PID regulation formula and related methods

pid discrete representation:

out =Kp*(err(k) + T/Ti  * err1 + Td/T  * (err(k) - err(k-1) );

out: output value, pwm input value.

T sampling period, Ti, integration period, Td, differential period, err(k), error value, err1, error accumulation value.

Location type:

pid.out = pid.kp * pid.err +  pid.ki * pid.err1 + pid.kd * (pid.err - pid.next);

The parameters are the same.

Incremental:

pid.inc= pid.kp * (pid.err - pid.next) +  pid.ki * pid.err + pid.kd * (pid.err - 2*pid.next + pid.last);

pid.out  += pid.inc; 

pid.next = pid.err;

pid.last = pid.next;

Kp: Speed ​​up system response and improve system adjustment accuracy; side effect: overshoot

Ki: Eliminate steady-state error, side effect: integral saturation

Kd: Improve system dynamic performance, side effect: extend adjustment time

 

Same as above

General principles of PID debugging: 

When the output does not oscillate, increase the proportional gain P. From small to large     

When the output does not oscillate, reduce the integral time constant Ti. From big to small     

When the output does not oscillate, increase the derivative time constant Td. From small to large

1. Determine the proportional gain P When determining the proportional gain P, first remove the integral term and differential term of the PID, generally set Ti=0, Td=0 (see the description of PID parameter setting for details), so that the PID is purely proportional. The input is set to 60%~70% of the maximum value allowed by the system. Gradually increase the proportional gain P from 0 until the system oscillates; conversely, the proportional gain P gradually decreases from this time until the system oscillation disappears, and record For the proportional gain P at this time, set the PID proportional gain P to 60%~70% of the current value. The adjustment of proportional gain P is completed. Generally take P = Pmax(*60~70%).  

  2. Determine the integral time constant Ti. After the proportional gain P is determined, set a larger initial value of the integral time constant Ti, and then gradually reduce Ti until the system oscillates, and then in turn, gradually increase Ti until the system The oscillation disappeared. Record the Ti at this time and set the PID integral time constant Ti to be 150%~180% of the current value. The integration time constant Ti debugging is completed.    

  3. Determining the integral time constant Td Generally, the integral time constant Td does not need to be set, it is only 0. To set, use the same method to determine P and Ti, and take 30% when there is no oscillation.

Mantra:

  1. Find the best parameter setting and check in order from small to large.
  2. Proportional first, then integral, and finally the derivative is added.
  3. The curve oscillates frequently, and the proportional dial should be enlarged.
  4. The curve floats around the big bay, and the scale dial is moved slightly.
  5. The curve deviates slowly, and the integration time decreases.
  6. The curve fluctuation period is long, and the integration time is longer.
  7. The curve oscillates at a fast frequency, so first reduce the differential.
  8. The fluctuation is slow due to large momentum. The derivative time should be longer.
  9. The ideal curve has two waves, high in the front and low in the back by 4 to 1.
  10. One look at the second adjustment and more analysis, the adjustment quality will not be low.

The engineering tuning methods of PID controller parameters mainly include critical proportion method, response curve method and attenuation method.

Critical ratio method:

The steps for tuning PID controller parameters using this method are as follows:

1) First, pre-select a sampling period short enough for the system to work;

2) Only add the proportional control link until the critical oscillation appears in the system's step response to the input, and write down the proportional amplification factor and critical oscillation period at this time;

3) Under a certain degree of control, the parameters of the PID controller are calculated through formulas.

 

 

 

Guess you like

Origin blog.csdn.net/qq_38531460/article/details/95609989