# Three-Phase PWM (`pwm3`)

> Turns three duties into three gate signals with one shared carrier.

![pwm3](https://voltecx-web.nguyenvanqui291.workers.dev/docs/reference/img/pwm3.svg)

[Component reference](https://voltecx-web.nguyenvanqui291.workers.dev/docs/reference/) · [繁體中文](https://voltecx-web.nguyenvanqui291.workers.dev/zh/docs/reference/control/pwm3/)

**Group:** Control · **Kind:** `{"block":"pwm3","kind":"control"}`

## When to use it

Use it for a three-phase inverter, usually after Space-Vector Modulator set to duty. Use PWM Generator for a single gate.

## Pins

| Pin | Domain | Meaning |
|---|---|---|
| `a` | signal | Duty for phase a, 0 to 1 |
| `b` | signal | Duty for phase b, 0 to 1 |
| `c` | signal | Duty for phase c, 0 to 1 |
| `ga` | signal | Gate signal for phase a |
| `gb` | signal | Gate signal for phase b |
| `gc` | signal | Gate signal for phase c |

## Common parameters

- `freq`: Carrier frequency shared by all three phases (Default: required)

## Parameters

| Key | Unit | Default | Typical range | Description |
|---|---|---|---|---|
| `freq` | Hz | required |  | Carrier frequency shared by all three phases |
| `counts` | — | optional (off) |  | Timer counts in one PWM period; the duty rounds to 1/counts (none = exact) |
| `hrpwm` | s | optional (off) |  | High-resolution PWM edge step, or `f28379d` (150 ps) or `stm32g474` (184 ps); the duty rounds to step × freq |

_Parameter descriptions are in English in both languages._

## Model

Each gate follows duty > carrier, with the same triangle carrier of frequency freq (0 at the start of each period, 1 at half a period). The three phases are aligned and their edges are symmetric around the carrier valley. Each duty is clamped to 0 ... 1, and the solver lands a step on every edge. There is no dead time and no opposite output. With `counts` or `hrpwm` each duty first rounds to the timer's resolution, as in PWM Generator.

## Common mistakes

- The inputs are duties, not modulation signals. With the default output m of Space-Vector Modulator, which runs from -1 to 1, the negative half is cut off and the inverter output distorts, so set output to duty.
- A bridge with no dead time can shoot through. For both switches of a leg, make the opposite gate with Logic NOT and add a Dead Time to each gate, and keep the maximum step below one fiftieth of the carrier period.

Problems rules: `duty.out_of_range`, `step.too_large`, `shoot-through`

## Datasheet and sources

No datasheet applies. The value of freq is the inverter switching frequency you design for, for example 10 kHz in the drive examples, and the duties come from Space-Vector Modulator or a sine reference centred on 0.5.

## Example

Open the example with the command `file.openExample` and the name `demo:pwm3`.

---
Generated by `cargo xtask reference` from the usage texts and parameter specs. Do not edit by hand.
