1. Introduction
Resource recovery, maintaining water quality requirements, and maximizing energy efficiency are key challenges faced by wastewater treatment units [
1]. Over the past few decades, computational models have gained recognition as valuable tools for addressing these challenges and enhancing both the operational and financial performance of wastewater treatment facilities or plants. To forecast wastewater treatment plant performance in this context, stochastic models based on time series and robust models have been developed [
2]. With an ever-increasing amount of data available, data-driven models are becoming more attractive.
Consequently, the uncertainty in sedimentation tank models or secondary facultative lagoons is crucial for the simulation of a wastewater treatment system. This is notably highlighted in relevant and appropriate contributions in the scientific literature [
3,
4,
5], as are evaluations of the effects of microbial community predictors on settling velocity or hindered sedimentation at the level of water resource recovery [
6]. The recent literature also contains many three-dimensional computational fluid dynamic models, such as the case of Xu et al. (2022), and these models are commonly used to optimize the model and design of the computational fluid dynamics of the complete solid–liquid two-phase process [
7]. In addition to considering the most recent contributions that have motivated the present development in this field, studies focused on building a stochastic state-space model of the sludge layer height in secondary clarifiers in wastewater treatment plants should also be considered [
8].
According to this background, the spatial finite difference scheme of the advection–diffusion partial differential equation serves as the basis for the construction of these models, which also incorporate sedimentation dynamics using the real flow sedimentation curves and operational parameters of the sedimentation and biological treatment of wastewater. These models still serve as the basis for the one-dimensional modeling of clarifiers, mainly composed of reaction or facultative tanks and a sedimentation or maturation tank. In this context, the latest research in the literature improves the mathematical explanations of solid dispersion and mechanistic compression dynamics, for example, while primarily emphasizing appropriate mathematical formulations for ensuring proper positioning and stability [
8].
The complexity of the clarifier’s behavior under operational conditions and the accuracy of one-dimensional models are affected by complex factors such as turbulence and uneven sludge distributions, which represent the two obstacles to accurately estimating the height of the sludge layer. Another limitation inherent in previous studies is the approach to great computational complexity, which translates into a cost in obtaining the model, thus making it barely practical to execute online operations that require quick and continuous calculations to calibrate the model with different points that can be used to determine the expected sludge concentration profile and infer the height of the sludge layer.
These limitations were mitigated in the present study by assuming continuous measurements of the sludge layer height (endogenous variable) at different points, facilitating the calibration of the model defined in a single state-space equation, based on signals from operational control parameters in wastewater treatment that were repeatedly optimized. These operational parameters are defined as the plant’s inlet flow, the suspended solids concentrations of the clarifier, and the clarifier recycling rate. Using these parameters can lead to reductions in model prediction costs with an ideal configuration of model predictive control with quality measurements and representative sampling.
Considering these problems, this research focused on the objective of constructing a model that maintains a flexible fit to the data by estimating the parameters that minimize, in a single procedure, the negative logarithmic probability of the independent state transition probabilities, where state filtering is carried out using an Extended Kalman Filter (EKF). The above is achieved by solving the stochastic differential equation at each point in time through transformation to a weighted fit based on both the underlying uncertainty (probability distribution) and the very nature of the observations associated with the accumulation of activated sludge at the Ucubamba Guangarcucho wastewater treatment plant in Ecuador.
This procedure involves the construction of a state-space model that estimates the state of a dynamic system from a sequence of noisy observations. This methodology is ideal for the prediction of time series in dynamic systems that need to be monitored or estimated in real time, considering the uncertainties of the measurements, which allows readings to be refined to produce a more accurate forecast of the future state of the system as new data become available. Given the challenges associated with the implementation of traditional or analytical methods, as well as the costs of experimentation and computation, this type of modeling can be used to achieve more effective risk control.
1.1. Literature Review
This section defines a mathematical formula system known as the Kalman filter, which tends to offer a productive recursive solution to the least-squares approach. With the help of this method, an ideal linear, unbiased estimator of a process’s state can be determined at any given moment using the data available at time and updated with new data at time . The primary approach to estimating dynamic systems given in state-space form is represented by this type of filter.
Since the Kalman algorithm is the principal method for estimating dynamic systems represented in state-space form and has numerous applications in the field of econometrics, it is imperative to extend its understanding to other fields of knowledge. Applying this type of filter involves a mathematical process that employs a correction and prediction method. Essentially, this method takes its prior state estimation and predicts the current state by adding a correction term proportional to the prediction error, ensuring that the prediction error is statistically minimized.
The Extended Kalman Filter (EKF) has been explored in various studies as a potential tool for predicting sludge concentration in wastewater treatment facilities. In this context, the contributions of Li et al. [
9] and Bartos et al. [
10] have been significant, illustrating the usefulness of the Extended Kalman Filter (EKF) in estimating unmeasured states in wastewater treatment operations. Additionally, Kim et al. [
11] presented a reduced-order dynamic model for the activated sludge process, with the potential to forecast the dynamic behavior of a biological wastewater treatment facility. Using simple and affordable sensors, Nair et al. [
12] expanded the application of the Extended Kalman Filter (EKF) to estimate nutrient content in a prototype plant for a sequential batch moving bed biofilm reactor. All these studies demonstrate how the Extended Kalman Filter (EKF) can be used to forecast sludge concentration in wastewater treatment facilities.
1.2. Extended Kalman Filter (EKF)
The Kalman filtering (KF) process is a recursive prediction method that assumes a linear correlation exists between variables to determine the best estimate for an unknown state vector,
, given knowledge of an observable vector,
. However, when the model dynamics are nonlinear, a new filtering strategy is required (
Figure 1). Among these methods is the Extended Kalman Filter (EKF), a linearization procedure based on the Taylor approximation that extends the standard Kalman filter [
13].
To establish the foundations for constructing the Extended Kalman Filter (EKF), a nonlinear system characterized by the following state measurement model is analyzed:
The Gaussian noise processes and are independent, with zero mean and covariance matrices and , respectively. The nonlinear transition matrix functions, which are assumed to be and may vary over time in certain situations, are represented by the variables y .
The fundamental principle of the Extended Kalman Filter is to linearize the state-space model of Equations (1) and (2) each time around the previous or most recent state estimate, which can be either or , depending on the specific function considered. The variables or represent the a priori and a posteriori state estimates, respectively.
Selecting
and
is one of the most challenging aspects for effective filter implementation, as the Kalman filtering process employs fixed covariance matrices [
14].
In the scientific literature, stochastic models have been used to predict sludge height in wastewater treatment facilities. This strategy can improve effluent quality and optimize plant operations. Additionally, numerous wastewater treatment applications have utilized stochastic models for performance optimization, uncertainty analysis, and process performance prediction. To assess uncertainty in activated sludge modeling in wastewater treatment facilities, the use of a stochastic differential equation has been investigated. This method can aid in enhancing understanding and managing ambiguity throughout the treatment process.
1.3. Use of Model Generator (sdeTMB) for Solving Stochastic Differential Equations
Driven by the framework of continuous-time stochastic modeling, sdeTMB is an R package for parameter estimation, state filtering, and prediction in stochastic state-space models. This package eliminates the need for the user to write the required C++ file containing the negative log-likelihood function by providing an intuitive wrapper for the Template Model Builder. Instead, the provided R6 class object is used to automatically build the C++ script based on a user-specified model. Additionally, the package leverages the broader package ecosystem to streamline stochastic simulation paths and accelerate model prediction calculations.
The package implements the following technique: the continuous-discrete Extended Kalman Filter (EKF). Kalman filter implementations offer two key benefits: a substantial increase in computational performance and the ability to use a fixed-effects matrix for improved optimization convergence. TMB only provides automatic differentiation under certain conditions. The use of the Laplace approximation for likelihood calculations, which allows for state-space formulations when the observation residual density is non-Gaussian, is a significant advantage of this methodology.
Currently, algorithms are primarily designed to apply the Kalman filter and associated approaches within an integrated developer interface in RStudio 2023.12.0, as well as for k-step-ahead predictions and simulations. It also includes an implementation that, when calling the class object returned by the function, displays a simple residual analysis using packages such as ggplot2 (version 3.5.1), sdmTMB (version 0.6.0), predict, simulate, S3, method, plot, and estimate.
1.4. Wastewater Treatment Plant (WWTP)
The operational dynamics within wastewater treatment plants (WWTPs) significantly influence sludge behavior, particularly during the primary treatment phase, where fluctuations in influent flow rate, suspended solids concentration, and organic load impact sludge settling and accumulation [
4,
8]. These process variations necessitate advanced predictive modeling techniques to ensure effective monitoring and control. The Extended Kalman Filter (EKF) has been applied in wastewater treatment contexts to enable the precise estimation of sludge concentration by integrating real-time data from key operational parameters [
9,
10]. This methodological approach enhances process stability, improves predictive accuracy, and supports optimized decision-making for sludge management and overall plant performance.
According to the self-purification capacity of the system, the objective of a wastewater treatment plant (WWTP) is to receive and treat wastewater comprehensively, for its subsequent safe release into an aquatic environment. Wastewater treatment systems, on the other hand, involve a series of procedures and operations that range from the removal of solids to the final disposal of sludge, aiming to minimize potential environmental impacts and, as much as possible, reuse the resources generated in the process. The decomposition of organic matter throughout the treatment process produces sludge and biogas. These byproducts are crucial for the purification process due to their unique physical, chemical, and biological properties, which allow them to be reused beyond their disposal, offering greater utility and potential for exploitation [
15]. Sewage sludge management is increasingly approached from a circular economy perspective, focusing on resource recovery, energy production, and the sustainable reuse of nutrients and organic matter [
4].
As previously mentioned, sludge from wastewater treatment plant (WWTP) results from the concentration of solids contained in the effluent or from the formation of new suspended solids arising from dissolved solids, which are typically process byproducts containing a high concentration of organic matter, microorganisms, macro- and micronutrients, heavy metals, and water [
16].
To determine the quality and stability of residual activated sludge, it is essential to identify specific contaminants that may pose environmental or health risks. These contaminants include heavy metals (such as lead, mercury, and cadmium), organic micropollutants (like pesticides and pharmaceuticals), and pathogenic microorganisms (bacteria, viruses, and parasites). Comprehensive sludge characterization typically involves measuring parameters such as total suspended solids (TSS), chemical oxygen demand (COD), biochemical oxygen demand (BOD), and nutrient content (nitrogen and phosphorus), which are critical for assessing sludge composition and treatment performance. Additionally, total biochemical oxygen demand (TBOD) serves as an indicator of effluent quality, reflecting the overall organic load.
In the literature, neural network models enhanced by evolutionary algorithms are commonly used to predict the operational efficiency of wastewater treatment plants, utilizing key wastewater quality parameters (such as pH, TSS, COD, and BOD) as input variables [
17]. External environmental factors, including rainfall, sunlight exposure, and average daily air temperature, are also considered, as they can significantly influence the dynamics of sludge formation and the efficiency of the treatment process.
2. Materials and Methods
2.1. Description of Ucubamba Guangarcucho Wastewater Treatment Plant
The wastewater treatment plant is situated in the northeastern region of Cuenca, Ecuador, with the primary objectives of intercepting and treating 95% of the city’s wastewater, processing approximately 4.30 m3/day at an average flow rate of 1300 L/s. Additionally, wastewater management is supplemented by the operation of smaller treatment facilities distributed across different areas of the canton.
The plant’s design framework incorporates an advanced purification system, which consists of preliminary treatment units and a stabilization pond system arranged in two parallel treatment lines to optimize wastewater processing efficiency. This structural configuration is specifically engineered to regulate hydraulic pressure and inflow rates while simultaneously facilitating the removal of suspended solids, which inherently contribute to the treatment load.
The preliminary treatment infrastructure of the wastewater treatment plant (
Figure 2) includes inflow distribution chambers, which are strategically partitioned to manage an influent capacity of 1800 L/s. The facility operates with a maximum hourly treatment flow of 2270 L/s during the dry season, while the recorded peak hourly treatment flow during the rainy season reaches 2500 L/s.
2.2. Process of Extraction, Transportation, Pumping, Thickening, and Dewatering of Sludge
The Ucubamba Guangarcucho wastewater treatment plant features six stabilization ponds, comprising two aerated ponds, two facultative ponds, and two maturation ponds. These ponds are hydraulically connected in parallel within their respective categories and arranged in a linear sequence across different pond types (
Figure 3) to facilitate maintenance, cleaning, and repair operations while ensuring continuous treatment efficiency.
The process line for the extraction and dewatering of 220,000 m3 of sludge comprises several sequential operations, including initial extraction and pumping via dredging systems, sludge collection and conveyance through pressurized pipelines, pumping at intermediate stations, and screening within 18-inch-wide Parshall flumes (Model L8000T010; HONEYWELL BMS, Charlotte, NC, USA) to quantify the flow rate of treated wastewater, serving as data acquisition points during the final discharge into the Cuenca River. This phase corresponds to the terminal stage of the activated sludge extraction and dewatering system at the Ucubamba sector wastewater treatment plant.
The monitoring instruments employed in this process include the CBX Sludge Blanket Meter (Cerlic Controls AB, Segeltorp, Sweden) and the MultiTracker (Cerlic Controls AB, Segeltorp, Sweden), both of which provide high-precision, repeatable measurements of the sludge blanket level, based on real-time solid concentration analysis.
The activated sludge treatment integrates processes carried out across aeration lagoons and facultative lagoons, where the sludge layer plays a pivotal role in volume reduction and the biodegradation of pollutants. Within the aeration ponds, the primary objective is to decrease suspended solids and organic load to an optimal level, enabling the subsequent treatment stage through 1500 mm pipelines leading to the facultative ponds.
In the thickening stage, sludge undergoes gravity-assisted thickening, followed by the pumping of concentrated sludge, polyelectrolyte conditioning, dewatering via belt filter presses, pneumatic transfer to a storage silo, and final containment. Additionally, the Ucubamba Guangarcucho wastewater treatment plant incorporates auxiliary systems for water pumping, compressed air distribution, truck weighing, and real-time control and monitoring systems.
Untreated wastewater enters the treatment plant through three separate influent pipelines, which merge into a single 39-inch diameter conduit that directs the flow into the headworks facility, where preliminary treatment is conducted. The raw water pumping station conveys the wastewater to the grit chambers via two ductile iron pipelines: one 900 mm in diameter, capable of transporting 800 L/s, and another 1200 mm in diameter, with a capacity of up to 1600 L/s. Each pipeline extends approximately 96 m, collectively accommodating a maximum instantaneous flow of 2400 L/s.
As part of the sanitation process, the influent is sequentially distributed to the primary sedimentation tanks, percolating filters, aeration tanks, secondary sedimentation tanks, and final clarifiers, ultimately discharging into the Cuenca River.
The process flow diagram (
Figure 4) illustrates the interconnection of treatment stages and the recirculation of return activated sludge (RAS) and waste activated sludge (WAS) within the system. This comprehensive schematic visually represents the integrated wastewater treatment process, which encompasses pre-treatment, primary treatment, secondary treatment, and disinfection. Pre-treatment involves influent interception, coarse screening, solid extraction screens, pumping stations, fine screening, and grit removal chambers. Primary treatment focuses on the removal of suspended solids, floating materials, and organic matter. Secondary treatment includes aeration tanks and secondary clarifiers, with biological sludge recirculation for enhancing microbial activity and organic matter decomposition. The facility incorporates ultraviolet (UV) disinfection, ensuring the treated effluent is adequately disinfected before being discharged into the Cuenca River.
The management of activated sludge within the WWTP prioritizes resource recovery and waste minimization, leveraging a circular treatment approach. This process integrates biological treatment, final sedimentation, disinfection, sludge thickening, anaerobic digestion, dewatering, and biosolid utilization. Such an approach fosters the recovery and reuse of valuable resources, significantly reducing waste generation and contributing to the closure of the nutrient and organic matter cycle.
2.3. Data
The data matrix generated during this study is structured as follows:
represents the time variable throughout the stochastic process, during which measurements of the sludge blanket height are collected for each primary sedimentation tank.
denotes the influent flow rate, which accounts for the concentration of suspended solids within each biological tank pair while also considering percentage variations in the operational factor .
Additionally, the matrix includes data on the sludge recycling flow rate ( for each sedimentation tank, providing critical insights into sludge dynamics and system performance.
Due to the large volume of data, the complete data matrix is provided as
Supplementary Materials and is not included in the main body of this article.
2.4. Methodology for Data Analysis
The sdeTMB and ctsmTMB libraries were implemented in the free R 4.2.3 application under the RStudio 2023.12.0 integrated development environment, which allows for the estimation of mixed-effects models with non-Gaussian probability distributions, which defines the basis of this type of model. Utilizing models based on the sdeTMB library allows for the examination of data with complex structures, including time series, spatial data, or data with random effects; in this context, the sdeTMB library proves to be of practical use in constructing these models. Compared to conventional models, this methodology provides a more accurate modeling of data variability. Installing the sdeTMB library in RStudio is a prerequisite for using the function model = sdeTMB$new(). The syntax model = sdeTMB$new() can then be used to create a new object, where “model” represents the designation assigned to the resulting object. Consequently, the user must have a functional C++ compiler. Researchers working on Windows must install Rtools 4, while Mac users need to install Command Line Tools for the C++ compilers to function correctly.
Figure 5 provides a detailed description of the block diagram of the Extended Kalman Filter. This suggests that, somewhere—perhaps in a visual resource like a book, presentation, or technical document—there is a block diagram that explains in detail how the Kalman filter functions in a single dimension. This diagram likely visually illustrates the stages of the Kalman filter algorithm, such as measurement, update, and prediction, within a one-dimensional system. The block diagram serves as a graphical representation that helps to visually understand the operation and interaction of the different stages of the Kalman filter.
This study was conducted over a 30-day period in June 2024, generating a database comprising 4450 recorded data points, defined within time intervals ranging from 14:08 to 21:52. Utilizing this data matrix and applying the algorithm illustrated in
Figure 5, the modeling of sludge concentration dynamics in sewer systems for the wastewater treatment plant was performed.
2.5. Estimation Process
To evaluate the state of a nonlinear system from noisy observations, the EKF uses an iterative procedure and a state estimation approach. After linearizing the nonlinear system around the current operating point, the EKF estimates the state using the conventional Kalman filter.
The state and observation equations of the nonlinear system, as well as the measurement noise and process noise covariance matrices, must be defined before implementing the Extended Kalman Filter. The RStudio 2023.12.0 program can be used to implement the EKF, as shown in
Table 1, by applying the maximum likelihood estimation method.
In estimating an empirical equation to model the sludge blanket in the wastewater treatment plant as a function of time, parameters b0, b1, and b2 are specified as coefficients estimated from a statistical model. These coefficients represent the relationship between the predictor variables, represented by wastewater treatment operating parameters (Qf, Sf, and Qr), and the response variable (expressed on the logit scale). The invlogit function is used to convert the model’s prediction from the logit scale to the probability scale, making it easier to interpret.
To assess the adequacy and fit of the process, it is essential to compare the model’s predictions with documented data. This comparison was performed to evaluate the accuracy of the Kalman filter; to accomplish this, the predicted sludge blanket height was compared with the actual height. Descriptive graphs are typically used for this comparison.
2.6. Optimization Process
The optimization is completed by obtaining the following parameters: elapsed time, objective value, maximum gradient component, relative convergence, iterations, function, and gradient. The reference values for the state-space modeling of sludge concentration in wastewater treatment plants are shown in
Table 2.
3. Results
The Kalman filter is a recursive estimation technique that provides an optimal estimate of the state of a dynamic system based on noisy measurements. In the case of wastewater treatment, the Kalman filter can be used to predict the sludge blanket height in the wastewater treatment plant over time.
Figure 6 shows the hourly series with records starting from the first day of June 2024, corresponding to the exact record at 14:08 h for monitoring the final process in 18-inch Parshall channels leading to the aeration and facultative lagoons or tanks within the wastewater treatment plant, with the height of the activated sludge blanket recorded in meters. A comparison with the metric records of the average height of the activated sludge blanket reveals a complex and heteroscedastic pattern, indicating an accumulation behavior of 1.5 m or more of this type of sludge on the first day of recording and the fourth day. Additionally, a strong accumulation of sludge exceeding 2 m is recorded for the days 2 June 2024, 15 June 2024, and 17 June 2024, due to the reduced volume of water in the influent at the WWTP, as evidenced by the representation of the red line indicating the mass flow rate. This suggests that as the influent flow increases, the dilution flow reduces the sludge level in the WWTP. The minimum and maximum heights of the sludge layer are represented in the graph by the shaded gray color, assuming the minimum and maximum heights of the present solid layer that is linked to the level of use of clarifiers that are used to separate the suspended solids from the treated water.
The plotting of probabilistic forecasts (gray area shown in
Figure 6) is highly useful in practice as it provides insight into the reliability of the sludge blanket height forecast at the influent of the treatment plant by estimating a 95% prediction interval.
One of the most important factors when modeling the height of the activated sludge layer is time. To observe behavior in the predictions, it is crucial to consider the time intervals of every two and every four hours. This is because the Kalman filter uses a dynamic model to anticipate the system’s evolution over time (
Figure 7).
According to
Figure 7, a small estimation error is observed, indicating a difference between the actual values (the red line) and the Extended Kalman Filter (EKF) estimates (the green and blue lines). We can see that the estimation errors in the fit using the Extended Kalman Filter (EKF) decrease within the filter’s convergence region.
Residual Analysis
The discrepancy between actual measurements and filter estimates for the variable of interest (activated sludge layer height) is represented by the residuals (
Figure 8). Residuals should behave randomly, with constant variance and a zero mean. If trends (
Figure 8a), autocorrelations (
Figure 8c), or heteroscedasticity (
Figure 8b) are visible in the residuals, this indicates that the model does not fit the data adequately. This highlights the importance of residual analysis, as it allows us to identify potential issues with the model, including systematic errors, biases, or noise. By fine-tuning the parameters of the Extended Kalman Filter, the model can be further improved.
As shown in the graphs represented in
Figure 8, no potential estimation issues are identified, such as the non-normality of residuals, the presence of autocorrelation, or periodic components (
Figure 8d). This indicates that the method employed is efficient for estimating sludge concentration in the WWTP, effectively determining the treatment system’s efficiency, the amount of available sludge, and the contamination risks to ecosystems exposed to this waste.
4. Discussion
The quality of water must be monitored in various wastewater treatment plants to ensure compliance with specific standards. Monitoring detects problems in the WWTP, resulting in quality improvements and lower maintenance risks [
18]. The management of the WWTP is a sophisticated and comprehensive process influenced by unpredictable factors such as weather, illegal discharges, and water leaks [
19]. These variables can alter the flow and properties of the incoming water, requiring more robust treatment measures [
20]. The WWTP aims to regulate all processes to ensure water quality, minimize environmental impacts, and reduce operational costs.
The implementation of predictive models has the potential to transform the way facilities manage WWTPs by enabling real-time process simulation through digital emulation developments [
21]. Consequently, various challenges have emerged, including the application of conventional models and machine learning techniques to forecast wastewater properties and effluent contributions, as well as research to identify irregularities in activated sludge accumulation and optimize energy use in WWTPs [
22].
Since sludge contains harmful bacteria that pose a threat to human health and the environment, it has become one of the most challenging and concerning environmental issues related to wastewater treatment [
23]. In this context, residual sludge can significantly affect the operational efficiency of treatment plants. The primary phases of the physical separation of the sludge produced during traditional treatment are predominantly associated with sedimentation and filtration. Proper sludge management is necessary to avoid negative impacts on the environment and public health [
24]. If not managed correctly, residual sludge can accumulate and clog recirculation systems and treatment equipment within the wastewater treatment plant, reducing operational efficiency and potentially leading to the release of pollutants into the environment.
The literature generally reports variable estimates of sludge generation, so it is not appropriate to generalize this, as it depends on a series of factors, including the properties of the raw water, the type and dose of coagulant, the conditions of the coagulation process, and the structure or configuration of the treatment plant. Therefore, the estimation of sludge production in each treatment plant design represents a unique phenomenon influenced by various factors, as highlighted in [
25]. Therefore, due to methodological heteroscedasticity in model construction, variable management, and reliable measurement records, there is no unification for making direct comparisons with models present in various studies.
A challenge with the estimated model, unlike the contributions in existing models, is that it lacks easy interpretation in terms of the estimated parameters of the studied phenomenon, in terms of its complex qualitative dynamics of process functioning, where the method of data collection is vital to ensure they are of high quality and representative for analyzing correlations between endogenous and exogenous variables. It is important to avoid single-point measurement records that could erroneously lead to the conclusion of the uniform height of the activated sludge blanket, assuming that there is the incidence of the level of turbulence produced by the water flow [
8].
A significant advantage in the implementation of the Extended Kalman Filter technique to predict the level of activated sludge in the WWTP of the sewer system lies in its dynamic real-time adjustment as new data are incorporated, creating highly accurate information. This contrasts with traditional models, where model re-estimation requires constant updates and monitoring to validate predictive capability over extended periods and larger time ranges.
The simulation results for actuator models in a biological wastewater treatment process demonstrate that the Extended Kalman Filter method effectively estimates the states of a WWTP model, allowing for efficient fault detection [
26].
However, accurately predicting the evolution of solid concentration in different elements of WWTPs is a challenge. Therefore, constant monitoring and adjustments to the model are required based on the water flow rate and other factors that influence fluid dynamics and the dilution flow rate. This approach helps to detect failures and make the necessary adjustments to maintain the efficiency of the estimation model, which, in addition to determining the concentration, can be complemented with chemical analyses to detect the risks of soil and water contamination. Although models for estimating residual sludge have been improved using artificial intelligence (AI) systems such as machine learning (ML) and deep learning (DL) neural networks, given the large amount of data they handle [
27,
28,
29], models based on mathematical equations remain accurate.
5. Conclusions
The activated sludge concentration levels in the sewer system of the wastewater treatment plant remain within permissible limits when the dilution flow is adequate. This article summarized the EKF for a class of nonlinear systems in a special observable canonical form. Numerous nonlinear observers were developed that provide an estimate of a variable of interest based on the measurements of another process variable. These observers vary with respect to the measured and estimated variables, the parameters assumed to be known, and the type of convergence. This work developed and analyzed the EKF for state estimation (activated sludge height) based on biomass concentration measurements. The simulation results illustrate the preceding analysis and theoretical findings, demonstrating the EKF’s capabilities to offer reliable estimates.
A simplified Extended Kalman Filter is used for real-time identification. The reduced-order model presented in this document can serve as a tool for predicting the dynamic behavior of a wastewater treatment plant, as parameters under varying operating conditions can be recorded and adjusted in real time. The model parameters are effectively estimated even when measurements are affected by significant noise. This model is designed for operational and control purposes as an integral part of a WWTP control structure.
It should be noted that influent flow prediction and effluent characterization are the most studied applications, but the need for advances in anomaly detection and energy consumption optimization is highlighted. Despite progress in modeling, the lack of integration with data-driven models to achieve an optimal balance between prediction and computational requirements is noted. Future research should focus on implementing data-driven deep learning models to enhance the economic and operational efficiency of WWTPs, with the aim of increasing their environmental sustainability.