Main Content

On/Off Delay

Implement switch-on or switch-off delay

  • On/Off Delay block

Libraries:
Simscape / Electrical / Control / General Control

Description

The On/Off Delay block implements the following logic when the Select type parameter is set to On delay:

  • When the input becomes true, the output becomes true after a preset time delay. The output remains true as long as the input is true.

  • When the input is false or becomes false, the output becomes false with no delay.

  • When the Initial condition of previous input parameter is set to 1, and the input is true at t = 0, the output is true with no delay.

The On/Off Delay block implements the following logic when the Select type parameter is set to Off delay:

  • When the input becomes false, the output becomes false after a preset time delay. The output remains false as long as the input is false.

  • When the input is true or becomes true, the output is true with no delay.

  • When the Initial condition of previous input parameter is set to 0, and the input is false at t = 0, the output is false with no delay.

Characteristics

Direct FeedthroughYes
Sample TimeSpecified in the Sample Time parameter
Scalar ExpansionYes, of parameters
DimensionalizedYes
Zero-Crossing DetectionNo

Examples

The power_Logic example shows the operation of the On/Off Delay block.

The model sample time is parameterized with the variable Ts (default value Ts = 5e-3). To simulate a continuous On/Off Delay block, specify Ts = 0 in the MATLAB® Command Window.

Ports

Input

expand all

Input of Delay block.

Output

expand all

Output of Delay block. The value of the output depends on the value of the Select type and Initial condition of previous input parameters.

Parameters

expand all

To edit block parameters interactively, use the Property Inspector. From the Simulink® Toolstrip, on the Simulation tab, in the Prepare gallery, select Property Inspector.

Select between On delay (default for On Delay blocks) or Off delay (default for Off Delay blocks).

Duration of the delay, in seconds. When the Sample time parameter is greater than 0, the time delay value must be a multiple of the sample time.

Initial value of the previous input. Default is 0 for On Delay blocks and 1 for Off Delay blocks.

Sample time of the block, in seconds. Set to 0 to implement a continuous block.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2013a