How to understand P and I of incremental PID (2)

Dark Horse Miracle Chapter's Power

Demonstration of P and I understanding of incremental PID (Part 1)

Let’s do experiments first, and finally summarize the functions of P and I of incremental PID.

Background knowledge: The two premises mentioned in the previous blog: 1. The first moment when the motor is started, the current output value (PWM) in the controller is high or low; 2. The range is increased.

"The first moment when the motor is started, the current output value (PWM) in the controller is high or low" means: after powering on the motherboard where the K66 microcontroller is located, it just turns off the drive switch so that the motor does not rotate, without stopping the microcontroller. (PID controller) power down. Just to mention casually, the hardware of our car is composed of the main board and the drive board. Considering the aesthetics of the ride, it is not an integrated main and drive board. Although the motor is not rotating at this time, the microcontroller is not turned off. The microcontroller is performing the PI calculation formula every 2ms, so the output value PWM will always be there, and with the integral effect, the microcontroller is powered on. The PWM will continue to increase until our maximum limiter value is 999.

You ask me, why is it 2ms? Because I put the motor's incremental PI control algorithm in the PIT period timer, my speed control algorithm is periodically executed every 2ms. You can also put the PI algorithm in the while(1) of your main function for loop execution, it doesn't matter.

Let’s take a picture to illustrate: The
picture below shows the curve of the variable motor.speed_duty_output_R when P is 0.1, I is 0.01, and the setting value is 200. When the motor is not rotating, it is the picture of the output PWM. However, I did not start the motor at this time, but just started it. K66 microcontroller. The picture is not cropped well, so you don’t need to see the pink line at the front that is vertical to the x-axis. The curve suddenly increases from 0 to 20 (0.1*200=20 proportional effect), and then slowly increases to (the increase is due to the integral effect) my limiting value is 999

Insert image description here

"Increase domain" means:
if the set value is a speed of 200 and the motor starts from 0, then the increment domain is 200. If the set value is a speed of 300 and the motor changes from 250 to 300, then the increment domain is 50. That is to say, we want to control the increment of speed change, but this is by no means the current deviation, because the current deviation is a dynamic value. It is the difference between the real value and the set value every moment, which will change with time. The increment range is The deviation value that appears for the first time each time the motor becomes stable (the motor starts to rotate from 0 speed, the set value is 100, and the increment range is 100; now the motor is stable at a speed of 100, and I change the set value to 300 , the incremental domain is 200; now the motor is stable at 300, I set the setting value at 200, and the incremental domain is -100).

The above picture of Buduo bb————Argument:————Initial PWM level——The impact on incremental PID: The
green line is the set value of 200, changing from 0, that is to say, the incremental domain is 200. The red line is PWM The initial value of , the pink line is the actual rotation speed of the wheel.

P I PWM initial value is low PWM initial maximum 999 describe
0.1 0.01 Insert image description here Insert image description here The initial value of 999 has a large overshoot and the value is very high.
0.1 0.02 Insert image description here Insert image description here Here and in the following pictures, the red lines are cancelled. But the pictures on the right part are all with PWM initialization of 999, and the left part is with low PWM. It doesn’t matter what the value is, anyway, it is <500.
0.1 0.05 Insert image description here Insert image description here Obviously, the actual speed of the wheel is completely affected by whether the initial PWM is high or low.
0.1 0.1 Insert image description here Insert image description here A large initial PWM can increase the overshoot and improve the responsiveness.
0.1 0.5 Insert image description here Insert image description here
2 0.01 Insert image description here Insert image description here The increase of P makes the adjustment time longer and the overshoot decreases.
5 0.01 When P>=5, it is impossible to make an image with low PWM because the setting value is 200, 5*200=1000, which is >999, so once the controller is powered on, it will reach 1000 instantly, and P will not be 0.1 That way you can see that the PWM slowly reaches 999 under the influence of integral Insert image description here Oh wow~ the overshoot is gone. The same is the initial PWM999. The larger the P, the smaller the overshoot.
5 0.03 Insert image description here
5 0.05 Insert image description here
5 0.1 Insert image description here
5 0.3 Insert image description here
5 0.5 Insert image description here
5 1 Insert image description here
5 3 Insert image description here
10 0.01 Insert image description here The first peak value was lower than when P was 5, but in the end it reached 200 due to integration, and the picture was not captured.

