> 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/rt-lab/model-and-simulation/power-electronics-and-electric-machines-with-ehs.md).

# Power Electronics & Electric Machines with eHS

## Introduction to eHS

Real-time simulation of power electronics and electric machines requires **nanosecond-level timesteps**. OPAL-RT’s **eHS (electric Hardware Solver)** is a high-speed FPGA-based solver that meets this demand, enabling accurate simulation of converters, motors, and inverters without physical hardware. It is widely used in automotive, aerospace, and energy applications, including EV powertrains, battery management systems, and on-board chargers.

eHS allows users to simulate electric circuits on FPGA without VHDL programming or complex mathematical modeling.

To use the eHS solver, **the electric circuit schematic is created separately from the RT-LAB Simulink model**. The schematic can be built using OPAL‑RT’s built‑in **Schematic Editor (recommended)** or, alternatively, in a separate Simulink model using SPS blocks. The electric circuit schematic is then integrated into the main model using an eHS block from the [eFPGAsim library](https://www.opal-rt.com/docs/rt-lab/simulink-blocks-reference/efpgasim-library.md).

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-29623d559862fd1c080a787727740c475b68038a%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

## Run an electric circuit with eHS on FPGA

{% stepper %}
{% step %}

### Open the RT-LAB Simulink model

In RT-LAB, right-click the model and select **Edit** or **Edit with** to choose a MATLAB version. MATLAB will launch with your model.
{% endstep %}

{% step %}

### Choose the electric circuit editor (Schematic Editor vs SPS)

Decide how you want to build the electric circuit that will run on the FPGA at a smaller time step.

* **OPAL-RT Schematic Editor** **(recommended)** or,
* A separate Simulink model using SPS blocks.

The Schematic Editor is strongly recommended. However, if you already have an existing circuit model built in Simulink using SPS blocks and do not intend to take advantage of the Schematic Editor’s advanced features, you may choose to reuse this model instead.
{% endstep %}

{% step %}

### Add the appropriate eHS solver block

Open the **Simulink Library Browser**.

* For the **Schematic Editor** workflow, navigate to **eFPGASIM > OPAL-RT Schematic Editor workflow** and drag the [eHS\_SE\_SFunction\_Drivers](https://www.opal-rt.com/docs/rt-lab/simulink-blocks-reference/efpgasim-library/opal-rt-schematic-editor-workflow/ehs_se_sfunction_drivers.md) block into the Simulink model.
* For the Simulink SPS workflow, navigate to **eFPGASIM > External circuit editor workflow** and drag the [eHS CPU Block](https://www.opal-rt.com/docs/rt-lab/simulink-blocks-reference/efpgasim-library/simulink-sps-workflow/ehs-cpu-block.md) into the Simulink model.
  {% endstep %}

{% step %}

### Set the bitstream and design the electric circuit

Configure the bitstream and design the circuit according to the selected workflow. This step requires knowledge of eHS bitstreams, supported circuit blocks, and available features. Refer to the [full eHS documentation](broken://spaces/nVlkMVXjY5bWbFGd9Gyz/pages/R6s2AX8aCvHh2BkXs8jN) before proceeding.
{% endstep %}

{% step %}

### Save and run the Simulink model

Save and run the Simulink model to confirm that everything works as expected.
{% endstep %}

{% step %}

### Prepare the Hardware setup

Refer to the **Connect Analog & Digital I/Os** section of your simulator and/or expansion unit documentation for detailed instructions on connecting external hardware or a DUT through its I/O modules.
{% endstep %}

{% step %}

### Build, load and execute the model in RT-LAB

1. In RT-LAB, build the model.
2. Go to the **Execution** tab and ensure that the **Real-time simulation mode** is set to **Hardware synchronized**.
3. Open the **Assignation** tab and ensure that the **XHP** box is checked (enabled).
4. Load and execute the model in RT-LAB. During real-time execution, the electric circuit executes on the FPGA with nanosecond-level timesteps, while the remaining model runs on the CPU at microsecond-level timesteps.
   {% 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/rt-lab/model-and-simulation/power-electronics-and-electric-machines-with-ehs.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.
