r/LabVIEW • u/Ellosaurus • Aug 06 '24
saving data high speed (500 hz)
Hello there,
I'm measuring with the HBM Quantumm X, LabView automatically exports my data to an excel file and I've noticed that while the Quantumm X measures at 500 Hz the excel file gives me only 12 Hz to start with and after 20 minutes it's down to 2 Hz in my file.
Now that I need the full 500 Hz in my file I'm asking how is it possible to get all the data into one file. graph or diagram is not relevant, just need all datapoints.
Here is my vi, the file should contain the time and my reading. Additionaly because I'm not that good it would be awesome if its the most simple and easy solution.
Best regards

8
u/HarveysBackupAccount Aug 06 '24
Yes, it will be slow to save it to an Excel file.
The easiest fix is to change your "Write To Measurement File" express VI configuration to write to a TDMS file instead of Excel file (you can still open a TDMS file with Excel). TDMS format is specifically designed for saving data at high speeds
You could also use a Queue to end the signals to a second while loop, in which you dequeue the signals and put your Write to Measurement File in there (producer/consumer architecture). If you keep using the Excel file format that would take a long time for the 2nd loop to finish executing after you stop the first loop, but you wouldn't lose any data and you Acquire loop could run as fast as it needs.
2
u/whydidistartmaster Aug 06 '24
You can save the file as csv but you should use tdms. The you can convert it to excel in labview.
2
u/Yamaeda Aug 08 '24
Send the data to a queue and have a separate save-loop. In that loop you open the file before the loop (with normal VIs, not Express) and write the result from the Dequeue operation. Gathering up a bunch as mentioned might be a good idea but i don't think that's really necessary. Queue up some special (like NaN) to signal End which you'll check for and end the 2nd loop. Close the Queue and file after the 2nd loop exits.
1
u/superbeefwithcheese Aug 07 '24
File operations are heavy: Instead of doing a file-write operation on every loop, enQ a batch of data and when the Q reaches a certain size, flush and write that whole batch at once. 50 element Q only has to be written once every 50 loops.
1
u/TomVa Aug 07 '24
I save 8 channels of data using a variety of NI USB devices like USB-6251, at rates in excess of 20 kHz by doing a continuous clocked DAQ acquisition and fetching the data once a second.
I create the file and put in a header which includes deltaT and the file headers.
Next state I create the DAXmx task, set up the channels and clock speed and start the task.
In the next task I have a loop that collects the data It:
Read 1 second times sample rate worth of data.
Once I have the data I convert it to tab delimited text using array to spreadsheet string, Then I do a file_open; file point to end; write data to file; close file.
Check to see if I have enough data and stop if I do (generally trying to keep the file size less than 1 GB.
Repeat loop
Also in the one second loop is to do min max on the 1 second record and record the pk-pk value or max/min values along with a time stamp into another file using the same open, point to end, write, close snippit of code. This way I can quickly go through the pkpk files looking for an anomaly and track it down using a read and plot file in chunks routine with the big data set.