Hopsan
SecondOrderTransferFunction Class Reference

The SecondOrderTransferFunction class implements a second order transfer function using bilinear transform. More...

Public Member Functions

void initialize (double timestep, double num[3], double den[3], double u0=0.0, double y0=0.0, double min=-1.5E+300, double max=1.5E+300, double sy0=0.0)
 Constructor.
 
void initializeValues (double u0, double y0)
 
void setBackupLength (size_t nStep)
 
void setNum (double num[3])
 
void setDen (double den[3])
 
void setNumDen (double num[3], double den[3])
 
void setMinMax (double min, double max)
 
void backup ()
 
void restoreBackup (size_t nSteps=1)
 
double update (double u)
 
double updateWithBackup (double u)
 
double value () const
 
double delayedU () const
 
double delayed2U () const
 
double delayedY () const
 
double delayed2Y () const
 
bool isSaturated () const
 Check if the transfer function is saturated (har reached the set limits)
 

Detailed Description

The SecondOrderTransferFunction class implements a second order transfer function using bilinear transform.

To declare a filter like

\[G=\frac{a_2 s^2 + a_1 s + a_0}{b_2 s^2 + b_1 s + b_0}\]

the syntax is filter.setNumDen(num, den) where $num[0]=a_0$, $num[1]=a_1$, $num[2]=a_2$ and $den[0]=b_0$, $den[1]=b_1$, $den[2]=b_2$,

Member Function Documentation

◆ initialize()

void initialize ( double timestep,
double num[3],
double den[3],
double u0 = 0.0,
double y0 = 0.0,
double min = -1.5E+300,
double max = 1.5E+300,
double sy0 = 0.0 )

Constructor.

Parameters
timestepTime step
numNumerator
denDenominator
u0Initial input value
y0Initial output value
minMinimum limit of output value
maxMaximum limit of output value
sy0Initial derivative of output value

◆ isSaturated()

bool isSaturated ( ) const

Check if the transfer function is saturated (har reached the set limits)

Returns
true or false

◆ value()

double value ( ) const

Return current filter output value

Returns
The filtered actual value.