A thorough understanding of PID control in one article

Publisher:丝路老君Latest update time:2023-09-28 Source: elecfans Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

PID and its derivative algorithms are one of the most widely used algorithms in industry at present, and are well-deserved universal algorithms!

For R&D personnel, mastering the design and implementation process of the PID algorithm is enough to deal with general R&D problems.


PID Concept

PID is the abbreviation of Proportional, Integral, and Derivative. The proportional, integral, and derivative of the deviation are linearly combined to form a control quantity, which is used to control the controlled object.

The control process of PID cannot be simpler, as shown in Figure 1:

picture

Figure 1: PID control process

Through this flow chart, we can see that PID is also feedback control. In PID control:

1.

first step

Calculate the error based on the feedback value and the expected value. For example, in trajectory tracking control, this error is the distance between the vehicle's current position and the expected path.

2.

Step 2

After finding the error, the proportional, integral and differential terms are calculated based on the error value, where Kp, Ki and Kd are the coefficients of these three terms, indicating the proportion of the influence of these three terms on the output control quantity.

3.

Step 3

Finally, the calculated proportional, integral and differential terms are summed to obtain the final output control quantity.

The structure of PID can be changed flexibly, because according to the actual situation, not all three items, namely proportional, integral and differential, need to play a role, so the PID controller can often be transformed into a P controller and a PD controller.

Next, we will take trajectory tracking as an example to discuss the significance of the three terms: proportion, integration, and differentiation.

Concept

Consider a simple situation. Suppose we want the self-driving car to follow the route in the figure, but the car is in the position shown in Figure 2. How many degrees does it need to turn?

picture

Figure 2: Initial position of the car

If we input a fixed value for steering, the trajectory of the car will be as shown in Figure 3: the car will follow a serpentine curve along the center line of the lane.

picture

Figure 3: Driving trajectory of a car with fixed steering value

Obviously, if we sit in such a car, it will be very uncomfortable. Therefore, experienced drivers with skilled driving skills will keep adjusting the steering wheel when changing lanes or turning. When the deviation is large, they will turn a larger angle, and when the deviation is small, they will turn a smaller angle.

P control in PI, also known as proportional control, is to output different control signals according to different deviations. The output of the controller is proportional to the input. As long as the deviation occurs, a control signal proportional to it can be generated in time, as shown in the figure below.

picture

Figure 4: Proportional control

In this example of trajectory tracking control, it can be expressed as:

steering = K p .e(t)

Here, e(t) is the deviation between the expected value and the feedback value, which here refers to the distance the vehicle deviates from the expected path. Kp is the coefficient of proportional control, usually called the proportional parameter.

We can understand it this way: the angle that the steering wheel should be turned is a multiple of the distance the vehicle deviates from the current lane, and this multiple is Kp.

In P control, the coefficient Kp will directly affect the actual control effect. Within a reasonable value range, the larger the Kp, the better the control effect, and the faster the car will return to the desired path, as shown in Figure 5.

picture

Figure 5: The trajectory of the car at different Kp

However, if the position of the car itself is far away from the expected path and Kp is relatively large, the vehicle will lose control, as shown in Figure 6:

picture

Figure 6: Vehicle out of control when Kp is too large

If proportional control is used alone, the car may constantly cross the desired path and adjust back and forth, and cannot steadily drive along the center line of the lane. In the field of control, this phenomenon is called "overshoot".

PD Concept

It seems that PD control can achieve better control effect, but this is only for normal situations when there are disturbances in the environment.

For example, if the road surface is uneven and the vehicle is slightly offset by external force, the proportional control tends to move toward the center line of the lane, while the differential control hopes to offset this tendency. This may cause a continuous deviation between the vehicle's driving route and the expected path (as shown in Figure 7), making it impossible for the vehicle to travel along the expected path. We call this deviation "steady-state error."

picture

Figure 7: The trajectory of the car after it is disturbed and deviated

In order to eliminate the steady-state error, we need to introduce another term - the integral term. We also multiply the integral of the deviation by a coefficient Ki and add it to the expression of proportional differential control:

picture

Then the control output now becomes the sum of proportional, integral and differential terms. Now the controller changes from a PD controller to a PID controller, which is a proportional, integral and differential controller.

Integral control is actually very easy to understand. After the steady-state error persists for a period of time, the actual trajectory of the vehicle and the expected path will form a long strip area. This area can be called the cumulative error ****.

This cumulative error is actually the area of ​​the long strip, and the area of ​​this area can be expressed as the integral of the deviation.

After adding the integral term, the control function will try to make the integral of the vehicle's actual trajectory as small as possible (that is, make the area of ​​the shape formed between the vehicle's actual trajectory and the expected path as small as possible), so that the steady-state error can be eliminated.

Now we need to adjust three coefficients. Similarly, the size of the integral coefficient Ki will also affect the stability of the entire control system, as shown in Figure 8:

picture

Figure 8: The trajectory of the car with different Ki

If Ki is too large, the controller will become unstable because normal controller fluctuations will be exaggerated.

If Ki is too small, it will take a long time for the controlled vehicle to escape from the steady-state error, which will inevitably put the vehicle in a dangerous situation in some cases.

Only when Ki is just right can the vehicle quickly approach the ideal trajectory.

Summarize

We simultaneously consider three factors: the degree of vehicle deviation, the speed of approaching the desired path, and the continuous deviation error to control the vehicle to achieve trajectory tracking. This is proportional-integral-derivative control (PID).

This is explained using the example of vehicle trajectory tracking. Let’s summarize each link of PID:

The role of proportional control is to change the control amount in the direction of reducing the deviation according to the size of the deviation. The strength of the control effect depends on the proportional coefficient Kp. The larger the Kp, the stronger the control. However, too large a Kp will cause system oscillation, produce "overshoot", and destroy system stability.

The role of differential control is to prevent the change of deviation according to the rate of change of deviation. It helps to reduce overshoot, overcome oscillation and make the system stable.

Integral control can eliminate the steady-state error of the system and also promote the control quantity to change in the direction of reducing the deviation.

Selecting appropriate K p , Kd and Ki is the key to using PID controller, and the values ​​of the three parameters need to be determined through continuous trial and adjustment combined with actual working experience.


Reference address:A thorough understanding of PID control in one article

Previous article:Two techniques for implementing PID control algorithms
Next article:Brief Introduction of FOC of BLDC Motor Control Algorithm

Latest Embedded Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号