# Distribution Optimal Power Flow With Energy Sharing *Via* a Peer-To-Peer Transactive Market

^{1}State Key Laboratory of Power System and Generation Equipment, Department of Electrical Engineering, Tsinghua University, Beijing, China^{2}State Grid Qinghai Electric Power Company, Xining, China

The technology advancement and cost decline of renewable and sustainable energy increase the penetration of distributed energy resources (DERs) in distribution systems. Transactive energy helps balance the local generation and demand. Peer-to-peer (P2P) energy trading is a promising business model for transactive energy. Such a market scheme can increase the revenue of DER owners and reduce the waste of renewable energy. This article proposes an equilibrium model of a P2P transactive energy market. Every participant seeks the maximum personal interest, with the options of importing or providing energy from/to any other peer across different buses of the distribution network. The market equilibrium condition is obtained by combining the Karush–Kuhn–Tucker conditions of all problems of individual participants together. The energy transaction price is endogenously determined from the market equilibrium condition, which is cast as a mixed-integer linear program and solved by a commercial solver. The transactive energy flow is further embedded in the optimal power flow problem to ensure operating constraints of the distribution network. We propose a remedy to recover a near optimal solution when the second-order cone relaxation is inexact. Finally, a case study demonstrates that the proposed P2P market benefits all participants.

## Introduction

With the development of modern society and economy, the energy consumption is continuously increasing. However, due to the depletion of nonrenewable energy and the greenhouse gas emission from burning fossil-fuel energy, it is imperative to develop renewable and sustainable energy (Liu et al., 2020). The technology advancement and cost decline contribute to the high penetration of distributed energy resources (DERs), such as solar photovoltaics, wind turbine, and energy storage devices, in the power system (Hou et al., 2021). In such circumstances, there could be multiple generation sources that are volatile and owned by profit-driven entities. The Feed-in Tariff (FiT) scheme has been implemented as an effective tool to encourage DERs investment and owners’ participation in energy trading (Pyrgou et al., 2016). In the FiT scheme, DER owners can sell their excessive energy to main grid at a designed price. But the FiT scheme has been criticized for lacking competition (Butler and Neuhoff, 2008) and offering participants limited benefits (Tushar et al., 2015).

The transactive energy system is proposed to manage the energy generation and consumption and facilitate energy trading in the power system. The transactive energy scheme helps balance the local renewable energy generation and demand in the timeframe of real-time within a distribution network (Abrishambaf et al., 2019).

With the advancement of Information and Communication Technology (ICT), peer-to-peer (P2P) energy trading has been designed and expected to be a promising business model for the transactive energy scheme in future power systems (Abdella and Shuaib, 2018). P2P trading is composed of energy buyers and sellers, power system operators, and P2P service servers. A peer in the P2P market can sell surplus energy to local peers and can choose to act as an energy buyer or seller based on personal preferences and needs (Giotitsas et al., 2015). All peers can exchange energy with each other directly, without the involvement of utility companies. The implement of P2P energy trading enables all peers to engage in energy trading, thus creating a competitive energy market. Both the energy buyer and the seller can benefit from P2P transaction because they can utilize excessive renewable energy and reach a mutually satisfactory price and quantity (Mengelkamp et al., 2018). The P2P transactive market can also balance local energy supply and demand, thus reducing energy transmission losses. Furthermore, it can improve the power system reliability and reduce infrastructure investment (Shrestha et al., 2019).

Recently, P2P energy trading has attracted great attention as never before and an increasing number of researches have been conducted to facilitate the P2P trading mechanism. The state-of-the-art of P2P energy trading is presented as follows.

There are many articles summarizing the design and architecture of the P2P energy trading market. Tushar et al. (2020a) provided a detailed overview in the P2P energy trading field and discussed the solution techniques implemented in the P2P market. The key elements in the P2P market can be divided into virtual layer and physical layer. The virtual layer has the transaction data flow and the market mechanism while the physical layer consists of the power grid and communication infrastructure to guarantee that the physical energy transaction is carried out successfully. Zhang et al. (2018) proposed a four-layer system architecture in the P2P market, providing evaluation criteria to identify related technologies, facilities, and designs. The proposed architecture has three dimensions. The first dimension consists of business layer, control layer, ICT layer, and physical power grid layer, which form the basic framework in the P2P market. The second and third dimensions are classified according to the size of participants and energy trading process, respectively. Sousa et al. (2019) categorized the community-based P2P structure into full market, community-based market, and hybrid market according to the degree of connection and communication. In the full market, the peers can directly trade with each other without centralized coordination. By contrast, the community-based market requires a community manager to arrange the energy transactions within the community or between communities. The hybrid market is the combination of the above two market structures. Long et al. (2018a) categorized the P2P energy trading based on the existence of an intermedia. Without an intermedia, prosumers can directly control their DERs and a P2P market coordinator is needed to collect participants’ information and provide price signal. With an intermedia, a third party can manage prosumers’ energy and act as a market coordinator. In summary, the previously proposed P2P market architecture can be mainly classified as three types based on the degree of decentralization: decentralized market, centralized market, and hybrid market, as shown in Figure 1.

