Real-Time Workshop User's Guide | ![]() ![]() |
Introduction
Every Simulink block can be classified according to its sample time as constant, continuous-time, discrete-time, inherited, or variable. Examples of each type include:
Blocks in the inherited category assume the sample time of the blocks that are driving them. Every Simulink block therefore has a sample time, whether it is explicit, as in the case of continuous or discrete blocks (continuous blocks have a sample time of zero), or implicit, as in the case of inherited blocks.
Simulink allows you to create models without any restrictions on connections between blocks with different sample times. It is therefore possible to have blocks with differing sample times in a model (a mixed-rate system). A possible advantage of employing multiple sample times is improved efficiency when executing in a multitasking real-time environment.
Simulink provides considerable flexibility in building these mixed-rate systems. However, the same flexibility also allows you to construct models for which the code generator cannot generate correct real-time code for execution in a multitasking environment. But to make these models operate correctly in real time (i.e., give the right answers), you must modify your model. In general, the modifications involve placing Unit Delay and Zero Order Hold blocks between blocks that have unequal sample rates. The sections that follow discuss the issues you must address to use a mixed-rate model successfully in a multitasking environment.
![]() | Models with Multiple Sample Rates | Single- Versus Multitasking Environments | ![]() |