CSSM – Continuous state space model of a linear system

Block SymbolLicensing group: ADVANCED

Function Description
The CSSM block (Continuous State Space Model) simulates behavior of a linear system

dx(t) dt = Acx(t) + Bcu(t),x(0) = x0 y(t) = Ccx(t) + Dcu(t),

where x(t) n is the state vector, x0 n is the initial value of the state vector, u(t) m is the input vector, y(t) p is the output vector. The matrix Ac n×n is the system dynamics matrix, Bc n×m is the input matrix, Cc p×n is the output matrix and Dc 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

x((k + 1)T) = Adx(kT) + Bdu(kT),x(0) = x0 y(kT) = Ccx(kT) + Dcu(kT),

where k {1,2,} is the simulation step, T is the execution period of the block in seconds. 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(t) is changed only in the moments of sampling and between two consecutive sampling instants is constant, i.e. u(t) = u(kT) for t [kT,(k + 1)T), then the matrices Ad and Bd are determined by

Ad = eAcT Bd = 0T eAcτB cdτ

Computation of discrete matrices Ad and Bd 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.



Reset signal. When R1 = on, the state vector x is set to its initial value x0. The simulation continues on the falling edge of R1 (on off).



Simulation output holds its value if HLD=on.



Simulated system inputs. First m simulation inputs are used where m is the number of columns of the matrix Bc.  0.0

Double (F64)



Block error code


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


Simulated system outputs. First p simulation outputs are used where p is the number of rows of the matrix Cc.

Double (F64)



Matrix Dc usage flag. If UD=offthen the Dc matrix is not used for simulation (simulation behaves as if the Dc matrix is zero).



Order of the Padé approximation of the matrix exponential for the computation of the discretized system matrices.   0  4 2.00E+00

Long (I32)


Required accuracy of the Padé approximation.   0.0  1.0 1e-15

Double (F64)


Matrix (n × n) of the continuous linear system dynamics.

Double (F64)


Input matrix (n × m) of the continuous linear system.

Double (F64)


Output matrix (p × n) of the continuous linear system.

Double (F64)


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)


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