Open access peer-reviewed chapter

Peer-to-Peer Energy Trading in Microgrids and Local Energy Systems

Written By

Yue Zhou and Jianzhong Wu

Submitted: 01 July 2021 Reviewed: 13 July 2021 Published: 15 December 2021

DOI: 10.5772/intechopen.99437

From the Edited Volume

Microgrids and Local Energy Systems

Edited by Nick Jenkins

Chapter metrics overview

697 Chapter Downloads

View Full Metrics


Peer-to-peer (P2P) energy trading is an innovative approach for managing increasing numbers of Distributed Energy Resources in microgrids or local energy systems. In P2P energy trading, prosumers and consumers directly trade and exchange power and energy with each other. The development of P2P energy trading is described in five key aspects, that is, market design, trading platforms, power and ICT infrastructure, regulation and policy, and from a social science perspective. A general multiagent framework is established to simulate the behaviour of and interaction between multiple entities in P2P energy trading. A general evaluation index hierarchy is proposed to assess various P2P energy trading mechanisms. Finally, a residential community that is set in the context of Great Britain is studied using multiagent simulation and hierarchical evaluation methods. Both the technical and economic benefits of P2P energy trading are demonstrated.


  • Peer-to-peer energy trading
  • Distributed energy resource
  • Local energy system
  • Microgrid

1. Introduction

Traditional electric power systems operate in a unidirectional way, i.e. electricity is generated by large centralised generators, transmitted through transmission and distribution networks, and finally delivered to end users. Accordingly, electricity is sold through a wholesale market and large centralised generators sell electricity in bulk to energy suppliers (sometimes called ‘retailers’), who will further re-sell it in small amounts to end users.

However, the connection of Distributed Energy Resources (DERs) changes the landscape radically. DERs include distributed generators (especially renewable energy generators such as solar panels and wind generators), energy storage systems and flexible demand. DERs may cause reversed power flow, and both power systems and electricity markets become bidirectional. End users, who have the capability of generating electricity on site (called ‘prosumers’, which is a word combining ‘producer’ and ‘consumer’), are able to feed electricity back to the bulk power grid and obtain payment from energy suppliers.

Typical schemes to remunerate power fed from renewable sources into the bulk power grid are ‘net metering’ and ‘Feed-in Tariff (FiT)’ schemes. In net metering, the surplus generation that is fed back to the bulk power grid is recorded and then deducted from the electricity consumption of the same prosumer over a period of time (e.g., a month or a year). In the FiT scheme, the generation that is fed into the bulk power grid is remunerated at a fixed export price.

However, with rapidly increasing connection of DERs, net metering or FiT schemes impose financial pressure on the power utilities and any customers who do not install DERs. As a consequence, many countries are reducing their support for distributed renewable generation through these schemes. In this context, prosumers are seeking alternatives to selling surplus generation to the bulk power grid. Peer-to-peer (P2P) energy trading is an emerging solution, where prosumers and consumers exchange energy with each other in microgrids or Local Energy Systems (LES) [1].


2. Key aspects of peer-to-peer energy trading

As a promising scheme to tackle high penetration of DERs, P2P energy trading has attracted increasing attention and investment in many countries of the world. A rapidly increasing number of academic papers, research projects and industrial practice have emerged on P2P energy trading around the world [2]. P2P energy trading is a comprehensive scheme involving multiple spatial scales, multiple time scales and multiple conceptual layers, as summarised and illustrated in Figure 1.

Figure 1.

P2P energy trading with multiple spatial scales, time scales and conceptual layers.

Conceptual layers

P2P energy trading is a broad concept, beyond the power engineering domain. To implement P2P energy trading, various components are needed, including the electricity infrastructure to physically deliver the electricity traded, ICT infrastructure for supporting information exchange and advanced control, trading platforms for participants to negotiate and trade with each other, market design to set the trading rules, and laws and policies to regulate and guide the trading. Social science perspective is also valuable, which can help better understand participants’ behaviours and situations to improve the design and fairness in P2P energy trading.

Spatial scales

As shown in Figure 1, spatially, a hierarchical structure can be established for P2P energy trading in power systems. At the bottom level, prosumers and consumers can trade with each other within a microgrid/LES (e.g., in a community area). However, the generation and demand might not completely match with each other, resulting in the potential needs of the trading between microgrids/LES to consume/supply each other’s energy surplus/deficit. If the power and energy still cannot be balanced, electricity needs to be imported from / exported to upper-level power networks. With this hierarchical P2P energy trading structure, power and energy can be balanced layer by layer in a bottom-up manner, so that the capacity and losses of electricity transmission equipment can be reduced. In this chapter, we focus on P2P energy trading between prosumers and consumers in microgrids and LES.

Time scales

P2P energy trading spans a wide range of time scales as well. Similar to traditional energy trading in the electricity wholesale market, trading contracts can be made from well in advance (i.e., long-term/mid-term trading, such as year/month-ahead), day-ahead, intraday, to real time. After the delivery time, settlement needs to be conducted to examine whether and to what extent the participants in P2P energy trading have followed the pre-made contracts, and then to execute the financial payment/penalty accordingly.

2.1 Market design

Market design specifies the rules that the participants must follow to conduct energy trading with each other, including the requirements for information to be provided by the participants (e.g., the bids of the amount of energy and price in an auction), the rules to match generation and demand, the pricing model and the market settlement mechanism.

Currently, market design has attracted attention from both academia and industry [2]. Many market concepts have been proposed, which can be largely classified into three categories, i.e., centralised, decentralised and distributed markets. In a centralised market, there will be one central market coordinator, which collects all the information needed from prosumers and consumers, conducts the matching and pricing centrally, and settles the market or even directly controls some devices of prosumers/consumers. Centralised markets are relatively easy to design, being able to maximise the social welfare of all the participants and having higher level of certainty in terms of the participants’ behaviours. However, centralised markets are vulnerable to single-point failures, cause potential concerns over participants’ privacy and autonomy, and have scalability issues if the number of participants in the markets increases significantly.

