.Modelica_LinearSystems2.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 fromStateSpace. If the discretization method, e.g., the trapezoidal method, accesses current 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 current 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 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 package Controllers, additional equations are added for the initialization to uniquely compute the initial vector x, e.g.:

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

NameDescription
 'constructor'Collection of operators to construct a DiscreteStateSpace data record
 '-'Contains operators for subtraction of discrete state space systems
 '+'Parallel connection of two discrete state space systems (= inputs are the same, outputs of the two systems are added)
 '*'Series connection of two discrete state space systems
 '=='Check whether two linear discrete state space systems have identical matrices
 timeResponseCompute time response of DiscreteStateSpace system
 initialResponseCompute initial response of DiscreteStateSpace system
 AnalysisPackage of functions to analyse discrete state space system represented by a DiscreteStateSpace record
 DesignPackage of functions to design discrete state space controllers and observers
 PlotPackage of functions to plot discrete state space system responses
 ConversionPackage of functions for conversion of DiscreteStateSpace data record
 ImportPackage of functions to generate a DiscreteStateSpace data record from imported data
 InternalPackage of internal material of record DiscreteStateSpace (for advanced users only)

Generated at 2024-11-22T19:25:38Z by OpenModelicaOpenModelica 1.24.2 using GenerateDoc.mos