Cooperative Trading Mechanism and Satisfaction-Based Profit Distribution in a Multi-Energy Community

With the development of distributed generation and demand-side response, traditional consumers are now converted into prosumers that can actively produce and consume electricity. Moreover, with the help of energy integration technique, prosumers are encouraged to form a multi-energy community (MEC), which can increase their social welfare through inside multi-energy sharing. This paper proposes a day-ahead cooperative trading mechanism in a MEC that depends on an energy hub (EH) to couple electricity, natural gas, and heat for all prosumers. The model of the traditional uncooperative local integrated energy system (ULIES) is also built as a comparison. A satisfaction-based profit distribution mechanism is set according to prosumers’ feelings about the extra cost they save or extra profit they gain in MEC compared with that in ULIES. Finally, case studies are set to analyze the utility of MEC in enlarging social welfare, after considering the effects of prosumers’ electricity usage patterns and buy-and-sell prices in retail market. The results of satisfaction-based profit distribution are also analyzed to verify that it can save the cost or increase the profit of each prosumer and EH.


INTRODUCTION
With the continuous integration of distributed energy resources, traditional passive consumers are now becoming proactive prosumers who can produce and consume energy at the same time (Parag et al., 2016;Hu et al., 2021). For example, household consumers are encouraged to install roof-top solar panels for self-supplying and to further sell electricity to the power grid when there exists energy surplus (Liu et al., 2018;Ancona et al., 2021).
A promising way to deal with the energy management of prosumers is to gather individual prosumers into a group-wide system, and the energy community (EC) is one of the most typical concepts that has attracted much attention (Cai et al., 2017;Firoozi et al., 2020). The paper of Bera et al. (2018) analyzes the formatting process of an EC from a dynamic perspective. The paper of Lilla et al. (2020) focuses on the day-ahead operational planning of an EC. The paper of Feng et al. (2020) introduces a coalitional game-based transactive energy management method of ECs. In the paper of Cui et al. (2021), cheating behaviors in benefit sharing of EC are analyzed, and a cheating equilibrium-based solution is proposed to ensure a stable community.
The development of local integrated energy system realizes the multi-energy operation among local prosumers, which can broaden the energy utilization scope and contribute to the holistic economy of the whole energy system Cai et al., 2021). In Yang et al. (2016), Zhou et al. (2018, and Xu et al. (2020), optimal operation models are proposed for the multi-energy systems interconnected by energy hubs (EHs), considering both technical and economic aspects.
From the viewpoint of trading, proactive prosumers are able to promote a demand side-centric market mechanism against the traditional top-down hierarchical one. For example, prosumers can directly transact energy with each other through a P2P trading mechanism (Oh and Son, 2020). However, individual trading cannot ensure the global expected efficiency and need some special trading methods. The papers of Liu et al. (2017) and Cui et al. (2020) focus on designing appropriate price functions based on demand-supply relationships among prosumers to improve social welfare. The paper of ZiboWang and YunfeiMu (2020) proposes a real-time double auction with a continuous bidding mechanism to achieve the coordination among prosumers and, therefore, improve the global efficiency. The paper of Le Cadre et al. (2020) designs game theory approaches of P2P energy market and proves the optimal social welfare of the equilibrium achieved.
In addition, forming an EC is an appropriate cooperation method for individual prosumers to improve global efficiency and social welfare. One of the key works of EC is to gain the maximum profit (or minimum cost) of the entire community. The paper of Ma et al. (2019) designs a cooperative trading mode to minimize the overall cost of an EC composed of heating and power generation (CCHP) devices and PV prosumers. In the paper of Pourakbari-Kasmaei et al. (2020), the integrated community energy system maximizes its profit by analyzing its interactions with the inside prosumers and the outside wholesale electricity market. The paper of Ye et al. (2017) designs an online algorithm for prosumers to share energy with others that can minimize the overall cost of EC. The other key work of EC is to guarantee the fairness of profit distribution inside, which is the distribution of the entire profit gained by EC to each individual prosumer inside EC. It can affect the participation willingness of prosumers (Xu et al., 2014). A Nash-type non-cooperative game theory approach distributes prosumers' profit by introducing a spontaneous competition among them (Long et al., 2019;Jing et al., 2020). The paper of Ye et al. (2017) designs a profit division algorithm based on the Nash bargaining theory to fairly share profit among prosumers. A few studies, like Shapley (1953), introduce fairness by using the Shapley value, which is a common method for profit distribution in cooperative games based on the participants' contribution in the cooperation. However, it can be computationally complex and time consuming when there are many participants. Therefore, Ma et al. (2019) propose a simplified profit distribution method, which also follows the contribution-based principle and verifies the validity of the method.
Despite those comprehensive works, there still exist some gaps, which the current work seeks to fill. The previous literatures comprehensively analyze the structures and behaviors of ECs with only electricity carrier (Cai et al., 2017;Ye et al., 2017;Bera et al., 2018;Feng et al., 2020;Firoozi et al., 2020;Lilla et al., 2020;Cui et al., 2021), but barely focus on building a multi-energy community (MEC) with multi-energy interactions and analyzing the trading mechanism of it. In Ma et al. (2019), an EH is proposed to interact different energy carriers in an EC, but it is viewed as an EC operator in the leading level, which means the EH is not on the same status as prosumers and can lead the transaction with prosumers. Moreover, the EH only owns CCHP devices, which is not a realistic scenario. However, with the development of energy integration, building a comprehensive MEC is a promising way to improve the global efficiency and social welfare in a wider scope. Additionally, the existing profit-distribution methods in the reviewed papers can be divided into two types, game-based methods (Ye et al., 2017;Long et al., 2019;Jing et al., 2020) and contribution-based methods (Ma et al., 2019). The former introduces individual competition, which may lose some market efficiency because of individual selfish behaviors. However, the latter relies too much on the EC operator to calculate the contribution and distribute the whole profit, which does not take prosumers' own will into consideration.
Given these gaps, this paper builds a MEC in which all prosumers and EH can share multi-energy carriers with each other freely. The two main points of the MEC are the cooperative trading mechanism in market-clearing process and the profit distribution mechanism in market settlement process. The main contributions of this paper are summarized as follows: a. The model of cooperative trading mechanism is built, based on the physical structure of a MEC. In this mechanism, all prosumers and EH firstly share multi-energies with each other in the MEC and then transact with the outside retail market (RM). The mechanism can improve social welfare, compared with traditional uncooperative trading mechanism in uncooperative local integrated energy systems (ULIES). b. The satisfaction-based profit distribution method is designed based on the principle that the results should maximize the overall satisfaction of all prosumers as well as meet the profit requirement of EH in the MEC. The method can meet the desire of saving the cost and increasing the profit of each prosumer and EH. c. The model of uncooperative trading mechanism of ULIES is built in details as a comparison to show the advantages of a cooperative trading mechanism of MEC in enlarging social welfare and saving/improving the costs/profits of prosumers and EH.
The remainder of the paper is organized as follows. Structure of the MEC describes the structure of MEC. Model of Cooperative Trading Mechanism for MEC builds the cooperative trading mechanism model of MEC. Profit Distribution Mechanism for MEC proposes the satisfaction-based profit distribution method. Case Study analyzes the case study. Conclusion and Prospective Works draws the conclusion.

Structure of the Trading Mechanism
The structure of a MEC is shown in Figure 1A. The community is operated by an independent community operator who aims at maximizing the total profit or minimizing the total cost of the entire community and then distributing the entire profit/cost fairly to each participant. The MEC is composed of two kinds of participants: prosumers and EH. Prosumers use solar panels to produce electricity and consume electricity and heat at the same time. A prosumer equals to a traditional consumer when there is no electricity generation. EH can convert energies through the conversion devices and store energies through the storage devices inside.
The cooperative trading mechanism of MEC is that all prosumers and EH firstly share energies with each other inside the community and then transact with the outside RM (including electricity RM, natural gas RM, and heat RM) as a whole. This is because energy sharing inside MEC is cost-effective, considering the fact that the cost of electricity generation of solar panels (PV generation) of each prosumer is very low and that EH can couple different energy carriers in an economical way. However, energy trading with the RM is always dominated by the RM operator.
The price of buying electricity from RM is normally much higher than the price of selling electricity to RM. Once prosumers trade with the RM outside, prosumers will either pay high prices for energy consumed or receive low payments for energy sold, losing overall, while the RM operator will earn in both cases, being the price maker in both situations. Therefore, prosumers prefer sharing energies with each other and with EH, rather than transacting with the RM outside.
After that, the overall profit/cost is distributed by the community operator. Prosumers feel more satisfied and are more reliable to the community when they can gain more profit or save more cost according to the distribution. An energy hub can also be completely profit-driven like prosumers; however, it can also choose to help the development of MEC by giving up some of its profit after receiving an acceptable profit.
This trading mechanism is different from the mechanism of a traditional ULIES shown in Figure 1B. There does not exist any energy sharing on the demand side. All prosumers and EH work independently and are in competition, as each of them wants to maximize its own profit or minimize its own cost. In the competition, each prosumer transacts electricity and heat with EH or RM according to the corresponding prices. The EH, which can also be viewed as a kind of retailer, sets the prices for electricity and heat transactions with prosumers according to the demands, operation costs, and the prices in RM. The details of the uncooperative mechanism of ULIES are described in Supplementary Appendix A.

Prosumers and Energy Hub
Each prosumer inside the community is composed of solar panels and/or electricity demands and/or heat demands with a demand response. As shown in Figure 1, it can buy/sell electricity from/to RM, share electricity with other prosumers, and receive/send electricity from/to EH. It can also buy heat from RM and receive heat from EH. At each time point, prosumers can be divided into buy prosumers and sell prosumers, according to whether they have electricity demands or surpluses at that time.
In this paper, only solar panels are considered as the power production devices of prosumers in MEC as they are the most used among household consumers. However, the model can be extended to other distributed generators, including wind turbines, and electric vehicles. Since power generation mechanism is not considered in this paper, wind power can be judged the same as PV power with a difference in power output profile, which is, however, considered a constant parameter here. Electric vehicles, as a kind of controllable devices with the ability of charging, discharging, and storing electricity, can add some decision complexities inside MEC. However, this cannot affect fundamentally the cooperative trading mechanism and profit distribution mechanism of MEC. The goals and constraints of the model will be fundamentally the same as the ones presented here; the model of the electric vehicle for prosumer, if added, is fundamentally the same as the energy storage device that is here introduced for the energy hub. Figure 1, EH can buy/sell electricity from/to RM, buy natural gas from RM, receive/send electricity from/to prosumers, and send heat to prosumers. The main task of EH is to convert different energy carriers in the most efficient and economical way. The structure of the EH inside MEC is shown in Figure 2. The energy conversion relationships are described in the following.

As shown in
Combined heat and power unit (CHP) consumes natural gas and produces electricity and heat. The conversion relationship is expressed as: (2) Eq. 1 represents the relationship between the electricity and heat CHP produces. Eq. 2 represents the efficiency of the conversion between natural gas and electricity of CHP. Parameters k E CHP , η E CHP , and η LOSS CHP represent the heat exchange coefficient, electricity production efficiency coefficient, and heat loss coefficient of CHP, respectively. Since this paper only considers backpressure CHP, the heat-to-electricity ratio of the CHP, used to describe the relationship between the production of heat and electricity in Eq. 1, is a constant parameter given by (Xi et al., 2020). A power-to-gas station (P2G) consumes electricity and produces natural gas. The conversion is expressed as follows: where η P2G is the gas production efficiency coefficient of P2G. Gas furnace (GF) consumes gas and produces heat. The conversion is expressed as follows: where η GF is the heat production efficiency coefficient of GF. An electricity boiler (EB) consumes electricity and produces heat. The conversion is expressed as follows: where η EB is the heat production efficiency coefficient of EB. The general formulation of energy storage devices in EH (including electricity storage, natural gas storage, and heat storage) is uniformly written in a vector pattern. The limitations of them are also modeled: Eq. 6 indicates the discrete time storage dynamics. Eq. 7 forces the states of storages at the end of 1 day to be equal to their states at the beginning of the day, which is 50% according to the convention. Eq. 8 indicates the complementary relationship between the charge and the discharge. Eqs. 9 and 10 indicate the lower and upper limitations of the charged and discharged energies. Eq. 11 imposes the lower and upper limitations of the states of storages, which can be set at 0% and 100%, respectively. Vector SOC eh,t [SOC E eh,t , SOC G eh,t , SOC H eh,t ] T represents the states of charge of electricity, natural gas, and heat storages,

MODEL OF COOPERATIVE TRADING MECHANISM FOR MEC
Based on the MEC structure described in Structure of the MEC, the principle of cooperative trading mechanism is that prosumers and EH share energies inside MEC before trading with the outside RM. The working procedure of cooperative trading consists in three parts: 1) prosumers and EH share energies inside the MEC and then send their energy shortage or surplus to MEC operator; 2) EH converts energies inside the MEC in the most profitable way; and 3) finally, MEC operator operates the MEC aiming at maximizing the overall profit or minimizing the overall cost of community operation and transaction with the outside RM. The corresponding mathematical model is built in the following.
The goal of the MEC operator is to maximize the overall profit or minimize the overall cost in MEC, which can be formulated as follows: Eq. 12 represents the objective function of the MEC operator. Eq. 13 imposes the total cost/profit of all prosumers in MEC. Eq. 14 imposes the cost/profit of each prosumer in MEC, which is composed of cost of electricity buying from the RM, profit of electricity selling to the RM, cost of heat buying from the RM, and cost of demand response. Eq. 15 represents the cost of EH, which is composed of cost of gas buying from the RM, cost of electricity buying from the RM, profit of electricity selling to the RM, and cost of device operation in the EH.
Constrains of prosumers' behaviors in the MEC include the following: Eq. 16 represents the power balance of each prosumer. Each prosumer can either be a buy prosumer or a sell prosumer at a given time. Thus, when there exists energy requirement, the prosumer buys electricity from RM, gets electricity from EH, and gets electricity from other prosumers. When there exists energy surplus, the prosumer sells electricity to RM, sends electricity to EH, and sends electricity to other prosumers. Eq. 17 imposes the electric energy flow balance among prosumers since the amount of electricity prosumer i sends to j equals to the negative amount prosumer j sends to i at the given time. Eq. 18 represents the heat balance of each prosumer. Eqs. 19 and 20 set limitations to the demand response ability of each prosumer. Eqs. 21 and 22 set that the variables representing the energy prosumers transact with RM and share with EH are positive.
Constrains of EH in the MEC include the following: eh,t + η GF · g GF,bs eh,t + η EB · p EB,b eh,t + p EB,s eh,t − rh ch,bs eh,t + rh di,bs eh,t , i ∈ P she (eh), t ∈ T, g GF,bs eh,t g bs eh,t − rg ch,bs eh,t + rg di,bs eh,t , t ∈ T, re ch,b eh,t , re ch,s eh,t , rg ch,b eh,t , rg ch,bs eh,t , rg ch,s eh,t , rh ch,bs eh,t ∈ r ch eh,t , t ∈ T, re di,b eh,t , re di,s eh,t , rg di,b eh,t , rg di,bs eh,t , rh di,bs eh,t ∈ r di eh,t , t ∈ T.
Eq. 23 imposes the electricity balance of EH. The left side of the equation represents the net overall amount of electricity all prosumers receive from/give to EH. When it is positive, EH is in buying status. When it is negative, EH is in selling status. The right side represents the amount of electricity EH transacts with the RM and converts through its own devices. Eq. 24 imposes the heat balance of energy hub. The left side of the equation represents the overall amount of heat all prosumers need. The right side represents the amount of heat EH converts through its own devices. What is worth mentioning is that, in this model, the dispatchable devices related to electricity carrier are different in a buying status and a selling status of EH. For example, CHP is only dispatchable in a buying status and P2G is only dispatchable in a selling status. If devices are not related to electricity carrier, there is no difference for them in buying and selling status, like GF and heat storage, and they are viewed as in a buying and selling status all the time. This is because energy buying and selling are two opposite directions for energy transmission. The electricity carrier can change the transmission directions in real time; therefore, prosumers and EH can buy and sell electricity freely. However, natural gas and heat carriers should follow the fixed direction because of the inertia of gas and heat flow. Therefore, when the dispatchable devices are related to the electricity carrier, their status of buying and selling needs to be distinguished. The superscripts b, s, and bs indicate buying, selling, and buying and selling status, respectively. Eqs. 25 and 26 impose the compositions of gas used by CHP and GF. Eq. 27 imposes that the gas P2G devices produce can only be stored by gas storage. Eqs. 28-31 set limitations to the capacities of devices in EH. Eq. 32 forces that the transaction amount with RM should be positive. Eqs. 33 and 34 impose that the characteristics of electricity, natural gas, and heat storages in the EH follow constrains Eqs. 6-11.

