LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Items not being enqueued

Solved!
Go to solution

I've got a relatively straightforward queued state machine with enum as my queue data type.   Everything has been going well for several days, but I made some minor changes yesterday (tried undoing, thought I covered everything) and now i've got a problem with enqueuing and dequeuing certain states.  My QSM runs through the first three states automatically.  It then enters another state upon user input, then returns to state three.  All of this happens correctly.  When I try to enter the "initialize interview" state, however, the queue seems to break.  Although an element seems to be added correctly (per the preview function), the consumer loop returns to the default state.  Additionally, this default state is the first state, which correctly queued an element and advanced to the next state during startup.  Initially, all references to the queue were by local variable for the queue, as shown on the right.  As a troubleshooting measure, I tried obtaining some of them by name.  This seems to help a little bit, but there are still some erratic outcomes. 

 

One other note:  If I restart labview, the QSM makes it past the "initialize interview" error, but hangs the next time the producer loop is activated, even though nothing more is enqueed.  As with the above scenario, the queue cannot be changed after the consumer loop returns to the default state, even though it appears to continue looping.  I'm attaching a picture of the obtain and enqueue functions where the problem originates.

0 Kudos
Message 1 of 5
(3,881 Views)

Way not enough information but a quick comment: the dequeue operation shouldn't be in an event structure.

 

Ben64

0 Kudos
Message 2 of 5
(3,870 Views)

You are previewing the queue, not reading from it meaning that you will NOT remove old values each iteration.

 

Replace the "Preview Queue" with "Read from Queue" and all should be OK.

0 Kudos
Message 3 of 5
(3,864 Views)
Solution
Accepted by topic author Brendan222

Hi Intaris,

 

A bit more info--the preview was just a troubleshooting measure to make sure that the item was being enqueued correctly.  My dequeue is attached below and is inside a while loop connected to a case structure.  I'm also included a capture of the type of enqueue that is being used inside the consumer loop to automatically advance as necessary.

 

Thanks,

Brendan

Download All
0 Kudos
Message 4 of 5
(3,853 Views)

OK, giving us little bits of your program whenever you feel fit isn't going to get us anywhere quickly.

 

Why don't you post your VI (and information regarding which LV version it's in) and we'll look further.  If you can't post it all, try to break it down.  Often, the problem becomes apparent when you try to get an example going for the forums.

 

My avatar isn't a rubber duck for nothing!

0 Kudos
Message 5 of 5
(3,847 Views)