Development of an Environmental Decision Support System for Enhanced Coagulation in Drinking Water Production

: Drinking water production is subject to multiple water quality requirements such as minimizing disinfection byproducts (DBPs) formation, which are highly related to natural organic matter (NOM) content. For water treatment, coagulation is a key process for removing water pollutants and, as such, is widely implemented in drinking water treatment plants (DWTPs) facilities worldwide. In this context, artiﬁcial intelligence (AI) tools can be used to aid decision making. This study presents an environmental decision support system (EDSS) for coagulation in a Mediterranean DWTP. The EDSS is structured hierarchically into the following three levels: data acquisition, control, and supervision. The EDSS relies on inﬂuent water characterization, suggesting an optimal pH and coagulant dose. The model designed for the control level is based on response surface methodology (RSM), targeted to optimize removal for the response variables (turbidity, total organic carbon (TOC), and UV 254 ). Results from the RSM model provided removal percentages for turbidity (64.6%), TOC (21.9%), and UV 254 (30%), which represented an increase of 4%, 33%, and 28% as compared with the DWTP water sample. Regarding the entire EDSS, 62%, 21%, and 25% of turbidity, TOC, and UV 254 removal were ﬁxed as the optimization criteria. Supervision rules (SRs) were included at the top of the architecture to intensify process performance under speciﬁc circumstances.


Introduction
Drinking water treatment plants (DWTPs) supply water for all citizens under strictly legislated quality parameters. Multiple factors have an impact on drinking water treatment. For instance, scientific evidence shows that climate change has been modifying the availability of surface waters and inducing some changes in the quality of surface waters [1][2][3]. This situation, coupled with the idiosyncrasy of Mediterranean countries, i.e., geographical regions where water resources are highly stressed, has created additional difficulties for drinking water management. There are different types of water catchment facilities depending on the water source, i.e., groundwater, seawater, regenerated water, and surface water (including rivers and reservoirs) [4,5].
All DWTPs deal with influent natural organic matter (NOM) fluctuations. NOM is a heterogenic matrix and has become the most challenging factor to ensure drinking water regulations are met [6,7]. Spanish legislation requires a chlorine-based oxidation process at the end of treatment to avoid disinfection byproducts (DBPs) formation throughout the distribution network [8]. It is at this point where NOM removal becomes significant, given that NOM is the largest precursor of these compounds [9][10][11][12]. An increase of NOM removal in coagulation and flocculation reduces DBPs formation along water treatment and distribution.
In order to ensure NOM removal throughout the treatment process, DWTPs run a series of complementary unit operations. The most typical configuration is coagulation/flocculation coupled to filtration-based processes. Several authors [13][14][15] have shown that coagulation and flocculation optimization has an effect on organic components removal. Nevertheless, sand filters and CAG beds are critical for removing certain groups of NOM fractions [16,17]. Considering processes following coagulation, ultrafiltration (UF) membranes are emerging as promising and robust water quality treatments [18,19] that can even work as hybrid systems [20,21]. In this sense, parameters monitored to control membrane fouling can be used to complement NOM characterization [22]. Hence, the integration of enhanced coagulation models coupled with the expert rules derived from membrane experiments can improve DWTPs performance.
In an integrated treatment, the efficacy of enhanced coagulation has an impact on the following unit operations and, as such, the type of coagulant, dosages, dosing methodologies (continuous or intermittent), dosing points, and mixing methods [6,23] must be controlled in order to avoid membrane fouling, if the next unit operation in the treatment chain is a membrane-based treatment [24,25]. Several water properties (hydrophobicity, charge density, molecular weight, and molecular size) and impurities (colloidal or dissolved, protein-like substances, organic or inorganic) contribute to the fouling phenomena [26,27]. Considering all of this, UF fouling indicators can be used to characterize NOM, adding information to that already provided by the enhanced coagulation models.
To track and remove NOM content, DWTPs have developed a set of analytical techniques and have improved the quantity of the sensors implemented to monitor NOM, in an attempt to adapt the treatment to the environmental conditions [28]. To achieve a resilient process, NOM must be characterized and quantified at different stages during the treatment to control the efficiency of the treatments and to determine the levels of reactivity of the NOM compounds. The water content of the NOM is monitored through online sensors and analyzers, continuously producing large amounts of data. This data, which can be codified and incorporated into an environmental decision support system (EDSS), contain valuable information about the capability of the DWTPs' unit processes to reduce NOM and the related DBP formation. EDSSs are artificial intelligence (AI) tools that have emerged to cope with systems' operational complexity and accelerate decision making [29]. They integrate quantitative and qualitative aspects, combining mechanistic and statistical models together with other AI techniques. For instance, in a real-plant application, process parameters such as turbidity and UV 254 were used to build an artificial neural network to predict oxidant demand at a full-scale DWTP [30].
For EDSS implementation, it is important to define an operating structure which should make it possible to work with a fast and easily updated version of the system and to include any new requirements (legislation updates and modifications), new models, or new DWTP treatments. In that sense, the EDSS architecture has to be structured hierarchically in order to perfectly visualize all the modules or codified knowledge [31,32]. Consequently, a three-level architecture can be defined as data acquisition, control, and supervision [33]. According to this study, the control level represents the engine of the whole EDSS.
Traditionally, coagulation has been modeled through a one-factor-at-a-time approach (OFAT), based on controlling pH and coagulant doses to counter the turbidity response. To achieve enhanced coagulation, other water parameters, rather than solely turbidity removal, can be considered [34,35]. The development and implementation of these approaches implies an increase in the number of quality parameters (factors and responses) considered in the process. For this purpose, some modeling tools can be applied. For instance, response surface methodology (RSM) which is a technique based on mathematical statistical methods, provides an efficient and rapid resolution for coagulation processes that offers a multivariate response optimization analysis using a minimum number of experimental tests. RSM is also useful to describe the importance of individual factors as well as their interactive influences [36][37][38][39].
The present study was carried out within the framework of developing an EDSS for a water treatment facility in the Mediterranean, which would help to improve the whole plant's performance. The general objective was to develop an EDSS module for enhanced coagulation in order to determine the optimum operation conditions for this unit operation by achieving the following three specific objectives: (i) develop an enhanced coagulation model using RSM, (ii) evaluate the model for the case study, and (iii) develop the applied knowledge-based supervision rules for the EDSS.
The paper is structured as follows: First, in the Materials and Methods section the DWTP case study, laboratory experiments, and RSM coagulation model design are described; then, the Results and Discussion are divided into two subsections, the enhanced coagulation model and the EDSS architecture, where model analysis and optimization are fully detailed; finally, the three-level architecture of the EDSS is drawn up and specified with the proposed supervision rules.

Case Study
The NOM-related EDSS for coagulation unit operation optimization was developed at the Montfullà DWTP, located near Girona (NE Spain). This facility provides water to the province of Girona, and is managed by the Aigües de Girona, Salt i Sarrià de Ter company. Influent water coming from a series of connected reservoirs (Sau-Susqueda-Pasteral) in the Ter river basin is conducted through a 16 km pipeline. The maximum production of drinking water is 125,000 m 3 ·day −1 , supplied to circa 300 k inhabitants. The effect the reservoirs have on the quality of the water along the Ter river has been studied since the 1990s, and the water before and after the reservoirs' experience has been determined as having differences in NOM quantity and quality due to the settling effect and also the degradation of the organic compounds [40]. The treatment chain at the Montfullà DWTP is comprised of the following: (1) primary oxidation (PO) process with chlorine dioxide (ClO 2 ) in the mixing chamber; (2) rapidly followed by coagulation and flocculation with the addition of powdered polyaluminium chloride (PAC) before slow sedimentation settling; (3) then, gravity filtration through sand filters; and (4) CAG beds (in this facility, flocculant is not added as the powdered PAC alone is enough to keep the desired water quality requirements); (5) at the end of the treatment, the disinfection phase occurs to ensure the free chlorine concentration required as the water is moved through the supply distribution network [8]. Figure 1 shows the geographical location and a representation of the Montfullà DWTP treatment flow diagram.
A group of parameters are monitored to characterize the influent coming into the facility and adapt the treatment to the changing conditions ( Table 1). Some of these parameters, such as turbidity and total organic carbon (TOC), are used as NOM content indicators.   First, for the EDSS data acquisition level, it was necessary to identify the source, the format, and the availability of data. The aim was to propose a database for EDSS data acquisition. Different types of information were included in this database which included water quality (incoming influent and throughout the treatment), operational reagent (dosages), and laboratory analytics. To proceed with this analysis objectively, data were classified into databases A, B, and C based on their source, typology, and nature. Database A contained the manually introduced data from the DWTP laboratory analyses; Database B contained the data collected from the sensors, probes, and online analyzers; and Database C contained the values of the operational reagent dosages and other working parameters (flow, pH, HRTs, etc.).
Then, data from the DWTP influent were evaluated statistically representing the temporal evolution of the variables to detect behavioral patterns (seasonality) and cases of changing conditions, as well as normal distribution diagrams and other statistical values (average, median and percentile values, box diagrams, and so forth). Furthermore, Pearson correlations were analyzed to determine the influences between parameters. Data processing tools Excel 2016 (Microsoft®, Santa Rosa, CA, USA) and MATLAB 2015a (Mathworks®, Natick, MA, USA) were used to perform these analyses.
All these statistics, graphs, and correlations were assessed to identify the key influent parameters which needed to be considered to achieve an enhanced coagulation RSM model (EDSS control level). To compare the effect of raw water characterization and PO (ClO2DOSE) against the coagulation

Influent Raw Water Parameter Selection
First, for the EDSS data acquisition level, it was necessary to identify the source, the format, and the availability of data. The aim was to propose a database for EDSS data acquisition. Different types of information were included in this database which included water quality (incoming influent and throughout the treatment), operational reagent (dosages), and laboratory analytics. To proceed with this analysis objectively, data were classified into databases A, B, and C based on their source, typology, and nature. Database A contained the manually introduced data from the DWTP laboratory analyses; Database B contained the data collected from the sensors, probes, and online analyzers; and Database C contained the values of the operational reagent dosages and other working parameters (flow, pH, HRTs, etc.).
Then, data from the DWTP influent were evaluated statistically representing the temporal evolution of the variables to detect behavioral patterns (seasonality) and cases of changing conditions, as well as normal distribution diagrams and other statistical values (average, median and percentile values, box diagrams, and so forth). Furthermore, Pearson correlations were analyzed to determine the influences between parameters. Data processing tools Excel 2016 (Microsoft®, Santa Rosa, CA, USA) and MATLAB 2015a (Mathworks®, Natick, MA, USA) were used to perform these analyses.
All these statistics, graphs, and correlations were assessed to identify the key influent parameters which needed to be considered to achieve an enhanced coagulation RSM model (EDSS control level). To compare the effect of raw water characterization and PO (ClO2 DOSE ) against the coagulation parameters from the DWTP, the data provided for Databases A, B, and C were correlated with the coagulant dose. Table 2 shows the results from these correlations.  Table 2 shows that the highest correlations with the coagulant dose were Turbidity RAW and TOC RAW . On the basis of these results and the pre-existing scientific bibliography, these two raw water parameters were selected as enhanced coagulation model responses. In addition to these, UV 254 was included in the models and was proposed as a good indicator for NOM [41]. The objective of enhanced coagulation is to consider more responses (water parameters) than the OFAT approach does. For that reason, and to increase RSM robustness, the following three factors were selected as the most representative for DWTP coagulation performance: Turbidity, TOC, and UV 254 .

Jar Test Experiments
The jar test is widely used to determine the best coagulation conditions. Coagulant supplied by the DWTP was used in this study. The coagulant was alum-based (polyaluminium chloride), and the pH was adjusted with HCl 0.1M and NaOH 0.1M before the addition of the coagulant reagent. A Phipps & Bird (7790-910, Richmond, VA, USA) programmable jar tester was employed for the experiments (6 × 2 L rectangular jars). Mixing conditions were divided into three sequential steps as follows: rapid mix phase (1 min at 250 rpm), slow mix phase (30 min at 30 rpm), and a settling time of 30 min. The coagulant was added at T 0 of the rapid mix phase. NOM parameters (turbidity, TOC, and UV 254 ) were measured before and after the jar test experiments. Supernatants were collected from the middle of the water column to avoid collecting unstable superficial flocs.

Experimental Methodology for UF Membrane
To quantify the fouling phenomena, a bench-scale membrane filtration system with the ability to filter, in parallel, different water samples was constructed ( Figure 2). As NOM is considered to be one of the most critical fouling factors, different operational and quality parameters were monitored, including transmembrane pressure (TMP) values, flux, and permeability (K).
To assemble the hollow fiber (HF) UF membrane modules, a protocol to ensure that their characteristics were similar had to be developed. Each module was composed of two new PVDF fibers of equal length, (approximately 30 cm), thus, providing a useful filtration area of around 0.004 m 2 . The fibers used for the modules were provided by Polymem®and had a cut-off of 0.1 µm. All the modules were validated with an integrity test (5 min at 1 bar of pressure) and then the liquid permeability was assessed at 20 • C. Next, the continuous filtration experiments for estimating potential fouling were planned by maintaining a theoretical constant flux (monitored during the experiments) and evaluating the permeability as a key parameter in order to analyze the fouling potential [42,43].
The experimental UF tests, presented in this study, were evaluated by filtering the supernatant jar samples obtained after the coagulation experiments and the real DWTP coagulated sample. NOM-related parameters were measured before the UF experiments were run and at the same time as permeability was recorded. The study of permeability enabled the comparison between samples to be made because it integrated small changes into surface filtration areas which were calculated using online flux and transmembrane pressure (TMP) values (Equation (1)). The loss of permeability over the experiment was also calculated with Equation (2).
where flux is expressed by L·m −2 ·H −1 and transmembrane pressure (TMP) in Bar.
where K ti and K tf are permeability values at time = 0 and time = final, respectively.
where Kti and Ktf are permeability values at time = 0 and time = final, respectively. The UF experiments were carried out before and after a heavy flood event. This kind of extreme phenomena is typical in Mediterranean regions, causing alterations in reservoirs' water quality in terms of particulate and dissolved organic loads [44]. As the DWTP catchment is a reservoir system, the aim of the UF experiments was to correlate enhanced coagulation performance and UF membrane operation. In addition, all the samples were chemically analyzed.

Chemical Analysis
Water samples were characterized by monitoring specific parameters, including pH, turbidity, total carbon (TC), TOC, UV254, at the case study DWTP. For the turbidity measurements, a Hach TU5200 turbidimeter was used and the results were recorded in nephelometric units (NTU). TC/TOC and UV254 (cm −1 ) were analyzed with a Sievers M9 portable analyzer and a Cary 3500 UV-Vis Agilent Tech spectrophotometer with a quartz cell (1 cm of path length), respectively. The TC and TOC values were analyzed with the ICR function activated, thus, ensuring an inorganic carbon (IC) loss between 90 to 99%. Meanwhile, the pH was determined with a Crison micro pH 2000.
The ISO 5667-3:2018 requirements were followed to transport, store, and pretreat the samples. Samples were collected (without adding chemical reagents), directly from the DWTP influent through a pipe or from the river catchment, and were stored in amber bottles, in darkness at 4 °C. Once in the laboratory, to determine the TOC and UV254, the samples were filtered through 0.45 µm nylon filters prior to analysis. UV254 was measured according to Standard Methods: 5910B [45].

Response Surface Methodology (RSM) Design
The pH and coagulant dose were considered to be the key factors (A and B, respectively) in developing the response surface methodology (RSM) design. RSM for a NOM-related enhanced coagulation, which has been reported as a useful approach with which to model multifactorial processes such as coagulation, was developed. RSM with a central composite design (CCD) was the method chosen to optimize coagulation in the case study DWTP, in accordance with the methodology The UF experiments were carried out before and after a heavy flood event. This kind of extreme phenomena is typical in Mediterranean regions, causing alterations in reservoirs' water quality in terms of particulate and dissolved organic loads [44]. As the DWTP catchment is a reservoir system, the aim of the UF experiments was to correlate enhanced coagulation performance and UF membrane operation. In addition, all the samples were chemically analyzed.

Chemical Analysis
Water samples were characterized by monitoring specific parameters, including pH, turbidity, total carbon (TC), TOC, UV 254 , at the case study DWTP. For the turbidity measurements, a Hach TU5200 turbidimeter was used and the results were recorded in nephelometric units (NTU). TC/TOC and UV 254 (cm −1 ) were analyzed with a Sievers M9 portable analyzer and a Cary 3500 UV-Vis Agilent Tech spectrophotometer with a quartz cell (1 cm of path length), respectively. The TC and TOC values were analyzed with the ICR function activated, thus, ensuring an inorganic carbon (IC) loss between 90 to 99%. Meanwhile, the pH was determined with a Crison micro pH 2000.
The ISO 5667-3:2018 requirements were followed to transport, store, and pretreat the samples. Samples were collected (without adding chemical reagents), directly from the DWTP influent through a pipe or from the river catchment, and were stored in amber bottles, in darkness at 4 • C. Once in the laboratory, to determine the TOC and UV 254 , the samples were filtered through 0.45 µm nylon filters prior to analysis. UV 254 was measured according to Standard Methods: 5910B [45].

Response Surface Methodology (RSM) Design
The pH and coagulant dose were considered to be the key factors (A and B, respectively) in developing the response surface methodology (RSM) design. RSM for a NOM-related enhanced coagulation, which has been reported as a useful approach with which to model multifactorial processes such as coagulation, was developed. RSM with a central composite design (CCD) was the method chosen to optimize coagulation in the case study DWTP, in accordance with the methodology reported by [46]. Design response parameters were turbidity (%), TOC (%), and UV 254 (%) removal. Design-Expert®(Stat-Ease, Inc., Minneapolis, MN, USA) software version 11.0 was used to generate the models. The RSM was designed for a wider range of factors than those encountered in real DWTP operation, because the aim was to describe a total surface output model for response parameters. The Montfullà DWTP design was factorized with a pH range from 5.5 to 8.5, but in a real plant the operation fluctuates between 7.5 and 8. The coagulant dose was defined in the range from 10 to 40 mg·L −1 , which was considered to be feasible and representative.
Once the CCD-RSM had been developed, the model's outputs were used to identify the best pH and coagulant conditions for coagulation optimization. The removal percentages of the response variables (turbidity, TOC, and UV 254 ) were configured as an output of the model by following Equations (3)-(5). The raw water samples were the DWTP's influent without the addition of reagents.
It is worth noting that different sampling campaigns are planned to be carried out throughout the year, including seasonality events and different quantity/quality NOM fluctuations, in order to enhance the robustness and accuracy of the proposed design.

Results and Discussion
In this section, the enhanced coagulation model and the UF membrane experiments are presented. Then, the data and knowledge are incorporated into the EDSS architecture.

Development and Evaluation of the Enhanced Coagulation Model
The enhanced coagulation model based on the RSM-CCD developed at the case study DWTP is presented here. The factors for the model were pH (A) and coagulant dose (B), while percentages of turbidity, TOC, and UV 254 removal were the responses. Output supernatants from the jar test experiments were characterized for each model run ( Table 3). Some of the runs presented response values without significant percentages of removal (less than 0.5%) and, as such, were not considered. These results can be explained by the high pH effect (in Runs 7,9,and 14) and the absence of coagulant dosage (Run 16). The summary of run factors provided by the model's output and responses obtained from the analysis of the supernatants are presented in Table 3.

Model Analysis and Diagnosis
In this section, the results from model fitting and process analyses are presented. For three responses, statistics provided by ANOVA exhibited that model terms were significant (p-value < 0.05). Models did not exhibit lack of fit (p-value > 0.05), thus, indicating a significant level of confidence (lack of fit was not significant relative to the pure error). Therefore, the normal plot of residuals did not show significant deviations with respect to the linear distribution ( Figure 3A). Points which differed from a linear distribution were checked and significant relevance was not detected ( Figure 3B).

