From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Change the precision of waveform data or daqmx read

Solved!
Go to solution

Hi all,

 

I am currently using daqmx read and writing the data to a tdms fiile.  I would like to change the precision of the data if possible.

 

Any advice?

 

Thanks,

 

Matt



-Matt
0 Kudos
Message 1 of 9
(3,928 Views)

More information is needed here. What device are you using? Can you share your code? Your question could be pertaining to three different things.

 

  1. The analog input comes in as a DBL, which can support 15 digits of precision, so your data going through those wires can be that accurate.
  2. Your device has a rating for how accurate the signal is, so it can tell you what precision the data will actually come in as.
  3. Once you get to the writing to file part, you have to decide how you want the precision of the data on file. The TDMS Write takes in the data as a waveform, so you need to make the waveform data as accurate as you want. Since the data in a TDMS file is binary, the digits of precision on file are the maximum for the data type.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 2 of 9
(3,910 Views)

Hi James,

 

Im using an NI 9213 in my cDAQ0-9184.  Thermocouple themselves are only accurate within about 1 degree so i wanted to reduce the number of significant digits.  I was able to do this by getting the waveform data component and going from DBL to fractional string and then fractional string to DBL then building the waveform again.  I would assume there might be a cleaner way of doing this?

 

Thanks,

Matt



-Matt
0 Kudos
Message 3 of 9
(3,894 Views)

You want to avoid string operations most of the time because they're slow. Are you doing this just for display purposes? You want to see 98.1 degrees instead of 98.0845847?

If it's display purposes, then just change the way your numeric indicators display by editing the properties of the indicator.

 

If you're trying to save space on file, then there's not much you can do except for convert the data type. You could convert to a single precision float (SGL), which is half the size of a DBL.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 4 of 9
(3,888 Views)

James,

 

I was simply doing it for display purposes.  Its a little bit of false advertising to have 10 digits of precision in the file. HAHA.

 

I think ill just leave it as it. It is a thermocouple measurement program so the sampling time is going to be around 30 seconds, time isnt a huge concern. I also have it in the consumer loop.  But i dont want to be adding additional stress to the computer for really no reason.

 

Thanks again James,

 

Matt



-Matt
0 Kudos
Message 5 of 9
(3,834 Views)

James,

 

I did however have another question.  If i log data to a table indicator on my front panel, using a shift register to fill the table every data point, will this eventually become a burden on the CPU, and if so whats the largest table i should have on my front panel?

 

Thanks,

 

Matt



-Matt
0 Kudos
Message 6 of 9
(3,822 Views)
Solution
Accepted by topic author Wolleee

Conveying the right information in the data file is important. It's not a whole lot of overhead to limit your data to a specific precision if you do it as an array operation.

 

I'm not sure which is faster, the string precision method or this:

3DigPrecision.png

This took 1-2ms per 1 million iterations.

 

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 7 of 9
(3,816 Views)

@matt198717 wrote:

James,

 

I did however have another question.  If i log data to a table indicator on my front panel, using a shift register to fill the table every data point, will this eventually become a burden on the CPU, and if so whats the largest table i should have on my front panel?

 

Thanks,

 

Matt


Just saw that you asked another question. Yeah, your table will get bigger and bigger and is what we like to call a "memory leak". You can go pretty big and be fine, but it's really just a play-it-by-ear type of thing. Think about how your end user is going to need to see the data. If they onlyy need the last hour of data on the table, then cut it off at an hour of history. If they need the last day, maybe it can handle it, but you might want to look in to limiting what's displayed or something like that.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 8 of 9
(3,799 Views)

James,


The rounding example works perfect, thats a creative way to take care of that problem. I will also look into minimizing my data on the table.

 

Thanks again for the help,

 

Matt



-Matt
0 Kudos
Message 9 of 9
(3,788 Views)