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

Power factor correction: a boost PFC from the mains

A diode bridge with a capacitor behind it draws current only at the voltage peaks, so its power factor is poor. A power factor corrector puts a boost converter between the bridge and the capacitor and makes the line current follow the line voltage. You open a boost PFC, read its two control loops, compare the line current with the line voltage, measure the power factor and the distortion of the current, load it with a step, and let Auto Design size the same converter and its loops. About 20 minutes.

Pictures: a numbered red box is what you click or read, ▶ Run is a button, File › Open Example a menu path, ⌘⇧Y a key (⌘ is Cmd on a Mac, Ctrl elsewhere).

1. Open the example

Step 1 of 9 · about 1 min

Choose File › Open Example › Power quality › Boost PFC.

The File menu open at Open Example, Power quality, Boost PFC, marked 1 to 4

  1. File.
  2. Open Example.
  3. Power quality.
  4. Boost PFC.

2. Read the power stage

Step 2 of 9 · about 1 min

The 230 V, 50 Hz mains feeds a diode bridge. Behind it a boost converter charges a 470 µF capacitor to 400 V, and a 160 Ω load takes 1 kW.

The power stage: mains source, diode bridge, boost inductor, switch, boost diode, capacitor and load, marked 1 to 7

  1. Vs: the mains, 325 V peak (230 V rms) at 50 Hz. It floats: the DC negative rail is the ground.
  2. D1: one of the four bridge diodes D1 to D4, which turn the sine into a rectified sine.
  3. L1: the 3 mH boost inductor. It carries the rectified current and a 20 kHz ripple.
  4. S1: the MOSFET. Its duty decides how much current the inductor draws.
  5. D5: the boost diode, which passes the inductor current to the capacitor when S1 is off.
  6. C1: 470 µF at 400 V. It holds a ripple of twice the line frequency (100 Hz), because the power from a sine is not constant.
  7. R1: the 160 Ω load, 1 kW at 400 V. The voltmeter beside it gives the signal vdc.

Two meters in the bridge give the signals this tutorial uses: the ammeter AmAc gives the line current iac, and the voltmeter VMac gives the line voltage vac.

3. Read the two loops

Step 3 of 9 · about 1 min

The control sits above the power stage and meets it only through net labels (vac, il, vdc, g).

The control: voltage loop, multiplier, current loop, feed-forward duty and PWM, marked 1 to 5

  1. PIv: the slow voltage loop. It compares vdc with 400 V and gives ipk, the peak of the line current the converter must draw. Its output is limited to 0 to 15 A.
  2. Mul: multiplies ipk by the shape of the rectified line voltage, |vac|/Vpk. The result iref is a rectified sine, so the current has the shape of the voltage.
  3. PIi: the fast current loop. It compares iref with the inductor current il.
  4. Dff: the feed-forward duty 1 − |vac|/Vref. It is the duty a boost needs for its input voltage, so the current loop only corrects it.
  5. PWM: turns the duty into the gate signal g at 20 kHz.

The voltage loop crosses over near 10 Hz, well below the 100 Hz ripple on vdc, so the ripple hardly moves ipk and the current stays a clean sine. The gains in this example (PIv: 0.07 A/V and 1.5 A/(V·s); PIi: 0.06 and 120) are illustrative; step 9 shows designed ones.

4. Run it and compare the current with the voltage

Step 4 of 9 · about 1 min

Click ▶ Run, then Open in Separate Window at the top right of the scope, so the scope has a window of its own (the next steps use it). The window folds its signal list to a strip on the left edge: click Show signals there, then open Voltages and tick vac. A meter's signal is drawn by what it measures, so vac (volts) and iac (amperes) each get an axis of their own: on one shared axis, 7 A would be a flat line under 325 V.

The scope: vac on top, iac below, both sine waves in phase, marked 1 to 2

  1. vac: the line voltage, 325 V peak, 230 V rms.
  2. iac: the line current. It is a sine in phase with vac, 6.8 A at its peak, with the 20 kHz ripple of the inductor on top. A plain bridge and capacitor would give narrow pulses at the voltage peaks instead.

