5.2 A Gradient Projection Algorithm
5.2.4 Distributed Gradient Projection Algorithm
5.2.4.2 Distributed Implementation
An important advantage of Algorithm 7 is that it can be implemented in a distributed way. The infrastructure required to implement Algorithm 7 in a distributed way is described as follows.
• There is an agent at each branch busi∈ N+, and a coordinator at the substation bus 0. Call the agent at busiagent ifor brevity.
• Agent i knows the impedance (rij, xij) for all j such that i∼ j; it can measure the voltage vi, the power flow (Pij, Qij), and the current `ij for all j such thati→j; it can control the power consumption (pi, qi); and it can communicate with the coordinator and agentj ifi∼j.
• The coordinator knows the impedance (r0j, x0j) for allj such that 0→j; it can measure the voltage v0, the substation power injection (p0, q0), the power flow (P0j, Q0j), and the current
`0j for allj such that 0→j; and it can communicate with all agents in the network.
Remark 5.7. To implement Algorithm 7 in a distributed way, only buses iwhose power injections (pi, qi)can be controlled need to have agents. For example, if pi =pi andqi =qi, then bus i does not need to have an agent.
There are two key components in the distributed implementation of Algorithm 7: 1) compute gradient∂(p,q)L(p∗, q∗;µ) in a distributed way; and 2) run line search (Algorithm 6) in a distributed way. For clarity, we first present these two key components before describing the distributed imple- mentation of Algorithm 7.
Distributed gradient computation. The approximate gradients (5.5)–(5.6) can be computed in a backward forward sweep as described below.
Let down(i) := {j ∈ N | i ∈ Pj} denote the buses downstream of bus i ∈ N as illustrated in Figure 5.2. Define
i j
0
Backward sweep to update (g,h)
Forward sweep to update (c,d,e,f)
Figure 5.2: Buses down(i) downstream of busilies in the shaded region.
ci = Xn k=1
2Ri∧k µ
vk−vk + µ vk−vk
, i∈ N;
di= Xn k=1
2Xi∧k µ
vk−vk + µ vk−vk
, i∈ N;
ei=X
k→l
rkl
2Pkl
vk
1l∈Pi+`kl
vk
Ri∧k
, i∈ N;
fi=X
k→l
rkl
2Qkl
vk
1l∈Pi+`kl
vk
Xi∧k
, i∈ N.
Then the approximate gradients (5.5)–(5.6) can be simplified as
∂piL=−(2a0p0+b0) (1 +ei) + (2aipi+bi)−ci, i∈ N+; (5.9a)
∂qiL=−(2a0p0+b0)fi−di, i∈ N+. (5.9b) The centralized coordinator has access to p0 and can broadcast 2a0p0 +b0 to all branch buses.
Each agentiknowspi and can easily compute 2aipi+bi. Hence, the main challenge is to compute ci, di, ei, fi in a distributed manner.
The quantities ci, di, ei, fi can be computed recursively. To derive the recursive equations, note that for eachi→j, one has
Ri∧k−Rj∧k=−rij1k∈down(j)
and therefore
ci−cj = Xn k=1
2 (Ri∧k−Rj∧k) µ
vk−vk + µ vk−vk
= −
Xn k=1
2rij1k∈down(j)
µ
vk−vk + µ vk−vk
= −2rij
X
k∈down(j)
µ
vk−vk + µ vk−vk
.
Similarly,
di−dj = −2xij
X
k∈down(j)
µ
vk−vk + µ vk−vk
.
Besides,
1l∈Pj −1l∈Pi=1l=j
and therefore
ei−ej = X
k→l
rkl
2Pkl
vk
1l∈Pi−1l∈Pj
+`kl
vk
(Ri∧k−Rj∧k)
= −X
k→l
rkl
2Pkl
vk 1l=j+`kl
vkrij1k∈down(j)
= −2rijPij
vi −rij
X
k∈down(j)
rkl`kl
vk
.
Similarly,
fi−fj=−2rijQij
vi −xij
X
k∈down(j)
rkl`kl
vk
.
Hence, if we define
gi= X
k∈down(i)
µ
vk−vk + µ vk−vk
, i∈ N+;
hi= X
k∈down(i)
rkl`kl
vk
, i∈ N+,
thenci, di, ei, fi can be computed recursively as
cj =ci+ 2rijgj, i→j; (5.10a)
dj =di+ 2xijgj, i→j; (5.10b)
ej =ei+2rijPij
vi
+rijhj, i→j; (5.10c)
fj =fi+2rijQij
vi +xijhj, i→j. (5.10d)
Algorithm 8Distributed gradient computation
Input: the agent/coordinator at busi∈ N knows the parameter (µ, µ) and impedance (rij, xij) for allj such thati∼j; it can measure the voltagevi, power flow (Pij, Qij), and current`ij for all j such thati→j.
Output: each agenti∈ N+ computes (∂piL, ∂qiL) fori∈ N+. Backward sweep to compute (g, h).
1: each agent i∈ N+ measures vi and`ij for all j such thati→j. On receiving (gj, hj) from all its downstream neighborsj, agent icomputes (gi, hi) according to
gi= µ
vi−vi + µ vi−vi
+ X
j:i→j
gj; hi= X
j:i→j
rij`ij
vi
+hj
, (5.11)
and sends (gi, hi) to its (unique) upstream neighbor;
2: backward sweep terminates when the coordinator receives (gj, hj) from all its downstream neigh- borsj.
Forward sweep to compute (c, d, e, f).
3: the coordinator measuresv0and (P0j, Q0j) for allj such that 0→j, sets c0←0, d0←0, e0←0, f0←0,
and sends (c0, d0, e0+ 2r0jP0j/v0, f0+ 2r0jQ0j/v0) to each downstream neighborj;
4: each agentj∈ N+measuresvjand (Pjk, Qjk) for allksuch thatj→k. On receiving (ci, di, ei+ 2rijPij/vi, fi+ 2rijQij/vi) from its (unique) upstream neighbori, agentjcomputescj, dj, ej, fj
according to (5.10), and sends (cj, dj, ej + 2rjkPjk/vj, fj + 2rjkQjk/vj) to each downstream neighbor k;
Compute gradients.
5: the coordinator broadcasts 2a0p0+b0 to all agentsi∈ N+;
6: once having received 2a0p0+b0 from the substation and computed (ci, di, ei, fi), agent i∈ N+ computes∂piL and∂qiLaccording to (5.9);
To summarize, the distributed gradient projection algorithm is given in Algorithm 8, where L:={i∈ N+|@j such thati→j}
denotes the set of leaf buses. It consists of three main steps:
S1 Backward sweep to compute (g, h): for each agenti∈ N+, when all its downstream neighbors j have computed (gj, hj), computes (gi, hi) according to (5.11).
S2 Forward sweep to compute (c, d, e, f): for each agent j ∈ N+, when its (unique) upstream neighbor ihas computed (ci, di, ei+ 2rijPij/vi, fi+ 2rijQij/vi), computes (cj, dj, ej, fj) as in (5.10).
S3 Compute∂(p,q)L: each agenti∈ N+ computes∂piL and∂qiLaccording to (5.9).
Distributed line search. Line search given in Algorithm 6 can also be implemented in a dis- tributed manner, which gives rise to a distributed implementation of the inner loop of Algorithm 7.
The distributed implementation is presented in Algorithm 9.
In Algorithm 9, each agenti∈ N+keeps track of its last approved power injection (poldi , qiold) and proposes tentative power injections (pnewi , qnewi ) while computing some other quantities (∆si,∆Li,valuenewi ), with which the coordinator decides whether to approve the tentative power injections.
Tentative power injection (pnew, qnew) is computed by gradient projection (5.13a)–(5.13b), where the gradient is computed as in Algorithm 8 and the step size η is controlled by the coordinator.
The coordinator initializesη = 1 and reducesη by a fraction of 1−αuntil voltage constraints are satisfied, i.e.,vi≤vi ≤vi fori∈ N+, and the modified objective function is well-approximated by its linearization, i.e.,Lnew< Lthres (see step 11 in Algorithm 9).
The coordinator decides whether to approve the tentative power injection, i.e., set (pold, qold)← (pnew, qnew), and when to terminate Algorithm 9, i.e., set (p0, q0). In other cases, the coordinator reduces the step sizeηtoαηto ask for the submission of new tentative power injection (pnew, qnew).
The coordinator makes these decisions based on (∆si,∆Li) computed by the agents i ∈ N+. The quantity ∆si captures the update size of (pi, qi), and ∆Li is the product of gradient∂(pi,qi)L and power injection update. In particular, if P
i∈N+∆si ≤, the coordinator decides to stop the inner loop; or else ifLnew ≤Lold+βP
i∈N+∆Li, the coordinator decides to approve the tentative power injection, i.e., (pold, qold)←(pnew, qnew); or else the coordinator reduces the step sizeη by a fraction of 1−α, i.e.,η←αη.
Distributed gradient decent. Algorithm 7 can be implemented in a distributed manner by calling Algorithm 9 for a sequence (µ1, µ2, . . . , µK) of decreasing µas illustrated in Figure 5.3.
Distributed inner loop
with μ1
Distributed inner loop
with μ2
Distributed inner loop
with μ3
Figure 5.3: Flow chart illustrating the distributed implementation of Algorithm 7.
Algorithm 9Distributed inner loop
Input: each agenti∈ N+knows its original power injection (pi, qi), voltagevi, impedance (rij, xij) for neighboring linesi∼j, and power flow (Pij, Qij) for downstream linesi→j; the centralized coordinator at substation bus 0 knows algorithm parameters α,β,µ, and.
Output: each agenti∈ N+ computes a new (p0i, qi0).
1: the coordinator broadcastsµto all agents i∈ N+;
2: each agenti∈ N+ sets (poldi , qoldi )←(pi, qi);
3: each agenti∈ N+ computes
valueoldi =ai poldi 2
+bipoldi +µln(vi−vi) +µln(vi−vi) (5.12) and reports valueoldi to the coordinator;
4: the coordinator computes the original objective value Lold=a0p20+b0p0+ X
i∈N+
valueoldi ;
5: run Algorithm 8 to obtain (∂piL, ∂qiL) for each agenti∈ N+;
6: the coordinator initializes the step size η←1;
7: the coordinator broadcastsη to all agents i∈ N+;
8: each agenti∈ N+ computes pnewi ← Y
[pi,pi]
poldi −η∂piL
; (5.13a)
qinew← Y
[qi,qi]
qoldi −η∂qiL
; (5.13b)
∆si←pnewi −poldi +qinew−qiold; (5.13c)
∆Li←∂piL·(pnewi −poldi ) +∂qiL·(qinew−qiold); (5.13d) valuenewi ←ai(pnewi )2+bipnewi +µln(vi−vi) +µln(vi−vi), (5.13e) and reports (pnewi , qnewi ,∆si,∆Li,valuenewi ) to the coordinator;
9: network power flows stabilize to reach a steady state (P, Q, v, p0, q0);
10: if an agenti∈ N+ detectsvi∈/[vi, vi], the agent sends out a signal to the coordinator;
the coordinator sets η←αη, and returns to Step 7);
11: the coordinator computes
∆s← X
i∈N+
∆si;
Lnew←a0p20+b0p0+ X
i∈N+
valuenewi ; Lthres←Lold+β X
i∈N+
∆Li;
if ∆s≤, the coordinator sends out a signal to terminate the inner loop, i.e., go to Step 13);
else ifLnew> Lthres, the coordinator setsη←αη, and returns to Step 7);
otherwise, the coordinator sends out a signal to update (pold, qold), i.e., go to Step 12);
12: each agenti∈ N+ setspoldi ←pnewi ,qiold←qnewi , and returns to Step 3);
13: the coordinator sets
resetFlag←
(1 ifLnew > Lold, 0 otherwise, and broadcasts resetFlag to all agents i∈ N+;
14: each agents sets
(p0i, q0i)←
((poldi , qiold) if resetFlag = 1, (pnewi , qnewi ) otherwise;