PID algorithm finally understand the principle, originally it's that simple

 

PID still looks big, but in reality we are all shocked by his appearance lived. First intimidated by others, after being intimidated formula, since most of the high number of people not at all or forgotten, so Made in the formula, just scared to death. Very shallow understanding of the principle, the result of the formula can not read, do not understand the meaning, so in the end there is no thorough. I am here for the first formula to analyze, to understand to understand the formula, combined with some examples of pid online tells, will understand.

 

First the meaning of PID coefficients of these three simple literacy. And also to prevent themselves forgotten. P is a proportionality coefficient, I is the integral coefficient, D is the differential coefficient. Next, the three PID coefficients described in detail.

 

 

1. The scaling factor P is used to do, in fact, if you are now junior high school students, then once you understand, through the scale factor is used in the (0,0) coordinate point magnification of the line k, the larger the k, the larger the slope of the line, it is used in the y = k * x, where k is the proportionality factor p, we are simply referred to as KP, it becomes y = Kp * x.

x is the difference between the current value and the target value totalValue currentValue, acronym ERR error, then err = currentValue - totalValue. y is an output value of the actuator corresponding to U, the actuator so that a corresponding output value U = Kp * (currentValue - totalValue).

So, if that is using a proportional adjustment.

The current corresponding to the actuator when the output value is adjusted 1st U1 = Kp * (curentValue1 - totalValue1).

At the second adjustment actuator corresponding output value U2 = Kp * (currentValue2 - totalValue2).

This is the scale factor P application, that is, we say that the ratio adjustment. Ratio is adjusted according to the difference between the current value and the target value, multiplied by a coefficient Kp, to obtain an output value, which directly affects the output value of the next change in the current value. If only proportional control, then the system will shock more powerful. For example, your car is now running speed of 60km / h, and now you want to pass your actuator to control the car reached a constant 50km / h, then adjust the ratio if you only use kp. U = Kp * (60 - 50), an assumed value of Kp, the output value obtained at this time is U actuator 10, the result output of the actuator when you find car look into 35Km / h, at this time U2 = Kp * (35 - 50), the actuator at this time to give an output value U is -15, the result output of the actuator when you find the car goes 55Km / h, since the inertia error factors and unpredictable, you car has never been able to achieve a constant 50km / h. Always shaking, I believe that if you are in the car, you must spit very powerful. Therefore, the light has to adjust the scale factor, in some situations there is no way to adjust the system stable. It is possible to mitigate the shock of the powerful, it will be combined with P ratio and differential D.

 

2. The differential coefficient D

Differential, in fact, the error is differential. 1 is added to the error err (1). 2 is error err (2). Err is the error differential (err2 - err1). Multiplied by the differential coefficient D, it called the KD, after the 1st adjustment actuator has an error the first time, after the second regulating error with the second time, the combined coefficient P. There PD in conjunction with the adjusted each time, the estimated value of the empirical error, you can select the coefficient D. If the error is getting smaller and smaller, then the differential is definitely a negative. Certainly value than simply using smaller proportion of the adjusted value after a negative value multiplied by a coefficient D plus a proportion of the adjusted value, so we started to the effect of damping. With the damping effect will make the system of regional stability. PD binds formula after the above analysis is

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

 

3. integral coefficient I

Integral, in fact, is the integral of the error, which is infinite and error. How to understand the integral coefficient I, cited examples where online

Hot water, for example. If someone is put our heating system brought very cold place to start a boil. We need to burn 50 ℃.

P under the action of the water temperature was gradually increased. Until raised to 45 ℃, he found a bad thing: cold weather, the water cooling speed, and the speed of heating is equal to the P control. 
This is how to do?

P brother to think: My goal is very near, just gently heating it. 
D brother to think: equal heating and cooling, the temperature does not fluctuate, I do not like what adjustment.

Thus, the water to stay forever at 45 ℃, never reach 50 ℃.

As a person, based on common sense, we know that, should further increase the power of heating. But how much of the increase to calculate it? 
Methods senior scientists think is really clever.

A set amount of points. As long as the deviation exists, the deviation continuously integrating (accumulating), and adjusting the intensity of the reaction on.

As a result, even if the 45 ℃ and 50 ℃ difference is not large, but as time goes on, as long as the temperature did not reach the target, the amount of points will continue to increase. The system will gradually realize: not yet reached the target temperature, the increase in power it! 
To the target temperature, assuming that the temperature does not fluctuate, the integral value will not change. At this time, the heating power is still equal to the power dissipation. However, the temperature is secure in 50 ℃. 
The higher the value of kI, the greater the integration time multiplied by the coefficient, the more obvious the integration effect.

Therefore, the role I is to reduce the error in the static case, so that a controlled quantity target value as close as possible.

I use when there is a problem: the need to set integration limits. Prevent at the beginning of the heating, put the amount of points accumulated too much, it is difficult to control.

 

So the ultimate combination of PID, the company became, I found a screenshot directly from the Internet as follows

 

 

Guess you like

Origin www.cnblogs.com/whylinux/p/10960319.html