LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Queue Not Working Properly?

Solved!
Go to solution

Hey guys so this is an interesting problem. I am using a queue to pass information from on VI to another. Both VIs are on the host computer. One VI (Data Viewer.vi) is getting information from a cRIO and displaying it on 4 charts and passing it to the other VI (Record.vi) to record it into a file. Here's where it gets weird though. The data comes from pressure sensors. When I increase the pressure the Data Viewer.vi shows the increase in pressure but the Record.vi never sees this increase however the record.vi is seeing information from the sensors. Any ideas of why this is? See attached pictures for more information. Thanks!

Download All
0 Kudos
Message 1 of 8
(3,503 Views)

You attached two meaningless pictures and a broken snippet. If you want us to help you, please attach simplified working VIs.

 

(What we can see are greedy loops and Rube Goldberg logic everywhere... 🐵

0 Kudos
Message 2 of 8
(3,502 Views)

As suggested by Altenbach, Please attach sample code/ Code Snippet.

Based on the  attached code i suggest you to go through  LabVIEW basics and working process of State Machine Architecture

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 3 of 8
(3,459 Views)

If you have to attach images, you might as well add them as images (safes us a few clicks):Data%20DifferenceQueue%20ElementsRecord_%5Btest%5Dd

 

 

0 Kudos
Message 4 of 8
(3,444 Views)

Here are the VIs. 

Download All
0 Kudos
Message 5 of 8
(3,424 Views)

There would be a ton of remarks to do. Picking one of the most important: apparently you would like to save while acquiring. However, as you did not wire False to Wait Until Done, running Record.vi will pause the acquisition. Record.vi will then process all data stored so far into the queue since the beginning of the acquisition, until the queue is empty: now Dequeue Element will wait forever (timeout is -1) for new data that will never come, so you will not be able to stop the loop and exit Record.

So why not to put Record management in the lower loop, calling the vi normally? Also, you should avoid infinite wait in dequeuing, managing the timed out? output properly.

Also remark that pacing the recording loop with Delay Timer is not useful, as the loop is already timed by either the data rate or the timeout you should choose for dequeuing (say 100 ms, as your acquisition loop is timed at 20 ms).

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
Message 6 of 8
(3,404 Views)

What do you mean when you say "So why not to put Record management in the lower loop, calling the vi normally?". Put Record management in lower loop of the Data View.vi?

0 Kudos
Message 7 of 8
(3,363 Views)
Solution
Accepted by topic author MikeIsMyName

Yes. Acquisition and recording will be managed in parallel. Remember that all data will be saved, also those taken before you press Record.

Also, you don't need to call Record.vi dynamically.

The loop in Record could be managed as follows (I removed some unnecessary code).

loop.png

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
Message 8 of 8
(3,343 Views)