Peer-to-Peer Energy Trading among Microgrids with Multidimensional Willingness

Networked microgrids are emerging for coordinating distributed energy resources in distribution networks in the future Energy Internet, for which developing an efficient energy market model is crucial for facilitating multi-directional trading among microgrids. In this paper, a peer-to-peer energy trading mechanism is presented using non-cooperative bidding among microgrids. Multidimensional willingness, including time pressure and counter behavior for mimicking the personalized behaviors of microgrids, was taken into account in the design of the bidding strategy. Under a parallel trading framework based on a blockchain, the proposed multidimensional willingness bidding strategy turns out to be able to make rational decisions with sufficient flexibility in the bidding process. The simulation results of a realistic case of microgrids from Guizhou Province, China, validate that the proposed peer-to-peer energy trading mechanism is capable of raising the microgrids’ profits and renewable energy source utilization.


Introduction
The third industrial revolution, which is represented by new energy and Internet technology, promotes the evolution of power systems from the Smart Grid to the Energy Internet (EI).The future EI will draw on distributed energy resources (DERs) as the main primary energy, including distributed generation (DG), distributed energy storage (DES), dispatchable load (DL), electric vehicle (EV), etc.Despite advantages such as less pollution, flexible operation, high energy, and economic efficiency [1], DERs cause tremendous challenges to the stability and operational safety of a larger power system, as they are usually 'invisible' to and 'uncontrollable' by the power system.Especially when the capacity of DERs is a high proportion of the distribution network, guaranteeing power balance and power quality is extremely difficult for power system operators [2].
As a promising solution for coordinating the control of DERs within certain regions, the microgrid has become a hot research topic in both the energy and academic fields [3].A microgrid is able to work in either grid-tied or island mode, and it effectively guarantees an uninterrupted power supply to important users and reduces line loss [4].Distributed renewable energy sources (RESs), such as wind power and solar energy, are installed in microgrids and thereby switch traditional energy consumers into 'prosumers'.A large number of studies have focused on DER scheduling [5], power balance [6], operating economy [7], optimal dispatch [8], etc.For instance, Reference [9] proposed an optimization algorithm to flatten the energy peak and reduce residential payments; Reference [10] designed a current-sharing controller for island mode low-voltage microgrids.However, owing to the inherent fluctuations and uncertainty of RESs and insufficient dispatch ability, renewable generation is frequently curtailed to maintain system stability, leading to an enormous loss of energy.
Microgrids that are geographically located in a larger area can be networked to further improve the efficiency, sustainability, safety, reliability, and resilience of energy services in the distribution network [11].Cooperative dispatch approaches have been proposed to achieve better economic performances from networked microgrids.Algorithms and methods have been investigated to solve the optimization problems.Three kinds of demand response programs, including real-time pricing, critical peak pricing, and emergency demand response, were investigated for the optimal operation of a multi-microgrid system.Reference [12] proposed a collaborative strategy to promote the interaction among microgrids as a Stackelberg game.Reference [13] investigated a three-tiered approach to maximize the profits of microgrids through a win-win framework.A decentralized bi-level algorithm was proposed in Reference [14] to dispatch networked microgrids in both grid-connected and islanded modes.However, the installed DERs in microgrids belong to different owners who are driven by an interest in profit and market sensitivity, making the direct control and optimization by a central authority impractical.Although some Nash equilibrium methods have been presented to achieve a win-win distribution of profit, they still fall short of achieving the flexibility and safety of microgrid privacy [15].Reference [16] proposed an optimal bidding strategy in the day-ahead market of microgrids.However, with the reform of the electricity market, along with the application of advanced metrology and information and communication technology (ICT), the frequency of energy trading will obviously increase.Hour-ahead or even real-time energy trading is emerging, and a corresponding energy trading mechanism should be designed to support free and personalized market behaviors for the future EI.Peer-to-Peer (P2P) energy trading offers a new option for decentralized energy market designs.
A peer in P2P energy trading [17] refers to energy traders of different sizes, i.e., residential houses, neighborhoods, microgrids, and local distribution networks.The traditional trading of energy is mainly unidirectional: energy is usually transmitted from producers to consumers over long distances, and the trading market is regulated in a centralized manner by the grid.In contrast, P2P energy trading encourages multi-directional trading based on the concept of a P2P economy without intermediation by conventional energy suppliers.Advanced ICTs, such as the smart meter, blockchain [18], and cryptocurrency, [19] show great potential for enhancing the trials of P2P energy trading across the globe; among them, blockchain is nowadays emerging for its application in the energy market [20].Reference [21] addressed a brief experiment on the design of the blockchain-based energy market.Decentralized demand response management was achieved in Reference [22] on an Ethereum platform, and related security and privacy issues are discussed in Reference [23].Reference [24] introduced a game-theoretic approach for managing distributed energy, together with a practicable energy trading platform via a blockchain.The Brooklyn Microgrid is a successful case of microgrid energy market design in real life [25].Six peers located across three distribution microgrids in Brooklyn are linked via a blockchain, and renewable energy is traded directly under predefined transaction rules.The demonstration of blockchain-based energy trading on the campus of Washington State University is presented in Reference [26].Another application example of a blockchain is the localized energy trading among plug-in hybrid electric vehicles in Texas [27].In the existing literature, the blockchain is simply used to record energy trading information as a distributed database.However, the introduction of new ICT has brought both new opportunities and challenges for the design of energy trading mechanisms in the EI.Taking new features of new technology into account, a top-level design of the future energy market should be proposed.Inspired by these ideas, a P2P energy market is proposed in this paper, where multi-directional energy trading among microgrids in a distribution network is achieved in the form of non-cooperative bidding supported by a private blockchain.The proposed P2P energy trading mechanism considers the personalized demands of different microgrids and significantly increases the utilization of DERs in the distribution network.
The design of a P2P energy trading mechanism boils down to the design of the P2P energy bidding strategy.In the future energy market, it is no longer a human acting as the decision maker and executor.The application of new ICT accelerates the frequency of market transactions.Besides, the uncertainty of RES output and personalized demand lead to a time-varying supply and demand relationship, so software-based negotiation agents are needed for enabling effective and efficient negotiation [28].In general, an agent should be proactive, intelligent, cognitive, and well-behaved when undertaking automated negotiation tasks, which is quite complicated.The key challenge in this area is to design effective and efficient strategies that agents can apply to guide their bidding behaviors.Significant efforts have been devoted to designing various bidding strategies for negotiation agents.Reference [29] addressed a novel adaptive attitude bidding strategy with soft asks and soft bids in electronic commerce, setting up an overall framework of an agent-based continuous double auction (CDA).A market clearing framework of DERs was proposed using a knapsack approximation algorithm [30].In [31], a comprehensive set of factors were taken into account during the bi-directional energy exchange between the utility grid and smart building, including long-time and short-time eagerness.To reduce the negotiation time and enhance the trading efficiency, Reference [32] introduced an improved particle swarm optimization method for adaptive attitude bidding.However, the literature mentioned above is concerned with the bidding strategy between two traders, which results in the lack of applicability to most of the bidding scenarios in reality.Time pressure on an agent appears after a fixed deadline in [29], and, in [31,32], the increase in time urgency slows down as time approaches the deadline; however, both of these time-setting strategies are not reflective enough of real life.In addition, the short-time eagerness mentioned in [31] may face the problem of non-convergence.
Reference [33] studied the efficiency of a forecast-driven P2P bidding strategy in CDA.Reference [34] proposed an adaptive aggressiveness strategy in blockchain-based CDA in a microgrid, putting forward an energy market design from a new perspective.However, different bidding combinations may have distinct initial conditions, and there is not enough flexibility in adjusting the bidding quantity during the CDA bidding process.The power flow restriction among microgrids is another issue to be considered to ensure the safe operation in the distribution network, but it has not been taken into account in the existing literature.
On this basis, to make up for these limitations and adapt to new characteristics of the P2P energy market, we propose a parallel multidimensional willingness bidding strategy which mimics the attitude fluctuation of microgrids in a P2P energy trading environment.Counter behavior, time pressure, and other important (but usually overlooked) factors are given attention, as they have a tremendous impact on the microgrids' pricing strategy in the negotiation process.
The contributions of this paper are as follows.
(1) Energy trading among microgrids in a distribution network is implemented in a peer-to-peer fashion.The system architecture and non-cooperative trading mechanism were first designed for this weakly centralized energy market.Unlike the global optimization in the centralized energy market, this structure and bidding mechanism allows for the personalized behaviors of microgrids.(2) A parallel framework is proposed to perform concurrent energy bidding among microgrids with diverse initial conditions.Moreover, restrictions on the resulting power flow are validated by the joint effort of microgrids and the grid using a hybrid approach.(3) The dynamic attitude change of microgrids is quantified by establishing a multidimensional willingness based on historical trading records, the supply-demand relationship, and other factors and can provide reasonable bidding decisions with sufficient flexibility.(4) The counter behavior of a microgrid was first designed to reduce the impact of abnormal price control behavior of the bidding opponent.The time pressure was applied based on related work in the literature; it promotes the transactions to reach a deal.(5) The presented energy trading mechanism and bidding strategy were validated by a realistic case of 14 microgrids in Guizhou Province, China.The simulations were carried out on a private Ethereum blockchain.A 61.5% increase in the overall profits were achieved for the distribution network by applying P2P energy trading compared with the traditional mechanism.
The rest of this paper is organized as follows.In Section 2, the overall architecture of the distribution network is presented, along with the description of the P2P energy trading mechanism.The parallel multidimensional willingness bidding strategy is introduced in Section 3. A realistic case study and analysis are demonstrated in Section 4 to verify the advantages and efficiency of the proposed P2P energy trading mechanism.Conclusions and future work are given in Section 5.

