Choosing a Simulation Mode
Simulation Mode Tradeoffs
In general, you must trade off simulation speed against flexibility when choosing either accelerator mode or rapid accelerator mode instead of normal mode.
Normal mode offers the greatest flexibility for making model adjustments and displaying results, but it runs the slowest.
Accelerator mode lies between normal and rapid accelerator modes in performance and in interaction with your model. Accelerator mode does not support most runtime diagnostics.
Rapid accelerator mode runs the fastest, but this mode does not support the debugger or profiler, and works only with those models for which C code or MEX file is available for all of the blocks in the model.
An exception to this rule occurs when you run multiple simulations, each of which executes in less than one second in normal mode. For example:
for i=1:100 sim(model); % executes in less than one second in Normal mode end
To gain additional flexibility, consider using model referencing to componentize your model. If the top model uses normal mode, then you can simulate a referenced model in a different simulation mode than you use for other portions of a model. During the model development process, you can choose different simulation modes for different portions of a model. For details, see Choose Simulation Modes for Model Hierarchies.
The following table compares the characteristics of normal mode, accelerator mode, and rapid accelerator mode.
|If you want to...||Then use this mode...|
|Run your model in a separate address space|
|Efficiently run batch and Monte Carlo simulations|
|Change model parameters such as solver, stop time without rebuilding|
|Change block tunable parameters such as gain|
|For more information on configuration set parameters which can be modified without requiring rebuild, see Code Regeneration in Accelerated Models|
|Accelerate your model even if C code or MEX file are not used for all blocks|
|Support Interpreted MATLAB Function blocks|
|Support Non-Inlined MATLAB language or Fortran S-Functions|
|Permit algebraic loops in your models|
|Have your model work with the debugger or profiler|
|Have your model include C++ code|
|Use scopes and signal viewers||See Behavior of Scopes and Viewers with Rapid Accelerator Mode|
|Use scopes and signal viewers when simulating your model programmatically|
Scopes and viewers do not update if you run your model programmatically in rapid accelerator mode.
Use this decision tree to select between accelerator mode and rapid accelerator mode.
See Comparing Performance to understand how effective acceleration will be in improving the performance of your model.