> 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-legacy-gen4.md).

# Boost and Two Level Inverter (OpalBoards Legacy Gen4)

## Description

This project demonstrates the use of the eHS 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.
* 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, visit efs\_eHS\_SE\_Sfun\_Drivers for more detailed info.

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

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

## Requirements

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

In the OP4512 chassis configuration, **no** Digital Out to Digital In loopback is required.

The OP5369 cards supports natively internal Digital Out to Digital In loopback when it’s setup as bi-directional.

In the example models, the Digital Out signals are used on the channels 0-15, and the Digital In signals are used on the channels 16-31 of the Slot 1A.

## Simulation and results

### Setup Parameters

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

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 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-4a0f534397c18648069034cf306239598aea0f5f%2Fehs-boost2levelinverter-example-run1.png?alt=media" alt=""><figcaption></figcaption></figure>

5. Modify the parameters of the circuit from the Simulink Console and observe their effects on the Scopes. For instance, to produce an open-phase fault on the A phase of the two-level inverter, set the constant of the fault to 0.

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-ef050f2682edc076d59cad4696d2ba3fb6d3d81e%2Fehs-boost2levelinverter-example-run2.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-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.
