LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

write to file at 1 sample per second with data acquisition at 40Hz

Solved!
Go to solution

Hello, everyone, I'm acquiring data using cRIO 9035 at 40Hz with the scan engine 5ms and 5 scans, the data is transferred to data reduction loop to be calibrated and written to file.There is no wait time in the data reduction loop, does it mean the rate of data being written to file depends on my data acquisition loop, which is 40Hz? So, I'll write 40 samples per second. Is there any way that I can write part of the data to file at 1Hz? I can use the average value or the last value, it's OK for me. Thank you. 

0 Kudos
Message 1 of 4
(2,615 Views)
Solution
Accepted by topic author Xiao@Gemini

The easy way: Use quotient and remainder on your loop iteration divided by 40. Wire the remainder to a case structure which defaults to do nothing. But, if the remainder is zero, then write to file.

 

The reusable way: create a functional global / action engine which accepts data as well as dt between logs. It will keep time on its own, and when the elapsed time is greater than dt, it should write to file. You could also have an input that tells it whether to write all data, average data, or last point to make it more flexible.

Message 2 of 4
(2,612 Views)

Thank you for the reply, the thing is part of the data will be written to file at 1Hz all time, the other part of the data can be written to file at either 1Hz (static test) which is default or 40Hz (dynamic test). The data acquisition is always 40Hz. I'm thinking of making 3 case structures (maybe 2) to handle each scenario. I'm a beginner to labview, may I have detailed explanation? Thank you very much. 

0 Kudos
Message 3 of 4
(2,591 Views)
Solution
Accepted by topic author Xiao@Gemini

You can capture all the data without writing all of the data every time you receive it. I would recommend looking into the producer consumer architecture so that writing the data does not effect your acquisition. However, to answer your original question of how to write the data once per second, you can do it in the following way. These two pictures are the same VI, just with different cases shown.

capture.png

Capture2.PNG

Message 4 of 4
(2,589 Views)