.Modelica_LinearSystems2.WorkInProgress.DiscreteStateSpace

Information

This record defines a linear time invariant difference equation system in state space form:

     x(Ts*(k+1)) = A * x(Ts*k) + B * u(Ts*k)
     y(Ts*k)     = C * x(Ts*k) + D * u(Ts*k)
     x_continuous(Ts*k) = x(Ts*k) + B2 * u(Ts*k)

with

A discrete system is usually derived by discretization from a continuous block, e.g., by function LinearSystems.DiscreteStateSpace.fromStateSpace. If the discretization method, e.g., the trapezoidal method, accesses actual and past values of the input u (e.g. u(Ts*k), u(Ts*(k-1), u(Ts*(k-2))), a state transformation is needed to get the difference equation above where only the actual value u(Ts*k) is accessed.

If the original continuous state vector should be computed from the sampled data system above, the matrices of this transformation have to be known. For simplicity and efficiency, here only the specific transformation used by function LinearSystems.DiscreteStateSpace.fromStateSpace is stored in the data record of the discrete system via matrix B2. Therefore, the state vector of the underlying continuous system can be calculated by adding the term B2*u to the state vector of the discretized system.

In Modelica notation, the difference equation above can be implemented as:

     when {initial(), sample(Ts,Ts)} then
        new_x = A * x + B * u;
            y = C * x + D * u;
            x = pre(new_x);
        x_continuous = x + B2 * u;
     end when;

Since no "next value" operator is available in Modelica, an auxiliary variable new_x stores the value of x for the next sampling instant. The relationship between new_x and x is defined via equation "x = pre(new_x)".

The body of the when-clause is active during initialization and at the next sample instant t=Ts. Note, the when-equation is not active after the initialization at t=0 (due to sample(Ts,Ts)), since the state x of the initialization has to be used also at t=0.

In library Blocks.Controller additional equations are added for the initialization to uniquely compute the initial vector x:

  initial equation
     if init == InitialState then
        x = x_start;
     elseif init == SteadyState then
        x = new_x;
     end if;

Optionally, x is set to a given start vector x_start. As default initialization, the equation "x = new_x" is added that defines steady state initialization for the discrete system. As a consequence, the output y(Ts*k), k=0,1,2,.., remains constant after this initialization, provided the input vector u(Ts*k) remains constant.

Contents

Name Description
'constructor'
timeResponse Compute time response of DiscreteStateSpace system
initialResponse Compute initial response of DiscreteStateSpace system
Conversion Conversion functions from DiscreteStateSpace into DiscreteTransferFunction
Plot Functions to plot discrete state space system responses
Internal
Design Design functions for DiscreteStateSpace

Generated at 2020-09-27T00:59:23Z by OpenModelicaOpenModelica 1.16.0~dev-655-g93494e4 using GenerateDoc.mos