Comparative Analysis of P2P Architectures for Energy Trading and Sharing

: Rising awareness and emergence of smart technologies have inspired new thinking in energy system management. Whilst integration of distributed energy resources in micro-grids (MGs) has become the technique of choice for consumers to generate their energy, it also provides a unique opportunity to explore energy trading and sharing amongst them. This paper investigates peer-to-peer (P2P) communication architectures for prosumers’ energy trading and sharing. The performances of common P2P protocols are evaluated under the stringent communication requirements of energy networks deﬁned in IEEE 1547.3-2007. Simulation results show that the structured P2P protocol exhibits a reliability of 99.997% in peer discovery and message delivery whilst the unstructured P2P protocol yields 98%, both of which are consistent with the requirements of MG applications. These two architectures exhibit high scalability with a latency of 0.5 s at a relatively low bandwidth consumption, thus, showing promising potential in their adoption for prosumer to prosumer communication.


Introduction
Since the late 19th century the electric grid has been a centralised infrastructure.The traditional grid delivers energy, from the generators through the transmission and distribution domains, to the end users.Thus, energy can typically traverse long distances before reaching the consumer.Furthermore, this traditional grid only supports unidirectional flow of energy, and is prone to disruption due to single point of failure (SPoF) and high voltage/current losses.This basic structure remained unchanged for over a century [1].
As with other sectors, the emergence of smart technologies is uncovering new possibilities in the energy industry.For example, with embedded communication infrastructure for monitoring and control, distributed energy resources (DERs) can be integrated to deliver energy to the grid and transform it to a bidirectional energy highway.However, the connection/disconnection of DERs must be coordinated in order to maintain system integrity and seamless operation.A reliable communication system is needed to realise the exchange of monitoring and to control messages [2].
With continuous improvements in technology and reducing costs of DER components, on-site energy generation is becoming more popular with energy consumers [3].This consumer-domain production facility is termed a micro-grid (MG): a small-scale power network with capability to provide electricity to a small community or households using its own energy resources [4].The energy resources may be renewable, e.g., photovoltaic (PV) array, wind turbine, etc., or non-renewable, e.g., CHP (combined heat and power).A MG can act as an energy producer as well as consumer, often referred to as a prosumer [5].At production peak period, when more energy is produced than is needed, a prosumer can trade or share the excess energy with neighboring prosumers.Such prosumer characteristics have potential benefits including increased reliability of the main grid, reduced impact of generation activities on the environment, reduction in electricity costs, e.g., service charges by utility company, and active participation of prosumers in growing the economy [6].To realize these benefits, bidirectional communication is required in a prosumer-to-prosumer interaction without going through a central entity.This is because a central entity could alter the electricity price for its own gain [7], as well as introduce unnecessary communication delay between peers.In addition, due to the increase of DER components and prosumers, communication infrastructure plays a critical role in smart MG (SMG) [8].The communication infrastructure must have the capability for real-time monitoring and control and must support an increasing amount of numerous service requests and data traffic from all the MG components, prosumers and energy providers [8].The move towards the future SMG requires developing distributed communication infrastructure including architecture, technologies and protocols to accommodate all these complexities.Recent efforts in the literature [9][10][11][12] suggest the use of peer-to-peer (P2P) communication networks as communication systems in energy networks, where high efficiency, dynamicity and flexibility are needed.The IEEE 1547.3-2007defined performance metrics for communication networks for integrating DER/MG applications into power networks.However, [9][10][11][12] only proposed or suggested the use of P2P networks for MG distributed communication and control without assessing their suitability with the communication standard.Therefore, to explore such P2P interactions with energy network, this work investigates the adaptability of P2P communication architectures for MGs and P2P Energy Trading and Sharing (P2P-ETS).
P2P communication architecture has been widely researched and used in several applications, such as media streaming [13], mobile networks [14] and social networks [15,16].This is because of its capability to store and retrieve information without a central entity.P2P systems are self-organized and distributed in nature.These characteristics are required in prosumer communication due to their highly-decentralized nature.The major requirement of P2P communication in this context is the discovery of peers/prosumers and information/energy exchange within the network [17].Efficient communication will allow collaboration among prosumers so that energy produced by one can be utilized by another in the network.Multiple P2P communication architectures exist in the literature including structured, unstructured and hybrid [9,18].The ultimate choice of DER network architecture has to fulfill the performance requirements recommended by the IEEE 1547.3-2007 for the integration of DER/MG.These requirements include latency, throughput, reliability and security [19].
This study employs a P2P-ETS network which consists of independent distributed peers cooperating to share information and resources [15,20].The P2P-ETS network exists as an overlay network connected by virtual links on top of the physical MG networks/topologies.An overlay network is a virtual or logical network, formed by distributed links built over an existing power network, using the standard network design paradigm, such as the TCP/IP.In P2P-ETS networks, each peer acts as a client and server and can directly communicate with other peers without requiring an intermediary entity.This implies that the network continues to deliver energy even when few peers cease to generate energy [21].
Although several works have investigated P2P models for other applications, e.g., [13][14][15][16], they have only provided general overviews of various P2P models for power networks [9].None of them involved simulations or numerical methods to compare these models.Very recently, reference [22] proposed the use of a structured P2P network, in particular a Chord protocol [23] was implemented.However, this decision was based on the general properties of both the structured and unstructured network without considering individual protocols.For instance, a review presented in [24] showed that inactivity period of peers result in high overhead and performance degradation in Chord protocol compared with Kademlia [25] that is more robust through redundancy for fault or failure of peers.In addition, considering the unstructured protocol Gia [26], a topology adaptation algorithm implemented makes the network more robust in high churn rates (connection and disconnection of peers) [24].Gia is an improved version of the broadcasting techniques that considers peers' capacity before broadcasting information to the peers, thus significantly reducing the consumption of network bandwidth.Therefore, to the best of our knowledge, detailed performances of the various P2P models and protocols in power networks are yet to be investigated.
The contributions of this work can be summarized as follows: 1. Performance analysis of the structured and unstructured P2P architectural models for P2P-ETS.
A structured and unstructured P2P model has not been studied before for P2P-ETS aside from [9], which presented a general overview of the P2P model for power networks.2. Specific protocols such as Kademlia and Gia have improved performance than other protocols [24], and are therefore studied.A comparative analysis is used to determine their suitability for P2P-ETS networks in various transactive use-cases.3. The selected protocols are compared using the performance metrics of the communication requirements for DER/MG applications.No previous work compared the performance of the selected structured (Kademlia) and unstructured (Gia) P2P protocols for energy networks, specifically in ETS.
To integrate available concepts with our ETS proposal, we adopted the IEEE 1547.3-2007 for DER/MG requirements as guidelines for performance analysis.The performance analysis of the selected protocols is carried out using OMNET++, specifically, Oversim [27], which is an overlay P2P network simulator.More elaborate discussion on the methodology is given in Section 5.
The rest of this paper is organised as follows.Related work is presented in Section 2. Section 3 discusses MG applications and its communication requirements.Section 4 presents the P2P architecture with focus on structured and unstructured protocols.Experimental results analysis is discussed in Section 6.Finally, Section 7 draws conclusions and identifies potential future work directions.

