Next Article in Journal
Optimized Design of a Multistage Centrifugal Pump Based on Volumetric Loss Reduction by Auxiliary Blades
Next Article in Special Issue
Machine Learning Techniques in Dosing Coagulants and Biopolymers for Treating Leachate Generated in Landfills
Previous Article in Journal
Research in the Atlantic Sector of the Southern Ocean and Propagation of Antarctic Bottom Water in the Atlantic
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Unlocking the Potential of Wastewater Treatment: Machine Learning Based Energy Consumption Prediction

Computer, Electrical and Mathematical Sciences and Engineering (CEMSE) Division, King Abdullah University of Science and Technology (KAUST), Thuwal 23955-6900, Saudi Arabia
*
Author to whom correspondence should be addressed.
Water 2023, 15(13), 2349; https://doi.org/10.3390/w15132349
Submission received: 1 June 2023 / Revised: 18 June 2023 / Accepted: 23 June 2023 / Published: 25 June 2023
(This article belongs to the Special Issue Mathematical Modelling and Model Analysis for Wastewater Treatment)

Abstract

:
Wastewater treatment plants (WWTPs) are energy-intensive facilities that fulfill stringent effluent quality norms. Energy consumption prediction in WWTPs is crucial for cost savings, process optimization, compliance with regulations, and reducing the carbon footprint. This paper evaluates and compares a set of 23 candidate machine-learning models to predict WWTP energy consumption using actual data from the Melbourne WWTP. To this end, Bayesian optimization has been applied to calibrate the investigated machine learning models. Random Forest and XGBoost (eXtreme Gradient Boosting) were applied to assess how the incorporated features influenced the energy consumption prediction. In addition, this study investigated the consideration of information from past data in improving prediction accuracy by incorporating time-lagged measurements. Results showed that the dynamic models using time-lagged data outperformed the static and reduced machine learning models. The study shows that including lagged measurements in the model improves prediction accuracy, and the results indicate that the dynamic K-nearest neighbors model dominates state-of-the-art methods by reaching promising energy consumption predictions.

1. Introduction

Recycled water is a strategic alternative to mitigate water scarcity, particularly in arid regions. Notably, the treated water from wastewater treatment plants (WWTPs) can be used for different purposes, such as irrigation, aquariums, or discharged with a low level of pollution [1]. WWTPs are energy-intensive processes; therefore, improving their energy efficiency is needed from environmental and economic viewpoints [2]. It has been reported in refs. [3,4,5] that WWTPs energy usage accounts for 4% of the national electricity in the United States and around 7% of the electrical energy worldwide [6]. One potential option for optimizing WWTPs and achieving energy savings is accurately predicting their energy consumption. By developing predictive models, operators and engineers can forecast the expected energy requirements of the treatment processes, enabling them to anticipate the energy demand associated with different operational scenarios and efficiently schedule equipment and processes. For example, by aligning energy-intensive activities, such as aeration or pumping, with periods of lower electricity rates or increased availability of renewable energy, WWTPs can strategically reduce their energy costs. This optimization approach ensures that energy-intensive processes are carried out when energy prices are more favorable or when renewable energy sources are abundant, leading to significant cost savings and a reduced environmental impact.
WWTPs currently operate conservatively, with high operating costs, and waste a large amount of energy They are energy intensive because they require significant energy to perform the various treatment processes necessary to clean the wastewater. Some of the major energy-intensive processes in a WWTP include the aeration, mixing, and pumping of water and solids for recirculation, filtration, and disinfection. Additionally, WWTPs also require energy for processing biosolids, which may involve aerobic digestion, heat drying, and dewatering. The energy demand for disinfection processes can vary depending on the method employed, with chlorination being less energy-intensive compared to UV or ozone disinfection. While sedimentation is a necessary process in wastewater treatment, it is not considered highly energy-intensive. These energy-intensive activities and the mechanical and electrical equipment used within the WWTP contribute significantly to the overall energy consumption. The energy consumption of a WWTP can be reduced by implementing energy-efficient technologies, such as using renewable energy sources, or by optimizing the treatment process. Machine learning methods are being used in WWTPs to improve their efficiency and reduce operational costs.
Enhancing the energy efficiency of WWTPs is essential to saving energy, reducing economic expenses, and preserving resources and the environment [7,8,9,10,11]. Over the years, numerous methods have been developed for modeling and predicting key characteristics of WWTPS, including analytical and data-derived techniques [12,13,14]. Analytical-based methods rely on a fundamental understanding of the physical process [15]. Developing a precise physical model for complex, high-dimensional, and nonlinear systems is challenging, expensive, and time-consuming [16]. On the other hand, data-based methods only rely on available historical data. Nowadays, data-driven methods, particularly machine learning methods, are more common in modeling and managing WWTP processes. For example, ref. [14] investigated the application of machine learning-based approaches to predict wastewater quality from WWTPs. They applied and compared six models, namely RF, SVM, Gradient Tree Boosting (GTB), Adaptive Neuro-Fuzzy Inference System (ANFIS), LSTM, and Seasonal Autoregressive Integrated Moving Average (SARIMAX). Hourly data collected from three WWTPs has been used to assess the investigated models. Results demonstrated that SARIMAX outperformed the other models in predicting wastewater effluent quality and with acceptable time computation. Recently, Andreides et al. presented an overview of data-driven techniques applied for influent characteristics prediction at WWTPs [17]. They showed that most reviewed works use machine learning-based approaches, particularly neural networks. Some studies achieved comparable or better outcomes using machine learning methods such as kNN and RF. This review concludes that no one approach dominates all the others from the reviewed literature because they are conducted using different datasets and settings, making the comparison difficult. Overall, NNs and hybrid models exhibited satisfactory prediction performance. Guo et al. considered ANN and SVM models to predict the total nitrogen concentration in a WWTP in Ulsan, Korea [18]. To this end, daily water quality and meteorological data were used as input variables for the machine-learning models. The pattern search algorithm is adopted to calibrate the ANN and SVM models. This study demonstrated the capability of these two models in predicting water quality and the superior performance of the SVM in this case study [18]. The study in [19] focused on predicting effluent water quality parameters of the Tabriz WWTP through a supervised committee fuzzy logic approach. The study in [2] evaluates the energy efficiency of a sample of Chilean wastewater treatment plants (WWTPs) using a newly developed technique called stochastic non-parametric envelopment of data (StoNED). This technique combines non-parametric and parametric methods, and allows for an exploration of the influence of the operating environment on the energy performance of WWTPs. The study found that the Chilean WWTPs were considerably inefficient, with an average energy efficiency score of 0.433 and significant opportunities to save energy (average savings were 203,413 MWh/year). The age of the facilities negatively affected energy efficiency, and WWTPs using suspended-growth processes, such as conventional activated sludge and extended aeration, had the lowest levels of energy efficiency. The study suggests that this methodology could be used to support decision-making for regulation and to plan the construction of new facilities, and the authors also suggest that this methodology could be used to measure the energy efficiency of other stages of the urban water cycle, such as drinking water treatment.
This study explores the potential of machine learning models for predicting energy consumption in WWTPs. The following key points summarize the contributions of this paper:
  • First, we considered all input variables, including hydraulic, wastewater characteristics, weather, and time data, to predict energy consumption in a WWTP. This study compared twenty-three machine learning models, including support vector regression with different kernels, GPR with different kernels, boosted trees, bagged trees, decision trees, neural networks (NNs), RF, k-nearest neighbors (KNN), Gradient Boosting (XGBoost), and LightgBMs. Bayesian optimization has been applied to calibrate and fine-tune the investigated machine-learning models to develop efficient energy consumption predictions. In addition, A 5-fold cross-validation technique has been used to construct these models based on training data. Five performance evaluation metrics are employed to assess the goodness of predictions. Results revealed that using all input variables to predict EC, the machine learning models did not provide satisfactory predictions.
  • Second, the aim is to construct reduced models by keeping only pertinent input variables to predict EC in WWTP. To this end, Random Forest and XGBoost algorithms were applied to identify important variables that considerably influence the prediction capability of the considered models. Results showed that the reduced models obtained a slightly improved prediction of EC compared to the full models.
  • It is worthwhile to mention that the studied methods do not take into account the time-dependent nature of energy consumption in the prediction process. Our final contribution to addressing this limitation is constructing dynamic models by incorporating lagged measurements as inputs to enhance the ML models’ ability to perform effectively. Results demonstrated that using lagged data contributes to improving the prediction quality of the ML models and highlights the superior performance of the dynamic GPR and KNN.
The remainder of this study is organized as follows. Section 2 provides an overview of related works on energy consumption prediction. Section 3 presents the data from the Melbourne WWTP and the airport weather station, along with an exploratory data analysis. Furthermore, the investigated machine learning models are briefly described. Section 4 describes the proposed machine learning-based prediction framework. Section 5 contains the results and discussion of the machine learning algorithms within our datasets. Lastly, Section 6 recapitulates the paper and gives future directions for potential enhancements.

2. Related Works

Recently, many studies have explored the concept of machine learning to control WWTP by predicting how much energy they consume [20,21]. Machine learning-based models are flexible and rely only on historical data from the inspected process. For instance, ref. [22] used a Random Forest model to predict the energy consumption of WWTPs. They assessed this machine-learning approach using 2387 records from the China Urban Drainage Yearbook. Results indicate that Random Forest exhibited satisfactory prediction performance with an R 2 of 0.702. However, this study does not consider the effects of local climate and technology in building the predictive model, which is very important. Ref. [23] considered a logistic regression approach for predicting the energy consumption of a WWTP in Romania. The input variables, including the flowrate and wastewater characteristics, are used to predict energy consumption. Data were collected from a WWTP between 2015 and 2017 with 403 records to verify the efficiency of this approach. Results showed a reasonable prediction quality with an accuracy of 80%. Nevertheless, all parameters that affect water quality were not considered when constructing the logistic regression model. Ref. [24] investigated the capacity of the Artificial Neural Network (ANN), K-Nearest Neighbors (KNN), Support Vector Machine (SVM), and Linear Regression in predicting the energy consumption of a WWTP located in Peninsular Malaysia. The energy consumption data was collected from the Tenaga National Berhad (TNB) electrical bills from March 2011 to February 2015. The wastewater characteristics are collected to construct the predictive models. This study showed that the ANN model outperformed the other models. In ref. [25], the purpose was to save energy at WWTP by performing a daily benchmark analysis. Torregrossa et al. examined Support Vector Regression (SVR), ANN, and RF algorithms on the Solingen-Burg WWTP dataset (designed for a connected population of 120,000 individuals). The RF was chosen as the most efficient algorithm based on an R 2 of 0.72 in the validation and an R 2 of 0.71 in the testing.
Furthermore, ref. [26] applied machine learning methods (ANN and RF) to predict energy costs in WWTPs. This study is conducted based on 279 WWTPs located in northwest Europe, including the Netherlands, France, Denmark, Belgium, Germany, Austria, and Luxembourg. Regarding average R 2 , RF reached 0.82, followed by the ANN with 0.81. ANN could be extensively used to investigate larger WWTP databases. Qiao et al. proposed an approach to predict energy consumption and effluent quality based on a density peaks-based adaptive fuzzy neural network (DP-AFNN) [27]. They showed that this approach achieved high prediction accuracy compared to multiple linear regression, the FNN-EBP (error backpropagation), and the Dynamic FNN. Ref. [5] focused on the modeling and optimization of a wastewater pumping system to reduce energy consumption using the ANN model. Specifically, they applied neural networks to model pump energy consumption and wastewater flow rate. An artificial immune network algorithm is adopted to solve the optimization problem by minimizing energy consumption and maximizing the pumped wastewater flow rate. Results revealed that 6% to 14% of energy could be saved while maintaining pumping performance. Ref. [28] investigated the capability of ANN, Gradient Boosting Machine (GBM), RF, and the Long Short-Term Memory (LSTM) network in predicting energy consumption records from a Melbourne WWTP. The prediction has been performed by considering weather variables, wastewater characteristics, and hydraulic variables. Feature extraction has been considered to select important variables to construct the machine learning models. Results showed that the GBM model provided the best prediction in this case study. However, with future changes in the test set data, a model’s performance will degrade when applied to data from subsequent months. In [29], a neural network model has been applied to predict pump energy consumption in a WWTP. This will enable the generation of operational schedules for a pump system to decrease energy consumption. The ANN model showed satisfactory prediction by reaching MAE (Mean Absolute Error) and MAPE (Mean Absolute Percentage Error) of 0.78 and 0.02, respectively. Table 1 shows some recent studies on energy consumption prediction in WWTPs using various Machine Learning techniques.

3. Materials and Methods

3.1. Data Description and Analysis

This study uses multivariate data from the Melbourne water treatment plant and airport weather stations: https://data.mendeley.com/datasets/pprkvz3vbd/1, accessed on 25 April 2023. The data contains 1382 records gathered over a period of five years, from January 2014 to June 2019, from nineteen variables listed in Table 1. The dataset includes power consumption data as well as biological, hydraulic, and climate variables. The data on water quality and biological characteristics are collected using sensors, while weather data is collected using the Melbourne airport weather station located near the water treatment plant. This dataset provides a comprehensive view of the various factors that can impact energy consumption at a wastewater treatment plant and allows the researchers to build models that take into account the interplay between these factors. As shown in Figure 1, the data also contains time-domain information that will be considered in this study to improve prediction performance. More details about this data can be found in [28]. Additionally, we eliminated data points that had unusually low or high energy consumption, which were considered outliers. Roughly 5% of the data points were removed [1].
The evolution of energy consumption in wastewater treatment plants (WWTPs) can be affected by several factors, including the influx of wastewater volume and composition, weather conditions such as temperature, precipitation, and water flow, seasonality changes (e.g., tourism season, temperature, precipitation, and water flow), treatment processes used, and maintenance of the equipment. WWTP operators can use real-time data on the influx of wastewater, weather conditions, and treatment processes to monitor the daily evolution of energy consumption and adjust the treatment process as needed. This can help reduce energy consumption and costs and improve the overall performance of the WWTP.
Before constructing predictive models, it is important to perform exploratory data analysis. At first, we plot the time-series data to get a visual idea of the variation and correlation in the data. Plotting time-series data is an important step in exploratory data analysis, as it can help identify patterns and trends that can be useful in building predictive models. Visualizing the data can also help identify any outliers or missing data, which can be necessary for preprocessing the data before building the predictive models. Figure 2 displays the daily evolution of energy consumption, hydraulic and wastewater variables, and some weather time series collected in 2018. As WWTPs should handle highly dynamic influent, energy consumption and influent will vary accordingly (Figure 2).
Figure 3 illustrates the total inflow and energy consumption for each year from 2014 to 2018. The data in Figure 3 is based on the available dataset, which covers the period from January 2014 to June 2019. However, due to the limited data available for 2019 (only six months), we have excluded the 2019 data from Figure 3 to avoid any potential confusion. The figure specifically focuses on the years from 2014 to 2018 to provide a clear representation of the yearly variations in inflow and energy consumption. From Figure 3, we observe a high similarity in the variation between the inflow and the consumed energy. Essentially, the volume and composition of wastewater (inflow) that needs to be treated can affect the energy consumption of a WWTP. An increase in the volume of wastewater can increase the energy consumption of pumps and other equipment used to move the water through the treatment process. Additionally, changes in the composition of the wastewater, such as an increase in the amount of organic matter, can increase the energy consumption of the biological treatment process.
Figure 4 depicts the distribution of the collected data, indicating that these datasets are non-Gaussian distributed. Here, the Kernel density estimation [35], a non-parametric method, is applied to estimating the underlying distribution of a dataset. KDE is a powerful and flexible method for estimating the distribution of a dataset; it does not make any assumptions about the underlying distribution and can be used to estimate any kind of distribution. Figure 4 allows us to see the shape of the distribution, the presence of outliers, and the general characteristics of the data. It is an effective way of understanding the nature of the data and the underlying patterns in it.
To visualize the distribution of energy consumption over the years, Figure 5 displays the boxplots of yearly WWTP power consumption during the studied period from 2014 to 2019. Note that data for 2019 is available for only six months, which is why the boxplot for that year is more compact than the other years. From Figure 5, we observe that the annual distribution of energy consumption in 2018 has slightly decreased in average values and standard deviations compared to 2017. This decrease in energy consumption could be due to the operator’s optimization and management of the WWTP.
The boxplots in Figure 6 display the monthly energy consumption patterns, and it is observed that there is a significant increase in variance during the hot months of October, November, and December. This could be attributed to the high demand for water during these months and also to the increase in tourism. These months are typically considered the hottest period in Australia. The weather during this period is generally sunny, warm, and humid, which can lead to increased water usage for cooling and other purposes and also cause an influx of tourists, leading to increased strain on the WWTPs. This information could be used to improve energy consumption prediction for better resource allocation and planning.

3.2. Methodology

