1 Introduction

The rapid increase in smart distribution technologies such as dispatchable distributed generators (DG), storage and curtailable loads offer greater levels of controllability and observability over traditional distribution networks, which may allow for greater system stability and optimality if properly harnessed. These new opportunities come with new challenges which require new problem formulations and methods. Traditional, centralized solutions meet limitations in this regard, with new control and monitoring capabilities leading to the potential for excessive data volumes, increased computational requirements, data synchronization, latency, and privacy issues. These concerns motivate the need for improved optimization approaches, and in particular intelligent, decentralized methods which are capable of reducing centralized communication bottlenecks, distributing the processing of data, and protecting privacy, while still being capable of maintaining globally optimal or near-optimal operation.

In a report from Pacific Northwest National Laboratory (PNNL) describing a grid architecture [1], it is suggested that the existing whole grid coordination has gaps and a transition from centralized control to a hybrid central/distributed control is necessary. Furthermore, it provides insight into the need for future distribution networks to have excellent observability. Distributed approaches have been presented in the literature and often utilize features of network structure to make approximations, for example through decomposition of the network sensitivity matrix in order to form independent regions [2]. The disadvantage of utilizing completely independent regions in such approaches is that solutions are reached without considering full network state and they are prone to oscillations due to competition between controllers [3]. Hierarchical solutions, where a central coordinator takes on a leadership role, can overcome these problems by forming a multi-agent system (MAS). For example parallel optimization is performed by agents in [4,5,6], while global information updates such as Lagrange multipliers and aggregated load profiles are updated by a central coordinator. And in [7,8,9,10] global information is aggregated by a central entity and then communicated to agents who then apply a game theoretic approach to solving the optimization. These leader-follower multi-agent systems often succeed in distributing optimization computations, but local processing is still required to perform a full optimization at each iteration, and the leader agent can still be a communication bottleneck.

It is often possible to greatly reduce the central communication burden by allowing agents to communicate with each other in a non-hierarchical manner. In such systems, the leader agent becomes less relevant or even entirely redundant. Examples that utilize a leader include [11] where an auctioneer agent manages bids in the day-ahead market, and [12] where a leader agent is utilized to drive the follower agents’ solutions toward a global optimum. Removing the need for a leader agent may be preferable since it removes the central point of failure. Examples of leaderless MAS are presented in [13, 14] where voltages are regulated by distributed generators acting as cooperative agents, in [15, 16] where decentralized methods of optimal reactive power control are presented, in [17] where a distributed fair load shedding algorithm is presented, and in [18] where consumer agents cooperate to perform optimal load scheduling.

A popular approach to implementing a fully distributed MAS is through the developments of a consensus protocol. Consensus protocols allow agents to reach global agreement with respect to some quantity of interest through communication only with their immediate neighbours. Agents update their estimate of the quantity of interest based only on neighbour agent values, allowing iterative estimation improvements without agents requiring knowledge of the network beyond their neighbour set. Consensus protocols have been extensively researched and more recently have gained attention for their applicability to distributed smart grid applications. A review of consensus protocols and their applications can be found in [19]. In [20], a continuous-time consensus protocol is developed for the regulation of voltage through droop control and reactive power sharing. In [21], frequency synchronisation of microgrids is achieved through a consesus-based algorithm. In [22], wind turbine operation in a microgrid is optimized in a distributed manner with the power imbalance in the network discovered through a consensus protocol. In [14], a consensus protocol is developed for the fair curtailment of generation in an overvoltage situation, and in [23] an average consensus algorithm is developed for load shedding in a microgrid. In [24], consensus approaches to optimal power flow (OPF), econnomic dispatch, and state estimation in the smart grid are reviewed.

A common application of consensus-based methods is the incremental cost consensus (ICC) algorithm applied to the economic dispatch problem, where local objectives are optimized while being constrained by the power mismatch within the network. In [25], distributed generator power is dispatched according to an ICC protocol. In [26], an incremental welfare consensus protocol is developed for the optimal scheduling of DG and loads. In [27], energy storage is optimally controlled through ICC. In [28], a primal-dual perturbed sub-gradient method is applied locally while averaging consensus is applied to estimate the global cost functions and constaints.

Consensus-based approaches to smart grid problems provide great improvements in terms of solving optimization problems in a purely distributed manner without the need for central communication or processing. However there are some practical problems that have not yet been well addressed in the researched applications. The first problem is the information asynchronization of the agents. Most of the developed protocols are synchronous and require some form of coordination in order to maintain the correct sequence of updates. If such a protocol is applied in an asynchronous manner the average of the consensus values within the network may drift and an average consensus cannot be reached [29]. Some research has presented asynchronous averaging algorithms such as [30] and [31], however such approaches require either pairing between agents and blocking of communication during updates, or some form of local synchronization between agents, which may lead to communication inefficiencies. The second problem is line loss, which is generally neglected entirely, or sometimes approximated as a percentage of total demand [22, 27]. These approximations will lead to inaccuracies in any arrived at solution. A final problem is the impact of power flow and voltage limits within the distribution network. Some prior works have addressed these issues including [32] in which a distributed primal dual iterative approach is taken to solving an OPF problem. In [33], an SDP relaxation of OPF is combined with matrix decomposition to allow a distributed solution for OPF problems with linear costs. In [34], a large network is partitioned into regions and each region solves a separate OPF problem but is constrained by dummy variables at the boundary. In [35] a simplified version of the OPF problem based on linearization of constraints and convexity assumptions is solved without central coordination. In [36] a consensus-based approach is taken to the OPF problem by commissioning each agent to perform a full optimization across both its own state variables and its neighbours also. While these approaches solve, or approximately solve, the central OPF problem, they are unable to deal with inseparable components of system state such as network power mismatch. Addressing these problems is the objective of this paper.

