Analysis of biogas production from sewage sludge combining BMP experimental assays and the ADM1 model

The Anaerobic Digestion Model No. 1 (ADM1) was employed to simulate methane (CH4) production in an anaerobic reactor (AR), and the associated bench-scale biochemical methane potential (BMP) assay, having sewage sludge (SWS) from a municipal wastewater treatment plant (WWTP) as feedstock. The SWS presented the following physical-chemical characteristics: pH (7.4–7.6), alkalinity (2,382 ± 100 mg CaCO3 L−1), tCOD (21,903 ± 1,000 mg L−1), TOC (895 ± 100 mg L−1), TS, TVS, and VSS (2.0%, 1.1%, and 0.8%, respectively). The BMP assay was conducted in six replicates under anaerobic mesophilic conditions (37 ± 0.1°C) for 11 days with a CH4 yield registered of 137.6 ± 6.39 NmL CH4 or 124 ± 6.72 CH4 g−1 VS−1. When the results obtained with the BMP bench-scale reactors were compared to the output generated with computational data by the ADM1 model having as input data the same initial sewage tCOD, similar cumulative CH4 production curves were obtained, indicating the accuracy of the ADM1 model. This approach allowed the characterization of the sludge and estimation of its biogas production potential. The combination of BMP assays, experimental data, and ADM1 model simulations provided a framework for studying anaerobic digestion (AD) processes.


INTRODUCTION
Renewable energy plays a strategic role for energy security worldwide, since the main energy sources currently used are based on fossil fuels petroleum and coal, which are not renewable and pollute the environment (Chen et al., 2018;Vasco-Correa et al., 2018;Sillero, Solera & Perez, 2022).
Increasing amounts of sewage sludge (SWS) are generated all over the world at wastewater treatment plants (WWTPs) and its sustainable management is an important issue due to economic, environmental, and human health concerns (Zan et al., 2022;Ma et al., 2019).
Anaerobic digestion (AD) is a well-known complex microbial process in which organic waste, including SWS, is converted into bioenergy.This process integrates the set of waste management biotechnologies employing a diverse consortium of microorganisms (MO) to convert organic residues into CH 4 -rich biogas (Angelidaki et al., 2018).AD of SWS is considered a relevant decarbonization process worldwide.
Producing and collecting CH 4 from SWS reduces water pollution and CH 4 emissions to the atmosphere (Jiang et al., 2022), meanwhile using this renewable source of energy contributes to saving environmental resources (Deng et al., 2022).However, the application of this approach in an industrial scale requires evaluation of biomass production and conversion systems, including feedstock selection and growth; harvest; storage conditions; bio-gasification; gas cleaning; gas use and residue processing (Volschan Junior, de Almeida & Cammarota, 2021).
The development of highly accurate mathematical models is currently a focal point in research efforts, as these models can effectively assess digester performance capabilities (Achinas & Euverink, 2016).
The current state-of-the-art model, the Anaerobic Digestion Model No. 1 (ADM1) was originally developed by the International Water Association-IWA Task Group (Batstone et al., 2002).The model was further improved resulting in the BSM2 version (Alex et al., 2019;Donoso-Bravo et al., 2020), the xp version, among others.One of the key points for successful application of mathematical models to describe a particular bioprocess is achieving adequate input characterization (Batstone et al., 2002).In this scenario extensive model calibration procedures are required to improve accuracy and sensitivity (Weinrich & Nelles, 2021).Mechanistic models have in common that they need to be carefully calibrated (Sappl, Harders & Rauch, 2023).Computational simulation (CS) evaluates the different processes and operation variables on the performance of the CH 4 biogas production in AD (Jimenez et al., 2020;Batstone & Virdis, 2014;Batstone et al., 2015).The ADM1 model has been used by several modelling studies in sewage AD (Guo et al., 2023;García-Gen & Wouwer, 2021;Maharaj et al., 2019;Urtnowski-Morin et al., 2021;Zhao et al., 2019).
The biochemical methane potential (BMP) assay has been widely used to test the anaerobic degradability of different organic wastes, and it is considered a suitable method to compare the degradability of different substrates (Lavergne et al., 2018).This test enables the assessment of the decomposability and the CH 4 conversion efficiency of diverse organic materials.Owen et al. (1979) initially introduced the BMP test, outlining a procedure to ascertain the decomposability of a substrate by monitoring the cumulative CH 4 production from an anaerobically incubated sample over a period of time (Cabbai et al., 2013;Elbeshbishy, Nakhla & Hafez, 2012;Kafle & Chen, 2016;Raposo et al., 2011;VDI 4630, 2016).However, the results obtained for the same substrate often differ among laboratories and much work to standardize such tests is still demanded (Astals et al., 2013;Filer, Ding & Chang, 2019;Grosser, 2018;Raposo, Borja & Ibelli-Bianco, 2020;Strömberg, Nistor & Liu, 2014).The German VDI 4630 (VDI 4630, 2016) is a BMP guideline that discusses the typical shape of methanogenic curves.However, the guideline presents only hypothetical idealized curves and does not discuss actual measurements, being not clear what might actually cause each response (Koch et al., 2019).According to Filer, Ding & Chang ( 2019) because of the lack of a standardized protocol, there have been serious drawbacks impacting the industry users, as the reliability of generated information could be questioned, due to the potential effects laboratory-specific experimental and operational conditions, as well as data presentation on the results, limiting the comparability of published results.During the years several authors have worked to improve the BMP method (Angelidaki et al., 2009;Pearse, Hettiaratchi & Da Costa, 2020;Rodrigues et al., 2019;Wang et al., 2020).Numerical prediction methods using initial data acquired from conventional bench-scale BMP assays were recently proposed (Catenacci et al., 2022;Guo et al., 2023;Nabaterega, Nazyab & Eskicioglu, 2023).However, the BMP method is still undergoing evolution, and researchers are investigating crucial aspects to further mitigate potential sources of bias.
In the present study, we developed a methodology that combines biochemical methane potential (BMP) assays and total chemical oxygen demand (tCOD) data with a computational simulator, employing the BSM2 version of the ADM1 model (Alex et al., 2019), for the coupled full-scale anaerobic reactor (AR) and the BMP assay systems.By doing so, we were able to generate a comprehensive and detailed view of the AR processes, including a description of the inflow and outflow SWS compositions.This methodology can be applied to analyze the biogas production and the underlying processes in full/real-scale applications.

