Game‐based distributed energy‐sharing model for prosumers in microgrids considering carbon emissions and its fast equilibrium‐finding method

In recent years, energy sharing has attracted a lot of attention. However, the intermediate platforms in centralized energy‐sharing methods cause the rapid growth of communication complexity and the risk of privacy leakage. Unlike complex energy‐sharing market mechanisms, in this paper, a simple and efficient distributed energy sharing for microgrids (MGs) is proposed, where game theory is employed to form flexible prices for prosumers and only local information is used to improve the privacy protection of prosumers. First, prosumers located in different areas are characterized more precisely and a two‐tier carbon emission cost model is built. Next, a game‐theory‐based distributed energy‐sharing model is proposed, where a flexible pricing mechanism is developed to enable prosumers to independently reach price agreements and achieve supply–demand balance within MGs. In the process, optimization models for obtaining equilibrium are formed and only local information is needed. However, solving these optimization models is generally time‐consuming. So, a distributed optimization method based on weighted subgradients is proposed to accelerate the equilibrium‐finding process. Finally, four cases are designed, and simulation results demonstrate that the prosumers' costs of our method are reduced by 7.5%–22.5% compared to the costs obtained by feed‐in tariff. Moreover, in the case of solving the distributed trading model for an MG at a 24‐h time scale, the iteration numbers of our method are only 38.9% and 49.3% of the two traditional solving methods.


