Sei sulla pagina 1di 46

APSC 150

Engineering Case Studies


Case Study 3
Part 3: Automation
Lecture 3.8. Fuzzy Control
John A. Meech
Professor and Director of CERM3
Centre for Environmental Research in
Minerals, Metals, and Materials
http://www.mining.ubc.ca/faculty/meech/apsc150.htm

What is Fuzzy Logic?

When the only tool you have is a hammer, all your problems look like a
- Lotfi Zadeh, University of California,
The Father of Fuzz

A method to develop approximate solutions that tolerate


imprecision
Conventional mathematical models often demand a degree of
precision that is difficult to achieve (adaptation may also be a problem)
Models may only work over a small region in time or space,
particularly non-linear ones

The Whole World is Fuzzy!


We all use FL everyday in a natural way without even realizing it
FL is a method that computes with words rather than with numbers
FL deals with how we think about control rather than modeling the
process itself
A FL system is how we verbalize our understanding of the process

Degree of Belief (DoB)

Fuzzy Set Terminology


100

Fuzzy Day to Night

Fuzzy Set Examples

An automobile changing lanes while passing


The position of the shoreline during tidal inflow or outflow
A door being closed or opened (it's ajar!)
A water valve being opened or closed
A glass of water (Is it half-full or half empty?)
The mixing together of two primary colours
The age of a young customer in a bar (is ID required?)
The time it takes to drive from home to work
The waiting time in a queue

Fuzzy Logic versus Binary Logic


Binary Logic - things are either True or False
While that may be ultimately the case, as we
grapple with trying to predict this state of affairs,
the degree to which we believe something is true
or false can change on a scale from 0 to 100
Binary Logic deals with the set {0,100}
Fuzzy Logic deals with the set (0,100)

Fuzzy Statements
I am 90% sure about this.
It is warm today. (same meaning in Yellowknife as in Miami?)
It may rain today. (where, when, how intense, for how long?)
A recession is a decline in GDP over 2 consecutive quarters.
A depression is a severe (10% GDP drop) or prolonged (3-4 year)
recession.
Read my lips: no new taxes
G.H.W. Bush, 1988

"It depends on what the meaning of the word 'is' is."


W.J. Clinton, 1998

Paradoxes
A man says: Don't Trust Me.
Should you trust him? If you do, then you don't!

A politician says: All politicians are liars.


Is this true? If so, then he is not a liar.

A card states on one side:


The sentence on the other side is false...

On the other side appears:


The sentence on the other side is true...
How do you interpret this card?

Paradoxes
Bertrand Russell's Famous Paradox:
All rules have exceptions.
Is this a rule?
If so, then what is its exception?

The Liar's Paradox represented by


"This sentence is false."
can only be understood as a half truth. It can never be
statement and it never can be a false statement.

a true

Paradoxes
Paradoxes all have the same form:
A statement S and its negation not-S
both of which have the same truth-value t(S)

t(S) = t(not-S)
The two statements are both TRUE (1) and FALSE (0) at the
same time. But bivalent logic states that negation produces the
reverse truth value. Hence:

t(not-S) = 1 - t(S)

Paradoxes
Combining these two expressions, we get:

t(S) = 1 - t(S)
This is contradictory since if S is true, then 1 = 0 and if S is false,
then 0 = 1. But a fuzzy interpretation of truth values can solve for t(S)
allowing it to assume a value other than the set {0, 1}. So:

t(S) = 0.5
With fuzzy logic, a Paradox reduces to a literal half-truth which can
be considered the uncertainty inherent in every empirical statement
and many mathematical expressions.

Paradoxes
Returning to the Liars Paradox, it must have a value of 0.5 on a truth
scale from 0 to 1.
But it is possible to generate similar sentences that can take on a
value anywhere along the full range of the truth scale. For example:
DoB (%)

"This sentence is sometimes false."


"This sentence is rarely false."

50100
050

Other sentences that use qualifiers, hedges, or modifiers such as


"could be" or "might be provide a way to make all paradoxical
sentences truly fuzzy.

(and, perhaps, sensible!)

Fuzzy Linguistic Hedges


Linguistic expressions "flavour" our certainty in a concept or fact
A hedge is a qualifier used to avoid total commitment or to make a
statement more vague or more definite
The Random House Word Menu by Stephen Glazier lists
categories of qualifiers that include:
- Limitations and Conditions
325 entries
- Approximations and Generalizations
150 entries
- Emphasizers
85 entries
- Maximizers and Superlatives
105 entries
- Absolutes and Guarantees
185 entries

Fuzzy Linguistic Hedges


English is full of rich linguistic terms to provide "shades of grey" to a
concept. Consider the following set of words:

beautiful, pretty, gorgeous, voluptuous, sexy, attractive,


stunning, handsome, fabulous, marvellous, outstanding,
cute, remarkable, lovely, magnificent, extraordinary, etc.
Each may describe a persons appearance, but the meaning is different
depending on the word or context in which it is used.
Notice how your mind instantly switches context as you move from one
word to another.
The term "handsome", for example, is often reserved for males while
"pretty" and "gorgeous" typically describe a female.

Degree of Fuzziness

FL is Part of AI
AI = Artificial Intelligence
Components of AI

Expert Systems (rule base structure)


Fuzzy Logic (uncertainty management)
Artificial Neural Networks (learning method)
Genetic Algorithms (optimization search)
SWARM Intelligence (agent-based approach)

How a Fuzzy Controller Works

Adaptation and Extension are done with ease in one or more of four ways:

Redefining fuzzy sets dynamically


Redefining the rule base dynamically
Changing the Inferencing method on the fly
Changing the Defuzzification method on the fly

Example Rule
Rules are constructed as spoken by an
experienced operator (an Expert):
If CURRENT DRAW is LOW
Then INCREASE FEEDRATE A LOT
Provided SCREEN BIN LEVEL is not TOO-HIGH

A set of rules like this provides a way to


implement control rapidly and effectively

Rule Operations
ANDing takes the Minimum DoB
ORing takes the Maximum DoB

NdT

The Net Degree of Truth of the premise is assigned


to the conclusion statement using the following
equation:

DoB(conc) = NdT * CF / 100


where CF = Certainty Factor of the rule conclusion
statement (If no value is given, it is taken as 100%)

Example
IF
AND
OR
AND
THEN

A
B
C
D
F CF = 90

DoB(A) = 95
DoB(B) = 85
DoB(C) = 88
DoB(D) = 75

}
}

