Top Banner
Fuzzy Control
39

Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.

Dec 21, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.

Fuzzy Control

Page 2: Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.

Fuzzy Control

• Fuzzy Sets

• Design of a Fuzzy Controller– Fuzzification of inputs: get_inputs()– Fuzzy Inference– Processing the Rules: find_rules()– Centroid Defuzzification– Output Defuzzification: find_output()– A Fuzzy Control Example --

• Floating Ping-Pong Ball

Page 3: Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.

" So far as the laws of mathematics refer to reality, they are not certain,

And so far as they are certain, they do not refer to reality."

Albert EinsteinGeometrie und Erfahrung

Fuzzy Logic

Page 4: Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.

Fuzzy Sets

The sentence on the other sideof the line is false

The sentence on the other sideof the line is false

Is this sentence true or false?

Page 5: Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.

Agea1 a2

Young1

0

F igu re 14 .2 M em bersh ip func tion fo r the fuzzy se t Young

Page 6: Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.
Page 7: Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.
Page 8: Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.
Page 9: Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.

Probabiltiy vs. Fuzziness

Probability describes the uncertainty of an event occurrence.

Fuzziness describes event ambiguity.

Whether an event occurs is RANDOM.

To what degree it occurs is FUZZY.

Page 10: Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.

Probability:There is a 50% chance of an applebeing in the refrigerator.

Fuzzy:There is a half an apple in therefrigerator.

Page 11: Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.

Fuzzy logic acknowledges and exploits the tolerance for uncertainty and imprecision.

Page 12: Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.

Fuzzy Control

• Fuzzy Sets

• Design of a Fuzzy Controller– Fuzzification of inputs: get_inputs()– Fuzzy Inference– Processing the Rules: find_rules()– Centroid Defuzzification– Output Defuzzification: find_output()– A Fuzzy Control Example --

• Floating Ping-Pong Ball

Page 13: Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.
Page 14: Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.

INPUTS

OUTPUT

Map to Fuzzy Sets

FUZZY RULES

If A AND B then L

• • •

Defuzzification

get_inputs();

fire_rules();

find_output();

A Fuzzy Controller

Page 15: Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.
Page 16: Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.

Fuzzy Control

• Fuzzy Sets

• Design of a Fuzzy Controller– Fuzzification of inputs: get_inputs()– Fuzzy Inference– Processing the Rules: find_rules()– Centroid Defuzzification– Output Defuzzification: find_output()– A Fuzzy Control Example --

• Floating Ping-Pong Ball

Page 17: Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.
Page 18: Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.
Page 19: Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.
Page 20: Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.

Fuzzy Control

• Fuzzy Sets

• Design of a Fuzzy Controller– Fuzzification of inputs: get_inputs()– Fuzzy Inference– Processing the Rules: find_rules()– Centroid Defuzzification– Output Defuzzification: find_output()– A Fuzzy Control Example --

• Floating Ping-Pong Ball

Page 21: Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.

Fuzzy Inference

if x1 is A1 and x2 is B1 then y is L1 rule 1

if x1 is A2 and x2 is B2 then y is L2 rule 2

Given the fact that

x1 is A' and x2 is B' fact

the problem is to find the conclusion

y is L' conclusion

Page 22: Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.
Page 23: Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.

Fuzzy Control

• Fuzzy Sets

• Design of a Fuzzy Controller– Fuzzification of inputs: get_inputs()– Fuzzy Inference– Processing the Rules: find_rules()– Centroid Defuzzification– Output Defuzzification: find_output()– A Fuzzy Control Example --

• Floating Ping-Pong Ball

Page 24: Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.
Page 25: Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.
Page 26: Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.

Rules

Page 27: Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.

Fuzzy Control

• Fuzzy Sets

• Design of a Fuzzy Controller– Fuzzification of inputs: get_inputs()– Fuzzy Inference– Processing the Rules: find_rules()– Centroid Defuzzification– Output Defuzzification: find_output()– A Fuzzy Control Example --

• Floating Ping-Pong Ball

Page 28: Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.
Page 29: Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.

14.2.4 Centroid Defuzzification

The last step in the fuzzy controller shown in Figure 14.7 is defuzzification. Thisinvolves finding the centroid of the net output fuzzy set L' shown in Figures 14.15 and14.16. Although we have used the MIN-MAX rule in the previous section we will beginby deriving the centroid equation for the sum rule shown in Figure 14.16. This willilluminate the assumptions made in deriving the defuzzification equation that we willactually use in the fuzzy controller.

