Real-Time Workshop |
 |
Rate Transition Block Options
Several parameters of the Rate Transition block are relevant to its use in code generation for real-time execution. These are discussed below. For full documentation of the Rate Transition block and its block parameters, see the Simulink Blocks section of Using Simulink.
The Rate Transition block handles both types of transitions (fast to slow, and slow to fast). When inserted between two blocks of differing sample rates, the Rate Transition block detects the two rates and automatically configures its input and output sample rates for the appropriate type of transition.
The most critical decision you must make in configuring a Rate Transition block is the choice of data transfer mechanism to be used between the two rates. Your choice will be dictated by considerations of safety, memory usage, and performance. The data transfer mechanism is controlled by two options:
- Ensure data integrity during data transfer: When this option is on, the integrity of data transferred between rates is guaranteed (the data transfer is protected). When this option is off, data integrity is not guaranteed (the data transfer is unprotected). By default, Ensure data integrity during data transfer is on.
- Ensure deterministic data transfer (maximum delay): This option is enabled only for protected data transfer (when Ensure data integrity during data transfer is on). When this option is on, the Rate Transition block behaves like a Zero-Order Hold block (for fast to slow transitions) or a Unit Delay block (for slow to fast transitions). The Rate Transition block controls the timing of data transfer in a completely predictable way. When this option is off, the data transfer is non-deterministic. By default, Ensure deterministic data transfer (maximum delay) is on.
Thus the Rate Transition block offers three modes of operation with respect to data transfer. In order safety, from safest to least safe, these are:
- Protected/Deterministic (default): This is the safest mode. The drawback of this mode is that it introduces latency into the system:
- Fast to slow transition: maximum latency is 1 sample period of the slower task.
- Slow to fast transition: maximum latency is 2 sample periods of the slower task.
- Protected/Non-Deterministic: In this mode, data integrity is protected by double-buffering data transferred between rates. The blocks downstream from the Rate Transition block always use the latest available data from the block that drives the Rate Transition block. Maximum latency is less than or equal to 1 sample period of the faster task.
- The drawbacks of this mode are its non-deterministic timing and its use of extra memory buffers. The advantage of this mode is its low latency.
- Unprotected/Non-Deterministic: This mode is the least safe, and is not recommended for mission-critical applications. The latency of this mode is the same as for Protected/Non-Deterministic mode, but memory requirements are reduced since there is no double-buffering.
Note
In unprotected mode (Ensure data integrity during data transfer option off), the Rate Transition block does nothing other than allow the rate transition to exist in the model.
|
The next four sections describe cases in which Rate Transition blocks are necessary for sample rate transitions. The discussion and timing diagrams in these sections are based on the assumption that the Rate Transition block is used in its default (Protected/Deterministic) mode, with the Ensure data integrity during data transfer and Ensure deterministic data transfer (maximum delay) options on.
| Data Transfer Problems | | Faster to Slower Transitions in Simulink |  |