diff --git a/ocena-v1.fcl b/ocena-v1.fcl new file mode 100644 index 0000000..d673711 --- /dev/null +++ b/ocena-v1.fcl @@ -0,0 +1,63 @@ +FUNCTION_BLOCK ocena + +VAR_INPUT + goals : REAL; + xGPerMatch: REAL; + shotsPerMatch: REAL; + onTargetPerMatch: REAL; +END_VAR + +VAR_OUTPUT + ocena : REAL; +END_VAR + +FUZZIFY goals // Zmienna 'goals': {'malo', 'srednio' , 'duzo'} + TERM malo := (0, 1) (10, 1) (15, 0); + TERM sredno := (10, 0) (15, 1) (20, 0); + TERM duzo := (15, 0) (20, 1) (35, 1); +END_FUZZIFY + +FUZZIFY xGPerMatch // Zmienna 'xGPerMatch': {'malo', 'srednio' , 'duzo'} + TERM malo := (0, 1) (0.2, 1) (0.5, 0); + TERM sredno := (0.2, 0) (0.5, 1) (0.7, 1) (1, 0); + TERM duzo := (0.75, 0) (1, 1) (2, 1); +END_FUZZIFY + +FUZZIFY shotsPerMatch // Zmienna 'shotsPerMatch': {'malo', 'srednio' , 'duzo'} + TERM malo := (0, 1) (1, 1) (2, 0); + TERM sredno := (1, 0) (2, 1) (3, 1) (4, 0); + TERM duzo := (3, 0) (4, 1) (4.5, 1) (10, 1); +END_FUZZIFY + +FUZZIFY onTargetPerMatch // Zmienna 'onTargetPerMatch': {'malo', 'srednio' , 'duzo'} + TERM malo := (0, 1) (0.25, 1) (0.75, 0); + TERM sredno := (0.25, 0) (0.5, 1) (1, 1) (1.25, 0); + TERM duzo := (1.25, 0) (1.5, 1) (2, 1) (3.5, 1); +END_FUZZIFY + +DEFUZZIFY ocena // Zmienna 'ocena' : {'niska', 'srednia', 'wysoka'} + TERM niska := (0, 1) (40, 1) (50, 0); + TERM srednia := (40, 0) (50, 1) (60, 1) (80, 0); + TERM wysoka := (70, 0) (80, 1) (100, 1); + METHOD : COG; // Metoda defuzyfikacji - 'Center Of Gravity' - 'Sreodka ciezkosci' + DEFAULT := 0; +END_DEFUZZIFY + +RULEBLOCK No1 + AND : MIN; // Uzycie 'min' jako 'and' (implikuje uzycie 'max' jako 'or' dla zapewnienia praw DeMorgan'a) + ACT : MIN; // Uzycie 'min' jako metody aktywacji + ACCU : MAX; // Metoda agregacji - 'max' + + RULE 1 : IF goals IS duzo THEN ocena IS wysoka; + RULE 2 : IF xGPerMatch IS duzo THEN ocena IS wysoka; + RULE 3 : IF onTargetPerMatch IS duzo THEN ocena IS wysoka; + RULE 4 : IF onTargetPerMatch IS sredno AND goals IS sredno THEN ocena IS srednia; + RULE 5 : IF xGPerMatch IS duzo AND goals IS sredno THEN ocena IS srednia; + RULE 6 : IF onTargetPerMatch IS duzo AND goals IS malo THEN ocena IS srednia; + RULE 7 : IF shotsPerMatch IS duzo AND onTargetPerMatch IS malo THEN ocena IS niska; + RULE 8 : IF xGPerMatch IS duzo AND goals IS sredno THEN ocena IS niska; + RULE 9 : IF goals IS malo THEN ocena IS niska; +END_RULEBLOCK + +END_FUNCTION_BLOCK +