Presentation is loading. Please wait.

Presentation is loading. Please wait.

Fuzzy Control Lecture 6.1. Fuzzy Control Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the.

Similar presentations


Presentation on theme: "Fuzzy Control Lecture 6.1. Fuzzy Control Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the."— Presentation transcript:

1 Fuzzy Control Lecture 6.1

2 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

3 Fuzzy Logic

4 Normal “Crisp” logic where everything must be either True or False leads to PARADOXES

5 The sentence on the other side of the line is false The sentence on the other side of the line is false

6 A barber has a sign that reads: “I shave everyone who does not shave himself” Who shaves the barber?

7 Fuzzy Logic Lotfi Zadeh - Fuzzy Sets - 1965 Membership functions –Degree of membership between 0 and 1 Fuzzy logic operations on fuzzy sets A and B –NOT A => 1 - A –A AND B => MIN(A,B) –A OR B => MAX (A,B)

8 Membership Functions Young Age Not Young

9 Membership Functions Old Age Not Old

10 Membership Functions Age Not Old Not Young Middle Age = Not Old AND Not Young

11 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.

12 Probability: There is a 50% chance of an apple being in the refrigerator. Fuzzy: There is a half an apple in the refrigerator.

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

14 Fuzzy Control Map to Fuzzy Sets Fuzzy Rules IF A AND B THEN L * * Defuzzification Inputs Output get_inputs(); fire_rules(); find_output();

15 Algorithm for a fuzzy controller do_forever { get_inputs(); fire_rules(); find_output(); }

16 get_inputs(); Given inputs x1 and x2, find the weight values associated with each input membership function. ZNMNSPSPM X1 0.2 0.7 W = [0, 0, 0.2, 0.7, 0]

17 Fuzzy Inference fire_rules(); find_output(); Rule 1: If x1 is A1 and x2 is B1 then y is L1 Rule 2: If x1 is A2 and x2 is B2 then y is L2 Given: x1 is a and x2 is b What is y?

18 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

19

20 A Fuzzy Controller

21

22 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

23

24 The 68HC12 MEM Instruction

25

26

27

28 Neg_med003672 Neg_small4882100116 Zero104128128152 Pos_small140156174208 Pos_med184220255255

29

30

31 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

32 Fuzzy Inference

33

34

35 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

36

37

38 The 68HC12 REV Instruction

39

40

41 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

42

43

44

45

46

47

48

49 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

50

51

52

53 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

54

55 ;Fuzzy Control ;Data Structures ball_positionrmb24 ball_speedrmb24 in_out_arrayrmb16 rulesrmb129 centrmb5 5 65 128 175 200 cent

56 ;Main program fuzzy ;get_inputs() ;JSRget_position;position in D STD2,-X;push on data stack LDD#ball_position;D -> ball_position STD2,-X;push on data stack JSRFILLWT;fill.weights ;JSRget_speed;speed in D STD2,-X;push on data stack LDD#ball_speed;D -> ball_speed STD2,-X;push on data stack JSRFILLWT;fill.weights ;fire_rules() LDD#in_out_array;D -> in_out_array STD2,-X;push on data stack LDD#rules;D -> rules STD2,-X;push on data stack JSRFIRERULES;fire rules ;find_output() LDD#rules;D -> rules STD2,-X;push on data stack LDD#cent;D -> cent STD2,-X;push on data stack JSRFINDOUT;find output BRAfuzzy

57 ; Fill Weight Arrays ; fill.weights ( xi memfunc_addr -- ) FILLWT LDY 2,X+ ;Y -> input membership functions LDD 2,X+ ;B = xi PSHX ;save X TFR Y,X ;X -> membership functions LDY 2,X ;Y -> input weight table PSHB ;save xi LDD 4,X+ ;B = #mem functs; X->1st memb fnc PULA ;A = xi FW1 MEM ;fuzzy membership grade DBNE B,FW1 PULX ;restore X RTS

58 ; Fire all rules ; firerules ( in.out_addr rules_addr -- ) FIRERULES LDD 2,X+ ;D -> rules LDY 2,X+ ;Y -> in.out.array PSHX TFR D,X ;X -> rules INX INX ;X -> Wout addr PSHY ;save Y LDY 2,X+ ;Y -> Wout, X -> 1st rule LDAB 0,Y ;B = #out.memb.fncs FR0 CLR 1,X+ ;clear W array DBNE B, FR0 PULY ;Y -> in.out.array LDAA #$FF REV ;rule evaluation PULX RTS

59 ; Find Output value ; calc.output ( rules cent_addr -- output_value ) FINDOUT LDD 2,X+ ;D -> cent LDY 2,X+ ;Y -> rules PSHX TFR D,X ;X -> cent array LDY 2,Y ;Y -> Warray LDAB 0,Y ;B = #out.memb.fncs INY ;Y -> W array WAV EDIV ;Y = quotient TFR Y,D ;D = quotient A = 0, B = output PULX STD 2,-X RTS


Download ppt "Fuzzy Control Lecture 6.1. Fuzzy Control Fuzzy Sets Design of a Fuzzy Controller –Fuzzification of inputs: get_inputs() –Fuzzy Inference –Processing the."

Similar presentations


Ads by Google