Thread Content
I. The PID Story: Xiao Ming was given a task: there was a water tank that was leaking (and the leakage rate wasn’t necessarily constant), and it was necessary to keep the water level at a certain height. Whenever the water level dropped below this desired level, water had to be added to the tank. After receiving the task, Xiaoming stayed by the water tank the whole time. As time passed and he grew bored, he went inside to read novels, checking the water level every 30 minutes. The water leaked too quickly; every time Xiaoming came to check, almost no water was left, and it was still far from the required level. So Xiaoming changed to checking every 3 minutes, and as a result, not much water leaked each time, and no refilling was needed. Checking too frequently was pointless. After several trials, it was determined that checks should be done every 10 minutes. This inspection time is called the sampling period. At first, Xiao Ming used a ladle to add water; the faucet was about ten meters away from the tank, so he had to make several trips to fill it up. So he switched to using a bucket – one bucket at a time – which reduced the number of trips needed and increased the speed at which water was added. However, the tank overflowed several times, causing his shoes to get wet accidentally. Xiao Ming then thought of another solution: instead of using a ladle or a bucket, he would use a basin. After trying this method a few times, he found that it worked perfectly – he didn’t have to make many trips, and the water wouldn’t overflow either. The size of this water addition tool is called the proportionality coefficient. Xiaoming noticed that although the water didn’t overflow when added in excess, it sometimes rose to a level much higher than the desired height, still posing a risk of wetting the shoes. He came up with another idea: he installed a funnel on the water tank, so that instead of pouring water directly into the tank, it was poured into the funnel and added slowly. In this way, the problem of overflow is solved, but the rate at which water is added slows down, and sometimes it can’t keep up with the rate of water leakage. So he tried using funnels of different sizes to control the water addition rate, and finally found a funnel that satisfied him. The time of the funnel is called the integration time. Xiao Ming was finally able to catch his breath, but the requirements for the task suddenly became stricter. The timeliness of water level control had to be improved; once the water level dropped too low, water had to be added immediately to the required level, and it couldn’t be increased by too much, otherwise no payment would be given. Xiaoming is in trouble again! So he racked his brains again and finally came up with a solution: keep a basin of spare water nearby. As soon as it was detected that the water level had dropped, water would be poured in directly from the basin, without going through a funnel. This ensured timely refilling, but sometimes the water level would become too high. He is asking to drill a hole a little above the water level, and then connect a pipe to the spare bucket below, so that the excess water can flow out through the hole above. The rate at which this water leaks is called the differential time. Seeing a few posts asking about the sampling period, I came up with this story on the spot. The metaphor of differentiation is a bit forced, but it can help with understanding; hehe. It’s at an introductory level, and if it can assist beginners in grasping PID, that’s sufficient. In the story, Xiaoming’s experiments are carried out step by step independently, but in reality, the tool used for adding water, the diameter of the funnel, and the size of the overflow hole all affect the speed at which water is added as well as the amount of overshoot in water level. After conducting subsequent experiments, it is often necessary to adjust the results of previous experiments. II. Control model: The person uses PID control to pour half a cup of water with markings from a kettle into a glass, then stops ; Set value: the half-full mark on the water cup ; Actual value: The actual amount of water in the cup ; Output value: Number of times the kettle is poured and amount of water poured from the cup ; Measurement sensor: Human eye. Target of operation: Human. Action being performed: Pouring water. Reverse action: Scooping water out. 1. P-proportional control means that when the person sees that the amount of water in the cup has not reached half of the cup’s capacity, they pour water from the kettle into the cup until that amount is reached; if there is already more water in the cup than the designated level, then water is scooped out of the cup until the appropriate amount remains. This process stops once either the amount of water is less than half or more than half of the desired level. Note: P-proportional control is the simplest form of control. The output of its controller is proportional to the input error signal. When only proportional control is used, there is a steady-state error in the system output. 2. PI integral control means pouring water into the cup according to a certain amount; if there are no marks indicating the water level in the cup, pouring continues until the level exceeds half of the cup. At that point, water is scooped out of the cup, and this process is repeated: pouring water when the level is too low and scooping water out when it’s too high, until the water level reaches the marked level. Note: In integral I control, the output of the controller is proportional to the integral of the input error signal. For an automatic control system, if there is a steady-state error after it reaches steady state, then such a control system is referred to as a system with steady-state error, or simply a system with error. To eliminate steady-state error, an “integral term” must be introduced into the controller. The integral term represents the time-dependent integration of the error, and it increases as time goes on. In this way, even if the error is small, the integral term increases over time; it drives the output of the controller to increase, thereby further reducing the steady-state error until it becomes zero. Therefore, a proportional-plus-integral (PI) controller enables the system to have no steady-state error after reaching steady state. 3. PID differential control works by allowing a person to observe the distance between the water level in the cup and the scale. When this distance is large, water is poured in large amounts using the kettle; as the water level gets closer to the scale, the amount of water poured in is reduced, gradually bringing the level closer to the scale until it stops at the indicated mark on the cup. If it can finally stop precisely at the scale position, that is zero-error control ; If it stops near the scale, there is static error control. Note: In differential control D, the output of the controller is proportional to the derivative of the input error signal (i.e., the rate of change of the error). In practical engineering applications, the most widely used controller control laws are proportional, integral, and derivative control, commonly referred to as PID control or PID regulation. The PID controller has been around for nearly 70 years; thanks to its simple structure, good stability, reliable operation, and ease of adjustment, it has become one of the key technologies in industrial control. When the structure and parameters of the controlled object cannot be fully understood, or an accurate mathematical model is not available, and other techniques from control theory cannot be applied, the structure and parameters of the system controller must be determined based on experience and on-site tuning; in such cases, PID control technology is the most convenient to use. That is, when we do not fully understand a system and its controlled object, or when it is not possible to obtain the system parameters through effective measurement methods, PID control technology is the most suitable approach. There is PID control; in practice, there are also PI and PD control. A PID controller controls the system by calculating the control amount using proportion, integration, and differentiation based on the system’s error. Proportional (P) control: Proportional control is the simplest form of control. The output of its controller is proportional to the input error signal. When only proportional control is used, there is a steady-state error in the system output. Integral (I) control: In integral control, the output of the controller is proportional to the integral of the input error signal. For an automatic control system, if there is a steady-state error after it reaches steady state, then such a control system is referred to as a system with steady-state error, or simply a system with error. To eliminate steady-state error, an “integral term” must be introduced into the controller. The integral term represents the time-dependent integration of the error, and it increases as time goes on. In this way, even if the error is small, the integral term increases over time; it drives the output of the controller to increase, thereby further reducing the steady-state error until it becomes zero. Therefore, a proportional-plus-integral (PI) controller enables the system to have no steady-state error after reaching steady state. Differential (D) control: In differential control, the output of the controller is proportional to the derivative of the input error signal (i.e., the rate of change of the error). Automatic control systems may experience oscillations or even instability during the process of correcting errors. The reason is the presence of components with large inertia or components that introduce delay, which have the effect of suppressing errors; their changes always lag behind those of the errors. The solution is to make the change in the error-suppression effect \"proactive\", that is, when the error approaches zero, the error-suppression effect should be zero. In other words, it is often not sufficient to include only a “proportional” term in the controller; the function of this proportional term is merely to amplify the magnitude of the error. What is needed now is a “derivative” term, which can predict the trend of error changes. Thus, a controller with both proportional and derivative terms can ensure that the control action to suppress the error becomes zero, or even negative, in advance, thereby preventing severe overshoot of the controlled variable. Therefore, for controlled objects with high inertia or lag, a proportional-plus-differential (PD) controller can improve the dynamic characteristics of the system during the regulation process. When tuning PID parameters, it would be ideal to have a theoretical method for determining them, but in practical applications, the PID parameters are more often determined through trial and error. Increasing the proportional coefficient P generally speeds up the system’s response and helps to reduce the steady-state error when such an error exists. However, an excessively large proportional coefficient leads to significant overshoot and oscillations, thereby deteriorating the stability of the system. Increasing the integration time I helps to reduce overshoot and oscillations, thereby improving the stability of the system, but it prolongs the time required for the system to reach steady state. Increasing the differential time D helps to speed up the system’s response time, reduces overshoot, and improves stability; however, it weakens the system’s ability to suppress disturbances. During trial adjustments, one can refer to the impact trends of the above parameters on the system control process, and follow a tuning procedure that starts with proportional control, followed by integral control, and then derivative control. General methods for tuning PID controller parameters: Tuning the parameters of a PID controller is a core aspect of control system design. It determines the values of the proportional coefficient, integral time, and derivative time of the PID controller based on the characteristics of the process under control. There are many methods for tuning PID controller parameters, which can be broadly divided into two categories: one is the theoretical calculation tuning method. It mainly determines the controller parameters through theoretical calculations based on the mathematical model of the system. The calculation data obtained using this method may not be directly usable; it must still be adjusted and modified based on actual engineering conditions ; The second is the engineering tuning method, which relies primarily on engineering experience and is carried out directly during the testing of control systems. It is a simple method that is easy to master, and it is widely used in practical engineering applications. The engineering tuning methods for PID controller parameters mainly include the critical ratio method, the response curve method, and the attenuation method. The three methods each have their own characteristics, and what they all have in common is that experiments are conducted first, followed by the tuning of controller parameters using engineering experience formulas. However, the controller parameters obtained using either method require final adjustment and refinement during actual operation. The critical ratio method is generally used nowadays. The steps for tuning the PID controller parameters using this method are as follows: (1) First, select a sufficiently short sampling period to enable the system to operate ; (2) Only a proportional control element is added, until the system exhibits critical oscillation in its step response to the input; at that point, the proportional gain and the critical oscillation period are recorded ; (3) The parameters of the PID controller are calculated using formulas under a certain degree of control. Setting of PID parameters: This is done based on experience and familiarity with the process, by referring to the measured values and the setpoint curve in order to adjust the values of P, I, and D. Common mnemonic in the book: To determine the optimal parameter settings, check in ascending order from small to large ; First proportion, then integration, and finally add the differential ; The curve oscillates very frequently; the scale dial needs to be enlarged ; The curve floats around the large bay; turn the scale dial inwards ; The curve deviates slowly from its original state, and the integration time decreases ; The curve has a long fluctuation period, so the integration time needs to be increased further ; The curve oscillates at a high frequency; first reduce the derivative ; Large differential motion results in slow fluctuations. The differential time should be increased ; The ideal curve has two waves, higher at the front and lower at the back in a 4 to 1 ratio ; Observe first, then adjust and analyze thoroughly; the quality of the adjustment will surely be high. In my opinion, the magnitude of the PID parameter settings should, on the one hand, be determined based on the specific characteristics of the control object ; On the other hand is experience. P is used to address amplitude oscillations; a higher value of P results in greater amplitudes of these oscillations, but at a lower frequency, allowing the system to reach stability more quickly ; I determines the speed of action response; a larger value of I results in a slower response speed, while a smaller value leads to a faster one ; D is used to eliminate static errors; generally, its value is set quite low, and it has a minimal impact on the system. How to adjust PID parameters for optimal performance: (1) Tuning the proportional control – Increase the effect of proportional control from low to high, and observe each response until a response curve with fast reaction time and low overshoot is obtained. (2) Integral control element: If the steady-state error is not satisfactory under proportional control, integral control must be added. First, reduce the scaling factor selected in step (1) to 50–80% of its original value, then set the integration time to a higher value and observe the response curve. Then reduce the integration time, increase the integral action, and adjust the proportional coefficient accordingly, trying repeatedly until a satisfactory response is obtained to determine the proportional and integral parameters. (3) Tuning the differential element: If, after step (2), PI control can only eliminate the steady-state error but the dynamic performance is not satisfactory, differential control should be added to form PID control. Start with the pre-differentiation time TD set to 0, gradually increase TD while correspondingly adjusting the proportional coefficient and integral time, and repeatedly trial and error until a satisfactory control effect and PID control parameters are obtained.
PID is an algorithm that controls based on the deviation. First of all, it is important to understand what dimensionless quantification means: it involves converting measurement values, set values, and so on into values within the range of 0-1. For example, in the case of temperature, if the temperature range is 0-100 degrees, and the currently measured temperature is 40 degrees, then its dimensionless value will be 0.4. If the set value is 80 degrees, its dimensionless value will be 0.8. Only after values are transformed into a dimensionless form can calculations be performed. The deviation is 0.8 – 0.4 = 0.4; if P is 200%, then the P output will be 0.8. If the integration time is 10 minutes, that’s 600 seconds, so what does that mean? In other words, if the deviation of 0.4 persists for 10 minutes, the value of P output mentioned above, which is 0.8, is added to it. Of course, 0.8 + 0.8 = 1.6, and this is not acceptable; since the maximum output of the control valve is 100%, that value will be capped at 100%. Of course, the integral increases with each calculation (sampling period). If the sampling period is 1 second, then if the deviation is 0.4, the integral will increase by 0.8/600. So what does D mean? Suppose a reactor is reacting at 100 degrees when suddenly heat release begins, with the temperature rising by 0.1 degree every 5 seconds; the deviation is very small. Assuming the temperature measurement range is 0–200 degrees and the set temperature is 100 degrees, then the temperature rises to 100.2 degrees, giving a deviation of 0.2/200 = 0.001. If the proportional coefficient is 500%, the cooling water control valve will increase by 0.5%. Assuming there is one ton of water inside the reactor and the temperature rises by 0.1 degree every 5 seconds, what is its heat release rate? 0.02*1000*4.3=86kw. Are you simply going to adjust the valve by 0.5% to deal with this situation? If the temperature reaches 103 degrees, the material will be ruined – is that acceptable? So proportional control cannot be used, nor can integration; integration is merely for fine-tuning, to eliminate steady-state error. I can only go with differentiation. So what does differential time mean? If the differential time is 10 minutes, it means that the temperature should be maintained at that rate of increase for 10 minutes; with an increase of 0.1 degrees every 5 seconds, the temperature will rise by 12 degrees over 10 minutes. This 12-degree deviation is used as the output for D. Since 12 degrees corresponds to 0.06, multiplying this by 500% (the proportionality factor) gives 30%. Assuming that the control valve is initially set at 20% open, once a response starts and the temperature increases by 0.1 degree every 5 seconds, the control valve will be adjusted by 30%, bringing its opening to 50%. The PID output is then the sum of these three values.