AI Glossary / Graphs and symbolic AI / Intermediate
PID controller
Definition
A PID controller is a feedback controller that combines proportional, integral and derivative contributions to produce a control command. These terms respond to current error, accumulated error and the rate at which error changes.
What it means
The controller compares a desired value, called the setpoint, with a measured process output. The difference is the error. It then adjusts an actuator command, such as heater power or motor input, according to the chosen controller form and gains.
The proportional term reacts to the present difference. The integral term accumulates that difference over time and can help remove persistent offset. The derivative term responds to change and can help damp motion or anticipate the trend under an appropriate design.
PID is a control method, not inherently a machine-learning algorithm. Its gains may be selected manually, through model-based tuning or by an automated procedure. The presence of all three terms does not guarantee stability or good performance.
How it works
In the ideal parallel form, define error e(t) = r(t) − y(t), where r is the setpoint and y the measured output. The command is u(t) = Kp e(t) + Ki integral(e(t) dt) + Kd de(t)/dt, with any bias or feedforward contribution specified separately.
A digital implementation approximates integration and differentiation using samples. The sample interval, numerical method and gain convention must be consistent. Standard and parallel PID forms use different parameterizations, so numbers cannot always be transferred unchanged between products.
Practical implementations commonly filter derivative action because differentiation is sensitive to measurement noise. They may differentiate the measurement instead of the full error to reduce abrupt responses to setpoint changes.
Actuator limits are also important. If a command saturates while the integral continues accumulating, windup can cause delayed recovery. Anti-windup methods manage that internal state; simply clipping the final command does not necessarily address it.
Three practical examples
1. Temperature regulation: A controller adjusts heating input to keep a process near a target temperature. Thermal delay and actuator limits affect the tuning and response.
2. Motor control: A loop adjusts an input to regulate speed or position. The appropriate structure depends on the motor, load and sensing arrangement.
3. Process automation: A feedback loop regulates a measured flow or level while responding to disturbances. Its performance must be assessed over the relevant operating range rather than one convenient test point.
Think of it this way
Think of correcting a tracking task using three notes: how far away you are now, how much error has accumulated and whether the gap is widening or closing.
The analogy describes the three contributions, not a universal recipe for correction. Their effects depend on the dynamics of the controlled process, delays, units, gain signs and physical limits.
Worked example
For a simplified discrete calculation, let the sample interval be 0.5 seconds. The previous error is 1.5 units and the current error is 1.0 unit. The stored integral before this step is 2.0 unit-seconds.
Using a rectangular update, the new integral is 2.0 + 1.0 × 0.5 = 2.5 unit-seconds. The finite-difference derivative is (1.0 − 1.5) / 0.5 = −1.0 unit per second.
Choose teaching gains Kp = 2, Ki = 0.4 and Kd = 0.3 in consistent units. The proportional contribution is 2.0, the integral contribution 1.0 and the derivative contribution −0.3. Their sum is a command of 2.7 output units.
If the actuator limit is 2.0, the applied command saturates at 2.0. That clipping does not erase the stored integral of 2.5. An anti-windup design determines how the integral is managed. This single-step calculation does not establish closed-loop stability.
Illustrative case study
In a fictional project, Willow Control tests a simulated heating loop with an output limit. During a large setpoint change, the controller requests more power than the simulated actuator can deliver, while the integral continues growing.
When the temperature approaches its target, the accumulated integral keeps the requested power high. The team adds an appropriate anti-windup mechanism and retests disturbances, saturation and setpoint changes before drawing conclusions about the design.
The case illustrates a controller-state issue rather than a tuning recipe. The correct remedy depends on the process model and actuator behavior, and a successful simulation is not a substitute for validating an actual installation.
Common misconceptions and mistakes
- PID automatically learns the best gains. Learning is not part of the basic definition.
- Integral action always improves a controller. It can create overshoot or windup if poorly designed.
- Derivative action predicts the future perfectly. It responds to estimated change and can amplify noise.
- Limiting the output always prevents windup. The internal integral may continue growing despite saturation.
- Gains can be copied between any controllers. Units, sample time and parameterization can differ.
Business use
PID is relevant when a business process depends on stable physical regulation. Assess the controller together with the plant, sensor, actuator and operating conditions rather than treating it as an isolated software feature.
Useful evaluation includes response time, overshoot, steady-state error, disturbance rejection and behavior at limits. The tradeoffs should reflect the actual process. A fast response may be undesirable if it creates excessive wear or violates operating constraints.
When comparing implementations, identify the controller form, derivative filtering, anti-windup method and sample timing. Keep separate evidence for simulation, commissioning and operation. A numerical example of the PID formula demonstrates arithmetic, not suitability for a specific machine.
People also ask
Must every PID controller use all three terms?
The full form includes them, but P, PI and PD variants set selected contributions to zero or omit them.
Can integral action remove a constant offset?
It can under suitable stability and controllability conditions, but actuator limits and other constraints may prevent the target from being reached.
Why filter the derivative?
Differentiation can magnify rapid measurement noise, so practical designs often limit that effect.
Check your understanding
Why does saturating the worked command at 2.0 not automatically solve windup?
Answer: Saturation limits the applied output, while the integral is a separate stored state. That state needs appropriate management when the requested output cannot be applied.
Related terms
- PD controller
- Feedback control
- setpoint
- proportional control
- integral action
- derivative action
- actuator saturation
- anti-windup
Learn next
Recalculate the example with a different sample interval while keeping the physical units explicit. Track both requested output and stored integral. Then compare a saturated controller with and without a specified anti-windup rule in a safe simulation.
More in Graphs and symbolic AI
- Phoneme - A phoneme is a contrastive sound category in a language: replacing it with another phoneme can distinguish one word from another.
- Phrase search - Phrase search retrieves text in which a sequence of query terms occurs with specified positional relationships, usually adjacent and in the same order for...
- Phrase structure - Phrase structure is the hierarchical organization of a sentence into constituents, such as noun phrases and verb phrases.
- Pipeline architecture - Pipeline architecture organizes a system into processing stages whose outputs feed later stages.
- Plan recognition - Plan recognition is the task of inferring an agent's possible plans from observations of its behavior and relevant context.
- Planar Drawing - A planar drawing represents a graph in the plane with distinct points for vertices and edges that meet only at shared endpoints.
Sources
MathWorks explains PID forms and derivative filtering: https://www.mathworks.com/help/control/ug/proportional-integral-derivative-pid-controllers.html
Its anti-windup example explains saturation and integral-state handling: https://www.mathworks.com/help/simulink/slref/anti-windup-control-using-a-pid-controller.html
The numerical step and Willow Control case are original teaching examples, not hardware settings.
Previous: Physics-informed neural networks Next: Pie chart