Control Loop Compensation Calculator: Type II, Type III and TL431
Introduction
A regulated switching converter is a feedback system, and like any feedback it can oscillate. The compensator — a handful of resistors and capacitors around the error amplifier — decides how fast the output voltage returns to its value after a load step and whether it gets there without ringing. It is designed by looking at the loop gain: at what frequency it crosses 0 dB, and how much phase is left there before the 180° that make it oscillate.
The tool covers buck, boost and inverting buck-boost, in voltage mode and peak current mode, with three compensators: type II and type III with an op-amp, and the TL431 with an optocoupler used in isolated converters. From the power-stage data it computes the transfer function, places zeros and poles with the K-factor method, derives the components and rounds them to standard values. Then it does what you would do on the bench: it simulates the converter switching cycle by switching cycle with the real compensator, measures the loop gain by injecting a signal and applies a load step.
The converter data can be taken from the switching converter calculator, and the inductor from the inductor design calculator. SEPIC, flyback and discontinuous conduction are left out: they have different models.
| What | Formula |
|---|---|
| Voltage-mode buck | \( G_{vd}(s) = V_{in}\,\dfrac{1 + s R_c C}{1 + s\left(\frac{L}{R} + R_c C\right) + s^2 L C} \) |
| Right-half-plane zero | \( f_{RHP} = \dfrac{R\,D^{\prime 2}}{2\pi L}\ \text{(boost)} \qquad f_{RHP} = \dfrac{R\,D^{\prime 2}}{2\pi D L}\ \text{(buck-boost)} \) |
| Peak current mode | \( F_m = \dfrac{1}{(S_n + S_e)\,T_s} \qquad m_c = 1 + \dfrac{S_e}{S_n} \qquad Q_p = \dfrac{1}{\pi\,(m_c D^{\prime} – 0.5)} \) |
| Phase boost at fc | \( \varphi = PM – 90^\circ – \angle G(f_c) \qquad K_{II} = \tan\!\left(\tfrac{\varphi}{2} + 45^\circ\right) \qquad K_{III} = \tan^2\!\left(\tfrac{\varphi}{4} + 45^\circ\right) \) |
Card 1 — Converter
The power stage is the two-state averaged model, inductor current and capacitor voltage, with the resistive losses where they matter for the dynamics: the inductor DCR, to which you should add the switch RDS(on), and the capacitor ESR, which adds a zero and gives phase. The load is a resistance: a constant-current load would damp the resonance less.
In the boost and buck-boost the right-half-plane zero appears: when the duty cycle rises to deliver more current, at first less of it reaches the output, because the inductor is connected to the output for a shorter part of the period. It is a delay no compensator can cancel, and it caps the bandwidth.
Card 2 — Modulator and power stage
In voltage mode the compensator drives the duty cycle through a sawtooth ramp: the modulator gain is 1/VM, and what it sees is the LC double pole of the stage, with the phase dropping by 180° at resonance. Putting it back up almost always takes a type III.
In peak current mode there is an inner loop: every cycle the switch turns off when the current reaches the value the compensator asks for. The inductor becomes a current source, the LC double pole splits into a single low-frequency pole and a double pole at half the switching frequency, and a type II is enough. Above D = 50 % the inner loop oscillates at fs/2 unless a compensation ramp is added, and the damping Qp of that double pole tells you how far away you are.
How the model is built
The power stage is linearised numerically around the operating point, with DCR and ESR: for the voltage-mode buck it gives the formula in the table above, for boost and buck-boost the right-half-plane zero comes out by itself. For current mode the tool uses Ridley’s model (1991), with the modulator gain Fm and the sampling term that produces the double pole at fs/2; the last coefficient of the model, the feedback from the output voltage, is chosen so that the DC gain matches the exact averaged relation between peak and average current. For the buck the result matches Ridley’s closed-form expressions within a few thousandths.
The modulator is naturally sampled, like a real comparator: it compares the control voltage with the ramp, or with the current, instant by instant. Under these conditions the averaged model has no delay to add, and the switching simulation of card 4 confirms it in both modes and all three topologies. When instead the compensator has a lot of gain at the switching frequency — a type III with its poles beyond fs/2 — the ripple on the control voltage changes the modulator gain, and card 4 shows the deviation.
Card 3 — Compensator
| Part | Position | Computed | Standard |
|---|
You choose where the loop should cross 0 dB and how much phase should be left. The suggested fc is the highest one, no more than a tenth of the switching frequency and, in the boost and buck-boost, a fifth of the right-half-plane zero, at which the chosen compensator can supply the phase needed while keeping its poles below fs/2 — and, for the TL431, below the optocoupler pole; 60° of margin give a step response with almost no ringing, 45° is the sensible minimum.
The K-factor method (Venable, 1983) starts from the stage phase at fc, computes how much phase the compensator must add and places zero and pole symmetrically around fc, at fc/K and fc·K; the gain is set so that the loop is exactly 1 at fc. Type II adds at most 90°, type III, with two zeros and two poles, up to 180°.
The three compensators
Type II, with an inverting op-amp: R1 from the output to the inverting input, R2 in series with C1 and C2 across both, between op-amp input and output. The divider Rb sets the voltage but does not enter the loop, because it sits on a virtual ground.
\( H_{II}(s) = \dfrac{1 + s R_2 C_1}{s R_1 (C_1 + C_2)\left(1 + s R_2 \frac{C_1 C_2}{C_1 + C_2}\right)} \qquad H_{III}(s) = H_{II}(s)\,\dfrac{1 + s (R_1 + R_3) C_3}{1 + s R_3 C_3} \)
Type III adds R3 in series with C3, across R1: a second zero and a second pole. The TL431 with optocoupler and fast lane, with RLED tied straight to Vout, is a type II whose mid-band gain is set by CTR·Rpu/RLED and whose pole cannot be moved above the optocoupler’s:
\( H_{TL431}(s) = \dfrac{CTR\,R_{pu}}{R_{LED}}\cdot\dfrac{1 + s R_1 C_z}{s R_1 C_z}\cdot\dfrac{1}{1 + s R_{pu}(C_{pu} + C_{opto})} \)
For the TL431 the tool uses Vref = 2.495 V and a minimum cathode-anode voltage of 2.5 V, from the Texas Instruments datasheet, with 1 V across the LED and 0.3 V phototransistor saturation: that gives the maximum RLED. The optocoupler pole must be measured or read from the datasheet with the same Rpu, because it moves with it.
Card 4 — Switching check
| Frequency | |T| model | |T| simulated | Model phase | Simulated phase |
|---|
Here the converter is no longer an averaged model: it is simulated cycle by cycle, with the switch turning on at the start of the period and off when the ramp — or the inductor current — reaches the compensator voltage, and with the compensator computed above, at standard values. The tool injects a small sine wave between output and compensator, at fc/3, fc and 3·fc, and measures the loop gain as a network analyser would: the table compares it with the model. The box looks at the fc row, the one that sets the margin; where |T| is large, below fc, the measurement is as delicate as on the bench: the returning signal is small compared with the ripple, and its amplitude matters.
Then it applies a load step and watches the output voltage, averaged cycle by cycle to remove the ripple. The classic estimate ΔI/(2π·fc·C) gives the order of magnitude of the undershoot; with a low phase margin the voltage bounces above the final value before settling.
Ideal switches and synchronous rectifier: conduction stays continuous during the step too. The error amplifier is ideal, with no bandwidth or swing limit, and the TL431 compensator does not include the pole of the TL431 itself.