85
75

85

So the value of the NdT = 85


And F is assigned a DoB = 85*90/100 = 76.5%

Example (inclusive OR)


IF
A
AND (B
OR
C)
AND D
THEN F CF = 90

DoB(A) = 95
DoB(B) = 85
DoB(C) = 88
DoB(D) = 75

88

75

So the value of the NdT = 75


And F is assigned a DoB = 75*90/100 = 67.5%

Secondary Crushing Plant

Feed Rate Fuzzy Control Rule-Set


Current Draw
HIGH

Current Draw
MEDIUM-HIGH

OR
Screen Bin Level
HIGH

Current Draw
OK

Current Draw
MEDIUM-LOW

Current Draw
LOW

AND

AND

AND

Screen Bin Level Screen Bin Level Screen Bin Level


OK
OK
OK

YES

OR

NO

YES

NO

YES

NO

Chamber Level
HIGH

Feed Rate
Change
NEGATIVE-BIG

Feed Rate
Change
NEGATIVE-SMALL

Feed Rate
Change
NO-CHANGE

Feed Rate
Change
POSITIVE-SMALL

Feed Rate
Change
POSITIVE-BIG

Feed Rate Change (discrete) =


Weighted Average of Fuzzy Set Supremums based on Respective Degrees of Belief

Rule-Base Matrix
Current Draw

Low

Screen Bin Level


Not-OK
OK

High

High
Medium-High

NB
NS

NB
NS

NB
NS

NB
NB

OK
Medium-Low

NC
PS

NC
PS

NS
NS

NB
NB

Low

PB

PB

NC

NB

NB = Negative-Big
PB = Positive-Big
NS = Negative-Small
PS = Positive Small
NC = No-Change

Fuzzy Sets (membership functions)


Degree of Belief

100
Low

0
40

Medium
Low

42

Medium

44

46

Medium
High

48

High

50

Current Draw (amps)


Degree of Belief

100
Low

Not-OK

OK

High

0
0

20

40

60

Bin Level (%)

80

100

Output Fuzzy Singletons


Negative
No
Positive
Small Change Small

Positive
Big

Degree of Belief

Negative
Big
100

0
-50

-10

+10

Feed Rate Change (tph)

+50

Controller Performance crisp sets


PB

SCREEN BIN LEVEL = LOW

Feed Rate Change


(tph)

CRISP SETS

PS
NC
NS

NB

Current Draw
LOW

MEDIUM MEDIUM MEDIUM


LOW
HIGH

HIGH

(amps)

Controller Performance fuzzy sets


PB

SCREEN BIN LEVEL = LOW

Feed Rate Change


(tph)

FUZZY SETS

PS
NC
NS

NB

Current Draw
LOW

MEDIUM MEDIUM MEDIUM


LOW
HIGH

HIGH (amps)

Using a Fuzzy Confidence Level

Normally C = 0, but it may be reasonable for C to be chosen


to exclude low belief information

Results Best Production

Results - Stability

How to Build a Fuzzy Controller


Begin by selecting a specific output
Fan Speed (for example)

Min = 0

Max = 100

Select at least three terms to characterize the


output variable (five is better)

Off
Low
Medium
High
Very High

Determine the minimum and maximum level of the


output variable (discrete value)

How to Build a Fuzzy Controller


Select two variables that would affect the level of
the output variable
Room Temperature
Relative Humidity

Min = 0

Max = 30

Min = 0

Max = 100

Select at least three terms to characterize these two


input variables (here we have 5)
Temperature

Cold
Cool
OK
Hot
Very Hot

