A two-layer multi-energy management system for microgrids with solar, wind, and geothermal renewable energy

The inherent intermittency of high-penetrated renewable energy poses economic and reliable issues of microgrid energy management. This study proposes a two-layer predictive energy management system (PEMS) for high-renewable multi-energy microgrid (MEM). In this MEM, geothermal, solar, and wind energy is converted and conditioned for electricity, thermal, and gas supplies, in which multi-energy complementarities are fully exploited based on electrolytic thermos-electrochemical effects. The proposed microgrid multi-energy management is a complicated and cumbersome problem because of their increasingly tight energy couplings and uncertainties of renewable energy sources (RESs). This intractable problem is thus processed by means of a two-layer PEMS with different time scales, where the system operating costs are minimized in the upper layer and the renewable fluctuations are coped with in the lower layer. Simulation studies on a high-renewable MEM are provided to indicate its effectiveness and superiority over a single time scale scheme. Simulations results show that the operating cost can be reduced by 22.2% with high RESs accommodation.

In order to cope with the economic issues and environmental pollution, the utilization of 100% renewables have received the attention of extensive researchers and investment opportunities from operators because of its carbon neutrality and cost reduction performance (Bao et al., 2020b;Bao et al., 2020c;Jin et al., 2020). Based on the energy hub concept, the biogas, solar, and wind 100% renewables Xu et al., 2021;Zhang et al., 2021) are formulated as a MEM for multienergy carriers, including electricity, thermal, and biogas. Since it can be predicted easily, hydro energy is integrated in Dasgupta et al. (2020), Neto et al. (2020), and Li et al. (2022) to provide local complementarity of solar and wind energy. Based on the P2G technology, ammonia is formed with solar and wind as a 100% renewable MEM  for coupled electricity, heat, and H 2 supplies. Geothermal energy, as a potential RES, can provide multi-energy services, and high-temperature water can be directly fed in a geothermal-to-hydrogen (GTH) electrolyzer for electrolytic gas production (Xu et al., 2020). Extensive efforts by Tasnin and Saikia (2018) and Yilmaz (2020) have explored several different geothermal source combined heat and power systems (GSCHPs) and developed general thermo-economic property. Wind, solar , and geothermal energy are proposed for electrical and multi-energy supplies in Jordehi et al. (2021) and Xu et al. (2022). However, the multi-time scale energy management based on complementary couplings of geothermal, solar. and wind RESs to cope with their inherent intermittency and undispatchability is not involved yet.
In this study, a two-layer predictive energy management system (PEMS) is proposed for geothermal, solar, and wind MEM. Table 1 summarized the differences of typical works. The contributions of the study are as follows: 1) Geothermal, solar, and wind 100% renewable complementarities is proposed to form a MEM, where the input community renewables are efficiently conditioned/ converted for output multi-energy supplies. Compared to other electrical microgrids with constant P2G efficiency, thermodynamic behaviors of GTH under fluctuant solar and wind energy feedback are fully analyzed based on a resistor-capacitor network to exploit the 100% renewable multi-energy complementarities. A multi-energy coupling matrix is formulated to systematically express the multienergy integrated processes. 2) A novel two-layer PEMS is proposed for geothermal, solar, and wind MEM where the system operating costs are minimized in the upper layer and multi-energy supply and demand uncertainties are minimized in the lower layer. Compared to previous PEMS with single time scale, such PEMS allows the optimization of multi-time scale interactive multi-energy couplings for cost-effective enhancement. 3) A short-term multi-energy supply and demand forecasting method is developed based on multi-factor fusion. Instead of only using the supply and demand data in previous literatures, the meteorological factors are also considered, which are extracted based on copula theory to identify their importance and subsequently used to facilitate multienergy supply and demand forecasting in the extreme gradient boosting (XGBoost) algorithm.
The rest of this article is organized as follows. The problem formulation of multi-energy microgrid is presented in Section 2. In Section 3, the framework of two-layer management system is formulated. Comparative simulation studies under several different schemes are implemented in Section 4 to demonstrate the superiority of the proposed method. Finally, the study is concluded in Section 5.

