Blocks#
Every block of this toolkit, from its catalog.
control#
Block |
Type |
What it does |
|---|---|---|
|
Drives an error to zero: proportional, integral and derivative terms. n filters the derivative; u_min < u_max limits the output, with anti-windup (clamp or back_calc with kt). Equal limits: none. |
|
|
Accumulates its input over time. A feedback loop may pass through it. |
|
|
Smooths its input with a time constant: a first-order lag. |
|
|
Its input from a number of clock steps ago; any value. |
|
|
A transfer function H(s) or H(z) from its numerator and denominator coefficients (descending powers). s: integrated (controllable canonical form) or discretized by Tustin; z: direct form II transposed. |
|
|
A state-space model: x’ = A x + B u and y = C x + D u for s, or x[k+1] = A x + B u and y = C x + D u for z. A is n x n, B n x m, C p x n, D p x m, and x0 is the initial state. |
|
|
User-supplied ODE right-hand side x’ = f(t, x, u), separated by ‘;’ for multi-state systems (x1..xn, u1..um, t). Integrated by the run’s solver. |
|
|
The frequency response of num/den: magnitude in dB (20 log10 |H|) and phase in degrees. For z, sample_time sets z = exp(j w sample_time). |
|
|
The rank of the controllability matrix [B AB … A^(n-1) B], the system order and whether the system is controllable. A and B are matrix text. |
|
|
The rank of the observability matrix [C; CA; …; CA^(n-1)], the system order and whether the system is observable. A and C are matrix text. |
|
|
A second-order system k wn² / (s² + 2 zeta wn s + wn²): natural frequency wn, damping zeta, dc gain k. |
|
|
A transfer function from its zeros, poles and gain: k Π(s − z) / Π(s − p). Roots like -1 or -2+3j. |
|
|
A lead-lag compensator k (s/zero + 1) / (s/pole + 1): lead when zero < pole, lag when zero > pole. |
|
|
The rate of change of its input, filtered: s / (tau s + 1). |
|
|
Removes the steady part of its input, passing changes: tau s / (tau s + 1). |
|
|
Cuts one frequency: depth dB at freq, width sets how wide. For a resonance or mains hum. |
|
|
An IIR filter: Butterworth, Chebyshev I/II or Bessel; lowpass, highpass, bandpass or bandstop. Tustin with prewarped edges by default, so the cutoff is exact at any step. |
|
|
One second-order section from the Audio EQ Cookbook: lowpass, highpass, bandpass, notch, allpass, peak, lowshelf or highshelf at freq with q (and gain_db for peak and shelves). |
|
|
The mean of its last window samples (every step, or every sample_time). |
|
|
The median of its last window samples: removes spikes and keeps edges. |
|
|
An exponential moving average: y += alpha (u − y) every step (or sample_time). Smaller alpha, smoother. |
|
|
Follows its input no faster than rise up and fall down, per second: an actuator’s slew limit. |
|
|
Gear play: the output moves only once the input crosses a gap of width, then follows at its edge. |
|
|
The input in steps of interval, rounded or floored: what an ADC or an encoder reads. |
|
|
A switch with hysteresis: on_value once the input reaches on_at, off_value once it falls to off_at. |
|
|
The friction force at velocity u: Coulomb, viscous, and a Stribeck peak (static) near rest. |
|
|
Sums its input times the step (or sample_time): forward, backward or trapezoid. lower < upper limits it (equal: none); reset > 0.5 returns it to initial. |
|
|
Samples its input every sample_time and holds it: what a digital controller sees. |
|
|
Samples its input every sample_time and extends the line through the last two samples between. |
|
|
The difference of its last two samples over the step (or sample_time); unfiltered, see derivative. |
|
|
Its last taps samples as a numbers list, newest first (this step’s input included). |
|
|
Discretizes x’ = A x + B u at dt: Ad and Bd as matrix text, by zoh (exact for a held input) or tustin. |
|
|
The optimal state-feedback gain K (u = −K x) for weights Q (states) and R (inputs), and the Riccati solution P, as matrix text. A number for Q or R is that times the identity. |
|
|
The state-feedback gain K that puts the poles of A − B K at poles (like -1 -2+3j -2-3j), as matrix text. One input. |
|
|
The steady-state Kalman gain L for process noise Q and measurement noise R, and the error covariance P, as matrix text: the gain an observer takes. |
|
|
u = −K x + N r. Wire an lqr or place block’s K into the K input, or type K. N empty: the identity. |
|
|
Estimates the state from u and y: x̂’ = A x̂ + B u + L (y − C x̂). L from kalman_gain or by hand. No feedthrough, so it can close a loop with state_feedback. |
|
|
A discrete Kalman filter: each sample (every step, or sample_time) it predicts with A, B and u, then corrects with y. Q: process noise, R: measurement noise (a number is that times I). |
|
|
Solves a condensed QP every clock step (A, B, Q, R, N, u bounds from a JSON file). |
|
|
Solves a linear program every clock step from a JSON file. |
|
|
Solves a nonlinear program every clock step from a JSON file (needs Ipopt). |
group#
Block |
Type |
What it does |
|---|---|---|
|
An input of the subsystem or story it is in: a port on the group’s block outside, named by name, and its value here. |
|
|
An output of the subsystem or story it is in: what is wired to it leaves by a port on the group’s block outside, named by name. |