PID Controllers explained without Maths
PID controller is an essential control tool and widely used in industry for many process automation applications. Therefore, it is important to understand the concept of a PID control with underlying mathematics if you are from an engineering or technology background. However, in this article, we skip the math and only discuss the concept of PID control for the ease of understanding.
The basic idea of a PID controller is to use closed-loop feedback to control the process variables. Therefore, we can start with a simple control system with a Plant and a Controller. For simplicity let us start with the Plant or the system we want to control or change the behaviour. In the right-hand side of figure 1, we have a simple plant or with the input feeding into the plant and the output coming out from the plant. The goal of control engineering is to develop an appropriate input signal to plant so we would get the desired output. Now let us focus on the controller in the middle. In the left end of figure 1, we have something called reference or what we want our system to do. Some often call this command variable as well. What we do here is we compare the output of the plant with the reference. The output of the system is fed back to compare and control the system. That is why this process is known as feedback control. The difference provides us with how the plant has deviated from the desired behaviour or the error of the system in other words. This so-called error would be zero if the output is exactly equal to the reference and that is the expected behaviour of the system. Therefore, we introduce the controller to fix that by taking the error and transform it into a suitable input signal to the plant so we get the desired output. However, this does not happen in one shot mostly but over time. As the controller generates input signals based on the estimated error such a way that the error goes down to zero.
Let us take a practical example to understand how error can be used by the controller to generate input signals to the plant. We have a mobile robot that requires to move a desired distance. Now in terms of control systems, the plant is the robot, the input is the robot speed, the output is the distance from beginning, and the reference is the distance we want it to move. In the beginning, the error is equal to the reference. Let us say that the controller can decide the robot speed based on that error. We can set an arbitrary proportional gain as the multiplier term for the controller. Error multiplied by the proportional gain provides the controller output or the speed input to the robot. Therefore, the robot has the maximum speed due to the maximum error at the beginning. As it moves forward the error decreases and hence the speed as well. When it reaches very close to goal the speed would tend to zero and stops eventually. One can nicely plot how distance from starting point increase and how speed is gradually decreasing over time. Furthermore, changing the multiplier term, it can change the rate of change of speed. This type of controller is called a proportional controller.
However, this proportional controller does not solve everything. Let us clear this by thinking of an altitude controller of an aerial drone. To hover it at a desired altitude, the trust generated by drone propellers must equal to the weight. But first, the drone has to reach the desired altitude. We can use the same proportional controller to control the thrust of the drone propellers, which means the thrust is now proportional to the error. The error explains the difference between the current altitude and the target altitude. At the beginning due to maximum error, the propeller will create a significant thrust that the drone will lift off from the ground or altitude zero and go up while overcoming the weight. The drone will reach close to the desired hovering altitude as it rises.
Now the error will become very small or tend to zero and hence the thrust will also go to near zero. This would create a loss of trust to keep up the upward motion and start falling due to gravity. When it loses altitude the thrust would again start increasing as the error grows which sensed and reacted by the controller. This happens because the controller is only focused on the present error of the motion. The oscillating motion of going up and going down will damp until the error related thrust is equal to the weight of the drone and will not reach the desired altitude eventually. Even though we increase the proportional gain, the error term will always dominate the thrust and when the error is reaching zero, the thrust will also reach zero. One can argue that by introducing a bias term to the thrust equation to compensate the weight of the drone might solve the problem and it is also possible. But our goal is to create a stable controller. This particular error related to height is where the drone eventually hovers. However, this steady-state hovering altitude will always stay below the desired altitude. Furthermore, this particular error is known as the steady-state error.
Now the goal is to avoid this steady-state error and this can be done by letting the controller use the past information of motion. To achieve this, we can introduce an additional integrator part to our proportional controller in parallel as shown in figure 2. As integrator keeps a running sum of the input over time, it enables us to keep a memory or an idea of what happened in the past. Now let us call our modified controller as a proportional integral controller. With this new controller, we can consider both past and present errors. When the drone reaches a steady state like discussed before. The integrator part will sum up that non zero error and as a result, the combined output from both parts will increase. As a result, the drone would keep going up towards the target hight. When the error becomes very small as it reaches the desired altitude, the contribution from the proportional part becomes very small or zero. But the integral part would not become zero as there is a non zero error sum and will not let the drone to lose altitude but to keep moving up, which is nice since we have not reached the target altitude yet. Eventually, the drone would hover at the desired altitude but after an oscillatory behaviour due to excess thrust generation.
This is acceptable as the discussed controller fulfils our requirement. However, depending on how the drone has climbed up to the desired altitude, the integration part may have summed up the error that could generate an excess thrust. Due to this, the drone could fly over the desired altitude and create an overshoot. But the negative error from overshoot would again bring down the drone to by reducing the thrust. Eventually, such behaviour will create an oscillating like behaviour before hovering at the target altitude. The occurred overshooting and oscillating behaviour might not desirable since our effort is to develop a stable controller. This can overcome by introducing a derivative part to the controller parallel to the existing two parts as shown in figure 3. By introducing the derivative part, we can predict how fast the error would change while enabling us to predict how the motion will change. Now let us apply this future prediction part to the drone example. Let us say the drone is moving up towards the desired altitude and the error is reducing. Therefore, the rate of change of error would be a negative value. Now, this negative value, which is the output from the derivative controller part will make a negative effect on the overall controller output and hence lowers the thrust. The idea here is to use the rate change of error to determine whether the drone reaches the target altitude fast or slow. Furthermore, the size of the derivative controller output would determine how fast the drone accelerating or decelerating regardless of the sign. Importantly, the derivative controller part slows the drone down prematurely if it is moving too fast while preventing or minimizing undesirable overshoot.
Now our controller is upgraded to a proportional integral derivative controller or PID controller. It is capable of examining how the error has changed, how the error changes, and how the error would change based on the closed-loop feedback and then outputting appropriate control signals to the plant. One can decide how far these 3 sub-controllers should contribute to the overall output by introducing weights to each part. This is also known as tuning the controller and it is decided during the design phase of the PID controller. PID controllers are so popular because they can be used for a wide variety of real applications successfully such as industrial process control, robotics, mechatronics systems, and many more.
In this article, we have discussed how a PID controller works with a little bit of control theory without involving maths. It is important to understand the math behind and designing PID controllers. Popular tools such as MATLAB can be easily used to design PID controllers and to develop systems for real-world applications. I hope the used examples helped readers to clear the idea. Moreover, I look forward to discussing more on this and other control systems involved topics on later articles.