Distributed Adaptive Primal Algorithm for P2P-ETS over Unreliable Communication Links

: Algorithms for distributed coordination and control are increasingly being used in smart grid applications including peer-to-peer energy trading and sharing to improve reliability and efﬁciency of the power system. However, for realistic deployment of these algorithms, their designs should take into account the suboptimal conditions of the communication network, in particular the communication links that connect the energy trading entities in the energy network. This study proposes a distributed adaptive primal (DAP) routing algorithm to facilitate communication and coordination among proactive prosumers in an energy network over imperfect communication links. The proposed technique employs a multi-commodity ﬂow optimization scheme in its formulation with the objective to minimize both the communication delay and loss of energy transactional messages due to suboptimal network conditions. Taking into account realistic constraints relating to network delay and communication link capacity between the peers, the DAP routing algorithm is used to evaluate network performance using various ﬁgures of merit such as probability of signal loss, message delay, congestion and different network topologies. Further, we address the link communication delay problem by redirecting trafﬁc from congested links to less utilized ones. The results show that the proposed routing algorithm is robust to packet loss on the communication links with a 20% reduction in delay compared with hop-by-hop adaptive link state routing algorithm.


Introduction
The integration of independent and distributed energy resources (DER) into the energy grid has brought new challenges in energy coordination and control [1,2].Energy producers who also consume (or prosumers) mostly rely on renewable sources which are intermittent in nature.This introduces challenges to the conventional plants which need to ramp up quickly when renewable contribution falls below an acceptable level.In peer-to-peer energy trading and sharing (P2P-ETS), this also means unpredictable generation capacity which can destabilize the network.Effective energy coordination and control could alleviate these challenges and realize a more stable and reliable energy grid [3].Some centralized approaches have been discussed in the literature, for instance, [4,5], that require a single component to assess the whole system and make decisions for other peers in the network.Centralized approaches may be subject to single point of failure, high overhead cost, non-proactive measures in the presence of fault or general performance limitations like limited flexibility and scalability [6][7][8].To overcome these challenges, recent efforts have been diverted to distributed energy coordination [9,10].The prosumers may be grouped into virtual clusters or virtual microgrids (VMGs) for better management with the potential of increasing energy trading efficiency [9,10].
Distributed algorithms have been proposed for coordination and control of energy system applications [11][12][13][14][15][16].In these algorithms, each peer maintains a local approximate value of its cost function and communicates directly with connected neigbours until all the peers in the network reach a consensus through information exchange.The information exchanged by the peers converges to an optimal value in a connected communication network [8].It is a general assumption in the literature that perfect communication links exist amongst these peers (e.g., see [12,[17][18][19]) without considering the effect of unreliable links on the convergence speed and time of the distributed algorithm.However, a real communication network may be subjected to signal delay, fluctuations due to environmental conditions, or to packet loss due to faults on the communication links, resulting in non convergence of the distributed consensus algorithm [20].It is therefore desirable to investigate the impact of imperfect communication links on the distributed algorithms for energy applications especially in energy trading and sharing, and develop algorithms that are not only resilient against these imperfections, but also future-proof for emerging smart grid applications including P2P energy trading.
Efforts have been made in recent works to cope with the effect of unreliable communication links on some energy network applications, in particular, for energy dispatch problems (EDP) [8,15], where individual generators produce enough energy to meet the aggregate demand of the network.Performance indicators considered include communication delay [21,22] and unreliable communication links subject to packet drops [8].While these studies considered the constraints of a single network at a time, distributed algorithms for energy coordination especially for P2P-ETS application should be tested with more network constraints.This is because real-time or near real-time transactions are involved, and a significant delay in routing the energy request information among the peers in the network could result in failed transactions.Communication delay could result from congestion on the communication links, due to improper routing of information.In practical system designs, congestion could result from maximally utilizing the bandwidth installed on the communication links, thus increasing the delay and message drops.
This paper proposes a distributed adaptive primal (DAP) routing algorithm based on a multi-commodity flow (MCF) [23] optimization and gradient projection [24], where the local estimate or transmitted message of each prosumer is represented as a commodity transmitted in the network.We test the robustness of DAP routing algorithm to communication link constraints particular to P2P-ETS, including congestion, packet drop, delay and different topologies.The goal in P2P-ETS is to ensure all messages transmitted in the network are received accordingly without loss and within acceptable delay cost.
Compared with the existing distributed energy coordination algorithm, the main contributions of this work can be summarized as follows:

•
We propose a DAP routing algorithm to efficiently route energy request information in a network of proactive prosumers until a consensus is reached.The robustness of the proposed DAP routing algorithm is tested against unreliability and other link constraints that have impacts on the optimal communication amongst the trading prosumers, compared to the existing literature that assumes perfect communication links exists among the energy trading entities [12,[17][18][19]; The algorithm tends to reduce communication delay resulting from long queuing of messages.This is achieved by setting a limiting indicator on the communication link using the gradient update of the link states to adaptively route the messages via less congested paths, compared to [25] that calculate the shortest path based on link state marginal cost.With the limiting indicator and gradient update, the delay cost function associated with maximum capacity utilization is maximally reduced; • As a result of the adaptive nature of the proposed routing algorithm, future grids will benefit through reduced delay and lower bandwidth requirement.This can be observed from the result which shows a 20% reduction in delay compared to hop-by-hop adaptive link state routing algorithm [25].Further, in contrast to [8,15] that examined delay and packet loss, we tested the robustness of the proposed DAP routing algorithm to more stringent communication network constraints including delay, packet loss, congestion and different network topologies.The result shows that these constraints if not checked, would impact negatively the communication and transactions of the energy trading entities.
The organization of the remaining sections of the paper is as follows: Relevant literature review and the optimization problem for practical routing design challenges are presented in Sections 2 and 3 respectively.The DAP routing algorithm and implications to P2P-ETS is presented in Section 4, whilst simulation and result analysis are discussed in Section 5. Section 6 draws conclusions and identifies potential future work.

Literature Review
The broader implications associated with energy networks is the avenue to create neighbourhoods that integrate energy producers and consumers within a given locality.Distributed energy coordination and sharing algorithms aim to minimize the energy cost of each prosumer whilst meeting the aggregate energy demand and satisfying their individual generator output capacity.These algorithms have been widely investigated for use in energy networks in applications ranging from economic dispatch problems [8,15], decentralized energy management [11,21], scheduling algorithms for smart grids [26], distributed energy trading in microgrids [12,13,16,27], distributed optimal power flow [28] and distributed voltage control [29] etc. without examining the underlying communication network.However, to assess the effect of the communication infrastructure on these applications, recent works have considered network delay [15], packet loss [8] and time-varying network topologies of the communication networks.The authors in [30] applied a gradient method to handle cases of time-varying directed networks and [15] uses gradient push-sum method for cases including communication delays.
While the motivation for this study is energy network applications, our proposed framework is related to distributed optimization which can be used to address other cyber-physical networked systems with unreliable communication links [31][32][33].Packet drops on communication links are modeled as a time-varying graph in [31], and a distributed algorithm was proposed to solve the optimization problem.Whilst [32,33] utilized a running sum in their optimization algorithm, the distributed algorithm presented in [34] is based on the Newton-Raphson method [35].Other studies that uses communication systems in the management of peer-to-peer energy trading are documented in [36].
Management systems for energy networks capable of integrating data forecasting, transactions and optimization tools will play an active function in the distributed control of power networks [37].In view of this, the flexibility, scalability and efficiency offered by a MCF network [38][39][40] can be utilized for the power optimization tasks.MCF has been used successfully in communication networks [40], wireless sensor networks [39], distribution networks and transportation networks [23] to direct either continuous or discrete data from the source to destination using the available resources installed on the network.MCF network optimization has been recently formulated for energy network management [37], and applied to smart grid applications in [41].However, no computational or simulation analysis of its suitability was reported.Thus to the best of our knowledge, this is the first paper to fully model distributed energy coordination using MCF whilst also testing the robustness of the proposed algorithm over unreliable communication links.Table 1 summarizes the relevant literatures considered.

Problem Formulation
This study considers a model that focuses on the communication process amongst prosumers rather than on the electrical operations of the grid.The objective is to minimize loss of transactional messages and communication delay.Thus, it is assumed that each prosumer has its desired energy needs precomputed before communicating the message to other prosumers.The optimal control and routing algorithm should be completely distributed, relying on only local information available at each prosumer unit, i.e., each prosumer is only aware of its local energy demand message.

Communication Network
is a strongly connected undirected graph as shown in Figure 1, where every peer in the network is reachable from every other peer, i.e., there exists a directed path from peer n i to peer n j in the network.E (t) ⊆ V × V is a set of bidirectional links that changes over time according to the state of the link at time, t.A directed link from n i to n j is denoted by (i, j) ∈ E .Each directed link is characterized by its bandwidth capacity, c i,j , the flow of energy message, x i,j , network delay function, Φ i,j , and signal loss probability, k i,j .

Multi-Commodity Network Flow Model
The network problem is modeled as a MCF network optimization [38][39][40], to reflect differences in each prosumer cost function.A MCF network accepts multiple transactional messages in G and it models the average behaviour of the data transmissions across the network [23] utilizing the resources installed on the network.We denote commodity as energy request messages for the rest of the paper.
The most basic multi-commodity network representation is given by [37] min subject to: conservation of flow constraints unit constraints where A denotes the set of arcs/links in the network, x ijk is the flow of commodity k on the arc between the nodes (n i , n j ), whilst the objective function C ijk (x ijk ) is the cost of flow in arcs, which is a convex monotonically increasing function [37].The decision variables in this model are energy flows observing energy flow conservation in nodes, i.e., the flow entering the node (supply) must be equal to the flow leaving the node (demand).
Without loss of generality, the optimal message routing optimization is expressed in a flow-based MCF network formulation as follows: where cost function, Φ(•), associates a cost to a link, (i, j), and x i,j , is the total traffic flow on link (i, j) in the network.x d i,j represents the flow on link (i, j) corresponding to commodity d.I n is the ingress link to an intermediary or destination peer n j , while U n is the egress link from a source or intermediary peer n i .Equation (1b) is the conservation of flow constraint on energy transshipment nodes, i.e., the total message flow into a peer is equal to the total message out flow.Constraints (1c) suggest that the message flow in link, (i, j), must not exceed the capacity of the link c i,j .Constraint (1d) represents non-negativity of the flow traffic, x d i,j , traversing the network.

DAP-Adaptive Routing Algorithm
It is assumed that the cost function Φ i,j is differentiable and bounded because of its convexity.Thus, there exists an L < ∞ such that Φ i,j (x) ≤ L ∀(i, j) ∈ [0, ∞] N n .

The Proposed DAP Iterative Algorithm
At the tth iteration, let x i,j (t) denote the value of the traffic rate variable x i,j .By applying a gradient projection algorithm [23,42] to problem (1), we have: where α(t) is the step size at the tth iterative step and Φ i,j represents the weights of the communication links which can be expressed as the gradient of the objective function as l i,j is expressed as Equation ( 4) represents the link utilization indicator for each link in the network.A link (i, j) is maximally utilized if l i,j = 1, and vice versa.v d is given by the expression Equation ( 5) represents the peer capacity utilization indicator.An intermediary peer along the path of a message is considered fully utilized if Each link monitors the value Φ i,j (x i,j ) as a function of the traffic traversing the link and signals the updated value to each prosumer in the network.The iterative update of (2) has a simple interpretation, the traffic on each link decreases if the source peer is underutilized or the destination peer is fully utilized, and vice versa.Similarly, the traffic on each link decreases by the gradient of the objective function while it increases or decreases according to the number of congested links on the path.
The iterative update can be formally expressed as This gradient projection iteration is performed by each prosumer using only local information available at each prosumer, yielding to a distributed approach that does not depend on network-wide knowledge.In other words, each communication link (i, j) monitors the gradient value Φ i,j (x i,j ), representing the flow traffic on the link as a measure to deter maximum link utilization.The monitored gradient value is periodically communicated to every prosumer in the network.In response, each prosumer adaptively modifies the routing according to (6).The summary of the proposed DAP algorithm is given in Algorithm 1.

Implication of Model Solution to P2P-ETS
In P2P, delay is a critical factor as the peers would not reach a consensus in time in the presence of communication delay.This would affect service delivery.For instance, prosumer A and prosumer B in an energy network are about to transact, a significant communication delay from either party could result in exchanging the transactional message with another prosumer with a faster response.This implies that, prosumer A or B will lose the deal and hence the supposed profit.Amongst the leading factors affecting network delay is communication link congestion.The higher the utilization rate, the longer the queuing rate and the longer it takes to deliver the messages.Thus, the convex objective function is chosen as the M/M/1 delay formulated [23,25] as which has a direct relationship with the link capacity utilization.Obviously, minimizing (7), it can be observed that (and dropping the ∑ x i,j for simplicity), Φ i,j (x i,j ) = c i,j (x i,j −c i,j ) 2 , and that Φ i,j (x i,j ) → ∞, when x i,j → c i,j .This restrains the links from operating too close to its capacity.For instance, the delay cost function assigns an increasing convex cost that tends to infinity as the traffic in each link approaches its capacity.This implies that the traffic messages will be slowed down to avoid congestion and the possible collapse or failure of the network.Here, Φ i,j acts as a barrier function and link capacity constraints are enforced penalizing those solutions that violate it.Apart from using the M/M/1 delay function as a congestion indicator, the delay function is selected to form a basis of comparison with the related work.

Algorithm 1 Proposed DAP Routing Algorithm.
Input: G(t) = (V, E (t)), the step-size, α, and link capacity, c i,j , for all i ∈ N Output: Cost function, Φ i,j (x i,j ), optimal energy demand messages, d i (t), and the traffic x d i,j carried on each link.
Link's Algorithm: t > 0, Compute Φ i,j (x i,j ), for all message values and Broadcast Φ i,j (x i,j ) to the peers Peer's Algorithm: t > 0, Based on the role of prosumer n i at t, update x i,j using (6) Go to next time slot until maximum time-step is reached

Simulation and Result Analysis
To demonstrate the performance and the convergence of the proposed distributed algorithm, simulations are performed in Net2Plan; an open-source network planner tool developed in Java [23,43].The network topology is as shown in Figure 2 adapted from [13].A set of energy message request bits such as d 1 = 45 kb, d 2 = 35 kb, d 3 = 35 kb, d 4 = 40 kb, totalling D = 155 kb are considered.The 4 prosumers are connected by 12, 8, and 6 links for the three topologies considered as shown in Figure 2, i.e., full mesh, partial mesh and Bus topologies respectively.
The link capacities are set to a total of C = 400 kb equivalent to 38.8% link utilization.The step size, α, is set to a constant value of 1 and 0.01.To consider the effect of suboptimal communication link constraints representing a typical scenario, we randomly lose some signal link update messages to verify the robustness of the algorithm to unreliable communication links arising from signal loss.Loss of signal on communication links may occur due to environmental factors or fault on the links.Thus, each communication link, (i, j), suffers a packet drop in the signal of messages of probability p i,j = 0.1 as presented in [8].To further reflect a typical scenario, asynchronous communication is considered in all test cases.Asynchronous communication is a case where the prosumers communicate at different times and at different frequencies-a typical practical scenario.For the asynchronous update, the prosumers waited between 0-5 time steps before sending their updates.The simulation parameters are summarized in Table 2.

Performance Analysis of the DAP Routing Algorithm
An algorithm is considered stable when it converges to a solution in a finite amount of time.This is a desirable property used to measure the algorithm performance and efficiency.The result is analysed based on the algorithm convergence time.Figures 3 and 4 show the algorithm convergence for the full mesh and partial mesh topology respectively.The topmost plot of Figures 3 and 4 show the convergence of the transmitted messages, the middle plots show the evolution of the total transmitted messages on each link while, the lower plots show the evolution of the objective functions.A chaotic and state of instability start until the 24th time step can be observed for the three variable plots of Figure 3, however, a slower start was observed for the partial mesh of Figure 4, before the algorithm was able to find an optimal routing solution and converge to the optimal value.It can be observed from the considered network topologies that, the mesh configuration has the lowest delay cost of 7.5 ms compared with 9.7 ms and 13.5 ms for partial mesh and bus topology respectively.This is because all the peers in the full mesh configuration are connected to every other peer, so information can be sent easily and directly without going through an intermediary entity.However, a trade off exists in the number of resources used up; Full mesh has more links installed with somewhat complex configurations as the number of peers increases.

Cases of Unreliable Communication Link and Varying Step Sizes
In this section, a case of an unreliable communication network with a probability of signal loss on the communication links is considered, as well as varying the step sizes.Motivated by study [8], the probability of loss was set to 0.1 for the full mesh topology.The results are as shown in Figure 5.It can be observed that the signal loss probability has little effect on the algorithm convergence compared with the ideal case which stabilizes at the 27th time step, but with a negligibly higher delay cost than the ideal case.Figure 6 shows the result for the network delay of different values of α, i.e., α = 1, 0.01 and probability of signal loss of 0.1 for the 3 topologies.It can be observed that, in addition to having the lowest delay function, the full mesh topology has the lowest network delay compared with other topologies due to the direct connection between all peers in the network.However, this configuration uses more network resources leading to higher network and installation costs.In addition, for a larger network, it would result in higher complexity as compared to other topologies.It can also be observed that, the network delay increases when α = 0.01 compared with α = 1 for the full and partial mesh, but the bus topology remains at the same level.Furthermore, considering the effect of different step sizes on the algorithm convergence, we vary α = 1 and 0.01 to obtain Figure 7.We find that Figure 7 corroborates the fact that with higher step sizes, convergence is faster as compared to lower step sizes.

Evaluating Congestion on the Communication Link
The behaviour of the three network topologies is assessed further under varying degree of average link utilization as seen in Figure 8.It is observed that the time to attain optimal value increases as the network congestion increases.However, the full mesh topology outperformed the other topology configurations, which is evident from the direct connection between the peers.Although this work is intended for energy network applications, it is worth noting that the algorithm can be applied to cyber-physical networks where the network is subject to lossy communication.In view of this, the proposed DAP routing algorithm offers a significant improvement over previously proposed link state routing algorithms in the literature.In Figure 9, we compare the optimal value obtained by DAP to HALO [25] for the full mesh topology with varying degrees of link utilization.HALO is a hop-by-hop adaptive link state routing algorithm.As it can be seen, the DAP routing algorithm has lower optimal value (delay cost function) than HALO over the varying level of link capacity utilization.This is because, at each iteration, HALO updates are calculated based on the shortest path to each destination using link state marginal costs, whereas, DAP set a limiting indicator on the communication link using the gradient update of the link states.This also proves the DAP algorithm significance, as the utilization increases, the routing adaptively reroutes traffic via less congested links to realize a minimal network delay.

Scalability Check to Increasing Number of Prosumers
To assess the scalability of the algorithm, we increase the number of prosumers using a typical P2P unstructured architecture where each peer in the network is connected without any particular form.This topology reduces delay and complexity as well as saving costs [3]. Figure 10 shows the resulting plot for delay cost function for 5, 10, 15 and 30 prosumers.It can be observed that as the number of distributed prosumers increase, the delay cost function increases in almost a linear fashion, which could be O(n).This delay is still within an acceptable tolerance for smart grid applications [3].

Conclusions
In this paper, we have studied efficient message coordination in virtual microgrids taking into consideration realistic deployment scenarios involving imperfect communication links.We propose a DAP routing algorithm based on a MCF network optimization and gradient projection update, to mitigate the effects of lossy communication networks in P2P-ETS.Particularly, we addressed the problem of signal loss, delay and congestion using different topologies.The optimal value for the delay cost function achieved is much lower than previously proposed algorithms in the literature.The results show that the proposed routing algorithm is robust to packet loss over imperfect communication links with a 20% reduction in optimal delay compared with a hop-by-hop adaptive link state routing algorithm.This shows that for a fairly sized VMGs like 30, DAP routing algorithm recorded a delay cost of approximately 78 ms after convergence, which is within acceptable tolerance for smart grid applications.This work has a direct impact on several planning and coordination applications, especially in designing delay-sensitive networks like smart energy system by deciding the best topology and network capacity to use based on the required performance metrics and network complexity.In the future, we shall investigate the impact of prosumer processing capacity on optimal message routing amongst energy trading entities, as it also affects network delay.

Figure 1 .
Figure 1.An example of IEEE five-bus system showing the composition and connectivity of prosumers [27].

Figure 2 .
Figure 2. Bidirectional communication network used for the test cases of the proposed DAP routing algorithm: (A) Full mesh.(B) Partial mesh.(C) Bus topology.

Figure 3 .
Figure 3. Full mesh topology: (Topmost plot) Convergence of the transmitted messages.(Middle plot) Convergence of the communication links.(Lower plot) The network delay function.

Figure 4 .
Figure 4. Half mesh topology: (Topmost plot) Convergence of the transmitted messages.(Middle plot) Convergence of the communication links.(Lower plot) The network delay function.

Figure 5 .
Figure 5. Full mesh topology for probability of 0.1 loss: (Topmost plot) Convergence of the transmitted messages.(Middle plot) Evolution of traffic x i,j on each path.(Lower plot) The objective cost delay function.

Figure 6 .
Figure 6.Total network delay for the 3 topologies for the case of probability of loss (0.1) with step sizes 1 and 0.01.

Figure 7 .
Figure 7. Convergence of the delay cost function for the 3 topologies for differing step sizes of 1 and 0.01.

Figure 8 .
Figure 8.Time to attain optimal value for the Three Network Topologies with varying link utilization.

Figure 9 .
Figure 9.Time to attain optimal value for the DAP algorithm and HALO algorithm over varying link utilization.

Figure 10 .
Figure 10.Delay cost function for different number of prosumers.