38 lines
670 B
Plaintext
38 lines
670 B
Plaintext
FUNCTION_BLOCK ocena_dlugosc
|
|
|
|
VAR_INPUT
|
|
dlugosc: REAL;
|
|
END_VAR
|
|
|
|
VAR_OUTPUT
|
|
ocena : REAL;
|
|
END_VAR
|
|
|
|
FUZZIFY dlugosc
|
|
TERM krotki := (40, 1) (80,0);
|
|
TERM sredni := (60, 0) (90, 1) (120,1) (150,0);
|
|
TERM dlugi := (130, 0) (170,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 1 : IF dlugosc is dlugi THEN ocena IS dobry;
|
|
RULE 2 : IF dlugosc is sredni THEN ocena IS srednia;
|
|
RULE 3 : IF dlugosc IS krotki THEN ocena IS slaby;
|
|
|
|
END_RULEBLOCK
|
|
|
|
END_FUNCTION_BLOCK
|
|
|