| INTRODUCTION
With the further development in industrial production, China's carbon dioxide emissions are projected to exceed 13 billion tons by 2030. 1 As renewable energy technologies such as photovoltaic (PV) and wind turbines continue to advance, China is steadily advancing lowcarbonization goals. 2,3To efficiently consume renewable energy and improve energy utilization efficiency, microgrid (MG) technology is widely applied. 4,5An MG is an integration of loads, distributed generation, and energy storage systems (ESSs) that cooperatively operate to supply power. 6,7It has the advantages of improving power supply reliability and flexibility in operation. 8,9nder the new energy supply mode, traditional energy consumers equipped with distributed energy generation can not only generate to compensate for their energy consumption but also store surplus energy through ESSs or send energy back to the main grid; these individuals are called prosumers. 10,11n recent years, due to the rapid development of digital network communication technology, energy sharing in MGs has been widely studied. 12,13Energy sharing can achieve energy balance, increase renewable penetration, and enhance MG independence. 14Currently, there are studies reporting on energy sharing among prosumers in MGs 15 ; prosumers can not only trade with the main grid but also engage in energy sharing with other prosumers inside MGs.It can help direct energy along the shortest path among prosumers, reducing energy losses and improving overall energy efficiency.Additionally, prosumers can adjust their flexible resources to maximize their utilities, further promoting the proactivity of prosumers in energy sharing. 16As a result, the construction of the retail energy market is beginning to shift from the traditional centralized model of energy production and consumption to a decentralized and collaborative trend. 17,18urrently, energy-sharing methods of MGs can be divided into centralized methods, weakly centralized methods, and fully distributed methods according to whether there is a coordination control center.The centralized methods have been widely used in the energy-sharing management (ESM) of MGs involving prosumers.Basically, MG operators (MGOs) are responsible for ESM.An energy-sharing method for PV prosumers in MGs based on the Stackelberg game was proposed where the MGO acts as the leader to be responsible for formulating the energy-sharing prices, prosumers as followers, adjust their load according to the prices. 19A peer-to-peer (P2P) energy-sharing method for MGs was proposed by Zhang et al., 20 where the energysharing participants are prosumers or consumers from the residential, office, and industrial sectors.Nevertheless, the MGO needs to facilitate P2P information exchange, and prosumers or consumers need to bid through an energy-sharing platform.
In the above-mentioned methods, there are usually some drawbacks, including: reliance on MGOs, which can lead to system paralysis, transaction disruptions, and data loss in the event of MGO failures.Additionally, there are issues of low transparency and flexibility.With the increase in the number of traders, the problem scale will increase significantly, resulting in high operating costs and low operating efficiency of MGOs.Consequently, there is a growing trend toward decentralized research on energy-sharing methods in MGs.Distributed energy sharing can better encourage competition, which benefits in lowering energy prices.It is of great significance for the future development of MGs.
In practical applications, prosumers are selfinterested, making it prioritize trading fairness and privacy.If centralized methods are used to devise energy-sharing plans for prosumers, which takes the overall operating profit of the MG as the primary objective, it is highly probable that the interests of some prosumers will be compromised.Passively enabling some individuals to exchange energy will reduce their proactivity for engaging in energy-sharing activities. 21The game theory method is an effective approach to represent competition in a market.It provides effective support for encouraging competition and is beneficial for reducing energy prices. 22,23At present, there is existing research on the distributed energy-sharing mechanism of MGs based on game theory, mainly including noncooperative game and cooperative game. 24For MGs with PV prosumers, a P2P energy-sharing model of MGs based on noncooperative game theory considering the supply-demand ratio (SDR) pricing mechanism is proposed. 25By using prosumers as virtual MGs, the P2P energy sharing between prosumers is modeled as a Stackelberg game to optimize the interests of consumer groups. 26A distributed P2P energy-sharing model of MGs based on a noncooperative game approach is proposed.However, the center coordinator is still needed in the energy sharing to collect the energy exchange information of each agent. 27A distributed multi-MG energy-sharing mechanism is proposed and analyzed using the Stackelberg game framework, which proves that the Stackelberg equilibrium solution uniquely exists and can be used as a distributed energy-sharing strategy. 28In Li et al., 29 a novel trading energy-sharing framework based on noncooperative game theory was proposed to deal with the economic issues in energy sharing and the technical issues in distribution system operation in a holistic manner.
In the pricing methods for energy sharing among prosumers, the feed-in tariff encouraged the widespread integration of renewable energy sources by offering financial incentives to prosumers. 30However, prosumers could not flexibly determine their electricity prices under the feed-in tariff, which causes their benefits not to be maximized.Generally speaking, there are two types of price mechanisms, synchronous and asynchronous energy pricing. 31The synchronous energy pricing determines the energy-sharing prices based on market objectives such as maximizing social welfares or minimizing production costs.The pricing method based on the SDR is a typical synchronous energy pricing, where SDR can be obtained by dividing the total energy supply by the total energy demand of a market.However, prosumers may refuse to provide their own information and expect the right to autonomous pricing.On the other hand, asynchronous energy pricing allows prosumers to independently determine energy-sharing prices based on their own benefits, thereby eliminating the influence of centralized markets.This primarily includes gametheory-, auction-, and bargaining-based pricing. 32These methods are widely used in distributed energy-sharing markets.
For the decision-making and the model-solving methods for energy sharing in MGs, a distributed convex optimization framework was proposed to minimize the total costs of islanded MGs, and a subgradient-based method was used to solve the problem. 33However, the convergence of the method was not analyzed specifically.Additionally, a new P2P energy-sharing framework with distribution network security constraints was considered, 34 where a generalized fast dual ascent method was used to solve the problem.The convergence rate of the method was significantly improved.However, the market operator was needed to calculate and broadcast information.To better protect privacy, the alternating direction method of multipliers algorithm was applied to solve the distributed energy sharing among prosumers, in which prosumers only needed to exchange limited information with their neighbors. 35Further, an iterative double auction mechanism was developed to optimize electricity pricing in a localized P2P electricity trading model. 36Next, an auction market self-adaption algorithm was designed to reach a unique NE of an iterative uniform-price auction mechanism. 37ased on the above-mentioned literature review, some problems in energy-sharing models and methods still exist and can be summarized as follows: 1.In most energy-sharing models for MGs, different characteristics of prosumers are not fully analyzed and discussed, such as their types and carbon emission characteristics.2. For distributed energy sharing, it has long suffered its high computational complexity.Therefore, building a more efficient and effective model for distributed energy sharing is necessary.3. When game theory is introduced to energy sharing, it is really challenging to find the equilibrium quickly and at the same time to protect players' privacy.
To summarize, there are three technical contributions in this paper: 1. Prosumers in different areas are characterized more precisely, which leads to better cooperation and coordination among them.Then, a two-tier carbon emission cost model is built in response to carbon emission issues, including tiered carbon emission cost model and sharing-based carbon emission cost model.2. A game-theory-based distributed energy sharing via flexible prices for prosumers is developed to achieve distributed direct energy sharing among prosumers in MGs.Furthermore, the flexible pricing mechanism for prosumers enables prosumers to decide their energysharing prices, achieving supply-demand balance within MGs and improving the utility of each prosumer.The proposed method is simple and efficient, effectively reducing computational load.3. To accelerate the equilibrium-finding process of the noncooperative games in energy sharing, a distributed optimization method is proposed, where the subgradient information of neighbors is weighted and exchanged among prosumers to update price strategies.Then, a theorem is proved to show the convergence analysis of the proposed method.
The rest of the paper is organized as follows.The system framework of MGs is established in Section 2. Section 3 presents the multiarea prosumer models and the two-tier carbon emission cost model.In Section 4, the energysharing problem in MGs is formulated as a noncooperative game and the flexible pricing mechanism for prosumers is introduced.Next, an improved solving algorithm based on weighted subgradient is proposed and the convergence analysis is shown in Section 5. Cases and results are studied in Section 6.Finally, Section 7 concludes the paper.

| TWO-LAYER ENERGY-SHARING SYSTEM MODEL OF MGS
In this paper, we consider a grid-connected MG system that consists of prosumers in different areas, and the energysharing strategy is formulated by each prosumer in a distributed manner.Therefore, a two-layer energy-sharing system model of MGs is constructed based on a multiagent communication network, as shown in Figure 1.Agents can be matched one by one with prosumers, responsible for aggregating information and computing.
The bottom layer is the physical network of the MG, which is composed of different prosumers, mainly for energy exchange and transmission.The top layer is the communication network containing n agents corresponding to prosumers in the bottom layer, defined as a bidirectional graph is the adjacency matrix of G, which describes the information transmission relationship between nodes, assuming it to be a (0,1) matrix.If there is an edge from node n i to node n j , and i j  , then a = 1 ij , otherwise it is 0. When there is no edge between prosumer i and prosumer j, that is, a = 0 ij , they will not exchange energy at the physical layer, and the energy sharing amount between them is always 0. We call agents connected to agent i as its neighboring agents, and use N i to represent the set of neighboring agents of agent i. Agents exchange information and develop their energysharing plans based on local objective functions and constraints.Information connections are distributed between the two layers, and agents can collect information from prosumers through these connections, or send control signals back to the bottom layer.
In summary, the distributed energy sharing of various prosumers in an MG can be carried out in a two-layer system framework.First, each agent collects prosumer's production and consumption information.Then, based on a certain energy-sharing mechanism, each agent formulates its sharing strategy for the next time slot.Finally, each agent sends the sharing strategy back to the corresponding prosumer in the bottom layer to execute the corresponding scheduling plan.

| ELECTRICITY-CARBON MODELS OF MGS
Due to geographical differences, the production and consumption patterns of prosumers in local energy markets of MGs vary, and their decision-making goals differ accordingly.Also, the carbon emission characteristics of different prosumers and the collaborative carbon emission reduction benefits among prosumers should be considered.Therefore, in this section, the electricity-carbon models of prosumers are built, including several typical prosumer models and a two-tier carbon emission cost model.

| Models of prosumers in different areas
In this paper, prosumers in industrial areas are equipped with a certain number of microturbines (MTs) that can be used commercially.Their power generation and load adjustment capabilities are relatively flexible.Prosumers in urban areas are well regulated, with relatively reliable loads and commercial behaviors.So, there is a high enthusiasm for the installation of PV power generation, making it suitable for centralized and contiguous construction.Due to geographical location, distributed PV energy is relatively abundant while the power consumption is small and scattered in rural areas.Important loads that require high reliability and high-quality energy supply, such as government agencies, airports, and schools, are supplied with power by MTs.Besides, the ESS will be configured to ensure the continuity of power supply.In summary, the prosumers' energy balance constraint can be concluded as follows:   ( ) where n is the number of prosumers in the MG and N i is the set of neighbor prosumers of prosumer i. ( )

MTg
is the energy generated by prosumer i and ( ) , is the quantity of energy that prosumer i sells to prosumer j and P ji i , is the quantity of energy that prosumer i buys from prosumer j.P i L and P i IL are load demand and interruptible load of prosumer i, respec- tively.The interruptible load refers to the portion of the power load that prosumers can interrupt to increase system resilience during high peak or emergency periods through the signing of economic contracts.main grid, the cost of load interruptions, and the cost of scheduling the ESS.Hence, the cost function of prosumer i can be expressed as where is the power generation cost function of prosumer i in industrial areas, μ i 1, , δ i 1, , and υ i 1, are the nonnegative cost coefficients of generators, respectively.
represents the PV power generation cost function of prosumer i.
(is the internal energy transmission cost function of the MG. 33λ i is the energy sharing price of prosumer i and λ j is the energy sharing price of prosumer j. λ b and λ s represent the prices of industrial prosumers importing and exporting energy from the main grid.p ESS is the scheduling cost of the ESS.

For the decision variables
, and λ i in the cost function, the following constraints need to be met: Prosumer i also needs to meet the following generator operation constraints: where ( ) , ( ) are the minimum and maximum outputs of MTs for prosumer i, respectively.

( )
is the maximum value of PV output of prosumer i predicted by historical data.P i ILmax is the maximum interruptible load.
In addition, ESS needs to meet the following constraints: where

| Two-tier carbon emission cost model
In response to the carbon emission issues, a carbon emission measurement method within MGs is proposed.Then, a tiered carbon trading model for prosumers is built, including tiered carbon emission cost model and sharing-based carbon emission cost model.
Distributed power generations such as MTs, which use traditional fossil fuels as driving energy, emit gases during their normal operation, constituting a significant portion of the carbon emissions in MGs.The carbon emissions from these sources of prosumer i can be expressed as where E i MT, is the carbon quota generated by MTs of prosumer i due to carbon emissions.e i MT, is the carbon emission factor per unit of electricity for the MTs of prosumer i.
Unlike MTs driven by traditional fossil fuels, distributed power generations such as PVs, which are driven by renewable energy, generate low-carbon benefits during their normal operation.The additional carbon emissions quotas they create are represented as where E i RES, is the additional carbon quota index generated by renewable energy sources of prosumer i due to their low-carbon benefits.e i PV, is the carbon emission factor per unit of electricity for the PVs of prosumer i Within the MG system, besides directly paying carbon taxes to the upstream distribution system operator (DSO) based on their current carbon emissions, prosumers can also buy or sell carbon quotas from/to others with surplus or deficit quotas.This optimization helps in managing operational costs.Therefore, the carbon emission cost for prosumers consists of two parts: the carbon tax paid to the DSO and the benefits generated from trading carbon quotas with other prosumers.DSO directly distributes a certain proportion of free initial carbon emission quotas to prosumers, as shown where D i is the free initial carbon quotas distributed by DSO to prosumer i. δ i MT, is the free carbon quota factor per unit of electricity for the MTs of prosumer i.
When the carbon emissions generated by prosumers exceed the free initial carbon quotas distributed by DSO, the prosumer needs to pay additional fees to DSO.To minimize the carbon emissions of the MG as much as possible, DSO adopts a tiered charging rule and charges prosumers based on different intervals.The larger the carbon emissions of prosumers, the higher the fees they need to pay.Let D i and E i represent the free initial carbon quotas and carbon emissions of prosumer i, respectively.So, let C D E Δ = − i i , the tiered carbon emission cost model can be represented as where C i CO , DSO 2 is the fees that prosumer ~i needs to pay to DSO due to carbon emissions.When it is a positive value, it indicates the need to pay fees for excess carbon emissions.When it is a negative value, it indicates profits earned by selling some carbon quotas.c CO 2 is the unit carbon emission price.L is the interval length of carbon emissions.α is the growth rate of carbon emission fees.
In addition to directly paying fees to the DSO based on their own carbon emissions after deducting the free carbon quotas, prosumers can also optimize their operational costs by charging or paying additional fees when providing energy to or absorbing energy from other prosumers.These additional fees are for selling or buying indirectly generated carbon emission quotas through energy sharing.The sharing carbon emission cost between prosumers, resulting from sharing carbon emission quotas, can be represented as  ( ) where 2 is the costs of prosumer i due to sharing carbon quotas with other prosumers.When it is a positive value, it indicates the need to pay for purchased carbon quotas.When it is a negative value, it indicates profits earned by selling some carbon quotas.c ij CO , 2 is the unit price at which prosume i and prosumer j share carbon quotas.E ij B is the carbon quotas purchased by prosumer i from prosume j and E ij S is the carbon quotas sold by prosume i to prosumer j.In summary, the total cost incurred by the ith prosumer due to carbon emissions can be represented as

| GAME-BASED DISTRIBUTED ENERGY SHARING VIA FLEXIBLE PRICES FOR PROSUMERS
In this section, a game-based distributed energy sharing via flexible prices for prosumers is proposed.First, the noncooperative game for distributed energy sharing is modeled.Next, to ensure the energy balance in the local MGs, the flexible pricing mechanism for prosumers is presented and the energy balance process in MGs is introduced.

| Noncooperative games for energy sharing
In Section 2, multiarea prosumers in the MG system are modeled, and they have differentiated characteristics.To ZHENG ET AL.
| 1733 effectively promote the proactivity of various prosumers to engage in energy sharing, in this paper, each prosumer has its local decision vector and aims to minimize its local cost, ensuring that the costs of different types of prosumers engaging in the energy sharing are optimized.
In our energy-sharing mechanism, to maintain the supply-demand balance of the entire system, all types of prosumers can function as energy sellers or buyers.Moreover, any prosumer can switch roles between buyer and seller, ensuring flexibility in energy sharing.Hence, the distributed energy sharing can be constructed as a noncooperative game model.
(1) Players: the set M of all prosumers in the MG.
(2) Utility functions: { } where s i 1, , s i 2, , s i 3, , and s i 4, are the local decision vector for prosumers in industrial areas, urban areas, rural areas, and important load areas, respectively.
is the energy buying matrix of prosumer i and is its energy selling matrix.Assume that in the game model composed of n prosumers, the strategy choices made by each player are represented by combinations s s s ( *, *, …, *) and S i is the strategy space of player i.When any player i makes a decision strategy s* i , which makes its cost satisfy At this time, the Nash equilibrium (NE) is reached, and no player can reduce its cost by changing its strategy.
In summary, let s k  11), ( 16) − (20), = , The last constraint means the sold energy of prosumer i should be equal to the total amount of energy bought by other prosumers, we call it a global coupled constraint.
Proposition 1.There exists a NE in the proposed noncooperative game among the prosumers.
Proof.The local strategy space S i of prosumer i is a closed, bounded, and convex subset of a finitedimensional Euclidean space.The cost functions are continuous and strictly concave on S i . 33Hence, according to Lee et al., 28 the proposed noncooperative game among the prosumers has a NE.□

| Flexible pricing mechanism
Based on the two-layer system framework and noncooperative game model proposed above, next we address the flexible pricing mechanism of our method.
To achieve the balance between the energy demand and the energy offer in MGs, the global coupled constraint is considered in Equation (24).To relax the global constraint, we give a flexible pricing mechanism for prosumers in the game process, which is designed as follows: before the game starts, the initial values of the energy-sharing prices of all prosumers are set to λ b .Subsequently, for the kth iteration, the energy sharing price of prosumer i should be updated as where β is a fixed iteration step size, here it is assumed to be 0.3.P ij i , represents the selling energy to agent j optimized by agent i at the kth iteration, and represents the energy demand for agent i obtained from agent j, that is, P ∈ .It can be seen from Equation ( 25) that the energysharing price of prosumer i is related to the difference between the total energy demand from its neighbors and its total energy sales.When its total energy sales are less than its neighbors' total energy demand, that is, , its sharing price λ i k+1 will rise, thereby reducing the neighbor's energy demand Conversely, when its total energy sales are greater than its neighbors' total energy demand, λ i k+1 will fall, thereby . When all prosumers' energy sales match their neighbors' total energy demand, that is,  , their energy sharing prices will no longer change.

Meanwhile,    
holds, it means the supply-demand balance of the distributed energy sharing market is achieved after the evolution of sharing prices.
Finally, we conclude the energy balance process in Figure 2. First, each agent (i.e., market participant) collects the corresponding prosumer's power generation and load forecast information for the next time slot, then it needs to exchange initial energy prices with neighboring agents in the communication network.Next, each agent engages in the noncooperative game to update their sharing prices and the exchange energy until the NE of the game is found, which means the energy demand matches the energy supply globally.Last, each agent sends the optimized energysharing strategies to the corresponding prosumer.In this way, energy sharing in the MG for the next time slot is completed.

| DISTRIBUTED WEIGHTED SUBGRADIENT METHOD FOR FAST NE FINDING
The traditional distributed solution method is generally time-consuming to solve energy-sharing models.To improve the equilibrium finding speed and accuracy, in this section, a subgradient-based distributed algorithm is proposed.

| Distributed weighted subgradient method
The distributed energy-sharing problem can be regarded as an alternating iterative optimization process, which is consistent with the idea of the dual ascent method. 34The idea is that, for each prosumer, a coupling constraint   is considered to couple P ij i k , and P ij j k , .After that, Equation (2) becomes the objective function after relaxing the coupling constraints with λ i as the multiplier. 33Due to the convexity properties of the local problems of prosumers, the dual function of the cost function with coupled constraint for prosumers is the problem of maximizing with respect to λ i as follows: The algorithmic procedure for the dual ascent method based on the subgradient algorithm is as follows: ( ) where g i k is the subgradient of h λ ( ) i at λ i k .
Due to the fixed iteration step size, the convergence rate of the distributed approach is slow.Meanwhile, prosumer i's sharing price is partly decided by the energy requests from neighboring prosumers.Under the premise of considering the overall supply and demand balance constraint of the MG, the prices of neighboring prosumers are coupled.Hence, if neighboring prosumers exchange subgradient information with each other, it will speed up the acquisition of the equilibrium.So motivated by Wu et al., 38 a weighted subgradient method is introduced to speed up the convergence of the distributed approach for obtaining NE.During each iteration, each agent exchanges subgradient information with its neighbors according to a certain weight, so as to reach the equilibrium faster.The expression of the energy sharing price of prosumer i is updated as ( ) F I G U R E 2 Distributed energy sharing process.
where β k is the iteration step size.W w = ( ) × is the weight matrix at kth iteration, which is used to represent the information weight relationship between any two agents in the multiagent network.
is the subgradient information of prosumers, where . a k be a positive parameter of the step size.Since obtaining the optimal solution for h λ ( * ) i in the dual function is challenging, it can be replaced with the function's least upper bound or an estimate. 39n this paper, the weighted matrix W k is determined by adjacency matrix A a = ( ) ij n n × and energy demand collected by each prosumer at (k − 1)th iteration.For prosumer i, the weight of prosumer j' s subgradient is given by Such a weight coefficient changes with iterations, reflecting the influence coefficient of prosumer j on the energy-sharing price of prosumer i.
The following algorithm summarizes the decisionmaking process of each prosumer.At the beginning of each iteration, prosumer i first collects the sharing prices of its neighbors.Then, it formulates its energysharing strategies with the goal of minimizing its local cost.Next, it collects the energy demand information from its neighbors, calculates the weight coefficients, and updates its sharing prices.When the change in sharing prices between two consecutive iterations for each prosumer is within the error range, it can be considered that the energy-sharing strategies of each prosumer no longer changes, and the NE has been found.
Algorithm.Distributed approach for solving NE.
, each agent i do 3: Exchange λ i k with neighbors.

| Convergency analysis
In this section, a theorem is proved to indicate that the optimal point can be obtained by our method.Theorem 1 is given as follows: Proof.The Proof of Theorem 1 is given in Appendix A.
According to the theorem, holds.This implies that as the iterations progress, λ i k becomes progressively closer to the optimal value.Therefore, { } forms a monotonically decreasing sequence with a lower bound.Then, the convergence of our method can be proved.

| SIMULATION RESULTS
To evaluate the performance of our method, in this section, four cases are designed and the results are presented and discussed.The first case shows the energysharing results of MG when our method is applied.The second case compares the costs of prosumers and the net energy under different energy-sharing methods to test the performance of our method in the economic level and the improvement of the energy-sharing proactivity of prosumers.The third case focuses on the impacts of participation or withdrawal of prosumers from energy sharing.The fourth case focuses on the comparison of convergence rates and accuracies of NE obtained by our method and two other methods.

