functiontimeResponse

Calculate the time response of a state space system

Extends from Modelica_LinearSystems2.Internal.timeResponseMask2 (Declares the common structure for the set of response functions).

Information

Syntax

(y, t, x) = StateSpace.Analysis.timeResponse(ss, dt, tSpan, responseType, x0)

Description

This function calculates the time responses of a 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"

The state space system is transformed to a appropriate discrete state space system and, starting at x(t=0)=x0 and y(t=0)=C*x0 + D*u0, the outputs y and x are calculated for each time step t=k*dt.

Example

  Modelica_LinearSystems2.StateSpace ss=Modelica_LinearSystems2.StateSpace(
    A=[-1],
    B=[1],
    C=[2],
    D=[0]);
  Real 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.StateSpace.Analysis.timeResponse(ss,Ts,tSpan,response,x0);
  // y[:,1,1] = {0, 0.19, 0.3625, 0.518, 0.659}
  //        t = {0, 0.1, 0.2, 0.3, 0.4}
  // x[:,1,1] = {0, 0.0952, 0.1813, 0.2592, 0.33}

Inputs

TypeNameDefaultDescription
TimeResponseresponseTimeResponse.StepType of time response
StateSpacesc (from timeResponseMask2)State space system
Realdt (from timeResponseMask2)0Sample time [s]
RealtSpan (from timeResponseMask2)0Simulation time span [s]
Real[size(sc.A, 1)]x0zeros(size(sc.A, 1))Initial state vector

Outputs

TypeNameDefaultDescription
Real[:,size(sc.C, 1),size(sc.B, 2)]y (from timeResponseMask2)Output response: (number of samples) x (number of outputs) x (number of inputs)
Real[:]t (from timeResponseMask2)Time vector: (number of samples)
Real[:,size(sc.A, 1),size(sc.B, 2)]x_continuous (from timeResponseMask2)State trajectories: (number of samples) x (number of states) x (number of inputs)

Revisions

Date Author Comment
2010-05-31 Marcus Baur, DLR-RM Realization