| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → SimPowerSystems |
| Contents | Index |
| Learn more about SimPowerSystems |
| On this page… |
|---|
Once the proper method (continuous, discrete, or phasor), solver type, and parameters have been selected, 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 pane. 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 Simulink Accelerator mode is explained in the Accelerating Models documentation.
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 Real-Time Workshop® software to generate this code on the fly. Although the Accelerator mode uses this technology, Real-Time Workshop license 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 Accelerator from the Simulation menu of your model window. Alternatively, you can select Accelerator from the pull-down menu in the model window toolbar.
The following table shows typical performance gains obtained with discretization and Accelerator mode applied on the following two demos: a DC drive using a chopper and the AC-DC converter using a three-phase, three-level voltage-sourced converter. Two versions of the DC drive model are provided in the Demos library: a continuous version, power_dcdrive, and a discrete version, power_dcdrive_disc. The AC-DC converter is available as the power_3levelVSC demo.
Simulation Time in Seconds* | ||
|---|---|---|
Simulation Method | DC drive (Stop time = 2 s) | AC-DC converter (Stop time = 0.2 s) |
Continuous: ode23tb default parameters | 12 | — |
Discrete | 9.0 (Ts = 10 µs) | 14.5 (Ts = 5 µs) |
Discrete + Accelerator | 5.2 (Ts = 10 µs) | 3.3 (Ts = 5 µs) |
* Simulation times obtained on a Pentium IV 2.6 GHz processor, with 512 MB of RAM
The table shows how discretizing your circuit speeds up the simulation by a factor of 1.33 for the DC drive. Using the Accelerator mode, an additional factor of 1.7 performance gain is obtained. For the AC-DC converter the Accelerator mode provides a gain of 4.4 times. For complex power electronic converter models, the Accelerator mode provides performance gains up to factors of 15.
To take full advantage of the performance enhancements made possible by converting your models to code, you must use Real-Time Workshop software to generate stand-alone C code. You can then compile and run this code and, with xPC Target™ software, also run it on a target PC operating the xPC Target real-time kernel.
![]() | Simulating Power Electronic Models | The Nonlinear Model Library | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |