LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Any tip for literature about queues in LabVIEW?

Hello!

We want to learn about queues in LabVIEW. But do not think that the help in LabVIEW says so much. So that is why I ask if anyone has a tip about how to learn about queues...

Thank you and best regards!
0 Kudos
Message 1 of 7
(3,467 Views)
Have you tried searching this site using "Queues tutorial" as the search term?
I remember several articles dealing with producer-consumerand and client-server architectures which also talk about queues. There are also examples in LV which can help you.

___________________
Try to take over the world!
0 Kudos
Message 2 of 7
(3,461 Views)
Here is a quick and simple example of using a queue for a state machine. State names are put into the queue, each loop dequeues the next state which is fed into the case structure to select the next state. Within each state case, the next state is enqueued. The loop repeats until the exit state is reached. Modify this example to add more states or change the order of states by enqueing different strings. Each string enqueued must match a particular case selection string. You can use queues with numbers or any data type. One use of a queue is to capture data. One loop can be continuously running, capturing data and putting the data into a queue. Another loop can dequeue each piece of data and process it. That way, you don't miss any incoming data while processing older data. The queue will build up with data for each enque, then decrease in size when the data is dequeued. The queue can hold several items at one time and normally operates on a first in first out basis. However, there is a function that allows you to enque at the head of the queue so that the next deque will pull out the latest item enqueued instead of the oldest. The queue can be limited in size or unlimited (as far as the memory will allow). Also a queue can be given a name so that several queues with different names can be used in one vi.
- tbob

Inventor of the WORM Global
0 Kudos
Message 3 of 7
(3,441 Views)
FRUSTRATION!!!!! GRRRRR!!! I forgot to attach the example. NI: MOVE THE ATTACH BUTTON !!!!
- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 7
(3,441 Views)
Thank you for your help! I will have a look at the attached VI 🙂

Thank you again and best regards.
0 Kudos
Message 5 of 7
(3,420 Views)
Hello again!
I could see very good in the attached VI what happens and I have a bit moore understanding now I think 🙂
Now I have another question about the queues. There is an output "timed out". What does this means? Is this when the queue is full and want to empty it? I have data into a queue and want to write the data in a chart. The data comes with a certain rate. So if one write the data on a chart , that is when one dequeue the data, does the enqueue runs at the same time so that one do not loose data? And when one set the "max queue size", does this means that when this number is reached, then we get a true on the "timed out" output? Hope you dont think I have stupid questions now!

Thank you and bet regards!
0 Kudos
Message 6 of 7
(3,414 Views)
Quoting from the LV help:
"If the queue is full, the function waits timeout in ms before timing out. If space becomes available in the queue during the wait, the function inserts the element and timed out? is FALSE...
timed out? is TRUE if space in the queue did not become available before the function timed out or if an error occurred."

That means that if the queue isn't full, the enqueue VI enqueues immediately. If the queue is full, the VI waits for the timeout, and if during that time no element was taken from the queue, it returns with the timed out output. The same is true for the dequeue functions when the queue is empty. The timeout affects enqueue ops when the queue is full and dequeue ops when it's empty.

A queue is used for synchronization. For example, if you have tasks happening at different rates or at different intervals. If you're getting the data faster than you're charting it, your queue will just get bigger and bigger. If not, you're fine. The best way to learn about the functionality is to play around with it some more and see how it works.

___________________
Try to take over the world!
0 Kudos
Message 7 of 7
(3,410 Views)