DUECA/DUSIME
|
Class that performs calibration and scaling of an incoming integer value from an A/D converter or other input device. More...
Public Member Functions | |
InputRatioCalibrator (const R in_min, const R in_max, const R in_zero, const T &c, unsigned int idx=0, unsigned idx_ref=0) | |
Constructor. More... | |
~InputRatioCalibrator () | |
Destructor. More... | |
operator double () const | |
Obtain the converted value. More... | |
R | raw () const |
Obtain the raw integer value. More... | |
R | rawReference () const |
Obtain the raw integer value for the reference. More... | |
void | newConversion (const R i, const R ref) |
Insert a new converted value set into the calibrator. More... | |
R | bitDifference (const double r) const |
Return the difference between the given value and the measured value in bit domain. More... | |
unsigned int | index () const |
The index is a variable for user convenience, e.g. More... | |
unsigned int | indexReference () const |
The index of the reference signal, for user convenience. More... | |
std::ostream & | print (std::ostream &os) const |
Print to stream, for debugging purposes. | |
Class that performs calibration and scaling of an incoming integer value from an A/D converter or other input device.
It is a templated class, and the template parameter must be a class capable of scaling the incoming values.
InputRatioCalibrator< T, R >::InputRatioCalibrator | ( | const R | in_min, |
const R | in_max, | ||
const R | in_zero, | ||
const T & | c, | ||
unsigned int | idx = 0 , |
||
unsigned | idx_ref = 0 |
||
) |
Constructor.
Takes a converter as argument.
in_min | Minimum integer value |
in_max | Maximum integer value |
in_zero | Zero value for the input and reference |
c | Converter of (template) type T, the operation operator() (const double x) should exist for values between in_min and in_max, and should produce the required converted/scaled value. |
idx | Optional index to be stored with the calibrator. |
idx_ref | Index of the reference signal. |
InputRatioCalibrator< T, R >::~InputRatioCalibrator | ( | ) |
Destructor.
|
inline |
Obtain the converted value.
|
inline |
Obtain the raw integer value.
|
inline |
Obtain the raw integer value for the reference.
void InputRatioCalibrator< T, R >::newConversion | ( | const R | i, |
const R | ref | ||
) |
Insert a new converted value set into the calibrator.
R InputRatioCalibrator< T, R >::bitDifference | ( | const double | r | ) | const |
Return the difference between the given value and the measured value in bit domain.
r | Value for comparison |
|
inline |
The index is a variable for user convenience, e.g.
to remember where in an array of raw data the input value is stored.
|
inline |
The index of the reference signal, for user convenience.