Global Internal Recirculation Alternative Operation to Reduce Nitrogen and Ammonia Limit Violations and Pumping Energy Costs in Wastewater Treatment Plants

: The internal recirculation plays an important role in different areas of the biological treatment of wastewater treatment plants because it has a great inﬂuence on the concentration of pollutants, especially nutrients. A usual manipulation of the internal recirculation ﬂow rate is based on the target of controlling the nitrate concentration in the last anoxic tank. This work proposes an alternative for the manipulation of the internal recirculation ﬂow rate instead of nitrate control, with the objective of avoiding limit violations of nitrogen and ammonia concentrations and reducing operational costs. A fuzzy controller is proposed to achieve it based on the effects of the internal recirculation ﬂow rate in different areas of the biological treatment. The proposed manipulation of the internal recirculation ﬂow rate is compared to the application of the usual nitrate control in an already established and published operation strategy by using the internationally known benchmark simulation model no. 2 as a working scenario. The results show improvements with reductions of 59.40% in ammonia limit violations, 2.35% in total nitrogen limit violations, and 38% in pumping energy costs.


Introduction
The objective of Wastewater Treatment Plants (WWTPs) is to reduce pollution before water reaches the receiving environment. Specifically, the pollutant concentrations that must be under the established limits are: Total Suspended Solids (TSS), organic matter measured by Biochemical Oxygen Demand in five days (BOD 5 ) and Chemical Oxygen Demand (COD), Total Nitrogen (S Ntot ), phosphorous, and ammonium and ammonia nitrogen (S NH ). Among these pollutants, nutrients (phosphorous and S Ntot ) and S NH are the most difficult to keep under the established limits. Due to this reason, it is usual the application of control strategies in WWTPs with the objective of reducing the concentrations of these pollutants.
Nutrients can cause eutrophication and S NH , in addition to containing nitrogen, is toxic to the aquatic life. Given the importance of keeping pollutant concentrations under the established limits at the lowest possible operational costs, several research works have been published in recent years focusing on the application of control strategies in WWTPs.
Although the mentioned problem of excess nutrients in the water is of great importance, the law may not limit their concentration if the receiving environmental is not considered sensitive. In these cases, the WWTPs do not apply nutrient control. If nitrogen control is necessary for its reduction, the internal recirculation flow rate (Q a ) in the biological treatment is one of the possible variables that can be manipulated, although keeping it fixed is also a usual option, as in [1][2][3]. Other works, as [4,5], apply optimization techniques to manipulate both, dissolved oxygen (S O ) and Q a . However, the most usual control strategy applied to manipulate Q a , instead of keeping it fixed, is the control of nitrate (S NO ) in the last anoxic tank, as in [6][7][8].
Many of the published articles dealing with the application of control strategies in WWTPs use simulation models to test them. Specifically, the Benchmark Simulation Model no. 1 (BSM1) is an internationally known simulation model, developed by the International Association on Water Pollution Research and Control ( [9,10]), which is frequently used. The proposed work uses the Benchmark Simulation Model no. 2 (BSM2) ( [11]) as working scenario, which is an extension of BSM1.
The present work proposes an alternative for the manipulation of Q a with a broader approach to the effects of Q a in the biological treatment. A fuzzy controller is applied for the proposed manipulation due to the importance of a great knowledge of the dynamics of the variables of the plant. The effects of the Q a variations in nitrogen and ammonia concentrations and operational costs are analysed and compared to those of the S NO control.
The paper is organised as follows. First, BSM2 is presented. Next, the proposed fuzzy control design is explained. Afterward, the simulation results are shown, as well as the discussion about them. Finally, the most important conclusions are drawn.

Methodology
The proposed control technique in this work is tested by using the international known BSM2 ( [12]) as working scenario, which was updated by [13]. The proposed fuzzy controller has been assessed on the basis of an already published operation strategy ( [8]), just replacing the Q a manipulation and comparing the results with those of the original strategy. Thus, it will be possible to see the effects of changing the way the internal recirculation is operating.
Both BSM2 and the operation strategy applied in [8] are explained below.

