Uploaded by Pangun Park

Lecture

advertisement
PID Control
Pangun Park
Chungnam National University
Information Communications Engineering
1
Control Systems
§ Microcomputers are widely employed in control systems:
Ø
automotive ABS, ignition and fuel systems
Ø
household appliances
Ø
smart weapons
Ø
industrial robots
Ø
pacemakers
Pangun Park (CNU)
2
Contents
§ Overview Control Systems
§ PID Control
§ PID Parameter Tuning
§ PID Implementation
Pangun Park (CNU)
3
Control = Sensing + Computation + Actuation
Feedback “Loop”
Control = Sensing +InComputation
+ Actuation
Actuate
Sense
Gas Pedal
Vehicle Speed
Compute
Control “Law”
§ Control
objectives
Goals
•
within
Performance:
systemconditions).
responds rapidly to changes (accelerate to 6 m/sec)
operating
• “normal”
Robustness: system tolerates perturbations in dynamics (mass, drag, etc)
• Robustness/Regulation:
Ø
system tolerates perturbations in dynamics (mass,
Stability: systemmake
maintains
operating
(hold steady
speed)
Ø Stabilization:
sure desired
the system
does point
not “blow
up” (i.e.,
it stays
drag, etc), Maintain a desired operating point in spite of disturbances.
Ø
Performance/Tracking: system
responds rapidly to changes (accelerate to 6
Richard M. Murray, Caltech CDS
m/sec), follow a reference trajectory that changes over time, as closely as
possible.
CDS 101/110, 29 Sep 08
Pangun Park (CNU)
8
4
Control Systems : Performance metrics
Dynamic Behavior (and Stability)
§ Steady-state controller error
Ø
Average value of the difference between desired and actual performance
Actuate
§ Transient Gas
response
Pedal
Ø how quickly the system responds to change
§ Stability
Sense
underdamped
Vehicle Speed
tresponse
Ø
system output changes smoothly – without oscillation or unlimited excursions
Ø
Check if closed loop response is stable
Compute
Control “Law”
Dynamic Behavior (and Stability)
Goal #1: Stability
Check if closed loop response is stable
•
Actuate
Sense
Gas Pedal
Vehicle Speed
Goal #2: Performance
Look at how the closed loop system
behaves, in a dynamic context
•
Compute
Control “Law”
Goal #3: Robustness (later)
Goal #1: Stability
Parkresponse
CDS 101/110,
6(CNU)
Oct 08 is stable
Check if Pangun
closed
loop
•
Richard M. Murray, Caltech CDS
control law
control law
system input
Response
depends on
choice of control
(all are stable)
5
2
Example : Speed Control
Example #2: Speed Control
Example #2: Speed Control
“Bob”
reference
“Bob”
reference
∑
∑
disturbance
disturbance
Control
Control
Law
∑
Law
∑
Process
-1Process
Stability/performance
mv̇ = av + Feng + Fhill
Feng = kp (vdes v)
desired velocity as k → ∞
Steady
state
velocity
approaches
Smooth
response;
no
overshoot
or
•
Stability/performance
• desired
velocity
as
k
→
∞
oscillations
Ø
state velocity
approaches
Disturbance
rejection
• Steady
Ø Smooth response; no overshoot
velocity
mv̇ = av + Feng + Fhill
Feng = kp (vdes v)
velocity
§ Stability/Performance
-1 approaches
• Steady state velocity
desired velocity
k → ∞ (eg, hills)
disturbances
• Effect ofas
approaches zero as k → ∞
orresponse;
oscillations
kp
1 Smooth
no overshoot or
vss =
vdes +
Fhill
Robustness
a + kp
a + koscillations
p
§ Disturbance
rejection
on the specific
 Results don’t depend
0 as
1 as
values
of a, m or kp, for kp sufficiently
Disturbance
rejection
k
⇥
k
⇥
large of disturbances (eg, hills)
Ø Effect
Effect of disturbances (eg, hills)
time
approaches
zero
as
k→∞
approaches
zero
as
k
→
∞
kp
1
vss =
vdes29+
Fhill
CDS 101/110,
Sep 08
Richard M. Murray, Caltech CDS
10
Robustness
§ Robustness
a + kp
a + kp
 Results don’t depend on the specific
Ø Results don’t depend on the
0 as
1 as
values of a, m or kp, for kp sufficiently
k
⇥
k
⇥
large specific values of a, m or kp, for
•
•
time
CDS
101/110,Park
29 Sep(CNU)
08
Pangun
Richard M. Murray, Caltech CDS
kp sufficiently large
106
Basic control architectures: Feed-Forward
Basic control architectures: Open-loop control/Feed-Forward
r
F
u
P
y
Basic idea: given r , attempt to compute what should be the control input u
that would make y = r .
§ Basic idea: given r, attempt to compute what should be the
control
input uF that
make yof=P.r.
Essentially,
shouldwould
be an “inverse”
§ Essentially, F should be an “inverse” of P.
Relies on good knowledge of P — sensitive to modeling errors.
§ Relies on good knowledge of P — sensitive to modeling errors.
Ø
State
estimator
eliminated
: not
well
suited
formake
a complex
plant system stable.
Cannot
alter the
dynamics
of P,
i.e.,
cannot
an unstable
Ø
Assumes disturbing forces have little effect on the plant
Ø
Less expensive than closed-loop control : example: electric toaster
§ CannotE. Frazzoli
alter
the dynamics
of P, i.e., cannot make an
unstable
(ETH)
Lecture 2: Control Systems I
09/29/2017
5 / 24
system stable.
Pangun Park (CNU)
7
Open-loop control
Noise
Desired state
variables – X*(t)
Control
Software
Driving forces
Actuators
U(t)
Pangun Park (CNU)
Disturbing forces
Control
commands
Plant
D(t)
Real state variables
X(t)
8
Basiccontrol
control architectures:
architectures: Closed-loop
Basic
Feedback control/Feedback
r
e
C
u
P
y
§ Basic idea: given the error (r − y), compute u such that the error
Basic idea: given the error r
is “small.”
y , compute u such that the error is “small.”
Intuition:
bigger
C , the smaller
the error
e will the
be, regardless
of Pwill be,
§ Intuition:
thethe
well
designed
C, the
smaller
error “e”
(under some assumption, e.g., closed-loop stability).
regardless of P (under some assumption, e.g., closed-loop
stability).
Does not require a precise knowledge of P — robust to modeling errors.
§ Does Can
not stabilize
requireunstable
a precise
knowledge of P — robust to modeling
systems. But can also make stable systems unstable
errors.(!).
§ Can stabilize unstable systems. But can also make stable systems
Needs an “error” to develop in order to figure out the appropriate control.
unstable (!).
§ Needs an “error” to develop in order to figure out the appropriate
control.
E. Frazzoli (ETH)
Pangun Park (CNU)
Lecture 2: Control Systems I
09/29/2017
6 / 24
9
Benefits/Dangers of Feedback
§ Feed-forward control relies on a precise knowledge of the plant,
and does not change its dynamics.
§ Feedback control allows one to
Ø
Stabilize an unstable system;
Ø
Handle uncertainties in the system;
Ø
Reject external disturbances.
§ However, feedback can
Ø
introduce instability, even in an otherwise stable system!
Ø
feed sensor noise into the system.
Pangun Park (CNU)
10
manual and automatic control. It is important that there are no
switching transients.
Closed-loop
controldo not generate
It is also important that
parameter changes
transients. This can be avoided by proper coding.
§ Feedback is ubiquitous in natural and engineered systems
Example:
§ Feedback
loop implementation
This implementation
gives This implementation does
not give bumps
bumps
Ø Suitable
for complex plant
§ Sensors
! t
k
andi =state estimator
e(s)ds
Ti
!
t
k
produce
of
i =representation/estimation
e(s)ds
Ti
state variables
pdated with 8
Sfrag replacementsThe basic issue is that multiplication with a time function does
§ These not
values
are compared
to desired
values
commute
with differentiation
or integration.
§ Control software generates control commands based upon the
differences between estimated and desired values
Requirements
n
d
r
F
Σ
e
C
u
Σ
P
x
Σ
y
−1
• Reduce the effect of load disturbances
Pangun Park (CNU)
11
Closed-Loop Control
Ø
plant is a system that is intended to controlled
Ø
collect information concerning the plant – data acquisition system (DAS)
Ø
compare with desired performance
Ø
generate outputs to bring plant closer to desired performance
Disturbing forces
Noise
Real state variables
Driving forces
Actuators
U(t)
Plant
Desired state
variables – X*(t)
Sensor
outputs
Noise
Y(t)
State estimator
Analog Interface
Errors
Compare
E(t)=X*(t)-X(t)
Pangun Park (CNU)
X(t)
D(t)
Control
commands
Control
Software
Sensors
X’(t)
Software
ADC or
input compare
Estimated state
variables
12
Contents
§ Overview Control Systems
§ PID Control
§ PID Parameter Tuning
§ PID Implementation
Pangun Park (CNU)
13
PID Control
§ Advances in control theory have given a good insight into the
design problem
§ PID control is most common feedback structure in engineering
systems
302
CONTROL
§ Connect with the classic traditionCHAPTER
of Ziegler10.
andPID
Nichols
Error
Present
Past
Future
t
t + Td
Time
Control
Time
Figure 10.1: A PID controllerPID
takes
controlover
action
based on past, present and
prediction of future control errors.
Pangun Park (CNU)
14
Summary of PID Controller
PID control
y

We can build a PID controller that works well in practice
in most situations without knowing control theory
PID control
§ Intuition
u = kp e + ki
e dt + kd ė
Ø
Proportional term: provides inputs that correct for “current” errors
Ø
Integral term: insures steady state error goes to zero
orrect for “current”
errors
Ø Derivative
term: provides “anticipation” of upcoming changes
goes to zero
of upcoming
changes
§ Utility
of PID
Ø
For many systems, only need PI or PD (special case)
Ø Many
tools foroftuning
PID loops and designing gains
ky: “Directional
stability
automatically
erm control”
earization) could be used to understand the
rol
Pangun Park (CNU)
15
Proportional
Feedback
Proportional Feedback
Proportional Feedback
Simplest controller choice: u = kpe
controller
choice:
§ SimplestSimplest
controller
choice:
u u== kkppe e
e
lifts gain
withlifts
nogain
change
inchange
phasein phase
• Effect:
Effect:
with
no
r
• input tries to move the system in +r
Ø The control
for plants
withforlow
phase
up phase
to up to
plants
with low
• Gooda direction
• Good
that isbandwidth
opposite to the error, and is
desired
desired bandwidth
proportional
to the gain
error in magnitude.
• Bode:
Bode: shift gain
up shift
by factorupofbykpfactor of kp
•
Step response:
betterincreases,
steady state error,
•
§ Step
As
the
proportional
gain
response:
better
steady
state
error,
•
but with decreasing stability
+
e
-
kp kp
u u
P(s)
P(s)
yy
k >0
kp >p0
butØ with
The decreasing
closed-loop stability
system remains stable;
50
50
Ø
The steady-state error decreases;
0
Ø
The response becomes faster;
0
-50
-100
-50
Ø The
sensitivity
Proportional
gain
selection
-150
-100
0
1.2
-150
to noise increase
1
k=2
k=5
k=10
k=50
-100
0
0.8
-100
y
-200
0.6
-300
-1
10
0
1
10
2
10
10
0.4
-200
0.2
-300
-1
10
CDS 101/110, 24 Nov 08
Richard M. Murray, Caltech CDS
0
0
0
10
1
1
2
3
4
5
6
10
4
2
7
8
9
10
10
t
As the proportional gain increases,
The closed-loop
system remains stable;
Pangun
Park (CNU)
The
CDS 101/110,
24steady-state
Nov 08 error decreases;
Richard M. Murray, Caltech CDS
16
4
Proportional gain selection
§ As the proportional gain increases,
Ø
The closed-loop system become more oscillatory (warning!);
Ø
The steady-state error decreases;
Ø
The response becomes faster;
Proportional
selection
Ø The sensitivitygain
to noise
increases.
1.8
1.6
1.4
1.2
y
1
0.8
0.6
0.4
0.2
0
0
1
2
3
4
5
6
7
8
9
10
t
As the proportional gain increases,
The closed-loop system become more oscillatory (warning!);
Pangun Park (CNU)
17
Proportional
+
Integral
Compensation
Proportional + Integral Compensation
Proportional + Integral Compensation
Use to eliminateUse
steady
statesteady
errorstate error
to eliminate
e e
Effect:
lifts
gain
at low frequency
Effect: liftssteady
gain• at
low
frequency
kiki uu P(s)
§ Use to eliminate
state
error
y
r
+ k k+
y
p+
r
P(s)
+
p
s
Gives
zero
steady
state
error
• state error
s
Gives
zerostate
steady
Ø Gives zero
steady
error
Bode:
infinite
SS
gain
+
phase
lag
• gain + phase lag
Bode: infinite SS
Step response: zero steady state error,
•
Ø
Integrating
the
error
allows
oneof
to
detect
potential
kp > 0, ki > 0
The Amazing
Property
Integral
with
smaller
settling
time,
but moreAction
The Amazing
Property
ofzero
Integral
Action
Step response:
steady
state
error,
overshoot
“biases”with
in the
system
behavior.
kp > 0, ki > 0
smaller
settling
time, but more
Consider
a PI controller
of the
overshoot
der
a PI§ controller
In spite In
of spite
the widesp
Consider
a PI controller
•
•
•
•
100
! t
! t
u = ke +u k=i ke e+(τk)idτ e(τ )dτ
50
100
in ed
attentionattention
in education
turers.
PID is
com
turers. PID
control
0
-50
50
0
0-100
0
0
Øthat
Assume
that
is an
equilibrium
u(t) = ku
is there
an equilibrium
with with
constant
) == e0
meAssume
that there
is there
an equilibrium
with
constant
e(tconstant
) = e0(te(t)
0 and
=e0uerror
0then
. The must
error
e0be
then
must
bezero.
zero. Proof:
and constant
tThe
) = uerror
. The
e0 then
must
beProof:
onstant
u(t) e=
uu0(.constant
zero.
0 u(t)
e0 Proof:
!= 0, then
me Assume
e0 != 0, then
to co
Ø
Assume
, then
We haveWe
to have
consider
! t
! t
! t
! t
• Derivative
• Derivative
filter
-50
-100
-100
-200
0
-300
-2
10
-1
0
10
10
1
2
10
10
-100
u k=i ke0e+
(τ )0CDS
d+
τ101/110,
=i 24ke
τ k=iRichard
+ kCaltech
t
u = ke0 +
(τ )kdi τ =eke
k
τ i = kee00d+
eke
0e
0 Murray,
i e0CDS
Nov
08+
0 dk
0 t M.
0
-200
0
0
0
5
• Set
point
• Set point
(referen
weigthing
weigthing
Øhand
The
right ishand
is
different
from
zero.
Hence a
right
side
different
from
zero.a Hence
a contradiction
ghtThe
hand
side
is different
fromside
zero.
Hence
contradiction
unless e0 = 0.
0.
s e0unless
= 0. e0 =contradiction
• Integrator
• Integrator
Windup
Ø A controller with integral action will always give the
CDS
101/110,integral
24 Nov 08 will
Richard
M.
Murray,the
Caltechcorrect
CDS
A controller
with
action
will give
always
ntroller
with integral
action
always
thegive
correct
withiss
t5
Dealing Dealing
with these
correct steady state provided that a steady state exists.
-300
-2
10
-1
10
0
10
1
10
2
10
steady
state provided
that a state
steady
state exists.
y state
provided
that a steady
exists.
Pangun Park (CNU)
implementatio
implementation
of any
18
Integral gain selection
§ As the integral gain increases,
Ø
The steady-state error is zero (as long as kI is not zero)
Ø
The response becomes more oscillatory (warning!)
egral gainØ selection
The sensitivity to noise does not change!
1.6
k P=2, k I = 2
k P=2, k I = 2
1.4
k P=2, k I = 5
k P=10, k I = 50
1.2
y
1
0.8
0.6
0.4
0.2
0
0
1
he integral
gain
increases,
Pangun
Park
(CNU)
2
3
4
5
6
7
8
9
10
t
19
1
C(s)
kp + ki +(PID)
kd s
+yIntegral
+=
Derivative
Proportional
+ Integral + D
+
C(s)
s
1
= k(1e+
+ Tdus)
§ Differentiating the error
C(s)
T
s
r
y
i
P(s)
+
C(s)
-1 to “predict” what
allows one
kTd (s + 1/Ti )(s + 1/Td )
=
the error will do in the near
Ti
-1 s
e
r
uProportional
P(s)
future.
Bode Diagrams
§ An derivative control action
tries to avoid overshooting,
hence damping the system.
0
0
0
0
0
1
C(s) = kp + ki + kd s
s
1
= k(1 +
+ Td s)
Ti s
kTd (s + 1/Ti )(s + 1/Td )
=
Ti
s
0
0
y
0
0
0
0
-3
10
-2
10
-1
10
0
10
1
10
2
10
50
40
Phase (deg); Magnitude (dB)
egral + Derivative (PID)
Bode Diagrams
30
20
10
0
100
50
0
-50
-100
-3
10
-2
10
3
10
-1
10
0
10
1
10
2
10
3
10
Frequency (rad/sec)
Frequency (rad/sec)
CDS 101/110, 24 Nov 08
Pangun Park (CNU)
10, 24 Nov 08
Richard M. Murray, Caltech CDS
Richard M. Murray, Caltech CD
20
6
Derivative gain selection
§ As the derivative gain increases,
Ø
The steady-state error not affected;
Ø
The response becomes less oscillatory, but potentially slower
Ø
The sensitivity to noise increases!
Derivative gain selection
1.4
k P=50, k D=2
k P=50, k D=5
1.2
k P=50, k D=10
k P=50, k D=50
1
y
0.8
0.6
0.4
0.2
0
0
1
2
3
4
5
6
7
8
9
10
t
As the derivative gain increases,
The steady-state error not a↵ected;
Pangun Park (CNU)
The response becomes less oscillatory, but potentially slower
21
Proportional-Integral-Derivative Control
Proportional-Integral-Derivative Control
Proportional-Integral-Derivative
Control
5
5D Gain
Derivative
Derivative
1
s
Integrator
reference
Step1
disturbance
D Gain1
10
s
D Gain1
10
error
Step1
disturbance
Step
10
1
Integrator
reference
Step
D Gain
control
control
P Gain
error
10
2
s2+2s+2
control
simout
output
To Workspace
Transfer 2Fcn
s2+2s+2
control
P Gain
simout
output
To Workspace
Transfer Fcn
measurement
noise
Band-Limited
noise
White Noise
measurement
Band-Limited
White Noise
§ One
alsocombine
combine
theof effects
of and
an ofintegrator
and
Onecan
can also
the e↵ects
an integrator
a di↵erentiator
withof a
basic
controller.
differentiator
with the
basic
Onethe
can
alsoproportional
combine
the
e↵ects proportional
of an integratorcontroller.
and of a di↵erentiator with
the PID
basic
proportional controller.
control:
§ PID
control:
Z
t
PID control:
u(t) = kP e(t) + kI
u(t) = kP e(t)
kI + kI
C (s) = kP +
s
Z0 t
e(⌧ )d⌧ + kD ė(t),
e(⌧
kD )d⌧
s 2 ++
kPksD+ė(t),
kI
+ kD s0=
s
.
kI
kD s 2 + kP s + kI
C (s) = kP +
+ kD s =
.
s
s
E. Frazzoli (ETH)
Lecture 11: Control Systems I
1/12/2017
23 / 31
Pangun Park (CNU)
E. Frazzoli (ETH)
Lecture 11: Control Systems I
1/12/2017
22
23 / 31
Summary
§ Proportional control
Ø
Decrease the steady-state error;
Ø
Increase the closed-loop bandwidth;
Ø
Increase sensitivity to noise;
Ø
Can reduce stability margins for higher-order systems (2nd order or more).
§ Integral control
Ø
Eliminates the steady-state error to a step (if the closed-loop is stable);
Ø
Reduces stability margins, can make a higher-order system unstable.
§ Derivative control
Ø
Reduce overshooting, increase damping;
Ø
Improves stability margins;
Ø
Increase sensitivity to noise.
Pangun Park (CNU)
23
Contents
§ Overview Control Systems
§ PID Control
§ PID Parameter Tuning
§ PID Implementation
Pangun Park (CNU)
24
Performance Measures
§ Accuracy
Ø
Magnitude of the Error = Desired – Actual
§ Stability
Ø
No oscillations
§ Overshoot (underdamped, overdamped)
Ø
Ringing, slow
§ Response Time to new steady state after
Ø
Change in desired setpoint
Ø
Change in load
underdamped
tresponse
Pangun Park (CNU)
25
How do the PID parameters affect system dynamics?
§ 4 major characteristics of the closed-loop step response.
Ø
Rise Time: the time it takes for the plant output y to rise beyond 90% of the
desired level for the first time.
Ø
Overshoot: how much the the peak level is higher than the steady state,
normalized against the steady state.
Ø
Settling Time: the time it takes for the system to converge to its steady state.
Ø
Steady-state Error: the difference between the steady- state output and the
desired output.
Pangun Park (CNU)
26
Time Specifications
§ td: delay time, time for s(t) to reach half of s(1)
Ø
A typical step response s(t)
It is the time required for the response to reach
50% of the final value in first attempt.
Step Response
§ tr: rise time, time for s(t) to first reach s(1)
Ø
1.4
It is the time required to rise from 0 to 100% of
the final value for the under damped system.
1.2
1
§ tp: peak time, time for s(t) to reach first peak
It is the time required for the response to reach
the peak of time response or the peak
overshoot.
0.8
Amplitude
Ø
0.6
0.4
§ Mp: Peak overshoot
Ø
It is the normalized difference between the time
response peak and the steady output and is
defined as,
0.2
0
0
5
10
15
Time (sec)
§ ts: settling time, time for s(t) to settle within a range
(2% or 5%) of s(1)
§ Steady-state error
Ø
It indicates the error between the actual output
and desired output as ‘t’ tends to infinity.
Pangun Park (CNU)
27
How do the PID parameters affect system dynamics?
§ Effects of increasing a parameter independently
Pangun Park (CNU)
28
How do we use the table
§ Typical steps for designing a PID controller are
§
1.
Determine what characteristics of the system needs to be improved.
2.
Use Kp to decrease the rise time.
3.
Use Kd to reduce the overshoot and settling time.
4.
Use Ki to eliminate the steady-state error.
This works in many cases, but what would be a good starting
point?
Pangun Park (CNU)
29
PID Tuning
§ PID tuning corresponds to choosing the parameters kp, ki and kd
to reach the feedback control design specifications.
§ PID tuning can be done with tuning rules by hand or numerically
using MATLAB or other tools (the latter requires a system
model).
§ There exist heuristic methods to tune a PID controller without a
model of the plant P(s), e.g. the tuning rules proposed by Ziegler
and Nichols.
§ Zeigler-Nichols step response method
Pangun Park (CNU)
30
Ziegler-Nichols’ Step Response Method
§ Design PID gains based on step response
§ Measure maximum slope + intercept
Ø
Conduct numerous experiments and proposed rules for determining values
based on the transient step response of a plant.
Ø
Make a step in the control variable.
Ø
Log process output. Normalize the curve so that it corresponds to a unit step.
Ø
Determine intercepts of tangent with steepest slope i.e. parameters a and L.
The controller parameters are obtained from a table.
§ Works OK for many plants (but underdamped)
§ Good way to get a first cut controller
Pangun Park (CNU)
31
0
We will present a selection
−1
Ziegler-Nichols’ Step Response Method
Ziegler-Nichols’
Step Response
Method
§ Data: Apparent
time delay
L
0
2
4
6
8
12
0.5
0
−0.5
Tp is an estimate of the response
time
of the from
closed
eters
are obtained
a
table.
loop system.
§ Parameter
40
−1
−0.5
30
20
10
c K. J. Åström, October 2002
!
0
100
50
0
-50
-100
-3
10
-2
10
Pangun Park (CNU)
-1
10
0
10
Frequency (rad/sec)
1
10
2
10
14
Ziegler-Nichols’
Frequency Res
and intercept
a. Controller
parameters
Proportional
+byaIntegral
+ Derivative
(PID)
• Switch the
controller to
Data: apparent
time
delay Lare
andgiven
intercept
. Controller parampure proportional.
eters are given by
1
e
u
•
Adjust
C(s)
=
k
+
k
p
i + kthe
d s gain so that the
r Controller
y
+
C(s)
k
Ti
TP(s)
T
s
d
p
closed loop system is at
1
P
1/a
4L
= k(1 + the stability
+ Td s) boundary.
Ti s
PI
0.9/a -13L
5.7L
• Determine the gain ku
kTd (s(the
+ 1/T
1/Td )and
i )(s +gain)
ultimate
PID
1.2/a 2L L/2 3.4L
=
Ti the period
s Tu (the ultimate
Diagrams
Parameter Tp is an estimate Bode
of the
response time of the closed
period) of the oscillation.
loop system.50
• Suitable controller paramPhase (deg); Magnitude (dB)
10
3
10
32
Contents
§ Overview Control Systems
§ PID Control
§ PID Parameter Tuning
§ PID Implementation
Pangun Park (CNU)
33
PID Controller Implementation
Summary of PID Controller
§ Build a PID controller that works well in practice in most
 We
can build
a PID
controller
thattheory
works well in practice
situations
without
knowing
control
in most situations without knowing control theory
Pangun Park (CNU)
34
PID Control : Motor Control Example
X*
E(n)
- E(s)
+
X’(s)
X'(n)
PID Controller
Actuator
U(n)
Ki
PWM
+Kd s
Kp+
U(s) circuit
s
State estimator
Period
Measurement
Ki
G( s) = K p + K d s +
s
m
H ( s) =
1+t s
Pangun Park (CNU)
m
1+s t
Sensor
Tachometer
Plant
X(t)
X(s)
X ( s)
G ( s) H ( s)
=
X * ( s) 1 + G ( s) H ( s)
35
General Approach to PID
t
dE (t )
U (t ) = K p E (t ) + ò K i E (t )dt + K d
dt
0
§ Proportional
Up = KpE
Ui = Ui + KiEDt
Derivative Ud = Kd(E(n)-E(n-1))/Dt
PID U = Up + Ui + Ud
Run ten times faster than motor t
Run slower or equal to sensor sampling rate
§ Integral
§
§
§
§
Pangun Park (CNU)
36
Example : PID Controller Implementation
§ DC Motor Position Control
Ø
Move the output shaft of the motor from
current position to target position
Ø
Motor speed can be controlled by varying
the PWM duty cycle used to drive the motor.
§ There are a few terms commonly used to describe the PID control
loops, such as:
Ø
Control Variable (CV) – This is the output of the control loop. In this case, the CV is the
duty cycle of the PWM signal that drives the motor.
Ø
Process Variable (PV) – This is the feedback value returned by the system to the
controller. In this example, the PV is the current angle of the motor shaft.
Set Point (SP) – Set point is the value that we desire for the system. In our case, the SP is
the target position of the motor shaft in angle.
Ø
Ø
Error (E) – Error refers to the difference between the set point and the process variable.
In another words, it means how far the current position of the motor shaft from the
target position.
Pangun Park (CNU)
37
Proportional Controller
§ When the current position of the motor shaft is still far away from the
target position, we want to apply more power to drive the motor
towards the target position so that we can reach there faster.
§ When the shaft is getting nearer to the target position, we will reduce
the power to slow it down. At the time the shaft reaches the target
position, the motor needs to be stopped.
§ If the shaft position has overshot, we need to apply negative power to
the motor (reverse the motor) to bring it back to the target position.
§ The PWM duty cycle (output) is the result of multiplying the error with
a constant, Kp.
Pangun Park (CNU)
38
Proportional Controller
Pangun Park (CNU)
39
Proportional Controller
§ System response for
proportional controller with
low Kp
§ System response for
proportional controller with
high Kp
§ System response for
proportional controller with
excessively high Kp
Pangun Park (CNU)
40
Integral Controller
§ As can be seen from the graph of P controller, the actual position of
the motor shaft, when settles down will not reach the target position.
Ø
This is because when the current position is near to the target position, the
error becomes very small and the computed PWM duty cycle is too small for
the motor to overcome the friction and gravity.
§ The small error that exists when the system has settled down is called
the steady state error.
§ The integral is merely an accumulated error signals encountered since
startup.
Pangun Park (CNU)
41
Integral Controller
Pangun Park (CNU)
42
Integral Controller
§ System response for PI controller with no steady state error
Ø
Too low the value, the steady state error is corrected very slowly; too high the
value, the system becomes unstable and oscillates.
Ø
Because the integral can grow quite large when the set point cannot be
reached, some applications stop accumulating the error when the control
variable is saturated.
Pangun Park (CNU)
43
Derivative Controller
§ The derivative of any variable describes how that variable changes over
time. In a PID controller, the derivative is the rate of change of the
error.
§ In digital form, it can be described as:
Ø
Derivative = Error – Last Error
§ Negative values of derivative indicate an improvement (reduction) in
the error signal. For example, if the last error was 20 and the current
error is 10, the derivative will be -10. When these negative values are
multiplied with a constant, Kd, and are added to the output of the loop,
it can slow down the system when approaching the target.
Pangun Park (CNU)
44
Derivative Controller
Pangun Park (CNU)
45
Derivative Controller
§ The damping effect of the D controller allows the system to have a
higher value of Kp and/or Ki without overshooting.
Ø
In consequent, this will give the system a better response time to set point
changes.
§ However, too high the value of Kd will also have negative effect. The D
controller tense to amplify the noise exists in the feedback loop.
Ø
If the Kd is too high, the system will become jerky if the feedback loop is
noisy.
Pangun Park (CNU)
46
Joining Them Together – PID Controller
§ P controller for fast system response, I controller to correct the steady
state error and D controller to dampen the system and reduce
overshoot.
Pangun Park (CNU)
47
Joining Them Together – PID Controller
Pangun Park (CNU)
48
Summary
§ Controller only as good as its sensor
§ Observe everything “What was it thinking?”
§ Change one parameter at a time
§ Choose stability over responsiveness
Pangun Park (CNU)
49
Download