| Parameter setting
A grid-connected MG simulation model is established in MATLAB/Simulink according to actual data collected from Chongqing, China.The setup and parameters of prosumers and ESS are shown in Tables 1 and 2. Latin Hypercube Sampling method is applied to generate scenarios and k-means clustering is used to reduce complexity.Consequently, this process produces load curves and PV output power curves of typical scenarios, as shown in Figure 3.The unit subsidy cost for load interruption in industrial and urban areas are both calculated at 25$/MWh.In addition, the free carbon quota factor for MTs is 0.4 t/MWh, and their unit power carbon emission factor is 0.45 t/MWh.Renewable energy distributed generation units have an additional marginal carbon quota factor of 0.05 t/MWh.In the tiered carbon cost model for prosumers, the initial segment's unit carbon emission price is 31.08$/t, the carbon emission interval length is 2t, and the carbon emission cost growth rate is 1.The interprosumer carbon quota trading unit price is 36.64$/t.

| Case 1: Results of distributed energy sharing in an MG
Using the distributed energy sharing method proposed in this paper, we calculate the energy sharing and scheduling strategies of multiarea prosumers in different time slots in a day.The supply-demand balance of prosumers, the optimization process of sharing prices, and the energy-sharing process are analyzed to demonstrate the effectiveness of our method.Figure 4 shows the variation process of sharing prices of prosumers in slot 23.
Figure 5 shows the energy-sharing information of prosumers in time slot 23. Figure 6 shows the optimization results of internal supply and demand balance of different prosumers.Figure 7 shows the equilibrium sharing prices of different prosumers in different time slots.
From Figure 4, it can be seen that each prosumer adjusts its sharing price based on supply and demand starting from the initial import energy price $\lambda_b $.The sharing prices of all prosumers will tend to be stable, eventually reaching equilibrium.We find that the converged sharing prices can reflect the load demand of each prosumer in this time slot: the higher the load demand of a prosumer in this time slot, the higher its sharing price will be.If the prosumer's load demand is low, it can produce additional energy at a lower cost to make a profit, and its sharing price will be lower accordingly.
Figure 5 presents the buying matrix and selling matrix of prosumers in t = 23 h, where the ith column of the buying matrix represents the energy demand of prosumer i from neighboring prosumers, and ith row of the selling matrix represents total energy that neighboring prosumers sell to prosumer i.The energy sharing in MGs can only be completed when these two matrices are paired which means the sum of the ith row of the buying matrix is equal to the ith row of the selling matrix.Combined with Figure 4, we can see that in t = 23 h, prosumer 2 not only has a high load demand but also cannot produce more energy to feed its demand, so its sharing price is the highest.Prosumer 3 adjusts its sharing price to the lowest in the MG to sell more energy as much as possible.Prosumers 1 and 4 are both sellers and buyers in this round.They both buy energy from prosumer 3 at a lower price and sell excess energy at higher prices to reduce their local costs.
From Figure 6, we can clearly see that the upper part representing the energy supply and the lower part representing the energy consumption of prosumers are symmetrical, so the supply and demand of each prosumer in each time slot of the day are balanced.
In time slots 1-7 and 24, for dispatchable-output prosumers 3 and 4, their generation costs are higher than the cost of importing energy.At the same time, for prosumers 1 and 2 relying on PV generation, their energy generation is almost zero.Therefore, there is no surplus energy available for energy sharing in the MG during these time periods, and all prosumers import energy from the main grid to meet their local load demand.
For prosumer 1 located in the rural area, its daily load demand is relatively small, so it is one of the main selling prosumers in the MG when its PV output is high.In time slots 8-17, its PV generation is greater than the demand, so it sells excess energy to other prosumers at a sharing price higher than the energy export price λ s of the main grid.While in time slots 18-23, to feed its local loads, it purchases insufficient energy from other prosumers at buying prices lower than the energy import price λ b of the main grid.In other periods, since there are no selling prosumers in the MG, prosumer 1 can only import insufficient energy from the main grid.For prosumer 2, due to its location in urban areas, its PV generation is relatively small compared to prosumer 1, and its daily load demand is relatively large, making it one of the main purchasing prosumers in the MG.| 1737 For prosumer 3, due to its dispatchable output and interruptible load, it behaves very flexibly: in time slots 1-7 and 24, the cost of importing energy from the main grid is relatively low, so it chooses not to generate and imports all and only the energy it consumes.In time slots 8-16, due to the large amount of selling by PV prosumers and the relatively low energy prices, prosumer 3 mainly purchases energy; meanwhile, it will produce a small amount of energy to feed its local loads.During time slots 17-23, due to the exit of PV prosumers from competition and the supply shortage in the MG, prosumer 3 chooses to produce extra energy for sale to other prosumers.Moreover, it will also choose to interrupt a certain amount of loads to sell more energy.For prosumer 4 located in the important load area, its load demand is relatively large, so most of the time it plays the role of a buyer.Meanwhile, to ensure its local power supply stability and optimize its local costs, it needs to decide the plan for the ESS's charging and discharging energy based on the forecast data.
The equilibrium prices for all prosumers in different time slots from Figure 7 indicate that the equilibrium prices set by all prosumers fall within the range of (λ s , λ b ).During time slots 8-17, prosumers 1 and 2 are the main energy sellers.However, as prosumers 3 and 4 can control their local energy generation, the sellers cannot set the sharing prices arbitrarily.To sell more surplus energy, they have to lower the sharing prices until other prosumers accept it.In contrast, during time slots 18-23, prosumers 1 and 2 become the main buyers in the MG.Unlike other prosumers, they cannot produce more energy to meet their local load demands, resulting in sharing prices being mainly determined by selling prosumers during these periods.Therefore, the sharing prices are relatively high and close to λ b .
In addition, the carbon emissions in this case are calculated and compared with a model that does not incorporate the two-tier carbon emission cost.The distributed energy-sharing model considering two-tier carbon emissions is labeled as Model M1, and the model neglecting two-tier carbon emissions as Model M2.Finally, the results are shown in Table 3.
As shown in Table 3, the carbon emissions based on the two-tier carbon emissions model are reduced by 8.53% compared with the common model.Therefore, based on the proposed distributed energy-sharing method, the carbon emissions of MG systems can be significantly reduced.
Our energy-sharing method allows each distributed prosumer to develop their own energy-sharing strategies to ensure their own supply-demand balance.For prosumers 3 and 4, they can choose from generating, purchasing, or selling energy at any time based on their situation.We can mainly categorize their strategies into the following situations: 1.When ( ) ( ) Selling or buying energy is not profitable for prosumer i, so prosumer i generates all and only the energy it consumes and does not buy or sell.