Related Work
As the move towards decentralization of the energy network continues, so does challenges in managing all the independent subsystems increases.Since the smart-grid has to deal with input from numerous distributed, small and heavily fluctuating energy producers, the use of distributed scheduling, control and monitoring of the system would be more effective than management based on a central entity that is subject to SPoF [28].For instance, study [7] proposed an optimal energy management solution in SMGs using a centralized architecture, where the central entity inflated the trading price in-order to gain from the transaction.Moreover, a fault at the central entity could collapse the whole system.This and other disadvantages imply that traditional planning methods and tools require transformation into adaptive and distributed control [29].
In view of this, the literature review is conducted on distributed energy management and control in MG according to the systematic review provided in [30][31][32] using two academic databases: Scopus and Web of Science, spanning through the years 2007 to 2017.It was discovered that increasing efforts are being made in the literature to propose different distributed energy management and control schemes for MG in order to increase the system efficiency.Ref. [33] presented a technical review on MG energy management and control, while study [34] reviewed some of the controllable load management approaches in a smart grid.From the review conducted, communication is seen as one of the enablers of MG management and control, as it routes information among MG subsystems.One of the ways communication and control among MG is modeled in the literature is through multi-agent system (MAS) [35], which has the following limitations on efficient and optimal management of SMG [35,36]: (1) agents do not really have decision capabilities resulting in less proactive interactions; (2) although distribution of components exist, there is little decentralization among the agents; and (3) agent cannot simultaneously communicate with other agents.Agents interaction is a client-server approach resulting in a lack of agent proactivity.For instance, an agent cannot communicate its fault to the network directly until another agent communicates with it.This results in poor MG critical resource management; as well as (4) self-healing capabilities and dynamic reorganization is neither present nor active within the agents themselves.This functionality prevent the agents to adapt to communication failures, MG blackouts, agent and local-failures.However, to overcome these limitations, study [35] proposed applying P2P philosophy amongst other things to realize cooperation between control elements.Similarly, the authors of [37] advocate that P2P communication and agent-based control would provide a powerful combination towards robust and dependable smart power grid.Thus, P2P communication is now being investigated for distributed energy network management and control.
In study [20], a comprehensive review on resource discovery techniques in P2P networks is presented.Their discussion spans through the different P2P communication architectures including structured, unstructured, super-peer and hybrid architectures.Furthermore, study [14] performed a comparative analysis of structured P2P overlay network.In particular, Kademlia, Pastry, Chord, Broose and EpiChord protocols were selected for their analysis.Their results indicated that Kademlia is one of the best protocol for structured network.However, their study does not cover unstructured or hybrid P2P architecture.P2P communication is emerging as a way to enforce distributed control as well as bidirectional communication in smart MG [10].It provides an opportunity for a flexible and robust logical communication.Study [10] proposed the use of P2P communications in energy networks to allow prosumers to easily buy or sell energy.The authors further proposed a decentralized unstructured P2P model for a hydrogen energy network.More recently, a decentralized communication architecture with a P2P lookup algorithm, Chord, is presented in [22] for monitoring and control of MGs.Experimental results show that their proposed communication architecture reduced the number of lookup messages and end-to-end message delivery delay.
There have been many other efforts in the literature in analyzing P2P architecture for energy networks and distribution, e.g., [9,11,12,22,[37][38][39].However, many of these studies have common limitations, including: (1) focus on the theoretical background of P2P architectures without any numerical analysis, e.g., [9,11,39]; (2) studies are constrained to structured techniques with little or no attention to the pervasive unstructured techniques, e.g., [14,22]; and (3) that the performance of the communication network is rarely examined by MG papers but it becomes a crucial component for new SMG implementation.
In summary, modern and future energy networks will be managed using communication networks, not just from theoretical point of view, but also from analytical endpoint for multiple distributed systems.P2P are proven to be a suitable architecture for distributed control of these subsystems.Thus, this paper set out to investigate the structured and unstructured communication architectures, hence, advancing the literature by providing a new insight to structured and unstructured architecture from both theoretical and analytical point of view.Furthermore, it presents an analyses of the two architectures for energy network and evaluates their performance according to the communication requirements of energy networks defined in the IEEE 1547.3-2007 for MG/DER.Table 1 presents a summary of the literature reviewed.

Micro-Grid Applications
In P2P networks, communities of peers, namely prosumers, are enabled to cooperate in order to share information about energy demand and supply.Being run over a P2P network, MG can operate without a central control and any fault at its subsystem/applications should not result in the collapse of the whole infrastructure.This would enable easy replacement of any of its subsystem without altering the control module [39].To investigate the operation of P2P energy trading and sharing, it is necessary to start from the MG level by deriving the characteristics of MG subsystems/applications.If this P2P communication architecture fulfills the requirements characterization of the selected MG applications, then the P2P communication architecture would easily be integrated into prosumers trading and sharing energy in P2P mode.
Efficient communication in MG applications is as vital as communication between prosumers trading and sharing energy.Energy data generated by each application is required to be communicated to the appropriate endpoint, at the required time via bidirectional communication to locate fault on-time and for maximum efficiency of the whole system.There are three levels of bidirectional communication in a typical MG.One is that of the infrastructure for energy production and usage (DERs, loads), second is the MG control center, which controls all the application components, and third is that of the MG communicating with other MGs in the neighborhood.This communication hierarchy is depicted in Figure 1.Thus, it would be necessary to assess the characteristics of the MG applications in order to evaluate the adaptability of P2P communication architectures for controlling all applications and eventually for prosumers sharing and trading energy in P2P mode.In view of the preceding paragraphs, the following MG applications are examined for their diverse network requirements;

•
Smart metering: The metering hardware is located at the Customer Premises Network (CPN) and used to measure and record customer energy consumption.The measured quantities are sent either on-demand or periodically to the utility grid for billing purposes and grid management.
It is also used to measure power flow from DERs, MGs and storage systems [40,41].EVs interact with the grid in two modes: Vehicle-to-Grid (V2G), and Grid-to-Vehicle (G2V).Depleted batteries of the EVs are charged in G2V mode, and the EVs supply energy to the grid through its charged batteries in V2G mode [43,44].The charging time is one of the major issues with EV charging, as well as the deterioration of battery life with the number of charging cycles [45].Thus, research [45] suggests that charging the EV battery with constant current and voltage could reduce the EV charging time by 16% and extend battery life by 10%.

•
DER and Storage: DER from renewable sources can be located at the customer premises as well as at the utility network.These sources complement energy generation from the power grid by smoothing out power fluctuations.The storage system is required to retain excess generated energy in the event of surplus, and in order to power the connected loads in the event of deficit.Also, energy storage systems can be used to increase system reliability.

•
Asset Management: This is an application designed to ensure quality of service for customers at a minimum cost.It offers integrated management, optimization of the work order process, automation and scheduling processes.Some of the key indicators that can be balanced by asset management includes the assets, system performance, maintenance cost, failure risks and reliability through the use of a communication infrastructure [44].

•
Meter Data Management: Increase in metering data due to the two-way communication between the customer premises and the utility company, which makes meter data management a critical application to consider.Meter data management system has the responsibility to collect, store, analyze and process the data for appropriate pricing/billing, demand response, better customer experience and energy consumption management services.Meter data management systems have the capability to manage other meter types including electric, heat, and gas, by turning it on and off and transmitting data when appropriate [44].

Micro-grid Communication Requirements
To design an efficient communication infrastructure for a MG system, it is necessary to identify the specific application requirements that the communication infrastructure must satisfy.The IEEE 1547.3-2007 standard defines four performance metrics for DER integration into the power grid, which characterize their communication network performance.Table 2 shows the various MG applications and communication requirements [40,42,46,47].These performance metrics and their implications on MG applications are described briefly below:

•
Latency: This is a measure of time delay interval between transmission and delivery of a message and is designed in seconds.Latency requirements imply the acceptable window of delay associated with data flow from a sending peer to a receiving peer for each energy network application [40].Latency is a critical factor to consider while designing a communication architecture.Moreover, in energy network applications, energy information exchanges between subsystems have tight deadlines and thus require prompt transmission.Therefore, a communication network for transferring energy related messages should aim to meet latency requirements.

•
Reliability: This is important to ascertain prompt energy distribution and to ensure that energy will be made available when it is required.Therefore, the communication network must ensure that a message will reach its recipient or target peer as intended and without losses.In P2P-ETS networks, unreliable communication among peers can be caused by a number of factors including link/node failure, routing inefficiency, high churn rate of peers, inadequate communication infrastructure, etc.All these possible causes should be considered in selecting or designing a communication architecture for energy networks.In addition, different applications require different levels of reliability, thus communication systems should provide flexibility in the choice of reliability based on the application.

•
Throughput: It is a measure of the amount of data that can pass through a communication channel continuously, which is expressed in bits per seconds.With the increase in the amount of data generated from energy network applications, the choice of P2P communication architectures should be able to accommodate these increasing bandwidth applications to ensure low transmission delays, reduce packet losses and ensure prompt peer discovery and message delivery.

•
Security: A secured communication system is needed to ensure that the P2P-ETS network is only accessible to authorized personnel, system data is not compromised and that it is always available when needed.As a MG is a critical infrastructure requiring stringent resilience to cyber-attacks, prosumers' data privacy is to be ensured at all times.Thus, communication systems must provide assurance that energy assets and the P2P-ETS network are protected from cyber-attacks, customers' data are protected from unauthorised access and that the communication system is robust against network attacks.Although the IEEE 1547.3-2007outlines the above metrics for assessing communication performance in smart grids, investigation and detailed analysis of communication security are outside the scope of this study.

Peer-to-Peer Architectures for MGs
A P2P approach to energy trading and sharing would promote energy availability in the community, increases efficiency, flexibility and effectiveness of local resources.In view of these benefits, some pilot projects has begun, such as Piclo in the UK, Vandebron in the Netherlands and SonnenCommunity in Germany, etc. [48].This P2P pilot projects would inform network planners on how best to organize or arrange the network subsystem for maximum communication efficiency.
P2P architectures are mainly classified according to how information is routed within the network and how peers are organized.Thus, in terms of information routing, P2P networks can be based on a centralized or a decentralized information routing/file indexing architecture.This implies that in centralized information indexing, a requesting peer query a particular central entity that stores the index of all the resources for information (or IP address) of other peers holding a particular resource.The requesting peer receives the information of the peer holding the resource and direct communication is established between both peers without going through the central entity [20].Whereas, in decentralized file indexing, both information query and communication is routed directly amongst the peers in the network.
Furthermore, in terms of peers' organization in the network, the P2P network architecture can be classified as a structured or an unstructured architecture [9,18].There exists a third class, namely the hybrid architecture, which combines the functionalities of structured and unstructured architectures [9].

Structured Model
Structured models organize peers into a specific structure.Each peer has a randomly assigned ID with a logical list of neighbors.Each message has an ID tag stored in a specified peer.The structured topologies are usually constructed using Distributed Hash Tables (DHT) techniques [20], used to direct searches within the network to specific peers holding the requested resources.Due to the use of DHT, structured networks have efficient message routing, but suffer from high maintenance overhead.To discover peers in structured overlays, a specific graph structure O(log N ) (order of log N ) messages are used, where N represents the number of peers in the overlay [49].Examples of structured P2P protocol models include Chord [23] and Kademlia [25].
Structured models are theoretically viable for energy networks, as information search within the network are quick and efficient.Using DHT reduces the hop distance between prosumers, thus latency between prosumers is reduced.Moreover, information lookup is not based on best effort, so information delivery and communicating with the right prosumer when needed are guaranteed.However, because of the deterministic and structured architecture, they are prone to attack, and prosumers' data privacy might be vulnerable.

Unstructured Model
In an unstructured model, peers randomly establish connections with each other without any particular form.The organization of a P2P network overlay is random, where an indirect link is established between all peers.This arrangement theoretically enables access to all data in the network by all nodes without requiring a centralized node for data lookup.Unstructured protocols in P2P eliminate the SPoF problem [47].Peer positions in unstructured network architectures are usually determined by bootstrapping/network flooding [50].A query sent does not have a guarantee to return any results, but it employs maximum effort to return one.Examples of P2P protocols for unstructured architectures are Gia [26] and Gnutella [50].
In an unstructured overlay model, there is no central controller and all peers are connected to exchange information.All prosumer communication about energy demand, availability, distance, price, and tariff take place in a P2P fashion.This model results in high performance and reduces latency since the prosumers communicate directly with one another.Moreover, the network is scalable, as the addition of extra prosumers cannot deter the performance of the system.The SPoF issue is addressed also, for instance, a peer failure can not affect information exchange among other peers in the network.However, with this model, prosumer energy profile is not coherent, since there is no monitoring server as a trusted entity between the peers.In addition, prosumers' actions are not coordinated, as they can leave or join the network at will, resulting in network fluctuation.Finally, a malicious prosumer can join the network at will, infiltrating other prosumers privacy.Table 3 shows a comparison of the two protocols.

Simulation Model
In this study, OverSim, an overlay P2P network simulator that exists in the OMNET++ environment is used [27].OverSim is a discrete event simulator that allows users to define a specific event and terminate the simulation based on the occurrence of that event.It can be applied to both the wireless environment and the structured and unstructured overlay network.The simulation platform can be divided into three layers: Underlay, Overlay and Application.Underlay refers to the lower layer network, it consists of three kinds of network modules: Simple, SingleHost and INET.INET framework is the underlay network used in our simulation, because it has implemented the IEEE 802.11 b protocol for the wireless environment.The underlay parameters are given in Table 4.Among the structured P2P protocols, Kademlia [25] has been shown as the most robust protocol for mobile networks [14] and for pervasive environment in terms of lookup, dynamicity, churn, security and queries [24].In this study, we investigate the use of Gia (an unstructured P2P protocol) [26] in comparison with Kademlia (a structured P2P protocol), both for energy networks.
Extensive research has been done in [14] that compares the various structured P2P protocols including Kademlia.The study analyzed the success ratio and bandwidth consumption for different Kademlia parameters using different values, the protocol specific simulation parameters are similar to the ones used in [14], which are presented in Table 5.In addition, study [22] developed a MG communication protocol based on Chord P2P protocol for transmitting data among peers.The implemented MG communication packet structure is similar to Figure 2 with a variable message length between 0 byte-65 KB depending on the type of message implemented.
Table 5. Simulation parameters related to the specific protocols being analyzed [14,22].MG: micro-grid.To integrate available concepts with our proposal, we adopted the IEEE 1547.3-2007 for DER/MG requirements as guidelines for our performance analysis.The results analysed including peer discovery and message delivery using latency, bandwidth cost and reliability as performance metrics.The results of the performance metrics are then discussed against Table 2 given in Section 3.

Result Analysis and Discussion
In this section, we describe the results realized from the simulation of Kademlia and Gia P2P protocols.From the results, it was observed that with fewer number of nodes (for instance 25 and 50 nodes), there was no significant difference in their results.Due to this observation, and to check the scalability of the P2P communication architecture, an instance of 100 and 1000 nodes are used for the analysis.These results are analyzed comparatively, Kademlia (Kad) against Gia (Gia), in all representative examples using different performance metrics.These include the following: 6.1.Peers Discovery/ Lookup Mechanism: • Hop Count/Latency: This is delay estimates or hop-count of the number of peers traversed to discover a peer in the network.To discover peers in structured overlays, a specific graph structure O(log N ) messages are used where N represents the number of peers in the overlay network.In addition, to discover peers in unstructured network, Gia uses one hop replication approach, where each peer maintains a key list of its neighbors.Thus, a peer that receives a lookup query can actively respond by giving matches to the request.Figure 3 shows the average hop count for both (Kademlia and Gia) protocols.From the results, we observed that the average hop count for Gia is 0 for 100 peers and 1 for 1000 peers.However, with Kademlia, average hop count for 100 peers is 2, while for 1000 peers it is 3.This implies that unstructured protocols can discover a resource faster using fewer peers than structured protocols.• Network bandwidth: This is the bandwidth overhead used to maintain the network, locate peers and route information to peers.As we showed in Table 2, the throughput requirements for energy networks vary per application, with most in the range of 9.6 to 56 kbps.The total network bandwidth comprises of individual peer bandwidth cost and network maintenance bandwidth cost.In Figure 4, it can be observed that Kademlia consumes higher total network bandwidth compared to Gia.This is because of the structured nature of Kademlia.Kademlia uses excess bandwidth to maintain the network, see Figure 5, which results in higher bandwidth cost as the network grows.On the other hand, Gia uses biased random walk for query search, resulting in less total network bandwidth utilization because no additional overhead is required to maintain the network.Specifically, to further analyze the performances of the two protocols with increasing number of peers in terms of the number of events and messages created, the protocols were observed at different time stamp.An instance of 1200 s, 2400 s and 3600 s were observed with varying number of prosumers from 25 to 1000. it was observed that the total number of messages, see Figure 6, and events, see Figure 7, created are more for Kademlia (thus consuming more bandwdith) than Gia; this is because Gia uses high capacity peers to direct searches in a growing network.• Reliability: For energy networks, reliability is a function of efficient information routing among peers and efficient energy delivery.It is affected by number of dropped messages in the network.Communication architecture for energy network applications requires high reliability (for example, >99%).From Figure 8, the number of dropped bytes in Kademlia in peer lookup is approximately 0, thus satisfying the reliability requirement of MG as tabulated in Table 2.This implies that a structured network ensures that it locates any requested peers in the network at the cost of higher latency.In energy transaction, this suggests the ability of a Kademlia-supported network to ensure full peer energy price history/presence ensuring no waste of money by transacting peers.
Conversely, an unstructured protocol uses best efforts to locate a peer and deliver a message.However, once a peer cannot be located, the message is dropped as seen in Figure 8. Also, it was observed that increasing the number of peers in the network does not affect performance of Kademlia P2P protocol.However, increasing the number of peers in the unstructured network (using Gia) initially increases the drop rate of messages, but decreases as the activity period increases.Interestingly, after an activity period of 2400 s, it can be observed that with 100 peers in an unstructured network, the number of dropped messages started to increase.This is due to the churn rate of peers, which implies that messages are not being delivered because the peers have left the network or are not active.

Message Delivery/Message Routing
• Latency: Communication requirements for an energy network have tight delay requirements with most applications ranging from 300 ms to <1 min (see Table 2).From Figure 10, with 100 peers, Gia latency increases as the activity period increases, but with 1000 peers, the latency drops to 0.1 s over the activity period.Gia uses high capacity peers to route traffic in the network; this property is well suited for greater numbers of peers as is the case for 1000 peers as reflected in the results.However, with Kademlia, because of the structured approach to routing in the network, the latency remains below 0.5 s for both 100 and 1000 peers and decreases as the activity period increases.Thus, Kademlia would deliver messages across an energy network more rapidly than the unstructured Gia protocol.It was also observed that both protocols latency in message delivery is below 2 s, which is within the acceptable range of MG energy applications.• Peers' bandwidth overhead: This is the bandwidth overhead used by a specific peer in the network to deliver a message.It includes the peer-generated traffic such as query requests and replies.Figure 9 shows the bandwidth cost for incoming query messages received by each peer in the network.Figure 10 shows the bandwidth overhead for sending out replies to other peers in the network.Over the activity period, peers implementing Gia protocol has the higher individual bandwidth cost compared to peers implementing Kademlia protocol.The bandwidth cost of Gia fluctuates over the activity period as a result of peers joining and leaving the network.The average bandwidth overhead for each peer in Gia protocol is 20 bytes/s for an instance of 1000 peers and an average of 15 bytes/s for an instance with 100 peers.However, structured protocols have small demands on individual overhead.Kademlia has overhead cost of about 2 bytes/s for both 100 and 1000 peers.The structured approach to message delivery does not flood the peers with excessive overhead, thus saving a significant amount of peers' bandwidth overhead.• Reliability: Efficient communication between energy subsystems require high reliability of ≥98% (see Table 2) for prompt dissemination of messages.To analyze the performances of the two protocols with increasing number of peers in terms communication reliability, the protocols were observed at different time stamp.An instance of 1200 s, 2400 s and 3600 s were observed with varying number of prosumers from 25 to 1000.Message delivery ratio for Kademlia as seen in Figure 11 is an average of 99.96%, thus agreeing with the MG requirements listed in Table 2.This reliability scales well even with increasing numbers of peers and activity period.Gia reliability is a measure of its satisfaction level, which is an assessment of the number of neighbors a peer has and if they are sufficient to satisfy its file requests, satisfaction level increase from zero to one signifies that the requirement is fully satisfied.Gia reliability is low for lower numbers of peers (0-200) peers but increases with more peers in the network to an average of 98%.This is because the greater the number of peers in a network, the greater the certainty of a message being delivered.

Implication of P2P Networks in Energy Network
As discussed in Section 3, an efficient communication in MG applications is as vital as communication between prosumers trading and sharing energy.Thus, adapting P2P communication architecture for distributed MG applications is considered to overcome the limitations posed by MAS.However, to verify the suitability of the overlay architecture for energy network applications, some communication requirements applicable to integrating communication architecture to energy network have to be considered.These requirements are latency, throughput and reliability.From the results presented, P2P architecture shows promising potential in its adoption for DER/MG applications.
Latency is a critical factor to consider in developing a communication architecture for MG.Each MG application has a stringent latency requirement as presented in Table 2, with most applications within the range of 300 ms to 2 s.This is because data communication spans different levels in a typical MG, and each subsystem should update its data and transmit it at the required time to the receiving entity.Furthermore, this characteristic could be beneficial in early detection of fault in energy subsystem.From the results, P2P architectures exhibit low latency even with high number of peers, it shows that P2P networks if adapted for energy network would reduce communication delay amongst subsystem modules and subsequently in ETS.
Rise in the use of different interconnected things including MG components aggravate bandwidth consumption.Moreover, the amount of data generated from these numerous components, for instance, smart meter data are enormous.As a result, the choice of communication architecture should be very robust to support the increase in amount of generated data for efficient data throughput.Throughput requirements for MG applications range from 4.8 to 144 kbps depending on the application.If the communication architecture supports high throughput, then, the communication architecture would be efficient in providing prompt transmission of messages when required.From the results, P2P networks demonstrated relatively low bandwidth consumption thus supporting high number of simultaneous communications from the numerous connected peers; as high as 1000 peers.This characteristic showed great potential in its adoption for high scalability network offering high message throughput.
Reliability for communication architecture for MG applications range from 98% to 99.9%.This implies that the reliability of each subsystem in a MG is a critical factor to consider.If a subsystem fails without a backup system, the whole system could collapse.Whereas, with P2P network, a fault at a peer could be compensated by another peer so as not to collapse the whole system.In addition, from the results presented, P2P architectures exhibit high communication reliability, thereby communicating fault prompting when required.This characteristic makes it very suitable for MG applications.In terms of energy trading and sharing, this implies that the network continues to deliver energy even when a few peers cease to generate energy.
Finally, the results from both structured and unstructured P2P architecture performances evaluated against communication performance requirements for DER are very promising.However, a trade-off exists in both architectures.Structured P2P architecture is well-suited for communication instance requiring high communication reliability with confidence of message delivery and little delay of ≤0.5 s.On the other hand, unstructured P2P is well suited for communication instance requiring minimal latency, efficient scalability and reduced total network bandwidth.

Conclusions
In this study, we have evaluated the suitability of different P2P protocols for possible adaptation into P2P-ETS networks.An exemplar of a structured P2P protocol (Kademlia) was evaluated alongside the unstructured P2P protocol (Gia).Kademlia preserves bandwidth, uses asynchronous queries to avoid timeout delays from disconnected peers and routes queries via low-latency paths.On the other hand, Gia has improved scalability designs using a biased random walk.Gia protocol consumes less network bandwidth and is able to resolve file lookups using minimal latency as compared to Kademlia.The scalability of both architectures indicated that they could operate efficiently with increasing number of peers with unstructured performing better in peers discovery using one or two hops, and structured performing better in message delivery with 99.997% reliability.Given the standards for operating DER/MG energy networks, the evaluation results showed the potential of both P2P protocol architectures in energy networks namely P2P prosumer energy trading and sharing.The results obtained are however consistent with the reliability, scalability, latency and bandwidth requirements of the DER/MG networks.

Figure 3 .
Figure 3. Number of peers transversed to discover a resource in the network.

Figure 4 .
Figure 4. Performance comparison of total bandwidth cost of the network expended by Kademlia and Gia P2P protocols.

Figure 5 .Figure 6 .
Figure 5. Performance comparison of bandwidth cost to maintain a typical P2P network using structured (Kademlia) and unstructured (Gia) P2P communication protocols.

Figure 7 .
Figure 7. Number of events created as the activity period and number of prosumers increases.

Figure 8 .
Figure 8.Comparison of the number of dropped messages by each protocol during peer Lookup.

Figure 9 .
Figure 9. Evaluation of the amount of bandwidth overhead received by each peer when using Kademlia compared to when using Gia P2P protocols.

Figure 10 .Figure 11 .
Figure 10.Comparison of the bandwidth overhead forwarded by each peer using Kademlia and Gia P2P protocols.

Table 1 .
Review on P2P Architecture for Energy Network.P2P: peer-to-peer.

•
[40,42]ergy Management System (HEMS): This consists of smart meters and customer appliances that monitor and control home devices to optimize local power production, consumption or storage.It manages energy generation devices, energy storage and energy consumption for the household in order to optimize energy efficiency.•DemandResponse(DR):Itoperateswithin the CPN to interact with the service providers.DR is used to manage the energy delivered to consumers.It is designed to influence the energy consumption patterns of a customer by offering a range of programs including dynamic pricing.DR programs could also be incentive-based, direct load curtailment (e.g., direct load control), demand bidding and buyback, and emergency demand reduction or price-based programs.Examples of price based DR programs include Time-of-Use (TOU), Critical Peak Pricing (CPP), Real-Time Pricing (RTP) and Inclining Block Rate (IBR)[40,42].•ElectricVehicle (EV) charging: This has the capability for storage using its rechargeable battery pack to operate the vehicle's electric motors.EVs are also examples of distributed storage systems that supply the customer premises grid with power through their charged batteries.