Techno-economic optimization model for polygeneration hybrid energy storage systems using biogas and batteries

Renewable energy polygeneration systems are a viable alternative to fossil-fuel based systems, but storage solutions may be necessary when aiming for high sustainability and autonomy. As each storage technology has different strengths and weaknesses, combinations of various storage solutions may lead to better techno-economic performance than singular approaches. To this purpose, an optimization model including a novel dispatch control strategy for a hybrid energy storage system (HESS) is proposed, which uses biogas for long-term and batteries for short-term storage. The model optimizes for minimum lifetime costs while exploiting the biomass resources with maximum efficiency and quantifying the additional solar and battery capacities needed. It is applied in a case study with an innovative biomassbased polygeneration system in a rural locality of Bolivia to serve electricity, potable water, and bio-slurry as fertilizer. The results indicate that evenwith maximized efficiency of the biomass resource conversion, large PV and battery capacities are necessary to satisfy the electricity demand of the locality. Despite of the high investment costs, the biomass-based polygeneration system would cost 22% less over the project lifetime than the fossil-fuel based reference system while being less dependent on fuel price changes. It would also reduce CO2-emissions by over 98%. © 2020 The Author(s). Published by Elsevier Ltd. This is an open access article under the CC BY license (http://creativecommons.org/licenses/by/4.0/).


Introduction
The need for a transition towards more sustainable energies has been recognized globally with various technologies competing while also complementing each other to provide more sustainable and secure energy-related services [1,2]. Amongst these technologies, small-scale biogas has gained increasing interest as a lowemission and locally available energy carrier with ecological and socio-economic benefits for developing regions in Africa, South-East Asia and Latin America [3]. With rising living standards, the usage of biogas as a cooking fuel may no longer be sufficient and advanced energy-related services like electricity will be in higher demand. However, despite of high scientific interest in small-scale biogas electricity generation [4], a broad-scale penetration of rural areas has not been observed [5]. This may be due to the drawbacks of higher complexity and increased capital costs outweighing the benefits. The concept of polygeneration offers the possibility of dramatically increasing the benefits by providing several energyrelated services rendered with a relatively modest addition of complexity [6,7]. By increasing the total energy efficiency of the biogas systems and hence reducing losses, polygeneration also maximizes the utilization of the limited biogas resources. Such polygeneration systems serve apart from electricity also other energy-related services like hot water, cooling, or potable water by further using the heat inevitably produced in the biogas combustion process. In consequence, biomass-based polygeneration systems can decrease oil dependency and lower Greenhouse Gas (GHG) emissions [8]. Solar technologies like Photovoltaics (PV) can be added to decrease the amount of biogas usage and batteries can be used to extend the services of the solar energy beyond sunshine hours [9]. Despite the lower electric efficiencies, small-scale biogas-based systems may prove to be the most efficient method to use biomass due to smaller transport paths compared to large systems [10].
Several authors have proposed specific small-scale polygeneration systems using biogas, water purification, solar and/or storage technologies: Kyriakarakos et al. [11] proposed a polygeneration system consisting of 4.8 kWp PV panels, a 3 kW wind turbine and a 1 kW fuel cell to generate electricity and to desalinate water with reverse osmosis technology. The system uses a Proton Exchange Membrane electrolyser to produce hydrogen as a transport fuel as well as batteries to cover electric loads for 3 days. Based on particle swarm optimization the results show that the optimal system is economically feasible for an off-grid island system with a probability of 90%, depending on fuel price fluctuations. Gazda et al. [12] developed an algorithm for biogas-based CCHP systems with various RES (Renewable Energies Sources) to evaluate the energetic and ecologic efficiencies of facilities in the agri-food sector like distilleries, waste digesters, juice storage facilities etc. Using a 750 kWe biogas engine and ca. 228 kW PV panels, the system could lower GHG emissions by up to 67.4% and Primary Energy Savings (PES) by up to 65%. A heat storage tank has been considered, but electricity or biogas storage were not mentioned. Focusing on the Italian market and primarily on financial analyses Carlini et al. [13] calculated a payback time of 9 years for a 100 kWe biogas-fuelled CHP plant but five years for a 500 kWe CHP plant. It is mentioned that these results are highly dependent from the financial incentives set by the surrounding political institutions. However, they identify a trend that larger plants tend to recover the investment costs faster. For dairy farms in central Bolivia Villarroel-Schneider et al. [14] proposed a biogas-based polygeneration plant with a 40 kWe engine producing electricity, cooling for milk refrigeration and heat for bio-slurry drying, which could then be used as fertilizer. When compared to the highly subsidized fossil fuel-based energy solutions in Bolivia, the proposed system seems to be competitive showing a payback period of 3.5 years when requiring just 15% subsidies on the investment costs. The paper underlines the potential of biogas-based systems for rural regions as well as the economic complexities due to fluctuating prices.
A polygeneration system based on a plug-flow digester unit connected to a 10 kWe Internal Combustion Engine (ICE) to produce electricity, cooking gas and 20L/h of drinking water via air-gap membrane distillation (MD) has been devised by Khan et al. [15]. The system has been optimized for economic performance and a payback period of less than 4 years has been calculated. The biogas production could be increased through a recovery system transferring heat from the MD units to the anaerobic digester (AD). In a related study, the system has been further enhanced using 12 kW PV panels and approx. 10 kWh of batteries [16]. This enabled the system to serve nearly twice as many households with higher electricity demands highlighting the potentials of both, hybrid energy sources and storage technologies for polygeneration systems.
Due to the increasing penetration of RES into all electricity sectors and their inherent fluctuating nature, flexible storage solutions gain increasing interest. An extensive review on hybrid energy storage (HES) solutions of all sizes has been published by Bocklisch [17], who proposes several combinations of short-term and long-term storage technologies. A similarly interesting review concentrating specifically on micro-grids has been presented by Hajiaghasi et al. [18], who highlight amongst others the importance of capacity sizing. Both reviews clearly identify the complementing capabilities of short-term (e.g. supercapacitors) and long-term (e.g. Compressed Air Energy Storage (CAES)) technologies, however the storage potential of biomass resources (like biogas) has not been mentioned. Although several authors do consider biogas fuelled engines as back-ups for rural renewable energy systems, the details of the biogas storage control strategy are often neglected. For example, Amin Vaziri Rad et al. compare energy systems composed of PV panels, wind turbines, a biogas generator and hydrogen-driven fuel cells, which are supported by batteries and a hydrogen tank [19]. The results indicate that an offgrid system consisting only of PV panels, batteries and a biogas generator outperform all other combinations economically. However, the details of the biogas storage are not elaborated further. Nonetheless, Azzuni et al. identified a positive relationship of gas storage facilities towards energy security [20].
Despite the high interest in biogas-fuelled off-grid systems and their many benefits, no optimization method for biogas storage and batteries has been reported yet. Such a system could use the biogas for long-term storage (i.e. days to weeks), while the batteries could serve low short-term demands (i.e. several hours) and hence would allow for the biogas engine to operate at maximum efficiency as frequently as possible. Additionally, the system could be enhanced with PV panels, hence allowing for electricity service during maintenance downtime of gas system components as well as for surpassing the energetic limitation of the biomass resources. The aim of this paper is to facilitate the design of polygeneration with a hybrid energy storage system (HESS) using biogas by developing a versatile model. Additionally, the benefits and drawbacks are to be analysed based on a case study. Hence, the scientific contribution of this paper is twofold: 1. Firstly, a novel model for economic optimization for a HESS using biogas storage coupled to a biogas ICE and batteries, is presented. The model applies a dispatch control algorithm, which can take into account photovoltaic energy as an additional energy source, so that even with insufficient biomass resources a given demand load can be satisfied. In order to allow for a highly efficient system design, the model calculates the thermal energy recovered from the engine. 2. Secondly, an innovative polygeneration system has been designed to identify the benefits of a HESS employing biogas and batteries controlled by the algorithm. By adding a MD subsystem, the energy efficiency of the total system is further increased and a second service is provided for an off-grid locality in Bolivia. Further considering the fertilizer in form of bioslurry, the polygeneration system can provide up to three energy-related services: electricity, potable water, and fertilizer. The system is scrutinized with a techno-economic analysis in comparison with a diesel-based reference system in a case study.
After this introduction, the model approach is explained and one of many possible polygeneration layouts is presented in section 2. In section 3, the parameters and variables for the case study are described. The economic, energetic, as well as ecologic results are shown in section 4. The results and the model are discussed in section 5. Finally, conclusions on the algorithm and on the proposed polygeneration system are drawn in section 6.

Model and strategy description
The model aims to minimise the costs of the project over its lifetime. For this the Net Present Costs (NPC) are used, which are defined as follows in equation (1): where R t are the cashflows for year t, i is the real discount rate and n represents the project lifetime. For each component j, R t is composed of all capital costs CC j , replacement costs RC j , costs and revenues for operation & maintenance OM j , fuel costs FC j , and salvage revenues SR j . The optimization problem can be expressed as shown in equation Eqn 2: min NPC subject to E cs E cs;max (2) where E cs is the annual capacity shortage, where the energy system cannot satisfy the total electricity demand of the client, and E cs,max is the maximum annual capacity shortage permitted to the system. As the NPC is determined by component size and component utilization, the model simulates in an iterative process the system performance for each component size as predetermined in a given search space. For a more general comparison of the economic performance in relationship to the energetic output the Levelized Cost Of Energy (LCOE) is used and calculated as follows in equation (3): where C ann;tot are the annualized cost of the system [in $/yr] and E served is the total electrical load served for one year [in kWh/yr]. To calculate C ann;tot equation (4) is used: where i, n, and NPC are defined the same as for equation (1). For the ecologic performance of the optimal system, the total mass of CO 2emissions m CO2;tot is considered using equation (5): where m CO2;transp and m CO2;comb are the masses of emissions due to transport and combustion of fuel, respectively. The fuel used m biog in relation to the electric output by the engine is calculated as shown in equation (6): , P load is the electric load supplied by the engine [in kW], P gen;max is the peak load capacity of the engine [in kW], and t is the duration of one time step [in h]. With the electrical output of the engine depending on its partial load behaviour also its thermal output is varying according to electricity generated.
The model employs a unique dispatch strategy based on IF-THEN statements, which allows for optimal utilization of local biomass resources. Although there are similar control algorithms for HESS [21,22], none have been developed for the combination of two independent energy storage modes (chemical/biogas and electrochemical/batteries) for an optimization model of a polygeneration system. A graphic visualization of the algorithm is given in the supplementary material. The objective of the algorithm is to operate the biomass engine as often as possible at maximum load and hence at maximum electric efficiency. The control algorithm operates according to the following order: 1. Check the state of storage of the biogas system. If the biomass storage is 10% below its technical upper limit, the algorithm will signal to release biogas to the engine. 2. Check the state of charge of the battery system. 3. Compare the electric load (after PV panels if included) with the capacities of battery discharge, converter discharge, and generator output. 4. Finally, the algorithm sets the generator output and the battery discharging or charging power. In case some load demand cannot be met the algorithm calculates the unmet load. Similarly, in case unused surplus power is generated, which can neither be used directly nor stored in the batteries, the model calculates the excess power.
A block diagram with a generic polygeneration system layout is shown in Fig. 1 and the optimization and analysis procedure of the model is shown in Fig. 2. The model is based on MATLAB (Version R2019a) and the Hybrid Optimization Model for Multiple Energy Resources HOMER (Version Pro 3.12.4). HOMER allows for a bruteforce optimization approach running hundreds of simulations for all selected component sizes of the proposed polygeneration system. The connection to MATLAB allows for a more specific control of the energy storage and generation devices as well as for more precise calculations for the heat recovery. To validate the model behaviour under varying conditions firstly a white box testing approach with boundary value testing has been chosen with the results presented in the supplementary material [23]. Secondly, the model has been tested using results from a previous case study of a polygeneration system. The new dispatch (ND) control strategy has been used in a CCHP model and compared to the two most common strategies: load following (LF) and cycle charging (CC) [24]. The CCHP model has been presented in a previous study by Wegener et al. [25]. For the simulation, all input parameters have been kept equal while only the sizing of the biomass combustion system, the batteries, and the converter are being determined by the optimization model. Unlimited biogas supply is assumed and the PV panel capacity remains fixed.
The optimal component sizes for each strategy are shown in Table 1 and key results are shown in Fig. 3. Without biogas limitation, the ND strategy performs economically between the LF and the CC. However, the ND strategy requires less fuel and less engine operation time as the engine operates at higher efficiencies compared to the other two strategies. The results underline the universal applicability of the model and show that it optimizes biomass exploitation as aimed for.

Current electricity and water demand
For the case study, the locality of El Sena in Pando, Bolivia, has been chosen. In the reference case, the electricity demand of the inhabitants is covered by diesel-fuelled generators. These generators imply high GHG emissions and instability due to long fuel transport chains using unsecured roads. According to data from the national electricity agency (Autoridad de Fiscalizaci on y Control Social de Electricidad) of Bolivia the total electricity demand of the village in 2016 was 1342.4 MWh with peaking values during the major harvest season in October [26]. For the daily demand profile, a typical demand profile of a rural community has been used with random variabilities of ±10% from day-to-day and ±10% from hour-to-hour [27]. The yearly electricity demand is shown in Fig. 4 and an exemplary weekly electricity demand for the first week in January is shown Fig. 5.
Additionally, the locality suffers from insufficient potable water provision as does the entire region of Pando [28]. This can cause higher infant mortality rates, more frequent malaria infections, and more cases of pneumonia. However, the production of potable water within the concept of polygeneration systems is especially attractive for remote areas with insufficient water access [29]. Therefore, the polygeneration system has been enhanced with a water purification subsystem based on thermally driven MD technology. For the potable water demand, a daily minimum of 3 l per person as proposed by the World Health Organisation's guidelines for drinking water has been assumed [30]. With a population of 8,258, this means a potable water demand of 24,774 l/day for the entire locality.

RES potential and costs
As shown in Table 2, the biogas potential has been calculated based on the amount of animals and humans in the locality registered by the national statistics institute of Bolivia [31,32]. A collection factor has been added to account for any losses during the collection and transportation processes. The biogas price has been calculated based on the local average cow dung price with a value of 10 USD/ton [14]. An average transport distance of 50 km has been assumed due to the proximity of nearby localities and conservative average transport costs of 6.5 USD/t for manure and liquid slurry have been used in the calculations [33]. Considering further a price of 10 USD/t for cow dung [14], an average dry matter ratio of 20% and average biogas yield of 0.3 m 3 /kg DM (s. Table 3), a biogas price of 0.28 USD/Nm 3 has been calculated.
The monthly average values for solar global horizontal irradiance (GHI) and the clearness are provided by the NASA Surface meteorology and Solar Energy database and are shown in Fig. 6 [34]. The clearness index indicates how much of the extraterrestrial horizontal radiation arrives on a horizontal surface on the earth. With an annual average radiation of 4.84 kWh/m 2 /day and an annual average clearness index of 0.50, the potential for solar energy can be considered as rather high.

Polygeneration system design
The polygeneration system designed for the case study is shown in Fig. 7. The biomass is transformed into biogas in the AD, where also bio-slurry is produced as a side-product, which can be used later as fertilizer. The biogas leaving the AD is cleaned using various technologies (filter, cyclones, scrubber etc.) and then pumped to the biogas storage dome. Whenever the engine is started, biogas is drawn by the gas engine and combusted to generate electricity and heat. In the first heat exchanger (HEx), the heat of the exhaust gases is transferred to the cooling liquid and the gases are then emitted into the environment. In the second HEx, the heat between the engine cooling circuit and the feed water circuit for water purification is exchanged. The heated feed water is pumped into various MD units.where it is evaporated, then pressed through a hydrophobic membrane, and eventually condensed using a cooling plate. The cold side of the MD unit is connected to the AD in order to keep the AD at optimal temperatures above 35 C. A schematic diagram of the MD separation process is shown in Fig. 8 and another explanatory figure can be found in the supplementary material. A very informative and more detailed description of the purification process used in air gap MD systems has been provided by Noor et al. [38]. In case the cooling liquid is too hot, the temperature of the engine cooling liquid is further lowered for optimal engine cooling conditions in the third HEx and then returned to the engine. The kinetic energy of the engine shaft is transformed into electricity within the generator. The electric control system based on the dispatch control decides when to use the engine and/or the batteries to satisfy the electricity demand. The DC of the batteries and the PV panels is converted to AC using the converter and vice versa when excess energy from the engine is stored in the batteries [39].

Technical inputs
Key technical variables for the model are shown in Table 3. The size of the AD has been calculated to 150 Nm 3 based on the biomass availability shown in Table 2 and values provided by Teymoori Hamzehkolaei et al. [40]. The biogas production has been randomized with an hourly fluctuation of ±5% to account for inevitable process disturbances [41]. Furthermore, to account for downtimes, either scheduled (e.g. regular maintenance) or unscheduled (e.g. unexpected breakdowns), the biogas production has been set to zero for four days during three different occasions within the year (on the 1st of April, 1st of August and 1st of December) [42]. It has been assumed that the produced biogas has always the same chemical composition and hence the same LHV of 6.9 kWh/m 3 . For the additional electric load due to the AD system and gas storage, a value of 0.7 kWh per Nm 3 of biogas stored has been assumed [43,44]. The dimensions of a biogas storage dome are based on a technical data sheet by Sattler Ceno TOP-TEX GmbH [45].
The engine performance based on the Patruus 370 BG CHP model by 2G Energy AG [46,47] is shown in Fig. 9. Exemplary values for HEx mass flows, temperatures, and heat transfers for a 370 kWe engine at full load are shown in the supplementary materials. Thermal efficiencies have been assumed to be 90% for the HEx and 90% for the MD unit [48]. Other losses (.e.g. due to distribution) have been neglected. The minimum value of DT employed in the system is 3.16 K for the heat transfer between the jacket fluid and the heating circuit. In the simulations, all values have been adjusted proportionally depending on the optimal engine size calculated by the model.

Economic inputs
For the different parameters, values from scientific and commercial references have been used as shown in Table 4. Due to the rural environment with complicated access, additional transport and installation obstacles may arise during initial construction as well as for replacement. To account for these uncertain parameters, additional reserve costs of 500 kUSD have been assumed based on the authors' experience with previous systems. For transport, the costs for renting trucks with drivers have been considered [33]. As the farmers can bring their biomass to sell it profitably, it has been assumed that they cover the transport costs of biomass and bio-slurry. For the bio-slurry, it has therefore been assumed that the bio-slurry will be distributed to the farmers in exchange for the transport costs. For the diesel price, the diesel opportunity price (1 UDS/l) has been chosen, which approximately represents the price for diesel on the international market [57].

Economic
The optimal component sizes for the polygeneration and the reference system are shown in Table 5. Although peak demand reaches up to 450 kW, demand values above 330 kW occur less than 1% of the time, which is the maximum permitted by the capacity shortage constraint. Hence in the reference case a 330 kW e is sufficient. Notably, the peak power output of the PV system exceeds the maximum conversion capacity of the converters so that nearly 500 MWh/year of excessive PV power are generated, which neither can be stored nor used directly. A larger converter or more batteries could prevent this albeit with an increase in costs. The required size of the PV panels would be equivalent to the size of one large football field [53]. The parasitic load to due biogas processing and water purification is equivalent to approx. 10% of the client load of the locality.
The NPC for each component and for each category is shown in Fig. 10. The total costs over the lifetime of 20 years for the polygeneration system are nearly 2 MUSD smaller than for the reference system equivalent to savings of more than 22%. This can be attributed mostly to the revenue from the water sales as well as diminutive costs for biomass compared to diesel. However, the capital investment costs as well as the replacement costs exceed those of the reference system by several million USD. At the end of the project lifetime, the salvage value of the battery system is approx.1 MUSD indicating that this set of batteries could still operate for several years after project termination. In direct comparison the LCOE of the polygeneration system is 27.4% lower with 0.297 $/kWh compared to 0.409 $/kWh for the reference system. The relatively larger difference in LCOE compared to NPC can be attributed mostly to the larger amount of electricity served by the polygeneration system, which is not accounted for by the NPC.

Energetic
An exemplary electricity generation curve for one week in October is shown in Fig. 11. For most days, the PV panels generate enough power during the day to simultaneously charge the batteries as well as to serve the electricity demand. After sunny days, the batteries can serve most of the demand with the engine operating only in the morning hours. However, after days with less PV output the engine has to start more often to serve the load while most often charging the batteries as well.
A summary of the yearly system inputs and outputs is given in Table 6. The extra demand for biogas storage and water purification raises the electricity demand slightly. As the biogas production only stops during maintenance days, bio-slurry is constantly produced at around 334 kg/h, while potable water production occurs only sporadically when enough heat from the engine can be utilized. The Table 3 Summary of the technical component input data.

Ecologic
More than 3000 t/year of bio-slurry would be produced. With a max. load of 30 t [33], every three to four days one truck would have to collect biomass and redistribute the bio-slurry. The diesel consumption of the reference system would imply that a 30 t transport truck would have to arrive approximately every 12 days. As most petroleum in Bolivia is refined in the South, an average transport distance of 1350 km (distance from El Sena to Gualberto Villarroel Cochabamba Refinery) has been assumed. As shown in Table 7, the CO 2 -emissions for the biomass system would lead to a reduction of more than 98% when compared to the reference system. The difference in CO 2 -emissions between the two systems is visualized in Fig. 12.

Sensitivity analysis
The results of the sensitivity analysis for the economic performance of the polygeneration system and of the reference system are shown in Fig. 13. The polygeneration system performs better or close the reference case system for all scenarios with capital costs at 75% and 100%. Only with capital costs of 125% and low fuel prices of 75%, the polygeneration system can be outperformed by the fossil fuel based system. However, while the capital costs will be known beforehand and the biomass costs are dependent on only regional factors, the costs for diesel are very dynamic and dependent on many national as well as international factors out of the municipality's control. This leads to significant uncertainty for long-term financial planning.

Polygeneration system
The biomass resources of the locality could not satisfy the electricity demand entirely, so that enhancing the system with solar technology is necessary when aiming for a 100% renewable energy system. In consequence, the algorithm calculated that large capacities of PV panels and batteries would be necessary. On the one hand, this leads to a flexible energy system, which relies on two different energy sources and hence is more resilient. On the other hand, this increases capital investment costs immensely, which could complicate the financing process when looking for public and private investors. Despite of the high capital investment costs, the polygeneration system has considerably lower project lifetime costs than the reference system. This is especially due to much lower fuel costs stemming from locally available biomass as well as due to the potable water sales, which would lower operation costs substantially. The sensitivity analysis showed that, when compared with the reference system, the polygeneration systems is much more robust towards changes in fuel prices but much more susceptible to changes in the capital investment costs. This indicates that once the polygeneration system is constructed the municipality will have a financially more secure and stable energy system. This is also why the sizing of the components and their consecutive costs are crucial for a cost-effective design of the entire system underlining the importance of the optimization algorithm.
Although the produced water could only satisfy 8% of the assumed minimum potable water demand of the locality, the provision of potable water at low costs is another incentive for the local administration to support the polygeneration system financially. The MD system can therefore be considered as a supplemental water supply system providing high quality water to clinics and other critical areas. A compromise between a bio-solar and a fossil-fuel based system could be contemplated, where the CO2reduction potential may not be as high but the necessary investment costs could be lowered. A substitution of electricity from PV panels with more electricity from diesel combustion would also further increase the MD-subsystem operation time. This could also be a convenient solution in case the population and hence the  electricity demand rises beyond the expected scope of this study. Introducing the bio-slurry redistribution system would close the nutrition cycle, but also require a well-adjusted system for mass and nutrition flows [66]. Depending on the business strategy, more sophisticated post-treatment of the digestate can be contemplated in order to produce high quality fertilizer. A selling price for the fertilizer could further improve the system economics. The advanced technologies of the system would require several educational courses for local technicians and highly qualified personal as well as proper communication structures with the component manufactures for maintenance and reparation issues in order to operate the system safely. Considering further the complexity of the system, the planning and installation process should be carefully executed.

Dispatch control
The results of the validation and of the case study show that the algorithm successfully optimized the system for project lifetime costs given the limitations of biomass and solar resources as well as the need to serve the electricity demand. However, optimizing the economic performance of the system is just one of many possible optimization objectives with another option being minimizing CO 2 -emissions. Even within the selection of economic parameters, a reduction of capital investments costs or operational costs may be favoured over project lifetime costs depending on the business strategy. Nonetheless, the algorithm can easily be adopted to optimize similar energy systems employing the strength of longand short-term storage technologies (e.g. hydro-pump storage with super-capacitors). Using MD for potable water generation is only one of several possible extensions for the system to reach high energy efficiency by transforming the waste heat of the engine. Other possible extensions like hot water generation, room heating, refrigeration etc. can be considered depending on the system location and demand characteristics.
A considerable trade off of the control mechanism lies in the high flexibility it demands from the gas ICE, because sporadically turning the engine on and off leads to lower engine lifetime than continuous operation. When designing a polygeneration system with the help of the algorithm, it should be aimed for an engine that can withstand such exigencies. Nonetheless, modern gas engines used in the land transport sector should be able to comply easily with these requirements. Future investigations could also take into account a more dynamic biogas generation profile, where the biogas composition and hence the LHV value fluctuate. Alternatively, other less cost-oriented component size configurations could be studied, where a smaller biogas engine works more continuously and hence produces potable water more continuously, while the PV panels and batteries cover the major part of the electricity demand.

Conclusion
A model introducing a novel dispatch control strategy for the optimization of polygeneration HESS using biogas and batteries has been developed. The control algorithm regulates the two storage   technologies with the aim to maximize capitalization on the biomass resources. The control strategy within the model allows for economic optimization of project lifetime costs under the constraints of biomass resource availability and electricity demand. If the amount of available biomass is insufficient to fulfil the electricity demand, PV panels and batteries are added as additional energy resource and storage options. The model calculates the residual thermal energy of the combustion process within the ICE in order to allow.) for a further increase in energy efficiency of the system via additional heat-driven energy-related services (e.g. water purification, heating, cooling, etc). The model has been applied in a case study for a rural off-grid locality in Bolivia, where in the reference case a diesel-based system serves the electricity demand. The biogas potential has been calculated and a polygeneration system has been designed, which produces electricity, purified water, and fertilizer in form of bioslurry. The polygeneration system performs economically much better than the reference system with 22% lower project lifetime costs and shows much more robustness towards fuel price changes according to the results of the sensitivity analysis. Nonetheless, high capital investment costs may be an obstacle for the realization of the project. As an additional advantage, CO 2 -emissions could be reduced by more than 98% and the locality could achieve a much more sustainable and autonomous energy and water supply system. The developed model can help scientists, engineers, and investors in the design process of renewable energy systems. Furthermore, it underlines that in rural areas smartly designed biomass-based polygeneration systems represent a viable economic alternative.

Declaration of competing interest
The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.