Mechanism Design for Peer-to-Peer Energy Trading
2.1.Three-Layer System Architecture for Peer-to-Peer Energy Trading A three-layer architecture of a typical distribution network is proposed in this paper for P2P energy trading.Figure 1 presents a conceptual view of this supernetwork which comprises the power network, information network, and business network.The power network is composed of several networked microgrids that are situated in different geographical locations, in which DGs, DESs, DLs, EVs, and general loads are connected to distributed connection points.The internal topology of each microgrid is also different.These microgrids can operate individually or in conjunction with each other.For example, each microgrid can supply its power demand not only by dispatching distributed energy resources but also by importing power from neighboring microgrids or the grid.
The information network consists of communication devices, applications, protocols, and information flow.Smart meters installed in each microgrid record the actual energy flow; the real-time energy consumption is recorded in the distribution network database (DND) and the microgrid databases (MGDs).Different control strategies are also defined in this layer for preserving the quality and reliability of the power supply and controlling the power flow.
The business network is a P2P network enhanced by a blockchain for developing various kinds of business models that determine the energy trading strategy with peers and the grid.Microgrid Operators (MGOs) are authorized to participate in P2P energy trading in the local distribution network under the energy market regulations formulated by the distribution network operator (DNO).

Peer-to-Peer Energy Trading Mechanism
In future EI scenarios, microgrid interconnection and P2P energy transactions are highly efficient and enhanced by advanced ICT.The grid is no longer the monopolist but rather the builder of power infrastructure and market regulator, which means that the microgrids still need the grid as a centralized authority to formulate reliable, secure, and efficient smart contracts to ensure a stable, economical, and environment-friendly operation of the distribution network.Although energy and profit transactions, data storage, and interaction are carried out in a distributed form, market regulation and policy guidance are still the results of centralization to a certain degree.In this paper, this new form of energy market characteristic is described as weakly centralized.
In this weakly centralized distribution network, small-scale distributed energy resources belong to local DER owners.Their separated grid-connected behaviors will significantly affect the power quality of the power grid.An MGO works as the aggregator of DER owners and residents within its region.Besides arranging reasonable dispatch and operation, the MGO is permitted to set the price for the regional energy.The major motivation for the MGO to join in P2P energy trading is that the MGO could obtain clean energy from other microgrids at a low cost.Furthermore, surplus energy after internal coordinated dispatch can also be sold to other microgrids for more earnings instead of selling to the grid.The energy trading mechanism adopted by an MGO will evidently affect the overall profits of the microgrid.The DNO is the market regulator in this distribution network to provide a sufficient back-up energy supply and related ancillary services.The proposed P2P energy trading mechanism among microgrids in the local distribution network is shown in Figure 2. Detailed descriptions are given in the following sections.