Humidity
Low
Medium
Medium-High
High
Very High

How to Build a Fuzzy Controller


Formulate a set of rules to link each input
state combination to an output state
Relative
Humidity

Temperature (C)
Cold

Cool

OK

Hot

Very Hot

Off

Off

Low

Medium

High

Off

Off

Low

Medium

High

Medium

Off

Low

Medium

High

High

Medium-High

Off

Low

Medium

High

Very-High

High

Low

Medium

High

Very-High

Very-High

(%)

Low

Very-High

How to Build a Fuzzy Controller


Create Fuzzy Sets for Input Variables 1 & 2
Degree
of Belief

100

0
0

Cold

Cool

OK

Very
Hot

Hot

8 10 12 14 16 18 20 22 24 26 28 30
Temperature C

Degree
of Belief

100

0
0

Low

10

Medium

20

30

Medium
High

High

40
50
60
70
80
Relative Humidity (%)

Very
High

90

100

How to Build a Fuzzy Controller


Create Fuzzy Singletons for Output Variable
Off Low

Medium

Degree
of Belief

100

Very High

High

0
0

10

20

30

40
50
60
Fan Speed (%)

70

80

90

100

Temperature Sub-sets
Consider each fuzzy set as a trapezoid
100
Fuzzy
Subset i

DoB

Sub-set
Cold
Cool
OK
Hot
Very Hot

Ai Bi
Ci
Di
Universe of Discourse
A
0
0
14
20
25

B
0
14
20
26
30

C
0
14
20
26
30

D
14
20
25
30
30

Humidity Sub-sets
Consider each fuzzy set as a trapezoid
100
Fuzzy
Subset j

DoB

Sub-set
Low
Medium
Medium-High
High
Very-High

Aj Bj
Cj
Dj
Universe of Discourse
A
0
0
50
70
80

B
0
45
65
82
95

C
0
50
70
82
100

D
50
65
80
95
100

Membership (DoB) Equations


Generic equation for each set is as follows:
Let x = measured temperature (C)
DoB(Xi)left = Min(100, Max(0,100*(x - Ai)/(Bi - Ai)))
DoB(Xi)right = Min(100, Max(0,100*(Di - x)/(Di - Ci)))
DoB(Xi)final = Min(DoBleft, DoBright)

Let y = measured humidity (%)


DoB(Yj)left = Min(100, Max(0,100*(y - Aj)/(Bj - Aj)))
DoB(Yj)right = Min(100, Max(0,100*(Dj - y)/(Dj - Cj)))
DoB(Yj)final = Min(DoBleft, DoBright)

Example
x = 22 and y = 81
Temperature
DoB(Cold)
=0
DoB(Cool)
=0
DoB(OK)
= Min(Min(100, Max(0,100*(22 - 14)/(20 - 14))),
(Min(100, Max(0,100*(25 - 22)/(25 - 20))))
= Min(Min(100, 133), Min(100, 60))
= 60
DoB(Hot)
= Min(Min(100, Max(0,100*(22 - 20)/(26 - 20))),
(Min(100, Max(0,100*(26 - 22)/(26 - 20))))
= Min(Min(100, 33), Min(100, 66))
= 33
DoB(Very-Hot) = 0

Example
x = 22 and y = 81
Humidity
DoB(Low)
=0
DoB(Medium)
=0
DoB(Medium-High) = 0
DoB(High)
= Min(Min(100, Max(0,100*(81 - 70)/(82 - 70))),
(Min(100, Max(0,100*(95 - 81)/(95 - 82))))
= Min(Min(100, 92), Min(100, 108))
= 92
DoB(Very-High)
= Min(Min(100, Max(0,100*(81 - 80)/(95 - 80))),
(Min(100, Max(0,100*(100 - 81)/(100 - 100))))
= Min(Min(100, 7). Min(100, ))
=7

Pass the Input DoBs through the


Rules
Take the Minimum DoB and apply it to the
respective Output subset
Relative
Humidity

Temperature (C)

(%)

DoB

Low

Medium

Medium-High

High

92

Very-High

Cold

Cool

OK

Hot

Very Hot

60

33

60

33

Defuzzification
Supremum
DoB(medium)
DoB(high)
DoB(very-high)

= 60
= 7 or 33
= 7

40
70
100

Accumulation Method
Fan Speed = (60*40 + 7*70 + 33*70 + 7*100)/(60+7+33+7)
= (2400 + 490 + 2310 + 700)/107
= 5200/107 = 48.6
Maximum Method
Fan Speed = (60*40 + 33*70 + 7*100)/(60+33+7)
= (2400 + 2310 + 700)/100
= 5410/100 = 54.1

Adaptation
The system can be easily adapted to another variable by
one or more of the following:

Allow fuzzy sets to move along the Universe of Discourse


Change rule base
Change method of inferencing
Change method of defuzzification

In the previous example, if we feel cautious then the


accumulation method might be preferred whereas, if we
are prepared to take risks then the maximum method
could be used.

Questions ?

Potrebbero piacerti anche