delay
Return past value of operand
Parent Section: equations
Syntax
delay(u,tau,History=u0,MaximumDelay=taumax)
Description
Use the delay operator in the
equations section to refer to past values of
expressions:
delay(u,tau) = u(t-tau)
The full syntax is:
delay(u,tau,History=u0,MaximumDelay=taumax)
The required operands are:
u— The first operand is the Simscape™ expression being delayed. It can be any numerical expression that does not itself includedelayorderoperators.tau— The second operand is the delay time. It must be a numerical expression with the unit of time. The value oftaucan change, but it must remain strictly positive throughout the simulation.
The optional operands may appear in any order. They are:
History— The return value for the initial time interval (t<=StartTime+tau). The units ofuandu0must be commensurate. The defaultu0is 0.MaximumDelay— The maximum delay time.taumaxmust be a constant or parametric expression with the unit of time. If you specifyMaximumDelay = taumax, a runtime error will be issued whenevertaubecomes greater thantaumax.Note
You have to specify
MaximumDelayif the delay time,tau, is not a constant or parametric expression. Iftauis a constant or parametric expression, its value is used as the default forMaximumDelay, that is,taumax=tau.
At any time t, delay(u,tau) returns a
value approximating u( t -
tau) for the current value of
tau. More specifically, the expression
delay(u,tau, History = u0) is equivalent to
if t <= (StartTime + tau)
return u0(t)
else
return u(t-tau)
end In other words, during the initial time interval, from the start of simulation and
until the specified delay time, tau, has elapsed, the
delay operator returns u0 (or 0, if
History is not specified). For simulation times greater than
tau, the delay operator returns the past value
of expression, u( t -
tau).
Note
When simulating a model that contains blocks with delays, memory allocation for storing the data history is controlled by the Delay memory budget [kB] parameter in the Solver Configuration block. If this budget is exceeded, simulation errors out. You can adjust this parameter value based on your available memory resources.
For recommendations on how to linearize a model that contains blocks with delays, see Linearizing with Simulink Linearization Blocks.
Examples
Model Examples
Version History
Introduced in R2012a
