# Strategic Resource Planning for Sustainable Biogas Integration in Hybrid Renewable Energy Systems
## 2 Materials and Methods
### Biogas Production and Management
The generalized form of the cumulative biogas production is represented in Equation (6):  
\[Q_{Cumulative}=\sum_{1}^{n}\sum_{t_{i}}^{t_{i}+T}Q(t) \tag{6}\]  
Figure 3 illustrates the biogas production over time for two biomass inputs: 20 tons at hour 1 and 10 tons at hour 400. The top graph shows the biogas production rate (m\({}^{3}\)/h), with two distinct peaks corresponding to the two biomass inputs. The first peak, larger in magnitude, reflects the higher input of 20 tons, while the second, smaller peak represents the 10-ton input at hour 400. After each peak, the production rate decreases exponentially as the volatile solids in the biomass are consumed. The bottom graph depicts the cumulative biogas production (m\({}^{3}\)), showing a steady increase as the biogas is produced following each biomass input. As production slows down after both inputs, the cumulative production curve flattens, reflecting the complete digestion of the biomass over time. This highlights how the amount and timing of biomass inputs affect the production rate and the cumulative output of biogas. Figure 3: Multi-input biogas production rate. Based on the daily biogas requirement, the total biogas needed for a year is calculated using Equation (7):  
\[Q_{Total}=365\times Q_{Daily} \tag{7}\]  
To ensure stable and continuous biogas production, Equation (8) must always hold:  
\[Q_{Total}\leq Q_{Cumulative} \tag{8}\]  
By maintaining this balance, the system can consistently meet energy needs without falling short, ensuring a reliable and sustainable energy supply throughout the operation. It is important to note that the available volume of waste is limited. According to data provided by the municipality, this volume is 9880 tons per year. To achieve optimal biogas production, exceeding this amount will not be possible. Therefore, the system must be designed to operate efficiently within this biomass availability limit, as expressed using Equation (9):  
\[Q_{max}=m_{VS}\times k_{Methanogenic} \tag{2}\]0  
where \(m_{i}\) is the mass of each biomass input, \(N\) is the total number of biomass inputs, and \(M_{Available}\) is the total biomass available annually (9880 tons). Also, it is crucial to ensure that, at any given moment, the total volume of biomass in the reactor does not exceed the maximum capacity. This can be expressed using Equation (10):  
\[Q_{max}=m_{VS}\times k_{Methanogenic} \tag{2}\]1  
where \(\rho\) is the density of the biomass, which is approximately 1000 kg/m\({}^{3}\), and \(V_{Reactor}\) is the maximum volume capacity of the reactor, supposed to be 812 m\({}^{3}\). Now that we are familiar with the constraints of available biomass and the reactor's capacity, it is necessary to explain the logic of biomass input and output in the reactor, which is why Figure 4 is referenced. After biomass enters the reactor, it remains throughout the retention time until all biogas is produced. As seen with the 250-ton input at hour 1, the biomass stays in the reactor until hour 730, when it is fully digested and then discharged, marking the end of the biogas production for that batch. If additional biomass is added before the retention time of the previous input is complete, all inputs remain in the reactor until the final retention period is finished, as the different inputs cannot be separated. As shown in Figure 4, the second wave of inputs starts at hour 1460 with 250 tons, followed by additional inputs of 250 tons at hours 1610 and 1760. This causes the reactor's mass to increase stepwise, reaching 750 tons after the last input. The mass remains constant until hour 2490 when 730 h have passed since the previous input; at this point, all biomass is discharged from the reactor. It is important to note that at no point should the volume of biomass in the reactor exceed its maximum capacity. For example, in Figure 4, during the third wave of inputs, four entries of 250 tons are added at hours 3650, 3800, 3950, and 4100.