Topological considerations on peer-to-peer energy exchange and distributed energy generation in the smart grid

The vision of the future Smart Grid considers end-users connected to it as both consuming and generating energy. Equipped with small-scale renewable energy generators and storage systems, end-users, also known as prosumers, engage in a local energy market for procuring and selling energy, in turn disrupting the traditional utility model. The appeal of this vision lies in the engagement of end-users, in facilitating the introduction and optimization of renewable energy sources, with the overall expectation of optimizing the global energy generation and distribution process. To handle the peer-to-peer energy exchange and distributed energy generation in the digitalized Smart Grid, we proposed an optimization strategy. In the present work, we propose a Monte Carlo based simulation model to investigate the role of the topology in facilitating the peer-to-peer energy exchanges and distributed energy generation. We consider a 37-node distribution network and evaluate four topological models: radial, complete graph, random graph, and small-world. The results indicate that the random graph model is better than other models in reducing the average delivery path length and energy losses in the energy transfer between providers and consumers. The small-world model has higher efficiency than other models in reducing the maximum power load in the distribution network and the cost of buying energy for end-users. We scale up the investigation by considering a 100-node network and evaluate the random graph and the small-world models by varying the rewiring probabilities. The results show that the small-world model outperforms the random graph model on most efficiency metrics, even when considering infrastructural costs. This work provides the foundation for a decision support system for analysis and high level planning of the distribution network.


Introduction
The traditional model of a power system, with large generation facilities and passive load at the distribution end, is being challenged by the advances in renewable energy sources and the digitalization of the infrastructure. The trend involving distributed energy generation (DEG) entails that the power flows, especially at the distribution level, become multi-directional. The term Smart Grid captures the digitalization of the infrastructure and the related trends as just presented. More generally, the Smart Grid adopts Information and Communication Technology (ICT) to enhance the efficiency, environmental sustainability, reliability and economics of producing and distributing electrical energy in the power system (The Smart Grid 2016). If the overall efficiency of the traditional design of power systems is approximately 30%, the expectation is to bring this as high as 70% for the Smart Grid (Yu et al. 2011).
To achieve such radical efficiency increases, a number of technologies and techniques are necessary. In the present work, we consider the scenario for which renewable energy generators (REGs), such as photovoltaic (PV) panels and small wind turbines, enable endusers (in this case also called "prosumers") to produce electrical energy individually and to exchange the energy freely among each other. In other terms, the end-users can engage in a local energy market. After fulfilling the individual demands, their surplus energy is sold and transmitted to other end-users who need to buy energy. There are two key ingredients to realize such a scenario. One is the availability of such a market; the second is an energy distribution infrastructure that supports efficient, multi-directional power flows. In the present paper, we focus on the second issue: supporting "peer-to-peer energy exchange, " that is, the distribution of energy among end-users at a local scale. By contrast, "centralized energy exchange, " which is the current adopted model worldwide, means that end-users get the required energy from a central operator to which they remit their excess energy, when overproducing.
Achieved by introducing peer-to-peer energy exchange and trading in the same distribution network and distributed energy generation, the "Prosumer-involved Smart Grid" provides two important advantages: reducing the dependence on non-renewable energy sources that are based on fossil fuels; and improving the independence from centralized energy generation, operation and energy providers (The Smart Grid 2016). The distribution network is formed by the medium and low voltage (MV and LV) grids, including transformers and substations. The term "local scale" identifies residential areas covered by a sub-network of the distribution network running at low voltage without transformers and substations.
The present work extends the results presented in Sha and Aiello (2016), where we focused on the optimization of peer-to-peer energy exchange in the Prosumer-involved Smart Grid. The optimization objectives were to improve management of distributed energy generation, to reduce energy losses of delivery, to improve independence from a central operator, and to decrease energy costs for end-users. The present paper proposes a simulation model to investigate the topological effects on the optimization, that is, to study how the topology of distribution grids affect the optimal energy exchange based on distributed energy generation at the local scale. We study the effects of different topologies using the Monte Carlo approach (Law 2007). This work provides the foundation for a decision support system for the analysis and high-level planning of the distribution network towards managing distributed energy generation and peer-to-peer energy exchange.
For the evaluation, we design four assessment metrics: energy loss ratio in the distribution network, energy cost for end-users, maximum load in electric lines, and average path length of energy delivery. The evaluation process is divided into two stages. The first stage is performed on a 37-node network with four topology models: radial, complete graph, random graph (k = 4), and small-world (k = 4, p = 0.4). The second stage tests the random graph model with different average degrees k = 4, 6, 8, 10, 12 and the small-world model with different pairs of average degrees k = 4, 6, 8, 10, 12 and rewiring probabilities p = 0.2, 0.4, 0.6, 0.8, 1.0. We test these models against 100-node networks. The present work is also based on and extends our previous paper (Sha and Aiello 2018) by designing the second stage of the evaluation process. The major contributions of the present paper are: (i) a proposal for evaluating how the topology models and the model's parameters influence the performance of peer-to-peer energy exchange and trading, (ii) experiments from the topological point of view employing the optimization of peer-to-peer energy exchange, and (iii) a simulation model on the basis of the Monte Carlo approach and various statistical distributions.
The remainder of the paper is organized as follows. The "State of the art" section discusses the related work. The "Optimization of peer-to-peer energy exchange" section presents the mathematical optimization model of peer-to-peer energy exchange proposed in our previous paper (Sha and Aiello 2016). The "Monte Carlo simulation" section illustrates the Monte Carlo approach and the methods of simulating energy production, consumption, and real-time price. Evaluated topologies, parameters and cases, assessment metrics and evaluation settings are presented in "Simulation execution and results" where also the results are discussed. The "Scope and limitations" section discusses the scope and limitations of this paper. The "Conclusions" are offered in the final section.

State of the art
While energy exchange and trading in the Smart Grid is becoming increasingly studied, to the best of our knowledge, there are few works that combine the topological perspective with a probabilistic approach. In considering related work, we look into two main relevant fields: energy exchange and trading in the Smart Grid, and topological approaches to distribution networks.

