Engee documentation

Variable Time Delay

Delay input for a variable amount of time.

variable time delay

Description

The Variable Time Delay block delays the input signal for a variable time interval.

The output data at the current time step is equal to the value of its input data at the previous time step. This step is the current simulation time minus the delay time specified by the time delay input.

τ

variable time delay 1

During the simulation, the block stores the time and input value pairs in an internal buffer. At the beginning of the simulation, the block outputs the Initial output value until the simulation time exceeds the time delay input. Then, at each simulation step, the block outputs the input signal received at a point in time that corresponds to the current simulation time minus the delay time.

If you want data at time points that are between the input storage times, and the solver is a continuous solver, the block performs linear interpolation between the points. If the time delay is smaller than the step size of the solver, the block extrapolates the output point based on the previous point. For example, consider a simulation with a fixed step solver with step size 1 and current time at t = 5. If the delay is 0.5, the block should generate a point at t = 4.5, but the most recently stored time value will be at t = 4. Thus, the block extrapolates the input data at time t=4.5 from the data generated at t=4 and then uses the extrapolated data in calculating the value at time t=5.

Extrapolating forwards from a previous time step may give a less accurate result than extrapolating backwards from the current time step. However, the block cannot use the current input to calculate its output value because the input port does not have a forward pass-through connection.

If the model specifies a discrete solver, the block does not interpolate between time steps. Instead, it returns the nearest stored value that precedes the desired value.

Ports

Input

Port_1 - input signal
scalar | vector | matrix

Define the input signal as a scalar, vector or matrix.

Data types: Float64.

t0 - input time delay
scalar | vector | matrix

Input time delay specified as a scalar, vector or matrix.

Data types: Float64.

Output

Port_1 - delayed output signal
scalar | vector | matrix

Define the output signal as a scalar, vector or matrix.

Data types: Float64.

Parameters

Main

Maximum delay - maximum value of the time delay input
10 (by default) | scalar | vector | matrix

Set the maximum value of the time delay input. This value determines the largest time delay input that this block allows. The block will truncate any delay that exceeds this value. This value cannot be negative. If the time delay becomes negative, the block trims it to zero.

Usage in program code

Block parameter

MaximumDelay

Values

scalar | vector |matrix

By default

10

Initial output - initial output value
0 (by default) | scalar | vector | matrix

Specify the output that the block generates until the simulation time exceeds the time delay input as a scalar, vector or matrix.

Usage in program code

Block parameter

InitialOutput

Values

scalar | vector | matrix

By default

0

Initial buffer size - initial memory allocation
1024 (by default) | scalar | vector

Define the initial memory allocation for the number of input points to store.

  • If the number of input points exceeds the initial buffer size, the block allocates additional memory.

Since memory allocation slows down the simulation, choose this value carefully if simulation speed is an issue. For long delays, this block may use a large amount of memory, especially for dimensional input signals.
Usage in program code

Block parameter

MaximumPoints

Values

scalar | vector | matrix

By default

1024

Use fixed buffer size - use fixed buffer size
off (by default) | on

Select this checkbox to use a fixed size buffer to save input data from previous time steps.

The Initial buffer size parameter determines the size of the buffer. If the buffer is full, new data replaces the data already in the buffer. The block uses linear extrapolation to estimate output values that are not in the buffer.

If the input data is linear, checking this box can save memory. If the input data is non-linear, do not select this check box. Doing so may result in inaccurate results.
Usage in program code

Block parameter

FixedBuffer

Values

disabled | enabled

By default

disabled

Handle zero delay - option to set zero delay
off (by default) | on

Define the possibility of block operation with zero time delay.

When this checkbox is selected, the unit allows zero time delay operation. The input signal has a direct through connection.

In the off position, the unit does not allow zero time delay operation. The input signal does not have a straight through connection.

Usage in program code

Block parameter

ZeroDelay

Values

off | on

By default

off