How to Estimate the Size of TDMS File Before Logging?

Updated Sep 27, 2022

Reported In

Software

  • LabVIEW Full

Driver

  • NI-DAQmx

Programming Language

  • LabVIEW G

Issue Details

I am using a DAQ hardware to acquire data and log it in TDMS format. I am using the "DAQmx Configure Logging.vi". How can I predict/estimate the size of the file I am going to log?

Solution

1. General TDMS file
Typically size of the TDMS file will depend on the following factors :
  • Data type
  • No. of channels
  • Time duration of logging
Estimate of size = (no. of bytes each data type consumes) X (no. of channels) X (number of samples)
For example, we are logging a double data type for 10 seconds in 4 channels. Since the bytes consumed by double data type is 8 then; estimate of size = 8 X 4 X 10 = 320 bytes.

2. TDMS files logged using "DAQmx Configure Logging.vi"
When we log using the "DAQmx Configure Logging.vi ", the size no longer depends on the data type but rather on the width of the ADC used on the hardware. 
Considering the above example, even though the data type is double, the "DAQmx Configure Logging.vi " causes the raw ADC output to be logged to the TDMS file. Lets assume the ADC width is 16 bits(2 bytes), In this case the estimation of size =  2 X 4 X 10 = 80 bytes

Note : The actual size of the TDMS file will always be slightly greater than the estimated size because of the additional meta data that is included in the TDMS files.

Additional Information

You could notice the increase in data compression when using the "DAQmx Configure Logging.vi". DAQmx Configure Logging VI allows users to configure writing data to a TDMS file within a single VI on the DAQ palette.  Not only does this make it simple to use and integrate into existing data acquisition applications, but with under the hood optimisations, it is the fastest way to write data to disk. For more information on this, refer to Log Multiple DAQmx Tasks in the Same TDMS File .