Introduction
A PID (Proportional–Integral–Derivative) control loop is a common feedback mechanism used to keep a system’s output at a desired value (the “setpoint”) by continuously adjusting its input. Think of it like the cruise control in a car: you set a target speed and the system automatically speeds up or slows down to maintain that speed, even if the road’s slope changes.
The Three PID Terms
A PID controller computes its output by combining three error terms to calculate the magnitude of actuator response needed to adjust the process value towards the setpoint:
Proportional (P)
Correction - current error
Kp scales how strongly the controller reacts to the error right now.
Large Kp → quick response but may overshoot; small Kp → slow, steady approach.
Integral (I)
Correction - accumulated error over time
Ki addresses any persistent offset (“steady-state error”) by summing past errors.
Helps eliminate long-term bias (e.g., if the DO is always 2% below setpoint).
Derivative (D)
Correction - rate of change of error
Kd predicts future error by looking at how quickly the error is changing.
Dampens oscillations and improves stability by resisting sudden changes.
Tuning PID controllers
PID controllers can be tuned by some established methods, but often a little bit of trial and error is often involved to find the best parameters for stable but responsive control of a particular system.
Rules of thumb
1. Starting from scratch
If starting from a completely unknown state, it is generally advised to start with P gain, increasing it slowly while the system is active, until oscillations occur. Once P is high enough to cause oscillations, then reduce it back down to stable control and add a small amount of I. The I should be sufficient to compensate for any constant offset from the target setpoint. If needed, add D to reduce overshoot as needed. Adjust one parameter at a time, observing the effect on the system's response (overshoot, settling time, stability).
Play with an example system at: pid-tuning-game.streamlit.app
A well-tuned PID system should respond swiftly to meet setpoint, but also should have minimal overshoot once it reaches that value, and should hold stable at setpoint over time.
If an oscillation or “cycle” takes 30 minutes, for example, you may have to wait 60-90 minutes to fully observe the impact of your changes.
2. System oscillating strongly
A strongly oscillating system usually indicates too much P, D, or both. Observe which ones seem to be the dominant contributing factor to the overall response signal, then cut by 50% or more at a time and observe the response.
If an oscillation or “cycle” takes 30 minutes, for example, you may have to wait 60-90 minutes to fully observe the impact of your changes.
3. System responding too slowly
Too little P can lead to a sluggish response, as can a low I if the system lends itself to being primarily controlled via I-term. If the system is very slow to change demand, add I, but if faster response is needed then P should be increased.
If an oscillation or “cycle” takes 30 minutes, for example, you may have to wait 60-90 minutes to fully observe the impact of your changes.
4. System overshooting setpoint
Too little D to balance out a strong P response can lead to overshoots. Try increasing the D-term to dampen the signal when slope is steep. Be cautious, as too much D-term can lead to very similar results as too little.
If an oscillation or “cycle” takes 30 minutes, for example, you may have to wait 60-90 minutes to fully observe the impact of your changes.
5. System never reaches setpoint
If the system responds quickly and without oscillations, but never reaches setpoint, more I-term is likely needed. The I constant helps correct long-term offsets in the control loop that can’t be resolved with P and D.
If an oscillation or “cycle” takes 30 minutes, for example, you may have to wait 60-90 minutes to fully observe the impact of your changes.
Culture’s PID loops
Thermal control
Control of process temperature is managed by a nested PID loop. The primary loop uses the main process temperature reading to set a target temperature for the heating/cooling block that wraps around the vessel. A second loop uses a thermistor inside the metal block as feedback for controlling power to the heating/cooling element to achieve the desired temperature setpoint. The secondary control loop is hidden from user control, so the primary one can be treated like a normal PID for tuning purposes.
DO control
Control of process oxygen concentration is controlled with an Incremental PID loop (sometimes called Velocity PID). In this style of PID control, rather than calculating the absolute control signal, the controller calculates the change in control signal that should be applied to the setpoint. This has some advantages in numerical stability and reducing integrator windup.
pH control
The control loops for acid/base control (pumping and/or CO2 sparging) are classical PID loops with some modifications:
Within user specified deadbands, calculated rates are overridden to zero
Maximum allowable rates of pump/sparge can be applied, and the lesser of (PID, max) will be applied
Independent parameters are available for certain cases (e.g. separate kD values depending on whether pH is increasing or decreasing)
Check the available values in the script editor or live controls to see what parameters are available for tuning.
Download the guide here:
