Algorithmresearch
Active disturbance rejection control
Also called ADRC, extended state observer.
Lumps unknown dynamics and disturbances into one extra state, estimates it with an observer of the extended state and cancels it in the control law.
- Time
- O(n) worst
- Space
- O(n) extra
- Where
- n = the order of the plant
- Model
- Real RAM
- Properties
- deterministicexactonlineiterative
- Evidence
- Proof sketchCode in 1 languages
- Origin
- Jingqing Han, Zhiqiang Gao, Bao Zhu Guo, Zhi Liang Zhao, 1998
Active disturbance rejection control (ADRC) treats everything in a plant that the designer does not want to model as one signal, the total disturbance, and adds it to the state as an extra component. An observer of this extended state, which is a high-gain observer with one more integrator, estimates the total disturbance from the output. The control law subtracts the estimate and then applies a simple law, such as PD, to what is left: a chain of integrators. The only model data it needs are the order of the plant and a rough value of the input gain. Its linear form has two tuning parameters, the bandwidths of the observer and of the controller.
In plain words
Suppose you push a cart and do not know its friction, its springs, or the wind. Lump all of these into one unknown force. You know how hard you push and you see where the cart goes, so you can work out the unknown force from the difference between how the cart actually moves and how it would move if you were the only one pushing. Once you know the force, push against it, so it cancels. What is left is a cart with no friction, no spring and no wind, which is easy to control. The faster you work out the force, the better the cancellation, but the more the noise on your measurement shakes your push.
The problem
Input. A plant of order two (the method extends to order )
where is measured, is unknown, and the input gain is known only as an estimate of the same sign. A reference , a controller bandwidth and an observer bandwidth . A common rule of thumb takes several times , so that the observer is faster than the loop.
Output. A control such that follows the response of the PD loop , with an error that shrinks as grows, and with no steady error for a constant disturbance.
The trick is to write the plant as , with the total disturbance . The extended state is , with unknown.
The algorithm
ADRC-CONTROL(z, r, ω_c, b_0)- 1
u_0 ← ω_c² (r - z_1) - 2 ω_c z_2 - 2
return (u_0 - z_3) / b_0 ADRC-OBSERVER(z, y, u, ω_o, b_0)- 3
e ← y - z_1 - 4
ż_1 ← z_2 + 3 ω_o e - 5
ż_2 ← z_3 + 3 ω_o² e + b_0 u - 6
ż_3 ← ω_o³ e - 7
return ż
Lines L1 and L2 cancel the estimate of and apply PD with both poles at . Lines L3 to L6 are the observer of the extended state, with the gains that put all three of its poles at . In a sampled implementation, the control is computed at each sample and held, and the observer is integrated over the sample period, or replaced by a discrete observer obtained by zero-order hold discretization.
Example
The plant is with a step disturbance for . The controller knows none of this, except (the true is ). The reference is , (so ), and , all states start at . The simulation uses 4th order Runge-Kutta with step , with the control computed once per step and held.
| 0.5 | 0.26861 | -0.04604 |
| 1 | 0.55035 | -0.55420 |
| 2 | 0.87203 | -0.76846 |
| 3 | 0.97251 | -0.76831 |
| 5 | 0.99981 | -0.75163 |
| 5.5 | 1.04458 | -0.14171 |
| 6 | 1.04424 | -0.07094 |
| 8 | 1.00524 | 0.00093 |
| 10 | 1.00016 | 0.00027 |
At rest at the plant needs , so the total disturbance is : before the step and after it. The estimate follows these values. After the step, moves away from by at most and returns, with no steady error. The first control is .
The ideal response is that of the PD loop, . The largest deviation from it on is for , for and for (measurement): it falls roughly like .
Correctness
The full proof is in proofs/correctness.md. Its main steps:
- Lemma (observer error). The error obeys , , , for any control. The tests check it exactly.
- Theorem (size of the error). If along the motion, then after a transient, , , . This is the bound of the high-gain observer with .
- Theorem (perturbed PD loop). obeys exactly, so the deviation from the PD loop is at most after the transient.
- Theorem (separation). With and , the closed loop has the poles (twice) and (three times). The tests check this exactly for random values.
- Theorem (exact rejection). For a linear plant with a constant disturbance, if the closed loop is Hurwitz, then , because acts as an integrator. For the example, the Routh-Hurwitz criterion confirms that the loop is Hurwitz, exactly.
The bound is not free when , since contains . For linear plants it follows from the Hurwitz test; for nonlinear plants, Guo and Zhao (2011) prove convergence under bounds on , its derivatives and .
Proof: The observer of linear ADRC estimates the total disturbance with an error of order 1 over its bandwidth, and the loop rejects constant disturbances exactlyfull
The plant is with unknown and known only as . Write it as
where is the total disturbance. Lines L1 to L7 compute
with and a constant reference . Let and . Here is the Euclidean norm.
Lemma 1: the observer error equation
If is absolutely continuous in along the motion, then for almost every
Proof. , , . Subtract the observer, using : , , .
The input cancels, so the error equation does not depend on the control law. The tests check Lemma 1 exactly in Fraction for 200 random cases.
Theorem 1: the size of the estimation error
Let . Then with
and . Let solve , let be its smallest and largest eigenvalues, and ; these numbers depend only on . If on , then for
So after a transient of length , , and .
Proof. From Lemma 1, , , . is the companion matrix of , so it is Hurwitz. With this is the scaled error equation of a high-gain observer of order with , and Theorem 1 of that page's proof gives the bound.
The bound needs along the motion. contains , and contains , so for the bound is not given in advance; it must come from an analysis of the closed loop, such as Theorem 3 for linear plants, or the nonlinear analysis of Guo and Zhao (2011), which this page cites and does not reprove.
Theorem 2: the closed loop as a perturbed PD loop
Let . Then
Proof. , and . So . The terms cancel.
The left side has the double pole . With and small next to (they carry the extra factors and ), the deviation of from the response of the PD loop is the forced response of to the right side. Its impulse response is positive with integral , so an input bounded by gives a deviation bounded by (a theorem, by the convolution bound). So the deviation is of order . The page example measures the maximum deviation from the ideal response as , , for : each doubling of divides it by about .
Theorem 3: separation and exact rejection for linear plants
Let with constants and a constant .
(a) If and , the closed loop is linear with characteristic polynomial .
(b) In general the closed loop is linear and time invariant in , with the constant input . If its matrix is Hurwitz, then for every constant .
Proof. (a) Here and obeys Lemma 1 with , a system with the polynomial (Theorem 1 scaled back). Theorem 2 gives driven by , with the polynomial . In the coordinates the matrix is block triangular, so its characteristic polynomial is the product. The tests check this exactly in Fraction for 20 random choices of , , , with the matrix written in the original coordinates.
(b) If the matrix is Hurwitz, the state converges to the unique equilibrium. At the equilibrium, gives ; ; , and with L2, , so and . This holds for every , , and : the state acts as an integrator.
For the page example (, , , , , ) the characteristic polynomial is
and the first column of its Routh array is positive (computed exactly in the tests), so the Routh-Hurwitz criterion says the matrix is Hurwitz. By (b), before and after the step in . With the same gains, the loop is Hurwitz for and and not for : a gain error up to about is tolerated here, and the bound is not symmetric. For a plant that is not linear, convergence of the estimates and of the output is a theorem of Guo and Zhao (2011) under bounds on and its derivatives and on ; this page cites it.
Complexity
Count real operations at unit cost, as in the real RAM. For a plant of order , the observer has states, and one evaluation of the control law and the observer costs operations and space. The observer poles are at , so an explicit integrator needs a step that is small compared with ; here .
Properties
- Little model needed. Only the order and ; the rest is estimated. A wrong is absorbed into . In the example, with , the loop is Hurwitz for and and not for (theorem, by the exact Routh test); a bisection puts the limit near (measurement). The gain error it tolerates is not symmetric.
- Integral action built in. The estimate integrates the output error, so constant disturbances are rejected with zero steady error, like the I term of a PID controller.
- Two parameters. sets the speed of the response; sets how fast disturbances are estimated. The noise in grows with .
- Asymptotic, not exact, for varying disturbances. A disturbance that changes leaves an error of order in the estimate.
- Linear for linear plants. The linear form is a linear controller of order for the plant, which can be analyzed with transfer functions.
Variants and improvements
- Nonlinear ADRC. Han's original form replaces the linear gains by nonlinear functions of the error with a fractional power near zero, and adds a tracking differentiator that shapes the reference. It can give faster convergence with smaller gains but has more parameters.
- Higher order. For the observer has states with gains from , and the control is a state feedback with poles at .
- Discrete and sampled forms. A discrete observer, a prediction of one sample, or a current estimator for systems with delay.
- Models in the observer. If part of is known, add it to line L5, so the observer only estimates the rest. This makes and smaller.
- Generalized observers. More integrators in the extended state, for disturbances that are ramps or polynomials in time, or a sliding mode observer in place of the high-gain one.
When to use it
Use it for plants of known order with large uncertainty in the dynamics and slowly changing disturbances, where a model is costly and PID tuning is not good enough, such as motion control, motors and process control. Compared with a disturbance observer built around a nominal model, it needs less model. If the plant has a good model and the disturbance has a known form, use the internal model principle or model based design instead. If the measurement noise is large, the observer bandwidth must stay low, and the benefit shrinks.
Pitfalls
- Peaking at the start. If is far from the state, the observer estimates at lines L4 to L6 have a large transient and peaks. Start with , or limit , or raise gradually.
- Wrong sign of b0. Line L2 then adds the disturbance instead of cancelling it, and the loop is unstable.
- Too large a gain error. The loop tolerates only a range of ; in the example, about at most. Check it on the linearized loop.
- Actuator limits. When saturates, the cancellation at line L2 fails and keeps integrating, as in integrator windup. Feed the saturated , not the computed one, to line L5.
- Noise and sampling. The noise in grows with to a high power, and the sampling period must be small compared with .
- Not a model of F. includes and the unmodeled dynamics; it is not a measurement of the physical disturbance alone.
Implementations
Each implementation follows the pseudocode above. A comment @line links a line of code to a line of the pseudocode. Point at a line of the pseudocode to see the matching code. The build runs the native tests of each language.
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/active-disturbance-rejection-control/. The authors are listed in prov/1YHBZH.jsonl.
"""Linear active disturbance rejection control for a plant of order two
y'' = f(t, y, y') + b u,
where f (the total disturbance) is unknown and b is known only roughly, as
b0. Write the plant as y'' = F + b0 u with F = f + (b - b0) u, and estimate
z = (y, y', F) with an observer of the extended state (bandwidth wo):
z1' = z2 + 3 wo (y - z1),
z2' = z3 + 3 wo^2 (y - z1) + b0 u,
z3' = wo^3 (y - z1).
The control cancels the estimate z3 and applies a PD law (bandwidth wc):
u = (wc^2 (r - z1) - 2 wc z2 - z3) / b0.
If z3 = F exactly, the loop is y'' = wc^2 (r - y) - 2 wc y', with the double
pole -wc. With f = 0 and b = b0 the poles are -wc (twice) and -wo (three times).
control and eso_rhs keep int and Fraction inputs exact.
"""
from fractions import Fraction
__all__ = ["control", "eso_rhs", "observer_gains"]
def _div(a, b):
if b == 0:
raise ValueError("b0 must be nonzero")
if isinstance(a, int) and isinstance(b, int):
return Fraction(a, b)
return a / b
def observer_gains(wo):
"""Gains (3 wo, 3 wo^2, wo^3): all three observer poles at -wo."""
if wo <= 0:
raise ValueError("wo must be positive")
return 3 * wo, 3 * wo ** 2, wo ** 3
def control(z, r, wc, b0):
"""Control from the estimate z = (z1, z2, z3) and the reference r."""
if wc <= 0:
raise ValueError("wc must be positive")
u0 = wc ** 2 * (r - z[0]) - 2 * wc * z[1] # @line L1
return _div(u0 - z[2], b0) # @line L2
def eso_rhs(z, y, u, wo, b0):
"""Derivative of the estimate z for the measured output y and input u."""
b1, b2, b3 = observer_gains(wo)
e = y - z[0] # @line L3
d1 = z[1] + b1 * e # @line L4
d2 = z[2] + b2 * e + b0 * u # @line L5
d3 = b3 * e # @line L6
return [d1, d2, d3] # @line L7
ctlsim.py 120 lines
# SPDX-License-Identifier: MIT
# Shared helper of the control pages of https://algorithm.tamnd.com/. The authors are listed in prov/.
"""Fixed step simulation for the control pages.
Conventions:
- A continuous-time system is a function f(t, x, u) that returns x' as a
flat list. x is a flat list. u is whatever the control returns (a flat
list, a scalar, or None when there is no control).
- A discrete-time system is a function F(k, x, u) that returns x_(k+1).
- The integrator is the classical 4th order Runge-Kutta method with a fixed
step dt. The input is held constant over each step.
- Time t_k = t0 + k dt is computed by multiplication, not by summation.
- The number of steps round((t1 - t0) / dt) and the hold ratio
round(hold / dt) must match the real ratios within 1e-9 (relative), or
ValueError is raised.
This file holds no controller or observer of a control page.
"""
__all__ = ["rk4_step", "simulate", "simulate_discrete", "lti"]
def _axpy(a, x, y):
return [yi + a * xi for xi, yi in zip(x, y)]
def rk4_step(f, t, x, u, dt):
"""Return x(t + dt) after one RK4 step of x' = f(t, x, u), u held constant."""
k1 = f(t, x, u)
k2 = f(t + dt / 2, _axpy(dt / 2, k1, x), u)
k3 = f(t + dt / 2, _axpy(dt / 2, k2, x), u)
k4 = f(t + dt, _axpy(dt, k3, x), u)
return [xi + dt / 6 * (a + 2 * b + 2 * c + d) for xi, a, b, c, d in zip(x, k1, k2, k3, k4)]
def _ratio(num, den, what):
r = round(num / den)
if abs(r * den - num) > 1e-9 * max(abs(num), abs(den)):
raise ValueError(what + " is not an integer multiple of dt")
return r
def simulate(f, x0, t0, t1, dt, control=None, hold=None):
"""Simulate x' = f(t, x, u) from x(t0) = x0 to t1 with RK4 and step dt.
control(t, x) gives the input. It is called at each sampling instant
t0 + j hold, and its value is held (zero-order hold) until the next
instant. hold must be an integer multiple of dt; hold = None means
hold = dt. With control = None the input is None.
Returns (ts, xs, us): ts has N + 1 times, xs the N + 1 states, and us the
N inputs, where us[k] acts on [ts[k], ts[k + 1]].
"""
if dt <= 0:
raise ValueError("dt must be positive")
n_steps = _ratio(t1 - t0, dt, "t1 - t0")
if n_steps < 0:
raise ValueError("t1 is before t0")
r = 1 if hold is None else _ratio(hold, dt, "hold")
if r < 1:
raise ValueError("hold must be at least dt")
x = list(x0)
ts = [t0]
xs = [list(x)]
us = []
u = None
for k in range(n_steps):
t = t0 + k * dt
if control is not None and k % r == 0:
u = control(t, list(x))
x = rk4_step(f, t, x, u, dt)
ts.append(t0 + (k + 1) * dt)
xs.append(x)
us.append(u)
return ts, xs, us
def simulate_discrete(F, x0, N, control=None):
"""Run x_(k+1) = F(k, x_k, u_k) for k = 0, ..., N - 1.
u_k = control(k, x_k), or None if control is None. Returns (xs, us) with
N + 1 states and N inputs. Exact if F and control are exact.
"""
x = list(x0)
xs = [list(x)]
us = []
for k in range(N):
u = control(k, list(x)) if control is not None else None
x = list(F(k, x, u))
xs.append(x)
us.append(u)
return xs, us
def lti(A, B=None):
"""Return f(t, x, u) = A x + B u for the system x' = A x + B u.
u may be a flat list, a scalar (one input) or None (zero input). B may
be None for a system with no input.
"""
def f(t, x, u):
dx = [sum(a * xi for a, xi in zip(row, x)) for row in A]
if B is None or u is None:
return dx
uu = u if isinstance(u, (list, tuple)) else [u]
return [d + sum(b * ui for b, ui in zip(row, uu)) for d, row in zip(dx, B)]
return f
def _self_test():
import math
f = lti([[-1.0]])
_, xs, _ = simulate(f, [1.0], 0.0, 1.0, 0.01)
assert abs(xs[-1][0] - math.exp(-1.0)) < 1e-9
return True
if __name__ == "__main__":
_self_test()
test_active_disturbance_rejection_control.py 184 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/active-disturbance-rejection-control/. The authors are listed in prov/1YHBZH.jsonl.
import math
import random
from fractions import Fraction
import ctlsim
from active_disturbance_rejection_control import control, eso_rhs, observer_gains
# Simulations: classical RK4 (ctlsim) on the joint state (y, y', z1, z2, z3)
# with step DT = 0.002; the control is computed once per step from the
# estimate and held over the step (a sampled controller). Tolerances are
# stated at each check.
DT = 0.002
B, B0, WC, R = 2.0, 1.5, 2.0, 1.0
def steps(T, dt):
n = round(T / dt)
assert abs(n * dt - T) < 1e-12
return n
def dist(t):
return 1.0 if t >= 5 else 0.0
def run(wo, T):
# plant y'' = -y - 0.5 y' + d(t) + b u with b = 2; the controller uses b0 = 1.5
def f(t, x, u):
return [x[1], -x[0] - 0.5 * x[1] + dist(t) + B * u] + eso_rhs(x[2:], x[0], u, wo, B0)
def ctrl(t, x):
return control(x[2:], R, WC, B0)
ts, xs, us = ctlsim.simulate(f, [0.0] * 5, 0.0, T, DT, control=ctrl)
assert len(us) == steps(T, DT) <= 10000
return ts, xs, us
def ideal(t):
# y'' = wc^2 (1 - y) - 2 wc y', y(0) = y'(0) = 0
return 1 - (1 + WC * t) * math.exp(-WC * t)
def charpoly(A):
# Faddeev-LeVerrier in exact arithmetic: coefficients of det(sI - A), leading 1.
n = len(A)
M = [[Fraction(0)] * n for _ in range(n)]
c = [Fraction(1)]
for k in range(1, n + 1):
AM = [[sum(A[i][l] * M[l][j] for l in range(n)) for j in range(n)] for i in range(n)]
M = [[AM[i][j] + (c[-1] if i == j else 0) for j in range(n)] for i in range(n)]
AM = [[sum(A[i][l] * M[l][j] for l in range(n)) for j in range(n)] for i in range(n)]
c.append(-sum(AM[i][i] for i in range(n)) / k)
return c
def polymul(p, q):
out = [Fraction(0)] * (len(p) + len(q) - 1)
for i, a in enumerate(p):
for j, b in enumerate(q):
out[i + j] += a * b
return out
def routh_first_column(c):
# first column of the Routh array of c[0] s^n + ... + c[n]; None if a pivot is 0
c = [Fraction(v) for v in c]
rows = [c[0::2], c[1::2]]
w = len(rows[0])
rows = [r + [Fraction(0)] * (w - len(r)) for r in rows]
for _ in range(len(c) - 2):
a, b = rows[-2], rows[-1]
if b[0] == 0:
return None
rows.append([(b[0] * a[i + 1] - a[0] * b[i + 1]) / b[0] for i in range(w - 1)] + [Fraction(0)])
return [r[0] for r in rows]
def hurwitz(c):
col = routh_first_column(c)
return col is not None and all(v > 0 for v in col)
def closed_loop_matrix(wc, wo, b0, b=None, a0=0, a1=0):
# plant y'' = -a0 y - a1 y' + b u (b = b0 by default), state (y, y', z1, z2, z3), r = 0
b = b0 if b is None else b
b1, b2, b3 = observer_gains(wo)
urow = [0, 0, -wc ** 2 / b0, -2 * wc / b0, -1 / b0]
return [
[0, 1, 0, 0, 0],
[-a0, -a1] + [b * a for a in urow[2:]],
[b1, 0, -b1, 1, 0],
[b2, 0, -b2 + b0 * urow[2], b0 * urow[3], 1 + b0 * urow[4]],
[b3, 0, -b3, 0, 0],
]
def test_separated_poles_exact():
# with f = 0 and b = b0: det(sI - A) = (s + wc)^2 (s + wo)^3, exactly
A = closed_loop_matrix(Fraction(2), Fraction(10), Fraction(3, 2))
assert charpoly(A) == [1, 34, 424, 2320, 5200, 4000]
rng = random.Random(5)
for _ in range(20):
wc = Fraction(rng.randint(1, 30), rng.randint(1, 5))
wo = Fraction(rng.randint(1, 60), rng.randint(1, 5))
b0 = Fraction(rng.choice([-1, 1]) * rng.randint(1, 9), rng.randint(1, 4))
target = polymul(polymul([1, wc], [1, wc]), polymul(polymul([1, wo], [1, wo]), [1, wo]))
assert charpoly(closed_loop_matrix(wc, wo, b0)) == target
def test_page_loop_hurwitz_exact():
# page plant y'' = -y - 0.5 y' + 2 u, b0 = 3/2, wc = 2, wo = 10
cp = charpoly(closed_loop_matrix(Fraction(2), Fraction(10), Fraction(3, 2), Fraction(2), 1, Fraction(1, 2)))
assert cp == [1, Fraction(69, 2), 442, Fraction(10018, 3), Fraction(22072, 3), Fraction(16000, 3)]
assert hurwitz(cp)
# the gain error b / b0 the loop tolerates: b = 8 is Hurwitz, b = 17/2 is not
for b, ok in [(Fraction(1, 100), True), (Fraction(8), True), (Fraction(17, 2), False)]:
assert hurwitz(charpoly(closed_loop_matrix(Fraction(2), Fraction(10), Fraction(3, 2), b, 1, Fraction(1, 2)))) == ok
# the Routh test itself: (s + 1)^5 is Hurwitz, s^2 - s + 1 is not
assert hurwitz([1, 5, 10, 10, 5, 1]) and not hurwitz([1, -1, 1])
def test_observer_error_equation_exact():
# x = (y, y', F) with y'' = F + b0 u: the error x - z obeys
# e1' = e2 - 3 wo e1, e2' = e3 - 3 wo^2 e1, e3' = F' - wo^3 e1
rng = random.Random(3)
for _ in range(200):
y, yd, F, Fd, u = (Fraction(rng.randint(-30, 30), rng.randint(1, 7)) for _ in range(5))
z = [Fraction(rng.randint(-30, 30), rng.randint(1, 7)) for _ in range(3)]
wo = Fraction(rng.randint(1, 40), rng.randint(1, 3))
b0 = Fraction(rng.randint(1, 9), rng.randint(1, 4))
zd = eso_rhs(z, y, u, wo, b0)
e = [y - z[0], yd - z[1], F - z[2]]
xd = [yd, F + b0 * u, Fd]
ed = [a - b for a, b in zip(xd, zd)]
assert ed == [e[1] - 3 * wo * e[0], e[2] - 3 * wo ** 2 * e[0], Fd - wo ** 3 * e[0]]
def test_control_cancels_estimate_exact():
z = [Fraction(1, 3), Fraction(-2, 5), Fraction(7, 4)]
u = control(z, 1, 2, Fraction(3, 2))
# b0 u + z3 = wc^2 (r - z1) - 2 wc z2
assert Fraction(3, 2) * u + z[2] == 4 * (1 - z[0]) - 4 * z[1]
assert control([0, 0, 0], 1, 2, 3) == Fraction(4, 3)
def test_page_table():
# wo = 10: (t, y, z3), within 5e-5
ts, xs, us = run(10.0, 10.0)
table = [(0.5, 0.26861, -0.04604), (1, 0.55035, -0.55420), (2, 0.87203, -0.76846), (3, 0.97251, -0.76831), (5, 0.99981, -0.75163), (5.5, 1.04458, -0.14171), (6, 1.04424, -0.07094), (8, 1.00524, 0.00093), (10, 1.00016, 0.00027)]
for t, y, z3 in table:
x = xs[steps(t, DT)]
assert abs(x[0] - y) < 5e-5 and abs(x[4] - z3) < 5e-5
# u(0) = 4 / 1.5 = 2.667. The total disturbance is F = -y - 0.5 y' + d + (b - b0) u;
# at rest at y = 1 the plant needs u = (1 - d) / b, so F = -0.75 before t = 5
# and F = 0 after it, which z3 approaches in the table.
assert abs(us[0] - 4 / 1.5) < 1e-12
# largest |y - 1| after the step disturbance: 0.0477, within 1 percent
after = max(abs(x[0] - 1) for t, x in zip(ts, xs) if t >= 5)
assert abs(after - 0.0477) < 0.01 * 0.0477
def test_deviation_from_ideal_scales_with_bandwidth():
# max |y - ideal| for t < 5: wo = 10: 0.0514, 20: 0.0241, 40: 0.0113, within 1 percent;
# each doubling of wo roughly halves it
measured = {}
for wo, want in [(10.0, 0.0514), (20.0, 0.0241), (40.0, 0.0113)]:
ts, xs, us = run(wo, 5.0)
dev = max(abs(x[0] - ideal(t)) for t, x in zip(ts, xs) if t < 5)
assert abs(dev - want) < 0.01 * want
measured[wo] = dev
assert 2.0 < measured[10.0] / measured[20.0] < 2.3 and 2.0 < measured[20.0] / measured[40.0] < 2.3
def test_errors():
for bad in [lambda: observer_gains(0), lambda: control([0, 0, 0], 1, 0, 1), lambda: control([0, 0, 0], 1, 2, 0), lambda: eso_rhs([0, 0, 0], 1, 0, -1, 1)]:
try:
bad()
except ValueError:
continue
raise AssertionError("no error")
History
Jingqing Han developed ADRC in China in the 1990s, as an alternative to PID that keeps its independence of models but estimates and cancels the disturbance actively. His English paper of 2009 summarizes the ideas: the tracking differentiator, the observer of the extended state, and nonlinear feedback. Zhiqiang Gao (2003) proposed the linear form in which all observer poles are placed at one bandwidth and all controller poles at another, which reduced tuning to the choice of two numbers. Guo and Zhao (2011) proved convergence of the observer and the closed loop for a class of nonlinear plants with uncertainty.
References
- J. Han, From PID to active disturbance rejection control, IEEE Transactions on Industrial Electronics 56(3), 900-906, 2009, the total disturbance as an extra state, the observer of the extended state, and the nonlinear form of the controller
- Z. Gao, Scaling and bandwidth-parameterization based controller tuning, Proceedings of the American Control Conference, 4989-4996, 2003, the linear form with all observer poles at the observer bandwidth and all controller poles at the controller bandwidth
- B.-Z. Guo and Z.-L. Zhao, On the convergence of an extended state observer for nonlinear systems with uncertainty, Systems and Control Letters 60(6), 420-430, 2011, convergence of the observer and of the closed loop for nonlinear plants with uncertainty
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H1 sketch |
|
| Lean | L0 no Lean part |
|
| Code (python) | I0 not checked yet |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag 1YHBZH Edit this page History Report an error Markdown