Benchmark Simulation Model No. 2
BSM2 includes a primary treatment, a secondary treatment and a sludge treatment ( Figure 1). The primary treatment consists of a primary clarifier, where some sludge is decanted by gravity and conducted to be treated. The secondary treatment is composed of five activated sludge reactors, where the biological treatment is carried out, and a secondary clarifier. The first two reactors are anoxic and the next three aerobic. Some decanted sludge in the secondary clarifier is treated and the rest is recirculated to feed the biological treatment. In the sludge treatment there is a thickener to increase the solid content of sludge by removing a portion of the liquid fraction, an anaerobic digester to break down organic matter into biogas and digestate, and a dewatering to remove excess of water. This water is recycled to the primary clarifier through a storage tank to regulate the amount of water.
The present work is focused on the secondary treatment and specifically on the biological treatment. The objective of this treatment in WWTPs is to reduce organic matter and nutrients. Phosphorus can be removed biologically or by chemical precipitation, but it is not considered in this model. As mentioned before, the biological treatment of BSM2 is composed of five activated sludge reactors. The first two reactors are anoxic (no oxygen is added), but they contain oxygen in the form of S NO . Here, heterotrophic bacteria degrade organic matter and consume oxygen. As no oxygen is added, the oxygen of S NO is consumed, reducing S NO to nitrogen gas, which is called denitrification process. The next three reactors are aerobic. In these reactors, heterotrophic bacteria also degrade organic matter, but in this case they consume the oxygen added by the blowers. This oxygen is also consumed by autotrophic bacteria, oxidizing S NH to S NO , which is called nitrification process. As there is no S NO at the entrance of the biological treatment, there is an internal recirculation from the last aerobic reactor to the first anoxic reactor. The present work is focused on the flow rate regulation of this internal recirculation.

Activated Sludge Reactors
Anoxic Aerobic BSM2 includes 609 days of influent data, including periods of dry, rainy and storm weather and temperature (T as ) variations. The last year is evaluated. The average dry weather flow rate is 20,648.36 m 3 /d and the average COD is 592.53 mg/L. The volume of each anoxic tank is 1500 m 3 and that of each aerobic tank 3000 m 3 . The hydraulic retention time of the biological treatment is 14 h.
The pumping energy is calculated as: where T is the total time, Q r is the external recycle flow rate, Q w is the wastage flow rate from the secondary clarifier, Q pu is the underflow rate from the primary clarifier, Q tu is the underflow rate from the thickener and Q do is the underflow rate from the dewatering. The limits established for S Ntot in the effluent (S Ntot,e ) and S NH in the effluent (S NH,e ) are 18 mg/L and 4 mg/L, respectively.
The Activated Sludge Model No. 1 (ASM1) [14] describes the processes of the biological reactors. They define the conversion rates of the different variables of the biological treatment. The design of the proposed fuzzy controller is based on the conversion rates of S NH (r S NH ) and S NO (r S NO ), which are shown below: where ρ 1 , ρ 2 , ρ 3 , ρ 6 are four of the eight biological processes defined in ASM1. Specifically, ρ 1 is the aerobic growth of heterotrophs, ρ 2 is the anoxic growth of heterotrophs, ρ 3 is the aerobic growth of autotrophs and ρ 6 is the ammonification of soluble organic nitrogen. They are defined below: where S S is the readily biodegradable substrate and µ HT is: where X B,A is the active autotrophic biomass and µ AT is: where S ND is the soluble biodegradable organic nitrogen and k aT is: The general equations for mass balancing are: • For reactor 1: where Z is any concentration of the process, Z 1 is Z in the first reactor, Z a is Z in the internal recirculation, Z r is Z in the external recirculation, Z po is Z from the primary clarifier, V is the volume, V 1 is V in the first reactor, Q po is the overflow of the primary clarifier and Q 1 is the flow rate in the first tank and it is equal to the sum of Q a , Q r and Q po .

•
For reactor 2 to 5: where k is the number of reactor and Q k is equal to Q k−1