It can be seen that as P continues to increase, from 0.1 to 10, the actual speed of the wheel has been declining. When P=5, it has the best effect, with no overshoot and sufficient responsiveness. The system responsiveness of P=0.1 and P=10 is not as good as that of P=5. There is a peak in the response characteristics (that is, when P is 5, the performance reaches the maximum value), which is a proper quadratic function. Compare
P=0.1, I=0.01;
P=2, I=0.01;
P=5, I=0.01;
P=10, I=0.01;
under the same integral effect, the increase of P will cause the overshoot Decrease, and the adjustment time increases. So here comes the question. What I was told in the book "Principles of Automatic Control" is that increasing P can speed up the system adjustment. Is it wrong? Does this sentence only refer to positional PID, not incremental PID? What is going on with all this?

Oh! This realistic experimental data directly caused the collapse of my PID world view for many years. At this point, I can’t do it either! Everything seems so irregular. Is there a unified theory to explain everything? . . . . . . . Um. . . . . . so hard! It's so hard for me. Give up, this is the end of the search for the true meaning of incremental PID .
The whole story ends.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

Haha~ How can I open this trap without any strength? Who will be eliminated? Don't fucking make me laugh. Everyone, here comes the ultimate answer to all these mysteries! A unified theory! --I found it!

Demonstration of P and I understanding of incremental PID (Part 2)

The above picture of Buduobb————Argument:————Increase the domain size————The impact on incremental PID:
The above is the picture of increasing the domain by 200, and now it is 100, that is, the set value is 100. The wheel should change speed from 0 to 100. You will get the answer after doing this experiment

P I Initial PWM999 Initial PWM is 0 describe
5 0.01 Insert image description here Insert image description here When the increasing domain becomes smaller, the initial PWM999 has an overshoot. The first peak value when the initial PWM is 0 is lower than the previous increasing domain of 200 with the same parameters, but it tends to be stable in the end.
5 0.03 Insert image description here Insert image description here
5 0.05 Insert image description here Insert image description here
5 0.1 Insert image description here Insert image description here
5 0.3 Insert image description here Insert image description here The adjustment time becomes shorter as I increases
5 0.5 Insert image description here Insert image description here
5 1 Insert image description here Insert image description here
10 0.01 Insert image description here Insert image description here The two pictures are almost the same
12 0.01 Insert image description here Insert image description here
15 0.01 Insert image description here Insert image description here After P is 10, the responsiveness of the curve decreases, and the first peak reached decreases as P increases.

My doubts were cleared and I finally understood everything.
.
.
.
.
.
.
.
.
.
.
.
.

The Lost Truth of P and I Understanding of Incremental PID

When the domain is increased by 200, the responsiveness of the P=5 curve reaches a peak value, and when the domain is increased by 100, the responsiveness of the P=10 curve reaches a peak value. Why? This is just because 5×200=999, 10×100=999. That's right, I wrote 999, not 1000, and 999 is the limiting value of our PWM! Our PWM is limited to -999 to 999, and 999 is almost as big as 1000. Do you think this situation is a coincidence? No, it's not a coincidence, it's inevitable.

Does the larger P mean the greater the responsiveness?

Especially when we see that the response of the curve with an increasing domain of 200, P=5, I=0.01 is significantly smaller than that of an increasing domain of 200, P=10, I=0.01, this sentence is wrong. In fact, the larger P, the greater the responsiveness. If we do not limit the maximum and minimum values ​​of PWM, then this is the case: 10*200=2000. If we limit the maximum PWM to 999, this is the case: 10×200=999. Are you surprised that 10×200 is not =2000? Why do I write 999? The reason is that you have limited the amplitude. When it is greater than 999, 999 is taken. And it is precisely because we have discounted the original 2000 to 999. The situation caused by this operation is that we see that the responsiveness of the wheel becomes lower when the domain is increased by 200, P=10, and I=0.01. If we can not limit the maximum and minimum values ​​of PWM, then the responsiveness of the curve when increasing the domain by 200, P=10, I=0.01 will definitely be higher than when increasing the domain by 200, P=5, I=0.01, and the response characteristics of P It will be a monotonic linear function, not a quadratic function. Indeed, the larger P, the greater the responsiveness. Therefore, the most correct statement of this sentence should be this:

The true meaning that has never been mentioned and sealed :

1. In the case where the initial PWM value == the current speed of the wheel, if the condition: "PWM limiting value >= increasing range × P coefficient + initial PWM value" is true, then the larger P, the greater the responsiveness. Increasing I can also improve the responsiveness, shorten the adjustment time, and not only reduce the overshoot, but also compensate for the overshoot when there is no overshoot.
2. When the initial PWM value ≠ the current speed of the wheel, a small P (such as 0.1) has the potential for high responsiveness. The smaller the P, the higher the potential and amount of overshoot. I has the same effect. Increasing I can improve the responsiveness, shorten the adjustment time, and not only reduce the overshoot, but also compensate for the overshoot when there is no overshoot.

So what can activate the responsive potential of little P? First of all, the value of the initial PWM can be activated. The initial PWM maximum and the initial PWM non-maximum are two completely different things. Although in the real physical world, you are adjusting a thing (motor), the parameters corresponding to the initial PWM maximum and the initial PWM non-maximum are completely different, that is to say, one thing has two sets of parameters, and these two sets of parameters The difference is ridiculously huge. The larger the initial PWM, the greater the potential of small P (for example, P is 0.1) will be released, and the greater the overshoot will be, as shown in the figure below. The motor also rotates from 0 to 200, but the left picture shows the response of the wheel when the mainboard and driver board are turned on together, and the PWM is initially 0. The right picture shows only the mainboard being turned on first to let the microcontroller continue to execute the PID code, so that the PWM is calculated to 999. , the response of the wheels when the drive board is turned on again.

P I Initial PWM is 0 Initial PWM is 999 describe
0.1 0.01 Insert image description here Insert image description here The left side is the curve characteristic when P is not activated, and there is no overshoot. There is a large overshoot on the right, with a peak value of more than 800, and the setting values ​​are all 200

A small P (such as 0.1) has great potential (how big is its potential? It is 9990). After being activated, the overshoot can be seen to increase sharply, which is much greater than that in the inactive state. The smaller P, the greater the potential. A large P (such as 10) has a small potential (how small is its potential? It is 99.9). When the increasing domain is large, there is no overshoot after activation, because the potential of large P has been activated. It just cannot reach the value of the increasing domain. The large P should be 2000 (because 10×200=2000, use P coefficient , so the actual situation of large P now is 10×200=999, which is forced to compromise to 999. The reason for limiting makes its potential smaller than the case of P=0.1, 0.1×200=20, and 20<999, it does not Being compromised.

Only the initial PWM can activate the responsiveness potential of P. The integral effect can indeed improve the responsiveness, but it cannot activate the responsiveness potential of P, as shown below:

P I Initial PWM is 0 describe
0.1 0.01 Insert image description here
0.1 0.1 Insert image description here Increasing the I parameter can increase responsiveness
10 0.01 Insert image description here It can be seen that at a P of 10, the responsiveness is very poor at 1 hour
10 0.1 Insert image description here Increasing I can speed up the responsiveness, but the peak value of the first sudden increase in the curve cannot be increased. It is 100 both times, and finally reaches 200 due to the integration effect.

Points cannot activate the potential of P. For example, if the increase domain is 200, you need to choose a small P to increase the first burst peak. It can be said that if P is 10, its potential has been fully activated, which is more than 100. Why do I say that the potential of P=10 is about 100? How to calculate the potential value corresponding to the P coefficient? Please calculate according to the inequality I gave (PWM limiting value >= increasing domain The limiting value of PWM can be obtained by dividing the P coefficient by the P coefficient (at this time, the value of P potential = increased domain, but the P potential is not the increased domain, because the increased domain is given and the P potential is calculated), 999/ 10=99.9. If you want the curve to be more perfect and keep up with the set value of 200, P needs to be made smaller. So what is the most appropriate amount of P? Please also calculate according to Bright's inequality: The current situation is that the initial PWM value is equal to the current speed of the wheel, which is equal to 0, so 999/200=4.995≈5, so P is given to 5. There is no formula for setting the I parameter. You can adjust it slowly by yourself and rely on the actual results.

Please see, when P is 5 and I is 0.3, the perfect parameters suitable for increasing the domain by 200:
Insert image description here

…To Be Continued…

Guess you like

Origin blog.csdn.net/fangchenglia/article/details/109534127