Fuzzy Controller using RTES
|
Variables |
Analog Input : PRESS Analog output : VALVE Registers : PRESS_SP, PNORMAL, PLOW, PHIGH, PVLOW, PVHIGH, STATUS, DELTA R0033 DELTA0R0034 DELTA1 R0035 DELTA2 R0036 DELTA3 R0037 DELTA4
|
||
| Rules |
RULE PVHIGH=PRESS>(1.3*PRESS_SP) RULE PVLOW=PRESS<(0.7*PRESS_SP) RULE PHIGH=PVHIGH'&(PRESS>(1.15*PRESS_SP)) RULE PLOW=PVLOW'&(PRESS<(0.85*PRESS_SP)) RULE PNORMAL=(PVHIGH!PHIGH!PLOW!PVLOW)' RULE STATUS=PVLOW+2*PLOW+3*PHIGH+4*PVHIGH RULE DELTA0=0 RULE DELTA1=15 RULE DELTA2=3 RULE DELTA3=0-3 RULE DELTA4=0-15 EXEC C1=C2d1 RULE C2=C1d9 |
||
|
Notes |
See "Fuzzy Variable" . Registers DELTA0 to DELTA4 must be consecutive to form a table. The value of DELTA is extracted from the table at index STATUS. Alternately, DELTA may be calculated as a function of STATUS C1 is used to execute the command pointed by its value in the message area. RULE DELTA=3*(STATUS=1)+15*(STATUS=2)-3*(STATUS=3)-15*(STATUS=4) The delays (1 second+9 seconds) add up to a 10 second refresh interval. You may use instead a variable that depends on the status, to refresh more often when the status is very high or very low. |