Sampling and samples characterization
Samples of SWS were collected from an active anaerobic digester at a large municipal WWTP located in Rio de Janeiro, Brazil.The WWTP has a treatment capacity of 7,400 m 3 day −1 and a hydraulic retention time (HRT) of the AR is 28 days.It treats 2.5 m 3 s −1 of wastewater and serves a population equivalent to 1.5 million inhabitants.Standard methods (APHA, 2017) were used to measure physicochemical parameters.
The operational parameters applied to the BMP assay are shown in Table 1.
The initial and final pH values were measured using an MS Tecnopon model Mpa210 meter, and temperature levels were recorded with a digital thermometer.Chemical oxygen demand (COD) was determined using a Shimadzu UV-1800 UV-VIS Spectrophotometer, while alkalinity was measured via potentiometric titration.Total Solids (TS), total fixed solids (TFS), total volatile solids (TVS), volatile suspended solids (VSS) were quantified using a gravimetric method with the analytical scale Gehaka AG200 (Gehaka, Sao Paolo, Brazil).Total organic carbon (TOC) analyses were carried out using a Shimadzu Total Organic Carbon Analyzer TOC 5000A (Shimadzu, Kyoto, Japan).Both inoculum and substrate, approximately 100 mL in total, were employed for the BMP assays with SWS as per the recommendation by VDI 4630 (2016).

BMP assays: experimental procedure
The BPM assay was carried out according to previous studies by Angelidaki et al. (2009) and the German Guideline for Fermentation of Organic Materials (VDI 4630, 2016), in order to evaluate CH 4 production from sewage sludge SWS in bench-scale.
The experiment was conducted in six replicates R1-R6 (n = 6) incubated during 11 days under mesophilic conditions (37 ± 0.1 • C) using water-bath with digestion bottles of 250 mL total volume and 100 mL working volume (Fig. 1).
The BMP assay was carried out using four borosilicate Schott bottles (Fig. 1), chosen for their ability to withstand high temperatures and pressures.The first bottle in the sequence, referred to as the digester bottle (Fig. 1), featured pipes that had no contact with the inoculum, only with the gases produced.The second bottle was filled with a NaOH solution which served as a barrier to retain CO 2 .The cannula was submerged in this basic solution as the gases generated in the digestion process were bubbled through it.The third bottle contained 1 L of a saturated NaCl solution and was equipped with a silicone stopper fitted with two 3-way taps.One tap was connected to the second bottle containing the alkaline solution, while the other tap was linked to the fourth bottle, which measured the displaced water volume.
To prevent gas leakage from the digesters, caps and connectors were securely sealed using high vacuum grease.In order to eliminate any existing O 2 in the system, N 2 gas was flushed into the headspace of the bottles for a period of 2 min.For bottle sealing, silicone stoppers with two holes each were employed.Two 3-way faucets were then inserted into the tops of these silicone stoppers, enabling external connections to the system.The analysis of gas volume produced during the experiment continued until the cumulative gas curve reached a plateau.
The sealing of the biodigester system was checked using a high-pressure pump, a differential dual port piezoresistive pressure transducer MPX5050DP, a Fluke multimeter, and an Arduino data logger.The bottles were gently shaken manually every day to prevent particle retention and system clogging.
This experimental setup allowed for precise measurements and ensured the integrity of the gas samples throughout the BMP assay.

ADM1 model
The Anaerobic Digestion Model 1 (ADM1) is the quasi-industry standard for modelling the AD processes that result in CH 4 production from wastewater (Allen et al., 2023).It was developed by the International Water Association (IWA) and is based on several simpler AD models.It considers a continuously stirred tank reactor containing wastewater and 12 different bacterial groups that consume/produce 12 different substrates.This scenario is described by a system of 24 ordinary differential equations (ODEs).The model also considers physio-chemical reactions within the substrate itself, increasing the number of substrates to 23 and increasing the total number of state variables to 35.These physiochemical reactions are classified into two categories: acid-base reactions and liquid-gas exchange, both of which can be modelled by ODEs, resulting in the total system being described by 35 ODEs.
In this work, the Benchmark Simulation Model 2 (BSM2), (Alex et al., 2019), which is a modified version of the IWA ADM1 model (Batstone et al., 2002), is employed.The model comprises two extracellular stages, namely disintegration and hydrolysis, and three intracellular stages: acidogenesis or fermentation, acetogenesis, and methanogenesis.The extracellular stages were modeled using first-order kinetics.In this work we will use, interchangeably, the variables and model parameters naming notation employed by Alex et al. (2019), and Batstone et al. (2002), and Allen et al. (2023).For instance, complex composite concentration will be represented interchangeably by X c or X_c.
Initially, X_c was disintegrated into X_ch, X_pr, and X_li, as well as X_i and S_i, using a disintegration coefficient (kdis).Monod-type kinetics were used to describe substrate uptake in the intracellular biochemical reactions.In this study, two sequentially coupled simulators based on the ADM1 model were employed for the AR process and the BMP assay to provide a more comprehensive assessment of the inflowing sewage sludge, which will be explained in the following section.
In this study, we utilize a novel DAE-based (Differential Algebraic Equation) implementation of ADM1, developed in the Julia programming language.This implementation bears resemblance to a recent work by Allen et al. (2023).Our implementation, however, adopts the DAE approach, instead of the ODE approach employed by Allen et al. (2023).Our choice of this approach was motivated by its exceptional computational efficiency, surpassing that of alternative DAE-based implementations in Java and Python.As a result, it empowers us to conduct intricate optimization analyses without incurring undue computational expenses.
The stoichiometric, biochemical and physicochemical model parameters values were those presented in Rosén & Jeppsson (2005), and were not modified to represent the situation under study.

Anaerobic reactor system simulation module
The first application of ADM1 was employed to simulate the treatment of influent sludge in the anaerobic reactor (AR), which is a continuous process.The SWS inflow is a complex particulate mixture, which is characterized by the COD mass (X_c).The primary constituents of X_c were found to be organic compounds (X_ch, X_pr, and X_li) and inorganic components (Xi and soluble inert material (Si)).The unity (kg COD m −3 ) was utilized to input X_c and other organic substrates into the model.Subsequently, X_c was decomposed into five distinct components, according to their corresponding proportions, as determined by the yield of the product to the substrate (f_product_substrate), which led to hydrolysis, acidogenesis, acetogenesis, and methanogenesis.The input state variables of the soluble fractions (Ss) in the AR ADM1 module were set based on a best fit procedure as explained below.

BMP system simulation module
The second application of ADM1 was employed to simulate the BMP, which is a batch assay.Inhibition was not applied, since the BMP tests had parameters such as temperature controlled, and pH maintained around the neutral value.The input parameters required for the BMP ADM1 module are the complete set of components that characterizes the AR outflow SW.The module predicts the curve of CH 4 production as a function of time as output.

Combined AR and BMP ADM1 model parameters selection and validation
A methodology employing two coupled stages-AR and BMP-was applied to model the entire AD process, including the original bioreactor, and to infer additional parameters from BMP assays.A block diagram of the combined ADM1 model is shown in Fig. 2.
The first stage (AR ADM1 module) simulates a continuous-flow stirred-tank reactor (CSTR), while the second stage (BMP ADM1 module) simulates a batch reactor-the BMP assay.The output of the first module serves as the input for the second module.The input parameters of the first module are obtained through an iterative optimization solver.The solver minimizes the discrepancy between the simulated and measured values for the CH 4 production curve at selected times and the COD at the beginning of the BMP assay.
The methodology employed for determining the model parameters follows a leastsquares optimization approach, elaborated as follows.The primary objective of the least-squares optimization is to identify the model parameters that most effectively align with the experimental dataset.This dataset comprises 'n' data points represented as pairs (x i ,y i ),i =1 ,...,n, where x i signifies an independent ADM1 parameter, and y i corresponds to a dependent parameter derived from the BMP assays.The model function is denoted as f (x i , ), with m adjustable parameters encompassed in the parameter vector .The ultimate aim is to determine the parameter values for the model that offer the closest fit to the data.The fitting quality of a model to a given data point is quantified by the residual r i , which signifies the disparity between the observed value of the dependent variable and the value predicted by the model: The parameters were determined through the weighted least-squares method to identify optimal values that minimize the sum of squared residuals, S, as in Poggio et al. (2016): Here, y m,i represents the ith measured value of the target measurement, assumed to be a normally distributed random variable.f (x i , ) denotes the model prediction at the time corresponding to data point i, treated as a function of the set of parameters to be estimated.Additionally, σ m,i stands for the standard error of the measurement, y m,i , and serves as a weight for each term in the sum.
The standard error was estimated from the measured values, using the expression where σ is the standard deviation, and n is the number of samples.In the case of the combined AR-BMP ADM1 model, the target measurement is the accumulated methane production along the BMP tests.The standard error of each measurement was estimated using the standard deviation of the BMP results.Numerous optimization libraries are readily accessible within the Julia platform, facilitating rapid prototyping and experimentation with diverse strategies to address implementation optimization challenges.Various alternatives underwent testing, with Optimization.jlstanding out.This library aims to amalgamate an array of optimization packages, both local and global, into a cohesive Julia interface.Optimization.jlintroduces high-level attributes, such as seamless integration with automatic differentiation, rendering its utilization straightforward for most scenarios, all while retaining the entirety of options within a unified interface.
Though a simple gradient-based approach might suffice in certain instances, complications can arise due to positivity constraints.Gradient based methods suffer from many shortcomings such as slow convergence, difficulty with discontinuous problems, local minima and saddle points, among others.Consequently, an extensive array of methods available in the Optimization.jllibrary underwent evaluation in this work, ultimately revealing the DE/rand/1/bin method as the most suitable contender.
The ''DE/rand/1/bin'' optimization method is a specific variant of the Differential Evolution (DE) algorithm, a versatile technique for solving optimization challenges across domains.
The DE/rand/1/bin implemented in the Julia language Optimization.jllibrary was therefore used as the minimization technique, with a tolerance for convergence of 4E-3 in the objective function.The estimation process is repeated using different initial guesses of parameters to check the convergence of the algorithm towards the same optimum values.
The combined AR-BMP model employs, as input data, the COD values of the wastewater treatment plant (WWTP) sludge and the CH 4 production from the BMP assay.The iterative optimization method is employed to find the initial condition of the WWTP sludge (X_ch, X_pr, and X_li), as well as the effective hydraulic retention time (HRT) of the AR, which are input parameters of the AR ADM1 model.The search method is iterated until the initial conditions of the BMP ADM1 module, obtained from the AR module, result in a simulated CH 4 production curve that best matches the values at the points of the methanogenic curve obtained in the BMP assay.
As a result, the coupled AR-BMP model produces a simulated BMP methanogenic curve that best fits the values of the methanogenic curve obtained in the BMP experimental assays, in the least squares sense.The model was thus calibrated using the experimental

Substrate characterization
Table 2 shows the SWS physicochemical characterization used as feedstock in the BMP assays.Discrete changes in pH (7.43 ± 0.1 to 7.60 ± 0.1) were observed after 11 days in the reactor (Table 2), which is within the expected range, due to the growth of microorganisms (MO) and biogas production in all reactors without the addition of a buffer solution.The substrate pH was recorded at the beginning and end of the experiment to ensure that inhibition did not occur in the microbial communities.Alkalinity (2,382 ± 100 mg CaCO 3 L −1 ) and CODt value (21,903 ± 1,000 mg L −1 ) (Table 2) indicate the sludge's capability of buffering the reaction and the oxygen consumption capacity during the oxidation of the sludge organic matter (OM) into CO 2 and water.TOC (895 ± 100 mg CaCO 3 L −1 ) is the carbon in the OM oxidized and measured through the release as CO 2 .The biological processes lie in the ability of MO to use biodegradable organic compounds and transform them into by-products (Lucas et al., 2015).Regarding solid series, the following results were obtained after SWS characterization (Table 2): total solids (TS) 2.0%, total volatile solids (TVS) 1.1%, and volatile suspended solids (VSS) 0.8%.This suggests that anaerobic sludge contains more organic than inorganic compounds.The amount of biomethane yield produced is related to the mass of VS in these samples.

BMP assay results
The curves of cumulative CH 4 production (Fig. 3) are within a narrow range of values and the standard deviation curve (Fig. 4) shows that the BMP reactors achieved good reproducibility.The round of experiments (R1 to R6) produced the following CH 4 values (  (Batstone et al., 2015), and these patterns have meaningful implications (Labatut, Angenent & Scott, 2011).Temperature plays a crucial role in microbial interactions and affects the stability and performance of AD and the thermodynamic equilibrium of biochemical reactions in the AD process (Lin et al., 2017).
The proposed BMP assay setup enabled daily measurement of biogas volume, which yielded satisfactory results.The alkaline solution used in the setup efficiently retained the produced CO 2 .Furthermore, the BMP assays were conducted at mesophilic temperature, which contributed to the stability of the system.Mesophilic reactors are preferred for easy biodegradable biomass (Issah, Kabera & Kemausuor, 2020).The CH 4 yield production was found to be 113, 130, 124, 129, 127, and 118 mL CH 4 g −1 VS −1 in R1 to R6, respectively.These results demonstrate the effectiveness and accuracy of the experimental rounds conducted for the BMP assays (Table 4 and Fig. 5).
Table 5 shows the final (tCOD f ) values and the biodegradability rate (23-28%).The CH 4 yield can be normalized either per volume of substrate (mL CH 4 L −1 ), substrate mass volatile solids (mL CH 4 g −1 VS), or substrate mass chemical oxygen demand (COD) (mL CH 4 g −1 COD sub ).The last method allows direct conversion of the results into percentage of OM converted to methane using the theoretical calculation of 0.350 m 3 CH 4 per kg COD converted (McCarty, 1964).

Combined ADM1 computational simulation
The simulation results, employing the above data and model parameters presented in Table 6, are shown in Fig. 5, along with the results from the BMP assay.The simulated production curve is very similar to the one obtained in the BMP assay, indicating that the combined ADM1 model can reproduce the expected results.This makes the computational simulation (CS) a useful tool for elaborating and planning laboratory experiments.Tables 7  CH 4 yield mL CH 4 g −1 COD 5.6 6.5 6.2 6.1 5.9 6.3 6.15 ± 0.9 and 8 show the SWS composition according to the ADM1 model, applying the iterative optimization method and based on the SWS COD initial real value in the BMP assay feedstock.
The data in Table 7 show that the AR inflow is well characterized basically by a mixture of complex composites (40.769 kg COD m −3 ), with a small addition of protein (8.127 kg COD m −3 ), and trace amounts of additional lipids (8.127 kg COD m −3 ) and inert particulate (0.087 kg COD m −3 ).
It must be stressed that the complex composites category in ADM1 results in a predefined distribution of carbohydrates, proteins, lipids, and inert particulate matter when hydrolyzed.Thus, the net effect of including additional protein, lipids and inert particulate is to correct the default composition of the complex composite and to produce simulation results that better approximate the observed data.
The results obtained by the ADM1 modeling were very close to those obtained experimentally in the BMP test, illustrating the quality of the model proposed by the International Water Association (IWA).By using this model together with a least-squares  iterative method, a detailed SWS composition consistent with the BMP data was found (Table 8).
Table 8 shows the main concentrations present in the AR sludge, which include inert particulate, complex composite, inert soluble, and amino acid consumers.The composition of the AR sludge indicates a significant decrease in the concentration of complex composite (to approximately 5 kg COD m −3 ) and a considerable increase in the concentrations of inert particulate and inert soluble.Results in Table 8 were obtained by numerical calculation, and refer to the modeled composition output of the AD, and feed to the BMP model that best approximates the results of experimental BMP results.The low concentration of the composite X_c when compared to the inert X_i and S_i concentrations is consistent with a composition of the output variable values of a AD, where the Xc undergoes an efficient consumption.
Also the high values of X_aa and X_ac, when compared to other five biomass fractions, are compatible with results found in other AD simulations and experimental results.
Total acetate concentration is fed by six processes (with biochemical process rates ρ 5 to ρ 10 ) thus resulting in an acetate concentration that is comparatively higher than each of the six original sources.Also, acetate consumers do not have a faster metabolism compared to other consumers in the process.For instance, K_m_ac = 8 d −1 , while K_m_pro = 6 d −1 .Combining these two factors (larger concentration of acetate and relatively slow acetate consumers biochemical process rates), a larger mass of acetate consumers X_ac is required to consume the results of the acetogenic metabolic pathway production.If not properly taken into account, the high concentration of acetate could lead to reduced methane production due to the inhibition of acetoclastic methanogens caused by low pH.
On the other hand, protein load in the feed is relatively high, and amino acid production is proportionally high, thus a larger mass of amino acid consumers X_aa is to be found at the AD process output when the process reaches a steady state.A relatively high concentration of proteins, relative to carbohydrates and lipids is not uncommon in wastewaters in tropical climates.
By matching the ADM1 results with the BMP assays experimental measurements, an equivalent composition was obtained (Table 8 and Fig. 5).Table 9 provides a numerical comparison between BMP CH 4 production experimental results and ADM1 computational results, showing a maximum discrepancy of less than 2.8%.Based on the similarity of the results, it can be concluded that the model is suitable to characterize SWS and biogas production potential.

Results of validation of ADM1 model DAE-Based Julia implementation
The new Julia language implementation of the DAE-ADM1 model is validated comparing results with the ODE-Based Julia implementation (Allen et al., 2023).Validation tests were performed on various benchmark problems, showing very good agreement.In this section we present the results of the test performed on the data obtained in the previous section (Tables 6 and 7), in order to provide a validation of the results of the simulations performed in this work.Figures 6 to 10 show the results of the AR simulation using the current DAE implementation, compared to the results obtained by the DAE implementation of Allen et al. (2023).The validation tests demonstrate that the results have a very good agreement, perform model parameter estimations and operational parameters optimization.The tests were performed on an Intel(R) Core(TM) i7-1060NG7 CPU @ 1.20 GHz, with 16GB 3733 MHz LPDDR4X memory, macOS Ventura 13.5.2,and Julia v1.9.

Operational parameters and biogas production
AD pH stability is the main controlling factor in balancing the system (Issah, Kabera & Kemausuor, 2020).No pH adjustments were made during the BMP assays due to the buffer capacity of the SWS.The twice-daily stirring and agitation of the digesting vessels allow for the release of gas during the assays and at the same time avoiding clogging of the connecting valves.Biogas yield decreases when the pH value is higher than 7.6 or lower than 6.8 (Pilarski et al., 2020).Process variables, such as temperature and pH, are the principal factors affecting the smooth digestion process (Castellano-Hinojosa et al., 2018).At very high or very low temperatures, bacterial and archaeal activities may be curtailed, leading to low yields, and unbalanced pH could result in volatile fatty acid (VFA) accumulation that could result in MO mortality (Issah, Kabera & Kemausuor, 2020), especially methanogenic ones.
High values for alkalinity indicate that the reaction is buffered, so the pH does not undergo major changes (Angelidaki et al., 2013).The SWS alkalinity value in this study (2,382 ±100 mg CaCO 3 L −1 ) is similar to the alkalinity found in other SWS from WWTP as observed by Grosser et al. (2020), who investigated the BMP of SWS from a WWTP in Poland (2,823 mg CaCO 3 L −1 ).
The tCOD value (21,903 ± 1,000 mg L −1 ) is consistent with values found in other studies, such as 25,250 mg L −1 by Park et al. (2021) and 22,300 mg L −1 by Wickham et al. (2018).
As MO converts chemical energy to CH 4 , this is directly associated with the maximum energy that can be recovered as biogas (Raposo et al., 2012).The inoculum taken from an active anaerobic digester (AR) that is digesting complex organic matter (OM) and is at a steady state at the time of sampling provides a highly diverse microbial community, able to digest a large variety of organic molecules (Holliger et al., 2016).

Carbon content and sludge biodegradability
The biodegradability rate achieved in the present study is consistent with the COD removal percentages reported in previous studies based on SWS BMP assays, such as Maragkaki et al. (2018), Kashi et al. (2017), andZhang, Hu &Lee (2016), which achieved removal percentages of 28.9%, 16.0%, and 25.2%, respectively.OM is measured by the amount of carbon in a feedstock (Ferguson, Coulon & Villa, 2018;Gohil et al., 2018) and biomethane yield is affected by the VS content (Mayer et al., 2014).Therefore, CH 4 production is directly related to the degradation of VS (Angelidaki et al., 2009) being VS the OM component of TS.
Systems used in AD are classified according to the percentage of TS in the feedstock (Yi et al., 2014).The biogas yield mainly depends on the content of organic compounds in the feedstock, including fats, proteins, and carbohydrates, which are biologically degradable under AD (Abdul Aziz, Hanafiah & Mohamed Ali, 2019).Anaerobic MO can be inhibited by substances present in the substrate or by compounds generated in the metabolism itself (Mustapha et al., 2018).The biochemical methane production potential of the substrates intended for anaerobic digestion and their specific organic loads can be utilized to design various components of full-scale AD plants, including the size of digesters and the potential for utilizing the generated biogas (Filer, Ding & Chang, 2019).SWS is an optimal inoculum for BMP assays because of the diversity of its microbial population (Raposo et al., 2011).A well-functioning AD must contain a balanced microbial consortium community for efficient biogas production (Issah, Kabera & Kemausuor, 2020).The experimental results showed that the SWS obtained from a municipal WWTP has the capability to produce CH 4 , and it is considered as a feasible strategy for bioenergy production.The biodegradability properties of substrates and production of inhibitory intermediate products will mainly control the kinetics of AD different steps and define the shape of the biogas production curve, identifying important characteristics of substrates and anticipating digestion issues (Labatut, Angenent & Scott, 2011).
COD is commonly used to measure the organic strength of liquid effluents.At WWTPs, each kilogram of COD removed will yield 0.35 m 3 of CH 4 gas at standard temperature and pressure (Jingura & Kamusoko, 2017).The theoretical CH 4 yield can be calculated from the COD of a substrate, and biogas production in relation to COD is about 0.5 L g −1 COD removed, corresponding to a CH 4 production of approximately 0.35 L g −1 of COD removed (Angelidaki & Sanders, 2004).

Feasibility of using the model as a tool to predict BMP results
The ADM1 CS can be used to compare the decrease in COD observed experimentally with the values obtained from numerical simulation.Furthermore, the model can be validated by comparing and calibrating the methanogenic activity and production curves.AD processes are conducted under laboratory conditions and scaled to pilot-scale trials.This methodology can be applied to support the development of experiments and full-scale reactor projects.The generated BMP data's scalability and transferability allow the results to be applied to larger-scale systems, facilitating the development and optimization of AD processes (Jingura & Kamusoko, 2017).
The ADM1 model can be adapted to individual cases.There are certain factors in ADM1 that require the user's discretion, such as the fractionation of composition (Xc) and the definition of inert ingredients, soluble (SI) and particulate (XI).However, there are hypotheses that may restrict the model's applicability in anoxic environments.For instance, the influent particulate composite substrate and the cytolysis product use the same component Xc, which requires a disintegration process before hydrolysis.Therefore, characterizing the influent sludge becomes particularly challenging.

Combined AR-BMP model output and comparison with BMP assay: estimation of outflow composition, biogas production, and operation parameters of the full-scale AR
The methodology developed in this study involved using two coupled ADM1 models to validate the complete AD process, including the original bioreactor, and to infer additional parameters from the BMP assays.The first model simulates a continuous-flow stirred-tank reactor (CSTR), and the second model simulates the BMP assay, which is a batch reactor.The input of the second model is given by the output of the first model, and the input parameters of the first model are obtained by means of an iterative optimization method that minimizes the error of the obtained methane production curve along with the COD at the beginning of the BMP assay, as seen in Fig. 2. Therefore, the proposed methodology, using the combined ADM1 model, solves the challenging problem of characterizing the influent sludge in a systematic way.This methodology can be applied to support the development of experiments and full-scale reactor projects.The scalability and transferability of the data obtained with BMP assays can be used to apply the results in larger-scale systems (Jingura & Kamusoko, 2017).
The feasibility of using the model as a tool to predict BMP assays results and reduce possible mistrust in experimental results can be further evaluated by comparing the COD decrease observed experimentally in bench-scale and the values obtained in the numerical simulation.Also, the methanogenic activity and the production curve can be compared and calibrated to validate the model.

Optimization of operational parameters using the combined AR-BMP model calibrated with BMP assays
Once the AR-BMP simulator is calibrated, it can be employed to optimize operational parameters of the AR system.As the new Julia language implementation of the BSM2 DAE ADM1 model developed in this work is very fast, when compared to previous implementations, it is very well suited for optimization purposes.
To demonstrate the capabilities of the methodology, an example of the optimization of the AR operational parameters is presented.In this example, the influence of the parameters  9.
Full-size DOI: 10.7717/peerj.16720/fig-11 solute residence time, and particulate residence time is analyzed.The residence time can be increased by improving the flow patterns on the AR with inappropriate mixing, reducing slow recirculation flow regions or dead zones and dead time.On the other hand, particulate residence time can be selectively increased by providing a low mixing region at the outflow region, allowing for particle segregation due to the settling velocity.
To perform an optimization study, we define the following parameters: where V ,V p ,V s are the reactor nominal effective volume, the particulate effective volume, and the solute effective volume.Results of the simulations using the calibrated model for various values of χ and κ are shown in Fig. 11.It can be observed that the CH 4 production improves, for all values of κ, with the increase of χ from 0 up to an optimal value.The optimization provides the best value of χ for each value of the parameter κ, keeping the same reactor nominal effective volume V .Table 10 shows the CH 4 production at the optimum χ for each of the simulated κ values.It can be observed that CH 4 production can be increased by more than 5%, with respect to the unmodified parameter values, by optimizing the values of χ and κ.This methodology can be employed, along with numerical simulations of the particulate fluid flow or the results of properly reduced scale models, to assess the potential benefits of a proposed improvement of the process.

CONCLUSIONS
The present study was based on the assembly of bench-scale bioreactors (BMP assays) and the use of experimental data obtained to feed the ADM1 mathematical model with subsequent calibration to simulate the anaerobic digestion of an anaerobic sludge obtained at a municipal WWTP.The bench scale BMP assays resulted in cumulative CH 4 production ranging from 124 to 143 NmL CH 4 and CH 4 yields ranging from 113 to 130 mL CH 4 g −1 VS −1 after 11 days of BMP assay.
A method that employs two coupled ADM1 model applications and BMP assay, combined with an iterative optimization method, was developed to characterize sewage sludge and biogas production potential by an equivalent composition that produces similar methanogenic curves.
The approach presented in this investigation can be used to design experiments in batch reactors using sewage sludge as feedstock to produce biogas, and to optimize the biogas production in the large scale biogas plant, which is very important for practical use.
Further studies applying BMP assays and computer simulations of both AR and BMP processes, including flow and particle transport simulations, are recommended for better understanding of the anaerobic digestion process.The results achieved can be used not only to define experiments in batch reactors having sewage sludge as feedstock to produce biogas but also to investigate microbial communities associated with methane production using molecular biology tools.Finally, the combination of BMP tests and biological data will be useful to predict the best conditions to operate anaerobic reactors to produce bioenergy.
• Norberto Mangiavacchi conceived and designed the experiments, analyzed the data, prepared figures and/or tables, authored or reviewed drafts of the article, and approved the final draft.

Figure 1
Figure 1 Schematic diagram of BMP apparatus used in BMP assay.Vessel 1 is the BMP reactor, vessel 2 contains a 3 M NaOH scrubbing solution, vessel 3 contains 1 M NaCl saline solution.Vessel 4 is initially empty and collects the saline solution displaced by the CH 4 gas collected in vessel 3. Full-size DOI: 10.7717/peerj.16720/fig-1

Figure 2
Figure 2 Schematic diagram of the methodological approach adopted in the present study: combined BMP assay-ADM1 model.Top: Experimental assay.The full scale AR receives SWS with Inflow state, and its outflow feeds the BMP assay that produces the experimental cumulative CH 4 production.Bottom: Combined ADM1 model, implemented in Julia language.An estimated SWS inflow enters the AR ADM1 module, and its output feeds the BMP ADM1 module, resulting in the Simulated cumulative CH 4 production.The sum of squared residuals S between the experimental and the simulated CH 4 production curves feeds the optimization routine that corrects the estimated SWS inflow parameters, until the sum of the squared residuals S is minimized.Full-size DOI: 10.7717/peerj.16720/fig-2

Figure 5
Figure 5 Methanogenic curve obtained with the BMP experimental assay versus the curve obtained with the computational simulation using the ADM1 simulation model.Full-size DOI: 10.7717/peerj.16720/fig-5

Figure 6
Figure 6 Concentration curves of Xc, SI an XI obtained with the computational simulation of the AR using the current DAE-ADM1 model implementation, compared with the results obtained with ODE-ADM1 model (Allen et al., 2023).Lines with circles correspond to values obtained in the current simulations.Curves with squares are obtained with the ODE-ADM1 model, showing virtually identical results.Full-size DOI: 10.7717/peerj.16720/fig-6

Figure 7
Figure 7 Concentration curves of Xch, Xpr and Xli obtained with the computational simulation of the AR using the current DAE-ADM1 model implementation, compared with the results obtained with ODE-ADM1 model (Allen et al., 2023).Lines with circles correspond to values obtained in the current simulations.Curves with squares are obtained with the ODE-ADM1 model, showing virtually identical results.Full-size DOI: 10.7717/peerj.16720/fig-7

Figure 8
Figure 8 Concentration curves of Xsu, Xaa and Xfa obtained with the computational simulation of the AR using the current DAE-ADM1 model implementation, compared with the results obtained with ODE-ADM1 model (Allen et al., 2023).Lines with circles correspond to values obtained in the current simulations.Curves with squares are obtained with the ODE-ADM1 model, showing virtually identical results.Full-size DOI: 10.7717/peerj.16720/fig-8

Figure 9
Figure 9 Concentration curves of Xc4, Xpro and Xac obtained with the computational simulation of the AR using the current DAE-ADM1 model implementation, compared with the results obtained with ODE-ADM1 model (Allen et al., 2023).Lines with circles correspond to values obtained in the current simulations.Curves with squares are obtained with the ODE-ADM1 model, showing virtually identical results.Full-size DOI: 10.7717/peerj.16720/fig-9

Figure 10
Figure 10 Concentration curves of Ssu, Saa and Sfa obtained with the computational simulation of the AR using the current DAE-ADM1 model implementation, compared with the results obtained with ODE-ADM1 model (Allen et al., 2023).Lines with circles correspond to values obtained in the current simulations.Curves with squares are obtained with the ODE-ADM1 model, showing virtually identical results.Full-size DOI: 10.7717/peerj.16720/fig-10

Figure 11
Figure 11 Optimization of the production curve of CH 4 , considering a simple mixing/stratification model.The optimum production for the case κ = 1.0 is obtained for χ = 0.68, and the optimum production value is 29.84 kg COD/m 3 of effluent.The optimum values, for different values of κ, is marked by a dot in each curve.The relevant data is shown in Table9.Full-size DOI: 10.7717/peerj.16720/fig-11

Table 2 Sewage sludge physicochemical parameters.
Final pH average; %TS, Total solids percentage; %TVS, Total volatile solids percentage; %VSS, Volatile suspended solids percentage; TCODi, Total initial Chemical Oxygen Demand; TOC, Total Organic Carbon.data to accurately simulate the AD process.The output of the first model results in sludge with COD values similar to the WWTP biodigester sludge.Additionally, it produces a more complete description of the AR outflow SW which is consistent with the input data.

Table 3 Methane production from sewage sludge in BMP assays
(n = 6).

Table 4 Methane production from sewage sludge in experimental assays in the literature.
Notes.OS, organic substrate; SS, sewage sludge; PS, primary sludge; m, mesophilic; Ym, CH 4 yield; n.a., not available.

Table 6 ADM1 stoichiometric, biochemical and physiochemical model parameters values used in the simulations.
Values not marked are taken fromRosen and Jeppson (2006).Values highlighted with ''*'' are modified, and the original values are shown between parentheses ''( )''.