Discrete Varying Delay
Discrete varying delay with support for fixed delay and zero delay (direct feedthrough)
Since R2024a
Libraries:
Control System Toolbox /
Linear Parameter Varying
Description
The Discrete Varying Delay block extends the functionality of the Variable Integer Delay (Simulink) block in the Simulink
/
Discrete
library by providing additional support for specifying fixed and
zero delays. This block is helpful when you want to model a mix of zero, fixed, and varying
delays, which can occur in LPV models.
Examples
Use Discrete Varying Delay Block to Model Different Types of Delays in Multichannel Signals
This example shows how to use the Discrete Varying Delay block provided with the Control System Toolbox™ library. This block is useful when you want to model fixed, varying, and zero delays for individual channels in the signal using just one block.
Open the model provided with this example.
mdl = "DiscreteVarDelayModel";
open_system(mdl)
This model contains a ramp source connected to a Rate Transition block to generate a 3-by-1 discrete signal with sample time 0.2 s. The ramp signals have a slope of 1, 2, and 3 at the corresponding indices. The Sine Wave block generates a signal for the varying delay port.
For this model, specify:
A varying delay with a nominal delay of 1 s (5 samples) in the first channel of the ramp signal. The instantaneous value of the varying delay value is provided by the Sine Wave block. When the varying delay output is noninteger, the block rounds the delay value to the nearest integer.
A fixed delay of 3 s (15 samples) in the second channel of the ramp signal.
A zero delay (feedthrough) for the third channel of the ramp signal.
Configure the block parameters as shown.
Specify the nominal delay parameter as a vector with values 5, 15, and 0 corresponding to the delays (in samples) in each channel. Use the Fixed delays (indices) parameter to specify fixed delays for channels 2 and 3.
Examine the structure under the block mask. The block automatically configures the delays based on the specified settings. The varying delay length input has a Saturation block to ensure that the delay is nonnegative. Therefore, it provides a value of 0 when sin(k*Ts)
becomes negative. The block also rounds any noninteger input values to the nearest integer value.
Run the model and view the result.
sim(mdl);
As you can see, the first channel has a varying delay, the second channel has a fixed delay of 3 s (15 samples), and the third channel has zero delay.
close_system(mdl)
Ports
Input
u — Data input signal
scalar | vector
Input data signal delayed according to parameters settings.
This port has direct feedthrough when you specify a signal delay as fixed using
the Fixed delays (indices) parameter and specify a value
0
for the Nominal delay parameter.
d — Delay length
scalar | vector
Instantaneous delay length input specified as a scalar or vector. This value is used to specify the varying delay. The block treats any negative input values as zero.
When the delay length input is a noninteger value, the block rounds the value to the nearest integer.
Output
Port_1 — Output signal
scalar | vector
Output signal specified as a scalar or vector.
Parameters
To edit block parameters interactively, use the Property Inspector. From the Simulink® Toolstrip, on the Simulation tab, in the Prepare gallery, select Property Inspector.
Nominal delay (number of samples) — Nominal value of delay
1 (default) | nonnegative integer | vector of nonnegative integer values
Specify the nominal value of delays as the number of samples.
Maximum delay — Maximum value of delay length input
10
(default) | nonnegative integer | vector of nonnegative integer values
Set the maximum value of the time delay input. This value defines the largest delay length input that this block allows. The block clips any delay that exceeds this value.
Fixed delays (indices) — Signal indices with fixed delays
[]
(default) | positive scalar | vector of positive values
Specify the indices of the input signal channels where the delays are fixed. For
example, if you have a 4-by-1 input signal and you want to specify fixed delay in the
first and fourth channel, use a value [1 4]
for this parameter. The
block uses the value specified at the corresponding index of the Nominal
delay parameter.
When you list all channels as fixed, the block disables the second input port Port_2.
Initial output — Initial output
0
(default) | scalar | vector
For each input channel, specify the output value until the simulation time first exceeds the time delay for the channel.
Sample time (-1 for inherited) — Sample time
-1
(default) | positive scalar
Specify the time interval between samples. To inherit the sample time, set this
parameter to -1
. This block supports discrete sample time, but not
continuous sample time.
Prevent direct feedthrough with minimum delay of 1 — Prevent direct feedthrough
off
(default) | on
Select to increase the minimum delay length from zero to 1.
Selecting this check box prevents direct feedthrough from the input port, u, to the output port.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Version History
Introduced in R2024a
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)