.ModelicaReference.Operators.'delay()'

Information

Delay expression

Syntax

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

Description

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.]

Examples

model Delay
  Real x;
  Real y;
equation
  der(x) = 2;
  y = delay(x, 1);
end Delay;
Simulation result
Generated at 2020-06-05T07:38:22Z by OpenModelica 1.16.0~dev-420-gc007a39