disengagement-controller/disengagement.fcl

50 lines
1.7 KiB
Plaintext
Raw Normal View History

2024-05-29 11:30:12 +02:00
FUNCTION_BLOCK disengagement_FCL
VAR_INPUT
learning_quality : REAL;
remaining_time : REAL;
END_VAR
VAR_OUTPUT
disengagement : REAL;
END_VAR
FUZZIFY learning_quality
TERM low := (0, 1) (0.2, 1) (0.4, 0);
TERM medium := (0.2, 0) (0.4, 1) (0.6, 1) (0.8, 0);
TERM high := (0.6, 0) (0.8, 1) (1, 1);
END_FUZZIFY
FUZZIFY remaining_time
TERM low := (0, 1) (0.2, 1) (0.4, 0);
TERM medium := (0.2, 0) (0.4, 1) (0.6, 1) (0.8, 0);
TERM high := (0.6, 0) (0.8, 1) (1, 1);
END_FUZZIFY
DEFUZZIFY disengagement
TERM low := (0, 1) (0.2, 1) (0.4, 0);
TERM medium := (0.2, 0) (0.4, 1) (0.6, 1) (0.8, 0);
TERM high := (0.6, 0) (0.8, 1) (1, 1);
METHOD : COG;
DEFAULT := 0.5;
END_DEFUZZIFY
RULEBLOCK No1
AND : MIN;
ACT : MIN;
ACCU : MAX;
RULE 1 : IF learning_quality IS low AND remaining_time IS low THEN disengagement IS high;
RULE 2 : IF learning_quality IS low AND remaining_time IS medium THEN disengagement IS medium;
RULE 3 : IF learning_quality IS low AND remaining_time IS high THEN disengagement IS medium;
RULE 4 : IF learning_quality IS medium AND remaining_time IS low THEN disengagement IS medium;
RULE 5 : IF learning_quality IS medium AND remaining_time IS medium THEN disengagement IS medium;
RULE 6 : IF learning_quality IS medium AND remaining_time IS high THEN disengagement IS low;
RULE 7 : IF learning_quality IS high AND remaining_time IS low THEN disengagement IS medium;
RULE 8 : IF learning_quality IS high AND remaining_time IS medium THEN disengagement IS low;
RULE 9 : IF learning_quality IS high AND remaining_time IS high THEN disengagement IS low;
END_RULEBLOCK
END_FUNCTION_BLOCK