mirror of
https://github.com/marcin-szczepanski/jFuzzyLogic.git
synced 2024-08-17 02:11:56 +02:00
31 lines
414 B
Plaintext
31 lines
414 B
Plaintext
![]() |
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
|
||
|
|
||
|
|