HCBBS Forum (English)
Submit Chemical Projects / Find Solutions
Amplify Your Requirements on a Broader Chemical Platform *Engineering · Technology · Equipment · Solutions*
Submit Request

PID control parameters

2021-02-11View Original

Thread Content

While working on a competition project some time ago, I gained a slight understanding of the classic and practical PID algorithm, so I wrote this down to share it with everyone. I tried my best to explain the principles in the simplest terms possible, avoiding too much theoretical analysis. Therefore, the content below may contain inaccuracies or incorrect explanations. The experts have noticed this; please help me fill in the gaps or offer your criticism~~~ Thank you. Alright, let’s get to the main content. What is PID? Can PID be eaten? PID stands for “proportional, integral, derivative” and is a very common control algorithm. Algorithms cannot be eaten. By the day LZ posted this, PID had already been around for 105 years. It’s not something sacred; everyone must have seen practical applications of PID – such as in quadcopters, balance cars... as well as in a car’s cruise control system or the temperature controllers in 3D printers. Another example is sea lions in zoos that hold a pole upright on their heads (OOPS, that counts too).. In short, PID is extremely useful in any situation where it’s necessary to “maintain stability” of a certain physical quantity – such as keeping balance, stabilizing temperature, speed, etc. So here’s the question: For example, I want to control a quick-heating device in order to keep the temperature of a pot of water at 50°C. Why do we need the theories of calculus for such a simple task? You’re probably thinking, isn’t this really easy? Just make it heat up when the temperature is below 50°C, and turn off the power when it’s above 50°C, right? A few lines of code can be written with Arduino in just minutes – that’s right~ When the requirements aren’t high, it’s indeed possible to do that~ But! If LZ used different words, you’d know where the problem lies: What if my object of control is a car? If you wanted to keep the car’s speed at exactly 50 km/h, would you still dare to do this? Imagine that at some point, the car’s cruise control system measures the speed to be 45 km/h. It immediately ordered the engine: Accelerate! As a result, there was suddenly a 100% full throttle from the engine; with a whoosh, the car accelerated rapidly to 60 km/h. At that moment, the computer issued another command: Brake! As a result, squeak...............whoa............(passenger vomits). So, in most cases, using a \"digital signal\" to control a physical quantity is a rather crude approach. Sometimes, it’s impossible to maintain stability. Because microcontrollers and sensors are not infinitely fast; data acquisition and control require time. Moreover, the control object has inertia. For example, if you unplug a heater, its \"residual heat\" (i.e., thermal inertia) may still cause the water temperature to rise a little more for a while. At this point, a ‘algorithm’ was needed: one that could bring the physical quantity to be controlled close to the target value, one that could ‘predict’ the trend of changes in this quantity, and one that could eliminate static errors caused by factors such as heat dissipation and resistance. Thus, mathematicians of that time invented this enduring algorithm – namely PID. As you should already know, P, I, and D are three different types of control mechanisms; they can be used individually (P, I, D), in pairs (PI, PD), or all together (PID). What are the differences among these three effects? Please be patient, sir; let me explain things slowly. First, let’s talk about the three most basic parameters of a PID controller: kP, kI, and kD. kP P means proportion. Its effect is the most noticeable, and its principle is also the simplest. Let’s start with this: For the quantities that need to be controlled, such as water temperature, there is its current ‘actual value’, as well as the ‘target value’ we desire. When the difference between the two is not large, let the heater heat it up “gently”. If, for some reason, the temperature drops significantly, have the heater heat up a bit more. If the current temperature is much lower than the target temperature, the heater should be operated at full capacity to raise the water temperature as quickly as possible to a level close to the target. This is the role of P. Compared to switch-based control methods, isn’t this approach much “gentler”? In actual programming, one can establish a linear relationship between the deviation (target value minus current value) and the “adjustment intensity” of the controller, thereby achieving basic “proportional” control. The larger the value of kP, the more aggressive the adjustment; reducing kP makes the adjustment more conservative. If you are building a balance bike, with the effect of P, you will find that the bike shakes violently back and forth around the balance angle, making it difficult to keep it stable. If you’ve reached this point — congratulations! We’re just one small step away from success~ kD’s function is easier to understand, so let’s talk about D first and then I. Just now we saw the effect of P. It’s not hard to see that only P seems unable to get the balance station to function properly; the water temperature is also unstable, as if the entire system isn’t very stable and is constantly \"shaking\". Imagine a spring in your mind: it is currently at its equilibrium position. Pull it once, then let go. At this point, it will start to oscillate. Because the resistance is very low, it may oscillate for a long time before stopping back at the equilibrium position. Imagine this: if the system shown in the figure above is submerged in water, and we pull it again, then it takes much less time for it to return to its equilibrium position. We need a control mechanism that causes the \"rate of change\" of the physical quantity being controlled to approach 0, that is, something similar to \"damping\". Because, when closer to the target, P’s controlling effect becomes smaller. The closer to the target, the gentler P’s effect is. There are many internal or external factors that cause slight fluctuations in the control quantity. The role of D is to cause the velocity of the physical quantity to approach 0; whenever this quantity has a velocity, D exerts a force in the opposite direction, striving to stop this change. The larger the kD value, the stronger the braking force in the opposite direction of motion. For a balanced cart, with P and D control mechanisms in place, it should be able to stand up if the parameters are adjusted properly~ Let’s cheer! Wait, there seems to be another member among the PID trio. It seems that PD can keep physical quantities stable, so what is I needed for? Because we have overlooked an important point: taking hot water as an example for kI again. What if someone took our heating device to a very cold place and started boiling water? It needs to be heated to 50°C. Under the action of P, the water temperature gradually rises. It was not until the temperature rose to 45°C that he discovered a problem: it was too cold, and the rate at which water lost heat was equal to the heating rate controlled by P. What should we do? Brother P thought to himself: I’m already very close to my goal; I just need to apply a little heat. Brother D thought: Since heating and cooling are equal, the temperature doesn’t fluctuate, so it seems like there’s no need for any adjustments. Thus, the water temperature remains at 45°C forever, never reaching 50°C. As human beings, based on common sense, we know that the heating power should be increased further. But how should one calculate how much to increase? The methods devised by earlier scientists are truly ingenious. Set an amount of points. As long as a deviation exists, it is continuously integrated (accumulated), and this is reflected in the magnitude of the adjustment. In this way, even though the difference between 45°C and 50°C is not large, over time this integral value keeps increasing as long as the target temperature has not been reached. The system will gradually realize that the target temperature has not yet been reached, and it’s time to increase the power! Once the target temperature is reached, assuming there are no fluctuations in temperature, the integral value will no longer change. At this point, the heating power is still equal to the cooling power. However, the temperature remained steady at 50°C. The larger the value of kI, the greater the coefficient used during integration, and the more pronounced the integration effect. Therefore, the role of I is to reduce the error in static conditions, so that the controlled physical quantity can be as close as possible to the target value. I have another issue when using it: a score limit needs to be set. Prevent the integral value from becoming too large at the start of heating, making it difficult to control.
Reply #22021-02-16
Thank you for sharing. This explains the mysteries of PID from the perspective of learning knowledge in universities, but in practical applications, we need to analyze and set PID parameters by using trend charts of PV (measured value)/SP (set value)/OP (output value). I haven’t found any clear explanations of this online yet, so I hope experienced professionals can discuss it together. P regulation has been explained in detail above; it refers to the proportional value, and it affects the slope of OP. Of course, it also affects the slope of PV, that is, the speed of regulation. The larger the P value, the faster the regulation speed, but it becomes more difficult to achieve the desired stability. On the other hand, if the P value is too small, the slope will be too low, meaning that if the regulation speed is too slow, it might end up in an open-loop state within a certain period of time. To put it more vividly, if one regulation cycle takes place within a year, it’s as if no regulation has taken place at all. So, a suitable kP value needs to be found. Make the adjustment speed neither too fast nor too slow, just right. I’ll find a picture to add later.
Reply #32021-02-17
Nice, thanks for sharing! ! ! !

Submit a Project

**Looking for Chemical Technology, Equipment & Solutions?** No Registration Required Broader Platform Exposure | Global Chemical Service Provider Connections

Submit Request — Free Consultation

Disclaimer

This is an automated machine translation of the original thread. Some technical terms may have inaccuracies; the original text shall prevail. Click "View Original" at the top right to access the source page, which supports IP-based automatic real-time language translation. Please watch out for contact details and sales inducements to prevent fraud. All content and translations are for reference only, representing solely the poster's personal views. For enquiries, email service@hcbbs.com.