--- title: "How to apply logical rules to a sluice or gated weir" slug: "how-to-apply-logical-rules-to-a-sluice-or-gated-weir" description: "Learn how to provide logical rules to control a sluice or gated weir" updated: 2023-07-10T12:15:35Z published: 2023-07-10T12:15:35Z canonical: "help.floodmodeller.com/how-to-apply-logical-rules-to-a-sluice-or-gated-weir" stale: true --- > ## Documentation Index > Fetch the complete documentation index at: https://help.floodmodeller.com/llms.txt > Use this file to discover all available pages before exploring further. # How to apply logical rules to a sluice or gated weir Logical rules can be added to a vertical sluice, radial sluice, or gated weir, to enable their control to be determined by specified situations. This could include specifying the gate to open based on the water level at a given reference point, for instance. ![](https://cdn.document360.io/5074bc26-a9ef-4bf4-b1de-a5c6ce628aca/Images/Documentation/rules-gatedsluice(1).PNG) Note: This guide covers the minimum data required. Several optional settings are also available for logical rules, please see the [Rules](/v1/docs/rules) section of the technical reference for further details. ### Steps 1. Open the vertical sluice, radial sluice, or gated weir unit to which you are applying the rule(s) and navigate to the **Control Data** tab. 2. Use the drop-down to change the **Control Method** to **LOGICAL**. Add values in the fields provided for the **Minimum Setting**, **Maximum Setting** and **Max Movement Rate** of the gate. In the table provided, set the **Mode** to **AUTO** to use automatic mode from the start (time 0). When in automatic mode the unit will be driven by the rules you define. 3. Navigate to the **Rules** sub-tab to add your logical rules. Click **New Rule** and the **Rule editor** will open in a new window. The rule must be of the form: IF (xxx) THEN MOVE = () or THEN POSITION = () END Where xxx is a logical statement that can be evaluated as true or false. An example is provided below. 4. Repeat step 3 as required. Following 1 or more of the IF rules, an ELSE condition can be optionally provided to cover all other eventualities: ELSE MOVE = () or ELSE POSITION = () END An ELSE rule must be located as the final rule in the list. Example usage: controlling the gate opening of a sluice according to the water level at the gauge point A2. - Rule1 opens gate by 0.1 (metres) when the water level at A2 is between 12.2m and 13.0m - Rule2 sets the gate position to 1.0 (metres) when the water level at A2 is 13.0m or higher - Rule3 sets the gate position to 0.0 (metres) in other situations (i.e. when the water level at A2 is 12.2m or lower) RULE1 IF(LEVEL(A2).GT.12.2.AND.LEVEL(A2).LT.13.0) THEN MOVE=0.1 END RULE2 IF(LEVEL(A2).GE.13.0) THEN POSITION=1.0 END RULE3 ELSE POSITION=0.0 END Note: RULE3 above could also be achieved with the condition IF(LEVEL(A2).LE.12.2) 5. Click **OK** to save and close the unit. Don't forget to also **Save** these changes to the network. Note: Each rule can provide a maximum of one action to be applied to the unit (gate, in this case), however ALSO statements can be added to [define rules for global variables](/v1/docs/how-to-add-global-variables-within-logical-rules). You can also [apply logical rules to a pump](/v1/docs/how-to-apply-logical-rules-to-a-pump) and [apply logical rules to an abstraction unit](/v1/docs/how-to-apply-logical-rules-to-an-abstraction-unit).