LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why does queue not update?

Solved!
Go to solution

I'm using a queue to pass data between two state machines that operate two tabs on a tabbed dialog. Data on the setup tab is supposed to be placed on the queue in one state machine and retrieved by the second state machine.

 

When run, the queue always returns the initial data that I used to set up the queue.

 

I worked from the Queue Basics vi, modifying the data type and the queue length.

 

I went back to that example and made the same modifications and it worked ok. The only difference then is the use of state machines instead of simple while loops.

 

I have attached an image of the two state machines linked by the queue.

 

 

 

 

Peter Cusack
Control Engineer
CSIRO Materials Science and Engineering
LV 7.1, VB6 & Notepad++
0 Kudos
Message 1 of 15
(4,218 Views)

Do you have any wires from the left hand loop to the right that aren't showing in the picture? How are you determining that nothing is popped off the queue? Is the state required to write the values to the queue in the left loop being met?

 

 

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 2 of 15
(4,212 Views)

Debugging from screen shots is typically difficult - it's even more so when we don't get to see the entire block diagram.

 

Can you post the code itself?

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 3 of 15
(4,205 Views)

Thanks for picking this up Putnam.

 

The loops are entirely independent, that was the point of the queue. I have highlighted the execution and watched the values being popped off the queue. When the data on the setup tab are modified, the modified values are bundled and the bundle is placed on the queue, but the bundle that is popped is always the initial one.

 

I have a work around for now as you can see using local variables to pass the data, and the queue simply synchronises the two loops.

 

Cheers;

 

Peter.

Peter Cusack
Control Engineer
CSIRO Materials Science and Engineering
LV 7.1, VB6 & Notepad++
0 Kudos
Message 4 of 15
(4,204 Views)

Thanks Mike. I was hoping It would be something in the way that I had set up the queues or handled the data afterwards.  I*could* post the code, but a quick count has it at about 14MB most of it runs fine, just not the queue.

 

I have just had another hack at the Queues example, changing the top left and top right loops to state machines, and it still runs.

 

Cheers;

 

peter.

Peter Cusack
Control Engineer
CSIRO Materials Science and Engineering
LV 7.1, VB6 & Notepad++
0 Kudos
Message 5 of 15
(4,202 Views)

Just like Mike told, there is very little that anyone can suggest from the image that you have posted. The portion that you have posted looks perfect to me provided the data that you are passing to the queue is correct.

 

You might have done this already but just to confirm... have you verified (by placing probe to the 'element' input of the Enqueue VI) that the data that you are bundling and writing is different from the initial setup values?

 

Is there any other place in your code where you are  writing to this queue?

 

Is the Dequeue VI giving any error?

 

Also, why did you limit your queue size to one?

Message Edited by kikiduu on 02-09-2009 12:57 AM
------

"A VI inside a Class is worth hundreds in the bush"
യവന്‍ പുലിയാണു കേട്ടാ!!!
0 Kudos
Message 6 of 15
(4,176 Views)

Peter Cusack wrote:

When the data on the setup tab are modified, the modified values are bundled and the bundle is placed on the queue, but the bundle that is popped is always the initial one.

 

...

 

Peter.


That looks like the 'Get queue element' times out, in that event the default value of the queue is returned.

 

Check for 'Timed Out?' output.

Now if it times out you have a whole other problem.

 

Had a second look at your code, and you didn't connected  time out so that won't happen.

 

However you have a sized queueu of length 1. What if the second (read) loop doesn't finish and don't clear the queue fast enough? Then the write loop will be locked.

 

Using a sized queue without a timeout on the write part is a bad move.

For a single sized queue I would recommend a notifier.

 

Ton

 

 

Ton

Message Edited by TonP on 02-09-2009 01:58 PM
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 7 of 15
(4,154 Views)
Solution
Accepted by topic author Peter Cusack

Thanks for the insights guys. I was prompted to try some things that couldn't make any difference, and one did.

 

I changed the way that the Queue is initiated to use  a Bundle by Name that was initiated with Constants, rather than to use a Bundle Constant.Interestingly, the prototype for the Bundle by Name, which is required, is a Bundle Constant.

 

The pathology seems to be that if the Queue is initialised with a Bundle Constant, then it passes a Bundle Constant. The attempt to change the fields in the Bundle Constant by using a Bundle by Name fail without generating an error and the Queue passes on the Bundle Constant.

 

I have attached an image for those who can tell what a program written in a graphical language does by looking at it.

 

Cheers;

 

Peter.

Peter Cusack
Control Engineer
CSIRO Materials Science and Engineering
LV 7.1, VB6 & Notepad++
0 Kudos
Message 8 of 15
(4,106 Views)

Thanks kikiduu.

 

I limited the size of the queue to 1 element because I only want the Monitor loop to use the last set of setup values.If theMonitor loop was behind the Setup loop by say 10 values, then the user would have lost touch with the process. I could, with the insight that this gives, used a Notifier instead of a Queue.

 

Thanks again to everyone.

 

Cheers;

 

Peter.

Peter Cusack
Control Engineer
CSIRO Materials Science and Engineering
LV 7.1, VB6 & Notepad++
0 Kudos
Message 9 of 15
(4,104 Views)

I only have a couple of years experience. Something I caught on to is that the examples have a lot of legacy in them. They are ok for learning a concept, but aren't always good for using for your development architecture. Techniques have advanced a lot since some of those examples were written. You would be better off using one of the templates and expanding it using the tips you find from the veterns on this board. I played around with that example and wouldn't use it as a basis for a ground up program.

0 Kudos
Message 10 of 15
(4,086 Views)