# Space vector PWM (SVPWM) explained step by step

Space vector PWM is the modulator inside nearly every three-phase motor drive and grid inverter. It has a reputation for being hard: hexagons, sectors, dwell-time formulas. The idea underneath is simple, and it ends in a surprisingly short piece of code. This article builds it step by step on the `inverter3` example in Voltecx (a 600 V, 10 kHz three-phase inverter driving a 50 Hz RL load), and checks every number against a simulation.

If PWM itself is new to you, start with [PWM explained simply](https://voltecx-web.nguyenvanqui291.workers.dev/blog/pwm-explained): carrier, duty cycle and sine PWM are used here without introduction.

## Why three phases need a better modulator

A three-phase inverter has three legs, a, b and c, across one DC link. The obvious way to modulate it is three copies of single-phase sine PWM: compare three sines, 120° apart, with one triangle carrier.

That works, but it wastes voltage. Each leg's output (its **pole voltage**, measured from the midpoint of the link) can swing between $-V_{dc}/2$ and $+V_{dc}/2$, so with sine PWM the phase voltage can reach at most $V_{dc}/2$ peak. The load, however, is connected between the legs, and what it feels is the **line-to-line** voltage $v_a - v_b$. With phase peaks of $V_{dc}/2$, the line voltage peaks at only

$$\hat v_{ab} = \sqrt{3}\cdot\frac{V_{dc}}{2} = 0.866\,V_{dc}$$

yet two legs could put the full $V_{dc}$ between them: one at the top rail, the other at the bottom. Sine PWM never uses the top 13 % of the link. Space vector PWM does.

## The eight switch states

Each leg has two useful states: upper switch on (the phase sits at $+V_{dc}/2$, write 1) or lower switch on ($-V_{dc}/2$, write 0). Three legs give $2^3 = 8$ combinations, written as three bits for legs a, b and c:

| State | Pole voltages $(v_a, v_b, v_c)$ | Name |
|---|---|---|
| 100 | $(+, -, -)$ | V1 |
| 110 | $(+, +, -)$ | V2 |
| 010 | $(-, +, -)$ | V3 |
| 011 | $(-, +, +)$ | V4 |
| 001 | $(-, -, +)$ | V5 |
| 101 | $(+, -, +)$ | V6 |
| 000 | all $-$ | V0 (zero) |
| 111 | all $+$ | V7 (zero) |

In states 000 and 111 all three phases sit at the same rail, so every line-to-line voltage is zero: these are the **zero vectors**. The other six put voltage on the load: the **active vectors**.

## A picture for three numbers: the αβ plane

Three phase voltages are awkward to picture. In a balanced load, though, only two of the three numbers are independent (whatever is common to all three phases, the **zero sequence**, never drives a current through a three-wire load). The **Clarke transform** turns the three phases into two coordinates, $\alpha$ and $\beta$, and drops the common part:

$$v_\alpha = \frac{2v_a - v_b - v_c}{3}, \qquad v_\beta = \frac{v_b - v_c}{\sqrt{3}}$$

This is the amplitude-invariant form that the `clarke` block in Voltecx uses: a balanced set $v_a = \hat V\cos\theta$ (and $b$, $c$ 120° behind and ahead) becomes the point $(\hat V\cos\theta, \hat V\sin\theta)$, a vector of length $\hat V$ turning at the output frequency. A sinusoidal three-phase voltage is a **point moving on a circle**.

Put each switch state through the transform. For 100, with $V_{dc} = 600$ V:

$$v_\alpha = \frac{2(300) - (-300) - (-300)}{3} = 400\ \text{V}, \qquad v_\beta = 0$$

All six active states land at the same distance, $2V_{dc}/3 = 400$ V, 60° apart; the two zero states land at the origin. Together they form a **hexagon**.

![The vα–vβ plane of the 600 V inverter: the six active vectors V1 to V6 on a hexagon of radius 400 V, the zero vectors at the origin, the circle of radius Vdc/√3 (346 V) inside the hexagon, the sine PWM limit Vdc/2 (300 V), and the average output vector simulated in Voltecx at m = 0.8 and m = 1.3.](https://voltecx-web.nguyenvanqui291.workers.dev/media/blog/space-vector-pwm-explained/vector-plane.svg)

This picture holds the whole story:

- The inverter can only **sit on** one of the seven points at any instant.
- Over one switching period it can **average** any point inside the hexagon, by spending the right fraction of the period on nearby vectors. PWM is averaging, here in two dimensions.
- To turn a circle at constant speed, the circle must fit inside the hexagon. The largest one that fits touches the middle of each edge, at radius $\frac{2V_{dc}}{3}\cos 30° = V_{dc}/\sqrt{3} = 346$ V.
- Sine PWM stops at the circle of radius $V_{dc}/2 = 300$ V. The ratio is $346/300 = 2/\sqrt{3} = 1.155$: **15.5 % more voltage** from the same DC link.

In the figure, the purple circle is the simulated average output at a modulation index $m = 0.8$ (defined below): a circle of 240 V, to within 0.1 %.

## Sectors and dwell times

The six active vectors split the plane into six 60° **sectors**. Suppose the reference vector $\vec v^{\,*}$ lies in sector 1, between V1 (100) and V2 (110), at an angle $\theta$ from V1. Over one switching period $T_s$ the inverter spends:

- $T_1$ on V1,
- $T_2$ on V2,
- $T_0$ on the zero vectors, the rest of the period.

The average must equal the reference: $T_1 \vec V_1 + T_2 \vec V_2 = T_s \vec v^{\,*}$. Solving this in the αβ plane gives the **dwell times** (H. W. van der Broeck, H.-C. Skudelny and G. V. Stanke, "Analysis and realization of a pulsewidth modulator based on voltage space vectors", *IEEE Transactions on Industry Applications*, vol. 24, no. 1, 1988):

$$T_1 = T_s\,\frac{\sqrt{3}\,|v^*|}{V_{dc}}\,\sin(60° - \theta), \qquad T_2 = T_s\,\frac{\sqrt{3}\,|v^*|}{V_{dc}}\,\sin\theta, \qquad T_0 = T_s - T_1 - T_2$$

### Worked example

Take $m = 0.8$, so the reference has $|v^*| = 0.8 \times 300 = 240$ V, at $\theta = 30°$, the middle of sector 1:

$$\frac{\sqrt{3} \times 240}{600} = 0.693, \qquad T_1 = T_2 = 0.693 \times \sin 30° \cdot T_s = 0.346\,T_s, \qquad T_0 = 0.307\,T_s$$

At 10 kHz ($T_s = 100$ µs) that is 34.6 µs on V1, 34.6 µs on V2 and 30.7 µs on the zero vectors.

The same shares can be read off the simulation. In each period, the time with one upper switch on (100, 010 or 001) is the largest duty minus the middle one; the time with two upper switches on (110, 011, 101) is the middle duty minus the smallest; the rest is spent in 000 and 111.

![Dwell times against the angle of the reference, read from the duties simulated in Voltecx at m = 0.8: the share of each switching period on an active vector with one upper switch on, with two, and on the zero vectors. The vertical lines are the sector boundaries.](https://voltecx-web.nguyenvanqui291.workers.dev/media/blog/space-vector-pwm-explained/dwell-times.svg)

Over the whole cycle the simulated shares follow the formulas to within 0.002 of a period, and at 30° they are 0.346, 0.346 and 0.307, as computed above. Note how the zero-vector share never falls to zero at $m = 0.8$: there is margin left. It reaches zero in the corners of the sectors when the reference circle touches the hexagon.

## Zero vectors and the switching sequence

The dwell times say how long, not in which order. The standard choice:

- split $T_0$ equally between 000 and 111;
- arrange the period symmetrically, so that going from one state to the next changes **one leg at a time**.

In sector 1 the period runs 111, 110, 100, 000, 100, 110, 111 (or the same starting from 000): seven segments, each leg switching exactly twice per period. This is the **seven-segment** sequence.

![One 100 µs switching period of the simulated inverter with the reference at 30°: the triangle carrier and the three duties (top), and the gates ga, gb and gc (bottom, offset for clarity). The state steps 111, 110, 100, 000, 100, 110, 111, one leg at a time.](https://voltecx-web.nguyenvanqui291.workers.dev/media/blog/space-vector-pwm-explained/switching-period.svg)

Look at the top panel: this sequence is just three duties compared with **one triangle carrier**, exactly like sine PWM. Phase a has the largest duty and is on the longest, phase c the smallest. The space vector modulator is a carrier comparison in disguise; only the duties are different.

## SVPWM is sine PWM plus a zero sequence

Which duties? Write the duty of each leg as $d_x = 0.5 + (v_x + v_0)/V_{dc}$, where $v_x$ is the sine reference of that phase and $v_0$ is a voltage added to **all three** phases. Since $v_0$ is common, it cancels in every line-to-line voltage and the load never sees it. It is free to choose.

- $v_0 = 0$ gives sine PWM.
- Centring the active vectors in the period (equal 000 and 111 times) is the same as centring the three duties between 0 and 1:

$$v_0 = -\frac{\max(v_a, v_b, v_c) + \min(v_a, v_b, v_c)}{2}$$

This is the **min-max** (or centred) zero sequence. With it, carrier-based PWM and the seven-segment space vector modulator switch at exactly the same instants (K. Zhou and D. Wang, "Relationship between space-vector modulation and three-phase carrier-based PWM: a comprehensive analysis", *IEEE Transactions on Industrial Electronics*, vol. 49, no. 1, 2002). That is why a practical SVPWM fits in a few lines of firmware: no sectors, no trigonometry.

```c
float v0 = -0.5f * (fmaxf(va, fmaxf(vb, vc)) + fminf(va, fminf(vb, vc)));
da = 0.5f + (va + v0) / vdc;   /* and the same for db, dc */
```

The `svpwm` block in Voltecx does exactly this (and clamps each output to the PWM's range).

![The phase-a reference over one 50 Hz cycle in the simulated inverter. At m = 0.8 (top): the sine as a duty, the SVPWM duty da with its "saddle" shape, and their difference, the min-max zero sequence. At m = 1.15 (bottom): the sine would need a duty of 1.075, which no PWM can give, while the SVPWM duty stays inside 0 to 1.](https://voltecx-web.nguyenvanqui291.workers.dev/media/blog/space-vector-pwm-explained/references.svg)

At $m = 0.8$ the sine duty peaks at $0.5 + 0.8/2 = 0.9$, while the SVPWM duty, flattened by the zero sequence, peaks at $0.5 + (\sqrt{3}/2)(0.8/2) = 0.846$. The zero sequence itself is a triangle-like wave at three times the output frequency, peaking at $m/8 = 0.1$.

At $m = 1.15$ the difference decides everything: the sine needs a duty of 1.075, which cannot be made, so sine PWM is already overmodulated. The saddle peaks at 0.998 and still fits.

The older idea of adding a pure third harmonic (one sixth of the fundamental) gives the same 15.5 % (J. A. Houldsworth and D. A. Grant, "The use of harmonic distortion to increase the output voltage of a three-phase PWM inverter", *IEEE Transactions on Industry Applications*, vol. IA-20, no. 5, 1984). The min-max sequence is simply the one that reaches it with the most symmetric switching.

## The modulation index and the 15.5 %

Define the modulation index as the phase reference peak over half the link, $m = \hat v_{ph}/(V_{dc}/2)$. As long as the modulator stays linear, the fundamental of the line-to-line voltage is

$$\hat v_{ab,1} = \sqrt{3}\cdot m\cdot\frac{V_{dc}}{2}$$

- **Sine PWM** is linear up to $m = 1$: $\hat v_{ab,1} = 0.866 \times 600 = 519.6$ V.
- **SVPWM** is linear up to $m = 2/\sqrt{3} = 1.155$: $\hat v_{ab,1} = V_{dc} = 600$ V.

![Fundamental of the line-to-line voltage against the modulation index in Voltecx runs of the inverter: sine PWM and SVPWM, with the linear law √3·m·Vdc/2. Vertical lines at m = 1 and m = 1.155; horizontal lines at 519.6 V and 600 V.](https://voltecx-web.nguyenvanqui291.workers.dev/media/blog/space-vector-pwm-explained/line-voltage-vs-m.svg)

The simulation confirms both limits to within 0.5 %: 519.2 V for sine PWM at $m = 1$, 599.6 V for SVPWM at $m = 1.155$. At $m = 1.155$ sine PWM, already clipping, gives only 565 V.

## Overmodulation: beyond the hexagon's circle

Ask for more than $m = 1.155$ and the reference circle pokes out of the hexagon near the middle of each edge. The inverter cannot average a point outside the hexagon, so something has to give. The `svpwm` block clamps the duties to 0 and 1, which keeps the line voltage between the largest and smallest phase at the full $V_{dc}$, so the average vector **slides along the hexagon's edge** until the reference comes back inside. In the vector plane above, the orange trajectory at $m = 1.3$ follows the edges, between 346 V (the middle of an edge) and 390 V (the reference, in the corners).

The price:

- **Little extra voltage.** The line voltage grows only to 630 V at $m = 1.3$, and creeps towards the **six-step** limit, where each leg is a square wave: $\hat v_{ab,1} = (2\sqrt{3}/\pi)\,V_{dc} = 662$ V. Neither modulator passes it.
- **Low-order harmonics.** Clipping distorts the waveform with the 5th, 7th, 11th and 13th harmonics, which drive extra current and torque ripple in a motor.

Dedicated overmodulation schemes manage this transition smoothly up to six-step (J. Holtz, W. Lotzkat and A. M. Khambadkone, "On continuous control of PWM inverters in the overmodulation range including the six-step mode", *IEEE Transactions on Power Electronics*, vol. 8, no. 4, 1993). Most drives simply limit $m$ to about 1.15 and leave a small margin for the current controller.

## What the zero sequence does to the spectrum

The zero sequence is invisible to the load but not to the pole voltage. A Fourier analysis of one 50 Hz cycle shows where it goes:

![Low-order harmonics of the simulated inverter at m = 0.8. Top: the pole voltage v(oa) of leg a with sine PWM and with SVPWM. Bottom: the line-to-line voltage vab with SVPWM.](https://voltecx-web.nguyenvanqui291.workers.dev/media/blog/space-vector-pwm-explained/pole-spectrum.svg)

- Both modulators give the same 240 V fundamental on the pole voltage at $m = 0.8$.
- The SVPWM pole voltage carries a 49.6 V **third harmonic**, plus smaller lines at the 9th and 15th: the zero sequence. Its value matches the third harmonic of the min-max sequence of a 240 V sine computed directly, 49.6 V.
- In the line-to-line voltage the triplen harmonics cancel: under 1 V is left at the third. The load sees the same clean fundamental, just with 15.5 % more headroom.

One consequence: in a three-wire load the star point is not at the link's midpoint but follows the zero sequence. Connect the star point to the midpoint (a four-wire system) and the third harmonic drives a current in that wire. SVPWM is for three-wire loads.

## Practical pitfalls

- **Scale the reference with the link.** The duties are $v/V_{dc}$, so a drive must divide by the **measured** link voltage. The `svpwm` block takes $V_{dc}$ as an input for this reason.
- **Leave headroom.** Running at exactly $m = 1.155$ leaves the current controller nothing to correct with. Limit the voltage vector to a little under $V_{dc}/\sqrt{3}$.
- **Dead time eats small vectors.** At low speed the zero-vector time is long and the active-vector times are short; the dead-time error of $V_{dc}\,t_d\,f_{sw}$ per leg is then a large fraction of the command (see [Dead-time effects](https://voltecx-web.nguyenvanqui291.workers.dev/blog/dead-time-effects)).
- **Minimum pulses.** Near the corners of the hexagon, $T_0$ approaches zero and the 000 and 111 segments shrink below what the gate driver can produce. Clamp them or move to discontinuous PWM, which clamps one leg to a rail for 60° at a time and saves a third of the switching events.
- **Simulate the edges exactly.** An edge that falls between two steps of a fixed-step run has to be recorded at the instant it happens, with the switch still in its old state. On its default fixed 1 µs step, the reference solver now does that for `inverter3`, and at $m = 0.2$ it reads a line fundamental within 0.5 % of the 103.9 V of the formula, with sine PWM and with SVPWM alike. The fast solver, which lands its steps on the PWM edges, gives 103.8 V for both. The runs in this article use the fast solver.

## Try it in Voltecx

- Open `inverter3` (`File › Open Example`, Inverters): sine-triangle PWM from a `sine3` source into a `pwm3` block.
- To make it SVPWM, set the `sine3` source to volts (`amp` = $m \cdot V_{dc}/2$, `offset` = 0), wire its three outputs into an `svpwm` block with `output` set to `duty` and a constant 600 V on its `vdc` input, and wire the block's `ma`, `mb`, `mc` outputs to the `pwm3` inputs. That is exactly what the test behind this article does.
- A `clarke` block on the three duties gives `alpha` and `beta`; plot one against the other (an x-y plot) to see the vector turn inside the hexagon.
- `analysis.fft` on `v(oa)` shows the third harmonic of the zero sequence; on a voltmeter between `oa` and `ob` it shows the clean line voltage. `analysis.paramSweep` over the source's `amp` gives the voltage-against-$m$ curve.
- In `simulation.settings`, set `solver` to `fast` to put the steps on the PWM edges.
- The `pmsmFoc` example (Motor drives) uses the same `svpwm` block inside a field-oriented current loop.

Every figure here comes from a Voltecx test that runs the inverter with these numbers, and the test fails if a simulated number quoted in this article no longer matches the run.
