.Modelica_LinearSystems2.DiscreteTransferFunction.Conversion.toDiscreteStateSpace

Information

Syntax

dss = DiscreteTransferFunction.ConversiontoDiscreteStateSpace(dtf)

Description

Transforms a discrete transfer function into discrete state space representation. There are an infinite number of possible realizations. Here, the transfer function is transformed into controller canonical form, i.e. the transfer function

     b4*z^4 + b3*z^3 + b2*z^2 + b1*z + b0
y = -------------------------------------- * u
     a4*z^4 + a3*z^3 + a2*z^2 + a1*z + a0

is transformed into:

x_k+1 = A*x_k + B*u_k;
 y_k  = C*x_k + D*u_k;
with
  A = [   0  ,    1  ,    0  ,    0;
          0  ,    0  ,    1  ,    0:
          0  ,    0  ,    0  ,    1;
       -a0/a4, -a1/a4, -a2/a4, -a3/a4];

  B = [  0;
         0;
         0;
        1/a4];
  C = [b0-b4*a0/a4, b1-b4*a1/a4, b2-b4*a2/a4, b3-b4*a3/a4];
  D = [b4/a4];

Example

  DiscreteTransferFunction z = Modelica_LinearSystems2.DiscreteTransferFunction.z();
  Modelica_LinearSystems2.DiscreteTransferFunction dtf=(z+1)/(z^3 + z^2 + z + 1);

algorithm
  dss := Modelica_LinearSystems2.DiscreteTransferFunction.Conversion.toDiscreteStateSpace(dtf);
// ss.A = [0, 1, 0; 0, 0, 1; -1, -1, -1],
// ss.B = [0; 0; 1],
// ss.C = [1, 1, 0],
// ss.D = [0],
// ss.B2 = [0; 0; 0],

Interface

function toDiscreteStateSpace
  import Modelica;
  import Modelica_LinearSystems2;
  import Modelica_LinearSystems2.DiscreteTransferFunction;
  import Modelica_LinearSystems2.TransferFunction;
  import Modelica_LinearSystems2.DiscreteStateSpace;
  import Modelica.Math.Vectors;
  input DiscreteTransferFunction dtf "discrete transfer function of a system";
  output DiscreteStateSpace dss(redeclare Real A[DiscreteTransferFunction.Analysis.denominatorDegree(dtf), DiscreteTransferFunction.Analysis.denominatorDegree(dtf)], redeclare Real B[DiscreteTransferFunction.Analysis.denominatorDegree(dtf), 1], redeclare Real B2[DiscreteTransferFunction.Analysis.denominatorDegree(dtf), 1], redeclare Real C[1, DiscreteTransferFunction.Analysis.denominatorDegree(dtf)], redeclare Real D[1, 1]) "Discrete state space record";
end toDiscreteStateSpace;

Generated at 2024-04-28T18:16:21Z by OpenModelicaOpenModelica 1.22.3 using GenerateDoc.mos