nidas v1.2.3
|
A2DConverter for applying a polynomial conversion to A2D counts values. More...
#include <A2DConverter.h>
Public Member Functions | |
PolyA2DConverter (int nchan, int ncoefs) | |
~PolyA2DConverter () | |
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 polynomial 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 | |
PolyA2DConverter (const PolyA2DConverter &x) | |
No copy. | |
PolyA2DConverter & | operator= (const PolyA2DConverter &x) |
No assign. | |
Private Attributes | |
float ** | _d |
A2DConverter for applying a polynomial conversion to A2D counts values.
PolyA2DConverter::~PolyA2DConverter | ( | ) |
References _d, and nidas::core::A2DConverter::_maxNumChannels.
|
private |
No copy.
Convert a count to a floating point value.
Implements nidas::core::A2DConverter.
References _d, nidas::core::A2DConverter::_ncoefs, and nidas::core::getSample().
Implements nidas::core::A2DConverter.
References _d, nidas::core::A2DConverter::_maxNumChannels, nidas::core::A2DConverter::_ncoefs, 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 polynomial conversion for a channel.
Implements nidas::core::A2DConverter.
References _d, nidas::core::A2DConverter::_maxNumChannels, nidas::core::A2DConverter::_ncoefs, 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 _d, and nidas::core::A2DConverter::_ncoefs.
|
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().
|
private |
Referenced by convert(), get(), PolyA2DConverter(), set(), setNAN(), and ~PolyA2DConverter().
|
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 nidas::core::LinearA2DConverter::convert(), nidas::core::LinearA2DConverter::get(), get(), nidas::core::A2DConverter::getBipolar(), nidas::core::A2DConverter::getGain(), nidas::core::A2DConverter::getMaxNumChannels(), PolyA2DConverter(), nidas::core::LinearA2DConverter::set(), set(), nidas::core::A2DConverter::setBipolar(), nidas::core::A2DConverter::setGain(), nidas::core::LinearA2DConverter::setNAN(), setNAN(), and ~PolyA2DConverter().
|
protectedinherited |
Number of coefficients in the conversion.
Referenced by convert(), get(), PolyA2DConverter(), nidas::core::A2DConverter::readCalFile(), set(), and 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().