This section briefly describes the considered machine learning models for energy consumption prediction in this paper. As presented in Figure 7, twenty-three machine learning models are considered, including GPR, SVR, kNN, and ensemble learning models (RF, BT, BS, XGBoost, and LightgBM). Each model has its own strengths and weaknesses. Next, we provide a brief description of these popular machine-learning models.

3.2.1. SVR Model

It is a flexible data-based approach with good learning capacity via kernel tricks. The key idea underlying the SVR consists of mapping the train data to a higher dimensional space and conducting linear regression in that space. SVR can handle non-linear and non-separable data using the kernel trick, handle datasets with large numbers of features, and be robust to the presence of outliers. However, it requires a large amount of computational power and can be sensitive to the choice of kernel function and regularization parameter [36,37]. Moreover, the relevant concept used in designing the SVR model lies in structural risk minimization. It is demonstrated that SVR provides satisfactory performance with limited samples [38]. Thus, SVR models have been broadly exploited in various applications, such as solar irradiance prediction [39], wind power prediction [40], and anomaly detection [41]. This study will use optimized SVR via Bayesian optimization for comparison.

3.2.2. GPR Model

It is a probabilistic machine learning technique used for both regression and classification problems [42]. It models the target variable as a Gaussian process and assigns a probability distribution to the predicted values [43]. GPR is non-parametric, flexible, and able to capture complex relationships between the input variables and the target variable [44]. A key feature of GPR is that it can also model the uncertainty in the predictions it makes. This is achieved by assigning a probability distribution to the predicted values [42]. However, GPR is computationally expensive because it requires the calculation of the covariance matrix between all the data points, which can become computationally intensive as the number of data points increases. The computational complexity of GPR is typically O( N 3 ) where N is the number of data points. Additionally, GPR also requires the inversion of the covariance matrix and the calculation of the likelihood of the model given the data, which can be computationally expensive as well.

3.2.3. K-Nearest Neighbor

The K-NN is a lazy machine-learning method that does not require training before use. k-NN is a non-parametric method that can be used for regression by predicting the output of a new data point based on the average of the k-nearest data points’ output [45]. The value of k is a hyperparameter that needs to be set before training the model, and it affects the model’s sensitivity to outliers. However, the k-NN algorithm is sensitive to the scale of the features, so it may not perform well if the features have different scales. The k-NN algorithm may not perform well with high-dimensional data, as it becomes more difficult to find the k-nearest neighbors in high-dimensional space.

3.2.4. ANN Models

Artificial Neural Networks (ANNs) are advanced models capable of recognizing complex and non-linear relationships between inputs and outputs; however, they can be sensitive to the way they are structured and initiated and the parameters used. They are frequently used in studies related to wastewater treatment plants (WWTPs). Each layer of an ANN contains multiple neurons connected to neurons in the next layer and created to fulfill specific tasks. Different ANN models have been studied, such as Narrow, Wide, Medium, Bilayered, and Trilayered Neural Networks. Narrow Neural Networks have a small number of neurons in hidden layers, which makes them less complicated and quicker to train, but they may not be able to recognize complex relationships. Wide Neural Networks have many neurons in hidden layers, which makes them more complex and able to recognize more complex relationships. However, they can be costly to compute and susceptible to overfitting. Medium Neural Networks have an intermediate number of neurons in hidden layers and provide a balance between narrow and wide neural networks. Bilayered Neural Networks have two hidden layers, making them more complex than single-layered neural networks. Trilayered Neural Networks have three hidden layers, making them even more complex than Bilayered Neural Networks, but also more costly to compute and prone to overfitting.

3.2.5. Decision Tree Regression

Decision trees, or regression trees, are a method used to predict a continuous outcome. It uses a tree-like structure to divide the data into subsets and make predictions based on the average value of the target variable in each subset. The simplicity of the algorithm makes it easy to understand and implement [46]. However, the complexity increases as the tree grows deeper, and the model can become overfit. To mitigate this, techniques such as pruning, limiting tree depth and using regularization can be used. The time complexity of the algorithm is typically O ( l o g ( n ) ) on average, but can be as high as O ( n ) in the worst-case scenario. The space complexity is O ( n ) because it stores the entire tree in memory.

3.2.6. Ensemble Methods

Ensemble learning is a technique where multiple models are combined to make a single, more accurate prediction [47]. There are several ensemble methods like Bagging, Boosting, Random Forest, XGBoost, and LightGBM. Bagging, also known as Bootstrap Aggregating, trains several models independently on different subsets of the data and then combines the predictions by taking an average [48]. Boosting, on the other hand, trains multiple models sequentially, where each model tries to correct the prediction errors of the previous model [49]. Random Forest combines multiple decision trees, creating them on different subsets of the data and taking the average or majority vote of the predictions from the individual trees to make a final prediction [50]. XGBoost and LightGBM are open-source libraries for gradient boosting. XGBoost is highly efficient, scalable, and flexible and is used in various applications such as machine learning competitions, structured data, and time series [51]. LightGBM is efficient and scalable, particularly suitable for large datasets and high-dimensional data; it uses a histogram-based algorithm to build the trees, reducing computation time and memory usage [52,53]. Ensemble methods are considered more robust and accurate than single models; they reduce variance and bias in predictions by combining the strengths of multiple models [39].
When comparing the time complexity of Bagging, Boosting, Random Forest, XGBoost, and LightGBM, it is important to note that it can depend on the specific implementation and the size of the dataset. Generally speaking, the time complexity of Bagging and Boosting is O ( m n T ) , where m is the number of samples, n is the number of features, and T is the number of estimators (models) used. As T increases, the time complexity increases linearly. Random Forest has a time complexity of O ( m n l o g ( m ) T ) , where m is the number of samples, n is the number of features, and T is the number of estimators (models) used. As T increases, the time complexity increases logarithmically. XGBoost and LightGBM, which are based on gradient boosting, have a time complexity of O ( T n l o g ( n ) ) , where T is the number of estimators (models) used, and n is the number of samples. As T increases, the time complexity increases linearly. To sum up, Bagging and Boosting have a similar time complexity, which increases linearly with the number of estimators. Random Forest has a more complex time complexity, which increases logarithmically with the number of estimators. XGBoost and LightGBM, based on gradient boosting, have a time complexity that increases linearly with the number of estimators and the size of the dataset.
In terms of time complexity, Random Forest is considered to have the best time complexity among Bagging, Boosting, Random Forest, XGBoost, and LightGBM. Its time complexity is O ( m n l o g ( m ) T ) , where m is the number of samples, n is the number of features, and T is the number of estimators (models) used. As T increases, the time complexity increases logarithmically. This means that as the number of predictors increases, the time complexity of Random Forest increases at a slower rate compared to Bagging and Boosting, which have a linear increase in time complexity with the number of predictors.

3.2.7. Models Calibration via Bayesian Optimization

Fine-tuning a machine learning model involves adjusting the hyperparameters of the model in order to improve its performance on a specific task. Choosing the best hyperparameter configuration for a given model has a direct effect on its performance. There are several ways to fine-tune a machine learning model, including Grid Search, Random Search, and Bayesian optimization [54]. Grid Search is an exhaustive method that tries all possible combinations of hyperparameters within a predefined range [55]. Random Search is similar to grid search, but it randomly samples a set of hyperparameters from a predefined range [55]. Bayesian optimization, on the other hand, uses probabilistic models and previous evaluations to guide the Search, which makes it more efficient than the other two methods [56,57].
Of course, Bayesian optimization aims to find the optimal set of hyperparameters by selecting the best set of hyperparameters in a more efficient manner than Grid search and Random search, it uses the information gained from previous evaluations to guide the search, so it does not need to evaluate all possible combinations. In this study, we adopted Bayesian optimization to calibrate the models. For more details on Bayesian Optimization, refer to refs. [57,58].

4. Machine Learning-Based EC prediction framework

Energy consumption (EC) prediction is essential to optimally designing and operating sustainable energy-saving WWTPs. EC in WWTPs is influenced by diverse biological and environmental factors, making it complicated and challenging to build soft sensors. The techniques based on machine learning represent an appealing solution to predict the EC in WWTPs. In this paper, we investigated the prediction performance of the commonly used machine learning methods to predict the WWTP’s energy consumption. The general framework of the adopted machine learning framework is given in Figure 8. After pre-processing the data by eliminating outliers and imputing missing values, the data are subdivided into training and test sets. Here, 75% of the data are used to train the machine learning algorithms; furthermore, the trained models are evaluated using the testing data (i.e., the remaining 25% of data). We used the k-fold Cross-validation technique to train the models. Cross-validation is a technique used to assess the performance of a model by dividing the data into train and test sets, and training and testing the model multiple times on different subsets of the data [59]. The benefit of using cross-validation is that it provides a more accurate estimate of the model’s performance, reduces the risk of overfitting, and can also be used to tune the hyperparameters of a model. Note that the considered models are calibrated using Bayesian optimization during the training stage.
Selecting the best model is an important step in machine learning. The best model can be selected by comparing the performance of different models using these metrics. Here, we employed four commonly used metrics: root mean square error (RMSE), mean absolute error (MAE), mean absolute percentage error (MAPE), and training time are often used to evaluate the performance of a model. Training time measures how long it takes to train the model. In addition, we computed J 2 metric, which has been recently in [28]. The model that performs best based on these metrics can be selected as the best model. The measured and the predicted energy consumption are denoted respectively by y t and y ^ t , and n as the number of records.
  • RMSE measures the differences between predicted and true values.
    RMSE ( y , y ^ ) = 1 n i = 0 n 1 ( y i y ^ i ) 2 ,
  • MAE measures the average absolute difference between predicted and true values.
    MAE ( y , y ^ ) = 1 n i = 0 n 1 y i y ^ i 1 ,
  • MAPE measures the average percentage difference between predicted and true values.
    MAPE ( y , y ^ ) = 1 n i = 0 n 1 y i y ^ i 1 max ( ϵ , y i 1 ) ,
  • j 2 is the ratio of the square RMSE in testing to the square RMSE in training [28].
    J 2 = RMSE test 2 RMSE train 2 .
In summary, lower values of these metrics indicate that the model is making predictions that are more accurate, closer to the true values, and faster to train, which can be considered as better precision and quality of prediction.

5. Results and Discussion

In this study, we performed three investigations to develop effective machine-learning models to predict WWTP energy consumption. At first, all the available input variable data is considered in predicting energy consumption via several machine learning models. In the second experiment, we considered only the most important variables via variable selection in predicting WWTP energy consumption. In the last experimentation, we included lagged data to improve the prediction accuracy of the considered machine learning models.

5.1. EC prediction Using Full Models

This first experiment considers hydraulic, weather, wastewater characteristics, and time variables for EC prediction. This experiment assesses the capacity of machine learning methods for EC prediction based on all variables in Table 1. Here, we investigate the conventional Static machine learning models that are built using a fixed set of features and do not take into account any changes or updates in the data over time. These models are trained on a single dataset and make predictions based on that dataset.
As discussed, we used 75% of the data (from 1 January 2014, to 28 January 2018) for training sub-data and 25% for testing sub-data (from 29 January 2018, to 27 June 2019). In this context, we refer to full prediction models that predict EC without considering previous energy consumption. To train the investigated models, we used a 5-fold cross-validation technique. As the prediction accuracy of machine learning methods relies on the hyperparameters’ values, we adopted Bayesian Optimization herein to fine-tune the investigated methods during the training.
Table 2 summarizes the prediction performance of the investigated machine learning models based on testing data. A neural network tends to be the fastest model among all others in terms of training time. We observe that ensemble learning models (i.e., BST, BT, RF, XGBoost, and LightgBM) predicted WWTP EC with the lowest RMSE and MAE. For instance, the BST produced better RMSE values in the train with 35.77 and in the test data with MAE = 31.97 MWh, RMSE = 41.37 MWh, and MAPE = 11.25. Furthermore, XGBoost also yielded good results with RMSE = 41.38 (MWh/Day), MAE = 32.23 (MWh/Day), and J2 = 0.95. This could be due to their ability to reduce prediction errors using several weak regressors. Based on MAPE criteria, the top six models are QSVR, GPRE, GPRRQ, BT, BST, and XGBoost. Table 2 shows that the GPR models are time-consuming to train, followed by the SVR models. Overall, no one approach dominates all the others in terms of all considered statistical scores. Results in Table 2 indicate that there is still space for improvement in WWTP energy consumption.

5.2. EC Prediction Using Reduced Models

Now, the aim is to build parsimonious predictive models for WWTP EC prediction. Feature importance identification is the process of determining which input variables in a dataset have the most impact on the outcome of a machine learning model. This knowledge can help to understand the relationship between inputs and outputs, simplify the model, and improve its performance. Importantly, non-informative and redundant input variables will be ignored in building a predictive model to reduce the number of input variables. Here, we used two popular machine learning algorithms, XGBoost and RF, to identify important features in a dataset. By using two methods, one can obtain a more robust understanding of feature importance and make more informed decisions about which features to include or exclude in a model. Figure 9 displays the selection results based on the RF and XGBoost methods. The larger the input amplitude for feature importance, the more significant the influence of that variable on the WWTP EC prediction.
In Figure 9, results from the two feature selection methods indicate that the month is the most important variable, followed by the year. The relationship between total energy consumption and the month may be due to seasonal and weather changes. Including the year as a predictor may not provide meaningful insights beyond capturing the overall trend of energy consumption changing over time. Factors such as population growth, infrastructure improvements, or policy changes occurring annually in the WWTP may influence energy consumption broadly. However, the year variable alone may not offer specific insights into the factors driving energy demand variations within a year. Therefore, we have focused primarily on the month as the key predictor. Importantly, the month captures the seasonal and weather-related fluctuations that have a more immediate and direct impact on energy consumption patterns in WWTPs. The two hydraulic variables, average daily inflow and outflow rates, correlate well with the target. As these hydraulic variables are correlated, we selected only one of them (i.e., Q i n ). We can see that in climate variables, Tavg, Tmax, Tmin, and the average humidity have more effect on EC prediction. As there is a correlation between the average humidity and Tavg of 0.55, Tmin and Tmax of 0.76, and between Tavg and Tmax of 0.92, we can select only a few of them to construct machine learning models. For example, we can ignore two variables from Tavg, Tmax, and Tmin. From Figure 9, the other climate variables, such as WSmax, atmospheric pressure, and visibility, are not relevant and can be ignored. Figure 9 shows that for wastewater variables, TN, COD, and BOD are correlated with the target [60]. As there is a relatively important correlation between COD and TN (0.68); COD can be ignored. Figure 9 also indicates that Ammonia appears slightly more impactful than BOD in predicting energy consumption, which could be attributed to several factors. One possible explanation is that Ammonia levels in the influent wastewater can indicate the presence of nitrogen-rich compounds, which require additional energy for their removal during the treatment process. The energy-intensive processes involved in nitrogen removals, such as nitrification and denitrification, may contribute to the higher impact of Ammonia on energy consumption. On the other hand, BOD represents the amount of biodegradable organic matter in the wastewater. This could potentially explain the relatively lower impact of BOD compared to Ammonia on energy consumption in the studied context. Unexpectedly, influent water quality did not exhibit a stronger predictive power for energy consumption than other factors, such as water quantity. This could be attributed to several factors. Firstly, it is important to consider the specific characteristics of the dataset and the operational context of the studied WWTP. The dataset used in this study may have had relatively stable and controlled influent water quality conditions, with limited fluctuations or variations that could have a pronounced impact on energy consumption. Furthermore, it is worth noting that the energy consumption in WWTPs is influenced by a complex interplay of various factors, including hydraulic conditions, treatment processes, operational strategies, and system design. While water quality parameters are important in the overall treatment process, their individual contribution to energy consumption may be relatively lower than other influential factors.
Here, we investigate the performance of the reduced machine learning models that are built using a subset of features from the original dataset. These models are trained on a reduced dataset that contains only the relevant features, and make predictions based on that reduced dataset. Table 3 summarized the prediction results of the reduced models using testing data. The comparison of the performance of the models shows that KNN outperformed all of them, with the lowest RMSE, MAE, and MAPE errors at 37.33, 28.23, and 10.65, respectively. The KNNs outperform the static models across all criteria, and the training time is decreased from 12 s to 10 s. It was followed by GSVR, BT, RF, and LightgBM, which had the lowest RMSE. In terms of the J2 criteria, WNN has the lowest score of 0.38. Furthermore, the training time for neural networks is generally the fastest of all models.
In terms of a MAPE, the KNN model has the best prediction performance of 10.65, followed by the GSVR model with a MAPE of 11.17, followed by the GPR models between 11.23–11.25. Moreover, based on the RMSE criteria, Table 3 shows the six best models: GSVR, KNeighbors, LightgBM, RF, and XGBoost. The KNN and LightgBM models capture more fluctuations, respectively, with RMSE values of 37.33 and 41.27, followed by the RF, BT, XGBoost, and GSVR models with RMSEs between 41.6 and 41.9. Overall, the forecasting gets better with slower training times and fewer features from the static model.

5.3. EC Prediction Using Dynamic Models