Scheduling and Bidding Mechanism
The scheduling and bidding period is set before time slot N, during which MGOs implement internal coordinated dispatch (ICD) and decide which working mode to adopt in the following time slot.To deal with the stochasticity of DERs and unexpected load consumption, distributed Monte Carlo simulations are run by DER owners based on forecasted weather conditions and device status to provide a distributed power prediction to the responsible MGOs.Microgrids work in either off-chain or on-chain mode, so different energy trading mechanisms are designed to meet the respective requirements of the two modes.A microgrid in the off-chain mode is not linked to the P2P energy trading blockchain and acts as a traditional energy trader in the distribution network who only trades with the DNO.The operating priority of the MGO is to ensure the power supply of key users and decrease the cost of purchasing energy from the grid.Meanwhile, a flatter load curve is preferred to avoid a violent and obvious power fluctuation.Energy transaction commands are sent directly to DER owners and residents for execution.
However, if MGOs choose to join the P2P energy trading blockchain, they are endowed with more opportunities to obtain clean energy from other microgrids directly at a lower cost.In consideration of the particularities and personalized demands of each microgrid, particular market strategies are adopted by different MGOs: some MGOs might give priority to the nearest microgrid for trading clean energy to reduce line loss and transaction cost; some MGOs might choose the microgrids that declare the lowest initial asking price regardless of geographical distance; another cluster of MGOs might be more concerned about the historical credit records of the target microgrids to assure a more stable energy transaction experience.Therefore, distinctive trading applications from MGOs (e.g., the clear-cut power to trade over the following time slot, surplus energy for sale or required energy for purchase, target trading microgrid) are provided to the P2P energy trading platform to combine the proposed parallel multidimensional willingness bidding process with the DNO.Energy trading commands are generated once the bidding results pass the safety check.Detailed explanations of the parallel multidimensional willingness bidding process in Figure 2 are given in the next section.
Trading commands can be generated, canceled, or modified by the DNO and MGOs only before the bidding deadline.

Exchange Mechanism
During the energy exchange period of time slot N, energy balancing services and regulations are provided by the DNO.Actual energy generation and the consumption of each microgrid are recorded by smart meters.Energy transaction information for the DNO and MGOs are also kept in distributed databases on the P2P energy trading platform for settlement in the next period.A balanced energy supply will be guaranteed by the DNO, as the energy exchange schedules might be invalid due to extreme weather conditions and unexpected microgrid behaviors.