The opposite type of markets is the decentralised ones, in which there is not a central market coordinator, and all the prosumers and consumers directly negotiate and trade with each other bilaterally, e.g., establishing a ‘bilateral contract network’ [3]. In contrast to centralised markets, decentralised markets protect participants’ privacy and autonomy and have good scalability, but it is more difficult to reach a stable outcome which maximises the social welfare.

The compromise solution is distributed markets, where there is still a central market coordinator, but collecting less information from the participants and intervening with the participants in a more indirect way (e.g., through pricing signals rather than direct control signals). A number of distributed market designs are based on the Stackelberg game [4] or Alternating Direction Method of Multipliers (ADMM) [5]. Generally, distributed markets combine the advantages and disadvantages of centralised and decentralised markets.

Although many mechanisms have been proposed, there are still many challenges in the market design of P2P energy trading. Prosumers and consumers can be seen as profit-driven entities, aiming to maximum profits / minimum costs in P2P energy trading, but they often have conflicting interests, and thus how to model and manage the complicated interaction among prosumers and consumers is a challenge. Game-theory methods, either cooperative or non-cooperative games, can be used to deal with this challenge [6]. Also, if multiple P2P energy trading markets are allowed in the same area, the dynamics of forming and dissolving P2P energy trading coalitions becomes an interesting and practical topic, which has not been well explored yet. Furthermore, with increasing adoption of P2P energy trading in the future, the relationship between P2P energy trading markets and existing electricity wholesale and retail markets needs to be re-defined and coordinated. The current assumption that P2P energy trading markets are just price takers of bulk retail / wholesale markets will no longer be the case (Box 1).

Box 1.

An example of P2P energy trading market design – Mid-market rate (MMR) mechanism.

The Mid-Market Rate (MMR) mechanism, first proposed in [7], is used as an example to demonstrate P2P energy trading market design. MMR is a centralised market, where a central market coordinator is needed for information collection, pricing and settlement. Spatially, the MMR mechanism operates within a community microgrid. Temporally, MMR mechanism applies to time scales from day-ahead to hour-ahead energy trading.

Consider an example microgrid with only one prosumer A and one consumer B.

First, assume A has surplus generation of PA = 5kWh to be sold, and B has the same amount of demand, i.e. PB = 5kWh, to be supplied in a certain time slot.

Conventionally, A and B are individually metered and trade with the energy supplier. Assume the energy price at which prosumers/consumers buy electricity is pbuy = 15 p/kWh and the price to sell electricity to the energy supplier is psell = 5 p/kWh,. Then the net costs of them are (positive for cost, negative for income)


By contrast, in the MMR mechanism, A and B submit their surplus generation and electricity demand to the market coordinator, which makes the price for P2P energy trading as


The demand of B will be completely supplied by the surplus generation of A at pP2P. Therefore, the net costs of A and B in the MMR mechanism will be


The foundation of the MMR mechanism is the assumption that pbuy is larger than psell, which is usually the case in most countries (e.g., in Great Britain, pbuy is about three times as high as psell). With this assumption, we can see that |CA_P2P| > |CA_CONV| while |CB_CONV| > |CB_P2P|, indicating that the prosumer A has higher income while the consumer B has lower cost in P2P energy trading, so both benefit. The MMR mechanism takes the P2P energy trading price as the mean of the buying and selling prices issued by the energy supplier.

2.2 Trading platforms

Once proper design of P2P energy trading markets is in place, trading platforms are needed for the prosumers, consumers and coordinators to exchange information and negotiate with each other, make deals and transactions, and conduct other relevant activities such as problem reporting and dispute resolution. Considering that trading frequencies are usually high in P2P energy trading, the trading platforms are usually web-based services, which can be accessed by the participants through smart phones, tablets or personal computers in a convenient way.

A trading platform can be built based either on conventional centralised servers and databases or on Distributed Ledger Technology (DLT). Blockchain, which is the underlying technology of Bitcoin and many other cryptocurrencies, is the most famous and widely used type of DLT. Blockchain has a number of features including trustworthiness, transparency, redundancy, tamper-proof ability, and intermediary avoidance, which means it has good potential to be used for supporting P2P energy trading. Furthermore, smart contracts, which are contracts in the form of computer codes that can be automatically executed, can reduce the costs of contracting, enforcement and compliance in P2P energy trading [8].

There have been many industrial projects using Blockchain for P2P energy trading, such as the Brooklyn microgrid case in the U.S. [9]. In spite of the many potential advantages and its increasing use, there are also many issues of using Blockchain or wider DLT for P2P energy trading. DLT is still young and undergoing rapid development, with a number of technical issues, e.g., the high computational and energy costs of the ‘Proof of Work (PoW)’ mechanism and the reduced level of trustworthiness of other consensus mechanisms (Box 2).

Box 2.

“Elecbay” – An example of P2P energy trading platform.

A software platform for P2P energy trading, named as “Elecbay”, has been proposed in [1] and introduced here as an example. The parties and their interaction within “Elecbay” are illustrated in Figure 2.

The design of “Elecbay” learns from that of eBay, which is a famous e-commercial platform enabling customer-to-customer or business-to-customer sales online. On “Elecbay”, electricity sellers list the electricity to be sold as items, while electricity buyers browse all the listed items and place orders. Each order specifies the amount, time duration and price of the electricity to be exchanged.

After the transactions are agreed between electricity buyers and sellers, they will be sent to network operators to check whether the orders satisfy physical network constraints. Network operators can reject the agreements that will cause problems to physical networks. Detailed mechanisms in this will be discussed in Section 2.3.

The electricity to be sold by the sellers may not be enough to satisfy all the needs of the buyers, and vice versa. Therefore, electricity suppliers cover this electricity imbalance (i.e., providing balancing service) through buying/selling electricity from/to sellers/buyers.

