Real-Time Workshop | ![]() ![]() |
Slower to Faster Transitions in Real Time
In models where a slower block drives a faster block, the generated code assigns the faster block a higher priority than the slower block. This means the faster block is executed before the slower block, which requires special care to avoid incorrect results.
Figure 8-9: Time Overlaps in Slower to Faster Transitions
This timing diagram illustrates two problems:
To eliminate these problems, you must insert a Rate Transition block between the slower and faster blocks..
We assume that the Rate Transition block is used in its default (Protected/Deterministic) mode.
The picture below shows the timing sequence that results with the added Rate Transition block.
Three key points about this diagram:
The output portion of a Rate Transition block is executed at the sample rate of the slower block, but with the priority of the faster block. Since the Rate Transition block drives the faster block and has effectively the same priority, it is executed before the faster block. This solves the first problem.
The second problem is alleviated because the Rate Transition block executes at a slower rate and its output does not change during the computation of the faster block it is driving.
Note This use of the Rate Transition block changes the model. The output of the slower block is now delayed by one time step compared to the output without a Rate Transition block. |
![]() | Slower to Faster Transitions in Simulink | Singletasking and Multitasking Execution of a Model: an Example | ![]() |