dss = DiscreteStateSpace.Import.fromFile(fileName, matrixName)
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
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);
encapsulated function fromFile import Modelica; import Modelica.Utilities.Streams.readRealMatrix; import Modelica_LinearSystems2.DiscreteStateSpace; import Modelica_LinearSystems2.Utilities.Streams.readSystemDimension; 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]) "State space description of model read from file"; end fromFile;