Finally, at the settlement stage, “Elecbay” will distribute the payment collected from electricity buyers among electricity sellers (for providing the electricity), network operators (for the use of networks) and electricity suppliers (for dealing with the electricity imbalance). The “Elecbay” platform may keep a small percentage of the payment as the service fee as well.

Figure 2.

The parties and their interaction within “Elecbay”.

2.3 Power and ICT infrastructure

The transactions agreed between prosumers and consumers in P2P energy trading need to be physically delivered through electric power networks. This can be private wires or public power networks, as illustrated in Figure 3.

Figure 3.

P2P energy trading through private wires and public power networks. (a) through private wires. (b) through public power networks.

If a prosumer and a consumer (or two prosumers) are connected purely by private wires, as shown in Figure 3(a), the situation is simple and clear, where the electricity can be transmitted just as agreed in P2P energy trading. However, this is a rare scenario in the real world – electricity transmission and distribution businesses benefit from economies of scale and economies of density, so it is generally not economic (and even illegal in some areas) to build private power networks. Typical examples of private power networks include those in industrial parks, newly built residential communities and microgrids in islands or remote areas.

Therefore, in most practical cases, prosumers and consumers are interconnected with each other through public power networks, as shown in Figure 3(b). Electricity in public power networks has unified power quality, and the electricity from different sources cannot be physically distinguished. In this case, P2P energy trading is in nature a virtual trading arrangement, similar to the bilateral electricity purchase contracts between larger generators and consumers in conventional electricity markets. In spite of the similarities, a lot of new commercial mechanisms need to be set up to allocate the network use charges and network losses, manage the operational constraints, and provide incentives for long term network investment.

Information and communication technology (ICT) infrastructure is also needed to achieve P2P energy trading. Metering infrastructure is needed for measuring the generation/consumption of prosumers and consumers in P2P energy trading for market settlement and billing purposes. The smart metering infrastructure being deployed in many areas of the world is useful in this regard. There is research showing that existing communication technologies are sufficient to support P2P energy trading [10, 11].

2.4 Law, regulation, and policy

There have not been many formal and widely applied policies, laws or regulations on P2P energy trading across the world. P2P energy trading and the corresponding supporting technologies like Blockchain are still at an early stage and under rapid development, so it may still be too early to make firm and widely applied policies. Trials that rely on derogations from existing regulations have the advantages of being very flexible and relatively easy to establish. However, with the rapidly increasing penetration of DERs and increasing scale of P2P energy trading, establishing systematic policy, regulation and legal frameworks will be required (Box 3).

Box 3.

A list of issues to be addressed in future policy development.

The following issues need to be addressed in future policy development:

  • the formal role and responsibilities of participants of P2P energy trading (e.g., prosumers, consumers and the P2P energy trading coordinators),

  • the relationship between P2P energy trading and existing electricity markets (e.g., wholesale market, retail market, capacity market and ancillary service market),

  • the distribution of levies, taxes and network charges among the participants of P2P energy trading,

  • appropriate subsidies and incentives for encouraging the development of P2P energy trading, and

  • protection of vulnerable customers and energy equity in P2P energy trading.

2.5 A social science perspective

P2P energy trading involves large numbers of small customers, who cannot be treated in the same way as large generation companies or electricity suppliers, which behave with almost perfectly economical rationality and have a high-risk tolerance. Therefore, a social science perspective is of great importance in P2P energy trading to design reasonable and effective market mechanisms and to better understand, engage, satisfy, and protect customers (Box 4).

Box 4.

Example social science questions in P2P energy trading.

  1. Is P2P energy trading all settled by cash?

    No! In an ethnographic study in two off-grid villages in rural India, Singh et al. found that P2P energy trading is not just an economic act but actually a complicated sociocultural process [12]. Besides the ‘in-cash’ return (i.e., money), there are ‘in-kind’ return (e.g., food, oil, cakes, and service of irrigation) and ‘intangible’ returns (e.g., goodwill and friendship), involving the dynamics of social relations.

  2. Does P2P energy trading always happen in a marketplace?

    No! In another ethnographic study conducted in an off-grid village in rural India, Singh et al. found that P2P energy trading can not only happen in the regulated market realm mainly with rational participants, but also as ‘a social and personal transaction of energy between giver and energy receiver’. This was named as ‘mutual energy trading’, which is mutually structured and negotiated [13].

  3. Do customers value ‘autarky’ or ‘autonomy’ more?

    Based on the result of an online survey involving 248 German homeowners, Ecker et al. found that most customers value ‘autarky’ (i.e., independence of power supply) more than ‘autonomy’ (i.e., the ability to self-determine the source of energy) [14]. Ecker et al. inferred that this preference might not be good news for deploying P2P energy trading, considering customers might price the electricity they generate at a higher price than its actual worth. This inference remains to be validated in practice.


3. Simulation and evaluation of peer-to-peer energy trading

More and more P2P energy trading mechanisms with various focuses and designs are being created by researchers and practitioners across the world. Therefore, instead of focusing on any specific P2P energy trading mechanism which might be upgraded or replaced quickly, a general simulation and evaluation framework of P2P energy trading is described. This framework facilitates an understanding of the interaction of various parties, and can be used to simulate and assess the outcome of P2P energy trading for improving the mechanism design and conducting feasibility analysis and impact assessment.

3.1 Multiagent simulation

P2P energy trading involves multiple parties with different interests and objectives, and thus is suitable to be modelled and simulated by a multiagent system. The overall picture of the multiagent simulation framework for P2P energy trading is shown in Figure 4.

Figure 4.

A multiagent simulation framework for P2P energy trading (DNO/DSO: Distribution network/system operator; TSO: Transmission system operator).