The first 0.1 s or so is the start-up: the DC link rises to 400 V (vdc has its own trace; tick it to see it) and the current follows the voltage loop's demand. Judge the current only after that.

5. Choose a window of whole cycles

Step 5 of 9 · about 1 min

The table measures what the plot shows, start-up included. The scope folds the table away while the plots would get less than half its width, so click Measurements in the toolbar to show it. Click Cursors (Shift+C) and drag the two lines to 160 ms and 240 ms: four whole line cycles after the start-up.

The scope with two cursors; the table heading now says cursors 160 ms to 240 ms, marked 1 to 2

  1. Cursors: shows two vertical lines and the values of every signal at each.
  2. The table's heading now reads cursors 160ms – 240ms. Every figure below, including the power rows, is taken over that window.

6. Read the distortion of the line current

Step 6 of 9 · about 1 min

Click Measurements to show and tick THD.

The measurement picker with THD ticked, marked 1 to 2

  1. Measurements to show: the columns of the table, in groups (basic, AC, transient, power).
  2. THD: the total harmonic distortion of each signal, from its spectrum up to the 50th harmonic, as a share of the fundamental.

7. Read the power factor

Step 7 of 9 · about 1 min

Press Esc to close the picker. On the scope panel's Power tab, choose vac in the first list and i(AmAc) in the second (the ammeter's own current, the same as iac), then click Add power (the line reads Power from [vac] × [i(AmAc)] [Add power]).

The Power tab with a power row for vac and i(AmAc), marked 1 to 2

  1. The power row of vac and i(AmAc). The THD column is on the Summary and Signals tabs: 6.13 % for iac, so the harmonics add up to 6 % of the 50 Hz current, and 0.00 % for vac, as the source is a pure sine.
  2. PF of the pair: 0.994, from P = 1.007 kW and S = 1.013 kVA. A plain bridge with a capacitor typically gives 0.5 to 0.7. The distortion alone would cost 0.2 % (1/√(1 + 0.0613²) = 0.998); the rest is a phase shift of about 5° between the current and the voltage.

The lists offer vac because it is the output of a voltmeter: a signal that is not named v(…) is offered after the ones that are.

8. Load it with a step

Step 8 of 9 · about 1 min

Press ⌘⇧Y to open the console (first click Dock Back on the scope). Type these two lines, each followed by Enter:

simulation.tune {"component":"R1","key":"r","value":80}
simulation.continue {"duration":0.25}

The console with the two commands, marked 1 to 3

  1. Console: every menu item is a command, and the console runs any of them.
  2. simulation.tune halves the load resistor from 160 Ω to 80 Ω at the end of the run, 0.25 s, with every capacitor voltage and inductor current kept.
  3. simulation.continue runs another 0.25 s from there.

Click the Scope tab and Open in Separate Window.

The scope after the step: vdc falls and recovers, iac doubles, marked 1 to 2

  1. vdc: the load doubles from 1 kW to 2 kW at 0.25 s and the DC link falls from 400 V to 343 V, 57 V lower, within 22 ms. The 10 Hz voltage loop is slow, so the capacitor supplies the difference until ipk has grown. The link is back near 396 V at 0.5 s.
  2. iac: the peak line current rises from 6.8 A to 12.9 A. Over 0.4 s to 0.5 s the converter takes 1.98 kW at a power factor of 0.996 and a THD of 6.2 %: the correction holds at twice the load.

A faster voltage loop would shrink the dip, but it would also let the 100 Hz ripple into ipk and distort the current. That trade-off is why the voltage loop is slow.

9. Design the two loops, then let Auto Design size the converter

Step 9 of 9 · about 3 min

