jFuzzyLogic/tests/junit1.fcl

31 lines
414 B
Plaintext
Raw Permalink Normal View History

2014-12-19 14:30:46 +01:00
FUNCTION_BLOCK junit1
VAR_INPUT
temp : REAL;
END_VAR
VAR_OUTPUT
valve : REAL;
END_VAR
FUZZIFY temp
TERM cold := (0, 1) (30, 0);
TERM hot := (0, 0) (30, 1);
END_FUZZIFY
DEFUZZIFY valve
TERM closed := 0;
TERM inlet := 1;
END_DEFUZZIFY
RULEBLOCK No1
AND : MIN;
ACCU : MAX;
RULE 1 : IF temp IS cold THEN valve IS closed;
RULE 2 : IF temp IS hot THEN valve IS inlet;
END_RULEBLOCK
END_FUNCTION_BLOCK