You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've noticed that when we're reading voltage values at the very limits of the device (in this case at 10.0V) the 16-bit int values that get written to the .ai file wrap around and become negative. Here's an example:
This did not occur in older versions of Imagine because we read the raw a/d converter values, which cannot go beyond the 16-bit int range. However in recent versions we switched to using the analog read function in the NIDAQmx API (see #31). This higher level function returns a floating point value that has been rescaled according to device-specific calibration, so it should be more accurate (reference). However it seems that this rescaled value is not precisely within the voltage range specified for the hardware. It's very close, but not quite. The calibrated values seem to go up to 10.00091V. This causes a problem when we rescale the double value to signed short in this line:
I've noticed that when we're reading voltage values at the very limits of the device (in this case at 10.0V) the 16-bit int values that get written to the
.ai
file wrap around and become negative. Here's an example:This did not occur in older versions of Imagine because we read the raw a/d converter values, which cannot go beyond the 16-bit int range. However in recent versions we switched to using the analog read function in the NIDAQmx API (see #31). This higher level function returns a floating point value that has been rescaled according to device-specific calibration, so it should be more accurate (reference). However it seems that this rescaled value is not precisely within the voltage range specified for the hardware. It's very close, but not quite. The calibrated values seem to go up to 10.00091V. This causes a problem when we rescale the
double
value tosigned short
in this line:https://github.com/HolyLab/Imagine/blob/waveform/Imagine/ai_thread.cpp#L105
If I am correct, I think we can fix it by truncating the value to be within the -10.0...10.0V range. Something like this should work:
The text was updated successfully, but these errors were encountered: