36 lines
661 B
Plaintext
36 lines
661 B
Plaintext
|
FUNCTION_BLOCK ocena
|
||
|
|
||
|
VAR_INPUT
|
||
|
glosy : REAL;
|
||
|
END_VAR
|
||
|
|
||
|
VAR_OUTPUT
|
||
|
ocena : REAL;
|
||
|
END_VAR
|
||
|
|
||
|
FUZZIFY glosy
|
||
|
TERM malo := (1000,1) (2500,0);
|
||
|
TERM srednio := (2000, 0) (3500, 1) (4500,1) (6000,0) ;
|
||
|
TERM duzo := (5500, 0) (6500,1);
|
||
|
END_FUZZIFY
|
||
|
|
||
|
DEFUZZIFY ocena
|
||
|
TERM slaby := (5,1) (11,0);
|
||
|
TERM srednia := (9,0) (15,1) (21,0);
|
||
|
TERM dobry := (19,0) (25,1);
|
||
|
METHOD : COG;
|
||
|
DEFAULT := 0;
|
||
|
END_DEFUZZIFY
|
||
|
|
||
|
RULEBLOCK No1
|
||
|
AND : MIN;
|
||
|
ACT : MIN;
|
||
|
ACCU : MAX;
|
||
|
RULE 7 : IF glosy IS duzo THEN ocena IS dobry;
|
||
|
RULE 8 : IF glosy IS srednio THEN ocena IS srednia;
|
||
|
RULE 9 : IF glosy IS malo THEN ocena IS slaby;
|
||
|
END_RULEBLOCK
|
||
|
|
||
|
END_FUNCTION_BLOCK
|
||
|
|