Documentation
Tools for embedded systems
Loading...
Searching...
No Matches
qlibs::integrator Class Reference

A numerical integration class. More...

#include <numa.hpp>

Inheritance diagram for qlibs::integrator:
qlibs::nState

Public Member Functions

virtual ~integrator ()=default
 
 integrator (const real_t timeStep, const real_t initialCondition=0.0_re)
 Constructs an integrator block with a given timeStep time and optional initial condition.
 
real_t operator() (const real_t xDot)
 Performs one step of numerical integration.
 
real_t operator() () const
 Retrieve the current value of the integration.
 
- Public Member Functions inherited from qlibs::nState
virtual ~nState ()=default
 
 nState (const real_t x0=0.0_re, const real_t sn_1=0.0_re, const real_t sn_2=0.0_re) noexcept
 Constructor for the state object.
 
void init (const real_t x0=0.0_re, const real_t sn_1=0.0_re, const real_t sn_2=0.0_re) noexcept
 Initialize the state object.
 
real_t integrate (const real_t s, const real_t dt, const bool bUpdate=true) noexcept
 Perform a numerical integration step by using the specified integration method.
 
real_t derive (const real_t s, const real_t dt, const bool bUpdate=true) noexcept
 Perform a numerical derivation step by using the specified derivation method.
 
void setIntegrationMethod (integrationMethod m) noexcept
 Sets the numerical integration method.
 
void setDerivationMethod (derivationMethod m) noexcept
 Sets the numerical derivation method.
 
bool setSaturation (const real_t minV, const real_t maxV) noexcept
 Sets the saturation limits for the integrator output.
 
real_t operator() (void) const noexcept
 Get the value of the state.
 

Detailed Description

A numerical integration class.

A numerical integration class that can be used to compute in real-time the numerical approximation of an integral for data values sampled periodically. It supports optional output saturation limits.

Constructor & Destructor Documentation

◆ ~integrator()

virtual qlibs::integrator::~integrator ( )
virtualdefault

◆ integrator()

integrator::integrator ( const real_t timeStep,
const real_t initialCondition = 0.0_re )

Constructs an integrator block with a given timeStep time and optional initial condition.

Parameters
[in]timeStepThe fixed time step (dt) used to compute the integration.
[in]initialConditionThe initial output value of the integrator. Default is 0.0.
Note
It is assumed that input samples will be provided at regular intervals of timeStep.

Member Function Documentation

◆ operator()() [1/2]

real_t integrator::operator() ( void ) const

Retrieve the current value of the integration.

Returns
The current value of the integral.

◆ operator()() [2/2]

real_t integrator::operator() ( const real_t xDot)

Performs one step of numerical integration.

Parameters
[in]xDotThe input value to be integrated
Returns
The integrated value (i.e., the output of the integrator) after applying saturation.
Note
This should be called at intervals equal to the time step provided in the constructor.