Control theory – types of control algorithm
Control theory – types of control algorithms Here at Visaya we’ve talked a lot about controllers, control systems, and control loops.
Control theory – types of control algorithms
Here at Visaya we’ve talked a lot about controllers, control systems, and control loops. Now let’s talk about control theory, the principles behind all the logic. We have many types of control algorithm, and each has a certain complexity and purpose. Which one to use will depend on your system.
The most common control algorithm out there is the proportional-integral-derivative (PID) control. If you’ve never heard of it, don’t worry; we’ll review it in this article. Then if you want to learn more, we also have an entire article about PID controllers.
But before we talk about the different control algorithms, let’s back up to a pertinent question:
What is a control algorithm?
A control algorithm is a type of logic programmed into a controller to analyze the error between a measured value (MV) and a setpoint (SP). This logic helps the controller process field data and decide what to do.
Take an air conditioning unit, for example. When you set the AC’s thermostat at a temperature you like, you give your controller its SP. The unit will then measure the room temperature through its sensor and compare it to the SP you chose. If it reads the temperature as above your SP, then it’ll generate an error.
Here the control algorithms come into play. How it’ll adjust will depend on your control logic. Many ACs use a logic called bang-bang control or on-off control. This simple control algorithm does only two things. If it registers the temperature as over the SP, then it turns the AC on. Once the temp reaches the SP, it turns the AC off.
However, you could adjust the temperature more precisely with fuzzy logic. This way, the AC would adjust its power depending on how close it gets to the SP. PID control would give you an even more precise way to adjust. Now let’s go into how each of these control algorithms works.
Bang-bang control, the simplest control algorithm out there, goes by several other names as well: on-off, hysteresis, two-step. But all of these refer to the same type of control logic.
This control system turns a unit on or off to bring your MV closer to your SP. Coming back to the AC example, the controller will compare the room temperature with your setpoint and use true/false logic. If the temperature rises above your SP, then the output reads as true and turns the AC on. A false output turns the AC off. Simple, yes?
This can happen either mechanically or electronically, depending on your application. You’ll find this logic in home applications and simple industrial processes because it’s easy to set up and inexpensive. However, you won’t get high accuracy or quick response with this type.
Unlike on-off logic, fuzzy logic can have more than two output states. This logic can read a measurement as partly true or partly false. How so? Well, if we think about Boolean expressions, then we have one as a true value and zero as a false value. In fuzzy logic, a measurement can fall anywhere between zero and one.
Okay, let’s have a real example to make it easier to understand. Imagine you have a boiler to heat up water from 18 to 100 degrees Celsius. If we used a bang-bang controller, then the water could only have two states, cold (false) or hot (true). However, water doesn’t just switch from cold to hot. In the process, it gets warm, doesn’t it?
Let’s set our values as zero for cold water and one for hot. In fuzzy logic, the water at 18 degrees would have a value of 0.18, partly cold. As the water gets warmer and warmer, the value of your output starts to increase. Now, with this kind of logic, you could also control the power of your heater. Instead of having it at full power until the water reaches 100 degrees, you can reduce the power as your output gets closer to your SP.
Finally, we got to the most powerful of the control algorithms in this article. Here we’ll have just an overview. If you want to learn more about it, then read our PID controller article.
If you studied automation, then you probably had to study PID control in school. For those who forgot, PID stands for proportional-integral-derivative. The name comes from the three elements that form this control algorithm.
Each element will affect the process response to errors in a certain way. A good way to understand how it works is to split the elements into present, past, and future. So let’s check out how each element works on the error in your process.
Proportional – the present
The proportional term in a PID controller represents the present error. A proportional control algorithm multiplies the current error for a certain constant (Kp).
Let’s say you have a remote control car and want it to go from point A to point B, 100 meters away. At point A, you technically have an error of 100 meters. We’ll call the speed of your toy car your output here.If you have a Kp of 0.1, your speed would begin at 10 meters per second (m/s). As the car gets closer to the finish line, the error decreases, and so does the speed. At 25 meters, with the proportional control, the speed of the toy car would be 7.5 m/s. At the 50-meter mark, 5 m/s. When it reaches point B, the error of your system will eventually reach zero, and so will the car’s speed.
Integral – the past
The integral term of a PID controller deals with past errors. Let’s get our toy car back in here. In a proportional-only control, as your car gets close to the finish, it will move slower. The closer it gets, the slower it goes. This small error, called the steady state error, can take a long time to disappear.
The integral element in the PID control algorithm works to get rid of this steady state error. It runs on a short cycle, registering this small error in each cycle and adding it to the errors of the previous cycles. Adding these errors to the proportional equation makes the total error greater than it is at the present moment and help the system to eliminate it faster.
Derivative – the future
The derivative term is the fortuneteller. So it can predict the future and adjust the present accordingly. Sounds like a superpower, doesn’t it? Nope, just math.
The derivative term predicts outputs in the future based on the rate of change for the current error. Depending on how you tuned your system, in a P or PI controller you might go over your setpoint and get a negative error, which will make it adjust back to your SP. In control theory, we call this overshoot. But with the superpower of seeing the future, the derivative term can tell that the system will overshoot before it occurs and adjust your output to avoid it.
Bear in mind that you can have proportional-only (P), proportional-integral (PI), proportional-derivative (PD), or the complete PID controller. Each element of this control method tweaks certain characteristics of the response you get.
You can choose to use one or several types of control algorithms in your process. Your choices will depend on your system and its complexity. More than one type of control algorithm might suit your needs, so you should examine the advantages and disadvantages before deciding.
In this article, we reviewed what a control algorithm is and some of the most common types. You can find other control algorithms out there too, such as neural network control systems. However, the industry still uses PID control most often.