Modeling, simulation, and optimization of biogas-diesel hybrid microgrid renewable energy system for electriﬁcation in rural area

This research performed a techno-economic analysis of diesel-biogas hybrid microgrid system. The paper modeled, designed, and simulated the microgrid system using MAT-LAB/SIMULINK and performed system optimization using HOMER software. The anaerobic digestion (AD) processes were designed and simulated with the aid of Simulink to obtain the methane yield from the reactor. Results show that the methane yield is 95.04 kg/day at a reactor temperature of 55 ◦ C. The synchronous generator was modeled and simulated for the application of both diesel fuel and biogas fuel system. The HOMER software was used to optimize the hybrid micro-grid system with the diesel system taken as the base case. Biogas production was varied between 1 and 5 tons while the calculated energy demand of the village was 271925 kWh. At a biomass production of 4 tons and above, the hybrid system became powered by only the biogas system for total energy production. The energy produced by biogas is 452820 kWh and a cost of energy (COE) of $0.0484.


INTRODUCTION
A micro-grid can be defined as an interconnected arrangement of distributed energy sources and loads within the specified electrical channels that performed a controllable grid. The micro-grid system can sometimes disconnect and connect from the grid for the operation of both island or grid-connection mode [1]. The system involves three basic requirements: firstly, identification of the distribution system of a distinct micro-grid is very possible from other systems. Secondly, it is possible to control the micro-grid resources when comparing with distant resources and thirdly, the micro-grid system can work without considering the size of the grid-connected [2]. The generation of micro-grids is divided into three groups according to their physiological features: direct current (DC), alternating current (AC), and hybrid [3]. When considering the conventional con-network. Thus, when AC and DC bus microgrids are connected together, they form hybrid microgrid which always give better performance compared to either systems. Hence, the loads and power components are easily applied and suitable in the bus when hybrid micro-grid is used for the consumption and production in the network. The cost and energy losses are minimized when the number of converters is reduced [3][4][5]. The advantages of the micro-grids system include providing and enhancing of economic, environmental, and technical benefits to society. To achieve this, optimization in micro-grids design is required. These benefits can be achieved through the right selection of micro-grids system technologies, grid component, and also optimal size load component characteristics. Hence, to achieve the best design, there should be optimal energy capacity storage units in the system. The renewable energy sources are used for energy stability and as continuous energy storage in the micro-grid. Normally, energy is always stored when the generation is greater than usage. When considering the operation of renewable energy, the system cannot hold for the storage units to micro-grid. Therefore, one or more resources can be applied together with the maximum operation and planning method. According to physiological conditions, renewable and nonrenewable energy can operate together for high energy quality and cost-effectiveness [5]. There are various computer-aided design techniques to evaluate and analyze the micro-grids system. A well-known computer design that is effectively used in the economic power system model and experimental analysis is HOMER which allows different designs comparison. HOMER can operate in three stages which include optimization, simulation, and sensitivity analysis for micro-grids analysis and model. In all these three stages, HOMER gives the economic and technical analysis of micro-grid with a high degree of accuracy [5]. The researchers [6][7][8] proposed and also designed a micro-grid AC system for the Eskisehir Osmangazi University campus. The cost of total electrical energy consumed was minimized using the optimal energy management method and finally designed, modeled, and simulated the work in MATLAB. The researcher [9] designed a hybrid power production system that can operate wind energy, solar energy, batteries, and also modified electric load system cascades for the island. The result shows that both of them were able to achieve the maximum solution when the HOMER software is applied. The researcher [10] analyzed two power system generation which is decentralized in Malaysia using HOMER software, which combines various PV generation systems, energy storage, diesel generators, and converters. The researcher [11] modeled a hybrid power production system that consists of a diesel generator, biomass gasification, and the electric grid. The researcher [12] proposed an independent grid energy system which combines the production of biomass and PV power system for the agricultural farmer and residential community in Pakistan. The system required diesel generator, PV and power converter, and also high battery capacities using actual electricity energy consumption for the period of 1 year. The cost of electricity is cheap, reliability increases and also the hospital complex gives high-quality power generation.

REVIEW OF BIOGAS TECHNOLOGY AND MICROGRID ENERGY MANAGEMENT
The application of biogas as a source of electrical energy generation is highly efficient compared to using it as fuel for the gas lamp. From the perspective of energy utilization, generating electricity for lighting with biogas appears cost-effective. Using biogas to generate electricity, 0.75 m 3 per kW hour can power twenty-five 40-Watt lamps for 1 hour while the same volume of gas can only power seven lamps for an hour [13]. Community wastes can be collected and processed by bioreactors to generate electricity. Biogas generators can be utilized in generating electricity in remote areas with the grouped settlement. One of the available choices of biogas utilization is to generate electricity using a gas turbine or gas engine. The researcher [14] designed Biogas and PV solar system renewable energy system. The Pigs waste was used to generate biogas electrical energy while PV power system applied the Shockley diode principle. The linear regression of Biogas energy source increases as the mass of Pig waste increases. The researcher [15] compared biogas and solar energy for "Ajaba" near Ila-Orangun in Osun State to know the best renewable energy source for the area. The study considers photovoltaic cells as the device for trapping and converting solar energy to electrical energy. It was discovered that biogas energy produced more energy and performs better as compared to solar energy for the area. The paper forms a basis for the evaluation and performance of biogas energy for rural communities. The researcher [16] developed a simplex optimization model for biogas energy generation. The researcher [17] evaluates the energy management system with a renewable energy source through micro-grid. The researcher [17] simulates the model using Matlab-Simulink and java software. Hence the model was validated by applying the principle which includes adaptability and autonomy in the load variation of micro-grid management. The researcher [18] analyzes the two micro-grid system of energy management with a grid outage which comprises wind generators and photovoltaic generators each. The differential evolution algorithm was applied to minimize the cost of generation through a multi-agent management system which happens intermediate between load and solar system resources. The research studied the cost of grid variation and critical loads for the selection of the best solution. The researcher [19] proposed an intelligent multi-agent stand-alone micro-grid energy management system that operates between the generators, loads, and batteries. This system includes wind turbines, photovoltaic systems, fuel cells, and battery banks. The load is divided into three categories and the prediction of the generation is done by auto-regressive moving average models (ARMA). The system applied the dynamic compensator at low and high irradiation to balance reactive power. The researcher [20] evaluates the microgrid technology for the energy management system which involves buildings and houses. The optimization analysis of the energy management system normally coordinates the distributed generation (DG) and load demand.
The major objectives in cost analysis are to minimize the operating costs with the effect of electrical and thermic demand needs. The researcher [21] studied a multi-agents energy management system for different load demand and also the energy distributed resources. There is a mechanical system that validates the interconnected grids using JADE programming software. The system management minimized the peak values and provides clients the best cost analysis. The researcher [22] designed energy management for micro-grid using a mixed technique by synchronizing the utility grid and power cell fuel. The analysis of the research is done using linear optimization techniques at utility on/off states grid. The application of particle swarm optimization technique was also applied for the determination of optimum energy storage systems. The researcher [23] presented a flexible energy management system for the centralized method which is interconnected micro-grid to the end-users. The quadratic programming was adopted for optimal economic dispatch. The design grid was then integrated with demand allocated into the photovoltaic system. Thus, the model was tested on an IEEE 33 load data. The researcher [24] developed a genetic algorithm optimization model for the generation of biogas electrical power systems. The analysis finally shows that the power output of the system increases as the methane gas increases. The researcher [25] designed optimal scheduling for forecasting unexpected errors occurring in the microgrid system of renewable distributed generators using particle swarm optimization (PSO) algorithm. The researcher [26] proposed secondary voltage controls and unified frequency for operating microgrids in island mode using Levenberg-Marquardt method. The researcher [27] studied the importance of renewable energy distributed generation (REDG) and operational problems due to the integration of microgrid technology into electric power systems. The researcher [28] analyzed the systematic method for evaluating reliability and foresting the generation from different renewable sources using particle swarm optimization technique. The researcher [29] designed an inverter that minimizes the effect of harmonics on renewable energy especially photovoltaic (PV) system using the secondary controller. The researcher [30] designed a linear time-variant model predictive controller (LTV-MPC) for standalone microgrid through different load and source. The researcher [31] develop active distribution network with wind power and smart buildings. The method increases the performance of wind power and reduces grid network loss. The researcher [32] developed a method that improves the grid-connected performance through the application LCL-filter inverter using total uncertainty and disturbance estimator (TUDE). Energy crisis in Nigeria is a bewildering issue as an estimated 73 million (about 45%) of the populace lack access to electricity [33]. One of the proffered solutions to this problem by the Nigerian Rural Electrification Agency (REA) is the implementation of a decentralized access to electricity through a program called off-grid electrification strategy. The strategy employed by this program is energy generation in mini-grids, micro-grids and standalone installations majorly by using renewable energy resources [34]. One of the rural communities without access to electricity is Akpugo community despite having a substantial renewable energy resource potential in form of biomass. This research work performs a technoeconomic analysis of the implementation of biomass for electricity production for Akpugo community. Therefore, due to the lack of access electricity in the community, it is necessity to design renewable hybrid micro-grid systems for the community to improve electricity supply through animal manure produced in the community. Thus, the generation is very cheap and technically viable to develop because the animal manure is readily available and it also increases the social life of the community.

