LSR/Examples/jFuzzyLogic/QoS/LarsenQoSFewRules.fcl
2020-06-04 19:21:01 +02:00

56 lines
1.3 KiB
Plaintext

FUNCTION_BLOCK LarsenQoSFewRules
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;
RANGE := (-4.0 .. 9.0); // Added range for commitment
END_FUZZIFY
FUZZIFY clarity
TERM low := GAUSS 0 1;
TERM medium := GAUSS 2.5 1;
TERM high:= GAUSS 5 1;
RANGE := (-4.0 .. 9.0); // Added range for clarity
END_FUZZIFY
FUZZIFY influence
TERM low := GAUSS 0 1;
TERM medium := GAUSS 2.5 1;
TERM high:= GAUSS 5 1;
RANGE := (-4.0 .. 9.0); // Added range for influence
END_FUZZIFY
DEFUZZIFY service_quality
TERM inadequate := GAUSS 0 1;
TERM sufficient := GAUSS 2.5 1;
TERM excellent := GAUSS 5 1;
METHOD : COG;
DEFAULT := 0;
RANGE := (-4.0 .. 9.0); // Added range for service_quality
END_DEFUZZIFY
RULEBLOCK No1
AND : PROD;
ACCU : MAX;
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