Introduction to Control Theory - PID and Fuzzy Controllers

MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
Introduction to Control Theory
Introduction to Control Theory
PID and Fuzzy Controllers
Ahmed Elsafty
Universität Hamburg
Fakultät für Mathematik, Informatik und Naturwissenschaften
Fachbereich Informatik
Technische Aspekte Multimodaler Systeme
08. December 2014
A. Elsafty
1
MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
Introduction to Control Theory
Contents
1. Basics of Control Theory
State of the system
The need for Control
2. PID Control Design
Tuning
Limitations
3. FLC
Where are the fuzzy systems?
What the fuzz?!
Defuzzification techniques
Pros and Cons
A. Elsafty
2
MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
Introduction to Control Theory
Motivation
“...hark, now hear the sailors cry,
smell the sea, and feel the sky ...”
A. Elsafty
3
MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
Basics of Control Theory - State of the system
Introduction to Control Theory
State of the system
Structure of the system
I
I
I
I
I
I
A. Elsafty
System: Something that changes over time
Control: Influence that changes system behavior
State: control variable (e.g percentage)
Reference: what we want the system to do
Output: Measuring some aspects of the system
Feedback: Mapping from output to input
4
MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
Basics of Control Theory - State of the system
Introduction to Control Theory
State of the system
Structure of the system
I
I
I
I
I
I
A. Elsafty
System: Something that changes over time
Control: Influence that changes system behavior
State: control variable (e.g percentage)
Reference: what we want the system to do
Output: Measuring some aspects of the system
Feedback: Mapping from output to input
4
MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
Basics of Control Theory - State of the system
Introduction to Control Theory
State of the system
Structure of the system
I
I
I
I
I
I
A. Elsafty
System: Something that changes over time
Control: Influence that changes system behavior
State: control variable (e.g percentage)
Reference: what we want the system to do
Output: Measuring some aspects of the system
Feedback: Mapping from output to input
4
MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
Basics of Control Theory - State of the system
Introduction to Control Theory
State of the system
Structure of the system
I
I
I
I
I
I
A. Elsafty
System: Something that changes over time
Control: Influence that changes system behavior
State: control variable (e.g percentage)
Reference: what we want the system to do
Output: Measuring some aspects of the system
Feedback: Mapping from output to input
4
MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
Basics of Control Theory - State of the system
Introduction to Control Theory
State of the system
Structure of the system
I
I
I
I
I
I
A. Elsafty
System: Something that changes over time
Control: Influence that changes system behavior
State: control variable (e.g percentage)
Reference: what we want the system to do
Output: Measuring some aspects of the system
Feedback: Mapping from output to input
4
MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
Basics of Control Theory - State of the system
Introduction to Control Theory
State of the system
Structure of the system
I
I
I
I
I
I
A. Elsafty
System: Something that changes over time
Control: Influence that changes system behavior
State: control variable (e.g percentage)
Reference: what we want the system to do
Output: Measuring some aspects of the system
Feedback: Mapping from output to input
4
MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
Basics of Control Theory - The need for Control
Introduction to Control Theory
Control Theory: How to pick a proper Input signal while achieving
A. Elsafty
I
Stability
I
Tracking
I
Robustness
I
Disturbance rejection
I
Optimality
5
MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
PID Control Design
Introduction to Control Theory
PID Control Design
Maintaining Speed
I
State: velocity (v)
I
Input: Pedal on/off (u)
F = cu
I
Relating Input to State:
F = ma, ma = cu,
A. Elsafty
(1)
dv
c
= a, v̇ = u
dx
m
(2)
6
MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
PID Control Design
I
I
Introduction to Control Theory
Control signal should handle errors ( e = control Input Output)
Error handling criteria:
I
I
I
Small error = small Input
Control Input should not be jerky
Control Input should be dynamic
Brainstorming!
A. Elsafty
7
MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
PID Control Design
Introduction to Control Theory
Z
u(t) = KP ∗ e(t) + KI
t
e(t)dt + KD
0
I
P: Reduce rising time (stability), doesn’t eliminate S-S error
I
I: slow response, S-S eliminated, overshoots
I
D: stabilize system, eliminates overshooting, noise sensitivity
P
I
D
A. Elsafty
δe(t)
δt
Rise time
decreases
decreases
small change
Overshooting
increases
increases
decreases
settling time
small change
increases
decreases
S-S error
decreases
eliminates
no-change
8
MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
PID Control Design - Tuning
Introduction to Control Theory
Trail and Error
A. Elsafty
I
Increase P until it oscillates ”the push”
I
Increase I to decrease rise time and eliminate S-S
I
Increase D to decrease overshoots, after testing with noise
I
Calibration may take days
I
Not Reusable/Practical
9
MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
PID Control Design - Tuning
Introduction to Control Theory
Ziegler–Nichols method
I Heuristic tuning method
I Only P is set ”Simple”
I Creates quarter Wave Decay
I Works perfectly in a sluggish, laggy environment
I May cause vigorous overshoots
Control Type
P
PI
PID
I
I
A. Elsafty
Kp
0.5Kc
0.45Kc
0.6Kc
Ki
1.2Kp/Tu
2Kp/Tu
Kd
KpTu/8
Kp is increased until it oscillates with constant amplitude
At constant oscillations, Kp = Kc and Tu is oscillation period
10
MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
PID Control Design - Tuning
Introduction to Control Theory
Computerized Software
I Collects Data, Builds a model and suggest Gains
I
Robustness issues.
Neuro-PID Controlling
I Output is feedback to the neural network in a recurrent way.
I
Adaptive to changes.
Others: Fuzzy PID controller, Neuro-Fuzzy PID controller
A. Elsafty
11
MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
PID Control Design - Limitations
Introduction to Control Theory
Limitations
A. Elsafty
I
PID can be represented as an observer
I
Linearity
I
Noise in D ( Filtering)
I
Windup: Large change of setpoints occurs, I accumulates error
during rise, thus overshoots. ( Limit it)
I
Not useful in a system with fragile actuators
12
MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
FLC - Where are the fuzzy systems?
Introduction to Control Theory
Fuzzy Logic Controller
”Fuzzy theory is wrong, wrong, and pernicious. What we need is
more logical thinking, not less. The danger of fuzzy logic is that it
will encourage the sort of imprecise thinking that has brought us so
much trouble. Fuzzy logic is the cocaine of science.”
- Prof. Kahan, University of California, Berkeley
A. Elsafty
13
MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
FLC - Where are the fuzzy systems?
Introduction to Control Theory
Where are the Fuzzy systems?
I
Shifting gears in automatic transmissions in cars
I
Focussing your camera and camcorder
I
Running the cruise controls
I
Controlling dishwashers and washing machines
I
Heaters and many more.
The plan?
I
Design a fuzzy controller using:
I
I
I
A. Elsafty
Fuzzification ... Membership functions for our controlled variable,
A Rule Base
Defuzzification ... Get a control signal
14
MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
FLC - Where are the fuzzy systems?
Introduction to Control Theory
Where are the Fuzzy systems?
I
Shifting gears in automatic transmissions in cars
I
Focussing your camera and camcorder
I
Running the cruise controls
I
Controlling dishwashers and washing machines
I
Heaters and many more.
The plan?
I
Design a fuzzy controller using:
I
I
I
A. Elsafty
Fuzzification ... Membership functions for our controlled variable,
A Rule Base
Defuzzification ... Get a control signal
14
MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
FLC - What the fuzz?!
Introduction to Control Theory
To be or not to be
A. Elsafty
I
A statement is either True or False
I
A thing is either living or dead
I
A person is either funny or not
I
This Statement is False
I
A virus is neither living or dead
I
Fun is relative non measurable feature
I
Robert is tall
15
MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
FLC - What the fuzz?!
Introduction to Control Theory
To be or not to be
A. Elsafty
I
A statement is either True or False
I
A thing is either living or dead
I
A person is either funny or not
I
This Statement is False
I
A virus is neither living or dead
I
Fun is relative non measurable feature
I
Robert is tall
15
MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
FLC - What the fuzz?!
Introduction to Control Theory
To be or not to be
A. Elsafty
I
A statement is either True or False
I
A thing is either living or dead
I
A person is either funny or not
I
This Statement is False
I
A virus is neither living or dead
I
Fun is relative non measurable feature
I
Robert is tall
15
MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
FLC - What the fuzz?!
I
Fuzzy logic permits degrees of truth.
I
We can’t accept the sharp classification
I
Our concept of tallness is Fuzzy.
Introduction to Control Theory
50 shades of truth
A. Elsafty
I
Robert can be tall by 0.9 truth value
I
The sky is a member of the set of cloudy skies by a truth value
of 0.7
16
MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
FLC - What the fuzz?!
I
Fuzzy logic permits degrees of truth.
I
We can’t accept the sharp classification
I
Our concept of tallness is Fuzzy.
Introduction to Control Theory
50 shades of truth
A. Elsafty
I
Robert can be tall by 0.9 truth value
I
The sky is a member of the set of cloudy skies by a truth value
of 0.7
16
MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
FLC - What the fuzz?!
Introduction to Control Theory
Fuzzification
Tip: smooth == expensive
A. Elsafty
17
MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
FLC - What the fuzz?!
A. Elsafty
Introduction to Control Theory
18
MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
FLC - What the fuzz?!
Introduction to Control Theory
Temperature is 80
A. Elsafty
I
It’s 0.67 room is okay
I
0.33 room is hot
19
MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
FLC - What the fuzz?!
Introduction to Control Theory
Rule Base
I
I
I
A. Elsafty
If room is Cold, set the Heater on High mode
If room is Okay, set the Heater on medium mode
If room is Warm, set the Heater on Low mode
20
MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
FLC - Defuzzification techniques
A. Elsafty
I
Centroid
I
Max-membership principal
I
Center of sums
I
Center of Largest area and More
Introduction to Control Theory
21
MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
FLC - Defuzzification techniques
Introduction to Control Theory
Centroid (center of gravity)
R
c(z).zdz
Z = R
c(z)dz
∗
A. Elsafty
22
MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
FLC - Defuzzification techniques
Introduction to Control Theory
Weighted Average
A. Elsafty
23
MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
FLC - Defuzzification techniques
Introduction to Control Theory
Mean Max
Z∗ =
A. Elsafty
a+b
2
24
MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
FLC - Defuzzification techniques
Introduction to Control Theory
Center of Sums
A. Elsafty
25
MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
FLC - Defuzzification techniques
Introduction to Control Theory
Conditions
A. Elsafty
I
Each membership function overlaps only the nearest
neighbouring membership functions.
I
Membership values in all relevant fuzzy sets should sum up to
1 (approximately)
I
Dis-ambiguity, Computational-Complexity should be considered
when choosing a defuzzification method.
26
MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
FLC - Pros and Cons
Introduction to Control Theory
Pros:
I
Behavior based ( not Model based)
I
Simple, intuitive for starters
I
Can work as a nonlinear controller (without the need for
linearization)
Cons:
A. Elsafty
I
May not scale well to large rulesets
I
Difficult to estimate the membership function
27
MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
Conclusion
Introduction to Control Theory
Conclusion
A. Elsafty
I
Structure of the feedback system
I
How to mitigate errors
I
PID design and components
I
Gains’ tuning
I
Fuzzy logic
I
(De)fuzzification & fuzzy rules
28
MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
References
Introduction to Control Theory
References
A. Elsafty
I
Speed control of separately excieted DC motor using
neurofuzzy technique, Sanjeev Kumar,National Institute of
Technology Rourkela Rourkela-769008, Orissa
I
Tuning of a neuro-fuzzy controller by Genetic Algorithms with
an application to a coupled-tank liquid-level control system,
Centre for Artificial Intelligence and Robotics (CAIRO),
Universiti Teknologi Malaysia, Jalan Semarak, 54100 Kuala
Lumpur, Malaysia
I
Quadrocopter Fuzzy Flight Controller, Muhammad Saad
Shaikh, Technology Studies from the Department of
Technology at Örebro University, örebro 2011
29
MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
References
Introduction to Control Theory
References
I
I
I
I
A. Elsafty
Comparison of PID Controller Tuning Methods, Mohammad
Shahrokhi and Alireza Zomorrodi, Department of Chemical &
Petroleum Engineering Sharif University of Technology
An Adaptive Neuro PID for controlling the altitude of
quadcopter robot, M. Fatan, Islamic Azad university of Qazvin,
Qazvin, Iran
Neural Networks for Self Tuning of PI- and PID-Controllers,
www.caba.org, IS 2005-42
Adaptive System Control with PID Neural Networks, F.
Shahraki a , M.A. Fanaei b , A.R. Arjomandzadeh, Department
of Chemical Engineering, University of Sistan and Baluchestan,
Zahedan,Iran.
30
MIN-Fakultät
Fachbereich Informatik
Universität Hamburg
References
Introduction to Control Theory
References
I
A. Elsafty
Fuzzy-PID Controllers vs. Fuzzy-PI Controllers, M. Santos, S.
Dormido, J. M. de la Cruz, Dpto. de Informática y
Automática. Facultad de Fı́sicas.
31