Programmable logic controller-based automatic control for municipal wastewater treatment plant optimization

The treatment of industrial wastewater can effectively protect the water environment and maintain sustainable development. This paper introduces an incremental proportion and integration (IPI) control algorithm-based programmable logic controller (PLC) used to adjust the aeration tank’s dissolved oxygen content automatically in the wastewater treatment process. The control algorithm was improved by a back-propagation neural network (BP-NN). An instance analysis was carried out on a wastewater treatment plant in Zhejiang Province, China. This showed that the BP-NN improved control algorithm made the aeration tank’s dissolved oxygen content more stable at the set value than it was with manual adjustment and the conventional algorithm. The total nitrogen content in wastewater treated in the aeration tank under the control of the improved IPI algorithm was minimized and fluctuated least. The aeration tank blower’s power consumption was also at its lowest under the control of the improved IPI algorithm.


INTRODUCTION
Water, an important resource for human existence, is also an important production resource. As economies develop, the scale of industrial production expands and large amounts of industrial wastewater are produced (Kaczor et al. 2015). If the wastewater is discharged directly, pollutants will pollute other areas in the process of the natural water cycle (Sharma et al. 2016). Agricultural products that grow in polluted water can enrich the pollution, and the pollutants could eventually enter the human body through the food chain, with adverse effects on human health (Culhane et al. 2019). For economic development to be sustainable, pollutants in wastewater need to be treated before discharge to avoid pollution of the receiving environment or make it within that environment's self-treating capacity (Chen et al. 2018).
When factory wastewater is treated, it is a waste of human resources to control the processes by manual means alone, although it is more flexible. If the equipment operates for long periods to save staff resources, this might reduce human resource consumption but the long-term operation will reduce the equipment's service life and the cost may not be lower than that of the human resources. The equipment's additional energy consumption may also conflict with the concepts of energy-saving and emission reduction in sustainable development.
Automatic control systems are used to manage wastewater treatment equipment to reduce manual management costs and waste, so that the process is automated and unmanned. Dang et al. (2019) used a sequential batch reactor process, and edited the program in manual and automatic modes using a programmable logic controller (PLC) to achieve wastewater treatment. Zhang et al. (2018) proposed an adaptive setting control method of fuzzy proportion, integration and differentiation (PID) parameters for reaction tank aeration through a sequencing batch reactor (SBR). The results showed that the method was better than the conventional PID. Razak et al. (2018) used iminodiacetic acid (IDA) to modify red hemp fiber for use to remove divalent copper ions from wastewater.
In this study, an incremental proportion and integration (IPI) control algorithm modified by a backpropagation neural network (BP-NN) was used to control the dissolved oxygen content in a wastewater aeration tank automatically (Ozsoy et al. 2017). The work was done in Zhejiang Province, China.

Wastewater treatment
① (see Figure 1) Wastewater first passes through coarse and fine grids (Culhane et al. 2019), to remove insoluble and bulky items and/or suspended matter from the influent by physical means, which is beneficial in the subsequent processes. ② After initial screening, the wastewater needs to stand in the grit chamber for some time, to enable any remaining pollutant particles and/or suspended matter to settle out (Mintenig et al. 2017). ③ The wastewater is transferred to the aeration tank, the main purpose of which is to remove suspended matter and water-soluble degradable organic matter. A common method of treatment, applied in this study, is activated sludge, in which the sludge's microbial community degrades the organic matter. Air is introduced continuously into the tank to provide oxygen for the microorganisms and stir the tank's contents to improve degradation efficiency (Vialkova et al. 2020). ④ The effluent is transferred next to the sedimentation tank. The sludge and wastewater are mixed thoroughly in the aeration tank and, if the contents are discharged directly, the sludge will form part of the discharge. The sedimentation tank's main role is to precipitate the sludge and discharge it to the sludge storage tank, for return to the aeration tank (Dwivedi et al. 2020). ⑤ In the final stage, the treated wastewater is transferred to the disinfection tank after sedimentation. Although the sludge and wastewater are separated by sedimentation, some of the sludge microorganisms will inevitably remain in the liquid phase, which, if discharged directly, will very likely cause secondary pollution to the surrounding environment. The purpose of disinfection is to eliminate the residual microorganisms.

Automatic control by PLC
PLCs are common in automatic control systems (Rahayu et al. 2019). PLCs have effective applications in information collection and processing, system operation process control, and switch control (Park et al. 2019). The principle of PLC-based control of the dissolved oxygen (DO) content in an aeration tank is quite simple. The dissolved oxygen aeration tank's dissolved oxygen concentration is measured by the DO detector in real time and compared with the set (standard) value. The difference is transmitted to the PLC, where the control algorithm determines the adjustment instruction. The air volume from the blower is adjusted according to the PLC's instruction to modify the DO concentration in the aeration tank.
The IPI algorithm used in the PLC control system (Zheng et al. 2015) in this study is represented by Equation (1): where u(k), u(k À 1) are the blower airflow control parameters for this and the previous time, respectively, e(k), e(k À 1) the error signals for this and the previous time, respectively; that is, the difference between the actual and set aeration tank DO contents, and k p and k i proportional and integral parameters, respectively. When using the IPI algorithm to adjust the blower control parameters, the setting of the algorithm's proportional and integral parameters is very important. The traditional setting method is to set them initially on the basis of experience and then adjust them gradually. This is quite inflexible and, in a non-linear time-varying system like the aeration tank's DO content, when the environment changes, the fixed proportional and integral parameters will produce deviations that affect the control system's stability.
In this work, k p and k i in the IPI control equation were calculated by the BP-NN algorithm on the basis of the DO content's deviation, which means that k p and k i in the IPI control algorithm are made to produce adaptive changes related to the environmental changessee Figure 2.

EXAMPLE ANALYSIS Wastewater treatment plant overview
The wastewater treatment plant (WWTP) at which the work was done has been in operation for five years and is shown in Figure 3. It receives wastewater mainly from urban areas and uses the conventional process described above. Its treatment capacity was 110,000 tons/day but, to improve its performance, it was expanded and its capacity increased to 230,000 tons/day. Because of the low level of automation, operating costs and energy consumption increased significantly, and to reduce them, the PLC-based automatic control system was applied.

Experimental methods
Aeration tank-related parameters: After expansion, the WWTP has 12 aeration tanks, all with the same specifications. Each has a 250 kW blower and a DO detector (Barbosa et al. 2019). The minimum and maximum blower currents are 220 and 450 A, respectively. The DO content required is between 2.5 and 3.5 mg/L, so the standard value was set as 3.0 mg/L.
The aeration tanks were divided into three groups of four. One group was regulated manually. The second was regulated automatically by a PLC carrying the IPI control algorithm. The third was regulated automatically by a PLC with the BP-NN improved IPI algorithm.
For the manually regulated tank, staff tested the DO content every two hours and adjusted the blower air volume manually according to the DO contentthat is, increasing the blower air volume when the DO content was below the set value and lowering it when the DO content exceeded the set value.
For the tank with the IPI control algorithm, the desired DO content was set as 3.0 mg/L and the DO content was measured by the detector, and the difference between the actual and desired DO contents calculated in the PI control algorithm to determine the control parameters, which were then used to control the blower air volume. The values of k p and k i in the PI control algorithm were 5 and 2, respectively.
For the tank with the improved IPI control algorithm, the BP-NN was first trained with 1,000 samples. Every sample contained a DO deviation value and the most appropriate k p and k i corresponding to it. The difference in DO content was detected by the detector. The trained BP-NN calculated the k p and k i on the basis of the difference, and substituted them in the PI control algorithm, which was used to calculate the blower air volume control parameters.
The aeration tank test runs ran for 24 hours. The tanks' DO content was measured every hour and blower power consumption in each tank group was measured over the 24-hour test period. The test period started after tank operations had become stable; that is, after one hour.
The total nitrogen content in the effluent was also measured before and after aeration tank treatment, to compare the effect of the different DO content regulation methods. The influent to and effluent from the aeration tank groups were sampled every two hours, and the total nitrogen content measured by UV spectrophotometry.

