MATLAB: Are the signals giving distorted results when using Transport Delay blocks in Simulink

delaysimulinktransport

I am working on a Simulnk model in which the input signal is a periodic square wave. I pass this signal through 4 successive transport delays of 0.082 seconds and plot the signal after each individual delay. I am simulating this model for 10 seconds with default solver options.
For some reason, after each delay the signal looks more and more distorted, up to the point where at the fourth delay it has a triangular waveform with several spikes in it.
What is the issue here?

Best Answer

Make sure to check that the solver options match up with the delay values specified. Because the solver options were default, the automatic maximum sample time is 0.2 seconds.
Since the input signal is a square wave and has many long, flat regions of constant value, the default variable-step solver can take larger time steps that are greater than the delay value of 0.082 seconds. This can lead to numerical issues, as seen in this case.
In order to resolve this issue, navigate to the Solver tab of the model's Configuration Parameters. There, you can set the maximum step size of the solver to 0.082 seconds to ensure that in the worst case, we can at least capture one delay time step in the simulation.