Settlement Mechanism
In the settlement time period, the energy bill of each MGO is cleared according to actual energy trading information.As some microgrids might fail to generate/consume the promised amount of energy, they are required to trade with other microgrids at less beneficial (selling or buying) prices or be charged punitively by the DNO.In this study, no delayed P2P energy trading was set up in the settlement period, but the DNO will charge for a surplus/insufficient quantity of energy at penalty prices.The penalty prices for the seller microgrid (price t sp ) and buyer microgrid (price t bp ) in time slot t are defined by the following equations, respectively: where ∆Q t i is the quantity difference between the actual transaction energy (Q t i,actual ) and the scheduled trading energy (Q t i,scheduled ).α, β and γ are pre-set penalty coefficients.For a seller microgrid, surplus clean energy injected into the grid will be paid with a price under the energy purchase price of the grid in time slot t (price t grid,purchase ).Meanwhile, an insufficient quantity of energy will be charged by the DNO at a price higher than the energy sale price of the grid (price t grid,sale ) as a penalty.In contrast, over-consumed energy by a buyer microgrid will be charged at a price higher than price t grid,sale , and the energy that was not consumed as scheduled should be charged at the original sale price of the grid.
The credit records of the microgrids are calculated by the following equation, which will be referenced by MGOs for determining intended trading targets in the next time slot.
Power transmission costs are kept for the DNO, as it provides power infrastructure and ancillary services for MGOs.Profit distribution is carried out within a microgrid for DER owners, but this is not the focus of this paper.

Parallel Multidimensional Willingness Bidding Strategy
Based on the efforts of the above-mentioned works, we propose a parallel multidimensional willingness bidding strategy (PMWBS) for P2P energy trading among microgrids.Figure 3   During this time slot, bidding applications are presented individually by each MGO.A bidding round (indexed by r) starts when applications are formulated in a list.In each run of a round (indexed by m), the buyer/seller updates the ask/bid price with multidimensional willingness.If one of an application results in a deal, all MGOs update their real-time bidding quantities and willingness parallelly.A bidding round ends when there is no unfinished application in the list or the time deadline is reached (m = Run_Max).The distributed power flow is calculated by each MGO to reduce the computational pressure on the DNO.If the bidding result passes the safety check, energy trading commands are generated and sent to each MGO.Otherwise, a congestion price is calculated by the DNO to reflect the severity of power line congestion and the extent of each transaction's impact on overall congestion, which will obviously affect bidding applications in the next round.A maximum of Round_Max rounds of bidding is allowed to be performed within a time slot.Detailed variable setups are presented in the following paper.

Multidimensional Willingness of Microgrids
Willingness is affected by the MGO's impression of the last several time slots and the ongoing bidding rounds.In this paper, the willingness of a microgrid in a bidding run is defined as the integration of factors in multiple dimensions: historical trading records, counter behavior to the bidding price, time pressure, matching degree of the bidding quantity, and the real-time supply-demand relationship.The proposed multidimensional willingness of microgrid i in bidding run m is defined by Equation (4).
Detailed variable definitions are explained in the next subsection.

Historical Trading Records
One microgrid is either the seller or the buyer.Decision-making is mainly dependent on the previous trading history.The willingness based on historical trading records is determined by the following equations: where HTR t i represents the energy trading history of microgrid i in time slot t.H t i is the transaction percentage for microgrid i in time slot t, which is the quotient of the P2P traded energy quantity (Q t i,traded ) and the expected energy quantity (Q t i,expected ); I t i is the weighted sum of the historical transaction percentage of the former three rounds.As the closer time slots have the stronger influence on the current time slot, they are evaluated with a higher weight.δ is a small positive number and A is a preset positive number to restrict the basic value of round willingness.In an energy bidding market, a microgrid memorizes useful information of its own from previous time slots.If the seller/buyer has traded all the energy they want to trade in the last time slot, they would be eager for more profit in the current round.In this case, the willingness of historical trading records should return a low value, as the seller/buyer would reduce the step of the bid in a round in the hope of a higher/lower price on each unit of energy.On the other hand, a high willingness in historical trading records indicates the seller/buyer is eager to make more concessions and take this deal in the round, as too little energy has been traded in historical rounds.
The willingness of historical trading records should be maintained during rounds until a new time slot is approaching.

Counter Behavior to Bidding Price
Counter behavior to the bidding price is designed for a microgrid to mimic an opponent's concession behavior and take appropriate countermeasures.If the opponent compromises, the MGO becomes more cooperative and makes concessions as well.On the contrary, if the opponent has not conceded in the past few runs, the MGO will also refuse to make significant concessions to protect its own profit.The willingness of counter behavior to the bidding price is determined by the following equations: where CB m i represents the willingness of counter behavior of MGO i in the current bidding run m.Counter m j is the degree of concession for MGO i's bidding opponent j. n is the length of the time window, which can be defined by the trader.µ is a small positive number divided by the gap of the bid and asking prices.step t i,j defines the basic bidding step size in this time slot, and λ is an adjustment coefficient.In the early stage of bidding, the gap between the ask and bid price is large, and the latter part of Equation ( 8) has little impact on the calculation of Counter m j , but abnormal price control behavior of MGO j will be detected if there has been no significant change in the past successive runs of bidding.MGO i will imitate the opponent's behavior in this scenario.As the bidding step may decrease naturally when the deadline is approaching, the latter part of Equation ( 8) boosts the value of Counter m j , regardless of the opponent's bidding behavior, which largely promotes the bidding process to convergence.

