PID algorithm

control algorithm
Collection
zero Useful+1
zero
In process control, the control is carried out according to the proportion (P), integral (I) and differential (D) of deviation PID controller (also called PID regulator )It is the most widely used one Automatic controller It has the advantages of simple principle, easy realization, wide application, independent control parameters, simple parameter selection, etc; And theoretically, it can be proved that process control PID controller is an optimal control for typical objects of "first order delay+pure delay" and "second order delay+pure delay". PID regulation law is continuous system It is an effective method of dynamic quality correction. Its parameter setting mode is simple, and its structure is flexible (PI, PD,...). [1]
Chinese name
PID algorithm
Foreign name
Proportion Integral Differential
Initial application
Ship autopilot
Initial application time
1930s to 1940s
Scope of application
Industrial control, ship autopilot, etc

brief introduction

Announce
edit
PID control system structure diagram
PID is the abbreviation of Proportional, Integral and Differential. As the name implies, PID control algorithm is a control algorithm that combines the three links of proportion, integral and differential. It is the most mature and widely used control algorithm in continuous systems. This control algorithm appeared in the 1930s to 1940s, and is suitable for situations where the controlled object model is unclear. The practical operation experience and theoretical analysis show that the application of this control law to many industrial processes can achieve satisfactory results. PID control Its essence is to operate according to the deviation value of input and the functional relationship of proportion, integration and differentiation, and the operation result is used to control the output. [2]
In industrial processes, Continuous control system The ideal PID control law of is: [2]
Where, Kp -- proportional gain, Kp is inversely related to the scale; [2]
T t ——Integration time constant; [2]
T D ——Differential time constant; [2]
u(t)—— PID controller Output signal of; [2]
E (t) - the difference between the given value r (t) and the measured value. [2]

PID control principle

Announce
edit
closed-loop control It is a control method that corrects according to the output feedback of the control object. It corrects according to the quota or standard when the actual deviation from the plan is measured. For example, to control the speed of a motor, there must be a sensor to measure the speed and feed the results back to the control route. When it comes to the closed-loop control algorithm, we have to mention PID, which is the simplest one among the closed-loop control algorithms. PID is the abbreviation of Proportional Integral, Differential Coefficient, and represents three control algorithms respectively. The combination of these three algorithms can effectively correct the deviation of the controlled object, so that it can reach a stable state. [3]

proportion

Figure 1
Reflect the deviation signal of the control system in proportion. Once the deviation is generated, the control effect will be generated immediately to reduce the deviation. Proportional controller The output u (t) of is proportional to the input deviation e (t), which can quickly reflect the deviation, thus reducing the deviation, but cannot eliminate the static error. Static difference refers to System control When the process tends to be stable, the difference between the given value and the measured value of the output. The existence of deviation can make the controller maintain a certain control output, so the proportional controller must have a static error. According to the deviation theory, although increasing can reduce the deviation, it cannot completely eliminate the deviation. In addition to the deviation e (t), the size of the proportional control effect also depends on the size of the proportional coefficient Kp. The smaller the proportional coefficient Kp, the smaller the control effect and the slower the system response; On the contrary, the larger the proportional coefficient Kp, the stronger the control effect, and the faster the system response. However, if the Kp is too large, the system will produce large overshoot and oscillation, which will lead to poor stability of the system. Therefore, Kp should not be selected too large. Kp should be selected in a compromise according to the characteristics of the controlled object, so that the static error control of the system is within the allowable range, and at the same time, it has a fast response speed. [4]

integral

Figure 2
The function of integral link is mainly used to eliminate static error and improve the system's error free degree. The strength of the integration action depends on the integration time constant Ti. The larger Ti is, the weaker the integration action will be. On the contrary, the stronger the integration action will be. The existence of integral control function is related to the existence time of deviation e (t). As long as there is deviation in the system, the integral link will continue to play a role, integrating the input deviation, making the output of the controller and the opening of the actuator constantly change, and generating control effect to reduce the deviation. When the integration time is sufficient, the static error can be completely eliminated, and the integration control effect will remain unchanged at this time. The smaller Ti, the faster the integration speed and the stronger the integration effect. If the integration effect is too strong, the overshoot of the system will increase, and even the system will oscillate. [4]

differential

