Real-Time Workshop    

Introduction

A 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. Continuous blocks have a nominal sample time of zero. Every Simulink block therefore has a sample time, whether it is explicit, as in the case of continuous or discrete blocks, 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. To make these models operate correctly in real time (i.e., to give the right answers), you must modify your model. In general, the modifications involve placing Rate Transition 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 Singletasking vs. Multitasking Environments