.Modelica_LinearSystems2.DiscreteStateSpace.Analysis.timeResponse

Information

Syntax

      (y) = DiscreteStateSpace.Analysis.timeResponse(responseType, dss)
(y, t, x) = DiscreteStateSpace.Analysis.timeResponse(responseType, dss, tSpan, x0)

Description

Function timeResponse calculates the time responses of a discrete state space system. The type of the time response is defined by the input responseType, i.e.

Impulse "Impulse response",
Step "Step response",
Ramp "Ramp response",
Initial "Initial condition response"

Starting at x(t=0)=x0 and y(t=0)=C*x0 + D*u0, the outputs y and states x are calculated for each time step t=k*dss.Ts.

Example

  Modelica_LinearSystems2.DiscreteStateSpace dss=Modelica_LinearSystems2.DiscreteStateSpace(
    A = [0.904837418036],
    B = [0.095162581964],
    C = [2],
    D = [0],
    B2 = [0],
    Ts = 0.1);

  Real tSpan = 0.4;

  Modelica_LinearSystems2.Types.TimeResponse response=Modelica_LinearSystems2.Types.TimeResponse.Step;

  Real x0[1] = {0};

  Real y[5,1,1];
  Real t[5];
  Real x[5,1,1]

algorithm
  (y,t,x):=Modelica_LinearSystems2.DiscreteStateSpace.Analysis.timeResponse(dss,tSpan,response,x0);
//  y[:,1,1] = {0, 0.1903, 0.3625, 0.5184, 0.6594}
//         t = {0, 0.1, 0.2, 0.3, 0.4}
//  x[:,1,1] = {0, 0.0952, 0.1813, 0.2592, 0.33}

Interface

encapsulated function timeResponse
  import Modelica_LinearSystems2;
  import Modelica_LinearSystems2.DiscreteStateSpace;
  import Modelica_LinearSystems2.Utilities.Types.TimeResponse;
  input TimeResponse response = TimeResponse.Step "Type of time response";
  extends Modelica_LinearSystems2.Internal.timeResponseMask_discrete(redeclare Real y[:, size(dss.C, 1), if response == TimeResponse.Initial then 1 else size(dss.B, 2)], redeclare Real x_discrete[:, size(dss.A, 1), if response == TimeResponse.Initial then 1 else size(dss.B, 2)]);
  input Real x0[size(dss.A, 1)] = zeros(size(dss.A, 1)) "Initial state vector";
end timeResponse;

Generated at 2024-12-26T19:25:54Z by OpenModelicaOpenModelica 1.24.3 using GenerateDoc.mos