**5. Synthesis: Problem solution**

The design and development of the control program is of vital importance due to it constitutes the means for controlling the process. For the controller to carry out its intended task, a control program is necessary. The planning and design work for this process is complex. The following procedure, shown in Fig. 9, has been established in order that the program can be easily developed, verified and documented. An important part of this procedure is the division of programming tasks into two fundamental blocks: on the one hand to solve the sequential problem, on the other hand to implement safety (emergency stop, alerts,…) and operating modes (start conditions, reset, empty income well,…). The following Table 3 provides a good practice guide.

#### **1. Plan your program on paper first "80% of your time should be spent working out the program, and only 20% keying it in"**

2. Keep documentation of all elements used in the program and add so comments as necessary.

3. Assume the program will find every error sequence possible, "design safety into it !"

4. Keep programs simple and readable. Comments would be helpful

5. Try sectional development and verifying if possible.

6. Analysis of operation program in situations where it is safe to do so and simulate failures.

Table 3. Good programming practice

Allow two-way communication with the SCADA system (Cao, 2009; Tian et al., 2008).

The design and development of the control program is of vital importance due to it constitutes the means for controlling the process. For the controller to carry out its intended task, a control program is necessary. The planning and design work for this process is complex. The following procedure, shown in Fig. 9, has been established in order that the program can be easily developed, verified and documented. An important part of this procedure is the division of programming tasks into two fundamental blocks: on the one hand to solve the sequential problem, on the other hand to implement safety (emergency stop, alerts,…) and operating modes (start conditions, reset, empty income well,…). The

**1. Plan your program on paper first "80% of your time should be spent working out the** 

2. Keep documentation of all elements used in the program and add so comments as

6. Analysis of operation program in situations where it is safe to do so and simulate

3. Assume the program will find every error sequence possible, "design safety into it !"

4. Keep programs simple and readable. Comments would be helpful

Reading and interpreting all types of signals: analogue or digital Control and supervision of the actuators and field elements.

Fig. 8. Ladder diagrams

**5. Synthesis: Problem solution** 

following Table 3 provides a good practice guide.

5. Try sectional development and verifying if possible.

**program, and only 20% keying it in"** 

Table 3. Good programming practice

necessary.

failures.

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 easily understood.

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

Expert System Design for Sewage Treatment Plant 79

AIW0, and because of the signal has a unipolar format, your range will be between 6400 and 32000 as is shown in Fig. 11. Therefore it will be necessary to scale and standardize this

 y-y0 = m.(x-x0) (1) and solving for the values of the extremes, is obtained the slope of the line depending on the

a. Ph=5; y0=9.71mA=15543 that is the value to compare in the PLC program as a

b. Ph=7; y0=12mA=19200, that is the value to compare in the PLC program the maximum

c. Ph=5.8; y0=10.63mA=17000, that is the value to compare in the PLC program as a

It has been initiated to implement an expert system in the total control of the process and has been complemented with a set of records and alarms. This has revealed in real time the operation state of the process, which it allows to carry out analysis functions, correct them and act appropriately. It has been developed a Supervisory Control Acquisition Data Analysis (SCADA) system that is structured in a main screen from that is obtained access to the other four: Sewage Treatment Plant, Prepared of the Sewage Treatment Plant, Warnings,

The main screen, that is shown in Fig. 12, gives access to all screens. It allows handling the whole process: start, emergency stop, reset and empty the entrance well. It also displays the

From the screen shown in Fig. 13 and Fig. 14 the overall process of purification of the sewage plant is monitored and controlled. One of the important aspects of the process is the need to control and maintain constant the pH and temperature of water coming from the entrance well. To take the measurement, two transducers are used that convert physical quantities, temperature and pH, into two signals of intensity. The state of the system and the different processes are displayed, in addition of showing the levels of pH and temperature

So the equation to implement in the PLC program to know the real value of Ph is:

m = (14/25600)=0.0546.10-3 (2)

14-Ph =m. (3200-AIW0) (3)

variable to the actual range of pH, from 0 to 14.

Using the equation:

analog input value.

minimum value of Ph.

minimum value of Ph.

**6. Implementation and results** 

**6.2 Sewage treatment plant screen** 

of the water in the entrance well.

different states of the system in the box "System Status".

value of Ph.

and Histogram.

**6.1 Main screen** 

So for:

For example, one of the complicated aspects of the process is the need to control and maintain constant the pH and temperature of water coming from the entrance well. To take the measurement, two transducers are used that convert physical quantities, temperature and pH, into two signals of intensity. This signal intensity, shown in Fig. 10, is received by the PLC via an analog module (EM235) that makes the conversion for its interpretation and comparison with the desired values and thus the corrective actions in the system are made. Thus, one of the calculations is the conditioning of the analog sensors. So the Ph transducer provides as output a variable current signal from 4 to 20mA that reads analog module of the PLC and it becomes a 12-bit digital value. This value is stored in the analog input word,

