> 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/mmc-example-models/vsc-switching-function-model-with-variant-subsystems-not-good.md).

# VSC Switching Function Model with Variant Subsystems (not good)

## Description

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-c4a6e7b6ab15c4d63baa7d2e264edda05092c23c%2Fmmc-vsc2-ex.png?alt=media" alt="" width="482"><figcaption></figcaption></figure>

The **VSC Switching Function Model with Variant Subsystem**s example can be created by starting a new RT‑LAB project. From the menu bar, select **File > New > RT‑LAB Project**. Enter a name and location for your project, then click **Next**. From the available templates list, navigate to **MMC** and select **CPU\_TSB\_acac**, then click **Finish**.

This model simulates a back‑to‑back voltage source converter (VSC) used to interface an AC grid with an induction machine. The VSC can be implemented using either a two‑level or a three‑level converter topology, including the neutral‑point‑clamped (NPC) converter and the T‑type converter.

For each converter type, two possible configurations are available depending on whether the midpoint of the DC link is grounded. All supported topologies are listed below:

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

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

### Simulator license

[Verify that an active RT-LAB license](https://www.opal-rt.com/docs/rt-lab/licensing-reference/simulator-license.md) with the following feature is installed on the simulator to run this example model:

<table><thead><tr><th width="259.63629150390625">Feature Name</th><th width="109.5455322265625">Required Status</th><th>Description</th></tr></thead><tbody><tr><td>ARTEMIS_MMC_CONTROLLER</td><td>enabled</td><td>MMC high-level control blocks on CPU</td></tr></tbody></table>

## Detailed explanation

The VSC is modeled using the equivalent‑circuit method presented in \[1], referred to as the **OPAL model** in this demo. A detailed switching model is also implemented using SPS Software and serves as the reference. The **SM\_Conv** subsystem contains all OPAL and SPS converter models, for a total of 12 converter variants. The specific converter used in simulation is selected through a MATLAB Variant Subsystem.

Below are the steps required to select the desired converter:

{% stepper %}
{% step %}

### Select SPS or OPAL subsystem

In thein the initialization file **`Parameters_M3C.m`**, located in the Simulink model directory, set the value of `V_MODEslv`:

* `V_MODEslv = 0` → OPAL model
* `V_MODEslv = 1` → SPS model

In the Simulink model, the chosen subsystem is indicated inside **SM\_Conv**.

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-9bfc5cfabccf87ece3c85aa3b2920ac73b4a82d2%2Fmmc-vsc2-ex3.png?alt=media" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Select converter type

In the initialization file, set the value of `V_model`:

* `V_model = 0` → Two‑level converter
* `V_model = 1` → NPC (neutral‑point‑clamped) converter
* `V_model = 2` → T‑type converter

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

In the Simulink model, the selected converter appears inside the **OPAL** or **SPS** subsystem chosen in Step 1.

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-2f14d3d5f7418c821118f163a880e136a0377b05%2Fmmc-vsc2-ex4.png?alt=media" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Select topology (with or without grounded DC midpoint)

In the initialization file, set the value of `V_GND1`:

* `V_GND1 = 0` → topology **without** DC‑link midpoint grounding
* `V_GND1 = 1` → topology **with** DC‑link midpoint grounding

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

In the Simulink model, the selected topology is visible inside the converter subsystem chosen in Step 2.

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-efacfa4f91a64534a825e1147c6b380c405205ae%2Fmmc-vsc2-ex5.png?alt=media" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Select submodule type

In the Simulink model, open the **SC\_Console** subsystem and configure the submodule type in the **conv\_para** (VSC Parameter Block).

For a three‑phase back‑to‑back system, the number of submodules (SMs) must be set to **6**.

Choose the submodule type according to the converter selected:

* **Half‑Bridge SM** → for two‑level converters
* **NPC (neutral‑point‑clamped)** → for NPC converters
* **T‑type SM** → for T‑type converters
  {% endstep %}
  {% endstepper %}

## Simulation and results <a href="#simulationandresults" id="simulationandresults"></a>

To illustrate the accuracy of the modeling method, the OPAL model (SWF) with 20 µs is compared with the SPS model with 1 µs. The comparison results are presented. The results validate that the OPAL model with 20 µs has matched performance as the SPS detail model with 1 µs. The System parameters are listed as

<table><thead><tr><th width="142">Parameters</th><th width="456">Description</th><th width="141">Value</th></tr></thead><tbody><tr><td>Pref_DAB</td><td>DAB power rating per module</td><td>20 kW</td></tr><tr><td>Vmvdc</td><td>Medium voltage-side dc voltage per module</td><td>4 kV</td></tr><tr><td>VLvdc</td><td>Low voltage-side dc voltage</td><td>400 V</td></tr><tr><td>ftran</td><td>DAB transformer frequency</td><td>2 kHz</td></tr><tr><td>Ls_DAB</td><td>DAB external inductance</td><td>0.0420 H</td></tr><tr><td>Vac_MV</td><td>Medium voltage-side ac voltage</td><td>8.5 kV</td></tr><tr><td>freq</td><td>Medium and low voltage-side grid frequency</td><td>60 Hz</td></tr><tr><td>CC_mvdc</td><td>Medium voltage-side capacitance per module</td><td>0.125 μF</td></tr><tr><td>Vac_LV</td><td>Low voltage-side ac voltage</td><td>141.4 V</td></tr><tr><td>CC_lvdc</td><td>Low voltage-side capacitance</td><td>11.3 mF</td></tr></tbody></table>

**Solid state transformer simulation results:**

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

**Simulation performance:**

The elapse time for 1 s offline simulation.

| Test system             | Execution time for SPS model (1us timestep) | Execution time for OPAL-RT model (20us timestep) | Acceleration factor |
| ----------------------- | ------------------------------------------- | ------------------------------------------------ | ------------------- |
| Solid state transformer | 583.78 s                                    | 16.54 s                                          | 35.29               |

The real-time simulation performance (the minimum time step). The minimum time step is the minimum time the real time simulator needs to solve the model. This value being larger than the model discretizing time step, usually 20 \~50 us, means that the model cannot run in real time.

| Test system             | Minimum time step for SPS model            | Minimum time step for OPAL-RT model       |
| ----------------------- | ------------------------------------------ | ----------------------------------------- |
| Solid state transformer | 2907.6 us (> model discretizing time step) | 13.84 us (< model discretizing time step) |

## References <a href="#vscsolidstatetransformer-references" id="vscsolidstatetransformer-references"></a>

\[1] W. Li and J. Bélanger, "An Equivalent Circuit Method for Modelling and Simulation of Modular Multilevel Converters in Real-Time HIL Test Bench," in IEEE Transactions on Power Delivery, vol. 31, no. 5, pp. 2401-2409, Oct. 2016.

\[2] Bose, B. K., Power Electronics and AC Drives, Prentice-Hall, Englewood Cliffs, N.J., 1986.


---

# 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/mmc-example-models/vsc-switching-function-model-with-variant-subsystems-not-good.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.