Experimental results
The variation in DO content in the three aeration tanks groups over the 24-hour trial period is shown in Figure 4. The aeration tank DO control range was 2.5-3.5 mg/L, with 3.0 mg/L set as the desired value in the automatic control. As can be seen in Figure 4, the DO content in the manually controlled tank varied significantly and exceeded the required level many times. The DO content variation in the tank with IPI control was much less than that in the manually controlled tank, and did not exceed the control range, although there were periodic fluctuations.
The DO content in the tank with improved IPI control was more stable than that in the tank with basic IPI control, and the fluctuations were much smaller and around the desired value, 3.0 mg/L; that is, the control effect on DO content was good.
The same wastewater was diverted to all three aeration tank groups during the trial, so the influent's total nitrogen content as it entered the three tanks groups was virtually the same. On that basis the influent was sampled directly, before diversion. The total nitrogen content in the aeration tank group effluents was determined every two hours - Figure 5.
As can be seen in the figure, the total nitrogen content in the tank groups' influent was consistently about 35 mg-N/L. After treatment in the aeration tank groups, the nitrogen content in the effluent streams was reduced significantly by the activated sludge in them, regardless of the adjustment method. In relation to the three regulation methods, the total nitrogen content in the effluent from the manually controlled tank was the highest, fluctuating around 25 mg-N/L. Its fluctuation range was also the largest amongst the tank groups.
The total nitrogen content in the treated effluent from the tank with the IPI control algorithm was the second highest, fluctuating from about 20 to 21 mg-N/L, a relatively small range.
The effluent from the tank group with the improved IPI control algorithm always had the lowest nitrogen content of the three groups, around 14 mg/L, and the fluctuation range was also the smallest.
The use of automatic control to regulate DO in the aeration tanks was intended to save human resources and reduce energy consumption. The latter would be achieved by adjusting the blower airflow in a timely manner according to the actual DO content. Figure 6 shows the blower power consumption in the three aeration tank groups during the trial. The blower power consumptions were: Manual regulation 4,993 kWh IPI control 4,591 kWh, and Improved IPI control 4,026 kWh. Figure 6 shows that blower power consumption was highest in the manually regulated tanks, followed by the IPI control and the best was the improved IPI control. Manual blower air volume management is based on regular determination of DO content, and the monitoring frequency was two hours during which time blower air volume was kept constant. Little air was required to maintain the DO content's stability, so the energy consumed by providing the additional air was wasted, and the extra air destroyed the DO content's stability.
In the IPI controlled tank groupthat is, controlled automaticallythe blower air volume was adjusted according to DO content changes, avoiding wasting energy. The fixed values of k p and k i in the IPI control algorithm could not respond flexibly; however, to the changing DO content, so the air volume adjustment lagged and wasted energy.
The BP-NN improved IPI control algorithm in the third group of tanks adjusted k p and k i according to DO content changes, which improved the control algorithm's flexibility and reduced energy waste greatly.

CONCLUSION
This paper is about a PLC-controlled wastewater treatment process using an IPI control algorithm to adjust aeration tank DO content automatically. The IPI control algorithm was improved using a BP-NN.
In a parallel trail at a WWTP in Zhejiang Province, the DO content of the manually controlled aeration tanks fluctuated heavily and exceeded the required range. The DO content of the IPI-controlled tanks fluctuated much less but did not exceed the required range. The DO content of the tanks with the improved IPI control algorithm fluctuated least and remained very close to 3 mg/L throughout the trial.
After treatment in the aeration tanks, the total nitrogen contents in their treated effluent streams had all decreased significantly. The total nitrogen content in the effluent from the manually controlled aeration tank was highest and fluctuated most with time. That in the effluent from the IPI-controlled tanks was the second highest and fluctuated little. The total nitrogen content in the effluent from the tanks with the improved IPI control algorithm was the lowest and fluctuated least with time.
Blower power consumption in the manually controlled tanks was the highest, followed by those with IPI control and then those with the improved IPI control.

DATA AVAILABILITY STATEMENT
All relevant data are included in the paper or its Supplementary Information.