.Modelica_LinearSystems2.DiscreteStateSpace.Import.fromFile

Information

Syntax

dss = DiscreteStateSpace.Import.fromFile(fileName, matrixName)

Description

Reads and loads a discrete state space system from a mat-file fileName. The discrete System on the file must be described as:

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 (for more details see DiscreteStateSpace.'constructor'.fromStateSpace):

The file must contain

Example

algorithm
  file := Modelica.Utilities.Files.loadResource("modelica://Modelica_LinearSystems2/Resources/Data/dss.mat")
  dss:=Modelica_LinearSystems2.DiscreteStateSpace.Import.fromFile(file)
//  dss=StateSpace(
      A=[-4.5, 1.5, 4.0; -4.0, 1.0, 4.0; -1.5, -0.5, 1],
      B=[2; 1; 2],
      C=[1, 0, 0],
      D=[0],
      B2=[0;0;0],
      Ts=0.2,
      method=Trapezoidal);

Interface

encapsulated function fromFile
  import Modelica;
  import Modelica_LinearSystems2.DiscreteStateSpace;
  import Modelica_LinearSystems2.StateSpace;
  import Modelica_LinearSystems2;
  input String fileName = "dslin.mat" "Name of the state space system data file" annotation(
    Dialog(loadSelector(filter = "MAT files (*.mat);; All files (*.*)", caption = "state space system data file")));
  input String matrixName = "ABCD" "Name of the state space system matrix" annotation(
    Dialog);
  output DiscreteStateSpace result(redeclare Real A[nx, nx], redeclare Real B[nx, nu], redeclare Real B2[nx, nu], redeclare Real C[ny, nx], redeclare Real D[ny, nu]) "= model linearized at initial point";
end fromFile;

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