#### Abstract

The hybridization of two or more energy sources into a single power station is one of the widely discussed solutions to address the demand and supply havoc generated by renewable production (wind-solar/photovoltaic (PV), heating power, and cooling power) and its energy storage issues. Hybrid energy sources work based on the complementary existence of renewable sources. The combined cooling, heating, and power (CCHP) is one of the significant systems and shows a profit from its low environmental impact, high energy efficiency, low economic investment, and sustainability in the industry. This paper presents an economic model of a microgrid (MG) system containing the CCHP system and energy storage considering the energy coupling and conversion characteristics, the effective characteristics of each microsource, and energy storage unit is proposed. The random forest regression (RFR) model was optimized by the gravitational search algorithm (GSA). The test results show that the GSA-RFR model improves prediction accuracy and reduces the generalization error. The detail of the MG network and the energy storage architecture connected to the other renewable energy sources is discussed. The mathematical formulation of energy coupling and energy flow of the MG network including wind turbines, photovoltaic (PV), CCHP system, fuel cell, and energy storage devices (batteries, cold storage, hot water tanks, and so on) are presented. The testing system has been analysed under load peak cutting and valley filling of energy utilization index, energy utilization rate, the heat pump, the natural gas consumption of the microgas turbine, and the energy storage unit. The energy efficiency costs were observed as 88.2% and 86.9% with heat pump and energy storage operation comparing with GSA-RFR-based operation costs as 93.2% and 93% in summer and winter season, respectively. The simulation results extended the rationality and economy of the proposed model.

#### 1. Introduction

The government and legislative authorities incentives to use new energies, concerns about the high and rising price of fossil fuels including its scarcity, and environmental issues are the most important motivations for the integration of renewable energy resources into conventional power systems [1, 2]. In these circumstances, new technologies such as the combined cooling, heating, and power (CCHP) technology can organically combine heating, cooling, and power supply to realize the cascade utilization of energy, help to improve the utilization rate of energy, and reduce the emission of pollutant gases [3, 4]. In the context of promoting the rapid development of clean energy and the energy coupling with the microgrid (MG) the CCHP system and MG technology are combined [5, 6]. Many researchers dealt with this concern but the considerable research gap still needs to fill with the impact of the energy coupling of the CCHP and the optimization problem of the MG [7]. The traditional heat-fixed electricity can no longer meet the scheduling requirements as the peak-valley load difference continues to increase. How to realize the coordinated optimization of the three kinds of energy of the CCHP system and improve the flexible adjustment capability of the system is considered as the key issue for the proliferation of these useful systems [8, 9]. The CCHP system can make better advantages of the MG platform. The network mainly includes renewable energy units, energy conversion, and storage units [10]. Its object-oriented areas are smart buildings, isolated islands, and other areas. These systems integrate multiple energy inputs and outputs, and the comprehensive energy utilization rate of the system can reach 80%, which is important for promoting the coordination and complementarity of advantages among multiple energy sources, improving the efficiency of energy use and reducing the emission of undesirable gases [11]. Authors in [12] took the energy supply of commercial buildings as an example, taking the three indicators of the operating cost, energy utilization rate, and C02 emission reduction of the CCHP system as the objective function modelling and detailed analysis of the system’s sensitivity to changes in various indicators. Authors in [13], based on the characteristics of the CCHP system and mathematical model, accurately characterized the conversion relationship between the three types of energy in the network, such as cold, heat, and electricity, and optimized the operation of the CCHP system under different scheduling strategies. Authors in [14] established the optimal flow model of the energy flow of the MG parameter under the two typical operating modes of the CCHP system and reflected the coupling of the power and natural gas parameter through the energy supply rate index.

A component-based analysis for the CCHP system outlined by [15] includes energy generation units, heat recovery units, and thermal storage systems. Authors in [15] presented comprehensive comparisons of technology and proposed a general method of selecting the correct CCHP program for different applications. Authors in [16, 17] included a detailed overview of the energy system and the requirements for selecting an appropriate system structure. In this study, authors in [18] have discussed the CCHP method with two or more renewable sources of electricity. Authors in [19] reviewed the progress of small-scale energy system production within trigeneration systems. The authors stressed the energy and environmental advantages of small-scale systems and pointed out that the main obstacle to market penetration is the high initial cost [20]. It is found that optimizing micro- and small-scale system operations is harder than large-scale systems due to technical, law, and policies restrictions. Authors [21] had identified the profits of polygeneration systems concerning zero energy constructions. In this study, authors [22] presented the CCHP system equipment evaluation, planning, operation, and component modelling. However, the CCHP system can cool and heat during power supply and these energy sources cannot be absorbed in the system at the same time, resulting in low energy utilization or waste [23]. Therefore, to meet the constraints of the distributed microsource and energy storage unit operating characteristics, energy supply, and demand balance, the advantage of the proposed GSA-RFR model is its generalization ability. However, due to the different energy source characteristics of different systems, the input characteristics of the prediction model should be selected according to the actual condition of energy source so as to improve the accuracy of the model in specific period. So, this paper proposes the GSA-RFR approach in the CCHP operation scheduling model including heat pumps and energy storage units into the MG system. The detailed scheduling model for MGs with heat pumps and energy storage including wind turbines, photovoltaic cells, microgas turbines, ground source heat pumps, and energy storage units is presented. Considering the energy coupling characteristics in the grid and the operating characteristics of each distributed microsource and energy storage unit, the optimum output of each microsource and energy storage unit and the total cost of the system compared with optimized approaches, proposed GSA-RFR based approach, shows comparatively better performance.

#### 2. Microgrid Energy System Description

In grid-connected insulated modes, the characteristics of MG are flexible operating and can improve grid efficiency and safety [24]. If the MG unit can acquire refrigeration power from the grid, the unit can maintain a stable system frequency if it monitors the voltage of the grid. However, the MG antennas are designed to be used on remote islands, where a primary concern is the control of this type of frequency [25]. The MG concept is proposed by the consortium for solutions in electric reliability systems (CERTS) [26]. The CERTS can be characterized as a decentralized entity consisting of multienergy resources and controllable electric and thermal charges. These storage devices are connected to the upstream power generation grid using photovoltaic panels, wind farms, fuel cells, CCHP system, and microturbines (e.g., batteries or super-capacitor) [27]. The electrical grid can be seen as a regulated cell of the power system from an electrical utility perspective. As a part of the point of view of the customers, the MG can be designed carefully to meet the requirements for reliability as well as energy savings, improving efficiency, minimizing voltage sag, and powering a continuous current [28].

The MG with the energy storage system has become a promising component of future implementation of the smart grid [29]. Unlike grid power, however, the system's renewables do not supply a steady stream, matching supply needs as they change, and as a result, the MG system oscillators often do not lower loads or alter their frequency. Therefore, to avoid sudden fluctuations in energy from renewable sources, storage systems are needed to help balance out low-power and high-power systems [30]. The MG structure and energy conversion process with heat pump and energy storage in this paper are depicted in Figure 1. The wind turbines and photovoltaic cells belong to renewable energy units, which use natural energy to generate electricity, and natural gas consumption units including gas boilers, fuel cells, and microgas turbines are depicted in Figure 1. They use natural gas combustion power to provide energy, and microgas turbines and bromine-cooled units have covert the CCHP system and can recycle high-temperature flue gas during power generation [31, 32].

When the supply of cold (heat) power is insufficient, it can be used to make up the shortage while the gas boiler is used as auxiliary supply equipment for cold (heat) load [31, 32]. The energy storage unit consists of three parts, battery, cold storage, and hot water storage tank. The voltage level of the MG system is 380 V, which is connected to the 10 kV medium-voltage distribution parameter through a common node.

#### 3. Proposed Model

##### 3.1. The System Model Description

The optimal scheduling model of the MG with heat pump and energy storage established is a mixed-integer nonlinear programming problem. The general solution expression of the model is as follows:where the optimized scheduling variable *x* represents the output of each microsource and energy storage unit, the power consumed by the ground source heat pump, the transmission power with the external power grid, and so on. The inequality constraints include the maximum power constraint of the power grid and the operating characteristics constraints of each microsource and energy storage unit. To maintain the safety of the operation process of the MG system, it is necessary to take into account the constraints of the system's energy balance, unit start-up and shut down, and so on in actual operation.where F_{M} is the total operating cost of the system, *T* is the optimization period, *C*_{F} (*t*) is the unit fuel cost, *C*_{M}(*t*) is the operation and maintenance cost, and *C*_{S} (*t*) is the unit start-up cost during the *t* period, respectively. The interactive cost of electric energy *C*_{E} (*t*) and cooling (heating) *C*_{C} (*t*) is presented.

The fuel cost is calculated as follows:where *C*_{NG} and *L*_{NG} represent the unit cost of natural gas and low calorific natural gas, *Q*_{GB} (t) is the output thermal power efficiency of the gas-fired boiler, *P*_{FC} is the fuel cell power, *η*_{FC} is the fuel cell efficiency, respectively, while *t* is the output of the controllable unit at the time *t*.

The operation and maintenance cost is calculated as follows:where *K*_{M,t} is the unit maintenance cost for generating unit; *K*_{M,j} is the number of controllable units; *P*_{CG,i}*(t*) is the output of renewable energy unit *t* period; *K*_{ES} is the unit maintenance cost of the energy storage device; and *M* indicates the controllable unit *j* in the start-stop state during time *t*.

The unit start-up cost is calculated as follows:where *V*_{i} (*t*) = 1 is the start-up state; otherwise, it is the shutdown state; *C*_{S,i} is the controllable unit start-up cost.

The electricity cost is calculated as follows:where *P*_{grid},_{sup} (t) and *P*_{grid,dem} (t) are the power supply and demand power of the power grid during the period *t* and *K*_{dem} (t) is the electricity demand price.

The refrigeration (heat) profit is calculated as follows:where *K*_{c} and *K*_{h} are the predicted costs of cooling and heat load during the period, respectively; *Q*_{co} (t) is the unit cooling and *Q*_{he} (t) is the heating source.

The energy balance constraints are calculated as follows:where *P*_{BS} (*t*) is the power of the storage battery, *Q*_{CS} (*t*) is the cold storage, and *Q*_{HS} (*t*) is hot water storage tank in the *t* period, while *P*_{load} (*t*) is the predicted cost of the electric load in the *t* period.

The grid power constraints are calculated as follows:where *P*_{sup, max} is the maximum power supply and *P*_{dem, min} is the demand power for the grid. The multiple energy sources coordinate the coupling and conversion to minimize the total operating cost of the system.

The controllable unit constraints are calculated as follows:where is the minimum start-up time and is the minimum shutdown time of unit *i* and *j*, *C*_{ES} is the capacity of the energy storage unit, *P*_{ch, max} is the maximum input power, and *P*_{dis, max} is the maximum output power of the energy storage.

The energy storage unit constraints are calculated as follows:where *λ*_{max} and *λ*_{min} are the maximum and minimum state of the energy storage, respectively.

##### 3.2. The GSA-RFR Algorithm

The GSA algorithm needs to determine the fitness function to evaluate the advantages and disadvantages of the RFR model corresponding to each node. The crossover will produce a new particle as follows:where *r* is a random number between 0 and 1; and are the velocities of particles *X*_{i} and *X*_{j}; and *X*_{i} new and new are the positions and velocities of the new particle, which will replace *X*_{i}. For excellent particles, the strategy of dynamic updating inertia factor is adopted.

In the early stage, is selected to enhance the global searchability. The smaller was selected in the later stage to achieve a more sophisticated search [33]. The update formula of the inertia factor is shown in the following equation:

The mean square of residual was selected as follows:where *σ*^{2}_{y} is the variance of the predicted cost and *R*^{2}_{RF} is the mean square of residual error. The random forest can calculate the importance of each input feature [33], as shown in the following equation:where *n*_{k} is the importance of node *k*; *n*_{j} is the node with the feature *I* as the feature division; , , and are the proportion of the number of samples in node *k* and its subnodes to all the samples, respectively; and *M*_{k}, *M*_{1}, and *M*_{2} are the mean square errors of node *k* and its subnodes.

The procedure of the proposed algorithm is shown in Figure 2.

#### 4. Result and Discussion

##### 4.1. System Parameter

In this paper, the MG system under grid connection is selected as a case study and is optimized. The network mainly includes wind turbine, photovoltaic cells, fuel cells, CCHP, and energy storage units. The specific model shows the advantages of clean energy, wind turbines, and photovoltaic cells which are given priority in their output, and the MPPT operation mode is adopted. Figure 3 shows the predictive curves of wind, photovoltaic output, cooling, heating, and electrical loads assuming that both the heating and cooling power in summer in the MG parameter are zero where the optimal scheduling period is *T* = 24 h and the unit time Δt = 1 h.

**(a)**

**(b)**

The power generation cost of the unit is not included, only the operation and maintenance cost of the new energy unit is considered. For the different energy supply requirements in summer and winter in the MG parameter, two typical seasons were selected for analysis, and corresponding optimization scheduling strategies were formulated. The operating parameters of the microenergy parameter are shown in Table 1, the energy storage unit parameters are shown in Table 2, and the other parameters are shown in Table 3. Assuming that the microturbine, fuel cell, and ground source heat pump are in the shutdown state at the initial operation, the start-up costs of the unit are 1.94, 2.21, and 1.32 $, respectively.

##### 4.2. Analysis of Typical Season

###### 4.2.1. Summer Season

To validate the economic and energy-saving effects of the proposed model, the operation optimization model without heat pump and cold storage unit was selected for comparison. On a certain summer day, the optimization results without ground source heat pump and energy storage unit are shown in Figure 4. In Figure 4, the net load cost is the predicted cost of the electrical load minus the wind turbine and photovoltaic output without ground source heat pump and cold storage unit.

**(a)**

**(b)**

The CCHP system must first supply the demand for cooling load, and the microgas turbine operates in the mode of “fixing electricity with cold.” If the cooling load is insufficient, the gas boiler will make up the shortfall. In this mode of operation, the CCHP system needs to follow the changes in cooling power at all times. Due to the restriction of the energy coupling relationship, the adjustment capability of its electric power is greatly restricted, and it cannot be added to the optimized operation of the system autonomously. Therefore, the cost of the system in this operating mode is relatively high. The optimization results of electricity and cooling power of the MG with heat pump and cold storage in summer are shown in Figure 5.

**(a)**

**(b)**

The results show that the cooling load in the MG is jointly met by the CCHP system, energy storage unit, and heat pump device. The power required by the heat pump and the electrical load in the grid is composed of wind turbines, photovoltaic cells, grid power, CCHP systems, fuel cells, and battery equipment connect during the period of 0–7 and 23-24, and the demand for electricity and cooling load of the MG is relatively low. At this time, the electricity supply price of the external power grid is the lowest, and the power generation costs of distributed microsources (microturbines and fuel cells) in the grid are higher than the electricity supply price of the power grid. Therefore, the electrical load is first to supply from the grid to supply the user's electrical energy needs, and the shortage is supplemented by the fuel cell, the cold load is supplied by the ground source heat pump, and the CCHP system is in a shutdown state during this period. Since the heat pump cooling consumes less electric power, the supply of electrical load can fully meet the requirements during the periods of 7–10, 15–17, and 20–22, and the supply and sale price of external power grids were moderate. The generation cost of distributed microsources in the grid is higher than the power supply price and lower than the price of power demand. The insufficient part chooses to supply power from the grid microsources of the system which is preferentially called to meet the user's electrical energy demand. If the demand for the cooling load is small, the heat pump is driven by electric energy for cooling; if the demand for the cooling load is large, the CCHP system will start for cooling energy during the period of 10–15 and 18–21, and the price of supply electricity and sold by the external power grid is the highest. The electricity demand price of the power grid is higher than the generation cost of distributed microsources, and each microsource is at rated power as much as possible and demands electricity to obtain economic profits. The CCHP system is selected to supply the cooling load demand, and the heat pump equipment is shut down during the entire optimized dispatch period. When the external electricity price is low, releases the electrical energy is released; when the external electricity price is high, the battery stores electrical energy. The charging and discharging state is determined by the grid electricity price. The cold storage unit can absorb the cold energy output by the ground source heat pump at night and release it when the cold load demand is high during the day. The energy storage unit can realize the peak-valley difference transfer of the load within the grid, thereby reducing the total operating cost of the MG.

###### 4.2.2. Winter Season

According to the heating needs of users in winter, the operating state of the heat recovery device in the MG parameter CCHP system is switched to operate in the combined heat and power mode, and the cycle state of the heat pump compressor is changed for heating. On typical winter days, the optimization results of MG power and thermal power without heat pump and heat storage are shown in Figure 6, and the optimization results with the heat pump and heat storage are shown in Figure 7. A brief analysis of the operation optimization results of the winter MG system is presented in Table 4 and Figure 7.

**(a)**

**(b)**

**(a)**

**(b)**

###### 4.2.3. Optimum of Economic

To test the advantages of introducing ground source heat pumps and energy storage units in the MG, the peak-cutting, valley-filling, and energy utilization indexes in the grid were analysed. The peak-cutting and valley-filling index *F*_{n} is evaluated by the minimum square sum of various load change rates during the dispatch period, and the energy utilization index *F*_{m} is evaluated by the total energy input and output ratio presented in (10). The heat pumps and energy storage units into the MG system have significant advantages in terms of economics, peak and valley filling, and energy utilization. The main energy source of the MG is the external power grid and natural gas power generation. The time-phase electricity cost curve of electric energy is shown in Figure 8, the unit cost of natural gas is 2.52 $/m^{3}, and the low heating cost is 9.68 kW h/m^{3}. The electricity cost curve of the microgrid indicated and authenticated the proposed GSA-RFR optimization, while without optimization and GA, PSO approaches show comparatively higher values, which are not in favour of system operation (Figure 8). The cost of the MG parameter under the two scheduling methods in summer is shown in Table 5. It can be seen from the comparison of the operating costs of the MG in Table 5 that the introduction of heat pumps and cold storage units has good economic profits for the MG. The gas cost of the microsource during the optimization period is reduced by 24.9%, and the total operating cost of the system is reduced by 15.8%.

The demand for cold load in summer is low, and the demand for heat load in winter is high. There is a certain difference between the two. If the heat pump is used to supply electricity from the power grid for heating at night and the CCHP system is not started, the energy supply needs of users cannot be met. If the unit capacity of the ground source heat pump is further increased, there will be a situation where the equipment utilization rate is low and the initial investment cost is higher. The costs of the MG parameter under the two scheduling methods in winter are shown in Table 5. From the optimization results in Table 5, it can be seen that the gas cost of the microsource during the winter optimization period is reduced by 18.9%, and the total operating cost of the system is reduced by 17.6%.

The peak-shaving, valley-filling, and energy utilization indicators of the MG are shown in Table 4. On the analysis of the data, the peak-shaving and valley-filling index is higher than that of GSA-RFR presented in Table 4. The energy storage unit can shift a load of electricity, cooling, and heat from the peak period to the valley period, thus effectively reducing the load on the network peak-valley difference. The heat pump CCHP cost is higher, which can output heat energy that consumes three times the electrical energy. Its efficiency is much higher than that of common energy equipment, so the energy utilization rate is higher. Due to the high energy efficiency coefficient of CCHP cooling in summer, the cost of obtaining the same energy is lower, so the energy utilization rate in summer is slightly higher than that in winter.

To analyse the advantages of the different modes, a comparative analysis of the comprehensive cost of the MG under the two scheduling modes is carried out, as shown in Figure 9. It can be seen from depicted results that GSA-FRFR brings significant economic profit to the MG parameters compared with other modes and reduces the operation cost by 3.6%.

#### 5. Conclusion

