Delay expression

delay(expr, delayTime, delayMax)delay(expr, delayTime)

Returns `"expr(time - delayTime)"`

for ```
time
> time.start + delayTime
```

and
`"expr(time.start)"`

for ```
time ≤ time.start +
delayTime
```

. The arguments, i.e., `expr`

,
`delayTime`

and `delayMax`

, need to be
subtypes of Real. `delayMax`

needs to be additionally a
parameter expression. The following relation shall hold: ```
0 ≤
delayTime ≤ delayMax
```

, otherwise an error occurs. If
`delayMax`

is not supplied in the argument list,
`delayTime`

need to be a parameter expression.

*[The delay operator allows a numerical
sound implementation by interpolating in the (internal) integrator
polynomials, as well as a more simple realization by interpolating
linearly in a buffer containing past values of expression expr.
Without further information, the complete time history of the
delayed signals need to be stored, because the delay time may
change during simulation. To avoid excessive storage requirements
and to enhance efficiency, the maximum allowed delay time has to be
given via delayMax, or delayTime must be a parameter expression (so
that the constant delay is known before simulation starts). This
gives an upper bound on the values of the delayed signals which
have to be stored. For realtime simulation where fixed step size
integrators are used, this information is sufficient to allocate
the necessary storage for the internal buffer before the simulation
starts. For variable step size integrators, the buffer size is
dynamic during integration. In principal, a delay operator could
break algebraic loops. For simplicity, this is not supported
because the minimum delay time has to be give as additional
argument to be fixed at compile time. Furthermore, the maximum step
size of the integrator is limited by this minimum delay time in
order to avoid extrapolation in the delay buffer.]*

modelDelay Real x; Real y;equation der(x) = 2; y =delay(x, 1);endDelay;

Generated at 2019-07-17T01:39:38Z by OpenModelicaOpenModelica 1.14.0~dev-26604-gbda57e7 using GenerateDoc.mos