Real-Time Workshop | ![]() ![]() |
Faster to Slower Transitions in Real Time
In models where a faster block drives a slower block, you must compensate for the fact that execution of the slower block may span more than one execution period of the faster block. This means that the outputs of the faster block may change before the slower block has finished computing its outputs. The following diagram illustrates a situation where this problem arises. The hashed area indicates times when tasks are preempted by higher priority before completion.
Figure 8-8: Time Overlaps in Faster to Slower Transitions (T = Sample Time)
In Figure 8-8, the faster block executes a second time before the slower block has completed execution. This can cause unpredictable results because the input data to the slow task is changing. Data integrity is not guaranteed in this situation.
To avoid this situation, you must hold the outputs of the 1 second (faster) block until the 2 second (slower) block finishes executing. The way to accomplish this is by inserting a Rate Transition block between the 1 second and 2 second blocks. This guarantees that the input to the slower block does not change during its execution, ensuring data integrity..
We assume that the Rate Transition block is used in its default (Protected/Deterministic) mode.
The Rate Transition block executes at the sample rate of the slower block, but with the priority of the faster block.
This ensures that the Rate Transition block executes before the 1 second block (its priority is higher) and that its output value is held constant while the 2 second block executes (it executes at the slower sample rate).
![]() | Faster to Slower Transitions in Simulink | Slower to Faster Transitions in Simulink | ![]() |