PID parameter adjustment, personal experience (with output curve)

Series Article Directory

1. Component foundation 2. Circuit design 3. PCB design 4. Component welding 5. Board debugging 6. Program design 7. Algorithm learning 8. Writing exe 9. Testing standards 10. Project examples









foreword

An ordinary college student, what can you do to save your future?
The most detailed embedded system designer training manual in history
Embedded hardware and software summary

For you who can't find the direction of struggle after graduating from university (updated from time to time every week)

Shanghai Vocational Aptitude Examination Institute
China Computer Technology Vocational Qualification
Network Shanghai Socialized Evaluation Title Application Guidelines


PID algorithm nanny level teaching

①, start PID from a small story

PID control principle: you will understand after reading these three stories

insert image description here

Xiao Ming received such a task: there is a water tank leaking (and the speed of water leakage is not necessarily constant), and the water surface height is required to be maintained at a certain position. Once it is found that the water surface height is lower than the required position, add water to the water tank. water.
After receiving the task, Xiao Ming stayed beside the water tank. He felt bored after a long time, so he ran to the room to read novels, and checked the water level every 30 minutes. The water leaked too fast. Every time Xiaoming came to check, the water was almost finished, and it was far from the required height. Xiaoming changed it to check every 3 minutes. , coming too often to do is useless. After a few trials, be sure to check every 10 minutes. This inspection time is called the sampling period.
At first, Xiaoming used a ladle to add water. The faucet was more than ten meters away from the water tank. He often had to run several times to add enough water, so Xiaoming changed to using a bucket. It's fast too, but I overflowed the tank several times, and accidentally got my shoes wet several times. Xiao Ming used his brain again. I didn't need a scoop or a bucket. I used a basin. After a few times, I found that it was just right. Many times, it won't let the water overflow. The size of this watering tool is called the scale factor.
Xiao Ming also found that although the water would not overflow in excess, sometimes it would be much higher than the required position, and there was still a danger of wetting the shoes. He thought of another way to install a funnel on the water tank. Each time he added water, he did not pour it directly into the water tank, but poured it into the funnel and let it be added slowly. In this way, the problem of overflow is solved, but the speed of adding water is slow, and sometimes it can't keep up with the speed of water leakage. So he tried changing the funnels of different sizes to control the speed of adding water, and finally found a funnel that he was satisfied with. The funnel time is called the integration time.
Xiao Ming finally took a breath, but the requirements of the task suddenly became stricter, and the timeliness of water level control was greatly improved. Once the water level was too low, the water must be added to the required position immediately, and it should not be too high, otherwise no wages will be paid. Xiao Ming is in trouble again! So he tried his best, and finally let him think of a way, always put a basin of spare water next to him, and when he found that the water level was low, he would just go down a basin of water without going through the funnel, so the timeliness was guaranteed, but sometimes the water level would be high too much. He also drilled a hole for the water a little above the required water surface, and then connected a pipe to the spare bucket below, so that the excess water would leak out of the hole above. The speed at which the water leaks out is called the differential time.
After seeing several posts asking about the sampling period, I thought of such a story temporarily. The analogy of differentiation is a bit far-fetched, but it is enough to help understand it. Haha, entry-level, if you can help novices understand PID, it is enough. In the story, Xiaoming's test is done independently step by step, but the actual water adding tool, the diameter of the funnel, and the size of the overflow hole will also affect the speed of adding water and the size of the water level overshoot. After doing the subsequent experiments, it is often necessary to modify the front Results of the experiment.

②, Analysis of PID algorithm

Analysis of PID Algorithm

③、Explanation of PID control algorithm

Easy-to-understand PID control algorithm explanation

④, PID parameter analysis (one article reads PID and will debug kp, ki, kd) (positional + incremental PID)

PID parameter analysis (read the PID in one article and debug kp, ki, kd) (positional + incremental PID)

⑤, STM32 - PID constant temperature control (including C language program)

STM32 - PID constant temperature control

⑥, PID parameter adjustment formula

