.Modelica_LinearSystems2.DiscreteStateSpace.Import.fromModel

Information

Syntax

dss = DiscreteStateSpace.Import.fromModel(modelName, T_linearize, fileName, Ts, method)

Description

Generate a discrete state space 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 state space record and then converted into a discrete state space record.

Example

  String modelName = "Modelica_LinearSystems2.Utilities.Plants.DoublePendulum";
  Real T_linearize = 5;

algorithm
  dss = Modelica_LinearSystems2.DiscreteStateSpace.Import.fromModel(modelName, T_linearize);

// ss.A  = [1, 0.1, 0.0338415578929376, 0.00169207789464688, -0.010114371760331, -0.000505718588016548;
            0, 1, 0.676831157858752, 0.0338415578929376, -0.202287435206619,   -0.010114371760331;
            0, 0, 0.892698457060726, 0.0946349228530364, -0.0895698633812754,  -0.00447849316906376;
            0, 0, -2.14603085878547, 0.892698457060726, -1.79139726762551, -0.0895698633812755;
            0, 0, 0.0738077919657481, 0.0036903895982874, 1.0110083777752, 0.10055041888876;
            0, 0, 1.47615583931496, 0.0738077919657481, 0.220167555503916, 1.0110083777752];

// ss.B= [0.00170323086692055;
          0.0165800882263292;
         -0.00215003506298196;
         -0.02103518146498;
          0.00152042385523347;
          0.0144812915324601];

// ss.C=identity(6),
// ss.D= [0.000437113227802044;
          0.00874226455604088;
         -0.000549137994799829;
         -0.0109827598973295;
          0.000398179639293453;
          0.00796359278610463];

ss.B2  = [0.000437113227802044;
          0.00874226455604088;
         -0.000549137994866478;
         -0.0109827598973295;
          0.000398179639305232;
          0.00796359278610463];

Interface

function fromModel
  import Modelica;
  import DymolaCommands;
  import Simulator = DymolaCommands.SimulatorAPI;
  import Modelica_LinearSystems2;
  import Modelica_LinearSystems2.StateSpace;
  import Modelica_LinearSystems2.DiscreteStateSpace;
  input String modelName "Name of the Modelica model" annotation(
    Dialog(__Dymola_translatedModel(translate = true)));
  input Modelica.Units.SI.Time T_linearize = 0 "point in time of simulation to linearize the model";
  input String fileName = "dslin" "Name of the result file";
  input Modelica.Units.SI.Time Ts = 1 "Sample time";
  input Modelica_LinearSystems2.Utilities.Types.Method method = Modelica_LinearSystems2.Utilities.Types.Method.Trapezoidal "Discretization method";
  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]) "= discrete model linearized at initial point";
end fromModel;

Generated at 2024-04-24T18:15:52Z by OpenModelicaOpenModelica 1.22.3 using GenerateDoc.mos