METHODOLOGY
The paper designed hybrid power generation for Akpugo village located at Enugu state. Load audit of Akpugo community was conducted and the load profile was obtained. The peak power consumption per day was calculated using HOMER. The biogas system equations were modeled in MATLAB to determine the capacity of the generator required. The synchronous generator was designed and simulated using SIMULINK to determine machine output parameters. Optimization was performed on the system using the new HOMER optimizer subject to cost minimization and generated energy maximization. The optimizer implements the propriety derivative-free algorithm to determine the lowest cost system and also present different system designs option. The biomass anaerobic digestion process was designed and simulated, and the methane output was fed into the generator as gaseous fuel. Figure 1 shows the flow chart of hybrid microgrid system design. The importance of micro-grid installation in the community can be analyzed in three categories: clean energy integration, energy security, and economic benefits. The simulation of self-excited synchronous generator for hybrid micro-grid of biogas-diesel engine can be analyzed and achieved by the following steps: (i) Model the automatic governing system (ii) Design an ignition system that can effectively work for the micro-grid system (iii) Design a mixture of air-fuel system The conversion kit was designed to convert diesel engines to 100% biogas systems. The operation of a diesel engine is based on a compression ignition system of diesel fuel. Therefore because of the content of methane which is used as fuel in the biogas system, the temperature of self-ignition is very high. To improve the efficiency of methane, the compression ratio must be high [35]. The diesel engines use the governor for their mode of operation which regulates the engine speed. The main function of the governor is to stabilize the engine speed regardless of the load applied. The rack can be used as a throttle control to adjust the engine speed to the desired speed. When biogas is fed into the engine, the sound will change due to the change of sources. Figure 2 shows the biogas-diesel generator hybrid micro-grid system.   The following are the steps for the conversion of a diesel engine to spark ignition engines system: (i) Remove the fuel injection system of an engine (ii) Replace spark plug in place of fuel injection through injector modification. (iii) Incorporate the gas carburetor system (iv) Design crankshaft for the ignition system (v) Design the combustion chamber The electronic ignition system was applied for the conversion kit through the operation of the battery. The conversion kit includes: gas carburetor with the governor, spark plug, ignition system with H.T coil, electronic unit control, gas valve operating diaphragm system and the sensor picks up speed. Microgrid system is crucial to improve the power system reliability, backbone to main sources, and also fast response to the emergency. Figures 3 and 4 shows the conversion process. The optimization of the microgrid problem can be analyzed and achieved by the following steps:

Modeling of biogas system
The mass of solid waste available for the processing of electrical power output is given below. The mass of dry solid in waste is given by [37]:

FIGURE 4
Generator operating on 100% biogas system with electronic governing ignition system [36] where N a is the total number of animals and C w is the animal solid manure per day/kg The volume of biogas is given by [37]: where K is the biogas produced per unit dry mass of whole input which ranges from 0.2 to 0.4 m 3 kg −1 and M d is the mass of dung input. The modeling of hydrolysis is given in the equation below: where Sb is the biodegradable concentration of volatile solids of reactor (kg/m 3 ), Sb in is the biodegradable concentration of volatile solids of reactor feed (kg/m 3 ), F fed is the flow rate of fluid (m 3 /day), V is the volume of reactor/digester (m 3 ), m is the acidogens peak growth rate (per day), k 1 is the estimated yield factor [38], X acid is the acidogens concentration (kg/m 3 ) and k s is the acidogens half velocity Monod constant (kg/m 3 ). The methanogens peak value rate can be written as a function of reaction rates of temperature. The formula below shows the empirical formula [38][39][40]: where μ mc is the maximum growth rate for methanogens (d −1 ) and T react is the reactor temperature ( • C).
The modeling of acidogenesis is given in the equation below [38,39]: where SV is the total concentration of volatile fatty acids in the reactor (kg/m 3 ), SV in is the total concentration of volatile fatty acids in the reactor feed(kg/m 3 ), K 2 is the yield factor estimated, K 3 is the yield factor related to growth rate of methane gas, X meth is the concentration of methanogens (kg/m 3 ) [38][39][40].
The modeling of hydrogenesis is given in the equation below [38,39].
where k d is the specific death rate of acidogens (per day) and b is the retention time.
The modeling of methanogenesis is given in the equation below [38,39]: where K dc is the specific death rate of a methanogens (per day) and X meth is the concentration of methanogens (kg/m 3 ). The anaerobic digestion equations are modeled in Simulink and the result of the final stage is presented. Figure 5 shows the Simulink model of biogas production.
where H b is the heat of combustion per unit volume biogas, ɳ is the combustion efficiency of burners. The generator size can be calculated using the formula below [40]: where is the total efficient of conversion and P t is the generator size in kW

