Active implantable and wearable medical devices (insulin pumps, pacemakers) are closed-loop
PI controllers: a noisy sensor measures a physiological variable, the error against a fixed
setpoint drives a bounded actuator, and the plant itself keeps drifting and absorbing external
disturbances (a meal, exertion) the whole time.
error(t) = setpoint - measured(t)
integral += error(t) * dt
u(t) = clip(Kp*error + Ki*integral, -limit, +limit)
plant(t+dt) = plant(t) + (u(t) - naturalDrift + disturbance) * dt
measured(t) = plant(t) + noise * randn()
- Controller gain (Kp) — proportional response to the current error; too low under-corrects, too high overshoots and rings.
- Integral gain (Ki) — accumulates the error over time to erase steady-state offset the proportional term alone can't reach.
- Sensor noise — measurement noise the controller reads on top of the true plant value; high noise excites the actuator on nothing.
- Actuator limit — the physical delivery ceiling (e.g. maximum insulin infusion rate) the corrective signal is clamped to.
Closed-loop insulin pumps ("artificial pancreas" systems) run exactly this loop in a wearable
device, absorbing meal-driven glucose spikes without the patient calculating every dose by hand.