Design › Design Steps › Current Loop and Design › Design Steps › Voltage Loop recognise this circuit as a boost PFC and design its two PI blocks in place. Design the current loop first: the voltage loop sits on top of it.

  1. Design › Design Steps › Current Loop: the plant is Vout/(s·L) (400 V across the 3 mH L1) behind half a switching period of delay. The crossover is a tenth of the 20 kHz switching frequency, 2 kHz, with the PI zero at a quarter of it. PIi gets Kp 0.0914 and Ki 287 (the example has 0.06 and 120), with 58° of phase margin. The feed-forward duty Dff stays as it is.
  2. Design › Design Steps › Voltage Loop: the plant runs from the peak current ipk to the DC link, from the power balance. The crossover is a tenth of the 100 Hz ripple, 10 Hz, again with the zero at a quarter of it. PIv gets Kp 0.0765 A/V and Ki 1.20 (the example has 0.07 and 1.5), with 99° of phase margin at full load and 79° at a tenth of it. The reply also gives h3, the third harmonic the 100 Hz ripple puts into the line current through the loop: 5.3 %.

In each panel press Run to see the design, then Apply: it writes the gains in one undo step and verifies them by simulating the circuit over whole line cycles. With both loops applied the check reads a power factor of 0.997, a THD of 5.8 %, the DC link within 0.05 % of 400 V with 16.9 V of 100 Hz ripple, and, after a 50 % load step, a dip of 5.6 % that settles with no overshoot.

The panels tune the loops of the circuit you have; they do not choose L1 or C1. For that, Auto Design takes a mains spec. Its form has only DC input rows, so give the spec on the console (⌘⇧Y). A run replaces the open circuit, so save your work first.

design.auto {"spec":{"vinAc":{"min":184,"nom":230,"max":264},"fline":50,"vout":400,"pout":1000,"pf":0.98,"thd":10},"fsw":"20k"}

The Auto Design result for the mains spec: PASS, power factor 0.999, THD 3.606 %, marked 1 to 2

  1. Verdict: PASS. All five checked rows pass.
  2. Power factor: 0.999 against at least 0.98, and Input current THD: 3.606 % against at most 10 %. Below it the DC link holds 400 V within 0.109 %, its 100 Hz ripple is 14.6 V against 20 V, and it stays above 300 V for 18 ms after the mains is cut (10 ms asked).

The reply holds the design: L1 2.81 mH and C1 560 µF (the ripple needs 398 µF and the hold-up 322 µF; the larger, divided by 0.8 for a 20 % tolerance, is rounded up to the E12 value 560 µF). The current loop, Kp 0.0429 and Ki 67.3, crosses at 1 kHz (a twentieth of the switching frequency, so the delay of a firmware loop leaves 46° of phase margin). The voltage loop, Kp 15.3 W/V and Ki 240, crosses at 10 Hz with 77° of margin. Every value comes with its formula in the report.

Compare with step 3: the example's hand-set loops give 0.994 and 6.1 %, the designed ones 0.999 and 3.6 %.

Two more things the same call can do. Add "harmonics":"classA" to the spec and the verification also checks each harmonic of the line current against its IEC 61000-3-2 limit (a harmonics row in percent of the limit). Add "topology":"totemPolePfc" beside spec and the run draws the bridgeless totem-pole instead of the diode bridge, with the same inductor, capacitor and loops (chapter 16 of the manual explains both). Either way the circuit comes back grouped: the power stage and the controller as blocks joined by labels.

design.auto {"spec":{"vinAc":{"min":184,"nom":230,"max":264},"fline":50,"vout":400,"pout":1000,"pf":0.98,"thd":10,"harmonics":"classA"},"fsw":"20k","topology":"totemPolePfc"}

The same steps from a script

powercraft-cli run \
    --cmd file.openExample   --params '{"name":"pfcBoost"}' \
    --cmd simulation.run     --params '{}' \
    --cmd scope.measure      --params '{"signals":["iac"],"t0":"0.16","t1":"0.24","thd":{"fundamental":50},"power":{"v":"vac","i":"iac"}}' \
    --cmd simulation.tune    --params '{"component":"R1","key":"r","value":80}' \
    --cmd simulation.continue --params '{"duration":0.25}' \
    --cmd scope.measure      --params '{"signals":["vdc","iac"],"t0":"0.25","t1":"0.5"}'

The first scope.measure gives power.powerFactor 0.994 and thd.iac.thdPercent about 6.1; the second gives the 343 V minimum of vdc and the 12.9 A peak of iac.

Back to the learning path.