Problem formulation
The geothermal, solar, and wind microgrid energy management involves not only the individual management of multi-energy carriers but also their multi-time scale interactive multi-energy couplings. While the solar and energy can be directly delivered to multi-energy consumers, geothermal energy can be utilized properly to take complementarity into consideration by tapping abundant high-temperature geothermal water to produce clean hydrogen. The thermoelectrochemical reaction performed in the GTH electrolyzer is a fast dynamic process in comparison to other conversion and storage devices (Xu et al., 2020). In such cases, it may be uneconomic to coordinate all the microgrid devices in a single scale because of their different response and degradation cost characteristics. Also, hybridization of geothermal, solar, and wind renewables need to consider individual variability in energy supplies and operational availability. Therefore, the geothermal, solar, and wind microgrid management cannot be easily solved using traditional approaches owing to uncertainties of multi-energy supply and demand, multi-energy couplings, and multi-time scale coordination.
To utilize the geothermal, solar, and wind multi-energy complementarities, this study aims to 1) model and explore the multi-energy complementarities and 2) solve the microgrid multienergy management problem in a multi-time scale way. Figure 1 shows a geothermal, solar, and wind MEM for multienergy supply and demand based on the energy hub concept. The proposed MEM functions as a crucial bridge between RESs at the input port and energy-consuming. In this microgrid framework, the

Frontiers in Energy Research
frontiersin.org hybrid renewable energy is first integrated into photovoltaic thermal system (PVT), wind turbine (WT), electrolyzer, and GSCHP into multi-energy carriers, which are delivered to the consumption of community electricity, heat, and H 2 loads. In this microgrid system, when solar power is unavailable at night, wind turbines could run to generate electricity, which took solar and wind energy complementarity into consideration. Different from solar and wind energy that is greatly affected by environment and meteorological conditions, stable geothermal energy is a flexible RES and can be converted to different energy carriers. The obtained H 2 is an advantageous gas, which can keep variable RES in reserve and alternatively convert into electricity and heat. BES and H 2 tank serve as energy storage devices to store and condition superfluous energy. When solar and wind energy is scarce, the electrical and gas energy in ESS could be discharged to energy conversion devices in order to obtain an economical and reliable energy supply solution. Flexible energy storage and conversion provide more flexible multienergy pathways for enhancing economical energy management and RESs accommodation.

Hybrid energy storage
The aim of hybrid ESS is to inherit the advantages of heterogeneous ESSs in the aspect of response characteristics, operational costs, power and energy density, and flexibility. The hybrid energy storage in this study consists of a H 2 storage system and BES because of their mutually complementarities. The H 2 storage system is generally composed of an electrolyzer and a H 2 tank. The degradation cost of ESS is a common metric to evaluate economic operation of the microgrid. While the main degradation BES is derived from battery, the main degradation of the H 2 storage system is derived from the electrolyzer. The degradation of battery lifetime includes the degradation of cycle life and capacity. The number and rates of charging and discharging make a difference on the battery lifetime. Contrary to the complicated battery degradation, only the operating time and on/off cycling conditions have effects on electrolyzer degradation. Remarkable advantages of the electrolyzer in the aspect of low customer acquisition cost, easy to scale up, and long durability is propitious to maintain a longer lifespan and not suffer from cycling issues (Xu et al., 2020). Especially, because of the small capacity in the microgrid, the degradation cost of the electrolyzer or the H 2 storage tank is relatively small compared to the BES degradation cost. The hybrid ESS plays a role in offsetting the fluctuations from multi-energy supply and demand and alleviating unnecessary discharging/ charging of BES. Consequently, the hybrid ESS has different objectives, where H 2 storage is introduced to operate as the primary energy storage mode for supply and demand balance and the BES should be developed to cope with the instant energy unbalances.

