Consensus Control for Reactive Power Sharing Using an Adaptive Virtual Impedance Approach

Reactive power sharing among distributed generators (DGs) in islanded microgrids (MGs) presents control challenges, particularly in the mismatched feeder line condition. Improved droop control methods independently struggle to resolve this issue and centralized secondary control methods exhibit a high risk of collapse for the entire MG system under any failure in the central control. Distributed secondary control methods have been recently proposed to mitigate the reactive power error evident in the presence of mismatched feeder lines. This paper details a mathematical model of an adaptive virtual impedance control that is based on both leaderless and leader-followers consensus controls with a novel triangle mesh communication topology to ensure accurate active and reactive power sharing. The approach balances an enhanced rate of convergence with the anticipated implementation cost. A MATLAB/Simulink model with six DG units validates the proposed control performance under three different communication structures: namely, ring, complete, and triangle mesh topologies. The results suggest that leaderless consensus control is a reliable option with large DG systems, while the leader-followers consensus control is suitable for the small systems. The triangle mesh communication topology provides a compromise approach balancing the rate of convergence and the expected cost. The extensibility and scalability are advantages of this topology over the alternate ring and complete topologies.


Introduction
Recently, increased power demand has been one of the primary challenges associated with the power systems in many countries. Smart Grid (SG) technologies provide solutions for meeting the increased load demand; ensuring power quality, reliability, and efficiency; and, reducing the emission of carbon dioxide associated with global climate change [1]. Microgrids (MGs) are one of the dominant Smart Grid technologies that have attracted research interest in response to efforts to integrate distributed generators (DG) into the utility grid or as standalone systems [1]. Research has extensively investigated the design, operation, and control of these microgrids, particularly in the islanded mode. Numerous studies have proposed hierarchical control techniques to manage both power flow and power sharing among distributed generators (DGs) in the islanded case [2][3][4]. However, in the interconnected DG case, the lack of effective power sharing among DGs and inverters causes mismatched power sharing that might damage the DG sources and often leads to instability in the microgrid during transient changes in the load [2,3,5].
Sharing reactive power presents a significant challenge in the case of mismatched feeder lines where feeder line impedances are different from one to another. The influence of feeder line impedance  Each DG unit is connected through feeder lines to two other DGs that can be considered to be its neighbors (j th DG units).

Modeling of the Communication Network of the Microgrid
The communication topology is defined as the arrangement of agents and communication lines of the communication network [32]. Building a communication network is required in the secondary control level of the hierarchal control to allow for the DG units to communicate with each other. In general, communication agents do not need to have a direct communication link to all other agents in the system. Rather, the existence of some communication path to every agent via other agents is necessary to guarantee the communication topology connectivity [19,20,32,33].

A Graph Theory Approach
Mathematically, the communication network of the microgrid can be represented using graph theory, an approach that permits the description of the communication infrastructure [33].
Definitions: Definition 1. A graph (G) consists of a collection of agents (V) and a collection of edges (E), that can be written as G = (V, E). Each edge e ∈ E joins two nodes u and v at its endpoints. Given e joins i and j ∈ V, we can write e = i, j . In this case, agents u and v are known as adjacent, and edge e is known as incident with agents u and v respectively. Often, V is written as V(G) and E as E(G) to denote the collection of agents and edges associated with the graph (G) respectively [32].  Here, every agent communicates with all other agents to reach a consensus decision. Thus, all of the agents act as central agents ensuring a robust system that exhibits the fastest coverages to the consensus region when compared to other distributed topologies [21,24]. This structure requires a substantial number of communication links that increase the cost of the communication infrastructure [21]. Additionally, expanding this topology is highly expensive, especially in large systems [21].   Figure 4 illustrates another example of a distributed communication topology is the complete communication topology. Here, every agent communicates with all other agents to reach a consensus decision. Thus, all of the agents act as central agents ensuring a robust system that exhibits the fastest coverages to the consensus region when compared to other distributed topologies [21,24]. This structure requires a substantial number of communication links that increase the cost of the communication infrastructure [21]. Additionally, expanding this topology is highly expensive, especially in large systems [21].

Proposed Communication Topology
A consideration of the ring and complete communication topologies' performance characteristics suggests a need to build a new topology that balances the rate of convergence and the system cost, which also takes into consideration the network's extensibility, scalability, and fault tolerance. Here, a new communication topology is proposed to achieve this goal and it is termed a triangle mesh communication topology.
Defining terms according to definitions in [24,25], the degree of all agents, which is the number of agents incident with an agent, for this proposed control (a measure of an agent's connectivity to the network) is not the same, unlike the ring topology (degree of 2) and the complete topology (degree of − 1). Here, the highest degree of any agent is four for agents located at the center of the communication graph. The other terminal agents have a degree of two or three. For the example shown in Figure 5, agents 3 and 4 have a degree of four, and agents 1 and 6 and agents 2 and 5 have a degree of three and two, respectively. This proposed topology is easy to expand and expanding causes extensive growth of centralized agents that have a degree of four. In addition, an extension of the system does not require any interruption to the network activity.

Proposed Communication Topology
A consideration of the ring and complete communication topologies' performance characteristics suggests a need to build a new topology that balances the rate of convergence and the system cost, which also takes into consideration the network's extensibility, scalability, and fault tolerance. Here, a new communication topology is proposed to achieve this goal and it is termed a triangle mesh communication topology.
Defining terms according to definitions in [24,25], the degree of all agents, which is the number of agents incident with an agent, for this proposed control (a measure of an agent's connectivity to the network) is not the same, unlike the ring topology (degree of 2) and the complete topology (degree of N − 1). Here, the highest degree of any agent is four for agents located at the center of the communication graph. The other terminal agents have a degree of two or three. For the example shown in Figure 5, agents 3 and 4 have a degree of four, and agents 1 and 6 and agents 2 and 5 have a degree of three and two, respectively. This proposed topology is easy to expand and expanding causes extensive growth of centralized agents that have a degree of four. In addition, an extension of the system does not require any interruption to the network activity. With reference to Figure 5, above, two new agents (agents 7 and 8) are added to the communication topology, with two communication links that are necessary to connect each new agent into the communication topology Adding a new agent causes changes in the degree of nonmaximum agents in the network, and generates a new agent with a degree 4. Thus, agents 1 and 6 now have four communication links.

Mathematical Model of the Proposed Control Method
The proposed control methodology presented in this subsection consists of primary and secondary control levels with a hierarchical control structure to ensure an accurate reactive power sharing control among DG units under mismatched feeder line impedance conditions. The primary level consists of droop control, adaptive virtual impedance control, and dual voltage and current loops. In the secondary level, leaderless and leader-followers consensus control algorithms are designed to update the primary level. An analytical study of reactive power sharing is considered since the proposed control aims to provide accurate reactive power sharing among DG units in an islanded microgrid. The stability of the reactive power sharing based on consensus control is explored and proven to be asymptotically stable. Figure 6, below, illustrates the overall structure of the hierarchical control. The measured output voltage and current are converted into 0 frame and then used to calculate the active and reactive power. The power quantities are used to regulate frequency and voltage and then adaptive virtual impedance control adjust the voltage regulation in order to adjust the reference voltage for the inverter. The 0 quantity is converted back to the frame based on the reference frequency and voltages and then go through PI voltage and current loops to Sinusoidal Pulse Width Modulation (SPWM) in order to feed the inverter, as shown in Figure 6. Each DG unit and its primary control are connected to other DG units in a ring feeder distribution system, as shown in Figure 1. In Figure 6, the consensus control is considered to be a secondary control that communicates between DG units in order to exchange the information. In this figure, blue arrow indicates physical lines, black arrow indicates the primary control connections, and dark red arrow indicates communication links. In this paper, consensus control is implemented under three different communication topologies, the ring, complete, and triangle mesh. In this system, the feeder lines connect the DG units to supply the power demand. In the following, each part of this proposed control scheme explains in detail.

Primary Control
The primary level of hierarchical control consists of (1) droop control, (2) virtual impedance/adaptive virtual impedance control, and (3) outer voltage and inner current dual loop control. First, a droop control is applied to enable the active and reactive power sharing without communication links [1][2][3][4][5][6][7][8][9]. Each DG unit has a local droop control to regulate both active and reactive power to the reference values. Second, virtual impedance control balances the mismatched output impedance of the neighboring DG units to achieve better power sharing performance [1][2][3][4]8,12,13,15,25]. Third, dual loop voltage and current control is employed in order to compensate any deviation of the generated voltage and frequency to enhance the overall power quality [3][4][5][6]. With reference to Figure 5, above, two new agents (agents 7 and 8) are added to the communication topology, with two communication links that are necessary to connect each new agent into the communication topology Adding a new agent causes changes in the degree of non-maximum agents in the network, and generates a new agent with a degree 4. Thus, agents 1 and 6 now have four communication links.

Mathematical Model of the Proposed Control Method
The proposed control methodology presented in this subsection consists of primary and secondary control levels with a hierarchical control structure to ensure an accurate reactive power sharing control among DG units under mismatched feeder line impedance conditions. The primary level consists of droop control, adaptive virtual impedance control, and dual voltage and current loops. In the secondary level, leaderless and leader-followers consensus control algorithms are designed to update the primary level. An analytical study of reactive power sharing is considered since the proposed control aims to provide accurate reactive power sharing among DG units in an islanded microgrid. The stability of the reactive power sharing based on consensus control is explored and proven to be asymptotically stable. Figure 6, below, illustrates the overall structure of the hierarchical control. The measured output voltage and current are converted into dq0 frame and then used to calculate the active and reactive power. The power quantities are used to regulate frequency and voltage and then adaptive virtual impedance control adjust the voltage regulation in order to adjust the reference voltage for the inverter. The dq0 quantity is converted back to the abc frame based on the reference frequency and voltages and then go through PI voltage and current loops to Sinusoidal Pulse Width Modulation (SPWM) in order to feed the inverter, as shown in Figure 6. Each DG unit and its primary control are connected to other DG units in a ring feeder distribution system, as shown in Figure 1. In Figure 6, the consensus control is considered to be a secondary control that communicates between DG units in order to exchange the information. In this figure, blue arrow indicates physical lines, black arrow indicates the primary control connections, and dark red arrow indicates communication links. In this paper, consensus control is implemented under three different communication topologies, the ring, complete, and triangle mesh. In this system, the feeder lines connect the DG units to supply the power demand. In the following, each part of this proposed control scheme explains in detail.

Primary Control
The primary level of hierarchical control consists of (1) droop control, (2) virtual impedance/adaptive virtual impedance control, and (3) outer voltage and inner current dual loop control. First, a droop control is applied to enable the active and reactive power sharing without communication links [1][2][3][4][5][6][7][8][9]. Each DG unit has a local droop control to regulate both active and reactive power to the reference values. Second, virtual impedance control balances the mismatched output impedance of the neighboring DG units to achieve better power sharing performance [1][2][3][4]8,12,13,15,25]. Third, dual loop voltage and current control is employed in order to compensate any deviation of the generated voltage and frequency to enhance the overall power quality [3][4][5][6].

Droop Control
This classical approach to control in large power systems, where the analysis assumes a balanced three phased system with long transmission line models, typically assumes that the line impedances satisfy the condition ≫ . In this proposed control, the droop control is designed based on a mainly inductive feeder lines impedance, ≫ . The phase angle difference ( ) between the inverter voltage , and the voltage of the load is assumed to be small. Thus, it can be assumed that = 1 and = .
The active ( ) and reactive ( ) power injections can then be written as From Equations (1) and (2), it can be seen that the active power is related to power angle ( ), which is related to the output voltage frequency and the reactive power is related to the difference in the magnitude of output voltage of the DG units [3,4,26]. Thus, it is possible to use active power to adjust the frequency and reactive power to adjust the magnitude of the output voltage. These two relationships, which are commonly known as droop control and the angular frequency and voltage magnitude of the droop control, are expressed as the familiar droop control laws [1][2][3][4][5][6][7][8][9]26], where and are the nominal values of angular frequency and voltage amplitude respectively. and are the droop control coefficients of active power and reactive power, respectively. The droop control here is designed based on rotating reference frame quantities ( 0). Thus, Equation (4)

Droop Control
This classical approach to control in large power systems, where the analysis assumes a balanced three phased system with long transmission line models, typically assumes that the line impedances satisfy the condition X ij R ij . In this proposed control, the droop control is designed based on a mainly inductive feeder lines impedance, X ij R ij . The phase angle difference (δ i ) between the inverter voltage V abc,oi and the voltage of the load is assumed to be small. Thus, it can be assumed that cosδ i = 1 and sinδ i = δ i . The active (P i ) and reactive (Q i ) power injections can then be written as From Equations (1) and (2), it can be seen that the active power is related to power angle (δ i ), which is related to the output voltage frequency and the reactive power is related to the difference in the magnitude of output voltage of the DG units [3,4,26]. Thus, it is possible to use active power to adjust the frequency and reactive power to adjust the magnitude of the output voltage. These two relationships, which are commonly known as droop control and the angular frequency and voltage magnitude of the droop control, are expressed as the familiar droop control laws [1][2][3][4][5][6][7][8][9]26], where ω ni and V ni are the nominal values of angular frequency and voltage amplitude respectively. k pi and k qi are the droop control coefficients of active power and reactive power, respectively. The droop control here is designed based on rotating reference frame quantities (dq0). Thus, Equation (3) can be expressed in the (dq0) frame, as (4) These active power/frequency (P i /ω i ) and reactive power/voltage (Q i /V i ) relations are appropriate when the output inverter impedance and the feeder line impedance are purely inductive. However, this assumption that is justified for a high-voltage system is impractical and difficult to ensure in low-voltage systems, such as islanded microgrids [1][2][3][4]. In the latter case, mismatched feeder line conditions often exist and the reactive power/voltage (Q i /V i ) relation exhibits poor reactive power sharing [1][2][3][4][5][6][7][8][9][10][11][12][13][14][15][16]27].

Virtual Impedance Control
The virtual impedance loop ensures a consistent output impedance for all inverters in the islanded microgrid [1][2][3][4]8,12,13,15,25]. The feedback loop is employed here to improve the current regulation and change the effective output impedance of the inverters to arbitrary impedance, reducing the impedance mismatch.
A virtual impedance (Z v ) is added between the output of the DG unit and the outer voltage loop in each unit providing an additional control input into the outer voltage loop to match the output impedance in all DG units. This virtual impedance effectively increases the output impedance of each DG unit to match with other impedances in all DG units. The mismatched feeder line effects are eliminated and the reactive power/voltage (Q i /V i ) relation in the droop control can improve reactive power sharing [8,12]. The proposed control is designed based on rotating reference frame quantities (dq0), and the voltage deviation of the virtual impedance control (V dq,v ) can be expressed as where i od and i oq are the output current of the DG unit in (dq0) frame quantities, and R v and X v are the resistance and reactance values of the virtual impedance. Here, the voltage deviation in the virtual impedance control is employed in order to adjust the magnitude of the output voltage by modifying the voltage magnitude of the droop control [8,12,13,15]. The reference voltage V dq,re f implemented in the outer voltage loop can be expressed as Subsisting Equations (4) and (5) into Equation (6), the reference voltage V dq,re f can be expressed as Outer Voltage and Inner Current Dual Loop Control Outer voltage and inner current loops both have high bandwidth and fast response to any disturbances in the DG unit [3,4,26]. In this proposed control method, both control loops are designed Energies 2020, 13, 2026 9 of 26 in the synchronous reference frame (abc) and used Proportional-Integral (PI) controllers. The output current reference of outer loop I abc,re f is expressed as where k pv and k iv are the outer voltage loop parameters of the PI control. In the inner current loop, a SPWM modulated voltage signal V abc,SPWM is obtained by comparing the inductor current (I abc,Li ) and the reference current I abc,re f . The V abc,SPWM is determined as where k pi , and k ii are the inner current loop parameters of the PI control.

Secondary Control
Based on previous studies, the virtual impedance control method requires accurate knowledge of the DG and feeder line parameters to accurately balance the mismatched output impedance among DG units, which is not easy to guarantee in practical applications [1][2][3][4]8,12,13,15,25]. A secondary control is employed to restore the frequency and voltage by providing reference values to the primary control level to eliminate the inherent frequency and voltage deviations to overcome this challenge [3]. A consensus control method is designed in this proposed control to regulate voltage and ensure accurate reactive power to overcome the reactive power/voltage (Q i /V i ) droop relation limitation associated with the mismatched feeder line condition.

Reactive Power Sharing
In order to ensure the reactive power sharing among DG units under mismatched feeder line conditions, a proportional reactive power sharing among DG units should be achieved, such that [17,25,34] k where n = 1, 2, . . . ., N. The secondary control should achieve this proportional reactive power sharing condition to ensure accurate reactive power sharing. With the reactive power/voltage (Q i /V i ) droop relation substituted in Equation (2), the proportional reactive power sharing can be expressed as From Equation (11), the following equivalent equation can be obtained, From (12), we note that k qi should be selected based on its propositional relationship with its corresponding line reactance. In the mismatched feeder line case, droop control cannot control the reactive power, since k qi is fixed in droop control, while in this case, k qi needs to be updated or adjusted based on how the mismatched feeder line influences the system performance [25,[28][29][30]34]. Designing a secondary control to ensure accurate reactive power sharing expressed in Equation (10) requires an adaptive virtual impedance control method based on consensus control, such a control is proposed here.

Adaptive Virtual Impedance Control
To achieve consistent or equivalent output impedance for all inverters in the islanded microgrid, an adaptive control term is added to provide an online update into the virtual impedance. The virtual impedance control in Equation (5) can be rewritten to include the adaptive virtual impedance, as where u sec i is an adaptive term that is updated based on consensus control. Figure 7 illustrates the process of updating this adaptive virtual impedance. The reference voltage , in Equation (7) can be rewritten as This adaptive virtual impedance ensures an inductive DG equivalent feeder reactance by adding , and the reactive power sharing can be guaranteed without knowledge of the feeder line impedances.

Consensus Control
Using a consensus control protocol as a secondary control level enables each DG unit to update its reference values based on its neighbors' values [22,23,29,30,[35][36][37]. Each DG unit converges to a certain consensus point. In this proposed control, the distributed consensus control is designed in order to solve a regulator synchronization problem for reactive power sharing. The control is considered as a first-order linear multi-agent system (MAS), which can be expressed as where = {1,2, … , }, and ∈ and ∈ are the state and input control of DG unit and donates the adjacency matrix of the communication graph, where = [ ] ∈ .

Theorems and Lemmas
The global dynamics of system and input control in (15) can be defined as The reference voltage V dq,re f in Equation (7) can be rewritten as This adaptive virtual impedance ensures an inductive DG equivalent feeder reactance by adding Z vi , and the reactive power sharing can be guaranteed without knowledge of the feeder line impedances.

Consensus Control
Using a consensus control protocol as a secondary control level enables each DG unit to update its reference values based on its neighbors' values [22,23,29,30,[35][36][37]. Each DG unit converges to a certain consensus point. In this proposed control, the distributed consensus control is designed in order to solve a regulator synchronization problem for reactive power sharing. The control is considered as a first-order linear multi-agent system (MAS), which can be expressed as . where i = {1, 2, . . . , n}, and x i ∈ R n and u i ∈ R n are the state and input control of DG unit i and A donates the adjacency matrix of the communication graph, where A = a ij ∈ R nxn .

Theorems and Lemmas
The global dynamics of system and input control in (15) can be defined as where X and U are the global state and input control of the MAS system, respectively. Here, X ∈ R nN and U∈ R nN , where n donates the number of states in each DG unit and N donates the number of DG units in the entire system. In addition to the adjacency matrix (A), the communication graph can be presented by a diagonal matrix of in degrees D = diag{d i } ∈ R nxn and Laplacian matrix L = l ij ∈ R nxn . The relation among these communication graph matrices can be expressed and Laplacian matrix L can be defined as All row-sums of L are zero j l ij = 0 , according to the definition of the Laplacian matrix of a communication graph L in (17). This guarantees that L always has one and only one zero-eigenvalue (λ 1 = 0) and the rest of the eigenvalues are positive. Therefore, the Laplacian matrix of a communication graph L is a positive semidefinite matrix.  (2) if and only if a spanning tree is available in the communication graph [34].

Theorem 2.
Every connected graph has at least one spanning tree. Let the communication graph is a connected graph, if it has no cycle, then it is its spanning tree. In case it has cycles, then deleting one edge from the cycles does not affect the existence of spanning tree and the communication graph remains connected and cycle free containing all the agents of the communication graph [32]. Theorem 3. The states of all DG units will converge to the leader state if and only if a spanning tree with root node i ∈ B is available in the communication graph [32].
Using Theorem 1, all of the states can converge to the consensus if L is positive semidefinite (17). In addition, a spanning tree should be available in the communication topology. Using Theorem 2, the communication topology has at least one spanning tree as long as G remains connected.
Some technical lemmas are necessary to design a stable consensus control.

Lemma 1.
The Laplacian matrix for the undirected communication graph satisfies the following identity [38]: Proof of Lemma 1. Expand X T LX is given by Energies 2020, 13, 2026

of 26
In case i = j, then x i = x j otherwise x i x j . so, According to (17), Equation (20) can be rewritten as thus, Assume that the communication topology here is undirected, so a ij = a ji . X T LX can be written as: To complete the proof, 2X T LX is calculated as Simplify (24), then and proof of Lemma 1 is completed.

Lemma 2.
If an undirected communication graph is a connected graph, then the rank of the Laplacian matrix rank (rank(L) = N − 1) [39].
which implies  (16) is reached using the control law in (18) using the result in Lemma 1 [38].
Proof of Lemma 5. Consider the Lyapunov candidate, Using Lemma 1,. V depends on the Laplacian matrix L to ensure the stability of the system.

Reactive Power Sharing Based on Consensus Control
In order to represent the dynamics of the system using proportional reactive power sharing terminology, Equation (16) can be rewritten as The reactive power errors among DG units should be eliminated to reach the consensus region or consensus point [34]. The consensus control algorithm for a i th DG unit can be expressed, as where C kQi donates coupling gain and e kQi represents the local neighbor reactive power sharing error that can be expressed as where k qi Q i (t) and k qj Q j (t) are the proportional reactive power outputs of DG unit i and its neighbors, respectively. The entire system can be written in matrix form as where and, the entire system can be expressed as Equation (29) represents the leaderless consensus control algorithm.
In the case of leader-followers consensus control, a DG unit is selected to be a leader and other DG units as its followers [34,36,37]. Thus, Equation (29) can be rewritten to describe this leader-follower structure, as where and k qLeader Q Leader denotes to the proportional reactive power sharing of the DG unit selected to lead the system.

Stability Analysis of Consensus Control
The stability analysis of the reactive power consensus control is now developed. From the literature [17,28], the linear consensus control protocol can be expressed, as Using Lemma 1 and Lemma 5, the Lyapunov function candidate is selected as V e = X T e X e , and the derivative of this candidate is [40]. It is obvious that the stability of the system depends on L [38]. L is a positive semidefinite matrix, according to the definition of the Laplacian matrix of a communication graph L in (17). Thus, the consensus control in (35) is Lyapunov stable [40]. This stability analysis is based on the eigenvalues of the L. In order to improve this finding, a quadratic candidate Lyapunov function is selected as where P ∈ R nxn , P > 0 is positive definite and P > P T . Subsequently, the derivative of this Lyapunov candidate is The derivative in (37) can be written as From [34], the L T P + PL term is positive definite, which means that . V e < 0 is negative definite. Using Lyapunov theory, candidate P in (36) shows that the proposed control is asymptotically stable [40]. However, the L T P + PL term depends on the selection of P, since L is guaranteed to be positive semidefinite by definition (17). In a system such as an islanded microgrid, the expansion of the system is expected, which makes selecting values of the P matrix difficult and impractical. Therefore, alternative methods for guaranteeing asymptotically stable are now proposed.
From the analysis above, it is evident that the Laplacian matrix of the communication graph plays a key role in guaranteeing Lyapunov stability. The connectivity of the communication graph must be taken into consideration to ensure stability [38]. Here, the adjacency (A) and Laplacian (L) matrices are irreducible, and the quadratic Lyapunov function is difficult to select in order to ensure asymptotic stability [38]. Therefore, an alternative method is proposed to guarantee an asymptotically stable system. Here, the input control in Equation (35) is modified and expressed as where B ∈ R nxn is a diagonal matrix with nonnegative diagonal entities and at least one of them is positive [38]. This matrix guarantees that the (L + B) matrix is nonsingular. In other words, (L + B) matrix is positive definite. Therefore, the Lyapunov function candidate that is selected above as V e = X T e X e and its derivative . V e = −2C kQN X T e (L + B) X e is asymptotically stable, since (L + B) matrix is guaranteed to be positive definite [38,40]. In addition, selecting the quadratic Lyapunov This alternative method reduces the proposed control's sensitivity to the P matrix selection and ensures asymptotic stability.

Overall Control
The consensus control updates the local adaptive virtual impedance controls in the primary level of each DG unit to eliminate the reactive power errors among the DG units. Thus, each DG adjusts its virtual impedance based on its neighbors until all DG units reach the consensus region or point. Substituting Equations (28), (29), and (39) in the Equation in (13), the overall control can be expressed, as The reference of the adaptive virtual impedance (V dq,vi (t)) adjusts the voltage reference of the droop control (V * dqi (t)). Substituting Equations (4), and (41) in Equation (14), the reference voltage that feeds into the outer voltage loop can be rewritten, as

Results and Discussion
This section confirms that the proposed control methodology provides accurate active and reactive power sharing among DG units in an islanded microgrid. Three communication topologies are examined under leaderless and leader-followers consensus control algorithms. Ring and complete communication topologies are compared to the triangle mesh communication topology. Five cases are implemented in order to verify the effectiveness of the triangle mesh communication topology.
A configuration of six DG units with the same capacity of 10 kVA operated in a ring feeder distribution system, as shown in Figure 1. Each unit consists of a DC source, such as a PV array, a three-phase inverter, an LC filter, and a load. The line length between DG units 1 and 2 and DG units 5 and 6 were considered to be 100 m, the lines length between DG units 1 and 3 and DG units 4 and 6 were considered to be 150 m, and the lines length between DG units 2 and 4 and DG units 3 and 5 were considered to be 200 m, to consider feeder line mismatch condition. The line impedance of 1 km is (R f d = 0.642 Ω and X f d = 0.083 Ω). Table 1 presents the line impedance parameters. In this model, the DG units supply five balanced loads; three of them are constant power loads and the other two are constant impedance loads. The parameters of DG unit components and these loads are detailed in Tables 2 and 3, respectively. Table 3 displays in detail load locations, time of operation, and capacity. A constant power load (load 1) and constant impedance load (load 5) are connected over the entire simulation time window, and the other three loads switched on or off differently in order to examine the performance of the proposed control under power change conditions. Another constant power load (load 3) is connected from the beginning for two seconds, and a constant impedance load (load 4) switches on at 1 s. Additionally, a constant power load (load 4) is connected at 3 s. In the secondary level, the leaderless and leader-followers consensus control algorithms are designed in this simulation. The simulation model and results are developed in MATLAB/Simulink.  In this first case, the primary control operates locally without any communication links between the DG units. Thus, each local control works independently based on its local information only. Figures 8 and 9 present the simulation results of frequencies and active power sharing. According to IEEE Std 1547.4-2011 [41], a DG unit in islanded mode has to be able to regulate the frequency within an acceptance band. In Figure 8, all DG units' frequencies are regulated at 59.85 Hz, which is within the acceptance band in the period of 0-1 s. There is a slight drop/raise in the other time periods based on the active power increase/decrease, as can be seen in Figures 8 and 9. Figures 8 and 9 present the simulation results of frequencies and active power sharing. According to IEEE Std 1547.4-2011 [41], a DG unit in islanded mode has to be able to regulate the frequency within an acceptance band. In Figure 8, all DG units' frequencies are regulated at 59.85 Hz, which is within the acceptance band in the period of 0-1 s. There is a slight drop/raise in the other time periods based on the active power increase/decrease, as can be seen in Figures 8 and 9.  In Figure 9, the active powers shared accurately at 2.5 kW in 0-1 s period. In this period, loads 1 and 3, and 5 are connected. Each DG unit supplies these loads by 0.83 kW, 0.83 kW, and 0.8.1 kW, respectively. Hence, the total active power of each DG unit is approximately 2.5 kW. When the load IEEE Std 1547.4-2011 [41], a DG unit in islanded mode has to be able to regulate the frequency within an acceptance band. In Figure 8, all DG units' frequencies are regulated at 59.85 Hz, which is within the acceptance band in the period of 0-1 s. There is a slight drop/raise in the other time periods based on the active power increase/decrease, as can be seen in Figures 8 and 9.  In Figure 9, the active powers shared accurately at 2.5 kW in 0-1 s period. In this period, loads 1 and 3, and 5 are connected. Each DG unit supplies these loads by 0.83 kW, 0.83 kW, and 0.8.1 kW, respectively. Hence, the total active power of each DG unit is approximately 2.5 kW. When the load In Figure 9, the active powers shared accurately at 2.5 kW in 0-1 s period. In this period, loads 1 and 3, and 5 are connected. Each DG unit supplies these loads by 0.83 kW, 0.83 kW, and 0.8.1 kW, respectively. Hence, the total active power of each DG unit is approximately 2.5 kW. When the load 2 is connected at 1 s and load 4 is connected at 3 s, the frequencies slightly decrease to increase the active powers in order to meet the power demand, as shown in Figure 9. Dividing the additional active power portions by six DG units, each DG unit should supply 1.15 kW for connecting load 2 at 1 s and 0.66 kW for connecting load 4 at 3 s. Hence, the active powers increase from 2.5 kW to 3.60 kW when load 2 is connected at 1 s, and from 2.85 kW to 3.515 kW when load 4 switches on. In contrast, the frequencies slightly increase and active powers drop from 3.60 kW to 2.85 kW when the load 3 is disconnected at 2 s, as shown in Figures 8 and 9. Thus, the P/f droop control provides accurate active power sharing between the DG units, even though every local primary control works independently. Figures 10 and 11 present the simulation results of the output voltage magnitudes and reactive power sharing. The Q/V droop control enables the output voltages to accurately regulate the phase-to-ground voltage magnitude at 313 V in the 0-1 s period, as shown in Figure 10. When controlled by primary control alone, the reactive powers of DG units are 2.2 kVar, 2.15 kVar, 1.75 kVar, 2.7 kVar, Energies 2020, 13, 2026 18 of 26 1.8 kVar, and 2.65 kVar at 1 s, respectively. Thus, the reactive power sharing provided under this mismatched feeder line condition is poor, as shown in Figure 11. This poor reactive power sharing gets worse under load changing conditions. active power sharing between the DG units, even though every local primary control works independently. Figures 10 and 11 present the simulation results of the output voltage magnitudes and reactive power sharing. The Q/V droop control enables the output voltages to accurately regulate the phaseto-ground voltage magnitude at 313 V in the 0-1 s period, as shown in Figure 10. When controlled by primary control alone, the reactive powers of DG units are 2.2 kVar, 2.15 kVar, 1.75 kVar, 2.7 kVar, 1.8 kVar, and 2.65 kVar at 1 s, respectively. Thus, the reactive power sharing provided under this mismatched feeder line condition is poor, as shown in Figure 11. This poor reactive power sharing gets worse under load changing conditions.   The impedance of the feeder lines directly affects the accuracy of the reactive power sharing. Here, the output current magnitude difference between DG 3 and 4 units is about 2A, while the DG output currents in the steady state should be almost the same. Additionally, under sudden load changing the output current difference between DG units increases. Thus, the Q/V droop control fails to regulate the current, as shown in Figure 12 under all load change conditions, and the virtual impedance control with fixed values provides inadequate reactive power sharing under the mismatched feeder line condition. According to IEEE Std 1547.4-2011 [41], a DG unit should be able to provide accurate reactive power to enable the system to effectively meet the load requirements and enhance the stability of the entire islanded microgrid system [41]. The reactive power gain needs to be updated or adjusted based on how the mismatched feeder line influences the system based on the reactive power analysis above. A consensus control algorithm is added in the next case to achieve accurate reactive power sharing. The impedance of the feeder lines directly affects the accuracy of the reactive power sharing. Here, the output current magnitude difference between DG 3 and 4 units is about 2A, while the DG output currents in the steady state should be almost the same. Additionally, under sudden load changing the output current difference between DG units increases. Thus, the Q/V droop control fails to regulate the current, as shown in Figure 12 under all load change conditions, and the virtual impedance control with fixed values provides inadequate reactive power sharing under the mismatched feeder line condition. According to IEEE Std 1547.4-2011 [41], a DG unit should be able to provide accurate reactive power to enable the system to effectively meet the load requirements and enhance the stability of the entire islanded microgrid system [41]. The reactive power gain k qi needs to be updated or adjusted based on how the mismatched feeder line influences the system based on the reactive power analysis above. A consensus control algorithm is added in the next case to achieve accurate reactive power sharing.
to regulate the current, as shown in Figure 12 under all load change conditions, and the virtual impedance control with fixed values provides inadequate reactive power sharing under the mismatched feeder line condition. According to IEEE Std 1547.4-2011 [41], a DG unit should be able to provide accurate reactive power to enable the system to effectively meet the load requirements and enhance the stability of the entire islanded microgrid system [41]. The reactive power gain needs to be updated or adjusted based on how the mismatched feeder line influences the system based on the reactive power analysis above. A consensus control algorithm is added in the next case to achieve accurate reactive power sharing.

Case 2: Leaderless Consensus Control with Ring Communication Topology
It is clear that the local primary control struggles to share the reactive power accurately. A leaderless consensus control is added to the primary control with a ring communication topology to overcome this challenge. Figures 13 and 14 show that frequency regulation and accurate active power exhibit few artifacts during load change conditions and the results remain almost the same as Case 1. In addition, Figure 15 displays the DG units' output voltages with almost no change when compared to Case 1. It is clear that the local primary control struggles to share the reactive power accurately. A leaderless consensus control is added to the primary control with a ring communication topology to overcome this challenge. Figures 13 and 14 show that frequency regulation and accurate active power exhibit few artifacts during load change conditions and the results remain almost the same as Case 1. In addition, Figure 15 displays the DG units' output voltages with almost no change when compared to Case 1.    The difference here is that the leaderless consensus control improves the current regulations, as shown in Figure 16. By comparing Figures 12 and 16 in case 1, it can be seen that the leaderless consensus control successfully removes the current differences that provide an enhancement in reactive power sharing, as in Figure 17. It is obvious that adding consensus control to the proposed     The difference here is that the leaderless consensus control improves the current regulations, as shown in Figure 16. By comparing Figures 12 and 16 in case 1, it can be seen that the leaderless consensus control successfully removes the current differences that provide an enhancement in reactive power sharing, as in Figure 17. It is obvious that adding consensus control to the proposed control does not impact droop control performance, but solve the poor reactive power challenge, as evident in Figure 17. Here, the consensus control updates the adaptive virtual impedance based on reactive powers of DG unit's neighbors to eliminate the reactive power error. This elimination of reactive power errors improves the current regulation and the virtual impedance ensures an accurate equivalent impedance of the feeder lines.     According to [19], the rate of convergence of consensus control is quantified by the second smallest eigenvalue ( ) of the Laplacian matrix, a property that is known as algebraic connectivity [42]. In the undirected communication topology, is always greater than zero. The greater the value of means that the rate of convergence increases and all DG units reach to the consensus point faster. The Laplacian matrix of the ring communication topology has = 1, given the ring communication topology use in this case. Thus, there is an opportunity to improve the rate of convergence and strengthen the connectivity of the communication topology. Here, the failure of any two-communication links can separate the topology into two different parts that brings new challenges to manage this topology in order to control the system. In addition, the failure of one communication link makes exchanging information slower, since the exchange only occurs in one direction and will subsequently influence the rate of convergence.

Case 3: Leader-Followers Consensus Control with Ring Communication Topology
Since the reactive power sharing has a slow rate of convergence in the previous case, the leaderfollowers consensus control algorithm in (13) is simulated with the ring communication topology to accelerate the rate of convergence [34,36]. To implement this control, one of the DG units is selected to act as a leader, while the other DG units follow this leader. Here, DG 2 is selected to lead the other  Figure 17, below, illustrates reactive power sharing and shows that leaderless consensus control gradually eliminates the reactive power errors between the DG units. When controlled by the proposed method, the reactive powers of DG units converge to a steady state. For example, in the 2-4 s period, each DG unit supplies 0.5 kVar, 0.81 kVar, 0.83 kVar, and 1.21 kVar for loads 1, 2, 3, and 5, respectively. Hence, the total reactive power that is supplied by each DG unit is 3.35 kVar. In this case, the leaderless consensus control takes about 0.75 s to converge all DG units to the consensus point in all load change conditions, as shown in Figure 17.
According to [19], the rate of convergence of consensus control is quantified by the second smallest eigenvalue (λ 2 ) of the Laplacian matrix, a property that is known as algebraic connectivity [42]. In the undirected communication topology, λ 2 is always greater than zero. The greater the value of λ 2 means that the rate of convergence increases and all DG units reach to the consensus point faster. The Laplacian matrix of the ring communication topology has λ 2 = 1, given the ring communication topology use in this case. Thus, there is an opportunity to improve the rate of convergence and strengthen the Energies 2020, 13, 2026 22 of 26 connectivity of the communication topology. Here, the failure of any two-communication links can separate the topology into two different parts that brings new challenges to manage this topology in order to control the system. In addition, the failure of one communication link makes exchanging information slower, since the exchange only occurs in one direction and will subsequently influence the rate of convergence.

Case 3: Leader-Followers Consensus Control with Ring Communication Topology
Since the reactive power sharing has a slow rate of convergence in the previous case, the leader-followers consensus control algorithm in (13) is simulated with the ring communication topology to accelerate the rate of convergence [34,36]. To implement this control, one of the DG units is selected to act as a leader, while the other DG units follow this leader. Here, DG 2 is selected to lead the other DG units. Applying this approach with a distributed communication topology enhances the rate of convergence, as shown in Figure 18. In Case 2, all DG units require approximately 0.75 s to converge all DGs' reactive powers to the consensus point, while this consensus control algorithm converges all DG units within 0.40 s. Clearly, the leader-followers consensus control algorithm improves the rate of convergence. However, this consensus control requires extra communication links to make connections between the leader and its followers. In a large system, extra communication links increase the expense of this communication topology and increase the burden and dependence on the leader agent. Therefore, this consensus control topology is not recommended for large systems.

Case 4: Leaderless Consensus Control with Complete Communication Topology
In Case 4, a complete communication topology, as shown in Figure 4, is simulated in order to find the fastest rate of convergence in this islanded microgrid. Here, every agent behaves as a leader or central DG unit and all DG units share all information to adjust their output values. All DG units achieve consensus within 0.2 s in all load change conditions, as shown in Figure 19. Even though this complete topology provides the fastest rate of convergence, this topology is impractical for large systems due to its expenses.

Case 4: Leaderless Consensus Control with Complete Communication Topology
In Case 4, a complete communication topology, as shown in Figure 4, is simulated in order to find the fastest rate of convergence in this islanded microgrid. Here, every agent behaves as a leader or central DG unit and all DG units share all information to adjust their output values. All DG units achieve consensus within 0.2 s in all load change conditions, as shown in Figure 19. Even though this complete topology provides the fastest rate of convergence, this topology is impractical for large systems due to its expenses.
In Case 4, a complete communication topology, as shown in Figure 4, is simulated in order to find the fastest rate of convergence in this islanded microgrid. Here, every agent behaves as a leader or central DG unit and all DG units share all information to adjust their output values. All DG units achieve consensus within 0.2 s in all load change conditions, as shown in Figure 19. Even though this complete topology provides the fastest rate of convergence, this topology is impractical for large systems due to its expenses.

Case 5: Leaderless Consensus Control with Triangle Mesh Communication Topology
Based on previous cases, there is an inverse relationship between the rate of convergence and the cost of the communication topology. In this case, a triangle mesh communication topology with leaderless consensus control algorithm is proposed in order to find a topology that balances the rate of convergence to consensus and the overall system cost. Figure 5 illustrates the triangle mesh

Case 5: Leaderless Consensus Control with Triangle Mesh Communication Topology
Based on previous cases, there is an inverse relationship between the rate of convergence and the cost of the communication topology. In this case, a triangle mesh communication topology with leaderless consensus control algorithm is proposed in order to find a topology that balances the rate of convergence to consensus and the overall system cost. Figure 5 illustrates the triangle mesh communication topology, where the Laplacian matrix of this communication topology for a 6 DG system can be expressed, as The Laplacian matrix of the triangle mesh communication topology in (43) has λ 2 = 1.19, which is greater than λ 2 = 1 in Case 2. According to [19], a greater value of λ 2 indicates a faster rate of convergence. The triangle mesh communication topology guarantees a faster rate of convergence than the ring topology. Figure 20 shows that all of the DG units converge within 0.45 s. Thus, the triangle mesh communication topology increases the rate of convergence when compared to ring communication topology in Case 2.
Taking the extensibility and scalability of the triangle mesh topology into consideration, this topology can easily expand without shutdown or interruption to the entire system, since adding a new DG unit occurs in the terminal DG unit with two communication links, as shown in Figure 5. The triangle mesh structure takes advantage of the centralized communication concept with some restrictions to reduce the cost and overloading on the central unit(s). Here, each DG unit agent has a maximum limit of four communication links, while the centralized communication topology has no limit. In addition, the DG unit agent that reached the limit of four communication links is located in the center of the topology. Thus, the system can grow organically with a reasonable increase in cost, since this growth does not cause overloading on any one DG unit. restrictions to reduce the cost and overloading on the central unit(s). Here, each DG unit agent has a maximum limit of four communication links, while the centralized communication topology has no limit. In addition, the DG unit agent that reached the limit of four communication links is located in the center of the topology. Thus, the system can grow organically with a reasonable increase in cost, since this growth does not cause overloading on any one DG unit.

Conclusions
A mathematical model of adaptive virtual impedance control that is based on the leaderless and leader-followers consensus controls with triangle mesh communication topology proposed in this paper eliminates the reactive power sharing errors in a DG microgrid under mismatched feeder line conditions. A MATLAB/Simulink simulation model with six DG units validates the proposed control performance under three different communication topologies, the ring, complete, and triangle mesh. From simulation findings, we conclude that leaderless consensus control algorithm is a reliable

Conclusions
A mathematical model of adaptive virtual impedance control that is based on the leaderless and leader-followers consensus controls with triangle mesh communication topology proposed in this paper eliminates the reactive power sharing errors in a DG microgrid under mismatched feeder line conditions. A MATLAB/Simulink simulation model with six DG units validates the proposed control performance under three different communication topologies, the ring, complete, and triangle mesh. From simulation findings, we conclude that leaderless consensus control algorithm is a reliable option with large systems, while the leader-followers consensus control algorithm is suitable for the small systems, since it requires extra communication links to enable all followers to communicate directly with the leader DG unit agent. The simulation findings show that a triangle mesh communication topology balances between the rate of convergence and the cost of communication topology. In addition, extensibility and scalability are advantages of the triangle mesh topology over the ring and complete topologies. In future works, the fault tolerance of the system and influence of communication time delay will be considered with this proposed control method.