# Dual active bridge: power set by a phase shift

A dual active bridge (DAB) is two full bridges on either side of a transformer, with an inductance between them. Both bridges switch at half duty; the secondary's lag behind the primary sets how much power moves and in which direction. That makes it the usual stage between a DC bus and a battery, which must charge and discharge. Here you open the `dab` example, compare its power with the textbook formula, see what a larger shift costs in current, send the power back, and let Design › Automate size one from a spec. About 15 minutes.

`[▶ Run]` is a button, `File › Open Example` a menu path and `F5` a key.

The numbers on this page are checked by the tests of `crates/engine/tests/tutorial_dab.rs`, which run the same example.

## 1. Open the example

Choose `File › Open Example › Isolated › Dual active bridge`.

![The File menu open at Open Example, Isolated, Dual active bridge, marked 1 to 4](https://voltecx-web.nguyenvanqui291.workers.dev/docs/tutorials/img/en/dual-active-bridge/01-open-example.png)

The left bridge (legs `a` and `b`) sits on the 400 V bus `V1`, the right bridge (legs `c` and `d`) on the 200 V bus `V2`. Between them are the ammeter `AmL` (its output is the signal `iL`), the series inductance `Lk` and the 2:1 transformer `T1`. Above each bridge is its modulator: a 50 kHz carrier, an inverter for the second leg and a 100 ns dead time on each gate. The gate signals reach the switches by net label.

The example's variables (`Circuit › Variables`) hold its whole design:

| Variable | Value | What it is |
|---|---|---|
| `V1`, `V2` | 400 V, 200 V | the two buses |
| `Nt` | 2 | the transformer ratio n |
| `fsw` | 50 kHz | the switching frequency of both bridges |
| `Lk` | 50 µH | the series inductance, referred to the primary |
| `Phs` | 30 | the phase shift, in degrees, of the secondary's carrier behind the primary's |
| `td` | 100 ns | the dead time |

Both buses are sources, so the run measures the power a given shift moves; nothing regulates it yet. With n·V2 = V1 the inductor current is flat-topped and each switch turns on at zero voltage.

## 2. Run it

Press `F5`. The run is 2 ms; the currents start at zero, so read everything after 1 ms (`scope.measure {"signals":["iL","i(V1)","i(V2)"],"t0":1e-3}`).

- `iL` is a trapezoid of ±<!-- run:p30.ipk -->13.8 A<!-- /run --> peak, <!-- run:p30.irms -->12.6 A<!-- /run --> rms.
- `i(V2)` averages to <!-- run:p30.pout -->4.43 kW<!-- /run --> into the 200 V bus, while the 400 V bus gives <!-- run:p30.pin -->4.46 kW<!-- /run -->. The <!-- run:p30.loss -->32 W<!-- /run --> between them heat the eight 20 mΩ switches.

![The scope after the run at 30 degrees, zoomed to 5 cycles: the inductor current i(Lk) is flat-topped, with its flat tops near +14 A and −14 A, just outside the ±10 A gridlines, marked 1](https://voltecx-web.nguyenvanqui291.workers.dev/docs/tutorials/img/en/dual-active-bridge/02-run.png)

The textbook power (De Doncker, Divan and Kheraluwala, 1991) is

P = V1 · n·V2 · φ · (π − φ) / (2π² · fsw · Lk)

with φ the shift in radians. At 30 degrees it gives <!-- run:p30.theory -->4.44 kW<!-- /run -->: the run and the formula agree within the dead time's and the switches' share. The power depends only on the shift, both voltages, the frequency and `Lk`, so `Lk` is chosen for the full power at a moderate shift.

## 3. A larger shift: more power, much more current

Set `Phs` to 60, run, then 90, and read the same numbers:

| `Phs` | Power out | Formula | `iL` peak | `iL` rms | Lost in the switches |
|---|---|---|---|---|---|
| 30 | <!-- run:p30.pout -->4.43 kW<!-- /run --> | <!-- run:p30.theory -->4.44 kW<!-- /run --> | <!-- run:p30.ipk -->13.8 A<!-- /run --> | <!-- run:p30.irms -->12.6 A<!-- /run --> | <!-- run:p30.loss -->32 W<!-- /run --> |
| 60 | <!-- run:p60.pout -->7.05 kW<!-- /run --> | <!-- run:p60.theory -->7.11 kW<!-- /run --> | <!-- run:p60.ipk -->27.5 A<!-- /run --> | <!-- run:p60.irms -->23.5 A<!-- /run --> | <!-- run:p60.loss -->112 W<!-- /run --> |
| 90 | <!-- run:p90.pout -->7.89 kW<!-- /run --> | <!-- run:p90.theory -->8.00 kW<!-- /run --> | <!-- run:p90.ipk -->41.1 A<!-- /run --> | <!-- run:p90.irms -->32.7 A<!-- /run --> | <!-- run:p90.loss -->215 W<!-- /run --> |

The power peaks at 90 degrees, where φ·(π − φ) is largest, but its last 30 degrees add little while the rms current, and with it the conduction loss, keeps climbing: most of that current only circulates between the two bridges. This is why a DAB is designed for its full power at a shift well below 90 degrees, and why a shift above 90 degrees moves less power, not more.

## 4. Send the power back

Set `Phs` to −30 and run. Now the secondary leads: the 200 V bus gives <!-- run:m30.pout -->4.46 kW<!-- /run --> and the 400 V bus takes <!-- run:m30.pin -->4.43 kW<!-- /run -->, the formula's <!-- run:m30.theory -->4.44 kW<!-- /run --> in the other direction. The circuit did not change: only the sign of the shift. A battery on the 200 V side discharges into the bus this way.

![The scope after the run at −30 degrees, zoomed to 5 cycles, compared with Run 1: i(Lk) (solid) has the same flat tops near ±14 A as the 30 degree run (dashed), but its edges fall at other times: the current's phase has moved with the shift, marked 1](https://voltecx-web.nguyenvanqui291.workers.dev/docs/tutorials/img/en/dual-active-bridge/03-reverse.png)

## 5. Design one from a spec

`design.auto` draws a DAB when you name it, sizes `Lk` for the full power at 30 degrees from the lowest input, and closes a PI on the output that moves the shift (chapter 16 of the manual, "A dual active bridge"). Like the rest of Design › Automate, it runs on Voltecx Cloud.

```sh
powercraft-cli run --cmd design.auto --params \
  '{"spec":{"vin":[360,440],"vout":200,"iout":20,"ripple":2},"topology":"dab","fsw":"50k"}'
```

After the forward checks, the `reverse` stage runs copies of the finished circuit backwards at the lowest and the highest input: the load becomes a current source that feeds the full-load current into the output. The reply's `reverse.corners` gives, for each input, the output it held, the phase shift (negative: the power flows back) and the power that reached the input. A corner that misses the output tolerance is an open item, not a failed gate, since the spec asks for no reverse power.

## Try next

- Set `V2` to 160 and run at 30 degrees: n·V2 is no longer V1, the current is no longer flat-topped: its peak rises while the power falls, so each kilowatt costs more rms current.
- `threePortDab` adds a third bridge on the same core (`File › Open Example › Isolated`), and `threePortDabClosedLoop` closes a loop on each of its two shifts.

Next: the [manual](https://voltecx-web.nguyenvanqui291.workers.dev/docs/manual/15-examples/) lists the isolated examples, and [chapter 16](https://voltecx-web.nguyenvanqui291.workers.dev/docs/manual/16-automatic-design/) the DAB template.
