> 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.md).

# PWM Generator

## Description

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

The **PWM Generator** block, located in the **OPAL-RT SPS Software/Pulse and Signal Generators** library, generates pulses for carrier-based pulse width modulation (PWM) converters using two-level topology. The block can be used to fire the forced-commutated devices (FETs, GTOs, or IGBTs) of single-phase, two-phase, three-phase, two-level bridges, or a combination of two three-phase bridges.

The pulses are generated by comparing a triangular carrier waveform to a reference modulating signal. The modulating signals can be generated by the PWM generator itself, or they can be a vector of external signals connected at the input of the block. One reference signal is required to generate the pulses for a single- or a two-arm bridge, and three reference signals are required to generate the pulses for a three-phase, single or double bridge.

The amplitude (modulation), phase, and frequency of the reference signals are set to control the output voltage (on the AC terminals) of the bridge connected to the PWM Generator block.

The two pulses firing the two devices of a given arm bridge are complementary. For example, pulse 4 is low (0) when pulse 3 is high (1). This is illustrated in the next two figures.

The following figure displays the two pulses generated by the PWM Generator block when it is programmed to control a one-arm bridge.

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

The triangular carrier signal is compared with the sinusoidal modulating signal. When the modulating signal is greater than the carrier pulse 1 is high (1) and pulse 2 is low (0).

For a single-phase two-arm bridge the modulating signal used for arm 2 is the negative of modulating signal used for arm 1 (180 degrees phase shift). For a three-phase six-arm bridge the three modulating signals used for bridge 2 are the negative of the modulating signals applied to bridge 1.

The following figure displays the six pulses generated by the PWM Generator block when it is programmed to control a three-arm bridge.

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

## Parameters

<table data-header-hidden><thead><tr><th width="250"></th><th></th></tr></thead><tbody><tr><td><strong>Generator Mode</strong></td><td><p>Specify the number of pulses to generate.</p><p>The number of pulses is proportional to the number of bridge arms to fire.</p><p>Select 1-arm bridge (2 pulses) to fire the self-commutated devices of a one-arm bridge.</p><p>Pulse 1 fires the upper device and pulse 2 fires the lower device.</p><p><img src="https://799605156-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdlNg8IbOdahCpFCyzxSN%2Fuploads%2Fgit-blob-172dede0edac73a52b54783f695376c8c77870c8%2FPWM_generator_mode_2bridge.png?alt=media" alt="" data-size="original"></p><p>Select 2-arm bridge (4 pulses) to fire the self-commutated devices of a two-arm bridge.</p><p>Four pulses are generated for a two-arm bridge.</p><p>Pulses 1 and 3 fire the upper devices of the first and second arm.</p><p>Pulses 2 and 4 fire the lower devices.</p><p><img src="https://799605156-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdlNg8IbOdahCpFCyzxSN%2Fuploads%2Fgit-blob-b48e043c8c4d82ab473e31bf0bd3fd84526013a1%2FPWM_generator_mode_4armbridge.png?alt=media" alt="" data-size="original"></p><p>Select 3-arm bridge (6 pulses) to fire the self-commutated devices of a three-arm bridge.</p><p>Pulses 1, 3, and 5 fire the upper devices of the first, second, and third arms.</p><p>Pulses 2, 4, and 6 fire the lower devices.</p><p><img src="https://799605156-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdlNg8IbOdahCpFCyzxSN%2Fuploads%2Fgit-blob-0dd314f178a813fe144aa93c821ecf26711aa52a%2FPWM_generator_6armbridge.png?alt=media" alt="" data-size="original"></p><p>Select Double 3-arm bridges (12 pulses) to fire the self-commutated devices of two six-pulse bridges connected in a twelve-pulse bridge configuration.</p><p>The first six pulses (1 to 6) fire the six devices of the first three-arm bridge and the last six pulses (7 to 12) fire the six devices of the second three-arm bridge.</p></td></tr><tr><td><strong>Carrier frequency</strong></td><td>The frequency, in hertz, of the carrier triangular signal.</td></tr><tr><td><strong>Internal generation of modulating signal(s)</strong></td><td><p>If selected, the modulating signal is generated by the block.</p><p>Otherwise, external modulating signals are used for pulse generation. The default is unselected.</p></td></tr><tr><td><strong>Modulation index (0 &#x3C; m &#x3C; 1)</strong></td><td><p>The <strong>Modulation index</strong> parameter is visible only if the <strong>Internal generation of modulating signal (s)</strong> parameter is selected.</p><p>The amplitude of the internal sinusoidal modulating signal.</p><p>The <strong>Modulation index</strong> must be greater than 0, and lower than or equal to 1.</p><p>This parameter is used to control the amplitude of the fundamental component of the output voltage of the controlled bridge. This parameter is only visible when <strong>Internal generation of modulating signal(s)</strong> is selected.</p></td></tr><tr><td><strong>Frequency of output voltage</strong></td><td><p>The <strong>Frequency of output voltage (Hz)</strong> parameter is visible only if the <strong>Internal generation of modulating signal (s)</strong> parameter is selected.</p><p>This parameter is only visible when <strong>Internal generation of modulating signal(s)</strong> is selected. The frequency, in hertz, of the internal modulating signals.</p><p>This parameter is used to control the fundamental frequency of the output voltage of the controlled bridge.</p></td></tr><tr><td><strong>Phase of output voltage</strong></td><td><p>The <strong>Phase of output voltage</strong> parameter is visible only if the **Internal generation of modulating signal (s)**parameter is selected. This parameter is only visible when <strong>Internal generation of modulating signal(s)</strong> is selected.</p><p>The phase, in degrees, of the internal modulating signal.</p><p>This parameter is used to control the phase of the fundamental component of the output voltage of the controlled bridge.</p></td></tr></tbody></table>

## Inputs and Outputs

<table data-header-hidden><thead><tr><th width="249.66668701171875"></th><th></th></tr></thead><tbody><tr><td><strong>Signal(s)</strong></td><td><p>The input is not visible when <strong>Internal generation of modulating signal (s)</strong> is selected.</p><p>The input is the vector of modulating signals when <strong>Internal generation of modulating signal</strong> is not selected.</p><p>Connect this input to a single-phase sinusoidal signal when the block is used to control a single- or a two-arm bridge, or to a three-phase sinusoidal signal when the PWM Generator block is controlling one or two three-phase bridges.</p></td></tr><tr><td><strong>Pulses</strong></td><td>The output contains the two, four, six, or twelve pulse signals used to fire the self-commutated devices (MOSFETs, GTOs, or IGBTs) of single-phase, two-phase, or three-phase bridges or a combination of two three-phase bridges.</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.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.
