LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TDMS digital data

Hello,

 

we are developing datalogging system for our customer and we need to save analog and digital data to TDMS file. There is probably no problem with analog data streaming. But on the other side writing digital data inside TDMS file looks like a problem... So we tried to use background streaming (DAQmx Logging) where size of file is acceptable (8xDI(1B) x 512samples + TDMS header). But we need to log analog and digital data with timestamp channel so we can not use DAQmx background streaming instead we must program our application. When we used TDMS write for digital waveform, digital data result in TDMS viewer and DIAdem is OK but file size is (8x1B for each digital channel). We also look at TDMS by DAQmx logging where internal file structure (attached file  tdms_tsdata.png) contains parameter NI_DigitalLine which is bit in data byte index (i think). Another parameter is NI_DataType = 5 (UInt8). From these two params I deduced some ideas and do some tests with unsatysfying results. Only one of tested ways was to write direct UInt8 of DI (entire port) to ensure file size ... 8xDI=1B x samples. However those TDMS can not be correctly read by TDMS Viewer as structure of digital inputs but only as number.

 

Is there any chance to write manually and effectively digital data in TDMS file (like DAQmx logging)?

 

Thank you in advance for any hint.

 

Michal.

0 Kudos
Message 1 of 6
(3,665 Views)

When logging digital data to TDMS files in LabVIEW using nomal TDMS nodes, instead of DAQmx + TDMS logging, TDMS will record down each digital value by 1 Byte, that's U8, instead of 1 Bit. Maybe that's the reason why you see the file size difference?

0 Kudos
Message 2 of 6
(3,634 Views)

Thank you for your reaction.

 

Yes, that is true. But the question is still there. Is it possible (somehow) to log data in format 8DI (8bits) in 1Byte like DAQmx TDMS logging?

 

Michal.

0 Kudos
Message 3 of 6
(3,608 Views)
Technically, yes, it's still possible, but you have to program by yourself. You need to convert the digital data values to some other data type and doing the similar thing when reading out from TDMS file, vice versa. For example, one digital data value is a boolean which is 1 byte for TDMS, you need to convert 8 digital values together to 1 byte (8 bits) then write to TDMS file.
0 Kudos
Message 4 of 6
(3,604 Views)

Yes. It is very easy way. Only read U8 array from DAQmx Read and write this array inside TDMS. But still one big problem remains and this problem is file format support in TDMS Viewer and DIAdem.

 

0 Kudos
Message 5 of 6
(3,600 Views)

Hi kel072,

 

You are right, you can not write just as one  byte and expect Diadem, or TDMS file viewer to interpret directly as 8 lines boolean data.

This is an expected behavior because there is no information about the number of lines.

Therefore, I have two suggestions:

1. You can build your custom TDMS file viewer (pack your data as u8 bit, transfer it into the TDMS file and later build your own VI that will read from TDMS, reconstruct the data in boolean 1D array and display the data). In this scenario, Diadem will still not be able to interpret them as 1 bit data.

2. Write your data to a binary file in the format you specify. Then you can read it directly in LV or any other programming language that supports that format, or you can build a data plugin for Diadem that will allow it to interpret the data in the particular way you want ( and use it for your application). This method requires the most programming but gives you the most flexibility (packing data, display in Diadem, display in LabVIEW etc).

 

Check the links bellow for more information on the data plugin:

 

1. http://www.ni.com/white-paper/13803/en/

2. http://www.ni.com/example/29822/en/

 

 

 

 

 

0 Kudos
Message 6 of 6
(3,510 Views)