> 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/e-mobility-example-models/three-phase-llc-converter-with-pfc-hscs.md).

# Three-Phase LLC Converter with PFC (HSCS)

## Description

The **Three-Phase LLC Converter with PFC (HSCS)** project demonstrates the use of the Gen5 eHSx128 solver and **High Speed Converter Solver (HSCS)** to compute the outputs of an FPGA-based Three-Phase LLC Converter with Power Factor Correction (PFC) circuit in real-time.

The FPGA-based circuit comprises of a boost converter with PFC followed by an LLC resonant tank. 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.

## Requirements

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

In the chassis configuration listed for this example model, **no** Digital Out to Digital In loopback wire is required.

{% hint style="info" %}
This demo requires **HIGH PERFORMANCE license** to run properly.
{% endhint %}

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-8bdf822638a0149236102544b4db8a0fe52ce746%2Fehs-model-3phLLCwithPFC-HSCS-1.png?alt=media" alt=""><figcaption><p>PWM Out on Ch00 is read by PWM In on Ch00</p></figcaption></figure>

## Setup parameters

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

* **Tsc**: CPU Simulation Time Step - the default is 10µs.
* **Line\_Voltage\_Peak**: Input Voltage Peak to the Full Bridge Rectifier
* **Voref**: Desired Output Voltage from PFC Preconverter
* **Power**: Maximum Steady State Power Capability
* **Conv\_efficiency**: Nominal Efficiency of the Converter
* **f\_sw**: MOSFET Switching Frequency

The following parameters used for real-time simulation are editable by the user inside the SC\_Console subsystem:

* **llc\_frequency**: LLC Switching Frequency
* **llc\_duty**: LLC Switching Duty
* **pfc\_frequency**: PFC Switching Frequency

As the current flowing through the inductor is never zero during the switching cycle, the boost converter operates in Continuous Conduction Mode (CCM). The inductor current and the output voltage profiles are controlled using simple integral control. During start up, the reference output voltage is ramped up to the desired voltage.

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-eebe87718871bcb7ca38d3731db55dfb9ad84c62%2Fehs-model-3phLLCwithPFC-HSCS-2.png?alt=media" alt=""><figcaption><p>RT-LAB Model view</p></figcaption></figure>

The LLC converter is a DC/DC converter based on a resonant tank that enables soft-switching operation and reduces switching losses through zero-voltage switching (ZVS). Unlike a Series Load Resonant (SLR) converter, the LLC converter can maintain output-voltage regulation even under light load conditions. In this model, the LLC stage consists of a three-phase IGBT switching bridge, an LLC resonant tank, a three-phase bridge rectifier, and an output filtering or decoupling stage. The resonant tank consists of the primary and secondary transformers leakage, the transformers magnetization inductance, and a capacitor, C2.

{% hint style="info" %}
Notice that the Boost Converter and the LLC Converter are inside two separate HSCS subsystems.
{% endhint %}

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-0e66527f8f74ba14de4ccfe129e4f99856ffc5ab%2Fehs-model-3phLLCwithPFC-HSCS-3.png?alt=media" alt=""><figcaption><p>Schematic Editor Circuit</p></figcaption></figure>

## Real-time model

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, gates and sources parameters sent from the console are processed in this subsystem and subsequently sent to the eHS solver.

## Simulation and results

In order 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>Schematic\_Editor\_Workflow>>E-mobility>>3-Phase LLC Converter (HSCS)**.
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-9d7269f5e2d03c7660f4f9cb7a6a6c428364e7b5%2Fehs-model-3phLLCwithPFC-HSCS-res1.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-05636d4c6e966fdfb341e5fd5e0f68f0ba5e1ea1%2Fehs-model-3phLLCwithPFC-HSCS-res2.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-81385a95d7a71183141b0941208b5099e1f29557%2Fehs-model-3phLLCwithPFC-HSCS-res3.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-3ee9abc7a5d7092269ec5fd3c8aa08b2d4a85dae%2Fehs-model-3phLLCwithPFC-HSCS-res4.png?alt=media" alt=""><figcaption></figcaption></figure>

<details>

<summary><strong>S-function Workflow</strong></summary>

The **Mezzanine Option block** is an RT-LAB block used in the **S-Function workflow** to configure the settings of the I/O cards for each mezzanine. The available settings depend on the specific type of I/O card.

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

</details>

<details>

<summary><strong>OpalBoard workflow</strong></summary>

[OPAL-RT Board](https://www.opal-rt.com/docs/rt-lab/configure-ios/analog-digital-and-sfp-ios/opal-rt-board-workflow.md) allow the configuration of I/O card settings for each mezzanine.

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

If, for a given I/O mezzanine, this block is not used, then the corresponding settings will be kept at their default values. These default values are dependent on particularities of the bitstream, and they are not guaranteed to be exposed to the user loading their model. Further, the default values populating the Mezzanine Option block do not necessarily correspond to the default settings that will be seen if the Mezzanine Option block is not used.

Note that if a Mezzanine Option block is used, and the choice of mezzanine type is incorrect for the given slot, the model will still load and run. However, there will be errors in the load log in RT-LAB. For example, the following error is observed in the case that slot 1A on the simulator holds an OP5330-3, when we place a Mezzanine Option block that attempts to configure an OP5369 on slot 1A:

{% code overflow="wrap" lineNumbers="true" %}

```
Mezzanine configurator: OP5369 Threshold configuration.
ERROR: OPAL-RT Board: The threshold control register for slot 1A is in an unexpected state. Please reprogram the bitstream.
ERROR: Mezzanine configurator: Threshold configuration failed...
```

{% endcode %}

Further, as documented in the aforementioned RT-LAB page, the block outputs its status: a 0 in the case when the block’s settings have been correctly applied, and a -1 otherwise. For example, in the below model I incorrectly configured one block by giving it the wrong I/O card, and set the other correctly. The result when we load the model reflects this:

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-a4fe002fb70685f86d0a022ad92068069ae7264d%2Fehs-opalboard-block-workflow.png?alt=media" alt="" width="188"><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-635a0707a1e24ec9979ba91be578dae9fe0d6dac%2Fehs-opalborad-model-blocks.png?alt=media" alt=""><figcaption></figcaption></figure>

</details>


---

# 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/e-mobility-example-models/three-phase-llc-converter-with-pfc-hscs.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.
