# Full-bridge inverter: a 50 Hz sine from a DC link

A full bridge turns a DC voltage into AC. You open a single-phase inverter with sine PWM and an LC filter, read how its gates are made, simulate it, check the spectrum of the output, and let the Problems list lengthen a run that is too short. About 15 minutes.

Pictures: a numbered red box is what you click or read, `[FFT]` is a button, `File › Open Example` a menu path, `F5` a key.

## 1. Open the inverter example

Choose `File › Open Example › Inverters › Single-phase full-bridge inverter`.

![The File menu open at Open Example, Inverters, Single-phase full-bridge inverter, marked 1 to 4](https://voltecx-web.nguyenvanqui291.workers.dev/docs/tutorials/img/en/full-bridge-inverter/01-open-example.png)

1. `File`.
2. `Open Example`.
3. `Inverters`.
4. `Single-phase full-bridge inverter`.

## 2. Read the power stage

Four MOSFETs make two legs across the 400 V link. The output is taken between the legs, through the filter.

![The power stage: two legs of two MOSFETs, the LC filter and the load, marked 1 to 7](https://voltecx-web.nguyenvanqui291.workers.dev/docs/tutorials/img/en/full-bridge-inverter/02-power.png)

1. `Qah`: high side of leg a.
2. `Qal`: low side of leg a.
3. `Qbh`: high side of leg b.
4. `Qbl`: low side of leg b.
5. `L1`: 1 mH, one half of the filter inductance (`L2` is the other half, in the return path).
6. `C1`: 10 µF. With 2 mH it filters at 1.1 kHz, well below the switching ripple.
7. `R1`: the 50 Ω load. The voltmeter `VM` beside it gives the signal `vo`.

## 3. Read the control

Each leg has its own sine reference and PWM. The gate signals reach the switches through net labels (`gah`, `gal`…), so no wire crosses the page.

![The control: sine references, PWM, inverters and dead-time blocks, marked 1 to 4](https://voltecx-web.nguyenvanqui291.workers.dev/docs/tutorials/img/en/full-bridge-inverter/03-control.png)

1. `Refa`: `0.5 + 0.4·sin(2π·50 t)`, the duty of leg a. The modulation index `Mi` = 0.8 sets the 0.4.
2. `PWMa`: compares the duty with a 10 kHz carrier and switches leg a.
3. `DTah`: delays the turn-on of `Qah` by 500 ns. Its partner `DTal`, behind the inverter `Na`, does the same for `Qal`, so the two switches of a leg are never on together.
4. `Refb`: the same sine shifted by 180°, for leg b. The voltage between the legs then switches at twice the carrier frequency (unipolar PWM), which halves the filter's work.

## 4. Run it

Click `[▶ Run]` or press `F5`. The scope shows in the panel under the schematic; click `Maximize` at the panel's top right for a larger plot.

![The scope: vo is a 50 Hz sine, marked 1 to 2](https://voltecx-web.nguyenvanqui291.workers.dev/docs/tutorials/img/en/full-bridge-inverter/04-run.png)

1. `vo`: a 50 Hz sine of 316.6 V peak, 222.7 V rms. The ideal value is `Mi·Vdc` = 320 V peak; the dead time takes about 2 V from each leg (`Vdc·td·fsw`).
2. `FFT` at the end of the `vo` row of the measurements shows the spectrum of this signal over the visible window.

## 5. Read the spectrum

A spectrum needs a whole number of cycles: the visible window (about 4 ms to 56 ms) is not, and its spectrum smears the 50 Hz line. So take two whole cycles after the start-up. Click `Cursors` and put the two lines at 20 ms and 60 ms. Click `Measurements` in the scope toolbar to hide the table, so the plot takes the panel's width, then the spectrum button at the left of the plot's header.

![The plot as a spectrum between the cursors: fundamental 50 Hz, 315 V, marked 1 to 3](https://voltecx-web.nguyenvanqui291.workers.dev/docs/tutorials/img/en/full-bridge-inverter/05-fft.png)

1. The spectrum button: the plot shows the spectrum of its signals instead of the waveform.
2. The time range: pick `Between cursors` (it starts at `Visible window`).
3. The fundamental and the distortion: `vo: fundamental 50Hz, 315V, THD 0.70%`.

**Result:** the fundamental is 315 V at 50 Hz and the total harmonic distortion is 0.69 % over the visible window (24.5 µs to 60 ms, shown above the measurements). Another window gives a slightly different THD: the script below takes 20 ms to 60 ms and reads 0.68 %. The small odd harmonics (3rd, 5th, 7th) come from the dead time.

## 6. Read the note in Problems

Click the spectrum button again to go back to the waveform, `Measurements` to bring the table back and `Restore` at the panel's top right, then click the `Problems` tab.

![Problems: Run too short, with a Run until 200 ms button, marked 1 to 3](https://voltecx-web.nguyenvanqui291.workers.dev/docs/tutorials/img/en/full-bridge-inverter/06-problems.png)

1. `Problems 1`: one note.
2. `Run too short`: 60 ms holds only three cycles of 50 Hz, too few to trust the averages.
3. `[Run until 200 ms]` sets a longer end time.

## 7. Fix it and run again

Click `[Run until 200 ms]`, then press `F5`. When the run ends, click `[Show results]` on its notice and `Maximize`.

![Ten cycles of vo; Run History shows the end time change, marked 1 to 2](https://voltecx-web.nguyenvanqui291.workers.dev/docs/tutorials/img/en/full-bridge-inverter/07-fixed.png)

1. `vo` now shows ten cycles (the end time is 200 ms). From 40 ms on it holds 222.7 V rms with 0.70 % THD.
2. The `Runs` tab lists both runs and what changed between them: `tEnd 60 ms to 200 ms`.

## The same steps from a script

```sh
powercraft-cli run \
    --cmd file.openExample     --params '{"name":"fullBridgeSpwm"}' \
    --cmd simulation.run       --params '{}' \
    --cmd analysis.fft         --params '{"signal":"vo","t0":"20m","t1":"60m"}' \
    --cmd simulation.settings  --params '{"tEnd":"200m"}' \
    --cmd simulation.run       --params '{}' \
    --cmd scope.measure        --params '{"signals":["vo"],"t0":"40m","thd":{"fundamental":50}}'
```

Next: [the three-phase motor drive](https://voltecx-web.nguyenvanqui291.workers.dev/docs/tutorials/06-motor-drive/).
