当前位置:网站首页>PID refinement
PID refinement
2022-04-23 01:46:00 【Traceless rain】
What is? PID?
PID, Namely “ The proportion (proportional)、 integral (integral)、 differential (derivative)”, Is a very common control algorithm .
PID There has been a 107 It's about 20 years old .
It's not something very sacred , Everyone must have seen it PID Practical application of
Like a four-axis aircraft , Another example is the balance car ...... And the constant speed cruise of the car 、3D The temperature controller on the printer ....
It's something like this : A physical quantity needs to be “ Stay stable ” The occasion of ( Like maintaining balance , Stable temperature 、 Speed, etc ),PID It's going to come in handy .
So here comes the question :
such as , I want to control one “ The heat is fast ”, Keep the temperature of a pot of water at 50℃, Such a simple task , Why use the theory of calculus .
You must be thinking :
This is not so easy Well ~ Less than 50 Just let it heat up , Greater than 50 Power off at 90 degrees , Not to go ? A few lines of code use Arduino Write it in minutes .
you 're right ~ In the case of low demands , It can be done ~ But! If you put it another way , You know what the problem is :
What if my control object is a car ?
If you want to keep the speed of the car at 50km/h Immobility , Dare you do that again .
imagine , If the car's constant speed cruise computer at a certain time to measure the speed is 45km/h. It immediately commands the engine : Speed up !
result , Suddenly there's a 100% Full throttle , Buzz , The car sped up to 60km/h.
At this time, the computer issued a command : brake !
result , Squeak ............... wow ............( Passenger vomiting )
therefore , On most occasions , use “ Switching quantity ” To control a physical quantity , It seems relatively simple and rough . occasionally , It can't be stable . Because of MCU 、 Sensors are not infinitely fast , collection 、 Control takes time .
and , The control object has inertia . For example, you unplug a heater , its “ Waste heat ”( Thermal inertia ) It may also raise the water temperature for a little longer .
At this time , We need a kind of 『 Algorithm 』:
It can bring the physical quantity that needs to be controlled near the target
It can “ foresee ” The change trend of this quantity
It can also eliminate heat dissipation 、 Static error caused by resistance and other factors
....
therefore , Mathematicians at that time invented this enduring algorithm —— This is it. PID.
You should already know ,P,I,D There are three different regulatory effects , It can be used alone (P,I,D), You can also use two (PI,PD), You can also use three together (PID).
What is the difference between these three functions ? My guest, don 't worry , Listen to me slowly
Let's just say PID The three most basic parameters of the controller :kP,kI,kD.
kP
P It means proportion . Its effect is most obvious , The principle is also the simplest . Let's start with this :
The amount that needs to be controlled , For example, water temperature , There's it now 『 Current value 』, There's also what we expect 『 The target 』.
When the gap is small , Just let the heater “ airily ” Heat it up .
If for some reason , The temperature has dropped a lot , Just let the heater “ A little bit of force ” Heat it up .
If the current temperature is much lower than the target temperature , Just let the heater “ At full power ” heating , Get the water temperature near the target as soon as possible .
This is it. P The role of , Compared with the switch control method , Is it right? “ gentle ” A lot .
When you actually write a program , Let the deviation ( The goal subtracts the current ) With the regulating device “ The intensity of adjustment ”, Establish a relationship of first degree function , You can achieve the most basic “ The proportion ” Controlled ~
kP The bigger it is , The more radical the regulation is ,kP Turning down makes the regulation more conservative .
If you're making a balance car , With P The role of , You'll find that , The balance car goes back and forth near the balance angle “ Shaking ”, It's hard to hold on .
If you've reached this point —— congratulations ! Success is only a small step away ~
kD
D Better understand the role of , So let's start with D, The final say I.
We had just now P The role of . It's not hard for you to find out , Only P It doesn't seem to get the balance station up , The temperature of the water is also controlled dangerously , It seems that the whole system is not particularly stable , Always in “ shake ”.
Imagine a spring in your heart : Now in equilibrium position . Give it a pull , And let go . And then it will vibrate . Because the resistance is very small , It can oscillate for a long time , It's going to stop at equilibrium again .
Please imagine : If you immerse the system in the water shown above , Pull it again : In this case , It takes much less time to return to equilibrium .
We need a control function , Let the controlled physical quantity “ The rate of change ” Tend to 0, Which is similar to “ damping ” The role of .
because , When you're closer to the goal ,P The control effect is less . The closer to the goal ,P The softer the effect of . There are many internal and external factors , Make the control variable swing in a small range .
D The purpose of this paper is to make the speed of physical quantity tend to 0, Just when , This quantity has speed ,D Just push in the opposite direction , Try to stop the change .
kD The greater the parameters , The stronger the braking force is in the opposite direction of speed .
If it's a balance car , add P and D Two kinds of control functions , If the parameters are adjusted properly , It should be able to stand up ~ Cheers .
wait ,PID The three brothers seem to have another . look PD You can keep the physical quantity stable , That's more I why ?
Because we ignore an important situation :
kI
Take hot water as an example . If someone takes our heating device to a very cold place , It's boiling water . It needs to be burned to 50℃.
stay P Under the influence of , The water temperature rises slowly . Until it goes up to 45℃ when , He found a bad thing : It's too cold , The speed at which water dissipates heat , and P The controlled heating rate is equal to .
This is how to do ?
P Brother thinks so : I'm close to the goal , Just heat it gently .
D Brother thinks so : Heating is equal to heat dissipation , The temperature didn't fluctuate , I don't seem to have to adjust anything .
therefore , The temperature of the water stays at forever 45℃, Never to 50℃.
As a person , According to common sense , We know , The heating power should be further increased . But how to calculate the increase ?
The method that the predecessors thought of was really ingenious .
Set an integral . As long as the deviation exists , And I'm going to integrate the deviation over and over again ( Add up ), And respond to the intensity of regulation .
thus , Even if 45℃ and 50℃ The difference is not too big , But over time , As long as the target temperature is not reached , This integral is increasing . The system will gradually realize that : We haven't reached the target temperature yet , It's time to increase the power !
After reaching the target temperature , Suppose the temperature doesn't fluctuate , The integral value will not change again . At this time , The heating power is still equal to the cooling power . however , The temperature is stable 50℃.
kI The greater the value of , The greater the coefficient of the integral , The more obvious the integral effect .
therefore ,I Is that , Reduce the static error , Make the controlled physical quantity as close as possible to the target value .
I There's a problem with using it : You need to set an integral limit . Prevent from heating at the beginning , I'll just multiply the integral too much , It's hard to control .
版权声明
本文为[Traceless rain]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230143119524.html
边栏推荐
- The leader / teacher asks to fill in the EXCEL form document. How to edit the word / Excel file on the mobile phone and fill in the Excel / word electronic document?
- postman里面使用 xdebug 断点调试
- Abused "architect"!
- Planning garlic guest (outing) (DFS and BFS solution of dyeing block problem)
- C语言中如何“指名道姓”的进行初始化
- 揭秘被Arm编译器所隐藏的浮点运算
- Find number (DFS)
- Itextsharp page setup
- Detonate the bomb (DFS)
- Learning methods and career development guide (2022 Edition)
猜你喜欢
The most understandable life cycle of dependency injection
Abused "architect"!
《维C中国》乡村助农暖人心第三站嘉宝果农场
领导/老师让填写电子excel表格文档可手机上如何编辑word/excel文件填写excel/word电子文档?
Oracle database query lock table SQL script and delete lock information script (necessary for database development ETL and DBA)
Qingyan environment and Shenzhen Stock Exchange listing: annual revenue of 180 million and market value of 4.1 billion
Digital collection platform settled in digital collection platform to develop SaaS platform of digital collection
Soatest preliminary understanding
42. Use k3det in mmrotate for rotating target detection, MNN deployment and ncnn deployment
Do447 manage user and team access
随机推荐
Error in face detection and signature of Tencent cloud interface
[Blue Bridge Cup] [10th real topic in 2019] priority of takeout shop
中金财富是国企吗,开户安全吗
Itextsharp page setup
01 knapsack problem - and deformation problem
Challenges often faced by client project management
npm——配置淘宝镜像
Redis实现分布式锁
2022 low voltage electrician examination questions and answers
FL studio20. 8 the latest Chinese version installation and download graphic tutorial
ESP32使用freeRTOS的消息队列
DO447管理用户和团队的访问
Android sqliteopenhelper data table structure upgrade
Vscode + PHP debug + namespace guidelines
After disk D is distributed to Disk C, what should I do if the database recovery hangs? Please answer
iTextSharp 页面设置
Longest common subsequence (record path version)
(product resources) mingdeyang ad8488 module high performance digital X-ray FMC interface 128 analog channel high-speed ADC chip
ESP32蓝牙Bluetooth Controller API介绍
Counting garlic customers: Sudoku (DFS)