10-29-2025 10:45 AM - edited 10-29-2025 10:48 AM
Hi all,
My current project requires me to read measurement data from load cells and thermocouples, record the data, and use the load cell data in a control loop to change a motor's output. So far I am successful in gathering all of the data into an array and writing it to a file. The problem is that since the data is being acquired so quickly (continuous samples from a NI 9237 and NI 9210), the file being recorded to has more data than it really needs to have. Data is being acquired on the millisecond level, and I only need to record measurements on the level of once every 60 seconds.
For context, this program is for a setup that will be logging data for exactly 1000 hours, and displayed on a logarithmic time scale, so data logging at this speed is unnecessary.
I do not want to slow down the acquisition rate, as it would be a headache in it of itself to mess around with sample rates and buffering of my hardware, and the load cell force data is to be used in the PID control of a motor. All I want to do is decrease the rate that data is put into the measurement file's array.
I tried using the "Elapsed Time" function but I couldn't get it to work.
How can I implement a system that only allows for the building of an array (adding elements) on a specified time interval? Is that even the best way to go about it? Is there another way that involves writing to the measurement file in a loop? This one is a real head scratcher for me. Thank you in advance!!
the "build array" with 5 orange inputs on the left side is the one in question
10-29-2025 12:17 PM - edited 10-29-2025 12:17 PM
1.Obtain Queue had different datatype but you are enqueuing different datatype
2.You have to create a logic to build array whenever elapsed timer is On and you have to reinitiate the start time again.
3. The Data you are adding to the queue is not dequeued.
Store data once for every 60 seconds.
10-29-2025 12:23 PM - edited 10-29-2025 12:32 PM
I cannot look at your VI (only LabVIEW 2020 here), but your picture raises many red flags.
10-29-2025 01:12 PM
Thank you for your reply and comments, this is my first large-scale project after learning the basics and there is much I have to learn.
I'm sorry if I'm asking too many questions at once, I just figure that specific questions are needed for good answers and I want to learn as much as I can. Thank you again.
10-30-2025 05:28 AM
@powerpan4 wrote:
Thank you for your reply and comments, this is my first large-scale project after learning the basics and there is much I have to learn.
- I was unaware of the possible memory issues involved with the growing shift registers. What other ways could I add the data into an array that isn't so memory intensive? Or is there a more efficient route in general rather than shoving it all into an array.
Even Array will have the same impact (You can use Logging Module, which writes to file every 60 sec . Use Queues to transfer data from Data Acq Module to Logging Module)
10-30-2025 07:55 PM
Hello, PowerPan4.
Is this an accurate restatement of your basic question: "I am collecting data from multiple channels at 1000 Hz (which I use to do something). I would like to save a sub-set of these data, namely write one data point every 60 seconds to a files (along with a corresponding TimeStamp)."
If this is your goal, and the underlying question is "How to I save a "sub-sample" of sampled data to a data file", here is a method that I've successfully used:
Note that the Consumer gets called at 1 Hz (or once/second), but does trivial processing for 59 of its calls and does file I/O in the final second, which requires opening a file, finding its end, and appending to the end, which probably takes a few milliseconds, at most.
Bob Schor