LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Set numeric format u32 when writing TDMS file

Solved!
Go to solution

We are using the two counters of a PCI-6251, with both counters set to angular position mode, to measure the angular positions of two optical encoders 1000 every second for time intervals of 10 - 20 hours.  We are writing files using TDMS write.  The files are very large, approx. 800 MB, but that's acceptable.  We convert the TDMS files to .txt files, and then the data of the .txt files are analyzed in Mathematica.

 

My question is: how does one control the numeric format of data that are written in TDMS write?  Right now we have both counters set to produce N = 10000 samples of U32 numbers that are then streamed to a TDMS file every 10 seconds.  The counters are using units of ticks (integers) and we would like to see integers in our data files.  We are certain the counters are producing U32 formatted numbers because we see the correct U32 integers in indicators on the front panel and we see that the y-axis labels on our waveform graphs are integers, not real numbers. 

 

But we also see clearly that the TDMS write puts double precision (64-bit) floating point numbers in the TDMS file, not U32 numbers.  The double precision floating point numbers cause our .txt files to be twice as large as they need to be--these .txt files are half-filled with unnecessary zeroes and decimal points.  Also, when converting the U32 to double-precision reals, there seems to be a loss of precision as a result of the TDMS write, which is not acceptable.

 

 

Our experiment produces pairs of integers: in the U32 (or I32) format.  We could even get by with I16 numbers.  Is there any way to get our data to stay in U32 (or even I16) format when they are written to the TDMS file?  What controls the numeric format of numbers written to tdms?  Do all numbers written to a tdms file end up being written as double precision floating-point numbers?

 

We are using LabVIEW 8.2 on a PC running windows XP.

0 Kudos
Message 1 of 4
(3,829 Views)
Solution
Accepted by topic author jeff137

If you wire up TDMS Write with U32 data, data in the file will be U32. The conversion to floating point probably happens when you read data back from the file. You can change that by wiring an empty U32 array to the "data type" input of  TDMS Read.

 

You can double-check the data type in the file by looking at the channel properties in the TDMS File Viewer. If NI_DataType is 7, data in the file is U32. If it is 10, data is floating point.

 

Hope that helps,

Herbert

Message 2 of 4
(3,819 Views)

Ya as hebert told u can directly wire u32 data to tdms write and read the u32. while writing mention appropariate data type.

 

 

TDMS Write.JPG

Balaji PK (CLA)
Ever tried. Ever failed. No matter. Try again. Fail again. Fail better

Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.
Message 3 of 4
(3,815 Views)

Thank you Herbert and Baji.  I'm now producing 1 GB .txt files with two columns of U32 integers.  Contrary to what I expected, the .txt files are not that much smaller in U32 as opposed to DBL.

 

Herbert, you were correct in believing that it was my TDMS to .txt file write vi (a modified version of the TDMS to Excel vi from the LabVIEW library) that was converting U32 to DBL.  Once I connected an empty U32 array to the TDMS data type pin, the problem was solved.  As you suggested, I checked my TDMS write using the TDMS viewer to verify that NI_DataType was 7 for both columns, and indeed that was the case.

 

The help is much appreciated!

0 Kudos
Message 4 of 4
(3,785 Views)