Reguły FCL
This commit is contained in:
parent
dad3542862
commit
d69befad1e
@ -1,171 +1,108 @@
|
||||
FUNCTION_BLOCK prediction // Definicja bloku (moze byc wiecej blokow w pliku)
|
||||
FUNCTION_BLOCK prediction
|
||||
|
||||
VAR_INPUT // Definiuje zmienne wejsciowe
|
||||
goalkeeperForm1 : REAL;
|
||||
formationAgainstForm1 : REAL;
|
||||
shootsOnTargetAverage1 : REAL;
|
||||
possessionAverage1 : REAL;
|
||||
goalsAverage1 : REAL;
|
||||
goalsLostAverage1 : REAL;
|
||||
redCardsAverage1 : REAL;
|
||||
penaltyAreaEntriesAverage1 : REAL;
|
||||
penaltiesAverage1 : REAL;
|
||||
lastMatchesResultAverage1 : REAL;
|
||||
lastMatchesResultBetweenAverage1 : REAL;
|
||||
|
||||
goalkeeperForm2 : REAL;
|
||||
formationAgainstForm2 : REAL;
|
||||
shootsOnTargetAverage2 : REAL;
|
||||
possessionAverage2 : REAL;
|
||||
goalsAverage2 : REAL;
|
||||
goalsLostAverage2 : REAL;
|
||||
redCardsAverage2 : REAL;
|
||||
penaltyAreaEntriesAverage2 : REAL;
|
||||
penaltiesAverage2 : REAL;
|
||||
lastMatchesResultAverage2 : REAL;
|
||||
lastMatchesResultBetweenAverage2 : REAL;
|
||||
VAR_INPUT
|
||||
goalkeeperForm: REAL;
|
||||
formationAgainstForm: REAL;
|
||||
shootsOnTargetAverage: REAL;
|
||||
possessionAverage: REAL;
|
||||
goalsAverage: REAL;
|
||||
goalsLostAverage: REAL;
|
||||
redCardsAverage: REAL;
|
||||
penaltyAreaEntriesAverage: REAL;
|
||||
penaltiesAverage: REAL;
|
||||
lastMatchesResultAverage: REAL;
|
||||
lastMatchesResultBetweenAverage: REAL;
|
||||
END_VAR
|
||||
|
||||
VAR_OUTPUT // Definiuje zmienne wyjsciowe
|
||||
VAR_OUTPUT
|
||||
prediction : REAL;
|
||||
END_VAR
|
||||
|
||||
FUZZIFY goalkeeperForm1
|
||||
TERM zla := (0, 1) (4, 0) ;
|
||||
TERM dobra := (1, 0) (4,1) (6,1) (9,0);
|
||||
TERM znakomita := (6, 0) (9, 1);
|
||||
END_FUZZIFY
|
||||
FUZZIFY goalkeeperForm2
|
||||
TERM zla := (0, 1) (4, 0) ;
|
||||
TERM dobra := (1, 0) (4,1) (6,1) (9,0);
|
||||
TERM znakomita := (6, 0) (9, 1);
|
||||
FUZZIFY goalkeeperForm
|
||||
TERM zla := (50, 1) (70, 0);
|
||||
TERM dobra := (70, 0) (80,1) (90,0);
|
||||
TERM znakomita := (90, 0) (100, 1);
|
||||
END_FUZZIFY
|
||||
|
||||
FUZZIFY formationAgainstForm1
|
||||
TERM zla := (0, 1) (4, 0) ;
|
||||
TERM dobra := (1, 0) (4,1) (6,1) (9,0);
|
||||
TERM znakomita := (6, 0) (9, 1);
|
||||
END_FUZZIFY
|
||||
FUZZIFY formationAgainstForm2
|
||||
TERM zla := (0, 1) (4, 0) ;
|
||||
TERM dobra := (1, 0) (4,1) (6,1) (9,0);
|
||||
TERM znakomita := (6, 0) (9, 1);
|
||||
FUZZIFY formationAgainstForm
|
||||
TERM zla := (30, 1) (40, 0);
|
||||
TERM przecietna := (35, 0) (50,1) (70,0);
|
||||
TERM dobra := (70, 0) (100, 1);
|
||||
END_FUZZIFY
|
||||
|
||||
FUZZIFY shootsOnTargetAverage1
|
||||
TERM zla := (0, 1) (4, 0) ;
|
||||
TERM dobra := (1, 0) (4,1) (6,1) (9,0);
|
||||
TERM znakomita := (6, 0) (9, 1);
|
||||
END_FUZZIFY
|
||||
FUZZIFY shootsOnTargetAverage2
|
||||
TERM zla := (0, 1) (4, 0) ;
|
||||
TERM dobra := (1, 0) (4,1) (6,1) (9,0);
|
||||
TERM znakomita := (6, 0) (9, 1);
|
||||
FUZZIFY shootsOnTargetAverage
|
||||
TERM malo := (2, 1) (4, 0);
|
||||
TERM przecietnie := (3, 0) (5,1) (7,0);
|
||||
TERM duzo := (7, 0) (10, 1);
|
||||
END_FUZZIFY
|
||||
|
||||
FUZZIFY possessionAverage1
|
||||
TERM zla := (0, 1) (4, 0) ;
|
||||
TERM dobra := (1, 0) (4,1) (6,1) (9,0);
|
||||
TERM znakomita := (6, 0) (9, 1);
|
||||
END_FUZZIFY
|
||||
FUZZIFY possessionAverage2
|
||||
TERM zla := (0, 1) (4, 0) ;
|
||||
TERM dobra := (1, 0) (4,1) (6,1) (9,0);
|
||||
TERM znakomita := (6, 0) (9, 1);
|
||||
FUZZIFY possessionAverage
|
||||
TERM malo := (30, 1) (40, 0);
|
||||
TERM przecietnie := (40, 0) (50,1) (60,0);
|
||||
TERM duzo := (60, 0) (100, 1);
|
||||
END_FUZZIFY
|
||||
|
||||
FUZZIFY goalsAverage1
|
||||
TERM zla := (0, 1) (4, 0) ;
|
||||
TERM dobra := (1, 0) (4,1) (6,1) (9,0);
|
||||
TERM znakomita := (6, 0) (9, 1);
|
||||
END_FUZZIFY
|
||||
FUZZIFY goalsAverage2
|
||||
TERM zla := (0, 1) (4, 0) ;
|
||||
TERM dobra := (1, 0) (4,1) (6,1) (9,0);
|
||||
TERM znakomita := (6, 0) (9, 1);
|
||||
FUZZIFY goalsAverage
|
||||
TERM malo := (0, 1) (1, 0);
|
||||
TERM przecietnie := (1, 0) (1.5,1) (2,0);
|
||||
TERM duzo := (2, 0) (3, 1);
|
||||
END_FUZZIFY
|
||||
|
||||
FUZZIFY goalsLostAverage1
|
||||
TERM zla := (0, 1) (4, 0) ;
|
||||
TERM dobra := (1, 0) (4,1) (6,1) (9,0);
|
||||
TERM znakomita := (6, 0) (9, 1);
|
||||
END_FUZZIFY
|
||||
FUZZIFY goalsLostAverage2
|
||||
TERM zla := (0, 1) (4, 0) ;
|
||||
TERM dobra := (1, 0) (4,1) (6,1) (9,0);
|
||||
TERM znakomita := (6, 0) (9, 1);
|
||||
FUZZIFY goalsLostAverage
|
||||
TERM malo := (0, 1) (1, 0);
|
||||
TERM przecietnie := (1, 0) (1.5,1) (2,0);
|
||||
TERM duzo := (2, 0) (3, 1);
|
||||
END_FUZZIFY
|
||||
|
||||
FUZZIFY redCardsAverage1
|
||||
TERM zla := (0, 1) (4, 0) ;
|
||||
TERM dobra := (1, 0) (4,1) (6,1) (9,0);
|
||||
TERM znakomita := (6, 0) (9, 1);
|
||||
END_FUZZIFY
|
||||
FUZZIFY redCardsAverage2
|
||||
TERM zla := (0, 1) (4, 0) ;
|
||||
TERM dobra := (1, 0) (4,1) (6,1) (9,0);
|
||||
TERM znakomita := (6, 0) (9, 1);
|
||||
FUZZIFY redCardsAverage
|
||||
TERM malo := (0, 1) (0.1, 0);
|
||||
TERM przecietnie := (0.1, 0) (0.2,1) (0.3,0);
|
||||
TERM duzo := (0.3, 0) (0.4, 1);
|
||||
END_FUZZIFY
|
||||
|
||||
FUZZIFY penaltyAreaEntriesAverage1
|
||||
TERM zla := (0, 1) (4, 0) ;
|
||||
TERM dobra := (1, 0) (4,1) (6,1) (9,0);
|
||||
TERM znakomita := (6, 0) (9, 1);
|
||||
END_FUZZIFY
|
||||
FUZZIFY penaltyAreaEntriesAverage2
|
||||
TERM zla := (0, 1) (4, 0) ;
|
||||
TERM dobra := (1, 0) (4,1) (6,1) (9,0);
|
||||
TERM znakomita := (6, 0) (9, 1);
|
||||
FUZZIFY penaltyAreaEntriesAverage
|
||||
TERM rzadko := (0, 1) (5, 0);
|
||||
TERM przecietnie := (5, 0) (9,1) (13,0);
|
||||
TERM czesto := (13, 0) (20, 1);
|
||||
END_FUZZIFY
|
||||
|
||||
FUZZIFY penaltiesAverage1
|
||||
TERM zla := (0, 1) (4, 0) ;
|
||||
TERM dobra := (1, 0) (4,1) (6,1) (9,0);
|
||||
TERM znakomita := (6, 0) (9, 1);
|
||||
END_FUZZIFY
|
||||
FUZZIFY penaltiesAverage2
|
||||
TERM zla := (0, 1) (4, 0) ;
|
||||
TERM dobra := (1, 0) (4,1) (6,1) (9,0);
|
||||
TERM znakomita := (6, 0) (9, 1);
|
||||
FUZZIFY penaltiesAverage
|
||||
TERM malo := (0, 1) (0.1, 0);
|
||||
TERM przecietnie := (0.1, 0) (0.2,1) (0.3,0);
|
||||
TERM duzo := (0.3, 0) (0.4, 1);
|
||||
END_FUZZIFY
|
||||
|
||||
FUZZIFY lastMatchesResultAverage1
|
||||
TERM zla := (0, 1) (4, 0) ;
|
||||
TERM dobra := (1, 0) (4,1) (6,1) (9,0);
|
||||
TERM znakomita := (6, 0) (9, 1);
|
||||
END_FUZZIFY
|
||||
FUZZIFY lastMatchesResultAverage2
|
||||
TERM zla := (0, 1) (4, 0) ;
|
||||
TERM dobra := (1, 0) (4,1) (6,1) (9,0);
|
||||
TERM znakomita := (6, 0) (9, 1);
|
||||
FUZZIFY lastMatchesResultAverage
|
||||
TERM bardzo_slabo := (0, 1) (3, 0);
|
||||
TERM slabo := (3, 1) (4, 0);
|
||||
TERM przecietnie := (4, 0) (5,1) (6,1);
|
||||
TERM dobrze := (6, 0) (8, 1);
|
||||
TERM bardzo_dobrze := (8, 0) (9, 1);
|
||||
END_FUZZIFY
|
||||
|
||||
FUZZIFY lastMatchesResultBetweenAverage1
|
||||
TERM zla := (0, 1) (4, 0) ;
|
||||
TERM dobra := (1, 0) (4,1) (6,1) (9,0);
|
||||
TERM znakomita := (6, 0) (9, 1);
|
||||
END_FUZZIFY
|
||||
FUZZIFY lastMatchesResultBetweenAverage2
|
||||
TERM zla := (0, 1) (4, 0) ;
|
||||
TERM dobra := (1, 0) (4,1) (6,1) (9,0);
|
||||
TERM znakomita := (6, 0) (9, 1);
|
||||
FUZZIFY lastMatchesResultBetweenAverage
|
||||
TERM bardzo_slabo := (0, 1) (3, 0);
|
||||
TERM slabo := (3, 1) (4, 0);
|
||||
TERM przecietnie := (4, 0) (5,1) (6,1);
|
||||
TERM dobrze := (6, 0) (8, 1);
|
||||
TERM bardzo_dobrze := (8, 0) (9, 1);
|
||||
END_FUZZIFY
|
||||
|
||||
DEFUZZIFY prediction // Zmienna wyjsciowa 'prediction' : {'skromny', 'sredni', 'hojny' }
|
||||
TERM skromny := (0,0) (5,1) (11,0);
|
||||
TERM sredni := (9,0) (15,1) (21,0);
|
||||
TERM hojny := (19,0) (25,1) (30,0);
|
||||
METHOD : COG; // Metoda defuzyfikacji - 'Center Of Gravity' - 'Sreodka ciezkosci'
|
||||
DEFUZZIFY prediction
|
||||
TERM przegrana := (-1,1) (0,0);
|
||||
TERM remis := (-0.5,0) (0,1) (0.5,0);
|
||||
TERM wygrana := (0,0) (1,1);
|
||||
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'
|
||||
RULEBLOCK No
|
||||
AND : MIN;
|
||||
ACT : MIN;
|
||||
ACCU : MAX;
|
||||
|
||||
RULE 1 : IF goalkeeperForm1 IS zla OR goalkeeperForm2 is zla THEN prediction IS skromny;
|
||||
RULE 1: IF goalkeeperForm IS zla AND possessionAverage IS malo THEN prediction IS przegrana;
|
||||
RULE 2: IF possessionAverage IS duzo AND shootsOnTargetAverage IS duzo THEN prediction IS wygrana;
|
||||
RULE 3: IF lastMatchesResultBetweenAverage IS slabo OR lastMatchesResultBetweenAverage IS przecietnie lastMatchesResultBetweenAverage IS dobrze THEN prediction IS remis;
|
||||
END_RULEBLOCK
|
||||
|
||||
END_FUNCTION_BLOCK
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user