A supervisory fuzzy logic control scheme to improve ef ﬂ uent quality of a wastewater treatment plant

The application of control strategies in wastewater treatment plants has increased to improve its performance of treating the in ﬂ uent. Fuzzy Logic controller plays a vital role in this work and the simulation work is being carried out in Benchmark simulation model no.1 (BSM1) framework. The attempted work proposes two control schemes with the objectives of improving the ef ﬂ uent quality and minimizing the number of measurements taken from the plant. The design of fuzzy control schemes is based on 5 inputs and 6 outputs in order to accomplish the objectives. Experimental results show improvement in the ef ﬂ uent quality and increase in the ef ﬁ cacy of the control system. The proposed design is implemented using MATLAB with the adaptation of 2014a.


INTRODUCTION
Wastewater treatment includes numerous cycles and strategies which make a treatment plant with huge scale and complex framework. The wastewater treatment plant measures the water content by number of parameters specified in BSM1. Numerous dubious elements may influence the activity of wastewater treatment measure. Because of the multifaceted nature of wastewater treatment plant, traditional strategies indicated in the literature poses huge troubles when attempting to control them consequently.
Nowadays, the environment quality improvement system focuses wastewater treatment plant model with various controlling strategies. The wastewater treatment plants with anoxic tanks require distinctive cycles for controlling when compared to the fundamental air circulation based plant model. Some wastewater treatment plant doesn't have an anoxic tank separately; by cycling the air circulation blowers either to on or off condition, it might be expected to make an anoxic tank. This examines that cycling the blowers is done to decrease the power utilization. By all these concerns, the waste water treatments with fuzzy logic controllers on various applications are reviewed (Vijayaraghavan & Jayalakshmi 2015). Green house gas emission controlled with the fuzzy logic controller is presented in (Santin & Barbu 2018). Irrigation systems are controlled with fuzzy logic by volumetric water content (Rahim et al. 2020). To control the pH in the electro coagulation process system, fuzzy logic is used to improve its performance (Yavuz et al. 2015). Fuzzy based control scheme to control the aeration system is discussed in (Kalker et al. 1999).
In the Dissolved Oxygen examination, the nitrification process is a two-venture autotrophic cycling steps where ammonia is changed over to nitrite by smelling ammonia-oxidizing bacteria (AOB) and afterwards nitrite is oxidized to nitrate by nitrite-oxidizing bacteria (NOB). An analytical fuzzy predictive control scheme for a wastewater treatment plant is explained (Vallejo Llamas & Vega 2019). Riccardo (Boiocchi et al. 2017) discussed the effects of temperature and dissolved oxygen concentration in a benchmark model plant which tells the influence of the two parameters in AOB and NOB specific growth rates and effluent quality. The heterotrophic denitrification process comprises of micro organisms that converts nitrate to nitrogen gas (with nitrite, nitric oxide and nitrous oxide as intermediates). A fuzzy based model predictive control scheme is presented in (Satin et al. 2015) which help to reduce the effluent violation. Ammonia stripping process on industrial waste water treatment process is presented in (Kinidi et al. 2018).
The role of free ammonia (FA) is vital in the wastewater treatment plant. A review article on the effects of free ammonia (FA) in biological wastewater treatment processes was explained in (Liu et al. 2019). Many aeration control schemes based on ammonia measurement were developed. A neural network based ammonia control system is discussed in (Husin et al. 2019). The preliminary results of Ammonia-based aeration control (ABAC) in a full-scale wastewater treatment plant has shown significant savings on daily supplemental carbon usage for denitrification which resulted in decrease of aeration energy consumption and consistent removal of total nitrogen in the effluent (Kshitiz et al. 2015). Leiv Rieger discussed the case study on two control schemes based on ammonia measurement (Rieger et al. 2014). I.Santin (Satin et al. 2017) presented a cascade control strategy to minimize the nitrous oxide emissions and thereby maintaining a satisfactory trade-off between water quality and costs in Benchmark Simulation Model no. 2 Gas.
A new integral indicator for performance evaluation was discussed in  which consider water quality, operational cost and greenhouse gas emissions to capture overall performance of the wastewater treatment plant. Wei (Wei et al. 2020) presented a disturbance rejection control strategy to minimize the effects of large perturbations (dynamic influent rate, varying temperature and complex biological reactions) in benchmark simulation model number 1. Various studies on different WWTPs are reported in the literature. An investigation report on the impact of temperature control loops in a textile wastewater treatment plant (electro-coagulation system) using a fuzzy logic control algorithm is presented in (Demirci & Ozbeyaz 2019). A study was conducted to control the nitrification process in a wastewater treatment setup in order to reduce the operation cost in (Burnashova et al. 2018). Here (Sivaraman et al. 2001) an interesting two-stage biological treatment system is discussed for ammonium-nitrate-laden wastewater which improved the concentration of denitrifying organisms in the first stage, and population of denitrifying, nitrifying and algal micro organisms in the second stage. Edgar (Sanchez et al. 2010) presented the automation of an activated sludge wastewater treatment plant with different control strategies, Proportional Integral (PI), Fuzzy PI and PI Logarithm/Antilogarithm (PI L/A). Revollar et al. (Revollar et al. 2020) presented a cascaded control system that uses N/E (ratio of nitrogenated compounds eliminated and energy spent) index to optimize the plant (BSM2) efficiency. An enhanced non-linear PI control scheme for a BSM1 plant is discussed in (Samsudin et al. 2014). Also (Vilanova et al. 2009) explained the use of multi-loop PI control scheme and its tuning in a non-linear activated sludge model of a wastewater treatment plant. Hongbin et al. (Hongbin et al. 2020) demonstrated the performance of fuzzy partial least squared based dynamic Bayesian networks in modelling an industrial WWTP. Hong-Jun (Xiang et al. 2019) explained the design and simulation of new type of reactor based on discharge plasma in treating the industrial organic wastewater.
Major contribution of this work is to arrest the violation of effluent nitrogen impurities, improve the effluent quality and minimize the aeration energy usage. In this proposed approach, two control schemes have been implemented and compared with the default control scheme (Scheme1) as mentioned in the BSM1. The proposed control approaches are Ammonia Control Scheme (Scheme2) and Ammonia & Total Nitrogen Control Scheme (Scheme3). This paper is summarized as follows. Section II presents the description of the plant model. Proposed control strategy is explained in section III. Experimental results are discussed in section IV and the conclusion of the proposed work is presented in section V.

BSM1 PLANT
The BSM1 is a simulation environment defining a plant layout, a simulation model, influent loads, test procedures and evaluation criteria. The schematic of BSM1 is presented in Figure 1. The benchmark plant is composed of five activated sludge reactor with two anoxic tanks (1,000 m 3 ) followed by three aerobic tanks (1,333 m 3 each). A secondary settler (6,000 m 3 ) follows the activated sludge reactors and is modeled as ten layers with the height of 0.4 m and area of 1,500 m 2 .
Here the five tank model design involves biological reactive processing and controlling. The ammonia present in the influent is oxidized in the aerobic reactors (tank 3, tank 4 and tank 5). The nitrate generated in the aerobic tanks is circulated back to anoxic reactors (tank 1 and tank 2) where the heterogeneous micro organisms convert it to nitrogen and oxygen. The suspended particles settle in the secondary settler before the effluent is discharged.

Evaluation criteria
A simulation protocol is established to ensure that the results are obtained under the same conditions so that it can be compared across the control strategies. In this paper, the evaluation must include the percentage of time that the effluent parameters exceeding the limits (Table 1).
The effluent concentrations of total nitrogen (N tot ), total Chemical oxygen demand (COD t ), ammonia (S NH,e ), Total suspended solids (TSS) and Biochemical Oxygen Demand (BOD 5 ) during 5 days should obey the limits given in Table 1. N tot is calculated as the sum of S NO and S NKj , where S NKj is the Kjeldahl Nitrogen concentration, which is the sum of organic nitrogen and S NH present in the effluent.
Effluent Quality Index (EQI) is a parameter to calculate the quality of effluent and defined as in (1). The external carbon measurement is given as, Aeration energy (AE) and Pumping Energy (PE) are calculated as:

PROPOSED METHODOLOGY
The proposed scheme focuses the design of fuzzy logic control dependent on the plant conditions. Based on the knowledge obtained from the open loop simulation results of BSM1, fuzzy rules are formulated. The membership function values of input and output are adjusted by trial and error method in order to bring the best results. The designed FLC provides set points to the PI controllers and also manipulates other important flows which are explained in the coming sections. The fuzzy centroid model on the defuzzyfication is given by, The conventional PI controllers are implemented to control DO concentration in the aerobic reactors. Three PI controllers are implemented to maintain the DO concentration in the aerobic tanks. The IMC based tuning mechanism is followed to design the PI controller parameters. PI controller for tank 3 and tank 4 are tuned at K p ¼ 121 and T i ¼ 0.363. The PI controller parameter for tank 5 is designed with K p ¼ 39 and T i ¼ 0.253. The PI controllers manipulate K L a (0-360 day À1 ).

Ammonia control scheme
The ammonia control is shown in Figure 2. Totally, three FLCs along with two PI controllers are implemented to keep the effluent ammonia within the limit. Two Fuzzy blocks (Fuzzy1 and Fuzzy2) act as a supervisory controller to provide set point to the PI controllers (PI 1 , PI 2 , PI 3 ). The dissolved oxygen concentration (S O,3 , S O,4 & S O,5 ) in Aerobic tanks 3, 4, 5 are maintained as per the set points provided by the fuzzy blocks. The manipulated variable of the PI controller is oxygen transfer coefficient (K La3 , K La4 & K La5 ). Separate DO measurements for Uncorrected Proof individual aerobic tanks are made. One more FLC (Fuzzy3) is implemented to control the internal re-circulation flowrate, Q a .
The conventional PI controllers maintain DO in the aerobic tanks to oxidize the ammonia to a level as mentioned in the BSM1 model. In order to minimize the number of measurement, S NH,3 is measured, its slope is calculated and its maximum positive value is determined. When the slope is negative, chosen value is one. The product of measured S NH,3 and its slope is given as the input to Fuzzy1. The set point generated by the Fuzzy1 is then given to two PI controllers (tank 3 & tank 4). The fuzzy input is classified to five regions and triangular membership function is used. The fuzzy output is defuzzified using the Centroid method.
The increase in inlet ammonia means it has to be oxidized more in the aerobic tanks. Here this S NH increment additionally brings the requirement of more DO to be maintained in the aerobic tanks. So that the increased S NH is oxidized and accordingly more S NO is produced. The fuzzy rules are created based on the above understanding. When the inlet ammonia is increased, then set points to the PI controllers (tank 3 & tank 4) are made high. The decrease in inlet ammonia will reduces the set point of DO in tank 3 and tank 4.
The dissolved oxygen in tank 5 has to be maintained at 2 gN/m 3 as mentioned in BSM1. This ensures proper denitrification in anoxic tanks and sufficient DO in the effluent. While trying to maintain the DO at 2 g/m 3 in tank 5, the effluent ammonia crossed the acceptable limit of 4 gN/m 3 . So the DO level is maintained at around 2 (1.5-2.2). By varying the DO in tank 5, reduction of aeration energy is also obtained. So, another FLC is implemented to provide set point to PI controller in tank 5. This FLC takes the ammonia concentration of tank 4 (S NH,4 ) as input and manipulates the set point.
The oxidation of ammonia in aerobic tanks depends on the hydraulic retention time. For effective oxidation of the excess ammonia, the internal recirculation flow Q a is adjusted. One more FLC is designed to accept the S NH,3 as input and Q a as output. Five triangular membership functions fuzzify the input value and five triangular membership functions are designed to defuzzify the output. When the inlet ammonia to the aerobic tank is high, FLC sets Q a to low. This action will ensure more retention time. After the inlet ammonia is oxidized to nitrate and when the inlet ammonia is low, then FLC increases Q a to high value. This will ensure two purposes. One is the denitrification process will improve in anoxic tanks and the other is the decrease in effluent nitrogen concentration.
The re-circulated activated sludge (RAS) flow, Q r has to be maintained at a proper level to ensure effective function of microbes in anoxic and aerobic reactors. To achieve this, Q r is set to 32,000 m 3 /d and Q w (wastage sludge flow rate) is fixed at 385 m 3 /d.

Ammonia & total nitrogen control scheme
The Ammonia control scheme minimized the effluent ammonia content and kept it under the limit. But the nitrate generated during the oxidation of ammonia lead to the increase of total nitrogen in the effluent and exceeded the acceptable limit. So Ammonia & Total Nitrogen control scheme is demanded and discussed here.
The proposed scheme to control ammonia and total nitrogen in the effluent is shown in Figure 3. In this control scheme, two Fuzzy Logic Controllers provide the set point to Dissolved Oxygen Controllers in (Aerobic) tanks 3,  In the proposed method, only five measurements are taken to decide the control actions. The control logic in aerobic tanks and Q a are similar to Ammonia control scheme. In addition to that, two more FLCs are implemented to manipulate Q r & q EC1 . Both FLCs take S NH,3 as their input.
The high inflow of inlet ammonia will increase oxidation rate in the aerobic reactors which results in the increase of nitrate concentration. The concentration of heterogeneous microbes needs to be maintained high to perform the denitrification process in anoxic reactors effectively. To achieve this, a FLC is designed to manipulate Q r based on S NH,3 . When S NH,3 is high, Q r is increased. When S NH,3 is low, Q r is decreased. The input and output are classified in to five regions using triangular membership functions. FLC varies Q r between 18,446 to 36,892 m 3 /d.
The addition of external carbon source q EC1 in tank1catalyze the heterogeneous organisms in anoxic reactors to perform de-nitrification process effectively. So one more FLC is implemented to manipulate q EC1 . The nitrification process in aerobic reactors increases the nitrate concentration. After the decrease of ammonia in aerobic tanks, the increase in nitrate is observed. When S NH,3 is high, FLC decreases q EC1 . When S NH,3 is low, q EC1 is increased. The input and output are classified in to three regions using triangular membership functions. FLC manipulates q EC1 between 0 and 5 m 3 /d.

RESULTS AND DISCUSSION
The plant was simulated for 150 days to achieve quasi steady state with constant input. Then dry weather data is used to simulate the closed loop dynamics of the plant for 14 days. This sets up the plant for dynamic benchmark simulation. The result of this simulation was used as the initial values for the actual plant performance calculations using a dynamic input file (dry weather profile).
The plant is simulated with PI controller (as mentioned in BSM1) and with the proposed fuzzy method. The results are compared based on the evaluation criteria as described in section 3. The obtained results are sampled at every 15 minutes for integration between measurements. Some of the evaluation parameters considered for comparison are ammonia concentration, DO concentration and oxygen transfer coefficient in each aerobic reactor, effluent ammonia (S NH,e ) concentration and total nitrogen (N tot ) concentration of the effluent.

Ammonia control scheme
The primary objective of this control scheme is to keep the effluent ammonia (S NH,e ) within the limit of 4 gN/m 3 . The evolution of S NH,3 , S NO,3 and K L a 3 for the three control schemes are presented in Figure 4. The comparison results are taken for the duration of 2.5 days. During this period (between 7.5th day and 9.5th day), the influent to the wastewater treatment plant is high. The high inflow influent is rich in ammonia and nitrate concentration.
The increase in inlet ammonia has to be oxidized to control the violation of effluent ammonia. In ammonia control scheme, FLC increased the set point level of DO in the aerobic tanks. Taking the product of S NH,3 and its slope as input, Fuzzy1 quickly increased the set point in tank 3 and tank4. Also Fuzzy2 sensed the increase in ammonia level of tank4 and increased the set point of DO in tank5.

Uncorrected Proof
The PI controllers in the aerobic tanks followed the set points provided by the Fuzzy1 and Fuzzy2. The K L a 3 , K L a 4 & K L a 5 has increased and as a result DO level in the aerobic tanks are also increased. This phenomenon is observed in Figures 4-6. Whereas the default control scheme has kept K La3 and K La4 at the constant value of 240 d À1 which is not sufficient to oxidize the incoming ammonia.
The high level of S O,3 , S O , 4 and S O,5 has oxidized the inlet ammonia in the tanks 3, 4, 5. This is observed in the decrease of S NH,3 , S NH,4 & S NH,5 in the aerobic tanks. The oxidation of ammonia can be effective when the hydraulic retention time is more. So during this period, Q a is kept low as shown in Figure 7. In case of the default control scheme, the value of Q a is high during the period of high influent flow. So the retention time is less which resulted in less oxidation of ammonia and effluent ammonia crossed the limit.
The Figure 7 presents the evolution of S NH,e , N tot for the three control schemes. The efficacy of the ammonia control scheme can be seen in this duration which kept the effluent ammonia within the limit. In scheme1, the effluent ammonia crossed the threshold. Also, the effluent total nitrogen has crossed the maximum allowable limit (18 gN/m 3 ) in scheme1 and in scheme2. This has given rise to Ammonia and Total Nitrogen Control Scheme (Scheme3). Table 2 presents the quantitative analysis of the three control schemes. There is no violation in the effluent ammonia in scheme2. Whereas in scheme1, violation has occurred for the period i.e. 16.50% of the total evaluation period. Consumption of aeration energy in scheme1 and scheme2 are 3,697.6 kWh/d and 3,464.5 kWh/d. In scheme2, 233.1 kWh/d of aeration energy is saved per day which leads to the improvement of 6.3% when compared with scheme1. There is an increase in the usage of pumping energy (298 kWh/d) in scheme2. This increase is due to the pumping of more Q a to Anoxic tanks in order to improve the effluent quality. Though the pumping energy (PE) is increased in scheme2, the effluent quality has significantly improved. EQI is observed as 5,770.8 kg-pollutant/d which is improved to 5.6% in comparison with scheme1.

Ammonia and total nitrogen control scheme
The main objective of this scheme is to keep the effluent ammonia and total nitrogen concentration of the effluent within the acceptable limit. Here, the control strategy for effluent ammonia control is similar to scheme2. In addition to this, Q r is manipulated by Fuzzy4. Whereas in scheme2, Q r is kept at 32,000 m3 /d. Figure 7 shows the evolution of Q r . When S NH,3 is high, Fuzzy4 increased Q r to support ammonia oxidation in aerobic tanks. When ammonia load is less, Fuzzy4 decreased Q r which leads to the reduction of pumping energy. This is the advantage of Fuzzy4 in this scheme.
The total nitrogen concentration in the effluent can be minimized by reducing the nitrate concentration in anoxic tanks. To achieve this, Fuzzy5 is implemented to manipulate q EC1 . This is done with the idea of maximizing the consumption of generated nitrate in anoxic tanks by heterotrophic micro organisms. Thus the nitrate concentration in the plant is reduced and kept the total nitrogen under the maximum limit as shown in Figure 8.
The addition of q EC1 has lead to another problem of increase in consumption of aeration energy. This is due to the fact that the additional carbon has demanded extra dissolved oxygen to oxidize it in the aerobic tanks. This phenomenon can be observed with the increase of K L a 3 , K L a 4 & K L a 5 as depicted in Figures 4-7.
The efficacy of this control scheme is presented quantitatively in Table 2. Though the AE and PE are consumed more in this scheme, the effluent quality is impressive. When compared with scheme1, effluent quality of scheme2 is improved by 5.6% and scheme3 is improved by 20.3% respectively. Table 3 represents the effluent parameters resulted from this control scheme. All the parameters are well within the maximum limit.

CONCLUSION AND FUTURE WORK
This paper has presented the implementation of two control schemes (Scheme2 and Scheme3) with the objective of avoiding the violation of S NH,e and N tot . Three PI controllers were implemented to track the set point provided by the fuzzy controllers. Scheme2 kept S NH,e within in the limit and improved the aeration energy usage (6.3%) when compared to scheme1. Though, additional 298 kWh/d of pumping energy is consumed in scheme2, the Uncorrected Proof effluent quality is improved by 5.6%. Scheme2 did not keep the total nitrogen concentration in the effluent under the control limit. The control scheme3 avoided the violation of S NH,e and N tot . With the small increase in energy, significant improvement (20.3% against scheme1 and 15.57% against scheme2) in the effluent quality is achieved. Thus the proposed scheme3 has provided good results and more benefits in the waste water treatment processes. In future, the work may be extended with the neural network model based controlling scheme to improve the effluent quality and to reduce the electrical energy consumption.

DATA AVAILABILITY STATEMENT
All relevant data are available from an online repository or repositories.  Uncorrected Proof