jFuzzyLogic/fcl/QoS/TSQoSFewRules.fcl
2014-12-19 08:30:46 -05:00

53 lines
1.2 KiB
Plaintext

FUNCTION_BLOCK MamdaniQoSFewRules
VAR_INPUT
commitment : REAL;
clarity : REAL;
influence : REAL;
END_VAR
VAR_OUTPUT
service_quality : REAL;
END_VAR
FUZZIFY commitment
TERM nothing := GAUSS 0 1;
TERM minimal := GAUSS 1 1;
TERM partially := GAUSS 2 1;
TERM satISfactory := GAUSS 3 1;
TERM largely := GAUSS 4 1;
TERM fully := GAUSS 5 1;
END_FUZZIFY
FUZZIFY clarity
TERM low := GAUSS 0 1;
TERM medium := GAUSS 2.5 1;
TERM high:= GAUSS 5 1;
END_FUZZIFY
FUZZIFY influence
TERM low := GAUSS 0 1;
TERM medium := GAUSS 2.5 1;
TERM high:= GAUSS 5 1;
END_FUZZIFY
DEFUZZIFY service_quality
TERM inadequate := FUNCTION (commitment * 0.8);
TERM sufficient := FUNCTION (commitment * 0.6) + 1.2 +(clarity * 0.6) + (influence * 0.6);
TERM excellent := FUNCTION (commitment * 0.6) + (influence * 0.6);
METHOD : COGF;
DEFAULT := 0;
END_DEFUZZIFY
RULEBLOCK No1
ACCU : MAX;
AND : MIN;
RULE 1 : IF commitment IS fully AND influence IS high THEN service_quality IS excellent;
RULE 2 : IF commitment IS partially AND clarity IS high AND influence IS low THEN service_quality IS sufficient;
RULE 3 : IF commitment IS nothing THEN service_quality IS inadequate;
END_RULEBLOCK
END_FUNCTION_BLOCK