Set the parameters to find the best, and check in order from small to large.
First, proportional, then integrate, and finally add differential. The curve
oscillates frequently, and the proportional dial needs to be enlarged
. The curve floats around the big bay.
Going down , the
fluctuation period of the curve is longer, and the integration time is longer . The
oscillation frequency of the curve is fast, and the differential is lowered first
. The larger the moment, the slower the fluctuation. Differentiation time should be lengthened . The ideal curve has two waves. The front is high
and the back is low. 4:1 P increases I; if the ratio is too large, it will cause the system to oscillate ; if the integral is too large, it will cause the system to become sluggish





insert image description here

⑦, PID temperature control parameter setting method

Look at two more first, get some impressions, and then adjust

1. PID temperature control parameter setting method
2. PID control parameter setting (adjustment method) principle + diagram + MATLAB debugging
3. Detailed analysis of PID principle and adjustment process
4. PID adjustment experience
5. PID parameter selection of temperature control equipment (Real and effective)
(1) Determining the proportional coefficient Kp
When determining the proportional coefficient Kp, first remove the integral and differential terms of the PID, and set Ti=0 and Td=0, making it
pure proportional regulation. The input is set to 60%~70% of the maximum allowable output of the system, and the proportional coefficient Kp increases gradually from 0
until the system oscillates; and vice versa, the proportional coefficient Kp decreases gradually from this time until the system oscillation disappears.
Record the proportional coefficient Kp at this time, and set the proportional coefficient Kp of the PID to be 60% to 70% of the current value.

(2) Determine the integral time constant Ti
After the proportional coefficient Kp is determined, set a larger integral time constant Ti, and then gradually decrease Ti until the system
oscillates, and then reversely, gradually increase Ti until the system oscillation disappears . Record Ti at this time, and set the PID integral
time constant Ti to 150% to 180% of the current value.

(3) Determining the differential time constant Td
The differential time constant Td generally does not need to be set. If it needs to be set,
it is the same as the method for determining Kp, taking 30% of its value when it is not oscillating.

(4) No-load and on-load joint debugging of the system Fine-tune
the PID parameters until the performance requirements are met.

⑧, Matlab debugging

(1), 2016 matlab Chinese version software and installation tutorial
2016 matlab Chinese version software and installation tutorial

(2) matlab realizes pid simulation
matlab realizes pid simulation
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
Search, PID
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here

insert image description here

⑨、Personal experience

When I first came across this thing, I didn't know anything. I followed various tutorials on the Internet and adjusted it, and finally it came out.
insert image description here
(1) First, there is the program, the fourth section above, PID.c and PID.c. h can be used directly; it is more detailed.
(2) The program is only applied, and you have to spend time to adjust, mainly adjust KP, Ti and Td;
insert image description here
(3) First set KP to 1, and the others to 0; see the output fluctuation

If the actual value of the output has been rising slowly, it still rises when it exceeds the set value, and it rises for a long time before it comes down. At this time, the
KP setting should be small.

insert image description here
insert image description here
insert image description here
insert image description here
insert image description here

(4), KP is equal to the value just now, TI is equal to 100000, TD is still 0;
insert image description here
insert image description here
insert image description here

(5), KP, TI equal to the value just determined, TD equal to 1.
insert image description here
insert image description here
insert image description here
insert image description here
The above is the normal situation, and the following is the
abnormal
insert image description here
situation question.
2. There is a problem with the output end.
insert image description here
No matter how you adjust it, the output is always oscillating and has a slow upward trend or a downward trend. At this time, you need to see if there is a problem with your output end; for example, if you control it to 100, then 100 is to keep the signal, 101 is that the set value has not yet been reached, increase the output signal, and similarly 99 is to reduce the output signal. If online debugging, 99 becomes a plus, or 101 becomes a minus, then the above situation will occur.

The above is all personal experience, welcome to correct me.

⑩, serial port waveform debugging assistant

Paper airplane debugging assistant

Paper airplane serial debugging assistant to observe mup6050 data waveform

insert image description here

insert image description here

Guess you like

Origin blog.csdn.net/weixin_44407238/article/details/119255699