WRITING MULTIPLE RULES IN EPANET

157 views
Skip to first unread message

cro

unread,
Sep 14, 2012, 12:24:08 PM9/14/12
to epa...@googlegroups.com
Here is my example:
RULE  1
IF LINK  p20 FLOW BELOW 150.67
AND LINK  p20 FLOW ABOVE 150.1457
AND PUMP  CS2 SETTING IS  1
OR NODE n767 PRESSURE ABOVE 18
THEN PUMP  CS2 SETTING IS   0.998529


When I write rules in this way program is not working properly. This "OR" obviously refers just to the previous line but i would like it to refer to all conditions before like one group. So I would need something like this:

IF (SOMETHING1 AND SOMETHING2 AND SOMETHING3) OR (SOMETHING4)
THEN....

So how can I make it refere to the all conditions before??? I tried by using brackets in many ways but its not working.

Help please!!!

Lucas Vasconcelos

unread,
Sep 14, 2012, 4:29:08 PM9/14/12
to epa...@googlegroups.com
I'm not sure on how epanet evaluates this OR. Getting the program to model a smart plc is a troublesome. In this aplication wouldn't it be easier just to use a couple rules?

RULE 1
IF LINK p20FLOW BELOW150.67
AND LINK p20FLOW ABOVE150.1457
AND PUMP CS2SETTING IS 1
THEN PUMP CS2 SETTING IS 0.998529

(Notice that this rule will only change the setting if all the conditions are true)

RULE 1.1
IF NODE n767 PRESSURE ABOVE 18
THEN PUMP CS2 SETTING IS 0.998529

(As both rules have the same priority, the last one "wins". You might want to change it...)


Due to precision and discretization issues modeling the plc might be a little harder.

Always keep in mind that you might use a "dummy" pipe to manually impose the evaluation criteria by reading and changing its status.



Abdul Rahman Mosameem

unread,
Mar 6, 2015, 6:09:00 PM3/6/15
to epa...@googlegroups.com
Hello everyone, It is nice to have such forums which means a lot to all relevant professions. I have one question about Epanet and require your kind assistance. I want to know that how to find leakages through Epanet software? Please share your extensive information with me as I have no idea at all about this issue. Thanks in advance and looking for your kind comments and suggestions. 

Patrick Moore

unread,
Jul 28, 2015, 12:01:25 PM7/28/15
to Epanet and Development, dom....@gmail.com

CRO, 

You may want to check page 166 of the EPANET2 manual for OR statement priorities as it may help.   EPANET rules have certain ways that And and OR statements are applied that may require multiple rules to achieve.

Page 166 excerpt of the EPANET2 manual below: 

Remarks:

a. Only the RULE, IF and THEN portions of a rule are required; the other portions are optional.

b. When mixing AND and OR clauses, the OR operator has higher precedence than AND, i.e.,

IF A or B and C

is equivalent to

IF (A or B) and C.

If the interpretation was meant to be

IF A or (B and C)

then this can be expressed using two rules as in

IF A THEN ...

IF B and C THEN ...

Reply all
Reply to author
Forward
0 new messages