PROFIT DISTRIBUTION MECHANISM FOR MEC
The profit distribution mechanism is of high importance in the settlement of MEC trading. According to the MEC structure described in Structure of the MEC, the aim of profit distribution is to ensure that each prosumer can have a lower cost or a higher profit in the MEC than in the traditional ULIES. Otherwise, prosumers have no incentive to cooperate with each other or to form a MEC. The procedure of profit distribution consists of two steps: Firstly, all prosumers send their satisfaction functions to the MEC operator. The functions should show the relationships between prosumers' satisfaction and the extra profit/cost they earn/save. Secondly, the MEC operator distributes the profit to maximize the overall satisfaction of all prosumers, considering the profit requirement of EH.

Satisfaction and Satisfaction Function
This paper introduces the concept of satisfaction function to reflect the satisfaction each prosumer in MEC feels about its cost or profit according to the results of profit/cost distribution. The satisfaction of each prosumer is related to the extra cost it can save or the extra profit it can earn when participating in MEC, compared to when participating in ULIES. Based on that relationship, the satisfaction function of each prosumer can be decided by the prosumer according to its own situation and sent to the MEC operator.
To be specific, the cost of each buy prosumer or the profit of each sell prosumer in the MEC after profit distribution can be formulated as follows: The cost/profit of electricity and heat is calculated separately by Eqs. 35 and 36, respectively. For both electricity and heat, the cost/profit of each prosumer after profit distribution is composed of two parts, the part of transaction with RM and the part of energy sharing inside MEC. The former part is already calculated before the profit distribution process, and the latter part is what needs to be calculated in this step. Eq. 37 shows that p sh i,t represents the total amount of electricity prosumer i shares with other prosumers and EH at time t. Eq. 38 shows that h sh i,t represents the total amount of heat prosumer i receives from EH. The extra cost/profit of each prosumer save/earn in electricity and heat can be formulated as follows: where CP UL,E i,t and CP UL,H i,t represent cost/profit of each prosumer in electricity and heat in ULIES. The calculation method of cost/ profit in ULIES is shown in Supplementary Appendix A.
The satisfaction function can be formulated as follows: α + β 1.
Eqs. 41 and 42 indicate that the satisfaction of each prosumer is composed of the satisfaction coming from electricity transactions and the satisfaction coming from heat transactions with different weights α and β, so does the lower bound of satisfaction. In Eqs. 43 and 44, f SATI,E i (·) and f SATI,H i (·) represent the satisfaction functions from electricity and heat of prosumer i. Two typical function shapes may be used by prosumers as shown in Figure 3. The satisfaction under 0% or over 100% does not make sense and is ignored. Function 1 linearly relates the satisfaction to the extra profit/savings, while function 2 provides a certain level of indifference for very low or very high extra profit/ savings. For calculation simplicity, the function should be linearized into piecewise if it is non-linear, which is shown by the black lines in Figure 3B. Eqs. 45, 46 indicate that the lowest satisfaction of each prosumer should be more than the satisfaction it can obtain when extra cost/profit is 0, and that is 0. Eq. 47 forces the sum of weights equals one.

Profit Distribution Model
In this paper, the proposed objective of profit distribution is to maximize the overall satisfaction prosumers feel in MEC, under the condition that EH can achieve the minimum required profit, which is formulated as follows: Eq. 49 indicates the relationships between the satisfaction each prosumer feels and the extra cost/profit it can achieve through the satisfaction functions. Eq. 50 represents the upper and lower limitations of satisfaction. Eq. 51 represents the minimum required profit by EH, which can be calculated by the following: It should be noticed that, in this method, the variables are electricity and heat prices inside the MEC (λ E,dit t and λ H,dit t ). However, those prices are only a kind of virtual prices for the settlement process. They are only used for profit distribution after the market clearing and do not have any actual meaning or any impact on the market-clearing results.

Description of the Simulation System
In the simulation system, there exist five prosumers and an EH in the MEC. Each prosumer owns a solar panel. The structure of the EH is the same as in Figure 2. The time scale of the simulation is 24 h, with a time step of 1 h. Electricity demands and heat demands of all the prosumers are shown in Figure 4A,B. PV outputs are shown in Figure 4C Figure 4A) and heat demands ( Figure 4B). To simplify the analysis and computation process, the units of heat and gas flow rate are converted into power unit as kilowatt (Zeng et al., 2016). The retail prices of electricity (both buy price and sell price) in RM are shown in Figure 4D (Ma et al., 2019). Periods 10:00-14: 00 and 18:00-20:00 are on-peak price periods; periods 7:00-9:00, 15:00-17:00, and 21:00-22:00 are mid-peak price period; and period 23:00-6:00 is off-peak price period. The retail prices of natural gas and heat in RM are the same in 24 h, which are 0.3 and 0.7 Yuan/kWh, respectively.
Other major parameters of the simulation are shown in Table 1.
The results of ULIES are used as a comparison to show the advantages MEC can achieve in enlarging social welfare and  improving profit/decreasing cost of prosumers. All parameters in ULIES are the same as MEC. The problem is solved using Cplex under MATLAB on a laptop equipped with an i5-9300H CPU and an 8-GB RAM.

