**4. Control development and design**

The control system must govern all elements of performance of the sewage treatment Plant, and monitor its proper functioning. Moreover, it has to have a program for its daily operations and emergencies. All this accompanied by an information system supported by records and alarms to facilitate human decisions making, if were necessary. The control system may operate automatically according to operating programs daily and/or manually in case of emergency or tuning on. To design and develop the control for process, the following procedure has been established in Fig. 6. In this procedure, first all input variables that are to do with the control will be identified. And its constitution and behaviour will be scrutinised, as well as the margins of tolerance defined by the specification of the system. This allows to not only set the input parameters that will have to work with to solve the control algorithm but also to choose the appropriate control type: command or feedback control.

Normally, in each of the control processes in a plant we choose a programmable automation model. The process used here is continuous. The process involved in water waste removal can be separated into in different stages that must happen sequentially and correctly. Once the plant specifications have been laid down we continue to programme the plant design, a descending design "top-down" is used. Due to need for an algorithm as open as possible, in order to be able to work in different PLC's, depending on the needs of clients and the capacities of the system. The algorithm is implemented according to the Grafcet of the second level, Fig. 7, and the system requirements listed above.

As for the second phase, "Control Design and development", develops the functional and operational aspects of the expert system and will be dealt with in depth in the next section. The estimate of the same ones, in programmable controller, option chosen in this project, is achieved frequently using a complex mathematical model or control algorithm. Obviously, the 'programmable' attribute increases the potential and the flexibility that has the designer but in contrast increases the complexity, the number of possible solutions and the time spent. Because of this there is a need to define procedures that save time and complexity,

In phase 3, schematic diagrams and circuit diagrams will be made, which are particularly important to build the system and subsequently for realizing the installation and maintenance on site. These diagrams reflect the composition of the built system and will include all units of measurement, technical data of elements and their reference numbers. For the phase 4, implementation of the control system, it will be necessary know specifications and principles of functioning of control elements used, that will be

In phase 5, 'Test & Improvement', is to compare the expert system built with the initial requirements and the specification. This complete control of their functioning and operating

And last, but not least important, the documentation is an essential prerequisite to facilitate installation, final preparation and maintenance of the designed system. The documentation of the individual phases, including control programs should be available so on paper as on digital media. It goes without saying that the real state of the built expert system must

The control system must govern all elements of performance of the sewage treatment Plant, and monitor its proper functioning. Moreover, it has to have a program for its daily operations and emergencies. All this accompanied by an information system supported by records and alarms to facilitate human decisions making, if were necessary. The control system may operate automatically according to operating programs daily and/or manually in case of emergency or tuning on. To design and develop the control for process, the following procedure has been established in Fig. 6. In this procedure, first all input variables that are to do with the control will be identified. And its constitution and behaviour will be scrutinised, as well as the margins of tolerance defined by the specification of the system. This allows to not only set the input parameters that will have to work with to solve the control algorithm but

Normally, in each of the control processes in a plant we choose a programmable automation model. The process used here is continuous. The process involved in water waste removal can be separated into in different stages that must happen sequentially and correctly. Once the plant specifications have been laid down we continue to programme the plant design, a descending design "top-down" is used. Due to need for an algorithm as open as possible, in order to be able to work in different PLC's, depending on the needs of clients and the capacities of the system. The algorithm is implemented according to the Grafcet of the

also to choose the appropriate control type: command or feedback control.

second level, Fig. 7, and the system requirements listed above.

and that allow to obtain the optimum solution.

fundamental for their implementation.

coincide with the documentation.

**4. Control development and design** 

mode must be made prior to its installation on site.

Fig. 6. Procedure for design and development of process control

Expert System Design for Sewage Treatment Plant 73

M1.1 Set/Reset of EV101 &EV102. Drain valves of Decantion Tanks (1st & 2st stage)

**Inputs Function: Level Sensors** 

Inputs Function: Analog Sensors AIW0 Ph value. Mixer 1st Stage AIW2 Temperature. Mixer 1st Stage

Inputs Function: Memory

M0.1 Emergency Shutdown M0.2 Reset of the System M0.3 Empty income Well

M1.2 Set/Reset EV105A. M1.3 Set/Reset EV105B.

Table 1. Program inputs

M1.0 Emergency Shutdown Light

M0.0 Start

I0.0 Minimum level. Income Well (S400) I0.1 Reference level. Income Well (S401) I0.2 Maximum level. Income Well (S402)

I0.3 Maximum level. Ferric Chloride Preparation (S412)

I0.7 Maximum level. Calcium Hydroxide Preparation (S411). I1.0 Maximum level. Polyelectrolyte Preparation (S403). I1.1 Maximum level. Aluminium Chloride Preparation (S404)

I1.2 Minimum level. Aluminium Chloride Tank (S405). I1.3 Reference level. Aluminium Chloride Tank (S406). I1.4 Maximum level. Aluminium Chloride Tank (S407). I1.5 Minimum level. Biological Sludge Tank (S408) I1.6 Reference level. Biological Sludge Tank (S409). I1.7 Maximum level. Biological Sludge Tank (S410). I2.0 Maximum level. Physicochemical Sludge Tank(S413). I2.1 Minimum level. Physicochemical Sludge Tank (S414). I2.2 Minimum level. Ferric Chloride Preparation (S412B). I2.3 Minimum level. Aluminium Chloride Preparation (S404B) I2.4 Minimum level. Calcium Hydroxide Preparation (S411B). I2.5 Minimum level. Polyelectrolyte Preparation (S403B).

