MATLAB Examples

Multirate Modeling in Single-Tasking Mode (Bare Board, no OS)

This model shows the code generated for a multirate discrete-time model configured for single-tasking on a bare-board target (one with no operating system).


Open Example Model

Open the example model rtwdemo_mrstbb.


The model contains two sample times. Inport block 1 and Inport block 2 specify 1-second and 2-second sample times, respectively, which are enforced by the Periodic sample time constraint option on the Solver configuration page. The solver is set for single-tasking operation. Rate transition blocks are, therefore, not necessary between blocks executing at different sample times because preemption will not occur.

The model is configured to display sample-time colors upon diagram update. Red represents the fastest discrete sample time in the model, green represents the second fastest, and yellow represents mixed sample times. Double-click the yellow button in the model to update the diagram and show sample-time colors.