Operation Strategy Used for Testing
The control strategy applied in [8] is shown in Figure 2a. The S O of the aerated reactors is controlled by two Model Predictive Controllers (MPC) with feedforward compensation of the flow rate from the primary clarifier. One MPC controls the S O in the fourth reactor (S O,4 ) set-point by manipulating the oxygen transfer coefficient (K L a) of the third reactor (K L a 3 ) and fourth reactor (K L a 4 ). The other MPC controls S O in the fifth reactor (S O,5 ) set-point by manipulating K L a of the fifth reactor (K L a 5 ). The variation of S O set-points is a better option than keeping them fixed in terms of effluent quality and operational costs, as shown in ( [15]. In this control strategy, a fuzzy controller is applied to manipulate S O,4 and S O,5 set-points based on S NH,5 . Finally, another MPC with feedforward compensation manipulates Q a to control S NO in the second reactor (S NO,2 ) at the set-point of 1 mg/L (Q a _Man_MPC).

Fuzzy Controller Design
A fuzzy controller is proposed in this work for Q a manipulation. Fuzzy logic can be applied as a control technique, relating measured variables (inputs) and manipulated variables (outputs), based on human expertise about the plant to be controlled. Using fuzzy logic, the controller's input values are converted into words by means of membership functions. These words are used in the established rules that relate the variables of the inputs and outputs of the controller. Subsequently, the words of the outputs are converted into values also by membership functions, which are the resulting values of the manipulated variables.
The principle of fuzzy logic, the design of the proposed fuzzy controller and its application are described below.

Fuzzy Logic
The fuzzy control is based on the practical knowledge acquired with the operation of the systems. This knowledge is determined by words and expressions and not, as in traditional logic, by numbers and equations. In fact, this does not mean at all that knowledge of the process dynamics is not needed. Good knowledge of the dynamic behaviour of the controlled plant is to be available to the designer. The architecture of a fuzzy controller consists of a fuzzifier, a fuzzy rule base, an inference engine and a defuzzifier ( [16,17]).
As the variables are measured in numbers, a fuzzifier is used to convert the inputs into suitable linguistic values, granting them a relative membership degree and not strict. Conversely, a defuzzifier is used to transform the outputs from linguistic values into measured variables. The configuration of a fuzzifier and a defuzzifier implies the selection of the type of membership function, the number of membership functions and the definition of the range of input and output values. The fuzzy rule base is a set of i f -then rules that store the empirical knowledge of the experts about the operation of the process. The fuzzy logic computes the grade of membership of each i f condition of a rule and aggregates the partial results of each condition using fuzzy set operator. The inference engine combines the results of the different rules to determine the actions to be carried out, and the defuzzifier converts the control actions of the inference engine into numerical variables, determining the final control action that is applied to the plant. There are two different methods to operate these modules: Mamdani ([18]) and Sugeno ( [19]). Mamdani system aggregates the area determined by each rule and the output is determined by the centre of gravity of that area. In a Sugeno system the results of the i f -then rules are already numbers determined by numerical functions of the input variables and therefore no deffuzifier is necessary. The output is determined weighting the results given by each rule with the values given by the i f conditions.
Readers can find further information about fuzzy control in standard references such as [20]. The FIS (FIS: Fuzzy Inference System) Editor from Matlab is used for the implementation of the proposed fuzzy controller.

Proposed Fuzzy Controller for Q a Manipulation
A fuzzy controller is proposed in this work because the Q a manipulation is based on an exhaustive knowledge of its effects on the different areas of the biological treatment.
The most important relationships between the inputs and output are explained below: • S NH in the fifth reactor (S NH,5 ) is always lower than S NH in the influent (S NH,in ) due to the nitrification process. On the other side, there is no S NO in the influent, but there is S NO in the fifth reactor (S NO,5 ). Therefore, an increase of Q a dilutes S NH at the entrance of the first reactor (S NH,0 ) and S NO at the entrance of the first reactor (S NO,0 ) is increased (13) and (14). However, S NO is subsequently reduced in the denitrification process. Consequently, Q a manipulation is related to S NH,in , and Q a is increased when S NH,in is higher to dilute S NH,0 , and Q a is decreased when S NH,in is lower because dilution is not necessary and lower Q a results in operational cost savings and improvements in the nitrification and denitrification processes (12). However, this Q a reduction is always restricted by S NH,0 to have a minimum S NH dilution.
• Q a manipulation influences the Hydraulic Retention Time (HRT), increasing it when Q a is lower.
On the other side, during the biological process, substrate is biodegraded by heterotrophic bacteria, and therefore the Q a reduction increases substrate in the biological process. Hence, increases of HRT and substrate improve the denitrification process, reducing S NO (3), (6) and (12), However, HRT increases also improve the nitrification process, which can cause a S NO increase a little later, but it also depends on S O . Therefore, Q a is decreased when S NO,5 increases to improve the denitrification process, but not excessively so as not to generate too much S NO,5 in the nitrification process. The best option to avoid S Ntot limit violations is to reduce Q a just at the S NO,5 peak.

•
The nitrification and denitrification processes depends on T as , since they work worse when T as is lower (2), (3) and (5)- (8). Therefore, Q a values are higher when T as is lower to increase S NH,0 dilution, and, inversely, Q a is lower when T as is higher to decrease pumping energy costs. • Any rule that increases Q a is always restricted by S NH,5 , since if it increases to near the established limit Q a is reduced to improve the nitrification process and thus oxidize more S NH .
The resulting fuzzy controller consist of 30 rules based on the Q a effects on the biological treatment. It has 6 inputs and 1 output. The inputs are S NH,in , S NH,0 , S NH,5 , S NO,5 , T as and influent flow rate (Q in ) and the output is Q a . Mamdani ([18]) is the method of inference. T as has two membership functions: "low" and "high" (Figure 3e) and the rest of inputs have three membership functions: "low", "medium" and "high" (Figure 3a-d,f). The Q a output has six membership functions: "very_low", "low", "medium_low", "medium", "high" and "very_high" (Figure 3g).      Figure 2b shows the proposed application of the fuzzy controller for Q a manipulation in the operation strategy of [8] (Q a _Man_Fuzzy). The S O control in the aerated reactors is kept and only the MPC that controls S NO,2 by manipulating Q a is replaced by the proposed fuzzy controller. In this way, the proposed fuzzy controller for Q a manipulation is tested in an already established and published operation strategy and compared with a usual Q a manipulation based on S NO,2 control. The objective is not only to compare the achieved results, but also to analyse and compare the different effects of Q a variations on pollutants concentrations and costs.

Simulation Results and Discussion
In this section, simulation results of the operation strategy applied in [8] with Q a _Man_MPC (Figure 2a) and Q a _Man_Fuzzy (Figure 2b) are compared and discussed, analysing the evolution over time of the most important variables. Table 1 shows the simulation results of the percentage of time of S Ntot,e and S NH,e limit violations and the pumping energy consumption with Q a _Man_MPC Q a _Man_Fuzzy. Among these results, the reductions of 59.40% in S NH,e limit violations and 38% in pumping energy by Q a _Man_Fuzzy are remarkable. These improvements do not result in a deterioration of the percentage of time of S Ntot,e limit violations, since it is similar with both Q a manipulations and even with a 2.35% improvement with Q a _Man_Fuzzy.
As there is no S NO at the entrance of the biological treatment, but there is at the output, the Q a manipulation based on S NO,2 control increases Q a when S NO,5 is lower to increase S NO,2 to the set-point of 1 mg/L.The main disadvantage of the S NO,2 control is that this fact increases pumping energy consumption too much, specially at high T as , when the nitrification and denitrification processes improve and less dilution is necessary. This can be observed in Figure 4, which shows the results of a week simulation in summer. The difference in Q a values between Q a _Man_MPC and Q a _Man_Fuzzy is very large when S NH and S Ntot are lower enough than the established limits. In addition, in this specific control technic, MPC achieves a satisfactory S NO,2 tracking, but some abrupt Q a increases, due to its high gain, result in S NH,5 increases that reach values over the established limits in some cases, such as on days 589 and 590. Figure 5 shows the day 559, in which a high rain event takes place. When it happens, the Q in increase results in a HRT reduction, worsening the nitrification and denitrification processes, and consequently S NO and S NH increase. As a result of this S NO increase, Q a _Man_MPC reduces Q a to try to keep S NO, 2 at the set-point of 1 mg/L. Then, there is an important difference between Q a _Man_Fuzzy and Q a _Man_MPC between the times 559.3 and 559.4 since when there is a S NH,in increase, Q a _Man_Fuzzy increases Q a , but Q a _Man_MPC keeps a low Q a value. This fact results in an important difference in the S NH,0 dilution. When the S NH peak reaches the aerated reactors, detected by the S NH,5 input, Q a _Man_Fuzzy reduces Q a to similar levels of Q a _Man_MPC to improve the nitrification process. As can be observed between the times 559.4 and 559.5, the S NH limit violation is avoided with Q a _Man_Fuzzy but not with Q a _Man_MPC, which is mainly due to the previous S NH dilution. This fact also produces a slight reduction of the S NO,5 peak and therefore of the S Ntot,e peak, although the S Ntot,e limit violation is not avoided. A greater S NO,5 peak reduction could be achieved if Q a is reduced later, when S NO,5 is higher, but this Q a manipulation would not avoid the S NH,e limit violation.
A similar case happens on day 599, as shown in Figure 6. Q a _Man_MPC decreases Q a too much when there is rain event, while Q a _Man_Fuzzy increases Q a when S NH,in increases, resulting in a significant difference in S NH,0 dilution, specially between the times 599.3 and 599.4. In this case, the S Ntot,e limit violation is avoided with Q a _Man_Fuzzy. Figure 7 shows a week simulation in winter, when T as is lower. There is no significant difference in the Q a values between Q a _Man_MPC and Q a _Man_Fuzzy, only in specific short time periods . Therefore, the pumping energy savings of Q a _Man_Fuzzy in comparison with Q a _Man_MPC are mainly achieved with higher T as . It can be observed that with dry weather and low T as the Q a variations are similar with both applications. However, the Q a increase with Q a _Man_MPC coincides with a S NH,in increase, but is due to a S NO,2 decrease caused for a previous S NH,in decrease, while Q a _Man_Fuzzy increases Q a due specifically to a S NH,in increase. In the case of an influent with low S NH,in values during a longer period, applying Q a _Man_MPC could result in a larger and unnecessary Q a increase without coinciding with a S NH,in increase, as in the similar case of the summer period ( Figure 4). On the other hand, the Q a reduction is due to the S NO increase with both Q a manipulations, even though Q a _Man_MPC does not take into account the S NH,5 increase, while Q a _Man_Fuzzy does. This fact explains the similar percentage of time of S Ntot,e limit violations with both Q a manipulations and the improvement of S NH,e limit violations by applying Q a _Man_Fuzzy.    Figure 7. Time evolution of Q in , S NH,in , S NH,0 , S NO,5 , S NH,5 , S Ntot,e and Q a during one week in winter with Q a _Man_MPC and Q a _Man_Fuzzy.

Conclusions
An alternative for Q a manipulation in the biological wastewater treatment by a fuzzy controller has been proposed instead of the usual S NO,2 control. Both Q a manipulations has been tested and compared applying them in an already published operation strategy, obtaining the following conclusions: • Q a _Man_Fuzzy takes into account S NH,5 values for Q a manipulation, but Q a _Man_MPC is based only on S NO values. This fact added to the abrupt Q a variations with Q a _Man_MPC results in a 59.40% reduction of S NH,e limit violations with Q a _Man_Fuzzy in comparison with Q a _Man_MPC • With lower S NO values, the Q a _Man_MPC application increases Q a . This fact takes place specially at higher T as , when the S NH dilution is less necessary, while Q a _Man_Fuzzy application keeps lower Q a values without risk of violations. As a result, Q a _Man_Fuzzy gets a 38% reduction in pumping energy compared to Q a _Man_MPC.

•
Both Q a _Man_MPC and Q a _Man_Fuzzy reduce Q a when S NO increases. Due to this fact, the percentages of time of S Ntot,e limit violations are similar with both applications. The 2.35% reduction with Q a _Man_Fuzzy is mainly due to rain events because Q a _Man_MPC keeps Q a very low to reduce S NO,2 , without taking into account the S NH,0 dilution, as Q a _Man_Fuzzy does.

Conflicts of Interest:
The authors declare no conflict of interest.

Abbreviations
The following abbreviations are used in this manuscript: Underflow rate from the dewatering (m 3 /d) r S NH conversion rate of ammonium and ammonia nitrogen concentration in the biological process r S NO conversion rate of nitrate concentration in the biological process S Ntot Total nitrogen concentration (mg/L) S Ntot,e Total nitrogen concentration in the effluent (mg/L) S NH Ammonium and ammonia nitrogen concentration (mg/L) S NH,0 Ammonium and ammonia nitrogen concentration at the input of the first reactor (mg/L) S NH, 5 Ammonium and ammonia nitrogen concentration at the output of the fifth reactor (mg/L) S NH,in Ammonium and ammonia nitrogen concentration in the influent (mg/L) S NH,e Ammonium and ammonia nitrogen concentration in the effluent (mg/L) S NO Nitrate concentration (mg/L) S NO,0 Nitrate concentration at the input of the first reactor (mg/L) S NO,2 Nitrate concentration at the output of the second reactor (mg/L) S NO,5 Nitrate concentration at the output of the fifth reactor (mg/L) S O Dissolved oxygen concentration (mg/L) S O,i Dissolved oxygen concentration in tank i (mg/L) T as Temperature ( • C) TSS Total Suspended Solids (mg/L) WWTP Wastewater Treatment Plants Z any concentration of the process Z i is Z at the output of the reactor i