PID control algorithm notes arrangement 1: PID algorithm easy-to-understand way of understanding

P: proportional coefficient

I: Integral coefficient

D: Differential coefficient

 

1. What is the proportional coefficient P used for? In fact, if you are a junior high school student now, you will understand at once. The proportional coefficient is used for the magnification factor k of the line passing through the coordinate point (0,0). The larger the k is , the greater the slope of the line, so it is used in y = k * x, where k is the proportionality coefficient p, which is referred to as kp by everyone, so it becomes y = Kp * x.

 

x is the difference between the current value currentValue and the target value totalValue, referred to as the error err, then err = currentValue - totalValue. y is the output value U corresponding to the actuator, so the output value U = Kp * ( currentValue - totalValue ) corresponding to the actuator.

 

So, if it is said to use the ratio to adjust.

Then the corresponding output value of the actuator at the first adjustment is U1 = Kp * ( curentValue1 - totalValue1 ).

The corresponding output value of the actuator during the second adjustment is U2 = Kp * ( currentValue2 - totalValue2 ).

 

This is the application of the proportional coefficient P, which is what we call proportional adjustment. Proportional adjustment is to multiply the difference between the current value and the target value by a Kp coefficient to obtain an output value, which directly affects the next change of the current value. If there is only proportional adjustment, the system will oscillate more violently. For example, your car is running at a speed of 60km/h, and now you want to control the car to a constant 50km/h through your actuator, if you only use kp for proportional adjustment. U = Kp * ( 60 - 50 ), assuming that the value of Kp is 1, the output value of the U actuator is 10 at this time. As a result, when you output the actuator, you find that the car suddenly becomes 35Km/h, and U2 at this time = Kp * (35 - 50), at this time, the output value of the U actuator is -15. As a result, when you output the actuator, you find that the car becomes 55Km/h. Due to inertia and unpredictable error factors, your Cars can never reach a constant 50km/h. Shaking all the time, I'm sure if you're in the car, you're throwing up pretty badly. Therefore, there is only a proportional coefficient to adjust, and in some occasions there is no way to stabilize the system. Therefore, in order to slow down the shock, the proportional P and differential D will be used in combination.

 

 

2. Differential coefficient D

Differentiation, in fact, is to differentiate the error. A spurious error of 1 is err(1). Error 2 is err(2). Then the differential of error err is (err2 - err1). Multiplied by the differential coefficient D, which is called KD, then when the actuator has the first error after the first adjustment, and the second error after the second adjustment, then combine the P coefficient. With the combination of PD, you can select the coefficient of D according to the empirical calculation of the value of the error each time you adjust. If the error is getting smaller and smaller, then it must be a negative value after differentiation. After the negative value is multiplied by a D coefficient and the value of the proportional adjustment is definitely smaller than the value of simply using the proportional adjustment, the damping effect is activated. With the effect of damping, the system area will be stabilized. After the above analysis, the formula of PD combination is

U(t) = Kp * err(t) + Kd * derr(t)/dt

 

3. Integral coefficient I

The integral is actually the integral of the error, that is, the infinite sum of the error. How to understand the integral coefficient I, here is an example on the Internet

Take hot water as an example. Suppose someone took our heater to a very cold place and started boiling water. It needs to be burned to 50°C.

Under the action of P, the water temperature rises slowly. When the temperature rose to 45°C, he discovered a bad thing: the weather was too cold, and the speed of water cooling was equal to the heating speed controlled by P. 

This is how to do?

Brother P thinks like this: I am already very close to the target, and I only need to heat it up slightly. 

Brother D thinks this way: Heating and cooling are equal, the temperature does not fluctuate, and I don't seem to need to adjust anything.

Therefore, the water temperature stays at 45°C forever and never reaches 50°C.

As a human being, we know, based on common sense, that the heating power should be increased further. But how much to calculate? 

The method that the predecessors scientists thought of is really ingenious.

Set an integral amount. As long as the deviation exists, it will continue to integrate (accumulate) the deviation and reflect it on the adjustment strength.

In this way, even if the difference between 45°C and 50°C is not too large, as time goes by, as long as the target temperature is not reached, the integral will continue to increase. The system will gradually realize that the target temperature has not been reached yet, it is time to increase the power! 

After reaching the target temperature, assuming that the temperature does not fluctuate, the integral value will not change any more. At this time, the heating power is still equal to the cooling power. However, the temperature was a steady 50°C. 

The larger the value of kI, the larger the coefficient multiplied during integration, and the more obvious the integration effect.

Therefore, the function of I is to reduce the error in static conditions and make the controlled physical quantity as close as possible to the target value.

I still have a problem when I use it: I need to set an integral limit. To prevent the integral volume from being too large at the beginning of heating, it is difficult to control.

 

 

 

 

 

 

Guess you like

Origin blog.csdn.net/qq_27568125/article/details/115377478