Energy forecasting
In the microgrid, the energy balance between energy production and consumption must be stay at balance to avoid system operation interruptions. Compared to traditional generation systems, the multi-energy supply and demand are generally undispatchable. Thus, energy substitutes are needed to offset the fluctuations of renewable energy when they are scarce in the short term. Better forecastings allow the microgrid manger to deploy less energy storage; however, the problem gets more complex when considering multi-energy carriers. Here, the short-term multienergy supply and demand forecasting includes forecasting multi-energy loads and solar and wind renewable energy. Though short-term forecasting can be offered up to 7 days in advance, day-ahead multi-energy supply and demand forecasting is adopted to accommodate the market mechanisms and energy management systems. Here is the implementation process of the developed forecasting method: 1) Quantitative analysis is performed based on Copula theory to shed light on the inherent nonlinear relationships among external meteorological factors (including meteorological condition, and geographical location) and multi-energy supply and demand. The key meteorological factors are thus obtained to explore the model for forecasting accuracy enhancement; 2) Multi-energy supply and demand forecasting is performed based on XGBoost algorithm . XGBoost arranges all the column data in advance and stores them in blocks in the form of compression. Different blocks can be stored in a distributed way, or even in a hard disk. In feature selection, these column data can be processed in parallel to achieve parallelization, and multithreading can be used to achieve acceleration. 3) The commonly used performance indexes, including root mean square error, mean absolute error, and mean absolute percentage error are adopted to evaluate the multi-energy supply and demand forecasting accuracy.
3 Two-layer predictive energy management system 3.1 System model 3.1.1 Thermo-electrochemical model Based on thermo-electrochemical effects, GTH is another potential energy storage since excrescent electricity and thermal energy can be used to produce storable H 2 . The model of producing H 2 is shown as follows: Supposing that reaction environment and electrolytic solution are given, and temperature of electrolyte would be the prime affecting factor on reaction courses and H 2 generation. By using the piecewise linear, the H 2 can be modeled as shown in (2) by fitting the measured data (Clegg and Mancarella, 2015;Xu et al., 2020;Yilmaz, 2020).
The GTH reaction affected by many internal and external factors is complicated, and a RC thermodynamics model is introduced to be convenient for the electrolytic reaction analysis. With the classical lumped parameter method (Xu et al., 2020) the temperature, heat storage and transfer properties are processed into equivalent thermal resistance and capacitance at their geometric center. Based on the Fourier's law, the GTH dynamics can be expressed in (3) and (4).
From the thermodynamics model in (1)-(4), the gain H 2 yield owing to feedback of excess electrical and thermal energy in electrolyzer can be obtained, and multi-energy complementarities can be fully exploited.
With respect to (3), the nonlinear differential thermodynamic model of electrolyzer is handled by means of a Jacobian linearization approach, which are discretized to further problem solving: where T k and T k+1 are temperature state vector; A and B are state and input matrix; u k represents the RESs heating and GTH enthalpy uxes. This approach is proved in  to be effective and feasible for nonlinear differential equations.

Multi-energy coupling matrix
According to the converter efficiencies and dispatch factors of conversion and storage devices, microgrid is formulated as a multi-energy coupling matrix in (6) to provide multi-energy flexibility for cost-effective supplies.
By assigning outputs of multi-energy conversion and storage devices as state variables, the nonlinearity in (6) can be handled. The input vector E in (6) could combine with state variables as E′ in (7), as follows: 3.1.3 Energy supply and demand constraints Constraint (8) represents multi-energy supply and demand balance, which includes total, supplied, and shed loads. Constraints (9) and (10) limit load shedding and maximum electricity to market.
S buy,k ≤ S buy, max , S sell,k ≤ S sell, max .

Energy storage system constraints
Constraints (11)-(18) represent state of charge (SOC) balance in hybrid ESS, which includes physics ranges and limits.

Energy conversion constraints
Constraints (19) represents the limits of multi-energy converters.

Mathematical Model for upper layer predictive energy management system
The operational objective function of the upper layer is the minimization of the system operating costs. Since the fuels of Frontiers in Energy Research frontiersin.org conversion devices are obtained from GTH, the system operating costs only includes power procurement cost PC k and demand shedding cost DC k .
PC k μ buy,k S buy,k Δk − μ sell,k S sell,k Δk.
DC k μ p DL e,k + DL h,k + Q H2 DL g,k Δk.
The upper layer PEMS problem in the can be formulated as follows:

Mathematical model for lower layer predictive energy management system
The operational objective function of the lower layer PEMS is to minimize the effects raised from multi-energy supply and demand forecasting errors. By obtaining parameters from , the battery degradation cost BC k can be calculated as follows (24): BC k P ch,k + P dis,k μ cd Δk, μ cd μ BES r BES a 1 a 2 1 − SOC BES,avr + a 3 exp a 4 T out,k E R 1 − SOC BES,ref .
The effects raised from multi-energy supply and demand forecasting errors in short-time scales can be formulated as the deviations of references from the upper layer PEMS. The deviations can be augmented with penalty costs to form the penalty terms and can be formulated as a quadratic function: By integrating the degradation cost of BES and quadratic penalty factors, the lower layer PEMS problem can be formulated as follows: variables: V GS,tl , S B,tl , S CHP,tl , S F,tl , P gth,tl , S ef,tl , S hf,tl , DL e,tl , DL h,tl , DL g,tl , P ch,tl , P dis,tl , SOC H2 ,tl , SOC BES,tl , S buy,tl , S sell,tl .

Problem solving
As for the two-layer PEMS, the objective is to optimize the energy dispatch in a finite period, so that a reasonable allocation of energy resources is explored to operate economically under volatility and intermittent of multi-energy supply and demand. Based on the model predictive control framework, the two-layer PEMS is formulated as a discrete-time optimization problem with different time scales, where multi-energy supply and demand uncertainties can be corrected through feedback mechanism. Figure 2 shows the flowchart of the proposed two-layer PEMS. The upper layer PEMS is composed of a receding model predictive controller, and the lower layer PEMS is a quadratic model predictive controller. In the upper layer, system operating costs is minimized by solving objective function at the current moment and looking ahead the remaining time slots considering the forecasting of multi-energy supply and demand. Only the optimal results at the current time will be delivered as the base values to the lower layer. After the awareness of multi-energy supply and demand forecasting errors, energy fluctuations each short time interval is minimized in the lower layer PEMS. The lower layer PEMS would return the value to correct the associated value obtained from the upper-layer, and the PEMS problem will start for the next time until the last moment.

Case study 4.1 Base data
Here, the proposed two-layer predictive PEMS is verified on geothermal, solar, and wind MEM. The diagrammatic drawing of MEM and the flowchart of PEMS are illustrated in Figures 1, 2. In order to evaluate its practical performance, the system is equipped with PVT, WT, GSCHP, boiler, CHP, furnace, BES, and H 2 tank whose installed capacities are set as 1 MW, 1 MW, 500 kW, 1 MW, 1 MW, 1 MW, 1 MWh and 1000 m 3 , respectively. To achieve interaction with the electricity market and promote the diversified renewable accommodation, the feedin price is obtained from (Zhou et al., 2017a) and it is set as 0.04 $/kWh. The actual parameters of the all kinds of multi-energy devices in microgrid system obtained from (Xiao et al., 2010;Zhou et al., 2018;Xu et al., 2020) in demand are listed in Table 2.

Comparative results
To demonstrate the validity and superiority of the proposed two-layer PEMS of geothermal, solar, and wind MEM, comparative schemes are performed: 1) Scheme 1 is the proposed two-layer PEMS for geothermal, solar, and wind MEM in Sections 2, 3; Frontiers in Energy Research frontiersin.org 2) Scheme 2 is the proposed two-layer PEMS without consideration of the battery degradation cost in (24); 3) Scheme 3 is the single-layer PEMS for the proposed MEM in Section 2.
The three operation schemes are performed for a 24 h with upper and lower layer time intervals setting as 1 h and 15 min, respectively. All the schemes are coded on GAMS on a laptop with 2.3 GHz Intel Core i5 CPU and 8GB RAM, and solved with its default settings. Figure 3 shows the purchase and sale of daily electricity of schemes 1-3. It can be shown that, because of abundant solar and wind energy during noontime and lower electricity price, a large amount of electricity will be bought at dawn. Scheme 2 is performed with very similar purchase and sale as scheme 1 though without considering the degradation cost. Because of single-layer PEMS, the electricity in scheme 3 is tended to be bought timely to accommodate the shorter time scale fluctuations of solar and wind energy. When considering the intra-hour energy fluctuations, the microgrid in scheme 3 has to buy more electricity for multi-energy supply and demand balance. Figures 4, 5 show the daily outputs of BES and H 2 tanks. Energy storage units are in the state of charging when renewable energy is abundant and sufficient, and are discharged to replenish energy when renewable energy is insufficiency. Although the curve of scheme 1 is performed similarly as scheme 2, less electricity is charged in scheme 1 due to the consideration of the degradation cost. It also can be found that the hybrid ESS in the microgrid can efficiently accommodate the fluctuant solar and wind energy based on their complementary characteristics. While the H 2 tank is charged during hours 1-3 and 11-14 to cope with intermittent solar and wind energy to reduce unnecessary BES degradation, the BES is charged and discharged on a short time scale to compensate unstable renewable energy and load owing to their short-term volatility.
The daily outputs of multi-energy converters in schemes 1-3 are shown in the Figures 6-8. The three forms of energy, electricity, thermal and gas can be flexibly converted in multiple energy conversion devices. The high-efficiency CHP and BES in system can meet unstable renewable energy and fluctuant multienergy loads, while boiler and furnace are used as auxiliary equipment. The output of CHP is at high level to provide electricity and thermal energy because of low-level SOC of BES during hours 18-24. It also can be concluded from Figures 3-8 that the proposed two-layer PEMS scheme can reach efficient coordination among diverse multi-energy conversion equipment, hybrid ESS to regulate the multi-  Frontiers in Energy Research frontiersin.org

