Irrigation Canal Downstream Water level PLC Control

Two downstream level sensors provide redundant measurements at two points downstream locations. These sensors must be validated as they should provide similar readings consistent with previous measurements. We will assume two validated sensors input values for this project. Upstream flooding limit switch (not included in this abbreviated discussion / implementation) is used to provide the regulator an indication of possible flooding and thus command the system to raise both gates gradually using the same selection criteria until the flooding condition is removed or downstream level is close to the upstream level.

any register value.A centralized Human Machine Interfaces (HMI's) was also available.The original project was successfully implemented using the Rockwell Allen Bradley PLC 5/15 infrastructure but redone for this paper using the SLC RSLogix 500 PLC infrastructure [3] and the LogixPro simulator [1].Both systems are among the most dominant digital PLC control infrastructures worldwide.
Two downstream level sensors provide redundant measurements at two points downstream locations.These sensors must be validated as they should provide similar readings consistent with previous measurements.We will assume two validated sensors input values for this project.Upstream flooding limit switch (not included in this abbreviated discussion / implementation) is used to provide the regulator an indication of possible flooding and thus command the system to raise both gates gradually using the same selection criteria until the flooding condition is removed or downstream level is close to the upstream level.
Each motor is equipped with an overload alarm switch, which is used to trigger any unusual conditions such as over temperature or load.
The motors provide an input discrete signal within 5 seconds from start action indicating if the motor is running or not.If a motor fails to start then the fail to start alarm is issued.Motors can also start by activating the Push Button located on the local panel if the AUTO/MAN switch is in manual (MAN) and the LOCAL / REMOTE switch is on LOCAL.A selected motor is scheduled to run for 15 seconds.This is followed by an idle period of 15 minutes.These values are experimental values derived during the system checkout with major help from the manual system operator who was considered the domain expert for this application.No motor is allowed to run during the idle time.This is done to prevent repetitive activation of the motors during downstream water level transient.It is important to keep the gates at close positions in order to minimize the loading on both gates structure.An Emergency Shutdown Switch (ESD) is available to the operator to shut down the system in addition to the START and the STOP push button switches.

Introduction
In order to simplify this paper discussion, we will assume only two vertical gates for the considered PLC regulator site.The real implementation accommodate and control from 3 to 6 adjacent pair of gates, lower and upper, depending on the width of the irrigation canal at each site.Identical constant speed motors derive each gate [7].The motors can move the gates up or down but only one motor can run at any time.This is done in order to reduce the overall power requirements of the regulator site.Small variation in gate's position is needed at any time due to water level transient.The lowest position gate is selected for a raise operation and the highest position gate is selected for a lowering command.At start up when both vertical gates are at the same position, the program will determine which gate will run first.Both gates are equipped with position sensors, fully closed, and fully opened limit switches.All regulators / PLC's were networked along with local ready panel mounted on each PLC front cabinet to be used by operator to monitor/ alter This important step lists all I/O tags, assigned PLC addresses, and description.Figure 1 lists the irrigation control system discrete and analog inputs, while Figure 2 shows the corresponding PLC input tags.Figure 3 and Figure 4 repeat the same process for the discrete outputs.Notice that the real analog inputs / outputs for this control process were connected to the PLC using standard analog configured I/O interfaces.We only limited our control to ON / OFF control based on water level analog real time measurements relative to user defined set point for the downstream water level [2].

Automated System Implementation Building Blocks
The CPU supports the following types of subroutines that allow an efficient Structure for the program; File 2 (main file) define the structure of the program and Subroutines (SUB3, SUB4, etc.), which contain the program code that corresponds to specific tasks or combinations of parameters.Each subroutine file provides a set of input and Output parameters for sharing data with the calling file.

Irrigation Canal Control Ladder Software Implementation
The set point validation Subroutine shown in Figure 6 consists of three rungs; set point high limit / low limit validation, and dead band calculations.
The initialization subroutine shown in Figure 7   Supervisory control is a must for the entire irrigation canal downstream coordination at all sections [8].One regulation site changes do affect the downstream water level at other sections of the canal.Implemented site control is an ON / OFF strategy,   which is the most effective for this application due to excessive water transients after each gate activation and the large dead time in the controlled variable, the downstream water level.Each site is equipped with control panels allowing the operation of the gate motors in both manual and remote modes.Those panels are disabled during typical automatic control mode, the AUTO / MANUAL in the AUTO mode.Vertical Gate Position subroutine consists of four rungs; vertical gate1 highest in position, vertical gate1 lowest in position, vertical gate2 highest in position, and vertical gate2 lowest in position.As shown in Figure 12 the greater than or equal instruction (GEQ) compares I:1.0 (VG1 Position) to I:1.1 (VG2 Position).Once AUTO / MANUAL Switch is placed in AUTO.If VG1 position is higher than or equal to VG2 position, then the output B3:0/1 Tag Name (VG1_HIGHEST_IN_POS) is set.Notice that if the comparison used is only greater than and the two vertical gates are having equal position, then no gate will be selected to move.Vertical Gate1 raise Subroutine consists of seven rungs; Vertical Gate1 available, next up, Control UP, Vertical Gate1 Raise One Step Timer ,Vertical Gate1 Dead Time Enable , Dead Time Timer, and Vertical Gate1 Raise One Step.As shown in Figure 13; if AUTO/MANUAL switch is in AUTO, Vertical Gate1 not running, not failed to start, and Local/Remote switch in Remote, then Vertical Gate1 is available (VG1_AV).As shown in Fig. 14, if VG1 is available, lowest in position, not fully raised, and VG2 is not next to go up, then VG1 is next to go up.
As shown in Figure 15, if vertical gate1 next up, Process variable outside the dead band, and set point greater than Downstream Average Level, then CONTROL_UP is set.The "VG1_ CNT_UP" is latched around the GRT instruction due to possible transient in water level measurements.
As shown in Figure 16, vertical gate1 control up acts as a pulse causing T4:0 to start timing and timer timing bit (T4:0/TT) to be set.This timing bit latches around B3:0/3 keeping the timer running for 15 seconds while B3:0/3 is lost due to motor running (Refer to Figure 13).
As shown in Figure 17, while T4:0/TT is ON, ESD is OFF, and dead time timer is not running, vertical gate1 is ON raising the gate one step which is equivalent to 15 seconds.As shown in Figure 18, if vertical gate1 raise transition from high to low B3:1/0 will be ON for one scan due to the one shot (VG1_DEAD_TIME_OSR).For the Figure 19 rung if B3:1/0 or B3:1/3 is active timer (T4:4) will be set and the timer timing bit T4:4/TT will latch around (B3:1/0 or B3:1/3) which causeT4:4 (Dead Time Timer) to run for 15 minutes.Vertical Gate 2 Raise Subroutine consists of five Rungs; Vertical Gate2 available, next up, control up, VG2_RAISE_ONE_ STEP timer, and Vertical Gate2 Dead Time Enable.It works the same as for VG1 and has the same logic.

Pre-Implementation Ladder Logic Diagrams
Prior to the implementation of the PLC software control     showing the working details of the process control methodology used.Once these logic diagrams are finalized and approved by all stakeholders, implementation can go forward.The detailed specification for this project including the complete sets of logic diagrams for both of the Allen Bradley and the Siemens S7-1200 can be found in Kamel & Kamel [5] and [6].
Logic diagrams are recommended for sound documentation and as means of a transition from specifications to the actual ladder programming implementation.This step as will be briefly demonstrated using one operation makes ladder programming much easier.
The following logic diagram shows the implementation for the vertical gate 1 control available, which is an input condition to VG1 raise operation.Other operations logic diagrams can be constructed in a similar way for vertical gate 1 lowering operation and both the raise and lowering for VG2."L.T." and "H.T." refers to the low and high thresholds around the downstream water level set point "S.P.", while "D.S.AVE."refers to the average of all redundant downstream water level sensors measurements. .The logic diagrams shown in Figure 20 is divided into three logics entities as follows: • VG1 available is true; if the AUTO/ MANUAL selector switch is placed in AUTO, the REMOT/LOCAL selector switch is placed in REMOTE, vertical gate 1 is not running, and vertical gate1 not failed to start.
• VG1 next up is true; if VG1 available, VG2 not next to go up, VG1 is not fully raised, and VG1 is lowest in position.
• VG1 control up is true; if VG1 is next to go up, downstream average water level is outside the dead band, and downstream water set point is greater than or equal the downstream average water level.
Figure 21 shows the logic for starting VG1 motor for 15 seconds duration.This raise duration should cause increase in downstream water level, which is expected to stabilize after a 10 minutes idle time.The system enters the idle state after every gate raise or lower operation.No gate movement is permitted during the idle time.

Conclusion
This paper offers readers an insight to PLC programming with focus on real industrial process automation applications.Siemens S7-1200 / Allen Bradley SLC500 PLC hardware configuration and the SIMATIC STEP 7 / RSLogix 500 software were used for this implementation.LogixPro 500 simulation software can also be used to implement and test the required process control without any need for the real PLC hardware.The case study selected for this paper is intended to be a cap stone project encompassing most of the concepts covered in PLC process control and industrial automation.The project is part of larger irrigation canal control process, which was implemented by the authors several years ago and detailed in a recently published and referenced two text books.The part included in this paper deals with a common process control task in the flow and level ON / OFF control, which has to do with the motors sequencing and control.The coverage in this paper is simplified to an abbreviated one site and is transformed to a newer implementation using the SLC 500 PLC system.
Figure 5-1 shows the PLC subroutines (Initialization, Alarms, Downstream Average, Set point Validation, Vertical Gate1 Raise, Vertical Gate2 Raise, and Vertical Gate Position.The exact ordering of the implemented subroutine is irrelevant since the scanning of the ladder code is continuous and repeats at high rate, at least three complete scans per second.Critical tasks might require a definite ordering of some functional blocks.Most initialization tasks are executed only once on power up or system reset conditions.The figure shows the project view in Part 1 and the ladder view in Part 2.
consists of one rung, which clears the accumulated values for VG1 Raise one Step, VG2 Raise one Step, VG1 Fail to Start, VG2 Fail to start, and the dead time timer as the system is placed in AUTO on start up.All initializations are executed only during the first PLC scan using the first pass instruction.All initializations related to the local HMI, communication with the central site, and system diagnostic functions are not shown.Alarm Subroutine consists of five parts including Vertical Gate 1 Failed to Start, Vertical Gate 2 Failed to Start, Downstream1 Failed, Downstream2 Failed, and common alarm.If VG1 fail to start, or VG2 fail to start, or DS1 failed, or DS2 failed, the common alarm will be set.
Figure 8 shows a ladder logic diagram for the Vertical Gate1 Failed to Start Alarm.The ladder logic for the Vertical Gate2 Failed to Start Alarm is similar.Notice that the failed to start alarm is latched coil as it was one of the conditions for vertical gate to raise/ lower.

Figure 2 :
Figure 2: Irrigation System PLC Input Tags

Figure 9
Figure 9 shows a ladder logic diagram for the Down stream1 Fail Alarm.This diagram assumes greater than or equal and less than or equal instructions and output coil B3/11 tag name (DS1_ Fail).The ladder diagram work as follows: If downstream 1 is greater than or equal downstream average high threshold or less than or equal downstream average low threshold, then power flow to the output coil and B3/11 is set.This is an indication of level sensor 1 failure / alarm.