Time Pressure
Time pressure is an important factor in a bidding process.The MGO is willing to close a deal when the deadline is approaching.This kind of behavior will help MGOs gain more transaction opportunities and, consequently, enhance their profits.Meanwhile, the historical trading records have a significant influence on the degree of concession during a round.A microgrid with lower the willingness of historical trading records prefers to wait for more profit to accrue from each unit of energy instead of finishing the deal quickly, while a microgrid that seldom makes any transactions will give ground quickly to reach a deal.On the basis of the prior work of [29,32], the representation of time pressure is modified and designed by the following equation: where M is the maximum number of runs in a round.The time pressure exists throughout the whole process of negotiation.At the beginning of negotiation (m = 1), the time pressure is close to 0 as MGOs are not eager to trade at the initial stage, but when it comes to the deadline (m = 200), the time pressure of most microgrids is close to 1.The MGO with a higher willingness of historical trading records is more eager to give ground and reach a deal, as its time pressure is always higher than that of other MGOs during a round, while the one with higher historical trading records shows barely an increase in time pressure, as shown in Figure 4b.Compared to the time strategies proposed in [32], the slope of the time pressure curve increases, just as the urgency of an MGO will increase naturally in the real-life energy market when the bidding is approaching the deadline.

Matching Degree of Bidding Quantity
As the bidding quantity of traders is affected by energy preference, microgrid credibility, and the penalty price for power flow congestion and other factors, the matching degree between the bidding quantity and the expected trading quantity in the negotiation process will also affect concession willingness.Here, the willingness for matching the degree of the bidding quantity is introduced in the following form: where MD m i represents the matching degree of the bidding quantity for microgrid i in the current bidding run m.Q t i,expected represents the expected trading quantity in a round, and Q m i,bidding represents the actual bidding quantity in a run.Note that due to the parallel update of the market supply and demand relationship, Q m i,bidding can be different within the process of a bidding round.

Real-Time Supply-Demand Relationship
The relationship between real-time supply and demand of the local distribution network has a significant influence on microgrid traders' bidding strategies.When the overall market has surplus clean energy, seller MGOs are willing to make concessions to trade a higher quantity, as the energy injected into the grid is sold at a very low price.On the contrary, when the demand exceeds the supply in the real-time market, buyer microgrids are more likely to give ground to obtain clean energy from other seller microgrids.Although the transaction price might be higher than other that of other biddings, it is much lower than the price from the DNO.The willingness of a real-time supply-demand relationship for a seller microgrid (SDR t seller ) and buyer microgrid (SDR t buyer ) are designed by the following equations, respectively: where ω is a predefined small positive number.

Parallel Multidimensional Willingness Bidding Strategy
Given the clear power of all microgrids in the distribution network at one time slot, one buyer MGO is free to choose at most three seller MGOs based on the following factors: historical trading price, credit records, power transmission price, and matching degree of trading quantity.The congestion price π t,r ij also has a great impact on the selection of bidding opponents and quantity (detailed descriptions of π t,r ij are given in Appendix A).Then, the list of intentional trading applications is formed before the bidding process.
In order to describe the process of the proposed bidding strategy, some basic notions for one trading application are listed as follows: in which price t mt represents the price caused by the daily maintenance of DERs and price t tc,ij represents the power transmission price from microgrid i to j. price t sr ensures that the trading price is no less than the marginal price of generation.• price t br is the reservation price for the buyer microgrid, which is set as the selling price of the grid in time slot t.It is guaranteed that energy will not be purchased at a price higher than the current selling price of the grid.
• price_ask/price_bid is the price offer given by the seller/buyer microgrid in the current market.• step_basic is the basic size of the pricing step and remains unchanged during a round of bidding, which is calculated at the beginning of a round using: One round is divided into two phases.The first phase is the beginning of parallel bidding: the seller and buyer MGOs only have access to their own reservation prices and market limitations but not to the market dynamic information.In the first run of bidding, seller i submits an initial asking price, computed as follows: Similar to the seller, buyer j submits an original bid price, computed as follows: where rand_ask and rand_bid are random real numbers located in [0.95,1.0] to obtain higher asks/lower bids.
In the second phase, the asking price of the seller is calculated by the function below: When m = 1, the step size is determined by historical information and the original bid from the buyer, as no counter price from the market can be used as a reference.price_ask re f i represents the historical reference price for a seller.If there were successful trades in the last round, the seller would take the historical average trading price plus a small positive number η as a reference price in the hopes of obtaining a higher trading price.If there were no trades in the last rounds, the seller would employ the lowest ask they submitted in the last round minus a small positive number ε as a reference price to improve the possibility of reaching a deal in this round.
if there was successful trades min(price_ask t−1 i ) − ε, if there was no successful trades (19) Similar to the seller, the bid price for the buyer is calculated by the function below: in which price_bid re f j represents the reference price for a buyer.If there were successful trades in the last round, the reference price equals the historical average trading price minus a small positive number ϕ for obtaining a lower trading price.If there were no trades in the last round, the reference price equals the highest bid submitted in the last round plus a small positive number τ to improve the possibility of reaching a deal in this round.
if there was successful trades max(price_bid t−1 j ) + τ, if there was no successful trades (21) A deal is closed when price_ask m i ≤ price_bid m j before the time deadline is reached.All of the intended trading applications take place in parallel.When a deal is made, the related supply and demand energy quantity and willingness are updated simultaneously.The bidding process in a round ends when there is no intended bidding application in the list.

