- By
**neona** - Follow User

- 160 Views
- Uploaded on

Download Presentation
## PowerPoint Slideshow about 'APSC 150 Engineering Case Studies Case Study 3' - neona

**An Image/Link below is provided (as is) to download presentation**

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript

### APSC 150Engineering Case StudiesCase 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 nail.

- Lotfi Zadeh, University of California, Berkeley

The Father of Fuzzy Logic

- 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

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 a true statement and it never can be a false statement.

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 Liar’s 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." 50–100

"This sentence is rarely false." 0–50

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 5 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 person’s 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.

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

NdT

Example

}

}

IF “A” DoB(A) = 95

AND “B” DoB(B) = 85

OR “C” DoB(C) = 88

AND “D” DoB(D) = 75

THEN “F” CF = 90

85

85

}

75

So the value of the NdT = 85

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

Example (inclusive OR)

}

IF “A” DoB(A) = 95

AND (“B” DoB(B) = 85

OR “C”) DoB(C) = 88

AND “D” DoB(D) = 75

THEN “F” CF = 90

}

75

88

So the value of the NdT = 75

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

YES

YES

YES

NO

NO

NO

Feed Rate Fuzzy Control Rule-SetCurrent Draw

HIGH

Current Draw

MEDIUM-HIGH

Current Draw

OK

Current Draw

MEDIUM-LOW

Current Draw

LOW

OR

AND

AND

AND

Screen Bin Level

HIGH

Screen Bin Level

OK

Screen Bin Level

OK

Screen Bin Level

OK

OR

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

NB = Negative-Big PB = Positive-Big

NS = Negative-Small PS = Positive Small

NC = No-Change

Fuzzy Sets (membership functions)

100

0

Low

Medium

Low

Medium

Medium

High

High

Degree of Belief

40 42 44 46 48 50

Current Draw (amps)

100

0

Not-OK

Low

OK

High

Degree of Belief

0 20 40 60 80 100

Bin Level (%)

Output Fuzzy Singletons

Negative

Big

Negative

Small

No

Change

Positive

Small

Positive

Big

100

0

Degree of Belief

-50 -10 0 +10 +50

Feed Rate Change (tph)

Controller Performance – crisp sets

PB

PS

NC

NS

NB

SCREEN BIN LEVEL = LOW

CRISP SETS

Current Draw

(amps)

Feed Rate Change

(tph)

LOW MEDIUM MEDIUM MEDIUM HIGH

LOW HIGH

Controller Performance – fuzzy sets

PB

PS

NC

NS

NB

SCREEN BIN LEVEL = LOW

FUZZY SETS

Current Draw

(amps)

Feed Rate Change

(tph)

LOW MEDIUM MEDIUM MEDIUM HIGH

LOW HIGH

Using a Fuzzy Confidence Level

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

to exclude low belief information

How to Build a Fuzzy Controller

- Begin by selecting a specific output
- Fan Speed (for example)
- 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)

Min = 0 Max = 100

How to Build a Fuzzy Controller

- Select two variables that would affect the level of the output variable
- Room Temperature
- Relative Humidity
- Select at least three terms to characterize these two input variables (here we have 5)
- Temperature
- Cold
- Cool
- OK
- Hot
- Very Hot

Min = 0 Max = 30

Min = 0 Max = 100

- 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

Off

Off

Low

Medium

High

Off

Off

Low

Medium

High

Off

Low

High

High

Medium

Off

Low

Medium

Very-High

High

Low

High

Very-High

Very-High

Medium

How to Build a Fuzzy Controller

- Create Fuzzy Sets for Input Variables 1 & 2

100

0

Very

Hot

Cold

Cool

OK

Hot

Degree

of Belief

0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30

Temperature °C

100

0

Very

High

Degree

of Belief

Low

Medium

Medium

High

High

0 10 20 30 40 50 60 70 80 90 100

Relative Humidity (%)

How to Build a Fuzzy Controller

- Create Fuzzy Singletons for Output Variable

Very High

Low

Medium

High

Off

100

0

Degree

of Belief

0 10 20 30 40 50 60 70 80 90 100

Fan Speed (%)

100

0

DoB

Ai Bi Ci Di

Universe of Discourse

Temperature Sub-sets- Consider each fuzzy set as a trapezoid

Fuzzy

Subset i

Sub-set A B C D

Cold 0 0 0 14

Cool 0 14 14 20

OK 14 20 20 25

Hot 20 26 26 30

Very Hot 25 30 30 30

100

0

DoB

Aj Bj Cj Dj

Universe of Discourse

Humidity Sub-sets- Consider each fuzzy set as a trapezoid

Fuzzy

Subset j

Sub-set A B C D

Low 0 0 0 50

Medium 0 45 50 65

Medium-High 50 65 70 80

High 70 82 82 95

Very-High 80 95 100 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

60

33

7

7

Defuzzification

Supremum

DoB(medium) = 60 40

DoB(high) = 7 or 33 70

DoB(very-high) = 7 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.

Download Presentation

Connecting to Server..