Real-Time Workshop | ![]() ![]() |
Building the Program for Singletasking Execution
To use singletasking execution, select the singletasking mode on the Solver page of the Simulation Parameters dialog box. If the solver mode is Auto
, singletasking is used in the following cases:
Model Execution
To generate code that executes correctly in real time, you may need to modify sample rate transitions within the model before generating code. To understand this process, first consider how Simulink simulations differ from real-time programs.
Simulating Models with Simulink
Before Simulink simulates a model, it orders all of the blocks based upon their topological dependencies. This includes expanding subsystems into the individual blocks they contain and flattening the entire model into a single list. Once this step is complete, each block is executed in order.
The key to this process is the proper ordering of blocks. Any block whose output is directly dependent on its input (i.e., any block with direct feedthrough) cannot execute until the block driving its input has executed.
Some blocks set their outputs based on values acquired in a previous time step or from initial conditions specified as a block parameter. The output of such a block is determined by a value stored in memory, which can be updated independently of its input. During simulation, all necessary computations are performed prior to advancing the variable corresponding to time. In essence, this results in all computations occurring instantaneously (i.e., no computational delay).
![]() | Singletasking | Executing Models in Real Time | ![]() |