functiontimeResponse

Calculate the time response of a transfer function

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

Information

Syntax

(y, t, x) = TransferFunction.Analysis.timeResponse(tf, dt, tSpan, responseType, x0)

Description

First, the transfer function representation is transformed into state space representation which is given to StateSpace.Analysis.timeResponse and the time response of the state space system is calculated. 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

  TransferFunction s = Modelica_LinearSystems2.TransferFunction.s();
  Modelica_LinearSystems2.TransferFunction tf=1/(s^2+s+1);

  Real Ts=0.1;
  Real tSpan= 0.4;
  Modelica_LinearSystems2.Types.TimeResponse response=Modelica_LinearSystems2.Types.TimeResponse.Step;
  Real x0[1]={0,0};

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

algorithm
  (y,t,x):=Modelica_LinearSystems2.TransferFunction.Analysis.timeResponse(tf,Ts,tSpan,response,x0);
//  y[:,1,1]={0, 0.0048, 0.0187, 0.04, 0.0694}
//         t={0, 0.1, 0.2, 0.3, 0.4}
//  x[:,1,1]={0, 0.0048, 0.0187, 0.04, 0.0694}

Inputs

TypeNameDefaultDescription
Modelica_LinearSystems2.TransferFunctiontf (from timeResponseMask2_tf)
Realdt (from timeResponseMask2_tf)0Sample time [s]
RealtSpan (from timeResponseMask2_tf)0Simulation time span [s]
Modelica_LinearSystems2.Utilities.Types.TimeResponseresponseModelica_LinearSystems2.Utilities.Types.TimeResponse.Step
Real[TransferFunction.Analysis.denominatorDegree(tf)]x0zeros(TransferFunction.Analysis.denominatorDegree(tf))Initial state vector

Outputs

TypeNameDefaultDescription
Real[:,1,1]y (from timeResponseMask2_tf)Output response: (number of samples) x (number of outputs) x (number of inputs)
Real[:]t (from timeResponseMask2_tf)Time vector: (number of samples)
Real[:,Modelica_LinearSystems2.TransferFunction.Analysis.denominatorDegree(tf),1]x_continuous (from timeResponseMask2_tf)State trajectories: (number of samples) x (number of states) x (number of inputs)