Energy exchange and trading in the smart grid
In the context of the Smart Grid, a Microgrid comprises a cluster of distributed energy generators that are locally controlled and work at low voltages (≈≤ 1 kV) or medium voltage (usually ≈ 1 − −69 kV) (Hatziargyriou et al. 2007). A Microgrid behaves, from the power grid's perspective, as a single energy producer or consumer (Hatziargyriou et al. 2007). Game Theory is the most widely employed approach to model the system and its users (Abdella and Shuaib 2018). Matamoros et al. study how energy can be exchanged between two Microgrids in a peer-to-peer manner in order to minimize the total cost of energy generation and transportation, while each Microgrid fulfills its local energy demand (Matamoros et al. 2012). The approach is generalized for the case of Microgrids, which are fully connected, have a ring and a linear topologies (Gregoratti and Matamoros 2015). Other game theoretic approaches are presented in Lee et al. (2015), Zhang et al. (2018), and Marzband et al. (2018). Most studies on energy exchange and trading at the Microgrid level do not consider the topological effects on the reaching of equilibria and improving performances.
The PowerMatcher project focuses on a set of users connected to the same distribution network and coordinating their loads (Kok et al. 2005(Kok et al. , 2012Warmer et al. 2007Warmer et al. , 2008Hommelberg et al. 2007;Bliek et al. 2010;Kok 2010Kok , 2013MacDougall et al. 2011). Based on an agent-oriented architecture, the focus is on physical deployment and demonstrating the feasibility of local energy exchange. End-users, owning home appliances, electric vehicles and/or industrial installations, act as small electrical energy consumption. Small-sized distributed energy generators based on renewable sources provide small energy production in the operation of the electricity infrastructure. In this way, the Pow-erMatcher enables integration of the large amounts of renewable energy in the power grid while avoiding overloads in the distribution network. The aim of the project is to support the matching of supply and demand. A market-based control approach is employed to optimally balance energy production and consumption. The PowerMatcher project is validated both in the field deployment and in simulation studies with good results. It can improve the match between energy consumption and the availability of renewable energy production, and can reduce the imbalance caused by unpredictable behavior of renewable sources. In addition, it is able to relieve possibly overloaded distribution networks.
Another study based on Game Theory proposes a model that involves energy exchange and trading among prosumers (Samadi et al. 2016). Some studies investigate energy exchange based on intelligent buildings. Mocanu et al. propose a Building Energy Management Systems (BEMS) enabling energy exchange among buildings to optimize their energy scheduling and energy cost (Mocanu et al. 2014). In Kim and Lavrova (2013), Kim et al. optimize power flows in order to share energy among buildings equipped with battery storage systems. Based on energy exchange among buildings, the work presented inČaušević et al. (2019) proposes a mechanism that can supply electricity to communities affected by a power outage. The proposed mechanism assigns different priorities to buildings in the community based on community preferences. During power outage, the building with the highest priority is supplied with electricity by energy exchange first. In (Wörner et al. 2019), Wörner et al. describe the implementation of an actual prototype of blockchain-based electricity market for energy exchange within a neighborhood. The goal of this work is to evaluate the application of blockchain technology in energy exchange among prosumers.
In this field, the closest line of research to our study is on power routing which is a mechanism allowing electrical energy routing between prosumers and consumers. It is an essential service required for the energy exchange and trading (Abe et al. 2011;Zhong et al. 2016). In Tashiro et al. (2012), Tashiro et al. propose a system at physical layer to dispatch electrical energy by power packets from a source to a destination. The power packet means that electrical energy is treated like data packets tagged with the information about senders and receivers (Tashiro et al. 2012). The paper provides the physical foundation scheme for the peer-to-peer energy exchange. In Wang et al. (2017), Wang et al. present a design of a power router that is responsible for power dispatching. The design includes the hardware structure of the router and a power routing algorithm based on graph theory and lowest cost selection. The proposed power routing algorithm considers physical constraints of the power network. Based on such power router, Zhu et al. design a routing protocol to find the most energy efficient path for power flows from one house to another house (Zhu et al. 2011). This protocol focuses on the data security perspective on the power routing. A power router is also the subject of (Nguyen et al. 2010) in which Nguyen et al. present the cost-scaling push-relabel algorithm to control the power flow in distribution networks considering the distributed energy generation, bidirectional power flows and meshed network topology. In Brocco (2013), Brocco proposes a distributed protocol to create and maintain energy transit paths between energy sources and loads devices. The work focuses on the autonomous control of the power routing. In Hong and Kim (2016), Hong et al. propose a strategy utilizing game theory for optimizing power routing among prosumers or Microgrids. The main aim of their strategy is to minimize the transaction price. Power routing is simply modeled as a traditional transportation problem to balance the energy supply and demand. Ma et al. propose a power dispatching protocol based on the power packet and power router (Ma et al. 2018). The protocol focuses on matching energy consumers with suppliers, balancing load and generation, and scheduling energy transit in the distribution network. Very recently, the authors of (Jogunola et al. 2020) proposed a slime-mould inspired approach for optimizing the power routing among prosumers in the distribution network. The optimization approach considers the energy losses of power routing, the capacity constraint of electric lines, and the topology of the distribution network. This work is in line with our previous paper (Sha and Aiello 2016). The power routing algorithms proposed in the above cited works (Wang et al. 2017;Zhu et al. 2011;Nguyen et al. 2010;Brocco 2013;Hong and Kim 2016;Ma et al. 2018;Jogunola et al. 2020) are all centralized. Decisions about energy price, energy transit and demand-supply balance are decided centrally by the power router or a central controller. The work in (Jogunola et al. 2020) considers meshed graphs as the topology of the distribution network. The work presented in Nguyen et al. (2010) and Wang et al. (2017) use meshed direct graphs to model the topology of the power network, while other papers do not consider the topology perspective.
While the reviewed work focuses mostly on the coordination mechanism among the actors, in the present work we consider issues of efficiency of delivery and show how this is influenced by the underlying network topology.

Topological approaches to distribution
Reconfiguration problems of the distribution network from a power engineering point of view are the focal point of topological studies of the distribution networks. Reconfiguration in distribution systems is defined as altering the topological structures of distribution feeders by opening and closing the switches for reducing power loss or balancing load in the system (Civanlar et al. 1988). For example, Gohokar et al. apply the network topology approach to formulate the reconfiguration problem of the distribution network and achieve at least a 5% energy loss reduction (Gohokar et al. 2004).
From the power distribution's perspective, the topology of the distribution network has an important influence on electrical energy distribution and might need to change with respect to distributed energy generation for the Smart Grid. Brown argues for the necessity for non-radial distribution networks to support distributed energy generation in the Smart Grid (Brown 2008). This standpoint is further emphasized in Dugan et al. (2010) where the adoption of a meshed distribution network is shown to have the potential to reduce energy losses and to facilitate distributed energy generation. In addition, Alvarez-Herault et al. propose approaches to upgrade the distribution network topology from the current radial shape to a meshed network; the goal is to support the increasing connection of the distributed renewable energy generation for the Smart Grid (Alvarez-Herault et al. 2015).
In our previous work, we consider possible evolution of the distribution grids towards a Smart Grid. In particular, we provide a topological analysis of the Dutch distribution networks (Pagani and Aiello 2011). We assess the topological properties' influence on the cost of peer-to-peer energy exchange and trading in the Prosumer-involved Smart Grid. In the following (Pagani and Aiello 2014), we investigate several network topology models (e.g., small-worlds, random graphs) to discover which one performs best for supporting the peer-to-peer energy exchange and trading, and how network topology models influence the cost of electrical energy transit in the Smart Grid. Finally, in Pagani and Aiello (2016), we take a practical step in evaluating how to evolve the existing distribution network to a smart grid model, taking into account the physical constraints. In the present work, we go beyond a statical topological analysis and look into the actual power flows and practical network topologies, which clarifies and fills gaps left by previous works on the subject.

Optimization of peer-to-peer energy exchange
Prosumers produce energy for their own consumption or for resell. In the model, we proposed, any node can be a buyer and the price for energy is set dynamically per transaction (Sha and Aiello 2016). Electric utilities also sell energy and have to cater system's balance for a profit. Nodes can simply be consumers. All end-users are part of the same energy market to trade energy negotiating at real-time prices. The market's borders are defined by the topology of the infrastructure and are therefore geographical in nature. More precisely, the model uses the following assumptions.
-Buying and selling energy are random discrete events.
-Buying or selling energy is an autonomous decision of each prosumer. -Buying, selling and transmitting energy, in different time slots are independent events. -At any given time slot, a prosumer can only be a consumer or a provider, not both. -The providers prefer selling energy to the peers rather than the electric utility.
-The consumers prefer buying energy from the peers rather than the electric utility.
-Energy delivery entails a non-null energy loss.
-Energy losses are only due to power line transit.
-The cost of energy losses is paid by the consumer.
-The compensation of delivery energy losses is not considered.
-Only active power in the distribution network is considered. -Voltage instability in electric lines is not considered.
We define a weighted electricity distribution graph as one where nodes and edges represent end-users (including prosumers) and the electric lines connecting the end-users, respectively. The substations and transformers are not represented in the graph. The electric lines are differentiated according to their electrical resistance, and thus are modeled as weighted edges. According to the electrical resistance of the electric line, we can calculate the energy loss in this line. The edges are considered directed to represent the flow. The direction of the edge is dependent on the time slot, that is, it can change at different times. Formally, we have

Definition 1 (Weighted Electricity Distribution Graph) An electricity distribution graph is a weighted graph G(V , E, W ) such that each element v i ∈ V is an end-user that is a consuming unit of a physical distribution network. If there is an edge e
between two nodes, there is a physical electric line connecting directly the elements represented by v i and v j . The weight of the edge e ij is w(e ij ) ∈ W that is the electrical resistance of the physical electric line connecting v i and v j .
In the weighted electricity distribution graph, we have Fact 1 Between any two nodes, a path PATH(i, j) = {e ia , e ab , ..., e xj } represents a set of physical electric lines connecting v i and v j . As a point of notation, given a system with p end-users, we write EU = {eu 1 , eu 2 , ..., eu p } to denote these end-users and a set of time slots . A set of energy consumers and providers at t is denoted by EC(t) = {ec t,1 , ec t,2 , ..., ec t,n } and EP(t) = {ep t,1 , ep t,2 , ..., ep t,m }, respectively. For each provider, we have ep t,i = (price t,i , supply t,i ), where price t,i represents the energy price (€/kW·h) of ep t,i and supply t,i represents an amount of energy supplied by ep t,i . The amount of energy that ec t,i buys from ep t,j is represented by buy t,(i,j) ∈ (0, supply t,j ]. The energy generated and consumed by eu t,i are represented by GE t,i and C t,i , respectively. Thus, we have Q t,i = GE t,i − C t,i representing the amount of energy which eu t,i is able to sell or needs to buy. If Q t,i > 0, eu t,i has surplus energy to sell. If Q t,i < 0, eu t,i needs to buy energy to fulfill its demand.
In the proposed model, the power flow will follow varying paths which depend on the set of pairwise agreements between nodes per time slot and the physical constraint of keeping the system in electric balance. This also means that energy losses on the network will vary per time slot. Since energy losses are paid by the buyer, the buyer has the interest to make energy provisioning decisions that are optimal with respect to losses. In other words, the individual optimization goal can be stated as: "given an open energy market with real-time pricing possibilities, how to find the cheapest energy provider dynamically and be delivered energy following the paths with minimum energy losses. " For a consumer ec t,i , the cost of buying an amount of energy x is defined as CoB(x). The energy loss of delivering x to the consumer is defined as LoD(x). The delivery path from ep t,j to ec t,i is PATH(j, i) = {e 1 , e 2 , ...} where PATH(j, i) consists of electric lines {e 1 , e 2 , ...} without substations and transformers. Energy loss in an electric line e ∈ PATH(j, i) is defined as LS e . Thus, energy loss of a delivery path PATH(j, i) is the sum of LS e in all electric lines {e 1 , e 2 , ...} ∈ PATH(j, i). Then, in case of Q t,i < 0, the objective function of optimizing energy cost of ec t,i at any given time slot is the following: Since a prosumer can only act as a consumer or a provider at any given time slot, we have Eq. (2). Meaning that a prosumer cannot buy and sell energy at the same time slot.
The set of consumers and producers is a subset of the set of nodes. Then, we have Eq. (3). The formula contains "⊆" and not "=", because some prosumers can be self-satisfied at a given time slot.
At each time slot, the total energy consumption and the total energy supply in the distribution network have to be the same. Since prosumers are not necessarily able to provide the energy to all consumers, a super agent (i.e., an electric utility) is part of the model with the ability to buy or sell energy at fixed prices when end-users' demand and supply are unbalanced. The super agent buys energy at a lower price than it sells it.
The amount of energy balanced by the super agent at t is represented by ES(t). Positive values of ES(t) (ES(t) > 0) represent the selling of energy by the utility, negative values (ES(t) < 0) represent buying. Three constraints represent the condition that the system has to be always in balance.
Finally, two physical system's constraints are part of the model: ampacity and flow directionality. Ampacity of an electric line e k is the maximum electric current I max e k carried by the electric line (Grigsby 2007). The ampacity is related to the dependent on the voltage U e k in the following way I max e k ×U e k × t. The power flow starting from ep t,j going through e k is represented by f (e k ,ep t,j ) . This leads to: On a given line at a given time slot, there can be only one direction of flow, that is, the direction of f (e k ,ep t,j ) , represented by d (e k ,ep t,j ) takes values in the pair: {−1, 1}. For example, if there is a power flow in an electric line from point A to B at t, another power flow in this electric line from point B to A at the same t is not allowed.

Monte Carlo simulation
To understand the optimization strategy's effectiveness and its dependence on the various parameters, we resort to stochastic simulations. In particular, the Monte Carlo Simulation method relies on generating repeated random numbers (Law 2007;Raychaudhuri 2008).
In our work, this entails the use of statistical distributions for modeling energy consumption, renewable energy production, and real-time pricing. We run simulations for several topological models, to assess the topological effects on the optimization of energy distribution. In particular, we consider: a small-world model (Watts and Strogatz 1998), a random graph model (Noh and Rieger 2004), a complete graph model, and a radial model.
The reason for choosing the small-world model is that this model obtains a good balance between the upgrading costs for infrastructure and energy distribution efficiency (Pagani and Aiello 2014). The other models are considered as they form a benchmark for comparison. The radial model is the currently most common network distribution model used in practice and thus can be considered for the comparison with current practice. While the random graph and the complete graph models can be seen as extreme cases of the smallworld models where the rewiring probability is maximum or null, respectively. Next, we illustrate the specific sub-models for energy production, consumption, and distribution networks.

Simulation of wind energy production
Wind power is dependent on the length of the turbine's rotor blades, air density, and wind speed. The formulas of generating electric power P w by a wind turbine, and calculating electrical energy E w are derived from (Grogg 2005), shown next: The units of P w and E w are Watt and Joule, respectively. The area swept by the rotor blades (m 2 ), air density (kg/m 2 ), and wind speed (m/s) are represented by A, ρ and V, respectively. We use C w ∈ (0, 1) to represent the efficiency of a wind turbine, and P max (Watt) is the maximum power output.
The analytical relationship between the electric power P w and the wind speed V depends on the control characteristics of the wind turbine, which are cut-in speed V ci and cut-off speed V co . The wind turbine only works when the wind speed is in [ V ci , V co ]. Otherwise, the turbine is locked. Meaning that P w = 0 when V < V ci or V > V co .
We apply a standard three-bladed turbine (Bukala et al. 2015) in the simulation, where the swept area of blades A = 10.75 (m 2 ), the maximum power output P max = 2600 (Watt), V ci = 2 (m/s), and V co = 13 (m/s). We approximate the wind turbine's efficiency C w from the efficiency curve, as shown in Fig. 1. For air density, we use the average value ρ = 1.225 (kg/m 3 ) (International Organization for Standardization 1975).
The wind speed is generated by applying a Weibull distribution (Karki et al. 2006). The scale and shape of the distribution are calibrated by means of historical measures. In Ayr (2014), the author calculates the parameters of the Weibull distribution for 97 sites in Italy based on wind data collected throughout the country during 30 years. We use Milano Malpensa site's data provided by that work, in which the scale is 3.18 and the shape is 1.4 (Ayr 2014). This site is located near an international airport. Therefore, the wind data of this site are more stable and can provide useful information of wider validity (Ayr 2014).

Simulation of solar energy production
For the photovoltaic panel simulation, we consider one hour intervals and the temperature, air pressure, local time, and geographical location. For a cloudy sky, the model of hourly solar radiation is on the basis of the widely adopted model from (Sung et al. 2015). The model is characterized by the peak solar radiance S max,t (kW/m 2 ), the sunrise t rise and sunset t set times. More precisely: where I ss,t is the solar radiance (kW/m 2 ) of the simple sky model at time t, t rise and t set are the sunrise and sunset time, respectively. In the present work, as the panels are assumed to be roof-based, S max,t is the maximum terrestrial radiance in an hour I ETI,max,t multiplied by the hourly clearness index CI t . I ETI,max,t is dependent on the zenith angle θ Z,t , eccentricity factor E 0 , and the peak value on terrestrial surface I 0 , shown below (Sung et al . 2015): where d n is how many days simulated in a year. The angle between the sun position and vertical axis is called the zenith angle (Z) θ Z,t . To calculate θ Z,t , we refer to (Grena 2012) where five algorithms for the calculation are presented. We choose the Algorithm 3 because it has the best balance between model precision and computational costs. Algorithm 3 depends on the temperature, air pressure, local time, and geographical location. For the geographical location, we choose Maastricht in The Netherlands as detailed weather data is available thanks to the Royal Netherlands Meteorological Institute (KNMI) (Daily Data from the Weather in the Netherlands). Furthermore, Maastricht is the least influenced city of the Netherlands with respect to North Sea weather fluctuations. The data includes daily average cloud coverage, daily minimum temperature, daily maximum temperature, lowest hourly value of air pressure, and highest hourly value of air pressure. We use the meteorological data of 2016, where the sunrise and sunset times are obtained from "www.timeanddate.com".
In a year, we select a random day d n and the hour t in d n is the time slot. When t is not in the sunrise to sunset interval, the energy output is null. Otherwise, we use the weather data of the day and generate random numbers to calculate solar radiation and solar energy production in t. The value of the air pressure at t is randomly generated between the minimum and maximum values of the air pressure in a day. For the temperature, we assume that the hourly temperature T t is linear between the minimum temperature T min at the time H Tmin and maximum temperature T max at H Tmax in a day. Then, we can estimate the temperature at time t as follows: when the time t is not in [ T min , T max ], we generate a random number in [ T min , T max ] as T t . For a cloudy sky, the clearness index CI t is the sky portion that is without cloud covering. CI t is generated by a normal distribution whose mean value is in [ 0.4476, 0.64811] and standard deviation of 0.14 (Jurado et al. 1995). The mean value of CI t varies daily and the seasonal variability is taken into account. We transform the daily average cloud coverage CC d into the mean value of the clearness index in a day by 1−CC d /CC upper , where CC upper is the upper bound of CC d .
The formulas of producing solar power P s and electrical energy E s by a photovoltaic panel are shown next 1 .
The unit of P s is Watt and the unit of E s is Joule. The surface area of a photovoltaic panel (m 2 ) and solar radiation (W/m 2 ) are denoted by A and r, respectively. We use C p ∈ (0, 1) to denote the efficiency of a photovoltaic panel. We use Q ∈[ 0.5, 0.9] to denote the Quality Factor (Performance Ratio) that includes all loss relating to the solar power production of the photovoltaic panel. The peak power output of the photovoltaic panel is P peak (Watt).
We choose LG360Q1C 2 as the simulated photovoltaic panel where the photovoltaic panel's efficiency C p = 0.196, the photovoltaic panel's surface area A = 1.73 (m 2 ) and the photovoltaic panel's peak power output P peak = 360 (Watt). Because it has the top-three highest quality in 2017 and affordable price for the residential users 3 .
For residence buildings, fixed or adjustable panels are realistic choices. We assume that all photovoltaic panels are adjustable panels and their tilt is adjusted twice a year: in the summer and winter. Because adjustable panels can capture more energy during the whole year than fixed panels (Landau 2017). The Quality Factor (Performance Ratio) of the adjustable panel is Q = 0.75 (Landau 2017).
In the Netherlands, a modern residential building typically has 4 to 6 photovoltaic panels (van Sark and Schoen 2017). In relevant rare cases, some buildings do not have sufficient roof areas to fit 4 panels and some buildings have relevant higher energy consumption requiring more than 6 panels. Therefore, we consider that an end-user installs 2 to 8 panels. Since the photovoltaic panels are usually installed with even numbers, we randomly select a number in {2, 4, 6, 8} for a prosumer when the simulation starts. The total energy generated by the whole installation is the sum of the generation of each photovoltaic panel.

Simulation of energy consumption
Studies on the household energy consumption profile exist. Ogunjuyigbe et al. provide the profile of a typical household (Ogunjuyigbe et al. 2016). In Gottwalt et al. (2011), a similar profile is identified. Both of these profiles have two consumption peaks. One is in the morning and another one is in the afternoon. Therefore, the consumption in an hour of end-users can be assumed to be drawn by a bimodal distribution (Galtung 1967).
The bimodal distribution has two normal distribution curves combined that can model the two consumption peaks during one day. Then, we assume the boundary of the bimodal distribution to be at 11:00AM. Therefore, one peak appears in the morning around 6:00AM, and the other one is in the afternoon around 5:00PM. The bimodal distribution's parameters are calculated via the dataset of Liander (Energy Consumption of Small Customers in the Netherlands). In the afternoon, the standard deviation and mean of the consumption are 0.064 and 0.227, respectively. In the morning, the standard deviation and mean of the consumption are 0.058 and 0.15, respectively.

Simulation of energy prices
The energy price is assumed to change every hour and to correlate to overall country demand. It therefore follows the bimodal distribution of energy consumption with the same boundary. The parameters of such energy price distribution are coherent with the "electricity price statistics" 4 of 2017. The mean value of the distribution is €0.2 per kW·h which is the average price for the European 28 countries ("EU-28"). The standard deviation of the distribution is 0.05. The minimum price is €0.05 per kW·h. The electric utility offers a fixed price that is set to €0.22 per kW·h, which is the average price of "Euro area".

Simulation of distribution networks
A standard three-phase IEEE distribution test feeder is used to represent the radial topologies (Kersting 2001). The network consisting of 37 nodes is adapted for the simulation by removing the transformer and regulator, by considering a voltage of 120V for all electric lines (Fig. 2a). All of 37 nodes in the test feeder are assumed to be end-users and the distributed loads of three phases are assumed to be balanced. To generate small-world (Fig. 2b) and random graph (Fig. 2c) models, we use the Java library "GraphStream" 5 . Each electric line in all topologies has the same material and equal length. Thus, all electric lines have equal electrical resistance and ampacity.

Simulation execution and results
We built a Java program to implement the Monte Carlo simulations of the model presented in "Monte Carlo simulation" section. The simulation program was run on the

Assessment metrics
We design four metrics to evaluate the topological effects on the optimization strategies. The metrics are populated using the same load demand satisfaction. Firstly, to assess the energy delivery efficiency, we measure the energy loss ratio in the distribution network. The measured energy losses are on the basis of transferring the equal amount of energy in various considered topologies. For any end-user, the losses based on transferring energy from prosumers and from the super agent are both accounted for. LOSS t,i denotes the energy loss of an end-user eu t,i at t. BUY t,i denotes the amount of energy that an enduser eu t,i buys at t. We measure the ratio between energy losses on the network and the amount of energy that all end-users buy over a day (Eq. 14).
Secondly, to evaluate the economic benefits of a particular topology, we measure the energy costs for end-users. The energy costs are the total money that the end-users pay for buying and delivering energy from both prosumers and the super agent. COST t,i denotes the energy cost of an end-user eu t,i at t. We measure the energy cost (unit: EUR) of buying and delivering 1 kW·h energy on the network (Eq. 15).
Thirdly, to evaluate the influence on energy distribution flows we measure the maximum load in distribution networks. The maximum load in an electric line is the maximum energy an electric line carries at a time slot. We measure the maximum load (unit: kW) of the distribution network which is the maximum value of the loads in all electric lines in the whole network over one day. The electric line set is E and the load in an electric line e t,i at t is denoted by LOAD t,i . Then, we have: Lastly, we measure the average delivery path length for energy distribution in order to assess the efficiency of transmitting electricity between two nodes. The average delivery path length is the average hop count of all delivery paths from all resources (providers) to all destinations (consumers) in the distribution network. It represents the average number of electric lines of the delivery paths to transfer energy from providers to users who buy the energy. Since each electric line in all topologies has the same length and electrical properties, each electric line in all topologies has the same weight. Hence, the delivery path length equals the weighted delivery path length. DPL t,i denotes the total delivery path length for transferring all bought energy to an end-user eu t,i at t. DPN t,i denotes the number of delivery paths for transferring all bought energy to an end-user eu t,i at t. Then, we measure the average delivery path length (unit: step) to transfer all bought energy by all end-users over a day:

Power flow patterns
We apply two patterns of the power flow. One is Radial-flow that simulates energy distribution flows in the traditional way. In the distribution network, all end-users get energy from a central provider. The prosumer is not part of this pattern. The central provider injects electrical energy into the distribution network via Node 799, as shown in Fig. 2a.
The second pattern is the Optimal-flow one that adheres to the model proposed in "Optimization of peer-to-peer energy exchange" section. In this model, some or all of the end-users act as prosumers; energy production, real-time energy price, and peerto-peer energy exchange are enabled. A single super agent injects electricity into the distribution network via Node 799 when end-users' demand exceeds supply. For the random graph, complete graph, and small-world models, the location of Node 799 is decided by the model generation randomly. We refer to (Sha and Aiello 2016) for the algorithms of the Optimal-flow and do not repeat them here.

Evaluation stages and prosumer settings
We divide the evaluation process into two stages. In the first stage, we compare the performance based on various topologies. We test the random graph, complete graph, radial, and small-world models. For the small-world model, we use a rewiring probability p = 0.4 and an average degree of four k = 4, which provide a good balance between energy distribution efficiency and the cost of upgrading the infrastructure (Pagani and Aiello 2014). Then, we use the same average degree k = 4 for the random graph model. The experiments are performed on the modified IEEE 37-node test feeder, introduced in "Simulation of distribution networks". To model the traditional distribution way, we apply the Radial-flow pattern introduced in "Power flow patterns" to the radial topology. We apply the Optimal-flow to all topologies. This leads to five evaluation cases: "Traditional", "Complete Graph", "Small-world", "Random Graph", and "Radial". We apply Traditional to the baseline. We use several settings of the prosumer for the Optimal-flow cases with the goal to understand the influence of the number of prosumers. The case considers 24%, 50%, 75%, and 100% of prosumers; more precisely M = 9, 18, 27, 37 in the 37 nodes networks. These settings are referred to as "24%-prosumer", "48%-prosumer", "73%-prosumer", and "100%-prosumer", respectively. For the baseline (i.e., evaluation case Traditional), the number of prosumers is always 0 and it is therefore referred to as "0%-prosumer. " In the second stage, we test Small-world and Random Graph by varying graph formation probabilities by small increments. More precisely, the tested parameters of the random graph model are average degrees k = 4, 6, 8, 10, 12, while for the small-world model we test the same average degrees as the random graph model and p = 0.2, 0.4, 0.6, 0.8, 1.0 as the rewiring probabilities. We repeat the experiments for the 100 node graphs. The evaluation cases are named with the acronyms of topology models. For example, the random graph with k = 4 is referred to as "RG4" and the small-world having k = 4, p = 0.4 is referred to as "SW44".
In the second stage, we go beyond the traditional distribution way. Therefore, only the Optimal-flow pattern is applied and the Traditional case is not part of the simulation. We only compare the Random Graph case and the Small-world case with each other. We also assume that all end-users are prosumers, since the evaluation in this stage focuses on the topologies. Hence, this stage only has one prosumer setting, M = 100. In addition, this stage has the same physical constrains of distribution networks as the first stage. Meaning that the voltage for all electric lines is 120V, and all phases have the balanced loads, and each electric line has the same electrical resistance and ampacity.

Simulation settings
Small wind turbines and photovoltaic panels are the typical small scale energy generators adopted by prosumers. We randomly associate to each prosumer either a wind or solar generator. Hence, the wind and solar sources are given equal weight in the simulation. The solar source is only available in the daytime but wind is recurrent. This setting provides the possibility of simulating energy exchange in the nighttime.
The Monte Carlo approach is based on running many several simulation instances and processing the statistics of all outputs (Law 2007). Thus, in the first stage, we run the simulation 10,000 times. Meaning that the program simulates 10,000 days and calculates the mean values of the simulation outputs. The simulation randomly selects each day from the four seasons. Hence, the simulation represents the seasonal effects. In the second stage, the number of simulated days is set to 5000. Because the computation time of simulating more than 5000 days is too long to be accepted by the HPC cluster. Each evaluation case runs once in each iteration. In any iteration, t = 1 hour and there are T = 24 time slots.

Results
The results of the simulation are intended to determine the impact of the topology on the efficiency of open peer-to-peer energy market and, what models perform best. First, we consider the various topological models, and then we analyze the effects of parameter tuning for the most promising ones.

Topology comparison
First, we assess the energy loss ratio. That is, the total amount of energy losses in the distribution network divided by the total amount of energy bought by all end-users (Eq. 14). This metric indicates the performance of energy loss reduction for delivering energy in the distribution network. The measured energy losses are based on transferring a given, fixed amount of energy in the evaluated topologies, including the losses of transferring energy from prosumers and from the super agent. The simulation results are shown in Fig. 3, where the Complete Graph, Small-world, Random Graph, and Radial have decreasing energy loss with the increasing number of prosumers. The decrease of performance for these topologies are approximately linear. The energy loss maximally decreases 23%, compared to the baseline, achieved by the Complete Graph when the percentage of the number of prosumers reaches 100%. The Complete Graph performs better than other topology models in all prosumer settings. The Random Graph ranks second. Its performance is less than the performance of the Complete Graph by 4.3% at 24%-prosumer, by 5.7% at 100%-prosumer, and by 6.5% at other two prosumer settings. The performance of the Small-world only has 0.7% less than the performance of the Random Graph at 73%prosumer. Using three different prosumer settings, these two topology models have the same performance. The Radial ranks last. Its performance is less than the performance of the Small-world by 2.9%, 4.3%, 4.3%, and 4.4% at four prosumer settings respectively.
Second, we evaluate the energy costs for end-users which include the cost of buying energy and the cost of transferring energy. The costs are the money paid by the endusers for buying and delivering one Kilowatt-hour on the network (Eq. 15). This metric indicates the performance of energy cost reduction in various topology models. As one can see in Fig. 4, the Complete Graph, Small-world, Random Graph, and Radial have decreasing energy costs with the increasing number of prosumers. The decrease for the topologies are almost linear. The energy cost maximally decreases 8%, compared to the baseline, achieved by the Complete Graph when the prosumer percentage reaches 100%. The Small-world ranks second followed by the Random Graph and the Radial is the last  one. However, with the same prosumer setting, the performances of different topologies have small differences. The performance of the Small-world is less than the performance of the Complete Graph by 0.4% at all prosumer settings. However, it exceeds the performance of the Random Graph by 0.4% at 73%-prosumer and 100%-prosumer. The Random Graph has the same performance as the Small-world at 24%-prosumer and 48%prosumer. The performance of the Radial is less than the performance of the Random Graph by 0.8% for all prosumer settings.
Then, we evaluate the maximum load in the distribution network. The simulation results are shown in Fig. 5, where the Complete Graph, Small-world, Random Graph, and Radial have meaningful reductions compared to the baseline. The Complete Graph performs better than other topologies for all prosumer settings. It achieves the maximum reduction of 96.3% when the prosumer percentage is 100%. The Small-world ranks second. Its performance reaches 88.7% at 100%-prosumer, which is less than the performance of the Complete Graph by 7.6%. The performance of the Random Graph is almost same as the performance of the Small-world. The performance difference between these two topologies is no more than 0.2%. The Radial ranks last. Its performance is less than the performance of the Random Graph by 9.6%, 11.6%, 10.9%, and 9.3% at four prosumer settings respectively. Furthermore, for all topologies, increasing the number of prosumers only has slight influence on the results.
Lastly, we evaluate the average delivery path length for delivering energy and show the simulation results in Fig. 6. As one can see, the performances of four prosumer settings are very close for all topologies. The average delivery path length maximally decreases with a value of 84%, compared to the baseline, achieved by the Complete Graph at all prosumer settings. The Random Graph ranks second. Its maximum reduction for this metric reaches 56.1% at 73%-prosumer and 100%-prosumer, which is less than the performance of the Complete Graph by 27.9%. The Small-world ranks third. It has close performance Page 18 of 26   to the Random Graph. The maximum performance difference between these two topologies is 2.7% at 48%-prosumer and 73%-prosumer. The Radial ranks last. The performance of the Small-world exceeds the performance of the Radial from 23.1% to 30.3% which means a relevant large performance enhancement. The figures provide an overall illustration of the assessment metrics' performance. To show the enhancement clearly, assessment numerical data are also provided. Thus, the reduction percentage compared to the baseline for each metric is calculated, as shown in Table 1. The energy loss ratio, maximum load, energy cost, and average delivery path length maximally decrease of 23%, 96.3%, 8%, and 84%, respectively, with respect to the Complete Graph. The Radial has the bottom performances for all metrics. Comparing the Small-world and Random Graph, they have the same maximum reduction of energy loss ratio which is 17.3%. The Small-world performs better than the Random Graph with respect to energy cost and maximum load achieving the maximum reduction of 7.6% and 88.7%, respectively. However, the Random Graph exceeds the Small-world for the average delivery path length. It achieves the maximum reduction of 56.1%.
In summary, the Complete Graph outperforms the other topologies' . Because it has fullmeshed topology providing edges for all pairs of nodes. But the Complete Graph is only an idealized model because of its high construction and management costs. Considering more practical topologies, both of the Small-world and Random Graph perform well for several metrics. The Small-world stands out in two metrics: the maximum load and the energy costs. The Random Graph stands out in other metrics: average delivery path length and energy loss ratio. The performance of average delivery path length and the maximum load is independent of the number of prosumers. However, the performance of energy loss ratio and energy costs is highly relevant to the number of prosumers.

Parameter influence on random graph and small-world
In the second stage, our aim is to assess the parameter influence on the small-world and random graph models. For the random graph model, all metrics have a similar trend that is shown in Fig. 7. As one can see, the value of the assessment metric decreases with the increase of the average degree. Furthermore, the influence of average degree on the random graph model is non-linear. Thus, the speed of the improvement gets slower while the average degree k increases. This means that the performance of the random graph model improves with the increase of its average degree. But the speed of this improvement attenuates with the increase of the average degree.
For the small-world model, all metrics have a similar shape and trend, as shown in Fig. 8. The performance decreases with the increasing of the "k" and "p" values. This means that the small-world model's performance improves with the increase of its rewiring probability and average degree. Furthermore, the curves on p-axis (x-axis) and k-axis (y-axis) indicate that the influence of the average degree is much more significant than the influence of rewiring probability. The most significant improvement of the performance happens when "k" increases from 4 to 6. After that, the performance improves less with the increase of "k". Especially when k > 8, the speed of performance improvement dramatically reduces. That is, the influence of the average degree on the performance improvement is marginal when k > 8.
The figures provide an indication of overall trends and shapes of the parameter influence on the small-world and the random graph models. Overall, the performance of these two models is highly dependent on their parameters. To clearly compare the performance of these two models on the 100-node network, numerical data of the evaluation are also provided. Thus, we select the values at the same average degree "k" (rewiring probability p = 1.0 for the small-world model) of these two models for each metric, as shown in Tables 2, 3, 4 and 5, for comparison. One notices that the small-world model exceeds the random graph model in most of cases in three metrics, Energy Loss Ratio, Maximum Load, and Average Delivery Path Length. The random graph model has only better performance than the small-world model in the metric Energy Cost. The possible explanation is that the small-world model has enhanced propagation speed (Watts and Strogatz 1998) which makes peer-to-peer energy exchange efficient for large-scale networks. Overall,

Scope and limitations
The main assumption made in the present study is that changing the topology of distribution grids is not only feasible, but advantageous to move from a centralized electricity infrastructure to a distributed, peer-to-peer, decentralized one. The study shows how nodes connected to such future grids could exchange energy and what would be valid strategies to optimize the energy exchanges.
It is important to notice that this is a mathematical, topological study that considers the operation aspects of distribution grids, and not the long term planning. In fact, changing the topology of a distribution grid has relevant costs tied to the necessary laying of cabling and connecting stations. This fact can hinder the broad applicability of the methods proposed here. At the same time, we remark that electric assets have typically a long life (e.g., 50-70 years Willis (2013)) and are usually amortized in decades. In other words, such   (2016), we have made an economic evaluation to describe the economic feasibility to move towards denser topologies starting from existing medium and low voltage grids of the North of the Netherlands. We conclude that investigating alternative distribution topologies has potential and that it is necessary to perform additional studies that include also the planning phase and the amortization costs of the infrastructure in the economy of the operation costs.
Another assumption made is that energy can flow easily from distributed generation to load across the distribution grid and the losses are only due to power line transit. In other terms, we do not consider other possible losses or power quality issues. Technical solutions to make such flow across a distribution grid possible and efficient are assumed to be available. This is a potential treat to the applicability of the presented approach, though it is a highly investigated area and we are optimistic about the feasibility.
Finally, when considering alternative topologies, we assume that all links have the same physical properties, i.e., are the same. This is done to focus on the topological aspects. Furthermore, one could consider these values as averages. Given that distribution grids typically have short links, in the order of magnitude of kilometers, we consider this assumption acceptable for the topological testing. Furthermore, evidence from a previous study done on actual distribution networks, are encouraging in this respect (Pagani and Aiello 2016).

Conclusions
We propose a simulation approach to evaluate the topological effects of the distribution network on peer-to-peer energy exchange and distributed energy generation. The model and solution of optimizing peer-to-peer energy exchange come from our previous work (Sha and Aiello 2016) and is here used to evaluate several topological models under varying distributed energy generation and load conditions. The evaluation is on the basis of Monte Carlo simulation. We apply various statistical distributions to simulate renewable  energy generation, energy consumption of end-users, and real-time prices. For the evaluation, we design four assessment metrics that are: energy loss ratio in the distribution network, energy cost for end-users, maximum load in electric lines, and average delivery path length of energy delivery. We started with a 37-node radial network. Then, we moved onto more topological refined models. The random graph model can reduce the average delivery path length when transferring energy from providers to consumers, and energy losses of delivery with respect to other models. On the other hand, the small-world model has higher efficiency than other models in reducing the maximum power load in the distribution network and the cost of obtaining energy by the end-users. The second stage tested on 100-node networks shows that the small-world model outperforms the random graph model in the large-scale network. In addition, the most significant performance enhancement of the small-world model happens when the average degree k ≤ 8. Thus, the small-world model with k ∈[ 4, 8] is a better choice when we consider the balance between performance and saving on infrastructural costs. This result is in line with the outcomes of our previous work (Pagani and Aiello 2014).
From a practical point of view, the small-world model appears to have advantages over other models since it can provide a good balance between energy distribution efficiency and the cost of network construction. For the distribution network with dozens of endusers, the small-world model can provide better performance than the random graph model as it requires lower infrastructural/construction costs. For the larger network, since the construction cost of distribution infrastructure rises with the increase of the network scale, the small-world model has a larger advantage over other topology models from an economic perspective. In addition, the small-world model performs better with the higher ratio of prosumers to end-users in the distribution network. Considering the increasing social and economic appeal of becoming a prosumer, the small-world model appears to be a valid design model for energy distribution networks. Such a result confirms the results of our previous work using other metrics and simulations (Pagani and Aiello 2014). The present work provides the foundation for a decision support system for analysis and high level planning of the distribution network towards managing distributed energy generation and peer-to-peer energy exchange.
Additional technical challenges need to be addressed in order to implement the peerto-peer energy exchange and distributed energy generation in the envisioned smart grid. Firstly, ICT-related systems should be designed for the Smart Grid, which enable endusers to share the trading information such as the data of energy providers, consumers and prices. Secondly, more accurate approaches should be developed to forecast energy production and consumption for end-users. Finally, more precise costs of renewable energy generation should be estimated, in turn to enable good real-time energy prices forecasts.
To gain further insights on the attractive models of future Smart Grids, we plan to consider the buffering effects of having distributed energy storage systems, such as home batteries and electric vehicles. This entails the addition to the model of optimization strategies for charge/discharge cycles. With distributed energy storage systems, prosumers are enabled to decide whether the surplus energy should be sold to the end-users for an immediate profit or stored for later self-usage with some level of efficiency of storage.
Considering the voltage problem caused by the distributed energy generation, more advanced the reactive power and voltage control as ancillary services should be developed and applied for the distribution network. Moreover, the influence of distributed energy storage systems on the voltage problem and reactive power control should be investigated.