# Discrete Variable Time Delay

Delay signal by variable time value

## Library

Simscape / Electrical / Specialized Power Systems / Control

• ## Description

The Discrete Variable Time Delay block delays the input signal by the value specified in the D input. At each simulation time step, the Discrete Variable Time Delay block saves the time and the input value in an internal buffer and outputs the previous input value determined by the delay input.

When the delay input is not an integer of the time step, the Discrete Variable Time Delay block performs linear interpolation. When the Direct feedthrough parameter is selected, the delay can be less than the simulation time step.

## Parameters

Maximum delay (s)

Specify the expected maximum delay of the D input delay, in seconds. The Maximum delay parameter determines the input buffer size. When the maximum delay is exceeded, the delay is clipped to the maximum delay value. Default is `1`.

Initial conditions

Specify the initial conditions of the signal. The block outputs the specified values until the first delayed sample of signal is out. Default is `0`.

Set to `0` to implement null initial output, or specify the N previous input values of signal to start from steady-state. The required number of input values is N = ceil(D1/Ts) where D1 is the value of the delay at t = 0, and Ts the sample time value. The figure shows the details of the initial conditions. Suppose, for example, that the signal is a 60 Hz sine wave, the initial delay is set to D1 = 10*Ts by the D input of the block, and the sample time is equal to 50e-6 s. The N previous input values of the signal are determined as follows:

```N = ceil(10*Ts)/Ts; % N=10 t = [-N*Ts:Ts:-1*Ts]; % time vector of the N previous inputs S_init = sin(2*pi*60*t); % The N previous input values of signal```
Sample time

Specify the time interval between the samples. Default is `50e-6`.

Direct feedthrough

When this check box is selected, the block can handle a delay less than the simulation time step. Otherwise the block extrapolates the input values. Default is selected.

## Inputs and Outputs

`In`

The signal. The input can be a scalar signal or a vector of signals. The dimension of the In and D inputs must be the same.

`D`

The value of the delay to apply to the signal. The input can be a scalar delay signal or a vector of delay signals. The dimensions of the In and D inputs must be the same.

`Out`

Returns the delayed signal.

## Characteristics

 Direct Feedthrough Yes Sample Time Discrete Scalar Expansion Yes, of input D and of the Initial conditions parameter Dimensionalized Yes Zero-Crossing Detection No

## Example

The `power_DiscreteVariableTimeDelay` example shows various uses of the Discrete Variable Time Delay block.

## Version History

Introduced in R2013a