Convolutional Neural Network for Methane Prediction in Anaerobic Reactors of Domestic Sewage | Research Square window.SnipcartSettings = { analytics: { enabled: false } }; (function() { var accessVector = localStorage.getItem('access_vector') || ''; window.dataLayer = window.dataLayer || []; if (accessVector) { window.dataLayer.push({ user: { profile: { profileInfo: { snid: accessVector } } } }); } })(); (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-K279D39R'); Browse Preprints In Review Journals COVID-19 Preprints AJE Video Bytes Research Tools Research Promotion AJE Professional Editing AJE Rubriq About Preprint Platform In Review Editorial Policies Our Team Advisory Board Help Center Sign In Submit a Preprint Cite Share Download PDF Research Article Convolutional Neural Network for Methane Prediction in Anaerobic Reactors of Domestic Sewage Leandro Corrêa Pykosz, Alysson Nunes Diógenes, Maura Harumi Sugai-Guerios This is a preprint; it has not been peer reviewed by a journal. https://doi.org/ 10.21203/rs.3.rs-6960067/v1 This work is licensed under a CC BY 4.0 License Status: Under Review Version 1 posted 9 You are reading this latest preprint version Abstract Background Sustainable operation of wastewater treatment plants (WWTPs) increasingly depends on the ability to recover energy from byproducts such as biogas. Methane (CH₄) production in anaerobic reactors is highly sensitive to influent characteristics, yet real-time monitoring and control remain limited due to environmental and economic constraints. This study explores the use of Convolutional Neural Networks (CNNs) to predict methane flow in domestic wastewater treatment systems, aiming to support proactive process control, reduce greenhouse gas emissions, and enhance the energy efficiency of sanitation infrastructure. Results A CNN model was developed and trained using high-resolution operational data from a full-scale WWTP employing UASB reactors in Curitiba, Brazil. Input variables included sewage flow rate, chemical oxygen demand (COD), total suspended solids (TSS), and volatile suspended solids (VSS). The optimal architecture—comprising a single hidden layer with eight neurons and a sigmoid activation function—achieved a mean coefficient of determination (R²) of 0.93 and a low mean squared error across multiple training runs. The model effectively captured temporal dependencies in the data, supporting its suitability for time-series forecasting. A web-based interface was also implemented, enabling plant operators to input real-time data and receive immediate methane flow predictions, facilitating on-site decision-making and process optimization. Conclusions The proposed CNN-based approach offers a robust, low-cost solution for forecasting methane production in anaerobic wastewater treatment, with significant implications for energy recovery and environmental management. By enabling predictive and preemptive operational adjustments, the model contributes to improving biogas quality and minimizing CH₄ losses through flaring. The integration of artificial intelligence into WWTP operations represents a key advancement toward digital and sustainable sanitation, aligning with circular economy principles and global climate goals. Future work may explore model transferability across diverse climatic regions and the integration of hybrid AI architectures to further enhance predictive performance. Artificial intelligence Biogas Modeling Wastewater treatment plant UASB Methane Convolutional neural networks Figures Figure 1 Figure 2 Figure 3 Figure 4 Figure 5 Background The global drive for sustainability has heightened interest in energy recovery from waste treatment processes, particularly through the valorization of biogas generated in wastewater treatment plants (WWTPs). Among the most promising technologies are anaerobic reactors, which enable the degradation of organic matter and the consequent production of methane (CH₄), a high-calorific-value gas that can serve as a renewable energy source (Possetti et al. 2018; Wellinger, Murphy and Baxter 2013). However, despite their potential, many Brazilian WWTPs continue to flare biogas due to the lack of process control tools and real-time monitoring systems (Kaminski et al. 2021). Anaerobic systems such as the Upflow Anaerobic Sludge Blanket (UASB) reactor are widely employed in Latin America due to their low implementation and operational costs (Chernicharo et al. 2018). Yet, methane production efficiency is highly dependent on the control of influent physicochemical parameters, including flow rate, chemical oxygen demand (COD), total suspended solids (TSS), and volatile suspended solids (VSS) (Paula 2019). These parameters, which are summarized in Table 1, play a central role in predicting biogas yield. Table 1. Physicochemical variables used as model input features. Parameter Description Flow rate (L/s) Volume of influent entering the reactor per second COD (mg/L) Chemical Oxygen Demand, representing organic pollutant load TSS (mg/L) Total Suspended Solids, indicating total solids content in suspension VSS (mg/L) Volatile Suspended Solids, representing the biodegradable fraction of TSS Traditional monitoring relies on laboratory analyses with delayed feedback, which limits proactive management and can lead to suboptimal biogas quality and higher greenhouse gas emissions. Figure 1 illustrates the UASB reactor configuration used in this study, showing the path of influent, the development of the sludge blanket, and the collection of biogas and effluent. Artificial intelligence (AI), particularly artificial neural networks (ANNs), has been increasingly applied to model complex, nonlinear systems in wastewater treatment (Choi and Park 2001; Mjalli, Al-Asheh and Al-Fadala 2007; Nourani, Elkiran and Abba 2018). While many studies have successfully used multilayer perceptron (MLP) models, recent advances in deep learning and time-series modeling suggest that Convolutional Neural Networks (CNNs) may offer improved accuracy, particularly in capturing temporal patterns in influent parameters (Povey et al. 2018; LeCun et al. 1998). To date, few studies have investigated the use of CNNs in the context of real domestic wastewater datasets for methane prediction. Most existing research has relied on either synthetic datasets or focused on other water quality indicators such as COD or ammonia nitrogen. For example, Zhang et al. (2020) developed a CNN-LSTM hybrid model to predict biogas yield in anaerobic digestion, but the study was based on semi-controlled data. Yaseen and Afan (2021) examined deep learning models, including CNNs, for forecasting key parameters in wastewater, though not specifically methane. Similarly, Duan et al. (2021) applied CNN architectures to predict COD and NH₄⁺-N concentrations, without addressing biogas production. This gap is particularly relevant given the increasing complexity and scale of WWTPs under Brazil’s new sanitation legal framework (Brazil 2020), which encourages private investment and demands improved efficiency. This study addresses this gap by applying CNNs to predict methane flow in a UASB-based WWTP using real operational data. The aim is to develop a reliable, real-time decision-support tool capable of enhancing biogas production efficiency and supporting sustainability in wastewater management. A web-based interface was also created to facilitate model use by plant operators without requiring programming expertise. As shown in Equation 1, the CNN model integrates delayed time-series input data through a convolutional filter to forecast methane production, using a sigmoid activation function for nonlinear mapping. Equation 1. General structure of the convolutional neural network model for time-series input: Where: : predicted methane flow at time : input features delayed by time steps : learned weights in the convolutional filter : bias term : activation function (sigmoid in this study) : size of the convolutional window (temporal depth) This model was chosen considering the periodic behavior observed in the data. As can be seen in Figure 2(a), it was identified that the biogas flow has a behavior similar to the COD with an approximately 3-hour delay. This factor was also observed when comparing sewage flow to biogas flow, which exhibits a periodic behavior of 1 hour, as shown in Figure 2(b). This periodic behavior observed in these relationships motivated the study of convolutional neural networks. According to (HAYKIN, 1998), incorporating time into a neural network can be done through an implicit representation. For example, the input signal is expressed in the same way, and the sequence of weights for each neuron connected to the input layer is convoluted with a different input sequence, thereby incorporating the time series of the signal into the network structure. Another relevant point is the issue of seasonal phenomena, which occur regularly at certain times. In treatment plants, this phenomenon is closely related to population behavior, for example, bathing times, or in other words, the habits and times when people tend to release material into the sewage collection network and the time it takes for this material to reach the treatment plant, as well as the configuration and structure of the pipelines and networks (HEANNNDEZ, 2019). By integrating AI modeling with environmental engineering processes, this study contributes to bridging the gap between data availability and operational decision-making, aligning sanitation practices with circular economy principles and international climate targets. Methods This study aimed to develop and validate a predictive model for methane (CH₄) flow in anaerobic domestic sewage treatment using a Convolutional Neural Network (CNN). The model was based on operational data collected from a full-scale wastewater treatment plant (WWTP) located in Curitiba, Paraná, Brazil, which employs UASB reactors. The model’s goal was to support decision-making in real time by forecasting methane flow based on easily measurable influent characteristics. The study design was computational and retrospective, using secondary data from two previously published theses (Paula 2019 ; Hernandez 2019). The datasets included measurements from July to November 2018 and originated from a pilot project supported by Brazilian and German cooperation. The WWTP processes approximately 440 L/s of domestic sewage and serves a population of over 250,000 inhabitants. It includes six UASB reactors, a mechanical bar screen, grit chamber, and Parshall flume for flow measurement. The model's inputs were four physicochemical variables obtained hourly: flow rate (L/s), chemical oxygen demand (COD, mg/L), total suspended solids (TSS, mg/L), and volatile suspended solids (VSS, mg/L). Data were normalized to values between 0 and 1 to ensure numerical stability during training. Only data collected during periods without known sensor failures or biogas line leaks were used. Effluent data were excluded due to their lower sampling frequency and lack of statistical relevance (Paula 2019 ). The CNN model was implemented in Python using TensorFlow and Keras libraries (open-source). The architecture consisted of an input layer, one hidden convolutional layer (with varying neurons between 2 and 16), and one output layer. After testing multiple configurations, the best performance was achieved with 8 neurons and a sigmoid activation function. Model evaluation was based on three metrics: coefficient of determination (R²), Mean Squared Error (MSE), and a visual comparison of predicted versus actual values (Fig. 3 ). The models were trained and validated using 10-fold cross-validation. Power calculations were not applicable due to the deterministic nature of the modeling. The resulting tool was integrated into a web-based interface developed using FastAPI (Python) and hosted on a local server using Uvicorn. Users can input real-time values for influent variables and receive methane predictions without technical or programming knowledge. This ensures broad applicability in operational settings. Results The CNN model trained on real operational data from the WWTP showed strong predictive performance across multiple configurations. The best results were obtained using a model with one hidden layer and 8 neurons, yielding a mean coefficient of determination (R²) of 0.93 and a Mean Squared Error (MSE) of 2.08 × 10⁻⁴. These results were consistent across ten training iterations, demonstrating the model’s stability. Table 2 Performance metrics (average R² and MSE) for selected neural network configurations. Architecture MSE Average R² ANN C (2) 8.21E-04 0.77 ANN C (4) 1.54E-03 0.82 ANN C (8) 2.08E-04 0.93 ANN C (16) 8.06E-06 0.32 To confirm the optimal number of neurons, additional simulations with 7 and 9 neurons were conducted. The results confirmed that the 8-neuron model provided the best predictive accuracy, with lower MSE and higher R² than neighboring configurations. Figure 4 shows a scatter plot comparing predicted and actual methane flow values, demonstrating high alignment along the identity line. Figure 3 already presented the non-normalized comparison between predicted and real values, highlighting the model’s accuracy even in high-variance data segments. Figure 5 illustrates the training and validation loss over epochs, showing convergence and absence of overfitting. These results indicate that the proposed CNN architecture can reliably forecast methane production based on influent parameters, offering a practical tool for predictive process control in WWTPs. The model’s success supports its potential for broader adoption in sanitation infrastructure. Discussion The results of this study demonstrate that Convolutional Neural Networks (CNNs) can provide highly accurate predictions of methane flow in anaerobic domestic sewage treatment based on influent physicochemical parameters. The model's performance, particularly with an 8-neuron hidden layer architecture, surpassed the results reported in similar studies that employed multilayer perceptron (MLP) or hybrid ANN models. For example, Hamed, Khalafallah, and Hassanien ( 2003 ) achieved R² values ranging from 0.45 to 0.81 when using backpropagation-based ANN models to predict performance in WWTPs in Cairo. Canete et al. ( 2016 ), employing an MLP for effluent quality prediction, reported R² values between 0.88 and 0.92. In contrast, the CNN model presented in this study reached an average R² of 0.93 with a low mean squared error (MSE), indicating superior performance, particularly in capturing non-linearities and temporal dependencies inherent to wastewater treatment processes. CNNs, although originally developed for spatial data such as images (LeCun et al. 1998 ), have shown increasing effectiveness in time-series prediction tasks, particularly when the input data exhibit repetitive or periodic behavior. This was the case in the current study, where methane flow exhibited correlations with COD and influent flow with time lags of approximately three and one hour, respectively. Such temporal relationships are better captured by CNNs due to their inherent ability to recognize patterns across time windows (Povey et al. 2018 ). Compared to traditional offline monitoring methods—reliant on infrequent sampling and laboratory analysis—the use of AI-driven tools like the one proposed in this study enables real-time decision-making. This offers both economic and environmental benefits, allowing plant operators to optimize biogas recovery and reduce methane losses via flaring. This proactive management approach contributes directly to climate mitigation goals, given that methane has a global warming potential approximately 28 times greater than CO₂ over a 100-year horizon (IPCC, 2021 ). The web-based interface developed for this model also addresses a key operational barrier: usability. By providing an accessible interface that does not require programming skills, the tool encourages adoption by plant operators and supports broader digital transformation in sanitation infrastructure. This aligns with recommendations from the International Water Association (IWA), which advocates for the integration of smart tools in the water sector to enhance efficiency and resilience. Despite its promising results, the study has limitations. First, the model was trained and validated using data from a single WWTP located in Curitiba, Brazil. While representative of many medium-sized facilities using UASB reactors, the generalizability of the model to other regions or reactor configurations remains to be validated. Regional differences in influent characteristics, operational practices, and environmental conditions could influence prediction performance. Second, the dataset covered five months of monitoring, which may not capture seasonal variability or extreme operational events. Extending the monitoring period and incorporating long-term data would enhance the robustness and adaptability of the model, especially under conditions such as storm surges, temperature fluctuations, or hydraulic overloads. Another limitation is the exclusion of effluent data from model training. Although justified by their lower sampling frequency and weaker correlation with methane flow (Paula 2019 ), the inclusion of high-resolution effluent measurements in future studies may reveal additional predictors that improve model accuracy. Furthermore, while CNNs proved effective in this context, alternative architectures could also be explored. Recurrent Neural Networks (RNNs), Long Short-Term Memory (LSTM) networks, and Transformer models are specifically designed for sequential data and may offer advantages in capturing long-term dependencies or learning from irregularly spaced time series. Hybrid models combining CNN and LSTM layers have also shown promise in similar environmental applications (Nourani et al. 2018 ). In summary, this study provides evidence that CNN-based models represent a valuable advancement in AI applications for wastewater treatment. Their superior performance, combined with operational ease of use, makes them a viable tool for enhancing methane recovery, reducing greenhouse gas emissions, and supporting more sustainable and intelligent wastewater management systems. Continued research should focus on model transferability, data diversity, and the exploration of hybrid and adaptive learning systems to further consolidate AI's role in environmental engineering. Conclusions This study demonstrates the feasibility and effectiveness of using Convolutional Neural Networks (CNNs) to predict methane (CH₄) flow in anaerobic domestic sewage treatment based on real operational data from a Brazilian wastewater treatment plant. By modeling influent physicochemical variables—flow rate, chemical oxygen demand (COD), total suspended solids (TSS), and volatile suspended solids (VSS)—the developed CNN architecture achieved high predictive accuracy, with a coefficient of determination (R²) of 0.93. These results validate the suitability of deep learning, particularly CNNs, for capturing complex, time-dependent patterns in biogas generation processes. The study’s most impactful contribution is the development of a web-based decision-support tool that integrates seamlessly with existing WWTP workflows. This tool allows plant operators to make proactive adjustments in real time, enhancing operational efficiency and promoting the valorization of biogas as a renewable energy source. Such capability is especially relevant in the context of Brazil’s new legal framework for sanitation, which encourages technological innovation and private sector engagement in environmental infrastructure. The relevance of this research extends beyond the local case study. It contributes to the global discourse on sustainable wastewater treatment by offering a scalable, cost-effective method for improving resource recovery and reducing greenhouse gas emissions. The integration of artificial intelligence into sanitation systems aligns with broader environmental goals, such as those outlined in the Sustainable Development Goals (SDGs) and international climate commitments. In conclusion, CNN-based prediction models offer a promising pathway to modernize and optimize WWTP operations, providing technical, environmental, and economic benefits. Future research should focus on validating the model across multiple wastewater treatment plants with varying geographic, climatic, and operational conditions to improve generalizability. Incorporating additional variables such as temperature, pH, or real-time effluent parameters could enhance model accuracy and predictive range. Comparative studies with other deep learning architectures, including recurrent neural networks (RNNs), long short-term memory networks (LSTMs), or transformer-based models, are also recommended to evaluate performance trade-offs and potential for hybrid model integration. Moreover, long-term data collection encompassing seasonal and operational variability would strengthen model robustness and support the development of adaptive AI systems capable of continuous learning from incoming plant data. Expanding the decision-support tool to include optimization functionalities or scenario simulations could further assist plant operators in making strategic, data-driven decisions for energy recovery and environmental performance. Abbreviations AI: Artificial Intelligence ANN: Artificial Neural Network CNN: Convolutional Neural Network CH₄: Methane COD: Chemical Oxygen Demand TSS: Total Suspended Solids VSS: Volatile Suspended Solids WWTP: Wastewater Treatment Plant UASB: Upflow Anaerobic Sludge Blanket Declarations Ethics approval and consent to participate Not applicable. Consent for publication Not applicable Competing interests The authors declare that they have no competing interests. Funding The authors declare that they have received no funding. Author Contribution Leandro Corrêa Pykosz was responsible for configuring and training the convolutional neural network model, and contributed to the drafting and revision of the manuscriptAlysson Nunes Diógenes contributed to the writing of the manuscript and supervised the experimental procedures and overall research executionMaura Harumi Sugai-Guerios participated in the writing process and was responsible for providing and validating the experimental data used in the study. All authors read and approved the final version of the manuscript. Availability of data and materials The datasets used and/or analyzed during the current study are available from the corresponding author upon reasonable request. References Brazil. (2020). Law No. 14.026, of July 15, 2020. Official Gazette of the Union. Canete, J.F.D., Saz-Orozco, P., Rivas, M., & Martínez, F. (2016). Soft-sensing estimation of plant effluent concentrations in a biological wastewater treatment plant using an optimal neural network. Expert Systems with Applications, 43, 8–19. Chernicharo, C.A.L., Ribeiro, T.B., et al. (2018). Contributions for improving design, construction, and operation of UASB reactors treating domestic sewage – Part 1. DAE, 66(214), 5–16. Choi, D.J., & Park, H. (2001). A hybrid artificial neural network as a wastewater treatment process model. Water Research, 35(16), 3959–3967. Duan, N., Lv, Y., Wang, Y., & Ding, L. (2021). Prediction of water quality parameters using CNN-based deep learning model. Environmental Science and Pollution Research, 28, 39407–39418. https://doi.org/10.1007/s11356-021-13522-6 Hamed, M.M., Khalafallah, M.G., & Hassanien, E.A. (2003). Prediction of wastewater treatment plant performance using artificial neural networks. Environmental Modelling & Software, 18(10), 919–928. Heannndez, O.A.D. (2019). Avaliação de sistemas de medição para controle de processo em tempo real numa estação de tratamento de esgoto sanitário que utiliza reatores UASB (Master’s thesis). Federal University of Paraná (UFPR), Curitiba. Holubar, P., Zani, L., et al. (2002). Advanced controlling of anaerobic digestion by means of hierarchical neural networks. Water Research, 36(10), 2582–2588. IPCC. (2021). Climate Change 2021: The Physical Science Basis. Contribution of Working Group I to the Sixth Assessment Report of the Intergovernmental Panel on Climate Change. Cambridge University Press. International Water Association (IWA). (2019). Digital Water: Industry leaders chart the transformation journey. IWA Publishing. Kaminski, G., Possetti, G.R.C., et al. (2021). Combustão direta de biogás em queimadores. Cadernos Técnicos de Engenharia Sanitária e Ambiental, 1(1), 94. LeCun, Y., Bottou, L., Bengio, Y., & Haffner, P. (1998). Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11), 2278–2324. Mjalli, F.S., Al-Asheh, S., & Al-Fadala, H.E. (2007). Use of artificial neural network black-box modeling for the prediction of wastewater treatment plants performance. Journal of Environmental Management, 83(3), 329–338. Nourani, V., Elkiran, G., & Abba, S.I. (2018). Wastewater treatment plant performance analysis using artificial intelligence – an ensemble approach. Water Science & Technology, 77(10), 2451–2460. Paula, A.C.D. (2019). Avaliação integrada do desempenho de reatores anaeróbios do tipo UASB tratando esgoto doméstico em escala real (Master’s thesis). Federal University of Paraná (UFPR), Curitiba. Possetti, G.R.C., Rietow, S., & Chernicharo, C.A.L. (2019). Energy recovery from biogas in UASB reactors treating sewage. In C.A.L. Chernicharo & T. Bressani-Ribeiro (Eds.), Anaerobic Reactors for Sewage Treatment: Design, Construction and Operation (pp. 175–196). IWA Publishing. Povey, D., Cheng, G., et al. (2018). Semi-Orthogonal Low-Rank Matrix Factorization for Deep Neural Networks. Interspeech 2018, 3743–3747. Wellinger, A., Murphy, J., & Baxter, D. (2013). The Biogas Handbook: Science, Production and Applications. Elsevier. Yaseen, Z. M., & Afan, H. A. (2021). Deep learning in wastewater treatment: A review. Journal of Environmental Management, 286, 112220. https://doi.org/10.1016/j.jenvman.2021.112220 Zhang, Y., Zhang, S., & Liu, Y. (2020). A hybrid CNN-LSTM model for forecasting biogas production in anaerobic digesters. Renewable Energy, 162, 1309–1320. https://doi.org/10.1016/j.renene.2020.09.057 Additional Declarations No competing interests reported. Cite Share Download PDF Status: Under Review Version 1 posted Editorial decision: Revision requested 08 Apr, 2026 Reviews received at journal 22 Oct, 2025 Reviews received at journal 30 Sep, 2025 Reviewers agreed at journal 25 Sep, 2025 Reviewers agreed at journal 22 Sep, 2025 Reviewers invited by journal 13 Jul, 2025 Editor assigned by journal 05 Jul, 2025 Submission checks completed at journal 30 Jun, 2025 First submitted to journal 23 Jun, 2025 You are reading this latest preprint version Research Square lets you share your work early, gain feedback from the community, and start making changes to your manuscript prior to peer review in a journal. As a division of Research Square Company, we’re committed to making research communication faster, fairer, and more useful. We do this by developing innovative software and high quality services for the global research community. Our growing team is made up of researchers and industry professionals working together to solve the most critical problems facing scientific publishing. Also discoverable on Platform About Our Team In Review Editorial Policies Advisory Board Help Center Resources Author Services Accessibility API Access RSS feed Manage Cookie Preferences © Research Square 2026 | ISSN 2693-5015 (online) Privacy Policy Terms of Service Do Not Sell My Personal Information {"props":{"pageProps":{"initialData":{"identity":"rs-6960067","acceptedTermsAndConditions":true,"allowDirectSubmit":false,"archivedVersions":[],"articleType":"Research Article","associatedPublications":[],"authors":[{"id":484742135,"identity":"fe0b26c4-47ae-4972-94ed-2d2fbd720ad3","order_by":0,"name":"Leandro Corrêa Pykosz","email":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAAyAQMAAABI0h/eAAAABlBMVEX///8AAABVwtN+AAAACXBIWXMAAA7EAAAOxAGVKw4bAAABBElEQVRIiWNgGAWjYBACPhDBA+UwNgAJfgYGAxAnAZcWNgwtkg0kazE4QEgLe/OzB2/32OQZHOA9Jjmjos7e+Ebyxoc/ahjyzBtwaOE5Zm4451lascEBvjTJDWcOM5vdSCs25jnGUCxzAIcWiQQzaZ4DhxM3HOAxk3zYdoDN7EaOmTTQiYkzcDlM/vk3ZC11PMYzcsx//sSnRYIHyZaNbcwSBhI5Zgy8+LTw5JRJzjmQVix5mC/ZcsaZwwYSZ54VS/MckyiWwKGFn/34Nok3B2zy+I73HrzZAwwx/vbkjR9/1Njk4dICAwkKh3lYkBUR0gDUIt/Aw/yBoLJRMApGwSgYkQAAahtZHKZLgbMAAAAASUVORK5CYII=","orcid":"","institution":"Universidade do Estado de Santa Catarina","correspondingAuthor":true,"prefix":"","firstName":"Leandro","middleName":"Corrêa","lastName":"Pykosz","suffix":""},{"id":484742136,"identity":"31b25ff6-0b87-4c13-98c1-7759be4f55d7","order_by":1,"name":"Alysson Nunes Diógenes","email":"","orcid":"","institution":"University Positivo (UP)","correspondingAuthor":false,"prefix":"","firstName":"Alysson","middleName":"Nunes","lastName":"Diógenes","suffix":""},{"id":484742137,"identity":"41a0d2e6-e604-477f-8897-fd269c783afc","order_by":2,"name":"Maura Harumi Sugai-Guerios","email":"","orcid":"","institution":"University Positivo (UP)","correspondingAuthor":false,"prefix":"","firstName":"Maura","middleName":"Harumi","lastName":"Sugai-Guerios","suffix":""}],"badges":[],"createdAt":"2025-06-23 22:53:15","currentVersionCode":1,"declarations":"","doi":"10.21203/rs.3.rs-6960067/v1","doiUrl":"https://doi.org/10.21203/rs.3.rs-6960067/v1","draftVersion":[],"editorialEvents":[],"editorialNote":"","failedWorkflow":false,"files":[{"id":86800829,"identity":"79c98cbb-3fe0-4aae-b394-f295d1adb537","added_by":"auto","created_at":"2025-07-15 16:53:44","extension":"png","order_by":1,"title":"Figure 1","display":"","copyAsset":false,"role":"figure","size":155958,"visible":true,"origin":"","legend":"\u003cp\u003eSchematic diagram of the UASB reactor process used in the wastewater treatment plant.\u003c/p\u003e","description":"","filename":"1.png","url":"https://assets-eu.researchsquare.com/files/rs-6960067/v1/d8798bd591e86cff92c8ed0e.png"},{"id":86800820,"identity":"5e529aa2-c16c-47d9-b4a7-2ab7da9f6d6c","added_by":"auto","created_at":"2025-07-15 16:53:43","extension":"png","order_by":2,"title":"Figure 2","display":"","copyAsset":false,"role":"figure","size":93989,"visible":true,"origin":"","legend":"\u003cp\u003ePeriodic Behavior COD x Biogas (a) and Sewage x Biogas (b).\u003c/p\u003e","description":"","filename":"2.png","url":"https://assets-eu.researchsquare.com/files/rs-6960067/v1/58315117fcaa28b055bf6aa2.png"},{"id":86800887,"identity":"3d1548e8-26c3-45f6-a56f-377a8070f80b","added_by":"auto","created_at":"2025-07-15 16:53:45","extension":"png","order_by":3,"title":"Figure 3","display":"","copyAsset":false,"role":"figure","size":60406,"visible":true,"origin":"","legend":"\u003cp\u003eExample of predicted vs. actual methane flow values from CNN model.\u003c/p\u003e","description":"","filename":"3.png","url":"https://assets-eu.researchsquare.com/files/rs-6960067/v1/c54c66f5a1a64f0e8ba71860.png"},{"id":86800884,"identity":"d8c119ab-a011-403a-a1eb-f4695403f828","added_by":"auto","created_at":"2025-07-15 16:53:45","extension":"png","order_by":4,"title":"Figure 4","display":"","copyAsset":false,"role":"figure","size":33979,"visible":true,"origin":"","legend":"\u003cp\u003eScatter plot of actual vs. predicted methane flow values using the best CNN configuration.\u003c/p\u003e","description":"","filename":"4.png","url":"https://assets-eu.researchsquare.com/files/rs-6960067/v1/17e68777240a1a178ee0c1bd.png"},{"id":86800823,"identity":"2c36baeb-35a8-40d9-91cc-2e6809de287a","added_by":"auto","created_at":"2025-07-15 16:53:43","extension":"png","order_by":5,"title":"Figure 5","display":"","copyAsset":false,"role":"figure","size":58441,"visible":true,"origin":"","legend":"\u003cp\u003eTraining and validation loss curves during CNN model training.\u003c/p\u003e","description":"","filename":"5.png","url":"https://assets-eu.researchsquare.com/files/rs-6960067/v1/e5f8a6bc604904c0674da773.png"},{"id":86801102,"identity":"bf1804bd-a53a-4650-a512-570ad7ee7c10","added_by":"auto","created_at":"2025-07-15 17:01:50","extension":"pdf","order_by":0,"title":"","display":"","copyAsset":false,"role":"manuscript-pdf","size":829058,"visible":true,"origin":"","legend":"","description":"","filename":"manuscript.pdf","url":"https://assets-eu.researchsquare.com/files/rs-6960067/v1/1c67680b-69f5-4ffd-b68b-226fdcb221ae.pdf"}],"financialInterests":"No competing interests reported.","formattedTitle":"\u003cp\u003eConvolutional Neural Network for Methane Prediction in Anaerobic Reactors of Domestic Sewage\u003c/p\u003e","fulltext":[{"header":"Background","content":"\u003cp\u003eThe global drive for sustainability has heightened interest in energy recovery from waste treatment processes, particularly through the valorization of biogas generated in wastewater treatment plants (WWTPs). Among the most promising technologies are anaerobic reactors, which enable the degradation of organic matter and the consequent production of methane (CH₄), a high-calorific-value gas that can serve as a renewable energy source (Possetti et al. 2018; Wellinger, Murphy and Baxter 2013). However, despite their potential, many Brazilian WWTPs continue to flare biogas due to the lack of process control tools and real-time monitoring systems (Kaminski et al. 2021).\u003c/p\u003e\n\u003cp\u003eAnaerobic systems such as the Upflow Anaerobic Sludge Blanket (UASB) reactor are widely employed in Latin America due to their low implementation and operational costs (Chernicharo et al. 2018). Yet, methane production efficiency is highly dependent on the control of influent physicochemical parameters, including flow rate, chemical oxygen demand (COD), total suspended solids (TSS), and volatile suspended solids (VSS) (Paula 2019). These parameters, which are summarized in Table 1, play a central role in predicting biogas yield.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eTable 1.\u003c/strong\u003e Physicochemical variables used as model input features.\u003c/p\u003e\n\u003ctable border=\"0\" cellspacing=\"3\" cellpadding=\"0\"\u003e\n \u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\n \u003cp\u003e\u003cstrong\u003eParameter\u003c/strong\u003e\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd\u003e\n \u003cp\u003e\u003cstrong\u003eDescription\u003c/strong\u003e\u003c/p\u003e\n \u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003e\n \u003cp\u003eFlow rate (L/s)\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd\u003e\n \u003cp\u003eVolume of influent entering the reactor per second\u003c/p\u003e\n \u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003e\n \u003cp\u003eCOD (mg/L)\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd\u003e\n \u003cp\u003eChemical Oxygen Demand, representing organic pollutant load\u003c/p\u003e\n \u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003e\n \u003cp\u003eTSS (mg/L)\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd\u003e\n \u003cp\u003eTotal Suspended Solids, indicating total solids content in suspension\u003c/p\u003e\n \u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003e\n \u003cp\u003eVSS (mg/L)\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd\u003e\n \u003cp\u003eVolatile Suspended Solids, representing the biodegradable fraction of TSS\u003c/p\u003e\n \u003c/td\u003e\n \u003c/tr\u003e\n \u003c/tbody\u003e\n\u003c/table\u003e\n\u003cp\u003eTraditional monitoring relies on laboratory analyses with delayed feedback, which limits proactive management and can lead to suboptimal biogas quality and higher greenhouse gas emissions. Figure 1 illustrates the UASB reactor configuration used in this study, showing the path of influent, the development of the sludge blanket, and the collection of biogas and effluent.\u003c/p\u003e\n\u003cp\u003eArtificial intelligence (AI), particularly artificial neural networks (ANNs), has been increasingly applied to model complex, nonlinear systems in wastewater treatment (Choi and Park 2001; Mjalli, Al-Asheh and Al-Fadala 2007; Nourani, Elkiran and Abba 2018). While many studies have successfully used multilayer perceptron (MLP) models, recent advances in deep learning and time-series modeling suggest that Convolutional Neural Networks (CNNs) may offer improved accuracy, particularly in capturing temporal patterns in influent parameters (Povey et al. 2018; LeCun et al. 1998).\u003c/p\u003e\n\u003cp\u003eTo date, few studies have investigated the use of CNNs in the context of real domestic wastewater datasets for methane prediction. Most existing research has relied on either synthetic datasets or focused on other water quality indicators such as COD or ammonia nitrogen. For example, Zhang et al. (2020) developed a CNN-LSTM hybrid model to predict biogas yield in anaerobic digestion, but the study was based on semi-controlled data. Yaseen and Afan (2021) examined deep learning models, including CNNs, for forecasting key parameters in wastewater, though not specifically methane. Similarly, Duan et al. (2021) applied CNN architectures to predict COD and NH₄⁺-N concentrations, without addressing biogas production. This gap is particularly relevant given the increasing complexity and scale of WWTPs under Brazil\u0026rsquo;s new sanitation legal framework (Brazil 2020), which encourages private investment and demands improved efficiency.\u003c/p\u003e\n\u003cp\u003eThis study addresses this gap by applying CNNs to predict methane flow in a UASB-based WWTP using real operational data. The aim is to develop a reliable, real-time decision-support tool capable of enhancing biogas production efficiency and supporting sustainability in wastewater management. A web-based interface was also created to facilitate model use by plant operators without requiring programming expertise.\u003c/p\u003e\n\u003cp\u003eAs shown in Equation 1, the CNN model integrates delayed time-series input data through a convolutional filter to forecast methane production, using a sigmoid activation function for nonlinear mapping.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eEquation 1.\u003c/strong\u003e General structure of the convolutional neural network model for time-series input:\u003c/p\u003e\n\u003cp\u003e\u003cimg width=\"215\" height=\"57\" src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUIAAABWCAYAAAC6nZ+lAAAAAXNSR0IArs4c6QAAAAlwSFlzAAAWJQAAFiUBSVIk8AAAABl0RVh0U29mdHdhcmUATWljcm9zb2Z0IE9mZmljZX/tNXEAABjySURBVHhe7V29c+NGln9gTW7Hq5TUlcdK5SpBE6+W5FVZyajqlGiSoRxZYNUoGi1nxJEjbVmkkzUxwY0Suk4TnFy1Inc23SFdZW4oy2WRqS5e+Q8A7nWDDYAkKHw1SFB6SOwRge7Xv3546Pf96PDwEOgiBAgBQuAhI/DoIS+e1k4IEAKEAEOABCHxASFACDx4BEgQPngWIAAIAUKABOE95oFKZdusr+dA67JFlqBlNqBXrSr3eMm0NEIgEgIkCCPBthgPVatNpdLpm8CE4comCcHF2Daicg4IkCCcA+iznbIPV3giVLdyALe92U5NsxECC4IACcIF2ajIZA6u4RJU2Cpm4bYJsP3JBzNn6cqoLbfgcKlHqnJkcOnB+4IACcL7spNT1jG4OIMurMBBFoCdB7N7B1DSCqCraDPcz0OvSafEe84CtLwACJAgDADSvG/ZXr0xj6/3Yem2Gfr01md6cekA8jCAHI6zrnyAlVYfDntNpdeszntpND8hIBWBSmXV+OrJufLlP7+HvKJkqtWqGWQCEoRBUJrjPRUUXkpBRy22YR3pQlzIFOYuF50FUHT2XxVq/Q6qyOQ5DgEj3bpACFSrvcyXn+tG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LFajSvw3m74XiIeZl+9CQXs7K6ly4I4kTmIiPAT4Nf/Z9yYfwV8hgzWPVRiUkQLtBuN1EYLsFoL2VuH+SeXhSQNx/M882O7TkOoxozGLJ7B1DSCqAfWfZIFkdY38GueNi0yctRs0DQEakPDAHUcDLwhz9A780bOwIiCASkGgdBKYX35DdLoOo6FJRLlFenscJnWPP6Rh9jcHYwiFrR+GpVFIL9Rh7tjxHd0SnEjEgiBKYhQIJwQXmDqcwbh4eWE6U3elqMsqRqs6csbRzCIR+QD0pCMAqQ9MxCIkCCcCG3jYgmBAgBmQiQIJSJJo1FCBACC4kACcKF3DYimhAgBGQi8P9YrUgTAzevFgAAAABJRU5ErkJggg==\" alt=\"image\"\u003e\u003c/p\u003e\n\u003cp\u003eWhere:\u003c/p\u003e\n\u003cul type=\"disc\"\u003e\n \u003cli\u003e\u003cimg width=\"29\" height=\"21\" src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAgCAMAAABemGpIAAAAAXNSR0IArs4c6QAAAGNQTFRFAAAAAAAAAAA6AABmADpmADqQAGa2OgAAOgA6OpDbZgAAZjoAZjpmZmY6Zrb/kDoAkDo6kGaQkLbbkNv/tmYAtmY6ttv/tv//25A625Bm27aQ2////7Zm/9uQ/9u2//+2///bJdp7UgAAAAF0Uk5TAEDm2GYAAAAJcEhZcwAAFiUAABYlAUlSJPAAAAAZdEVYdFNvZnR3YXJlAE1pY3Jvc29mdCBPZmZpY2V/7TVxAAABGklEQVQ4T+2T0WLCIAxFm7bKtG7VjVWsYPn/r7QEEoKt7nUP8gg3yUlyqar3+WsCY7fLEtN+v9D7vi6ex25zfSaf9o9vvm/O62rxouufqFnGp1gLxCskBr7WUufE/he2pKC4WwdYzQIEMqeSwgCeRBuJpsNgATsymMgwxTyUhCyvpz2GRy7NdOk6klhGigId8ot0DBTETtE8sbRTIUKIM1AhxhoGQ4U4AxXiUMN9YDdZXCALjDBbnSbG+TJl2WCl60/aPpOi2J+SKUQD8wJonTwDp5rhdqTVs03kFGdoqnFR0NJWhE18L0yZjSSsI4wkaoR5LM1Lic2u8MCqeTleA9QPXl18K9WmmfTQDgtfj52Ity8/7Pp3+z+3dyx4Elw1c4YKAAAAAElFTkSuQmCC\" alt=\"image\"\u003e\u0026nbsp;: predicted methane flow at time\u0026nbsp;\u003c/li\u003e\n \u003cli\u003e\u003cimg width=\"53\" height=\"21\" src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAAAgCAMAAACy7Q9eAAAAAXNSR0IArs4c6QAAAGxQTFRFAAAAAAAAAAA6AABmADpmADqQAGa2OgAAOjqQOmaQOpDbZgAAZjoAZra2ZrbbZrb/kDoAkDo6kGaQkJA6kLbbkNv/tmYAtmY6tpA6ttv/tv//25A625Bm27aQ2////7Zm/9uQ/9u2//+2///bgL9CiQAAAAF0Uk5TAEDm2GYAAAAJcEhZcwAAFiUAABYlAUlSJPAAAAAZdEVYdFNvZnR3YXJlAE1pY3Jvc29mdCBPZmZpY2V/7TVxAAABZklEQVRIS+1VW3uDIAwVa6UbbrXr5i7OgvL//+MilyQPgHOvK09+kpzknFyoqvv5rwpM3eM+6mPzWnCwfV26TnpO3fGWg1xU/i7lM4iVju0PX2lEdjPUb9vMgY+zyuahXcCiSTrKKM6pC0rQvot2O0GywBRNJ45Af+5cBCMDyijcySmDLAQyCgqZ022Ef4vyvuu3P1GccpaLQqHJFbKyfSjtgEosaiO7IDRaaZQI0K4Bj6WF5IspGolNxj4H0YQmYoDEYEXUXtJwqJ+oKUB+xKaKM0AiX0qRWRGgkYx9DP47CfmAIOCsnmjaMCIjUMiQW/mi6HZWbUVDhso5U/uSGdAYgyobOw76FxwBxl7cSGJtjTx8zpetNQaA9iMY+awG8QB7Z+lF4xcBifIt478CZduL+tkvrtx2YH2wZ5JXxsnlUFhsWzOYW6N7F2yc/Pyg/ukJkHHWkjymLi1HlrQuPlL7anG3/gFfYRcFoyh51QAAAABJRU5ErkJggg==\" alt=\"image\"\u003e: input features delayed by time steps\u003c/li\u003e\n \u003cli\u003e\u003cimg width=\"16\" height=\"21\" src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAgCAMAAAA/gEgKAAAAAXNSR0IArs4c6QAAAFRQTFRFAAAAAAAAAAA6AABmADqQAGa2OgAAOgA6OmZmOpCQOpDbZgAAZmY6ZrbbZrb/kDoAkNv/tmYAtmY6tv/btv//25A627Zm2////7Zm/9uQ//+2///bPQWwHQAAAAF0Uk5TAEDm2GYAAAAJcEhZcwAAFiUAABYlAUlSJPAAAAAZdEVYdFNvZnR3YXJlAE1pY3Jvc29mdCBPZmZpY2V/7TVxAAAAsklEQVQ4T+2QyxbCIAxEE1B8oFJs0RT+/z9NghysduHCpdk07c1kJgX419d/gBA3d55OeATIHvHSpDe0E/dRAMxeX7Sy9jy7FeAEN2AGAN4ogLoASmBQwsGzVQkqiBVH9iM7BgakOYq0FWR/KcFO/Hi9hoNGHolmiGLTi3C/Y/tkTnVDardwILFMKOmUPKPNTidJsZpW5Udl349cwNktsnWWmtf7rmjH66qGnDmvmv/84wN5cgflj5YymwAAAABJRU5ErkJggg==\" alt=\"image\"\u003e: learned weights in the convolutional filter\u003c/li\u003e\n \u003cli\u003e\u003cimg width=\"9\" height=\"21\" src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAgCAMAAAD+BwKmAAAAAXNSR0IArs4c6QAAAF1QTFRFAAAAAAAAAAA6AABmADqQAGa2OgAAOjqQOmaQOma2OpC2OpDbZgAAZrb/kDoAkDo6kGYAkGY6kNv/tmYAtpBmttuQttv/tv//25A62////7Zm/9uQ/9u2//+2///b3cEKEgAAAAF0Uk5TAEDm2GYAAAAJcEhZcwAAFiUAABYlAUlSJPAAAAAZdEVYdFNvZnR3YXJlAE1pY3Jvc29mdCBPZmZpY2V/7TVxAAAAf0lEQVQoU7WQzQ6DMAyD4zIKbJANyt8o5P0fc12oRDlyoJfIie1PKtEtTxjIj2b54JVwnOmSG2fTobxNYrScYrPp1hao1C2cDcUYOM1fbTWKL9G8Q71VwLKruIwjsp02b7WyhdXv7SN0hFgy4okcgmVlozR5P3sLlOMtf3ep9AcM2gWoInqRhQAAAABJRU5ErkJggg==\" alt=\"image\"\u003e: bias term\u003c/li\u003e\n \u003cli\u003e\u003cimg width=\"9\" height=\"21\" src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAgCAMAAAAVMLmlAAAAAXNSR0IArs4c6QAAAEhQTFRFAAAAAAAAAAA6AABmADqQAGa2OgAAOjoAOpDbZgAAZpDbZrb/kDoAkGYAkNv/tmYAtv//25A627Zm2////7Zm/9uQ//+2///b5ooHRQAAAAF0Uk5TAEDm2GYAAAAJcEhZcwAAFiUAABYlAUlSJPAAAAAZdEVYdFNvZnR3YXJlAE1pY3Jvc29mdCBPZmZpY2V/7TVxAAAAbklEQVQoU7WR2xKAIAhEQcuyi6Zp/v+fxjSjgc/FGwx7dhkAfq84IQ5ntfHaFT/WLuDM/C+rD9YmJgMoOzYZgMen1rpeNuUE6XWkceJSAOlKrIah3S5ENoIUJElKuxDZdOew/HSBCBwF16rlo7fcKzsDVYJAslsAAAAASUVORK5CYII=\" alt=\"image\"\u003e: activation function (sigmoid in this study)\u003c/li\u003e\n \u003cli\u003e\u003cimg width=\"9\" height=\"21\" src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAgCAMAAAAVMLmlAAAAAXNSR0IArs4c6QAAAFdQTFRFAAAAAAAAAAA6AABmADqQAGa2OgAAOgA6OmaQOma2OpDbZgAAZrb/kDoAkGYAkNv/tmYAtmY6ttv/tv//25A625Bm27Zm27aQ2////7Zm/9uQ//+2///bE6qF1wAAAAF0Uk5TAEDm2GYAAAAJcEhZcwAAFiUAABYlAUlSJPAAAAAZdEVYdFNvZnR3YXJlAE1pY3Jvc29mdCBPZmZpY2V/7TVxAAAAfElEQVQoU7WQyQ6AIAxEGRdccN8V/v87pTVovXlxDk0awpuXKvVjrAFSwXcNSlnXoZKvdTyK9dDJJtb9RVITkRaNC+jqqKWJgn9YQ6Q9lDFpyULXhNT18RDYHXzuKiJZQzTOoT3p0WSJx4QlqGzNveoloWaNQor/eN8P6BPoRAUqLUB5UAAAAABJRU5ErkJggg==\" alt=\"image\"\u003e: size of the convolutional window (temporal depth)\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eThis model was chosen considering the periodic behavior observed in the data. As can be seen in Figure 2(a), it was identified that the biogas flow has a behavior similar to the COD with an approximately 3-hour delay. This factor was also observed when comparing sewage flow to biogas flow, which exhibits a periodic behavior of 1 hour, as shown in Figure 2(b). This periodic behavior observed in these relationships motivated the study of convolutional neural networks.\u003c/p\u003e\n\u003cp\u003eAccording to (HAYKIN, 1998), incorporating time into a neural network can be done through an implicit representation. For example, the input signal is expressed in the same way, and the sequence of weights for each neuron connected to the input layer is convoluted with a different input sequence, thereby incorporating the time series of the signal into the network structure.\u003c/p\u003e\n\u003cp\u003eAnother relevant point is the issue of seasonal phenomena, which occur regularly at certain times. In treatment plants, this phenomenon is closely related to population behavior, for example, bathing times, or in other words, the habits and times when people tend to release material into the sewage collection network and the time it takes for this material to reach the treatment plant, as well as the configuration and structure of the pipelines and networks (HEANNNDEZ, 2019).\u003c/p\u003e\n\u003cp\u003eBy integrating AI modeling with environmental engineering processes, this study contributes to bridging the gap between data availability and operational decision-making, aligning sanitation practices with circular economy principles and international climate targets.\u003c/p\u003e"},{"header":"Methods","content":"\u003cp\u003eThis study aimed to develop and validate a predictive model for methane (CH₄) flow in anaerobic domestic sewage treatment using a Convolutional Neural Network (CNN). The model was based on operational data collected from a full-scale wastewater treatment plant (WWTP) located in Curitiba, Paran\u0026aacute;, Brazil, which employs UASB reactors. The model\u0026rsquo;s goal was to support decision-making in real time by forecasting methane flow based on easily measurable influent characteristics.\u003c/p\u003e\u003cp\u003eThe study design was computational and retrospective, using secondary data from two previously published theses (Paula \u003cspan citationid=\"CR15\" class=\"CitationRef\"\u003e2019\u003c/span\u003e; Hernandez 2019). The datasets included measurements from July to November 2018 and originated from a pilot project supported by Brazilian and German cooperation. The WWTP processes approximately 440 L/s of domestic sewage and serves a population of over 250,000 inhabitants. It includes six UASB reactors, a mechanical bar screen, grit chamber, and Parshall flume for flow measurement.\u003c/p\u003e\u003cp\u003eThe model's inputs were four physicochemical variables obtained hourly: flow rate (L/s), chemical oxygen demand (COD, mg/L), total suspended solids (TSS, mg/L), and volatile suspended solids (VSS, mg/L). Data were normalized to values between 0 and 1 to ensure numerical stability during training. Only data collected during periods without known sensor failures or biogas line leaks were used. Effluent data were excluded due to their lower sampling frequency and lack of statistical relevance (Paula \u003cspan citationid=\"CR15\" class=\"CitationRef\"\u003e2019\u003c/span\u003e).\u003c/p\u003e\u003cp\u003eThe CNN model was implemented in Python using TensorFlow and Keras libraries (open-source). The architecture consisted of an input layer, one hidden convolutional layer (with varying neurons between 2 and 16), and one output layer. After testing multiple configurations, the best performance was achieved with 8 neurons and a sigmoid activation function.\u003c/p\u003e\u003cp\u003eModel evaluation was based on three metrics: coefficient of determination (R\u0026sup2;), Mean Squared Error (MSE), and a visual comparison of predicted versus actual values (Fig.\u0026nbsp;\u003cspan refid=\"Fig3\" class=\"InternalRef\"\u003e3\u003c/span\u003e). The models were trained and validated using 10-fold cross-validation. Power calculations were not applicable due to the deterministic nature of the modeling.\u003c/p\u003e\u003cp\u003e\u003c/p\u003e\u003cp\u003eThe resulting tool was integrated into a web-based interface developed using FastAPI (Python) and hosted on a local server using Uvicorn. Users can input real-time values for influent variables and receive methane predictions without technical or programming knowledge. This ensures broad applicability in operational settings.\u003c/p\u003e"},{"header":"Results","content":"\u003cp\u003eThe CNN model trained on real operational data from the WWTP showed strong predictive performance across multiple configurations. The best results were obtained using a model with one hidden layer and 8 neurons, yielding a mean coefficient of determination (R\u0026sup2;) of 0.93 and a Mean Squared Error (MSE) of 2.08 \u0026times; 10⁻⁴. These results were consistent across ten training iterations, demonstrating the model\u0026rsquo;s stability.\u003c/p\u003e\u003cp\u003e\u003cdiv class=\"gridtable\"\u003e\u003ctable float=\"Yes\" id=\"Tab2\" border=\"1\"\u003e\u003ccaption language=\"En\"\u003e\u003cdiv class=\"CaptionNumber\"\u003eTable 2\u003c/div\u003e\u003cdiv class=\"CaptionContent\"\u003e\u003cp\u003ePerformance metrics (average R\u0026sup2; and MSE) for selected neural network configurations.\u003c/p\u003e\u003c/div\u003e\u003c/caption\u003e\u003ccolgroup cols=\"3\"\u003e\u003cdiv align=\"left\" class=\"colspec\" colname=\"c1\" colnum=\"1\"\u003e\u003c/div\u003e\u003cdiv align=\"left\" class=\"colspec\" colname=\"c2\" colnum=\"2\"\u003e\u003c/div\u003e\u003cdiv align=\"char\" char=\".\" class=\"colspec\" colname=\"c3\" colnum=\"3\"\u003e\u003c/div\u003e\u003cthead\u003e\u003ctr\u003e\u003cth align=\"left\" colname=\"c1\"\u003e\u003cp\u003eArchitecture\u003c/p\u003e\u003c/th\u003e\u003cth align=\"left\" colname=\"c2\"\u003e\u003cp\u003eMSE\u003c/p\u003e\u003c/th\u003e\u003cth align=\"left\" colname=\"c3\"\u003e\u003cp\u003eAverage R\u0026sup2;\u003c/p\u003e\u003c/th\u003e\u003c/tr\u003e\u003c/thead\u003e\u003ctbody\u003e\u003ctr\u003e\u003ctd align=\"left\" colname=\"c1\"\u003e\u003cp\u003eANN C (2)\u003c/p\u003e\u003c/td\u003e\u003ctd align=\"left\" colname=\"c2\"\u003e\u003cp\u003e8.21E-04\u003c/p\u003e\u003c/td\u003e\u003ctd align=\"char\" char=\".\" colname=\"c3\"\u003e\u003cp\u003e0.77\u003c/p\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd align=\"left\" colname=\"c1\"\u003e\u003cp\u003eANN C (4)\u003c/p\u003e\u003c/td\u003e\u003ctd align=\"left\" colname=\"c2\"\u003e\u003cp\u003e1.54E-03\u003c/p\u003e\u003c/td\u003e\u003ctd align=\"char\" char=\".\" colname=\"c3\"\u003e\u003cp\u003e0.82\u003c/p\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd align=\"left\" colname=\"c1\"\u003e\u003cp\u003eANN C (8)\u003c/p\u003e\u003c/td\u003e\u003ctd align=\"left\" colname=\"c2\"\u003e\u003cp\u003e2.08E-04\u003c/p\u003e\u003c/td\u003e\u003ctd align=\"char\" char=\".\" colname=\"c3\"\u003e\u003cp\u003e0.93\u003c/p\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd align=\"left\" colname=\"c1\"\u003e\u003cp\u003eANN C (16)\u003c/p\u003e\u003c/td\u003e\u003ctd align=\"left\" colname=\"c2\"\u003e\u003cp\u003e8.06E-06\u003c/p\u003e\u003c/td\u003e\u003ctd align=\"char\" char=\".\" colname=\"c3\"\u003e\u003cp\u003e0.32\u003c/p\u003e\u003c/td\u003e\u003c/tr\u003e\u003c/tbody\u003e\u003c/colgroup\u003e\u003c/table\u003e\u003c/div\u003e\u003c/p\u003e\u003cp\u003eTo confirm the optimal number of neurons, additional simulations with 7 and 9 neurons were conducted. The results confirmed that the 8-neuron model provided the best predictive accuracy, with lower MSE and higher R\u0026sup2; than neighboring configurations.\u003c/p\u003e\u003cp\u003eFigure \u003cspan refid=\"Fig4\" class=\"InternalRef\"\u003e4\u003c/span\u003e shows a scatter plot comparing predicted and actual methane flow values, demonstrating high alignment along the identity line. Figure\u0026nbsp;\u003cspan refid=\"Fig3\" class=\"InternalRef\"\u003e3\u003c/span\u003e already presented the non-normalized comparison between predicted and real values, highlighting the model\u0026rsquo;s accuracy even in high-variance data segments. Figure\u0026nbsp;\u003cspan refid=\"Fig5\" class=\"InternalRef\"\u003e5\u003c/span\u003e illustrates the training and validation loss over epochs, showing convergence and absence of overfitting.\u003c/p\u003e\u003cp\u003e\u003c/p\u003e\u003cp\u003e\u003c/p\u003e\u003cp\u003eThese results indicate that the proposed CNN architecture can reliably forecast methane production based on influent parameters, offering a practical tool for predictive process control in WWTPs. The model\u0026rsquo;s success supports its potential for broader adoption in sanitation infrastructure.\u003c/p\u003e"},{"header":"Discussion","content":"\u003cp\u003eThe results of this study demonstrate that Convolutional Neural Networks (CNNs) can provide highly accurate predictions of methane flow in anaerobic domestic sewage treatment based on influent physicochemical parameters. The model's performance, particularly with an 8-neuron hidden layer architecture, surpassed the results reported in similar studies that employed multilayer perceptron (MLP) or hybrid ANN models. For example, Hamed, Khalafallah, and Hassanien (\u003cspan citationid=\"CR6\" class=\"CitationRef\"\u003e2003\u003c/span\u003e) achieved R\u0026sup2; values ranging from 0.45 to 0.81 when using backpropagation-based ANN models to predict performance in WWTPs in Cairo. Canete et al. (\u003cspan citationid=\"CR2\" class=\"CitationRef\"\u003e2016\u003c/span\u003e), employing an MLP for effluent quality prediction, reported R\u0026sup2; values between 0.88 and 0.92. In contrast, the CNN model presented in this study reached an average R\u0026sup2; of 0.93 with a low mean squared error (MSE), indicating superior performance, particularly in capturing non-linearities and temporal dependencies inherent to wastewater treatment processes.\u003c/p\u003e\u003cp\u003eCNNs, although originally developed for spatial data such as images (LeCun et al. \u003cspan citationid=\"CR12\" class=\"CitationRef\"\u003e1998\u003c/span\u003e), have shown increasing effectiveness in time-series prediction tasks, particularly when the input data exhibit repetitive or periodic behavior. This was the case in the current study, where methane flow exhibited correlations with COD and influent flow with time lags of approximately three and one hour, respectively. Such temporal relationships are better captured by CNNs due to their inherent ability to recognize patterns across time windows (Povey et al. \u003cspan citationid=\"CR17\" class=\"CitationRef\"\u003e2018\u003c/span\u003e).\u003c/p\u003e\u003cp\u003eCompared to traditional offline monitoring methods\u0026mdash;reliant on infrequent sampling and laboratory analysis\u0026mdash;the use of AI-driven tools like the one proposed in this study enables real-time decision-making. This offers both economic and environmental benefits, allowing plant operators to optimize biogas recovery and reduce methane losses via flaring. This proactive management approach contributes directly to climate mitigation goals, given that methane has a global warming potential approximately 28 times greater than CO₂ over a 100-year horizon (IPCC, \u003cspan citationid=\"CR9\" class=\"CitationRef\"\u003e2021\u003c/span\u003e).\u003c/p\u003e\u003cp\u003eThe web-based interface developed for this model also addresses a key operational barrier: usability. By providing an accessible interface that does not require programming skills, the tool encourages adoption by plant operators and supports broader digital transformation in sanitation infrastructure. This aligns with recommendations from the International Water Association (IWA), which advocates for the integration of smart tools in the water sector to enhance efficiency and resilience.\u003c/p\u003e\u003cp\u003eDespite its promising results, the study has limitations. First, the model was trained and validated using data from a single WWTP located in Curitiba, Brazil. While representative of many medium-sized facilities using UASB reactors, the generalizability of the model to other regions or reactor configurations remains to be validated. Regional differences in influent characteristics, operational practices, and environmental conditions could influence prediction performance.\u003c/p\u003e\u003cp\u003eSecond, the dataset covered five months of monitoring, which may not capture seasonal variability or extreme operational events. Extending the monitoring period and incorporating long-term data would enhance the robustness and adaptability of the model, especially under conditions such as storm surges, temperature fluctuations, or hydraulic overloads.\u003c/p\u003e\u003cp\u003eAnother limitation is the exclusion of effluent data from model training. Although justified by their lower sampling frequency and weaker correlation with methane flow (Paula \u003cspan citationid=\"CR15\" class=\"CitationRef\"\u003e2019\u003c/span\u003e), the inclusion of high-resolution effluent measurements in future studies may reveal additional predictors that improve model accuracy.\u003c/p\u003e\u003cp\u003eFurthermore, while CNNs proved effective in this context, alternative architectures could also be explored. Recurrent Neural Networks (RNNs), Long Short-Term Memory (LSTM) networks, and Transformer models are specifically designed for sequential data and may offer advantages in capturing long-term dependencies or learning from irregularly spaced time series. Hybrid models combining CNN and LSTM layers have also shown promise in similar environmental applications (Nourani et al. \u003cspan citationid=\"CR14\" class=\"CitationRef\"\u003e2018\u003c/span\u003e).\u003c/p\u003e\u003cp\u003eIn summary, this study provides evidence that CNN-based models represent a valuable advancement in AI applications for wastewater treatment. Their superior performance, combined with operational ease of use, makes them a viable tool for enhancing methane recovery, reducing greenhouse gas emissions, and supporting more sustainable and intelligent wastewater management systems. Continued research should focus on model transferability, data diversity, and the exploration of hybrid and adaptive learning systems to further consolidate AI's role in environmental engineering.\u003c/p\u003e"},{"header":"Conclusions","content":"\u003cp\u003eThis study demonstrates the feasibility and effectiveness of using Convolutional Neural Networks (CNNs) to predict methane (CH₄) flow in anaerobic domestic sewage treatment based on real operational data from a Brazilian wastewater treatment plant. By modeling influent physicochemical variables\u0026mdash;flow rate, chemical oxygen demand (COD), total suspended solids (TSS), and volatile suspended solids (VSS)\u0026mdash;the developed CNN architecture achieved high predictive accuracy, with a coefficient of determination (R\u0026sup2;) of 0.93. These results validate the suitability of deep learning, particularly CNNs, for capturing complex, time-dependent patterns in biogas generation processes.\u003c/p\u003e\u003cp\u003eThe study\u0026rsquo;s most impactful contribution is the development of a web-based decision-support tool that integrates seamlessly with existing WWTP workflows. This tool allows plant operators to make proactive adjustments in real time, enhancing operational efficiency and promoting the valorization of biogas as a renewable energy source. Such capability is especially relevant in the context of Brazil\u0026rsquo;s new legal framework for sanitation, which encourages technological innovation and private sector engagement in environmental infrastructure.\u003c/p\u003e\u003cp\u003eThe relevance of this research extends beyond the local case study. It contributes to the global discourse on sustainable wastewater treatment by offering a scalable, cost-effective method for improving resource recovery and reducing greenhouse gas emissions. The integration of artificial intelligence into sanitation systems aligns with broader environmental goals, such as those outlined in the Sustainable Development Goals (SDGs) and international climate commitments.\u003c/p\u003e\u003cp\u003eIn conclusion, CNN-based prediction models offer a promising pathway to modernize and optimize WWTP operations, providing technical, environmental, and economic benefits.\u003c/p\u003e\u003cp\u003eFuture research should focus on validating the model across multiple wastewater treatment plants with varying geographic, climatic, and operational conditions to improve generalizability. Incorporating additional variables such as temperature, pH, or real-time effluent parameters could enhance model accuracy and predictive range. Comparative studies with other deep learning architectures, including recurrent neural networks (RNNs), long short-term memory networks (LSTMs), or transformer-based models, are also recommended to evaluate performance trade-offs and potential for hybrid model integration. Moreover, long-term data collection encompassing seasonal and operational variability would strengthen model robustness and support the development of adaptive AI systems capable of continuous learning from incoming plant data. Expanding the decision-support tool to include optimization functionalities or scenario simulations could further assist plant operators in making strategic, data-driven decisions for energy recovery and environmental performance.\u003c/p\u003e"},{"header":"Abbreviations","content":"\u003cp\u003eAI: Artificial Intelligence\u003c/p\u003e\n\u003cp\u003eANN: Artificial Neural Network\u003c/p\u003e\n\u003cp\u003eCNN: Convolutional Neural Network\u003c/p\u003e\n\u003cp\u003eCH₄: Methane\u003c/p\u003e\n\u003cp\u003eCOD: Chemical Oxygen Demand\u003c/p\u003e\n\u003cp\u003eTSS: Total Suspended Solids\u003c/p\u003e\n\u003cp\u003eVSS: Volatile Suspended Solids\u003c/p\u003e\n\u003cp\u003eWWTP: Wastewater Treatment Plant\u003c/p\u003e\n\u003cp\u003eUASB: Upflow Anaerobic Sludge Blanket\u003c/p\u003e"},{"header":"Declarations","content":"\u003cp\u003e\u003cstrong\u003eEthics approval and consent to participate\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eNot applicable.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eConsent for publication\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eNot applicable\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eCompeting interests\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eThe authors declare that they have no competing interests.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eFunding\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eThe authors declare that they have received no funding.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eAuthor Contribution\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eLeandro Corr\u0026ecirc;a Pykosz was responsible for configuring and training the convolutional neural network model, and contributed to the drafting and revision of the manuscriptAlysson Nunes Di\u0026oacute;genes contributed to the writing of the manuscript and supervised the experimental procedures and overall research executionMaura Harumi Sugai-Guerios participated in the writing process and was responsible for providing and validating the experimental data used in the study. All authors read and approved the final version of the manuscript.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eAvailability of data and materials\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eThe datasets used and/or analyzed during the current study are available from the corresponding author upon reasonable request.\u003c/p\u003e"},{"header":"References","content":"\u003col\u003e\n\u003cli\u003eBrazil. (2020). Law No. 14.026, of July 15, 2020. Official Gazette of the Union.\u003c/li\u003e\n\u003cli\u003eCanete, J.F.D., Saz-Orozco, P., Rivas, M., \u0026amp; Mart\u0026iacute;nez, F. (2016). Soft-sensing estimation of plant effluent concentrations in a biological wastewater treatment plant using an optimal neural network. Expert Systems with Applications, 43, 8\u0026ndash;19.\u003c/li\u003e\n\u003cli\u003eChernicharo, C.A.L., Ribeiro, T.B., et al. (2018). Contributions for improving design, construction, and operation of UASB reactors treating domestic sewage \u0026ndash; Part 1. DAE, 66(214), 5\u0026ndash;16.\u003c/li\u003e\n\u003cli\u003eChoi, D.J., \u0026amp; Park, H. (2001). A hybrid artificial neural network as a wastewater treatment process model. Water Research, 35(16), 3959\u0026ndash;3967.\u003c/li\u003e\n\u003cli\u003eDuan, N., Lv, Y., Wang, Y., \u0026amp; Ding, L. (2021). Prediction of water quality parameters using CNN-based deep learning model. Environmental Science and Pollution Research, 28, 39407\u0026ndash;39418. https://doi.org/10.1007/s11356-021-13522-6\u003c/li\u003e\n\u003cli\u003eHamed, M.M., Khalafallah, M.G., \u0026amp; Hassanien, E.A. (2003). Prediction of wastewater treatment plant performance using artificial neural networks. Environmental Modelling \u0026amp; Software, 18(10), 919\u0026ndash;928.\u003c/li\u003e\n\u003cli\u003eHeannndez, O.A.D. (2019). Avalia\u0026ccedil;\u0026atilde;o de sistemas de medi\u0026ccedil;\u0026atilde;o para controle de processo em tempo real numa esta\u0026ccedil;\u0026atilde;o de tratamento de esgoto sanit\u0026aacute;rio que utiliza reatores UASB (Master\u0026rsquo;s thesis). Federal University of Paran\u0026aacute; (UFPR), Curitiba.\u003c/li\u003e\n\u003cli\u003eHolubar, P., Zani, L., et al. (2002). Advanced controlling of anaerobic digestion by means of hierarchical neural networks. Water Research, 36(10), 2582\u0026ndash;2588.\u003c/li\u003e\n\u003cli\u003eIPCC. (2021). Climate Change 2021: The Physical Science Basis. Contribution of Working Group I to the Sixth Assessment Report of the Intergovernmental Panel on Climate Change. Cambridge University Press.\u003c/li\u003e\n\u003cli\u003eInternational Water Association (IWA). (2019). Digital Water: Industry leaders chart the transformation journey. IWA Publishing.\u003c/li\u003e\n\u003cli\u003eKaminski, G., Possetti, G.R.C., et al. (2021). Combust\u0026atilde;o direta de biog\u0026aacute;s em queimadores. Cadernos T\u0026eacute;cnicos de Engenharia Sanit\u0026aacute;ria e Ambiental, 1(1), 94.\u003c/li\u003e\n\u003cli\u003eLeCun, Y., Bottou, L., Bengio, Y., \u0026amp; Haffner, P. (1998). Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11), 2278\u0026ndash;2324.\u003c/li\u003e\n\u003cli\u003eMjalli, F.S., Al-Asheh, S., \u0026amp; Al-Fadala, H.E. (2007). Use of artificial neural network black-box modeling for the prediction of wastewater treatment plants performance. Journal of Environmental Management, 83(3), 329\u0026ndash;338.\u003c/li\u003e\n\u003cli\u003eNourani, V., Elkiran, G., \u0026amp; Abba, S.I. (2018). Wastewater treatment plant performance analysis using artificial intelligence \u0026ndash; an ensemble approach. Water Science \u0026amp; Technology, 77(10), 2451\u0026ndash;2460.\u003c/li\u003e\n\u003cli\u003ePaula, A.C.D. (2019). Avalia\u0026ccedil;\u0026atilde;o integrada do desempenho de reatores anaer\u0026oacute;bios do tipo UASB tratando esgoto dom\u0026eacute;stico em escala real (Master\u0026rsquo;s thesis). Federal University of Paran\u0026aacute; (UFPR), Curitiba.\u003c/li\u003e\n\u003cli\u003ePossetti, G.R.C., Rietow, S., \u0026amp; Chernicharo, C.A.L. (2019). Energy recovery from biogas in UASB reactors treating sewage. In C.A.L. Chernicharo \u0026amp; T. Bressani-Ribeiro (Eds.), Anaerobic Reactors for Sewage Treatment: Design, Construction and Operation (pp. 175\u0026ndash;196). IWA Publishing.\u003c/li\u003e\n\u003cli\u003ePovey, D., Cheng, G., et al. (2018). Semi-Orthogonal Low-Rank Matrix Factorization for Deep Neural Networks. Interspeech 2018, 3743\u0026ndash;3747.\u003c/li\u003e\n\u003cli\u003eWellinger, A., Murphy, J., \u0026amp; Baxter, D. (2013). The Biogas Handbook: Science, Production and Applications. Elsevier.\u003c/li\u003e\n\u003cli\u003eYaseen, Z. M., \u0026amp; Afan, H. A. (2021). Deep learning in wastewater treatment: A review. Journal of Environmental Management, 286, 112220. https://doi.org/10.1016/j.jenvman.2021.112220\u003c/li\u003e\n\u003cli\u003eZhang, Y., Zhang, S., \u0026amp; Liu, Y. (2020). A hybrid CNN-LSTM model for forecasting biogas production in anaerobic digesters. Renewable Energy, 162, 1309\u0026ndash;1320. https://doi.org/10.1016/j.renene.2020.09.057\u003c/li\u003e\n\u003c/ol\u003e"}],"fulltextSource":"","fullText":"","funders":[],"hasAdminPriorityOnWorkflow":false,"hasManuscriptDocX":true,"hasOptedInToPreprint":true,"hasPassedJournalQc":"","hasAnyPriority":false,"hideJournal":false,"highlight":"","institution":"","isAcceptedByJournal":false,"isAuthorSuppliedPdf":false,"isDeskRejected":"","isHiddenFromSearch":false,"isInQc":false,"isInWorkflow":false,"isPdf":false,"isPdfUpToDate":true,"isWithdrawnOrRetracted":false,"journal":{"display":true,"email":"
[email protected]","identity":"energy-sustainability-and-society","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":false,"externalIdentity":"esso","sideBox":"Learn more about [Energy, Sustainability and Society](https://energsustainsoc.biomedcentral.com/)","snPcode":"13705","submissionUrl":"https://submission.nature.com/new-submission/13705/3","title":"Energy, Sustainability and Society","twitterHandle":"@OpenEnviron","acdcEnabled":true,"dfaEnabled":true,"editorialSystem":"em","reportingPortfolio":"BMC/SO AJ","inReviewEnabled":true,"inReviewRevisionsEnabled":true},"keywords":"Artificial intelligence, Biogas, Modeling, Wastewater treatment plant, UASB, Methane, Convolutional neural networks","lastPublishedDoi":"10.21203/rs.3.rs-6960067/v1","lastPublishedDoiUrl":"https://doi.org/10.21203/rs.3.rs-6960067/v1","license":{"name":"CC BY 4.0","url":"https://creativecommons.org/licenses/by/4.0/"},"manuscriptAbstract":"\u003ch2\u003eBackground\u003c/h2\u003e\u003cp\u003eSustainable operation of wastewater treatment plants (WWTPs) increasingly depends on the ability to recover energy from byproducts such as biogas. Methane (CH₄) production in anaerobic reactors is highly sensitive to influent characteristics, yet real-time monitoring and control remain limited due to environmental and economic constraints. This study explores the use of Convolutional Neural Networks (CNNs) to predict methane flow in domestic wastewater treatment systems, aiming to support proactive process control, reduce greenhouse gas emissions, and enhance the energy efficiency of sanitation infrastructure.\u003c/p\u003e\u003ch2\u003eResults\u003c/h2\u003e\u003cp\u003eA CNN model was developed and trained using high-resolution operational data from a full-scale WWTP employing UASB reactors in Curitiba, Brazil. Input variables included sewage flow rate, chemical oxygen demand (COD), total suspended solids (TSS), and volatile suspended solids (VSS). The optimal architecture\u0026mdash;comprising a single hidden layer with eight neurons and a sigmoid activation function\u0026mdash;achieved a mean coefficient of determination (R\u0026sup2;) of 0.93 and a low mean squared error across multiple training runs. The model effectively captured temporal dependencies in the data, supporting its suitability for time-series forecasting. A web-based interface was also implemented, enabling plant operators to input real-time data and receive immediate methane flow predictions, facilitating on-site decision-making and process optimization.\u003c/p\u003e\u003ch2\u003eConclusions\u003c/h2\u003e\u003cp\u003eThe proposed CNN-based approach offers a robust, low-cost solution for forecasting methane production in anaerobic wastewater treatment, with significant implications for energy recovery and environmental management. By enabling predictive and preemptive operational adjustments, the model contributes to improving biogas quality and minimizing CH₄ losses through flaring. The integration of artificial intelligence into WWTP operations represents a key advancement toward digital and sustainable sanitation, aligning with circular economy principles and global climate goals. Future work may explore model transferability across diverse climatic regions and the integration of hybrid AI architectures to further enhance predictive performance.\u003c/p\u003e","manuscriptTitle":"Convolutional Neural Network for Methane Prediction in Anaerobic Reactors of Domestic Sewage","msid":"","msnumber":"","nonDraftVersions":[{"code":1,"date":"2025-07-15 16:53:16","doi":"10.21203/rs.3.rs-6960067/v1","editorialEvents":[{"type":"communityComments","content":0},{"type":"decision","content":"Revision requested","date":"2026-04-08T19:44:52+00:00","index":"","fulltext":""},{"type":"editorInvitedReview","content":"","date":"2025-10-22T12:50:43+00:00","index":"hide","fulltext":""},{"type":"editorInvitedReview","content":"","date":"2025-09-30T08:03:47+00:00","index":"hide","fulltext":""},{"type":"reviewerAgreed","content":"104600581642811664650014310516528377381","date":"2025-09-26T01:14:56+00:00","index":"hide","fulltext":""},{"type":"reviewerAgreed","content":"290635700775774530546412778742433043300","date":"2025-09-22T10:45:52+00:00","index":"hide","fulltext":""},{"type":"reviewersInvited","content":"","date":"2025-07-13T19:36:07+00:00","index":"","fulltext":""},{"type":"editorAssigned","content":"","date":"2025-07-05T16:00:05+00:00","index":"","fulltext":""},{"type":"checksComplete","content":"","date":"2025-06-30T23:43:35+00:00","index":"","fulltext":""},{"type":"submitted","content":"Energy, Sustainability and Society","date":"2025-06-23T22:48:25+00:00","index":"","fulltext":""}],"status":"published","journal":{"display":true,"email":"
[email protected]","identity":"energy-sustainability-and-society","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":false,"externalIdentity":"esso","sideBox":"Learn more about [Energy, Sustainability and Society](https://energsustainsoc.biomedcentral.com/)","snPcode":"13705","submissionUrl":"https://submission.nature.com/new-submission/13705/3","title":"Energy, Sustainability and Society","twitterHandle":"@OpenEnviron","acdcEnabled":true,"dfaEnabled":true,"editorialSystem":"em","reportingPortfolio":"BMC/SO AJ","inReviewEnabled":true,"inReviewRevisionsEnabled":true}}],"origin":"","ownerIdentity":"5dc7391a-fa29-4687-9e67-aff92b6ea8d7","owner":[],"postedDate":"July 15th, 2025","published":true,"recentEditorialEvents":[],"rejectedJournal":[],"revision":"","amendment":"","status":"under-review","subjectAreas":[],"tags":[],"updatedAt":"2026-05-08T10:25:39+00:00","versionOfRecord":[],"versionCreatedAt":"2025-07-15 16:53:16","video":"","vorDoi":"","vorDoiUrl":"","workflowStages":[]},"version":"v1","identity":"rs-6960067","journalConfig":"researchsquare"},"__N_SSP":true},"page":"/article/[identity]/[[...version]]","query":{"redirect":"/article/rs-6960067","identity":"rs-6960067","version":["v1"]},"buildId":"8U1c8b4HqxoKbykW_rLl7","isFallback":false,"isExperimentalCompile":false,"dynamicIds":[84888],"gssp":true,"scriptLoader":[]}
Text is read by the "Ask this paper" AI Q&A widget below.
Extraction quality varies by source — PMC NXML preserves structure
cleanly, OA-HTML may include some navigation residue, and OA-PDF can
have broken hyphenation. The publisher copy
(via DOI)
is the canonical version.