Upload
calder
View
66
Download
0
Tags:
Embed Size (px)
DESCRIPTION
EEE-8005 Industrial automation SDL. Module leader: Dr. Damian Giaouris Email: [email protected] Room: E3.16 Phone: 0191 222 -7327. Module Leader of: Digital Control (EEE 8007) Degree Program Director of MSc: Automation and Control. Scopes / Objectives. Lecture Scope: - PowerPoint PPT Presentation
Citation preview
EEE-8005 Industrial automation SDL
Module leader: Dr. Damian Giaouris
Email: [email protected]
Room: E3.16
Phone: 0191 222 -7327
Module Leader of: Digital Control (EEE 8007)Degree Program Director of MSc: Automation and Control
Scopes / Objectives
Lecture Scope: • To give a mathematical background on set theory
Lecture Outcomes: • Syllabus outline• Explain the SDL part of the course• Boolean set theory – definition, intersection, union…• Need for fuzzy logic• Fuzzy logic set theory – membership functions: form, domain,
image• Logical operators OR AND Min Max…• Linguistic variables
Module Structure
Student Directed LearningStudent Directed Learning
Some lectures => Trigger further individualindividual study
Normal Lectures: 2hs/week
1h session/week: SDL
Provisional syllabus
Artificial IntelligenceFuzzy Logic
Theory Matlab
Neural NetworksGenetic algorithms
Provisional syllabus
Week 1: Intro – Basic set theoryWeek 2: Design of fuzzy logic controllersWeek 3: Design of fuzzy logic controllers IIWeek 4: TS Fuzzy Logic Weeks 5 - 7: Matlab programming Week 8: ANN – Matlab Week 9: ANN – Matlab IIWeek 10: Genetic AlgorithmsWeek 11: RevisionWeek 12: ???
Control strategy
Conventionalcontrol Model of the actual plant
Deterministic Stochastic
Inaccurate
Complex methods
Human reasoning and experience
Complicated processes Controlled by experiencedpractical engineers
Have no ideaabout the model
Use their knowledge &experience
Human reasoningNo model neededSatisfactory performance
Artificial Intelligence
Artificial Intelligence
•Expert Systems (ES)•Fuzzy Logic (FL)•Artificial Neural Networks (ANN)•Genetic Algorithms (GAs)•A combination of all these
Set theory I
Shape A Shape B Shape C Shape D
Shape E Shape F Shape G Shape H
H Shape F, Shape D, Shape C, ShapeA
G Shape E, Shape B, Shape A, ShapeB
H Shape G, Shape F, Shape E, Shape D, Shape C, Shape B, Shape A, ShapeC
Set theory II
H Shape F, Shape D, Shape C, ShapeA
G Shape E, Shape B, Shape A, ShapeB
H Shape G, Shape F, Shape E, Shape D, Shape C, Shape B, Shape A, ShapeC
Subset: A set that has some elements from another set
G Shape B, Shape A, ShapeD BD Union: A set that has all the elements of two other sets
G Shape B, Shape A, Shape H, Shape F, Shape D, Shape C, Shape AD
DAAD
Intersection: A set that has all the common elements of two other sets
G ShapeEB H Shape G, ShapeEwhere
BEEB
Boolean Logic
esTemperaturA HotesTemperaturBAB ,
25 esTemperaturesTemperaturB
25 Temperature
MembershipFunction
100%
0%
Boolean and Fuzzy Logic (FL)
Temperature=24.99 ??? Not so HotNot so Hot
Temperature=25 100 %
Temperature=24 90 %Temperature=15 0 %
Element Membership function, I.e. How much an element belongs to a set
HotMuchHowesTemperaturC ,
Fuzzy Logic
25 Temperature
MembershipFunction
15
100%
0%
25 Temperature
MembershipFunction
100%
0%
Fuzzy Sets I
Triangular
Trapezoidal
Fuzzy Sets II
Gaussian
Sigmoidal
Polynomial
Fuzzy Sets III
Logical Operators
6 4, 2, 1,A
1 2 3 4 5 6
Set A
Union•For element 1: Is 1 a member of set A OR set BIntersection•For element 1: Is 1 a member of set A AND set B
6 5, 2,3, B
1 2 3 4 5 6
Set B
Logical Operators Discrete Sets
6 3,4,5, 2, 1,BA
1 2 3 4 5 6
UnionA B AND OR
1 0 0 1
0 1 0 1
1 1 1 1
0 0 0 0
6 2,BA
1 2 3 4 5 6
Intersection
Logical Operators Continuous Sets
25 esTemperaturesTemperaturA
30 eTemperatureTemperaturInter
25 etemperaturetemperaturUnion
25 Temperature30 25 Temperature30
03 esTemperaturesTemperaturB
Fuzzy sets & Logical Operators I
OR=MAXAND=MIN
A B Min(A, B)and
Max(A, B)or
1 0 0 1
0 1 0 1
1 1 1 1
0 0 0 0
Fuzzy sets & Logical Operators II
Example – Matlab Exercise
Two fuzzy sets have the following membership functions
35,30,75
1
30,25,55
1
3525,0
xxx
xxx
xorxx
A
40,35,85
1
35,30,65
1
4030,0
xxx
xxx
xorxx
B
Plot the two setsFind the union and the intersection of them, and explain the results through the min, max operator
Linguistic variables
The room is cold lets switch on the heaterNot The temperature is 17.5 degrees
)(x
esTemperatur
1
1510 20
cold
Lecture 1
Lecture scope
Lecture Scope: • To define advanced concepts on FL set theory• Connection between classical and FS theory
Lecture Outcomes: • Notation• Definitions like support, height…• Union, intersection, max and min• Negation, bounded sums• Cartesian products on crisp and FS• Extension principle• Fuzziness
Lecture Outcomes
Lecture Scope: • Basic steps in the design of a Fuzzy Logic Controller
Lecture Outcomes:
• Basic Control strategy• Fuzzification• Fuzzy Inference System• Multiple Inputs – And/Or operators• Overlapping Fuzzy Sets• Defuzzyfication
Design of a FLC - Basic Concept
FL mimics Human Reasoning:
If … Then…
IF THEN RULES
R1: If the room is very cold then switch on the heater to fullR2: If the room is cold then switch on the heater to mediumR3: If the room is normal then switch off the heater
If part: premise - Then part: conclusion
Design of a FLC - Fuzzification I
)(x
Temperatures
1
1510 20
VeryCold
Cold Warm Hot
1. Cover I/O the universe of discourse with FS2. Assign to every real input a membership function at each set This process is called Fuzzyfication
Design of a FLC - Fuzzification II
)(x
Temperatures
1
1510 20
VeryCold
Cold Warm Hot
11
0.7
0.5
With this way every real input is mapped to a fuzzy setThe value of the membership function that will be assigned dependson the shape of the membership function
Design of a FLC – If… Then…
1. If … Then … Rules2. Input Fuzzy Sets (Fuzzification)3. Output Fuzzy Sets
Associate
If Then Rules
Input Linguistic Variable
Output Linguistic Variable
If … Then … Rules associate the input fuzzy sets to the output fuzzy setsIf … Then … Rules associate the input fuzzy sets to the output fuzzy sets
Design of a FLC – If… Then…
)(x
eTemperatur0
Very Cold Cold Normal
35 10050 80
)(x
%
Heater0
MaxMedOff
35 10050 80
R1: If temp is Very Cold Then Heater is MaxR2: If temp is Cold Then Heater is MedR3: If temp is Normal Then Heater is Off
Design of a FLC - Degree of Support Boolean sets
Assume an IF THEN rule with Boolean sets:R1: IF student fails THEN his/her parents are Sad
Hence if a student x fails 100% then his/her parentswill be 100% sad.
Therefore how much truth is the premise defines how much truth is the conclusion
The value of 100% or 0% is called degree of support of R1
Design of a FLC - Degree of Support Fuzzy sets I
Exactly the same stands for fuzzy setsR1: If temp is Cold Then Heater is Med
)(x
1
5030 80
Cold)(x
1
50%35% 80%
Med
Assume temp=35oC
Design of a FLC - Degree of Support Fuzzy sets II
So the degree of support is 0.7So the output “Med” is true 0.7
)(x
1
5030 80
Cold
35
0.7
???
R1: If temp is Cold Then Heater is Med
Design of a FLC - Degree of Support Fuzzy sets III
I have to take 70% of the output
)(x
1
5030 80
Cold
35
0.7
)(x
1
50%35% 80%
Med
0.7
Design of a FLC - Degree of Support Fuzzy sets IV
)(x
1
50%35% 80%
Med
0.7
)(x
1
50%35% 80%
Med
0.7
Min method Product method
Design of a FLC - 2nd example
)(x
hour
milesSpeed0
Slow Normal Fast
35 10050 80
)(x
%
LevelBrake0
Min Med Max
35 10050 80
R1: If speed is Slow Then Brake is MinR2: If speed is Normal Then Brake is MedR3: If speed is Fast Then Brake is Max
Design of a FLC - Degree of Support Fuzzy sets II
85 miles/hour -> Input: Max 0.5Hence Output: 0.5
)(x
hourmilesSpeed
0.5
9080 100
Fast
85
)(x
0.5
90%80% 100%
Maximum
Brake level
Design of a FLC - Degree of Support Fuzzy sets III
85 miles/hour -> Input: High 0.5Hence Output: 0.5
)(x
0.5
90%80% 100%
High
Brake level
)(x
hourmilesSpeed
0.5
9080 100
Fast
85
Design of a FLC – Number of Inputs
Has the previous controller a satisfactory performance?
No, what about if the speed is medium and there is a car in 5m
We need another input, the distance from the front car.
Hence the rules will have the following form:
R1: If Speed is High OR/AND the Distance is Small Then Brake is Max
Hence we have to use logical operators: Max & Min
Design of a FLC – Or / AND I
The problem now is the degree of support of this rulesince there are two fuzzy sets that are activated
High Speed and Small Distance
)(x
hkmSpeed /,
1
9080 100
High)(x
m,distance
1
2010 30
Close
Design of a FLC – Or / AND II
Assume that the actual speed is 85 and the actual distance is 18 meters:
)(x
hkmSpeed /,
1
9080 100
High
85
0.5
)(x
m,distance
1
2010 30
Close
0.6
18
Degree from input 1=0.5Degree from input 2=0.6
Design of a FLC – Or / AND III
Since the OR operator was used then the overall degree of support is found by the max operation:Degree of Support for rule 1: max(0.5,0.6)=0.6
If the operator was the AND then we would use min:Degree of Support for rule 1: min(0.5,0.6)=0.5
)(x
0.6
90%80% 100%
Maximum
Brake level
)(x
0.6
90%80% 100%
High
Brake level
Maximum
Design of a FLC – Multiple Input FS I
The universe of discourse must be fully covered by FSHence now the controller could be:
)(x
hkmSpeed /,
9080 100
High
60504030
MedLow
Input Output
)(x
scaleBrake
9080 100
Full
60504030
SomeLittle
If Speed==Low Then Brake==Little
If Speed==Some Then Brake==Some
If Speed==High Then Brake==Full
Design of a FLC – Multiple Input FS II
Hence if input=35km/h:
Input Output
)(x
hkmSpeed /,
9080 100
High
60504030
MedLow
0.5
)(x
scaleBrake
9080 10060504030
Little
Design of a FLC – Overlapping Input FS I
What about if speed is 50km/h?The controller will do nothing!!!
For this reason we overlap the FS:
)(x
hkmSpeed /,
9080 1007050403020100 60
VeryLow
Low HighVeryHigh
)(x
hkmSpeed /,
9080 1007050403020100 60
Nothing Little Some Full
Brake scale %
Design of a FLC – Overlapping Input FS II
1. If Speed==Very Low Then Brake==Nothing2. If Speed==Low Then Brake==Little3. If Speed==High Then Brake==Some 4. If Speed==Very High Then Brake==Full
Speed=25 km/h Very Low 0.8 Low 0.2
Hence degree of support for R1 is 0.8 and for R2 is 0.2
Design of a FLC – Overlapping Input FS III
)(x
hkmSpeed /,
9080 1007050403020100 60
Nothing
Brake scale%
)(x
hkmSpeed /,
9080 1007050403020100 60
Little
Brake scale%
Aggregation MethodAggregation Method
1. Max (Maximum) 2. Prodor (Probabilistic Or) 3. Sum
)(x
hkmSpeed /,
9080 1007050403020100 60
Nothing
Brake scale %
Design of a FLC – Overlapping Input FS V
Brake scale %
)(x
hkmSpeed /,
9080 1007050403020100 60
Nothing
Brake scale %
)(x
hkmSpeed /,
9080 1007050403020100 60
Nothing)(x
hkmSpeed /,
9080 1007050403020100 60
Nothing
Design of a FLC – Defuzzification
)( x
0.5
90%80% 100%
Maximum
)( x
0.5
90%80% 100%
Mean Of Maxima
Max Of Maxima
Least Of Maxima
)( x
0.5
90%80% 100%
Centre of area (COA)
Design of a FLC – Defuzzification
max: yyout Maximum
Mean Of Maxima (MOM) max:1
1
j
m
jj yy
mout
Centre of area (COA)
m
ij
m
ijj
y
yyout
1
1
Largest of maximumSmallest of maximum
Design of a FLC – Summary
The first step is to Fuzzify the real inputs:Appropriate cover the universe of discourse with FS
The second step is to create the FIS:Create the IF THEN rules using AND/OR operatorAggregate all the FLR to get the final output FS
Initially choose the number of inputs/outputs and their universe of discourse
The last step is to defuzzify the output fuzzy sets to a real value
Lecture 3
Artificial Neural Networks (ANNs)
Human Brain:
Memory Processor
Small “computing” element: Neuron
NucleusCell bodyAxon/Nuerous dendritic links Synapses
1010 to 1012
Adaptive connections
Structure of ANNs
Σ f(net)net y
w1
w2
w3
w n
x1
x2
x3
xn
Activationfunction
Inputs
1
b
Inputs: x1 ,x2,x3,…,xn Weights w1 ,w2,w3,…,wn
bxwxwxwxwbxwnet nn
n
iii
.......332211
1
bxwfnetfy
n
iii
1
Activation function
bxwfnetfy
n
iii
1
Linear activation function
y
net
Threshold activation function
y
net
+1
-1
Activation function…cont
bxwfnetfy
n
iii
1
net
+1
0.5
y
Sigmoid function
Tansigmoid function
y
net
+1
-1
Architecture of ANNs
Combinations of ANNs
y1
x2
x3
x1
y2
y3
+1 +1
Threshold Threshold
b11
b12
w111
w112
w431 w34
2
InputLayer
OutputLayer
HiddenLayer
o1
o2
o3
o4
Multi-layer feedforward
Σ f(net)net y
w1
w2
w3
w n
x1
x2
x3
xn
Activationfunction
Inputs
1
b
3 inputs x 4 outputs from o 3 outputs y
T
T
T
yyy
oooo
xxx
321
4321
321
y
o
x
Multi-layer feedforward
T
T
T
yyy
oooo
xxx
321
4321
321
y
o
x
14
13
12
11
143
142
141
133
132
131
123
122
121
113
112
111
,
b
b
b
b
www
www
www
www
11 bw
y1
x2
x3
x1
y2
y3
+1 +1
Threshold Threshold
b11
b12
w111
w112
w431 w34
2
InputLayer
OutputLayer
HiddenLayer
o1
o2
o3
o4
1st Layer
Hidden Layer
113
1132
1121
111
11 bxwxwxwfo
214
2143
2132
2121
211
21 bowowowowfy
Recurrent neural networks
y1
x2
x1
y2
y3
w111
w112
w431 w34
2
Delay
ExternalInputs
Delay
Classification of ANN
Supervised Learning:
Unsupervised Learning
Teacher Input/ Target data
Network weight correction Learning algorithm
Minimize an error function
Mean-squared error (MSE)
Learning algorithm
Back propagationNon-LinearFunction
NeuralNetwork
Learning Algorithm
x
Input
y
y
+
-
error )(1 kwkwkw ijijij
ijij w
Ew
n: Learning Rate
)1(
)(1
kw
kwkwkw
ij
ijijij
ANNs Strategy
1.Assemble the suitable training data2.Create the network object
3.Train the network 4.Simulate the network response to new inputs
Application of ANNs
1. Classification and diagnostic2. Pattern recognition 3. Modelling 4. Forecasting and prediction5. Estimation and Control
Revision
Σ f(net)net y
w1
w2
w3
w n
x1
x2
x3
xn
Activationfunction
Inputs
1
b
y1
x2
x3
x1
y2
y3
+1 +1
Threshold Threshold
b11
b12
w111
w112
w431 w34
2
InputLayer
OutputLayer
HiddenLayer
o1
o2
o3
o4Non-Linear
Function
NeuralNetwork
Learning Algorithm
x
Input
y
y
+
-
error
Matlab
net= newff ([-4 3; -5 5], [4,1], {‘tansig’,’purelin’},’traingda’ )
net.trainParam.lr
net.trainParam.epochs
net.trainParam.goal
562.003.0 23 xxxxfy x=0-20 input=x
target=f(x)
>> net=newff([0,20],[10,1],{'tansig','purelin'},'trainlm');>> net.trainParam.goal=1e-5;>> net.trainParam.epochs=500;
>> [net,tr]=train(net,p,t);
>> a=sim(net,x)