Modeling and simulation of synchronous generator
The rotor winding of the synchronous generator consists of the filed winding and damper windings, all with varying electrical FIGURE 5 Simulink model of methane production attribute [41]. The stator winding is a symmetrical three phase connection each phase displaced from the other by 120 • . The rotor winding consists of one field winding on the d-axis and two damper windings, one on the d-axis and the other on the q-axis [42].
The voltage equations expressed in three phase machine variables can be written as [41,42]: where Equation (10) represents the stator voltage equations and Equations (11), (12) and (13) are the rotor winding equations. Transforming Equation (10) into the arbitrary reference frame yields [42,43]: where qds = [ ds − qs 0] T and represents the magnetic flux The rotor variables and stator variables are expressed in the rotor reference frame following the work of R.H. Park as presented in [41]. Equation (14) is expanded and expressed in terms of reactance such that it becomes: Equations (10), (11) and (12) then become: V r fd = −r fd I r fd + .
The damper windings are short circuited such that V r kq and V r kd become zero.
r kd = X lkd I r kd + X md r fd = X l fd I r fd + X md where: r s = stator winding resistance r kq = resistance of damper winding in q-axis r kd = resistance of damper winding in d-axis r fd = field winding resistance L ls , X ls = stator leakage inductance and reactance, respectively L lkq , X lkq = damper winding leakage inductance and reactance in the q-axis, respectively L lkd , X lkd = damper winding leakage inductance and reactance in the d-axis, respectively L l fd , X l fd = field winding leakage inductance and reactance, respectively L mq , X mq = magnetizing inductance and reactance along qaxis, respectively L md , X md = magnetizing inductance and reactance along qaxis, respectively ω = speed in arbitrary reference frame r = speed in the rotor reference frame V qd 0s = the stator voltage in arbitrary reference frame V abcs = three phase stator voltage in machine variable kd = indicate damper winding in the d-axis kq = indicate damper winding in the q-axis V = indicates voltage I = indicate current = is the magnetic flux when inductance is converted to reactance The superscript "r" indicates representation in rotor reference frame.
The mechanical torque is given by: where H is an inertia constant of the turbine generator set, T m is the mechanical torque of the turbine and is a damping torque. The damping torque, T damp , represents the rotational losses of the rotating parts which consist of the magnetic losses and the mechanical losses. The model was implemented in Simulink and generator output parameters such as current and voltage are viewed through the scopes. Figure 6 shows the Simulink model of the synchronous generator.

Optimization of hybrid micro-grid system using HOMER
The biomass produced by the village is incremented from 1 ton to 5 tons. Figure 7 shows load profile of the community using HOMER. This shows the daily, seasonal and annual load profiles of the community. It showed that the annual average energy is 745 kwh/day, the average load is 31.04 kW and the peak load is 90.18 kW. Figure 8 shows the schematic diagram of the dieselbiogas architecture. The load audit in Figure 8 shows that the average annual energy demand of the village is 271925 kWh with a peak power of 93.21 kW. The two systems are both connected to an AC interface from where stable power can be supplied to the electric load.