Model Analysis and Diagnosis
In this section, the results from model fitting and process analyses are presented. For three responses, statistics provided by ANOVA exhibited that model terms were significant (p-value < 0.05). Models did not exhibit lack of fit (p-value > 0.05), thus, indicating a significant level of confidence (lack of fit was not significant relative to the pure error). Therefore, the normal plot of residuals did not show significant deviations with respect to the linear distribution ( Figure 3A). Points which differed from a linear distribution were checked and significant relevance was not detected ( Figure 3B).
The coded equation can be used to predict responses for a given level of each factor and to identify the relative impact of the factors by comparing the factor coefficients. In addition, it is useful to know what the most relevant factor for each response is (A, B, AB, A 2 , and B 2 ) and which of these are significant model terms. In that sense, the quadratic equations suggest that the coagulant dose represents the highest influence factor for turbidity and UV254 removal (Table 4).   The coded equation can be used to predict responses for a given level of each factor and to identify the relative impact of the factors by comparing the factor coefficients. In addition, it is useful to know what the most relevant factor for each response is (A, B, AB, A 2 , and B 2 ) and which of these Water 2020, 12, 2115 9 of 17 are significant model terms. In that sense, the quadratic equations suggest that the coagulant dose represents the highest influence factor for turbidity and UV 254 removal (Table 4).  To evaluate the model, the standard error (SE) was plotted in the fraction of design space using an fraction of design space (FDS) graph, thus, providing information about the maximum predictor variability of any given factor of the total space represented by the model [47]. In our case, 80 percent of the RSM design falls at or below 0.44 units of SE (see Figure 4A). The representation of SE in our RSM is useful in order to determine its prediction power. In this case, the model is less affected by intermediate values of pH and coagulant dose ( Figure 4B) because the CCD is a design composed of six center points, and therefore more robust in the middle of the represented space. However, in the corners, close to our design limits, the model is affected by the lack of predictability, i.e., regions where the response cannot be predicted as precisely. To evaluate the model, the standard error (SE) was plotted in the fraction of design space using an fraction of design space (FDS) graph, thus, providing information about the maximum predictor variability of any given factor of the total space represented by the model [47]. In our case, 80 percent of the RSM design falls at or below 0.44 units of SE (see Figure 4A). The representation of SE in our RSM is useful in order to determine its prediction power. In this case, the model is less affected by intermediate values of pH and coagulant dose ( Figure 4B) because the CCD is a design composed of six center points, and therefore more robust in the middle of the represented space. However, in the corners, close to our design limits, the model is affected by the lack of predictability, i.e., regions where the response cannot be predicted as precisely.

Model Optimization
Having evaluated the accuracy and robustness of the performed models, the next step was to optimize the coagulation and to generate predictive models for our three responses, i.e., turbidity, TOC, and UV254 removal as a function of two factors, i.e., pH and coagulant dose.
The numerical optimization is presented through the two-dimensional (2D) and threedimensional (3D) surface plots shown in Figure 5. As a general trend, best removals were obtained at a lower pH for the three responses.
For turbidity removal, the acceptable range (≥60%) was at a medium coagulant dose and all ranges of pH, (see Figure 5A). At neutral pH values and a high coagulant dose, TOC removal was higher than 30%. At a feasible DWTP, (pH varying from 7 to 8), the highest removals were obtained at pH 7 and with a medium coagulant dose (between 30 and 40 mg·L −1 ), i.e., 65% of turbidity, 30% of TOC, and UV254 removal. Response surface plots are presented with the ranges fixed by model runs (0-50 mg·L −1 ) for coagulant dose and 4.5-9.5 for pH, (see Table 3) in order to observe the full gradient through the whole response surface. Subsequently, the model was numerically optimized with the aim of determining a common surface response in order to achieve satisfactory levels of removal for the three aforementioned

Model Optimization
Having evaluated the accuracy and robustness of the performed models, the next step was to optimize the coagulation and to generate predictive models for our three responses, i.e., turbidity, TOC, and UV 254 removal as a function of two factors, i.e., pH and coagulant dose.
The numerical optimization is presented through the two-dimensional (2D) and three-dimensional (3D) surface plots shown in Figure 5. As a general trend, best removals were obtained at a lower pH for the three responses.
For turbidity removal, the acceptable range (≥60%) was at a medium coagulant dose and all ranges of pH, (see Figure 5A). At neutral pH values and a high coagulant dose, TOC removal was higher than 30%. At a feasible DWTP, (pH varying from 7 to 8), the highest removals were obtained at pH 7 and with a medium coagulant dose (between 30 and 40 mg·L −1 ), i.e., 65% of turbidity, 30% of TOC, and UV 254 removal. Response surface plots are presented with the ranges fixed by model runs (0-50 mg·L −1 ) for coagulant dose and 4.5-9.5 for pH, (see Table 3) in order to observe the full gradient through the whole response surface. Subsequently, the model was numerically optimized with the aim of determining a common surface response in order to achieve satisfactory levels of removal for the three aforementioned responses. The optimization criteria were fixed by evaluating the minimum and maximum removals per run and response (see Table 3). For turbidity, the minimum removal was 47.1% and the maximum 77.5%, for TOC 6.8% and 36.3%, and for UV 254 1.2% and 49.3%. The suitable low range was calculated following Equation (6), thus, ensuring, at least, the mid-upper percentage of removal in the obtained response range. The upper range of response removal was the maximum obtained after the jar test experiments (Table 3). Hence, selected ranges were superposed in a common surface, and the overlay graph was obtained ( Figure 6). In Figure 6, the area shaded grey illustrates the surface area where the optimization criteria were achieved: 62.3-77.5% removal for turbidity, 21.55-36.3% for TOC, and 25.25-49.3% for UV 254 . As in the discussion above, pH 7 was determined to be the best value for a feasible level in a real DWTP operation. For the model developed here, the yellow circle (pH = 7 and coagulant dose = 40 mg·L −1 ) represents the optimized proposal for coagulation.
Water 2020, 12, x FOR PEER REVIEW 10 of 18 following Equation (6), thus, ensuring, at least, the mid-upper percentage of removal in the obtained response range. The upper range of response removal was the maximum obtained after the jar test experiments (Table 3). Hence, selected ranges were superposed in a common surface, and the overlay graph was obtained ( Figure 6). In Figure 6, the area shaded grey illustrates the surface area where the optimization criteria were achieved: 62.3-77.5% removal for turbidity, 21.55-36.3% for TOC, and 25.25-49.3% for UV254. As in the discussion above, pH 7 was determined to be the best value for a feasible level in a real DWTP operation. For the model developed here, the yellow circle (pH = 7 and coagulant dose = 40 mg·L −1 ) represents the optimized proposal for coagulation. The results obtained by the model (the yellow circle) were compared with those from the real DWTP operation (the blue circle). For the real DWTP, the sampling campaign using the jar test took place in April 2019. The values were calculated from April's monthly average, with a pH result of 7.8 and coagulant dose of 21.9 mg·L −1 . The improvements obtained in terms of coagulation removals (Equation (7)) were +4% for turbidity, +33% for TOC, and +28% for UV254 removal as compared with the DWTP's monthly operation mean. The lower impact on turbidity removal is fundamentally because of the low turbidity value of the influent water. However, it has been demonstrated that coagulants do increase the amount of turbidity removal with high turbid waters (as a consequence of more particulate NOM fraction), and their capacity for turbidity removal is likewise reduced in low turbidity waters [48,49]. The results obtained by the model (the yellow circle) were compared with those from the real DWTP operation (the blue circle). For the real DWTP, the sampling campaign using the jar test took place in April 2019. The values were calculated from April's monthly average, with a pH result of 7.8 and coagulant dose of 21.9 mg·L −1 . The improvements obtained in terms of coagulation removals (Equation (7)) were +4% for turbidity, +33% for TOC, and +28% for UV 254 removal as compared with the DWTP's monthly operation mean. The lower impact on turbidity removal is fundamentally because of the low turbidity value of the influent water. However, it has been demonstrated that coagulants do increase the amount of turbidity removal with high turbid waters (as a consequence of more particulate NOM fraction), and their capacity for turbidity removal is likewise reduced in low turbidity waters [48,49].
Regions that fit with fixed optimization criteria appear shaded in grey. The yellow circle represents optimum feasible conditions to achieve NOM enhanced coagulation and the blue circle shows real DWTP operation removals.

Knowledge-Based Rules for Coupled Enhanced Coagulation-Membrane Filtration
In this section, the results from the enhanced coagulation coupled to UF experiments are presented. After evaluating the supernatants obtained in the jar test experiments, runs 8 and 17 were chosen for continuous UF assays ( Table 3). The election criteria followed the highest removal values for three responses (49.7%, Run 8) and the best run in a feasible operation at the DWTP (pH = 7, Run 17). Although Run 15 had high values, it was not selected because it was outside the initial model boundaries.
Permeability evolution over time was monitored. The reduction of permeability was related to fouling properties [50]. The results shown during the dry period ( Figure 7A) revealed that the decrease in permeability was higher in the DWTP sample than Runs 8 and 17, although the initial value being the largest. The UF membrane with the DWTP sample was the most fouled and experienced a 30% permeability loss. A comparison of these results with the after-flood (AF) event experiment ( Figure 7B) seems to indicate that there is no apparent relationship. After the flood, Run 17 presented the most fouled sample, with a decrease in permeability of over 40%. Regions that fit with fixed optimization criteria appear shaded in grey. The yellow circle represents optimum feasible conditions to achieve NOM enhanced coagulation and the blue circle shows real DWTP operation removals.

Knowledge-Based Rules for Coupled Enhanced Coagulation-Membrane Filtration
In this section, the results from the enhanced coagulation coupled to UF experiments are presented. After evaluating the supernatants obtained in the jar test experiments, runs 8 and 17 were chosen for continuous UF assays ( Table 3). The election criteria followed the highest removal values for three responses (49.7%, Run 8) and the best run in a feasible operation at the DWTP (pH = 7, Run 17). Although Run 15 had high values, it was not selected because it was outside the initial model boundaries.
Permeability evolution over time was monitored. The reduction of permeability was related to fouling properties [50]. The results shown during the dry period ( Figure 7A) revealed that the decrease in permeability was higher in the DWTP sample than Runs 8 and 17, although the initial value being the largest. The UF membrane with the DWTP sample was the most fouled and experienced a 30% permeability loss. A comparison of these results with the after-flood (AF) event experiment ( Figure 7B) seems to indicate that there is no apparent relationship. After the flood, Run 17 presented the most fouled sample, with a decrease in permeability of over 40%. To understand these behaviors, the chemical parameters values (Table 5) had to be checked to comprehend the permeability decreases. As we expected, the waters from the AF event had more organic charge, reflected by the increase of turbidity and the UV254 values in the raw water samples collected. However, this trend was not observed for TOC. This can be explained by the fact that TOC content in large mass waters such as lakes or reservoirs is not related to precipitation or runoff [51]. The results for samples with higher permeability loss are well associated with high values of UV254. These results are in accordance with previous studies [52], supporting that UF membranes working with waters with a high level of aromatic compounds have a greater capacity to retain compounds associated with UV254 than those corresponding to the TOC fraction. The UV254 NOM fraction cannot pass through the membrane, consequently causing fouling and decreasing permeability capabilities.

EDSS Operational Architecture
The information and knowledge acquired in this study allowed us to establish a hierarchical structure and to configure the EDSS. In the following, each EDSS level, as well as the decision tree proposed for the supervision level are described (and summarized in Figure 8) as follows: Data acquisition level: Data dumped directly from DWTP databases provide the input for the control and supervisory levels. The values used in the algorithms correspond to instantaneous readings from online sensors and analyzers coupled with laboratory analytics.
Control level: Coagulation at the Montfullà DWTP is controlled by fixing the coagulant dose (PACDose) and the pH set point at the clarifiers (pHclar). The three parameters related to NOM content that were studied were considered for the EDSS design.
In terms of the influence raw water quality has on NOM content, several raw water quality parameters such as turbidity, TOC, and UV254 can be monitored. For operational parameters, pH and To understand these behaviors, the chemical parameters values (Table 5) had to be checked to comprehend the permeability decreases. As we expected, the waters from the AF event had more organic charge, reflected by the increase of turbidity and the UV 254 values in the raw water samples collected. However, this trend was not observed for TOC. This can be explained by the fact that TOC content in large mass waters such as lakes or reservoirs is not related to precipitation or runoff [51]. The results for samples with higher permeability loss are well associated with high values of UV 254 . These results are in accordance with previous studies [52], supporting that UF membranes working with waters with a high level of aromatic compounds have a greater capacity to retain compounds associated with UV 254 than those corresponding to the TOC fraction. The UV 254 NOM fraction cannot pass through the membrane, consequently causing fouling and decreasing permeability capabilities.

EDSS Operational Architecture
The information and knowledge acquired in this study allowed us to establish a hierarchical structure and to configure the EDSS. In the following, each EDSS level, as well as the decision tree proposed for the supervision level are described (and summarized in Figure 8) as follows: Data acquisition level: Data dumped directly from DWTP databases provide the input for the control and supervisory levels. The values used in the algorithms correspond to instantaneous readings from online sensors and analyzers coupled with laboratory analytics.
Control level: Coagulation at the Montfullà DWTP is controlled by fixing the coagulant dose (PAC Dose ) and the pH set point at the clarifiers (pH clar ). The three parameters related to NOM content that were studied were considered for the EDSS design. Water 2020, 12, x FOR PEER REVIEW 14 of 18

