SPECIAL SECTION ON ADVANCED SENSOR TECHNOLOGIES ON WATER MONITORING AND MODELING Received July 31, 2019, accepted October 23, 2019, date of publication October 31, 2019, date of current version November 13, 2019. Digital Object Identifier 10.1109/ACCESS.2019.2950852 LSTM-Based Wastewater Treatment Plants Operation Strategies for Effluent Quality Improvement IVAN PISA 1,2 , IGNACIO SANTÍN2 , ANTONI MORELL1 , JOSE LOPEZ VICARIO1 , AND RAMON VILANOVA2 , (Member, IEEE) 1 Wireless Information Networking Group, Escola d’Enginyeria, Universitat Autònoma de Barcelona, 08193 Bellaterra, Spain 2 Advanced Systems for Automation and Control Group, Escola d’Enginyeria, Universitat Autònoma de Barcelona, 08193 Bellaterra, Spain Corresponding author: Ivan Pisa (ivan.pisa@uab.cat) This work was supported in part by the Catalan Government under Project 2017 SGR 1202 and Project 2017 SGR 1670, in part by the La Secretaria d’Universitats i Recerca del Departament d’Empresa i Coneixement de la Generalitat de Catalunya i del Fons Social Europeu under FI Grant, in part by the Spanish Government under Project TEC2017- 84321-C4-4-R and Project DPI2016-77271-R, and in part by the European Regional Development Funds of the European Union. ABSTRACT Wastewater Treatment Plants (WWTPs) are facilities devoted to managing and reducing the pollutant concentrations present in the urban residual waters. Some of them consist in nitrogen and phosphorus derived products which are harmful for the environment. Consequently, certain constraints are applied to pollutant concentrations in order to make sure that treated waters comply with the established regulations. In that sense, efforts have been applied to the development of control strategies that help in the pollutant reduction tasks. Furthermore, the appearance of Artificial Neural Networks (ANNs) has encouraged the adoption of predictive control strategies. In such a fashion, this work is mainly focused on the adoption and development of them to actuate over the pollutant concentrations only when predictions of effluents determine that violations will be produced. In that manner, the overall WWTP’s operational costs can be reduced. Predictions are generated by means of an ANN-based Soft-Sensor which adopts Long-Short Term Memory cells to predict effluent pollutant levels. These are the ammonium (SNH ,e ) and the total nitrogen (SNtot,e ) which are predicted considering influent parameters such as the ammonium concentration at the entrance of the WWTP reactor tanks (SNH ,po ), the reactors’ input flow rate (Qpo ), the WWTP recirculation rate (Qa ) and the environmental temperature (Tas ). Moreover, this work presents a new multi-objective control scenario which consists in a unique control structure performing the reduction of SNH ,e and SNtot,e concentrations simultaneously. Performance of this new control approach is contrasted with other strategies to determine the improvement provided by the ANN-based Soft-Sensor as well as by the fact of being controlling two pollutants at the same time. Results show that some brief and small violations are still produced. Nevertheless, an improvement in the WWTPs performance w.r.t. the most common control strategies around 96.58% and 98.31% is achieved for SNH ,e and SNtot,e , respectively. INDEX TERMS Artificial neural networks, BSM2 framework, industrial control, violation reduction, water pollution. I. INTRODUCTION and return them to its natural cycle. Their main aim is The pollutant reduction process of urban residual waters to reduce the concentration levels of phosphorus, nitro- is performed at Wastewater Treatment Plants (WWTPs) gen derived components, biochemical oxygen demand and which are facilities devoted to treating the incoming waters total suspended solids to assure that they are harmless to the environment and aquatic life where treated waters are The associate editor coordinating the review of this manuscript and spilled. For that reason, some regulations, like the Euro- approving it for publication was Gilberto Pastorello . pean Directive 91/271 [1], are applied to these facilities to This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see http://creativecommons.org/licenses/by/4.0/ VOLUME 7, 2019 159773 I. Pisa et al.: LSTM-Based Wastewater Treatment Plants Operation Strategies for Effluent Quality Improvement assure that pollutant parameters are maintained below certain Another approach consists in the adoption of Adaptive Fuzzy limits. Neural Networks (ANNs + Fuzzy Logic). For instance in These pollutant reduction processes are carried out by [11] and [12], this approach has been adopted to track the means of highly complex and non-linear biological and bio- optimal set-points of the dissolved oxygen (SO,5 ) (2 mg/L) chemical processes which are described by the Activated at the fifth tank and nitrate nitrogen (SNO,2 ) (1 mg/L) at Sludge Models (ASMs): the Activated Sludge Models No.1 the second one. Furthermore, in [13] two Multilayer Per- (ASM1), No.2 (ASM2), No.2d (ASM2d) and No.3 (ASM3), ceptron (MLP) neural networks are adopted to predict both, all of them developed by the International Water Association the ammonium (SNH ,e ) and total nitrogen concentrations (IWA). ASM1 consists in a mathematical model showing the (SNtot,e ) in the effluent, and determine whenever a violation of reduction of nitrogen derived pollutants [2]. Besides, it has their limits is likely to occur. When a violation of the pollutant been extended with the development of Activated Sludge limits is detected, a hierarchical control strategy based on Models No.2 and 2d (ASM2 & ASM2d), where the former the implementation of MPC and Fuzzy Logic controllers is models the phosphorus pollutant reduction and the latter activated automatically. However, the prediction performed improves the denitrification process. ASM1 has also been by the MLP corresponds to the effluent’s maximum value extended with Activated Sludge Model No.3 (ASM3), a new observed in a day, i.e., the time dependence among influent tool of the next generation of Activated Sludge Models [3]. and effluent is not considered. Furthermore, ANNs have been In this context, control strategies have been designed and also adopted as the main tool to fix certain set-points of deployed at WWTPs to try to maintain the pollutant levels the WWTP control strategies. For instance, in [14], three under the limits established by the regulations. However, different neural networks with feedback input are considered there are a lot of WWTPs architectures depending on their in the optimal set-point design of an MPC controller. Among purpose. For that reason, the well-known Benchmark Simu- the different parameters under control, these networks are lation Model No.1 and No.2 (BSM1 and BSM2) have arisen focused on tracking the SO and SNH ,5 set-points adopted by as frameworks where the evaluation of the control strategies the controllers. performance is done. Those simulation models have been In such a context, this work is based on the development designed and implemented to offer a standardised WWTP and deployment of an improved predictive control approach architecture which allows for generalisation, easy compar- able to control more than one pollutant concentration at the ison and replication of results. Therefore, they define their same time. It consists mainly of two parts: the predictive and own simulation protocols and regulations [4]. the control. The predictive part consists of an ANN-based From the control point of view, BSM1 and BSM2 imple- Soft-Sensor which is in charge of predicting the pollutant ment a default control strategy based on Proportional Inte- concentrations. These are obtained by means of Long Short gral (PI) controllers [5] which maintain the dissolved oxygen Term Memory (LSTM) cells which are ANNs able to model concentration (SO ) of certain reactor tanks at the set-point of highly non-linear and complex systems [15] like WWTPs. 2 mg/L by means of modifying the oxygen transfer coeffi- Besides, these networks have been considered to perform cient (KL a) [6]. More complex control strategies such as the predictions due to their ability in modelling sequences since Model Predictive Control (MPC) and Fuzzy Logic have also they take into account the high time correlation between been adopted in the literature. For instance, the adoption of an WWTP’s data [16] [17, Chapter 10]. In terms of the con- MPC controller is proposed in [7], where the authors propose trol part, predictions will determine when and which control the deployment of MPCs with and without Feed Forward actuations have to be applied. These actuations are focused over BSM1 framework in order to assure that pollutant con- on reducing the pollutant concentrations and consequently centrations are upheld the regulation limits. Another control their violations. For instance, violations of SNH ,e and SNtot,e , approach consists in the development of hierarchical control since the former is toxic for the aquatic life and the latter strategies like the one proposed by Nopens et al. [8]. They is a limiting nutrient that causes eutrophication [18], [19]. implement a hierarchical closed-loop (CL) control based Phosphorus is not considered in this work since it is based on PI controllers that will modify the SO parameter of the on BSM2 which only implements ASM1 models. BSM2 tanks in order to maintain the ammonium concentra- Results of the proposed control approach will be com- tion of the fifth tank (SNH ,5 ) at a given set-point of 1.5 mg/L. pared with BSM2 default control strategies and also with the Artificial Neural Networks (ANNs) have been applied in ones adopted in [13]. An improvement of the performance certain works as predictive tools able to learn and generate is expected since predictive control strategies are able to mathematical models of highly non-linear relations such as actuate in advance for the case of BSM2 default control in the ASMs [9]. Moreover, ANNs have also been considered strategy. In terms of the hierarchical control presented in [13], for control purposes, where they are in charge of forecasting an improvement is also expected as a consequence of taking or predicting some parameters to feed a control strategy. into account LSTM cells. Moreover, this work proposes to In that sense, Foscoliano et.al propose the adoption of recur- control both pollutant variables at the same time by means of a rent neural networks (RNNs) to predict the WWTP’s nutrient new control approach where two predictive control strategies concentrations and then, feed an MPC strategy to assure based on MPC and Mamdani Fuzzy Logic controllers are that concentrations are under the established limits [10]. considered. Therefore, the reduction of SNH ,e and SNtot,e 159774 VOLUME 7, 2019 I. Pisa et al.: LSTM-Based Wastewater Treatment Plants Operation Strategies for Effluent Quality Improvement TABLE 1. State-of-art review. concentrations is performed simultaneously. In that sense, operation decisions on the basis of the (not)predicted effluent Tab. 1 summarises the different control strategies applied in limit violation. Therefore, the potential improvement will the WWTP facilities as well as the main contribution of this come not just because reducing the number of effluent limit work w.r.t. the reviewed ones. violations but also from the ease of deployment. For instance, It is important to notice that in this work, the ANN-based the adoption of such a soft-sensor allows us to dissociate soft-sensor providing predictions will not only be used to the predictions of pollutant concentrations from the WWTP predict the full plant output concentration, but also to deter- architecture since it only requires input and output data of the mine when they will generate a violation over the prescribed processes to model. limits. In that sense, the application of this soft-sensor will The outline of this paper is as follows. Next section is help in the reduction of the WWTP operational costs since devoted to presenting the BSM2 framework which this work they will only be increased when a violation is detected. is based on. Next, the adopted ANN-based soft-sensor pre- Thus, no extra action is needed when the effluents are below dicting the effluent concentrations is described. Later, results the limits. This ANN-based Soft-Sensor has been previously are presented in terms of the percentage of violations and also designed in [20]. In there, the soft-sensor was able to pre- in terms of the effluent and costs index. Finally, Section V dict the effluent concentrations but, the pollutant peaks were concludes the paper. not correctly predicted since the imbalance data problem in the training process was not addressed. This was solved II. BENCHMARK SIMULATION MODEL NO.2 in [21], where the soft-sensor was improved and calibrated The purpose of this work is to analyse the improvement of by means of data preprocessing techniques which circumvent a WWTP when an Artificial Neural Network-based Soft- the problem of imbalanced data. However, in both cases it Sensor (ANN-based Soft-Sensor) is applied as a predictive was neither deployed in BSM2 framework nor tested with mechanism feeding predictive control strategies. For that rea- control strategies. Consequently, this paper is an extension of son, it will be implemented and deployed in a well-known [20] and [21]. Here the performance of the ANN-based soft- WWTP benchmark scenario, the BSM2, which describes and sensor is evaluated by considering the interaction with control models a standard biological WWTP [22], [23]. strategies in a BSM2 environment. As shown, the ANN needs As a WWTP simulator, BSM2 implements a simulation to be retrained considering the actuations of control strategies protocol which takes into account a whole year of influent since they are counterproductive. data. These data represent different types of weather: dry, It is also important to put into place the work contribution rainy and stormy. Besides, influent data not only gives infor- from the WWTP operation point of view. One of the appeal- mation about the weather, but also about the nutrients present ing aspects of the proposal, in addition to the performance in it. However, BSM2 has to be calibrated before being able improvement that it may provide with respect to existing to simulate the real behaviour of a WWTP facility. This approaches, is that it can be understood as an additional calibration is in charge of leading BSM2 to a steady-state decision layer that can improve existing operation. There- by means of simulating a 200-days constant influent with no fore, it does not ask for changes in instrumentation nor in noise measurements. Once calibrated, it is able to simulate already existing control equipment (either software and/or the WWTP behaviour. To do so, 609 days of influent showing hardware). This soft-sensor based layer takes measurements rainy episodes as well as variations in the environmental tem- already existing because of usual control-loops and builds up peratures is adopted. From these 609 days simulation, only VOLUME 7, 2019 159775 I. Pisa et al.: LSTM-Based Wastewater Treatment Plants Operation Strategies for Effluent Quality Improvement TABLE 2. BSM2 flow rates. TABLE 3. BSM2 effluent quality limits. FIGURE 1. BSM2 layout modelling the architecture of a wastewater considered in the BSM2 layout, where Qa corresponds to the treatment plant. quantity of aerated flow going from the last reactor tank to the first anoxic one and Qr corresponds to the sludge’s internal recycle flow which moves some sludges from the second results of 365 days (from day 245 to day 609) are considered clarifier to the first reactor tank. Furthermore, the rest of for WWTP performance computation [6], [23]. BSM2 model parameters as well as the processes involved in the pollutant reduction process are defined in [23]. A. BSM2 LAYOUT BSM2 defines the WWTP’s water line, where the pollu- B. BSM2 REGULATIONS tant reduction tasks are performed, and the sludge treatment BSM2 does not only implement its own simulation protocol where the WWTP’s sludge is managed. The water line con- and WWTP model, but also its own regulations. This is sists of a set of five reactor tanks (Activated Sludge reactors), motivated by the fact that it has been designed as a general the first two are anoxic (they present a lack of dissolved framework scenario whose aim is to offer generality, easy oxygen) whilst the remaining three are aerobic (they are comparison and replication of results among different control working under aerated conditions). The processes performed strategies [4]. in the water line are defined by ASM1 model [2], therefore, In that sense, BSM2 limits correspond to the ones shown we will focus on those related with the nitrogen and its in Tab. 3, where the pollutant limits for the Chemical derived reduction processes. They correspond to nitrification Oxygen Demand (COD), the Biochemical Oxygen Demand and denitrification, where the former oxides the ammonium (BOD5 ), the Total Suspended Solids (TSS) and the ammo- ions into nitrate, and the latter transforms the nitrate into nium SNH ,e and total nitrogen concentrations SNtot,e are nitrogen and gaseous products [24]. The sludge treatment defined. Although those are very similar to the ones adopted part consists of the different modules devoted to treating in the European Directive 91/271 [1] for WWTPs, BSM2 lim- the sludge adopted in the pollutant reduction process. These its are more restrictive due to the fact that a violation is per- modules correspond to: the primary and secondary clarifiers, formed whenever the limits are exceeded. In this case, the two which are in charge of the sedimentation process defined most important limits to take into account are those derived by the Tákacks model [25]; the Anaerobic Digester, where from the nitrogen (SNH ,e and SNtot,e ) because they are the sediments obtained from the clarifiers will be treated to pro- most difficult to tackle. Besides, violations of COD, BOD5 cess the organic material and transform it in sludges; the and TSS are well treated and managed by usual control and Dewatering module, which will remove the excess of sludges; operational strategies [6], [8], [13]. On the other hand, phos- and the Storage Tank, which will store an amount of sludge phorus pollutant derived components cannot be addressed by to be reused in the water line [23]. BSM2 framework since it is based on ASM1 models. There- The layout considered in the BSM2 scenario can be fore, BSM2 regulations do not consider any kind of violations observed in Fig. 1 where the water line and the sludge related to phosphorus components. If these pollutants have to treatment modules are differentiated. Besides, BSM2 has be considered, BSM2 has to be redefined to follow Activated been designed to manage an average flow rate of 20648.36 Sludge Models 2 and 2d [3]. m3 /day. The anoxic tanks support a maximum volume of 1500 m3 whereas the aerated ones support 3000 m3 . This C. CONTROL STRATEGIES yields to an average retention time of 14 hours [6], [23]. Since BSM2 implements its own protocol and regulations, In other words, the incoming water will remain 14 hours it is usually adopted as a benchmark where control strategies in the WWTP plant. Tab. 2 shows the different flow rates are compared and tested in terms of the reduction of pollutant 159776 VOLUME 7, 2019 I. Pisa et al.: LSTM-Based Wastewater Treatment Plants Operation Strategies for Effluent Quality Improvement FIGURE 2. Control Strategies. Notice that Default control strategy and the one proposed by Nopens et al. [8] consider the application of conventional PI controllers. Their main difference consists in the fact that Nopens et.al propose a hierarchical control structure instead of a unique PI. Finally, the control strategies adopting the ANN-based Soft-Sensor are differentiated in the manner they use the soft-sensor itself. The strategy reducing the SNH,e violations applies the soft-sensor to decide if the Mamdani Fuzzy or the MPC will be applied in the manipulation of Qa . The strategy reducing SNtot ,e considers the soft-sensor to determine the amount of carbon that will be added to the first and second WWTP’s reactor tanks. violations and WWTP’s operational costs. In our case, four tanks 4 and 5 (SO,4 and SO,5 ) at the given set-point of 2 mg/L different control strategies will be considered, two of them and 1 mg/L, respectively. The predictive control structure adopt predictive control strategies based on the hierarchical in charge of reducing ammonium violations implements an control of [13] whereas the two remaining consist in the MPC and a Mamdani Fuzzy Logic to maintain the SNO,2 BSM2 default control strategies [6], [8], which are based on concentration at 1 mg/L. To achieve this, Qa is manipu- the application of Proportional Integral controllers (PI) [5]. lated taking into account the predictions performed by the The first considered control strategy corresponds to the ANN-based Soft-Sensor. It will determine if the MPC or the BSM2 default control (DS) defined in [6]. It is in charge Mamdani Fuzzy is applied (see Fig. 2c). On the other hand, of managing the SO present at the fourth tank by means of the control structure reducing SNtot,e violations considers the manipulating the oxygen transfer coefficient (KL a) of the ANN-based Soft-Sensor’s predictions to decide when extra three aerated tanks (see Fig. 2). In addition, the control strate- carbon has to be added to tanks 1 and 2 or if a fixed value gies presented by Nopens et al. [8] have also been considered. will be added instead [13]. Moreover, an additional MPC + They are based on the application of PI controllers in the SO Mamdani Fuzzy Logic is considered to track and maintain control loop to maintain the dissolved oxygen of the fourth the SNO,2 at the given set-point (1 mg/L) manipulating the and fifth tanks at the given set-points of 2 mg/L. In this Qa (see Fig. 2d). case, the first approach (closed loop control (CL)) corre- sponds to a modification of the default control strategy shown in [6]. D. PERFORMANCE METRICS The two predictive control approaches are based on the BSM2 performance is computed adopting three different met- implementation of a hierarchical control and a predictive rics devoted to evaluating the effects of the control strategies control structure based on the predictions performed by an on BSM2. They can be divided into two main groups: (i) eco- Artificial Neural Network-based Soft-Sensor (ANN-based nomical metrics and (ii) behaviour metrics. Soft-Sensor). It will predict the effluent concentrations, SNH ,e Economical metrics are those which inform about the cost and SNtot,e , and feed a selector which will determine the that the implemented control strategy will spend on the pol- control strategy to apply. Both approaches have a common lutant reduction process. In the case of this work, the metric part which corresponds to the hierarchical control presented showing this corresponds to the Overall Cost Index (OCI). in [13]. Its main aim is to maintain the dissolved oxygen of It computes the overall costs of the WWTP plant as the sum VOLUME 7, 2019 159777 I. Pisa et al.: LSTM-Based Wastewater Treatment Plants Operation Strategies for Effluent Quality Improvement of the different consumed energies: OCI = AE + PE + 3 · SP+3 · EC + ME − 6 · MP + HEnet (1) where AE corresponds to the aeration energy, PE to the pumping energy, ME to the mixing energy and HEnet to the heating energy of anoxic tanks’ sludge. SP is defined as the sludge production for disposal, EC corresponds to the amount of consumed external carbon and finally, MP is defined as the energy provided by the methane produced in the anaerobic digesters. This energy is subtracted from the OCI since it corresponds to a benefit from the economical point of view. Further details on how to compute the different parameters involved in the OCI computation are shown in [6], FIGURE 3. LSTM Cell. Input gate (it ) modifies the LSTM cell state, update [13]. gate (c̃t ) determines the new cell state candidates, forget gate (ft ) resets It has to be stressed that OCI is an aggregated measure that the cell’s memory and output gate (ot ) determines the output candidates. x, h and c are the inputs, outputs and state of the LSTM cell, respectively. has no monetary units. The specific costs will be dependent Further details in [17, Section 10.10]. on the WWTP location as energy regulations, for exam- ple, vary from one country to another. Also, in the specific Thus, the reduction of the number of violations as well case of using an external source for carbon addition to help as the improvement of WWTP’s EQI and OCI metrics are denitrification, costs may be affected. Many external carbon sought. Since the concentrations of interest can be treated sources are derived from fossil fuel based raw materials [26]. as time-series showing a high correlation over time, the Significant price fluctuations in the methanol, ethanol, and application of LSTMs for prediction purposes is highly advis- acetic acid markets can have a huge impact on the prices of able [17]. these carbon sources. On the other hand, the metrics devoted to computing the A. LONG-SHORT TERM MEMORY CELLS plant performance in terms of its behaviour are: (i) the per- LSTM cells are a type of Gated Neural Networks [17, centage of time that effluents are violated w.r.t. the WWTP Section 10.10] which have arisen as a solution that alleviates operational time, and (ii) the Effluent Quality Index (EQI). the RNNs [17, Chapter 10] well-known problem of Vanishing The first metric corresponds to the amount of time that and Exploding gradients [27]. Besides, LSTMs have been SNH ,e and SNtot,e pollutant levels are above the BSM2 limits, considered as the main predictive approach because of their 4 mg/L and 18 mg/L, respectively. Besides, this metric has capacity in modelling time-series and time-dependant param- been complemented providing information about the number eters such as the WWTP’s influent and effluent values. This of violations that have been produced during the simulation is motivated by the fact that they implement memory cells time. Their maximum level, their average (µ) and standard able to not only take into account the current input, but also deviation (σ ) are also considered. Finally, EQI corresponds the previously observed dynamic [17, Section 10.10]. Fig. 3 to an aggregated metric measuring the quality of the efflu- shows the main architecture of a LSTM cell. For the sake ent [23]. It is computed as the average of the effluent pollutant of brevity, we do not provide specific details (the interested levels over the observation period: reader is referred to [17, Section 10.10]). Z t=609days 1 In this work we consider Back Propagation Through Time EQI = (2 · TSS(t) + COD(t) algorithm, which updates the weights and biases of the LSTM 1000 · T t=245days + 30 · SNKj (t)+10 · SNO (t)+2 · BOD5 (t)) · Q(t) · dt gates toward the reverse of the cost function’s gradient [17, Chapter 6]. Moreover, L2 penalty regularisation technique is (2) adopted since ANNs are suitable to present overfitting [17, where TSS is the Total Suspended Solids, COD is the Chem- Chapter 7]. Overfitting is committed whenever the learned ical Oxygen Demand, SNKj corresponds to the Total Kjeldahl model does not fit new input data, achieving good perfor- Nitrogen, SNO is the nitrate nitrogen concentration, BOD5 is mance only with training data. One common approach to the Biochemical Oxygen Demand and Q(t) is the flow rate reduce overfitting is to limit the capacity of ‘‘specialization’’ over time [13], [23]. of the network by means of regularization techniques [17, Chapter 7]. For instance, L2 adds extra penalties to the ANN’s III. VIOLATION REMOVAL PROCESS BASED ON weights in order to reduce the learning capacity of the net- ARTIFICIAL NEURAL NETWORKS work. The adoption of an ANN-based Soft-Sensor seeks the B. ANN-BASED SOFT-SENSOR improvement of the WWTP’s performance by means of Concerning the ANN-based Soft-Sensor architecture, enhancing the predictions adopted by the control scenarios. it implements two main blocks (see Fig. 4): the Data 159778 VOLUME 7, 2019 I. Pisa et al.: LSTM-Based Wastewater Treatment Plants Operation Strategies for Effluent Quality Improvement TABLE 4. ANN-based soft-sensor’s input and output data. FIGURE 4. ANN-based Soft-Sensor block diagram. are executed. At each execution, K-1 subsets are considered for training (with about 70% of the data) and one subset for validation (with about 15% of the data). Validation data FIGURE 5. Implemented sliding window in the ANN-based soft-sensor. is used to better adjust the learning rate and L2 penalties previously obtained (in our case both equal to 1 · 10−3 ). Finally, the test dataset is used to compute the performance Preprocessing block devoted to preprocessing the input data, of the ANN-based Soft-Sensor. and the LSTM-based Predictor block which implements a In a real environment, data considered in the training LSTM neural network to predict effluent concentrations. process will consist of online measurements which are val- The preprocessing carried out consists of the normalisation ues that can be obtained at the same WWTP plant without of data towards zero-mean and unity variance in order to the necessity of laboratory analyses. In other words, the address the heterogeneity of measurements [28]. This module ANN-based Soft-Sensor will take measurements of nutrient’s also considers the implementation of a sliding window to concentrations that can be directly obtained from available organise the time-dependent measurements, which are sam- sensors with a sampling time of 15 minutes. Then, predictions pled every 15 minutes. In such a context, the sliding window will be performed adopting these data as inputs. Besides, it is has been designed to gather 10h of input data (window length worth mentioning that the ANN-based Soft-Sensor can find - WL) and perform predictions of the effluent concentrations missing data in a real WWTP due to sensor malfunction. that will flow out the plant in 4h (prediction horizon - PH) In that case, an additional imputation layer should be con- (see Fig. 5). These times have been selected according to their sidered. However, this work is based on a simulated envi- relationship with the prediction performance. The more input ronment, BSM2, and thus the management of missing data data, the better prediction performance. However, the control is out of the scope of the paper. Therefore, measurements strategies have an actuation time that has to be also consid- here refer to BSM2 generated data, which are adopted by ered. In that sense, 4 hours of prediction horizon is enough the soft-sensor as its inputs, whereas predictions refer to the for control strategies to completely reduce a pollutant peak. output of such soft-sensor. In this case, generated data consist Besides, 10h of input data allows the ANN-based Soft-Sensor in 609 days of influent and effluent measurements sampled to get enough information of the influent that has entered in every 15 minutes. Thus, the total amount of data consist the WWTP. For instance, to determine if a rainy or stormy in 58464 samples which are obtained when BSM2’s default episode is being produced. Furthermore, the WL and PH influent dynamics showing episodes of dry, rainy and stormy can be changed, but they are chosen taking into account the weathers are simulated. As a consequence, the considered WWTP’s retention time (approximately 14h), i.e., the sum of hydrochemical parameters have been analysed by processes PH with WL equals to this time. already implemented in the BSM2 environment. In this case, The ANN-based Soft-Sensor’s LSTM-based Predictor is effluent measurements correspond to ammonium, SNH ,e , and built with two LSTM cells which are stacked, i.e., the output total nitrogen, SNtot,e . Tab. 4 shows the ANN-based Soft- of the first LSTM cell acts as the input to the second one. Sensor’s input and output data. Besides, each cell gate is formed by an ANN with 50 hidden Qpo and SNH ,po are considered due to their effects in the neurons. The whole structure has been trained in order to find final pollutant concentrations (SNH ,e and SNtot,e ): (i) SNH ,po the 31851 model parameters (weights and biases) which offer has an important effect in the nitrification process yielding the best prediction performance. The model hyperparameters to an increment of the ammonium’s concentration in the have been computed by means of a grid search where the effluent and (ii) Qpo determines the amount of water entering number of cells and neurons per cell are also determined. in the first reactor tank. Tas is considered due to its influence Then, the performance of the model has been computed by in the nitrification and denitrification processes, and hence means of a K-Fold strategy as we describe next. First, 15% the final value of SNtot,e [2]. Finally, Qa is considered in of the dataset is saved for testing. With the remaining 85%, the SNtot,e violation removal strategy since it increases the we split the data into K (K = 5 in our case) sequences amount of sludge and dissolved oxygen in the anoxic tanks. (thus keeping temporal order). Then K training processes However, it is not taken into account in the SNH ,e control VOLUME 7, 2019 159779 I. Pisa et al.: LSTM-Based Wastewater Treatment Plants Operation Strategies for Effluent Quality Improvement strategy because this strategy modifies Qa to reduce the amount of ammonium. Further details on the soft-sensor’s implementation and its training and calibration processes can be found in [21]. There, the ANN-based Soft-Sensor has been trained considering data coming from three different levels of control. The objective there was to test its feasibility and per- formance when predicting WWTP effluent products. Results showed that the soft-sensor is able to generate highly accu- rate predictions of ammonium and total nitrogen four hours in advance indistinctly of the control. Besides, the lowest Root Mean Squared Error (RMSE) equals to 0.12 mg/L and 0.40 mg/L for SNH ,e and SNtot,e predictions, respectively, when the sensor is trained with the high-level control strategy data. FIGURE 6. ASS-PRS control scenario. Notice that predictive element corresponds to the ANN-based Soft-Sensor which is predicting SNH,e and C. CONTROL SCENARIOS SNtot ,e at the same time. As it has been previously stated, the ANN-based Soft-Sensor is able to perform predictions taking into account the time- the control strategy actuates over the pollutant under correlation. Consequently, the improvement achieved due to control. Consequently, costs derived from the addition of these predictions will be computed and tested by means of external carbon are directly related with the performance four different predictive control scenarios: of the control strategy. The more violations detected, • Default Scenario (DS): Non-predictive control sce- the more external carbon required, and so, it is impor- nario which corresponds to the default control strat- tant to minimise false detection. Considered ANN-based egy adopted in [6] (Fig. 2). It does not consider the Soft-Sensor’s has an equivalent structure to the one con- ANN-based Soft-Sensor. Here, a PI controller is in sidered in ASS-NHRS, however, it adopts a new input, charge of controlling the oxygen transfer coefficient of the recirculation flow rate (Qa ). The soft-sensor has been each aerated tank. The amount of carbon added to the calibrated to detect violations whenever γSNtot,e exceeds first tank (qEC,1 ) is maintained fix at a constant flow rate 17 mg/L. Thus, more violations will be detected at the of 2 m3 /day. expense of allowing false positives. • Hierarchical Scenario (HS): Non-predictive control Notwithstanding, the predictive control scenarios, ASS- scenario which corresponds to the control strategies NHRS and ASS-NTRS, are devoted to controlling and actu- adopted in [8] (Fig. 2b). It does not consider the ating over a unique pollutant parameter, either SNH ,e or ANN-based Soft-Sensor. The amount of carbon added SNtot,e . Thus, effluent quality and overall costs are improved to the first tank (qEC,1 ) is maintained fix at a constant w.r.t. default control strategies since the concentrations of the flow rate of 1 m3 /day. pollutant under control are reduced. Despite this, violations • ANN-based Soft-Sensor SNH ,e reduction scenario of the non-controlled pollutants are sometimes increased (ASS-NHRS): Predictive control scenario (Fig. 2c) degrading the EQI and OCI parameters. For instance, SNtot,e which is focused on reducing the ammonium violations concentration is increased when the SNH ,e control actuation is varying the Qa . It adopts the MPC control strategy applied. Since SNH ,e is reduced varying the Qa , the amounts defined in [13] and the ANN-based Soft-Sensor. In this of sludges and dissolved oxygen are increased in the anoxic case, carbon is only added when the control strategy tank, raising the concentrations of nitrates and total nitro- actuates over the pollutant under control, therefore, costs gen [13]. This example shows that some actuations control- derived from the addition of external carbon are directly ling a unique pollutant concentration are counterproductive related with the performance of the control strategy. for the others. For that reason, a WWTP has to be observed ANN-based Soft-Sensor’s input variables are SNH ,p , Qpo as a whole system where control actuations have to be applied and Tas . The product between SNH ,p and Qpo is consid- simultaneously, i.e., SNH ,e and SNtot,e control actuations have ered due to its appearance in the mass-balance equations to be applied together. Following this point, we have proposed shown in [2]. The soft-sensor has been calibrated to the ANN-based Soft-Sensor pollutant reduction scenario detect violations whenever γSNH ,e exceeds 4 mg/L. (ASS-PRS), which unifies the ASS-NHRS and ASS-NTRS • ANN-based Soft-Sensor SNtot,e reduction scenario control strategies. Here, the two control strategies, one per (ASS-NTRS): Predictive control scenario (Fig. 2d) pollutant, will be actuating at the same time with the objective which is focused on reducing the total nitrogen vio- of reducing effluent peaks for SNH ,e and SNtot,e . Predictions lations. It adopts the correspondent control strategy performed with the ANN-based Soft-Sensor will determine defined in [13] as well as the soft-sensor. In this case, when the control strategies based on MPC and Mamdani external carbon is only added to tanks 1, 2 and 5 when Fuzzy Logic have to be applied (see Fig. 6). In that manner, 159780 VOLUME 7, 2019 I. Pisa et al.: LSTM-Based Wastewater Treatment Plants Operation Strategies for Effluent Quality Improvement when the actuation over a pollutant increases the concen- trations of the other, the control strategy will automatically reduce its concentration in order to avoid the limit violation. Notice that in this new control scenario, the Qa parameter is acting as an input of the ANN-based Soft-Sensor at the same time it is modified by the SNH ,e control strategy. For that reason, the ANN-based Soft-Sensor has to be trained twice. The first training is performed to obtain the model hyperparameters which will correctly predict the SNH ,e con- centrations. SNtot,e concentrations will also be correctly pre- dicted with the exception of that moments where a peak of ammonium is detected. At this point, the control strat- egy acting over SNH ,e will change the Qa parameters and therefore, predictions of SNtot,e will be degraded since the network predicting them has not been trained considering these changes: LSTMs predicting SNtot,e are trained with DS’ Qa measurements. Once a whole year simulation of ASS-PRS scenario is performed, LSTMs predicting SNtot,e are retrained considering the new Qa measurements. Thus, information about the actuations devoted to reducing the SNH ,e violations is provided in the second retraining process. IV. RESULTS A. WWTP PERFORMANCE WITH SEPARATED CONTROL STRATEGIES WWTP’s performance is computed for the four different predictive control scenarios to determine the improvement FIGURE 7. Both concentrations, when DS and HS scenarios are applied, achieved with the adoption of the ANN-based Soft-Sensor. are present to show that if no prediction is performed, SNH,e and SNtot ,e Results are shown in Tab. 5, where the different stated criteria would incur into violations. are computed: EQI, OCI, SNtot,e ’s and SNH ,e ’s violations. They show that WWTP’s performance depends on the vari- able under control, i.e., if the control structure is proposed to ones because predictions of concentrations are given four remove violations of SNH ,e or SNtot,e . Results show that both hours in advance. For instance in Fig. 7, the pollutant peak structures are able to totally remove the concentrations they predicted at day 560.3 corresponds to the peak measured at are in charge of at the expense of allowing violations of the day 560.6 approximately. non-controlled pollutants. In terms of ASS-NTRS, one can observe that in this Focusing on ASS-NHRS, one can observe that a total case the violations of SNtot,e are completely removed. How- removal of SNH ,e violations is achieved whereas the viola- ever, the SNH ,e ’s limit is violated a 0.14% of the WWTP’s tions of total nitrogen have increased 1.57 percentage points operational time. This percentage represents a reduction of w.r.t. DS control strategy. This effect is motivated by the violations equivalent to 0.27 and 0.09 percentage points fact that whenever a violation of ammonium is predicted, w.r.t. DS and HS, respectively. Since both pollutant prod- the control strategy modifies the Qa flow rate increasing ucts are reduced, the EQI measurement is also improved a the amount of sludge and dissolved oxygen in the anoxic 6.14%, a 2.94% and a 0.37% w.r.t. DS, ASS-NHRS and tanks and therefore, worsening the nitrates concentrations. HS, respectively. Moreover, the OCI is increased a 9.38% Consequently, this increases the levels and violations of total w.r.t. ASS-NHRS control strategy as it is shown in Tab. 5. nitrogen. It is also observed that OCI is reduced a 37.2% This is because whenever a violation is predicted, the control since the control strategy is only applied when a violation strategy adds external carbon to the first, second and fifth is detected whereas DS and HS strategies are applied all the reactor tanks. Moreover, if OCI is compared with DS and time. ASS-NHRS is also able to improve the effluent quality HS, it is observed that it has been reduced a 30.70% and a index (EQI) reducing it a 3.30% w.r.t. DS motivated by the 18.69%, respectively, motivated by the fact that DS an HS are reduction of ammonium violations. Fig. 7 shows the detection continuously adding carbon at a flow rate of 2 and 1 m3 /day and reduction of a future SNH ,e violation. In this case and whilst ASS-NTRS does not. Finally, an example of a SNtot,e for the rest of the paper, figures correspond to the evolution violation removal process is shown in Fig. 7b where a viola- of concentrations in real time. Consequently, measured con- tion occurs at day 559.4 if predictive control is not adopted. centrations show an offset around four hours w.r.t. predicted In this case, the ANN-based Soft-Sensor is able to predict VOLUME 7, 2019 159781 I. Pisa et al.: LSTM-Based Wastewater Treatment Plants Operation Strategies for Effluent Quality Improvement TABLE 5. WWTP’s performance - DS, HS, ASS-NHRS and ASS-NTRS comparison. TABLE 6. Number of violations, average of violation levels and standard deviation. Maximum violations, µ and σ are measured in mg/L. it at day 559.2, thus, the control strategy actuates achieving the reductions of SNtot,e levels in the effluent avoiding the FIGURE 8. SNH,e violation detected and reduced at day 505.4, thus Qa will be modified to reduce the effluent peak at day 505.6. Consequently, violation. SNtot ,e is badly predicted since the variations of Qa have not been In both cases (ASS-NHRS and ASS-NTRS) the same considered in the ANN-based Soft-Sensor training process. effect is observable in terms of the number of violations, their average and their standard deviation (see Tab. 6). For instance, there are not SNtot,e violations in ASS-NTRS sce- Qa modifications performed in the SNH ,e violations removal nario. However, they have been increased in the case of ASS- process. Results in Tab. 7 show that a reduction of the number NHRS. In the case of SNH ,e , they have been reduced from of violations is achieved, however, they are not completely 11 in the case of DS scenario to 0 and 4 in the case of removed w.r.t. DS: (i) SNtot,e violations are reduced 1.1 per- ASS-NHRS and ASS-NTRS, respectively. Furthermore, their centage points, which represent violations during the 0.08% maximum level has been significantly reduced from 8.36 (DS of the WWTP’s operational time, and (ii) SNH ,e violations scenario) to 5.46 (ASS-NTRS). As a summary, the adoption are reduced 0.396 percentage points, which are equal to of the ANN-based Soft-Sensor entails the improvement of violations during 0.014% of the operational time. Violations the control strategies performance in terms of the percent- cannot be completely removed because when varying Qa , age of time that concentrations under control are violated, the levels of nitrate in the anoxic tanks are increased. This is the amount of violations and their maximum levels. translated into a trade-off between the ammonium reduction and the levels of total nitrogen: when violations of SNH ,e B. WWTP PERFORMANCE WITH JOINT are reduced, the levels of total nitrogen are increased and CONTROL STRATEGIES consequently the probability of observing SNtot,e violations Until this point all the scenarios compared with DS and HS (see Fig. 8). Besides, the ANN-based Soft-Sensor predicting correspond to scenarios where the control strategy is focused SNtot,e has not been trained considering these Qa variations. on reducing a unique pollutant concentration. However, this Consequently, predictions of total nitrogen are not so accurate does not represent a real scenario where the main aim is to in those points where a violation of SNH ,e is predicted. avoid both types of violations (SNH ,e and SNtot,e ). For that To solve this, the soft-sensor is retrained when a whole year reason, the WWTP performance has also been computed simulation is achieved. Results in Tab. 7 show that the number when a more realistic scenario is considered. It corresponds of SNtot,e violations is reduced a 75% when the ANN-based to ASS-PRS, where the efforts are focused on reducing SNH ,e Soft-Sensor is retrained. SNH ,e predictions do not vary since and SNtot,e pollutants at the same time. In such a context, one no action is performed on the considered input variables. has to specially consider those parameters (Qa ) that act as In terms of EQI and OCI, the former is decreased a 0.34% inputs of the ANN-based Soft-Sensor and as a manipulated whereas the latter is increased a 0.57% w.r.t. the situation parameter in the violations removal process. where the soft-sensor is not retrained. Finally, if the perfor- First, performance is computed without retraining the mance of ASS-PRS is computed in terms of the percentage of ANN-based Soft-Sensor, i.e., without taking into account the operational time that an effluent is violated, an improvement 159782 VOLUME 7, 2019 I. Pisa et al.: LSTM-Based Wastewater Treatment Plants Operation Strategies for Effluent Quality Improvement TABLE 7. WWTP’s performance-DS and ASS-PRS comparison. FIGURE 10. Comparative between violations produced in ASS-NTRS and ASS-PRS scenarios. Only the days, where SNH,e violations of ASS-PRS are produced, are shown. TABLE 8. Number of violations, average of violation levels and standard deviation. Maximum violations, µ and σ are measured in mg/L. FIGURE 9. Comparative between violations produced in ASS-NHRS and ASS-PRS scenarios. in ASS-NHRS. These reach SNtot,e values of 18 mg/L and 18.12 mg/L at days 384.4 and 560.5, respectively. of 98.31% in the reduction of SNtot,e and a 96.58% for SNH ,e On the other hand, Fig. 10 compares the SNH ,e violation w.r.t. DS scenario is achieved. This corresponds to a 99.27% obtained in ASS-PRS with the same violation performed in for SNtot,e and 90% for SNH ,e in terms of ASS-NHRS and the ASS-NTRS scenario. In this case, both violations are pro- ASS-NTRS, respectively. duced because the level of ammonium reaches 4.177 mg/L. Moreover, it is worth noting that, although the complete Both are produced by the actuation performed over SNtot,e at avoidance of violations is not achieved, they represent a low day 410.5, where a violation of total nitrogen is predicted and percentage of the operational time. For instance, a unique vio- reduced. This is clearly shown in Tab. 8, where the amount lation of SNH ,e , which equals to a 0.014% of the operational of violations has not changed from ASS-PRS to ASS-PRS time, is produced at day 410.5. SNtot,e is violated two times, retrained. The improvement here is shown in the average at days 384.4 and 560.5, which only represents a 0.02% of the of violations and their maximum. For instance, ASS-PRS WWTP’s operational time. In such a context, Fig. 9a, Fig. 9b SNtot,e ’s maximum violation equals to 19.92 mg/L while in and Fig. 10 show the differences between the violations ASS-PRS retrained it has been reduced until 18.12 mg/L. that occurred in ASS-NTRS, ASS-NHRS and ASS-PRS. Moreover, the average of violations (µ) is also improved. In Figs. 9a and 9b, it is observed that violations performed It has been reduced from 19.17 mg/L (ASS-PRS) to in ASS-PRS scenario are much lower than those produced 18.06 mg/L (ASS-PRS retrained). VOLUME 7, 2019 159783 I. Pisa et al.: LSTM-Based Wastewater Treatment Plants Operation Strategies for Effluent Quality Improvement As a summary, the application of ASS-PRS scenario entails have to be adopted when translating our approach into real the reduction of the % of time that effluent concentrations are environments. For instance, filters are usually applied, which exceeding the BSM2 limits. Effluent violations are reduced attenuate the noise signal. In addition, the controller parame- between 0.216 and 0.396 percentage points for SNH ,e and ters should be adjusted after an analysis of the sensor signals. between 1.1 and 1.16 percentage points in the case of SNtot,e . The reduction of pollutant concentrations and the avoidance ABBREVIATION AND SYMBOLS of violations also help in the improvement of the EQI metric: the lower the pollutant concentrations, the better the EQI. For ANN Artificial Neural Network instance, the ASS-PRS retrained scenario is the one show- ASM Activated Sludge Model ing the lowest pollutant concentrations and consequently the ASM1 Activated Sludge Model No.1 lowest EQI, 5218.76. In terms of OCI, ASS-PRS scenario ASM2 Activated Sludge Model No.2 only adds external carbon when an effluent limit violation ASM2d Activated Sludge Model No.2d is predicted. Therefore, this is translated into an improve- ASM3 Activated Sludge Model No.3 ment (reduction) of the WWTP’s OCI w.r.t. DS and HS ASS-NHRS ANN-based Soft-Sensor SNH ,e control scenarios where its maximum improvement equals to reduction scenario a 29.78% w.r.t. DS. ASS-NTRS ANN-based Soft-Sensor SNtot,e reduction scenario V. CONCLUSION ASS-PRS ANN-based Soft-Sensor pollutant In this paper, the deployment of an ANN-based Soft-Sensor reduction scenario has been tested with predictive control strategies whose main BOD5 Biochemical Oxygen Demand (mg/L) aim is to reduce the SNH ,e and SNtot,e violations. In that BSM1 Benchmark Simulation Model No.1 sense, the ANN-based Soft-Sensor is in charge of predicting BSM2 Benchmark Simulation Model No.2 the effluent concentrations that will be adopted by a hierar- CL Default control strategy loop adopted in [8] chical control strategy in order to actuate in advanced and COD Chemical Oxygen Demand avoid possible violations. Besides, performance of the control DS Default Scenario strategies has been compared with BSM2 default control. EQI Effluent Quality Index Results show that the application of the ANN-based Soft- HS Hierarchical Control Scenario Sensor improves the default control in terms of EQI, OCI IWA International Water Association and number of violations. For instance, control strategies KL a x Oxygen Transfer Coefficient devoted to reducing SNH ,e violations are able to completely for tank x (d −1 ) reduce them whereas BSM2 default control shows violations LSTM Long-Short Term Memory equivalent to the 0.41% of the WWTP operational time. MLP Multilayer Perceptron On the other hand, the application of the ANN-based Soft- MPC Model Predictive Control Sensor in a control strategy devoted to reducing SNH ,e and OCI Overall Cost Index SNtot,e violations at the same time is also addressed in this PH Prediction Horizon work. For that purpose, predictive control strategies have PI Proportional Integral Controller been modified to be able to act together. Results emphasize qEC,x External carbon flow rate at tank x (m3 /d) the importance of ANN-based Soft-Sensor’s input data. In our Qa Internal recirculation flow rate (m3 /d) case, the recirculation flow (Qa ) acts as an input of the Qe Effluent flow rate (m3 /d) ANN-based Soft-Sensor when predicting SNtot,e as well as it Qin Influent flow rate (m3 /d) is one of the variables modified by the control strategy reduc- Qpo Primary Clarifier’s flow rate (m3 /d) ing the SNH ,e violations. Therefore, Qa modifications have to Qr Sludge internal recycle flow rate (m3 /d) be considered in the ANN-based Soft-Sensor training process RMSE Root Mean Squared Error (mg/L) in order to avoid a degradation of predictions’ accuracy. RNN Recurrent Neural Network Then, it is shown that the modified predictive con- SNH Ammonium Concentration (mg/L) trol approach improves the control performance w.r.t. SNH ,e Ammonium Concentration BSM2 default control approaches achieving the reduction in the effluent (mg/L) of the percentage of time that effluent limits are violated. SNH ,5 Ammonium Concentration When comparing the performance of our approach, one can at the fifth reactor tank (mg/L) observe that it is able to reduce SNH ,e violations around a 90% SNKj Total Kjeldahl Nitrogen Concentration w.r.t the control strategy focused on reducing SNtot,e (ASS- (mg/L) NTRS). Furthermore, the percentage of time that effluent SNO,x Nitrate Nitrogen Concentration limits are violated is reduced 1.1 percentage points in the case at tank x (mg/L) of SNtot,e and approximately 0.325 percentage points in the SNtot Total Nitrogen Concentration (mg/L) case of SNH ,e , both w.r.t. BSM2’s default control strategies. SNtot,e Total Nitrogen Concentration Finally, it is important to notice that some considerations in the effluent (mg/L) 159784 VOLUME 7, 2019 I. Pisa et al.: LSTM-Based Wastewater Treatment Plants Operation Strategies for Effluent Quality Improvement SO,x Dissolved Oxygen Concentrations [20] I. Pisa, I. Santín, J. L. Vicario, A. Morell, and R. Vilanova, ‘‘A recur- at tank x (mg/L) rent neural network for wastewater treatment plant effuents’ predic- Tas Environment Temperature (◦ C) tion,’’ in Proc. Actas 39th Jornadas Autom., Badajoz, Spain, Sep. 2018, pp. 621–628. [Online]. Available: http://eii.unex.es/ja2018/actas/JA2018_ TSS Total Suspended Solids (mg/L) 148.pdf WL Window Length [21] I. Pisa, I. Santín, J. L. Vicario, A. Morell, and R. Vilanova, ‘‘ANN-based WWTP Wastewater Treatment Plant soft sensor to predict effluent violations in wastewater treatment plants,’’ Sensors, vol. 19, no. 6, p. 1280, 2019. γSNH ,e SNH ,e threshold (mg/L) [22] J. B. Copp, The COSTSimulation Benchmark: Description and Simulator γSNtot,e SNtot,e threshold (mg/L) Manual(a product of COST Action 624 & COST Action 682). Luxembourg, U.K.: Office for Official Publications of the European Union, 2002. [23] K. V. Gernaey, U. Jeppsson, P. A. Vanrolleghem, and J. B. Copp Bench- REFERENCES marking of Control Strategies for Wastewater Treatment Plants. London, U.K.: IWA, 2014. [1] Council Directive 91/271/EEC of 21 May 1991 Concerning Urban Waste [24] P. Y. Yang and Z. Zhang, ‘‘Nitrification and denitrification in the wastew- Water Treatment, Eur. Commission, Brussels, Belgium, 1991. ater treatment system,’’ in Proc. UNESCO—Univ. Tsukuba Int. Semi- [2] M. Henze, L. Grady, Jr., W. Gujer, G. V. R. Marais, and T. Matsuo, ‘‘Acti- nar Traditional Technol. Environ. Conservation Sustain. Develop. Asian– vated sludge model no. 1,’’ IAWPRC Sci., London, U.K., Tech. Rep. 1, Pacific Region, Tsukuba, Japan, Dec. 1995, pp. 145–158. Jan. 1987. [25] I. Takács, G. G. Patry, and D. Nolasco, ‘‘A dynamic model of [3] M. Henze, W. Gujer, T. Mino, and M. C. van Loosdrecht, Activated sludge the clarification-thickening process,’’ Water Res., vol. 25, no. 10, models ASM1, ASM2, ASM2d ASM3. London, U.K.: IWA, 2000. pp. 1263–1271, 1991. [4] D. Vrecko, E. Volcke, U. Jeppsson, and K. Gernaey, ‘‘Evaluation criteria [26] Wastewater Treatment Fact Sheet: External Carbon Sources for Nitrogen description and example for BSM2,’’ Task Group Benchmarking Control Removal, document EPA 832-F-13-016, United States Environmental Pro- Strategies Wastewater Treatment Plants, Int. Water Assoc., London, U.K., tection Agency. Office of Wastewater Management, Aug. 2013. Tech. Rep. 23, 2007. [27] Y. Bengio, P. Simard, and P. Frasconi, ‘‘Learning long-term dependencies [5] R. Vilanova and A. Visioli, PID Control in the Third Millennium: Lessons with gradient descent is difficult,’’ IEEE Trans. Neural Netw., vol. 5, no. 2, Learned and New Approaches. London, U.K.: Springer, 2012. pp. 157–166, Mar. 1994. [6] U. Jeppsson, M.-N. Pons, I. Nopens, J. Alex, J. Copp, K. Gernaey, [28] S. Garcia, J. Luengo, and F. Herrera, Data Preprocessing in Data Mining. C. Rosen, J.-P. Steyer, and P. Vanrolleghem, ‘‘Benchmark simulation New York, NY, USA: Springer, 2015. model no 2: General protocol and exploratory case studies,’’ Water Sci. Technol., vol. 56, no. 8, pp. 67–78, Oct. 2007. IVAN PISA was born in Barcelona, Spain, in 1994. [7] W. Shen, X. Chen, and J. P. Corriou, ‘‘Application of model predictive con- He received the B.Sc. degree in telecommunica- trol to the BSM1 benchmark of wastewater treatment process,’’ Comput. tions systems engineering and the M.Sc. degree in Chem. Eng., vol. 32, no. 12, pp. 2849–2856, Dec. 2008. telecommunications engineering from the Univer- [8] I. Nopens, L. Benedetti, U. Jeppsson, M.-N. Pons, J. Alex, J. B. Copp, sitat Autònoma de Barcelona, Spain, in 2016 and K. V. Gernaey, C. Rosen, J.-P. Steyer, and P. A. Vanrolleghem, ‘‘Bench- 2018, respectively, where he is currently pursuing mark simulation model no 2: Finalisation of plant layout and default the Ph.D. degree in electrical and telecommuni- control strategy,’’ Water Sci. Technol., vol. 62, no. 9, pp. 1967–1974, 2010. cations engineering with the Wireless Information [9] H.-S. Ou, C.-H. Wei, H.-Z. Wu, C.-H. Mo, and B.-Y. He, ‘‘Sequential Networking (WIN) Group and Advanced Control dynamic artificial neural network modeling of a full-scale coking wastew- Systems and Automation (ASAC) Group. ater treatment plant with fluidized bed reactors,’’ Environ. Sci. Pollut. Res., From 2016 to 2018, he was a Research Assistant with the WIN Group. vol. 22, no. 20, pp. 15910–15919, 2015. His research interests include machine learning, the IoT, Industry 4.0, and [10] C. Foscoliano, S. Del Vigo, M. Mulas, and S. Tronci, ‘‘Predictive control data analytics. In May 2019, he has received the Best Academic Record of an activated sludge process for long term operation,’’ Chem. Eng. J., Award from the Spanish Official College of Telecommunications Engineers vol. 304, pp. 1031–1044, Nov. 2016. (Colegio Oficial de Ingenieros de Telecomunicación-COIT). [11] J.-F. Qiao, Y. Hou, L. Zhang, and H.-G. Han, ‘‘Adaptive fuzzy neural network control of wastewater treatment process with multiobjective oper- IGNACIO SANTÍN was born in Barcelona, Spain, ation,’’ Neurocomputing, vol. 275, pp. 383–393, Jan. 2018. in 1980. He received the B.Sc. degree in electronic [12] H.-G. Han, L. Zhang, H.-X. Liu, and J.-F. Qiao, ‘‘Multiobjective design of engineering, in 2006, the M.Sc. degree in envi- fuzzy neural network controller for wastewater treatment process,’’ Appl. ronmental studies (specialized in environmental Soft Comput., vol. 67, pp. 467–478, Jun. 2018. technology), and the Ph.D. degree in wastewater [13] I. Santín, C. Pedret, R. Vilanova, and M. Meneses, ‘‘Advanced decision treatment control, in 2015. control system for effluent violations removal in wastewater treatment He was involved in the water control of plants,’’ Control Eng. Pract., vol. 49, no. 2, pp. 60–75, Apr. 2016. Barcelona sewer systems, and management and [14] M. Sadeghassadi, C. J. Macnab, B. Gopaluni, and D. Westwick, ‘‘Appli- improvement of processes, until 2011. cation of neural networks for optimal-setpoint design and MPC con- trol in biological wastewater treatment,’’ Comput. Chem. Eng., vol. 115, pp. 150–160, Jul. 2018. ANTONI MORELL received the M.Sc. degree [15] Z. Y. Wan, P. Vlachas, P. Koumoutsakos, and T. Sapsis, ‘‘Data-assisted in electrical and electronics engineering and the reduced-order modeling of extreme events in complex dynamical sys- Ph.D. degree from the Universitat Politècnica de tems,’’ PLoS ONE, vol. 13, no. 5, 2018, Art. no. e0197704. Catalunya (UPC), Barcelona, in 2002 and 2008, [16] K. Greff, R. K. Srivastava, J. Koutnìk, B. R. Steunebrink, and respectively. J. Schmidhuber, ‘‘LSTM: A search space odyssey,’’ IEEE Trans. Neural He was with the Signal Theory and Commu- Netw. Learn. Syst., vol. 28, no. 10, pp. 2222–2232, Oct. 2017. [17] I. Goodfellow, Y. Bengio, and A. Courville, Deep Learning. Cambridge, nications Department, UPC, from 2002 to 2005, MA, USA: MIT Press, 2016. holding a Spanish Government FPU Grant to pur- [18] R. Vilanova, I. Santín, and C. Pedret, ‘‘Control y operación de esta- sue the Ph.D. degree. He joined the Universitat ciones depuradoras de aguas residuales: Modelado y simulación,’’ Revista Autònoma de Barcelona, in 2005, where he is Iberoamericana de Autom. e Inform. Ind., vol. 14, no. 3, pp. 217–233, 2017. currently an Associate Professor. He has expertise in optimization techniques [19] Y. Lorenzo-Toja and I. Vázquez-Rowe, M. J. Amores, M. Termes-Rifé, applied to communications and the IoT/WSN, publishing over articles in D. Marín-Navarro, M. T. Moreira, and G. Feijoo, ‘‘Benchmarking wastew- recognized international journals and over 50 articles including conference ater treatment plants under an eco-efficiency perspective,’’ Sci. Total Env- proceedings. His current research interests include the IoT solutions and deep iron., vols. 566–567, pp. 468–479, Oct. 2016. learning applications to e-health and industry 4.0. VOLUME 7, 2019 159785 I. Pisa et al.: LSTM-Based Wastewater Treatment Plants Operation Strategies for Effluent Quality Improvement JOSE LOPEZ VICARIO received the degree RAMON VILANOVA (M’06) was born in Lleida, in electrical engineering and the Ph.D. degree Spain, in 1968. He received the master’s and (cum laude) from the Universitat Politècnica de Ph.D. degrees from the Universitat Autònoma de Catalunya (UPC), Barcelona, in 2002 and 2006, Barcelona (UAB), in 1991 and 1996, respectively. respectively, and the M.B.A. degree from the IESE He is currently a Lecturer with the School of Business School, Universidad de Navarra. Engineering, UAB, where develops educational He is an Associate Professor with the UAB. task teaching subjects of signals and systems, auto- He has a wide expertise on wireless communica- matic control and technology of automated sys- tions and the IoT/WSN, publishing 32 articles in tems. He is the author of several book chapters recognized international journals, over 50 articles and has more than 100 publications in international in conferences and supervising five Ph.D. thesis (over three in progress). congresses/journals. His research interests include methods of tuning of He has received the 2005/06 best Ph.D. prize in information technologies and PID regulators, systems with uncertainty, analysis of control systems with communications by the UPC. He holds the advanced research accreditation several degrees of freedom, application to environmental systems, and the issued by Catalan Government. development of methodologies for the design of machine-man interfaces. He is a member of the IFAC. 159786 VOLUME 7, 2019