Social Welfare and EH Operation of MEC
The overall cost of MEC is 10,815.99 Yuan. It is lower than the overall cost of ULIES, which is 11,993.72 Yuan. This means that MEC can achieve more social welfare than ULIES under the same conditions. To find the reasons, the behaviors of prosumer cluster and EH in MEC and ULIES are shown in Figure 5. The specific energy sharing behaviors among prosumers are shown in Supplementary Appendix B. It is mentioned in advance that, "prosumer-EH receive" and "prosumer-EH give" in Figure 5A, B are equal to negative "EH-prosumer give" and negative "EHprosumer receive" in Figure 5C, D, respectively. This because they all refer to the same electricity transmission between prosumers and EH, but from the prospective in opposite.
Compare Figure 5A with Figure 5B and Figure 5C with Figure 5D, in periods 1:00-7:00 and 19:00-24:00, when there is no PV output, the behaviors of the prosumer cluster (can be viewed as consumers at that time) and EH in MEC and ULIES are similar. However, their behaviors change when there exists PV outputs and prosumers and EH in MEC begin to share energy. In MEC, when the amount of PV outputs is small in periods 8: 00-10:00 and 15:00-18:00, it is firstly self-consumed and then sent to other prosumers who require it. This kind of inside balance decreases the overall electricity prosumers and EH need to buy from RM. When the amount of PV outputs is large in period 11:00-14:00, there exists electricity surplus after the inside balance among prosumers and EH, so prosumer cluster and EH stop buying and begin selling electricity to RM.
However, in ULIES, prosumers and EH are all in competitive situations; therefore, there does not exist any inside balance in ULIES. In the prosumer cluster, sell prosumers can only sell their electricity surplus to EH or RM, while buy prosumers can only buy electricity from EH or RM according to the price signals. Therefore, in the period 8:00-14:00, buy prosumers buy electricity in a high price while sell prosumers sell electricity in a low price.
To conclude, in MEC, prosumers and EH can balance themselves inside MEC before trading with RM, which can minimize the cost caused by the variations between selling price and buying price in RM, and therefore, improve the social welfare.  The operation of EH is shown in Figure 6. The CHP keeps working, because after considering the additional heat it can produce, it is cheaper than buying electricity and heat from RM, except during 11:00-12:00 and 14:00-15:00, when there exists electricity surplus in MEC. Electricity storage charges when there exists electricity surplus in MEC and during the off-peak price period. It discharges during the on-peak price and mid-peak price periods. The effects of EH operation on MEC can be noticed from Figure 5A,C that, during the on-peak period (18:00-20:00) and mid-peak period (7:00-9:00 and 16:00-17:00), prosumers decrease the overall amount of electricity bought from RM and use electricity from EH instead, which saves the overall cost of MEC and contributing to the improvement of its social welfare.
Moreover, a part of heat demands of all prosumers can also be supplied by CHP and GF in EH instead of buying from RM, which can further decrease the overall cost of MEC. The composition of heat demand is shown in Figure 7.

Impacts on the Utility of MEC
The utility of MEC refers to the social welfare MEC can increase (cost MEC can save) compared with ULIES. Electricity usage patterns and retail price differences can affect the utility of MEC. Five additional scenarios have been established for each of the two factors, besides the basic case described in the text above. In total, twelve scenarios have been obtained, and they are detailed in Supplementary Appendix C. To be more specific, electricity usage patterns indicate the differences among prosumers in their electricity demands. PV outputs can counteract prosumers' demands to increase or decrease the demand differences. The retail price differences indicate the variations or intervals between electricity buy and sell prices in RM. Figure 8 shows the impact of the electricity usage patterns to MEC compared to the corresponding total cost of ULIES. The differences of prosumers' electricity demands and PV outputs are increasing from scenario 1 (no difference) to scenario 6. The results show that the cost of MEC does not change in any scenario because the total amount of electricity demands and PV outputs is the same in all scenarios. Since MEC firstly balance the energy inside and then trade with the RM, the total cost does not change when the total amount stays the same. However, the cost of ULIES is continuously growing and can be increased by about 50% in scenario 6: because there is no inside balance and prosumers' transactions with RM increase when the differences keep growing. Figure 9 shows the impacts of the retail price differences in RM on MEC, with the comparison of the corresponding total cost of ULIES. The differences between buy and sell prices are increasing from scenario 7 (no difference) to scenario 12; to    be more specific, buy price stays the same while sell price keeps decreasing in all scenarios. The results show that the difference of the total cost between MEC and ULIES keeps enlarging, because social welfare loss of ULIES keeps increasing when prosumers transact with RM under growing variations between buy and sell prices.
To conclude, forming MEC has a larger utility size when the electricity usage patterns are more diverse or the retail price differences of RM are larger.