In this paper, we combine consensus-based approaches to handle inseparable components of the smart grid model with distributed power flow methods to produce a fully distributed (no central coordination or control), asynchronous smart grid optimization algorithm. The presented asynchronous, averaging consensus protocol is simple to implement without communication constraints such as blocking, and shares many of the benefits of synchronous consensus protocols. And the distributed, asynchronous power flow analysis allows for the discovery of line losses and voltages, ensuring the solution is feasible and optimal.

The remainder of the paper is organized as follows: In Sect. 2, we introduce the smart grid optimization problem in terms of separable distributed generation costs, power flow and power mismatch constraints, and generation and nodal voltage limits. Section 3 presents an iterative solution based on an augmented Lagrange function, and Sect. 4 then develops a fully distributed approach based on an asynchronous consensus protocol and distributed power flow calculations. Then in Sect. 5, a simulation based case study is presented which demonstrates the operation of the asynchronous, distributed algorithm. Finally, the presentation concludes with a summary of findings and a discussion of future directions in Sect. 6.

2 Problem formulation

A distribution network modelled as a connected graph (NY) is considered, with buses defined by the node set N and edges defined by the bus admittance matrix \({\varvec{Y}}\). The network has a single slack bus at \(0\in N\) and features controllable DG at buses in \(N_G\subseteq N\) and loads at buses in \(N_L\subseteq N\). For convenience, it is assumed that \(N_L=N{\backslash } N_G\) without loss of generality. For the sake of a simpler presentation of the algorithms in this paper only a balanced network is considered, and it is assumed that each bus has all required measurements available. Application of the presented algorithms to an unbalanced distribution network is left for future study.

The goal of the smart grid optimization problem is to optimally control DG such that network operating constraints are maintained and power mismatch between generation, demand and loss is constrained to zero. The dispatchable generator operational costs are dependent on network state x, assumed continuous and convex, and are collectively given by:

$$\begin{aligned} c({\varvec{x}}) = \sum \limits _{i\in N_G} c_i(p_i,q_i) \end{aligned}$$
(1)

where \(p_i,q_i{\subset } x_i\) for \(i\in N_G\) are the active and reactive nodal powers respectively, and are constrained according to the DG capacity limitations defined by:

$$\begin{aligned} {\left\{ \begin{array}{ll} p_i\in [p_i^-, p_i^+]\\ q_i \in [q_i^-, q_i^+]\\ \forall \ i\in N_G \end{array}\right. } \end{aligned}$$
(2)

Loads, which are defined by the set \(\{p_i,q_i:i\in N_L\}\), are measurable components of state. We denote by the vectors \({\varvec{p}}=[p_0,p_1,\dots ,p_{|N|}]^{\rm{T}}\) and \({\varvec{q}}=[q_0,q_1,\dots ,q_{|N|}]^{\rm{T}}\) the full set of real and reactive nodal powers. Slack bus real and reactive powers are denoted by \(p_0\) and \(q_0\), which ensure zero net power flow within the network.

We denote by \({\varvec{e}}=[e_0,e_1,\dots ,e_{|N|}]^{\rm{T}}\) and \({\varvec{f}}=[f_0,f_1,\dots ,f_{|N|}]^{\rm{T}}\) the real and imaginary components of bus voltages. Note that the real and imaginary components of voltage are used throughout the paper rather than the more common magnitude/angle representation due to the simplification it provides to derivatives [37]. Slack bus real and imaginary voltages are denoted by \(e_0\) and \(f_0\) respectively, and are modelled as constant with \(e_0=1\) and \(f_0=0\). All other bus voltage magnitudes are constrained according to

$$\begin{aligned} {\left\{ \begin{array}{l} (e_i^2+f_i^2)^{\frac{1}{2}} \in [v^-, v^+]\\ \forall i\in N {\backslash } \{0\} \end{array}\right. } \end{aligned}$$
(3)

Power flow constraints are defined in their rectangular form in terms of the real and imaginary components of voltage:

$$\begin{aligned} {\left\{ \begin{array}{ll} {\varvec{g}}({\varvec{x}}) =[g_{p_1}({\varvec{x}}),g_{p_2}({\varvec{x}}),\dots ,g_{p_{|N|}}({\varvec{x}}),g_{q_1}({\varvec{x}}),g_{q_2}({\varvec{x}}),\dots ,g_{q_{|N|}}({\varvec{x}})]^{\rm{T}} \\ g_{p_i}({\varvec{x}}) =\sum \limits _{j\in N} ( e_i e_j G_{ij} + f_i f_j G_{ij} + f_i e_j B_{ij} - e_i f_j B_{ij} ) - p_i\\ g_{q_i}({\varvec{x}}) =\sum \limits _{j\in N} ( f_i e_j G_{ij} - e_i f_j G_{ij} - e_i e_j B_{ij} - f_i f_j B_{ij} ) - q_i\\ \forall i\in N \end{array}\right. } \end{aligned}$$
(4)

where B and G are the real and imaginary components of the admittance matrix, \({\varvec{Y}}\), respectively.

The net power mismatch within the distribution network is:

$$\begin{aligned} {\left\{ \begin{array}{ll} {\varvec{h}}({\varvec{x}})=[h_p({\varvec{x}}),h_q(x)]^{\rm{T}} \\ h_p({\varvec{x}})= \sum \limits _{i\in N{\backslash }\{0\}} p_i + \frac{1}{2}\sum \limits _{i\in N} \sum \limits _{j\in N_i} p_{ij}({\varvec{x}})\\ h_q({\varvec{x}})= \sum \limits _{i\in N{\backslash }\{0\}} q_i + \frac{1}{2}\sum \limits _{i\in N} \sum \limits _{j\in N_i} q_{ij}({\varvec{x}})\\ p_{ij}({\varvec{x}})= G_{ij}((e_i - e_j)^2 + (f_i - f_j)^2)\\ q_{ij}({\varvec{x}})= B_{ij}((e_i - e_j)^2 + (f_i - f_j)^2)\\ \end{array}\right. } \end{aligned}$$
(5)

where \(p_{ij}({\varvec{x}})\) and \(q_{ij}({\varvec{x}})\) are the active and reactive line losses respectively between nodes i and j. DG power is modelled as positive and loads as negative so that nodal powers sum to zero when the distribution network is operating in isolated mode (i.e. no power is imported/exported into/from the network).

The problem is formally defined as follows:

$$\left\{ {\begin{array}{*{20}l} {\min \,{\varvec{c}}({\varvec{x}})} \hfill & {} \hfill \\ {{\text{s.}}\,{\text{t.}}} \hfill & {{\varvec{g}}({\varvec{x}}) = {\mathbf{0}}} \hfill \\ {} \hfill & {{\varvec{h}}({\varvec{x}}) = {\mathbf{0}}} \hfill \\ {} \hfill & {{\varvec{x}} \in X} \hfill \\ \end{array} } \right.$$
(6)

where X is the set of admissible states and is defined by power generation capacity constraints (2) and voltage magnitude constraints (3). The objective of this paper is to develop methods for calculating the power mismatch and solving (6) in an asynchronous, distributed manner, without a central node.

3 Augmented Lagrangian optimization

Previously, Millar and Jiang [32] have applied augmented Lagrange optimization to solving the OPF problem. However the formulation did not account for the case of constraints that could not be directly calculated from local and neighbourhood values. As such, in this section we both summarize the important points and extend the approach. Amendments to the formulation are provided to handle inseparable constraints that cannot be dealt with through local and neighbour values alone, but rather require global information. Such problems require estimation approaches since only neighbour communication is available. Therefore, the following extends the algorithm to include power mismatch in preparation for the consensus algorithm in Sect. 4.1 that will be developed for its discovery.

The augmented Lagrange function associated with the problem of (6) is defined as follows:

$$\begin{aligned} \begin{aligned} L({\varvec{x}},{\varvec{\lambda ,\mu }}) &=c({\varvec{x}}) +{\varvec{\lambda }}^{\rm{T}} {\varvec{g}}({\varvec{x}}) + {\varvec{\mu }}^{\rm{T}} {\varvec{h}}({\varvec{x}})\\&\quad +\frac{\alpha ^{(k)}}{2} \left( \Vert {\varvec{g}}({\varvec{x}}) \Vert ^2 + \Vert {\varvec{h}}({\varvec{x}})\Vert ^2 \right) \end{aligned} \end{aligned}$$
(7)

where \({\varvec{\lambda }}=[\lambda _p,\lambda _q]^{\rm{T}}\) is the vector of Lagrange multipliers for the active and reactive power flow constraints, and \({\varvec{\mu }}=[\mu _p,\mu _q]^{\rm{T}}\) is the vector of Lagrange multipliers for the active and reactive power mismatch constraints. The penalty terms, with increasing multiplier sequence \(\alpha ^{(k)}\), penalize for non-zero equality constraints and assist in driving the solution towards feasibility in terms of (4) and (5).

The method of multipliers is applied to (7) in order to search for a solution to (6). Given sequences \(\{\lambda ^{(k)}\}\) and \(\{\mu ^{(k)}\}\), the iterative procedure produces the sequence \(\{x^{(k)}\}\) according to

$$\begin{aligned} {\varvec{x}}^{(k+1)} = \arg \underset{{\varvec{x}}\in X}{\min } L({\varvec{x}},{\varvec{\lambda}} ^{(k)},{\varvec{\mu}} ^{(k)}) \end{aligned}$$
(8)

We denote by \(X^o\) the open set containing all points of X excluding its boundary. Then we can say that for \({\varvec{x}}^{(k+1)}\in X^o\) calculated by (8) the gradient satisfies:

$$\begin{aligned} \Vert \nabla _{\varvec{x}} L({\varvec{x}}^{(k+1)},{\varvec{\lambda}} ^{(k)},{\varvec{\mu}} ^{(k)})\Vert = 0 \end{aligned}$$
(9)

To simplify the calculation of the minimum in (8) the preceding condition can be slackened while \({\varvec{x}}^{(k+1)}\in X^o\) such that:

$$\begin{aligned} \Vert \nabla _{\varvec{x}} L({\varvec{x}}^{(k+1)},{\varvec{\lambda}} ^{(k)},{\varvec{\mu}} ^{(k)})\Vert \le \epsilon ^{(k+1)} \end{aligned}$$
(10)

for a sequence \(\{\epsilon ^{(k)}\}\) that satisfies \(\epsilon ^{(k)} \ge 0\) for all k and \(\epsilon ^{(k)} \rightarrow 0\) [38]. For points \({\varvec{x}}^{(k+1)}\notin X^o\) that cannot satisfy (10), the minimization of (8) must instead be solved such that a further reduction to \(L(\cdot )\) can’t be made.

To achieve the minimization with respect to x, for any \({\varvec{x}}^{(k+1)}\in X\), the gradient projection method [39] is taken over iterations k as follows:

$$\begin{aligned} {\varvec{x}}^{(k+1)} = P_X\left\{ {\varvec{x}}^{(k)} - \Gamma ^{(k)} \nabla _{\varvec{x}} L(x^{(k)}, {\varvec{\lambda}} ^{(k)}, {\varvec{\mu}} ^{(k)}) \right\} \end{aligned}$$
(11)

where \(P_X\{\cdot \}\) is projection on X, and \(\Gamma =\text {diag}([\gamma _i])\) is the step direction and is chosen to maximize the reduction in \(L(\cdot )\). Iterations (11) are repeated until condition (10) is met, or until a reduction in \(L(\cdot )\) can’t be made in the case that \({\varvec{x}}^{(k+1)}\notin X^o\).

Fig. 1
figure 1

Asynchronous neighbour communication

Under the condition that \(\{{\varvec{\lambda}} ^{(k)}\}\) and \(\{{\varvec{\mu}} ^{(k)}\}\) are bounded, the iterations (8) are known to converge to a solution of (6) as \(\alpha ^{(k)}\rightarrow {\infty }\) [38]. The method of multipliers improves upon this result by estimating the optimal Lagrange multipliers, which we denote by \({{\varvec{\lambda}} }^*\) and \({{\varvec{\mu}} }^*\), such that under appropriate conditions, \({\varvec{\lambda}} ^{(k)}\rightarrow {\varvec{\lambda}}^*\) and \({\varvec{\mu}} ^{(k)}\rightarrow {\varvec{\mu}}^*\). As such we employ the projected updates:

$$\begin{aligned} {\varvec{\lambda}} ^{(k+1)} = P_\varLambda \left\{ {\varvec{\lambda}} ^{(k)} + \alpha ^{(k)} g({\varvec{x}}^{(k+1)}) \right\} \end{aligned}$$
(12)

and

$$\begin{aligned} {\varvec{\mu}} ^{(k+1)} = P_M\left\{ {\varvec{\mu}} ^{(k)} + \alpha ^{(k)} h({\varvec{x}}^{(k+1)}) \right\} \end{aligned}$$
(13)

where \(P_{\varLambda }\{\cdot \}\) is projection on \(\varLambda =\{{\varvec{\lambda}} :|{\varvec{\lambda}} |\le \lambda ^+\}\) and \(P_{M}\{\cdot \}\) is projection on \(M=\{{\varvec{\mu}} :|{\varvec{\mu}} |\le \mu ^+\}\) given positive constants \(\lambda ^+\) and \(\mu ^+\). The projection ensures that the sequences \(\{{\varvec{\lambda}} ^{(k)}\}\) and \(\{{\varvec{\mu}} ^{(k)}\}\) are bounded, which is sufficient for convergence if \(\alpha ^{(k)}\rightarrow {\infty }\) and does not impact the optimality of the solution [38]. However, if \(|{\varvec{\lambda}} ^*|\le \lambda ^+\), \(|{\varvec{\mu}} ^*|\le \mu ^+\), \({\varvec{x}}^*\in X^o\), and \(\nabla ^2_{xx}L({\varvec{x}}^*,{\varvec{\lambda}} ^*)>0\), then the updates (12) and (13) ensure that \({\varvec{\lambda}} ^{(k)}\rightarrow {\varvec{\lambda}}^*\) and \({\varvec{\mu}} ^{(k)}\rightarrow {\varvec{\mu}}^*\) when \(\alpha ^{(k)}\) is large enough ([38] Proposition 2.4).

Appropriate values for \(\lambda ^+\) and \(\mu ^+\) can be chosen by analysing condition (9) assuming \({\varvec{x}}^*\in X^o\), and through simulation of a representative set of network scenarios otherwise. For the case that \(x^*\in X^o\), we can say that:

$$\begin{aligned} \begin{aligned} \begin{bmatrix} {\varvec{\lambda}} ^* \\ {\varvec{\mu}} ^* \end{bmatrix}&\in \left\{ -\left( {\varvec{\eta}} ({\varvec{x}})^{\rm{T}} {\varvec{\eta}} ({\varvec{x}}) \right) ^{-1} {\varvec{\eta}} ({\varvec{x}})^{\rm{T}} \nabla _{\varvec{x}} c({\varvec{x}}) : {\varvec{x}}\in X^o \right\} \\ {\varvec{\eta}} ({\varvec{x}})&= \left[ \nabla _{\varvec{x }}{\varvec{g}}({\varvec{x}}), \nabla _{\varvec{x}}{\varvec{h}}({\varvec{x}}) \right] \end{aligned} \end{aligned}$$
(14)

assuming that \({\varvec{\eta}} ({\varvec{x}})\) has rank 2|N| [32].

4 Asynchronous, distributed solution

In the following, a distributed approach to finding a solution to (6) is presented. An iterative algorithm is developed that applies the minimization steps of (11) and multiplier estimate updates of (12) and (13) with an asynchronous consensus protocol for finding the values of the coupled power mismatch \({\varvec{h}}({\varvec{x}})\) and its associated multiplier \({\varvec{\mu }}\). All updates are performed asynchronously, with agents exchanging information with their immediate neighbours, an illustrations of which is presented in Fig. 1. Each agent represents a single bus within the distribution network and communicates only with its neighbours while preserving the privacy of local power production and demand.

First an asynchronous averaging consensus protocol is presented, followed by a fully distributed implementation of (11). The two algorithms are then combined to provide a unified solution to the problem of (6).

4.1 Asynchronous consensus protocol

Consider the undirected graph (NA) with node set N, and weighted adjacency matrix \({\varvec{A}}=[a_{ij}]\). The objective of the consensus protocol is to find the average of the |N|-dimensional vector \({\varvec{h}}\). Each node i holds an estimate of the average denoted by \({\tilde{h}}_i\), which is updated iteratively through communication only with neighbours \(N_i=\{j\in N:a_{ij}\ne 0\}\). The basic iterative, synchronous consensus protocol can be defined as follows over iterations k:

$$\begin{aligned} {\tilde{h}}_i^{(k+1)} = {\tilde{h}}_i^{(k)} + \xi \sum \limits _{j\in N_i} \left( {\tilde{h}}_j^{(k)} - {\tilde{h}}_i^{(k)}\right) \end{aligned}$$
(15)

where \(\xi\) is the step size. Given a step size \(\xi \in (0,1/\Delta ]\) for \(\Delta =\max _i\left( \sum \limits _{j\ne i}a_{ij}\right)\) and given initial estimates \({\tilde{h}}_i^{(0)}=h_i\), the synchronous consensus protocol will converge such that \({\tilde{h}}_i^{(k)}=\frac{1}{N}\sum \limits _j h_j,\ \forall i\in N\) as \(k\rightarrow {\infty }\) [19].

Averaging consensus relies on maintaining the average value across the network after each iteration k. Specifically:

$$\begin{aligned} \sum \limits _{i\in N} {\tilde{h}}_i^{(k)} = \sum \limits _{i\in N} h_i\quad\ \ \forall k \end{aligned}$$
(16)

If (15) is performed asynchronously, for example if not all nodes are updated at each iteration, then the consensus result will not give the average of the initial condition and (16) will not be maintained [29]. Asynchronous, averaging consensus protocols have been presented in the literature and typically employ a symmetric gossip strategy (a description of which is presented in [40]). However existing implementations of this strategy require some form of local synchronization [31], explicit pairing (agreement between neighbours as to who controls communication) [41] or blocking [30]. Next we present a simple asynchronous averaging consensus protocol that avoids the need for these mechanisms and possesses the following properties:

  1. 1)

    Distributed: No central controller or leader agent

  2. 2)

    Asynchronous: No inter-agent synchronization

  3. 3)

    Implicit pairing: No blocking or explicit pairing

  4. 4)

    Averaging: Average consensus is reached

  5. 5)

    Tracking: Average is tracked as network state changes

