LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sampling Rate

Hi,

 

I am relatively new to LabVIEW and I recently made a test application that continuously logs data but I do not think the code responsible for sampling data is written efficiently.  I am just using the low level Daqmx VIs.  When the program begins, the data waveforms look normal but as time goes on, I start to see gaps in my data (See Image).

 

Also, after I left the program running for a few days, the program stopped logging data and I got the following error message: "Error -200361: Onboard device memory overflow. Because of system and/or bus-bandwidth limitations, the driver could not read data from the device fast enough to keep up with the device throughput."

 

Any advice for sampling best practices is appreciated!

 

Thank you!

Download All
0 Kudos
Message 1 of 3
(1,838 Views)

Hi ANON,

 

after I left the program running for a few days, the program stopped logging data

Well, it is recommend to NOT open and close files with each iteration of a loop - as is done within WriteDelimitedFile!

Open the file once before the loop, write to the file inside the loop and close the file after the loop. Similar as you do with your DAQmx task…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 3
(1,833 Views)

You have coded the hardware to acquire 150 samples per sec but yet you are only reading 15 samples from the buffer at a time.  The "read" loop would have to run 10 time per second to keep up with the hardware.  As Gerd pointed out, you are opening and closing the spreadsheet during each iteration of the "read" loop, which is going to slow it down to the point where it can't keep up, causing the buffer overflow.  Now values will start to be overwritten in the buffer, creating gaps in your data. 

 

The solution, either move the write to file to a separate loop and ensure the "read" loop executes 10 times per second, or even better read all of the samples available in the buffer at once.  Do this by setting the number of samples to read from buffer to -1 (default). 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
Message 3 of 3
(1,799 Views)