DUECA/DUSIME
|
Implementation of a rotary scaling/converting device, using a simple gain. More...
#include <Circular.hxx>
Public Member Functions | |
Circular (double K, double xzero, double range, double ystart) | |
Constructor. | |
~Circular () | |
Destructor. | |
double | operator() (const double x) const |
The operator. | |
std::ostream & | print (std::ostream &os) const |
Print the object. | |
Public Member Functions inherited from dueca::SimpleFunction | |
SimpleFunction () | |
Constructor. | |
virtual | ~SimpleFunction () |
Destructor. | |
Implementation of a rotary scaling/converting device, using a simple gain.
This class is a functor, with a double as input and another double as output. The application for this in DUECA is as an input calibrator for IO signals, see also the InputCalibrator and OutputCalibrator documentation.
Implements function
\[ y(x) = R * ( \frac{K}{x-x_0} ) + n * R \]
Here the integer \(n\) is adjusted so that the function's output (reach) runs from \(y_{start}\) to \(y_{start}+R\)
How to calibrate:
Determine the input value for which your parameter is zero, set \( x_0 \) to this value
Determine the range of input values and set \( K \) to its inverse, e.g., if the range is \( 2^{12} \), then \( K = \frac{1}{2^{12}} \)
Determine the output range, e.g., 360 deg, set \( R \) to this value.
Determine where you want to "start" the output, e.g., \( y_{start} = -180 \) means you will get outputs from -180 to 180, with \( y_{start} = 0 \) the output will be 0 to 360.
Constructor.
K | Gain coefficient, 1.0/(increments in full rotation) |
xzero | Input value when angle is zero (normally integer) |
range | Range that the value is to be scaled to, e.g. 360 degrees or \(2\pi\) |
ystart | Start value of the output range, for exaple 0, -180, etc. |
The operator.
Implements dueca::SimpleFunction.