Products & Services Industries Academia Support User Community Company

Learn more about Simulink   

Referenced Model Simulation Modes

About Referenced Model Simulation Modes

Simulink executes the top model in a model reference hierarchy just as it would if no referenced models existed. All Simulink simulation modes are available to the top model. Simulink can execute a referenced model in any of three modes: Normal, Accelerator, or Processor-in-the-loop (PIL).

Normal Mode

Simulink executes a Normal mode submodel interpretively, as if the submodel were an atomic subsystem implemented directly within the parent model. Normal mode:

Simulation results for a given model are essentially identical in either Normal or Accelerator mode. Trivial differences may occur due to differences in the optimizations and libraries used.

Accelerator Mode

Simulink executes an Accelerator mode submodel by creating a MEX-file (or simulation target) for the submodel, then running the MEX-file. See Model Reference Simulation Targets for more information. Accelerator mode:

Simulation results for a given model are essentially identical in either Normal or Accelerator mode. Trivial differences may occur due to differences in the optimizations and libraries used.

Processor-in-the-loop (PIL) mode

Simulink executes a PIL-mode referenced model by:

Simulink PIL mode:

For more information, see Verifying Compiled Object Code with Processor-in-the-Loop Simulation in the Real-Time Workshop Embedded Coder documentation.

Specifying the Simulation Mode

The Model block for each instance of a referenced model controls its simulation mode. The default referenced model simulation mode is Accelerator mode. To set or change a submodel's simulation mode:

  1. Access the Model block's parameter dialog box. (See Navigating a Model Block.)

  2. Set the Simulation mode field to Normal, Accelerator, or Processor-in-the-loop (PIL).

  3. Click OK or Apply.

Mixing Simulation Modes

When a parent model executes in Normal mode, it can contain Normal mode, Accelerator mode, and PIL mode submodels. At most one instance of a given model can execute in Normal mode. A submodel can execute in Normal mode only if every model that is superior to it in the hierarchy also executes in Normal mode. A Normal mode path then extends from the top model through the model reference hierarchy down to the Normal mode submodel.

When a parent model executes in Accelerator mode, all subordinate models must also execute in Accelerator mode. When a Normal mode model is subordinate to an Accelerator mode model, Simulink posts a warning and temporarily overrides the Normal mode specification. When a PIL-mode model is subordinate to an Accelerator mode model, an error occurs.

When a parent model executes in PIL mode, all subordinate models also execute in PIL mode regardless of the simulation mode specified by their Model blocks. The PIL mode Model block uses the model reference targets of the blocks beneath. Only one branch (top model and all subordinates) in a model reference hierarchy can execute in PIL mode. For more information, see Verifying Compiled Object Code with Processor-in-the-Loop Simulation in the Real-Time Workshop Embedded Coder documentation, and Creating Model Components in the Real-Time Workshop documentation.

Accelerating a Freestanding or Top Model

You can use Simulink Accelerator mode (see Accelerating Models) or Rapid Accelerator mode (see Testing and Refining Concept Models With Standalone Rapid Simulations) to achieve faster execution of any Simulink model, including a top model in a model reference hierarchy.

When you execute a top model in Simulink Accelerator mode or Rapid Accelerator mode, all submodels execute in Accelerator mode. For any submodel that specifies Normal mode, Simulink displays an error message.

Be careful not confuse Accelerator mode execution of a referenced model with:

While the different types of acceleration share many capabilities and techniques, they are implemented differently, and have different requirements and limitations.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS