From 8d0024c277ad93e608cc22bbebfb0d76c3f2ff19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Pogodzi=C5=84ski?= Date: Mon, 24 Jan 2022 12:40:40 +0100 Subject: [PATCH] Upload files to '' --- transfer-rate.fcl | 62 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 transfer-rate.fcl diff --git a/transfer-rate.fcl b/transfer-rate.fcl new file mode 100644 index 0000000..fa462d0 --- /dev/null +++ b/transfer-rate.fcl @@ -0,0 +1,62 @@ +FUNCTION_BLOCK transfer_rate + +VAR_INPUT + season_rate : REAL; + prev_season_rate: REAL; // Póki co nieużywane, możliwe że wywalimy. + age: REAL; + market_value REAL; +END_VAR + +VAR_OUTPUT + tranfser_rate : REAL; +END_VAR + +FUZZIFY season_rate // Zmienna 'season_rate': {'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); +END_FUZZIFY + +FUZZIFY age // Zmienna 'age': {'mlody', 'sredni' , 'stary'} + TERM mlody := (15, 1) (20, 1) (25, 0); + TERM sredni := (20, 0) (25, 1) (28, 1) (30, 0); + TERM stary := (28, 0) (30, 1) (40, 1); +END_FUZZIFY + +FUZZIFY market_value // Zmienna 'market_value': {'malo', 'srednio' , 'duzo'} + TERM malo := (0, 1) (15, 1) (40, 0); + TERM sredno := (30, 0) (50, 1) (80, 0); + TERM duzo := (70, 0) (80, 1) (180, 1); +END_FUZZIFY + +DEFUZZIFY tranfser_rate // Zmienna 'tranfser_rate' : {'niski', 'sredni', 'wysoki'} + TERM niski := (0, 1) (40, 1) (50, 0); + TERM sredni := (40, 0) (50, 1) (60, 1) (80, 0); + TERM wysoki := (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 season_rate IS wysoka AND age IS mlody THEN tranfser_rate IS wysoki; + RULE 2 : IF season_rate IS wysoka AND market_value IS sredno THEN tranfser_rate IS wysoki; + RULE 3 : IF season_rate IS wysoka AND age IS sredni THEN tranfser_rate IS wysoki; + + RULE 4 : IF age IS mlody AND season_rate IS srednia THEN tranfser_rate IS sredni; + RULE 5 : IF market_value IS malo AND season_rate IS srednia THEN tranfser_rate IS sredni; + RULE 6 : IF market_value IS malo AND age IS mlody THEN tranfser_rate IS sredni; + RULE 7 : IF age IS stary AND market_value IS malo THEN tranfser_rate IS sredni; + + RULE 8 : IF age IS stary AND market_value IS malo THEN tranfser_rate IS niski; + RULE 8 : IF age IS srednio AND market_value IS srednio THEN tranfser_rate IS niski; + RULE 9 : IF season_rate IS niska THEN tranfser_rate IS niski; + + +END_RULEBLOCK + +END_FUNCTION_BLOCK +