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

Implementation of a rotary scaling/converting device, using a polynomial for final correction and optionally tracking of the angle. More...

#include <CircularWithPoly.hxx>

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

Public Member Functions

 CircularWithPoly (double K, double xzero, double norm_start, size_t n, const double ai[])
 Constructor.
 
 CircularWithPoly (const CircularWithPoly &o)
 Copy constructor.
 
CircularWithPolyoperator= (const CircularWithPoly &o)
 assignment
 
 ~CircularWithPoly ()
 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 polynomial for final correction and optionally tracking of the angle.

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.

The input is first scaled with a gain K, and then normalized to a range \(n_0\) .. \(n_0+1\). The polynomial is then applied to this normalized result.

Implements in step 1:

\[ x_t(x) = (K\left(x-x_0\right) - n_0) \mod 1 + n_0 \]

And with that result (ranging from

\[ y(x_t) = a_0 + a_1 x_t \ldots + a_n (x_t)^n \]

As an example, consider a 10 bit synchro measuring angle of attack, with output values from 0 to 1023. At 0 degrees angle of attack, the output from the measurement is 980, and so with different inputs the measurement is likely to flip around from 1023 to 0. Determine \(x_0=980\), \(K=1/1024\) and \(n_0=-0.5\), then the output from the first step ranges from -0.5 to 0.5 for a -180 to 180 degree (hypothetical) input. With the polynomial from the second step the scaling may be further defined.

Constructor & Destructor Documentation

◆ CircularWithPoly()

dueca::CircularWithPoly::CircularWithPoly ( double K,
double xzero,
double norm_start,
size_t n,
const double ai[] )

Constructor.

Parameters
KGain coefficient, 1.0/(increments in full rotation)
xzeroInput value when angle is zero
norm_startNormalised start value of first step, for example -0.5, to get a -0.5 to 0.5 output, or zero to get a 0 to 1 output
nOrder of the calibrating polynomial
aiArray with polynomial coefficients, polynomial is \(a_0 + a_1 x + \ldots + a_n x^n \)

Member Function Documentation

◆ operator()()

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

The operator.

Implements dueca::SimpleFunction.


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