**FIGURE 1**. Three types of P2P market architecture: **(A)** decentralized market; **(B)** centralized market; **(C)** hybrid market.

1) *Decentralized market*: In a decentralized P2P energy market, peers can negotiate and trade with each other directly without the intermediary. The market participants can decide their transaction amount and price to maximize their personal interest and satisfy own preferences. Sorin et al. (2018) proposed a decentralized P2P market design based on multi-bilateral economic dispatch (MBED). The authors described a relaxed consensus + innovation (RCI) approach to solve the MBED. Such a market can cater to consumers’ product differentiation preference and maximize society surplus. Morstyn et al. (2019) established a bilateral contract network for scalable P2P energy trading for real-time and forward market. The utility-maximizing preferences of agents satisfy full substitutability, which guarantees a stable result in the distributed price-adjustment process. Guerrero et al. (2019) designed a decentralized P2P scheme with a self-interested agent. The pricing mechanism builds on continuous double auction (CDA). This scheme is also the first decentralized P2P architecture considering distribution network constraints. Alvaro-Hermana et al. (2016) presented a P2P energy trading application scene in electric vehicles (EV) with the objective of minimizing EV users’ energy expense. The implementation of P2P trading benefits users involved in the market and decreases charging impact on grid. Tushar et al. (2020b) proposed a P2P trading design based on coalition formation game. In such a prosumer-centric market, a prosumer can decide to join the P2P market or not by evaluating the P2P market’s attractiveness. Prosumers can also choose whom to cooperate or not to achieve more benefit.

2) *Centralized market*: In a centralized market, an aggregator communicates with peers and manages the operation of DERs. The aggregator collects information from participants and makes proper control decisions of devices to reach a common target, for example, maximizing financial benefit or achieving an environmentally friendly goal. Kang et al. (2017) implemented localized P2P energy trading among plug-in hybrid electric vehicles (PHEVs). Local aggregators communicate with PHEVs, acquire their charging and discharging demand, and allocate energy with a goal of maximizing social welfare. Alam et al. (2017) proposed a P2P energy trading model with a Pareto optimality method. The proposed model requires the centralized manager to solve a multiobjective optimization problem, including microgrid energy cost minimization and individual cost optimization, and finally obtain Pareto optimality results, eliminating unfair cost distribution. Long et al. (2018b) developed a two-stage aggregated control method in P2P energy sharing where an energy sharing aggregator controls DERs to reduce total energy cost. An adjusted supply and demand ratio pricing mechanism is proposed to benefit all participants. Nguyen et al. (2018) proposed a centralized P2P trading mechanism in a local community with rooftop PV and battery. The objective of the aggregator is to minimize the total energy cost and the problem is formulated as a mixed integer linear programming (MILP). Long et al. (2017) introduced a centralized P2P energy trading to maximize the local energy balance. A linear programming is implemented to solve the market.

3) *Hybrid market*: Hybrid market is the combination of decentralized and centralized markets, in which a peer can decide to switch from the conventional energy market to the P2P energy market with the price signal from the aggregator. On one hand, the hybrid market requires an aggregator to manage and supervise transaction activities compared with the decentralized market. On the other hand, peers can control their devices, achieve self-interest, and protect personal privacy in comparison with the centralized market. Long et al. (2018a) presented three representative P2P market designs with different pricing mechanisms. They are, respectively, bill sharing, mid-market rate, and auction-based pricing strategy. Qi et al. (2019) constructed a P2P transaction model, with the aim of maximizing prosumers’ benefit. The proposed model considers the impact of distribution network constraint on P2P transaction. Zhang et al. (2016) devised a bidding platform “Elecbay” based on the noncooperative game theory, in which all peers make their decision independently. The agents with flexibility of demand in the platform can mathematically lead to Nash equilibrium. Morstyn and McCulloch (2019) proposed a P2P market based on multiclass energy management, in which a distributed price-directed optimization mechanism is constructed to respect prosumer preferences and minimize external cost.

Game theory approaches, optimization methods, and auction-based approaches are widely used in designing P2P energy trading. Game theory is used in a competitive circumstance in which a player’s decision and action will affect other players’ outcomes and vice versa. Game theory approaches are grouped into two parts: noncooperative and cooperative game theory (Tushar et al., 2018). The author summarized several P2P energy management domains adopting game theory approached, including electric vehicle, DERs, energy storage, and energy service. Optimization methods are widely used in the P2P scheme. In Nguyen et al. (2018), an agent with rooftop PV and battery participates in P2P energy trading and proposes a centralized P2P trading mechanism in a local community with rooftop PV and battery and a mixed integer linear programming is proposed to minimize the total energy cost. Morstyn and McCulloch (2019) used the distributed convex optimization method alternating direction method of multipliers (ADMM) to solve the multiclass energy management problem. Auction-based approaches can be applied to markets with multiple energy buyers and sellers. Continuous double auction is used to match energy sellers and buyers and bidding strategies is proposed to facilitate agent’s bid and ask (Guerrero et al., 2019). An iterative double auction algorithm is proposed based on consortium blockchain to disclose hidden information about electric vehicles (Kang et al., 2017).

