1. Introduction
Solid waste management is one of the most important environmental challenges globally. Rapid population growth, industrialization, and economic development have intensified waste generation, which in turn has aggravated ecological, social, and public health problems [
1]. Although solid waste includes a wide variety of reusable materials, such as glass, paper, and metals, organic waste presents a very important opportunity thanks to its capacity to be transformed into compost, biofertilizers, and biogas, thus contributing to more sustainable management [
2].
In this context, the bioeconomy emerges as a sustainable strategy to address resource scarcity, environmental challenges, and evolving market demands. Its approach is based on the efficient conversion of renewable biological materials into bioproducts and bioenergy, thereby reducing dependence on fossil fuels [
3]. Among the various energy alternatives, biogas production from organic waste has gained significant relevance, as it not only diversifies energy matrices but also promotes decentralized renewable energy generation [
4].
Countries with a strong agricultural base, such as Colombia, have begun to recognize the potential of biogas in their transition to cleaner energy. Since 2019, the “Energy Transition” initiative has promoted the integration of non-conventional renewable sources, within which biogas is positioned as a promising option [
5]. In rural areas, where many communities still lack access to electricity and rely on biomass combustion for cooking, this technology could provide a sustainable and accessible solution [
6].
Biogas, also known as renewable natural gas (RNG), is obtained through anaerobic digestion, a process that converts organic waste into a clean and reliable energy source. Unlike other renewable energies, its production does not depend on climatic conditions, making it a viable alternative for cooking, lighting, and heating [
7]. The use of this waste contributes significantly to the reduction in methane emissions, a greenhouse gas with a global warming potential greater than that of carbon dioxide. Furthermore, it enables the recycling of essential nutrients in agriculture, decreasing dependence on synthetic fertilizers and promoting more sustainable farming practices [
8].
Despite its great potential, optimizing biogas production still faces significant challenges. Traditionally, waste dosing in biodigesters has been carried out using empirical approaches, which can lead to inefficiencies in the conversion of organic matter into biogas. Various studies have developed predictive and optimization models to address this issue, highlighting substrate composition, pH, and temperature as key determinants [
9,
10].
Advances in artificial intelligence have improved model accuracy; however, their practical application remains limited due to regional variability and implementation challenges [
11]. Similarly, emerging technologies such as the Internet of Things (IoT) and machine learning have facilitated the real-time monitoring and adjustment of biodigester conditions. However, their high costs continue to be a barrier to large-scale adoption [
12].
Some studies have explored the use of pretreatment methods to enhance the degradation of lignocellulosic biomass, thereby increasing methane production. However, operational feasibility and associated costs remain key factors determining their scalability [
13]. These challenges highlight the need for more flexible and efficient models capable of adapting to different conditions and optimizing biogas production in a comprehensive manner [
14].
Recent advancements in optimization techniques have increasingly incorporated artificial intelligence (AI), Internet of Things (IoT), and hybrid models to enhance biogas production from organic waste. For instance, machine-learning algorithms, such as artificial neural networks (ANNs) and support vector machines (SVMs), have been employed to predict biogas yields with high accuracy by analyzing complex nonlinear relationships between input variables like substrate composition, pH, and temperature [
15,
16,
17]. Additionally, IoT-based systems have enabled the real-time monitoring and control of anaerobic digestion processes, improving operational efficiency and reducing manual intervention [
18,
19]. Hybrid models combining mechanistic approaches with data-driven techniques have also shown promise in addressing the limitations of traditional models, particularly in handling regional variability and dynamic operational conditions [
20,
21]. However, despite these advancements, there remains a significant gap in integrating these technologies into scalable and cost-effective solutions, especially in resource-constrained settings such as rural areas in developing countries [
22].
Furthermore, while existing studies have demonstrated the potential of AI and IoT in optimizing biogas production, their practical implementation often faces challenges related to high initial costs, data scarcity, and the need for specialized expertise [
23]. For example, although IoT-enabled biodigesters can provide real-time data for process optimization, their deployment in remote areas is hindered by limited infrastructure and connectivity [
20]. Similarly, while hybrid models offer improved accuracy, their complexity often limits their applicability in real-world scenarios where simplicity and interpretability are crucial [
17]. These limitations underscore the need for a more practical and adaptable optimization framework that can bridge the gap between advanced computational techniques and on-the-ground implementation.
This study seeks to address this need by developing a linear optimization model with nonlinear constraints. The proposed model integrates critical variables such as pH, humidity, C/N ratio, organic matter, volatile solids, and biogas production potential for different types of waste. Its objective is to estimate the optimal quantities of organic waste based on their composition to maximize biogas production within a defined biodigester capacity. Through this systematic approach, this study aims to bridge the gap between theoretical optimization and practical application in rural and agricultural contexts, offering an efficient tool for sustainable organic waste management and renewable energy generation.
2. Materials and Methods
The development of an optimization model for biogas production requires a detailed understanding of the properties of the organic waste involved in the process. For this reason, the methodology began with a structured data collection process aimed at identifying and characterizing the most representative waste in rural environments, allowing for the creation of a solid information base that accurately reflects the real conditions under which anaerobic digestion takes place.
The selection of waste was not arbitrary but the result of an analysis based on its availability in agricultural communities and its impact on the fermentation process. To achieve this, previous scientific studies and technical reports containing results from analytical, mathematical, and experimental processes were reviewed to ensure the reliability of the values used in the proposed model. Additionally, essential aspects such as the pH, moisture content, total and volatile solids, carbon/nitrogen ratio, and biogas production potential were considered, as these elements directly influence the stability and efficiency of the system by regulating microbial activity within the biodigester.
The collected information was systematically organized to facilitate interpretation, prioritizing the most representative data in Tables 1 and 5 to avoid redundancy. Based on this information, the input parameters for the optimization model were established. At this stage, it was essential to identify the variables with the greatest influence on biogas production and define the operational constraints that ensured a balance between stability and performance. Anaerobic digestion is highly sensitive to variations in substrate composition, so setting appropriate limits helped to minimize the risk of inhibition and ensure optimal process conditions.
The mathematical formulation of the model employed a linear optimization method with nonlinear constraints, aiming to precisely define the interactions between different factors within the suggested parameter ranges. This approach allowed the development of a tool capable of realistically representing the complexity of the biological process. To assess the robustness of the model under varying operational conditions, a sensitivity analysis based on the Monte Carlo method was implemented. This made it possible to quantify the impact of parameter variability on the volume of biogas generated, providing a detailed perspective on the system’s response under different scenarios.
Finally, the simulation results were analyzed in terms of their applicability to real-world environments, evaluating the model’s ability to optimize biogas production according to substrate composition.
2.1. Biogas Production from Organic Waste: An Overview
The production of biogas from organic waste represents a sustainable alternative for waste management and renewable energy generation. This process is based on the anaerobic decomposition of biomass, where specialized microorganisms break down organic matter in the absence of oxygen, releasing biogas as the main product. Biogas is composed of methane (CH
4), carbon dioxide (CO
2), carbon monoxide (CO), nitrogen gas (N
2), and hydrogen sulfide (H
2S), along with small amounts of hydrogen (H
2) and ammonia gas (NH₃) [
24].
Biodigesters, devices designed to regulate this process, optimize biogas production from various waste sources, such as food waste, animal manure, and agricultural residues [
6]. In rural areas, where access to conventional energy sources may be limited, the valorization of these wastes through anaerobic digestion not only helps to reduce environmental pollution but also promotes the utilization of a local, renewable, and reliable energy resource [
25].
Beyond its energy function, biogas production provides significant environmental and economic benefits. On one hand, capturing and utilizing the methane generated by waste decomposition reduces the emission of this greenhouse gas, whose impact on global warming is significantly higher than that of carbon dioxide [
26]. On the other hand, digestate, the byproduct of the anaerobic digestion process, is rich in nutrients and can be used as organic fertilizer, reducing the need for chemical inputs in agriculture [
27].
Among the main sources of organic waste used in biogas production are food waste, animal manure, and agricultural residues [
28]. In countries with strong agricultural activity, such as Colombia, the utilization of these residues represents a significant opportunity for transitioning toward more sustainable and self-sufficient energy systems. In this study, the proposed model focuses on the most common types of waste in rural settings, considering the availability of these materials and their impact on biogas production.
2.2. Data Collection
The development of the optimization model for biogas production is based on a rigorous data collection process that enables the characterization of organic waste and the establishment of realistic conditions for its utilization in anaerobic digestion. This data-gathering process is essential to ensure that the model reflects operational conditions applicable in rural settings rather than being limited to theoretical approximations.
The selection of waste types considered in this study is based on their availability in agricultural communities and their impact on biogas production. To achieve this, bibliographic sources and experimental databases documenting the physicochemical properties of different types of waste were consulted. Priority was given to the characterization of the most common waste in rural areas, such as animal manure, food waste, and certain agricultural residues. These waste types not only have high availability but also exhibit favorable characteristics for anaerobic digestion, such as an adequate volatile solids content and an optimal carbon/nitrogen (C/N) ratio for microbial activity [
29].
One of the fundamental aspects of data collection was determining the substrate volume within the biodigester. It was considered that the biodigester should not be filled to total capacity, as space must be reserved for the accumulation of the produced biogas. In most practical applications, it is recommended that the substrate occupies between 60% and 75% of the total capacity, leaving the remaining 25% to 40% as gas storage space [
30]. This proportion prevents overpressure generation, which could compromise the biodigester’s structure and reduce process efficiency. For this study, a standard filling value of 70% with substrate was adopted [
31].
Additionally, operational factors influencing process efficiency were considered, such as the need for substrate agitation and the hydraulic retention time (HRT). It is recommended to incorporate an agitation system, either manual or mechanical, to ensure a homogeneous distribution of nutrients and microorganisms within the biodigester. Agitation also prevents the formation of surface crusts and improves the conversion of organic matter into biogas [
7]. On the other hand, HRT defines the time required for complete substrate degradation inside the biodigester, and under optimal conditions, it varies between 20 and 40 days, depending on the substrate composition and operating temperature [
32].
The volume and composition of the produced biogas are determined by multiple factors, including the nature of the substrate used and the operating conditions of the biodigester. Studies have documented that waste with high carbohydrate and protein content generates larger biogas volumes, while those with a high proportion of lignin or cellulose can hinder anaerobic degradation and reduce process efficiency [
33]. To facilitate the estimation of the required substrate volume based on the weight of available waste,
Table 1 presents the average densities of the most common animal, food, and agricultural waste types found in rural settings [
34]. It is important to clarify that the density values reported correspond to bulk density, which represents the density of loosely stacked material rather than real or particle density.
Based on the collected information, input parameters were established to serve as the foundation for formulating the optimization model, ensuring that each variable accurately reflects real operational conditions and maximizes the efficiency of the biogas production process.
2.3. Input Parameters
Biogas production through anaerobic digestion is a continuously evolving research field, and numerous studies have explored the optimization of substrate mixtures to maximize its generation. The incorporation of animal manure into these mixtures is a widely used practice due to its high concentration of organic matter and the presence of microorganisms that can enhance the efficiency of the anaerobic digestion process.
When integrated into the mixture, animal manure plays a crucial role as an inoculum, as it contains an abundant community of methanogenic microorganisms that facilitate the decomposition of organic matter and biogas production. Although other residues, such as those rich in fats or carbohydrates, may have a higher energy potential, manure acts as a biological catalyst that helps to stabilize the process.
Moreover, the carbon/nitrogen (C/N) ratio is one of the key factors influencing anaerobic digestion efficiency. An optimal C/N ratio generally ranges between 20:1 and 30:1, as methanogenic bacteria require a balanced supply of carbon and nitrogen for their growth and metabolic activity. An imbalance in this ratio can slow down or even inhibit biogas production. In this context, animal manure typically presents a lower C/N ratio compared to other residues, such as fruit and vegetable waste, which have a higher carbon content. Therefore, incorporating manure in small proportions within the substrate mixture can help to regulate this ratio and improve the performance of the anaerobic digestion process.
Although there is no absolute consensus on the ideal proportion of animal manure in substrate mixtures, various studies have demonstrated that including around 20% not only optimizes biogas production but also stabilizes the process by creating a favorable environment for microbial activity and the efficient utilization of organic waste. This is because manure provides essential nutrients and active microorganisms that facilitate anaerobic co-digestion. However, the optimal proportion may vary depending on the type of substrate and the specific conditions of the biodigester.
In this regard, several studies have analyzed the influence of animal manure on biogas production. In [
35], the combination of agricultural waste with cow manure was investigated, and the results indicated that including 20 to 30% manure significantly enhanced biogas production, attributing this effect to nutrient balance and the presence of beneficial microorganisms in the manure. Similarly, in [
36], different combinations of pig manure and crop residues were evaluated, finding that a 20% manure proportion maximized methane production due to high microbial activity and a well-balanced carbon/nitrogen ratio. Additionally, in [
32], the effect of different proportions of cow manure in the anaerobic digestion of organic waste was examined, revealing that a 20 to 25% proportion improved process stability and increased biogas production, highlighting manure’s role not only as a microbial source but also as a regulator of biodigester conditions. Finally, in [
37], the co-digestion of cow manure with plant residues was investigated, concluding that a mixture containing 20% manure provided an optimal balance of nutrients and microorganisms, resulting in a significant increase in biogas production and greater process efficiency.
In line with the previously discussed aspects, the proposed model considered the possibility of combining manure from different species with other organic residues, such as food scraps or agricultural waste, to adjust the C/N ratio of the overall mixture, improve digestion process stability, and maximize biogas production [
38]. Manure from certain species with a low C/N ratio, such as poultry manure, can cause acidification in the medium, making it necessary to incorporate residues that help to regulate pH and keep it within an optimal range to ensure efficient biogas production [
28]. Some types of manure, such as bovine or horse manure, have a high fiber content, which can slow down decomposition, although they also contribute to process stability. On the other hand, manure with a more liquid texture, such as pig manure, promotes rapid biogas production but requires adjustments in the mixture to prevent excessive moisture.
Below are some of the most outstanding factors in the mixture of organic waste for biogas production [
23]:
% Moisture: This is the percentage of water present in the residue. This parameter influences the fluidity of the substrate and its ability to mix properly within the digester. Ideally, it should be maintained between 50% and 60% to ensure an efficient process. Manures with a high moisture content (such as pig manure) may require the addition of dry material to balance the mixture and optimize biogas production.
% Total Solids (TS): TS corresponds to the amount of residue that is not water (100%–% moisture). Higher TS values, such as those found in chicken manure, indicate that water or dilution may be required to facilitate anaerobic digestion.
C/N (Carbon/Nitrogen) Ratio: The C/N ratio is a critical factor for the activity of anaerobic bacteria. An optimal ratio typically ranges between 20:1 and 30:1, ensuring microbial balance and efficient biogas production.
% Organic Matter (OM): OM refers to the proportion of organic matter within the total solids that can be decomposed by anaerobic bacteria. A higher organic matter content enhances the efficiency of biogas production.
% Volatile Solids (VS): VS represents the fraction of organic matter that can be converted into biogas during anaerobic digestion. This is an important parameter for estimating the potential biogas yield from each type of waste. Higher VS values indicate greater biogas production potential.
Biogas Produced (BP): BP represents the total amount of biogas generated from organic solid waste, expressed in . It is calculated as the product of the amount of VS [kg] and the biogas production potential (PP) specific to each type of waste [/kg].
A comparison is presented in
Table 1 of the factors most outstanding for the production of biogas in various types of organic waste—information considered very useful and which is directly related to the estimation of the coefficients of the optimization model proposed to maximize biogas production.
Table 1.
Comparison of factors most outstanding in manure of different species, food, and agricultural waste [
28,
30,
35,
36,
37,
39,
40,
41,
42,
43,
44].
Table 1.
Comparison of factors most outstanding in manure of different species, food, and agricultural waste [
28,
30,
35,
36,
37,
39,
40,
41,
42,
43,
44].
Species | Density (kg/L) | pH | Buffering Capacity (High, Medium, Low) | % Moisture | % Total Solids | C/N Ratio | % Organic Matter | % Volatile Solids (VS) | Other Important Aspects |
---|
Bovine | 0.65–0.75 | 6.5–7.5 | High | 85–88% | 12–15% | 18–25:1 | 75–80% | 70–75% | Contains high fiber, slow decomposition. Ideal for continuous flow biodigesters. |
Pig | 0.60–0.70 | 6.0–7.0 | Average | 88–92% | 8–10% | 10–14:1 | 85–90% | 80–85% | High concentration of nutrients and liquids, excellent for biogas production due to its rapid decomposition. |
Hen/chicken | 0.50–0.60 | 6.2–7.4 | Average | 70–75% | 25–30% | 6–10:1 | 60–65% | 55–60% | High nitrogen content, requires mixing with other waste to improve the C/N ratio. |
Horse | 0.70–0.80 | 6.5–7.5 | High | 75–80% | 20–25% | 20–30:1 | 60–65% | 55–60% | Manure with a high fiber content and low liquid content, useful as a complement in biodigesters. |
Sheep | 0.65–0.75 | 6.8–7.6 | High | 65–70% | 30–35% | 16–18:1 | 55–60% | 50–55% | Rapid decomposition, good option for mixtures with drier waste. |
Rabbit | 0.55–0.65 | 6.3–7.3 | Average | 65–70% | 30–35% | 10–12:1 | 50–55% | 45–50% | Small manure with high nitrogen content, excellent for biogas but requires dilution. |
Goat | 0.60–0.70 | 6.8–7.6 | High | 70–75% | 25–30% | 14–16:1 | 50–55% | 50–55% | Similar to sheep manure, but with a lower liquid content. |
Duck/goose | 0.55–0.65 | 6.0–7.0 | Average | 80–85% | 15–20% | 8–12:1 | 60–65% | 55–60% | Contains high moisture and nitrogen, requires adjustment of the pH and C/N ratio. |
Fruit remains (peels) | 0.40–0.60 | 4.0–5.5 | Low | 80–90% | 10–20% | 35:1–40:1 | 90–95% | 85–90% | High sugar content, rapid degradation. High carbon content, excellent for mixing with nitrogen-rich manure. Provides stability in anaerobic digestion. |
Vegetable waste | 0.50–0.80 | 5.5–7.0 | Average | 80–90% | 10–20% | 12:1–20:1 | 85–90% | 80–85% | High moisture, good nitrogen supply. Good carbon source, ideal for adjusting the C/N ratio in combination with these animals. |
Cereal crop residues (straw) | 0.12–0.15 | 6.0–7.0 | Average | 50–70% | 30–50% | 60:1–80:1 | 70–80% | 60–70% | High proportion of cellulose and lignin, slow degradation. Very high in carbon, requires combination with nitrogen-rich residues to avoid inhibiting digestion. |
Potato peels | 0.55–0.65 | 6.0–7.0 | Average | 75–85% | 15–25% | 20:1–25:1 | 80–85% | 75–80% | Rich in starches, moderately high in carbon, good for adjusting the C/N ratio when combined with more nitrogen-rich residues. |
Egg shells | 0.60–0.70 | 7.0–8.0 | High | 5–10% | 90–95% | 2:1–5:1 | 30–40% | 10–20% | Rich in calcium, low anaerobic digestibility. |
Coffee grounds (coffee residue) | 0.55–0.65 | 4.5–6.0 | Low | 50–60% | 40–50% | 20:1–25:1 | 80–85% | 75–80% | Contains lignin, a potential inhibitor in high quantities. C/N ratio close to ideal, favors biogas production but requires adjustment with other waste to avoid acidification. |
Corn residues (leaves, stalks) | 0.12–0.25 | 6.0–7.5 | Average | 50–70% | 30–50% | 40:1–60:1 | 65–75% | 60–70% | High cellulose content, slow degradation. High carbon content, needs to be mixed with nitrogen-rich waste to balance methane production. |
Old bread/bread scraps | 0.35–0.45 | 5.0–6.5 | Low | 30–40% | 60–70% | 20:1–30:1 | 85–90% | 80–85% | High carbohydrate content, rapid degradation. Good C/N ratio, provides sufficient carbon to stabilize anaerobic digestion. |
Nut and seed shells | 0.25–0.35 | 5.5–6.5 | Low | 5–10% | 90–95% | 80:1–100:1 | 40–50% | 30–40% | Contains lignin and fats, which are slow to degrade. High levels of carbon, and must be combined with nitrogen-rich waste to obtain an adequate balance. |
Leftover cooked rice | 0.75–0.85 | 6.0–7.0 | Average | 50–60% | 40–50% | 15:1–20:1 | 85–90% | 80–85% | High carbohydrate content, good degradation. Low carbon ratio, excellent for improving anaerobic digestion efficiency when mixed with more fibrous materials. |
Leftover cooked vegetables | 0.60–0.75 | 6.0–7.5 | Average | 75–85% | 15–25% | 10:1–15:1 | 85–90% | 80–85% | High nitrogen content, good degradation. Low carbon content, needs to be mixed with carbon-rich materials to avoid acidification of the biodigester. |
Vegetable oils and fats | 0.80–0.90 | 6.0–6.5 | Low | 0–2% | 98–100% | 20–30:1 | 95–99% | 95–99% | High energy concentration improves biogas production. Its low moisture content requires mixing with wetter waste. |
Pasta (cooked) | 0.65–0.75 | 5.5–6.5 | Average | 50–55% | 45–50% | 15–20:1 | 85–90% | 80–85% | Rapid degradation, ideal for co-digestion to balance acidity. Can generate volatile fatty acids if not well controlled. |
Leaves and plant remains | 0.10–0.20 | 6.5–7.0 | High | 60–75% | 25–40% | 30–60:1 | 75–85% | 65–75% | They contain cellulose and lignin, which can slow down digestion. They provide structure to the mixture. Pretreatment recommended to improve biodegradation. |
2.3.1. Critical Parameter Control
There are some suggested methods for adding certain types of waste of a specific nature through which it is possible to achieve certain levels of control in parameters of great importance during the biogas production process such as the C/N ratio, pH, moisture, temperature, and odor, specifically.
Table 2 below describes these methods.
2.3.2. Proposed Methodology for Estimating pH in a Mixture of Organic Waste
To estimate the approximate pH value of a waste mixture, a common technique can be used which consists of weighting the pH values of each waste by its buffering capacity and its proportion in the mixture [
8]. Although this methodology does not offer absolute accuracy due to the inherent complexity of the acid–base behavior of waste, it can provide a useful estimate to predict the pH of the mixture under real conditions. It is important to note that the acid–base interaction between waste is not linear, as it depends on factors such as the concentration of hydrogen ions in solution, the presence of buffer substances, and possible chemical reactions that occur during anaerobic digestion [
40]. Despite these limitations, this approach can be a practical tool in planning anaerobic digestion processes and biogas production.
Table 1 presents the average pH values and buffering capacity for the different types of animal, food, and agricultural waste most common in rural environments as factors of great influence in the anaerobic digestion process and biogas production according to the proposed model.
Animal waste, such as cattle, goat, sheep, and horse manure, has a high buffering capacity, which helps to maintain a relatively stable pH during the anaerobic digestion process. This stability is crucial to create optimal conditions for biogas production, as the process requires a pH close to neutrality (between 6.5 and 7.5). In contrast, food and agricultural waste, such as fruit peels, coffee grounds, and stale bread, tends to be more acidic and have a low buffering capacity [
49]. This can cause a decrease in the pH of the system, increasing the risk of acidification that inhibits the activity of the methanogenic bacteria responsible for biogas production. For this reason, it is necessary to adjust the pH by adding materials with a higher buffering capacity, such as calcium carbonate or ash, to avoid imbalances that affect the efficiency of the process.
The proposed procedure to estimate the pH in the mixture is as follows:
Assign a weighting factor to the damping capacity (CA) according to the values established in
Table 3 [
13].
To calculate the average
pH (
) of the waste mixture, a method based on the hydrogen ion concentration
is used, since the
pH follows a logarithmic scale and cannot be calculated by an arithmetic average. In addition, some wastes exhibit a higher buffering capacity (
CA) of each waste, which means that they can significantly influence the final pH of the mixture. pH is defined as follows [
13]:
where the hydrogen ion concentration
is obtained as
For this particular case, the average concentration of hydrogen ions is calculated by weighting the buffering capacity
and the weight in the mixture of each waste, according to the following expression [
32]:
Allowing the average pH to be calculated as
where
In order to understand the proposed methodology, the following example will be solved: It is desired to calculate the pH of a mixture composed of the following types of waste and its weight in kg.
Waste Used:
20 kg of bovine manure;
10 kg of pig manure;
5 kg of fruit peels;
8 kg of vegetable waste;
5 kg of eggshells;
2 kg of coffee grounds.
Table 4 summarizes the values established for each type of waste in the mixture, for calculating the
.
The result obtained in the example using the weighted methodology for estimating the pH in the mixture was 6.03, which is slightly below the optimal range for biogas production (6.5–7.5). This indicates a mildly acidic environment that could affect the efficiency of methanogenic bacteria. Maintaining the pH within this optimal range is essential to maximize microbial activity and biogas yield. Given that the estimated pH falls outside this range, it would be necessary to incorporate waste with a high buffering capacity, such as animal manure or calcium carbonate, to neutralize excess acidity and stabilize the pH. This adjustment would help to create favorable conditions for anaerobic digestion, ensuring a more efficient biogas production process.
2.4. Definition of the Model to Estimate Biogas Production
2.4.1. Biogas Production Calculation
Biogas production can be preliminarily calculated based on empirically established average values related to the biomass composition and conversion efficiency of each type of waste using the biogas production potential [
/kg]. Through this, it is possible to estimate the amount of biogas expressed in
that can be produced for each kilogram of volatile solids (VS) of biomass [
50].
Table 5 presents a consolidated range of average values that have been established by various studies mainly for certain types of animal, food, and agricultural waste. Additionally, some relevant aspects related to the characteristics of the waste and their impact on the biogas production process are included, such as the fiber, protein, or carbohydrate content, which may reflect dynamic behavior depending on the specific conditions of the biodigester and the efficiency of the process.
The general equation for estimating the total biogas production
is given by the following expression:
where
biogas production potential of component i [m3/kg].
weight of volatile solids (VS) component i in the mixture, expressed in [kg].
can be calculated from the following expression:
where
total solid fraction of waste i.
organic matter fraction of the residue i.
volatile solids fraction of the waste i.
: weight in kg of the residue i [kg].
2.4.2. Proposed Optimization Model
This paper proposes the design of a Linear Programming model with Nonlinear Constraints as a strategy for solving the proposed problem. The objective of the model is to optimize , subject to a set of constraints that include both linear and nonlinear constraints, represented mathematically as follows:
Objective function:
where
represents the maximum amount of biogas that is desired to be obtained, expressed in [m3].
is the contribution in of biogas produced by the amount of of waste i, where .
corresponds to the coefficients related to the volatile solids (VS) component in the mixture and the biogas production potential for waste i. The value of the coefficients can be calculated from the following mathematical expression:
refers the weight in [kg] of each type of waste i required in the mixture to maximize biogas production in the proposed model. Additionally, represents the decision variables that must be optimized in the proposed model.
is the number of residues in the mixture.
The values corresponding to the coefficients
are presented in
Table 6, based on the proportions related to moisture, total solids, organic matter, volatile solids, and biogas production potential for different types of animal, food, and agricultural waste commonly found in rural environments, according to the proposed model.
Linear constraints: Linear constraints are expressed as inequalities of the following form:
where
is a matrix of coefficients of linear constraints and
is a vector defining the upper bounds for these constraints.
For the proposed model, it must be taken into account that the weights for the waste that can be used for biogas production comply with the following linear restrictions:
Additionally, the volume of the total substrate must be less than or equal to 70% of the volume of the biodigester (
). For the model, the volume occupied by each type of waste was calculated using the quotient between the weight (
) and the density (
) of each one. Thus, the following restriction was established:
If animal waste is available, and in line with previous recommendations on the importance of incorporating at least 20% of feces in the mixture to ensure a proper balance of nutrients and microorganisms during biogas production, the proposed mathematical model includes an additional constraint. This constraint establishes that the total volume of animal waste must represent at least 20% of the total, with
k = 8 corresponding to the total number of animal waste types considered in the model, as expressed in the following constraint:
Nonlinear constraints: Nonlinear constraints involve expressions modeled as nonlinear functions that must satisfy inequality () or equality () conditions, where represents the nonlinear function in the j-th constraint. The following nonlinear constraints were established for the proposed model:
- a.
Control restrictions based on the C/N ratio for waste mixing: For the proposed model, calculating the carbon/nitrogen (C/N) ratio in the total mixture is an essential factor to ensure that the biodigester operates efficiently and maximizes biogas production. To estimate the resulting C/N value in the mixture, the carbon (C) and nitrogen (N) contents of each biomass component (organic waste, animal waste, etc.) and their proportions in the mixture must be known. The mathematical expression that allows us to calculate the C/N ratio of the mixture is as follows:
Considering that the ideal C/N ratio for efficient anaerobic digestion should be between 20:1 and 30:1, then the following restrictions are defined:
Therefore, for the control of the (C/N) ratio the results are as follows:
- b.
Control restrictions based on the average pH of the mixture: Starting from the expression for the average pH, we obtain that
Considering that the ideal pH range for efficient anaerobic digestion must be between 6.5 and 7.5, then the following restrictions are defined:
Therefore, the constraints for controlling the resulting average pH are as follows:
- c.
Control restrictions based on the average moisture content of the mixture: Moisture in the biodigester is essential for the microorganisms that decompose organic matter to function properly. Considering that the ideal range of moisture percentage for efficient anaerobic digestion should be between 50 and 60, then the following restrictions are defined:
Therefore, the restrictions for controlling the percentage of moisture in the resulting mixture, based on the weight and percentage of moisture of each waste, are as follows:
2.4.3. Computational Implementation and Optimization Algorithm for Maximizing Biogas Production
The proposed optimization model was implemented in Python 3.12, using the numpy library for numerical computations and SciPy.optimize to solve the constrained nonlinear optimization problem. Specifically, the minimize function from SciPy.optimize was employed to determine the optimal combination of organic waste that maximizes biogas production while satisfying the imposed constraints on pH, C/N ratio, and moisture content.
The algorithm 1 follows a systematic approach where a binary vector is used to indicate the availability of different waste types, enabling a flexible and adaptable selection of input materials. The optimization function iteratively adjusts the waste proportions to maximize biogas yield, subject to operational and biochemical constraints. Additionally, nonlinear constraints were incorporated to maintain critical parameters within acceptable ranges, preventing unfavorable conditions for anaerobic digestion.
To evaluate the robustness of the model, a sensitivity analysis was conducted using the Monte Carlo method using this same programming language, where 1000 simulations per scenario were executed. This process involved randomly varying important input parameters including biogas production potential, pH, and organic matter content within their established minimum and maximum ranges. This approach allowed for a probabilistic evaluation of how variations in waste composition influence biogas yield, ensuring that the model remains applicable under real-world conditions.
The selection of Python as the computational framework was driven by its flexibility, efficiency, and extensive adoption in scientific research. Its open-source nature promotes transparency and reproducibility, facilitating future adaptations and refinements. By structuring the model with explicitly defined variables, constraints, and assumptions, the proposed approach ensures accessibility for researchers and practitioners seeking to optimize biogas production in diverse operational environments.
This model considers the availability of various types of waste and integrates a set of previously described restrictions, which reflect the most important physical–chemical properties that significantly affect biogas production, seeking to establish optimal conditions for the anaerobic fermentation of the substrate.
The initial parameters of the model include the total capacity of the biodigester, which was set at 160 L for the proposed scenarios. Of this volume, 70% is assumed to be the maximum limit for the substrate. The model also incorporates a binary availability vector, where a value of 1 indicates the presence of a specific waste and 0 its absence, in accordance with the general relationship of the proposed design. This vector allows the filtering of the physical–chemical characteristics considered in the calculations, such as the pH, C/N ratio, moisture percentage, and biogas production coefficients, among others, providing flexibility to the model and facilitating its adaptation to any combination of waste in specific contexts. This structure optimizes the biogas maximization process by adapting to different waste configurations.
Table 7 presents the average values of the physical–chemical properties integrated in the proposed model for the most common types of waste in rural environments.
The objective function of the proposed model is defined as the sum of the contributions of each waste to biogas production, using the average coefficients specific for each type of waste. To maximize the total biogas production, the objective function is formulated with a negative sign, since the minimize function of SciPy.optimize is used to solve the model. In addition, multiple linear and nonlinear constraints were implemented with the aim of controlling physical–chemical factors within the optimal limits recommended to maximize biogas production based on the amount of waste. These constraints include the following:
pH Restrictions: Maintain the average pH of the substrate between 6.5 and 7.5, the ideal range for microbiological activity.
C/N Ratio: Establish a carbon/nitrogen ratio between 20 and 30, in order to maximize biogas production and minimize the formation of inhibitory compounds.
Moisture: Control the moisture percentage so that it remains within the optimal range between 50% and 60%.
Substrate Volume Restriction: Limit the volume of the substrate to 70% of the total capacity of the biodigester, ensuring sufficient space for the biogas generated.
As a result of the analysis carried out and articulating the various factors mentioned above that significantly influence biogas production, Algorithm 1 developed for the proposed model is as follows.
Algorithm 1. Optimization algorithm for maximizing biogas production |
Input: Biodigester capacity,
Waste availability vector (1 if available, 0 if not available) Biogas production parameters, density, pH, moisture, and C/N for each waste pH, C/N, and moisture limits: , , , , , Allowed proportion of animal waste: 20% of
Output: Optimal amounts of each waste [kg] Optimized average values of pH, C/N, moisture, and substrate volume
Define target substrate volume: Initialize biogas production coefficients for available waste: Formulate the objective function: Define nonlinear constraints for mixture parameters: Average pH: Average C/N ratio: Average moisture: Allowed volume of animal waste:
Start linear constraints for total substrate volume: Set variable limits: x Run optimization: Calculate parameters of the optimized substrate: Show results: estimated
|
2.5. Monte Carlo Analysis
Sensitivity analysis is a fundamental tool for assessing the stability and reliability of mathematical models in biogas production, especially when input parameters exhibit inherent variations [
53]. In this study, the Monte Carlo method was employed, a widely used statistical simulation technique for modeling complex systems, which allows us to quantify the impact of parameter variability on the volume of biogas generated.
For the implementation of this analysis, the optimal substrate composition values obtained from the optimization model were used as a baseline. Based on these values, 1000 simulations were performed for each proposed scenario, assigning random values within the established minimum and maximum ranges for key parameters such as the pH, carbon/nitrogen (C/N) ratio, moisture percentage, biogas potential coefficients, and waste densities.
This approach enabled not only the identification of the most probable biogas production values but also an analysis of the system’s sensitivity to fluctuations in operating conditions. In particular, the study evaluated how small variations in input parameters could influence biogas production, providing a broader perspective on the robustness of the model. Additionally, the Monte Carlo method allowed for the generation of statistical distributions of the results, facilitating the interpretation of the uncertainty associated with each scenario.
The results obtained helped us to determine the variability of the biogas volume produced as a function of parameter uncertainty, which aids in understanding which factors have the greatest impact on the process. This type of analysis is crucial for decision-making, as it allows the anticipation of potential fluctuations in biogas production and the design of strategies to minimize adverse effects.
To illustrate the findings, graphical representations such as histograms and box plots are presented, allowing for a clear visualization of data dispersion and system stability. These results provide a solid reference framework for validating the model’s applicability under real operating conditions and highlighting its ability to adapt to different scenarios without compromising process efficiency.
3. Results
3.1. Proposed Scenarios
This section presents two proposed scenarios in order to evaluate the effectiveness of the optimization model to maximize biogas production that was developed in Python. Each scenario simulates a configuration of available organic waste using a binary availability vector, where a value of “1” indicates the presence of waste in the biodigester and a value of “0” its absence. The model takes into account the capacity of the biodigester, the specific coefficients of each waste for biogas production, and the optimized physical–chemical constraints for each mixture. The specific configuration for each of the scenarios is presented below, accompanied by the results obtained in the model, evaluating the values obtained by the objective function and the physical–chemical parameters related to the resulting substrate for the anaerobic fermentation process.
Scenario 1:Binary Availability Vector (1 If The Residue Is Available, 0 If Not) | Optimization Result Obtained |
availability = { ‘Bovine’: 0, ‘Pig’: 1, ‘Hen/chicken’: 0, ‘Horse’: 0, ‘Sheep’: 0, ‘Rabbit’: 0, ‘Goat’: 0, ‘Duck/goose’: 0, ‘Fruit remains (peels)’: 1, ‘Vegetable waste’: 1, ‘Cereal crop residues (straw)’: 0, ‘Potato peels’: 1, ‘Eggshells’: 1, ‘Coffee residue’: 0, ‘Corn residues (leaves, stalks)’: 0, ‘Stale bread/bread scraps’: 1, ‘Nut and seed shells’: 0, ‘Leftover cooked rice’: 1, ‘Cooked vegetable leftovers’: 1, ‘Vegetable oils and fats’: 0, ‘Pasta’: 0, ‘Leaves and plant remains’: 1 } | Bovine: 0.00 kg Pork: 14.56 kg Chicken: 0.00 kg Horse: 0.00 kg Sheep: 0.00 kg Rabbit: 0.00 kg Goat: 0.00 kg Duck/goose: 0.00 kg Fruit remains (peels): 0.00 kg Vegetable waste: 0.00 kg Cereal crop residues (straw): 0.00 kg Potato peels: 0.00 kg Eggshells: 5.38 kg Coffee grounds: 0.00 kg Corn residues (leaves, stalks): 0.00 kg Stale bread/bread scraps: 6.56 kg Nut and seed shells: 0.00 kg Leftover cooked rice: 9.88 kg Cooked vegetable scraps: 0.00 kg Vegetable oils and fats: 0.00 kg Pasta: 0.00 kg Leaves and plant remains: 7.89 kg
Average pH: 6.5 C/N ratio avg: 20.00 Average moisture: 60.00
Maximum substrate volume in [L]: 112.0 Estimated substrate volume in [L]: 112.00 Value of the objective function in [L]: 3418.67 Value of the objective function in [m3]: 3.42 |
In the first scenario, a condition of limited waste availability was considered, mainly fruit scraps, cooked vegetables, cooked rice, egg, and potato peels, as well as pig manure. These wastes were selected due to their relative accessibility in rural environments and their average biogas production characteristics. As a result of the optimization process in the first scenario, a notable load recommendation was obtained for pig waste (14.56 kg), egg shells (5.38 kg), leftover cooked rice (9.88 kg), bread scraps (6.56 kg), and leaves and plant remains (7.89), prioritizing those that, due to their characteristics, maximize methane generation and facilitate a homogeneous substrate composition.
The results related to the control parameters obtained in this scenario showed a pH of 6.5, a C/N ratio of 20.00, and a moisture level of 60.00%, values that are within the optimal ranges for microbiological activity in anaerobic digestion and minimize the formation of inhibitors, which favors a continuous methane production process. In turn, the optimization model predicts an estimated biogas volume of 3418.67 L (3.42 m3), reflecting a moderate production efficiency compared to the total substrate volume. This result suggests that, although the selected wastes are suitable, the absence of certain wastes with high biogas production, such as bovine waste or uncooked vegetables, limit the maximum performance. However, the scenario provides a viable context for biodigesters in areas where waste availability is variable or limited.
Scenario 2:Binary Availability Vector (1 If The Residue Is Available, 0 If Not) | Optimization Result Obtained |
availability = { ‘Bovine’: 1, ‘Pig’: 0, ‘Hen/Chicken’: 0, ‘Horse’: 0, ‘Sheep’: 0, ‘Rabbit’: 0, ‘Goat’: 0, ‘Duck/goose’: 0, ‘Fruit remains (peels)’: 1, ‘Vegetable waste’: 1, ‘Cereal crop residues (straw)’: 1, ‘Potato peels’: 1, ‘Eggshells’: 0, ‘Coffee waste’: 1, ‘Corn residues (leaves, stalks)’: 0, ‘Stale bread/bread scraps’: 0, ‘Nut and seed shells’: 0, ‘Leftover cooked rice’: 1, ‘Cooked vegetable leftovers’: 1, ‘Vegetable oils and fats’: 0, ‘Pasta’: 1, ‘Leaves and plant remains’: 0 } | Bovine: 15.68 kg Pork: 0.00 kg Chicken: 0.00 kg Horse: 0.00 kg Sheep: 0.00 kg Rabbit: 0.00 kg Goat: 0.00 kg Duck/goose: 0.00 kg Fruit remains (peels): 0.00 kg Vegetable waste: 0.00 kg Cereal crop residues (straw): 2.36 kg Potato peels: 0.00 kg Eggshells: 0.00 kg Coffee grounds: 0.00 kg Corn residues (leaves, stalks): 0.00 kg Stale bread/bread scraps: 0.00 kg Nut and seed shells: 0.00 kg Leftover cooked rice: 48.30 kg Cooked vegetable scraps: 0.00 kg Vegetable oils and fats: 0.00 kg Pasta: 8.24 kg Leaves and plant remains: 0.00 kg
Average pH: 6.49 C/N ratio avg: 20.00 Average moisture: 60.95
Maximum substrate volume: 112.0 Estimated substrate volume: 112.00 Value of the objective function in [L]: 8061.43 Value of the objective function in [m3]: 8.06 |
The second scenario introduces a greater diversity of wastes, including cattle waste, cereal crops, fruit waste, potato peels, coffee grounds, and other cooked foods such as pasta and rice. This combination responds to the hypothesis that a greater diversity of substrates can increase biogas production, taking advantage of the different methane generation coefficients of each waste, while seeking to maintain the control parameters within the appropriate intervals.
The results of the optimization process in this scenario suggest a priority allocation to waste with high biogas production potential, such as bovine waste (15.68 kg) and pasta (8.24 kg), in addition to significant quantities of cooked rice (48.3 kg). These wastes were selected not only for their biogas production coefficients, but also because, when combined, they meet the optimal physical–chemical limits. The model managed to establish a combination of wastes that allows the estimation in the substrate of a pH of 6.49, a C/N ratio of 20.00, and a moisture of 60.95%, values that are ideal for maximizing methanogenesis by providing an environment conducive to microbiological activity, while limiting inhibition caused by acidic or ammoniacal compounds. This balance ensures a stable anaerobic environment, necessary to maximize methane production and reduce the risks of inhibition in the digestive process.
Additionally, the model predicts a biogas production of 8.06 m3 for the resulting substrate, highlighting a significant improvement in efficiency compared to the first scenario. This increase in biogas volume not only demonstrates the importance of diversifying the waste in the mix, but also highlights the model’s ability to select waste that is able to maximize production within the physical limits of the biodigester. The optimization performed in this scenario reflects how the availability of waste with a high methanogenic capacity increases the efficiency of the biodigester, making this combination a viable and efficient alternative in environments with greater access to a variety of organic waste.
3.2. Sensitivity Analysis for the Proposed Scenarios
The results obtained include detailed metrics of dispersion and central tendency, such as confidence intervals and quartiles, which support the interpretation of the potential effects of each variable on the expected biogas production.
Figure 1,
Figure 2,
Figure 3 and
Figure 4 present the histogram, most probable value, and box plots, accompanied by
Table 8 and
Table 9 that describe the statistical results of each of the parameters evaluated for Scenarios 1 and 2.
In Scenario 1, the sensitivity analysis applied to biogas production allowed us to evaluate the effects of variability in the input parameters (pH, % moisture, C/N ratio, and substrate volume) on the volume of biogas produced in liters, using the Monte Carlo method. The results show that the biogas volume has a most probable value of 3514.65 L, with a mean of 3444.91 L and a close median of 3460.83 L, indicating a symmetrical distribution of the variable. The standard deviation of 387.14 L reflects a significant variability, and the interquartile range (IQR) of 558.14 L confirms the dispersion of the data within the 95% confidence interval (3420.89 to 3468.94 L). This suggests that, in the evaluated scenario, biogas production is sensitive to variations in the input factors, with a relatively consistent central prediction around the mean values and a high dispersion in the extreme values.
The factors corresponding to pH, moisture, and the C/N ratio describe a low variability, reflecting stability and efficient control in the system. pH presents a most probable value of 6.63, with a close mean and median (6.68 and 6.67, respectively), with a standard deviation of 0.12, which shows that despite the fluctuations of the system, the pH tends to remain within a very narrow range. This behavior is also reflected in the 95% confidence interval (6.67 to 6.68), suggesting that pH variations have little influence on biogas performance in this context. Moisture describes a most probable value of 59.79% and a mean of 59.97%, reflecting a similar stability to pH, with an IQR of 1.79 and a confidence interval that is centered around stable values. On the other hand, the C/N ratio shows an equally stable and little dispersed behavior, with a most probable value of 20.97 and a close mean and median (20.01 and 20.03). Its IQR of 2.48 and low standard deviation of 1.65 reinforce the low sensitivity of this parameter to variability in process conditions, which is beneficial for uniformity in biogas production. Establishing a stable environment in relation to pH, moisture, and the C/N ratio is very favorable during the digestion process, since it avoids sudden variations that could negatively affect the efficiency of the anaerobic process.
However, the volume of the substrate shows a greater dispersion due to the variability that may be present in the density levels of each type of waste that is part of the substrate, reflecting a most probable value of 104.36 L and a mean of 113.74 L, thus reflecting its dynamic nature in the process. In turn, this parameter presents an IQR of 17.29 and a confidence interval of 113.06 to 114.43 L, which suggests that, although the volume of substrate has a greater dispersion, it continues to remain in a relatively stable range and in coherence with the restrictions established in the proposed model, in order not to exceed 70% of the volume of the biodigester.
In Scenario 2, the results describe specific variability patterns in each factor analyzed for biogas production, similar to those observed in Scenario 1, although with certain differences in the concentration and dispersion of values. For biogas volume, the most probable value is 8587.05 L, while the mean and median are 8067.2 and 8134.86 L, respectively. The greatest dispersion in this scenario is observed with a standard deviation of 1246.66 L and an IQR of 2056.59 L, indicating a relatively wide production range. However, the 95% confidence interval (7989.84 to 8144.56 L) suggests that most values are concentrated in a range higher than that of the first scenario, possibly due to the restrictions established in the proposed model in order to maintain control over the input factors.
For the factors of pH, moisture, C/N ratio, and substrate volume, their variability is low and their behavior is stable, ensuring a favorable environment for anaerobic digestion. pH remains in an optimal zone, with a most probable value of 6.65, mean of 6.59, and median of 6.60, along with an IQR of 0.29 and a narrow confidence interval (6.58 to 6.60), indicating stability in the process. Moisture also reflects slight variability, with a most probable value of 58.82%, a mean of 60.84%, and an IQR of 2.24%, suggesting a controlled impact on production. Similarly, the C/N ratio presents a most probable value of 19.63 and an IQR of 1.56, confirming that this factor has a stable influence on the process. Finally, the substrate volume is the most constant factor, with a most probable value of 110.49 L, mean of 112.29 L, and a tight confidence interval (112.12 to 112.46 L), which allows for greater precision in controlling the substrate used. The stability observed in this scenario reaffirms the effectiveness of the model in managing operational factors, favoring controlled and predictable biogas production.
4. Discussion
The selection of waste considered in Scenarios 1 and 2 is based on the availability and typical characteristics of organic waste generated in rural environments. This selection was made using a binary vector that reflects the presence or absence of certain types of waste in such contexts, ensuring that the proposed configurations are realistic and applicable. This methodology allows for modeling practical conditions, rather than relying solely on ideal scenarios that may lack viability in real situations.
In rural areas, the available waste often depends on local economic activities such as agriculture, livestock farming, and domestic food handling. In this sense, the waste selected for both scenarios includes those that are most representative in such environments, such as animal manure, kitchen scraps, and plant waste. These wastes are not only abundant and easily accessible, but also have physicochemical characteristics compatible with the anaerobic digestion process, such as a significant content of volatile solids and a composition suitable for adjusting critical parameters such as pH and the carbon/nitrogen (C/N) ratio.
The use of the binary vector as a selection criterion responds to the need to adapt the model to the specific conditions of each rural environment. For example, in communities where cattle farming predominates, it is common to find cow manure as one of the main inputs. On the other hand, in areas where pig farming is practiced, pig manure is more frequent, which explains its inclusion in certain scenarios. Likewise, kitchen and vegetable waste are constantly present in practically all rural households due to daily food preparation and the management of agricultural crops.
This selection strategy ensures that the waste considered is not only available in significant quantities, but also contributes to a more sustainable management of local waste. In addition, it allows identifying the most feasible waste combinations for each community, considering the capacity of the biodigester and the need to control critical factors such as humidity, odor generation, and the risk of acidification. This is especially important in environments where resources for managing biodigesters are limited, which underlines the relevance of designing mixtures that efficiently use available waste without requiring expensive or difficult-to-obtain external inputs.
Therefore, we could say that the selection of waste for Scenarios 1 and 2 is not arbitrary, but rather responds to a systematic approach that considers both the accessibility of the materials and their compatibility with the anaerobic digestion process. By modeling these conditions using the binary vector, it is ensured that the proposed configurations are practical, sustainable, and aligned with the reality of rural environments, thus promoting an effective implementation of the proposed model.
The results obtained demonstrate the model’s ability to capture the influence of various operational variables on biogas production. Sensitivity analysis using the Monte Carlo method allowed the variability in biogas production to be assessed based on fluctuations in critical parameters. In Scenario 1, biogas production showed a relatively symmetrical distribution with a mean of 3444.91 L and a 95% confidence interval between 3420.89 and 3468.94 L. In Scenario 2, the greater diversity of waste and its strategic combination allowed an average production of 8067.2 L to be achieved, with a confidence interval between 7989.84 and 8144.56 L.
These differences reflect the impact of the substrate composition and biogas production coefficients on biodigester performance. Additionally, the observed stability in parameters such as pH and the C/N ratio in both scenarios suggests that the model manages to maintain favorable conditions for anaerobic digestion, minimizing negative effects derived from fluctuations in the available waste.
These findings highlight the importance of using optimization approaches based on mathematical models, instead of relying exclusively on empirical methodologies, to maximize biogas production in scenarios with variability in waste availability.
The results obtained in this study illustrate the complex interaction between different types of organic waste during biogas production. Model optimization showed that waste with higher production coefficients, such as fruit waste and vegetable waste, plays a key role in maximizing biogas yield. Furthermore, sensitivity analysis using the Monte Carlo method showed that small variations in substrate composition can have a considerable impact on biogas production, thus highlighting the importance of careful waste selection. The average pH of the optimized substrate remained within the ideal range (6.5–7.5), suggesting that the combination of selected wastes favors an optimal environment for microbial activity. This finding aligns with previous research highlighting the relevance of an adequate balance in the C/N ratio for biogas production efficiency [
54].
The second scenario highlights the importance of considering a greater diversity of wastes, as the combination of different types of substrates allowed us to achieve a significantly higher biogas production, thus optimizing the efficiency of the biodigester. This finding suggests that, in future applications, the inclusion of a diverse set of wastes may be a key strategy to maximize the energy yield of biodigesters, benefiting both rural communities and industrial facilities. In this regard, the analysis of the effect of the C/N ratio revealed that an adequate proportion favors fermentation and methane production. The results of the sensitivity analysis underline that small variations in the waste ratio can drastically affect biogas production, corroborating previous findings indicating that an inadequate C/N balance can limit microbial activity and, therefore, the efficiency of the anaerobic digestion process [
55].
The comparative analysis of the two proposed scenarios reveals significant differences in biogas production, highlighting the impact of input conditions and the sensitivity of the system to certain parameters. In Scenario 2, biogas production is significantly higher, both in terms of probable and average value, generating a waste mix with better conditions for microbiological activity under optimized conditions. However, this production advantage also promotes greater variability, suggesting that the system is more susceptible to fluctuations in input parameters related to substrate composition and its nutrients. From a real-world perspective, the model predicts an increase in biogas production capacity, with the possibility of requiring constant monitoring of the digestion process as well as greater control over the inputs used, in order to maintain stability in the system.
Control parameters such as pH, moisture, and the C/N ratio exhibit relative stability in both scenarios, with minimal variations that highlight their role as controllable variables within the anaerobic digestion process. The low dispersion observed in these factors indicates that the system manages to maintain an adequate environment for the activity of methanogenic bacteria, even when there are changes in other parameters, such as substrate volume or moisture. This regulation capacity is an advantage of great importance for the design and scalability of the biodigester, since it ensures that microbiological activity remains within an optimal range, thus protecting biogas yield, even when other factors experience higher levels of fluctuation [
56]. Furthermore, since microbiological activity is sensitive to the balance between moisture and substrate composition, the observed values of the control parameters suggest robust efficiency in anaerobic digestion. This, in turn, could indicate the need to slightly adjust the water content in scenarios that seek to maximize production under more variable conditions, which is key to optimizing biogas yield.
The approach proposed in this study is distinguished by its ability to comprehensively evaluate the interactions between multiple interdependent variables affecting biogas production. Unlike conventional models that often treat parameters in isolation, this approach integrates critical factors such as pH, C/N ratio, moisture, and biogas production potential coefficients to provide a more holistic understanding of anaerobic digestion dynamics. Additionally, by incorporating Monte Carlo-based sensitivity analysis, the model enhances its predictive reliability, offering valuable insights into how fluctuations in organic waste composition influence system performance. This methodological framework is particularly relevant for real-world applications, where the variability of substrates poses a challenge to maintaining stable and efficient biogas production [
57].
The implications of this model for the design and operation of biodigesters in rural settings are significant, especially in contexts where the availability and variability of organic waste are critical factors. The model allows farmers and waste managers to select optimal substrate combinations, maximizing biogas production and promoting energy sustainability. This ability to adjust substrate composition offers significant advantages, promoting improvements in biodigester efficiency that could reduce dependence on fossil fuels and contribute to the reduction in greenhouse gas emissions, aligning with the findings of [
5].
In addition to its direct application in biodigester optimization, the model is presented as a useful tool for planning waste management policies in rural areas, supporting the implementation of biodigesters in communities where it was previously considered unfeasible. This increases the energy resilience of communities, contributing to environmental sustainability and the fulfillment of global emissions reduction targets. The resulting optimization of biogas production also offers versatile energy performance, applicable in various activities, such as electricity generation and water heating, with a direct impact on the energy sustainability of these communities.
The composition of biogas is a key factor in its energy efficiency, as the methane (CH
4) content directly influences its calorific value and viability for various applications. In this study, although the model focuses on optimizing total biogas production, the input parameters were selected considering their impact on methanogenesis. Factors such as the carbon/nitrogen (C/N) ratio, pH, moisture content, and volatile solids proportion influence the activity of methanogenic bacteria, which in turn determines the methane proportion in the generated biogas [
58].
Previous studies have shown that substrates with a high carbohydrate and fat content can promote greater methane production, while those with a high proportion of lignin or nitrogen can negatively affect process efficiency [
39]. In this context, the methodology used in this study prioritizes waste combinations that, in addition to maximizing biogas production, help to maintain optimal conditions for methanogenesis.
Although this study does not explicitly quantify the methane fraction in the produced biogas, values reported in the literature suggest that the optimized mixtures in this model could generate biogas with a methane content within the typical 50–70% range, depending on operating conditions [
59]. In future research, the integration of additional gas composition prediction models will allow for a more precise assessment of the quality of the optimized biogas and its applicability in different energy systems.
Model validation is essential to ensure its applicability in real-world scenarios. However, at this first stage, the focus of the article was exclusively on theoretical development, which allowed for further exploration of the mathematical formulation and sensitivity analysis, establishing a robust framework for its subsequent experimental application. This also limited its scope, preventing the article from becoming excessively long. For this reason, the validation process will be addressed in a future manuscript, where full-scale biodigesters will be used in rural contexts to contrast the model results with specific experimental conditions.
This experimental analysis will allow us to verify the applicability of the model in diverse environments, assessing the impact of the variability of the available waste, and making the necessary adjustments to maximize its accuracy. By reserving this stage for a later study, it is ensured that the experimental aspects can be addressed in the necessary detail, without compromising the focus and clarity of the present work.
The proposed model was designed with critical parameters widely validated in the literature, such as the C/N ratio, moisture content, and volatile solids composition, providing a solid basis for anticipating its performance in real-world scenarios. Furthermore, the sensitivity analysis performed using the Monte Carlo method helped us to simulate variations in the composition of waste, which constitutes an indirect validation and reinforces the robustness of the model to adapt to dynamic conditions typical of rural environments.
This approach ensures that the proposed model is based on solid theoretical foundations and reliable simulated results, while laying the foundation for future work dedicated exclusively to its experimental validation. This stepwise approach promotes a methodical and structured progress in research, guaranteeing scientific rigor and clarity at each stage of the model development.
The proposed model stands out for its integrative approach, as it simultaneously considers multiple interdependent variables to optimize biogas production. Unlike existing models, such as those developed by [
11,
54,
59], which focus on isolated parameters or rely on empirical assumptions, this approach incorporates nonlinear constraints to achieve an optimal balance between key operational factors. By systematically analyzing the interplay of the pH, C/N ratio, moisture, and volatile solids content, the model enables a more accurate representation of biodigester performance under diverse conditions.
Furthermore, the integration of Monte Carlo-based sensitivity analysis enhances the model’s robustness by quantifying the impact of parameter variability on biogas yield. This feature differentiates it from traditional deterministic models, which often overlook the inherent fluctuations in organic waste composition. Compared to purely empirical or AI-based models, which may lack adaptability to real-world constraints, this approach provides a structured and flexible optimization framework suited for dynamic operating environments.
Although this study does not include a direct numerical comparison with specific models, including those based on artificial intelligence, the results highlight the importance of optimization approaches that are both adaptable and context-aware. Nevertheless, this work lays a solid foundation for future research, in which comparisons with similar models under controlled conditions are expected, ensuring scientific rigor and evaluating performance across different operational scenarios.
The developed model stands out for integrating nonlinear constraints and a Monte Carlo-based sensitivity analysis, enabling the evaluation of parameter variability’s impact on biogas production. This contrasts with previous models that rely on empirical approximations or deterministic methods without accounting for variability in critical operating conditions, such as the biogas production potential, pH, and C/N ratio. However, to provide a general understanding of the most relevant aspects of the proposed model in comparison to previous approaches,
Table 10 has been prepared:
The carbon/nitrogen (C/N) ratio is a fundamental parameter in anaerobic digestion, as it directly influences the stability of the process and the efficiency of biogas production. However, its calculation in mixtures of organic waste can be approached from different approaches, each with advantages and limitations. In this study, the C/N ratio of the mixture has been estimated from a weighted average based on the weight of each waste and its individual C/N ratio, instead of using elemental fractions of carbon and nitrogen. Previous studies have shown that the method based on weighted averages of the C/N ratio is a valid approximation in practice and has been used in various experimental studies and mathematical models. In this sense, the methodology adopted in this study is in line with approaches previously validated in the literature.
The choice of this method responds to various practical and methodological considerations, aimed at ensuring the applicability of the model in real operating conditions. First, the availability and accessibility of information has been a determining factor, considering that much of the literature on anaerobic biodigestion reports average C/N ratio values for different types of waste, without specifying their exact carbon and nitrogen composition (information available in the scientific literature and in technical reports). In addition, this approach allows the developed model to be implemented in real biodigestion contexts without the need to resort to advanced chemical analysis, facilitating its use in agricultural and community settings.
From an operational perspective, estimating the C/N ratio based on the weight of the waste offers a practical and accessible alternative for the management of biodigesters. In scenarios where the availability of raw material varies constantly, having a method based on direct measurements, such as the weight of the waste, facilitates its application without requiring complex chemical analysis and the establishment of equilibrium mechanisms within the optimal range of 20 to 30 for the C/N ratio, favoring microbial activity and contributing to efficient and stable biogas production.
The second approach proposes the estimation of the C/N ratio from the elemental fractions of carbon and nitrogen, which provides greater precision, especially in studies that have detailed analysis of each waste. However, information on the carbon and nitrogen fractions in each type of waste is more difficult to obtain and, in many cases, varies depending on factors such as the stage of decomposition, the type of feed in the case of animal waste, and climatic conditions. Therefore, a comparison between both approaches could be explored in future research, evaluating their impact on the prediction of biogas production and on process stability. In this way, it could be determined more clearly in which contexts each method is most suitable and to what extent the incorporation of elemental fractions could improve the predictive capacity of the model.
The model developed in this study was evaluated in two specific scenarios to demonstrate its applicability under conditions representative of biodigesters in rural environments. The selection of these scenarios was based on the availability of organic waste commonly used for biogas production and realistic operational constraints. However, given the inherent variability in waste composition and operating conditions, it is essential to consider its behavior across a broader range of situations.
Incorporating a sensitivity analysis using the Monte Carlo method allowed for a simultaneous evaluation of the model’s robustness against variations in input parameters, as well as an assessment of system behavior from a probabilistic perspective. This approach ensures that the solutions obtained are applicable to a wide range of real-world conditions.
While the results obtained in the evaluated scenarios have demonstrated the model’s effectiveness in optimizing biogas production, future research could focus on applying the model to a greater diversity of waste combinations and operational conditions. This would further validate its reliability and expand its applicability to environments with specific characteristics, such as large-scale biodigesters or regions with variable feedstock availability.
Although the proposed model constitutes a robust tool for optimizing biogas production, it is essential to acknowledge certain aspects that may influence its applicability and open the door to future improvements.
One of the main challenges is related to the inherent variability in input parameters, particularly empirical coefficients such as potential biogas production (PP). Although these values have been extracted from the scientific literature and previous studies, they may vary depending on the origin and specific characteristics of the organic waste used. To mitigate this effect, the model incorporates a sensitivity analysis based on the Monte Carlo method, which allows for an evaluation of how biogas production fluctuates with variations in critical parameters. However, future research could focus on collecting specific experimental data to further refine these coefficient estimates and adapt the model to more specific conditions.
From an operational perspective, implementing the model in real-world scenarios may face logistical and technological challenges. The need for detailed information on waste composition and physicochemical properties can be a limitation in environments where such data are not readily available. Although the model is designed to be flexible and adaptable to various waste combinations, its applicability could benefit from integration with sensors and real-time monitoring systems, enabling more precise substrate characterization without relying solely on estimated values.
In computational terms, while the model has been efficiently implemented using Python and the SciPy.optimize library, the use of nonlinear constraints and probabilistic simulations increases the computational burden. Although this approach provides a more accurate representation of the anaerobic digestion process dynamics, running the model on systems with limited resources may require optimized algorithmic implementations. Exploring strategies to reduce computational complexity without compromising accuracy represents a potential direction for future research.
Additionally, although this study does not include a direct numerical comparison with alternative models, its formulation allows for the generation of representative scenarios that can be adapted to different contexts. In future studies, experimental validation of the model under controlled conditions and its comparison with other approaches will provide a more precise assessment of its performance and identify possible improvements in its structure and applicability.
Finally, the proposed model can be considered as a tool of greater interest within applied research processes compared to other existing models, taking into account adaptation methods for a wide range of waste types that may be present in rural or urban environments with high waste diversity, allowing optimization processes and the ability to adjust operating conditions through the systematic evaluation of variables, providing a valuable contribution to improving efficiency in biogas production.