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.
Solved! Go to Solution.
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.
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.
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.