Documentation
Tools for embedded systems
Loading...
Searching...
No Matches
qlibs::ltisys Class Referenceabstract

A LTI system base class. More...

#include <ltisys.hpp>

Inheritance diagram for qlibs::ltisys:
qlibs::tdl qlibs::continuousSystem qlibs::discreteSystem

Public Member Functions

virtual ~ltisys ()
 
 ltisys ()=default
 
real_t excite (real_t u)
 Drives the LTI system recursively using the input signal provided.
 
virtual bool isInitialized (void) const =0
 Check if the LTI system is initialized.
 
virtual bool setInitStates (const real_t *xi=nullptr)=0
 Set the initial states for the given system.
 
ltisysType getType (void) const
 Get the LTI system type.
 
bool setDelay (real_t *const w, const size_t nD, const real_t initVal=0.0_re) noexcept
 Set the input delay for LTI system.
 
bool setSaturation (const real_t minV, const real_t maxV) noexcept
 Setup the output saturation for the LTI system.
 
- Public Member Functions inherited from qlibs::tdl
virtual ~tdl ()
 
 tdl ()=default
 
 tdl (real_t *const area, const size_t n, const real_t initVal=0.0_re)
 Constructor for the Tapped Delay Line (TDL) instance.
 
template<size_t numberOfDelays>
 tdl (real_t(&area)[numberOfDelays], const real_t initVal=0.0_re) noexcept
 Constructor for the Tapped Delay Line (TDL) instance.
 
void setup (real_t *const area, const size_t n, const real_t initVal=0.0_re) noexcept
 Setup and initialize a Tapped Delay Line (TDL) instance by setting the default optimal parameters.
 
template<size_t numberOfDelays>
void setup (real_t(&area)[numberOfDelays], const real_t initVal=0.0_re) noexcept
 Setup and initialize a Tapped Delay Line (TDL) instance by setting the default optimal parameters.
 
void flush (const real_t initVal=0.0_re) noexcept
 Clears all delays from the TDL and sets them to the specified value.
 
real_t getOldest (void) const noexcept
 Get the oldest sample from the TDL x(k-n)
 
real_t getRecent (void) const noexcept
 Get the most recent sample from the TDL x(k)
 
real_t getAtIndex (const size_t i) const noexcept
 Get the specified delayed sample from the TDL x(k-i)
 
void insertSample (const real_t sample) noexcept
 Insert a new sample to the TDL removing the oldest sample.
 
const real_toperator[] (int index) noexcept
 Get the specified delayed sample from the TDL x(k-i)
 
void operator() (const real_t sample) noexcept
 Insert a new sample to the TDL removing the oldest sample.
 
bool isInitialized (void) const
 Check if the TDL has been initialized.
 

Detailed Description

A LTI system base class.

Constructor & Destructor Documentation

◆ ~ltisys()

virtual qlibs::ltisys::~ltisys ( )
inlinevirtual

◆ ltisys()

qlibs::ltisys::ltisys ( )
default

Member Function Documentation

◆ excite()

real_t ltisys::excite ( real_t u)

Drives the LTI system recursively using the input signal provided.

Precondition
Instance must be previously initialized.
Note
The user must ensure that this function is executed in the required sample time T or time step dt either by using a HW or SW timer, a real time task or a timing service.
Parameters
[in]uA sample of the input signal that excites the system
Returns
The system response.

◆ getType()

ltisysType qlibs::ltisys::getType ( void ) const
inline

Get the LTI system type.

Returns
true if the system has been initialized, otherwise return false.

◆ isInitialized()

virtual bool qlibs::ltisys::isInitialized ( void ) const
pure virtual

Check if the LTI system is initialized.

Returns
true if the system has been initialized, otherwise return false.

Implemented in qlibs::continuousSystem, and qlibs::discreteSystem.

◆ setDelay()

bool ltisys::setDelay ( real_t *const w,
const size_t nD,
const real_t initVal = 0.0_re )
noexcept

Set the input delay for LTI system.

Parameters
[in]wA array of n elements with the delay window for the input channel.
[in]nDThe number of elements of w.
[in]initValThe initial value of the input channel.
Returns
LTISYS_TYPE_CONTINUOUS or LTISYS_TYPE_DISCRETE. If the system is not initialized, LTISYS_TYPE_UNKNOWN

◆ setInitStates()

virtual bool qlibs::ltisys::setInitStates ( const real_t * xi = nullptr)
pure virtual

Set the initial states for the given system.

Precondition
System should be previously initialized by using the setup() method
Parameters
[in]xiAn array of n-elements with the initial state values. User can pass nullptr as argument to set initial conditions equal to zero.
Returns
true on success, otherwise return false.

Implemented in qlibs::continuousSystem, and qlibs::discreteSystem.

◆ setSaturation()

bool ltisys::setSaturation ( const real_t minV,
const real_t maxV )
noexcept

Setup the output saturation for the LTI system.

Parameters
[in]minVThe minimal value allowed for the output.
[in]maxVThe maximal value allowed for the output.
Returns
true on success, otherwise return false.