Dynamic Signal Acquisition

cancel
Showing results for 
Search instead for 
Did you mean: 

How to scale 32-bit signed integer data to floating-point voltage when acquring data in DAQmx by PXI4472?

I acquired data in DAQmx by PXI4472. For the high speed data logger, I used "DAQmx Read" to read unscaled 32-bit signed integer data.
Now, my question is how to scale 32-bit signed integer data to floating-point voltage?
I think that it's (20/(2**24))*I32 because the voltage range of PXI4472 is -10 to +10 and its resolution is 24 bits. But I cann't get correct voltage by that formula.
0 Kudos
Message 1 of 11
(12,455 Views)
hmqi2002,

You're very close! The correct equation for the 4472 is:

voltage = (20 / 2^32) * binaryI32

In this case, since we're using a 32 bit signed integer, you need to calculate 2^32 rather than 2^24. I think you'll see that this equation does the trick.


Regards,
Alan Loprete
Applications Engineer
National Instruments
Message 2 of 11
(12,446 Views)
While you could hard code the scaling factor, it will be more flexible if you retrieve the scaling coefficients from the driver. To do this, you need to use the Analog Input>>General Properties>>Advanced>>Device Scaling Coefficients>>Device Scaling Coefficients properties under the DAQmx Channel Property Node. Look at the documentation for this property to see how it can be used to create a polynomial equation for scaling to volts.

Since you are creating a data logging solution, you may want to consider using a compressed data stream from the driver instead of the I32 data type. This will allow you to read the data back as a stream of u8's instead. Since the PXI-4472 is 24 bits, you will only have to write 3 bytes to disk for each sample instead of 4. You can check out the following examples for how to create an application using this compressed data stream. It also shows how to use the scaling coefficients to transform the unscaled data back to voltage values.
0 Kudos
Message 3 of 11
(12,422 Views)
Thank Alan and reddog!
0 Kudos
Message 4 of 11
(12,416 Views)
Hi, i my test i had to use 20/(2^31)*I32 to scale 32-bit signed integer data to floating-point voltage (PCI-4472 in traditional DAQ). Does anybody can give me an explanation?
regards werner
0 Kudos
Message 5 of 11
(12,339 Views)
I got the same result in my test. Does anyone know the reason why the solution of 4472 is not 24 bits but 31 bits?
The Analog Input>>General Properties>>Advanced>>Device Scaling Coefficients>>Device Scaling Coefficients properties under the DAQmx Channel Property Node is about 9.31323e-9, and it's exactly equal to 20/(2^31).

帖子被hmqi2002在05-11-2005 12:36 AM时编辑过了

0 Kudos
Message 6 of 11
(12,329 Views)
The explanation is a little complicated, but it's due to how calibration on the board is performed. The calibration coefficients for the board are applied after the data has been acquired. Because of this, there is a 1 bit pad on the most significant bit for a potential rollover as you approach the end of the full scale range. This is why it is 2^31 instead of 2^32. This is also why I previously recommended using the scaling coefficients returned by the DAQmx driver so you don't have to worry about learning the intricacies and internals of how the device works. Also, using the scaling coefficients returned by the driver will allow you to write a generic program instead of hard coding the scaling for each device. With that said, the Traditional DAQ driver doesn't support reading of the scaling coefficients (at least to my knowledge). So if you've decided to use Traditional DAQ over DAQmx, you'll have to use the hard coded equation of scaled value = (20/2^31)*binary value instead.
0 Kudos
Message 7 of 11
(12,317 Views)
Red dog: Even though the scaling factor is 20/2^31, would I still expect the 4472 samples to take on at most 2^24 discrete values?

I assume that if I take an analog voltage value, I can invert the formula to get

integer = (analog voltage value)/20*2^31.

Does anyone know which 2^24 out of 2^31 integer values are allowed/used?

I ask because I am working on various lossless compression schemes...


Thanks very much ! This has been a really useful thread.

CW

Message Edited by cwierzynski on 06-17-2005 01:28 PM

0 Kudos
Message 8 of 11
(12,178 Views)
CW -

I noticed that you said you are working on a lossless compression scheme. Are you using DAQmx 7.4? The reason I ask is because DAQmx 7.4 already has implemented both lossless and lossy compression schemes. There are good examples of this at:
NI-DAQmx Professional Tools

You might also find this KB interesting.

What kind of aplication are you working on? Are you streaming data to disk? Across ethernet? Just curious....

-Jack
0 Kudos
Message 9 of 11
(12,172 Views)
Thanks Jack!

I am working on a high channel count (>100), relatively high-speed (25K-32KHz) acquistition system that needs to stream to disk for days at a time. Yes, that's TB of data. So If we can save 33% by storing 24 bits instead of 32-bit floats, that's a great savings!

Thanks again for the post.

And yes, we are streaming this over the network, to a networked storage server, in real-time. Did you have any network-specific tips? Right now our bottleneck is just hard drive space, not network or CPU. The next bottleneck is PCI bus speed on the acquiring computer....

CW
0 Kudos
Message 10 of 11
(12,061 Views)