Main Content

Backpropagation in Sample Times

When you update or simulate a model that specifies the sample time of a source block as inherited (–1), the sample time of the source block may be backpropagated; Simulink®may set the sample time of the source block to be identical to the sample time specified by or inherited by the block connected to the source block. For example, in themodelbelow, the Simulink software recognizes that theSine Waveblock is driving aDiscrete-Time Integratorblock whose sample time is1; so it assigns theSine Waveblock a sample time of1.

You can verify this sample time setting by selectingInformation Overlays>Colorsfrom theDebugtab of the Simulink toolstrip and noting that both blocks are red. Because theDiscrete-Time Integratorblock looks at its input only during its sample hit times, this change does not affect the results of the simulation, but does improve the simulation performance.

Now replacing theDiscrete-Time Integratorblock with a continuousIntegratorblock, as shown in themodelbelow, causes theSine WaveandGainblocks to change to continuous blocks. You can test this change by, on theModelingtab, selectingUpdate Modelto update the colors. Both blocks now appear black.

Note

Backpropagation makes the sample times of model sources dependent on block connectivity. If you change the connectivity of a model whose sources inherit sample times, you can inadvertently change the source sample times. For this reason, when you update or simulate a model, by default, Simulink displays warnings at the command line if the model contains sources that inherit their sample times.SeeSource block specifies -1 sample timefor more information.

See Also

|