Case Studies and Simulation Results
A realistic case of microgrids in Guizhou Province, China, was used to validate the proposed P2P energy trading mechanism.As shown in Figure 5, the distribution network consists of 14 microgrids.The distance matrix is given in Table A1, from which the transmission price for each kWh of energy between any two microgrids can be calculated.The power of these microgrids after the internal coordinated dispatch is presented in Figure A1.
The surplus clean energy that is directly injected into the grid is paid at 0.3 CNY/kWh, and each kWh of energy purchased from the grid is charged according to the peak/flat/valley price formulated by the Guizhou Grid, which divides a day into three types of time intervals, charging 1.197/0.744/0.356CNY, respectively (see Table A2).
To highlight the PMWBS proposed in this paper, all 14 microgrids were set to on-chain mode.In order to simulate the microgrids' personalized preferences, four strategies for choosing the trading target are provided in the case studies: (1) choose the nearest microgrids; (2) choose the microgrids with the cheapest initial asking prices; (3) choose the microgrids with the highest credit records; (4) accept recommendations from the DNO.The microgrids dispatch the internal entities and join the P2P energy trading market every ∆t = 0.5 h within a scheduling cycle of 24 h.The simulation starts at 9:00 in the morning and ends at 21:00 in the next day.
The process of bidding in a single round extracted from a P2P energy trading cycle is presented in the first case study, and the impact of different dimensions of the overall willingness are examined.The second case study simulates the behaviors of 14 microgrids over a 24 h trading cycle, and it also compares profits under two energy trading mechanisms.The formulation presented in Sections 2 and 3 was implemented using MATLAB.All computations are done on an Intel Core i7-4790 CPU, 3.60 GHz.

Case Study 1: Effectiveness Verification of the Proposed PMWBS
To test the performance of the proposed PMWBS, four rounds under four typical scenarios are extracted from the proposed P2P energy trading process.The results are illustrated in Figure 6.As the seller in Figure 6a, MG 9 fails in two of three previous time slots, so the willingness of historical trading records for MG 9 is markedly increased in this round, which causes the asking price to drop quickly to reach a deal.On the contrary, in time slot 15, MG 13 has a low willingness, as it succeeded in all previous three rounds, and it desires to gain more profit from each unit of clean energy.Pairing with MG 5, who holds a higher bidding willingness, the deal is closed at 0.641 CNY/kWh, as shown in Figure 6b.It can be observed from these two runs that microgrids with a greater willingness will make more compromises to reach a deal quickly.Figure 6c presents a well-matched bidding process of MG 1 and MG 14, as they have comparable willingness in this bidding round.Figure 6d shows the bidding result of microgrids where both the buyer and the seller have a very low willingness.It can be seen that an agreement cannot be reached before the deadline of negotiation because neither MG 4 nor MG 8 is willing to make a concession to close the deal.
To illustrate the influences of different dimensions of expressing willingness on the bidding results, two more simulations were conducted.In Figure 7a, the asking price of MG 10 in the 34th time slot is maintained during this bidding round to test the influence of a multidimensional willingness on the bid price.If the willingness of MG 2 is set at a fixed number, the bid price depends greatly on this predetermined parameter as the slope of the price curve.For the bid price under a low and high multidimensional willingness, the bidding step can better respond to historical trading records, time pressure, the real-time supply-demand relationship, and other factors.For example, as time approaches the deadline in one round, both of the traders are willing to increase the bidding step in case of a failed round.In the proposed parallel multidimensional willingness bidding process, the bidding quantity and willingness will be updated if other bidding applications reach a deal and the relationship between the supply and demand change.In this case, one bid price curve is divided into several parts, as shown in Figure 7a by the updated points A and B. A bidding round is forced to stop when no more energy is left to be traded or the deadline is reached.The performance of counter behavior is shown in Figure 7b.The buyer MGO is required to not make concessions from the 41st to 98th run in one round.It can be observed that a seller MGO without counter behavior is not able to adjust its bidding step according to its opponent's changes, leading to a low deal price of 0.426 CNY/kWh.On the other hand, an MGO with counter behavior successfully mimics the buyer's behavior in order to protect its own interests and stops reducing its price from the 46th run.When the opponent starts to make concessions again, the seller MGO with counter behavior is able to catch this signal and continue bidding.The deal is closed at 0.478 CNY/kWh in this situation, which means that the seller MGO can increase profit by 12.2% from P2P energy trading in this round and reduce the impact of abnormal price control on the bidding results.
All the simulation results show the usability and learning ability of the proposed PMWBS in P2P energy trading among microgrids.It turns out to be effective for making the appropriate bidding concession decision according to the dynamic intentions of different microgrids in the bidding process.

