This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

composite conditions / controls - how does the OR function apply?

Hi,

I am trying to input pump controls as close as possible to how they are set in reality, as there are a number of significant network changes proposed in multiple stages about to occur. The pump set in questions has level triggers, time variables, and triggers based on current pump configuration. i.e. for time between X and Y, stage 1 pump configuration will be triggered between levels A and B, unless Stage 1 is already operating in which case it remains active between levels C and D.

It's a little hard to explain exactly, there are reasons, but regardless my question is:

How does the OR function apply.

e.g. If the condition I am trying to input is "IF (Clock Time  >= 11:00 PM)  And (Clock Time  < 12:00 AM ) And (Tank 1 Level < 6 m) And ((Pump 1 Status = Off)  Or (Pump 2 Status = Off))"

Can I enter the composite condition into WaterCAD as:

IF Clock time >= 11PM

AND Clock time < 12AM

AND Tank 1 Level < 6m

AND Pump 1 status = Off

OR Pump 2 status = Off

..or will that apply as "IF [(Clock Time  >= 11:00 PM)  And (Clock Time  < 12:00 AM ) And (Tank 1 Level < 6 m) And (Pump 1 Status = Off)]  Or [(Pump 2 Status = Off))]" instead?

If the latter, is the only way to do this to have 2 separate conditions being:

IF Clock time >= 11PM

AND Clock time < 12AM

AND Tank 1 Level < 6m

AND Pump 1 status = Off

...and...

IF Clock time >= 11PM

AND Clock time < 12AM

AND Tank 1 Level < 6m

AND Pump 2 status = Off

...with a separate control for each condition with both having the same action?

^ I'm really hoping it's not this, as the control set is large and complicated enough as it is.

Thanks in advance for the help.

Kind Regards,

Peter

Parents
  • Hello Peter,

    Which product are you using? And what is its version?

    From the description I understand you wish to have two conditions governing your pump operation (On/Off).

    The logic of the IF, OR and AND operators is something like this;

    IF (Condition1) AND (Condition2) THEN "Do this" ELSE "Do that".

    To break it down, IF conditions 1 and 2 are true(E.g. Time is between 11 AM and 12 Noon) THEN "Do this" ELSE "Do that". The "Do this" and "Do that" conditions are up to you to specify.

    Now, if you wish to add an additional criteria such as hydraulic grade/level of tank to your exiting condition then it can be done as below;

    [IF (Condition1) AND (Condition2) AND (Condition3)] THEN "Do this" ELSE "Do that".

    As you can see the program will check all the conditions (1,2 & 3) and unless they are fulfilled it won't run the operation of "Do this" ELSE "Do that".

    E.g. IF Time >= 11 AM AND Time<12 Noon AND Hydraulic Grade < 104 m. Unless all these criteria are met the control won't be executed.

    As far as the OR operator is concerned it would work something like this;

    [IF (Condition1) AND (Condition2)] OR [(Condition3)] THEN "Do this" ELSE "Do that".

    Here, the first loop of conditions (1 & 2) will be checked first. If fulfilled the control of "Do this" ELSE "Do that" will be executed. However, if not fulfilled it will go to the Condition3 i.e. the second loop. If fulfilled here the control would be executed.

    Hence, if you use the OR operator, if either of the loops are fulfilled the control would be executed by the program.

    E.g. IF Time >= 11 AM AND Time<12 Noon OR Hydraulic Grade < 104 m. If either one of these loops are TRUE, then the control would be executed.

    I hope this can give you some clarity as to how the operators work.

    Here are few reference articles which provides more details on this;

    Creating Controls - Conditions, Actions and Control Sets (V8i)

    Creating Controls - Conditions, Actions, and Control Sets (CONNECT Edition and V8i SELECTseries 6)

    Simple controls vs. logical controls

    Hope this helps.


    Regards,

    Yashodhan Joshi

  • Thanks Yashodan, I understand that bit. What I am trying to see, using the terminology you have used, is whether I can use the OR function to have something like;

    IF [(condition 1) AND (condition 2) AND (condition 3)] or [(condition 1) AND (condition 2) AND (condition 4)] THEN [Action]

    In other words, using your example of:

    [IF (Condition1) AND (Condition2)] OR [(Condition3)] THEN "Do this" ELSE "Do that".

    ...my (Condition 3) would actually be a composite condition made up of two simple conditions and an AND function.

    I fear that it's unlikely I can and I'll require 2 separate controls though. I just thought I'd put the question out before I sit down and duplicate the many controls for the multiple time steps conditioned; but it's not looking promising. I can't imagine it's a level of detail required too often, so fair enough.

  • Hello Peter,

    Your Condition3 can be a composite condition and you can surely use the functions as required.

    However, it would be better and much more simplified if you broke down the conditions based on your operational requirements.

    Generally, a pump operation can be modulated with the HGL. If however, you wish to regulate pump status depending on time too, you can find out the HGL at your given time.

    E.g. If I want to start pump at 11 AM, I will find out the HGL at that time and control the pump with only HGL. Hence both your conditions are intrinsically followed i.e. time as well as HGL.

    So, a better option would be to find the inter-dependency between different conditions and verify if they are in fact mutually exclusive. If they are interdependent then the control won't execute properly for multiple conditions.


    Regards,

    Yashodhan Joshi

  • Hi Peter,

    Correct, you'll need to do this as 2 controls.

    Rob

  • Thanks Yashodhan,

    Unfortunately due to the time loops in place operationally (control tank is common inlet/outlet and cycles in set periods to ensure turnover), and the pump sets in question needing controls to ramp speeds up and down to set levels in different combinations, the simplification will not work for the task I am looking to undertake.

    You are saying condition 3 can be a composite, but my version of WaterCAD (1.01.00.72) only allows a simple condition to be selected for each IF, AND or OR function.

    So in my example above, lets say condition 3 is actually a composite of simple conditions 4 and 5. The control I need will be looking for both Condition 1 and Condition 2 to be true as well as either Condition 4 or Condition 5 being met. In this case, are you saying that if I input:

    IF Condition 1

    AND Condition 2

    AND Condition 4

    OR Condition 1

    AND Condition 2

    AND Condition 5

    ...it will do what I require? (i.e. the OR will group all conditions after until another OR is used?)

    Or does this group either side of the OR? (i.e. saying if 1 is true, and 2 is true, either 4 or 1 is true, and 2 is true, and 5 is true)

    Actually, when I put it this way, I think I just realised the most fail safe method to do so... I can just rearrange to:

    IF Condition 1

    AND Condition 2

    AND Condition 4

    OR Condition 5

    AND Condition 1

    AND Condition 2

    ... and it should work either way, right?

    It would be nice to know though how the logic is applied. If I knew for sure I could potentially cut down the number of controls required.

    And, you know, closure...

    Thanks for your time either way Slight smile

  • Hello Peter,

    I believe Rob may have answered this yesterday. You may need to use two controls for this. I believe there is no parenthetical options where you can have a IF (x and y) OR (a and b) type format at this time.

    Regards,

    Scott

Reply Children
No Data