How To: Reduce Memory Consumption in LabVIEW Data Acquisition Applications

Acquiring and/or logging high speed data, using the traditional DAQmx scaling approach, will consume considerable amounts of memory due to its use of the double precision data type. Each sample collected will consume eight bytes of memory whether being stored in memory or on disk. This size is fine when collecting data at lower rates, but if you are collecting data at a rate of 1 MS/s, eight bytes per sample is too much for most systems to handle.

As an alternative to collecting scaled data via DAQmx, an application can collect DAQmx data as raw values and utilize TDMS data scaling capabilities. This effectively stores the scaling information alongside the raw data values in the TDMS log file; the data is then presented as scaled values when viewed using National Instruments DIAdem or the TDMS file viewer in LabVIEW. Depending on the resolution of your DAQ card, this could reduce your memory consumption by up to 75%. Download our example file and execute using LabVIEW.  (Editors note: Use this Download for LV2015 version.)

The downloadable example demonstrates disk usage when logging data in scaled versus raw mode. To use the example, first set the scale type to raw or scaled.  Next set the sample rate, length of time to acquire data and the desired channels.  Finally run the application and take note of the file size.

Industry Example: An actual application created by DISTek for our customers needed to acquire data on 16 channels at 1MS/s holding a 3 second buffer in memory. The application also needed to trigger a 6 second log of data on a DAQ event, using the 3 second buffer and 3 seconds of post trigger data. Due to the high data rate, raw data values needed to be used in order to reduce the amount of memory consumption in the application.

Industry Example Memory Usage Calculations:

DBL (DAQmx Scaled)

Bits of Storage on Disk: 64

Buffer Memory Usage: 16 channels * 1MS/s * 8 bytes/sample * 3 sec = 384 MB

Disk Memory Usage per Log: 16 channels * 1MS/s * 8 bytes/sample * 6 sec = 768 MB

Log File Size: 750 MB

 

I16 (Unscaled)

Bits of Storage on Disk: 16

Buffer Memory Usage: 16 channels * 1MS/s * 2 bytes/sample * 3 sec = 96 MB

Disk Memory Usage per Log: 16 channels * 1MS/s * 2 bytes/sample * 6 sec = 192 MB

Log File Size: 187 MB

Depending on the hardware and accuracy requirements, switching from scaled to raw acquisition mode can save significant memory and disk space while having minimal effects on the actual data.

Share this post with your friends.........
Facebooktwitterredditpinterestlinkedinmail

Follow DISTek......
Facebooktwitterlinkedinyoutube

2 thoughts on “How To: Reduce Memory Consumption in LabVIEW Data Acquisition Applications

    1. Hey, thanks for the comment and suggestion, Ajay. We created a LV2015 VI and posted it in the blog. Thanks for reading and following our blog.

Comments are closed.