Case Study 2: Bidding Performance of P2P Energy Trading
In this case study, the overall performance of P2P energy trading in the distribution network is simulated.The analysis of the bidding price, quantity, trading target, and profits of the microgrids are given in the following.

Bidding Results of P2P Energy Trading
The bidding results of three typical microgrids are shown in the figures described in the following and shown below.MG 4 plays the role of buyer in all time slots, as shown in Figure 8, in which the bidding quantity is represented by the red bars.MG 4 succeeded in the first 11 time slots; however, it failed in the 12th time slot, because it has a low bidding willingness in order to pay less for each unit of clean energy but could not reach a deal with its chosen opponents.For these time slots, MG 4 purchases energy from the grid at a peak/flat/valley price.During the valley interval, the price for purchasing energy from the DNO is 0.356 CNY/kWh, which is very close to the initial asking price of the seller microgrids of around 0.3 CNY/kWh.Few deals are made in this interval, as the price of clean energy from the other microgrids is not competitive in the energy trading market.MG 9, which contains a large installed capacity of wind and solar power, has surplus energy throughout the whole trading cycle, and its bidding quantity is represented by the green bars in Figure 9.As a clean and cheap energy resource, the surplus energy injected into the market is urgently needed during specific intervals.From Figure 9, it can be observed that MG 9 reaches deals with other microgrids in almost all the time slots in peak and flat intervals.This trading result has greatly relieved the problem of the high energy supply pressure on the grid in peak periods.In the valley period for energy consumption, surplus energy is discarded or sold to the grid at a very low price.The trading performance of MG 12 is shown in Figure 10, as MG 12 plays different roles in different time slots in a trading cycle.The detailed trading performance of MG 12 between the 9th and 32nd time slot is presented in Figure 10b, in which the buyer and seller intervals are differentiated by two background colors.When the PMWBS is applied, MG 12 has a good performance in both roles: it purchases clean energy from MG 8 and MG 13 at the 12th and 22nd time slot, respectively, to reduce cost; meanwhile, it successfully sells surplus energy to other microgrids to raise its profit.The overall profit of MG 12 is significantly increased from 421.2 CNY/day to 581.0 CNY/day.

Preference Analysis for Trading Target
The detailed performance of MG 3, MG 4, MG 8, MG 10, and MG 13 in different price intervals are given in Table 1.The percentage below the price indicates the proportion of the trading quantity from P2P energy trading.Individual energy trading habits and market sensitivities are reflected in the results: some microgrids prefer to trade with a certain target because they might be closer in geographical location, or their willingness to trade with each other is strong.As shown in Table 1, MG 3 prefers the clean energy of MG 13, though sometimes the trading price is higher than the market average.MG 4 likes to try different trading targets as long as it can gain more profit.One seller could be chosen by multiple buyers, but in most of the time slots, it is popular in the market as its clean energy is always sold out.Combining these results with Figure 5, it can be seen that the proposed P2P energy trading mechanism contributes to energy transactions in smaller regions, which will evidently reduce the energy loss caused by long-distance energy transmission.Furthermore, it helps to increase the utilization of RES inside the distribution network and reduce energy waste.Based on the bidding results in this distribution network, the quantity of traded energy from the proposed P2P energy trading platform in a day can be calculated.As shown in Table 2, almost all the microgrids can complete successful transactions in the P2P bidding process.Buyer microgrids are able to obtain different proportions of clean energy from other surplus microgrids and vice versa.Specifically, the results show that MG 10 can purchase 15.2 kWh of energy (22.6% of the demand) from other microgrids and sell 608.0 kWh of energy (50.3% of the surplus production) for more profits.What is important is that all of the energy sources are renewable and clean.In this case, 49.1% of the overall energy demand is supplied by clean energy produced within this distribution network, and 52.6% of the surplus energy is sold to neighboring microgrids, which reduces the loss of energy from long-distance power transmission.This indicates that the proposed P2P energy trading mechanism enables unrestrained decision making of energy sources in the decentralized energy interaction.

Profit Analysis on Two Energy-Trading Mechanisms
Table 3 shows the profit from the energy-trading mechanism without and with peer-to-peer energy trading (P2PET).The negative value of the profit indicates the cost paid to the grid and other microgrids through P2P energy trading platform.A significant increase can be observed for all 14 microgrids.The buyer microgrids are able to raise their profits by an average of 21.4%.More profit growth can be achieved by seller microgrids (like MG 8 (49.8%) and MG 9 (64.3%)), as clean energy at a price lower than the grid is in urgent need in the distribution network, but the trading price has been far higher than the purchase price of the grid.A 61.5% rise in the overall profits can be achieved by applying P2PET compared with the traditional energy trading mechanism.In summary, the presented peer-to-peer energy trading among microgrids is capable of raising profits and improving the utilization of RES through a decentralized energy trading method as a result of considering multiple dimensions of willingness and the personalized preferences of the microgrids.

