pid control system for dummies
TRANSCRIPT
• Quadcopter
• Flight Control
• Robots
• Self Driving Cars
• Air conditioner
When we need to automatically control something…
• We are a feedback control system!!
• Try walking / writing with your eyes closed!
Feedback Control
Observe the Effect
Make changes
Air conditioner
• Our room is at 30°C.
• We need to :
Cool down it to 22°C
Within a shortest time.
Maintain the temperature at 22°C against external effects.
On-Off control
• Can’t control the power: only ON - OFF
• Disadvantage:
oTemperature oscillations
oUnstable System
Switch On A/C
Switch Off A/C
Temperature < 22°C
Temperature > 22°C
PID Control System
Remember the
PAST
(Integral)
Consider the
PRESENT
(Proportional)
Predict the
FUTURE
(Derivative)
And adjust power accordingly…
ERROR
• Air condition in a room
• Error will be changing over time.
Error8°C
Process Variable30°C
Set Point Value22°C
= -
Proportional ControlConsider the present
Concept : Reduce power gradually
𝑃𝑜𝑤𝑒𝑟 = 𝐾𝑝(𝐸𝑟𝑟𝑜𝑟)
Where 𝐾𝑝 is proportional gain
(we need to tune)
Reduce power of A/C gradually, until temperature = 22°C
• Steady state error may occur in pure proportional control.
• We don't have this in reality.
Systems have momentum –The room has heat capacity
Add small overshoot
Proportional control…
Integral ControlRemember the past!
Concept : If past has high errors, increase the power
Integral : Sum of errors over time
𝑃𝑜𝑤𝑒𝑟 = 𝐾𝑝 𝐸𝑟𝑟𝑜𝑟 + 𝐾𝑖(𝐼𝑛𝑡𝑒𝑔𝑟𝑎𝑙 𝑜𝑓 𝑝𝑎𝑠𝑡 𝑒𝑟𝑟𝑜𝑟𝑠)
Where 𝐾𝑖 is integral gain (we need to tune)
If temperature doesn’t settle for a long time, apply more power
Proportional-Integral control…
• Removes steady state error
• Tends to introduce overshoot!
• Increases relaxation time
• 𝐾𝑖 should be very small to prevent overshoot
Derivative ControlPredict the future!
Concept : If room cools slowly, increase the power
𝑃𝑜𝑤𝑒𝑟 = 𝐾𝑝 𝐸𝑟𝑟𝑜𝑟 + 𝐾𝑖 𝐼𝑛𝑡𝑒𝑔𝑟𝑎𝑙 𝑜𝑓 𝑝𝑎𝑠𝑡 𝑒𝑟𝑟𝑜𝑟𝑠 + 𝐾𝑑 𝐷𝑒𝑟𝑖𝑣𝑎𝑡𝑖𝑣𝑒 𝑜𝑓 𝑒𝑟𝑟𝑜𝑟
Where 𝐾𝑑 is derivative gain (we need to tune)
eg: Empty room cools fast Use low powerWater filled room cools slowly Use high power
PID Equation
Power = 𝐾𝑝 Error 𝐾𝑖
Sum of past
errors over
time
𝐾𝑑
How fast
error
changes
+ +
𝑃𝑜𝑤𝑒𝑟(𝑡) = 𝐾𝑝 ∙ 𝑒𝑟𝑟𝑜𝑟(𝑡) + 𝐾𝑖 ∙ 𝑠𝑡𝑎𝑟𝑡
𝑛𝑜𝑤
𝑒𝑟𝑟𝑜𝑟(𝑡) ∙ 𝑑𝑡 + 𝐾𝑑 ∙𝑑(𝑒𝑟𝑟𝑜𝑟(𝑡))
𝑑(𝑡)
Math : Second Order Ordinary Differential Equation
𝐾𝑝 , 𝐾𝑖 , 𝐾𝑑 are constants to be determined by careful tuning
• 𝐾𝑝 , 𝐾𝑖 , 𝐾𝑑 are tuned to have
• Minimum relaxation time
• Minimum steady state error
• Minimum oscillations / vibrations
PID Equation
Power = 𝐾𝑝 Error 𝐾𝑖
Sum of past
errors over
time
𝐾𝑑
How fast
error
changes
+ +
• To self balance
• 3 axes – Adjust angle (3 PID equations, 9 constants to be tuned)
• Error - Measured by a gyroscope module, Power - Given to the motors
Quadcopters, Aircrafts