Biogas generator output
The base voltage was taken as 400 V and the base power is 100 KVA. The outputs from the synchronous generator were measured in the per-unit system using a voltage and current measurement device as in Figure 6. The biogas generator was simulated under a steady-state condition at full load. The deltaconnected reactive capacitor bank used as a filter for the output waveform is calculated to be 25 Kvar. Figure 9 shows the three cycles of the three phase stator line-line voltage. The threephase peak voltage in the machine variables, Vabc is 1.01 p.u. There was distortion in the waveform of current and voltage at startup. The magnitude of the stator voltage is proportional to the amplitude of the electromagnetic torque generated as a result of the interrelation of the field current and armature current and the field voltage. The current waveform is also considered for three cycles after the rotor acceleration. Figure 10 shows the line current in machine variables, that is, Iabc which was measured to be 0.913p.u. The stator current, like the stator voltage, is also dependent on the field voltage. The voltage supplied by the field winding to the terminals of the rotor is shown in Figure 11. The field voltage settled at a value of 1.778 p.u. after plunging to a high value in the first two seconds. The waveform is characterized by a continuously decaying ripple with time thus making the voltage tending towards a constant value. To maintain the stator voltage close to the nominal voltage, the field voltage applied across the terminal of the field winding is adjusted through the operation of the AVR. Therefore, the stator voltage and the electromagnetic torque produced by the machine are dependent on the field voltage. The actual speed of the generator is compared with the reference speed which was set at 1.0 p.u. and gradually adjusted accordingly by the biogas engine governor until the desired speed is attained to ensure a stable power supply. Figure 12 shows the actual output speed of the synchronous generator. The speed waveform steadied at 1.0 p.u. after an ini-

4.3
Optimization result of a hybrid system using HOMER Table 2 shows the optimization result of the hybrid system. The diesel system was selected as the base case system and diesel fuel price was assumed to be constant at $0.625/litre while the mass of biomass is varied. Results of energy generated and the NPV of the systems in each case were also presented.

4.3.1
Energy production Operating the diesel system alone produces 316,644 KWh of energy annually. Figures 13, 14, and 15 show the energy production of diesel, biogas and the hybrid architecture, respectively, at varying mass of biomass penetration. However, at 1 ton of biomass, the diesel system contribution to the hybrid  The energy production in both cases is 482,141 KWh. In all the six cases presented above, sufficient energy is produced. Thus, implementation of any of the cases will be able to meet the energy demand of the community.

4.3.2
Net present cost (NPC) and cost of energy (COE) Figures 16 and 17 show the NPC and COE, respectively, of each architecture for varying biomass production from 1 ton to 5 tons at a diesel price of $0.625/litre. The diesel system was selected as the base case system. The NPC of the base case system is $1,141,292 while the COE is $0.3247. With the FIGURE 16 The NPC of each architecture system operated in the hybrid mode at 1 ton of biomass, the NPC and COE of the hybrid system is $911,378 and $0.2593, respectively; $641,096 and $0.1824, at 2 tons of biomass, respectively; $374,742 and $0.1066 respectively, at 3 tons, and $176,600 and $0.052, respectively, at both 4 tons and 5 tons of biomass. However, the NPC and COE of biogas system are $176,085 and $0.0484, respectively. There is an inverse relationship observed between both the NPC and COE of the hybrid system and increasing biomass penetration which reached saturation at 4 tons of biomass. Between 1 ton and 3 tons, the hybrid system proved to be the lowest cost system but at 4 tons and 5 tons, operating biogas system exclusively, provides the lowest cost.  Table 2, diesel hours, diesel operation and maintenance cost and diesel fuel cost reduced simultaneously with increasing biomass penetration.

Inference
With the community having a biomass potential production potential of 5 tons per day, implementing an architecture that utilizes 80% of such potential, under an ideal condition is able to produce energy of 452,820 KWh per annum which is deemed surplus to their energy demand of 271,925 KWh per annum.
An advantage that comes with the implementation of the biogas system just at 80% of biomass potential is that it provides an excess of 180,985 KWh of energy which could translate to accommodation of more loads within the community or sending the excess energy to nearby communities that do not have access to electric power supply and all at the lowest cost of energy and net present value for the project life span.

CONCLUSION
This research paper discussed on the modeling, designing, simulation, and optimization of the biogas system for optimal energy production. The results of the AD processes show that the yield of methane gas is 95.04 kg/day. It was also established that the methane yield increases with an increase in temperature of the reactor, subject to the constraint 25 • < T < 55 • , where T is the temperature of the reactor. In this work, the temperature was varied between 25 • C and 55 • C. The simulation result shows that methane yield was highest at 55 • C. The MATLAB/SIMULINK results show output variables of the synchronous generator which include the terminal voltage and current, the actual speed of the rotor, field voltage, and current and the mechanical power. The stator terminal voltage was at 1.01 p.u., which falls conveniently into the desired range of voltage limits of 0.9-1.1 p.u. and the line current staked at 0.913 p.u. The presented model of the biogas system and the diesel system were then hybridized and optimized using the HOMER software. The system was designed to generate sufficient electricity for Akpugo community implementing the lowest cost system.