> 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/smart-power-simulation-software-sps/blocks-functions-tools/control-and-measurements/pulse-and-signal-generators/pwm-generator-multilevel.md).

# PWM Generator (Multilevel)

## Description

<figure><img src="https://799605156-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdlNg8IbOdahCpFCyzxSN%2Fuploads%2Fgit-blob-3ef8cff44521aa80fe25756c8a08f17a9776bfd8%2FPWM_generator_multilevel_block.png?alt=media" alt=""><figcaption></figcaption></figure>

The **PWM Generator (Multilevel)** block, located in the **OPAL-RT SPS Software/Power Electronics/Power Electronics Control** library, generates pulses for a PWM-controlled modular multilevel converter. For a half-bridge converter, carriers are phase-shifted by an angle obtained by dividing 360 degrees by the number of bridges. The number of bridges is a parameter that you specify. For a full-bridge converter, carriers are phase-shifted by an angle obtained by dividing 180 degrees by the number of bridges.

The PWM Generator (Multilevel) block generates one carrier signal for every power module (full-bridge or half-bridge) that is controlled. For example, if you set **Bridge type** to Full-bridge, and **Number of bridges** to 10, the block generates 10 carrier signals, each shifted by 18 degrees (180/10) from the other.

## Parameters

<table data-header-hidden><thead><tr><th width="250.33331298828125"></th><th></th></tr></thead><tbody><tr><td><strong>Bridge Type</strong></td><td>Choose whether to control a <strong>Half-bridge</strong> (default) or a <strong>Full-bridge</strong> converter.</td></tr><tr><td><strong>Number of bridges</strong></td><td><p>Specify the number of bridges (power modules) of the multilevel converter you want to control.</p><p>The number of bridges must correspond to the number of power modules used in the modular multilevel converter.</p><p>The default value is 4. For example, if you want to control a full-bridge MMC converter that contains 22 power modules (the equivalent of 22 full-bridges), set the <strong>Bridge type</strong> parameter to Full-bridge and the <strong>Number of bridges</strong> parameter to 22.</p><p>If you want to control a half-bridge MMC converter that contains 22 power modules (or 22 half-bridges), set <strong>Bridge type</strong> to Half-bridge and <strong>Number of bridges</strong> to 22.</p></td></tr><tr><td><strong>Carrier frequency (Hz)</strong></td><td><p>Specify the frequency, in hertz, of the triangular carrier signals.</p><p>The default value is 540.</p></td></tr><tr><td><strong>Sample time (s)</strong></td><td><p>Specify the sample time of the block. Set to <code>0</code> to implement a continuous block.</p><p>Default is 0.</p></td></tr><tr><td><strong>Show carriers outport</strong></td><td>Select this option to show the Cr output port for the carriers’ waveforms. By default, this option is cleared.</td></tr></tbody></table>

## Inputs and Outputs

<table data-header-hidden><thead><tr><th width="250.111083984375"></th><th></th></tr></thead><tbody><tr><td><strong>Uref</strong></td><td><p>Vectorized single-phase sinusoidal reference signal used to generate the output pulses.</p><p>You specify one reference voltage for each bridge of the multilevel converter you want to control. For linear operation of this block, the magnitude of Uref must be between −1 and +1.</p></td></tr><tr><td><strong>P</strong></td><td><p>Vectorized gating signal to control a multilevel converter.</p><p>When the <strong>Bridge type</strong> parameter is set to Half-bridge, the block outputs double the <strong>Number of bridges</strong> pulses.</p><p>When the <strong>Bridge type</strong> parameter is set to Full-bridge, the block outputs four times the <strong>Number of bridges</strong> pulses.</p></td></tr><tr><td><strong>Cr</strong></td><td>Carriers’ waveforms. This outport only appears if you enable the <strong>Show carriers outport</strong> option.</td></tr></tbody></table>

## Characteristics

<table data-header-hidden><thead><tr><th width="250.333251953125"></th><th></th></tr></thead><tbody><tr><td>Sample Time</td><td>Specified in the <strong>Sample Time</strong> parameter Continuous if <strong>Sample Time</strong> = 0</td></tr><tr><td>Scalar Expansion</td><td>No</td></tr><tr><td>Dimensionalized</td><td>No</td></tr></tbody></table>


---

# 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/smart-power-simulation-software-sps/blocks-functions-tools/control-and-measurements/pulse-and-signal-generators/pwm-generator-multilevel.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.
