LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Converting DAQmx Scaled values to Unscaled in I32 resolution

Hello, I'm having a problem with solving quite specific DAQmx issue. Hopefully somebody faced similar problem and will be able to point me in good direction.

 

My RT application is continuously acquiring analog data from PXIe-6365 with DAQmx Read 2D I16 NChan NSamp (Unscaled) and buffering user specified timeframe.

To get a preview of what is getting measured I take 1 sample per second from each channel and convert it to Scaled Data with Polynomial Evaulation.vi 

Bakur_0-1728399758979.png

Data is written into TDMS file (only after user specified trigger condition occurs on selected number of signals) together with Device Scaling Coefficients taken from channel property node to minimize file size and memory usage of the controller.

Let's say user decides to trigger the measurement file on AI1 Rising Edge threshold 5V. As I'm operating in Unscaled domain, beforehand I have used DAQmx Compute Reverse Polynomial Coefficients.vi to calculate Reverse Device Scaling Coefficients and then I'm able to convert user specified 5V to unscaled value.

Bakur_1-1728400367483.png

This way I'm able to compare threshold value in unscaled units to the sampled input of PXIe-6365. (It's faster to convert threshold value once than 10kHz data stream).

 

Now, I'm trying to use my application with new device: PXIe-4309 which is up to 28bits. Automatically I have to use DAQmx Read 2D I32 NChan NSamp (Unscaled). I can get Device Scaling Coefficients the exact same way with property node. 

The problem appears when I'm trying to use DAQmx Compute Reverse Polynomial Coefficients.vi. First of all "number of points to compute within x range" is I32 value so it can't fit 2^32 value. Secondly though, the function throws memory allocation error straight away with (2^31)-1 value.

Bakur_2-1728401462991.png

Do you know any other solution to convert scaled value (5V) to unscaled in PXIe-4309 domain (taking into account that basic calculation like 5V/20V*2^32 doesn't take card calibration into account).

 

Thank you in advance,

Bakur

 

 

0 Kudos
Message 1 of 4
(134 Views)
Side question: Is recursion even allowed in RT?

"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 4
(115 Views)

When using DAQmx Compute Reverse Polynomial Coefficients VI, you don't have to input the number of points to be the same as the number of possible unique ADC codes*. Try attached VI.

*You may want to validate the scaling at all possible ADC codes (and then the unscaling) just to make sure the fit that DAQmx computes is good at every value you care about.

Doug
NI Sound and Vibration
Message 3 of 4
(77 Views)

Thanks Doug, that's a great tip that # of point doesn't have to be equal to number of ADC codes.

 

I noticed another thing. For the whole time when using Compute Reverse Polynomial Coefficients.vi I thought that Max Value X and Min Value X inputs should correspond to Max and Minimum Voltage of the channel as it was giving correct results for I16 ADC.

Bakur_2-1728469421704.png

This didn't work though for PXIe-4309 ADC.

Bakur_1-1728469396456.png

Then I realized that for reverse scaling X is ADC codes again (not Volts) so changing MinX and MaxX gave me correct value for PXIe-4309.

Bakur_6-1728470442158.png

 

It seems that I was just lucky enough that for I16 the MinX=-10 and MaxX=10 were giving same Polynomial Coeffs as MinX=-32768 and MaxX=32767.

Bakur_4-1728469652729.png

 

Thank you!

 

 

 

Download All
0 Kudos
Message 4 of 4
(50 Views)