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-level 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 running your model from the command line|
Scopes and viewers do not update if you run your model from the command line in Rapid Accelerator mode.
Use this decision tree to select between Accelerator, or Rapid Accelerator modes.
See Comparing Performance to understand how effective the accelerator modes will be in improving the performance of your model.