Conclusions
The study presents the development of an enhanced coagulation EDSS for drinking water production, with the aim to support daily decision making. To accomplish this, the EDSS was structured onto a three-level hierarchical architecture, i.e., data acquisition, control, and supervision. Regarding the control level, the model developed for coagulation is designed based on RSM and proposes the optimum pH and coagulant dosage under specific removal quality requirements (optimization criteria). Under normal conditions, the model is designed to achieve 62%, 21%, and 25% removal for turbidity, TOC, and UV254, respectively, thus, helping to reduce the risk of DBP formation. Membrane fouling indicators and expert knowledge allowed us to establish supervision rules to set up the top of the hierarchical architecture. Hence, the supervision level merges operational performance and expert decision-making knowledge. Three supervision rules (SR1, SR2, and SR3) have been created to work as a feed-back supervisory system to readjust the RSM criteria for an In terms of the influence raw water quality has on NOM content, several raw water quality parameters such as turbidity, TOC, and UV 254 can be monitored. For operational parameters, pH and coagulant dose are the main variables that can be modified in order to optimize coagulation. Influent water quality accounts for the principal environmental conditions which, apart from the seasonal variations, also depends on the depth from which raw water is taken from the reservoir (different catchment heights can be selected) [53]. In order to include these fluctuations, it is important to complete the EDSS with updated versions that include all this variability.
The model acts by recognizing the typology of influent water when it receives the three input variables (turbidity, TOC, and UV 254 ), and then considers all this information to propose an optimized pH and coagulant dose for coagulation optimization. Based on model described in Section 3.1, the EDSS was designed to propose operational consigns to ensure at least 62%, 21%, and 25% removal for turbidity, TOC, and UV 254 , respectively.
Supervision level: At the top hierarchical level of the EDSS, the expert knowledge and reasoning is incorporated and supervises the control actions module. The supervision rules developed to specify some process operation factors are also introduced at this stage. The main task of this level is to ensure NOM enhanced coagulation (adjusting pH and coagulant dose) under some active operational DWTP management considerations. Supervision rules (SR) were established to build this EDSS, i.e., SR 1 is related to UV 254 , SR 2 to cost-environmental assessment (coagulant dose), and SR 3 in case of flood events and are described as follows: • SR 1 intensifies the enhanced coagulation (pH and dose of coagulant) to achieve 50% UV 254 removal (modify RSM optimization criteria) to ensure a high quality post-coagulated water prior to filtration. This SR works when an influent UV254 RAW value is higher than 0.1 cm −1 so as to avoid sand filters pore blocking and increase their useful life. SR 1 acts with a fixed optimum pH = 7 and modifies the coagulant dose of the control level optimization criteria (Figure 9). In addition, this SR decreases the costs associated with sand filters and CAG replacement (>50% of DWTP total annual costs). • SR 2 is related to economic cost of the PAC, in cases with high proposed coagulant dose >40 mg·L −1 . In these cases, the priority is to adjust the pH instead of surpassing a coagulant dosage of 40 mg·L −1 (Figure 9). Polyaluminum coagulants are more expensive than other alum-based coagulants [49] and for this reason, and also to reduce the formation of chemical sludge, SR 2 is important for managing tasks and indirectly contributes to generating lower impact from an environmental viewpoint. • SR 3 is designed to be activated when facing flood events. When the Turbidity RAW is >10 NTU, the percentage of turbidity removal is automatically increased to 75%. As with SR 1 , the intervention of this SR occurs at the optimization criteria of enhanced coagulation control level, readjusting the coagulant dose to ensure the required quality ( Figure 9). Ensuring this percentage of removal in cases where turbidity is high is crucial for plant managers, because turbidity is considered to be the most critical factor in the performance of filtration-based treatments (sand filters and CAG).

Conclusions
The study presents the development of an enhanced coagulation EDSS for drinking water production, with the aim to support daily decision making. To accomplish this, the EDSS was structured onto a three-level hierarchical architecture, i.e., data acquisition, control, and supervision. Regarding the control level, the model developed for coagulation is designed based on RSM and proposes the optimum pH and coagulant dosage under specific removal quality requirements (optimization criteria). Under normal conditions, the model is designed to achieve 62%, 21%, and 25% removal for turbidity, TOC, and UV254, respectively, thus, helping to reduce the risk of DBP formation. Membrane fouling indicators and expert knowledge allowed us to establish supervision rules to set up the top of the hierarchical architecture. Hence, the supervision level merges operational performance and expert decision-making knowledge. Three supervision rules (SR1, SR2, and SR3) have been created to work as a feed-back supervisory system to readjust the RSM criteria for an

Conclusions
The study presents the development of an enhanced coagulation EDSS for drinking water production, with the aim to support daily decision making. To accomplish this, the EDSS was structured onto a three-level hierarchical architecture, i.e., data acquisition, control, and supervision. Regarding the control level, the model developed for coagulation is designed based on RSM and proposes the optimum pH and coagulant dosage under specific removal quality requirements (optimization criteria). Under normal conditions, the model is designed to achieve 62%, 21%, and 25% removal for turbidity, TOC, and UV 254 , respectively, thus, helping to reduce the risk of DBP formation. Membrane fouling indicators and expert knowledge allowed us to establish supervision rules to set up the top of the hierarchical architecture. Hence, the supervision level merges operational performance and expert decision-making knowledge. Three supervision rules (SR1, SR2, and SR3) have been created to work as a feed-back supervisory system to readjust the RSM criteria for an integrated control. These SR's are designed to intensify treatment by modifying coagulant doses in the case of detecting high influent water values of turbidity and UV 254 , and readjusting pH when the proposed coagulant dose is above the maximum desired value.
The EDSS designed offers an innovative approach in terms of NOM tracking and implementing data/knowledge inside the enhanced coagulation EDSS to assess drinking water production. Because of the capacity to feed the EDSS with the online data acquired from the abovementioned full-scale DWTP facility, the final goal is to implement it as an open-loop system in the plant itself. Funding: This research was funded by Ministerio de Economía, Industria y Competitividad, Gobierno de España: Retos de la Sociedad Project (CTM2017-83598-R). In addition, this study was supported by the University of Girona with PhD student grants IFUdG2017-30 and IFUdG2018-69.