Conclusions
To enable the weakly centralized operation of microgrids in a distribution network, a peer-to-peer energy trading mechanism, including scheduling, bidding, exchange, and settlement, was developed to facilitate non-cooperative clean energy transactions.Based on a three-layer distribution network architecture and the decentralization characteristics of a blockchain, a parallel bidding framework was designed to support multi-initial-condition energy trading among microgrids.Counter behavior, time pressure, and other dimensions of willingness were modeled to mimic the dynamic attitude fluctuation in the bidding process.By simulating a multi-agent system on a private Ethereum blockchain, the results of a realistic case from Guizhou Province show that the proposed parallel multidimensional bidding strategy is capable of making reasonable negotiation decisions and has learning ability.The microgrids with counter behavior can detect abnormal price control behaviors of their opponents and take appropriate countermeasures.In addition, the setting of time pressure promotes the closing of deals before the deadline.It can be observed that different percentages of profit growth are achieved by microgrids under personalized preferences and demands.A 61.5% growth of the overall profits can be achieved compared with the traditional energy trading mechanism.Also, 22.6% of the demand and 50.3% of the surplus production are satisfied by local DERs, avoiding large line-losses from power transmission and the underutilization of RESs.The proposed P2P energy trading mechanism and corresponding blockchain platform can be applied to more local energy markets in the future EI.
Although excellent results were acquired in the case studies, there are still some limitations and deficiencies to be discussed.As for the parallel bidding framework, it is hard to measure the impact of trading quantity fluctuations.Moreover, if the supply-demand relationship of the energy market changes dynamically due to the application of large-capacity energy storage, the bid and asking price in the trading process might not be monotonous.Future work will be focused on solving the above problems and the design of the P2P energy future market.Besides, a series of policy reforms and the market access of ICT (e.g., blockchain, cryptocurrency) are still required before the P2P energy trading becomes a reality.The role that the distribution network operator plays in the weakly centralized energy market and related service pricing are also key points to be studied in the future.was set as 0. If the bidding result does not pass the safety check, the congestion price will be updated according to the following equation: where π t,r ij represents the congestion price at round r in time slot t.L is the set of lines that power the transaction from MG i to MG j and contributes to congestion.P l is the actual power on line l, P lmax is the maximum power that line l can hold.ω t is the congestion coefficient that varies with time slots and actual congestion situations.As shown in Figure 3, the congestion price is added to the base price in each application of the bidding game, which has a huge impact on the target trading microgrid and expected trading quantity.The iteration ends when all the bidding applications in the list pass the safety check.

Figure 1 .
Figure 1.The structure of a typical distribution network for peer-to-peer (P2P) energy trading.

Figure 2 .
Figure 2. The process of the proposed P2P energy trading mechanism.
presents a flowchart of the proposed PMWBS in a given time slot.

Figure 3 .
Figure 3.The process of the parallel multidimensional willingness bidding strategy in a time slot.

Figure 4 .
Figure 4. Time pressure of microgrid under (a) different historical trading records and (b) bidding runs.

Figure 5 .
Figure 5.A realistic distribution network topology in Guizhou Province.

Figure 6 .
Figure 6.The bidding process of four rounds extracted from the proposed P2P energy trading process: a trade round between (a) microgrid (MG) 6(bid) and MG 9(ask) in time slot 12; (b) MG 5(bid) and MG 13(ask) in time slot 15; (c) MG 1(bid) and MG 14(ask) in time slot 22; (d) MG 4(bid) and MG 8(ask) in time slot 37.

Figure 7 .
Figure 7.The influences of the multidimensional willingness proposed in the paper on bidding results: (a) trading performance of the bid price under fixed willingness (FW), low multidimensional willingness (MW-L), high multidimensional willingness (MW-H), updated multidimensional willingness (MW-Update), and failed multidimensional willingness (MW-Failed); (b) trading performances of the asking price under multidimensional willingness without counter behavior (MW-NCB) and multidimensional willingness with counter behavior (MW-CB).

Figure 8 .
Figure 8.(a) Bidding price and quantity of MG 4; (b) actual trading price of MG 4.

Figure 9 .
Figure 9. (a) Bidding price and quantity of MG 9; (b) actual trading price of MG 9.

Figure 10 .
Figure 10.(a) Actual trading price of MG 12 in a 24 h trading cycle; (b) detailed trading performance of MG 12 between the 9th and 32rd time slot.
the highest bidding price limitation in the market, which is set as the selling price of the grid in time slot t.

Table 1 .
Trading target and price of five microgrids in different price intervals.

Table 2 .
Proportion quantity of traded energy from P2P energy trading.