Let Li(y) be the original output membership function associated with rule i where yis the output universe of discourse (see Figure 14.15.). After applying rule i thismembership function will be reduced to the value

mi(y) = wiLi(y) (14.1)

where wi is the minimum weight found by applying rule i. The sum of these reducedoutput membership functions over all rules is then given by

M(y) = i=1

Nmi(y) (14.2)

where N is the number of rules.

Page 30: Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.

The crisp output value y0 is then given by the centroid of M(y) from the equation

y0 = yM(y)dy

M(y)dy (14.3)

Note that the centroid of membership function Li(y) is given by

ci = yLi(y)dy

Li(y)dy (14.4)

But

Ii = Li(y)dy (14.5)

is just the area of membership function Li(y). Substituting (14.5) into (14.4) we can write

yLi(y)dy = ciIi (14.6)

Page 31: Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.

Using Eqs. (14.1) and (14.2) we can write the numerator of (14.3) as

yM(y)dy = y

i=1

NwiLi(y) dy

= i=1

N

ywiLi(y) dy

= i=1

N wiciIi (14.7)

where (14.6) was used in the last step.

Page 32: Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.

Similarly, using (14.1) and (14.2) the denominator of (14.3) can be written as

M(y)dy =

i=1

NwiLi(y) dy

= i=1

N

wiLi(y) dy

= i=1

N wiIi (14.8)

where (14.5) was used in the last step. Substituting (14.7) and (14.8) into (14.3) we canwrite the crisp output of the fuzzy controller as

y0 =

i=1

N wiciIi

i=1

N wiIi

(14.9)

Eq. (14.9) says that we can compute the output centroid from the centroids, ci, of theindividual output membership functions.

Page 33: Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.

Note in Eq. (14.9) the summation is over all N rules. But the number of outputmembership functions, Q, will, in general, be less than the number of rules, N. This meansthat in the sums in Eq. (14.9) there will be many terms that will have the same values of ciand Ii. For example, suppose that rules 2, 3, and 4 in the sum all have the outputmembership function Lk as the consequent. This means that in the sum

w2c2I2 + w3c3I3 + w4c4I4

the values ci and Ii are the same values ck and Ik because they are just the centroid andarea of the kth output membership function. These three terms would then contribute thevalue

(w2 + w3 + w4)ckIk = WkckIk

to the sum, where

Wk = (w2 + w3 + w4)

is the sum of all weights from rules whose consequent is output membership function Lk.

Page 34: Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.

This means that the equation for the output value, y0, given by (14.9) can be rewritten as

y0 =

k=1

Q

WkckIk

k=1

Q

WkIk

(14.10)

If the area of all output membership functions, Ik are equal, then Eq. (14.10) reduces to

y0 =

k=1

Q

Wkck

k=1

Q

Wk

(14.11)

Eqs. (14.10) and (14.11) show that the output crisp value of a fuzzy controller can becomputed by summing over only the number of output membership functions rather thanover all fuzzy rules. Also, if we use Eq. (14.11) to compute the output crisp value, thenwe need to specify only the centroids, ck, of the output fuzzy membership functions. Thisis equivalent to assuming singleton fuzzy sets for the output.

We will always use singleton fuzzy sets for the output represented by thecentroids, ck. We will also use the MIN-MAX inference rule described in the previoussection. It should be clear from Figure 14.16 that in this case the centroid y0 will still begiven by Eq. (14.11) where Wk is now the output array, Out(k), shown in Figure 14.18and computed by the word firerules given in Figure 14.19.

Page 35: Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.

Fuzzy Control

• Fuzzy Sets

• Design of a Fuzzy Controller– Fuzzification of inputs: get_inputs()– Fuzzy Inference– Processing the Rules: find_rules()– Centroid Defuzzification– Output Defuzzification: find_output()– A Fuzzy Control Example --

• Floating Ping-Pong Ball

Page 36: Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.
Page 37: Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.

Fuzzy Control

• Fuzzy Sets

• Design of a Fuzzy Controller– Fuzzification of inputs: get_inputs()– Fuzzy Inference– Processing the Rules: find_rules()– Centroid Defuzzification– Output Defuzzification: find_output()– A Fuzzy Control Example --

• Floating Ping-Pong Ball

Page 38: Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.

68HC12JStamp…

Page 39: Fuzzy Control. Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the Rules: find_rules() –Centroid.

Fuzzy k-map for floating ping-pong ball