### CDELSSM – Continuous state space model of a linear system with time delay

Function Description
The CDELSSM block (Continuous State Space Model with time DELay) simulates behavior of a linear system with time delay $del$

$\begin{array}{rcll}\frac{dx\left(t\right)}{dt}& =& {A}_{c}x\left(t\right)+{B}_{c}u\left(t-del\right),\phantom{\rule{1em}{0ex}}x\left(0\right)=x0& \text{}\\ y\left(t\right)& =& {C}_{c}x\left(t\right)+{D}_{c}u\left(t\right),& \text{}\end{array}$

where $x\left(t\right)\in {ℝ}^{n}$ is the state vector, $x0\in {ℝ}^{n}$ is the initial value of the state vector, $u\left(t\right)\in {ℝ}^{m}$ is the input vector, $y\left(t\right)\in {ℝ}^{p}$ is the output vector. The matrix ${A}_{c}\in {ℝ}^{n×n}$ is the system dynamics matrix, ${B}_{c}\in {ℝ}^{n×m}$ is the input matrix, ${C}_{c}\in {ℝ}^{p×n}$ is the output matrix and ${D}_{c}\in {ℝ}^{p×m}$ is the direct transmission (feedthrough) matrix.

All matrices are specified in the same format as in Matlab, i.e. the whole matrix is placed in brackets, elements are entered by rows, elements of a row are separated by spaces (blanks), rows are separated by semicolons. The $x0$ vector is a column, therefore the elements are separated by semicolons (each element is in a separate row).

The simulated system is first converted to the discrete (discretized) state space model

$\begin{array}{rcll}x\left(\left(k+1\right)T\right)& =& {A}_{d}x\left(kT\right)+{B}_{d1}u\left(\left(k-d\right)T\right)+{B}_{d2}u\left(\left(k-d+1\right)T\right),\phantom{\rule{1em}{0ex}}x\left(0\right)=x0& \text{}\\ y\left(kT\right)& =& {C}_{c}x\left(kT\right)+{D}_{c}u\left(kT\right),& \text{}\end{array}$

where $k\in \left\{1,2,\dots \right\}$ is the simulation step, $T$ is the execution period of the block in seconds and $d$ is a delay in simulation step such that $\left(d-1\right)T. The period $T$ is not entered in the block, it is determined automatically as a period of the task (TASK, QTASK nebo IOTASK) containing the block.

If the input $u\left(t\right)$ is changed only in the moments of sampling and between two consecutive sampling instants is constant, i.e. $u\left(t\right)=u\left(kT\right)$ for $t\in \left[kT,\left(k+1\right)T\right)$, then the matrices ${A}_{d}$, ${B}_{d1}$ and ${B}_{d2}$ are determined by

$\begin{array}{rcll}{A}_{d}& =& {e}^{{A}_{c}T}& \text{}\\ {B}_{d1}& =& {e}^{{A}_{c}\left(T-\Delta \right)}{\int }_{0}^{\Delta }{e}^{{A}_{c}\tau }{B}_{c}d\tau & \text{}\\ {B}_{d2}& =& {\int }_{0}^{T-\Delta }{e}^{{A}_{c}\tau }{B}_{c}d\tau ,& \text{}\end{array}$

where $\Delta =del-\left(d-1\right)T$.

Computation of discrete matrices ${A}_{d}$, ${B}_{d1}$ and ${B}_{d2}$ is based on a method described in [5], which uses Padé approximations of matrix exponential and its integral and scaling technique.

During the real-time simulation, single simulation step of the above discrete state space model is computed in each execution time instant.

Inputs

 R1 Reset signal. When $\mathtt{\text{R1}}=\mathtt{\text{on}}$, the state vector x is set to its initial value x0. The simulation continues on the falling edge of R1 (on$\to$off). Bool HLD Simulation output holds its value if HLD=on. Bool u1..u16 Simulated system inputs. First $m$ simulation inputs are used where $m$ is the number of columns of the matrix Bc.  $\odot$0.0 Double (F64)

Outputs

 iE Block error code Error 0 .... O.K., the simulation runs correctly -213 . incompatibility of the state space model matrices dimensions -510 . the model is badly conditioned (some working matrix is singular or nearly singular) xxx .. error code xxx of REXYGEN, see appendix C for details y1..y16 Simulated system outputs. First $p$ simulation outputs are used where $p$ is the number of rows of the matrix Cc. Double (F64)

Parameters

 UD Matrix Dc usage flag. If UD=offthen the Dc matrix is not used for simulation (simulation behaves as if the Dc matrix is zero). Bool del Model time delay [s].  $↓$0.0 $\odot$0.0 Double (F64) is Order of the Padé approximation of the matrix exponential for the computation of the discretized system matrices.  $↓$0 $↑$4 $\odot$2.00E+00 Long (I32) eps Required accuracy of the Padé approximation.  $↓$0.0 $↑$1.0 $\odot$1e-15 Double (F64) Ac Matrix ($n×n$) of the continuous linear system dynamics. Double (F64) Bc Input matrix ($n×m$) of the continuous linear system. Double (F64) Cc Output matrix ($p×n$) of the continuous linear system. Double (F64) Dc Direct transmission (feedthrough) matrix ($p×m$) of the continuous linear system. The matrix is used only if the parameter UD=on. If UD=off, the dimensions of the Dc matrix are not checked. Double (F64) x0 Initial value of the state vector (of dimension $n$) of the continuous linear system. Double (F64)

2020 © REX Controls s.r.o., www.rexygen.com