Voltecx is in beta. The macOS build comes first; Windows and Linux packages are still being tested.Beta. macOS comes first; Windows and Linux are still in testing. What's new
Documentation

Closed-loop buck: design the compensator

The buck of the first tutorial runs at a fixed duty, so its output follows the input. Here a feedback loop holds the output at 12 V. You let the Design panel size a PI controller, read why it fails its check on this circuit, and then take the Type III compensator it suggests. About 15 minutes.

Pictures: a numbered red box is what you click or read, Run is a button, Design › Design Steps › Voltage Loop a menu path, F5 a key.

1. Open the closed-loop example

Step 1 of 8 · about 1 min

Choose File › Open Example › DC-DC › Buck converter, closed loop. The power stage is the one you know; the control loop is drawn above it.

The closed-loop buck with its loop parts, marked 1 to 5

  1. VM measures the output voltage.
  2. Ref is the set point, Vref = 12 V.
  3. Err subtracts the measurement from the set point.
  4. PI turns the error into a duty.
  5. PWM drives the switch with that duty.

2. Open the voltage-loop design

Step 2 of 8 · about 1 min

Choose Design › Design Steps › Voltage Loop.

The Design menu with Voltage Loop, marked 1

  1. Voltage Loop.

3. Look at the Design panel

Step 3 of 8 · about 1 min

The Design page opens in the editor area, as a tab beside the circuit's. The fields start filled from the circuit, and a first design is shown at once.

The Design panel on the Voltage Loop task, the Controller field, marked 1 to 2

  1. Voltage Loop is the task.
  2. Controller is Auto, and the note under it says Auto picked Type III.: the panel picked a Type III network, because a PI cannot reach the default crossover (a tenth of the 100 kHz switching frequency) on this circuit.

4. Ask for a PI

Step 4 of 8 · about 1 min

In the Controller row click PI.

The Controller row with PI, marked 1

  1. PI.

5. Design the PI

Step 5 of 8 · about 1 min

Click Run (it reads Design again until you change a field), then collapse the bottom panel (↓ at its top right) to see more of the result.

The PI design: Kp, Ki and the Bode plot of the loop, marked 1 to 2

  1. Design again: the design is computed; changing a field turns the button back into Run.
  2. Apply writes the design into the circuit.

Result: Proportional gain 0.003017 and Integral gain 73.69 1/s. The crossover field shows 685.4 Hz: with 60° of phase margin, this is as high as a PI can cross, well below the LC resonance at 1.59 kHz.

6. Apply it and read the check

Step 6 of 8 · about 1 min

Click Apply. The panel writes kp and ki into the PI block as one undo step, then checks the loop on a copy of the circuit. Fold Corner check and Changes made and scroll down the Verification list.

Check failed: the recovery overshoot after a load step is too large, marked 1

  1. Recovery overshoot fails: 73 % against a 40 % limit. The output rings after a 50 % load step, because a loop that crosses below the resonance cannot damp it.

Result: the PI regulates (the output error after the step is near zero), but the response is poorly damped. The note under the plot says what to do: a Type III network reaches 5.78 kHz here.

7. Take the Type III compensator

Step 7 of 8 · about 1 min

Click Type III in the Controller row, click Run, then Apply.

The Type III design applied and verified, marked 1 to 2

  1. Controller is Type III. The crossover is 5.78 kHz with 60° of margin.
  2. ✔ Verified: the loop passes its checks. On the schematic, the PI block is now a transfer-function block B(s)/A(s) with the same name and wires. ⌘Z brings the PI back.

8. Simulate the closed loop

Step 8 of 8 · about 1 min

Close the Design page with the × on its tab and open the bottom panel again. Click ▶ Run in the toolbar or press F5, then Maximize at the panel's top right for a larger plot.

The scope in the panel: v(out) settles on vref, marked 1 to 2

  1. v(out): the output sits on the set point. The plot shows the last cycles; Whole run above it shows the output rising from the start.
  2. vref: the 12 V set point.

Result: from 8 ms on, the output averages 12.00 V.

The same steps from a script

powercraft-cli run \
    --cmd file.openExample    --params '{"name":"buckClosedLoop"}' \
    --cmd design.voltageLoop  --params '{"controller":"pi"}' \
    --cmd design.voltageLoop  --params '{"controller":"typeIII","apply":true}' \
    --cmd simulation.run      --params '{}' \
    --cmd scope.measure       --params '{"signals":["v(out)"],"t0":"8m"}'

Next: design the transformer of a flyback.