Type II / Type III Compensator (compensator)
The error-amplifier compensator of a switch-mode power supply: an integrator with one or two zero-pole pairs, output limits and anti-windup.
Group: Control · Kind: {"block":"compensator","kind":"control"}
When to use it
Use it for the voltage loop of a converter designed in the frequency domain, with the zero and pole frequencies from a K-factor or crossover design. Type II suits a current-mode plant; Type III a voltage-mode buck with its LC double pole. Use pi or pid for gains given in the time domain, and ztf or dpi for a sampled controller.
Pins
| Pin | Domain | Meaning |
|---|---|---|
fb |
signal | Feedback input (the divided output voltage). |
ref |
signal | Reference input; the block acts on the error ref - fb. |
out |
signal | Compensator output (the duty or the current command), limited to vl ... vh. |
Common parameters
type: Compensator type:2(Type II: one zero, one pole) or3(Type III: a second zero and pole) (Default: 2)g: Gain g of H(s) = g·(ωz1/s)·(1 + s/ωz1)/(1 + s/ωp1), on the error ref − fb (Default: 1)fz1: First zero: ωz1 = 2π·fz1, also the integrator's unity-gain frequency (Default: required)fp1: First pole frequency (Default: required)
Parameters
| Key | Unit | Default | Typical range | Description |
|---|---|---|---|---|
type |
— | 2 | Compensator type: 2 (Type II: one zero, one pole) or 3 (Type III: a second zero and pole) |
|
g |
— | 1 | Gain g of H(s) = g·(ωz1/s)·(1 + s/ωz1)/(1 + s/ωp1), on the error ref − fb | |
fz1 |
Hz | required | First zero: ωz1 = 2π·fz1, also the integrator's unity-gain frequency | |
fp1 |
Hz | required | First pole frequency | |
fz2 |
Hz | optional (off) | Second zero frequency (Type III; needed there) | |
fp2 |
Hz | optional (off) | Second pole frequency (Type III; needed there) | |
avol |
— | optional (off) | DC gain of the integrator, as an op-amp's open-loop gain: ωz1/s becomes ωz1/(s + ωz1/avol); unset = ideal | |
vl |
— | -1e30 | Lower output limit | |
vh |
— | 1e30 | Upper output limit |
Parameter descriptions are in English in both languages.
Model
With e = ref - fb and w = 2pif, the Type II transfer function is H(s) = g*(wz1/s)*(1 + s/wz1)/(1 + s/wp1); Type III multiplies it by (1 + s/wz2)/(1 + s/wp2). A finite avol turns wz1/s into wz1/(s + wz1/avol), a pole at wz1/avol with DC gain avol. The integrator is clamped so that g times it stays in vl ... vh (the lead-lag sections have unit DC gain), so the output leaves a limit as soon as the error reverses, and the output is limited to vl ... vh. The block is strictly proper (no direct feedthrough), so a loop closes through it, and an AC sweep uses H(jw).
Common mistakes
- The frequencies are in Hz, not rad/s. Entering a crossover design's angular frequencies as
fz1andfp1puts every zero and pole 2*pi times too high. gis the gain at the frequencyfz1of the integrator alone, not the mid-band gain. For a Type II with fz1 well below fp1 the mid-band gain is about g; for a Type III the gain keeps rising between fz2 and fp1, so the loop gain at crossover may be much higher than g.- A duty output needs
vl= 0 andvhbelow 1; with the default (no) limits the integrator winds up during start-up and the output overshoots.
Datasheet and sources
For an op-amp error amplifier, avol is the open-loop gain from its datasheet (for example 10^4 to 10^5). The zero and pole frequencies follow from the feedback network (fz1 = 1/(2piR2C1), fp1 = 1/(2piR2C2) for a Type II) or from the K-factor method.
Example
Open the example with the command file.openExample and the name demo:compensator.
Generated by cargo xtask reference from the usage texts and parameter specs. Do not edit by hand.