> 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/overview/how-sps-software-works.md).

# How SPS Software Works

Every time you start the simulation, a special initialization mechanism is called. This initialization process computes the state-space model of your electric circuit and builds the equivalent system that can be simulated by Simulink® software. This process performs the following steps:

{% stepper %}
{% step %}

### Sort blocks and evaluate topology

* Sorts all SPS blocks, gets the block parameters and evaluates the network topology.
* The blocks are separated into linear and nonlinear blocks.
* Each electrical node is automatically given a node number.
  {% endstep %}

{% step %}

### Compute state-space model and steady-state calculations

* Once the network topology has been obtained, the state-space model (A, B, C, D matrices) of the linear part of the circuit is computed.
* All steady-state calculations and initializations are performed at this stage.

Additional behaviors:

* If you have chosen to discretize your circuit, the discrete state-space model is computed from the continuous state-space model.
* If you are using the phasor solution method, the state-space model is replaced with the complex transfer matrix H(jω) relating inputs and outputs (voltage and current phasors) at the specified frequency. This matrix defines the network algebraic equations.
  {% endstep %}

{% step %}

### Build the Simulink model

* Builds the Simulink model of your circuit and stores it inside the Powergui block located at the top level of your model.
* The Simulink model uses an S-Function block to model the linear part of the circuit as well as the switches and power electronic devices.
* Predefined Simulink models are used to simulate nonlinear elements.
* Simulink Source blocks connected at the input of the State-Space block are used to simulate the electrical source blocks.
  {% endstep %}
  {% endstepper %}

The next figure represents the interconnections between the different parts of the complete Simulink model. The nonlinear models are connected in feedback between voltage outputs and current inputs of the linear model.

<figure><img src="https://799605156-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdlNg8IbOdahCpFCyzxSN%2Fuploads%2Fgit-blob-e69325745a0ac32b7fb7070f4e83e8244e950a5e%2FInterconnection_linear_nonlinear_circuit_model.png?alt=media" alt=""><figcaption><p><strong>Interconnection of Linear Circuit and Nonlinear Models</strong></p></figcaption></figure>

Once SPS Software has completed the initialization process, the simulation starts. You can observe waveforms on scopes connected at the outputs of your measurement blocks. Through the Powergui block, you can access the Linear System Analyzer and obtain transfer functions of your system between any pair of input and output. The Powergui block also allows you to perform an FFT analysis of recorded signals to obtain their frequency spectrum.

If you stop the simulation and double-click the powergui block, you have access to the steady-state values of inputs, outputs, and state variables displayed as phasors. You can also use the Powergui block to modify the initial conditions. The powergui block allows you to perform a load flow with circuits involving three-phase machinery and initialize the machine models so that the simulation starts in steady state. This feature avoids long transients due to mechanical time constants of machines. The Powergui block allows you to specify the frequency range that you want, visualize impedance curves, and store results in your workspace for [Impedance Measurement](broken://pages/5fb2aabf4263d0ddf87010f886a5181cff638eed) blocks connected in your circuit.

## Limitations of the nonlinear models

Because nonlinear models are simulated as current sources, they cannot be connected in series with inductors and their terminals cannot be left open.

If you feed a machine through an inductive source, SPS prompts you with an error message. You can avoid this error by connecting large resistances in parallel with the source inductances or across the machine terminals.

A series RC snubber circuit is included in the model of the Breaker block and power electronics blocks. If you keep these snubber circuits in service, you do not encounter any issues. The snubber can be changed to a single resistance by setting **Cs** to Inf, or to a single capacitor by setting **Rs** = 0 To eliminate the snubber, specify **Rs** = Inf or **Cs** = 0


---

# 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/overview/how-sps-software-works.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.