( )
hold.In this situation, prosumer i generates all the energy it needs and some extra energy to sell.

( )
hold, prosumer i generates and buys the energy to feed all the loads and does not sell in this situation.( ) hold.In this situation, prosumer i does not generate and sell, it buys all and only the energy it consumes.
hold, prosumer i does not generate, it buys all the energy it needs plus some extra energy to sell in this situation.
However, for prosumers 1 and 2, they are highly dependent on the energy sold by other prosumers when their local generating energy is insufficient because of their nondispatchable output, leading to high sharing prices.
Furthermore, we denote the derivatives of prosumer's generation cost function and transmission cost function C′ i and γ′ as the marginal cost and marginal transmission

Models
Carbon emissions (t) cost to represent the costs required to produce or transmit one unit of energy, respectively.It is worth noting that prosumers are more willing to engage in energy sharing within MGs, as the internal energy sharing prices are always better than the energy import/export prices according to Equation (7).For dispatchable-output prosumers, they produce extra energy for export only when ( ) holds and the demand of the MG is fully satisfied.They import energy only when ( ) holds and their demand is not satisfied.For nondispatchable-output prosumers, they will export energy when the demand of the MG is satisfied while they have surplus output or import energy when their demand is not satisfied and there are no other energy sources within MGs.

| Case 2: Comparisons of costs under different energy sharing methods
To analyze the advantages of our method from the economic level, in this case, a comparative analysis of four different energy-sharing methods is given.The compared energy-sharing methods include feed-in tariff, distributed energy-sharing method based on total cost minimization, 33 distributed energy-sharing method based on SDR pricing, 25 and the energy-sharing method proposed in this paper.Figure 8 presents a comparison of the costs of prosumers in different time slots under different energy-sharing methods, and Table 4 presents comparisons of total costs of prosumers in a day.Finally, Figure 9 shows the net energy between the MG and the main grid obtained by the four methods.
It can be seen from Figure 8 that the cost of each prosumer in each time slot of our method is better than that of feed-in tariff.This is because our method allows prosumers to determine their own energy-sharing strategies to minimize their local costs, and they can trade energy at more favorable prices, thereby optimizing their local costs.Therefore, using the method proposed in this paper is more advantageous for prosumers to profit.
Then, we note that while the energy exchange method based on the overall cost of MGs can achieve lower total cost, not all prosumers' costs are optimized.In some cases, some prosumers are forced to engage in energy exchange, sacrificing their own interests to reduce the total cost of the MG, which in practice may cause some prosumers to be unwilling to engage in energy sharing.On the contrary, our method can ensure the cost of each prosumer is optimized.
As shown in Table 4, the total cost of the MG obtained by our method is significantly reduced, accounting for only 85.35% of the total cost obtained by the feed-in tariff method.Moreover, our method is better than the distributed energy-sharing strategy based on the SDR-pricing method, and the difference in total cost of MG obtained by the total cost-based energy-sharing method is small.This indicates the effectiveness of the proposed method on the economic level.
From the comparison of the net energy of various methods in Figure 9 (net energy refers to the energy flow between the MG and the main grid), it can be seen that the net energy obtained by our method is the lowest among the four methods.Therefore, it can be proved that the proposed distributed energy-sharing method can effectively reduce the energy exchange between the MG and the main grid, and prosumers are more willing to engage in energy sharing within the MG, thus achieving local energy consumption in the MG and reducing the MG's dependence on the main grid.

