LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Create logfile from three vis - data is sometimes missing

Solved!
Go to solution

Hello,

i have three measurement-vis running parallel in a loop

The three results are continuously saved in  global-array and also in a text-file.

The global-arrays has always all data but in the text-file is some data missing.

I think this is because the file is locked from one vi while the other vi wants to write his data.

 

What can i do here?

Something like writing data in a queue and another vi reads the queue and writes the file?

Or is there something like a "check if file is in use"-property? Then i could loop until unused before executing write?

 

Thanks

0 Kudos
Message 1 of 6
(3,185 Views)

Try LabVIEW synchronization VIs. "Semaphores" would help you for prioritize the events.

You can find examples along with LabVIEW which will help in how to use it.

Step out of your comfort zone to experience the real you!
Message 2 of 6
(3,182 Views)
Solution
Accepted by OnlyOne

Yes, writing data to a queue is the perfect solution. Quick for the sender, the writer writes in it's own pace and no data missing.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 3 of 6
(3,174 Views)

I am not sure if using the semaphores would slow down my measuring.

If loop1 in the example would be my measure-vi1 and WriteToFile and If loop2 would be my measure-vi2 and WriteToFile .

Then loop2 is not exeuting while loop1 has locked the semaphore.

I can put the semaphore only around my WriteToFile-vi perhaps...

Or is this so fast that it will not be noticeable?

 

 

sema.jpg

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

Hi One,

 

use a queue to buffer all log data and just one additional loop that fetches the queue and writes to your text file.

Easy, fast, reliable…

Best regards,
GerdW


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

Sempaphores can slow down the measuring, as the loops will have to wait to get the semaphores, go with the queue. 🙂

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 6 of 6
(3,162 Views)