Model Variable Propagation Delay
Open the model VariablePropagationDelay
. The model uses the Propagation Delay block to delay the output from a Sine Wave block. The delay signal is modeled using a Step block.
The Sine Wave
and Delay
signals are logged using signal logging. The Delayed Sine Wave
signal is logged using output logging.
mdl = "VariablePropagationDelay";
open_system(mdl)
Simulate the model. Then, open the Simulation Data Inspector and use the Simulink.sdi.loadView
function to load the view VariablePropDelayView.mldatx
.
out = sim(mdl);
Simulink.sdi.view
Simulink.sdi.loadView("VariablePropDelayView.mldatx");
The delay signal value must be greater than zero throughout the simulation, so the Step block is configured to step from an initial value of 0.2
to a value of 1
at a simulation time of 2
seconds.
For the first simulation step, at 0
seconds, the Delayed Sine Wave
signal value is the Initial output value defined for the Propagation Delay block, 0.1
.
On the next time step, the delay of 0.2
seconds has elapsed, and the Propagation Delay block output is determined by the delayed sample values.
When the simulation reaches 2
seconds, the step occurs, and the delay becomes 1
second instead of 0.2
seconds. The Propagation Delay block holds the output value for the 1
second delay. Then, the output updates to the sample taken when the step occurred. For the rest of the simulation, the delay between the input and output is 1
second, and the Propagation Delay block output is determined by input signal samples.