ss = StateSpace.Import.fromModel(modelName, T_linearize, fileName)
Generate a StateSpace data record by linearization of a model defined by modelName. The linearization is performed at time T_linearize of the simulation. The result of linearization is transformed into a StateSpace record.
String modelName = "Modelica_LinearSystems2.Utilities.Plants.DoublePendulum"; Real T_linearize = 5; algorithm ss = Modelica_LinearSystems2.StateSpace.Import.fromModel(modelName, T_linearize); // ss.A = [ 0.0, 1.0, 0.0, 0.0, 0.0, 0.0; 0.0, 0.0, -2.26, 0.08, 1.95, -0.45; 0.0, 0.0, 0.0, 1.0, 0.0, 0.0; 0.0, 0.0, -3.09, -1.38, 7.70, -3.01; 0.0, 0.0, 0.0, 0.0, 0.0, 1.0; 0.0, 0.0, -6.47, 1.637, -2.90, 1.29], // ss.B=[0.0; 0.13; 0.0; -0.014; 0.0; -0.1], // ss.C=identity(6), // ss.D=[0; 0; 0; 0; 0; 0]
function read_dslin import Modelica; import DymolaCommands; import Modelica_LinearSystems2.StateSpace; input String fileName = "dslin" "Name of the result file"; output StateSpace result(redeclare Real A[nx, nx], redeclare Real B[nx, nu], redeclare Real C[ny, nx], redeclare Real D[ny, nu]) "Outputs model linearized at initial point"; end read_dslin;