Lecture_7_PID_controller_ Design & Implementation_F2024
Lecture_7_PID_controller_ Design & Implementation_F2024
Faculty of Engineering
Electrical Eng. Depart.
AUTOMATIC CONTROL
LECTURE 8
PID CONTROLLER
DESIGN & IMPLEMENTATION
Dr. Khaled Alawasa
Fall 2014 1
Controller Types
Controller (compensator)
R(s)
+ Gc(s) Y(s)
G (s )
-
s 2 10s 20
1 Gc ( s)G ( s)
G
G
Variations
8
Adding [Proportional Controller] (1)
(Closed Loop)
R(s)[F(s)]
E(s) U(s) 1 Y(s)[X(s)]
+
Kp s 2 10s 20
-
Controller
9
Adding [Proportional Controller] (2)
Closed-loop response w ith Kp=300
1.4
1.2
System: CL_Kp
Final Value: 0.938
1
Amplitude
Time (sec): 0.105 Settling Time (sec): 0.772
Amplitude: 0.912
0.6
Kp 300 0.4
e ss lim 1 2 0.0625
s 0
s 10s (20 K p ) 320
0.2
0
0 0.2 0.4 0.6 0.8 1 1.2 1.4
Time (sec)
5
n 20 K p , , when K p : n and Tr
20 K p
As Kp increase wn increased ( more oscillation) and damping ratio decrease.
From the rise time expression, When the damping ratio wn increased , rise time decreases.
For Kp=300 , rise time=0.067 sec. ( a bit different from the result on the plot
in the previous slide, why?) 11
Adding [Proportional Controller] (4)
• Question: Calculate the damping ratio and overshoot
percent for the system with Kp=100, 200, 300.
1
100( 120) K n 2
Step Response
1.2
1.4
Amplitude
•With Kp=200 P.O% = 32.5% 0.6
s 0 s 10s (20 K )
20 K p
Time (sec)
p
13
Adding Integral Gain
PI Controller (1)
F(s) + E(s) Ki U(s) 1 X(s)
Kp
- s s 2 10s 20
Controller
1.2
• Let kp=30, Ki=70
System: CL_Kp System: CL_Kp
Rise Time (sec): 0.684 Final Value: 1
1
System: CL_Kp
System: CL_Kp • We have reduced the
proportional gain because
Peak amplitude: 1.01
Settling Time (sec): 0.62
0.8 Overshoot (%): 1.26
Amplitude
0.6
the integral controller also
reduces the rise time and
0.4
increases the overshoot as
0.2
the proportional controller
does (double effect).
0
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8
Time (sec)
K p Kd s
X ( s) s 2
10 s 20 K p Kd s
2
F (s) K p Kd s s (10 K d ) s (20 K p )
1 2
s 10s 20
16
PD Controller (2)
1.4
System: CL_Kp
Closed-loop response w ith Kp=300 and KD=10
• Let kp=300, Kd=10
• This plot shows that the
Peak amplitude: 1.08
1.2 Overshoot (%): 15.3
At time (sec): 0.17
System: CL_Kp System: CL_Kp
proportional derivative
Settling Time (sec): 0.29 Final Value: 0.938
1
System: CL_Kp
0.8 Rise Time (sec): 0.103
controller reduced both the
Amplitude
0.6
0.4
overshoot and the settling
0.2
time, and had small effect on
0
0 0.1 0.2 0.3 0.4 0.5 0.6
the rise time and no effect on
Time (sec)
the steady-state error.
under step input :
K p Kds Kp 300
y ss lim 2 1 0.9375
s 0 s (10 K )s (20 K )
d p 20 K p 320
1 1 20
e c ( ) ( ) 0.0625
1 lim sGc (s )G (s ) K K d s 20 K p
s 0 1 lim 2 p K p 300
s 0 s 10s 20
17
Three Controller ( P, I, D)
PID Controller (1)
F(s) + E(s) Ki U(s) 1 X(s)
Kp K Ds
- s s 2 10s 20
Controller
0.8
0.6
Amplitude
0.4
0.2
0
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Time (sec)
1.2
0.8
Amplitude
0.6
(P-mode)
0.4 (PD-mode)
(PI-mode)
0.2
(PID-mode)
0
0 0.5 1 1.5 2 2.5 3 3.5 20
Time (sec)
The PID Controller
• The PID algorithm is the most popular feedback
controller algorithm used in industrial process
control.
• It is a robust easily understood algorithm that can
provide excellent control performance despite the
varied dynamic characteristics of processes.
• As the name suggests, the PID algorithm consists
of three basic modes:
– the Proportional mode, (P-mode)
– the Integral mode, (I-mode)
– the Derivative mode. (D-mode)
21
P, PI or PID Controller
• Utilizing the PID algorithm, it is necessary to decide
which modes are to be used (P, I or D, or combination)
and then specify the parameters (or settings) for each
mode used.
• Generally, three basic algorithms are used: P, PI or PID.
• Controllers are designed to eliminate the need for
continuous operator attention. (so it’s Automatic
Control)
– Examples: Cruise control in a car and a house thermostat are common
examples of how controllers are used to automatically adjust some
variable to hold a measurement (or process variable) to a desired variable
(or set-point)
22
PID Definitions
R(s) + E Ki U Plant/ Y(s)
Kp K s process
- s d
PID Controller
K d s 2 K ps K i
PID
s
25
PID Controller Functions
• Output feedback
from Proportional action : compare output with set-point
• Anticipation
From Derivative action: react to rapid rate of change
before errors grows too big
Controller Output (1)
• The variable being controlled is the output of the
controller (U) (and the input of the plant):
R(s) E U
+ Controller
Plant/ Y(s)
process
-
System to
provides excitation to the plant
be controlled
t de(t )
u (t ) K p e(t ) K i e(t )dt K d
0 dt
• The signal u(t) will be sent to the plant, and a new output
y(t) will be obtained. This new output y(t) will be sent back
to the sensor again to find the new error signal e(t). The
controllers takes this new error signal and computes its
derivative and its integral gain. This process goes on and on.
U=E*Controller 28
Controller Effects
• A proportional controller (P)
– reduces error responses to disturbances, but still
allows a steady-state error.
• When the controller includes a term proportional
to the integral of the error (I),
– then the steady state error to a constant input is
eliminated, although typically at the cost of
deterioration in the dynamic response.
• A derivative control
– typically makes the system better damped and more
stable.
29
Closed-loop Response
Rise time Maximum Settling Steady-
overshoot time state error
Increasing Decrease Increase Small Decrease
KP change
Increasing Decrease Increase Increase Eliminate
KI
Increasing Small Decrease Decrease Small
KD change change
• Note that these correlations may not be exactly accurate,
because P, I and D gains are dependent of each other.
1 Kp Kd
U (s ) K p 1 T d s E (s ) Ti , Td
Ti s Ki Kp
Effect of Proportional,
Integral & Derivative Gains on the
Dynamic Response
Effect of change Proportional Controller
Gain (Kp)
• Pure gain (or attenuation) since: the
controller input is error the controller output
is a proportional gain
R(s) E U
+ Plant/ Y(s)
Kp process
-
Controller
E ( s ) K p U ( s ) u (t ) K p e(t )
32
Effect of change Proportional
Controller Gain (Kp)
Closed-loop response w ith different controllers
1.5
(KP=10)
(KP=50) Increase in Kp gain:
(KP=100)
(KP=500)
Upgrade both steady-
1 state and transient responses
Reduce steady-state
Amplitude
error
Step Response
2
0.5 1.8
1.6
1.4
1.2
Amplitude
1
0.8
Kp increases 0.6
0.4 Kp=1000
0.2
0 0
0 0.5 1 1.5 2 2.5 3 0 0.1 0.2 0.3 0.4 0.5
Time (sec)
0.6 0.7 0.8 0.9 1
Time (sec)
t
Ki
E (s ) U (s ) u (t ) K pe (t ) K i e (t )dt 34
s 0
Effect of change Integral Controller
Gain (Ki)
1.8
Step Response
• Increase in ki gain:
(Ki=0)
1.6 (Ki=50) upgrade steady-
1.4
With Kp=30 (Ki=100)
state responses
(Ki=300)
1.2
Zero error
1
Increase slightly
Amplitude
0.8
settling time
0.6
Increase oscillations
0.4
Ki increases and overshoot!
0.2
0
0 0.5 1 1.5 2 2.5 3
Time (sec)
Rise time Maximum Settling time Steady-state
overshoot error
Increasing KI Decrease Increase Increase Eliminate
35
Effect of change for gain PD controller (2)
• Differentiation of error with a constant gain:
Detect rapid change in output
Reduce overshoot and oscillation
Does not affect the steady-state response
To see the effect of changing KD, Kp is kept
constant.
F(s) + E(s) U(s) 1 X(s)
K p K Ds
- s 2 10s 20
Controller
de (t )
E (s )K d s U (s ) u (t ) K pe (t ) K d
dt 36
Effect of change for gain PD controller (2)
Step Response
1
• Increase in gain:
0.9
0.8
Upgrade transient
0.7
response
0.6
small change in settling time
Decrease the peak and rise
Amplitude
0.5 (KD=0)
0.4
(KD=50) time
(KD=100)
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Time (sec)
40
Manual PID tuning
• One approach to manual tuning is to first set Kd=0 and Ki=0 .
• This is followed by slowly increasing the gain until the output of the
closed-loop system oscillates just on the edge of instability.
• This can be done either in simulation or on the actual system if it
cannot be taken off-line.
• Once the value of (with and) is found that brings the closed-loop
system to the edge of stability, you reduce the value of gain to
achieve what is known as the quarter amplitude decay: (i.e. reduce
the gain to 50%).
• A rule-of-thumb is to start by reducing the proportional gain KP by
one-half.
• The next step of the design process is to increase Kj (eliminate the
error) and KD manually to achieve a desired step response.
– Ki to eliminate the error
– Kd to reduce the overshoot.
41
Manual PID tuning Example
Step#1
• Consider the closed-loop system in Figure
43
Manual PID tuning Example…con’t
Step#2
• The root locus for KP = 370, Ki= 0, and 0 < KD < ∞
is shown in Figure below
• In this case, the characteristic equation is
44
Manual PID tuning Example…con’t
Step#2
45
Manual PID tuning Example…con’t
Step#3
• The root locus for Kp= 370, KD = 0, and 0 < Ki < ∞ is
shown in Figure below .
• The characteristic equation is
46
Manual PID tuning Example…con’t
Step#3
• The percent overshoot and settling time as a function of K{
are shown in Figure 7.36. The trends in Figure 7.36 are
consistent with Table 7.6.
• To meet the percent overshoot and settling time
specifications, we can select KP = 370, KD = 60, and Ki =
100.
• The step response shown in Figure 7.37 indicates a Z;. = 2.4
s and P.O. = 12.8% meeting the specifications.
47
Manual PID tuning Example…con’t
Step#3
The percent overshoot and settling time as a function of K
Percent overshoot
and settling time
with KP = 370,
KD = 0, and
50 < K, < 600.
48
Output response
Percent overshoot
and settling time
with final design
KP = 370, KD = 60,
andK/ = 100.
49
Ziegler-Nichols Tuning
• In 1942 Ziegler and Nichols, described simple
mathematical procedures for tuning PID
controllers.
• The method had a large impact in making PID
feedback controls acceptable to control engineers
• These procedures are now accepted as standard in
control systems practice.
• The closed-loop Zielgier-Nichols tuning method
considers the closed-loop system response to a
step input (or step disturbance) with the PID
controller in the loop.
50
Ziegler-Nichols PID tuning method (1)
• Initially the derivative and integral gains, KD and Ki
respectively, are set to zero. The proportional gain
KP is increased (in simulation or on the actual
system) until the closed-loop system reaches the
boundary of instability.
• The gain on the border of instability, denoted by Ku,
is called the ultimate gain. The period of the
sustained oscillations, denoted by Tu, is called the
ultimate period.
• Once Ku and Tu are determined, the PID gains are
computed using the relationships in Table 7.7
according to the Ziegier-Nichols tuning method. 51
Ziegler-Nichols PID tuning method (2)
• How to find the ultimate gain and ultimate
period. By using RH-method.
52
Ziegler-Nichols PID tuning method.
53
Comparison
Manual tuning method Ziegler-Nichols tuning method
54
Ziegler-Nichols PID tuning method
Example
Consider a process with transfer function :
1
G (s )
(s 1)(s 3)(s 5)
+ Y(s)
PID System
-
61
Tips for Designing a PID Controller (2)
• Lastly, keep in mind that you do not need to
implement all three controllers (proportional,
derivative, and integral) into a single system, if
not necessary.
• For example, if a PI controller gives a good
enough response , then you don't need to
implement derivative controller to the system.
• Keep the controller as simple as possible.
62
Tips for Designing a PID Controller (3)
System with added Controller:
• If the TF similar to 2nd standard transfer, the design will
be quite easily: use the developed equation to find Tr,
Tp, Ts, O.S%,
• If the TF is a 3rd order :
– Check if the added pole/zero can be cancelled, so the
response can be approximated to that by 2nd standard
transfer …. the design then will be easily.
– Otherwise, use root locus technique to select the
controller parameters (Kp, Ki, KD) to achieve the desired
response( speed, overshoot, error)
• Normally Root locus technique is used for design/find
the PID gains
• Use Ziegler-Nichols tuning method for achieve fast
and simple designs 63
PID in our Control Lab
Process- Control Simulator Plant/ Process
Feedback
Sensor Actuator
Output
Input
PID controller
Identify the control system components 64
PID Application
PID controller in AVR system - ABB
EATEN
Real system
Is it Digital or analogue ??
Equivalent TF.
65
Controller Implementation (1)
• The use of the computer has played an major role in
recent advances in the design of Automatic control
systems.
• The computers may divided into TWO types:
– Analogue computers and
– Digital computers.
• Analogue computer is one in which the equation
describing the operation of the computer in analogue
to that for the actual system.
• The most commonly used analog computer is the
electronic analog system.
• The electronic analog computer is a very powerful tool
for investigation the performance of control systems
66
Controller Implementation (2)
Process
R(s)
+ Analogue Controller (Operation to be Y(s)
(via Analogue computer) controlled)
-
Process
R(s) Digital Controller
+ (via Digital computer,
(Operation to be Y(s)
controlled)
- PC)
R(s) Process
+ Controller
(Operation to be Y(s)
controlled)
-
• Active-Circuit Realization
68
Op-amps
Inverting op-amp
-
+
inputs output
-
69
Physical Realization of
Controller - Analogue computer
• Electronic analog computer; typically use op-amps
op-amps
At our Control Lab
70
Active realization of controllers using
an operational amplifier
71
PID realization (implementation using Analog
computer )
Vo R
P ????? 2 K P
Vi R1
PD K p ?
PD K p (TD s 1)
TD ?
First op-amp. Second op-amp.
PI 1
( s 1)
K K s Ki T
PI K p i p Kp i
s s 1
s
T i 72
The second op-amp acts as
K p ?
a sign inverter as well as a gain adjuster
Ti ?
PID Second op-amp.
Second op-amp.
To invert the signal
- s
Summing point
1
integral with time constant ;
R4C 1
R3 C1
R1
Input - R4
Output
-
+
R2 +
R6
Make R5 R6 to get a unity feeeback
R5
-
+ 75
Analogue computer:
Exercise#1 and 2
• Exercise#1: Using analogue computer, built a
Second order shown below:
R(s) + a Y(s)
- s(s 2b)
77