Profit/Cost Distribution Results
In advance, the lower bound of required profit of EH is set to 1,485 Yuan, 1,457 Yuan (the profit it earns in ULIES), 800 Yuan, and 0 Yuan, respectively. In the first two cases, EH requires at least the same profit it can earn in ULIES. In the last two cases, EH can give up some of its profit. What is more, we assume that prosumers all chose the linear satisfaction function, both for electricity and for heat, in Figure 3A, where satisfaction increases linearly from 0% where they receive the same cost/profit as in ULIES to 100% where λ E,dit t λ E,s t for buy prosumers, λ E,dit t λ E,b t for sell prosumers, and λ H,dit t 0.2·λ H,b t . The cost of each prosumer and the profit of EH in MEC after profit distribution are shown in Figure 10, with the comparison of the situation in ULIES.
The costs of all prosumers in MEC are lower than in ULIES, even if EH does not give up any profit (shown in MEC-1457) or even earns more (shown in MEC-1485) compared to the ULIES, especially the costs of P1 and P5, who are composed of demands and PVs one much larger than the other. The cost drop of P5 can even reach about 40%. Moreover, if EH can give up some of its profit, the more it can give up, the lesser the cost all prosumers needs to pay, as is shown in MEC-800 and MEC-0. All prosumers' satisfactions are described through function 1, and the results are given in Figure 11, in which two more points MEC-1200 and MEC-400 are added. The lesser profit EH requires, the more satisfaction overall prosumers can feel.
We also change the satisfaction function from function 1 in Figure 3A to function 2 in Figure 3B, in which prosumers are not sensitive to the cost near 0% and 100% satisfaction. For linearization, in function 2, we suppose the point A and point B in Figure 3B as 10% and 0.5% and 90% and 99.5%. As is shown in Figure 11, prosumers' satisfaction is affected by the satisfaction function. When function 2 is used, the growth rate of the total satisfaction is faster than using function 1 when EH keeps giving up profit.

CONCLUSION AND PROSPECTIVE WORKS
This paper builds the cooperative trading mechanism model of MEC based on its physical structure consisting of prosumers and EH. A satisfaction-based profit distribution method is designed to distribute profit/cost of the entire MEC to each prosumer, which can maximize the satisfactions of all prosumers as well as meet the profit requirement of EH. The outcomes show prosumers and EH gaining advantages from forming an appropriate MEC in the future. In details, the paper's main results can be resumed in the following: a. The cooperative trading mechanism of MEC can enlarge the social welfare, when compared with traditional uncooperative trading mechanism of ULIES, through energy sharing among prosumers and EH and energy conversion of EH inside MEC. b. A satisfaction-based profit distribution method can ensure that all prosumers and EH pay less/earn more in MEC than in traditional ULIES. Moreover, if EH is willing to give up some profit, prosumers can achieve extra satisfactions, which can ensure a more solid MEC. c. The utility size of MEC is larger when the differences of electricity usage patterns and/or buy-and-sell retail price intervals are larger.
In the future, the work can be improved mainly in two aspects: a. The uncertainties of renewable energy can be taken into consideration, which also means that the real-time operation and ancillary service market can be combined with the dayahead energy market. An analysis can focus on the short-time energy balancing, effects of physical limitations, and trading mechanisms in combined markets of MEC. b. Prosumers' strategic behaviors on their satisfaction functions can be taken into consideration. An analysis can focus on how to design appropriate rules to ensure competition and fairness and avoid social welfare loss.

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.

AUTHOR CONTRIBUTIONS
JW, NX, and VI contributed to conception and design of the study. CB organized the database. HX conducted the statistical analysis. YW provided suggestions for amendments. All authors contributed to the article and approved the submitted version.