PID——pid and parameter debugging method

The so-called PID refers to Proportion-Integral-Differential. Translated into Chinese is proportional-integral-derivative.
Insert picture description here
Remember two sentences:

1. PID is classic control (used for a long time) 2. PID is error control ()

Control the speed of DC motor at constant speed:

1. L293 is used as motor drive; 2. Photoelectric sensor-as output feedback; 3. PWM is used as input control. How does PID control the error, listen to me in detail:

The so-called "error" is the difference between the command and the output. For example, if you want the control speed to be 4 revolutions/s (PWM wave duty ratio=80%), but in fact the control speed is only 3.5 revolutions/s, the error: e=0.5 revolutions, if the actual speed is 4.5 revolutions, the error e =-0.5 revolutions (note the sign).

The error value is sent to the PID controller as the input of the PID controller. The output of the PID controller is: error multiplied by proportional coefficient Kp + Ki error integral + Kd error differential.

Kp e + Ki ∫edt + Kd*(de/dt) (where t is time, that is, time integration, differentiation) The above formula is the sum of three terms (hope you can understand), the PID result is sent to the motor driver. It can be seen from the above formula that if there is no error, that is, e=0, then Kp e=0; Kd (de/dt)=0; and Ki*∫edt is not necessarily 0. The sum of the three items is not necessarily zero.

In short, if the "error" exists, PID will adjust the motor drive until the error=0. There are three indicators to evaluate whether a control system is superior: fast, stable and accurate.

The so-called fast means that the pressure can reach the "command value" quickly (I don't know how much time your system requires). The so-called stable means that the pressure is stable without fluctuations or small fluctuations (I don't know how much fluctuation your system allows). , That is, the error e between "command value" and "output value" is required to be small (I don't know how much error your system allows)

For your system, if you require "fast", you can increase the Kp and Ki values. If you require "accurate", you can increase the Ki value

If "stability" is required, the Kd value can be increased and pressure fluctuations can be reduced. A careful analysis shows that these three indicators are contradictory. If it is too "fast", it may lead to instability; if it is too "stable", it may lead to instability;

As long as the system is stable and there is integral Ki, the system has no error in the static state (there will be dynamic errors); the so-called dynamic error refers to when the "command value" is not a constant value, the "output value" cannot keep up with the "command value" And there are errors. No matter who designed it, no matter how good the system is, there are dynamic errors. The dynamic error reflects the tracking characteristics of the system. For example, some audio amplifiers are not sensitive to high-frequency sounds, which means that the tracking performance of the amplifier is not good. There are two ways to adjust PID parameters: 1. Simulation method; 2. "Trial method" Simulation method I don't think you can, introduce the recommended steps of "Trial method" and "Trial method" to set PID parameters:

1. Set Ki and Kd to 0, do not integrate and differentiate;

2. Slowly increase the Kp value from 0, and observe whether the response speed of the pressure is within your requirements; 3. When the response speed of the pressure reaches your requirements, stop increasing the Kp value; 4. At the Kp value Decrease by 10% on the basis; 5. Slowly increase the Ki value from 0;

6. When the pressure begins to fluctuate, stop increasing the Ki value;

7. Decrease 10% on the basis of the Ki value;

8. Slowly increase the Kd value from 0, and observe whether the pressure response speed is within your requirements

Guess you like

Origin blog.csdn.net/Williamcsj/article/details/107370914