I0.4 Minimum level. Ferric Chloride Tank ( S415) I0.5 Reference level. Ferric Chloride Tank (S416) I0.6 Maximum level. Ferric Chloride Tank (S417).

Fig. 7. Level 2 GRAFCET

The Table I and the Table II contain the description of input and output variables respectively used in the program. The analysis of GRAFCET of the second level, that represents the flow diagram of the states of the process, concluded that there is a cycle of working with seven processes that operate simultaneously or selectively. The activation of each of the processes will depend on the necessity to activate the process in question (Lira et al., 2003). The processes of the system are following:


The Table I and the Table II contain the description of input and output variables respectively used in the program. The analysis of GRAFCET of the second level, that represents the flow diagram of the states of the process, concluded that there is a cycle of working with seven processes that operate simultaneously or selectively. The activation of each of the processes will depend on the necessity to activate the process in question (Lira et

a. Branch 1: "Water filling process". It starts with the "starting up" of the system and when the sensor S400, minimum level of water in the entrance well, is activated. Under these circumstances the pump P109 will start which will circulate water from entrance well through the static sieve. Then it will open the valve EV100 that will allow the passage of water to 1st stage mixer. When sensors S401, due to work level, and S402, due to maximum level of water, are activated in the well, it will launch the P100 pump and will open the EV103 valve to discharge excess water from the entrance well towards the pool. This latter process will stop when the water in the well reaches the minimum level. The activation of the P109 pump and of the EV100 valve that cause water to flow into the other stages, will be cancelled if any of the sensors of minimum level of the tanks of preparation are activated (ferric chloride or polyelectrolyte or

aluminium chloride) or if the Ph level in the "Mixer for 1st stage" is less than 5.6. b. Branch 2: "Process of polyelectrolyte preparation": When activating the "Start-up", this starts the M103 motor that turns the contents of the tank that contains the polyelectrolyte preparation and the water to mix. If the S403B sensor is activated, which is the minimum level of the deposit, the P103 pump, will be activated and this is responsible for providing the preparation to the mixer 1st and 2nd stage. If minimum level sensor is disabled or the emergency stop is activated, the motor of remover in the

c. Branch 3 "Process of calcium hydroxide preparation". When activating the "Startup", it starts the motor M101 responsible for mixing the calcium hydroxide prepared solution in the preparation tank. If the S411B sensor minimum level of preparation is activated, the P101 pump which provides the mixture of the 1st stage will be activated. Disabling the minimum level sensor of preparation (S411B) or activating the emergency stop will

Fig. 7. Level 2 GRAFCET

al., 2003). The processes of the system are following:

tank of prepared of polyelectrolyte will stop.

stop the M101 motor.


Table 1. Program inputs

Expert System Design for Sewage Treatment Plant 75

e. Branch 5: "Process of Aluminium chloride preparation". It is similar to the branch 4, by changing the designation of sensors and actuators. Its output is the mixer stage 2, instead of stage 1. With the system in motion, the P111 pump starts which supplies aluminium chloride preparation in the deposit up to the maximum level detected by S404. Then it will launch the M104 engine, responsible for mixing the preparation, and the P104 pump that supplies the preparation in 2nd stage mixer. Disabling the preparation minimum level S404B sensor or activating emergency stop, will stop the

f. Branch 6. "Process of physical-chemical sludge removal": When activated the "Startup" in the SCADA panel, the submersible P107 mixer is put into operation that ensures the physical-chemical sludge does not solidify. Twenty minutes after the process starts, the EV101 opens to extract the sludge from decanter of 1st stage for another 20 minutes. Immediately the EV101 closes and the EV102 opens to remove, in this case, the sludge from the decanter of 2nd stage for another 20 minutes. This cycle is repeated

g. Branch 7: "Biological sludge Extraction Process". When "Startup" on SCADA panel is activated, it starts the EV104 valve that operates the P104 pump, responsible for the extraction of biological sludge, and opens EV106 valve that connects the aspiration of the pump. After 5 minutes, the EV106 closes and the EV107 and EV108 valves opens for

With regards to "the emergency stop": If emergency stop in the SCADA is activated the entire installation will stop and remain locked until reset is activated. The activating the emergency stop paralyzes all motors and pumps and puts the valves in a stand by position, leaving different system processes to be automatically locked until the system is rearmed. This description Grafcet is translated and converted into Boolean equations for development the control program for this process. In order to codify the program, the Boolean equations are converted ladder diagrams (Fig. 8) to create logic networks but using certain techniques to express and identify the sequence logic equations that control the system outputs.

another 5 minutes each alternately connecting to the pump suction.

Besides, ladder diagrams allow to be implemented in any PLC of the market.

Information about the protocol for each alarm or warning activated.

