## 3 Results
### Dynamic Biogas Process Modeling
#### 3.4.2 Gray Box Biogas Process Models
A dynamic biogas production as AD was modeled as a simple first-orderreaction mechanism inside the MATLAB(r) environment. The input feedstock was presented as a mass flow of degradable substrates (total solids, volatile solids and degradable volatile solids). The AD kinetics calculated a biogas mass flow based on a mass balance equation of the fermenter. In addition to the feedstock input mass flow, an output mass flow, and an accumulation term, a first-order reaction mechanism was implemented into the balance equation generating a biogas mass flow, which was split into methane and CO\({}_{2}\) with fixed coefficients. Microsoft Excel(r) integrated the time-related EPEX spot market benefits and, thus, calculated a methane demand as an overall balance equation of a CHP. Additionally, the vehicle fleet CNG demand was also integrated with Microsoft Excel(r). The gas storage model necessary was calculated by adding the methane volume stream produced and subtracting the methane volume stream consumed and optimized in MATLAB(r) with \"fmincon\" for fuel consumption profiles of different vehicle fleets (logistics, taxi, waste disposal and agriculture). The simulation led to the lowest additional costs as a result of additional gas storage capacity not being required for prior fuel production with an electricity production within the remaining hours of biogas production. The slow dynamics of the AD process cannot compensate for a strong biogas demand for the electricity-regulated operation mode of the biogas plant generated from the EPEX spot market. Simulating the electrical application of a biogas plant, a micro gas turbine with an electrical synchronous generator under the influence of different types of feedstock (here: animal manure) and its resulting methane production rate was designed in MATLAB(r) Simulink by the authors of [101]. They used a modified Hill [11] model of AD, which responds to the digestate temperature and the input feedstock. The AD steps include hydrolysis, acidogenesis, acetogenesis and methanogenesis and were modeled as differential species balance equations producing methane in the reaction mechanism of the methanogenesis step. The reaction steps were published as Simulink screenshots. In addition to the AD steps, dynamic models of the micro gas turbine with its synchronous electrical generator and a gas storage system are also published in the same way. In order to control the electrical load of the generator, a PID controller (error gain with a proportional, integral differential equation) in Laplace space regulates the biogas flow into the micro gas turbine, while the gas storage is modeled as a buffer to predict the over- or underload of the micro gas turbine. Regarding the AD process simulation, the model was validated using simulation results applied from literature. The model was used for scenario analysis by varying the feedstock input (swine, beef, poultry and dairy manure) and its effect on the methane production rate, as well as the torque and speed of the micro gas turbine. An integration of biogas energy in off-grid rural areas in India was investigated by [102]. The energy system model contains a biogas digester, a CHP, a water tank (heat buffer), a photovoltaic system with energy storage and load profile of a village in West Bengal; it was built within the software environment HOMER(r) (by HOMER Energy) as microgrid simulation software. HOMER(r) was developed as graphical modeling software, which allows the use of complete and adjustable modules of physical systems to integrate their physical behavior into a simulation approach. In the case of the AD process and due to the annual energy demand of the rural village calculated inside HOMER(r), the feedstock input necessary was calculated outside HOMER(r) with a linear equation considering feedstock specific biogas production and volatile solids content. The biogas CHP could fit the electrical load demands and produced 61% of the overall energy demand.