Main Content

Time-Based Scheduling

Solver, sample rates and transitions, tasking, real-time execution, timers

Models run at one or more sample times. The flexibility offered for developing multirate models imposes challenges for generating code that can execute in real time in a multitasking environment. To make multirate models operate as expected in real time (that is, to give the right answers), you sometimes must modify a model or instruct the Simulink engine to modify the model for you.

Topics

Time-Based Scheduling and Code Generation

Generate code that meets real-time execution requirements after reviewing sample time and tasking mode considerations.

Configure C Code Generation for Model Entry-Point Functions

Learn about generated C entry-point functions, configuration options, and how to interface with them.

Execution of Code Generated from a Model

Execute code generated from single-tasking and multitasking models for rapid-prototyping and embedded system run-time environments.

Modeling for Single-Tasking Execution

Use the base sample rate of a model to define the time interval during which blocks in the model execute.

Modeling for Multitasking Execution

Include blocks that use different sample rates, or use different sample rates for continuous and discrete parts of a model.

Handle Rate Transitions

Handle transitions between blocks with different periodic sample rates.

Configure Time-Based Scheduling

Configure model configuration parameters that are relevant to time-based scheduling of generated code.

Use Discrete and Continuous Time

Design models that include discrete and continuous time blocks.

Optimize Multirate Multitasking Execution for RTOS Run-Time Environments

Improve performance of generated code by using real-time operating system (RTOS) task management mechanisms to eliminate redundant scheduling calls for multirate, multitasking models.

Time-Based Scheduling Example Models

Models that show time-based scheduling scenarios.