Once you have selected the proper method (continuous, discrete, or phasor), solver type, and parameters, there are additional steps you can take to optimize your simulation speed.
Discretizing your electric circuit and your control system. You can even use a larger sample time for the control system, provided that it is a multiple of the smallest sample time.
Simulating large systems or complex power electronic converters can be time consuming. If you have to repeat several simulations from a particular operating point, you can save time by specifying a vector of initial states in the Simulation > Configuration Parameters > Workspace IO dialog box. This vector of initial conditions must have been saved from a previous simulation run.
Reducing the number of open scopes and the number of points saved in the scope also helps in reducing the simulation time.
Using the Simulink® Accelerator mode. The performance gain obtained with the Accelerator varies with the size and complexity of your model. Typically you can expect performance improvements by factors of two to 10.
The Accelerator mode speeds up the execution of Simulink models by replacing the interpreted M code running beneath the Simulink blocks with compiled code as your model executes. The Accelerator mode uses portions of Simulink Coder™ to generate this code on the fly. Although the Accelerator mode uses this technology, Simulink Coder is not required to run it. Also, if you do not have your own C compiler installed, you can use the LCC compiler provided with your MATLAB® installation.
To activate the Accelerator mode, select Simulation > Mode > Accelerator from the toolbar of your model window. Alternatively,
you can select
Accelerator from the pull-down menu
in the model window toolbar.
To take full advantage of the performance enhancements made possible by converting your models to code, you must use Simulink Coder software to generate standalone C code. You can then compile and run this code and, with Simulink Real-Time™ software, also run it on a target PC operating the Simulink Real-Time real-time kernel.