fuzzy control. fuzzy sets design of a fuzzy controller –fuzzification of inputs: get_inputs()...

39
Fuzzy Control

Post on 21-Dec-2015

246 views

Category:

Documents


3 download

TRANSCRIPT

Fuzzy Control

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

" 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

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?

Agea1 a2

Young1

0

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

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.

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

Fuzzy:There is a half an apple in therefrigerator.

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

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

INPUTS

OUTPUT

Map to Fuzzy Sets

FUZZY RULES

If A AND B then L

• • •

Defuzzification

get_inputs();

fire_rules();

find_output();

A Fuzzy Controller

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

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

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

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

Rules

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

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.

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)

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.

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.

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.

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.

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

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

68HC12JStamp…

Fuzzy k-map for floating ping-pong ball