If protocol (15) is applied for a single update, for example when a single node i performs an update at iteration k, then after the update is complete the sum of value estimates in (16) will be incorrect by a factor of \(\xi \sum \limits _{j\in N_i} \left( {\tilde{h}}_j^{(k)} - {\tilde{h}}_i^{(k)}\right)\). To maintain the average an amount can be subtracted from each neighbour’s estimate. This amount does not have to be subtracted immediately and can be queued by each neighbour and subtracted when it next performs an update. We specify the consensus correction variable \(w_i\) to store this value and the resulting protocol is presented in Algorithm 1.

figure a

Algorithm 1 maintains the average:

$$\begin{aligned} \sum \limits _{i\in N} ({\tilde{h}}_i^{(k)} + w_i^{(k)}) = \sum \limits _{i\in N} h_i\quad \ \forall k \end{aligned}$$
(19)

even though the asynchronous nature of the algorithm, defined by the update set \(S^{(k)}\), implies some nodes may not be updated at iteration k.

In practice, we can’t assume that updates for \(w_i\) will not occur in parallel. Therefore all such requests should be queued. Additionally, since a single failure to update \(w_i\) will cause the average to be shifted and condition (19) to be breached, it is important that these updates require an acknowledge message from each neighbour.

Given non-empty update set \(S^{(k)}\), and ignoring constraint (19) such that \(w_i^{(k)}=0,\ \forall i,k\), the update (17) can be synchronously defined in matrix form as follows:

$$\begin{aligned} {\tilde{h}}^{(k)} = \left( \prod \limits _{l=0}^{k} {\varvec{P}}^{(l)}\right) h \end{aligned}$$
(20)

where \({\varvec{P}}\) is the Perron matrix and is defined as:

$$\begin{aligned} {\left\{ \begin{array}{ll} {\varvec{P}}^{(k)} = {\varvec{I}} - \xi {\varvec{D}}^{(k)}\\ D_{ij}^{(k)} = \left\{ \begin{array}{ll} |N_i| &{} \quad j=i \,{\text { and }}\, i\in S^{(k)}\\ -1 &{} \quad j\in N_i \,{\text { and }}\, i\in S^{(k)}\\ 0 &{}\quad \text {otherwise} \end{array} \right. \end{array}\right. } \end{aligned}$$
(21)

where \({\varvec{I}}\) is the identity matrix, and \(|N_i|\) is the cardinality of the neighbour set of node i.

Theorem 1

Assume there exists a positive constant m such that for the sequence \(\left\{ k,k+1,\dots ,k+m\right\}\) the graph associated with the matrix \(\prod \limits _{l=k}^{k+m} {\varvec{P}}^{(l)}\) is fully connected for all k. Then under the iterations specified by algorithm 1, and given step size \(0< \xi < 1/\Delta\) for \(\Delta\)=\(\max _i|N_i|\), all local estimates \({\tilde{h}}_i\) converge to the average of the initial values \(h_i\) as \(k\rightarrow \infty\), such that:

$$\begin{aligned} {\tilde{h}}_i^{(k)} \rightarrow \frac{1}{|N|}\sum \limits _{i\in N} h_i \end{aligned}$$
(22)

Remark

The assumption on the connectivity of the product of Peron matrices can be understood intuitively as there being a uniform upper bound on the number of iterations required before information from one agent can propagate through the network to any other agent.

The following proof is adapted for the asynchronous case from the synchronous convergence analysis provided by [19].

Proof

From the updates in (20), a consensus is reached if the limit \(\lim \limits _{k\rightarrow \infty }\prod \limits _{l=k}^{k+m} {\varvec{P}}^{(l)}\) exists. Having \(0<\xi <1/\mathrm {\Delta }\) gives \(D_{ii}<1\), and \(0<P_{ii}<1,\ \forall i\), and also \(0 < P_{ij}, i\ne j\). It then follows that the matrix \(\prod \limits _{l=k}^{k+m} {\varvec{P}}^{(l)}\) has the following properties:

  1. 1)

    All diagonal elements are non-negative

  2. 2)

    All off-diagonal elements are positive

  3. 3)

    The digraph associated with the matrix is strongly connected

