DUECA/DUSIME
Loading...
Searching...
No Matches
Public Member Functions | List of all members
OutputCalibrator< T, R > Class Template Reference

This performs a conversion of some (engineering units) value to an integer suitable for control of a D/A converter or other output device. More...

#include <OutputCalibrator.hxx>

Public Member Functions

 OutputCalibrator (const double out_min, const double out_max, const R int_min, const R int_max, const T &c, const double rem_weight=0.0, unsigned int idx=0)
 Constructor.
 
 ~OutputCalibrator ()
 Destructor.
 
 operator double () const
 Obtain the converted value.
 
raw () const
 Obtain the raw integer value.
 
OutputCalibratoroperator= (const double x)
 Assignment operator.
 
OutputCalibratoroperator+= (const double x)
 Summation with current value.
 
newConversion ()
 Get a new converted value (integer) from the calibrator.
 
unsigned int index () const
 The index is a variable for programmer convenience, e.g.
 
std::ostream & print (std::ostream &os) const
 Print to stream, for debugging purposes.
 

Detailed Description

template<class T, class R = int>
class OutputCalibrator< T, R >

This performs a conversion of some (engineering units) value to an integer suitable for control of a D/A converter or other output device.

Constructor & Destructor Documentation

◆ OutputCalibrator()

template<class T , class R = int>
OutputCalibrator< T, R >::OutputCalibrator ( const double out_min,
const double out_max,
const R int_min,
const R int_max,
const T & c,
const double rem_weight = 0.0,
unsigned int idx = 0 )

Constructor.

Takes a converter as argument.

Parameters
out_minMinimum value for the engineering units side.
out_maxMaximum value for the engineering units side.
int_minMinimum value for the converted signal.
int_maxMaximum value for the converted signal. Take care that the int_min and int_max ranges do not fall outside the range for your D/whatever converter!
cConverter.
rem_weightIf you have an output value it can almost never be converted exactly, there is a remainder of less than half a bit at each conversion. The rem_weight parameter determines how much this remainder is counted at the next conversion. With 0 it will simply not carry over, with 1 it will count fully.
idxOptional index to be stored with the calibrator.

Member Function Documentation

◆ operator=()

template<class T , class R = int>
OutputCalibrator & OutputCalibrator< T, R >::operator= ( const double x)
inline

Assignment operator.

Has the effect of taking the input value, and storing it for later output.

◆ operator+=()

template<class T , class R = int>
OutputCalibrator & OutputCalibrator< T, R >::operator+= ( const double x)
inline

Summation with current value.

Has the effect of taking the input value, summing it with the present value and storing it for later output.

◆ index()

template<class T , class R = int>
unsigned int OutputCalibrator< T, R >::index ( ) const
inline

The index is a variable for programmer convenience, e.g.

to remember where in an array of raw data the input value is stored.


The documentation for this class was generated from the following file: