36 lines
651 B
Plaintext
36 lines
651 B
Plaintext
|
FUNCTION_BLOCK ocena
|
||
|
|
||
|
VAR_INPUT
|
||
|
rok : REAL;
|
||
|
END_VAR
|
||
|
|
||
|
VAR_OUTPUT
|
||
|
ocena : REAL;
|
||
|
END_VAR
|
||
|
|
||
|
FUZZIFY rok
|
||
|
TERM stary := (1990, 1) (1997,0);
|
||
|
TERM sredni := (1995, 0) (2000, 1) (2005,1) (2010,0) ;
|
||
|
TERM nowy := (2007,0) (2015,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 4 : IF rok IS nowy THEN ocena IS slaby;
|
||
|
RULE 5 : IF rok IS sredni THEN ocena IS srednia;
|
||
|
RULE 6 : IF rok IS stary THEN ocena IS dobry;
|
||
|
END_RULEBLOCK
|
||
|
|
||
|
END_FUNCTION_BLOCK
|
||
|
|