> 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-opalboards.md).

# Boost and Two Level Inverter (OpalBoards)

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

The **Boost and Two Level Inverter** project demonstrates the use of the **eHSx128 solver** 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.

## Requirements

RT-LAB and the eHS toolbox must be installed in order to successfully run this example project.

This project uses an external Digital Out to Digital In loopback connection to control the gates. Connect a loopback cable from Slot 2B to Slot 2A on the **OP5607 simulator**. This is essential to successfully run the simulation.

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-5e6e84fb8428936d3c2214504a9dd6161002b7eb%2Fehs-boost2level-opalboard-loopback.png?alt=media" alt="" width="320"><figcaption><p>Loopback connection to control the gates</p></figcaption></figure>

The connections are already made in the RT-LAB Project :

* In the I/O Interface OPAL-RT Board, the first 8 channels of the Slot 2B Digital Out are enabled

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

* In the Configuration folder of the project, the connections are setup between the PWM Out block of the Simulink model, and the Digital Out channels:

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

## 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>>Schematic\_Editor\_Workflow>>Power Electronics>>Boost and Two Level Inverter (OpalBoards)**.
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-bbd737ee717201cea4d73183642c70bd211a5657%2Fboost-2levelinverter-exmodel-simulation-results.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-opalboards.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.
