Documentation |
During a model update, for example at the beginning of a simulation, Simulink^{®} uses a process called sample time propagation to determine the sample times of blocks that inherit their sample times. The figure below illustrates a Discrete Filter block with a sample time period T_{s} driving a Gain block.
Because the output of the Gain block is the input multiplied by a constant, its output changes at the same rate as the filter. In other words, the Gain block has an effective sample rate equal to the sample rate of the filter. The establishment of such effective rates is the fundamental mechanism behind sample time propagation in Simulink.
Simulink uses the following basic process to assign sample times to blocks that inherit their sample times:
Propagate known sample time information forward.
Propagate known sample time information backward.
Apply a set of heuristics to determine additional sample times.
Repeat until all sample times are known.
A block having a block-based sample time inherits a sample time based on the sample times of the blocks connected to its inputs, and in accordance with the following rules:
If... | Then... |
---|---|
all of the inputs have the same sample time and the block can accept that sample time | Simulink assigns the sample time to the block |
the inputs have different discrete sample times and all of the input sample times are integer multiples of the fastest input sample time | Simulink assigns the sample time of the fastest input to the block . (This assignment assumes that the block can accept the fastest sample time.) |
the inputs have different discrete sample times, some of the input sample times are not integer multiples of the fastest sample time, and the model uses a variable-step solver | Simulink assigns a fixed-in-minor-step sample time to the block. |
the inputs have different discrete sample times, some of the input sample times are not integer multiples of the fastest sample time, the model uses a fixed-step solver, and Simulink can compute the greatest common integer divisor (GCD) of the sample times coming into the block, | Simulink assigns the GCD sample time to the block. Otherwise, Simulink assigns the fixed step size of the model to the block. |
the sample times of some of the inputs are unknown, or if the block cannot accept the sample time | Simulink determines a sample time for the block based on a set of heuristics. |