PowerElecHub

Integrator Windup in a Digital PI Loop: Clamp, Conditional Integration and Back-Calculation Compared

By the Power Electronics Hub editor · Published 2026-11-17

A PFC stage starts with its 1 mF bus capacitor precharged to 325 V through the rectifier and has to bring it to 400 V while a downstream converter already draws 5 A. The voltage loop commands the current into the bus, and that command is limited to 6 A, so only 1 A is left to charge the capacitor. With a plain PI controller the command sits at the limit for 103 ms, the integrator keeps accumulating error the whole time, and the bus peaks at 430.8 V before it creeps back. Clamping the accumulator to the output range, which is what the code from the PID generator on this site does by default, cuts the peak to 5.9 V. Conditional integration and back-calculation with a short tracking time remove it completely, but they do not all reach 400 V equally fast.

The loop in this example

To keep the numbers easy to follow, the model is the simplest one that still shows windup. The inner current loop is treated as ideal, so the voltage controller's output is the average current pushed into the bus. The 100 Hz ripple of a real PFC is left out. The capacitor then integrates the difference between that current and the load current, and the plant is a pure integrator, 1/(C·s).

The PI gains come from a crossover of 20 Hz, which is a typical order of magnitude for a PFC voltage loop that has to stay well below the 100 Hz ripple. Kp is chosen so that the loop gain is one at crossover, and the PI zero is placed a factor of four lower, at 5 Hz. That gives 76° of phase margin in continuous time. The controller runs every 100 µs.

Plant
C·dv/dt = i_cmd − I_load, C = 1 mF, I_load = 5 A
Controller
u = Kp·e + Ki·I, e = V_ref − v, i_cmd = min(max(u, 0), I_max), I_max = 6 A
Gains
Kp = C·ωc = 0.1257 A/V, Ki = Kp·ωc/4 = 3.948 A/(V·s), Ti = Kp/Ki = 31.8 ms
Fastest possible charge
t_min = C·ΔV/(I_max − I_load) = 1 mF · 75 V / 1 A = 75 ms

The last line is the benchmark. No controller can bring the bus from 325 V to 400 V in less than 75 ms with 1 A of headroom, so the question is how close each version gets to that, and how far past 400 V it goes.

No anti-windup: 31 V of overshoot

At the start the error is 75 V, so the proportional term alone asks for 9.4 A. The command saturates at 6 A and stays there. The bus rises at exactly 1 V/ms and reaches 400 V after 75 ms, which is the best possible. The problem is what the integrator has done in the meantime: it has been summing an error that started at 75 V and fell linearly to zero, and Ki·I has grown to well above the 5 A the load needs.

At 400 V the error is zero, but Ki·I is still above 6 A, so the command stays at the limit and the bus keeps climbing. Only a negative error can bring the integrator back down, and that means voltage above the reference. The command leaves saturation at 103 ms, with Ki·I still at 9.5 A. The bus peaks at 430.8 V at 109 ms and then settles back slowly, from above, at a rate set by the PI zero. It is within ±0.75 V (1 % of the step) only after 198 ms.

Thirty volts on a 400 V bus is not a cosmetic problem. If the bulk capacitors are rated 450 V, the margin left is under 20 V, and an overvoltage comparator set close to 430 V would trip on a normal start-up.

Clamping the accumulator

The simplest fix is to limit the integral state itself. The code produced by the PID code generator on this site clamps the accumulator to ±windup_limit, and the default limit is output limit / Ki, so that Ki·I alone can never exceed the 6 A output range. With that clamp the integrator still charges during saturation, but it stops at 6 A instead of running on to 9.5 A.

The overshoot falls to 5.86 V (peak at 91 ms) and the bus settles in 148 ms. It does not go to zero because the clamp sits at 6 A while the load needs only 5 A. At 400 V the controller still commands 6 A, and the extra 1 A has to be cancelled by the proportional term, which takes a negative error of 1 A / Kp ≈ 8 V. The integrator unwinds while the bus is on its way there, so the real peak stays below that.

That suggests tightening the clamp to the largest steady-state output you expect. With the limit at 5.5 A the overshoot halves to 2.93 V, and with the limit at exactly the 5 A load it disappears and the bus settles in 86 ms. The catch is that the clamp also caps what the integrator can deliver in steady state. With the clamp at 5 A and a 5.5 A load, the missing 0.5 A has to come from the proportional term, and the bus sits 4.0 V low indefinitely. A clamp is a good choice when the steady-state output range is narrow and known; it is a poor one when the load can move across most of the actuator range.

Conditional integration

Conditional integration stops the integrator while the output is saturated and the error would push it further into saturation. In this loop the integrator does not integrate at all during the first part of the start-up: the proportional term alone keeps the command at 6 A until the error has fallen below 6 A / Kp = 47.7 V, which happens at 27 ms. From then on the controller is in its linear range and integrates normally, starting from zero.

