ECE 344
Control Systems
Lecture #7: PID Controllers
By
Mohamed Saeed Darweesh
Associate Professor
Electronics and Computer Engineering Program
School of Engineering and Applied Sciences
Nile University
IEEE R8 Young Professionals Chairman
IEEE Egypt Section Secretary ْ َ
ِبحم ِد ِه تعالى
This Lecture Logistics
❑ Chapter 8
❑ K. Ogata, “Modern Control Engineering,” 5th Edition, 2010
2
Agenda
❑ Introduction
❑ Proportional (P) Controller
❑ Proportional + Integral (PI) Controller
❑ Proportional + Derivative (PD) Controller
❑ Proportional + Integral + Derivative (PID) Controller
❑ Example
3
Introduction
PID stands for:
❑ P → Proportional
❑ I → Integral
❑ D → Derivative
4
Why we need this?
5
Why we need this?
❑ Our robot will be travelling through a maze and needs to know
where the walls are.
❑ Line following robots are everywhere, they use IR sensors to
determine where the line is and since most motors do not
operate smoothly, we need to adjust the left and right motor
speeds to keep the robot on track.
❑ We can also use this concept for a wall following robot that will
keep the robot within the walls of the maze.
❑ Our PID controller will accept the current position as the input,
compensate using a PID controller and output left and right
motor speeds to adjust the position such that the robot
displays the desired response.
6
Introduction
❑ The usefulness of PID controls lies in their general applicability
to most control systems.
❑ In the field of process control systems, it is well-known that the
basic PID control scheme have proved their usefulness in
providing satisfactory control.
❑ It is interesting to note that more than half of the industrial
controllers in use today are PID controllers.
7
Introduction
For any control system, there exist specifications on:
➢ Transient response.
➢ Steady state accuracy.
❑ The above 2 requirement are contradicting, and the designer
must compromise.
❑ Parameter setting is the 1st step in the design.
❑ In most cases parameter setting failed to get the specifications,
and a controller must be added to the system.
8
Introduction
When PID controller is used?
❑ PID control works well on single input single output (SISO)
systems of 2nd order, where a desired set point can be
supplied to the system control input.
❑ PID control handles step changes to the set point especially
well:
◼ Fast rise time
◼ Little or No overshoot
◼ Fast settling time
◼ Zero steady state error
9
PID Controller
10
Four Modes of Controllers
Each mode of control has specific advantages and limitations.
❑ Proportional (P)
❑ Proportional plus Integral (PI)
❑ Proportional plus Derivative (PD)
❑ Proportional plus Integral plus Derivative (PID)
11
Proportional Controller (P)
❑ In proportional mode, the control output proportional to the
current error.
❑ This error value multiplied by the proportional gain ( 𝐾𝑃 )
determines the output response, or in other words proportional
gain decides the ratio of proportional output response to error
value.
12
Proportional Controller (P)
Output of proportional controller is:
The transfer function can be written as:
13
Proportional Controller (P)
14
Proportional Controller (P)
Feed-Forward TF
Open-loop TF
Closed-loop TF
15
Proportional Controller (P)
For a unit-step response, the steady state error will be:
16
Proportional Controller (P)
Thus, increasing the proportional gain, 𝐾𝑃 , will:
❑ Decrease time constant/Rise time → Faster response.
❑ Decrease steady state error → improve accuracy, but for some
systems, cannot reach to zero.
❑ The proportional controller reduces the steady state error as 𝐾𝑃
increases. On the other hand, increasing 𝐾𝑃 make the transient
more oscillatory.
17
Integral Controller (I)
❑ Due to limitation of P-controller where there always exists an
offset between the process variable and set point, I-controller is
needed.
❑ In Integral mode, there is a continuous linear relation between
value of the control signal and the integral of error signal.
❑ I-controller provides necessary action to eliminate the steady
state error. It integrates the error over a period of time until
error value reaches to zero.
18
Integral Controller (I)
19
Integral Controller (I)
Feed-Forward TF
Open-loop TF
Closed-loop TF
20
Integral Controller (I)
By comparing the above TF with the standard form of 2nd order TF.
21
Integral Controller (I)
For a unit-step response, the steady state error will be:
22
Integral Controller (I)
Thus, increasing the integral gain, 𝐾𝑖 , will:
❑ Eliminates steady state error (𝑒𝑠𝑠 = 0).
❑ Decrease damping.
❑ Increase overshoot.
Integral controller increase the order of the system by 1
23
Integral Controller (I)
The major advantage of integral controllers is that they have the
unique ability to return the controlled variable back to the exact
set point following (Zero steady-state error).
24
Integral Controller (I)
❑ Disadvantages of the integral control mode are that it responds
relatively slowly to an error signal.
❑ This can lead to system instability. For this reason, the integral
control mode is not normally used alone but is combined with P
control mode.
25
Proportional Plus Integral Controller (PI)
𝐾𝑝 = Faster transient response
𝐾𝑖 = Eliminate steady-state error
26
Derivative Controller (D)
A derivative controller sees how fast process variable changes per
unit of time and produce the output proportional to the rate of
change.
❑ The derivative output is equal to the rate of change of error
multiplied by a derivative constant.
❑ D-controller moves the control action in such a direction as to
counteract the rapid change of a process variable.
27
Proportional Plus Derivative Controller (PD)
❑ Although derivative control does not affect the steady-state
error directly, it adds damping (overshoot change) to the system
and thus permits the use of a larger value of the gain 𝐾𝑝 .
❑ Because derivative control operates on the rate of change of the
actuating error and not the actuating error itself, this mode is
never used alone.
❑ It is always used in combination with proportional or
proportional-plus-integral control action.
28
Proportional Plus Derivative Controller (PD)
29
Characteristics of P, I, and D controllers
❑ A proportional controller (𝐾𝑝 ) will have the effect of reducing the
rise time and will reduce, but never eliminate, the steady-state
error.
❑ An integral control (𝐾𝑖 ) will have the effect of eliminating the
steady-state error, but it may make the transient response
worse.
❑ A derivative control (𝐾𝑑 ) will have the effect of increasing the
stability of the system, reducing the overshoot, and improving
the transient response.
30
Characteristics of P, I, and D controllers
31
Tips for Designing a PID Controller
❑ Obtain an open-loop response and determine what needs to be
improved.
❑ Add a proportional controller to improve the rise time.
❑ Add an integral controller to eliminate the steady-state error.
❑ Add a derivative controller to improve the overshoot.
❑ Adjust each of 𝐾𝑝 , 𝐾𝑖 , and 𝐾𝑑 until you obtain a desired overall
response.
❑ Please keep in mind that you do not need to implement all
three controllers (proportional, derivative, and integral) into a
single system, if not necessary.
❑ Keep the controller as simple as possible.
32
PID: Have your cake, and eat it too
❑ PID combines the steady state accuracy of the PI
compensator with the improvement in stability of a PD
compensator.
❑ This is also nice in terms of design; you can design the PD
compensator and PI compensator individually (determine gain
such that stability is optimized) and superimpose one on the
other.
❑ PD controller will reduce the overshoot and settling time but
increases steady state error and has effect on rise time.
❑ PI controller will eliminate steady state error, reduce rise time,
and increase the overshoot.
33
PID Controller
34
PID: Have your cake, and eat it too
35
PID Controller
The transfer function of PID controller is given as:
Where:
𝐾𝑝 : Proportional Gain
𝐾𝑖 : Integral Gain
𝐾𝑑 : Derivative Gain
36
PID Controller
The transfer function of PID controller is given as:
𝐾𝑖 𝐾𝑑 𝑑𝑒(𝑡)
𝑢 𝑡 = 𝐾𝑝 𝑒 𝑡 + න 𝑒 𝑡 𝑑𝑡 + ×
𝐾𝑝 𝐾𝑝 𝑑𝑡
𝐾𝑖 1 𝐾𝑑
𝑈 𝑠 = 𝐾𝑝 𝐸 𝑠 + × 𝐸(𝑠) + × 𝑠𝐸(𝑠)
𝐾𝑝 𝑠 𝐾𝑝
37
PID Controller
The transfer function of PID controller is given as:
𝑈(𝑠) 𝐾𝑖 1 𝐾𝑑
𝐶𝑝𝑖𝑑 𝑠 = = 𝐾𝑝 1 + × + ×𝑠
𝐸(𝑠) 𝐾𝑝 𝑠 𝐾𝑝
𝑈(𝑠) 1 1
𝐶𝑝𝑖𝑑 𝑠 = = 𝐾𝑝 1 + × + 𝑇𝑑 × 𝑠
𝐸(𝑠) 𝑇𝑖 𝑠
It can be simplified as:
Where:
𝑇𝑖 : Integral Time Constant
𝑇𝑑 : Derivative Time Constant
38
Example #1
Design a series controller 𝐺𝑐 (s) such that:
❑ The max peak = zero.
❑ The output of the system reaches to reference input within 2.5
sec.
❑ Comment on the performance improvement before and after the
controller.
39
Example #1
Requirement on transient response so PD controller used.
40
Example #1
41
Example #1
42
Example #1
43
Example #1
Comment
No improvement in the steady state because PD has no effect on
the steady state; it improves the transient state only.
❑ Before Controller: 𝑒𝑠.𝑠 = 0
❑ After Controller: 𝑒𝑠.𝑠 = 0
44
Example #2
Solved on board
45
Example #3
Solved on board
46
Where to find me?
❑ My Office at UB2-S09-B
❑ Email: mdarweesh@[Link]
47