In last week's edition of Simple Saturdays, I talked about control loops. This week I will talk about the PID loop. Unlike many explanations of the PID loop, I will keep it simple. I will avoid showing the equation that a controller uses. The truth is that as a control engineer, I don’t need to know or understand the equation, I just need to know how to use it.
As I said last week, a control loop simply measures something, compares it with the number you want, then adjusts or changes something else to try and move the measurement closer to the number that is wanted. The PID loop is the most common way that control systems use to work out how much of an adjustment to make.
The PID loop gets its name from the three parts it is made of three:
The first thing the controller does is compare the measurement, also known as process value (PV) with what is wanted, the target or setpoint (SP). It then subtracts one from the other to get the Error. If the measurement is the same as the target, the error is zero (PV-SP=E=0). The further away the two numbers are, the bigger the error.
This is what is used to calculate the output (OP) that is sent to the control valve or pump speed.
The proportional part simply multiplies the error by some gain. The bigger the error, the bigger the move that is made. This is very fast to respond to sudden changes in the reading. This can help keep the measured value close to the target by quickly moving the output when a change is seen. The problems with the proportional part is that it can aggressively move the output, sometimes when it is not needed and can wear the output equipment out. It also ends up only responding enough to stop the error increasing as much, but it does not completely remove the error. If using only proportional control, there will always be a permanent offset when at steady state. If nothing else changes, the error will not be completely removed.
The integral part of the control loop adds up the error over time and uses this to change the output. While there is an error, it keeps slowly moving the output until the measurement matches the target. At this point, the integral part leaves the output allone. This is a slower response than the proportional control but it does help get rid of the permanent offset.
That is why using both parts are used together. The proportional reacts quickly to the move, and the integral helps get rid of the permanent offset and brings the error back to zero. And that is it really. That is how the majority of control loops work.
But I havent talked about Derivative part. The thing is, it is not often used at all. The derivative part, if used, looks at the rate of change of the error. If the error is getting bigger quickly, it moves the output more in an attempt to ‘catch’ the disturbance before it gets too large. It is a bit like the proportional bit but faster. In theory, by including the derivative part, you can build a loop that responds faster without becoming unstable. The problem is that the derivative responds to noise. Noise is any changes in what you measure, but not what is actually happening in the process. The measurement bounces around, even though the process is actually very steady. This can happen for lots of reasons, but if you have a controller that is looking at the derivative, the rate of change, of the error, then the controller will move the output unnecessarily. As a result this is not often used.
There are a few more things I could cover such as initialisation, how the system is started, and there are subtle differences in how different PID equations are set up and that changes how they respond in different situations. But the key points are:
- Proportional can make quick reactions to an unexpected error but leaves an offset
- Integral is slower to respond but removes the offset
- Derivative is rearly used.