![]() |
Documentation
Tools for embedded systems
|
A LTI discrete system object. More...
#include <ltisys.hpp>
Public Member Functions | |
| virtual | ~discreteSystem () |
| discreteSystem (real_t *num, real_t *den, real_t *x, const size_t n_b, const size_t n_a) noexcept | |
| Constructor for a the discrete LTI system. | |
| template<size_t NB, size_t NA> | |
| discreteSystem (real_t(&num)[NB], real_t(&den)[NA], real_t *x) noexcept | |
| Constructor for a the discrete LTI system. | |
| template<size_t NB, size_t NA> | |
| discreteSystem (discreteTF< NB, NA > &dtf) noexcept | |
| Constructor for a the discrete LTI system from a transfer function definition. | |
| bool | setup (real_t *num, real_t *den, real_t *x, const size_t n_b, const size_t n_a) noexcept |
| Setup and initialize an instance of the discrete LTI system. | |
| template<size_t NB, size_t NA> | |
| bool | setup (real_t(&num)[NB], real_t(&den)[NA], real_t *x) |
| Setup and initialize an instance of the discrete LTI system. | |
| template<size_t NB, size_t NA> | |
| bool | setup (discreteTF< NB, NA > &dtf) noexcept |
| Setup and initialize an instance of the discrete LTI system from a transfer function definition. | |
| bool | isInitialized (void) const noexcept override |
| Check if the LTI discrete system is initialized. | |
| operator bool () const noexcept | |
| Check if the LTI discrete system is initialized. | |
| bool | setInitStates (const real_t *xi=nullptr) override |
| Set the initial states for the discrete system. | |
Public Member Functions inherited from qlibs::ltisys | |
| virtual | ~ltisys () |
| ltisys ()=default | |
| real_t | excite (real_t u) noexcept |
| Drives the LTI system recursively using the provided input sample. | |
| real_t | operator() (const real_t u) |
| Drives the LTI system recursively using the provided input sample. | |
| operator bool () const noexcept | |
| Check if the LTI system is initialized. | |
| 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 () noexcept=default |
| tdl ()=default | |
| tdl (real_t *const area, const size_t n, const real_t initVal=0.0_re) noexcept | |
| 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. | |
| real_t | operator[] (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 noexcept |
| Check if the TDL has been initialized. | |
| operator bool () const noexcept | |
| Check if the TDL has been initialized. | |
Static Public Member Functions | |
| static real_t | updateFIR (real_t *w, const size_t wsize, const real_t x, const real_t *const c=nullptr) |
| Evaluate the discrete FIR filter by updating the delay lines of x inside the window w of size wsize with the coefficients given in c. If c it's not supplied, this function just perform the window update. | |
A LTI discrete system object.
The instance should be initialized using the discreteSystem::setup() method.
|
inlinevirtual |
|
inlinenoexcept |
Constructor for a the discrete LTI system.
| [in,out] | num | : An array of nb elements with the numerator coefficients of the transfer function. Coefficients should be given in descending powers of the n or nb-degree polynomial. Coefficients will be normalized internally. |
| [in,out] | den | An array of or na elements with the denominator coefficients of the transfer function. Coefficients should be given in descending powers of the n or nb-degree polynomial. Coefficients will be normalized internally. |
| [in,out] | x | Initial conditions of the system. Should be an, an array of type discreteStates with max(na,nb) elements The supplied array will be updated on every invocation of discreteSystem::excite(). |
| [in] | n_b | Number of elements in num |
example: \( b_{0}+b_{1}z^{-1}+b_{2}z^{-2}+b_{3}z^{-3}, nb = 4 \)
| [in] | n_a | Number of elements in den. |
example 1: \( a_{0}+a_{1}z^{-1}+a_{2}z^{-2}+a_{3}z^{-3}, na = 4 \)
|
inlinenoexcept |
Constructor for a the discrete LTI system.
| [in,out] | num | : An array of nb elements with the numerator coefficients of the transfer function. Coefficients should be given in descending powers of the n or nb-degree polynomial. Coefficients will be normalized internally. |
| [in,out] | den | An array of or na elements with the denominator coefficients of the transfer function. Coefficients should be given in descending powers of the n or nb-degree polynomial. Coefficients will be normalized internally. |
| [in,out] | x | Initial conditions of the system. Should be an, an array of type discreteStates with max(na,nb) elements The supplied array will be updated on every invocation of discreteSystem::excite(). |
|
inlinenoexcept |
Constructor for a the discrete LTI system from a transfer function definition.
| [in,out] | dtf | : The transfer function definition |
|
inlineoverridevirtualnoexcept |
Check if the LTI discrete system is initialized.
true if the system has been initialized, otherwise return false. Implements qlibs::ltisys.
|
inlineexplicitnoexcept |
Check if the LTI discrete system is initialized.
true if the system has been initialized, otherwise return false.
|
overridevirtual |
Set the initial states for the discrete system.
| [in] | xi | An array of n-elements with the initial state values. User can pass nullptr as argument to set initial conditions equal to zero. |
true on success, otherwise return false. Implements qlibs::ltisys.
|
inlinenoexcept |
Setup and initialize an instance of the discrete LTI system from a transfer function definition.
| [in,out] | dtf | : The transfer function definition |
true on success, otherwise return false.
|
noexcept |
Setup and initialize an instance of the discrete LTI system.
| [in,out] | num | : An array of nb elements with the numerator coefficients of the transfer function. Coefficients should be given in descending powers of the n or nb-degree polynomial. Coefficients will be normalized internally. |
| [in,out] | den | An array of or na elements with the denominator coefficients of the transfer function. Coefficients should be given in descending powers of the n or nb-degree polynomial. Coefficients will be normalized internally. |
| [in,out] | x | Initial conditions of the system. Should be an, an array of type discreteStates with max(na,nb) elements The supplied array will be updated on every invocation of discreteSystem::excite(). |
| [in] | n_b | Number of elements in num |
example: \( b_{0}+b_{1}z^{-1}+b_{2}z^{-2}+b_{3}z^{-3}, nb = 4 \)
| [in] | n_a | Number of elements in den. |
example 1: \( a_{0}+a_{1}z^{-1}+a_{2}z^{-2}+a_{3}z^{-3}, na = 4 \)
true on success, otherwise return false.
|
inline |
Setup and initialize an instance of the discrete LTI system.
| [in,out] | num | : An array of nb elements with the numerator coefficients of the transfer function. Coefficients should be given in descending powers of the n or nb-degree polynomial. Coefficients will be normalized internally. |
| [in,out] | den | An array of or na elements with the denominator coefficients of the transfer function. Coefficients should be given in descending powers of the n or nb-degree polynomial. Coefficients will be normalized internally. |
| [in,out] | x | Initial conditions of the system. Should be an, an array of type discreteStates with max(na,nb) elements The supplied array will be updated on every invocation of discreteSystem::excite(). |
true on success, otherwise return false.
|
static |
Evaluate the discrete FIR filter by updating the delay lines of x inside the window w of size wsize with the coefficients given in c. If c it's not supplied, this function just perform the window update.
| [in,out] | w | An array of wsize elements that holds the window with the delay lines of x. |
| [in] | wsize | The number of elements of w. |
| [in] | x | A sample of the input signal. |
| [in] | c | An array of wsize elements with the coefficients of the FIR filter. Coefficients should be given in descending powers of the nth-degree polynomial. To ignore pass nullptr. |