> For the complete documentation index, see [llms.txt](https://www.opal-rt.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.opal-rt.com/docs/smart-power-simulation-software-sps/simulation-and-analysis/increase-simulation-speed.md).

# Increase Simulation Speed

## Ways to increase dimulation speed

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.

* Discretize 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.
* If you are simulating repeatedly from a particular operating point, specify a vector of initial states:
  1. Simulate your model. Save the initial states as a vector in the MATLAB® workspace.
  2. In Simulink®, in the Modeling tab, select Model Settings > Model Settings.
  3. In the left pane of the Configuration Parameters dialog box, select Data Import/Export.
  4. Select the Initial state parameter and enter the name of the workspace variable that contains the vector of initial states.
* Reducing the number of open scopes and the number of points saved in the scope also helps reduce simulation time.
* Use 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.

## Using accelerator mode and simulink coder

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 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.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.opal-rt.com/docs/smart-power-simulation-software-sps/simulation-and-analysis/increase-simulation-speed.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
