> 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/ehs/3.7/model-in-sps-rt-lab-only/design-the-sps-circuit.md).

# Design the SPS Circuit

The **legacy eHS with SPS workflow** uses Simulink models created with [Smart Power Simulation Software ](https://www.smartpowersimulationsoftware.com/)blocks (formerly Simscape Electrical Specialized Power Systems) to define the electrical circuit executed by eHS on the FPGA. Unlike the Schematic Editor workflow, the circuit topology is created and edited directly in Simulink.

## Typical eHS with SPS workflow

1. Create the circuit model in Simulink using supported SPS Software blocks
2. Create an RT-LAB project with CPU model and add the **OpCtrl** block and **eHS CPU Block** to the main computation subsystem of the model
3. Choose and add the eHS firmware
4. Add the SPS circuit model to eHS
5. Configure the eHS circuit interfaces
6. Save and build the model in RT-LAB
7. Assign the model to the simulator, load and execute the simulation

## Design the SPS circuit

{% stepper %}
{% step %}

### Create a dedicated Simulink model

Create a dedicated Simulink model that will serve as the circuit model executed on the FPGA by the eHS solver. To avoid confusion, use a name that clearly identifies the model as the SPS circuit model and distinguishes it from the CPU model.
{% endstep %}

{% step %}

### Add and connect supported SPS Software blocks

Build the circuit using supported blocks from the SPS Software libraries. Refer to [Supported SPS Blocks Reference](https://www.opal-rt.com/docs/ehs/3.7/model-in-sps-rt-lab-only/design-the-sps-circuit/supported-sps-blocks-reference.md) for the list of supported blocks. The SPS circuit model may contain unsupported blocks, but are ignored when the circuit is processed by the eHS solver in RT-LAB.

The model must contain a **powergui** block. Although the simulation type can be set to **Continuous**, it is recommended to configure **Simulation Type** to **Discrete** and use a sample time similar to the expected eHS FPGA timestep (for example, `20e-6`). This allows the circuit model to be simulated offline in Simulink and used as a reference before executing it in real time on the FPGA.

Adding machine models to an SPS circuit requires additional configuration. See [Include Machines in an SPS Circuit](https://www.opal-rt.com/docs/ehs/3.7/model-in-sps-rt-lab-only/include-machines-in-an-sps-circuit.md) for details.
{% endstep %}

{% step %}

### Name blocks following the naming convention

Source, switching device and measurement blocks should follow a consistent naming convention to simplify identification and configuration within RT-LAB. Recommended prefixes are:

| Element Type      | Recommended Prefix  |
| ----------------- | ------------------- |
| Sources           | `U01`, `U02`, ...   |
| Switching devices | `SW01`, `SW02`, ... |
| Measurements      | `Y01`, `Y02`, ...   |

Using consistent naming helps identify signals and devices after they are extracted and sorted by the eHS.

<figure><img src="https://521571437-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fo99Izmvvw5eHT4ldzI4g%2Fuploads%2Fgit-blob-7299ae7dad8a9510e196b882b73602fd81a10220%2Fehs-circuit-sps-machines.png?alt=media" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Execute the model offline in Simulink

Although this step is not mandatory, it is recommended to execute the SPS circuit model offline in Simulink before using it with the eHS solver. This confirms that the model is valid, that all required blocks and parameters are configured correctly, and that the simulation produces the expected results. The offline simulation results can then be used as a reference when validating the behavior of the FPGA-based real-time simulation.
{% endstep %}

{% step %}

### Save the model

Save the SPS circuit model in the same directory as the CPU model. The **eHS CPU Block** expects the circuit model to be available from that location when the FPGA simulation is configured and loaded.
{% endstep %}
{% endstepper %}


---

# 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/ehs/3.7/model-in-sps-rt-lab-only/design-the-sps-circuit.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.