Figure 3
The function of the differential link can reflect the change trend (change rate) of the deviation signal, and can introduce an effective early correction signal into the system before the value of the deviation signal becomes too large, so as to accelerate the action speed of the system and reduce the adjustment time. Although the introduction of integral control can eliminate static error, it reduces the response speed of the system. Especially for the controlled object with large inertia, it is difficult to obtain good dynamic regulation quality with PI controller, and the system will produce large overshoot and oscillation. At this time, differential action can be introduced. At the moment when the deviation just appears or changes, it can not only make timely response according to the deviation amount (i.e. proportional control effect), but also give a larger control effect (i.e. differential control effect) in advance according to the variation trend (speed) of the deviation amount to eliminate the deviation in the bud, which can greatly reduce the dynamic deviation and adjustment time of the system, The dynamic regulation quality of the system can be improved. The differential link helps the system to reduce overshoot, overcome oscillation, speed up the response of the system, and reduce the adjustment time, thus improving the dynamic performance of the system. However, if the differential time constant is too large, the system will become unstable. One of the major defects of differential control is that it is easy to introduce high-frequency noise, so it is difficult to detect the interference signal Flow control system It is not suitable to introduce differential control function in. [4]
The step response characteristic of differential control action is zero for a constant deviation, no matter how large its value is. Therefore, differential action cannot eliminate static error, and it is of little significance to use it alone. Generally, it needs to be used together with proportional and integral control actions to form PD or PID control. [4]
For PID control, when the control deviation input is a step signal, proportional and differential control functions will be generated immediately. At the moment of deviation input, the rate of change is very large, and the differential control effect is very strong. After that, the differential control effect decays rapidly, but the integral effect becomes larger and larger, until the static error is finally eliminated. PID control integrates three functions of proportion, integral and differential, which can not only speed up system response, reduce oscillation, overcome overshoot, but also effectively eliminate static error. The static and dynamic quality of the system has been greatly improved, so PID controller has been most widely used in industrial control. [4]

PID parameter adjustment

Announce
edit
When tuning the parameters of the PID controller, the parameters of the controller can be adjusted by experiment according to the qualitative relationship between the parameters of the controller and the dynamic and stable performance of the system. Experienced commissioning personnel can generally get relatively satisfactory commissioning results quickly. The most important problem in debugging is to know which parameter should be adjusted and whether the parameter should be increased or decreased when the system performance is not satisfactory. [4]
In order to reduce the parameters that need to be adjusted, the PI controller can be used first. In order to ensure the safety of the system, conservative parameters should be set at the beginning of commissioning, such as the proportional coefficient should not be too large, and the integration time should not be too small, to avoid the abnormal situation of system instability or excessive overshoot. Given a step given signal, the system performance information, such as overshoot and regulation time, can be obtained according to the output waveform of the controlled quantity. The PID parameters shall be adjusted repeatedly according to the relationship between PID parameters and system performance. [4]
If the overshoot of the step response is too large, and it can be stable or not stable at all after multiple oscillations, the proportional coefficient should be reduced and the integration time should be increased. If the step response has no overshoot, but the controlled quantity rises too slowly and the transition process takes too long, the parameters should be adjusted in the opposite direction. If the speed of error elimination is slow, the integration time can be appropriately reduced to enhance the integration effect. [4]
Repeatedly adjust the proportional coefficient and integration time. If the overshoot is still large, differential control can be added. The differential time gradually increases from 0. Repeatedly adjust the parameters of the proportional, integral and differential parts of the controller. [4]
In a word, the debugging of PID parameters is a comprehensive process in which all parameters influence each other. Many attempts in the actual debugging process are very important and necessary. Common control methods: P, PI, PD, PID control algorithm. [4]

Algorithm type

Announce
edit

PID incremental algorithm

