What The Hell Is A PID Controller?
A PID Controller is a box of electronics (or pneumatics if you go back more than about 30 years) that controls a physical property of a process so that it stays at a user defined setpoint.
Examples of a PID Controller:
- Your Airconditoning System - The PID Controller keeps your home's temperature at a comfortable temperature no matter what the weather.
- Your Car's cruise control - The PID Controller keeps your car at a constant speed, set by you, whether you are going up or down a hill, into or out of the wind.
A PID Controllers' primary role in life is to control.
One dictionary definition of the word control is:
–verb (used with object)
to exercise restraint or direction over; dominate; command.
Engineers usually use the word to mean something along the lines of:
The applied science of changing the dynamic behaviour of a physical process to get a desired outcome.
Examples of modern control systems in use every day are:
- Aircraft Autopilot Systems
- Car Engine Management Systems
- Hot water thermostats
A control system (PID or otherwise) is the combination of a controller with a physical process. The control system will also need a sensor and an actuator.
The sensor senses the physical conditions of the process, and relays this information to the controller. The controller uses this information to decide what to do next to reach it’s progeammed, desired objective and sends a command to the actuator to alter the process behaviour. Hopefully in a way that makes the process get closer to its objective. e.g. get the jumbo nearer to the runway!
Control systems can be classed as:
- Open Loop, or
- Closed Loop
Open Loop Control
In an open loop system, the controller is told what the desired process output is, and the controller sends a command to the actuator to try and achieve this. The process is shown below as a block diagram:
An example of open loop control is a cheap electric heater.
Referring to the block diagram above - our Desired Process Response is a comfortable temperature in the room.
The controller is the person in the room who switches the heater on when he feels a bit chilly.
The actuator is the heater itself.
The plant is the thermodynamic behaviour of the room. Which is a fancy way of saying ‘how much heat the room loses’.
If there is no further intervention once the fire has been switched on, then the process-output (the room temperature) will eventually settle at a constant temperature. This temperature is dependent on two things:
- The amount of heat gnerated by the fire
- The heat losses from the room
These 2 factors are the only things that will affect the final temperature. For example: If the heater is too powerful and/or the room is super-insulated, we will get too hot.
Closed Loop Control
Of course, what happens in the real world is that if the person in the room gets too hot, she switches the heater off.
If she does this then she has just upgraded herself to a closed loop controller.
She sensed the temperature was too hot, and processed a simple control algorithm with the rules:
If temperature is more than comfortable
switch heater off.
This is the simplest of closed loop control systems and the human is playing the part of the controller.
It is shown in the block diagram below. It is called on/off control or Bang-Bang control because the resolution of control is either 100% on or 100 % off:
Closed Loop PID Control
If we want to to have better control over our temperature we can replace the bang-bang controller with a much more refined beast: the PID controller.
The PID controller will look at:
- the temperature setpoint (what you have decided is your ideal temperature)
- the actual temperature in the room
and come up with a 'temperature error'. It will put this number though an internal equation called a PID Algorithm, and decide how much the system needs to heat or cool the room on a scale of 0-100%.
The PID Controller will then instruct the Airconditoning system to heat or cool by this much. As the room gets closer to setpoint the PID Controller will reduce its output to suit.
If your PID Controller Tuning has been done well, then the result will be a room at your desired temperature plus or minus about half a degree, all day long.
If you want to understand exactly how the PID Algorithm in the PID Controller works, then there is an Idiot's Guide to the PID Algorithm that I have written. A lot of people who have read it claim that is the best explanation of PID they have ever read...