{'fraction_non_alphanumeric': 0.03553927181131211, 'fraction_numerical': 0.007831463247080376, 'mean_word_length': 4.285126467384727, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
A distributed control strategy for reactive power compensation in smart microgrids

We consider the problem of optimal reactive power compensation for the minimization of power distribution losses in a smart microgrid. We first propose an approximate model for the power distribution network, which allows us to cast the problem into the class of convex quadratic, linearly constrained, optimization problems. We then consider the specific problem of commanding the microgenerators connected to the microgrid, in order to achieve the optimal injection of reactive power. For this task, we design a randomized, gossip-like optimization algorithm. We show how a distributed approach is possible, where microgenerators need to have only a partial knowledge of the problem parameters and of the state, and can perform only local measurements. For the proposed algorithm, we provide conditions for convergence together with an analytic characterization of the convergence speed. The analysis shows that, in radial networks, the best performance can be achieved when we command cooperation among units that are neighbors in the electric topology. Numerical simulations are included to validate the proposed model and to confirm the analytic results about the performance of the proposed algorithm.

Most of the distributed optimization methods have been derived for the problem of dispatching part of a large scale optimization algorithm to different processing units [1]. When the same methods are applied to networked control systems (NCS) [2], however, different issues arise: the way in which decision variables are assigned to different agents is not part of the designer degrees of freedom; agents have a local and limited knowledge of the problem parameters and of the system state; moreover, the information exchange between agents can occur not only via a given communication channel, but also via local actuation and subsequent measurement performed on an underlying physical system.
The extent of these issues depends on the particular application. In this work we present a specific scenario, belonging to the motivating framework of smart electrical power distribution networks [3], [4], in which these features play a central role.
In the last decade, the introduction of distributed microgeneration of electric energy (driven by technological advances, economical reasons, and environmental issues), together with an increased demand and the need for higher quality of service, has been driving the integration of a large amount of information and communication technologies (ICT) into the power distribution network.
Among the many different aspects of this transition, we focus on the control of the microgenerators inside a smart microgrid [5], [6]. A microgrid is a portion of the low-voltage power distribution network that is managed autonomously from the rest of the network, in order to achieve better quality of the service, improve efficiency, and pursue specific economic interests. Together with the loads connected to the microgrid (both residential and industrial customers), we also have microgeneration devices (solar panels, combined heat-and-power plants, micro wind turbines, etc.). These devices are connected to the microgrid via electronic interfaces (inverters), whose main task is to enable the injection of the produced power into the microgrid.
In this work we consider the problem of optimal reactive power compensation. Loads belonging to the microgrid may require a sinusoidal current which is not in phase with voltage. A convenient description for this, consists in saying that they demand reactive power together with active power, associated with out-of-phase and in-phase components of the current, respectively. Reactive power is not a "real" physical power, meaning that there is no energy conversion involved nor fuel costs to produce it. Like active power flows, reactive power flows contribute to power losses on the lines, cause voltage drop, and may lead to grid instability. It is therefore preferable to minimize reactive power flows by producing it as close as possible to the users that need it.
We explore the possibility of using the electronic interface of the microgeneration units to optimize the flows of reactive power in the microgrid. Indeed, the inverters of these units are generally oversized, because most of the distributed energy sources are intermittent in time, and the electronic interface is designed according to the peak power production. When they are not working at the rated power, these inverters can be commanded to inject a desired amount of reactive power at no cost [10].
This idea has been recently investigated in the literature on power systems [11], [12], [13]. However, these works consider a centralized scenario in which the parameters of the entire power grid are known, the controller can access the entire system state, and the few agents deployed in the distribution network are dispatched by a October 24, 2011 DRAFT central processing unit. The contribution of this work consists in casting the same problem in the framework of networked control systems, distributed optimization, and large scale complex systems. This approach allows the design of algorithms and solutions which can guarantee scalability, robustness to node insertion and removal, and compliance with the actual communication capabilities of the agents. Up to now, the few attempts of applying these tools to the power distribution networks have focused on grids comprising a large number of mechanical synchronous generators, instead of power inverters. See for example the stability analysis for these systems in [14] and the decentralized control synthesis in [15]. Instead, preliminary attempts of designing distributed reactive power compensation strategies for power inverters have been performed only very recently. However, the available results in this sense are mainly supported by simulations and heuristic approaches [16], and in some cases do not implement any communication or synergistic behavior of the agents [17].
The contribution of this paper is twofold. On one side, it consists in proposing a rigorous analytic derivation of an approximate model of the power flows which is commonly adopted in the power system literature and which allows to cast the optimal reactive power flow (ORPF) problem into a quadratic optimization (Section III). The second contribution is to propose and to analyze a distributed optimization algorithm whose operation is strongly based on the developed model (Section IV). In Section V we show under which conditions the previous algorithm converges to the global optimal solution. In Section VI we show how this algorithm can be optimized by a proper choice of the communication strategy. In Section VII, we finally validate the proposed model and the proposed algorithm via simulations.

II. MATHEMATICAL PRELIMINARIES AND NOTATION
Let G = (V, E, σ, τ ) be a directed graph, where V is the set of nodes, E is the set of edges, and σ, τ : E → V are two functions such that edge e ∈ E goes from the source node σ(e) to the terminal node τ (e). Two edges e and e are consecutive if the intersection {σ(e), τ (e)} ∩ {σ(e ), τ (e )} is not empty. A path is a sequence of consecutive edges (regardless of their direction).
In the rest of the paper we will often introduce complex-valued functions defined on the nodes and on the edges. These functions will also be intended as vectors in C n and C r (where n = |V|, r = |E|). We denote bȳ the operation of element-wise complex conjugation, and by T the operation of matrix transposition.
Let moreover A ∈ {0, ±1} r×n be the incidence matrix of the graph G, defined via its elements If W is a subset of indices, we define by 1 W the column vector whose elements are Similarly, if w is an index, we denote by 1 w the column vector whose value is 1 in position w, and 0 elsewhere, and we denote by 1 the column vector of all ones. Notice that, if the graph G is connected (i.e. for every pair of nodes v, w ∈ V there is a path connecting them), then 1 is the only vector in ker A.  Figure 1. Schematic representation of the adopted microgrid model. In the lower panel a circuit representation is given, where black diamonds are microgenerators, white diamonds are loads, and the left-most element of the circuit represents the PCC. The middle panel illustrates the adopted graph representation for the same microgrid. Circled nodes represent microgenerators and the edge orientation is consistent with the sign of the power line currents. The upper panel shows how the compensators can be divided into overlapping clusters in order to implement the control algorithm proposed in Section IV. Each microgenerator is capable of measuring and actuating the system locally, while each cluster is also provided with some computational capability.
An undirected graph G is a graph in which for every edge e ∈ E, there exists an edge e ∈ E such that σ(e ) = τ (e) and τ (e ) = σ(e). In case the graph has no multiple edges and no self loops, we can also describe the edges of an undirected graph as subsets e ⊆ V with cardinality |e| = 2. By extension, we define a hypergraph H as a pair (V, E) in which edges are subsets of V of arbitrary cardinality.

A. A model of a microgrid
We define a smart microgrid as a portion of the power distribution network that is connected to the power transmission network in one point, and hosts a number of loads and micro power generators, as described for example in [5], [6].
For the purpose of this paper, we model a microgrid as a directed graph G, in which edges represent the power lines, and nodes represent both loads and generators that are connected to the microgrid. These include the residential and industrial consumers, microgenerators, and also the point of connection of the microgrid to the transmission grid (called point of common coupling, or PCC).
We limit our study to the steady state behavior of the system, when all voltages and currents are sinusoidal signals at the same frequency ω 0 . Each signal can therefore be represented via a complex number whose absolute value corresponds to the signal root-mean-square value, and whose phase corresponds to the phase of the signal at t = 0. Therefore the complex number y = |y|e j∠y represents the signal y(t) = |y| √ 2 sin(ω 0 t + ∠y).
In this notation, the steady state of a microgrid is described by the following system variables: • u ∈ C n , where u v is the grid voltage at node v; • i ∈ C n , where i v is the current injected by node v into the grid; • ξ ∈ C r , where ξ e is the current flowing on the edge e.
The following constraints are satisfied by u, i and ξ where A is the incidence matrix of G, and Z = diag(z e , e ∈ E) is the diagonal matrix of line impedances, Each node v of the microgrid is then characterized by a law relating its injected current i v with its voltage u v .
We model the node corresponding to the PCC (which we assume to be node 0) as a constant voltage generator, i.e.
We assume instead that the voltage u v and the current i v of every node v, but the PCC, satisfy the following where s v is the nominal complex power and η v is a characteristic parameter of the node v. The model (4) is called exponential model [18] and is widely adopted in the literature on power flow analysis [19]. Notice that s v is the complex power that the node would inject into the grid if the voltage at its point of connection was U 0 . Notice also that, by properly choosing the parameters η v , equation (4) describes the behavior of constant power, constant current, and constant impedance devices (with η v = 0, 1, 2 respectively). In this sense, this model is also a generalization of ZIP models [18], which also are very common in the power system literature.
It is correct to say that equation (4) models the steady state of the vast majority of residential and industrial loads. Microgenerators also fit in this model, with η v = 0, as they generally are commanded via a complex power reference and they are capable of injecting it independently from the voltage at their point of connection [5], [6].
The task of solving the system of nonlinear equations given by (1), (2), (3), and (4) to obtain the grid voltages and currents, given the network parameters, the injected nominal powers {s v , v ∈ V\{0}} at every node, and the nominal voltage U 0 at the PCC, has been extensively covered in the literature under the denomination of power flow analysis (see for example [20,Chapter 3]).
In the following, we derive an approximate model for the microgrid state, which will be used later for the setup of the optimization problem and for the derivation of the proposed distributed algorithm. To do so, a couple of technical lemmas are needed.
Lemma 1. Let L be the complex valued Laplacian L := A T Z −1 A. There exists a unique symmetric matrix where, we recall, [1 0 ] v = 1 for v = 0, and 0 otherwise and I is the identity matrix.
Proof: Let us first prove the existence of X. Note that ker L = span 1 = ker(I − 11 T 0 ), and therefore there exists X ∈ C n×n such that X L = (I − 11 T 0 ). Let X = X (I − 1 0 1 T ). Then Existence is therefore guaranteed. To prove uniqueness, notice that and uniqueness of X follows from the uniqueness of the inverse. Moreover, as L = L T , we have The matrix X depends only on the topology of the microgrid power lines and on their impedance (compare it with the definition of Green matrix in [21]). Indeed, it can be shown that, for every pair of nodes (u, v), where Z eff is a complex-valued matrix whose elements Z eff uv represent the effective impedance of the power lines between node u and v.
If we fix the nominal voltage U 0 at the PCC, all the currents i and the voltages u are therefore determined by the equations where the first equation results from (1), (2), and (3) together with Lemma 1.
We can see the currents i and the voltages u as functions i(U 0 ), u(U 0 ) of U 0 . The following proposition provides the Taylor approximation of i(U 0 ) for large U 0 .
The proof of this proposition is based on elementary multivariable analysis but requires a quite involved notation. For this reason it is given in the appendix. The quality of the approximation proposed in the previous proposition relies on having large nominal voltage U 0 and relatively small currents injected by the inverters (or supplied to the loads). This assumption corresponds to correct design and operation of power distribution networks, where indeed the nominal voltage is chosen sufficiently large (subject to other functional constraints) in order to deliver electric power to the loads with relatively small power losses on the power lines.
Numerical simulation in Section VII will indeed show that the approximation is extremely good when power distribution networks are operated in their regular regime.
Remark. Notice that this approximation, in similar fashions, has been used in the literature before for the problem of estimating power flows on the power lines (see among the others [22], [17] and references therein).
It is also possible to show the analogy between this approximation and the quite common assumption of power flow conservation across the power network. The analytical rigorous justification proposed here, however, allows us to estimate the approximation error, and, more importantly, will provide the tools to understand what information on the system state can be gathered by properly sensing the microgrid.

B. Power losses minimization problem
Similarly to what has been done for example in [23], we choose active power losses on the power lines as a metric for optimality of reactive power flows. The total active power losses on the edges are given by where we used (2) to express ξ as a function of u. Via (7) and by exploiting the properties (5) of X, we have Let s be the vector of all nominal complex powers s v , including s 0 := − v∈V\{0} s v . Then, by plugging in the approximate system state (8), we have where s is decomposed into the injected active power p = Re(s) and the injected reactive power q = Im(s), and whereJ(U 0 , s) :=δ T Re(X)s +s T Re(X)δ +δ T Re(X)δ is infinitesimal as U 0 tends to infinity and so it can be neglected. Therefore, via the approximate model (8), we have been able to • approximate power losses as a quadratic function of the injected power; • decouple the problem of optimal power flows into the problem of optimal active and reactive power injection.
In the scenario that we are considering, we are allowed to command only a subset C ⊂ V of the nodes of the microgrid (namely the microgenerators, also named compensators in this framework). We denote by m := |C| its cardinality. Moreover, we assume that for these agents we are only allowed to command the amount of reactive power injected into the grid, as the decision on the amount of active power follows imperative economic criteria (for example, in the case of renewable energy sources, any available active power is typically injected into the grid to replace generation from traditional plants, which are more expensive and exhibit a worse environmental impact -see [10]).
The problem of optimal reactive power injection at the compensators can therefore be expressed as a quadratic, linearly constrained problem, in the form {Im(s v ), v ∈ V\C} being the nominal amount of reactive power injected by the nodes that cannot be commanded.
The solution of the optimization problem (9) would not pose any challenge if the nodes knew the problem parameters X and {Im(s v ), v ∈ V\C}. These quantities depend both on the grid parameters and the power demand of all the microgrid devices, therefore it is unpractical that every agent is capable of retrieving all this information, and, in the case of a large scale system, it would be also preferable to avoid the presence of a centralized agent collecting all the necessary data.

IV. A RANDOMIZED DISTRIBUTED ALGORITHM
In this section, we present an algorithm that can be distributed across the agents of the microgrid, meaning that it can be implemented by the compensators without the supervision of any central controller, by performing local measurements, data processing, and actuation. The proposed approach consists in decomposing the optimization problem into smaller, tractable subproblems that are assigned to small groups of agents. We will show that the agents can solve their corresponding subproblems via local measurement, local knowledge of the grid topology, and minimal communication. We will finally show that the iterative, randomized, solution of these subproblems yields the solution of the original optimization problem.
It is worth remarking that the decomposition methods proposed in most of the literature on distributed optimization, for example in [24], cannot be applied to this problem because the cost function in (9) is not separable into a sum of individual terms for each agent. Approaching the decomposition of this optimization problem via its dual formulation (as proposed in many works including the recent [25]) is also unlikely to succeed, as the feasibility of the system state must be guaranteed at any time during the optimization process.

A. Optimization problem decomposition
Let the compensators be divided into possibly overlapping sets C 1 , . . . , C , with i=1 C i = C. This family of subsets can be interpreted as the edges of a hypergraph H defined over the set of compensator nodes C. Nodes belonging to the same set (or cluster) are able to communicate each other, and they are therefore capable of coordinating their actions and sharing their measurements. Each cluster is also provided with some computational capabilities, in the form of a cluster supervisor, possibly one of the compensators.
The proposed optimization algorithm consists of the following, repeated steps: 2) the agents in C i(t) , by coordinating their actions and communicating, determine the new feasible state that minimizes J(q), solving the optimization subproblem in which all the nodes that are not in C i(t) keep their states constant; 3) the agents in C i(t) actuate the system by updating their state (the injected reactive power).
In order to describe more precisely this procedure, we rewrite the optimization (9) distinguishing the controllable and the uncontrollable components of the vector q. Assume with no loss of generality that the first m components of q are controllable (i.e. they describe the reactive power injected into the grid by the compensators) and that the remaining n − m are not controllable. Let us then partition q as where q C ∈ R m and q V\C ∈ R n−m . According to this partition of q, let us also partition the matrix Re(X) as Let us also introduce some convenient notation. Consider the subspaces and the m × m matrices Notice that S i = span Ω i . We list some useful properties of these matrices.
If the system is in the state q and the nodes in the cluster C i are activated, they perform the following optimization arg min Using the standard formulas for quadratic optimization it can be shown that where is the gradient of J(q C , q V\C ) with respect to the decision variables q C .
We prove now that the computation of q opt, i C can be performed by the nodes in a distributed way via a From the previous properties we get that In the following, we show how each node h ∈ C i can compute (14) on the basis of the information available to the cluster C i .

B. Hessian estimation from local topology information
Agents belonging to the cluster C i can infer some information about the Hessian M . More precisely they can determine the matrix Ω i M Ω i appearing in (14). Define now R eff as a m × m matrix with entry in h, k equal to Re Z eff hk , where Z eff hk are the mutual effective impedances between pairs compensators h, k. From (6) and (10) we have that and so we can write where diag(M ) is the m × m diagonal matrix having the same diagonal elements of M . Consequently, since We can therefore argue that the elements of the matrix Ω i M Ω i can be obtained by the nodes from the mutual effective impedances Z eff hk for h, k ∈ C i . These impedances are assumed to be known by the nodes belonging to the cluster. This is a reasonable hypothesis, since the mutual effective impedances can be obtained from either a priori knowledge of the local microgrid topology, or via online estimation procedures as in [26], or via ranging technologies over power line communications as suggested in [27].
Then the nodes need to compute the pseudo-inverse of Ω i M Ω i . Notice that all these operations have to be executed offline once, as these coefficients depend only on the grid topology and impedances.

C. Gradient estimation via local voltage measurement
Assume that nodes in C i can measure the grid voltage at their point of connection (via phasor measurement units that return both amplitude and phase of the measured voltage -see [28], [29]). Let moreover assume the following about power line impedances.
Assumption 3. All power lines in the microgrid have the same inductance/resistance ratio, i.e.
where Z is a diagonal real-valued matrix, whose elements are Z ee = |z e |. Consequently, L = e −jθ A T Z −1 A, and X := e −jθ X is a real-valued matrix.
This assumption seems quite reasonable in most practical cases (see for example the IEEE standard testbeds [30]). The possible effects of this approximation will be commented in Section VII.
Let then each agent k ∈ C i compute ν (i) Observe that By using (7), we have where we used the fact that, by (8),Ū 0 i =s + δ. The third term of the sum is, according to (13), The first and the fourth terms of the sum form the quantitỹ which is infinitesimal for large U 0 and so it can be ignored. The second and the last terms form the quantity which does not depend on the node h but only on the selected cluster C i . Therefore we can write

D. Description of the algorithm
From the above consideration, starting from equation (14), we propose the following iterative algorithm. If we assume that at time t the system is in the state q(t) ∈ R n and that the cluster i is activated. Then the new state q(t + 1) will be such that q h (t + 1) = q h (t) for all h ∈ C i , while the node h ∈ C i will inject the new reactive power where we used that fact that, as ker(Ω i R eff Ω i ) = ker Ω i , the term α (i) in (17) disappears, while the termsν have been neglected since they are infinitesimal.
We have therefore shown as the proposed algorithm can be implemented by the agents of the microgrid in a distributed way. In a preliminary, offline phase, each cluster computes Ω 1 R eff Ω i . Then, at every iteration of the algorithm: • a cluster C i is randomly chosen; • every agent h not belonging to the cluster C i holds its injected reactive power constant; • every agent h belonging to the cluster C i senses the grid voltage at its point of connection, computes ν (i) h as in (16), and then updates its injected reactive power according to (18).
Remark. It is important to notice that the distributed implementation of the algorithm is only possible because of the specific physical system that we are considering. By sensing the system locally, nodes can infer some global information on the system state (namely, the gradient of the cost function) that otherwise would depend on the states of all other agents. For this reason, it is necessary that, after each iteration of the algorithm, the agents actuate the system implementing the optimization step, so that subsequent measurement will reflect the state change. This approach resembles some other applications of distributed optimization, e.g. the radio transmission power control in wireless networks [31] and the traffic congestion protocol for wired data networks [32], [33]. Also in these cases, the iterative tuning of the decision variables (radio power, transmission rate) depends on congestion feedback signals that are function of the entire state of the system. However, these signals can be detected locally by each agent by measuring error rates, signal-to-noise ratios, or specific feedback signals in the protocol.

V. CONVERGENCE OF THE ALGORITHM
In this section we will give the conditions ensuring that the proposed iterative algorithm converges to the optimal solution, and we will analyze its convergence rate.

A. A necessary condition for convergence
Consider the discrete time system This system describes the ideal iterative optimization algorithm based on the steps described in (12). It therefore approximates the iterative update law (18), and we refer to it for studying the convergence of the proposed algorithm. We introduce the auxiliary variable x = q C −q opt C ∈ R m , where q opt is the solution of the optimization problem (9), and q opt C are the elements of q opt corresponding to the nodes in C. In this notation, it is possible to explicitly express the previous discrete time ( 19) system as where The matrices F i have some nice properties which are listed below: i) the matrices F i are projection operators, i.e. F 2 i = F i , and they are orthogonal projections with respect to the inner product ·, · M , defined as x, y M := x T M y. In other words, ii) The matrices F i are self-adjoint matrices with respect to the inner product ·, · M , i.e. F T i M = M F i , thus having real eigenvalues.
Notice that, as span(Ω i M Ω i ) = span Ω i , ker 1 T is a positively invariant set for (20), namely F i (ker 1 T ) ⊆ ker 1 T for all i.
It is clear that q(t) converges to the optimal solution q opt is if and only if x(t) converges to zero for any initial condition x(0) ∈ ker 1 T . A necessary condition for this to happen is that there are no nonzero equilibria in the discrete time system (20), namely that the only x ∈ ker 1 T such that F i x = x for all i must be x = 0.
The following proposition provides a convenient characterization of this property. We need the following lemma first.
Proof: Let us prove the reverse implication first. Assume that span[Ω 1 . .
. Ω ] = ker 1 T and that x ∈ ker 1 T is such that F i x = x for all i. Then we can find y i ∈ R n such that Moreover, as F i x = x for all i, then (Ω i M Ω i ) M x = 0 and so, by the properties mentioned above, we can argue that M x ∈ ker Ω i . We therefore have and so, since M is positive definite, it yields that x = 0.
We prove now the other direction. The inclusion span[Ω 1 . .
. Ω ] ⊆ ker 1 T is always true and follows from the fact that span Ω i ⊆ ker 1 T . We need to prove only the other inclusion. Suppose that x = 0 is the only point in ker 1 T such that F i x = x for all i. This means that which implies that R m = span 1 + span(I − F T 1 ) + · · · + span(I − F T ) Take now any x ∈ ker 1 T . Then there exist a α ∈ R and y i ∈ R m such that where we have used the fact that span(Ω i XΩ i ) = span Ω i . From the fact that span Ω i ⊆ ker 1 T , we can argue that w ∈ ker 1 T and so it follows that 0 = w T α1 = w T M w. Finally, since M is positive definite, we can conclude that w = 0 and so that x ∈ span[Ω 1 . .
The condition expressed in Lemma 4 can also be expressed as a connectivity test. Let H be the hypergraph having the elements in C as nodes and the sets C i , i = 1, 2, . . . , as hyperedges. This hypergraph describes the communication network needed for implementing the algorithm. Proof: Consider the matrix W ∈ R m×m with entries W hk equal to the number of the sets C i which contain both h and k. Let G W be the weighted graph associated with W . It is quite easy to see that the hypergraph having C i as edges is connected if and only if G W is a connected graph.
Let us define δ Ci : C → {0, 1} as the characteristic function of the set C i , namely a function of the nodes that is 1 when the node belongs to C i and is zero otherwise. Then the Laplacian L W of G W can be expressed as follows Notice that the graph connectivity is equivalent to the fact that ker L W = span 1 and so, by the previous equality, it is equivalent to which is equivalent to (21). The proposition statement then follows from Lemma 4.

B. Convergence and rate of convergence
In order to prove that the connectivity of the hypergraph H is not only a necessary but also a sufficient condition for the convergence of the algorithm, we introduce the following assumption on the sequence i(t). Let v(t) := E x T (t)M x(t)) = J(q(t)) − J(q opt ) and consider the following performance metric R = sup which describes the exponential rate of convergence to zero of v(t). It is clear that R < 1 implies the exponential mean square convergence of q C (t) to the optimal solution q opt C . Using (20), we have

Let us then define
Via Assumption 6, we can argue that ∆(t) satisfies the following linear recursive equation where L(∆) Equations (22) and (23) can be seen as a discrete time linear system with state ∆(t) and output v(t).
Remark. The discrete time linear system (22) can be equivalently be described by the equation where vec(·) stands for the operation of vectorization and where Notice that F is self-adjoint with respect to the inner product ·, · M −1 ⊗M −1 and so F, and consequently L, has real eigenvalues.
Studying the rate R (which can be proved to be the slowest reachable and observable mode of the system (22)-(23) [34]) is in general not simple. It has been done analytically and numerically for some special graph structures in [34]. It is convenient to analyze its behavior indirectly, through another parameter which is easier to compute and to study. Let us define We have the following result.
Theorem 7. Assume that Assumption 6 holds true and that the hypergraph H is connected. Then Before proving Theorem 7, observe that the following result descends directly from it.
Corollary 8. Assume that Assumption 6 holds true and that the hypergraph H is connected. Then the state of the iterative algorithm described in Section IV-A converges in mean square to the global optimal solution.
Remark. Observe that, by standard arguments based on Borel Cantelli lemma, the exponential convergence in mean square implies also almost sure convergence to the optimal solution.
In order to prove Theorem 7 we need a few technical lemmas.
Lemma 9. Let P, Q ∈ R m×m and P ≥ Q.
Proof: From the definition of L, we have By iterating these steps t times we then obtain L t (P ) ≥ L t (Q).
And so, since also F ave is self-adjoint, its eigenvalues are real and are smaller than or equal to 1 in absolute value.
Assume now that F ave x = λx, with |λ| = 1. Then we have If Assumption 6 holds (and thus the probabilities ρ i 's are all strictly greater than 0), then the last inequality implies that F i x M = x M for all i's. As F i are projection matrices, it means that F i x = x and so M x ∈ ker Ω T i , ∀i. Using the fact that span Ω 1 · · · Ω = ker 1 T , we necessarily have x = M −1 1. By inspection we can verify that the left eigenvector corresponding to the same eigenvalue is 1.
We can now give the proof of Theorem 7.
The tightness of β as a bound for R has been studied in [34], by evaluating both β and R analytically and numerically for some special graph topologies. In the following we consider β as a reliable metric for the evaluation of the algorithm performances.
The following result shows what is the best performance (according to the bound β on the convergence rate R) that the proposed algorithm can achieve.
Theorem 12. Consider the algorithm (19), and assume that H describing the clusters C i is an arbitrary connected hypergraph defined over the nodes C. Let Assumption 6 hold. Then In case all the sets C i have the same cardinality c, namely |C i | = c for all i, then Proof: Let It is clear that β = 1 − β , where β = min{|λ| | λ ∈ λ(E ave ), λ = 0}. We have that λj ∈λ(Eave) Notice now that E i have eigenvalues zero or one and so This implies that λj ∈λ(Eave) and so

VI. OPTIMAL COMMUNICATION HYPERGRAPH FOR A RADIAL DISTRIBUTION NETWORK
In this section we present a special case in which the optimal convergence rate of Theorem 12 is indeed achieved via a specific choice of the clusters C i . To obtain this result we need to introduce the following assumption, which is commonly verified in many practical cases (see for example the standard IEEE testbeds [30]).
Assumption 13. The distribution network is radial, i.e. the corresponding graph G is a tree.
We start by providing some useful properties of the matrices E i .

Lemma 14.
The following properties hold true:

Proof:
i) First observe that, since M is invertible, then span E i = span(Ω i M Ω i ) M = span(Ω i M Ω i ) . Finally from the properties of the matrices (Ω i M Ω i ) , we obtain that span E i = span Ω i .

ii) First observe that E
iii) Let x ∈ span Ω i = span E i . Then x = E i z for some vector z and so Let us now consider for any pair of nodes h, k the shortest path P hk ⊆ E (where, we recall, a path is a sequence of consecutive edges) connecting h, k. Define moreover Lemma 15. Let Assumption 13 hold true. Then ii Proof: where with some abuse of notation we have denoted with the same symbol 1 h the vector in R m and the corresponding vector in R n . Notice that, if we have a current i = 1 r − 1 s in the network, then according to (7) we get a voltage vector ii) If P Ci ∩ P hk = ∅, then We give now the key definition to characterize, together with connectivity, the optimality of the communication hypergraph H. In order to prove the optimality of having edge-disjoint clusters, we need the following lemma.
Lemma 17. Assume that Assumptions 13 holds true and that the clusters C i are edge-disjoint. Then E i E j = 0 for all i = j.
Proof: Let x be any vector in R m . Notice that, since span E j = span Ω j , then there exists z ∈ R m such that where the last equality follows from the fact that P Ci ∩ P rs = ∅ for all r, s ∈ C j .
From the previous lemma we can argue that every vector in span Ω i is eigenvector of E ave = i=1 ρ i E i associated with the eigenvalue ρ i . On the other hand, recall that the hypergraph connectivity implies that span E i and hence we have that, besides the zero eigenvalue, the eigenvalues of E ave are exactly ρ 1 , . . . , ρ and so The bound β is minimized by taking ρ i = 1/ for all i, obtaining Notice finally that E i E j = 0 for all i = j implies that i=1 span E i is a direct sum and then If all the sets C i have the same cardinality c, then c = m + − 1, and so which, according to Theorem 12, shows the optimality of the hypergraph.

VII. SIMULATIONS
In this section we present numerical simulations to validate both the model presented in Section III, and the randomized algorithm proposed in Section IV.
To do so, we considered a 4.8 kV testbed inspired from the standard testbed IEEE 37 [30], which is an actual portion of power distribution network located in California. We however assumed that load are balanced, and therefore all currents and voltages can be described in a single-phase phasorial notation.
As shown in Figure 2, some of the nodes are microgenerators and are capable of injecting a commanded amount of reactive power. Notice that the PCC (node 0) belongs to the set of compensators. This means that the microgrid is allowed to change the amount of reactive power gathered from the transmission grid, if this reduces the power distribution losses. The nodes which are not compensators, are a blend of constant-power, constant-current, and constant-impedance loads, with a total power demand of almost 2 MW of active power and 1 MVAR of reactive power (see [30] for the testbed data). to ∠z(e) = 0.59. This justifies Assumption 3, in which we claimed that ∠z(e) can be considered constant across the network. The effects of this approximation will be commented later.
Without any distributed reactive power compensation, distribution power losses amount to 61.6 kW, 3.11% of the delivered active power.
Given this setup, we first estimate the quality of the linear approximated model proposed in Section III. As shown in Figure 3, the approximation error results to be negligible.
We then simulated the behavior of the algorithm proposed in Section IV. We considered the two following clustering choices: • edge-disjoint gossip: motivated by the result stated in Section VI, we enabled pairwise communication between compensator in a way that guarantees that the clusters (pairs) are edge-disjoint; the resulting hypergraph H is represented as a dashed line in Figure 2; • star topology: clusters are in the form C i = {0, v} for all v ∈ C\{0}; the reason of this choice is that, as 0 is the PCC, the constraint 1 T q = 0 is inherently satisfied: whatever variation in the injected reactive power is applied by v, it is automatically compensated by a variation in the demand of reactive power from the transmission grid via the PCC.
In Figure 4 we plotted the result of a single execution of the algorithm in the edge-disjoint gossip case. One can see that the algorithm converges quite fast, reducing losses to a minimum that is extremely close to the best achievable solution. The results achieved by the proposed algorithm on this testbed are summarized in the following node v   minimum achieved by the algorithm proposed in this paper is partly due to the approximation that we introduced when we modeled the microgrid (assuming large nominal voltage U 0 ), and partly due to the assumption that θ is constant across the network. Further simulative investigation on this testbed showed that the effect of this last assumption is largely predominant, compared to the effects of the approximation in the microgrid state equations. Still, the combined effect of these two terms is minimal, in practice.
In Figure 5 we compared the behavior of the two considered clustering strategies, plotted together with the curve representing the best achievable performance as given in Theorem 12. One can notice different things.
First, both strategies converge to the same minimum, which is slightly larger than the minimum losses that could be achieved by solving the original, nonconvex optimization problem. As expected, the clustering choice do not affect the steady state performance of the algorithm. Second, the performance of the edge-disjoint gossip algorithm results indeed to be better than the star topology in the long-time regime, as the analysis in Section VI suggests, and corresponds to the fastest achievable performance, as predicted by Theorem 12. Third, one can see that, while the performance metric that we adopted is meaningful for describing the long-time regime, it does not describe the initial stage (or short-time behavior), when the full dynamics of the system (19) contribute to the algorithm behavior. This fact suggests that a different metric should possibly be adopted, in order to better characterize the two regimes. The choice of the most appropriate metric requires a preliminary characterization of how fast the reactive power demands change in the microgrid, compared with the rate of execution of the algorithm iterations. If the time-varying demands are much slower than the algorithm, then we expect that the analysis of the slowest eigenvalue remains the most meaningful choice. On the contrary, if the rate of change of demands is comparable with the rate of execution of the algorithm, then we expect that a different index will have to be considered to characterize the algorithm performance.

VIII. CONCLUSIONS
The proposed model for the problem of optimal reactive power compensation in smart microgrids exhibits two main features. First, it can be casted into the framework of quadratic optimization, for which robust solvers are available and the performance analysis becomes tractable; second, it shows how the physics of the system can be exploited to design a distributed algorithm for the problem.
On the basis of the proposed model, we have been able to design a distributed, leaderless and randomized algorithm for the solution of the optimization problem, requiring only local communication and local knowledge of the network topology.
We then proposed a metric for the performance of the algorithm, for which we are able to provide a bound on the best achievable performances. We are also able to tell which clustering choice is capable of giving the optimal performances. It is interesting that the optimal strategy requires short-range communications: this is somehow surprising, considered that consensus algorithm (which share many features with the proposed algorithm) benefit from long-range communication that shorten the graph diameter. At the same time, this result is also motivating from the technological point of view, because achieving cooperation of inverters that are far apart in the microgrid presents a number of issues (e.g. time synchronization, limited range of power line communication technologies).
Motivated by the final remarks of Section VII, we plan to add two elements to the picture in the next future in order to understand if the proposed metric is really meaningful for the real problem. These elements are the network dynamics (both the dynamic behavior of the power demands, and the electrical response of the system when actuated), and the presence of operational constraints for the compensators, whose capability of injecting We want to give the Taylor approximation of i( ) around = 0.
Let us define and substitute them into (28). We get a system of equations in δ, λ, which can be written as We have 2n complex equations in 2n + 1 complex variables.
We interpret now the complex numbers as vectors in R 2 and G v , F v as functions from R 2n × R 2n × R 2 to R 2 .
which is invertible.