The results obtained in the previous experiments are based on static models that do not account for the previous day’s energy consumption. However, energy consumption data often exhibits a dynamic nature. This experiment will examine how machine learning models perform when past data is incorporated into their construction. Towards this end, we introduce lagged data, the lag 1 energy consumption data, when building prediction models to capture energy consumption’s dynamic and evolving nature. These dynamically reduced models are trained on a reduced dataset that contains only the relevant features but also incorporates time-lagged measurements. Figure 10 shows the results of variable importance identification based on the RF and XGBoost algorithms. According to RF and XGBoost, Figure 10 illustrates the effect of each feature on energy consumption. For both RF and XGBoost, it shows that the lag 1 energy consumption data significantly impacts the target with a large score of around 0.53. This confirms the need to take past data into account when building predictive models for energy consumption prediction.
Similarly to the reduced models’ experiment, we construct the machine learning models based on training data with selected variables. In dynamic models, such as autoregressive models, it is common to use lagged data to capture the dynamic and time-dependent nature of the process being modeled. In this study with dynamic machine learning models, Lag 1 energy consumption is a key predictor because it reflects the immediate past energy consumption, significantly influencing the current energy consumption in the wastewater treatment process. Note that we investigated the inclusion of other Lag orders, such as Lag 2 and Lag 3 data, and the analysis consistently showed that incorporating Lag 1 data provided superior prediction results compared to the use of Lag 2 and Lag 3 data. This suggests the strong influence of immediate past energy consumption on the current energy consumption in the wastewater treatment process. After building the models with Lag 1 energy consumption data as an input variable, we tested the dynamic models using data from 29 January 2018, and 27 June 2019. Table 4 lists the prediction results of the dynamic machine learning models. Results show that XGBoost achieved the best prediction results in terms of RMSE (37.14); it is followed by kNN, GPRE, LightGBM, and BT with RMSE values of 37.33, 37.36, 37.38, and 37.56, respectively (Table 4). Moreover, the time consumed by XGBoost in training (398 s) is nearly 30 times that of the second-best model, kNN (13 s), with only a 1% loss in predicting performance with regard to RMSE.
Overall, the time consumed by XGBoost in training is significantly higher than that of kNN, with XGBoost taking approximately 30 times longer than kNN. However, the difference in prediction performance between the two models is relatively small, with XGBoost having a slightly better performance in terms of RMSE. This suggests that while XGBoost may have a higher time complexity, it may be more suitable for certain applications where a higher level of accuracy is desired, while kNN may be more suitable for applications where computational efficiency is a priority. Hence, a trade-off between prediction accuracy and computational time may need to be considered when selecting a machine-learning model for energy consumption prediction in WWTPs.
Figure 11a,b shows the heatmap of the RMSE values of the twenty-three models (static, reduced, and dynamic models). The dynamic reduced models that incorporate lagged energy consumption data show better prediction results in terms of RMSE and MAPE when compared to static and reduced models. This suggests that considering past energy consumption data can lead to more accurate predictions of energy consumption in WWTPs (Figure 11). The dynamic ensemble models, led by XGBoost, show good prediction performance in terms of RMSE and MAPE compared to static and reduced models. The use of lagged energy consumption data in the dynamic models improves the accuracy of predictions. However, it’s important to note that the time complexity of XGBoost is considerably higher than other models like kNN.
In summary, machine learning is a powerful tool that can be used to predict energy consumption in WWTPs. By analyzing the available input-output data, machine learning models can identify patterns and relationships that can be used to make accurate predictions about energy consumption. This can help WWTPs reduce energy costs by identifying opportunities for energy efficiency and optimizing the treatment process in several ways. By accurately forecasting energy consumption, operators can implement proactive measures to optimize energy usage. For example, suppose the prediction model indicates a peak in energy demand during a specific time period. In that case, operators can schedule the operation of energy-intensive equipment during off-peak hours or consider alternative energy sources to minimize costs. Furthermore, by analyzing the factors influencing energy consumption, such as influent characteristics, operational parameters, and treatment processes, WWTPs can identify specific areas where energy efficiency improvements can be made. This analysis may reveal opportunities to optimize process parameters, retrofit equipment with energy-saving technologies, or implement advanced control strategies to reduce energy waste. Additionally, predicting energy consumption can support decision-making in allocating resources and investments. WWTPs can prioritize projects and investments based on the predicted energy demands and potential energy savings. This allows for targeted interventions and resource allocation towards areas that yield the greatest energy efficiency improvements, resulting in long-term cost reductions. Moreover, by continuously monitoring and updating the predictive model, WWTPs can assess the effectiveness of energy-saving initiatives over time and fine-tune their energy management strategies. This iterative process enables the identification of further optimization opportunities and the implementation of adaptive measures to achieve sustained energy efficiency gains. In the context of energy consumption prediction in WWTPs, dynamic models would be more suitable, as they can capture the temporal dynamics of the data and make more accurate predictions about future energy consumption. It is important to note that while XGBoost performed well in terms of RMSE, other models such as kNN and GPR performed well in terms of other evaluation metrics. Additionally, the time complexity of the models should also be taken into consideration. Therefore, it is recommended to use a combination of different models and evaluation metrics to optimize energy consumption prediction in WWTPs.

6. Conclusions

This study investigates the application of machine learning techniques for predicting energy consumption in WWTPs. Real data from a WWTP in Melbourne is utilized, and a range of machine learning models, including kernel-based methods, ensemble learning methods, ANN models, decision trees, and k-nearest neighbors, are assessed. Feature selection methods, such as Random Forest and XGBoost, are employed to enhance model efficiency. The findings demonstrate that incorporating past data through dynamic models, specifically time-lagged measurements, improves the accuracy of energy consumption predictions. The dynamic K-nearest neighbors model emerges as the top-performing model. It is important to highlight that while XGBoost excels in terms of RMSE, other models like kNN and GPR exhibit strong performance in different evaluation metrics. Furthermore, considering the time complexity of the models is crucial. To optimize energy consumption prediction in WWTPs, it is recommended to employ a combination of diverse models and evaluation metrics.
The analysis of the Melbourne East WWTP data demonstrated that multiple variables significantly influenced EC. Among these variables, month, TN, ammonia, daily temperature, humidity, and influent flow showed the highest impact on EC in the WWTP. However, our investigation also revealed that factors such as rainfall, atmospheric pressure, and wind speed did not exhibit significant effects on EC in the WWTP. Furthermore, our findings indicated that incorporating lag 1 EC data improved the predictive performance of the models. These results provide valuable insights into the factors influencing EC in the Melbourne East WWTP and highlight the potential benefits of considering these variables and lagged energy consumption in future energy consumption prediction models.
The proposed framework presented in this study can be customized and implemented in other WWTPs by incorporating plant-specific data and relevant variables. While the specific conclusions drawn from our research may not directly translate to other plants due to differences in operational conditions and data characteristics, the underlying principles, methodologies, and insights gained from our study can serve as valuable references for other pollution treatment plants. By adapting the framework to their specific context, other WWTPs can leverage the knowledge and approaches developed in our study to enhance their understanding and prediction of energy consumption in their respective systems.
There is still room for improvement in energy consumption prediction for WWTPs using machine learning.
  • Despite optimizing the prediction model through variable selection methods, it is important to acknowledge that our model’s predictive capability could be influenced by other variables that were not included due to data limitations. Future research should focus on exploring and incorporating a broader range of variables to enhance the accuracy and comprehensiveness of energy consumption prediction models in WWTPs. This could involve considering additional variables related to process conditions, influent characteristics, operational parameters, and external factors such as climate and regulatory changes. By incorporating these variables, we can improve the predictive power of the models and gain a more comprehensive understanding of the factors impacting energy consumption in WWTPs.
  • In future work, we will emphasize the need for additional studies that focus on validating the feasibility and utility of these models in real-world scenarios. This will involve considering factors such as computational requirements and operational constraints commonly encountered in real WWTP settings.
  • Deep learning models, known for their ability to handle time-series data, present an intriguing avenue for further exploration in forecasting energy consumption in WWTPs. These models, such as recurrent neural networks (RNNs) and long short-term memory (LSTM) networks, have demonstrated promising capabilities in capturing temporal dependencies and patterns within time-series data [61,62]. By leveraging their strengths, deep learning models could improve the accuracy and precision of energy consumption forecasts in WWTPs.
  • Another possibility for improvement is integrating wavelet-based multiscale data representation with machine learning models. This approach would take into account the temporal and frequency characteristics of the data and could potentially improve the accuracy of the prediction models. Wavelet-based multiscale representation can also be used to extract relevant features and patterns from the data, which could be used to improve the performance of the machine learning models. This approach could potentially provide more accurate predictions and lead to further optimization of energy consumption in WWTPs.

Author Contributions

Y.A., Conceptualization, formal analysis, investigation, methodology, software, writing—original draft, and writing—review and editing. F.H., Conceptualization, formal analysis, investigation, methodology, software, supervision, writing—original draft, and writing—review and editing. Y.S., Investigation, methodology, conceptualization, supervision, and writing—review and editing. All authors have read and agreed to the published version of the manuscript.

Funding

This publication is based upon work supported by King Abdullah University of Science and Technology (KAUST) Research Funding (KRF) from the Climate and Livability Initiative (CLI) under Award No. ORA-2022-5339.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Not applicable.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Gu, Y.; Li, Y.; Li, X.; Luo, P.; Wang, H.; Wang, X.; Wu, J.; Li, F. Energy self-sufficient wastewater treatment plants: Feasibilities and challenges. Energy Procedia 2017, 105, 3741–3751. [Google Scholar] [CrossRef]
  2. Molinos-Senante, M.; Maziotis, A. Evaluation of energy efficiency of wastewater treatment plants: The influence of the technology and aging factors. Appl. Energy 2022, 310, 118535. [Google Scholar] [CrossRef]
  3. Daw, J.; Hallett, K.; DeWolfe, J.; Venner, I. Energy Efficiency Strategies for Municipal Wastewater Treatment Facilities; Technical Report; National Renewable Energy Lab. (NREL): Golden, CO, USA, 2012.
  4. Goldstein, R.; Smith, W. Water & Sustainability: US Electricity Consumption for Water Supply & Treatment-the Next Half Century; Electric Power Research Institute: Palo Alto, CA, USA, 2002; Volume 4. [Google Scholar]
  5. Zhang, Z.; Kusiak, A.; Zeng, Y.; Wei, X. Modeling and optimization of a wastewater pumping system with data-mining methods. Appl. Energy 2016, 164, 303–311. [Google Scholar] [CrossRef]
  6. Plappally, A.; Lienhard V, J.H. Energy requirements for water production, treatment, end use, reclamation, and disposal. Renew. Sustain. Energy Rev. 2012, 16, 4818–4848. [Google Scholar] [CrossRef]
  7. Robescu, L.D.; Boncescu, C.; Bondrea, D.A.; Presura-Chirilescu, E. Impact of wastewater treatment plant technology on power consumption and carbon footprint. In Proceedings of the 2019 International Conference on ENERGY and ENVIRONMENT (CIEM), Timisoara, Romania, 17–18 October 2019; pp. 524–528. [Google Scholar]
  8. Chen, Y.; Song, L.; Liu, Y.; Yang, L.; Li, D. A review of the artificial neural network models for water quality prediction. Appl. Sci. 2020, 10, 5776. [Google Scholar] [CrossRef]
  9. Harrou, F.; Cheng, T.; Sun, Y.; Leiknes, T.; Ghaffour, N. A data-driven soft sensor to forecast energy consumption in wastewater treatment plants: A case study. IEEE Sens. J. 2020, 21, 4908–4917. [Google Scholar] [CrossRef]
  10. Cheng, T.; Harrou, F.; Kadri, F.; Sun, Y.; Leiknes, T. Forecasting of wastewater treatment plant key features using deep learning-based models: A case study. IEEE Access 2020, 8, 184475–184485. [Google Scholar] [CrossRef]
  11. El-Rawy, M.; Abd-Ellah, M.K.; Fathi, H.; Ahmed, A.K.A. Forecasting effluent and performance of wastewater treatment plant using different machine learning techniques. J. Water Process Eng. 2021, 44, 102380. [Google Scholar] [CrossRef]
  12. Hilal, A.M.; Althobaiti, M.M.; Eisa, T.A.E.; Alabdan, R.; Hamza, M.A.; Motwakel, A.; Al Duhayyim, M.; Negm, N. An Intelligent Carbon-Based Prediction of Wastewater Treatment Plants Using Machine Learning Algorithms. Adsorpt. Sci. Technol. 2022, 2022, 8448489. [Google Scholar] [CrossRef]
  13. Safeer, S.; Pandey, R.P.; Rehman, B.; Safdar, T.; Ahmad, I.; Hasan, S.W.; Ullah, A. A review of artificial intelligence in water purification and wastewater treatment: Recent advancements. J. Water Process Eng. 2022, 49, 102974. [Google Scholar] [CrossRef]
  14. Ly, Q.V.; Truong, V.H.; Ji, B.; Nguyen, X.C.; Cho, K.H.; Ngo, H.H.; Zhang, Z. Exploring potential machine learning application based on big data for prediction of wastewater quality from different full-scale wastewater treatment plants. Sci. Total Environ. 2022, 832, 154930. [Google Scholar] [CrossRef]
  15. Cheng, T.; Harrou, F.; Sun, Y.; Leiknes, T. Monitoring influent measurements at water resource recovery facility using data-driven soft sensor approach. IEEE Sens. J. 2018, 19, 342–352. [Google Scholar] [CrossRef] [Green Version]
  16. Haimi, H.; Mulas, M.; Corona, F.; Vahala, R. Data-derived soft-sensors for biological wastewater treatment plants: An overview. Environ. Model. Softw. 2013, 47, 88–107. [Google Scholar] [CrossRef]
  17. Andreides, M.; Dolejš, P.; Bartáček, J. The prediction of WWTP influent characteristics: Good practices and challenges. J. Water Process Eng. 2022, 49, 103009. [Google Scholar] [CrossRef]
  18. Guo, H.; Jeong, K.; Lim, J.; Jo, J.; Kim, Y.M.; Park, J.p.; Kim, J.H.; Cho, K.H. Prediction of effluent concentration in a wastewater treatment plant using machine learning models. J. Environ. Sci. 2015, 32, 90–101. [Google Scholar] [CrossRef] [PubMed]
  19. Nadiri, A.A.; Shokri, S.; Tsai, F.T.C.; Moghaddam, A.A. Prediction of effluent quality parameters of a wastewater treatment plant using a supervised committee fuzzy logic model. J. Clean. Prod. 2018, 180, 539–549. [Google Scholar] [CrossRef]
  20. Hernández-del Olmo, F.; Gaudioso, E.; Duro, N.; Dormido, R. Machine learning weather soft-sensor for advanced control of wastewater treatment plants. Sensors 2019, 19, 3139. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  21. Alali, Y.; Harrou, F.; Sun, Y. Predicting Energy Consumption in Wastewater Treatment Plants through Light Gradient Boosting Machine: A Comparative Study. In Proceedings of the 2022 10th International Conference on Systems and Control (ICSC), Marseille, France, 23–25 November 2022; pp. 137–142. [Google Scholar] [CrossRef]
  22. Zhang, S.; Wang, H.; Keller, A.A. Novel Machine Learning-Based Energy Consumption Model of Wastewater Treatment Plants. ACS ES&T Water 2021, 1, 2531–2540. [Google Scholar]
  23. Boncescu, C.; Robescu, L.; Bondrea, D.; Măcinic, M. Study of energy consumption in a wastewater treatment plant using logistic regression. In IOP Conference Series: Earth and Environmental Science, Proceedings of the 4th International Conference on Biosciences (ICoBio 2021), Bogor, Indonesia, 11–12 August 2021; IOP Publishing: Bristol, UK, 2021; Volume 664, p. 012054. [Google Scholar]
  24. Ramli, N.A.; Abdul Hamid, M.F. Data Based Modeling of a Wastewater Treatment Plant by using Machine Learning Methods. J. Eng. Technol. 2019, 6, 14–21. [Google Scholar]
  25. Torregrossa, D.; Schutz, G.; Cornelissen, A.; Hernández-Sancho, F.; Hansen, J. Energy saving in WWTP: Daily benchmarking under uncertainty and data availability limitations. Environ. Res. 2016, 148, 330–337. [Google Scholar] [CrossRef]
  26. Torregrossa, D.; Leopold, U.; Hernández-Sancho, F.; Hansen, J. Machine learning for energy cost modelling in wastewater treatment plants. J. Environ. Manag. 2018, 223, 1061–1067. [Google Scholar] [CrossRef] [PubMed]
  27. Qiao, J.; Zhou, H. Modeling of energy consumption and effluent quality using density peaks-based adaptive fuzzy neural network. IEEE/CAA J. Autom. Sin. 2018, 5, 968–976. [Google Scholar] [CrossRef]
  28. Bagherzadeh, F.; Nouri, A.S.; Mehrani, M.J.; Thennadil, S. Prediction of energy consumption and evaluation of affecting factors in a full-scale WWTP using a machine learning approach. Process Saf. Environ. Prot. 2021, 154, 458–466. [Google Scholar] [CrossRef]
  29. Zhang, Z.; Zeng, Y.; Kusiak, A. Minimizing pump energy in a wastewater processing plant. Energy 2012, 47, 505–514. [Google Scholar] [CrossRef]
  30. Oulebsir, R.; Lefkir, A.; Safri, A.; Bermad, A. Optimization of the energy consumption in activated sludge process using deep learning selective modeling. Biomass Bioenergy 2020, 132, 105420. [Google Scholar] [CrossRef]
  31. Das, A.; Kumawat, P.K.; Chaturvedi, N.D. A Study to Target Energy Consumption in Wastewater Treatment Plant using Machine Learning Algorithms. In Computer Aided Chemical Engineering; Elsevier: Amsterdam, The Netherlands, 2021; Volume 50, pp. 1511–1516. [Google Scholar]
  32. Oliveira, P.; Fernandes, B.; Analide, C.; Novais, P. Forecasting energy consumption of wastewater treatment plants with a transfer learning approach for sustainable cities. Electronics 2021, 10, 1149. [Google Scholar] [CrossRef]
  33. Yusuf, J.; Faruque, R.B.; Hasan, A.J.; Ula, S. Statistical and Deep Learning Methods for Electric Load Forecasting in Multiple Water Utility Sites. In Proceedings of the 2019 IEEE Green Energy and Smart Systems Conference (IGESSC), Long Beach, CA, USA, 4–5 November 2019; pp. 1–5. [Google Scholar]
  34. Filipe, J.; Bessa, R.J.; Reis, M.; Alves, R.; Póvoa, P. Data-driven predictive energy optimization in a wastewater pumping station. Appl. Energy 2019, 252, 113423. [Google Scholar] [CrossRef] [Green Version]
  35. Parzen, E. On estimation of a probability density function and mode. Ann. Math. Stat. 1962, 33, 1065–1076. [Google Scholar] [CrossRef]
  36. Yu, P.S.; Chen, S.T.; Chang, I.F. Support vector regression for real-time flood stage forecasting. J. Hydrol. 2006, 328, 704–716. [Google Scholar] [CrossRef]
  37. Hong, W.C.; Dong, Y.; Chen, L.Y.; Wei, S.Y. SVR with hybrid chaotic genetic algorithms for tourism demand forecasting. Appl. Soft Comput. 2011, 11, 1881–1890. [Google Scholar] [CrossRef]
  38. Smola, A.J.; Schölkopf, B. A tutorial on support vector regression. Stat. Comput. 2004, 14, 199–222. [Google Scholar] [CrossRef] [Green Version]
  39. Lee, J.; Wang, W.; Harrou, F.; Sun, Y. Reliable solar irradiance prediction using ensemble learning-based models: A comparative study. Energy Convers. Manag. 2020, 208, 112582. [Google Scholar] [CrossRef] [Green Version]
  40. Lee, J.; Wang, W.; Harrou, F.; Sun, Y. Wind power prediction using ensemble learning-based models. IEEE Access 2020, 8, 61517–61527. [Google Scholar] [CrossRef]
  41. Harrou, F.; Saidi, A.; Sun, Y.; Khadraoui, S. Monitoring of photovoltaic systems using improved kernel-based learning schemes. IEEE J. Photovoltaics 2021, 11, 806–818. [Google Scholar] [CrossRef]
  42. Williams, C.K.; Rasmussen, C.E. Gaussian Processes for Machine Learning; MIT Press: Cambridge, MA, USA, 2006; Volume 2. [Google Scholar]
  43. Williams, C.; Rasmussen, C. Gaussian processes for regression. Adv. Neural Inf. Process. Syst. 1995, 8, 514–520. [Google Scholar]
  44. Tang, L.; Yu, L.; Wang, S.; Li, J.; Wang, S. A novel hybrid ensemble learning paradigm for nuclear energy consumption forecasting. Appl. Energy 2012, 93, 432–443. [Google Scholar] [CrossRef]
  45. James, G.; Witten, D.; Hastie, T.; Tibshirani, R. An Introduction to Statistical Learning; Springer: Berlin/Heidelberg, Germany, 2013; Volume 112. [Google Scholar]
  46. Loh, W.Y. Classification and regression trees. Wiley Interdiscip. Rev. Data Min. Knowl. Discov. 2011, 1, 14–23. [Google Scholar] [CrossRef]
  47. Zhou, Z. Ensemble Methods: Foundations and Algorithms; CRC Press: Boca Raton, FL, USA, 2012; pp. 15–55. [Google Scholar]
  48. Breiman, L. Bagging predictors. Mach. Learn. 1996, 24, 123–140. [Google Scholar] [CrossRef] [Green Version]
  49. Bühlmann, P.; Hothorn, T. Boosting algorithms: Regularization, prediction and model fitting. Stat. Sci. 2007, 22, 477–505. [Google Scholar]
  50. Breiman, L. Random forests. Mach. Learn. 2001, 45, 5–32. [Google Scholar] [CrossRef] [Green Version]
  51. Chen, T.; He, T.; Benesty, M.; Khotilovich, V.; Tang, Y.; Cho, H.; Chen, K.; Zhou, T. Xgboost: Extreme gradient boosting. R Package Version 0.4-2 2015, 1, 1–4. Available online: https://cran.r-project.org/web/packages/xgboost/vignettes/xgboost.pdf (accessed on 17 June 2023).
  52. Deng, H.; Yan, F.; Wang, H.; Fang, L.; Zhou, Z.; Zhang, F.; Xu, C.; Jiang, H. Electricity Price Prediction Based on LSTM and LightGBM. In Proceedings of the 2021 IEEE 4th International Conference on Electronics and Communication Engineering (ICECE), Xi’an, China, 17–19 December 2021; pp. 286–290. [Google Scholar]
  53. Ke, G.; Meng, Q.; Finley, T.; Wang, T.; Chen, W.; Ma, W.; Ye, Q.; Liu, T.Y. Lightgbm: A highly efficient gradient boosting decision tree. Adv. Neural Inf. Process. Syst. 2017, 30, 52. [Google Scholar]
  54. Bull, A.D. Convergence rates of efficient global optimization algorithms. J. Mach. Learn. Res. 2011, 12, 2879–2904. [Google Scholar]
  55. Bergstra, J.; Bengio, Y. Random search for hyper-parameter optimization. J. Mach. Learn. Res. 2012, 13, 281–305. [Google Scholar]
  56. Yang, L.; Shami, A. On hyperparameter optimization of machine learning algorithms: Theory and practice. Neurocomputing 2020, 415, 295–316. [Google Scholar] [CrossRef]
  57. Snoek, J.; Larochelle, H.; Adams, R.P. Practical bayesian optimization of machine learning algorithms. Adv. Neural Inf. Process. Syst. 2012, 25, 1–12. [Google Scholar]
  58. Shahriari, B.; Swersky, K.; Wang, Z.; Adams, R.P.; De Freitas, N. Taking the human out of the loop: A review of Bayesian optimization. Proc. IEEE 2015, 104, 148–175. [Google Scholar] [CrossRef] [Green Version]
  59. Hastie, T.; Tibshirani, R.; Friedman, J.H.; Friedman, J.H. The Elements of Statistical Learning: Data Mining, Inference, and Prediction; Springer: Amsterdam, The Netherlands, 2009; Volume 2. [Google Scholar]
  60. Wang, S.; Zou, L.; Li, H.; Zheng, K.; Wang, Y.; Zheng, G.; Li, J. Full-scale membrane bioreactor process WWTPs in East Taihu basin: Wastewater characteristics, energy consumption and sustainability. Sci. Total Environ. 2020, 723, 137983. [Google Scholar] [CrossRef]
  61. Rathnayake, N.; Rathnayake, U.; Dang, T.L.; Hoshino, Y. A Cascaded Adaptive Network-Based Fuzzy Inference System for Hydropower Forecasting. Sensors 2022, 22, 2905. [Google Scholar] [CrossRef]
  62. Harrou, F.; Dairi, A.; Kadri, F.; Sun, Y. Forecasting emergency department overcrowding: A deep learning framework. Chaos Solitons Fractals 2020, 139, 110247. [Google Scholar] [CrossRef]
Figure 1. Measured variables in this study.
Figure 1. Measured variables in this study.
Water 15 02349 g001
Figure 2. Distribution of some the used variables.
Figure 2. Distribution of some the used variables.
Water 15 02349 g002
Figure 3. Yearly sum of inflow (a) and energy consumption (b) from 2014 to 2018.
Figure 3. Yearly sum of inflow (a) and energy consumption (b) from 2014 to 2018.
Water 15 02349 g003
Figure 4. Distribution of some the used variables.
Figure 4. Distribution of some the used variables.
Water 15 02349 g004
Figure 5. Distribution of annual energy consumption over the course of the study period.
Figure 5. Distribution of annual energy consumption over the course of the study period.
Water 15 02349 g005
Figure 6. Distribution of monthly energy consumption over the course of the study period.
Figure 6. Distribution of monthly energy consumption over the course of the study period.
Water 15 02349 g006
Figure 7. The investigated machine learning method in this study.
Figure 7. The investigated machine learning method in this study.
Water 15 02349 g007
Figure 8. Illustration of the general framework of machine learning-based prediction procedure.
Figure 8. Illustration of the general framework of machine learning-based prediction procedure.
Water 15 02349 g008
Figure 9. Feature importance identification using RF and XGBoost methods with all input variables.
Figure 9. Feature importance identification using RF and XGBoost methods with all input variables.
Water 15 02349 g009
Figure 10. Feature importance identification using RF and XGBoost methods with all original input variables and Lag 1 Energy consumption.
Figure 10. Feature importance identification using RF and XGBoost methods with all original input variables and Lag 1 Energy consumption.
Water 15 02349 g010
Figure 11. Heatmap of (a) MAPE and (b) RMSE values obtained using the twenty-three models.
Figure 11. Heatmap of (a) MAPE and (b) RMSE values obtained using the twenty-three models.
Water 15 02349 g011
Table 1. Summary of some studies on the WWTPs power consumption prediction.
Table 1. Summary of some studies on the WWTPs power consumption prediction.
ReferenceDatasetPredicted AlgorithmResult
Zhang et al. [22]2387 records from the China Urban Drainage YearbookRF modelAchieved an R2 of 0.702
Bagherzadeh et al. [28]Melbourne water company between 2014 and 2019ANN, GBM, and RFGBM reached the lowest RMSE and MAE values in the test phase, 33.9 and 26.9, respectively
Boncescu et al. [23]Data collected between 2015 and 2017 with a total of 403 recordsLogistic RegressionAccuracy around 80%
Ramli et al. [24]EC dataset collected from TNB electrical bills from March 2011 to February 2015NN, KNN, SVM, and Linear RegressionANN reached an RMSE of 52,084
Torregrossa et al. [26]WWTPs in Northwest EuropeANN and RFRF and ANN obtained an R2 of 82 and 0.81, respectively
Torregrossa et al. [25]Solingen-Burg datasetSVR, ANN, and RF algorithmsRF obtained an R 2 of 0.71
Oulebsir et al. [30]317 WWTPs located in the north-west of EuropeANN modelR2 got a range between 74.2 to 82.4
Zhang et al. [29]Data set covers the period from July 2010 to January 2012ANN modelreaches 0.78 and 0.02 in MAE and MAPE
Das et al. [31]360 instances collected over one yearANN, RNN, LSTM, and GRUGRU achieves the lowest MAE of 0.43
Oliveira et al. [32]Three datasets covering the period between January 2016 and May 2020LSTM, CNN, and GRUCNN models produced higher performance results in both tests, achieving 690 kWh in the RMSE and 630 kWh in the MAE
Yusuf et al. [33]A water district in southern CaliforniaARIMA and LSTM modelsRMSE with a score of 20.96 and MAPE with a score of 5.51.
Filipe et al. [34]70,962 data points were collected from September 2013 to June 2017Linear Quantile Regression, and Gradient Boosting Trees (GBT)GBT achieved MAE and RMSE scores of 2.43% and 3.31% respectively
Table 2. Prediction results of full machine learning models based on testing data.
Table 2. Prediction results of full machine learning models based on testing data.
MethodsRMSE (MWh)MAE (MWh)MAPE (%)RMSE Train (MWh)Train Time (s)J2
LSVR46.4036.1112.0939.1260.2971.40
CSVR41.9633.5612.3045.58197.890.84
GSVR41.8532.2811.2438.8628.941.15
QSVR43.4433.6811.8140.6697.0521.14
GPRE43.3233.4811.4537.92469.671.30
GPRM3/246.0235.5111.8838.16308.81.45
GPRRQ42.4432.6211.2437.97805.051.24
GPRSE46.2335.6511.9238.15482.81.46
GPRM5/246.0035.4811.8838.18527.091.45
BT41.4632.2311.3635.67442.611.35
BST41.3731.9711.2535.7728.3761.33
ODT42.5733.5711.8739.0619.3451.18
NNN60.0547.0814.5844.0613.641.85
MNN93.7767.8518.5155.9011.862.81
WNN194.31131.1027.91145.0316.161.79
BNN64.5451.0015.6545.9010.111.97
TNN67.5949.7615.6951.9512.141.69
ONN47.0936.5512.2139.40157.721.42
XGBoost41.3832.2312.0742.36375.000.95
RF42.4333.1612.0744.9075.000.89
KNN41.5132.8212.3041.4121.001.00
LightgBM41.7632.3412.4041.76107.001.00
Table 3. Prediction results of the reduced models based on testing data.
Table 3. Prediction results of the reduced models based on testing data.
MethodsRMSE (MWh)MAE (MWh)MAPE (%)RMSE Train (MWh)Train Time (s)J2
LSVR47.7637.1912.3039.52102.181.46
CSVR41.9633.5612.3045.68178.570.84
GSVR41.9632.1611.1738.3961.981.19
QSVR45.3135.1411.9040.03264.511.28
GPRE43.3033.5011.4438.06379.951.29
GPRM3/242.3532.6711.2538.30462.061.22
GPRRQ42.4332.6211.2337.91977.711.25
GPRSE46.2135.6711.9238.39467.661.45
GPRM5/242.2232.5811.2438.42420.511.21
BT41.7032.3511.4335.51450.591.38
BST43.6734.2612.5640.0130.561.04
ODT42.7133.2611.6038.7335.811.22
NNN60.8848.9615.2942.7910.272.02
MNN101.3470.4618.8578.049.851.69
WNN140.7692.6526.12227.7713.330.38
BNN60.0446.3614.5059.8710.301.01
TNN62.4349.0715.0646.8611.641.78
ONN43.4433.7411.5341.22298.741.11
XGBoost41.7732.8012.2042.91376.000.95
RF41.6132.3112.2541.4864.001.01
KNN37.3328.2310.6541.4110.000.08
LightgBM41.2732.0012.2741.27103.001.00
Table 4. Prediction results of the dynamic models based on testing data.
Table 4. Prediction results of the dynamic models based on testing data.
MethodsRMSE (MWh)MAE (MWh)MAPE (%)RMSE Train (MWh)Train Time (s)J2
KNN37.3328.2310.6537.4813.000.99
XGBoost37.1428.5010.8137.62398.000.97
LightGBM37.3828.6310.9637.11150.001.01
GPRRQ37.4528.6510.0434.17936.091.20
RF37.8628.7310.9141.7366.000.82
GPRE37.3628.7410.0533.88549.211.22
BT37.5628.7510.2733.99332.301.22
GPRM5/237.4228.8110.0733.93502.681.22
BST37.8328.8610.2534.9258.891.17
ODT38.4828.8710.4535.7022.871.16
GSVR37.7028.8810.1234.4734.781.20
GPRSE37.5928.9210.1033.96784.891.23
QSVR38.6229.3010.2434.38210.031.26
ONN38.8530.0210.4635.45423.011.20
CSVR40.0730.1310.3544.40122.440.81
LSVR39.2230.2910.4334.1549.951.32
BNN46.9636.3112.4339.8311.411.39
TNN46.9636.3112.4338.7212.801.47
NNN53.8339.8312.5557.0810.520.89
MNN90.1865.3717.7760.0811.162.25
WNN152.43111.0826.80210.2014.630.53
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Alali, Y.; Harrou, F.; Sun, Y. Unlocking the Potential of Wastewater Treatment: Machine Learning Based Energy Consumption Prediction. Water 2023, 15, 2349. https://doi.org/10.3390/w15132349

AMA Style

Alali Y, Harrou F, Sun Y. Unlocking the Potential of Wastewater Treatment: Machine Learning Based Energy Consumption Prediction. Water. 2023; 15(13):2349. https://doi.org/10.3390/w15132349

Chicago/Turabian Style

Alali, Yasminah, Fouzi Harrou, and Ying Sun. 2023. "Unlocking the Potential of Wastewater Treatment: Machine Learning Based Energy Consumption Prediction" Water 15, no. 13: 2349. https://doi.org/10.3390/w15132349

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop