Algorithmadvanced
Super-twisting algorithm
Also called second-order sliding mode, super-twisting controller.
A sliding mode law whose switching acts on the derivative of the control, so the control is continuous and the sliding variable and its derivative reach zero in finite time.
- Time
- O(N) worst
- Space
- O(1) extra
- Where
- N = the number of sampling instants
- Model
- Real RAM
- Properties
- deterministicnot exactonlineiterative
- Evidence
- Proof sketchCode in 1 languages
- Origin
- Arie Levant, Jaime A. Moreno, Marisol Osorio, 1993
The super-twisting algorithm is a continuous sliding mode law for a sliding variable whose derivative is , where is an unknown disturbance with a bounded derivative, . It uses the control
The switching acts on , not on , so is a continuous function of time. For gains that are large enough compared with , both and reach in finite time, and the integral term then equals exactly. Compared with the first order law of sliding mode control, it removes the discontinuity of the control and reduces chattering, at the price of a stronger assumption on .
In plain words
A plain sliding mode controller pushes with full force left or right, so its output jumps all the time. The super-twisting controller has two parts. One part pushes back with a force that grows with the square root of the error, so it is strong far away and soft near the target. The other part slowly builds up a correction, like the integral part of a PID controller, but it changes at a fixed rate in the direction of the error. This slow part learns the unknown disturbance and cancels it. Because the jumps happen only in the rate of the slow part, the output itself is smooth. The controller still reaches the target exactly in a finite time, as long as the disturbance does not change too fast.
The problem
Input. A measured sliding variable with , where is unknown, absolutely continuous, and for almost every . A sampling period . Gains and .
Output. At each sampling instant , a control value , held over , such that in the continuous-time limit after a finite time, and with sampling and after a finite time.
The sliding variable usually comes from a surface of relative degree one with respect to the input, as in sliding mode control. Then collects the known part of that is not cancelled, and the uncertainty, and the condition must hold along the motion.
The algorithm
SUPER-TWISTING-STEP(s, w, k_1, k_2, h)- 1
u ← -k_1 |s|^{1/2} sgn(s) + w - 2
w ← w - h k_2 sgn(s) - 3
return u
The state starts at (often ) and is kept between calls. Line L1 computes the control from the current sample and the current integral state. Line L2 advances the integral state by one explicit Euler step of . Line L3 returns the control, which is held until the next sample.
In continuous time, put , so that
At the right side is discontinuous, and solutions are taken in the sense of Filippov. The pair reaches in finite time, and means .
Example
Let , so , with , , and . The plant is integrated with 4th order Runge-Kutta with step , and the control is computed at the start of each step and held. The certificate below holds, because .
| 0.5 | 0.151849 | -1.00 | -0.479426 |
| 1 | 0.002585 | -0.76 | -0.841471 |
| 1.5 | -0.000131 | -1.00 | -0.997495 |
| 2 | 0.000023 | -0.92 | -0.909297 |
| 3 | -0.000031 | -0.16 | -0.141120 |
| 4 | -0.000063 | 0.76 | 0.756802 |
Measurements from this run and two more:
- for good from .
- For , the maximum of is for , for and for , that is between and . The accuracy is of order , as the theory says.
- follows within for . It moves by per step, so it can only follow in steps of that size.
- For comparison, the first order law with the same keeps , about 50 times larger, and its control jumps by at almost every step.
The Lyapunov bound on the convergence time for these gains is , far above the measured time below . The bound is a guarantee, not an estimate.
Correctness
The full proof is in proofs/correctness.md. Its main steps:
- Coordinates. With and , the closed loop is with , where .
- Theorem (Lyapunov function). Let with (the matrix of Moreno and Osorio). Then , with . If , then is positive definite for every .
- Theorem (finite time). Under that condition, , where is the smaller of the least eigenvalues of and , so reaches before . The set , is crossed, not followed, so it does not break the argument.
- Theorem (necessity). If , no gain works: for , staying on needs , but there.
- Theorem (accuracy with sampling). With sampling period , and after a finite time (Levant 1993). The tests measure the factor in front of .
The tests check the identity and the formula for exactly in Fraction for 200 random gains, the identity exactly at 200 random points, the table, the accuracy for three periods, the comparison with the first order law, the rule of thumb gains, and the failure for .
Proof: The super-twisting algorithm drives s and v to zero in finite time when k2 > L + 2 L^2 / k1^2, and k2 >= L is necessaryfull
The plant is , where is absolutely continuous and for almost every . The continuous-time form of lines L1 and L2 is and , with . Put . Then
The first equation has a continuous right side. The second is discontinuous at , and solutions are taken in the sense of Filippov: is absolutely continuous, the first equation holds for every , and for almost every , where for and . In this proof is the absolute value, is the Euclidean norm on , and , are the least and the largest eigenvalue of a symmetric matrix.
Lemma 1: the closed loop in the coordinates zeta
Let and . The map is continuous and invertible (), so is continuous in . Where , is differentiable in with derivative . So, for almost every with ,
with (any if ). Indeed . In matrix form,
Lemma 2: the Lyapunov matrix and its derivative
Let
(a) is positive definite: and .
(b) . With and , the product has the entries , , and . Adding the transpose gives the diagonal entries and , and the off-diagonal entry . These are the entries of .
(c)
(d) If , then is positive definite for every . Its entry is positive. The function is a concave quadratic, so on it is smallest at an endpoint. , and exactly when . Conversely, if , then is not positive definite.
(e) Let . For a fixed unit vector , is affine, so is concave in and its minimum on is at an endpoint. So for every , and under the condition of (d).
The tests check (b) and (c) exactly in Fraction for 200 random gains, and the identity of Lemma 3 at 200 random points.
Lemma 3: V decreases away from s = 0
Let and assume . On every open time interval where , is absolutely continuous and, for almost every ,
using and . So with wherever and .
Lemma 4: zeros of s with v nonzero are isolated
Let and . By the first equation of (1), which holds for every with a continuous right side, , and is continuous near . So is strictly monotone near and for for some .
Theorem 1: finite-time convergence
Assume . Then for all , where
Proof. Fix and an interval on which . The zeros of in have , because gives . By Lemma 4 each zero is isolated. If there were infinitely many, they would have an accumulation point , with by continuity and since ; then would be isolated by Lemma 4, which is a contradiction. So has finitely many zeros in . On each of the open intervals between them, Lemma 3 gives , and since is continuous, the inequality holds across the zeros too. So .
Now let be the first time with (if , put ). On , , so . Hence takes values at most before for every .
It remains to show that never increases. Let and suppose . Let . By continuity , and on . For each , is continuous and positive on , so it has a positive minimum there, and the first part, with equal to this minimum, gives . Letting gives , a contradiction. So is non-increasing on . Combined with the first part, for and every , so for . Since is positive definite, , that is .
At the Filippov set for is , which contains because . So staying at the origin is a valid solution, and by the theorem it is the only one. On the origin , so : the integral state equals minus the disturbance, and the averaged value of is .
Theorem 2: k_2 >= L is necessary
Let and , so . Suppose on an interval of positive length. By the first equation of (1), on , so for almost every . But , and . This is a contradiction. So no solution stays on for any , and is not reached in the sense of Theorem 1.
The test with , and shows . The gap between and the sufficient condition comes from the choice of ; other Lyapunov functions give other sufficient conditions.
Sampling
The implementation samples with period and integrates by explicit Euler (line L2). Then exact convergence is replaced by a neighborhood: Levant (1993) shows that and after a finite time. This page does not reprove that result. The tests measure between and for in the page example.
Complexity
Count real operations at unit cost, with the square root as one operation, as in the real RAM. Each sample costs time: one square root, one sign, and a few products and sums. The state is the single number , so the extra space is . A run of samples costs time.
Properties
- Continuous control. is a continuous function of and , and is continuous in time. The jump happens in .
- Finite-time convergence. Both and reach in finite time. The bound from the Lyapunov function is conservative.
- Exact disturbance estimate. After convergence , so the algorithm also estimates the disturbance. This is why it serves as a differentiator and as an observer.
- Homogeneity. With the weights for and for , the vector field is homogeneous of degree . This explains the finite-time convergence and the accuracy and (Levant 1993).
- Needs the relative degree one. must have relative degree one with respect to . The algorithm does not need to be measured.
- Stronger assumption than first order sliding. It needs a bound on , not on . A disturbance that jumps is not covered.
Variants and improvements
- Rule of thumb gains. The choice , , which Levant (1998) uses for the differentiator, works well in practice. It is a rule of thumb, not a certificate: for it fails the condition of this page, but the example converges with it by .
- Exact differentiator. Run the algorithm on with . Then converges to in finite time when (Levant 1998).
- Observer. The same law drives a sliding mode observer for mechanical systems, where it estimates the velocity from the position.
- Linear terms. Adding to and to gives the generalized super-twisting algorithm, which handles disturbances that grow with and converges faster far from the surface. Moreno and Osorio's Lyapunov method extends to it.
- Adaptive gains. Gains that increase while the sliding mode is lost and decrease while it holds avoid a conservative .
- Higher order. Laws of order three and more drive to for a sliding variable of higher relative degree.
When to use it
Use it when a first order sliding mode controller would work but its switching control is not acceptable, and the disturbance is smooth enough that holds with a moderate . It is a common choice in electric drives, hydraulic and pneumatic actuators and aircraft control, and as a robust differentiator. If the disturbance can jump, use the first order law or a boundary layer. If is smooth and well modeled, a linear observer with a PID controller or active disturbance rejection control may be simpler to tune.
Pitfalls
- k_2 too small at line L2. If , the integral state cannot follow the disturbance, and drifts away (test case: , , and grows to by ).
- Large L from a crude bound. The required gains grow with , and with them the chattering. Use the smallest that the plant really has.
- Relative degree two. If enters and not , the algorithm does not apply. Use a different surface or an algorithm of higher order.
- Integral windup at line L2. With input limits, keeps growing while the actuator is saturated. Limit in the same way as in anti-windup schemes.
- Unmodeled actuator dynamics. A fast actuator still causes chattering, now in , of smaller size. The algorithm reduces chattering, it does not remove it.
- Explicit Euler at line L2. For large the integral state moves in large steps. Choose so that is small compared with the size of .
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
# 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()
super_twisting_algorithm.py 94 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/super-twisting-algorithm/. The authors are listed in prov/QDH2NE.jsonl.
"""The super-twisting algorithm for a sliding variable with
s' = u + d(t), |d'(t)| <= L,
in its sampled form with sampling period h:
u_j = -k1 |s_j|^(1/2) sgn(s_j) + w_j,
w_(j+1) = w_j - h k2 sgn(s_j).
In continuous time the closed loop is s' = -k1 |s|^(1/2) sgn(s) + v,
v' = -k2 sgn(s) + d' with v = w + d. With z = (|s|^(1/2) sgn(s), v) the
quadratic form V = z^T P z,
P = [[2 k2 + k1^2 / 2, -k1 / 2], [-k1 / 2, 1]],
decreases along every solution when k1 > 0 and k2 > L + 2 L^2 / k1^2, and
s = v = 0 is reached in finite time T <= 2 sqrt(lambda_max(P)) sqrt(V(0)) / q,
where q is the smaller of the least eigenvalues of Q(1) and Q(-1) below.
lyapunov_matrix, q_matrix and certified are exact for Fraction input.
"""
import math
__all__ = ["sgn", "SuperTwisting", "lyapunov_matrix", "q_matrix", "certified", "time_bound"]
def sgn(s):
"""Return -1, 0 or 1."""
return (s > 0) - (s < 0)
class SuperTwisting:
"""Sampled super-twisting controller with gains k1, k2 and period h."""
def __init__(self, k1, k2, h, w0=0):
if k1 <= 0 or k2 <= 0:
raise ValueError("k1 and k2 must be positive")
if h <= 0:
raise ValueError("h must be positive")
self.k1 = k1
self.k2 = k2
self.h = h
self.w = w0
def step(self, s):
"""Return u_j for the measured s_j and advance the integral state."""
sg = sgn(s)
u = -self.k1 * math.sqrt(abs(s)) * sg + self.w # @line L1
self.w = self.w - self.h * self.k2 * sg # @line L2
return u # @line L3
def lyapunov_matrix(k1, k2):
"""P of the quadratic Lyapunov function V = z^T P z."""
return [[2 * k2 + k1 * k1 / 2, -k1 / 2], [-k1 / 2, 1]]
def q_matrix(k1, k2, L, theta):
"""Q(theta) = -(A^T P + P A) for A = [[-k1/2, 1/2], [-k2 + theta L, 0]]."""
a = k1 * k2 + k1 ** 3 / 2 + theta * L * k1
b = -k1 * k1 / 2 - theta * L
return [[a, b], [b, k1 / 2]]
def certified(k1, k2, L):
"""True if Q(1) and Q(-1) are positive definite, that is k2 > L + 2 L^2 / k1^2."""
for theta in (1, -1):
q = q_matrix(k1, k2, L, theta)
if not (q[1][1] > 0 and q[0][0] * q[1][1] - q[0][1] * q[1][0] > 0):
return False
return True
def _eig2(m):
a, b, d = float(m[0][0]), float(m[0][1]), float(m[1][1])
r = math.hypot((a - d) / 2, b)
return (a + d) / 2 - r, (a + d) / 2 + r
def time_bound(k1, k2, L, s0, v0):
"""Upper bound on the time to reach s = v = 0 from s(0) = s0, v(0) = v0."""
if not certified(k1, k2, L):
raise ValueError("the gains are not certified for this L")
p = lyapunov_matrix(k1, k2)
z1 = math.sqrt(abs(s0)) * sgn(s0)
v0 = float(v0)
V0 = float(p[0][0]) * z1 * z1 + 2 * float(p[0][1]) * z1 * v0 + v0 * v0
lmax = _eig2(p)[1]
q = min(_eig2(q_matrix(k1, k2, L, 1))[0], _eig2(q_matrix(k1, k2, L, -1))[0])
return 2 * math.sqrt(lmax) * math.sqrt(V0) / q
test_super_twisting_algorithm.py 144 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/super-twisting-algorithm/. The authors are listed in prov/QDH2NE.jsonl.
import math
import random
from fractions import Fraction
import ctlsim
from super_twisting_algorithm import SuperTwisting, certified, lyapunov_matrix, q_matrix, sgn, time_bound
# Simulations: the plant s' = u + d(t) is integrated with classical RK4
# (ctlsim) with step dt equal to the sampling period h of the controller, so
# u is held over each step. Tolerances are stated at each check.
def steps(T, h):
n = round(T / h)
assert abs(n * h - T) < 1e-12
return n
def run(k1, k2, h, T, d=math.sin, s0=1.0):
st = SuperTwisting(k1, k2, h)
ws = []
def control(t, x):
ws.append(st.w)
return st.step(x[0])
ts, xs, us = ctlsim.simulate(lambda t, x, u: [u + d(t)], [s0], 0.0, T, h, control=control)
ws.append(st.w)
assert len(us) == steps(T, h)
return ts, [x[0] for x in xs], ws
def rand_frac(rng, lo, hi, den=8):
return Fraction(rng.randint(lo * den, hi * den), den)
def test_step_by_hand():
st = SuperTwisting(2, 2, Fraction(1, 100))
assert st.step(4.0) == -4.0
assert st.w == Fraction(-2, 100)
assert st.step(0.0) == -0.02
assert st.w == Fraction(-2, 100)
assert abs(st.step(-0.25) - (1.0 - 0.02)) < 1e-15
def test_q_matrix_is_minus_lyapunov_derivative():
# Q(theta) = -(A^T P + P A) and det Q = k1^2 k2 / 2 - theta L k1^2 / 2 - theta^2 L^2, exactly.
rng = random.Random(3)
for _ in range(200):
k1, k2, L = rand_frac(rng, 1, 5), rand_frac(rng, 1, 9), rand_frac(rng, 0, 3)
theta = rand_frac(rng, -1, 1)
P = lyapunov_matrix(k1, k2)
A = [[-k1 / 2, Fraction(1, 2)], [-k2 + theta * L, 0]]
M = [[sum(A[k][i] * P[k][j] + P[i][k] * A[k][j] for k in range(2)) for j in range(2)] for i in range(2)]
Q = q_matrix(k1, k2, L, theta)
assert all(M[i][j] == -Q[i][j] for i in range(2) for j in range(2))
det = Q[0][0] * Q[1][1] - Q[0][1] * Q[1][0]
assert det == k1 * k1 * k2 / 2 - theta * L * k1 * k1 / 2 - theta * theta * L * L
assert certified(k1, k2, L) == (k2 > L + 2 * L * L / (k1 * k1))
def test_lyapunov_rate_exact():
# Along s' = -k1 |s|^(1/2) sgn s + v, v' = -k2 sgn s + rho, |rho| <= L, in
# z = (|s|^(1/2) sgn s, v): V' = -z^T Q(theta) z / |z1| with theta = rho sgn(z1) / L.
rng = random.Random(5)
for _ in range(200):
k1, k2, L = rand_frac(rng, 1, 4), rand_frac(rng, 1, 6), rand_frac(rng, 1, 2)
z1 = rand_frac(rng, -3, 3)
if z1 == 0:
continue
z2 = rand_frac(rng, -3, 3)
rho = rand_frac(rng, -1, 1) * L
dz1 = (-k1 * z1 + z2) / (2 * abs(z1))
dz2 = -k2 * sgn(z1) + rho
P = lyapunov_matrix(k1, k2)
z, dz = [z1, z2], [dz1, dz2]
vdot = 2 * sum(z[i] * P[i][j] * dz[j] for i in range(2) for j in range(2))
theta = rho * sgn(z1) / L
Q = q_matrix(k1, k2, L, theta)
assert vdot == -sum(z[i] * Q[i][j] * z[j] for i in range(2) for j in range(2)) / abs(z1)
if certified(k1, k2, L):
assert vdot < 0
def test_page_example():
# s' = u + sin t, L = 1, gains (2, 2): certified since 2 > 1 + 2 / 4.
assert certified(2, 2, 1)
assert abs(time_bound(2.0, 2.0, 1.0, 1.0, 0.0) - 132.984) < 1e-3
h = 0.01
ts, ss, ws = run(2.0, 2.0, h, 10.0)
table = {0.5: (0.151849, -1.0), 1.0: (0.002585, -0.76), 2.0: (0.000023, -0.92), 4.0: (-0.000063, 0.76)}
for t, (s, w) in table.items():
i = steps(t, h)
assert abs(ss[i] - s) < 5e-7 and abs(ws[i] - w) < 1e-9
# |s| <= 0.05 for good from t = 0.59 (measured)
i = steps(0.59, h)
assert all(abs(s) <= 0.05 for s in ss[i:]) and abs(ss[i - 1]) > 0.05
# w tracks -d: max |w + sin t| for t >= 6 is 0.045 (measured), about 2 h k2
assert max(abs(w + math.sin(t)) for t, w in zip(ts, ws) if t >= 6) < 0.05
def test_accuracy_is_order_h_squared():
# max |s| for t >= 6 is 4.35 h^2, 5.31 h^2, 4.75 h^2 for h = 0.01, 0.005, 0.0025 (measured).
for h in (0.01, 0.005, 0.0025):
ts, ss, ws = run(2.0, 2.0, h, 10.0)
late = max(abs(s) for t, s in zip(ts, ss) if t >= 6)
assert 3 * h * h < late < 6 * h * h
def test_first_order_comparison():
# u = -1.5 sgn s with the same h: band 0.0235, about 50 times the super-twisting band.
h = 0.01
ts, xs, us = ctlsim.simulate(lambda t, x, u: [u + math.sin(t)], [1.0], 0.0, 10.0, h, control=lambda t, x: -1.5 * sgn(x[0]))
assert len(us) == steps(10.0, h)
band = max(abs(x[0]) for t, x in zip(ts, xs) if t >= 6)
assert 0.02 < band <= 2.5 * h
def test_rule_of_thumb_gains():
# k1 = 1.5 sqrt(L), k2 = 1.1 L is not certified by this P, but converges here.
assert not certified(1.5, 1.1, 1.0)
ts, ss, ws = run(1.5, 1.1, 0.01, 10.0)
assert max(abs(s) for t, s in zip(ts, ss) if t >= 1) <= 0.05
assert max(abs(s) for t, s in zip(ts, ss) if t >= 6) < 5e-4
def test_k2_below_L_fails():
# d = t has d' = 1 = L. With k2 = 0.5 < L, v' >= 0.5 and s drifts away.
ts, ss, ws = run(2.0, 0.5, 0.01, 10.0, d=lambda t: t)
assert ss[-1] > 4.0
ts, ss, ws = run(2.0, 1.5, 0.01, 10.0, d=lambda t: t)
assert max(abs(s) for t, s in zip(ts, ss) if t >= 6) < 2e-4
def test_errors():
for bad in [lambda: SuperTwisting(0, 1, 0.1), lambda: SuperTwisting(1, 1, 0), lambda: time_bound(1.0, 1.0, 1.0, 1.0, 0.0)]:
try:
bad()
except ValueError:
continue
raise AssertionError("no error")
History
Arie Levant (who published earlier as Levantovsky) introduced the super-twisting algorithm in his 1993 paper on sliding order and sliding accuracy, among other laws that keep and at zero. His proofs used the geometry of the phase plane, and he showed that sampling with period gives an accuracy of order . In 1998 he used the same law as a robust exact differentiator, which made it popular in observers and output feedback. A Lyapunov function for the algorithm was missing until Moreno and Osorio presented a quadratic form in the coordinates in 2008 and extended it to strict Lyapunov functions in 2012. This made the usual tools of Lyapunov analysis available, such as convergence time estimates and robustness margins.
References
- Sliding order and sliding accuracy in sliding mode control, the definition of the super-twisting algorithm, its finite-time convergence, and the accuracy of order h^2 with sampling period h
- A. Levant, Robust exact differentiation via sliding mode technique, Automatica 34(3), 379-384, 1998, the use of the super-twisting algorithm as an exact differentiator with a bound on the second derivative of the signal
- J. A. Moreno and M. Osorio, Strict Lyapunov functions for the super-twisting algorithm, IEEE Transactions on Automatic Control 57(4), 1035-1040, 2012, the quadratic form in the coordinates (|s|^(1/2) sgn s, v) and the finite-time estimate
- Christopher Edwards and Sarah K. Spurgeon, Sliding Mode Control, Theory and Applications, Taylor and Francis, 1998, the background on sliding modes, the reaching condition and matched uncertainty
Where this leads
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 QDH2NE Edit this page History Report an error Markdown