Skip to main content

Module control

Module control 

Source
Expand description

Control theory and systems: PID, state-space, transfer functions, Bode analysis, LQR, Kalman filter, MPC, adaptive control, fuzzy control, and neural controller.

Structs§

AdaptiveController
Model Reference Adaptive System (MRAS) controller using the MIT rule for parameter adaptation.
BodeAnalysis
Bode frequency response analysis for a SISO transfer function.
FuzzyController
Mamdani fuzzy controller with triangular MFs and centroid defuzzification.
FuzzyRule
Fuzzy rule: (input_mf_index) → (output_mf_index).
KalmanFilter
Full linear Kalman filter with predict and update steps.
LqrController
Linear Quadratic Regulator (LQR): computes optimal gain matrix K via Discrete Algebraic Riccati Equation (DARE).
ModelPredictiveControl
Simple linear MPC with prediction horizon N, tracking and input penalties.
NeuralController
Simple multi-layer perceptron (MLP) neural network controller.
Pid
Proportional-integral-derivative (PID) controller with anti-windup and derivative filter.
ReplayBuffer
Simple experience replay buffer for neural controller training.
StateSpaceModel
Continuous or discrete linear state-space model: ẋ = Ax + Bu, y = Cx + Du.
TransferFunction
SISO transfer function defined by numerator and denominator polynomials (descending powers).
TriangleMf
Triangular membership function: zero outside [a, c], peak at b.

Constants§

TWO_PI
Constant π exported for convenience.

Functions§

controllability_matrix
Compute controllability matrix: [B, AB, A²B, …, A^(n-1)B].
pole_placement
Pole placement: compute state feedback gain K such that eigenvalues of (A - B*K) match desired poles (Ackermann’s formula, SISO only).
riccati_solve_dare
Solve the Discrete Algebraic Riccati Equation (DARE) iteratively. Returns gain matrix K = (R + BᵀPB)⁻¹ * BᵀPA.
zoh_discretize
Zero-order hold (ZOH) discretization of continuous-time A matrix. Uses Padé approximation: e^(Adt) ≈ I + Adt + (A*dt)²/2 + …