| Case 3: Performances of our method when prosumers join or quit from energy sharing
In MGs, it is common for prosumers to participate in or withdraw from energy sharing.To demonstrate the feasibility of our distributed energy-sharing method in such cases, in this section, prosumer 2 withdraws from energy sharing at t h = 16 and rejoins at t h = 20 .The optimization results of internal supply and demand balance of different prosumers are shown in Figure 10.
In Figure 10, after prosumer 2's withdrawal from energy sharing during time slots 16-19, it is no longer able to engage in energy exchange with other prosumers.As a result, it must rely solely on importing energy from the main grid to meet its load demands, leading to significantly increased costs due to the high importing price compared to the sharing prices.However, for other prosumers, our distributed energysharing method can still work well.This is because, in our method, the quit of a prosumer corresponds to the decrease of agents in the communication network, which only changes the sizes of the adjacency matrix A and the weighted matrix W . Thus, the proposed method remains functional.Due to the withdrawal of prosumer 2, the energy produced by prosumers 3 decreases.Nonetheless, supply-demand balance is maintained for all prosumers.Summarily, our distributed energysharing method continues to work well even when the number of prosumers changes, ensuring the flexibility of energy sharing.

| Case 4: Comparisons of convergence results under different NEfinding methods
To show the effectiveness of the proposed method in this paper, the convergence rate and accuracy of solving the distributed energy sharing model under different numbers of prosumers (denoted as n) are compared between our method (S3) and th3 other two methods, that is, a subgradient method (S1) in Zhou and Lund 32 and a variable step-size subgradient method (S2) in Montes et al., 40 as shown in Figure 11   | 1741 The number of iterations (NoI) is used to measure the convergence rate, and the average convergence errors (ACE) are used to measure the convergence accuracy, defined as follows: where λ i is the equilibrium price for prosumer i obtained through the distributed method and λ* i represents the equilibrium price obtained through the interior point method.
The fixed iteration step size for (S1) is set to β = 0.3, and the step size for (S2) is set to β k ( ) = (0.9) /2 k−1 .For the parameters in the stopping criterion, all are set to ε e = 1 −3 .

| CONCLUSION
To achieve simple and efficient distributed energy sharing among prosumers in MGs, a game-theory-based distributed energy sharing method considering carbon emissions is proposed to reduce the communication and computational burdens.First, a model to characterize prosumers located in different areas is constructed to better reflect their production and consumption patterns.Then, a two-tier carbon emission cost model is built to reduce the carbon emissions of the MG systems.Second, a noncooperative game energy-sharing model is presented.Based on this, a flexible pricing mechanism for prosumers during the game process is proposed.Furthermore, an equilibrium-solving method based on the weighted subgradient algorithm is proposed to boost the convergence rate.
The energy sharing among prosumers in a local MG system based on actual data is conducted in MATLAB/ Simulink.The simulation results show that the costs of prosumers obtained by our method are reduced by 7.5%-22.5% compared to the costs under feed-in tariff, and the total supply-demand balance of the MG system is always guaranteed.Moreover, the carbon emissions in our method are also reduced by 8.53%.Meanwhile, the game-theory-based mechanism effectively reduces the energy exchange between the MG and the main grid.Furthermore, our distributed energy-sharing method can adapt to the number of changes caused by prosumer removing or participating, which demonstrates the flexibility and reliability of our method.Finally, the use of weighted subgradient method significantly accelerates the convergence rate to find the equilibrium solutions, where the iteration number of our method is only 38.9% and 49.3% of those of the two conventional subgradient methods to find NE at a given accuracy.
How to cite this article: Zheng X, Li Q, Yuan J.
According to Equations ( 29) and (32), Equation (33) can be rewritten as holds, theorem gets proved. □ exported and imported by prosumer i from the main grid.P i c is the charging energy of the ESS and P i d is the discharging energy of the ESS.η is the charging and discharging coefficient.There are several parts of the cost function of prosumers.These include the cost of energy generated, the cost of energy sharing with other prosumers and F I G U R E 1 Two-layer energy sharing system model of microgrids.

F I G U R E 3
Simulation data.(A) Load curves of prosumers.(B) Photovoltaic output curves of prosumers.(C) Energy import and export prices.F I G U R E 4 Evolution of energy sharing prices in t = 23 h.F I G U R E 5 Buying and selling matrices in t = 23 h.
mer i generates, sells and buys.

F
I G U R E 6 Supply and demand balance of prosumers in a day.F I G U R E 7 Equilibrium sharing prices of prosumers in a day.T A B L E 3 Comparison of carbon emissions.

F I G U R E 9
Comparison of net energy under different methods.ZHENG ET AL.

F 6 8
Abbreviations: ACE, average convergence errors; NoI, number of iterations. i T A B L E 1 Setup and parameters of prosumers.

Table 5 .
and T A B L E 4 Comparison of daily total costs of prosumers under different energy-sharing methods.