Must establish procedures for cases of failure or emergency. With warning signs and

Finally, the expert system specifications chosen for this design are:

Include functions and sequences of the plant standards.

Structured programming to facilitate any changes or upgrades.

Display and management of real time processing.

Displays alarms and warnings. Display alarm history, and notices.

Two way communication with S7 PLC.

M102 motor and P102 pump will stop.

continuously unless the process is stopped.

M104 motor and P104 pump.

a. SCADA System:

b. The PLC Program:

alarms well marked.

detected by S412 sensor. Then in turns starts the M102 motor, responsible for removing the preparation, and the P102 pump that supplies the preparation in 1st stage mixer. Disabling the prepared minimum level S412B sensor or activating emergency stop, the


Table 2. Program outputs

d. Branch 4: "Process of Ferric Chloride Preparation". With the system in motion the P110 pump that supplies ferric chloride to preparation tank to reach the maximum level

**Outputs Function** 

Q0.0 Recirculating Pump towards Basin(P100)

Q0.3 Electro-valve. 1st Stage Mixing (EV100).

Q0.6 Pump. Ferric Chloride Preparation (P102).

Q0.7 Pump. Ferric Chloride Tank (P110).

Q1.1 Mixing Motor. 1st Stage (M105)

Q1.4 Mixing Motor. 2nd Stage (M107)

(EV105A)

Q3.6 Air Compressor (C100).

Table 2. Program outputs

Q0.4 Pump. Calcium Hydroxide Preparation (P101)

Q0.5 Mixing Motor .Calcium Hydroxide Preparation (M101).

Q1.3 Sludge Extraction Electro-valve. 1st Stage Decantion Tank (EV101)

Q1.6 Sludge Extraction Electro-valve. 2nd Stage Decantion Tank (EV102)

Q2.6 Electro-valve for control of Extraction Pump. Physicochemical Sludge

d. Branch 4: "Process of Ferric Chloride Preparation". With the system in motion the P110 pump that supplies ferric chloride to preparation tank to reach the maximum level

Q2.7 Electro-valve for control of Extraction Pump. Biological Sludge (EV105B). Q3.0 Electro-valve for control of Extraction Pump. Pools Sludge (EV104).

Q1.0 Mixing Motor. Ferric Chloride Preparation (M102)

Q1.2 Mixing Motor. 1st Stage Decantion Tank (M106)

Q1.5 Mixing Motor. 2nd Stage Decantion Tank (M108)

Q1.7 Mixing Motor. Polyelectrolyte Preparation (M103)

Q2.2 Pump. Aluminium Chloride Preparation (P104). Q2.3 Mixing Motor. Aluminium Chloride (M104).

Q2.4 Submergible Pump. Physicochemical Sludge Tank (P107).

Q2.5 Recirculating Pump. Biological Sludge Tank (P108).

Q3.1 Extraction Electro-valve. Pools Sludge (EV106). Q3.2 Extraction Electro-valve. Pools Sludge (EV107). Q3.3 Extraction Electro-valve. Pools Sludge (EV108)

Q3.4 Air Injection Motor. Pool 2 (M109). Q3.5 Air Injection Motor. Pool 1 (M110).

Q2.0 Pump. Polyelectrolyte Preparation (P103) Q2.1 Pump. Aluminium Chloride Tank (P111)

Q0.2 Pump. Income Well (P109).

Q0.1 Recirculating Electro-valve towards Basin (EV103)

detected by S412 sensor. Then in turns starts the M102 motor, responsible for removing the preparation, and the P102 pump that supplies the preparation in 1st stage mixer. Disabling the prepared minimum level S412B sensor or activating emergency stop, the M102 motor and P102 pump will stop.


With regards to "the emergency stop": If emergency stop in the SCADA is activated the entire installation will stop and remain locked until reset is activated. The activating the emergency stop paralyzes all motors and pumps and puts the valves in a stand by position, leaving different system processes to be automatically locked until the system is rearmed.

This description Grafcet is translated and converted into Boolean equations for development the control program for this process. In order to codify the program, the Boolean equations are converted ladder diagrams (Fig. 8) to create logic networks but using certain techniques to express and identify the sequence logic equations that control the system outputs. Besides, ladder diagrams allow to be implemented in any PLC of the market.

Finally, the expert system specifications chosen for this design are:

a. SCADA System:

Display and management of real time processing. Displays alarms and warnings. Display alarm history, and notices. Information about the protocol for each alarm or warning activated. Two way communication with S7 PLC.

b. The PLC Program:

Include functions and sequences of the plant standards.

Must establish procedures for cases of failure or emergency. With warning signs and alarms well marked.

Structured programming to facilitate any changes or upgrades.

Expert System Design for Sewage Treatment Plant 77

The sequential problem has been structured with definite sections dealing about specific areas of process. By adopting this approach, the programs developed are reliable and can be

Fig. 9. Procedure for design and development of process control

easily understood.

Allow two-way communication with the SCADA system (Cao, 2009; Tian et al., 2008). Reading and interpreting all types of signals: analogue or digital Control and supervision of the actuators and field elements.

Fig. 8. Ladder diagrams
