Skip to Main Content Skip to Search
Product Documentation

Designing Your Model for Effective Acceleration

Selecting Blocks for Accelerator Mode

The Accelerator simulation mode runs the following blocks as if you were running Normal mode because these blocks do not generate code for the accelerator build. Consequently, if your model contains a high percentage of these blocks, the Accelerator mode may not increase performance significantly. All of these Simulink blocks use interpreted code.

Selecting Blocks for Rapid Accelerator Mode

Blocks that do not support code generation (such as SimEvents®), or blocks that generate code only for a specific target (such as vxWorks), cannot be simulated in Rapid Accelerator mode.

Additionally, Rapid Accelerator mode does not work if your model contains any of the following blocks:

Controlling S-Function Execution

Inlining S-functions using the Target Language Compiler increases performance with the Accelerator mode by eliminating unnecessary calls to the Simulink application program interface (API). By default, however, the Accelerator mode ignores an inlining TLC file for an S-function, even though the file exists. The Rapid Accelerator mode always uses the TLC file if one is available.

A device driver S-Function block written to access specific hardware registers on an I/O board is one example of why this behavior was chosen as the default. Because the Simulink software runs on the host system rather than the target, it cannot access the targets I/O registers and so would fail when attempting to do so.

To direct the Accelerator mode to use the TLC file instead of the S-function MEX-file, specify SS_OPTION_USE_TLC_WITH_ACCELERATOR in the mdlInitializeSizes function of the S-function, as in this example:

static void mdlInitializeSizes(SimStruct *S)
{
/* Code deleted */
ssSetOptions(S, SS_OPTION_USE_TLC_WITH_ACCELERATOR);
}

Accelerator and Rapid Accelerator Mode Data Type Considerations

Behavior of Scopes and Viewers with Rapid Accelerator Mode

Running the simulation from the command line or the menu determines the behavior of scopes and viewers in Rapid Accelerator mode.

Scope or Viewer TypeSimulation Run from MenuSimulation Run from Command Line
Simulink Scope blocksSame support as Normal mode
  • Logging is supported

  • Scope window is not updated

Simulink signal viewer scopesGraphics are updated, but logging is not supportedNot supported
Other signal viewer scopesSupport limited to that available in External modeNot supported
Signal loggingNot supportedNot supported
Multirate signal viewersNot supportedNot supported
Stateflow Chart blocksSame support for chart animation as Normal modeNot supported

Rapid Accelerator mode does not support multirate signal viewers such as the DSP System Toolbox spectrum scope or the Communications System Toolbox™ scatterplot, signal trajectory, or eye diagram scopes.

Factors Inhibiting Acceleration

You cannot use the Accelerator or Rapid Accelerator mode if your model:

Rapid Accelerator mode does not support targets written in C++.

For Rapid Accelerator mode, model parameters must be one of these data types:

Reserved Keywords

Certain words are reserved for use by the Simulink Coder code language and by Accelerator mode and Rapid Accelerator mode. These keywords must not appear as function or variable names on a subsystem, or as exported global signal names. Using the reserved keywords results in the Simulink software reporting an error, and the model cannot be compiled or run.

The keywords reserved for the Simulink Coder product are listed in Configuring Generated Identifiers. Additional keywords that apply only to the Accelerator and Rapid accelerator modes are:

muDoubleScalarAbs muDoubleScalarCosmuDoubleScalarMod
muDoubleScalarAcos muDoubleScalarCoshmuDoubleScalarPower
muDoubleScalarAcoshmuDoubleScalarExpmuDoubleScalarRound
muDoubleScalarAsinmuDoubleScalarFloormuDoubleScalarSign
muDoubleScalarAsinh muDoubleScalarHypotmuDoubleScalarSin
muDoubleScalarAtan,muDoubleScalarLogmuDoubleScalarSinh
muDoubleScalarAtan2muDoubleScalarLog10muDoubleScalarSqrt
muDoubleScalarAtanhmuDoubleScalarMaxmuDoubleScalarTan
muDoubleScalarCeil muDoubleScalarMin muDoubleScalarTanh

  


Related Products & Applications

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

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