The result is no overshoot at all, and the bus is within 1 % after 123 ms. But look at how it gets there. Once the command leaves the limit at 27 ms, the converter no longer delivers the full 6 A, because the integrator, starting from zero, has to build up the 5 A the load needs, and in the meantime the proportional term is doing the work with a shrinking error. At 75 ms, when the unlimited controller was already at 400 V, this one is at 391.3 V. It trades charge time for zero overshoot.

The word clamping is used for two different things. Åström and Hägglund use "integrator clamping" as another name for conditional integration, switching integration off during saturation. Many code libraries, including the generator on this site, use clamping for a limit on the integral state. They behave differently, as the numbers above show, so check which one a library means.

Back-calculation

Back-calculation keeps integrating, but feeds the difference between the saturated and the unsaturated output back into the integrator through a gain 1/Tt. While the output is limited, the integral state is pulled toward the value that would put the controller exactly at the limit, and Tt sets how fast. When the output is not saturated, the extra term is zero and the controller is an ordinary PI.

Back-calculation
I[k+1] = I[k] + Ts·( e[k] + (i_cmd[k] − u[k]) / (Ki·Tt) )
Rule of thumb (PID)
Td < Tt < Ti, for example Tt = √(Ti·Td)

The rule of thumb is written for a PID. For a PI there is no Td, so it gives an upper bound and nothing else. In this example the overshoot depends strongly on where Tt sits below Ti:

  • Tt = Ti = 31.8 ms: 2.36 V overshoot, settled in 131 ms.
  • Tt = 20 ms: 0.02 V, settled in 95 ms, the fastest of all the versions here.
  • Tt = 10 ms: no overshoot, settled in 118 ms.
  • Tt = 3 ms: no overshoot, settled in 122 ms. With a very short Tt the integrator is held almost exactly at the limit, so after saturation it behaves much like conditional integration.
  • Tt = 100 ms, three times Ti: 15.5 V. A long tracking time is barely better than no anti-windup.

So back-calculation has one more parameter to set, and that parameter decides whether it beats the simpler methods. Here a value between a third and two thirds of Ti gave the best result, but that is a finding for this loop, not a general rule.

Try it

MethodOvershootSettled (±1 %)
No anti-windup30.78 V198 ms
Accumulator clamp5.86 V148 ms
Conditional integration0.00 V123 ms
Back-calculation0.00 V118 ms

Fastest possible charge: 75.0 ms. Start 325 V, reference 400 V, sampled every 100 µs. Kp = C·ωc, PI zero at fc/4.

The chart runs the same discrete model for all four controllers. Raise the current limit and the windup shrinks: with I_max = 7 A the charge takes only 37.5 ms and even the unprotected PI overshoots by just 3.6 V, because there is less time to accumulate error. Lower it toward the load current and the unprotected loop gets much worse: at 5.5 A it overshoots by 51.6 V. Anti-windup matters most exactly when the converter has the least margin.

A slower soft-start is not a substitute

A ramped reference is the other common way to keep a start-up under control, and it is worth having, but it does not remove the need for anti-windup. With a 100 ms ramp from 325 V to 400 V, the unprotected loop still hits the current limit for 117 ms in total and overshoots by 24.5 V: the loop needs some error to follow a ramp, and the integrator winds up while it is saturated. The ramp has to be stretched to about 200 ms, nearly three times the 75 ms minimum, before saturation becomes short enough that the overshoot drops to 2.2 V. That remaining 2.2 V is the same for every version, because it comes from how this loop tracks a ramp, not from windup.

Details that matter in the code

  • Compute the unlimited output first, then saturate, then update the integrator. The anti-windup decision needs both u and the limited value from the same sample.
  • Store the integrator as Ki·I, in output units. A limit in amps or in duty cycle is then easy to read and to check against the actuator range, and changing Ki at run time does not make the output jump.
  • If the command is also limited somewhere else, for example by a slower current limit in another task or by the PWM module, the controller has to see that limited value. Anti-windup that only knows its own clamp still winds up against a limit it cannot see.
  • Test the start-up and the largest load step with the real limits in place. A loop that is tuned only for small signals behaves exactly like the unprotected one above as soon as it saturates.

The model here is deliberately simple. A real PFC voltage loop also has a ripple filter or a notch, a slower sample rate in some designs, and an inner current loop with its own limit. Those change the numbers, so treat them as an illustration of the mechanism, not as a prediction for a particular converter.

Sources

  • K. J. Åström, T. Hägglund, Advanced PID Control, ISA, 2006, section 3.5 "Integrator Windup" (back-calculation and the tracking time constant Tt, the rule Td < Tt < Ti with Tt = √(Ti·Td), and conditional integration, also called integrator clamping).
  • The numbers in this guide come from a discrete simulation of the model above (100 µs step), checked against a continuous-time solution of the same equations: 30.7 V without anti-windup and 2.34 V with back-calculation at Tt = Ti.

This guide explains general engineering principles. Always verify your design with datasheets, simulation and measurement.

Calculators for this topic

More guides