LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

multiple while loops write to file

Solved!
Go to solution

hi!

I have a VI which collects data from different sensors (TC and ultrasound flow meters) at different rates (every 1000 ms for TC and every 50ms for flow meters). I placed the TC code in a while loop and the flow meters code in a second while loop running in parallel with the first one.

However, I would like to write all of the data into one lvm file using the express vi "write to measurement file" at the rate of the slowest instrument (every 1000 ms). How can I do that? I thought about using a third loop having the acquisition rate I want to use for the file and passing the data from the other loops with local variable but I'm worried about using local variables. Is there another way I can do?

Thank you in advance.

Valeria

0 Kudos
Message 1 of 6
(3,228 Views)
Solution
Accepted by Turillo

Hi Valeria,

 

using a 3rd loop is a good idea!

 

I would recommend notifiers to provide the latest reading of TC/flowmeter to your FileWrite-Loop…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 6
(3,225 Views)

ok....thanks, I'll try!

0 Kudos
Message 3 of 6
(3,212 Views)

I must miss something...I tried building the VI, it works with local variables but not with notifiers. I'm probably messing up with them since it's the first time I use them.

I attached the screenshot of my VI,  every time I run it it says that there's an input error on "release notifier".

Can someone help me?

Thanx!

0 Kudos
Message 4 of 6
(3,161 Views)

Use http://zone.ni.com/reference/en-XX/help/371361G-01/glang/wait_on_notification/ instead of wiring the double through to your writing loop. Your loop is now waiting for both of the producer loops to finish before it will execute due to data flow (LabVIEW is a data flow language!).

Look at the notifier examples that ship with LabVIEW.


CLA CTAChampionI'm attending the GLA Summit!
Subscribe to the Test Automation user group: UK Test Automation Group
0 Kudos
Message 5 of 6
(3,158 Views)

ok, thanks, now it works!

0 Kudos
Message 6 of 6
(3,117 Views)