How to determine if a condition or action is being shared with other controls?

Product(s): WaterGEMS, WaterCAD, SewerGEMS, SewerCAD
Version(s): 10.XX.XX.XX
Area: Modeling


How to determine if a condition or action is being shared with other controls?


Controls allow you to specify how various model elements should operate over time during an extended period simulation (EPS). For instance, you may want to turn a pump off when a tank or wet-well reaches a certain level.

Controls are made up of a Condition and an Action, and are expressed in this form: 

IF {Condition} THEN {Action}

For example:

IF {T-1 Level > 5.0 m} THEN {PMP-1 Pump Status = Off}

When defining Controls, you can choose to create new Conditions and Actions or use (share) existing ones. The ability to share existing Conditions or Actions can save you some effort when setting things up. For instance, if you want to turn a pump off at midnight or when the tank level is high, you can define two separate controls that share the same Action.

However, sometimes multiple controls could share certain conditions or actions among themselves which can be a problem if some condition / action gets changed in a specific control, leading to changes being carried over to other controls. It could get problematic then to locate the controls and edit them individually by using separate conditions and actions or re-create new controls altogether.

Here is an example of how a single "action" is being shared with two controls;

As you can see, the Controls Manager itself does not give any indication that the "action" (Pump Status = Off) is being shared. However, there is a way you can figure that out.


Although the Controls Manager does not provide a way to directly see if sharing is being used, you can use the controls export functionality to determine if there is sharing.

  1. Click the export tool  to export your controls to file.
  2. Using a text editor (such as Notepad), open the controls (.ctl) file you just exported.

Here is a what the file looks like for the controls shown above:

ELEVATION                 meters

IF TANK T-1 LEVEL > 3 C688 
THEN A689                                ; PUMP PMP-2 STATUS IS CLOSED
"Variable Speed Pumping"

Notice that line 11 looks different than line 7. When an action is shared, the definition is only written once (line 7), and subsequent references to that action just refer to the id of the original. The text following the semi-colon ‘;’ on line 11 is there just for reference. Text after the semi-colon represents a comment and gets ignored if you were to import this back in.

So, to determine if Controls reference any Shared Actions or Condition, you can simply export controls and search to see if there are any semi-color characters in the file.

Now that you know there are references to Shared Conditions or Actions, you may want to do away with them.  Below are a few ways you could do that.

Note: We highly recommend you make a backup of your hydraulic model file before utilizing either of these options.

Option 1

The controls manager provides a duplicate tool ( ).  If you click on the dropdown at the right of the tool, you’ll see two choices.

When you choose Duplicate “Full”, the resulting copy will no longer refer to a shared condition or action (even if the original did).

First, locate the control that you want to duplicate.  In this example, using the steps above we determined that control LC690 is making use of sharing (see Line 9 : LOGICAL LC690)

Select control LC690 in the list, then click Duplicate to make a “full” copy.

After you duplicate the control you can delete the original.

Important Note: If your original control was part of one or more control sets, you’ll need to take steps to ensure that your new duplicate control is part of the same control sets as the original.

Option 2

This technique is a bit more advanced and involves exporting controls and directly editing the file. 

  1. Export controls to file
  2. Edit the file you just exported and remove references to sharing:

Track down any line in the file that contains a ‘;’ (as described above).

Change the Line 11 from this:

  1. THEN A689                                        ; PUMP PMP-2 STATUS IS CLOSED

To this:


(…basically, just delete from the id up to and including the ‘;’)

  1. THEN A689                                        ; PUMP PMP-2 STATUS IS CLOSED

Note: You don’t need to include an ID at the end of this line (as seen in line 7 above), the import logic does not require it.

Pros and Cons of shared Conditions and Actions

The ability to perform the same action for multiple controls (as described in the example above) demonstrates one of the benefits of sharing. Another benefit would be related to making changes to a condition or action. If you are using shared conditions or actions, you can make the change once and it will be applied to all controls that reference it.

The downside of shared conditions and actions are related to the fact that it is not easy to determine if a particular condition or action is shared, or which controls are using them. If you are unaware that two controls share a condition or action, making a change to one control could impact the other unexpectedly.

You may feel that the downsides of sharing actions and conditions outweigh the benefits, so you can avoid sharing when defining controls and creating new conditions and actions for every control. That works out ok if only you are working on a particular hydraulic model file. But if multiple people are working on the file, sharing could get introduced.

See Also

Using Controls, Conditions, Actions and Control Sets in WaterGEMS and WaterCAD

Simple Controls vs. Logical Controls

Troubleshooting Controls in WaterCAD and WaterGEMS