Figure 4 shows that the framework models the parties related to P2P energy trading as agents and also describes their interactions. In the lower block, the parties within the P2P trading community and their interactions are presented. Although the term ‘community’ is used, it is not necessary to be a physical community, but can be a virtual aggregation of the parties conducting P2P energy trading. The participants of P2P energy trading include prosumers, distributed generators (e.g., small-scale PV power plants), community energy storage (e.g., batteries collectively owned and shared by the customers in a community) and consumers. There is a coordinator managing various aspects of P2P energy trading. This trading coordinator could be a real entity, e.g., a company running this business, or a virtual one, such as a smart contract sitting in a blockchain. Depending on the specific P2P energy trading mechanisms, the participants need to exchange various types of information (such as measurements, bids and offers, pricing signals, and control signals) with the coordinator (in centralised or distributed market designs) or with other participants (in decentralised market designs).

The upper block of Figure 4 shows the external parties. Multiple P2P energy trading communities can trade and share energy with each other, creating a hierarchical P2P energy trading structure [15]. The P2P energy trading community needs to trade and share energy with the energy supplier (also called retailer) to balance the electricity surplus or deficit. Furthermore, the P2P energy trading community could provide various ancillary services, such as voltage support, congestion management and frequency support, for bulk power system utilities, such as distribution network operators (DNOs), distribution system operators (DSOs) and transmission system operators (TSOs) (Box 5) [16].

Box 5.

Mathematical models for simulating P2P energy trading adopting MMR mechanism.

A day-ahead P2P energy trading among prosumers adopting the MMR mechanism is presented as an instance for demonstrating the multiagent simulation. For this instance, the framework in Figure 4 is simplified as that in Figure 5.

As shown in Figure 5, using the MMR mechanism, the P2P energy trading coordinator decides the internal P2P energy trading prices, based on the energy bids provided by the prosumers and the import / export prices issued by the energy supplier. Four models are used to simulate the whole process of P2P energy trading, which are detailed as below.

  1. The P2P energy trading coordinator agent and the MMR pricing model

    The agent representing the P2P energy trading coordinator takes the inputs from the prosumer agents and energy supplier agent and generates the corresponding output, with the core being the MMR pricing model linking the inputs and outputs, as illustrated in Figure 6.

    In Figure 6, ICA is the set of inputs for the coordinator agent, where pSA=ptimtTptextT is the set of electricity prices issued by the supplier agent. ptim represents the price of buying electricity from the supplier (i.e. import price). ptex represents the prices of selling electricity to the supplier (i.e. export price). T is the set of time slots considered and t is the index of a time slot. bPA=btPAtT is the set of ‘energy tenders’ submitted by the prosumer agents, indicating the amount of energy to be sold (if negative) or bought (if positive). The set OCA is the set of outputs for the coordinator agent. pP2P=ptbtTptstT is the prices for prosumers to conduct P2P energy trading with each other. ptb is the buying price and pts is the selling price. eCA=etCAtT is the amount of electricity that the coordinator agent buys from / sells to the supplier agent (positive values for buying and negative for selling) for balancing the supply and demand of the whole P2P energy trading community.

    Based on the ‘energy tenders’ from the prosumer agents, the P2P energy trading coordinator agent calculates the amount of energy that it needs to buy from / sell to the supplier agent to address the supply and demand imbalance within the P2P energy trading community:


    where N is the total number of prosumers in the P2P energy trading community and i is the index of a prosumer.

    The P2P energy trading prices in the MMR mechanism, pP2P, are taken as the mean of grid import and export prices, with some modification terms when there is supply and demand imbalance in the P2P energy trading community, which needs to be balanced by the external supplier agent. Specific formulas are presented in Appendix A.

  2. The prosumer agent and the decision-making model

    The prosumer agent optimises the schedules of its flexible devices and the energy tender submitted to the P2P energy trading coordinator agent, in order to maximise its own economic benefits, as illustrated in Figure 7. Note that a prosumer agent can include models of distributed generators, energy storage and various electric loads, so being a general model that can describe other parties such as community energy storage and consumers as shown in Figure 4.

    In Figure 7, IPA is the set of inputs for the prosumer agent, which includes the P2P energy trading prices pP2P issued by the P2P energy trading coordinator agent. The set OPA is the set of outputs of the prosumer agent, which includes the ‘energy bids’ bPA of the prosumer. The prosumer agent runs an optimisation to decide its optimal operation schedule and energy bids. The formulation of the optimisation problem is presented in Appendix B.

  3. The energy supplier agent

    The energy supplier is considered to act in a passive way, just to balance the electricity imbalances in the P2P energy trading community. The P2P energy trading coordinator imports/exports electricity from/to the energy supplier at the prices published by the energy suppliers. Flexible pricing schemes can be included, such as time-of-use (TOU) pricing, critical peak pricing (CPP), real-time pricing (RTP) and incline block pricing (IBP).

  4. The implementation process and model

    The implementation model specifies how the agents interact with each other, especially between the P2P energy trading coordinator agent and prosumer agents. The decisions of the coordinator agent and prosumer agents depend on each other, so iterations are used to describe their interaction. The iteration process can be fully implemented in practice, or used to model the gaming process in the agents’ mind when they make decisions.

    The convergence of iteration is an issue. In some designs, game-theoretic analysis is used to prove the existence of equilibria, where the iteration can converge, such as in [4]. However, game-theoretic methods usually assume models with specific mathematical forms, which might not be the case in practice. To address this issue, some heuristic methods, such as the ‘Step Length Control’ and ‘Learning Process Involvement’ proposed in [17], can be used to facilitate convergence. If convergence still cannot be achieved, the iteration process can be set to end after a pre-set number of iterations.

    With the above formulation, P2P energy trading adopting the MMR mechanism can be simulated. A numerical example is given in Section 4.

Figure 5.

The multiagent simulation framework for P2P energy trading adopting MMR mechanism.

Figure 6.

The P2P energy trading coordinator agent.

Figure 7.

The prosumer agent.

3.2 Evaluation index hierarchy

