10-08-2024 10:36 AM - edited 10-08-2024 10:37 AM
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
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.
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.
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
10-08-2024 10:54 AM
10-08-2024 04:21 PM - edited 10-08-2024 04:25 PM
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.
10-09-2024 05:48 AM
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.
This didn't work though for PXIe-4309 ADC.
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.
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.
Thank you!