Presentation is loading. Please wait.

Presentation is loading. Please wait.

Fuzzy Control Design of Embedded Systems

Similar presentations


Presentation on theme: "Fuzzy Control Design of Embedded Systems"— Presentation transcript:

1 Fuzzy Control Design of Embedded Systems
Using 68HC12/11 Microcontrollers Chapter 14 Richard E. Haskell, Prentice Hall, 2000

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 Fuzzy Sets Is this sentence true or false?

5 The Barber Paradox Sign on a Barber Shop:
“I shave all who do not shave themselves.” Who shaves the barber?

6

7

8

9

10

11 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

12

13 A Fuzzy Controller

14

15 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

16

17 The 68HC12 MEM Instruction

18

19 The 68HC12 MEM Instruction

20

21

22

23

24

25

26 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

27 Fuzzy Inference

28

29

30 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

31

32

33 The 68HC12 REV Instruction

34 Figure 14.19 68HC12 code for WHYP word
* Fire all rules * firerules ( in.out.array rules -- ) FIRERULES LDD 2,X D -> rules LDY 2,X Y -> in.out.array PSHX TFR D,X X -> rules INX INX X -> Out0 addr PSHY save Y LDY 2,X Y -> Out0, X -> 1st rule LDAB 0,Y B = #out.memb.fncs FR0 CLR 1,+Y clear Out array DBNE B, FR0 PULY Y -> in.out.array LDAA #$FF REV rule evaluation PULX RTS Figure HC12 code for WHYP word firerules ( in.out.array rules-- )

35

36 Listing 14.2 Fuzzy Control in WHYP -- Making rules
\ Fuzzy Logic Control Using WHYP12 File: FUZZY12.WHP \ ********** Defining word for making rules ********** : make.rules ( +++ ) CREATE HERE 0 , \ leave room for #rules 0 , \ leave room for ^Out0 DOES> ( pfa -- ) ; HEX : C: ( pfa ix -- pfa ) C, FE C, ; : C; ( pfa ix -- pfa ) C, FE C, 1 OVER +! ; \ inc #rules : C ( pfa ix -- pfa ) C, FF C , 1 OVER +! ; \ inc #rules DECIMAL : end.rules ( pfa -- ) DROP ; \ drop addr of #rules

37 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

38

39

40

41

42

43

44

45 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

46

47

48 The 68HC12 REV Instruction

49

50 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

51

52

53

54

55 This is WRONG : in.out.array ( -- addr ) ball_position 2+ @ ;
\ ****************************************************** \ Define output \ ****************************************************** 5 CONSTANT #out.member.fncs \ No. of output membership functions CREATE cent \ output centroid array 5 C, 65 C, 128 C, 175 C, 200 C, \ |neg_high|neg_low|zero_m|pos_low|pos_high| 10 CONSTANT Out0 \ Power percent change to motor 11 CONSTANT neg_high 12 CONSTANT neg_low 13 CONSTANT zero_m 14 CONSTANT pos_low 15 CONSTANT pos_high \ 2- VALLOT \ input 1 weight array \ VALLOT \ input 1 weight array \ #out.member.fncs 1+ VALLOT \ controller output weights : in.out.array ( -- addr ) ball_position ;

56 The 68HC12 REV Instruction

57

58

59

60


Download ppt "Fuzzy Control Design of Embedded Systems"

Similar presentations


Ads by Google