View
223
Download
3
Category
Preview:
Citation preview
Implementing PID on a microcontroller
BJ FurmanME 190 Mechatronics Engineering Design
11NOV2015
(adapted from: http://brettbeauregard.com/blog/2011/04/improving-the-beginners-pid-introduction/)
PID equation
Standard form
Parallel form
πΎ π=πΎ πΎ π=πΎπ π
πΎ π=πΎπ πlet
ππ’π‘ππ’π‘=πΎ ΒΏ
Figure from Matlab Help (Designing PID Controllers with the PID Tuner)
u=
u=
= r(t) β y(t)
Important considerations
o Sample Timeo Derivative Kicko On-The-Fly Tuning Changeso Reset Windup Mitigationo On/Off (Auto/Manual)o Initialization (bump-less transfer)o Controller Direction
(Way too) simple algorithm
Sample Time
o Need to call at a regular intervalo Use millis() or an interrupt
(cont.)
Sample Time, cont.
Derivative Kick
The problem
ππ’π‘ππ’π‘=πΎ ΒΏ
dttdy
dttde
dttdy
dttde
dttdy
dttdr
dttde
)()(
)(0
)(
constant is r(t) if
)()()(
Derivative Spikes
Derivative Kick, cont.
Derivative Kick, cont.
On-the-fly tuning changes
When things go βbumpββ¦
On-the-fly tuning changes, cont.
Calculate the contribution for the integral term differently:
β’ Before
β’ After
On-the-fly tuning changes, cont.
Integrator windup
The problem
Integrator windup, cont.
Integrator windup, cont.(same as before)
Integrator windup, cont.
The result
On/Off (automatic or βmanualβ)
The problem
On/Off, cont.
On/Off, cont.(same as before)
Initialization
The problem
Initialization, cont.(same as before)
Initialization, cont.βBumplessβ transfer
Direction
The problem: should an increase in y (the output) lead to an increase or a decrease in the manipulating variable (u, the output of the controller)?
Direct acting (Kp, Ki, Kd should be positive) Reverse acting (Kp, Ki, Kd should be negative)
Direction, cont.
Direction, cont.(same as before)
Recommended