Free Trial
Free Trial
Power Electronics|Power Systems

How to Simulate a Digital Control Algorithm for Active Power Factor Correction

Key Takeaways

  • Active power factor correction works best when the rectifier, sensing chain, and sampled controller are modelled as one system rather than tuned as separate pieces.
  • The current loop and voltage loop need different bandwidth priorities, and both must be checked across line and load extremes before hardware exists.
  • Power factor is only one outcome, so pre-hardware testing must include delay, ripple, saturation, quantization, and startup behaviour.

Accurate digital PFC simulation will save redesign time and prevent efficiency loss before a board exists.

Active power factor correction shapes rectifier input current so it follows the line voltage and keeps harmonic content low. The difficult part is not the boost stage alone. The difficult part is the interaction between that stage and a sampled controller with sensing delay, duty limits, and ripple on the DC bus. Data centres used about 240 TWh of electricity in 2022, which shows why repeated front end losses matter across switch mode supplies.

You’ll get better control results when the plant and the digital loop are modelled as one system from the start. That single model lets you tune gains against actual converter behaviour, check sampling effects before layout work starts, and catch weak assumptions that a paper design will hide. Good simulation is not a final check. It is the place where active power factor correction control earns its stability.

Active power factor correction forces sinusoidal input current

Active power factor correction makes the rectifier draw current that matches the mains voltage waveform. A good controller keeps current nearly sinusoidal, closely phased with the line, and stable across load and line variation. Digital control improves power factor when its sensing and update timing are modelled correctly. A continuous design alone will miss those sampled effects.

Consider a 1 kW supply on 230 V AC with no active shaping. The bridge and bulk capacitor pull narrow current peaks near the voltage crest, which raises RMS current and stresses input parts. A boost PFC stage changes that behaviour because the controller sets inductor current every switching cycle. You’re no longer depending on passive charging pulses. You’re commanding the current waveform.

That distinction matters during simulation because the current reference is not enough on its own. ADC scaling, PWM update timing, current sensor filtering, and bus ripple all shift the final waveform. A model that reproduces those pieces will show you how digital control improves power factor and where it can also hurt it. That is the practical answer to what active power factor correction is in a switch mode supply.

Boost PFC fits most switch mode supply front ends

The boost PFC rectifier suits most offline switch mode supplies because it keeps input current continuous and holds the DC bus above the line peak. That makes control simpler than many other power factor correction methods. It also matches common universal input requirements well. Most digital PFC work starts here for good reason.

A 90 to 264 V AC supply that needs a regulated 390 V to 400 V bus is a standard example. The boost stage gives you one inductor, one switch, one diode or synchronous path, and a clear control structure with an inner current loop and outer voltage loop. Other power factor correction techniques exist, including passive filters and bridgeless variants, but they add tradeoffs in size, conduction path, or control effort.

The common harmonic standard for many front ends covers equipment with input current up to 16 A per phase, which places a broad set of commercial supplies inside the same compliance frame. That is why boost PFC remains the default answer when you ask which power factor correction methods suit switch mode supplies. Its limitations are familiar, and its control problem is well structured enough to simulate deeply before hardware.

One simulation should include plant control firmware timing

A useful PFC simulation combines the power stage, sensing chain, PWM timing, and control code timing in one model. That is the best way to model a PFC control loop before hardware. Separate studies for the plant and the controller will hide interactions that later appear as poor power factor or unstable gain choices. One model keeps the timing honest.

A practical model includes the AC source, bridge, boost inductor, switch, output capacitor, load, current sense gain, voltage divider, ADC sample instant, control interrupt rate, and PWM duty update. A controller that looks stable in a continuous transfer function can lose phase margin once those timing blocks are inserted. That is where many paper designs drift away from hardware. The missing detail is rarely exotic. It is usually a one-cycle delay that nobody modelled.

SPS SOFTWARE fits this workflow because you can place the rectifier stage and the digital loop inside the same physics-based model and inspect what each block is doing. That matters when you’re comparing fixed-frequency CCM control against a lighter-load case where sensing noise and duty resolution start to shape the result. Gain selection becomes a modelling task, not a board rework task.

“Separate studies for the plant and the controller will hide interactions that later appear as poor power factor or unstable gain choices.”

The discrete model must capture sampling delay effects

The discrete model must capture sampling delay effects

A digital PFC loop will only simulate honestly when sampling delay, computation delay, and PWM update delay are included explicitly. Each of those delays adds phase lag. That lag cuts into current loop bandwidth and changes transient behaviour. A missing delay term is enough to make a marginal loop look healthy on screen.

Take a controller that samples inductor current near the middle of a switching period and applies the new duty command on the next cycle. That sequence inserts a delay even before quantization is considered. Add a small input filter on the current signal and you have more lag than the compensator was tuned for. The result is familiar: current distortion near zero crossings, overshoot at load steps, or audible stress in magnetic parts.

