S921 of 55
0 XP
  1. Hook
  2. Play
  3. Predict
  4. Name it
  5. Check
  6. Explain

S9 · Lesson 21 · Resonant and repetitive control

The internal model principle: zero steady-state error for sinusoids and periodic disturbances

Lesson 10 showed that an integrator in the loop drives a constant error to zero: the controller contains a model of a constant, a pole at s=0. A grid-tied inverter must track a 50 or 60 Hz sinusoid exactly, a disk drive must follow a track that wobbles once per revolution, and a power supply must reject ripple at the line frequency and its harmonics. An integrator can't do those perfectly, but the same idea extends: put a model of the sinusoid, a pair of poles at ±jω0, inside the controller, and the loop has infinite gain at exactly that frequency. A delay line in positive feedback does it for every harmonic at once. That's the internal model principle, and it's why proportional-resonant and repetitive controllers are standard in power electronics.

  • The magnitude of a proportional-resonant controller, C(s)=Kp+Krss2+ω02 with f0 = 50 Hz, in dB against frequency. It's flat at Kp except for a sharp peak, infinite in the ideal form, at 50 Hz.
  • A practical version adds damping, Kr2ωcss2+2ωcs+ω02, to widen the peak and tolerate grid-frequency drift; the dashed curve shows it with ωc chosen by the slider.

Predict

A PI current controller in a grid inverter has a gain of 20 dB at 50 Hz in its loop. How large is the steady-state error tracking the 50 Hz reference, roughly?

Name it

The internal model principle

To reject or track a signal with zero steady-state error, the loop must contain a model of that signal's generator. A constant comes from 1/s, so the loop needs an integrator. A sinusoid at ω0 comes from ss2+ω02, so the loop needs poles at ±jω0: infinite gain there, so |1/(1+L)| = 0 at exactly ω0.

Proportional-resonant control

C(s)=Kp+Krss2+ω02

In a rotating (dq) frame a sinusoid becomes a constant and an ordinary PI controller does the job; the PR controller is its equivalent in the stationary frame. Because an ideal resonance is infinitely narrow, a small frequency drift loses most of the benefit, so practical PR controllers use a damped form with bandwidth ωc, and add resonant terms at selected harmonics (3rd, 5th, 7th).

Repetitive control

A periodic disturbance of period T contains every harmonic of 1/T. Its generator is a delay line in positive feedback: in discrete time with N=T/Ts samples per period,

11−z−N

which has poles at all N roots of unity: every harmonic kfs/N up to the Nyquist frequency. Placed in the loop (with a low-pass filter Q(z) in the feedback for robustness, and phase-lead compensation), it learns the periodic error from cycle to cycle and cancels it. It needs N samples of memory and converges over several periods.

Stability

Infinite gain at a frequency is safe only if the loop's phase there allows it. The resonant gain Kr is limited by phase margin near ω0, and a repetitive controller's Q filter limits how high the learned harmonics go, trading perfect rejection for robustness against unmodeled high-frequency dynamics.

Worked example

A loop has a gain of 10 at 50 Hz with a phase of −120°. What fraction of a 50 Hz reference appears as error, and what would a resonant term do?

Show the solution
  1. Loop gain as a complex number. L=10e−j120°=−5−8.66j
  2. Return difference. 1+L=−4−8.66j with magnitude 9.54.
  3. Error. 1/9.54=10.5% of the reference, in magnitude.
  4. Add a resonant term. Adding Krs/(s2+ω02) makes |L| infinite at exactly 50 Hz, so the error there is zero.
  5. If the grid drifts. At 49.5 Hz the error is merely small, which is why damped resonances are used.

Answer 10.5% of the reference appears as error, and a resonant term at 50 Hz makes it zero there.

Worked example

A repetitive controller rejects a 50 Hz periodic disturbance in a converter sampled at 10 kHz. How many samples of memory does it need, and how many harmonics can it address?

Show the solution
  1. Memory. One location for each sample in a period: N=10000/50=200
  2. Harmonics. The poles of 1/(1−z−200) sit at every multiple of 50 Hz, so it addresses up to N/2=100 harmonics, up to the 5 kHz Nyquist frequency.
  3. In practice. The Q filter limits it to a few kilohertz.

Answer 200 samples of memory, addressing up to 100 harmonics (in practice the Q filter limits it to a few kilohertz).

Worked example

A grid's frequency drifts to 50.5 Hz. A damped PR controller with Kr = 100 and bandwidth ωc = 5 rad/s is tuned to 50 Hz. How much gain does its resonant term give at 50.5 Hz, compared with its peak?

Show the solution
  1. The damped term. It peaks at Kr = 100 at ω0: 2ωcKrss2+2ωcs+ω02
  2. The two frequencies. ω=2π×50.5=317.3rad/sω0=314.2rad/s
  3. The denominator at ω. Its real and imaginary parts: ω02−ω2=−19842ωcω=3173
  4. Magnitude. gain=100×317319842+31732=85 That's still 39 dB, against 40 dB at the peak.
  5. Compare an undamped resonance. It would give only about Krω|ω02−ω2|=16 so the damping keeps the gain high across the drift.

Answer 85 (39 dB) at 50.5 Hz, against 100 (40 dB) at the peak; an undamped term would give only about 16.

Check

At the reference frequency, a loop has gain 10 and phase −90°. What percentage of the reference appears as tracking error?

Check

A repetitive controller sampled at 10 kHz rejects a disturbance with a 50 Hz period. How many samples of memory does its delay line need?

Check

A repetitive controller's delay line holds N = 200 samples. Up to how many harmonics of the fundamental do its poles cover, to the Nyquist frequency?

Check

A damped PR controller with Kr = 100 and ωc = 2 rad/s is tuned to 50 Hz. What is its resonant term's gain at 1 Hz above 50 Hz?

Check

Why can a PI controller in a synchronous (dq) reference frame track a 50 Hz current with zero error, while the same PI in the stationary frame can't?

Check

Simulate repetitive control. A plant y[n]=u[n]+d[n] (a direct feedthrough for simplicity) suffers a periodic disturbance d[n]=sin⁡(2πn/N)+asin⁡(6πn/N) with period N = 20. The controller learns with u[n]=u[n−N]−ge[n−N], where e=y (the reference is zero) and g = 0.9, starting from u=0 for the first N samples. Run 40 periods and set rms_first and rms_last, the RMS error over the first and last periods.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Explain why

A grid-tied inverter with a PI current controller in the stationary frame shows a few percent of current error at 50 Hz and visible 5th and 7th harmonic distortion. Explain why, and what to change, using the internal model principle.

Practice

Keep practicing

7 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.