With the outcome of P2P energy trading obtained from the multiagent simulation or measured from real implementation cases, an evaluation system is needed for comprehensively assessing the performance of conducting P2P energy trading. The impact of P2P energy trading can include a wide range of aspects – for example, a multi-dimension conceptual framework has been proposed to analyse blockchain-based P2P microgrids from technological, economic, social, environmental and institutional dimensions [17]. In this chapter, we will establish a general index hierarchy with some key quantitative technical and economic indexes for assessing the performance of P2P energy trading.

3.2.1 Technical indexes

From the perspective of microgrid/LES operators, one important motivation of conducting P2P energy trading is to better coordinate and integrate a high penetration of DERs. The potential technical capability of P2P energy trading is mainly in the improvement of local power and energy balance, which can be quantified in various ways.

Box 6.

Technical indexes for assessing P2P energy trading.

Local Power Balance Index

The local power balance facilitated by P2P energy trading can help release circuit congestion, reduce circuit losses and improve the circuit utilisation within the microgrid/LES, and defer network reinforcement for both the microgrid/LES and upper-level power networks. The local power balance can be quantified by the peak-to-average ratio (PAR) within the microgrid/LES, as calculated by


where ILPB is the value of Local Power Balance Index; PMmax is the peak active power of the microgrid/LES; PM¯ is average active power of the microgrid/LES throughout the time horizon considered (usually one day).

Local Energy Balance Index

Local energy balance indicates the extent to which local generation/demand can be consumed/ satisfied within the microgrid/LES, also reflecting the independency of the microgrid/LES. The local energy balance can be quantified by


where ILEB is the value of Local Energy Balance Index; PtIm and PtEx are the total import and export power of the microgrid/LES at the time step t; PtD and PtG are the total demand and local generation of the microgrid/LES at the time step t; T is the total number of time steps considered (usually for one day).

3.2.2 Economic indexes

The economic performance of P2P energy trading can be measured from the perspectives of individual participants as well as the whole microgrid/LES. Economic benefits are direct incentives for conducting P2P energy trading, especially for individual participants.

Box 7.

Economic indexes for assessing P2P energy trading.

Coalition Stability Index

For each individual participant, the necessary condition for it to stay in the P2P energy trading community, rather than directly trade with the conventional energy supplier, is that its economic benefit obtained through P2P energy trading is no lower than those with the energy supplier. Therefore, the coalition stability of the P2P energy trading community can be quantified by the percentage of participants who have higher economic benefits in P2P energy trading than those with the energy supplier, i.e.


where ICS is the value of Coalition Stability Index; NH is the number of participants who have higher economic benefits in P2P energy trading than those with the energy supplier; NP2P is the total number of the participants in the P2P energy trading community.

Total Benefits Index

The total economic benefits of all the participants brought by P2P energy trading, with the benefits with the energy supplier as a reference value, are assessed by


where ITB is the value of Total Benefits Index; BMP2P is the total economic benefits of all the participants in the P2P energy trading community; BMES is the total economic benefits of all the participants if trading with the energy supplier otherwise. The economic benefits are measured by net electricity costs.

Benefits Allocation Index

Another index is needed for reflecting how the total benefits brought by P2P energy trading are allocated to each participant, which is defined as follows:


where IBA is the value of Benefits Allocation Index, and C represents the net cost of a P2P energy trading participant (positive for cost and negative for income) throughout the time horizon considered. It is seen that (11) calculates the summation of the cost difference between any two participants in P2P energy trading.

3.2.3 Index normalisation and index hierarchy establishment

Based on the individual technical and economic indexes defined in the previous subsections, an index hierarchy can be established to assess the overall performance of P2P energy trading. To compare and synthesise different indexes, the indexes need to be normalised with the following features: (i) the index value being a number ranging from 0 to 1, and (ii) the index value ‘0’ representing ‘the worst’ and ‘1’ representing ‘the best’. Specific normalisation of the indexes presented in the previous subsections is given in the following box. The technical and economic indexes presented in Boxes 6 and 7 are normalised as follows (Table 1).

CategoryIndex nameOriginal indexNormalised indexNotes
TechnicalLocal Power BalanceILPB=PMmaxPM¯ILPB=1ILPBσσ: Maximum peak-average ratio from experience
Local Energy BalanceILEB=t=1TPtIm+PtExt=1TPtD+PtGILEB=1ILEB
EconomicCoalition StabilityICS=NHNP2PICS=ICS
Total BenefitsITB=BMP2PBMESITB=ITBBMmaxBMESBMmax: Maximum potential benefits that could be obtained (calculated through centralised optimisation [18])
Benefits AllocationIBA=i=1NP2Pj=1NP2PCiCjIBA=1IBA2NP2P2·maxi12NCi

Table 1.

Normalisation of evaluation indexes for assessing P2P energy trading.

After normalisation, the indexes can be synthesised hierarchically by calculating the weighted sum, as presented below and illustrated in Figure 8 [19]:

Figure 8.

Evaluation index hierarchy for assessing P2P energy trading.


where ITPI, IEPI and IOPI represent the values of Technical Performance Index, Economic Performance Index, and Overall Performance Index; αi, βi and γi are the weighting coefficients; IiTI represents the i-th technical index (such as the local power/energy balance index), and NTI is the total number of technical indexes; IiEI represents the i-th economic index (such as Coalition Stability Index, Total Benefits Index and Benefits Allocation Index), and NEI is the total number of economic indexes; Iisub represents the i-th index below the ‘Overall Performance Index’ level (such as Technical Performance Index and Economic Performance Index), and Nsub is the total number of these indexes.

It is worth noting that the indexes and hierarchy presented are just examples, and the methodology behind these examples is general and scalable. Firstly, more/different indexes for assessing technical or economic performance can be defined. Furthermore, other aspects beyond technical and economic performance, such as social, environmental and institutional dimensions, can also be considered to be assessed. More complicated methods can be used to synthesise the indexes at different levels, such as using the Analytic Hierarchy Process (AHP) method to decide the values of weighting coefficients.


4. Case study

A case study using multiagent simulation and the evaluation index hierarchy described in Sections 2 and 3 demonstrates P2P energy trading and its performance. A residential community consisting of 20 houses in Great Britain (GB) was considered. P2P energy trading was conducted between the customers within the community, adopting the MMR mechanism. The simulation was conducted in MATLAB and the optimisation was solved using CPLEX solvers.

4.1 Case design and parameters

For the 20 houses in the community, it was assumed that half of the houses had a 2 kW PV system for each house but did not have an electric vehicle, while each of the other half owned an electric vehicle but did not have a PV system. The CREST model [20], which is based on realistic GB statistics, was used to generate the electrical and usage patterns of the domestic appliances, demand and PV generation profiles of each house. The parameters and travel behaviour of the electric vehicles were generated from a database reflecting realistic use in GB [21].

The customers were assumed to conduct P2P energy trading under the MMR mechanism. They were assumed to do the trading day-ahead at the time resolution of one hour, i.e., making energy trading agreements for each hour of the next day one day in advance. For P2P energy trading, the ‘Learning Process Involvement’ technique was adopted as the implementation mechanism [19], with the learning rate selected as 0.5 and the maximum iteration number being 300. The import and export electricity prices provided by the external energy supplier were assumed to be 14.57 pence/kWh and 5.03 pence/kWh, which are typical values in GB.

Two reference cases (i.e., ‘P2G’ and ‘Global Optimum’) were simulated and compared with the P2P energy trading case (the ‘P2P’ case). The ‘P2G’ (‘Peer to Grid’) is the current arrangement in GB, where customers separately trade with the energy supplier at the import/export prices. In the ‘Global Optimum’ case, all the customers were assumed to be fully controlled by a centralised entity, which minimised the electricity cost of the whole community. The ‘Global Optimum’ case is to provide a reference to examine the capability of P2P energy trading in tapping the economic potential in the community.

When calculating the values of the evaluation indexes, equal coefficients were taken at all the levels.

4.2 Simulation and evaluation results – technical performance

The resulting daily demand profiles of the whole community in the three cases are presented in Figure 9, also with the community generation profiles and external/internal electricity prices plotted. The index values regarding the technical performance are shown in Table 2.

Figure 9.

The community demand and generation profiles with the external/internal electricity prices in the three cases. (a) the ‘P2G’ case. (b) the ‘global optimum’ case. (c) the ‘P2P’ case.

CasesLocal power balance indexLocal energy balance indexTechnical performance index
Global Optimum0.31890.82600.5724

Table 2.

Indexes values of the technical performance in the three cases.

Figure 9(a) shows that the surplus PV power generation of some customers in the community was not consumed by other customers in the community due to the lack of coordination among customers when the customers separately traded with the external energy supplier. Moreover, the peak power of the community of the day was as high as 38.45 kW. By contrast, Figure 9(b) shows that, with the global optimisation, the local energy balance was able to reach a very high level, and the peak net power was reduced significantly to 10.14 kW.

Figure 9(c) shows the results with P2P energy trading. Compared to the ‘P2G’ case, much flexible demand was shifted to around noon to utilise the surplus PV power generation, incentivised by the lower internal P2P buying prices during those periods. This resulted in a much higher level of local energy balance as well as a higher level of local power balance with the peak net power of the community in the day being just 9.20 kW. Compared to the ‘Global Optimum’ case, the local energy balance level of the ‘P2P’ case was slightly lower expectedly, but the peak net power was also slightly lower (indicating an even better local power balance than the ‘Global Optimum’ case). This is because the price signals with the unit of £/MWh just incentivise local energy balance but do not incentivise local power balance directly. Therefore, additional measures, such as adding a ‘capacity charge’ element (i.e., with the unit being £/MW), can be taken (in the traditional retail market or in the P2P energy trading market) to further incentivise the local power balance.

Table 2 shows the quantified performance through the index values. Consistent with the results shown in Figure 9, the values of Local Power Balance Index, Local Energy Balance Index and Technical Performance Index in the ‘P2P’ case are 220.8%, 67.6% and 106.6% higher than those in the ‘P2G’ case. On the other hand, the value of Local Energy Balance Index in the ‘P2P’ case is just 5.5% lower than that of the ‘Global Optimum’ case, showing that P2P energy trading under the MMR mechanism had got very close to the global optimum in this respect.

4.3 Simulation and evaluation results – economic performance

The total net cost of the community is illustrated in Figure 10, showing that P2P energy trading with the MMR mechanism significantly reduced the total net cost of the community compared to the ‘P2G’ case, being very close to the global optimum value.

Figure 10.

The daily net cost to the community in the three cases.

Figure 11 shows that the daily net cost of any customer in the ‘P2P’ case was lower than that in the ‘P2G’ case, indicating that P2P energy trading benefited every customer to some extent and no customer would have the incentive to escape from the P2P energy trading coalition.

Figure 11.

The cost distribution in the community in the ‘P2G’ and ‘P2P’ cases.

The index values regarding the economic performance are calculated as presented in Table 3. Note that the index values regarding the cost distribution were not calculated for the ‘Global Optimum’ case, since how the total cost of the community is allocated was not specified for the ‘Global Optimum’ case.

CasesCoalition stability indexTotal benefits indexBenefits allocation indexEconomic performance index
Global OptimumN/A1.0000N/AN/A

Table 3.

Indexes values of the economic performance in the three cases.

The numbers in Table 3 are discussed as follows. Consistent with the results in Figures 10 and 11, the value of Total Benefits Index of the ‘P2P’ case is significantly higher than that of the ‘P2G’ case, being only 8.5% lower than that of the ‘Global Optimum’ case. No customer would be worse off in the ‘P2P’ case, so the value of Coalition Stability Index takes the maximum value of 1.0000. By contrast, the value of Benefits Allocation Index in the ‘P2P’ case is slightly lower than that of the ‘P2G’ case, showing that P2P energy trading with the MMR mechanism did not improve the equity level in the community in terms of electricity cost. In summary, the value of Economic Performance Index of the ‘P2P’ case is 27.95% higher than that of the ‘P2G’ case, showing clear economic benefits brought by P2P energy trading.

4.4 Simulation and evaluation results – overall performance

The performance of the three cases is summarised in Table 4. It is shown that P2P energy trading has a significantly better performance from both the technical and economic perspectives, compared to the existing arrangement where customers separately trade with the energy supplier, showing the great potential of P2P energy trading.

CasesTechnical performance indexEconomic performance indexOverall performance index
Global Optimum0.5724N/AN/A

Table 4.

Comparison of the overall performance of the three cases.


5. Summary

P2P energy trading is an innovative approach for managing increasing numbers of DERs in microgrids or local energy systems. In P2P energy trading, prosumers and consumers directly trade and exchange power and energy with each other. With proper design, P2P energy trading can create a triple win situation for customers, microgrids/local energy systems and wider bulker energy systems.

P2P energy trading is an emerging area with rapidly increasing academic research and industrial practice in many places of the world. P2P energy trading can be conducted across multiple temporal scales (e.g., settlement markets and forward markets with various time resolutions) and multiple spatial scales (i.e., within/between/beyond microgrids/LES). The development of P2P energy trading can be categorised into five key aspects, that is, i) market design, ii) trading platforms, iii) power & ICT infrastructure, iv) law, regulation & policy, and v) social science perspective.

Multiagent simulation and an evaluation index hierarchy were proposed to simulate and evaluate various P2P energy trading mechanisms. These techniques are useful for both academic study and industrial practice. In the multiagent simulation, relevant parties involved in P2P energy trading, such as market coordinators, energy suppliers and prosumers, are modelled as agents, with their internal behaviour models and interaction with other parties described. In the evaluation index hierarchy, quantitative indexes are defined to assess different aspects of P2P energy trading (e.g., technical and economic aspects), and indexes are synthesised to reflect higher-level performance. It is worth noting that the multiagent simulation framework and evaluation index hierarchy described are actually open systems, which are easy to extend and adjust for further development or specific applications.

Finally, P2P energy trading in a residential community in the context of GB was demonstrated as a case study. The houses had PV panels, electric vehicles and other typical appliances, trading and sharing electricity with each other in a day-ahead manner. Simulation results showed that the adopted P2P energy trading mechanism significantly improved the technical and economic performance of the community. The case study also showcased the application of a multiagent simulation framework and the effectiveness of the evaluation index hierarchy.


The Mid-Market Rate mechanism makes the P2P energy trading prices using the following formulas:




In (A1) and (A2), ptb and pts represent the prices at which the prosumers buy and sell electricity in the P2P energy trading community. ptmean is the average of the import price ptim and export price ptex issued by the supplier agent, as calculated in (A3).Dt and Gt are the total electricity demand and supply in the P2P energy trading community, as specified by (A4) and (A5) respectively. bi,tPA is the energy tender submitted by the prosumer agent i, indicating the amount of energy to be sold (if negative) or bought (if positive).

The prosumer agent runs an optimisation to decide its optimal operation schedule and energy bids. If a prosumer with solar PV panels, an electric vehicle, an electric water heater with a tank (as a flexible load) and inflexible electric loads is considered for example, the decision-making model of this prosumer is as follows:




subject to


(B1) is the objective function, showing that the prosumer agent tries to minimise its daily net electricity cost. Ptnet is the net power consumption at the time slot t, calculated by (B2) where xtH is the power consumption of the electric water heater; xtch and xtdis are the charging (always positive) and discharging (always negative) power of the electric vehicle; ηch and ηdis are charging and discharging efficiencies of the electric vehicle; Ptinflex is the sum of the all the inflexible loads; PtPV is the power generation of the PV panels. Positive Ptnet means the prosumer has electricity deficit, so the prosumer agent needs to buy electricity from the P2P energy trading community, thus the P2P energy trading price being the buying price shown in (B3). By contrast, negative Ptnet means the prosumer has electricity surplus, so the prosumer agent needs to sell electricity to the P2P energy trading community, thus the P2P energy trading price being the selling price shown in (B3). t is the length of a time step.

(B4)(B7) are the constraints regarding the electric water heater with a hot water tank. (B4) and (B5) ensure that the thermal energy stored in the hot water tank can satisfy the hot water demand at the same time does not exceed the capacity of the tank. ρ is unit conversion coefficient between ‘J’ and ‘kWh’; M is the maximum amount of water the tank can store in the tank; c is the specific heat capacity of water; θ¯ and θ¯ are the lower and upper limits of the water temperature in the tank; θini is the initial water temperature in the tank. (B6) calculates the heat energy needed at each time step, Qt, because of the hot water use. θset is the setpoint of the water temperature, and θcold is the temperature of the cold water inlet. mt is the amount of water consumed at each time step. (B7) specifies the range of electric power of the water heater for heating.

(B8)(B12) are the constraints regarding the electric vehicle. (B8) describes the evolution of the state of charge (SOC) of the batteries in the electric vehicle. (B9) models the impact of travelling on the SOC, where SOCtin and SOCtout represent the SOC when the electric vehicle returns home and leaves from home for travelling respectively, and SOC represents the amount of energy needed (measured by SOC) for travelling. Note that here only one travel is modelled – if more travels are made, similar equations can be added. (B10) specifies the upper bound SOC¯ and lower bound SOC¯ of SOC. (B11) requires the SOC at the end of the day, SOCT, should be equal to that at the beginning of the day, SOCini, so that the schedule is sustainable for the future. (B12) specifies the ranges of charging and discharging power.

In summary, given the P2P energy trading prices received from the P2P energy trading coordinator agent, the prosumer will optimise its flexible load schedule to minimise its own net electricity cost. The resulting net power consumption/generation will be submitted to the coordinator agent for deciding the P2P energy trading prices, i.e., the set of energy bids being bPA=btPA=PtnettT .


  1. 1. C. Zhang, J. Wu, Y. Zhou, M. Cheng, and C. Long, “Peer-to-peer energy trading in a microgrid,” Applied Energy, vol. 220, pp. 1-12, Jun. 2018.
  2. 2. Y. Zhou, J. Wu, C. Long, and W. Ming, “State-of-the-art analysis and perspectives for peer-to-peer energy trading,” Engineering, vol. 6, no. 7, pp. 739-753, Jul. 2020.
  3. 3. T. Morstyn, A. Teytelboym, and M. D. McCulloc, “Bilateral contract networks for peer-to-peer energy trading,” IEEE Transactions on Smart Grid, vol. 10, no. 2, pp. 2026-2035, 2019.
  4. 4. N. Liu, X. Yu, C. Wang, C. Li, L. Ma, and J. Lei, “Energy-sharing model with price-based demand response for microgrids of peer-to-peer prosumers,” IEEE Transactions on Power Systems, vol. 32, no. 5, pp. 3569–83, 2017.
  5. 5. D. H. Nguyen, “Optimal solution analysis and decentralized mechanisms for peer-to-peer energy markets,” IEEE Transactions on Power Systems, vol. 36, no. 2, pp. 1470-1481, Mar. 2021.
  6. 6. W. Tushar, C. Yuen, H. Mohsenian-Rad, T. Saha, H. V. Poor, and K. L. Wood, “Transforming energy networks via peer-to-peer energy trading: the potential of game theoretic approaches,” IEEE Signal Process Magazine, vol. 35, no. 4, pp. 90-111, 2018.
  7. 7. C. Long, J. Wu, C. Zhang, L. Thomas, M. Cheng, and N. Jenkins, “Peer-to-peer energy trading in a community microgrid,” in Proceedings of IEEE PES General Meeting, Chicago, IL, USA, pp. 1-5, 2017.
  8. 8. M. Walport. “Distributed ledger technology: beyond block chain.” Government Office for Science. 2016. (accessed Apr. 13, 2021).
  9. 9. E. Mengelkamp, J. Gärttner, K. Rock, S. Kessler, L. Orsini, and C. Weinhardt, “Designing microgrid energy markets: a case study: the Brooklyn microgrid,” Applied Energy, vol. 210, pp. 870-880, Jan. 2018.
  10. 10. O. Jogunola, A. Ikpehai, K. Anoh, B. Adebisi, M. Hammoudeh, H. Gacanin, and M. Hammoudeh, “Comparative analysis of P2P architectures for energy trading and sharing,” Energies, vol. 11, no. 1, 2018.
  11. 11. C. Zhang. Peer-to-peer energy trading in electrical distribution networks [PhD Dissertation]. Cardiff: Cardiff University; 2017.
  12. 12. A. Singh, A. T. Strating, N. A. R. Herrera, D. Mahato, D. V. Keyson, and H. W. van Dijk, “Exploring peer-to-peer returns in off-grid renewable energy systems in rural India: an anthropological perspective on local energy sharing and trading,” Energy Research & Social Science, vol. 46, pp. 194-213, Dec. 2018.
  13. 13. A. Singh, A. T. Strating, N. A. R. Herrera, H. W. van Dijk, and D. V. Keyson, “Towards an ethnography of electrification in rural India: social relations and values in household energy exchanges,” Energy Research & Social Science, vol. 30, pp. 103-115, Dec. 2017.
  14. 14. F. Ecker, H. Spada, and U. J. J. Hahnel, “Independence without control: autarky outperforms autonomy benefits in the adoption of private energy storage systems,” Energy Policy, vol. 122, pp. 214-228, 2018.
  15. 15. L. Shi, Y. Zhou, C. Long, S. Abeysinghe, L. Cipcigan, and J. Wu, “A peer-to-peer energy trading hierarchy for microgrids in distribution networks,” in Proceedings of International Conference on Applied Energy, Västerås, Sweden, pp. 1-6, 2019.
  16. 16. Y. Zhou, J. Wu, G. Song, and C. Long, “Framework design and optimal bidding strategy for ancillary service provision from a peer-to-peer energy trading community,” Applied Energy, vol. 278, 115671, 2020.
  17. 17. A. Ahl, M. Yarime, K. Tanaka, and D. Sagawa, “Review of blockchain-based distributed energy: Implications for institutional development,” Renewable and Sustainable Energy Reviews, vol. 107, pp. 200-211, Jun. 2019.
  18. 18. Y. Zhou, J. Wu, C. Long, M. Cheng, and C. Zhang, “Performance evaluation of peer-to-peer energy sharing models,” in Energy Procedia (World Engineers Summit – Applied Energy Symposium & Forum: Low Carbon Cities & Urban Energy Joint Conference, WES-CUE 2017), Singapore, pp. 1-6, 19-21 Jul. 2017.
  19. 19. Y. Zhou, J. Wu, and C. Long, “Evaluation of peer-to-peer energy sharing mechanisms based on a multiagent simulation framework,” Applied Energy, vol. 222, pp. 993-1022, Jul. 2018.
  20. 20. E. McKenna, and M. Thomson, “High-resolution stochastic integrated thermal-electrical domestic demand model,” Applied Energy, vol. 165, pp. 445-461, Jan. 2016.
  21. 21. Y. Zhou, J. Wu, and C. Long, “Electric_Vehicle_Dataset (Great Britain).xlsx”, in Evaluating peer-to-peer energy sharing mechanisms for residential customers in present and future scenarios of Great Britain (Cardiff University Research Datasets), available from:

Written By

Yue Zhou and Jianzhong Wu

Submitted: 01 July 2021 Reviewed: 13 July 2021 Published: 15 December 2021