Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at...

40
Universit¨ at Hamburg MIN-Fakult¨ at Fachbereich Informatik Introduction to Control Theory Introduction to Control Theory PID and Fuzzy Controllers Ahmed Elsafty Universit¨ at Hamburg Fakult¨ at f¨ ur Mathematik, Informatik und Naturwissenschaften Fachbereich Informatik Technische Aspekte Multimodaler Systeme 08. December 2014 A. Elsafty 1

Transcript of Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at...

Page 1: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

Introduction to Control Theory

Introduction to Control TheoryPID and Fuzzy Controllers

Ahmed Elsafty

Universitat HamburgFakultat fur Mathematik, Informatik und NaturwissenschaftenFachbereich Informatik

Technische Aspekte Multimodaler Systeme

08. December 2014

A. Elsafty 1

Page 2: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

Introduction to Control Theory

Contents

1. Basics of Control TheoryState of the systemThe need for Control

2. PID Control DesignTuningLimitations

3. FLCWhere are the fuzzy systems?What the fuzz?!Defuzzification techniquesPros and Cons

A. Elsafty 2

Page 3: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

Introduction to Control Theory

Motivation

“...hark, now hear the sailors cry,smell the sea, and feel the sky ...”

A. Elsafty 3

Page 4: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

Basics of Control Theory - State of the system Introduction to Control Theory

State of the system

Structure of the system

I System: Something that changes over timeI Control: Influence that changes system behaviorI State: control variable (e.g percentage)I Reference: what we want the system to doI Output: Measuring some aspects of the systemI Feedback: Mapping from output to input

A. Elsafty 4

Page 5: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

Basics of Control Theory - State of the system Introduction to Control Theory

State of the system

Structure of the system

I System: Something that changes over timeI Control: Influence that changes system behaviorI State: control variable (e.g percentage)I Reference: what we want the system to doI Output: Measuring some aspects of the systemI Feedback: Mapping from output to input

A. Elsafty 4

Page 6: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

Basics of Control Theory - State of the system Introduction to Control Theory

State of the system

Structure of the system

I System: Something that changes over timeI Control: Influence that changes system behaviorI State: control variable (e.g percentage)I Reference: what we want the system to doI Output: Measuring some aspects of the systemI Feedback: Mapping from output to input

A. Elsafty 4

Page 7: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

Basics of Control Theory - State of the system Introduction to Control Theory

State of the system

Structure of the system

I System: Something that changes over timeI Control: Influence that changes system behaviorI State: control variable (e.g percentage)I Reference: what we want the system to doI Output: Measuring some aspects of the systemI Feedback: Mapping from output to input

A. Elsafty 4

Page 8: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

Basics of Control Theory - State of the system Introduction to Control Theory

State of the system

Structure of the system

I System: Something that changes over timeI Control: Influence that changes system behaviorI State: control variable (e.g percentage)I Reference: what we want the system to doI Output: Measuring some aspects of the systemI Feedback: Mapping from output to input

A. Elsafty 4

Page 9: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

Basics of Control Theory - State of the system Introduction to Control Theory

State of the system

Structure of the system

I System: Something that changes over timeI Control: Influence that changes system behaviorI State: control variable (e.g percentage)I Reference: what we want the system to doI Output: Measuring some aspects of the systemI Feedback: Mapping from output to input

A. Elsafty 4

Page 10: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

Basics of Control Theory - The need for Control Introduction to Control Theory

Control Theory: How to pick a proper Input signal while achieving

I Stability

I Tracking

I Robustness

I Disturbance rejection

I Optimality

A. Elsafty 5

Page 11: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

PID Control Design Introduction to Control Theory

PID Control Design

Maintaining Speed

I State: velocity (v)

I Input: Pedal on/off (u)

F = cu (1)

I Relating Input to State:

F = ma,ma = cu,dv

dx= a, v =

c

mu (2)

A. Elsafty 6

Page 12: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

PID Control Design Introduction to Control Theory

I Control signal should handle errors ( e = control Input -Output)

I Error handling criteria:I Small error = small InputI Control Input should not be jerkyI Control Input should be dynamic

Brainstorming!

A. Elsafty 7

Page 13: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

PID Control Design Introduction to Control Theory

u(t) = KP ∗ e(t) + KI

∫ t

0e(t)dt + KD

δe(t)

δt

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

Rise time Overshooting settling time S-S error

P decreases increases small change decreases

I decreases increases increases eliminates

D small change decreases decreases no-change

A. Elsafty 8

Page 14: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

PID Control Design - Tuning Introduction to Control Theory

Trail and Error

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

A. Elsafty 9

Page 15: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

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 Kp Ki Kd

P 0.5Kc - -

PI 0.45Kc 1.2Kp/Tu -

PID 0.6Kc 2Kp/Tu KpTu/8

I Kp is increased until it oscillates with constant amplitude

I At constant oscillations, Kp = Kc and Tu is oscillation period

A. Elsafty 10

Page 16: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

PID Control Design - Tuning Introduction to Control Theory

Computerized SoftwareI Collects Data, Builds a model and suggest Gains

I Robustness issues.

Neuro-PID ControllingI Output is feedback to the neural network in a recurrent way.

I Adaptive to changes.

Others: Fuzzy PID controller, Neuro-Fuzzy PID controllerA. Elsafty 11

Page 17: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

PID Control Design - Limitations Introduction to Control Theory

Limitations

I PID can be represented as an observer

I Linearity

I Noise in D ( Filtering)

I Windup: Large change of setpoints occurs, I accumulates errorduring rise, thus overshoots. ( Limit it)

I Not useful in a system with fragile actuators

A. Elsafty 12

Page 18: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