Therefore, the matrix is primitive and according to Lemma 4 from [19] \(\lim \limits _{k\rightarrow \infty } \prod \limits _{l=k}^{k+m} {\varvec{P}}^{(l)}\) exists. It then follows that \({\tilde{h}}_i^{(k)}={\tilde{h}}_j^{(k)},\ \forall i,j\in N\) as \(k\rightarrow \infty\).

The average conservation variable \(w_i\) can be considered a bias in the updates of (17), which does not affect the stability analysis of the algorithm [19]. Given the consensus of the variables \({\tilde{h}}_i^{(k)}\) and since each node is updated such that \(w_i^{(k)}=0\) at least every m iterations, it follows from (18) that \(w_i^{(k)}\rightarrow 0\) as \(k\rightarrow \infty\). Then (19) gives \(\sum \limits _{i\in N} {\tilde{h}}_i^{(k)} = \sum \limits _{i\in N} h_i\) and from consensus \({\tilde{h}}_i^{(k)} \rightarrow \frac{1}{N}\sum \limits _{i\in N} h_i,\ \forall i\in N\).\(\square \)

The preceding proof states that a bias does not affect the stability analysis. This can be seen by following the progression of the average condition with biases added:

$$\begin{aligned} \sum \limits _{i\in N} {\tilde{h}}_i^{(k)} = \sum \limits _{i\in N} \left( h_i + \sum \limits _{j=0}^{k-1} b_i^{(j)} \right) \end{aligned}$$
(23)

Therefore, adding a bias is equivalent to modifying the initial state in terms of (16). It follows that the average condition will converge if \(\sum \limits _{i\in N}\sum \limits _{j=0}^{k-1}b_i^{(j)} \rightarrow C\), for some \(C\in (-\infty ,\infty )\).

For an analysis of the optimal choice of tuning parameter \(\xi\) the reader is referred to [42] where an eigenvalue analysis of the Laplacian provides both admissible and optimal values. This applies to the synchronous case, but extends to the asynchronous case by replacing the Laplacian with its expectation.

4.2 Asynchronous distributed algorithm

