User Tools

Site Tools


kb:labview:tdms

31 TDMS

TDM (Technical Data Management) is a data model and file format from National Instruments that defines how test and measurement data should be organized. TDMS (Technical Data Management Streaming) is a newer, more efficient file format that implements this model by storing both the data and descriptive metadata in a single, structured binary file.

Quick View

The in LabVIEW built-in TDMS File Viewer can be used to quickly have a look at .tdms files, without Excel or Diadem.

Flush

Think about usage of the TDMS Flush function instead of opening and closing the file constantly, depending on your usecase.

Attributes

Misc
Name Level Example Required? Description
datetime File no Start DateTime of the whole TDMS file
unit_string Channel no String representation of the channel unit
NI_ChannelName Channel “temp_1” no the name that appears in the plot legend of a LabVIEW chart/graph
Standard Waveform Property Names [1]
Name Level Example Required? Description
wf_xname Channel Time yes Name of the x-axis quantity
wf_xunit_string Channel s yes Unit of the x-axis quantity
wf_start_offset Channel 0 yes Start offset value of the x-axis
wf_increment Channel 0.001 yes Increment value of the x-axis
wf_start_time Channel no Start DateTime value of the time axis
wf_samples Channel 1000 yes Number of values of the x-axis
XY Channel Relationships [2]
Name Level Example Required? Description
wf_xcolumns Group “one” no the first channel in that group is the time channel
xchannel Group “Time” no name of the time channel in that channel group
Properties to Improve Loading Speed in NI DIAdem
Name Level Example Required? Description
minimum Channel -3.14 no The minimum value of the channel
maximum Channel 3.14 no The maximum value of the channel
monotony Channel Not monotone no If the channel is monotone rising or falling
novaluekey Channel No no If any NaN values are in the channel

[1] Note that the property names are case-sensitive and must be in lowercase. The wf_xname and wf_xunit_string properties are not set by default in NI LabVIEW— you need to add those properties yourself to every waveform channel in the TDMS file.

[2] See “Non-Equidistant Data” below.


Non-Equidistant Data

Acquired data channels must have associated timing information. For constant sampling rates (equidistant samples), timing information is contained implicitly via t0 and dt. For non-equidistant samples (acquired in a non-deterministic way or without constant sampling rate), timing information must be provided explicitly.

The clearest and simplest approach is to always have only one explicit time channel inside each channel group and to always position the explicit time channel as the first channel in that channel group. This leads to two common cases: one explicit time channel plus one acquired data channel in each channel group (XY) or one explicit time channel plus multiple acquired data channels in each channel group (XYYY).
If you adopt this suggestion to have only one time channel in each channel group, then you should set the wf_xcolumns property on the channel group level to have the value “one”, which will tell all NI software that the first channel in that group is the time channel. If for some reason your time channel is not first, you can set the xchannel property on the channel group level and fill it with the name of the time channel in that channel group.
TDMS files offer a native datetime data type for both properties and data channels. When you save datetime information, make sure to always use the built-in datetime option. Writing a numeric value of elapsed seconds is not sufficient to record a datetime, because different applications that write and read TDMS files have different conventions for the starting datetime value and even the increment metric (seconds as opposed to days). For NI LabVIEW programs, you should always wire a brown datetime wire directly to the property value or channel data input.

(Source: http://www.ni.com/white-paper/14252/en/)


Test of TDMS write performance

All test are executed with the LV2016 project “TDMS-Perf-Test” from the GitLab repo https://code.hampel-soft.com/hse-labs/proofs-of-concepts.

Windows

Tested in a Win 7 VM (2 cores, 6GB RAM, SSD) on a Dell XPS13 notebook.

Conditions: TDMS Write data layout: decimated, TDMS Flush after every write. Runtime 2 minutes.

Block size Block rate (ms) # Channels kBytes per block Ø Write time (s) Ø Write rate (kB/s) File size (kB) Index size (kB)
100 100 16 12,50 0,043 109 7.491 4
250 250 16 31,25 0,047 740 7.488 4
500 500 16 62,50 0,046 1.534 7.504 4
1000 1000 16 125,0 0,053 2.636 7.504 4

Linux RT

Tested with a cRIO 9030 (firmware version 4.0).

Conditions: TDMS Write data layout: decimated. Runtime 2 minutes.

Block size Block rate (ms) # Channels kBytes per block Ø Write time (s) Ø Write rate (kB/s) File size (kB) Index size (kB)
100 100 16 12,50 0,002 6.059 7.404 4
250 250 16 31,25 0,002 14.314 7.457 4
500 500 16 62,50 0,002 26.886 7.473 4
1000 1000 16 125,0 0,003 49.591 7.504 4

Conditions: TDMS Write data layout: decimated, TDMS Flush after every write. Runtime 2 minutes.

Block size Block rate (ms) # Channels kBytes per block Ø Write time (s) Ø Write rate (kB/s) File size (kB) Index size (kB)
100 100 16 12,50 0,015 946 7.404 4
250 250 16 31,25 0,018 2.179 7.457 4
500 500 16 62,50 0,017 4.143 7.473 4
1000 1000 16 125,0 0,019 7.614 7.566 4

Conditions: TDMS Write data layout: decimated. Runtime 2 minutes.

Block size Block rate (ms) # Channels kBytes per block Ø Write time (s) Ø Write rate (kB/s) File size (kB) Index size (kB)
100 25 24 18,75 0,003 6.523 41.556 6
250 25 24 46,875 0,003 15.927 103.646 6
500 25 24 93,75 0,003 30.003 206.393 4
1000 25 24 187,5 0,005 55.502 407.912 4

Other Resources

Consider the precision and drift of your data sources when storing into TDMS.

kb/labview/tdms.txt · Last modified: 2026/06/19 08:01 by joerg.hampel