FLC - Where are the fuzzy systems? Introduction to Control Theory

Fuzzy Logic Controller

”Fuzzy theory is wrong, wrong, and pernicious. What we need ismore logical thinking, not less. The danger of fuzzy logic is that itwill encourage the sort of imprecise thinking that has brought us somuch trouble. Fuzzy logic is the cocaine of science.”

- Prof. Kahan, University of California, Berkeley

A. Elsafty 13

Page 19: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

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 Fuzzification ... Membership functions for our controlled variable,I A Rule BaseI Defuzzification ... Get a control signal

A. Elsafty 14

Page 20: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

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 Fuzzification ... Membership functions for our controlled variable,I A Rule BaseI Defuzzification ... Get a control signal

A. Elsafty 14

Page 21: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

FLC - What the fuzz?! Introduction to Control Theory

To be or not to be

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

A. Elsafty 15

Page 22: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

FLC - What the fuzz?! Introduction to Control Theory

To be or not to be

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

A. Elsafty 15

Page 23: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

FLC - What the fuzz?! Introduction to Control Theory

To be or not to be

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

A. Elsafty 15

Page 24: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

FLC - What the fuzz?! Introduction to Control Theory

I Fuzzy logic permits degrees of truth.

I We can’t accept the sharp classification

I Our concept of tallness is Fuzzy.

50 shades of truth

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 valueof 0.7

A. Elsafty 16

Page 25: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

FLC - What the fuzz?! Introduction to Control Theory

I Fuzzy logic permits degrees of truth.

I We can’t accept the sharp classification

I Our concept of tallness is Fuzzy.

50 shades of truth

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 valueof 0.7

A. Elsafty 16

Page 26: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

FLC - What the fuzz?! Introduction to Control Theory

Fuzzification

Tip: smooth == expensiveA. Elsafty 17

Page 27: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

FLC - What the fuzz?! Introduction to Control Theory

A. Elsafty 18

Page 28: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

FLC - What the fuzz?! Introduction to Control Theory

Temperature is 80

I It’s 0.67 room is okay

I 0.33 room is hot

A. Elsafty 19

Page 29: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

FLC - What the fuzz?! Introduction to Control Theory

Rule Base

I If room is Cold, set the Heater on High mode

I If room is Okay, set the Heater on medium mode

I If room is Warm, set the Heater on Low mode

A. Elsafty 20

Page 30: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

FLC - Defuzzification techniques Introduction to Control Theory

I Centroid

I Max-membership principal

I Center of sums

I Center of Largest area and More

A. Elsafty 21

Page 31: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

FLC - Defuzzification techniques Introduction to Control Theory

Centroid (center of gravity)

Z ∗ =

∫c(z).zdz∫c(z)dz

A. Elsafty 22

Page 32: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

FLC - Defuzzification techniques Introduction to Control Theory

Weighted Average

A. Elsafty 23

Page 33: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

FLC - Defuzzification techniques Introduction to Control Theory

Mean Max

Z ∗ =a + b

2

A. Elsafty 24

Page 34: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

FLC - Defuzzification techniques Introduction to Control Theory

Center of Sums

A. Elsafty 25

Page 35: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

FLC - Defuzzification techniques Introduction to Control Theory

Conditions

I Each membership function overlaps only the nearestneighbouring membership functions.

I Membership values in all relevant fuzzy sets should sum up to1 (approximately)

I Dis-ambiguity, Computational-Complexity should be consideredwhen choosing a defuzzification method.

A. Elsafty 26

Page 36: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

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 forlinearization)

Cons:

I May not scale well to large rulesets

I Difficult to estimate the membership function

A. Elsafty 27

Page 37: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

Conclusion Introduction to Control Theory

Conclusion

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

A. Elsafty 28

Page 38: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

References Introduction to Control Theory

References

I Speed control of separately excieted DC motor usingneurofuzzy technique, Sanjeev Kumar,National Institute ofTechnology Rourkela Rourkela-769008, Orissa

I Tuning of a neuro-fuzzy controller by Genetic Algorithms withan application to a coupled-tank liquid-level control system,Centre for Artificial Intelligence and Robotics (CAIRO),Universiti Teknologi Malaysia, Jalan Semarak, 54100 KualaLumpur, Malaysia

I Quadrocopter Fuzzy Flight Controller, Muhammad SaadShaikh, Technology Studies from the Department ofTechnology at Orebro University, orebro 2011

A. Elsafty 29

Page 39: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

References Introduction to Control Theory

References

I Comparison of PID Controller Tuning Methods, MohammadShahrokhi and Alireza Zomorrodi, Department of Chemical &Petroleum Engineering Sharif University of Technology

I An Adaptive Neuro PID for controlling the altitude ofquadcopter robot, M. Fatan, Islamic Azad university of Qazvin,Qazvin, Iran

I Neural Networks for Self Tuning of PI- and PID-Controllers,www.caba.org, IS 2005-42

I Adaptive System Control with PID Neural Networks, F.Shahraki a , M.A. Fanaei b , A.R. Arjomandzadeh, Departmentof Chemical Engineering, University of Sistan and Baluchestan,Zahedan,Iran.

A. Elsafty 30

Page 40: Introduction to Control Theory - uni- · PDF fileUniversit at Hamburg MIN-Fakult at Fachbereich Informatik Introduction to Control Theory Contents 1. Basics of Control Theory State

Universitat Hamburg

MIN-FakultatFachbereich Informatik

References Introduction to Control Theory

References

I Fuzzy-PID Controllers vs. Fuzzy-PI Controllers, M. Santos, S.Dormido, J. M. de la Cruz, Dpto. de Informatica yAutomatica. Facultad de Fısicas.

A. Elsafty 31