DUECA/DUSIME
Loading...
Searching...
No Matches
Public Member Functions | List of all members
dueca::Circular Class Reference

Implementation of a rotary scaling/converting device, using a simple gain. More...

#include <Circular.hxx>

Inheritance diagram for dueca::Circular:
Inheritance graph
[legend]
Collaboration diagram for dueca::Circular:
Collaboration graph
[legend]

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.
 

Detailed Description

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 & Destructor Documentation

◆ Circular()

dueca::Circular::Circular ( double K,
double xzero,
double range,
double ystart )

Constructor.

Parameters
KGain coefficient, 1.0/(increments in full rotation)
xzeroInput value when angle is zero (normally integer)
rangeRange that the value is to be scaled to, e.g. 360 degrees or \(2\pi\)
ystartStart value of the output range, for exaple 0, -180, etc.

Member Function Documentation

◆ operator()()

double dueca::Circular::operator() ( const double x) const
virtual

The operator.

Implements dueca::SimpleFunction.


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