The Basics of Feedback Control Systems and PID Control - 180D-FW-2023/Knowledge-Base-Wiki GitHub Wiki

Introduction

At the core of any control system is a control loop, which consists of a controller, system, and sensor. In a closed loop feedback system, the output of our system modifies the behavior of our controller. A simple diagram of an electric clothes dryer is pasted below:

image

In the above example, we have a controller, a sensor, and our system would consist of the heating elements and the clothes together. The output of our clothes dryer, the actual dryness of our clothes, is fed back into the controller to allow our control system to correct itself if the clothes are actually too dry or if the clothes are actually too wet.

This simple example provides a basic use case of a closed-loop control system, however many control systems use a more complicated feedback control technique called a PID Controller. A PID Controller is a type of closed-loop control system that utilizes three terms for continuous control correction: a proportional term, an integral term, and a derivative term. The purpose of this article will be to provide more background information on closed-loop control systems, as a primer for the rest of this article which will be dedicated to exploring the basics of PID controllers.

Closed-Loop Control Systems

In a closed loop control system, the output: y(t) is fed through the sensor to then be compared with the desired reference input: r(t). The difference between the input and output is called the error, and can be shown as: e(t) = r(t) - y(t) . This error is then fed into the controller to continuously modify our output. A very general closed-loop system is pasted below to help visualize the flow of these variables:

image

With this in mind, we have the prerequisite background to begin exploring PID Controllers.

PID Controllers

Before we discuss how a PID controller actually works, it would make sense to give more background information so that it is clear as to why we would need to learn about a PID controller in the first place.

Background

A PID controller is a control loop feedback mechanism which is widely used in industrial control systems. It is the most commonly used control algorithm in industry, which can be attributed to its great performance as well as its approachable functionality, which makes it not too difficult for engineers to operate.

So, because the PID controller is so widely used, and incredibly common in countless practical applications, it would make sense to dedicate a good portion of this wiki post to understanding this particular control algorithm, so that we have a certain familiarity should we come across one.

Core Functionality

A PID controller utilizes a closed feedback loop structure, and so it still calculates an error as e(t) = r(t) - y(t). Similarly to a regular closed loop control system, the goal and ultimate function of the controller is to minimize the error.

Let us use the following controls diagram as the centerpiece of our following discussion:

image

Assuming the controller in the above diagram is a PID controller, the output of a PID controller for the above diagram would be:

image

From this equation and the above diagram we can gleam the meaning of the acronym PID, it is proportional, integral, and derivative.

To deconstruct and understand this equation and diagram, it would be helpful to investigate the PID controller one term at a time, and so that is exactly what we will do.

Proportional Term

In essence, the proportional term is related to the current, real-time error value of our system. It doesn't take previous or potential future error values into account. So if our error is large at a particular instant in time, the output of our proportional term will also be large. For the proportional term, the real-time error is multiplied by Kp, which we call the proportional gain. This gain is responsible for determining how heavily our present error is weighted relative to our past error and potential future error, as the proportional gain simply changes the scaling of our present error.

And so, our proportional term is written as: Kp*e(t)

When choosing a value for Kp, the goal is to have enough error correction such that a closer-to-desired outcome is achieved, without having it too high so as to avoid dealing with potential overshoot corrections.

Integral Term

For our integral term, it is equal to: image

It is important to note that it is proportional not only to the magnitude of previous error values, but also to the duration of error (since we are integrating from the start of our process up to the current moment in our process). When we compute our integral, it gives us our steady-state error, which is an error that in an ideal scenario should not exist. We can think of our steady state error as an error that still exists even after our system has settled, it's like a constant offset that prevents our system from settling to the desired value. And so, this accumulated error is multiplied by Ki, our integral gain, and then it is added to the output of our controller.

The purpose of the integral term then is to minimize our steady state error. We will not reach our desired outcome perfectly, but the goal of the integral term is to minimize this error, not to get rid of it totally and completely, which would be unrealistic and unattainable.

Derivative Term

Our derivative term is equal to: image

We calculate this term by taking the derivative of the instantaneous error, and then multiplying that derivative by our derivative gain, Kd. The derivative term is predictive by nature (utilizes the rate of change as its core deterministic value) and so we can think of it as a term that predicts the behavior of our system and attempts to stabilize it. For example, our derivative term can be used to minimize the overshoot of our system, as it can detect that there is a potentially large rate of change for our error, and reduce the incoming intensity of that change accordingly, and prevent hyper-intense overcorrection.

Conclusion

And so, this gives us an understanding of PID control and the behavior of each term within this controller. We can now associate the proportional term with current error, the integral term with past error/cumulative error, and our derivative term with the rate of change of error. So, we see that all the individual terms of this PID controller work in tandem to provide us with a feedback based controller that results in our control system outputting a stable output that is close to our desired output (assuming we have selected our gain terms appropriately).

References:

  1. https://www.electronics-tutorials.ws/systems/closed-loop-system.html

  2. https://eng.libretexts.org/Bookshelves/Industrial_and_Systems_Engineering/Chemical_Process_Dynamics_and_Controls_(Woolf)/11%3A_Control_Architectures/11.01%3A_Feedback_control-_What_is_it%3F_When_useful%3F_When_not%3F_Common_usage.

  3. https://ctms.engin.umich.edu/CTMS/index.php?example=Introduction&section=ControlPID

  4. https://medium.com/autonomous-robotics/pid-control-85596db59f35