Fig. 10. Current's variation in function Ph

Fig. 11. Variation of AIW0 analog input in function Ph

AIW0, and because of the signal has a unipolar format, your range will be between 6400 and 32000 as is shown in Fig. 11. Therefore it will be necessary to scale and standardize this variable to the actual range of pH, from 0 to 14.

Using the equation:

$$\mathbf{y} \cdot \mathbf{y}\_0 = \mathbf{m}. (\mathbf{x} \cdot \mathbf{x}\_0) \tag{1}$$

and solving for the values of the extremes, is obtained the slope of the line depending on the analog input value.

$$\mathbf{m} \equiv \begin{pmatrix} 14/25600 \end{pmatrix} = 0.0546.10^3 \tag{2}$$

So the equation to implement in the PLC program to know the real value of Ph is:

$$\text{14-Ph} \equiv \text{m. (3200-AIW0)}\tag{3}$$

So for:

78 Emerging Informatics – Innovative Concepts and Applications

For example, one of the complicated aspects of the process is the need to control and maintain constant the pH and temperature of water coming from the entrance well. To take the measurement, two transducers are used that convert physical quantities, temperature and pH, into two signals of intensity. This signal intensity, shown in Fig. 10, is received by the PLC via an analog module (EM235) that makes the conversion for its interpretation and comparison with the desired values and thus the corrective actions in the system are made. Thus, one of the calculations is the conditioning of the analog sensors. So the Ph transducer provides as output a variable current signal from 4 to 20mA that reads analog module of the PLC and it becomes a 12-bit digital value. This value is stored in the analog input word,

0 20mA

0 6400 32000

0

4mA

Fig. 10. Current's variation in function Ph

0

Fig. 11. Variation of AIW0 analog input in function Ph

2

4

6

8

10

12

14

16

2

4

6

8

10

12

14

16


#### **6. Implementation and results**

It has been initiated to implement an expert system in the total control of the process and has been complemented with a set of records and alarms. This has revealed in real time the operation state of the process, which it allows to carry out analysis functions, correct them and act appropriately. It has been developed a Supervisory Control Acquisition Data Analysis (SCADA) system that is structured in a main screen from that is obtained access to the other four: Sewage Treatment Plant, Prepared of the Sewage Treatment Plant, Warnings, and Histogram.

#### **6.1 Main screen**

The main screen, that is shown in Fig. 12, gives access to all screens. It allows handling the whole process: start, emergency stop, reset and empty the entrance well. It also displays the different states of the system in the box "System Status".

#### **6.2 Sewage treatment plant screen**

From the screen shown in Fig. 13 and Fig. 14 the overall process of purification of the sewage plant is monitored and controlled. One of the important aspects of the process is the need to control and maintain constant the pH and temperature of water coming from the entrance well. To take the measurement, two transducers are used that convert physical quantities, temperature and pH, into two signals of intensity. The state of the system and the different processes are displayed, in addition of showing the levels of pH and temperature of the water in the entrance well.

Expert System Design for Sewage Treatment Plant 81

This screen displays the different preparations which are going to add to water for physical-

Thus, from this screen is possible to control the levels of the different machines needed to perform the different functions in the purification process, such as the pumps and motors.

This screen displays warnings and system alarms set up. In both cases, shown in Fig. 16,

In the proposed control system, in addition to the specific warnings of the system HMI that

a. Warnings Service. It reports irregularities in the service or in the process of the Sewage Treatment Plant, and the effects on the efficiency of the process. These warnings are automatically generated and are a necessary information for the operator in making decisions. For example, inadequate levels of temperature or pH will be referred to in

b. Alarms. These show states of malfunction or danger in the process. These alarms require mandatory action by an operator after its recognition, and are usually accompanied by the shutdown of the system to remedy the problem (for example in Fig. 14 ). It is distinguished, in this project, among two types of alarms, according to the typology of signal: binary notices for level sensors in the different tanks, and announcements concerning the analogue temperature sensor and pH sensor, for which

it has set an upper limit and lower one involving a failure or risk at the plant.

Fig. 17 shows the two analogue variables, Ph level and temperature, depending on the time, when the system is on, and Fig. 18 shows when the system there is an emergency shutdown.

chemical treatment of flocculation and coagulation. Fig. 15 shows this treatment

**6.3 Prepared of the sewage treatment plant screen** 

Fig. 15. Prepared of Sewage Treatment Plant Screen

apart from the source, reflects the date and time.

reports the state of service, are defined the following:

messages to report this fact (see alert in Fig. 16).

**6.4 Warnings** 

**6.5 Histogram screen** 

Fig. 12. Menu of Main Screen Sewage Treatment Plant

Fig. 13. Main Screen Sewage Treatment Plant in status operation normal

Fig. 14. Main Screen Sewage Treatment Plant. Powered emergency shutdown