The perfection in the modelling of the energy storage system with economic optimization characteristics is the key features of next-generation energy technologies. Nonetheless, there are still issues to developing a physically attractive/efficient and energy storage system that is cost-effective for electronic as well as hybrid vehicles. The model we are going to use to test this is a mixed-integer program. By given data, the integrated parameters, the output cost, and the total cost of the grid are obtained. The simulation verification shows that the integration of the heat pumps and energy storage units into the MG parameter can improve the coupling relationship of the three energy sources of the CCHP system. The MG sources including wind, photovoltaic, CCHP systems, fuel cells, and energy storage unit complementary and coordinated operation are also realized. According to the analysis of the peak-cutting, valley-filling, and energy utilization indexes, the heat pump can improve the energy utilization rate and reduce the natural gas consumption of the microgas turbine, and the energy storage unit has the function of realizing load peak cutting and valley filling. Energy efficiency’s numerical costs validated the proposed GSA-RFR optimization, which is calculated as 93.2% and 93%, comparing 88.2% and 86.9% of heat pump and energy storage costs in the summer and winter season, respectively. Owing to the limitations of the RFR model, if the actual cost exceeds the range, the prediction result may produce a greater deviation. This problem can be improved by expanding the range nodes. The proposed model provided a certain reference for the modelling planning and optimal scheduling of the MG parameter. This study is expected to be a significant contribution concerning the maturity of energy storage technologies for microgrid application, which is likely to dominate the electricity market need.

#### Abbreviations

C_{CH}: | Cooling (heating) profit of the system |

CCHP: | Combined cooling, heating, and power |

C_{E}: | Interactive cost of electric energy |

CERTS: | Consortium for solutions in electric reliability systems |

C_{ES}: | The capacity of the energy storage |

C_{F}: | Unit fuel cost |

C_{M}: | Operation and maintenance cost |

C_{NG}, L_{NG}: | Unit cost of natural gas and low calorific natural gas |

C_{S}: | Unit start-up cost |

C_{S,i}: | Controllable unit start-up cost |

F_{M}: | Total operating cost of the system |

K_{c}, K_{h}: | Predicted costs of cooling and heat load |

K_{dem}: | Electricity demand price |

K_{ES}: | Unit maintenance cost of the energy storage device |

K_{M,j}: | Number of controllable units |

M: | Controllable unit |

MG: | Microgrid |

P_{BS}: | Power of the storage battery |

P_{CGi}: | Output thermal power efficiency of the gas-fired boiler |

P_{ch, max,}P_{dis, max}: | Charging/discharging output power |

P_{dem, min}: | Demand power |

P_{grid}: | Active power |

P_{grid},_{pur}, P_{grid,dem}: | Supply and demand power |

P_{load}: | Predicted cost of the electric load |

P_{pur, max}: | Maximum supply and demand of power |

PV: | Photovoltaic |

Q_{co}: | Unit cooling |

Q_{CS}: | Cold storage |

Q_{GB}: | Low calorific cost of natural gas |

Q_{grid}: | Reactive power |

Q_{he}: | Heating source |

Q_{HS}: | Hot water storage tank |

t: | Time |

T: | Optimization period |

: | Shutdown time |

: | Start-up time |

λ_{max} and λ_{min}: | Maximum and minimum state of the energy storage. |

#### Data Availability

The data used to support this study are cited in the manuscript.

#### Conflicts of Interest

The authors declare that they have no conflicts of interest.

#### Authors’ Contributions

M. S. N. was responsible for conceptualization, formal analysis, and methodology of the study and wrote the original draft. S. D. reviewed and edited the manuscript and developed software. W. A. S. validated the study and reviewed and edited the manuscript. M. A. performed formal analysis. A. Y. K was responsible for original draft preparation and investigation. A. N. A. was involved in conceptualization, investigation, formal analysis, and reviewing and editing of the manuscript. P .S. was involved in investigation and reviewing and editing of the manuscript.

#### Acknowledgments

All the authors are highly grateful to their affiliated institutes and universities for providing all the necessary services.