However, there are still some research gaps in the existing research works. Many studies did not concentrate on individual P2P market participant’s interest, and such a market mechanism might damage personal interest. Many pricing designs in the P2P energy sharing market did not reflect the true value of transactive energy resources in different supply–demand scenarios and could not guarantee every participant’s benefit from the market. P2P transaction should be conducted *via* physical distribution network, whereas the operating constraints are rarely taken into consideration.

In this article, we study transactive energy in a P2P market with participants at different buses of a distribution network. The main contributions are twofold.

1) We propose an equilibrium model of a P2P transactive market. Every participant is rational and pursues profit maximum, with the options of importing or providing energy from/to any other peer across different buses of the distribution network. The market equilibrium condition is obtained by combining the Karush–Kuhn–Tucker (KKT) conditions of all problems of individual participants together. Specifically, the price is endogenously determined from the market equilibrium condition, rather than bid by the providers, which is different from existing works and better reflects the value of resources in accordance with the supply–demand relation. The market equilibrium condition is further cast as a mixed-integer linear program and solved by a commercial solver.

2) We formulate the distribution optimal power flow (OPF) problem considering the transactive energy flow at the market equilibrium. To solve the nonlinear OPF problem, the second-order cone relaxation is performed. If the convex relaxation is inexact, a feasible recovery procedure is suggested to recover a near-optimal solution. The procedure entails solving second-order cone programs and is thus efficient. Such a framework offers a new paradigm to study power system operation with P2P transactive energy.

The remainder of this article is organized as follows. The P2P transaction scheme, the mathematical model of the P2P market, and the market equilibrium condition are presented in *P2P Transactive Scheme and the Market Equilibrium*. The distribution OPF problem considering the transactive energy flow of the P2P market and the solution technique are given in *Optimal Power Flow With Transactive Energy*. Case studies are reported in *Case Study*. Finally, *Conclusion* concludes the article.

## P2P Transactive Scheme and the Market Equilibrium

In this section, a P2P transactive energy scheme is proposed. The problems of energy sellers and buyers are then presented. At last, the market equilibrium condition is given and cast as an MILP.

### Problem Description

The transaction structure of the P2P energy-sharing market proposed in this article is shown in Figure 2. In this article, a peer who has excessive energy and shares energy with other people is identified as a typical energy seller

1) The infrastructure has been installed to operate P2P sharing scheme.

2) Associated stakeholders in the P2P market are rational and maximize their own interest. A contract with

3) Energy sellers can choose to sell their surplus energy to the main grid in the FiT scheme or trade in the P2P market. Similarly, buyers can also purchase energy from the grid or the P2P market, with the hope to minimize their costs. A seller or buyer can sell or buy energy at a higher or lower price in the P2P market compared with traditional power utility. Otherwise, people will have no incentive to participate in P2P sharing.

4) The P2P market is operated by an aggregator. It collects supply and demand information from participants and clears the market. Then, it sends transaction results to the distribution grid.

5) All players are self-interested and they will not form an alliance. Besides, we assume all players tell their true supply and demand information to the aggregator.

### Mathematic Formulation

The models of sellers, buyers, and total P2P market are presented in the following subsections.

##### Seller’s Problem

A rational energy seller

where

Constraint (Eq. 2) limits that the total P2P trading amounts should not be more than seller’s initial surplus energy. Constraint (Eq. 3) imposes non-negativity condition on the P2P trading amount.

##### Buyer’s Problem

A rational energy buyer

where *Seller’s Problem*.

Constraint (Eq. 5) shows that the total P2P trading amounts should not exceed buyer’s demand.

##### Time-And-Level-Of-Use Price

Energy buyers purchase energy from the main grid at the TLOU price, which consists of two dimensions: time of day and level of consumption (Gomez-Herrera and Anjos, 2019). The structure of TLOU is as follows:

where

##### Equilibrium Model

In summary, all the participants in the P2P market consider their own interest optimal problem at the same time. Sellers or buyers increase or lower the transaction price

where all participants’ interests are taken into consideration and solved simultaneously.

### Problem Reformulation

In equilibrium problem (Eq. 8), it is crucial that sellers and buyers have consistent decision variables

It is worth mentioning that the transaction price

The KKT condition of seller

The expression

The KKT condition of each buyer

Since the sellers and buyers have consistent values of

Problem (Eq. 11) is composed of a set of linear and nonlinear constraints. The decision variable

However, the equilibrium problem (Eq. 11) is a nonlinear problem and intrinsically hard because of the existence of nonlinear complementary slackness constraints.

### Big-M Method

To deal with the complementary slackness constraints in the equilibrium problem (Eq. 11), we introduce a big-M method proposed in Fortuny-Amat and Mccarl (1981). Take complementary slackness constraint in KKT conditions (Eq. 9) as an example:

If the primal constraint is not binding, its dual variable

where

However, the above constraints lack an optimization problem. We create an MILP to implement constraints (Eqs. 13, 14):

The objective function (Eq. 15) should be zero if the question is feasible. Otherwise, if the optimal value is positive, the complementary slackness constraint is violated. In the objective function, the product term

Similarly, the reformulation can be applied to the first term

Finally, the objective function (Eq. 15) can be written as an MILP:

Feasible solution can be obtained by solving above MILP through the commercial optimization problem solver, such as MOSEK.

## Optimal Power Flow With Transactive Energy

In this section, we implement P2P energy sharing in the optimal power flow problem of a microgrid-based distribution network. A distribution system operator (DSO) controls the distribution network with an operation goal to minimize the total energy cost. Many distribution networks are radial network with tree topology. The typical connection of a radial network is shown in Figure 3. Without loss of generality, a peer in the P2P market is a bus in distribution network, whose role is, e.g., a traditional energy consumer, a prosumers with DERs, or a local solar power station, etc. Branch flow model (BFM) is used in radial distribution power grid (Baran and Wu, 1989b) (Baran and Wu, 1989a). The radial network can be described by a graph

### Branch Flow Model

The mathematical formulation of BFM is described as follows, with an objective function to minimize total energy generation cost.

where constraints (Eqs. 21, 22) are bus active/reactive power balance condition. Constraint (Eq. 23) is the forward voltage drop in branch

Constraints (Eqs. 25–28) are the physical network operating constraints, which represent the active and reactive generation capacities, nodal voltage constraint, and power flow limits in each line.

In the above constraints (Eq. 24) is a quadratic equation, which makes the BFM nonlinear and nonconvex. To solve the nonconvex problem Farivar and Low (2013) proposed a second-order cone program (SOCP) method to make convex relaxation, which replaces the equality constraint (Eq. 24) with the following inequality constraint in a canonical form:

Such a SOCP convex relaxation is exact for BFM under some mild conditions, such as the objective function is convex and cost is strictly increasing in line losses. However, the relaxation may be inexact if the objective function violates the above mild conditions, thus resulting in infeasible solution.

Denote the BFM constraints with SOCP concisely as Cons-BFM.

### Feasibility Recovery

To make sure the convex relaxation is exact Wei et al. (2017) proposed a method based on the convex-concave program to evaluate the initial SOCP result and run the feasibility recovery procedure if SOCP is inexact. Guo et al. (2020) made some improvement based on the method, gaining better convergence performance. Detailed method introduction is as follows:

Denote Following Convex Quadratic Functions

Define a gap function to show the gap in (Eq. 24) caused by the SOCP relaxation at

where

Algorithm 1: **Feasibility Recovery Procedure**

1. Set an initial penalty coefficient

2. Form linear approximation of

And solve the following approximation of

where

3. If the relxation gap

### A Two-Stage Method

P2P market transactions should be implemented in physical power system network. First, the aggregator in the P2P market collects the transaction information and solves the P2P equilibrium problem. Second, the aggregator submits P2P transaction results to DSO. The DSO solves an optimal power flow problem in BFM to minimize total energy cost under network operating constraints.

Figure 4 shows how P2P transaction is embedded in the physical distribution network. After reaching an agreement in the P2P financial network, the supply buses inject energy into physical network and receive cash payment while the demand buses absorb energy from the physical network and pay for this transactive energy.

## Case Study

To testify the proposed P2P model in this article, we implement our model in a 6-bus radial distribution network system. The system structure is presented in Figure 5 and G0 connects transmission line. B1-B4 represent the energy buyers participating in the P2P market and S1-S2 are sellers who own PV plants and sell surplus energy. The parameter setting is in the next subsection. All experiments are carried out on a 64-bit laptop with Intel Core i7-7500U CPU with 2.7 GHz and 8 GB RAM. The equilibrium problem and OPF problem are coded in MATLAB with YALMIP interface. Commercial solver MOSEK 9.2.29 is used to solve SOCP.

### Benchmark Parameter Setting

In our P2P market model, the transaction is expected to be solved hourly. In one time period, the seller’s supply and buyer’s demand are shown in Table 1. We assume that the sellers sell their surplus to energy main grid at

There are three generators located in buses 2, 3, and 4 respectively. The detailed line data and generator parameters are listed in Tables 2, 3. The reference value is 1 MVA and all the parameters and results are given in p.u. The voltage magnitude limits are

### Numerical Result

In the first stage, after solving the equilibrium problem, we can obtain the following P2P market model solution.

Figure 6 depicts where buyers purchase their energy. Without P2P transaction, they can only satisfy their demands through the main grid. With the P2P market, consumers can allocate their demand between main grid and P2P market to reduce their costs. In our test case, all buyers purchase same quantity from grid and all P2P transaction prices are 0.575$/kWh, which is also the main grid marginal price. As a result, it is no difference for the buyer to choose whom to trade in the P2P market. The result is reasonable because if a buyer offers a higher price, all sellers will trade with him and other buyers will also improve their prices successively; if a buyer offers a lower price, he will loss all sellers and a rational participant will avoid the option. In this condition, the equilibrium price gradually converges to the highest main grid marginal price.

Figure 7 shows the buyers’ costs and sellers’ revenues comparison between the two scenarios, without and with the P2P market. The left one shows that all buyers benefit from the P2P market and have less cost, in which B2 has the most significant reduction in total energy cost because he has the largest amount consumption in the P2P market. Sellers also earn more profit through P2P sharing.

Finally, Table 4 summarizes the total cost and revenue of P2P market participants during the trading period. Owing to the introduction of P2P market, the sellers and buyers can discover transaction price in P2P trading. The price is not less than the FiT value and not more than TLOU. Therefore, buyers’ cost decreases and sellers’ revenue increases, with an improvement of $ 31.675 in market benefit. The local welfare gets improvement compared with market without the P2P market.

### Discussion of Parameter M

In *Big-M Method*, we claim the value of parameter M is manually specified. It should be neither too big nor too small. In a benchmark case study, the numerical value of M is 150. To find out the performance of the optimization impacted by the value of M, we change the numerical value of M from 10 to 1,000 and record their feasibility and calculation time of equilibrium problem. The results are provided in Table 5.

In Table 5, fail means the equilibrium problem is infeasible in solver MOSEK. In our benchmark test, the value of M should not be less than 100, which is also the maximum value of seller’s supply and buyer’s demand. When M is equal to or larger than maximum supply or demand value, the results of market benefit are identical. In terms of calculation time, we can find time increases with M’s value improvement. In view of the above finding, we can obtain some instructions about the selection of M. On one hand, it should not be less than the maximum value of seller’s supply and buyer’s demand. On the other hand, it should not be too large to save calculation time.

### Sensitivity Analysis

We keep other participants’ supply and demand and change buyer 1’s demand. The buyer 1′ energy bought from P2P market also changes accompanied with demand increase, as shown in Figure 8. And the important turning points

### Performance of Feasibility Recovery Procedure

In this subsection, we evaluate the performance of FRP. In the first stage, the aggregator solves the equilibrium problem in the P2P market and submits P2P transaction information to DSO. In the second stage, the DSO solves BFM with SOCP relaxation. When the initial SOCP relaxation is inexact and the relaxation gap exceeds predetermined tolerance value

To evaluate the performance of the solution from FRP, we compare it with a solution from NLP solver KNITRO, which can handle the nonconvex optimization problem. The results are shown in Table 6.

In FRP, we change the value of

In conclusion, we can observe that in a 6-bus distribution network, SOCP relaxation is exact when the tolerance value

### Additional Case Study

To further validate our proposed P2P model, we provide a realistic case study simulated over one day with 1 h time-step. We collect four realistic energy buyers’ demand and real-time electricity price from 200 Irish residents over the year of 2009, as shown in Figures 9, 10. Energy sellers’ renewable energy generation curve is shown in Figure 11, which comes from the solar PV simulation data in Ireland. All data set has been processed and scaled to benchmark parameter setting, which can be found in our Supplementary Material. The constant coefficient

Table 7 summarizes every P2P market participant’s cost and revenue comparison during one day. Both energy sellers and buyers can benefit from the introduction of the P2P market. The additional case study using realistic data further validates our proposed P2P model, which can benefit all participants.

## Conclusion

In this article, we have proposed a novel P2P market framework to model the equilibrium of P2P transactive energy. The transaction price is determined endogenous by solving the KKT conditions of all peers’ optimization problem. The equilibrium condition can be transformed to an MILP which can be processed by commercial solvers. The transaction energy flow information is further submitted to the distribution system operator and used to solve optimal power flow, so that network operation constraints can be guaranteed. The case study demonstrates that our proposed P2P market benefits all participants. The society also benefits from the P2P market.

## Data Availability Statement

The original contributions presented in the study are included in the article/Supplementary Material, further inquiries can be directed to the corresponding author.

## Author Contributions

BZ: conceptualization, writing-original draft preparation, software. YF: funding acquisition, validation. WW: conceptualization, methodology, writing-review and editing. YX: validation. SH: project administration. SM: supervision. All authors have read and agreed to the published version of the manuscript.

## Funding

This work was supported by the Scientific and Technological Project of State Grid Qinghai Electric Power Company, China (SGQH0000DKJS2000127).

## Conflict of Interest

Author YF and YX are employed by State Grid Qinghai Electric Power Company, China.

The remaining authors declare that the research was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.

## Supplementary Material

The Supplementary Material for this article can be found online at: https://www.frontiersin.org/articles/10.3389/fenrg.2021.701149/full#supplementary-material

## References

Abdella, J., and Khaled, S. (2018). “Peer to Peer Distributed Energy Trading in Smart Grids: A Survey.”. *Energies*. 11 (6), 1560. doi:10.3390/en11061560

Abrishambaf, O., Lezama, F., Faria, P., and Vale, Z. (2019). “Towards Transactive Energy Systems: An Analysis on Current Trends.”*Energ. Strategy Rev.*26., 100418. doi:10.1016/j.esr.2019.100418

Alam, M. R., St-Hilaire, M., and Kunz, T. (2017). “An Optimal P2P Energy Trading Model for Smart Homes in the Smart Grid.”*Energy Efficiency*. 10 (6),1475–1493. doi:10.1007/s12053-017-9532-5

Alvaro-Hermana, R., Fraile-Ardanuy, J., Zufiria, P. J., Knapen, L., and Janssens, D. (2016). Peer to Peer Energy Trading with Electric Vehicles. *IEEE Intell. Transport. Syst. Mag.*8 (3), 33–44. doi:10.1109/MITS.2016.2573178

Baran, M., and Wu, F. F. (1989a). Optimal Sizing of Capacitors Placed on a Radial Distribution System. *IEEE Trans. Power Deliv.*4 (1), 735–743. doi:10.1109/61.19266

Baran, M. E., and Wu, F. F. (1989b). Network Reconfiguration in Distribution Systems for Loss Reduction and Load Balancing. *IEEE Trans. Power Deliv.*4 (2), 1401–1407. doi:10.1109/61.25627

Butler, L., and Neuhoff, K. (2008). Comparison of Feed-In Tariff, Quota and Auction Mechanisms to Support Wind Power Development. *Renew.Energ.*33 (8), 1854–1867. doi:10.1016/j.renene.2007.10.008

Farivar, M., and Low, S. H. (2013). Branch Flow Model: Relaxations and Convexification-Part. *IEEE Trans. Power Syst*. 28, 2554–2564. doi:10.1109/TPWRS.2013.2255317

Fortuny-Amat, J., and McCarl, B. (1981). A Representation and Economic Interpretation of a Two-Level Programming Problem. *J.Oper. Res. Soc.*32 (9), 783–792. doi:10.2307/2581394

Giotitsas, C., Pazaitis, A., and Kostakis, V. (2015). “A Peer-To-Peer Approach to Energy Production.”*Technology Soc.*42, 28–38. doi:10.1016/j.techsoc.2015.02.002

Gomez-Herrera, J. A., and Anjos, M. F. (2019). “Optimization-Based Estimation of Power Capacity Profiles for Activity-Based Residential Loads.”*Int. J.Electr. Power Energ. Syst.*104 (2018), 664–672. doi:10.1016/j.ijepes.2018.07.023

Guerrero, J., Chapman, A. C., Verbic, G., and Gregor, V. (2019). Decentralized P2P Energy Trading under Network Constraints in a Low-Voltage Network. *IEEE Trans. Smart Grid*. 10, 5163–5173. doi:10.1109/tsg.2018.2878445

Guo, Z., Wei, W., Chen, L., Wang, Z., and Mei, S. (2020). “Operation of Distribution Network Considering Compressed Air Energy Storage Unit and its Reactive Power Support Capability.”*IEEE Trans. Smart Grid*.11 (4), 2954–2965. doi:10.1109/TSG.2020.2966742

Hou, K., Tang, P., Liu, Z., Jia, H., and Zhu, L. (2021). “Reliability Assessment of Power Systems with High Renewable Energy Penetration Using Shadow Price and Impact Increment Methods.”*Front. Energ. Res.*9 (March), 1–11. doi:10.3389/fenrg.2021.635071

Kang, J., Yu, R., Huang, X., Maharjan, S., Zhang, Y., and Hossain, E. (2017). “Enabling Localized Peer-To-Peer Electricity Trading Among Plug-In Hybrid Electric Vehicles Using Consortium Blockchains. *IEEE Trans. Ind. Inf.*13 (6), 3154–3164. doi:10.1109/TII.2017.2709784

Liu, B., Chen, J., Wang, H., and Wang, Q. (2020). “Renewable Energy and Material Supply Risks: A Predictive Analysis Based on an LSTM Model.”*Front. Energ. Res.*8 (September), 1–12. doi:10.3389/fenrg.2020.00163

Long, C., Wu, J., Zhang, C., Cheng, M., and Al-Wakeel, A. (2017). “Feasibility of Peer-To-Peer Energy Trading in Low Voltage Electrical Distribution Networks.”*Energ. Proced.*105, 2227–2232. doi:10.1016/j.egypro.2017.03.632

Long, C., Wu, J., Zhang, C., Thomas, L., Cheng, M., and Jenkins, N. (2018a). “Peer-to-Peer Energy Trading in a Community Microgrid.” *IEEE Power and Energy Society General Meeting*. 2018 (July): 1–5. doi:10.1109/PESGM.2017.8274546

Long, C., Wu, J., Zhou, Y., and Jenkins, N. (2018b). “Peer-to-Peer Energy Sharing through a Two-Stage Aggregated Battery Control in a Community Microgrid.”*Appl.Energ.*226 (April), 261–276. doi:10.1016/j.apenergy.2018.05.097

Mengelkamp, E., Gärttner, J., Rock, K., Kessler, S., Orsini, L., and Weinhardt, C. (2018). “Designing Microgrid Energy Markets.”*Appl.Energ.*210, 870–880. doi:10.1016/j.apenergy.2017.06.054

Morstyn, T., and McCulloch, M. D. (2019). “Multiclass Energy Management for Peer-To-Peer Energy Trading Driven by Prosumer Preferences.”*IEEE Trans. Power Syst.*34 (5), 4005–4014. doi:10.1109/TPWRS.2018.2834472

Morstyn, T., Teytelboym, A., Mcculloch, M. D., and McCulloch, (2019). “Bilateral Contract Networks for Peer-To-Peer Energy Trading.”*IEEE Trans. Smart Grid*. 10 (2), 2026–2035. doi:10.1109/TSG.2017.2786668

Nguyen, S., Peng, W., Sokolowski, P., Alahakoon, D., and Yu, X. (2018). “Optimizing Rooftop Photovoltaic Distributed Generation with Battery Storage for Peer-To-Peer Energy Trading.”*Appl.Energ.*228, 2567–2580. doi:10.1016/j.apenergy.2018.07.042

Pyrgou, A., Kylili, A., and Fokaides, P. A. (2016). “The Future of the Feed-In Tariff (FiT) Scheme in Europe: The Case of Photovoltaics.”*Energy Policy*.95, 94–102. doi:10.1016/j.enpol.2016.04.048

Qi, M., Yang, H., Wang, D., Luo, Y., Zhang, S., and Liao, S. (2019). “Prosumers Peer-To-Peer Transaction Decision Considering Network Constraints.”2019 3rd IEEE Conference on Energy Internet and Energy System Integration. Ubiquitous Energy Network Connecting Everything. EI2 2019, no. 71931003, 643–647. doi:10.1109/EI247390.2019.9061909

Shrestha, A., Bishwokarma, R., Chapagain, A., Banjara, S., Aryal, S., Mali, B., et al. (2019). “Peer-to-Peer Energy Trading in Micro/Mini-Grids for Local Energy Communities: A Review and Case Study of Nepal.”*IEEE Access*.7, 131911–131928. doi:10.1109/ACCESS.2019.2940751

Sorin, E., Bobo, L., and Pierre, P. (2018). Consensus-Based Approach to Peer-To-Peer Electricity Markets with Product Differentiation. *IEEE Trans.Power Syst.* 34 (2), 994–1004. doi:10.1109/TPWRS.2018.2872880

Sousa, T., Soares, T., Pinson, P., Moret, F., Baroche, T., and Sorin, E. (2019). “Peer-to-Peer and Community-Based Markets: A Comprehensive Review.”*Renew.Sustainable Energ. Rev.*104. (January), 367–378. doi:10.1016/j.rser.2019.01.036

Tushar, W., Chai, B., Yuen, C., Smith, D. B., Wood, K. L., Yang, Z., et al. (2015). “Three-Party Energy Management with Distributed Energy Resources in Smart Grid.”*IEEE Trans. Ind. Electron.*62.(4), 2487–2498. doi:10.1109/TIE.2014.2341556

Tushar, W., Yuen, C., Mohsenian-rad, H., Saha, T., Vincent Poor, H., and Wood, K. L. (2018). “Transforming Energy Networks via Peer-To-Peer Energy Trading: The Potential of Game-Theoretic Approaches.” *IEEE Signal Processing Magazine*.35, (July), 90–111. doi:10.1109/msp.2018.2818327

Tushar, W., Saha, T. K., Yuen, C., Azim, M. I., Morstyn, T., Poor, H. V., et al. (2020a). “A Coalition Formation Game Framework for Peer-To-Peer Energy Trading.” *Appl.Energ.*261. (December 2019), 114436. doi:10.1016/j.apenergy.2019.114436

Tushar, W., Saha, T. K., Yuen, C., Smith, D., and Poor, H. V. (2020b). “Peer-to-Peer Trading in Electricity Networks: An Overview.”*IEEE Trans. Smart Grid*. 11 (4), 3185–3200. doi:10.1109/TSG.2020.2969657

Wei, W., Wang, J., Li, N., and Mei, S. (2017). Optimal Power Flow of Radial Networks and its Variations: A Sequential Convex Optimization Approach. *IEEE Trans. Smart Grid*. 8 (6), 2974–2987. doi:10.1109/TSG.2017.2684183

Zhang, C., Wu, J., Cheng, M., Zhou, Y., and Long, C. (2016). “A Bidding System for Peer-To-Peer Energy Trading in a Grid-Connected Microgrid.” *Energ. Proced.*103. (April), 147–152. doi:10.1016/j.egypro.2016.11.264

Zhang, C., Wu, J., Zhou, Y., Cheng, M., and Long, C. (2018). “Peer-to-Peer Energy Trading in a Microgrid.” *Appl.Energ.*220 (December 2017), 1–12. doi:10.1016/j.apenergy.2018.03.010

## Nomenclature

Abbreviations

**BFM** Branch flow model

**DERs** Distributed energy resources

**DSO** Distribution system operator

**FiT** Feed-in Tariff

**FRP** Feasibility recovery procedure

**ICT** Information and Communication Technology

**KKT** Karush–Kuhn–Tucker conditions

**MILP** Mixed-integer linear program

**OPF** Optimal power flow

**P2P** Peer-to-Peer

**SOCP** Second-order cone program

**TLOU** Time-and-level-of-use

Indices and sets

** $B$** Set of energy buyers

** $S$** Set of energy sellers

** $b$** The index of energy buyer

** $s$** The index of energy seller

** $N$** Set of buses in radial distribution network

** $L$** Set of lines in radial distribution network

** $c\left(j\right)$** Child buses of bus

** $i,j,k$** The index of bus

** $l$** The index of line

Parameters

** $t$** Index of time periods

** ${\lambda}^{sell}$** Feed-in Tariff

** ${\lambda}^{cost}$** P2P transaction cost

** ${\lambda}_{b}^{buy}$** The TLOU price of energy buy

** ${\lambda}_{0}^{buy}$** Initial electricity price in TLOU

** ${k}_{t}$** Constant coefficient in TLOU

** ${P}_{s}$** The excessive energy for sell of seller

** ${D}_{b}$** The energy demand of buyer

** $M$** Constant parameter in big-M method

** ${a}_{i}$, ${b}_{i}$, ${c}_{i}$** Coefficients of the production cost function.

** ${P}_{dj}$, ${Q}_{dj}$** Fixed active and reactive power demand

** ${r}_{ij}^{l}$, ${x}_{ij}^{l}$, ${z}_{ij}^{l}$** Resistance, reactance and impedance of line

** ${P}_{gi}^{n}$, ${P}_{gi}^{m}$** Active generation limits at bus

** ${Q}_{gi}^{n}$, ${Q}_{gi}^{m}$** Reactive generation limits at bus

** ${V}_{i}^{n}$, ${V}_{i}^{m}$** Square voltage magnitudes limits at bus

** ${S}_{l}$** Apparent power flow capacity of line

Variables

** ${p}_{sb}$** P2P transaction amount between seller

** ${\rho}_{sb}$** P2P transaction price between seller

** ${P}_{gi}$, ${Q}_{gi}$** Active and reactive power generation at bus

** ${P}_{ij}^{l}/{P}_{jk}^{l}$,${Q}_{ij}^{l}/{Q}_{jk}^{l}$** Active and reactive power flow in line

** ${I}_{ij}^{l}$** Square current magnitude in line

** ${V}_{i}$** Square voltage magnitude at bus

** $x$** The feasible set of BFM solution

Keywords: distribution network, market equilibrium, optimal power flow, peer-to-peer trading, transactive energy

Citation: Zheng B, Fan Y, Wei W, Xu Y, Huang S and Mei S (2021) Distribution Optimal Power Flow With Energy Sharing *Via* a Peer-To-Peer Transactive Market. *Front. Energy Res.* 9:701149. doi: 10.3389/fenrg.2021.701149

Received: 27 April 2021; Accepted: 21 June 2021;

Published: 15 July 2021.

Edited by:

Thomas Alan Adams, McMaster University, CanadaReviewed by:

Emmanuel Ogbe, ExxonMobil, United StatesChau Yuen, Singapore University of Technology and Design, Singapore

Copyright © 2021 Zheng, Fan, Wei, Xu, Huang and Mei. This is an open-access article distributed under the terms of the Creative Commons Attribution License (CC BY). The use, distribution or reproduction in other forums is permitted, provided the original author(s) and the copyright owner(s) are credited and that the original publication in this journal is cited, in accordance with accepted academic practice. No use, distribution or reproduction is permitted which does not comply with these terms.

*Correspondence: Shaowei Huang, huangsw@mail.tsinghua.edu.cn