> 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/example-models/ehs-example-models/power-electronics-example-models/boost-and-two-level-inverter-legacy-gen4.md).

# Boost and Two Level Inverter (Legacy Gen4)

## Description <a href="#description" id="description"></a>

The **Boost and Two Level Inverter** project demonstrates the use of the eHS Ge nsolver to compute the outputs of an FPGA-based Boost and Two-Level Inverter circuit in real time. The FPGA-based circuit comprises of a boost converter followed by a two-level DC/AC converter with fault insertion Ton the third phase. This circuit is created using the OPAL-RT Schematic Editor. With this example project, the user is able to control the simulation parameters (inputs and gates values) in real-time via the RT-LAB console.

## Detailed explanation

The RT model is composed of the following two main subsystems: the Console (SC) and the Master (SM).

* The **console subsystem**, which runs on the host computer, manages the communication between the host computer and the target simulator. It is used as a user interface during the real time simulation to control the model and visualize the outputs of the eHS solver.
* The **master subsystem**, which runs in real time on the target simulator, manages the communication between the CPU model and the eHS solver running on the FPGA. For example, the carrier frequency, output frequency, and modulation index parameters sent from the console are processed in the **Circuit\_Control** subsystem into frequency and duty cycle control values, which are subsequently sent as a PWM signal to the Digital-Out.
* There are two ways to configure IO block. One is using OPAL-RT Board drivers while the other is configured with S-Function drivers. Since eFPGASIM 2.9, it's possible to use eHS with Schematic Editor plus S-Function drivers.

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

## Requirements

RT-LAB, Schematic Editor/Unified Database and the eHS Power Electronics Toolbox must be installed in order to successfully run this example project.

<details>

<summary><strong>OP5607 and OP5707 simulators</strong></summary>

In this configuration, an external Digital Output–to–Digital Input **loopback connection** must be used to control the gate signals. Connect a loopback cable from a digital output to the corresponding digital input on the simulator. This connection is required for the simulation to run successfully.

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

</details>

<details>

<summary><strong>OP4512 and OP4610 simulators</strong></summary>

When configured in **bi-directional mode**, the OP5369 card supports an internal Digital Output–to–Digital Input loopback. This allows a Digital Input assigned to a channel to directly read the signal generated by the Digital Output on the same channel.

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

</details>

{% hint style="info" %}
If your IO Configuration contains bi-directional OP5369 card, you can always use its internal loopback capability.
{% endhint %}

## Simulation and results

### Setup Parameters <a href="#setup-parameters" id="setup-parameters"></a>

The following parameters used for real-time simulation are editable by the user inside the **initBoost2LevelInverter.m** file found in the model directory:

* **Ts:** CPU Simulation time step - the default is 20µs.
* **Boost\_Vin:** Voltage input of the boost converter
* **Boost\_PWM\_Freq:** Carrier frequency of the boost PWM generator
* **Boost\_PWM\_Duty:** Duty Cycle of the boost PWM generator
* **Inv\_PWM\_CarrierFreq:** Carrier frequency of the two-level PWM generator
* **Inv\_PWM\_ModulationIndex:** Modulation index of the two-level PWM generator
* **Inv\_PWM\_ShiftAngle:** Shift angle between the BEMF generator and the PWM/Vabc setpoints generator
* **Inv\_PWM\_Out:** AC base frequency of the two-level inverter
* **Inv\_BEMF\_Ampl:** Amplitude of the BEMF

### Run the model <a href="#running-the-model" id="running-the-model"></a>

In order to run the example, follow the procedure below:

1. If you have eFPGASIM installed, add the example project to RT-LAB by selecting **File>>New>>RT-LAB Project>>eFPGASim>>Power Electronics>>Boost and Two Level Inverter (Legacy Gen4)**.
2. Compile the RT Model by clicking on **Build** in RT-LAB.
3. Once the model has been successfully built, **Load** and **Execute** the model in RT-LAB in order to begin the real-time simulation.
4. Once the real-time model and the eHS are running, observe the results of the eHS simulation by opening the **Scope** blocks in the Simulink Console.

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


---

# 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/example-models/ehs-example-models/power-electronics-example-models/boost-and-two-level-inverter-legacy-gen4.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.
