TMC #0011: Cybernetics: Feedback Control & Wiener Predictor
A pure-Python simulation of Norbert Wiener's cybernetics (1948): PID feedback control of a thermal plant, open-loop vs closed-loop comparison, and a causal Wiener-Hopf optimal predictor on a random walk.
Wiener's 1948 Cybernetics proposed that negative feedback is the common mechanism behind thermostats, nervous systems, and anti-aircraft gun predictors alike. This simulator demonstrates both of the core mathematical results Wiener derived: the PID feedback control loop and the Wiener-Hopf optimal predictor.
What It Includes
ThermalPlant: A first-order discrete-time thermal system: . Euler-integrated with configurable time constant and ambient temperature.
PIDController: Full proportional–integral–derivative controller: . Includes integral windup and output clamping.
Open-loop vs closed-loop demo: Simulates 300 timesteps of a thermal system targeting 70°C with a fixed heat input (open-loop) versus a PID controller. Shows steady-state offset, overshoot, and settling time side by side.
Wiener-Hopf predictor: Discrete causal optimal predictor using the Yule-Walker autocorrelation equations, solved via pure-Python Gaussian elimination (no NumPy). Compares Wiener predictor MSE against naive last-value prediction on a 200-step random walk.
Running It
python cybernetics_sim.py # all demos
python cybernetics_sim.py --demo thermal -v # thermal system with time series
python cybernetics_sim.py --demo prediction # Wiener-Hopf predictor only
No external dependencies: pure Python 3.10+.