Expand description
Advanced control algorithms — adaptive PID tuning, Model Predictive Control, and MIMO
state-space — complementing the PID/anti-windup loops in the parent module. Pure f64 math,
zero-heap (caller-supplied buffers; bounded loops).
Functions§
- adaptive_
gains - Scale a PID gain triple by a scalar
adaptationfactor — the simplest gain-scheduling step (retune as the operating regime changes). Returns(kp, ki, kd). - mimo_
output - MIMO output equation
y = C·x + D·uwithpoutputs:cisp×n(row-major),disp×m(row-major); the output is written toout(len p). Zero-heap. Returnsfalseon a mismatch. - mimo_
step - MIMO state transition
x' = A·x + B·ufor a system withnstates andminputs.ais then×nstate matrix (row-major),bthen×minput matrix (row-major),xthe state (len n),uthe input (len m); the next state is written toout(len n). Zero-heap. Returnsfalseon a dimension mismatch. - mit_
rule_ adapt - MIT-rule online gain adaptation (model-reference adaptive control): nudge
gainto reduce the trackingerror—gain + adaptation_rate · error · signal. One adaptation step. - mpc_
control - One-step Model Predictive Control for a scalar LTI plant
x_{k+1} = a·x_k + b·u: search candidate controls across[u_min, u_max](a grid ofsteps+1 points), simulatehorizonsteps holdingu, and return theuminimisingΣ (setpoint − x_k)² + control_penalty·u². The optimal FIRST move of the receding horizon. Zero-heap (bounded loops, no allocation). - scheduled_
gain - Gain scheduling: linearly interpolate the gain between
low_gain(atop_min) andhigh_gain(atop_max) for the currentop_point— adaptive tuning across the operating envelope. Clamps outside[op_min, op_max].