> 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/hypersim/library-blocks-reference/network-voltage-source-converters/2-level-converter-switching-function.md).

# 2-Level Converter (Switching Function)

## Description

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-d307e0716ed1de52ac0a49cad509b90b40a70ae0%2Fimage%20(1056).png?alt=media" alt="" width="131"><figcaption></figcaption></figure>

The **2-Level Converter (Switching Function)** block, located in the **Network Voltage Source Converters** library, models a three-phase voltage source converter (VSC) for applications such as renewable energy integration and motor drives. It uses a switching function representation optimized for real-time simulation, balancing the execution speed of an average model with the accuracy of detailed switching devices.

The converter is modeled by a switching function model. The switches are replaced by two voltage sources and two diodes per phase on the AC side and a current source on the DC side.

The figure below shows the internal circuit of the converter that can be accessed by opening the subcircuit. Although the topology of the converter is similar to that of the [**Full-bridge converter (Switching Function)**](https://www.opal-rt.com/docs/hypersim/library-blocks-reference/network-voltage-source-converters/full-bridge-converter-switching-devices.md), the equations for controlling the amplitude of voltage and current sources are different.

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-e217c8f37a3172fe453db1e8c5356713485e976e%2Fimage%20(1057).png?alt=media" alt=""><figcaption></figcaption></figure>

The converter is controlled by firing pulses produced by a PMW generator or by firing pulses averaged over a time step of the simulation (1/Ts), providing signals between 0 and 1. Both operating modes accurately produce harmonics. In addition, this converter model correctly simulates the operation as a rectifier as well as the blanking time.

The **PWM average generator** outputs a vectorized gating signal to control the converter. The gating signal contains six firing pulses. The first two pulses control the Q1 and Q2 switching devices (phase A of the converter), pulses three and four control the Q3 and Q4 switching devices (phase B of the converter), and the last two pulses control the Q5 and Q6 switching devices (phase C of the converter).

{% hint style="danger" %}
This model must be used with the **PWM Average Generator for 2-Level Converter (Switching Function)** component available in the Control Sources library of HYPERSIM or with an input FPGA module (contact our [technical support](https://www.opal-rt.com/contact-technical-support/) for an example).

This model does not participate in the load flow solution.
{% endhint %}

## Mask parameters

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-da6dd228dc56c71ca4303ba66cb451baa19ae140%2Fimage%20(1058).png?alt=media" alt="" width="443"><figcaption></figcaption></figure>

<table><thead><tr><th width="270">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong>Description</strong></td><td>Free-form text field for documenting the block. Variable: Description = {'string'}.</td></tr><tr><td><strong>Diode on-state resistance</strong></td><td>Internal resistance of diodes (Ohm), Rclose Range: [1e-12, 1e12].</td></tr><tr><td><strong>Diode snubber resistance</strong></td><td>Snubber resistance of the diodes (Ohm), Rsnubber Range: [1e-12, 1e12].</td></tr></tbody></table>

{% hint style="info" %}
For accurate results, enable **Activate iterative method** and **Solve control inputs before solving power** in **Simulation Settings**.
{% endhint %}

## Conserving ports

<table><thead><tr><th width="269.20001220703125">Port</th><th>Description</th></tr></thead><tbody><tr><td>net_1</td><td>Network connector on the AC side (supports only 3-phase connections).</td></tr><tr><td>DCplus</td><td>Network connector on the DC side. Positive terminal (supports only 1-phase connections).</td></tr><tr><td>DCminus</td><td>Network connector on the DC side. Negative terminal (supports only 1-phase connections).</td></tr></tbody></table>

## Inputs

<table><thead><tr><th width="269.199951171875">Input</th><th>Description</th></tr></thead><tbody><tr><td>P</td><td>Vectorized signal containing six firing pulses to control the converter.</td></tr></tbody></table>

## Outputs

<table><thead><tr><th width="270.79998779296875">Output</th><th>Description</th></tr></thead><tbody><tr><td>V</td><td>Vectorized voltage signal containing AC side phase-to-ground voltages (Va, Vb, Vc) and the DC link voltage (Vdc).</td></tr><tr><td>I</td><td>Vectorized current signal containing AC side phase-to-ground currents (Ia, Ib, Ic) and the DC link current (Idc).</td></tr></tbody></table>

## Signals available for monitoring and external I/O connections (via sensors form)

All block inputs and outputs are available as signals for monitoring and for external I/O connections.

## References

<mark style="background-color:yellow;">SPS 2 level converter</mark>

M. H. Rashid, *Power electronics handbook*, 4<sup>th</sup> ed. Butterworth-Heinemann, 2017


---

# 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/hypersim/library-blocks-reference/network-voltage-source-converters/2-level-converter-switching-function.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.