Frontiers in Energy
Research frontiersin.org 08 energy carriers. For example, during 6-8 hours, the outputs of BES, furnace, and CHP in schemes 1 and 2 stay at low level, while boiler is used to follow the peak thermal demand. Table 3 lists the system operating cost, battery degradation cost, electricity procurement, load shedding, and renewable accommodation of schemes 1-3. It can be found that the proposed two-layer PEMS can cost-effectively explore the multienergy complementarities to supply the multi-energy loads. It is shown that the battery degradation cost of scheme 1 is decreased by 5.5% comparing with schemes 2, which mitigate unnecessary BES charging/discharging actions because of the consideration of battery degradation costs in scheme 1. In terms of scheme 3, the SOC of H 2 tanks always stays at high level and electricity is purchased and sold timely with electricity market, which results in lower degradation cost. While sufficient electricity is purchased in the single-layer PEMS, the proposed scheme 1 takes the fluctuation of renewable energy in 15 min into account to reduce system operating cost. As a result, the electricity procurement cost and operating cost of scheme 1 is decreased by 29.5% and 22.2% compared to schemes 3. Because of the synergistic effects of hybrid renewables and electricity market, load shedding is 0 and solar and wind accommodation is 100%. In conclusion, the comparative schemes confirm the advantages of the proposed two-layer PEMS.

Conclusion
A geothermal, solar, and wind MEM is proposed for sustainable multi-energy supplies and a two-layer PEMS is proposed to exploit their 100% renewable complementarities from multi-time scales. The two-layer PEMS is performed by considering hybrid ESS degradation characteristics, in which the operational cost is minimized in the upper layer for a long term and fluctuations by multi-energy supply and demand forecast errors are minimized with shorter time intervals in the lower layer. It can be concluded: 1) With the multi-time scale mutual multi-energy couplings, cost-effective utilization of geothermal, solar, and wind

FIGURE 8
Daily furnace outputs of schemes 1-3. RESs can be achieved. More specifically, the operating cost and electricity procurement cost of the proposed two-layer PEMS are decreased by 22.2% and 29.5%. 2) The hybrid energy storage can be utilized complementarily at two layers for multiple decision-making objectives, and the battery degradation cost is decreased by 5.5% because of the consideration of degradation cost.
3) The proposed two-layer PEMS can coordinate energy sources efficiently and accommodate renewable energy at high penetration.
Further research would focus on the multi-time scales of multiple energy carriers.

Data availability statement
The original contributions presented in the study are included in the article/Supplementary Material; further inquiries can be directed to the corresponding author. σ EC and σ BC Coefficients of the penalty cost and battery degradation cost W WT,k , G PVT,k , and E geo,k Input wind, solar, and geothermal energy η ch and η dis Efficiencies of battery charging and discharging η B , η F , η e,CHP , η h,CHP , η e,GS , and η h,GS Efficiencies of multienergy converters Variables BC k Battery degradation cost DL e,k , DL h,k , and DL g,k Shedding value of multi-energy loads DC k Load shedding cost E pg,k Net electricity procurement L e,k , L h,k , and L g,k Supplied multi-energy loads P dis,k and P ch,k Power of battery discharging and charging P BES,k and V GS,k Net outputs of BES and gas storage P gth,k GTH input PC k Electrical purchasing cost Q RES,k Thermal energy for GTG Q reaction,k GTH enthalpy uxes F u Upper layer system objective function F l Lower layer system objective function S buy,k and S sell,k Amounts of electricity bought and sold SOC BES,k and SOC H2,k SOC of battery and H2 storage S B,k , S F,k , and S CHP,k Outputs of boiler, furnace, and CHP S ef,k and S hf,k Renewable energy for reaction heating T Z,k Temperature of electrolysis V H2,k H2 generation ν B,k , ν CHP,k , ν F,k , ν e,k , ν h,k , and ν g,k Factors of input energy flowed to devices and loads η H2,k Electrolytic efficiency of the GTH Frontiers in Energy Research frontiersin.org