(y, t, x) = ZerosAndPoles.Analysis.timeResponse(zp, dt, tSpan, responseType, x0)
First, the ZerosAndPoles record is transformed into state space representation which is given to StateSpace.Analysis.timeResponse to calculate the time response of the 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.
p=Modelica_LinearSystems2.ZerosAndPoles.p(); Modelica_LinearSystems2.ZerosAndPoles zp=1/(p^2 + p + 1) Real Ts=0.1; Real tSpan= 0.4; Modelica_LinearSystems2.Types.TimeResponse response=Modelica_LinearSystems2.Types.TimeResponse.Step; Real x0[2]={0,0}; Real y[5,1,1]; Real t[5]; Real x[5,1,1] algorithm (y,t,x):=Modelica_LinearSystems2.ZerosAndPoles.Analysis.timeResponse(zp,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}
encapsulated function timeResponse import Modelica_LinearSystems2; import Modelica_LinearSystems2.StateSpace; import Modelica_LinearSystems2.ZerosAndPoles; import Modelica_LinearSystems2.Utilities.Types.TimeResponse; extends Modelica_LinearSystems2.Internal.timeResponseMask2_zp; input TimeResponse response = TimeResponse.Step; input Real x0[ZerosAndPoles.Analysis.denominatorDegree(zp)] = zeros(ZerosAndPoles.Analysis.denominatorDegree(zp)) "Initial state vector"; end timeResponse;