Using Simulink |
 |
Increasing Performance of Accelerator Mode
In general, the Simulink Accelerator creates code optimized for speed with most blocks available in Simulink. There are situations, however, where you can further improve performance by adjusting your simulation or being aware of Accelerator behavior. These include
- Simulation Parameters dialog box -- The options in the Diagnostics and Advanced panes can affect Accelerator performance. To increase the performance:
- Disable Consistency checking and Bounds checking on the Diagnostics pane.
- Set Signal storage reuse on in the Advanced pane.
- Stateflow -- The Accelerator is fully compatible with Stateflow, but it does not improve the performance of the Stateflow portions of models. Disable Stateflow debugging and animation to increase performance of models that include Stateflow blocks.
- User-written S-functions -- The Accelerator cannot improve simulation speed for S-functions unless you inline them using the Target Language Compiler. Inlining refers to the process of creating TLC files that direct Real-Time Workshop to create C code for the S-function. This eliminates unnecessary calls to the Simulink application program interface (API).
- For information on how to inline S-functions, consult the Target Language Compiler Reference Guide, which is available on the MathWorks Web site,
www.mathworks.com
. It is also available on the documentation CD provided with MATLAB.
- S-functions supplied by Simulink and blocksets -- Although the Simulink Accelerator is compatible with all the blocks provided with Simulink and blocksets, it does not improve the simulation speed for M-file or C-MEX S-Function blocks that do not have an associated inlining TLC file.
- Logging large amounts of data -- If you use Workspace I/O, To Workspace, To File, or Scope blocks, large amounts of data will slow the Accelerator down. Try using decimation or limiting outputs to the last N data points.
- Large models -- In both Accelerator and Normal mode, Simulink can take significant time to initialize large models. Accelerator speed up can be minimal if run times (from start to finish of a single simulation) are small.
| Handling Changes in Model Structure | | Blocks That Do Not Show Speed Improvements |  |