You should also represent zero-order hold behaviour and sensor scaling limits. That gives you the same information the firmware will actually see, rather than an idealized waveform that no ADC could ever read. Once those pieces are present, the best way to tune a digital PFC control loop becomes much clearer. You tune around a discrete system with delay, not an imaginary analogue one.

Current loop tuning sets stability over the switching range

The inner current loop determines how well the input current follows its reference across line voltage and load changes. Stable tuning requires bandwidth that is fast enough to shape current but slow enough to tolerate digital delay and switching ripple. Good tuning is measured across the operating range, not at one nominal point. That is where many digital loops quietly fall short.

A common starting point is to set crossover well below the sampling frequency and then verify it at low line, high line, light load, and full load. A loop tuned only at 230 V AC and rated load can look clean there and still ring badly at 90 V AC. The boost plant gain changes with operating point, and so does the effect of duty saturation. Current command headroom also shrinks when the line is low and power is high.

You’ll get a better result when you sweep operating conditions before touching hardware. Watch phase margin, current tracking error, and zero-crossing behaviour on the same plots. A loop that survives those cases will usually behave well on the bench. A loop that only looks good at one operating point is not tuned yet.

Voltage loop tuning must reject line ripple distortion

The outer voltage loop sets DC bus regulation and must stay slow enough to avoid passing twice-line ripple into the current reference. If it reacts too strongly to that ripple, the current loop will distort the mains current. Good voltage loop tuning protects power factor by staying calm. Stable bus control matters less than clean current if the loop bandwidth is chosen badly.

Picture a 400 V DC bus fed from 50 Hz mains. The bus ripple appears at 100 Hz after rectification, and the outer loop will chase that ripple if its crossover is set too high. That chase shows up as a modulated current reference, which then bends the input current waveform. Bus regulation can still look neat on a slow plot while power quality gets worse. You need both views open at once.

What to check in the model What the result tells you
Bus voltage ripple at twice line frequency stays visible in the simulation The outer loop is seeing the same disturbance that hardware will see, so bandwidth choices are based on the right signal.
Current reference remains smooth when the bus ripple grows The voltage loop is slow enough to protect input current shape instead of chasing ripple.
Current tracking remains clean at low line and full load The inner loop has enough margin where plant stress is highest.
Duty command stays away from clipping during load steps The controller still has authority when the supply is disturbed.
Input current stays sinusoidal while bus regulation settles The two loops are cooperating instead of fighting each other.

That checkpoint view is more useful than a single bode plot. You’re looking for interaction, not isolated gains. Outer loop tuning only counts as good when it protects current quality while holding the bus inside its target range.

Power factor alone can hide control loop problems

Power factor is important, but it is not a complete measure of loop quality. A supply can post a strong power factor number and still show poor current shape, weak transient behaviour, or repeated saturation near line zero crossings. You need a broader set of checks. Good active power factor correction is visible in waveforms, not only in one reported value.

A supply running near rated load often shows a high power factor simply because average current follows the mains reasonably well. That same unit can still have noticeable high-frequency ripple on the inductor current, slow recovery after a load step, or voltage loop spillover that bends the line current around each crest. Those issues won’t disappear in hardware. They’ll show up as compliance margin loss, thermal stress, or awkward tuning late in the schedule.

Useful checks include current THD, bus voltage ripple, current loop overshoot, duty clipping, and behaviour at line zero crossing. Each one points to a different weakness. Power factor tells you the control goal was approached. The other plots tell you how cleanly it was achieved and how much margin you actually have.

Before hardware build test quantization saturation startup limits

Before hardware is built, you should test the digital limits that paper tuning leaves out. Quantization, duty saturation, soft-start behaviour, sensor offsets, and load transients all change controller behaviour in ways a neat continuous model will miss. Those checks turn a plausible loop into a buildable one. They also reduce lab surprises that waste weeks.

A short pre-hardware test set will catch most of the expensive mistakes:

  • Use realistic ADC and PWM resolution so low-current distortion becomes visible.
  • Clip the duty command and confirm recovery stays stable after saturation.
  • Start with an empty bus capacitor and watch soft-start current and bus overshoot.
  • Inject sensor offset and gain error to see how current shaping shifts.
  • Step the load at low line and high line to expose weak loop margin.

That discipline is where digital PFC control stops being a sketch and becomes an engineering result. You’re not trying to prove a controller can work. You’re trying to prove it will keep working once timings, limits, and non-ideal signals are present. SPS SOFTWARE fits that closing step well because the converter and the control loop can be judged inside one transparent model, where the gain choices and sampling effects are visible before a board is fabricated.

“Power factor tells you the control goal was approached. The other plots tell you how cleanly it was achieved and how much margin you actually have.”

Cart Overview