Discretization formula: [5]
△u(k)= u(k)- u(k-1)
△u(k)=Kp[e(k)-e(k-1)]+Kie(k)+Kd[e(k)-2e(k-1)+e(k-2)]
It can be further rewritten as: [5]
△u(k)=Ae(k)-Be(k-1)+Ce(k-2)
For incremental algorithm, the following functions can be selected: [5]
(1) Selection of filtering
A prefilter can be added to the input, so that the given value entering the control algorithm does not change abruptly, but is a slow variable with a certain inertia delay. [5]
(2) Dynamic process acceleration of the system
In the incremental algorithm, the symbols of the proportional term and the integral term have the following relationship: if the controlled quantity continues to deviate from the given value, the symbols of these two terms are the same, and when the controlled quantity changes in the direction of the given value, the symbols of these two terms are opposite. [5]
Because of this property, when the controlled quantity is close to the given value, the proportional action of the anti sign hinders the integral action, thus avoiding the integral overshoot and the resulting oscillation, which is obviously conducive to control. However, if the controlled quantity is far from the set value and only changes to the set value at the beginning, the control process will be slowed down due to the reverse of proportion and integration. [5]
In order to speed up the starting dynamic process, we can set a deviation range v, when the deviation | e (t). Using this algorithm, the dynamic process of control can be accelerated. [5]
(3) Saturation of PID Incremental Algorithm and Its Suppression
In the PID increment algorithm, because the actuator itself is a mechanical or physical integral storage unit, if the given value changes suddenly, the control increment calculated by the proportional part and differential part of the algorithm may be relatively large. If the value exceeds the maximum allowed by the actuator, then the actually executed control increment will always be the value when it is limited, The redundant part will be lost, which will make the dynamic process of the system longer. Therefore, certain measures need to be taken to improve this situation. [5]
The method to correct this defect is to adopt the accumulation compensation method. When the execution capacity of the actuator is exceeded, the surplus part will be accumulated, and once possible, the supplementary execution will be carried out. [5]

PID position algorithm

Discrete formula: [5]
u(k)=Kp*e(k) +Ki*
+Kd*[e(k)-e(k-1)]
For positional algorithms, the following functions can be selected: [5]
a、 Filtering: the same as the first order inertial filtering; [5]
b、 Saturation inhibition. [5]
(1) Limit weakening integral method
Once the control variable enters the saturation zone, only the operation of weakening the integral term will be performed and the operation of increasing the integral term will be stopped. Specifically, when calculating u (i), it will be judged whether the control amount u (i-1) at the previous time has exceeded the limit range. If it has exceeded the limit range, it will be judged whether the system is in the overshoot area according to the sign of the deviation, thus deciding whether to include the corresponding deviation in the integral term. [5]
(2) Integral separation method
In the basic PID control, when there is a large disturbance or a large change in the set value, because there is a large deviation at this time, and the system has inertia and lag, under the effect of the integral term, there is often a large overshoot and long-term fluctuations. This phenomenon will be more serious especially for the process of slow change of temperature and composition. Therefore, integral separation measures can be adopted, that is, when the deviation is large, the integral effect can be canceled; When the deviation is small, the integral action will be input. [5]
In addition, the threshold value of integration separation shall be determined according to the specific object and requirements. If the threshold is too large to achieve the purpose of integral separation, and if it is too small, it may be impossible to jump out of the integral separation area due to the controlled quantity, and only PD control will be performed residual [5]
Discretization formula: [5]
When
Hour
When | e (t) |>β, q0=Kp (1+Td/T); q1 = -Kp(1+2Td/T); q2 = Kp Td /T;u(t) = u(t-1) + Δu(t)。 [5]
Note: The meanings of each symbol are as follows: [5]
U (t) - output value of the controller. [5]
E (t) - error between controller input and set value. [5]
Kp -- Proportional coefficient. [5]
Ti -- integration time constant. [5]
Td -- differential time constant. (Some places are indicated by "Kd") [5]
T -- Adjustment cycle. [5]
β - integral separation threshold. [5]
(3) Effective deviation method
When the control quantity calculated according to the PID position algorithm exceeds the limit range, the control quantity can actually only take the marginal value U=Umax, or U=Umin. The effective deviation method is to count the deviation value of the corresponding control quantity as the effective deviation value into the integral accumulation rather than the actual deviation into the integral accumulation. Because the control quantity calculated according to the actual deviation was not implemented. [5]
(4) Differential advance PID algorithm
When the given value of the control system steps, the differential action will lead to a large change in the output value, which is not conducive to the stable operation of production. Therefore, the given value is not considered in the differential term, and only the controlled quantity (controller input value) is differentiated. Differential first PID algorithm is also called measured value differential PID algorithm. [5]