This is a self-archived – parallel published version of this article in the publication archive of the University of Vaasa. It might differ from the original. A framework for participation of prosumers in peer- to-peer energy trading and flexibility markets Author(s): Khorasany, Mohsen; Shokri Gazafroudi, Amin; Razzaghi, Reza; Morstyn, Thomas; Shafie-khah, Miadreza Title: A framework for participation of prosumers in peer-to-peer energy trading and flexibility markets Year: 2022 Version: Accepted manuscript Copyright ©2022 Elsevier. This manuscript version is made available under the Creative Commons Attribution–NonCommercial–NoDerivatives 4.0 International (CC BY–NC–ND 4.0) license, https://creativecommons.org/licenses/by-nc-nd/4.0/ Please cite the original version: Khorasany, M., Shokri Gazafroudi, A., Razzaghi, R., Morstyn, T. & Shafie-khah, M. (2022). A framework for participation of prosumers in peer-to-peer energy trading and flexibility markets. Applied Energy 314, 118907. https://doi.org/10.1016/j.apenergy.2022.118907 A Framework for Participation of Prosumers in Peer-to-Peer Energy Trading and Flexibility Markets Mohsen Khorasanya, Amin Shokri Gazafroudib,∗, Reza Razzaghia, Thomas Morstync, Miadreza Shafie-khahd aDepartment of Electrical and Computer Systems Engineering, Monash University, Clayton VIC 3800, Australia bInstitute for Automation and Applied Informatics, Karlsruhe Institute of Technology (KIT), 76131 Karlsruhe, Germany cSchool of Engineering, The University of Edinburgh, Edinburgh EH8 9YL, United Kingdom dSchool of Technology and Innovations, University of Vaasa, 65200 Vaasa, Finland. Abstract As the owners of distributed energy resources (DER), prosumers can actively manage their power supply and consumption and partake in new energy services. In order to enable prosumers to benefit from their participation in energy services, innovative market models need to be designed. This paper proposes a framework for local energy and flexibility trading within distribution networks, in which prosumers partici- pate in a peer-to-peer (P2P) market to trade energy with each other based on their preferences. The P2P market is cleared in a decentralized manner with direct interaction of seller and buyer prosumers. Then, the distribution system operator (DSO) checks the network constraints based on the energy scheduling of prosumers. If the network constraints are not satisfied, the DSO calculates the flexibility that is required in each feeder to avoid network issues. Triggered by the requested flexibility by the DSO, prosumers in each feeder form a community and participate in a flexibility market, in which they can offer their flexibility in response to the DSO’s request. An iterative auction is employed to clear the flexibility market, which enables the prosumers to independently decide on their offered flexibility, while the DSO adjusts the flexi- bility price to minimize its costs. The proposed framework is tested on a real-world distribution network. Simulations based on a number of case studies indicate that through the proposed framework, the DSO can avoid network constraints violation by employing prosumers’ flexibility. Besides, participation in the P2P and flexibility trading reduces the net energy costs of the prosumers in different community by an average of 17.09%. Keywords: Decentralized optimization, energy flexibility, iterative double auction, local energy market, peer-to-peer energy trading. 1. Introduction 1.1. Motivation and Background In distribution systems with high penetration of distributed energy resources (DER), local energy markets can facilitate the integration of consumer-level DER into the networks. Through local energy trading, consumers and prosumers are able to actively participate in the market and decide on their trading strategy based on their preferences. Local energy markets unlock potential benefits for different stakeholders such as reducing transport losses, strengthening customers’ position by enabling them to play a more active role in the market, and supporting the development of a smart grid [1]. Thus, prosumers, as strategic agents, ∗Corresponding author Email addresses: mohsen.khorasany@monash.edu (Mohsen Khorasany), shokri@kit.edu (Amin Shokri Gazafroudi), reza.razzaghi@monash.edu (Reza Razzaghi), Thomas.Morstyn@ed.ac.uk (Thomas Morstyn), miadreza.shafiekhah@uwasa.fi (Miadreza Shafie-khah) P2P trading (Decentralized) Offer flexibility to DSO (Community- based) Request flexibility from prosumers Check network constraints Prosumers DSO Calculate required flexibility for each community (a) ... ... DSO (b) (c) ... ... ... ... ... ... Figure 1: The proposed framework overview; a) Flowchart of prosumers and DSO actions, b) Information exchange in the P2P energy trading, c) Information exchange in the flexibility market. are empowered to bid and offer for sharing energy in local energy markets [2]. In the context of local energy markets, peer-to-peer (P2P) energy trading is a promising mechanism that offers several advantages to prosumers including autonomy, their ability to express individual preferences, and a competition in a transparent market [3]. Through providing a decentralized environment, P2P trading enables market players to determine their power exchanges with each other without any need for a central entity [4]. However, the decisions of participating prosumers on their actions in the market may not be feasible for the physical distribution system to support. Thus, distribution system operators (DSOs) need flexibility services to resolve these issues and to keep the network within safe operational limits. The term flexibility is defined as the capability of a system to modify its output or state in response to a signal [5]. This flexibility can be provided by different institutions who have access to physical resources across all of the power system, including system operations and markets, flexible generation, and demand- side resources [6]. Increases in the share of DER provides a cost-effective source of flexibility for managing power systems. However, in the current market scheme, energy end-users’ flexibility cannot be integrated into the overall operation of the power system. To this end, local flexibility markets are a promising alternative concept to activate untapped flexibility potential of DER to address the constraints that the current electricity system is facing and those it will have to overcome in the future. The market design for acquiring flexibility from distribution system’s end-users has been investigated in some recent works. A coordinated multilateral trading market is proposed in [7], in which groups of agents can trade among themselves and propose to the system operator a contingent trade that is balanced. The system operator coordinates trades to ensure that network constraints are not violated and curtails trades in case of network constraints violation. Different regulatory frameworks for local energy markets are compared in [8], in which an AC optimal power flow (OPF) is used to check network constraints and to curtail self-generation until guaranteeing a secure grid operation. In [9], authors proposed a hierarchical approach to trade energy and flexibility in the local market for maintaining distribution network constraints. In [10], a flexibility market is proposed which enables the DSO to request flexibility from aggregators in order to satisfy the physical constraints of the system. The flexibility management model presented in [11] enables the aggregator to manage end-users’ appliances to match the flexibility request from the DSO while reducing the costs for rescheduling end-users’ appliances. The flexibility market in [12] is designed such that the aggregator of smart homes can provide flexibility to support operational constraint at the point of common coupling. In [13], a two-stage stochastic optimization model is presented for participation of an aggregator of prosumers in energy and tertiary reserve markets. However, in [10]-[13] end-users are not able to negotiate on the price and quantity of the offered flexibility. Several studies also considered end-users as independent decision makers in the market. A networked flexibility market is presented in [14], which allows DSOs to manage local demand constraints by obtaining flexibility from aggregators who incentivize independent prosumers to provide flexibility according to their preferences. In [15], a flexibility market is proposed to decrease the ramp rate of the purchased power by the DSO from the wholesale market using the flexible energy resources operated by the system operator or the microgrids. Monopolistic and game-based approaches are employed in [16] for the management of energy flexibility through end-users, aggregators, and the DSO as independent agents who are able to manage their energy flexibility. A coordination scheme is presented in [17], which allows residential customers to optimize their flexibility schedule based on predefined requirements and communicate directly with the local distribution companies in order to enhance the grid operational efficiency. Authors in [18] proposed a decentralized approach for managing flexibility in distribution networks based on interaction among end- users, aggregators and electric vehicle owners. An iterative algorithm for local flexibility trading among end- users, aggregators and the DSO is studied in [19]. In [20], a nested transactive framework is proposed which utilizes flexibility of residential buildings for addressing transformer overloading and reducing wholesale price peaks when system-level supply is jeopardized. However, these works only focus on the flexibility market and do not address the integration of P2P and flexibility markets. The integration of P2P and flexibility markets has been discussed in a few recent works. In [21], a coordinated market design for P2P energy trading and ancillary services is proposed, where the DSO procures flexibility from P2P market participants to secure the P2P trades in distribution grids. This work employs grid usage prices as the price signal of procuring ancillary services in all transactions. However, the price for ancillary services is calculated in each iteration of P2P market, which increases the computational complexity of the market clearing. In [22], a peer-centric marketplace for P2P energy trading is presented, in which the P2P platform is integrated with a distribution AC OPF to effectively accommodate P2P in the distribution system. The OPF results are used to calculate a network usage charge based that prosumers need to pay for using the distribution network. Similar to [21], the network usage charges need to be updated at each iteration of the P2P negotiation which increases the computational complexity of the mechanism and may cause the market settlement to take a longer time. A framework for simultaneous P2P energy and flexibility trading is presented in [23], in which prosumers are grouped as communities and each community has an obligation to reserve the flexibility during P2P energy transaction to ensure an intact distribution system. However, in this work the amount of flexibility that the P2P community should reserve is determined by the ratio of the amount of energy transactions and not the violated network constraints. In [24], a P2P market model is proposed to trade PV forecast power and uncertain power simultaneously. This work utilizes the flexibility of consumers to manage the uncertain PV power. However, the potential of flexible resources in managing network constraints is not explored. An iterative method for coordination of P2P markets with DSOs is proposed in [25], where the DSO validates the P2P trading results and modifies the results using prosumers flexibility to avoid network constraints violation. In [26], a three-step methodology for the optimization of bilateral P2P energy transactions is proposed, in which the trading results are used to check network constraints iteratively to ensure the network constraints are not violated during the trading. The works in [25, 26] only consider flexibility service for adjusting prosumers commitments in the P2P trading using a service charge. In [27], a joint P2P and balancing market model is proposed, in which a balancing market combined with AC OPF are used to calculate the requested flexibility from each prosumer to guarantee that network constraints are respected. The proposed framework in [28] considers the combination of P2P and flexibility markets for a community of prosumers. However, the flexibility market is only triggered for managing the distribution transformer loading and other network constraints are not considered. Also, the P2P trading scheme is modeled as a community-based trading, which is facilitated by a local market operator. 1.2. Contributions and Paper Organization Motivated by the aforementioned limitations in the existing works, a new framework for local energy and flexibility trading is presented. In the proposed framework, prosumers participate in a P2P energy trading and interact with DSO through a flexibility market. The prosumers interaction in the P2P market is modeled as a decentralized negotiation through which prosumers negotiate on the price and quantity of their trades in the market. The interaction of DSO and prosumers in the flexibility market is modeled as an iterative auction through which the DSO indicates the flexibility price to procure prosumers’ flexibility to manage network constraints. In order to improve the computation efficiency in the flexibility market, participating prosumers are grouped in different communities such that prosumers connected to the same feeder form a community. It allows the DSO to utilize local flexibility resources to manage the network issues in each feeder. The contributions of this paper are summarized as follows: - A trading framework is proposed, which enables prosumers to participate in a P2P market and to employ their flexible assets to assist the DSO in managing network constraints. - A community-based flexibility market is designed which enables the DSO to ensure the secure operation of the network by acquiring flexibility services from prosumers. - An iterative auction is designed to clear the flexibility market, through which the DSO calculates the flexibility price to minimize its costs. The paper progresses as follows: Section 2 presents the P2P energy trading scheme, which is followed by the description of the flexibility market in Section 3. Section 4 presents the model of the case study and simulation results, and Section 5 concludes the paper. 2. Energy Trading Scheme 2.1. System Model We consider a distribution network with a set of n ∈ N prosumers connected to nodes of a radial distribution network with a set of j ∈ J feeders, and a set of l ∈ L lines. The considered market is a forward intraday market, in which before each time slot t ∈ T , prosumers negotiate on their trading actions in the next time slot. Fig. 1a shows the flowchart of the actions taken by prosumers and the DSO in the proposed method. First, prosumers participate in a P2P trading market, where they can communicate with all other prosumers through a communication network. It is assumed that prosumers are equipped with an internet of things (IoT) device which enables them to communicate with each other and the DSO through information and communication infrastructure. The information exchange among prosumers in the P2P market is in a decentralized manner, as shown in Fig. 1b. Given the decentralized nature of energy sharing in P2P trading, blockchain technology is one of the best tools to implement this type of market structures. Due to its salient features, which include decentralization, trust, anonymity, and auditability, blockchain has been widely used as a platform for energy trading in recent literature [29, 30]. In the proposed model, blockchain and distributed ledger technologies can be used as the platform for information exchange to ensure data privacy and security. The participation of prosumers in P2P market is opt-in, which allows them to continue obtaining energy from the existing retail electricity market if they cannot secure their energy requirements in the P2P market [14]. Hence, after deciding on transactions in the P2P market, prosumers inform the DSO about their scheduled energy for trading with each other and the grid. It is assumed that the DSO is responsible for ensuring that the constraints of the distribution network are not violated. After receiving energy schedule information of prosumers, the DSO checks the constraints and triggers a flexibility market if required. In this step, the DSO calculates the minimum flexibility which is required in each feeder to manage the network constraints. Then, a community-based flexibility market will be run in parallel in all feeders, in which prosumers offer their flexibility in response to the offered price by the DSO. It should be noted that the flexibility market is an event-driven market and only happens when DSO predicts a network constraint violation. Hence, prosumers can participate in the flexibility market whether they have participated in the P2P market or not. The information exchange in the flexibility market is illustrated in Fig. 1c. 2.2. P2P Energy Trading We model prosumers in the market with nonexclusive model, such that each prosumer can change its role based on its load and generation profile to a consumer (buyer) or a producer (seller). In the P2P market, prosumers communicate with all other prosumers to reach an agreement on the quantity and the price of energy in each trade. Prosumers can negotiate with several trading partners simultaneously. However, in order to balance the total demand and supply in the P2P trading, all prosumers should come to agreement on the quantity of the energy they want to trade with each other. It is assumed that prosumers are equipped with PV and flexible loads and have a range of flexibility for the power they want to trade in the market, which is constrained with a minimum and maximum limit as in (1) Pn,t ≤ Pn,t ≤ Pn,t, : (µ n,t , µn,t), ∀n ∈ N ∀t ∈ T (1) where µ n,t , µn,t are dual variables associated with the constraints. Indeed, prosumers without flexibility can be modeled by setting Pn,t = Pn,t. Prosumers are assumed to be economically rational so that they try to maximize their individual welfare through participating in P2P trading, either as a seller or a buyer. The welfare of each prosumer in P2P trading can be modeled by WPn (Pn,t) = ∑ m λnm,tPnm,t − 1 2 αn,tP 2 n,t − βn,tPn,t, (2) where, αn, βn > 0 are two constants representing cost function for a seller prosumer, or utility function for a buyer prosumer. For a seller prosumer (producer), the cost function reflects the amount of energy that a seller is willing to sell at different prices at a given time. The utility function for a buyer prosumer (consumer) models the willingness to pay or satisfaction of a consumer from consuming a certain amount of energy. The considered utility function is a non-decreasing function with a non-increasing marginal benefit as presented in [31]. The parameters for cost/utility function vary from prosumer to prosumer and may also vary along the time of a day. For each prosumer, these parameters are determined differently depending on its assets as well as its priority and significance in each time interval (see Ref. [32] for more details). Pnm,t is the traded energy between prosumer n and m, and λnm,t is the perceived per unit price of energy for this trade. The welfare function in (2) models the difference between the received/paid money by the seller/buyer prosumer (first term), and the generation cost/willingness to pay for the seller/buyer prosumer (the second and third terms). The generation cost of a seller reflects the cost of producing power Pn (or the marginal cost of the excess energy), while for a buyer prosumer the willingness to pay reflects the negative amount the buyer is willing to pay for the power |Pn|. It should be noted that for a seller prosumer the marginal cost of PV generation is zero. However, it is assumed that prosumers can always sell the generated energy by PV to the network at a fixed price such as Feed-in Tariff (FiT). Hence, in the case of a seller prosumer the cost function implies the minimum acceptable price by the prosumer, which should be higher than FiT. The market settlement in P2P trading aims to find the optimal energy dispatch among prosumers such that the social welfare is maximized; max Pn,t ∑ n∈N ∑ t∈T WPn (Pn,t) (3a) s.t. (1) and Pn,t = ∑ m∈N\{n} Pnm,t, ∀n ∈ N (3b) Pnm,t + Pmn,t = 0 : (λnm,t), ∀n,m ∈ N (3c) Pnm,t ≥ 0, ∀n ∈ NS (3d) Pnm,t ≤ 0, ∀n ∈ NB (3e) where subsets NS and NB are used to separate seller and buyer prosumers in each time slot. The total generated/consumed power by the prosumer in each time slot is the sum of trades with all trading partners (denoted by m) as in (3b), and demand-supply constraint in each transaction is imposed in Eq. (3c). The market settlement objective in (3) is a centralized problem which can be solved by a central agent who has access to private information of prosumers. However, this paper aims to solve the optimization problem with only P2P communications to ensure data privacy of the prosumers. Hence, the primal-dual gradient method is employed [33] to solve the market settlement optimization in a decentralized way. In this method, primal and dual variables are employed to decompose the optimization problem to several local problems. Each prosumer is an independent decision maker who solves its own problem and communicates with other peers. During the market settlement, seller prosumers iteratively update their prices and broadcast them to the buyers. Buyers respond to the received prices from sellers by indicating the amount of energy that they are willing to buy from each seller. The updates of dual and primal variables are based on the Karush–Kuhn–Tucker (KKT) optimality conditions of the local problems, and can be developed using first order derivative of the relaxed problem as follows: λk+1 nm,t = [ λknm,t − ρkλ(P knm,t − P kmn,t) ]+ ,∀n ∈ NS ,∀t ∈ T (4a) P k+1 nm,t = [ P knm,t + ζknm(P̃ k+1 nm,t − P kn,t) ]+/− ,∀n ∈ N ,∀t ∈ T (4b) µk+1 n,t = [ µk n,t + ρµ(Pn,t − P kn,t) ]+/− ∀n ∈ N ,∀t ∈ T (4c) µk+1 n,t = [ µkn,t + ρµ(P kn,t − Pn,t) ]+/− ∀n ∈ N ,∀t ∈ T (4d) P̃ k+1 nm,t = λk+1 nm,t − µk+1 n,t + µk+1 n,t − βn αn ,∀n ∈ N ,∀t ∈ T (4e) P k+1 n,t = ∑ m∈N\{n} P k+1 nm,t,∀n ∈ N ,∀t ∈ T (4f) |λk+1 nm,t − λknm,t|< ε,∀t ∈ T (4g) where ρλ, ζnm and ρµ are small tuning parameters to adjust updating rate of price, power, and dual variables of flexibility constraints, respectively. [∗]+ and [∗]− denote max(0, ∗) and min(0, ∗), respectively. Equations (4a) and (4b) denote the price and energy at each iteration of the negotiation between prosumers n and m. The updating rules for dual variables of boundary constraints in (1) are given by (4c) and (4d). Equation (4e) denotes the target power setpoint in the transaction between prosumers n and m, which is defined using the inverse gradient. Finally, (4f) and (4g) express the total traded power by prosumer n and the negotiation termination condition, respectively. At each iteration, a seller prosumer calculates the price for each transaction using (4a) and broadcasts the updated price to the buyers. Buyer prosumers will employ the updated prices to update their demand using (4b). Equations (4c)-(4f) are used by both sellers and buyers to calculate the required values for price and power update. This algorithm repeats till convergence criteria in (4g) are met. It should be noted that in each iteration, all of the calculations are done by either seller or buyer prosumers. Hence, there is no need for a third party involvement and this algorithm can be implemented in a fully decentralized manner. After clearing the P2P market, if the energy requirement of buyer prosumers is not fulfilled, they can buy the shortage from the grid (P gn,t < 0) at a fixed price such as time of use tariff (ToU). Similarly, if seller prosumers have still excess energy, it can be sold to the grid at FiT price (P gn,t > 0). Hence, the final scheduled power of prosumer n at time t can be calculated as: Pn,t = P gn,t + ∑ m∈N\{n} Pnm,t (5) 3. Flexibility Trading Scheme 3.1. DSO Coordinating After P2P trading, the DSO receives the scheduling profile of prosumers and solves the load flow problem based on net scheduled power by prosumers. If the constraints of the distribution network have not been satisfied (e.g. voltage and congestion constraints), then the optimal power flow problem is solved by the DSO, in which its objective function is to minimize flexibility provided at each feeder. In the proposed method, we employ a feeder-level flexibility market, in which prosumers connected to the same feeder form a community and participate in the flexibility market. The feeder-level market limits the number of prosumers in the flexibility market which in turn increases the computational efficiency. Moreover, prosumers in a feeder are able to compete with each other to provide the aggregated requested flexibility at the feeder-level. The DSO commits the requested flexibility in each feeder considering voltage and congestion constraints of the distribution network. Eq. (6a) represents the objective function min ∆Fj,t ∑ j∈J ∑ t∈T ∆F 2 j,t, (6a) subject to (6b) - (6o), where ∆Fj,t is the requested flexibility committed by the DSO to feeder j at time step t. In other words, ∆Fj,t represents the aggregated requested flexibility from the community of prosumers at feeder j at time step t. Moreover, each prosumer is mapped to its corresponding communicated feeder as represented in (6b) Fj,t = ∑ n∈N Mj,nPn,t, ∀j ∈ J ,∀t ∈ T (6b) where Mj,n represents a mapping between prosumer n and feeder j in the distribution network. This way, Mj,n = 1 if prosumer n connected to feeder j, otherwise Mj,n = 0. Moreover, in our model, we propose that flexibility as an interactive service with the DSO is limited to the portion of the net power of prosumers which is not provided from P2P energy trading as represented in (6c) ∆Fj,t ≤ ∑ n∈N Mj,n(Pn,t − ∑ m∈N\{n} Pnm,t),∀j ∈ J ,∀t ∈ T (6c) Moreover, the optimal power flow problem is constrained to constraints of the distribution network which are presented in the following. It is noticeable that a linearized AC (not the DC one) power flow problem is utilized in this paper based on [34]. In this way, the network active and reactive power balancing equations are represented in (6d) and (6e), respectively. Fj,t + ∆Fj,t + ∑ i (F+ ij,t − F − ij,t)− ∑ i (F+ ji,t − F − ji,t) +RjiIji,t = 0,∀j(j 6= i) ∈ J ,∀t ∈ T (6d) Qj,t + ∑ i (Q+ ij,t −Q − ij,t)− ∑ i (Q+ ji,t −Q − ji,t) +Xji,Iji,t = 0,∀j(j 6= i) ∈ J ,∀t ∈ T , (6e) where Qj,t is the net reactive power at feeder j at time slot t. Also, Iji,t is an auxiliary variable repre- senting I2 ji,t. Moreover, F+ ji,t, F − ji,t, Q + ji,t and Q−ji,t are called bijection flows as positive variables representing active/reactive power flow of distribution lines in upstream and downstream directions, respectively [34]. It is noticeable that, the power factor is considered to be 0.8 for each prosumer based on the average power factor of domestic devices presented in [35]. Besides, Rji and Xji represent resistance and reactance of the line between buses j and i. Eqs. (6f) and (6g) restrict the maximum active and reactive power which can flow in distribution lines. Voltage balancing between two nodes is stated in Eq. (6h). According to (6h), Vj,t is an auxiliary variable for representing V 2 j,t. Fj + i,t + Fj − i,t ≤ V nomIji,∀j(j 6= i) ∈ J ,∀t ∈ T (6f) Qj + i,t +Qj − i,t ≤ V nomIji,∀j(j 6= i) ∈ J ,∀t ∈ T (6g) Vj,t − Vi,t − Zj2iIji − 2Rji(Fj + i,t − Fj − i,t)− 2Xji(Qj + i,t −Qj − i,t) = 0,∀j(j 6= i) ∈ J ,∀t ∈ T , (6h) Figure 2: Modeling the linearization of the power flow. where V nom represents the nominal voltage which is set to 1 p.u. in this paper. Also, Iji states maximum current which can flow between nodes j and i based on the capacity of distribution lines. Besides, Zji represents the impedance of the line between nodes j and i.It is noticeable that at most one of F +/− ji,t and Q +/− ji,t can be different from zero at a time t. Moreover, V nomIji in Eqs. (6f) and (6g) is defined as right hand side constraint to restrict the maximum transfer capacity, therefore V nom in these two constraints is not used for calculation of power flow, and Vj,t is indeed used for considering V 2 j,t in power flow calculation as represented in Eq. (6h). In order to obtain the accurate linearization, piecewise linearization of the flow constraints are expressed in Eqs. (6i)-(6n), as shown in Fig. 2. (V nom)2Iji,t = ∑ f (2f − 1) S′ji F ′ ji,f,t + ∑ f (2f − 1) S′ji Q ′ ji,f,t,∀j(j 6= i) ∈ J ,∀t ∈ T (6i) F+ ji,t + F−ji,t = ∑ f F ′ji,f,t,∀j(j 6= i) ∈ J ,∀t ∈ T (6j) Q+ ji,t +Q−ji,t = ∑ f Q′ji,f,t,∀j(j 6= i) ∈ J ,∀t ∈ T (6k) 0 ≤ F ′ji,f,t ≤ S′ji,∀j(j 6= i) ∈ J ,∀t ∈ T (6l) 0 ≤ Q′ji,f,t ≤ S′ji,∀j(j 6= i) ∈ J ,∀t ∈ T (6m) S′ji = V nomIji Nf ,∀j(j 6= i) ∈ J (6n) where Nf represents the number of blocks used for linearizing, and it is set to 10 according to [34]. Moreover, S′ji expresses upper limit for the discretization of power line connected nodes j and i. Also, F ′ji,f,t and Q′ji,f,t represent discretized active and reactive power flowing between nodes j and i at f linear partition and time t, respectively. Eq. (6o) expresses maximum and minimum limitations for representing the squared voltage of each node. V 2 ≤ Vj,t ≤ V 2 ,∀j ∈ J ,∀t ∈ T (6o) where, V and V present minimum and maximum voltage ranges at all nodes which are set to 0.95 p.u. and 1.05 p.u., respectively. 3.2. Community-based Flexibility Trading In this section, our proposed flexibility market is presented which is community-based for each feeder of the distribution network. Thus, prosumers are able to trade flexibility with other prosumers which are located in the same feeder community based on the requested flexibility from the DSO to maintain security constraints of the network. According to our community-based flexibility trading framework, prosumers have more freedom to provide the requested flexibility. In other words, if some of prosumers located in the feeder are not able to provide the flexibility, other prosumers in the feeder community can provide it. Besides, our community-based flexibility trading framework makes a competitive environment for prosumers for providing flexibility which is ended with fair flexibility price. All in all, after receiving the flexibility request from the DSO (∆Fj,t) for the community of prosumers at each feeder, prosumers in each feeder can participate in the flexibility market by adjusting their active power. Let κn,t denote the flexibility ramp that each prosumer provides such that κn,t = P̃n,t − Pn,t Pn,t , (7) where P̃n,t is the new power set point of the prosumer after providing the flexibility, and Pn,t is the traded energy by prosumer n, which is determined using the explained method in Section 2 1. The flexibility ramp of each prosumer is bounded as in κn,t ≤ κn,t ≤ κn,t (8) in which, κn,t and κn,t can be calculated from (1) as in κn,t = Pn,t − Pn,t Pn,t , κn,t = Pn,t − Pn,t Pn,t (9) The welfare of prosumer n in the flexibility market, defined as WFn , is calculated as the compensation received from the DSO for its flexibility services, minus the cost incurred to provide the flexibility. The welfare can be modeled as WFn,t = φn,t(κn,t)− θn,t(κn,t) (10) where φn,t(κn,t) is the reward for prosumer n for providing κn,t flexibility in time-slot t, and θn,t(κn,t) is the cost incurred to prosumer due to change in its power set points. Each slot has a per unit flexibility price denoted by rt, which is identical for all prosumers. The reward to each prosumer is proportional to the provided flexibility, i.e. φn,t(κn,t) = |κn,tPn,t|rt (11) The flexibility cost is modeled as a quadratic function as proposed in [28, 36] θn,t(κn,t) = γn,t(κn,tPn,t) 2 (12) 1It has to be pointed out that while Pn,t is a variable in P2P market, it becomes a constant in the flexibility market and prosumer need to decide on the fraction of this power which can be provided as flexibility. where γn,t is the discomfort cost parameter set by each prosumer2. In the community-based flexibility trading, the objective is to procure the flexibility of prosumers to provide the requested flexibility for feeders by the DSO such that the total welfare of prosumers is maximized. The optimization problem can be written as max κn,t ∑ n∈N WFn,t (13a) s.t. (7)− (9), (11) and ∆Pj,t = ∑ n∈N Mj,nκn,tPn,t, ∀j ∈ J ,∀t ∈ T (13b) ∆Pj,t ≤ { ∆Fj,t, if ∆Fj,t > 0 −∆Fj,t otherwise (13c) where ∆Pj,t is the offered flexibility by community of prosumers in feeder j, which is limited to the flexibility requested by the DSO for each community as represented in (13c). In this section, we adapt and modify the iterative auction model proposed in [37] to model the interaction of prosumers and the DSO. The flexibility market for each time slot t is a noncooperative coordination game model consists of a sequence of auction iterations, in which in each iteration the DSO updates the price and the prosumers update their bids in response to the updated price. The price update rule depends on a measure of revenue deficit (RD) which can be modeled as RDk = rkkt ∆P kkj,t + λFt (∆Fj,t −∆P kkj,t ) ∆Fj,t − rkkt (14) where the first term in (14) models the average total cost. Here, kk is the iteration index for the iterative auction, ∆P kkj,t and rkkt are the offered flexibility by community of prosumers and the per unit price offered by DSO at iteration kk, respectively, λFt is the per unit price that DSO needs to pay to procure the flexibility from sources other than prosumers. This price is used as the price cap for the flexibility market. In addition, the DSO sets an initial price r0 t , and waits for prosumers bids. After receiving bids, RD is updated and if RD > 0, then the price increases. Otherwise, the price stays the same in the next iteration: rkk+1 t = { rkkt + ςkk+1, if RDkk > 0 rkkt otherwise (15) where ςkk+1 is a configurable price adjustment step-size. The price adjustment rule in (14) starts with low prices and the price is monotonically increased until the RD in that time-slot is (close to) eliminated. After receiving the price, prosumers update their bids according to their preferences. As the offered price by DSO is monotonically increasing, the prosumers bid in each time slot should be monotonically increasing too. This prevents the auction from oscillating among globally infeasible solutions, without making any progress. The prosumer’s objective is to maximize its welfare. Therefore, the prosumers’ bid in each iteration is updated by solving the following optimization problem: κkkn,t = max[κkk−1 n,t , argmax κn,t≤κn,t≤κn,t WF,kk n,t (κn,t)] (16) As it can be seen in (15), the price adjustment is monotonic, and the price keep rising until the revenue deficit is eliminated. The algorithm terminates when RD ≤ 0. From (14), it can be preserved that if at the final iteration (kk = K) RD < 0, the offered flexibility is higher than the requested flexibility, and hence, the bids in the last iteration should be adjusted as follows: κn,t = κKn,t − ∆P kkj,t −∆Fj,t Nj FPn,t (17) 2It should be noted that the proposed market clearing method for the flexibility market can be implemented for different types of cost function, regardless of the convexity. Figure 3: The flowchart of decentralized P2P and community-based flexibility trading. where NF j is the number of prosumers in the community j who participate in the flexibility market. Figure 3 represents the flowchart of the designed algorithm for decentralized P2P energy trading and community- based flexibility trading. 4. Simulation Results 4.1. Experiment Setting In this section, a real-world distribution network, which represents a rural Finnish network [9, 38], is used to evaluate the effectiveness of the proposed approach. The test system includes ten prosumers which are connected to different nodes in the network and form three communities as shown in Fig. 4. Prosumers 1, 3, 4, 7, and 8 are equipped with PV panels with different sizes. The hourly PV generation of these prosumers is depicted in Fig. 5. All prosumers are assumed to have a degree of flexibility in their load profile. The operation horizon is divided to T = 24 time slots with equal duration of one hour. The ToU prices are chosen based on the average prices in [28], and the price cap for the flexibility market is assumed to be 150% of the ToU prices. The tuning parameters ρµ, and ρλ are set to 0.1 and 0.1ρµ k(0.1ρµ) , respectively. The stopping conditions in (4g) are set to 0.001, and the flexibility price adjustment step size (ς) is considered to be 0.1. The range of values for the prosumers parameters is given in Table 1. 4.2. Energy and Flexibility Trading Results Fig. 6 illustrates the traded energy by prosumers in different time slots. As prosumers with PV panels do not have excess power in all time slots, the P2P trading only happens during time slots 7 to 18. Prosumers 148 259 3610 7 Main Grid Comm. AComm. BComm. C Figure 4: The considered distribution network model. 2 4 6 8 10 12 14 16 18 20 22 24 Time (h)(b) 0 1 2 3 4 Pow er ( kW ) P #1 P #3 P #4 P #7 P #8 Figure 5: The hourly PV generation of prosumers. Table 1: Prosumers’ Parameters Parameter αn (¢/kWh2) βn (¢/kWh) γn (¢/kWh2) Value [0.09, 0.1] [5, 30] [0.2-30] 2 4 6 8 10 12 14 16 18 20 22 24 Time (h) -4 -3 -2 -1 0 1 2 3 Pow er ( kW ) Buying energy Selling energy P #1 P #2 P #3 P #4 P #5 P #6 P #7 P #8 P #9 P #10 Figure 6: Traded energy by prosumers in P2P market. can participate in the market as a seller or a buyer and they can change their role in different time slots based on their net load and generation. During these time slots, prosumers 1, 7, and 8 take the role of seller as they have excess generation in all of the slots, while other prosumers (including prosumers 3 and 4 with PV generation) participate in the market as buyers. Results of P2P trading at time slot 11 are illustrated in Fig. 7. As there is no limit on selecting the trading partners in the P2P market, prosumers can negotiate with all other prosumers from different communities. Fig. 7 shows how prosumers deal for energy trading, as a result of the negotiation in the P2P market. It can be seen that prosumers are allowed to simultaneously transact with several trading partners. In the considered case study, the flexibility market is applied to three separate communities, where prosumers located at the same feeder form a community. Thus, in each community, the prosumers compete to provide the flexibility requested by the DSO. Fig. 8 shows the requested flexibility and the aggregated provided flexibility by prosumers in different communities. According to the results, in all time slots the requested flexibility is completely provided by the community members, which allows the DSO to manage the network constraints. Moreover, it can be preserved that the flexibility market is an event-driven market and the number of events varies in different communities. Besides, the flexibility market can be triggered independent of P2P market, if it is required by the DSO. For example, the flexibility market is in place between time slots 1 to 5 in communities A and B, while the P2P market starts at time slot 7. As explained in Section 3.2, the flexibility provided by prosumers depends on the range of their flexibility rate, the flexibility cost (θn,t(.)), and the offered reward price by the DSO. Hence, there might be some instances that the DSO is not able to procure all of the required flexibility from the prosumers. An example of these events is when the offered reward price is not high enough to compensate the discomfort cost of the prosumer. In this case, the DSO will employ resources other than prosumers, e.g. backup generators, to manage the network constraints. The prices in the flexibility market and for different communities are shown in Fig. 9. The flexibility price is always bounded by a higher limit, which is set by the DSO (λF ). Results verify that in all events the 1.3 kW 1.2 kW 0.7 kW 2.2 kW 0.2 kW 0.7 kW 1.2 kW Figure 7: Result of P2P trading at time slot 11. 5 10 15 20 Time (h) (a) 0 10 20 Pow er ( kW ) 5 10 15 20 Time (h) (b) 0 10 20 30 Pow er ( kW ) 5 10 15 20 Time (h) (c) 0 10 20 30 Pow er ( kW ) Provided flexibility Requested flexibility Figure 8: Requested flexibility versus provided flexibility in: a) Community A, B) Community B, and c) Community C. flexibility price is lower than the cap. The initial price in each time slot (r0 t ) is set to ToU price to reduce the number of iterations in the flexibility market. This in turn guarantees that the reward price is always higher or equal to the ToU price, which incetivizes prosumers to participate in the flexibility market3. In order to evaluate the effectiveness of the flexibility market in managing network constraints, we compare the constraints in the network with and without applying the flexibility market. Fig. 10 displays voltage variations at prosumers’ node with(out) flexibility market. As shown in 10a, when the flexibility 3According to (15), the flexibility price is monotonically increasing. Hence, since the initial price is set to ToU, the final price is always higher or equal to the ToU price. 5 10 15 20 Time (h) (a) 0 50 Pri ce ( ¢/kW ) 5 10 15 20 Time (h) (b) 0 50 Pri ce ( ¢/kW ) 5 10 15 20 Time (h) (c) 0 50 Pri ce ( ¢/kW ) F r Figure 9: Flexibility price in: a) Community A, b) Community B, and c) Community C. 2 4 6 8 10 12 14 16 18 20 22 24 Time (h)(a) 0.95 1 1.05 Vo ltag e (p .u.) 2 4 6 8 10 12 14 16 18 20 22 24 Time (h)(b) 0.9 0.95 1 1.05 Vo ltag e (p .u.) Figure 10: Box plot of voltages at prosumers’ nodes a) with flexibility market, b) without flexibility market. market is applied, the voltage range in all nodes is in acceptable range ([0.95 ∼ 1.05] p.u.). However, as illustrated in Fig. 10b, without flexibility market the voltage range in most of time slots is less than 0.95 p.u. (specially at nodes at the end of each distribution branch), which does not retain the power quality of the distribution network. Additionally, the percentage of distribution lines usage is illustrated in Fig. 11. As shown in Fig. 11b, congestion (when the percentage of line usage is higher that 100 %) is occurred several times in the distribution network without flexibility market. Moreover, comparing Figs. 11a and 11b presents that the flexibility market impacts significantly on decreasing the line rates in the distribution network caused by flexibility provided by agents. In order to demonstrate the effectiveness of the flexibility market in reducing net costs of the communities, 0 20 40 60 80 100 120 140 Lines rate (% of line capacity)(a) 0 20 40 60 80 Oc urre nce s 0 20 40 60 80 100 120 140 Lines rate (% of line capacity)(b) 0 20 40 60 80 Oc urre nce s Figure 11: Histogram of lines rate in different lines (% of power flow per line capacity) a) with flexibility market, b) without flexibility market. Table 2: Daily Energy Costs and Flexibility Reward in Different Communities Energy Cost ($) Flexibility Reward ($) Net Cost ($) Reduction (%) Community A 76.60 13.06 66.54 16.40 Community B 129.36 34.63 94.73 26.77 Community C 106.91 8.67 98.24 8.10 the daily energy costs and the flexibility reward for different communities are compared. Results are reported in Table 2, where the energy cost indicates the total daily cost paid by the community members to the grid, and the flexibility reward is the profit that community members make from providing flexibility in response to the DSO requests. Results verify that participation in the flexibility can reduce the net energy costs significantly. However, the profit in the flexibility market depends on the number of events and the flexibility price. Hence, the flexibility reward in the Community C is the lowest, as it has the lowest number of flexibility events (see Fig. 8c). On the other hand, the highest number of flexibility events occurs in the Community B, which in turn increases the total flexibility reward for the prosumers in this community. 4.3. Remarks on Computational Efficiency In the proposed framework, the P2P market is a fully decentralized market which allows prosumers to directly negotiate with each other. The decentralized P2P approaches are known for their scalability as shown in [33]. Moreover, for the flexibility market which requires DSO to interacts with prosumers, we have proposed community-based flexibility markets that are employed for each feeder with limited number of prosumers. Thus, the proposed framework is able to deal with large scales of local communities and does not face any computational burden, and increase in the number of prosumers does not significantly impact the complexity of the local system. In other words, the computational burden in our approach is less compared to requesting flexibility from each bus which is an important factor in large-scale local energy communities. However, since the market clearing process in both P2P and flexibility markets is iterative, it is important to ensure computational efficiency for the real-world implementation of this framework. Fig. 12 shows the number of iterations and computation time required to clear the market in each time slot. The 5 10 15 20 Time (h)(a) 0 50 100 150 Co mpu tatio n tim e (m s) 0 100 200 300 Iter atio ns Computation time No. of iterations 5 10 15 20 Time (h)(b) 0 20 40 60 80 Co mpu tatio n tim e (m s) 0 10 20 30 Iter atio ns Figure 12: Number of iterations and computation time required for market clearing in a) P2P market, b) flexibility market. prosumers algorithms have been implemented using MATLAB on a computer with an Intel Core i7 of 2.6 GHz and 16 GB memory, while the DSO algorithm for flexibility calculation has been implemented using CPLEX solver in GAMS. Since the flexibility market is cleared in parallel for all communities, the maximum values among all communities are reported. The total computation time in each time slot is the summation of the computation time in the flexibility and P2P markets. As it can be observed from the results, both P2P and flexibility markets can be settled in a short time (the maximum computation time in P2P and flexibility markets are 140 and 70 ms, respectively). Also, it is noticeable that the number of iterations in the flexibility market is significantly lower than the P2P market. This is due to the fact that the flexibility market is formed as a community-based market for each feeder with lower number of participants. 5. Conclusion In this paper, we have proposed a new framework for neighborhood energy and flexibility trading in distribution networks. Thus, prosumers are able to trade P2P energy based on decentralized negotiations. According to our proposed framework, the DSO commits the requested flexibility for each community to manage network constraints in the distribution system. Finally, prosumers, in interaction with the DSO, are able to provide flexibility service from community-based flexibility markets based on the iterative auction. According to our study, it is concluded that our proposed local energy and flexibility market framework empowers prosumers for trading P2P energy with several local players simultaneously. Moreover, prosumers completely provide flexibility requested by the DSO. In this way, not only do considering flexibility market retain voltage of the distribution network in an acceptable range, but also it decreases lines rate and prevents congesting in lines. Finally, it is found that our proposed local P2P energy and flexibility markets can be cleared in a short time, while the computational time of the flexibility market is less which plays a key role for the DSO fast operating in case of non-secure states occurred in the distribution network. Future work includes the consideration of a more detailed model for prosumers by incorporating uncertainties and adaptive strategic bidding of prosumers. Another potential extension is the design of a secure and privacy preserving blockchain-enabled platform to facilitate prosumers and DSO communication in joint P2P energy and flexibility markets. References [1] M. Khorasany, R. Razzaghi, Microgrids and local markets, Microgrids: Advances in Operation, Control, and Protection (2021) 151–177. [2] M. Khorasany, R. Razzaghi, A. S. Gazafroudi, Two-stage mechanism design for energy trading of strategic agents in energy communities, Applied Energy 295 (2021) 117036. [3] T. Morstyn, N. Farrell, S. J. Darby, M. D. McCulloch, Using peer-to-peer energy-trading platforms to incentivize prosumers to form federated power plants, Nat. Energy 3 (2) (2018) 94–101. [4] W. Tushar, T. K. Saha, C. Yuen, D. Smith, H. V. Poor, Peer-to-peer trading in electricity networks: An overview, IEEE Trans. Smart Grid 11 (4) (2020) 3185–3200. [5] J. Zhao, T. Zheng, E. Litvinov, A unified framework for defining and measuring flexibility in power system, IEEE Trans. Power Syst. 31 (1) (2015) 339–347. [6] J. Cochran, M. Miller, O. Zinaman, M. Milligan, D. Arent, B. Palmintier, M. O’Malley, S. Mueller, E. Lannoye, A. Tuohy, et al., Flexibility in 21st century power systems, Tech. rep., National Renewable Energy Lab.(NREL), Golden, CO (United States) (2014). [7] J. Qin, R. Rajagopal, P. Varaiya, Flexible market for smart grid: Coordinated trading of contingent contracts, IEEE Transactions on Control of Network Systems 5 (4) (2017) 1657–1667. [8] R. Rocha, J. V. Collado, T. Soares, F. Retorta, Local energy markets for energy communities with grid constraints, in: 2020 17th International Conference on the European Energy Market (EEM), IEEE, 2020, pp. 1–6. [9] A. S. Gazafroudi, M. Khorasany, R. Razzaghi, H. Laaksonen, M. Shafie-khah, Hierarchical approach for coordinating energy and flexibility trading in local energy markets, Applied Energy 302 (2021) 117575. [10] G. Tsaousoglou, J. S. Giraldo, P. Pinson, N. G. Paterakis, Mechanism design for fair and efficient dso flexibility markets, IEEE Trans. Smart Grid (2020). [11] F. Lezama, J. Soares, B. Canizes, Z. Vale, Flexibility management model of home appliances to support dso requests in smart grids, Sustainable Cities and Society 55 (2020) 102048. [12] C. A. Correa-Florez, A. Michiorri, G. Kariniotakis, Optimal participation of residential aggregators in energy and local flexibility markets, IEEE Trans. Smart Grid 11 (2) (2019) 1644–1656. [13] J. P. Iria, F. J. Soares, M. A. Matos, Trading small prosumers flexibility in the energy and tertiary reserve markets, IEEE Trans. Smart Grid 10 (3) (2018) 2371–2382. [14] T. Morstyn, A. Teytelboym, M. D. McCulloch, Designing decentralized markets for distribution system flexibility, IEEE Trans. Power Syst. 34 (3) (2018) 2128–2139. [15] S. Allahmoradi, M. P. Moghaddam, S. Bahramara, P. Sheikhahmadi, Flexibility-constrained operation scheduling of active distribution networks, International Journal of Electrical Power & Energy Systems 131 (2021) 107061. [16] A. S. Gazafroudi, M. Shafie-Khah, F. Prieto-Castrillo, J. M. Corchado, J. P. Catalão, Monopolistic and game-based approaches to transact energy flexibility, IEEE Trans. Power Syst. 35 (2) (2019) 1075–1084. [17] O. Alrumayh, K. Bhattacharya, Flexibility of residential loads for demand response provisions in smart grid, IEEE Trans. Smart Grid 10 (6) (2019) 6284–6297. [18] A. S. Gazafroudi, J. M. Corchado, A. Keane, A. Soroudi, Decentralised flexibility management for evs, IET Renewable Power Generation 13 (6) (2019) 952–960. [19] A. S. Gazafroudi, J. M. Corchado, M. Shafie-khah, M. Lotfi, P. J. Catalão, Iterative algorithm for local electricity trading, in: 2019 IEEE Milan PowerTech, IEEE, 2019, pp. 1–6. [20] M. S. H. Nizami, M. Hossain, K. Mahmud, A nested transactive energy market model to trade demand-side flexibility of residential consumers, IEEE Trans. Smart Grid 12 (1) (2020) 479–490. [21] K. Zhang, S. Troitzsch, S. Hanif, T. Hamacher, Coordinated market design for peer-to-peer energy trade and ancillary services in distribution grids, IEEE Trans. Smart Grid 11 (4) (2020) 2929–2941. [22] J. Kim, Y. Dvorkin, A p2p-dominant distribution system architecture, IEEE Transactions on Power Systems 35 (4) (2019) 2716–2725. [23] S.-W. Park, Z. Zhang, F. Li, S.-Y. Son, Peer-to-peer trading-based efficient flexibility securing mechanism to support distribution system stability, Applied Energy 285 (2021) 116403. [24] Z. Zhang, R. Li, F. Li, A novel peer-to-peer local electricity market for joint trading of energy and uncertainty, IEEE Trans. Smart Grid 11 (2) (2019) 1205–1215. [25] T. Orlandini, T. Soares, T. Sousa, P. Pinson, Coordinating consumer-centric market and grid operation on distribution grid, in: 2019 16th International Conference on the European Energy Market (EEM), IEEE, 2019, pp. 1–6. [26] D. Botelho, P. Peters, L. de Oliveira, B. Dias, T. Soares, C. Moraes, Prosumer-centric p2p energy market under network constraints with tdf’s penalization, in: 2021 IEEE Madrid PowerTech, IEEE, 2021, pp. 1–6. [27] T. Orlandini, Mutual-benefit coordination of peer-to-peer market and distribution grid management, Master’s thesis, DTU (2018). [28] M. Khorasany, A. Najafi-Ghalelou, R. Razzaghi, A framework for joint scheduling and power trading of prosumers in transactive markets, IEEE Trans. Sustain. Energy (2020). [29] S. Wang, A. F. Taha, J. Wang, K. Kvaternik, A. Hahn, Energy crowdsourcing and peer-to-peer energy trading in blockchain-enabled smart grids, IEEE Trans. Syst. Man, Cybern., Syst. 49 (8) (2019) 1612–1623. [30] C. Dang, J. Zhang, C.-P. Kwong, L. Li, Demand side load management for big industrial energy users under blockchain- based peer-to-peer electricity market, IEEE Trans. Smart Grid 10 (6) (2019) 6426–6435. [31] P. Samadi, H. Mohsenian-Rad, R. Schober, V. W. Wong, Advanced demand side management for the future smart grid using mechanism design, IEEE Trans. Smart Grid 3 (3) (2012) 1170–1180. [32] G. Hug, S. Kar, C. Wu, Consensus+ innovations approach for distributed multiagent coordination in a microgrid, IEEE Trans. Smart Grid 6 (4) (2015) 1893–1903. [33] M. Khorasany, Y. Mishra, G. Ledwich, A decentralized bilateral energy trading system for peer-to-peer electricity markets, IEEE Trans. Ind. Elec. 67 (6) (2019) 4646–4657. [34] M. Shafie-Khah, P. Siano, D. Z. Fitiwi, N. Mahmoudi, J. P. Catalao, An innovative two-level model for electric vehicle parking lots in distribution systems with renewable energy, IEEE Trans. Smart Grid 9 (2) (2017) 1506–1520. [35] A. Ahmad, S. A. R. Kashif, M. A. Saqib, A. Ashraf, U. T. Shami, Tariff for reactive energy consumption in household appliances, Energy 186 (2019) 115818. [36] S. Cui, Y.-W. Wang, Y. Shi, J.-W. Xiao, A new and fair peer-to-peer energy sharing framework for energy buildings, IEEE Trans. Smart Grid (2020). [37] A. C. Chapman, G. Verbič, An iterative on-line auction mechanism for aggregated demand-side participation, IEEE Trans. Smart Grid 8 (1) (2015) 158–168. [38] H. Laaksonen, P. Saari, R. Komulainen, Voltage and frequency control of inverter based weak lv network microgrid, in: 2005 Int. Conf. Future Power Syst., IEEE, 2005, pp. 6–pp.