nidas v1.2.3
|
A2DConverter for applying a linear conversion to A2D counts values. More...
#include <A2DConverter.h>
Public Member Functions | |
LinearA2DConverter (int nchan) | |
~LinearA2DConverter () | |
float | convert (int ichan, float counts) const |
Convert a count to a floating point value. | |
void | set (int ichan, const float *d, int nd) |
Set the initial linear conversion for a channel. | |
void | get (int ichan, float *d, int nd) const |
void | setNAN (int ichan) |
void | setNAN () |
int | getMaxNumChannels () const |
Maximum possible number of channels. | |
int | getNumConfigChannels () const |
One plus the index of the last active channel. | |
int | getGain (int ichan) const |
Gain of each channel. | |
void | setGain (int ichan, int val) |
int | getBipolar (int ichan) const |
void | setBipolar (int ichan, int val) |
void | readCalFile (CalFile *cf, dsm_time_t tt) |
Read records from a CalFile for calibration coefficients with time tags less than or equal to tt, assuming they are in increasingg order in the file. | |
Protected Attributes | |
int | _maxNumChannels |
How many channels on the A2D. | |
int | _numConfigChannels |
A configured channel has a gain > 0. | |
int | _ncoefs |
Number of coefficients in the conversion. | |
int * | _gain |
Gain setting of each channel. | |
int * | _bipolar |
Polarity setting, 1=bi-polar. | |
Private Member Functions | |
LinearA2DConverter (const LinearA2DConverter &x) | |
No copy. | |
LinearA2DConverter & | operator= (const LinearA2DConverter &x) |
No assign. | |
Private Attributes | |
float * | _b |
Conversion intercepts for each channel. | |
float * | _mx |
Conversion slopes for each channel. | |
A2DConverter for applying a linear conversion to A2D counts values.
LinearA2DConverter::LinearA2DConverter | ( | int | nchan | ) |
References _b, _mx, and nidas::core::getSample().
|
private |
No copy.
Convert a count to a floating point value.
Implements nidas::core::A2DConverter.
References _b, nidas::core::A2DConverter::_maxNumChannels, _mx, and nidas::core::getSample().
Implements nidas::core::A2DConverter.
References _b, nidas::core::A2DConverter::_maxNumChannels, _mx, and nidas::core::getSample().
References nidas::core::A2DConverter::_bipolar, nidas::core::A2DConverter::_maxNumChannels, and nidas::core::getSample().
Referenced by nidas::dynld::raf::A2D_Serial::getBipolar().
Gain of each channel.
An A2DConverter needs to know the gain and bipolarity because it reads the cal file and there are typically cal records for each gain and polarity.
References nidas::core::A2DConverter::_gain, nidas::core::A2DConverter::_maxNumChannels, and nidas::core::getSample().
Referenced by nidas::dynld::raf::A2D_Serial::getGain().
|
inlineinherited |
Maximum possible number of channels.
References nidas::core::A2DConverter::_maxNumChannels.
|
inlineinherited |
One plus the index of the last active channel.
An active channel has a gain > 0.
References nidas::core::A2DConverter::_numConfigChannels.
Referenced by nidas::core::A2DConverter::readCalFile().
|
private |
No assign.
|
inherited |
Read records from a CalFile for calibration coefficients with time tags less than or equal to tt, assuming they are in increasingg order in the file.
Each record has a gain and bipolar value after the time, followed by coefficients for each channel.
A calibration record is used for a channel if its gain and bipolar fields match the values for the configured channel. A gain value of -1 in the file is a wildcard, matching any configured gain for a channel, and likewise for the bipolar value.
readCalFile() expects there to be getNumConfigChannels() X _ncoefs number of coefficients after the time, gain and bipolar fields in each CalFile record. If there are less than the expected number, a warning is logged, and missing coefficients are set to floatNAN.
EOFException, IOException, ParseException
References nidas::core::A2DConverter::_bipolar, nidas::core::A2DConverter::_gain, nidas::core::A2DConverter::_ncoefs, nidas::core::A2DConverter::getNumConfigChannels(), nidas::core::getSample(), LOG_WARNING, nidas::core::A2DConverter::set(), and nidas::core::A2DConverter::setNAN().
Referenced by nidas::dynld::raf::A2D_Serial::process().
Set the initial linear conversion for a channel.
Implements nidas::core::A2DConverter.
References _b, nidas::core::A2DConverter::_maxNumChannels, _mx, and nidas::core::getSample().
References nidas::core::A2DConverter::_gain, nidas::core::A2DConverter::_maxNumChannels, nidas::core::A2DConverter::_numConfigChannels, and nidas::core::getSample().
Referenced by nidas::dynld::DSC_A2DSensor::validate(), nidas::dynld::raf::A2D_Serial::validate(), and nidas::dynld::raf::DSMAnalogSensor::validate().
|
virtual |
Implements nidas::core::A2DConverter.
References nidas::core::A2DConverter::_maxNumChannels, and setNAN().
Referenced by setNAN().
Implements nidas::core::A2DConverter.
References _b, _mx, nidas::core::floatNAN, and nidas::core::getSample().
|
private |
Conversion intercepts for each channel.
Referenced by convert(), get(), LinearA2DConverter(), set(), setNAN(), and ~LinearA2DConverter().
|
protectedinherited |
Polarity setting, 1=bi-polar.
e.g -5 to 5V, 0=unipolar, e.g. 0 to 5V, -1 for an unused channel.
Referenced by nidas::core::A2DConverter::A2DConverter(), nidas::core::A2DConverter::getBipolar(), nidas::core::A2DConverter::readCalFile(), nidas::core::A2DConverter::setBipolar(), and nidas::core::A2DConverter::~A2DConverter().
|
protectedinherited |
Gain setting of each channel.
0 for an unused channel.
Referenced by nidas::core::A2DConverter::A2DConverter(), nidas::core::A2DConverter::getGain(), nidas::core::A2DConverter::readCalFile(), nidas::core::A2DConverter::setGain(), and nidas::core::A2DConverter::~A2DConverter().
|
protectedinherited |
How many channels on the A2D.
Set in constructor.
Referenced by convert(), get(), nidas::core::PolyA2DConverter::get(), nidas::core::A2DConverter::getBipolar(), nidas::core::A2DConverter::getGain(), nidas::core::A2DConverter::getMaxNumChannels(), nidas::core::PolyA2DConverter::PolyA2DConverter(), set(), nidas::core::PolyA2DConverter::set(), nidas::core::A2DConverter::setBipolar(), nidas::core::A2DConverter::setGain(), setNAN(), nidas::core::PolyA2DConverter::setNAN(), and nidas::core::PolyA2DConverter::~PolyA2DConverter().
|
private |
Conversion slopes for each channel.
Referenced by convert(), get(), LinearA2DConverter(), set(), setNAN(), and ~LinearA2DConverter().
|
protectedinherited |
Number of coefficients in the conversion.
Referenced by nidas::core::PolyA2DConverter::convert(), nidas::core::PolyA2DConverter::get(), nidas::core::PolyA2DConverter::PolyA2DConverter(), nidas::core::A2DConverter::readCalFile(), nidas::core::PolyA2DConverter::set(), and nidas::core::PolyA2DConverter::setNAN().
|
protectedinherited |
A configured channel has a gain > 0.
The number of configured channels is the index of the last configured channel plus one.
Referenced by nidas::core::A2DConverter::getNumConfigChannels(), and nidas::core::A2DConverter::setGain().