Documentation
Tools for embedded systems
|
qLTISys is a class that evaluates single-input, single-output (SISO) transfer function models in real-valued systems. A transfer function is a model that describes the frequency-dependent response of a linear time-invariant system, and this class can handle both continuous-time and discrete-time systems. qLTISys can be used for simulating dynamic systems and implementing filters, compensators, or controllers.
Here, the transfer function \( G(s) \) is the linear mapping of the Laplace transform of the input, \( U(s)= \mathcal{L}[u(t)]\), to the Laplace transform of the output \( Y(s)= \mathcal{L}[y(t)]\).
\( G(s) = \frac{N(s)}{D(s)} = \frac{ b_{0}s^{n} + b_{1}s^{n-1} + b_{2}s^{n-2} + ... + b_{n} }{ s^{n} + a_{1}s^{n-1} + a_{2}s^{n-2} + ... + a_{n} } \)
\( N(s) \) and \( D(s) \) are the numerator and denominator polynomials in descending powers of \(s\), respectively.
To instantiate a continuous transfer function, you should define a variable of type qLTISys_t, two arrays of N+1 elements with the coefficients of the polynomials for both, the numerator and denominator, and finally, an array of type qLTISys_ContinuosX_t to hold the N states of the system. Then, you can call qLTISys_Setup() to construct the system and set initial conditions. Subsequently, you can evaluate the system with a given input-signal by just calling qLTISys_Excite().
\( G(s) = \frac{ 2s^{2} + 3s + 6 }{ s^{3} + 6s^{2} + 11s + 16 } \)
The z-transform is used in discrete-time systems to deal with the relationship between an input signal \( u(t) \) and an output signal \( y(t) \) , so the transfer function is similarly written as \( G(z^{-1}) \) and is often referred to as the pulse-transfer function.
\( G(z^{-1}) = \frac{N(z^{-1})}{D(z^{-1})} = \frac{ b_{0} + b_{1}z^{-1} + b_{2}z^{-2} + ... + b_{m}z^{-m} }{ 1 + a_{1}z^{-1} + a_{2}z^{-2} + ... + a_{n}z^{-n} } \)
Discrete systems are instantiated in a similar way to continuous systems, but there are some differences. States are should be stored in an array of type qLTISys_DiscreteX_t. The size of polynomials can vary according to their order, and you should pass the QLTISYS_DISCRETE directive on qLTISys_Setup() in order to differentiate the system when it is being evaluated. Please take a look at the following example:
\( G(z^{-1}) = \frac{ 0.1 + 0.2z^{-1} + 0.3z^{-2} }{ 1 - 0.85z^{-1} + 0.02z^{-2} } \)