LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

queue question

Solved!
Go to solution

Hello All,

 

one question regarding queue and while loop...

There is dequeue element in while loop. My opinion is that while loop should run constantly, but instead while loop doesn't run, only if i press start test.

Please check in attachment.

Can someone please give me explanation?

 

Thanks 

0 Kudos
Message 1 of 4
(767 Views)
Solution
Accepted by topic author milan87

Hi milan,

 

I guess there is no timeout given for the Dequeue function: it will wait until there is an element in the queue to be read!

 

The observed behaviour is following the "THINK DATAFLOW!" mantra…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 4
(738 Views)

You did not wire any timeout value to the Dequeue Element function, so it's stuck waiting forever until you enqueue an element in the other while loop.

I understand that this is only a skeleton of a program, however causing the lower loop to run by enqueing the very same element does not seem the right choice to do. One possible improvement is to structure the lower loop as a state machine and only use the queue to make the state shift from "waiting" to "executing test A" or "executing test B" and so on. Also, explore the possibility to use a Typedef Enum instead of a string to define the possible states.

I guess you should still go through some LabVIEW tutorial to familiarize with LV coding.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 3 of 4
(730 Views)

Thank you both.

 

0 Kudos
Message 4 of 4
(721 Views)