The update of (13) requires knowledge of all elements of global state x since it relies on the value of \({\varvec{h}}(x)\). As such, the exact calculation of (13) can only be made centrally. To convert the centralised method of Sect. 3 to a distributed form the inseparable power mismatch constraint, \({\varvec{h}}(x)\), is calculated through the asynchronous consensus protocol of algorithm 1. The local estimate of power mismatch is \({\tilde{{\varvec{h}}}}_i^{(k)}=\left[ {\tilde{h}}_{p_i}^{(k)},{\tilde{h}}_{q_i}^{(k)}\right] ^{\rm{T}}\) for node i at iteration k. The power mismatch estimate update is then given by:

$$\begin{aligned} {\left\{ \begin{array}{ll} {\tilde{h}}_i^{(k+1)} = {\tilde{h}}_i^{(k)} + \xi _h \sum \limits _{j\in N_i} ({\tilde{h}}_j^{(k)} - {\tilde{h}}_i^{(k)}) - w_i \\ \quad \quad \quad \quad + s_i^{(k+1)} - s_i^{(k)} +\sum \limits _{j\in N_i} (s_{ij}({\varvec{x}}^{(k+1)}) - s_{ij}({\varvec{x}}^{(k)}))\\ w_j^{(k+1)} = w_j^{(k)} + \xi _h ({\tilde{h}}_j^{(k)} - {\tilde{h}}_i^{(k)})\quad \ \forall j\in N_i\\ w_i^{(k+1)} = 0 \end{array}\right. } \end{aligned}$$
(24)

where nodal complex power is defined as \({\varvec{s}}_i=[p_i,q_i]^{\rm{T}}\) and line loss as \({\varvec{s}}_{ij}(x)=[p_{ij}(x),q_{ij}(x)]^{\rm{T}}\).

A similar approach is taken for the approximation of the power mismatch multiplier \(\mu\), however since average consensus is not required a standard asynchronous consensus protocol is used without the average maintaining terms \(w_i\):

$$\begin{aligned} \begin{aligned} {\tilde{\mu }}_i^{(k+1)} = {\tilde{\mu }}_i^{(k)} + \xi _\mu \sum \limits _{j\in N_i} \left( {\tilde{\mu }}_j^{(k)} - {\tilde{\mu }}_i^{(k)}\right) + \alpha {\tilde{h}}_i^{(k+1)} \end{aligned} \end{aligned}$$
(25)

The bias terms present in (24) and (25), are \(\left( s_i^{(k+1)} - s_i^{(k)}\right) +\sum \limits _{j\in N_i} \left( s_{ij}^{(k+1)} - s_{ij}^{(k)}\right)\) and \(\alpha {\tilde{h}}_i^{(k+1)}\) respectively. These terms shift the global average according to the change in state at iteration k, but they do not impact the stability of algorithm 1 and therefore they ensure that the estimates \({\tilde{h}}\) and \({\tilde{\mu }}\) track the global values. Therefore, so long as the bias terms’ sums converge, the estimates will converge to the true global values, that is \({\tilde{h}}_i^{(k)}\rightarrow {\frac{1}{N}}h(x^{(k)})\) and \({\tilde{\mu }}_i^{(k)}\rightarrow \mu\) for all \(i\in N\), where \(\mu\) is the global estimate of the optimal multiplier \(\mu ^*\). In this way an approximation can be made for the gradient descent steps of (11):

$$\begin{aligned} \begin{aligned} x^{(k+1)}_i &=P_X\left\{ x^{(k)}_i - \gamma _i^{(k)}\left( \nabla _{x_i} c_i(x_i^{(k)}) \right. \right. \\&\quad + \nabla _{x_i} h(x^{(k)})({\tilde{\mu }}_i^{(k)} + \alpha {\tilde{h}}_i^{(k)}) \\&\quad + \left. \left. \nabla _{x_i} g({\varvec{x}}^{(k)})({\varvec{\lambda}} ^{(k)} + \alpha g({\varvec{x}}^{(k)})) \right) \right\} \end{aligned} \end{aligned}$$
(26)

where \(\nabla _{x_i} h({\varvec{x}}^{(k)})\) and \(\nabla _{x_i} g({\varvec{x}}^{(k)})\) are calculable locally and are non-zero only for elements corresponding to node i and its neighbours [32]. This modification makes a fully distributed solution possible. The asynchronous, distributed algorithm for finding a solution to (6) is presented in algorithm 2, where \(h_i({\varvec{x}})=s_i+\frac{1}{2}\sum \limits _{j\in N_i}s_{ij}({\varvec{x}})\).

figure b

5 Simulation results

We consider the case of a distribution network featuring numerous DG capable of operating in an isolated mode; that is, operating such that power generated within the network is able to match all loads and losses within the network. Furthermore, each bus in the network is equipped with an agent that has knowledge of nodal DG or load power, and has a communication interface with neighbouring agents. The test network is a balanced three phase implementation of a 35 bus subnetwork of the IEEE 123 node test feeder system [43]; the 35 bus subset has been chosen for the sake of simpler presentation of results, however convergence analysis of larger subsets of this network is included below. Only buses 1 to 34 were included in the test network along with bus 149 configured as a slack bus. Dispatchable generators, each with a 500 kW capacity, were attached to buses 1, 3, 8, 14, 18, 26 and 29, and their associated agents were equipped with cost functions \(c_i(p_i,q_i)=0.5p_i^2+0.5q_i^2\). The base voltage was set to 1 p.u.=120 V, voltage magnitudes were constrained according to (3) with \([v^-,v^+]=[0.95,1.05]\) p.u, and base power was set to 1 p.u.=10 kVA.

Algorithm 2 was applied to the test network, initialized with a random feasible state with cost of 512.5, and resulted in the convergence of the Lagrange and cost functions to the cost of a centralized OPF solution as presented in Fig. 2. \(L^*\) denotes the value of a centralised solution to the OPF problem. This convergence also implies that \({\varvec{g}}({\varvec{x}}^{(k)})\rightarrow 0\) and \({\varvec{h}}({\varvec{x}}^{(k)}){\rightarrow } 0\) which is further evident in Fig. 3 which shows the norm of the power flow constraints converging to zero.

Figure 4 shows the estimate of the power mismatch calculated through consensus by each agent (solid green lines), and the average of the true power mismatch (broken red line). It can be seen that the asynchronous consensus protocol of 1 successfully converges on and tracks the true power mismatch \(h_p({\varvec{x}})\) without drifting (similar results were found for \(h_q({\varvec{x}})\)). Furthermore, algorithm 2 successfully reduces the power mismatch, including line loss, to zero. As such all equality constraints are satisfied.

Fig. 2
figure 2

Convergence of Lagrange function and cost function to solution of centralized OPF over iterations of the distributed Algorithm 2

Fig. 3
figure 3

Convergence of power flow constraints, g(x) to zero over iterations of Algorithm 2

Fig. 4
figure 4

Consensus tracking of average active power mismatch by agents through Algorithm 1, and convergence of power mismatch to zero over iterations of Algorithm 2

Figure 5 presents the final voltages of the network which are clearly within voltage magnitude limits. The voltage at bus 24 has been constrained according to (3) (refer to the marker on the 0.95 p.u. lower bound) indicating that the solution lies on the boundary of X. Figure 6 presents the estimates of optimal generated power as iterations of algorithm 2 progress, and are within DG capacities according to (2). Therefore, the arrived at solution is feasible; that is, \({\varvec{x}}\in X\), \({\varvec{g}}({\varvec{x}})=0\), \({\varvec{h}}({\varvec{x}})=0\).

Fig. 5
figure 5

Nodal voltages after convergence of Algorithm 2

Fig. 6
figure 6

Convergence of optimal DG power estimates for each agent over iterations of Algorithm 2

Fig. 7
figure 7

Convergence of normalized Lagrange gradients to zero over iterations of Algorithm 2

Finally, Fig. 7 presents the normalized gradients of the Lagrange function. As described above, the voltage at bus 24 lies on the boundary of X and due to the projection operation of (11) the gradient with respect to \(e_{24}\) and \(f_{24}\) cannot satisfy (10) as \(\epsilon ^{(k)}\rightarrow 0\). As such, these elements of the gradient have been neglected in the presentation of Fig. 7. Clearly, all other gradients successfully approach zero in accordance with (10) such that a local optimum is reached. It should be noted that in many tested scenarios, including the one presented here, the sequence \(\{\epsilon ^{(k)}\}\) could be chosen such that only a single gradient descent step was required at each iteration.

Fig. 8
figure 8

Comparison of convergence of algorithm 1 for networks of varying sizes

Fig. 9
figure 9

Comparison of convergence of Algorithm 2 for networks of varying sizes

To assess the algorithm’s scalability, numerous subsets of the IEEE 123 node test feeder system were considered. As a metric for the convergence of the consensus algorithm the average absolute errors of the power mismatch estimate were taken as a percentage of network power. As a metric of the distributed OPF convergence the state’s deviation from final converged values was taken. Figures 8 and 9 presents the metrics measured against each test network over iterations of algorithm 2. The consensus algorithm shows good convergence with all test cases reaching a neighbourhood of the true value early on, and the larger networks taking progressively longer to fully converge. The distributed OPF algorithm presents similar convergence properties, with a rapid, early decrease in error and full convergence taking an increasing number of iterations in approximate proportion to the network size.

6 Conclusion

We have presented an asynchronous, distributed algorithm for optimal DG control in the Smart Grid, which enforces zero power mismatch between generation, load and line loss, and enforces nodal voltage constraints. An asynchronous averaging consensus protocol was developed and applied to the discovery of power mismatch within the network which is otherwise not calculable by agents since they only possess local and neighbourhood information. The protocol was able to maintain a system average without any synchronization between agents, and was able to drive each agent to converge on the average power mismatch value. The asynchronous, distributed optimization algorithm was combined with the asynchronous consensus protocol to deliver a feasible and locally optimal solution requiring no central coordination or control. Finally, the application of the combined asynchronous, distributed algorithms was presented through a case study, demonstrating its ability to converge to a feasible solution in terms of power flow, power mismatch, and nodal voltage constraints, and to reach a locally optimal solution.