> 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/sps-software-example-models/boost-and-two-level-inverter.md).

# Boost and two-level inverter

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

The **Boost and two-level inverter** model illustrates the use of the eHS solver to compute the outputs of a circuit simulating a boost converter followed by a two-level DC/AC converter. User defined switching characteristics of the switch of the boost and of the six switches of the inverter are controlled in real-time by the developer in the RT-LAB model.

## Requirements <a href="#requirements" id="requirements"></a>

The **RT-LAB**, **RT-EVENTS**, **SPS Software** and **eFPGASIM toolboxes** must be installed on the host and target computers to run this example model properly. Please refer to the product documentation for details on version compatibility.

The eHS solver requires an FPGA-based hardware board. This board will be configured with the attached binary file automatically when the model is loaded in the RT-LAB interface. This model uses an Avnet Kintex-7-based Mini-Module Plus (MMPK7) as its active carrier board.

## Simulation and results

To run the example, follow the procedure below:

1. If eFPGASIM is installed, add the example project to RT-LAB by selecting **File>>New>>RT-LAB Project>>eFPGASIM>>SimPowerSystems\_Workflow>>Boost and two-level Bridge**.
2. Compile the RT Model by clicking on **Build** in RT-LAB.

### Setup and connections

This model must be run with the Hardware Synchronized option, with the XHP mode enabled. It does not require any external I/O hardware except the active control card, which should be a Trenz Kintex-7-based card (TE0741) on the OP4510 Chassis.

Verify that the OP4510 board ID is set correctly in the OpCtrl block in the RT-LAB model SM\_eHS subsystem. To get this information, select “Tools > Get I/O infos” on the target context menu in RT-LAB and find the index of your hardware.

Locate the “OpCtrl” inside the SM\_eHS subsystem. This block manages the firmware of the hardware on which the eHS solver is executed. By default, it is configured for an OP4510 board. If your hardware is different, select the appropriate board type and bitstream file name. A bitstream for each of the supported board types is included in the model folder.

<details>

<summary><strong>Setup required for all OP4510 models</strong></summary>

Please note that the following setup is required for all OP4510 models:

* The configuration file (bitstream) generation must have been successfully configured during the model loading phase.
* RT-LAB 10.6.6 or later in the case of the OP4510.
* The OP4510 board ID must be set correctly in the OpCtrl block in the RT-LAB model SM\_eHS subsystem.
* The Simulink simulation step time is set to 20 microseconds as the variable Ts in the RT-LAB model “InitFcn” and “PostLoadFcn” callbacks. To modify it, double-click on the “Model Initialization” block in the root of the RT-LAB model and modify accordingly the definition of the variable “Ts”.

</details>

### Run the model

Observe the SPS Software (formerly SimPowerSystems) model. You will find in it a one-phase universal bridge implementing the boost converter, and a three-phase universal bridge implements the DC/AC converter. You will also see an RLE load on each phase and various voltage and current measurement blocks.

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

The voltage of the DC source in input (Vdc) will be controlled from the RT-LAB console during the real-time simulation. The console also controls the PWM modulator and carrier frequency for the boost and two-level converters. Similarly, all eight voltage and current measurements are sent back to the RT-LAB model console. Open both the RT-LAB console and master subsystem to see how the six PWM signals controlling the two-level converter are generated from parameters in the console as three equally shifted sine modulations.

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

When the model is compiled in Simulink, the configuration of the eHS solver is generated according to the SPS Software (formerly SimPowerSystems) circuit characteristics. Elements are converted into matrices and stored into .mat files that are transferred into the solver when the model is run from the RT-LAB interface. To generate the matrices, the user can either open the “eHSx64 CommBlk” block parameter panel or select the “Generate matrices” check box. This step is not mandatory, as matrices are regenerated during model compilation in RT-LAB.

To run a simulation including the eHS solver in real time, create an RT-LAB project and add the RT-LAB model of this example into the project. The SPS Software (formerly SimPowerSystems) model should not be added to the RT-LAB project, as it does not need to be transferred to the target computer for execution. Compile the model, then assign a target node to run it in real time, then load the model onto it.

Execute the real-time simulation and enjoy the results, changing the PWM modulator and carrier characteristics and the voltage of the DC input to suit your interests. The following results have been obtained with the original model by setting the RT-LAB Probe control to acquire 2500 samples per signal for acquisition group #1.

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-fed6b0ec86ffc5b66c76344ca7d5f5a2f4677cfb%2Fehs-model-sps-boost2level-3.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-7781d676fac013e1e2fd8b8ba793b43bea0fe94c%2Fehs-model-sps-boost2level-4.png?alt=media" alt=""><figcaption></figcaption></figure>

The **RT-EVENT blocks** in the model have a maximum number of events per time step per channel set to 4. This is adequate for any simulation step size up to twice the period of the PWM carrier. If the PWM carrier runs faster than half the simulation step size, more events per simulation step are needed (twice the number of PWM periods that can be present in one single simulation step). All RT-EVENTS blocks and the eHSx64 CommBlk have to be configured accordingly.


---

# 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/sps-software-example-models/boost-and-two-level-inverter.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.
