Algorithmadvanced
Reference governor
Also called command governor.
An add-on that changes the reference of a closed loop with a Schur state matrix as little as needed so that constraints on the future response are never violated.
- Time
- O(N (n + m)) worst
- Space
- O(N (n + m)) extra
- Where
- N = the number of rows of the admissible set, at most q (t + 1) + q for q rows of the constraint and the index t at which the offline loop stops; m = the number of references; n = the number of states
- Model
- Real RAM
- Properties
- deterministicexactonlineiterative
- Evidence
- Proof sketchCode in 1 languages
- Origin
- Elmer G. Gilbert, Ilya Kolmanovsky, Kok Tin Tan, 1995
A reference governor is an add-on to a control loop that already works well when no limit is active. It sits between the user and the loop and passes on a modified reference instead of the requested reference . At each step it moves from its last value toward by the largest fraction for which the future response, with held constant from now on, meets all constraints. The test uses a set of states and references computed offline by linear programs. The governor keeps the constraints for all time, and it reaches a constant reference that is strictly admissible in finitely many steps. The online work is one ratio per row of that set.
In plain words
A good controller can still overshoot. If the operator asks for a big change at once, a valve can hit its limit or a temperature can go too high. The reference governor watches each request and asks one question: if I pass this request on and keep it fixed, will every future value stay within the limits? If yes, it passes the request on. If no, it passes on only part of the change, as much as is safe. The answer to the question comes from a list of simple linear checks prepared ahead of time. As the loop settles, more of the change becomes safe, and the full request goes through.
The problem
Input: a discrete-time closed loop , with Schur, a constraint with that describes a bounded set, a margin , an initial pair , and a reference sequence . The steady state gain is . Assume that is observable and has full column rank.
Output: a sequence with as large as possible, such that for all .
The admissible set. With held constant from the state , the output at time is , with . Let
Without the margin, the set is in general not finitely determined, because the pair has the dynamics with eigenvalues 1. The margin costs a little of the steady state range and makes a polyhedron with finitely many rows (maximal positively invariant set).
The algorithm
REFERENCE-GOVERNOR(A, B, C, D, H, h, ε, x₀, v₋₁, r₀, r₁, ...)- 1
O ← {(x, v) : H G₀ v ≤ (1 - ε) h}, G₀ = C (I - A)⁻¹ B + D ▷ steady state rows - 2
for t = 0, 1, 2, ... do ▷ offline part - 3
R_t ← rows of H (C Aᵗ x + (C Sₜ B + D) v) ≤ h - 4
if every row of R_t is redundant in O (one LP per row) then stop - 5
O ← O ∩ R_t - 6
for k = 0, 1, 2, ... do ▷ online part - 7
κ ← largest value in [0, 1] with (x_k, v_{k-1} + κ (r_k - v_{k-1})) ∈ O - 8
v_k ← v_{k-1} + κ (r_k - v_{k-1}); apply v_k; x_{k+1} ← A x_k + B v_k
Lines L1 to L5 build once, as in the algorithm of Gilbert and Tan (1991). Line L4 checks a row by solving ; the row is redundant when the maximum is at most . The code solves each LP by the simplex method on its dual, with Bland's rule. When all rows of one time step are redundant, the rows of all later steps are redundant too, so the loop stops.
Line L7 is cheap. Each row becomes with and . Rows with do not limit , and the others give . So is the minimum of 1 and these ratios. Since is in , , and is always allowed.
Example
Take the closed loop
The eigenvalues of are , of modulus , so is Schur, and . The response to a unit step of from rest is , with a peak of 1.25.
Let the constraint be and , so the steady state rows are . In exact rational arithmetic, the offline loop adds the rows of and finds all rows of redundant, so has 16 rows. For example, the row of is , which from rest is the peak .
Start at rest with and request . The governor gives:
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | |
|---|---|---|---|---|---|---|---|---|---|
| 0.88 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | |
| 0.88 | 0.88 | 0.88 | 0.88 | 1 | 1 | 1 | 1 | 1 | |
| 0 | 0 | 0.44 | 0.88 | 1.1 | 1.1 | 1.05 | 1 | 0.975 |
At the row of limits the step to . At the full reference is safe, and jumps to 1. The output touches the limit 1.1 at and and never passes it, and then settles at 1. Without the governor the output would reach 1.25.
If the request is , which is beyond the steady state range, stops at , the largest admissible steady state value, and the output stays within .
Correctness
The proof is in proofs/correctness.md. One step with held maps to , and the output at time from the new state is the output at time from the old one. Hence the set of the rows up to time satisfies , and once , the set stays the same for all later . Observability and the bounded constraint make bounded. Since is Schur, approaches , which is at least inside the limits, so all rows beyond some time are redundant, and the offline loop stops. is invariant when is held, so is always feasible and for all , which gives . For a constant reference with , the margin gives every state near a steady state a uniform amount of room, so reaches after finitely many steps.
Proof: The admissible set is finitely determined and invariant, so the governed loop meets the constraints for all time and reaches a constant admissible reference in finite timefull
Setting. The closed loop is , , with , and Schur. The constraint is with componentwise, and is bounded. Fix . Let (), let be the steady state gain, and assume that is observable and has full column rank. If is held constant from the state , the output at time is
Write and for one step with held. Then , because .
Define the sets , , and , and
Part 1: the LP
lp_max solves subject to with . The point is feasible. By LP duality, the primal is bounded if and only if the dual subject to , is feasible, and then both optima are equal. Phase 1 minimizes the sum of the artificial variables; its value is 0 exactly when the dual is feasible, and the code then returns None otherwise. After the artificial variables are pivoted out of the basis (an equation whose row has no nonzero entry outside the artificial columns is a linear combination of the others and is dropped), phase 2 starts from a feasible basis. Bland's rule makes both phases end after finitely many pivots (Bland 1977). Phase 2 cannot be unbounded, since every dual feasible has by weak duality. So the returned value is the primal maximum. With rational data and tol = 0 all operations are exact.
Part 2: the stopping test is correct
Lemma 1. For every , .
Proof. . Also because does not change . So , and intersecting with gives .
Lemma 2. If for some , then .
Proof. By Lemma 1, . By induction for all , so .
Lines L4 and L5 test whether every row of is redundant in the current set, by one LP per row: the row is redundant in if and only if . The code adds to the set only the rows that are not redundant; this does not change the set. If all rows of are redundant, then , and by Lemma 2 the rows found so far define .
Part 3: the loop stops
Lemma 3. There is a finite such that .
Proof. First, is bounded. On , , so , which is bounded, and is bounded because has full column rank. On , the vector , where stacks , equals the stacked outputs minus terms linear in ; the outputs lie in and is bounded, and has full column rank by observability, so is bounded. Let bound on .
Next, with , (1) gives . Since is Schur, , so there is such that for all rows and all . For and ,
So every row of is redundant in for , and the loop stops at the latest at that .
Part 4: the online step
Lemma 4. If , governor_step returns the largest with .
Proof. Let . A row at reads with and . If the row holds for all . If it holds exactly for . So the set of feasible is , which is what line L7 computes.
Theorem. Let . Then for all :
- the step is defined, , and ;
- ;
- if for all and , then for all after some finite time.
Proof. (1) and (2). is invariant under : if , then for all , and by Lemma 1 for all , so . Suppose . By Lemma 4, exists and , so . Then . Induction on gives (1) and (2).
(3). For the values lie on the segment from to and move toward : . So is nonincreasing and for some on the segment. Suppose that for all . The rows of never limit : they are linear in alone and hold at and at , so they hold on the segment between. Since is convex and contains and , it contains and every between and . Because and is Schur, . For a row of at ,
with , which is finite since is Schur. Choose with . For large, and ; then every on the segment with is admissible at , so either or . The second case cannot happen infinitely often for a convergent sequence, so for some , against the assumption. Once , the direction is and stays at .
Part 5: what the code computes
- Line L1 forms by solving and adds the rows of , which is .
- Lines L2 and L3 keep and with the recursions and , and form the rows of from (1).
- Lines L4 and L5 are the test of Part 2. The returned is the first with , so the rows of and of define .
- Lines L6 to L8 are the step of Lemma 4 and the plant update. With floating point data, can be slightly negative from rounding; the code then sets , which keeps the old and is the choice that the theorem allows.
Complexity
The online step costs for the rows of : one inner product and one ratio per row. The offline part runs rounds with LPs each, where is the number of rows of ; each LP has variables and at most rows. The proof bounds by the first with below a constant times , which is of the order of for the spectral radius ; so grows when is close to 1 or is small. Memory is .
Properties
- Constraint satisfaction for all time, for every reference sequence, if the loop starts in , for example at rest at an admissible steady state.
- Recursive feasibility. is always allowed, so the governor never fails.
- Finite-time convergence to a constant reference with . For a constant reference outside this range, stops on the boundary of the admissible range.
- No change to the loop. If the reference is far from the limits, and the loop behaves as designed. The governor does not alter the stability or the robustness of the inner loop, since it only filters its reference.
- Monotone in one direction. For a constant reference, moves along a segment toward and never back.
Variants and improvements
- Command governor. Choose freely in the admissible set, closest to in a quadratic norm, instead of on the segment. This needs a small QP per step instead of the ratio test.
- Extended command governor. Add a few free future corrections of , which enlarges the admissible set at the cost of a larger QP.
- Disturbances. With a bounded additive disturbance, tighten each row by the worst case effect of the disturbance up to time , as in tube MPC.
- Nonlinear plants. Bemporad (1998) checks admissibility by simulating the nonlinear response with held, instead of a precomputed set.
- Explicit form. Since is a minimum of ratios, the map from to is piecewise rational and can be stored, but the online ratio test is already cheap.
When to use it
Use a reference governor when a linear loop is already tuned for small signals, and the only problem is that large reference changes violate limits on the state or the input. It is much simpler than MPC: the online step has no optimization, and it leaves the inner loop unchanged, so existing controllers and certifications stay valid. Use MPC instead when the limits are active most of the time, when performance near the limits matters, or when the plant is open-loop unstable without a stabilizing inner loop. For an integrator in the loop that winds up during saturation, anti-windup is the simpler fix.
Pitfalls
- Forgetting the margin. With the admissible set has infinitely many rows in general, and the offline loop does not stop.
- Starting outside the set. The guarantees need . A loop that starts far from a steady state may need chosen to match the state, or a check before switching on.
- A slow loop. If has eigenvalues near the unit circle, and the number of rows grow large. Remove redundant rows, or use a larger .
- Model errors. The guarantee is only for the model. Unmodeled dynamics or disturbances can push the output over the limit; add a disturbance tightening, or keep a margin in .
- Rounding. With floating point, a row can be violated by a rounding error, and can come out slightly negative. Clip to 0 in that case, as the code does.
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/reference-governor/. The authors are listed in prov/JN3QT7.jsonl.
"""Scalar reference governor for a discrete-time closed loop.
The closed loop is x_(k+1) = A x_k + B v_k, y_k = C x_k + D v_k, with A Schur
and the constraint H y_k <= h (h > 0). The governor replaces the reference r_k
by v_k = v_(k-1) + kappa_k (r_k - v_(k-1)) with the largest kappa_k in [0, 1]
such that (x_k, v_k) lies in the set O of states and constant inputs whose
future outputs meet the constraint and whose steady state output meets it with
the margin eps.
Matrices are lists of rows and vectors are flat lists. With int or Fraction
data and tol = 0 every step is exact rational arithmetic.
"""
__all__ = ["lp_max", "build_admissible_set", "governor_step", "run", "admissible"]
def _mul(a, b):
return [[sum(a[i][k] * b[k][j] for k in range(len(b))) for j in range(len(b[0]))] for i in range(len(a))]
def _add(a, b):
return [[x + y for x, y in zip(ra, rb)] for ra, rb in zip(a, b)]
def _eye(n):
return [[1 if i == j else 0 for j in range(n)] for i in range(n)]
def _solve(a, b):
"""Solve a X = b by Gaussian elimination with partial pivoting."""
n = len(a)
M = [list(a[i]) + list(b[i]) for i in range(n)]
for c in range(n):
p = max(range(c, n), key=lambda r: abs(M[r][c]))
if M[p][c] == 0:
raise ValueError("singular matrix")
M[c], M[p] = M[p], M[c]
for r in range(n):
if r != c and M[r][c] != 0:
f = M[r][c] / M[c][c]
M[r] = [x - f * y for x, y in zip(M[r], M[c])]
return [[v / M[i][i] for v in M[i][n:]] for i in range(n)]
def _pivot(T, r, c):
p = T[r][c]
T[r] = [v / p for v in T[r]]
for i in range(len(T)):
if i != r and T[i][c] != 0:
f = T[i][c]
T[i] = [x - f * y for x, y in zip(T[i], T[r])]
def _simplex(T, basis, cost, tol):
"""Minimize cost . lam on the tableau T, which is in canonical form for basis.
Bland's rule (smallest index enters, smallest basic index leaves on ties)
prevents cycling. Returns False if the objective is unbounded below.
"""
ncol = len(T[0]) - 1
while True:
enter = None
for j in range(ncol):
if j in basis:
continue
rj = cost[j] - sum(cost[basis[i]] * T[i][j] for i in range(len(T)))
if rj < -tol:
enter = j
break
if enter is None:
return True
leave, best = None, None
for i in range(len(T)):
if T[i][enter] > tol:
ratio = T[i][-1] / T[i][enter]
if best is None or ratio < best - tol or (abs(ratio - best) <= tol and basis[i] < basis[leave]):
leave, best = i, ratio
if leave is None:
return False
_pivot(T, leave, enter)
basis[leave] = enter
def lp_max(c, G, g, tol=1e-10):
"""Return max c . z subject to G z <= g, z free, or None if unbounded.
Needs g >= 0, so that z = 0 is feasible. Solves the dual LP
min g . lam subject to G^T lam = c, lam >= 0 by the two-phase simplex method;
by strong duality its value is the primal maximum.
"""
d, N = len(c), len(G)
T = []
for i in range(d):
row = [G[j][i] for j in range(N)] + [0] * d + [c[i]]
if c[i] < 0:
row = [-v for v in row]
row[N + i] = 1
T.append(row)
basis = [N + i for i in range(d)]
_simplex(T, basis, [0] * N + [1] * d, tol) # phase 1 is bounded below by 0
if sum(T[i][-1] for i in range(d) if basis[i] >= N) > tol * max(1, d):
return None # the dual is infeasible, so the primal is unbounded
keep = []
for i in range(d):
if basis[i] >= N:
j = next((j for j in range(N) if abs(T[i][j]) > tol), None)
if j is None:
continue # redundant equation
_pivot(T, i, j)
basis[i] = j
keep.append(i)
T = [T[i][:N] + [T[i][-1]] for i in keep]
basis = [basis[i] for i in keep]
if not _simplex(T, basis, list(g), tol):
raise ValueError("the primal LP is infeasible")
return sum(g[basis[i]] * T[i][-1] for i in range(len(T)))
def build_admissible_set(A, B, C, D, H, h, eps, tol=1e-10, t_max=1000):
"""Return (rows, t_star): the rows (a, b) of a . (x, v) <= b that define O.
O is the set of (x, v) with H y_t <= h for all t >= 0 when v is held
constant from the state x, and H G0 v <= (1 - eps) h for the steady state
gain G0 = C (I - A)^(-1) B + D. t_star is the first t whose rows were all
redundant, so the rows of the times 0, ..., t_star - 1 define O.
"""
n, m = len(A), len(B[0])
if D is None:
D = [[0] * m for _ in C]
nH = len(H)
G0 = _add(_mul(C, _solve(_add(_eye(n), [[-a for a in row] for row in A]), B)), D) # @line L1
HG0 = _mul(H, G0)
rows = [([0] * n + HG0[i], (1 - eps) * h[i]) for i in range(nH)]
Apow = _eye(n)
SB = [[0] * m for _ in range(n)] # S_t B with S_t = I + A + ... + A^(t-1)
for t in range(t_max + 1): # @line L2
Hx = _mul(H, _mul(C, Apow)) # @line L3
Hv = _mul(H, _add(_mul(C, SB), D))
G = [a for a, _ in rows]
g = [b for _, b in rows]
new = []
for i in range(nH):
a = Hx[i] + Hv[i]
val = lp_max(a, G, g, tol) # @line L4
if val is None or val > h[i] + tol:
new.append((a, h[i]))
if not new:
return rows, t # @line L4
rows = rows + new # @line L5
SB = _add(B, _mul(A, SB))
Apow = _mul(A, Apow)
raise RuntimeError("O was not determined within t_max steps")
def admissible(rows, x, v, tol=0):
"""True if (x, v) satisfies every row."""
z = list(x) + list(v)
return all(sum(ai * zi for ai, zi in zip(a, z)) <= b + tol for a, b in rows)
def governor_step(rows, x, v_prev, r):
"""Return (v, kappa) with the largest kappa in [0, 1] such that (x, v) is in O."""
n = len(x)
d = [ri - vi for ri, vi in zip(r, v_prev)]
kappa = 1 # @line L7
for a, b in rows:
beta = b - sum(ai * xi for ai, xi in zip(a[:n], x)) - sum(ai * vi for ai, vi in zip(a[n:], v_prev))
alpha = sum(ai * di for ai, di in zip(a[n:], d))
if alpha > 0 and beta < kappa * alpha:
kappa = beta / alpha
if kappa < 0: # only rounding can make beta negative
kappa = 0
v = [vi + kappa * di for vi, di in zip(v_prev, d)] # @line L8
return v, kappa
def run(A, B, C, D, rows, x0, v_prev, refs):
"""Apply the governor to the references refs. Returns (xs, vs, ys, kappas)."""
m = len(B[0])
if D is None:
D = [[0] * m for _ in C]
x = list(x0)
v = list(v_prev)
xs, vs, ys, ks = [list(x)], [], [], []
for r in refs: # @line L6
v, kappa = governor_step(rows, x, v, r)
y = [sum(c * xi for c, xi in zip(Cr, x)) + sum(dd * vi for dd, vi in zip(Dr, v)) for Cr, Dr in zip(C, D)]
x = [sum(a * xi for a, xi in zip(Ar, x)) + sum(b * vi for b, vi in zip(Br, v)) for Ar, Br in zip(A, B)] # @line L8
xs.append(x)
vs.append(v)
ys.append(y)
ks.append(kappa)
return xs, vs, ys, ks
test_reference_governor.py 150 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/reference-governor/. The authors are listed in prov/JN3QT7.jsonl.
import itertools
import random
from fractions import Fraction as F
from reference_governor import _solve, admissible, build_admissible_set, governor_step, lp_max, run
# The example of the page: y = x1 / 2 follows v with the step response 0, 0, 0.5, 1, 1.25, 1.25, 1.125, ...
A = [[0, 1], [F(-1, 2), 1]]
B = [[0], [1]]
C = [[F(1, 2), 0]]
H = [[1], [-1]]
h = [F(11, 10), F(11, 10)]
EPS = F(1, 20)
def outputs(Am, Bm, Cm, x, v, steps):
ys = []
for _ in range(steps):
ys.append(sum(c * xi for c, xi in zip(Cm[0], x)))
x = [sum(a * xi for a, xi in zip(row, x)) + Bm[i][0] * v for i, row in enumerate(Am)]
return ys
def random_schur(rng, n):
while True:
M = [[rng.uniform(-1, 1) for _ in range(n)] for _ in range(n)]
# Gershgorin: spectral radius below max row sum of |entries|; scale it to 0.8.
s = max(sum(abs(v) for v in row) for row in M)
M = [[0.8 * v / s for v in row] for row in M]
b = [[rng.uniform(-1, 1)] for _ in range(n)]
c = [[rng.uniform(-1, 1) for _ in range(n)]]
# Steady state gain away from 0 so that references matter.
I_A = [[(1 if i == j else 0) - M[i][j] for j in range(n)] for i in range(n)]
g0 = sum(c[0][i] * _solve(I_A, b)[i][0] for i in range(n))
if abs(g0) > 0.3:
return M, b, c, g0
def test_lp_against_vertex_enumeration():
rng = random.Random(4)
for _ in range(40):
k = rng.randint(3, 7)
G = [[rng.uniform(-1, 1), rng.uniform(-1, 1)] for _ in range(k)]
g = [rng.uniform(0.1, 1.0) for _ in range(k)]
c = [rng.uniform(-1, 1), rng.uniform(-1, 1)]
best = None
for i, j in itertools.combinations(range(k), 2):
det = G[i][0] * G[j][1] - G[i][1] * G[j][0]
if abs(det) < 1e-9:
continue
z = [(g[i] * G[j][1] - G[i][1] * g[j]) / det, (G[i][0] * g[j] - g[i] * G[j][0]) / det]
if all(G[r][0] * z[0] + G[r][1] * z[1] <= g[r] + 1e-9 for r in range(k)):
val = c[0] * z[0] + c[1] * z[1]
best = val if best is None else max(best, val)
val = lp_max(c, G, g)
# In the plane, the cone {d : G d <= 0} is spanned by directions along the lines G_i d = 0.
dirs = [[s * G[i][1], -s * G[i][0]] for i in range(k) for s in (1, -1)] + [c]
ray = any(all(G[r][0] * d[0] + G[r][1] * d[1] <= 1e-12 for r in range(k)) and c[0] * d[0] + c[1] * d[1] > 1e-12
for d in dirs)
if val is None:
assert ray
else:
assert not ray and best is not None and abs(val - best) < 1e-8
def test_lp_unbounded_and_exact():
assert lp_max([1, 0], [[0, 1], [0, -1]], [1, 1]) is None
assert lp_max([F(1), F(1)], [[1, 0], [0, 1], [-1, 0], [0, -1]], [F(1, 3), F(2, 7), 1, 1], tol=0) == F(13, 21)
def test_example_set_is_exact_and_small():
rows, ts = build_admissible_set(A, B, C, None, H, h, EPS, tol=0)
assert ts == 7 and len(rows) == 16
# The row of t = 4 is the peak 1.25 v of the step response.
assert ([F(-1, 8), 0, F(5, 4)], F(11, 10)) in rows
def test_membership_matches_simulation():
rows, ts = build_admissible_set(A, B, C, None, H, h, EPS, tol=0)
rng = random.Random(9)
inside = outside = 0
for _ in range(300):
x = [F(rng.randint(-24, 24), 10), F(rng.randint(-24, 24), 10)]
v = F(rng.randint(-12, 12), 10)
ss_ok = abs(v) <= (1 - EPS) * h[0]
ys = outputs(A, B, C, x, v, 60)
ok = ss_ok and all(abs(y) <= h[0] for y in ys)
assert admissible(rows, x, [v]) == ok
# A violation, if any, happens before t_star.
if ss_ok and not ok:
assert any(abs(y) > h[0] for y in ys[:ts])
inside += ok
outside += not ok
assert inside > 20 and outside > 20
def test_example_closed_loop():
rows, _ = build_admissible_set(A, B, C, None, H, h, EPS, tol=0)
xs, vs, ys, ks = run(A, B, C, None, rows, [0, 0], [0], [[1]] * 30)
assert vs[0] == [F(22, 25)] and vs[3] == [F(22, 25)] and vs[4] == [1]
assert max(y[0] for y in ys) == F(11, 10)
assert all(vs[k][0] <= vs[k + 1][0] for k in range(29))
assert abs(ys[-1][0] - 1) < 1e-3
# Without the governor the output peaks at 1.25.
assert max(outputs(A, B, C, [0, 0], 1, 12)) == F(5, 4)
def test_inadmissible_reference_stops_at_the_margin():
Af = [[0.0, 1.0], [-0.5, 1.0]]
rows, _ = build_admissible_set(Af, [[0.0], [1.0]], [[0.5, 0.0]], None, H, [1.1, 1.1], 0.05)
xs, vs, ys, ks = run(Af, [[0.0], [1.0]], [[0.5, 0.0]], None, rows, [0.0, 0.0], [0.0], [[1.2]] * 40)
assert max(abs(y[0]) for y in ys) <= 1.1 + 1e-12
assert abs(vs[-1][0] - 1.045) < 1e-9
def test_random_loops_and_references():
rng = random.Random(21)
for _ in range(6):
n = rng.choice([2, 3])
M, b, c, g0 = random_schur(rng, n)
hh = [1.0, 1.0]
rows, ts = build_admissible_set(M, b, c, None, H, hh, 0.1)
x = [0.0] * n
v = [0.0]
for k in range(60):
if k % 15 == 0:
r = [rng.uniform(-2.0, 2.0) / g0]
assert admissible(rows, x, v, 1e-9)
v, kappa = governor_step(rows, x, v, r)
assert 0 <= kappa <= 1
assert admissible(rows, x, v, 1e-9)
y = sum(ci * xi for ci, xi in zip(c[0], x))
assert abs(y) <= 1.0 + 1e-9
x = [sum(a * xi for a, xi in zip(row, x)) + b[i][0] * v[0] for i, row in enumerate(M)]
def test_set_is_invariant_with_constant_v():
rows, _ = build_admissible_set(A, B, C, None, H, h, EPS, tol=0)
rng = random.Random(5)
for _ in range(200):
x = [F(rng.randint(-20, 20), 10), F(rng.randint(-20, 20), 10)]
v = F(rng.randint(-10, 10), 10)
if admissible(rows, x, [v]):
x1 = [x[1], -x[0] / 2 + x[1] + v]
assert admissible(rows, x1, [v])
# kappa = 0 is always allowed, so the governor never gets stuck.
assert governor_step(rows, x1, [v], [F(-3)])[1] >= 0
History
Gilbert and Tan (1991) defined the maximal output admissible set of a linear system, showed when it is finitely determined, and computed it by linear programs. Gilbert, Kolmanovsky and Tan (1995) applied it to the state together with a constant reference to build the discrete-time reference governor with one scalar per step and proved constraint satisfaction and finite-time convergence. Bemporad (1998) extended the idea to nonlinear systems. Later work added command governors with a free choice of , robust versions for disturbances, and many applications in automotive and aerospace control, which Garone, Di Cairano and Kolmanovsky (2017) survey.
References
- Elmer G. Gilbert, Ilya Kolmanovsky and Kok Tin Tan, Discrete-time reference governors and the nonlinear control of systems with state and control constraints, International Journal of Robust and Nonlinear Control 5(5), 487-504, 1995, the discrete-time reference governor for linear systems and the proofs of its properties
- Elmer G. Gilbert and Kok Tin Tan, Linear systems with state and control constraints, the theory and application of maximal output admissible sets, IEEE Transactions on Automatic Control 36(9), 1008-1020, 1991, the maximal output admissible set, its finite determination, and its computation by linear programs
- Alberto Bemporad, Reference governor for constrained nonlinear systems, IEEE Transactions on Automatic Control 43(3), 415-419, 1998, the reference governor for nonlinear systems, based on prediction of the future response
- Emanuele Garone, Stefano Di Cairano and Ilya Kolmanovsky, Reference and command governors for systems with constraints, a survey on theory and applications, Automatica 75, 306-328, 2017, the survey of scalar reference governors, command governors and their applications
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 JN3QT7 Edit this page History Report an error Markdown