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 minChoose File › Open Example › Power quality › Boost PFC.
File.Open Example.Power quality.Boost PFC.
2. Read the power stage
Step 2 of 9 · about 1 minThe 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.
Vs: the mains, 325 V peak (230 V rms) at 50 Hz. It floats: the DC negative rail is the ground.D1: one of the four bridge diodesD1toD4, which turn the sine into a rectified sine.L1: the 3 mH boost inductor. It carries the rectified current and a 20 kHz ripple.S1: the MOSFET. Its duty decides how much current the inductor draws.D5: the boost diode, which passes the inductor current to the capacitor whenS1is off.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.R1: the 160 Ω load, 1 kW at 400 V. The voltmeter beside it gives the signalvdc.
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 minThe control sits above the power stage and meets it only through net labels (vac, il, vdc, g).
PIv: the slow voltage loop. It comparesvdcwith 400 V and givesipk, the peak of the line current the converter must draw. Its output is limited to 0 to 15 A.Mul: multipliesipkby the shape of the rectified line voltage,|vac|/Vpk. The resultirefis a rectified sine, so the current has the shape of the voltage.PIi: the fast current loop. It comparesirefwith the inductor currentil.Dff: the feed-forward duty1 − |vac|/Vref. It is the duty a boost needs for its input voltage, so the current loop only corrects it.PWM: turns the duty into the gate signalgat 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 minClick ▶ 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.
vac: the line voltage, 325 V peak, 230 V rms.iac: the line current. It is a sine in phase withvac, 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 minThe 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.
Cursors: shows two vertical lines and the values of every signal at each.- 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 minClick Measurements to show and tick THD.
Measurements to show: the columns of the table, in groups (basic, AC, transient, power).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 minPress 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 row of
vacandi(AmAc). TheTHDcolumn is on theSummaryandSignalstabs: 6.13 % foriac, so the harmonics add up to 6 % of the 50 Hz current, and 0.00 % forvac, as the source is a pure sine. PFof the pair: 0.994, fromP= 1.007 kW andS= 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 minPress ⌘⇧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}
Console: every menu item is a command, and the console runs any of them.simulation.tunehalves the load resistor from 160 Ω to 80 Ω at the end of the run, 0.25 s, with every capacitor voltage and inductor current kept.simulation.continueruns another 0.25 s from there.
Click the Scope tab and Open in Separate Window.
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 untilipkhas grown. The link is back near 396 V at 0.5 s.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 minDesign › 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.
Design › Design Steps › Current Loop: the plant isVout/(s·L)(400 V across the 3 mHL1) 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.PIigetsKp0.0914 andKi287 (the example has 0.06 and 120), with 58° of phase margin. The feed-forward dutyDffstays as it is.Design › Design Steps › Voltage Loop: the plant runs from the peak currentipkto 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.PIvgetsKp0.0765 A/V andKi1.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 givesh3, 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"}
Verdict: PASS. All five checked rows pass.Power factor: 0.999 against at least 0.98, andInput 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.









