From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Enqueuing Data from the same source to two different Queues

Solved!
Go to solution

I added a modified version of the FFT Analysis subvi.
Even when I activate the highlight execution mode I see nothing chaning, meanwhile the Data Acquisition loop works very fine by applying the same programming structure I am applying in the FFT analysis SubVi.

0 Kudos
Message 11 of 16
(392 Views)

The two Dequeue nodes in the FFT consumer loop are blocking, since you wired no timeout.

This means that you can dequeue data only if some message is received from the FFT Analysis queue.

If the "Apply FFT" is the only message received, the loop will dequeue acquired data only one time.

You should instead input a timeout value >= 0 and manage the timed out? output accordingly.

I would put a null timeout for the FFT Analysis queue - so that it does not limit the acquisition rate.

For the other queue, a proper value could be slightly less than the acquisition period.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 12 of 16
(383 Views)

@pincpanter  ha scritto:

For the other queue, a proper value could be slightly less than the acquisition period.


Well I meant slightly more than the acquisition period. Unless this period is "long": I would avoid a timeout greater than some tenths of second.

The key point is avoid stealing too much execution time to the other loops, while keeping the loop quickly responsive to the messages queue.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 13 of 16
(368 Views)

Thanks for your response.
Could you please refer me to a source where I could find out more about that timeout implementation or explain to me, because I am not quite sure what to do there or how this timeout could influence the data flow and solve my problem. 

0 Kudos
Message 14 of 16
(364 Views)
Solution
Accepted by topic author Amr95

The LabVIEW help should be enough. Right-click the node and select Help from the context menu.

Quoting the help text:

 

timeout in ms specifies the time, in milliseconds, that the function waits for an element to become available in the queue if the queue is empty. The default is –1, indicating never to time out.
If the function waits timeout in ms and the queue remains empty, timed out? is TRUE.

 

Let's suppose you wire a constant = 100 to the timeout input terminal. The Dequeue function waits an element for a maximum of 100 ms. As soon as an element is available, the function exits and returns that element; timed out? will be FALSE.

If no element is available within 100 ms, the function exits returning the default value of the data type; timed out? will be TRUE.

You should build the array only if timed out? is FALSE.

 

On the other side, if you wire nothing to the timeout input terminal (or wire -1), the function will wait until a new element is available.

This means that the loop is stuck if the message queue is empty. A stuck loop will not build the data array.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
Message 15 of 16
(356 Views)

Oh perfect now I get what you mean, thanks alot!
will try it out and see if it solves my problem

0 Kudos
Message 16 of 16
(351 Views)