A Finite-Time Robust Distributed Cooperative Secondary Control Protocol for Droop-Based Islanded AC Microgrids

: In this research work, a resilient ﬁnite-time consensus-based distributed secondary control protocol is presented for droop-based distributed generating (DG) units of an islanded AC microgrid (MG). Through a multi-agent control structure, the DG units of the microgrid adjust their active power outputs so that they reach an agreed-upon value in a ﬁnite time. Concurrently, all the DG units are forced to operate with their frequencies regulated to the reference MG frequency in a ﬁnite time, despite time-varying load perturbations. Each DG unit is provided with a hierarchical control architecture, where the primary control is achieved using the droop control method, while the secondary control is established through the proposed distributed control protocol. The communication between DG units takes place over a sparse communication network. The proposed control protocol is robust to both small and sufﬁciently large communication latencies and it supports the plug-and-play feature of DG units. Different time-domain-based numerical simulations are carried out on a small as well as large microgrid testbenches in Matlab/Simulink and demonstrate the correctness and effectiveness of the proposed distributed control protocol. A comparative study is also presented with the existing distributed control protocol, and it is found that the proposed strategy is superior in its performance.


Introduction
The pioneering concept of microgrids (MGs) was presented by Robert H. Lasseter in 2001Lasseter in /2002. He stated that a MG is a low-voltage power system that consists of a cluster of micro-generation sources (MGSs) or distributed generating (DG) units, energy storage systems (ESSs) and loads. It appears to the main grid as a single controllable entity, operable in either mode (i.e., grid-tied or autonomous mode), and provides both electric power and heat locally [1][2][3][4]. The existence of a flexible but controllable interface between the main grid and the MG is the heart of the MG concept. A grid-connected MG has a Point of Common Coupling (PCC) or Point of Interconnection (POI) as an interfacing point with the main grid/large power system [5,6]. This interface essentially provides electrical isolation between the MG and the main grid, but also connects them economically. To the customers, the MG can be designed to appear as a low-voltage, small autonomous power system that increase the cost and decrease the reliability of the MG. Centralized control ensures lowvoltage performance through capability, accurate power sharing, etc., but is prone to a single point of failure; that is, if the central controller or one of the communication links fails, it causes the entire MG to collapse. Furthermore, this strategy places a large computational burden on the central controller, thus making its design complex and costly [18,19]. The decentralized control method comprises several individual controllers that need only local measurements, but it does not require a high-bandwidth communication infrastructure (except for synchronization purpose). Thus, it is proven to be more reliable than the centralized strategy because of its limited communication infrastructure [10,20]. However, due to the lack of system-wide information, all the available energy sources in an MG cannot be efficiently harmonized in an optimum way [21]. To counteract the stated limitations of the two control strategies, the distributed control method has been proven to be very reliable [18,21]; it is influenced by the idea of a multi-agent system (MAS). In this method, the energy nodes are considered to be agents that can exchange information with their neighboring nodes through a sparse communication infrastructure. Consequently, the cost of the communication infrastructure decreases and the system reliability increases [22].
Over the past few decades, there has been a remarkable progress in MAS-based distributed cooperative control strategies [23][24][25]. For this reason, the secondary control of MGs using distributed cooperative control techniques has attracted a great deal of attention from researchers. The authors in [26] reported a distributed consensus-based control strategy for an islanded AC microgrid with multiple droop-controlled DG units. The technique has been found to be useful for regulating the voltages, frequencies and active/reactive power outputs of the DG units. Furthermore, it has been tested and found to be successful during both constant and varying communication topologies along with time-varying communication latencies. The system closed-loop response has been found to exhibit more oscillations, or even become unstable, if the communication latency increases beyond a certain extent, as discussed in [18]. To address the actuator faults, in an islanded AC microgrid with switching communication topology, a distributed cooperative faulttolerant control technique was reported in [27]. In [28], a detailed survey was conducted to signify the impact of communication latencies on the secondary frequency regulation in the case of islanded AC microgrids. It was found that the communication latency margin varied in direct proportion with the proportional gain value, but it varied inversely with the integral gain value of the secondary frequency controller. To counteract the effect of the communication latency, a gain scheduling strategy was adopted. The authors in [22] presented a robust finite-time distributed control protocol for the secondary frequency and voltage regulation of an islanded AC microgrid. The proposed strategy was successfully applied to offer a plug-and-play attribute in the DG units and increase the robustness to unmodeled system dynamics and parametric uncertainties. In [18], a robust consensusbased secondary frequency and voltage restoration strategy was applied to an IEEE 14-bus system based islanded AC microgrid. The performance of the stated technique was found to be superior to the feedback linearization-based distributed cooperative secondary control of microgrids presented in [29], in terms of successfully dealing with a frequently switching communication graph, load perturbations, parametric uncertainties, communication latencies and the plug-and-play feature of the DG units. Due to the nonlinear and non-identical nature of the DG units dynamics, an input-output feedback linearization method was used to transform the dynamics to linear in [29]. Nonetheless, the dynamics of the primary controller were ignored during this process, which might have reduced the functionality and stable operation of the microgrid. In another attempt, the same authors presented a distributed cooperative control framework for secondary voltage and the frequency restoration of inverter-based MGs in [30]. However, the schemes presented in [29,30] were not fully-distributed. To address the stated problem, a fully-distributed (also termed as distributed adaptive) consensus-based control strategy was reported in [31] for droop-based islanded AC microgrids. For the resilient operation of an autonomous microgrid comprising inverter-based DG units, a fast terminal sliding mode-based distributed secondary voltage control strategy was proposed in [32]. A Kalman-Bucy filter-based extended state observer was designed for accurate estimation of the state information of the extended DG model and counteract the disturbances resulting from three different sources: measurement noise, parameter variation and immeasurable external variables. However, there may exist intentional and external interferences, such as cyber attacks and communication faults; thus, furthermore exploration is required for extending this work to handle the problem of cybersecurity-based MG control design. The authors in [33] proposed a cooperative secondary voltage control scheme for autonomous microgrids using an auxiliary centralized event-triggering controller. The event triggering controller was designed to generate the triggering time. In this scheme, the estimates of the agents were used to replace their actual values for feedback control. All the agents received the same event-triggering time from the auxiliary centralized controller. Thus, the communication between agents was only needed when the events were triggered. This strategy greatly reduced the burden of the communication network and enhanced the reliability of the control structure. However, due to the centralized event-triggering mechanism, this scheme was not fully distributed. In [34], the authors presented a probabilistic index to measure the controllability of currents and voltages in various lines and buses of both single-and multi-microgrid distribution systems. After that, the current-voltage controllability index was investigated for a pre-designed multi-microgrid system having an optimum reliability and supply-security. It was revealed that the controllability index was significantly low and could be improved. Finally, a novel comprehensive index was defined to optimally cluster an active distribution system into a multi-microgrid system having optimum reliability, supply security, and controllability.

Key Contributions
The key contributions made by this article are outlined as follow:

1.
A resilient fully-distributed consensus-based secondary control protocol is designed for a droop-based islanded AC microgrid. The proposed design adjusts the real power outputs of the DG units so that they reach an agreed upon level in a finite time. Concurrently, all the DG units are forced to operate with their frequencies regulated to the reference microgrid frequency in a finite time, despite time-varying load perturbations. It is important to mention that the proposed strategy considers mixed types of DG units (i.e., both high-inertia and low-inertia types), whereas the techniques reported in [35][36][37] consider only low-inertia type DG units; 2.
The uniqueness of the proposed design lies in the fact that the active power as well the frequency control of each DG unit is ensured through the application of the same control strategy at each DG unit, while the existing strategies reported in [35][36][37] apply a separate control protocol for real power and frequency regulation, thus requiring more control effort; 3.
The proposed protocol is fully-distributed in the sense that each agent of the communication network only requires information regarding itself and its neighbors. This virtue directly helps in minimizing the overall bandwidth requirement. As a result, the microgrid can operate with greater reliability and flexibility, as compared to the strategies reported in [29,30], which were not fully-distributed; 4.
The proposed scheme is robust to much higher communication latencies of around 1 s, whereas the strategies reported in [35][36][37] considered smaller communication latencies of around 16 ms and have not been tested for higher latencies. Furthermore, the proposed strategy guarantees plug-and-play capability for DG units.
The article is structured as follows. The preliminary graph theory is explained in Section 2. The mathematical modeling of the micro-generation sources of the test microgrid is presented in Section 3. Section 4 covers the proposed distributed finite-time consensus protocol design. In Section 5, the correctness and efficacy of the proposed distributed control protocol is verified through time-domain-based numerical simulations in Matlab/Simulink, while Section 6 summarizes the concluding remarks to this article.

Graph Theory
The concept of distributed control is based on the theory of the MAS, which considers an MG as a MAS, the energy nodes as vertices or agents and the communication links as arcs or edges. The information exchange/communication between various nodes takes place through a sparse communication system. The communication topology for a network of N nodes can be represented by a weighted graph, G(E , V, A), whether directed (i.e., unidirectional) or undirected (i.e., bidirectional), where V = {1, 2, . . . , N} and E and A are, respectively, the set of vertices, the set of edges and the weighted adjacency matrix. The elements of the set E are denoted as (i, j), which denotes an edge leaving the ith node and arriving at the jth node and is shown by an arrow with its tail at the ith node and head at the jth node. This implies that information can flow from the ith node to the jth node. The jth node can be regarded as a neighbor of the ith node if (i, j) ∈ E . The weight of the edge (i, j) is denoted by a ij , where a ij > 0, if (i, j) ∈ E ; otherwise, it is 0. In other words, the edge (i, j) can be considered as outgoing with respect to the ith node and incoming with respect to the jth node and, in this case, the ith node is termed as the parent and the jth node as the child. The number of edges with the ith node as a head is termed as the in-degree, d in i , of the ith node, while the number of edges with the ith node as a tail is termed as the out-degree, d out i , of the ith node. The neighboring set of nodes of the ith node is denoted by N i = {j ∈ V |(j, i) ∈ E }; that is, the set of nodes with their edges arriving at the ith node. The number of neighbors of the ith node, |N i |, equals its in-degree, d in for all nodes, i ∈ V, the graph is termed as balanced. If (i, j) ∈ E = (j, i) ∈ E , and a ij = a ji , ∀ i, j, the graph is termed as undirected; otherwise, it is termed as a digraph or directed graph. The ith node is said to be connected to the jth node if there exists a directed path from the ith node to the jth node. A digraph is termed as strongly connected if there is a directed path between every two distinct nodes. On the other hand, an undirected graph is termed as simply connected if there is an undirected path between every two distinct nodes.
By examining the properties of the Laplacian, adjacency and in-degree matrices (i.e., L, A and D, respectively), the graph structure and properties can be determined. For the ith node, the weighted Laplacian matrix is defined as follows [38,39]: An alternative method for determining the Laplacian matrix uses

Mathematical Modeling of Micro-Generation Sources
The correctness and effectiveness of the proposed control technique is evaluated by using a three-phase microgrid (MG) testbench, as illustrated in Figure 1. Note that the dotted arrows represent the undirected communication between the distributed generating (DG) units. The stated MG has three DG units and four buses. Two of the DG units are inverter-based (i.e., a microsource (MS) and an external energy storage system (ESS)). The third DG unit comprises an internal combustion (IC) engine operated diesel genset (GS) with a wound-field synchronous generator. The order of connection of the ESS, MS and GS to the buses, respectively, is 1, 3 and 4. All the DG units are connected to the buses through three-phase ∆Y-transformers. At bus 1, the overall MG is connected to the main grid via a static transfer switch (STS). Between the DG units and buses, Z ESS and Z MS denote the series coupling inductances, while Z GS represents a coupling capacitor. Various loads are attached to the buses. The lines between the main grid and bus 1 (Z 1 , Z 2 ) and between the buses (i.e., Z 12 , Z 13 , Z 24 and Z 34 ) represent RLC-branches. The main grid and the entire MG testbench parameters are listed in Tables A1-A4 in Appendix A. The undirected communication graph, G, between DG units is illustrated in Figure 2.

Inverter-Interfaced Microsource Mathematical Modeling with Droop/Primary and Overload Control
Mathematically, the inverter-based MS is designed as a controlled-voltage source (three-phase), where its voltage magnitude, V max , and frequency, ω MS , at the terminals are controlled through external inputs. The inverter outputs are three-phase instantaneous voltages (i.e., v a , v b and v c ), as defined below [40]: where V max = M x V DC ; that is, the product of the modulation index, M x , and inverter DC input voltage, V DC .

Droop/Primary Control for Inverter-Based Microsource
The inverter-based MS is shown in Figure 3, along with its droop/primary and overload control. For the MS, the Pω-droop control is described as follows: where ω MS , ω 0 and ∆ω adj,MS represent, respectively, the frequency of the inverter-based MS, the nominal MG frequency and the frequency adjustment under overload control for the MS. Moreover, m P,MS , P req,MS = P set,MS and P meas,MS are, respectively, the Pω-droop characteristic slope or the droop gain, the external active power requested from the MS (i.e., real power set-point) and the instantaneously measured real power of MS. The Pω-droop characteristic slope for the MS (i.e., m P,MS ), while considering a frequency droop of ∆ f MS = 0.5 Hz or ∆ω MS = π rad s −1 , is computed, using values listed in Table A3 in Appendix A, as follows: The computed value of m P,MS permits the inverter-based MS to make a real power request, P req,MS , within its real power range. Moreover, this action is performed with the frequency tolerance of ±0.5 Hz.
Similarly, for the MS, the QV-droop control is described as follows: where V req,MS = V set,MS and V meas,MS are, respectively, the MS voltage magnitude set-point and the instantaneously measured voltage of the MS. Moreover, m Q,MS and Q meas,MS are, respectively, the QV-droop characteristic slope or the droop gain and the instantaneously measured reactive power of the MS. The MS voltage magnitude is permitted to sag or droop by 5% for each 1 pu variation in its reactive power output. Under this situation, the QV-droop characteristic slope, m Q,MS , for the MS is computed using the values listed in Table A3 in Appendix A, as follows: This means that the MS voltage will be permitted to droop by 0.5 % to deliver 0.1 pu of reactive power. This appears to be a minor contribution; however, it greatly helps in the controlled injection of reactive power.
The principal role of the QV-droop control strategy is to regulate the voltage magnitude to a value at which the MS will need to inject a smaller amount of reactive power [41,42].

Overload Control for Inverter-Based Microsource
If one among several grid-forming AC sources operating in an MG reaches its real power limits while its other counterparts have not, at that time, a sudden load increase incident may overload that specific source. If this overloading condition persists for a longer period, it may cause the IC engine to stop or may damage the inverter-based DG units and may ultimately cause the overall MG to collapse. Now, to mitigate this overloading condition, the overloaded source is relieved by shifting its excess load (by sagging down its frequency) to the under-loaded sources [42,43]. As a matter of fact, the real power flow is always from a higher-frequency source to the lower-frequency source. Figure 3 depicts the overload prevention scheme for MS. It does not need any communication between various sources and functions autonomously by redistributing the real power flow in the MG in case of an unanticipated load increase incident.
The minima and maxima of real power for the MS (i.e., P min,MS and P max,MS , respectively) in case of overload prevention must be imposed. For this purpose, two separate PI controllers are used with maxima and minima in terms of frequency. Each PI controller yields zero output (i.e., ∆ω min , ∆ω max = 0) if the MS operates within its real power range.
Since the upper PI controller is provided with a zero upper limit, it will be activated only if the MS real power output goes beyond P max,MS . When the real power output goes beyond P max,MS , then ∆ω max becomes negative and imposes the real power limit. The upper PI controller is also provided with a -∆ω lower limit to stop the real power output of the MS from going below P min,MS . This strategy prevents the inverter-based MS frequency from sagging too much in the case of a sudden overload. This proceeds as follows: If the inverter-based MS is overloaded, it activates the upper PI controller, which immediately begins to reduce its frequency to prevent the overloading condition. On the other hand, to stop the real power output of the MS from going below P min,MS , the lower PI controller is provided with a zero lower limit and ∆ω upper limit. Thus, if the MS real power output goes below P min,MS , then ∆ω min becomes positive and imposes the real power limit.

Inverter-Interfaced External Energy Storage System Mathematical Modeling with Droop/Primary Control and Overload Control
As with the inverter-based MS, the inverter-based ESS is also designed as a threephase controlled-voltage source. Moreover, its droop/primary and overload control model almost resembles the mathematical model of the inverter-based MS, but with only one important dissimilarity: in the case of the ESS, the minimum limit of real power, P min,ESS , is kept negative-that is, P min,ESS = −2.50 kW = −0.1667 pu-which indicates battery charging/energy storage. Thus, the Pω-droop characteristic slope for ESS, m P,ESS , can be computed using the values listed in Table A3, in Appendix A, as follows: The QV-droop characteristic slopes are the same for the inverter-based ESS and MS (i.e., m Q,ESS = m Q,MS ).

Diesel Genet Mathematical Modeling with Droop/Primary Control and Overload Control
The main parts of the GS include a wound-field synchronous generator driven by a diesel IC engine, a mechanical speed governor and a field exciter. The overload control for the diesel GS can be applied in a similar manner to that applied to the inverter-based DG units, as shown in Figure 3.

Droop/Primary Control for Diesel Genset
The GS is shown in Figure 4 along with its droop/primary and overload control. For GS, the Pω-droop strategy is given below: where ω GS , ω 0 and ∆ω adj,GS represent, respectively, the frequency of GS, the nominal MG frequency and the frequency adjustment under overload control for GS. Moreover, m P,GS , P req,GS = P set,GS and P meas,GS are, respectively, the droop gain, the real power request/setpoint and the instantaneously measured active power of GS. Similarly, the QV-droop strategy for GS is described below: where V cmd = V max , V req,GS = V set,GS and V meas,GS are, respectively, the voltage magnitude command applied as an input to the GS field exciter controller, the GS voltage magnitude set-point and the instantaneously measured voltage of the GS. Moreover, m Q,GS and Q meas,GS are, respectively, the droop gain and the instantaneously measured reactive power of GS. Note that the droop gains for GS and MS are the same (i.e., m P,GS = m P,MS and m Q,GS = m Q,MS ). The PI controller, depicted in the voltage regulator block in Figure 4, takes the voltage error as an input from the QV-droop control block and produces an output that is summed with a feed-forward value (i.e., a constant), V base . This feed-forward value is actually the expected voltage value required in order to generate the reference voltage magnitude at the inverter terminals. The field exciter block receives the voltage regulator block output, V cmd .
The field exciter block takes inputs from the synchronous generator shaft and the voltage regulator block (i.e., ω r and V cmd , respectively) to generate a DC excitation, V f , for the synchronous generator field winding.
The speed governor block generates a fuel command, F cmd , from the measured real power output of GS and the speed error (i.e., P meas,GS and ω GS − ω r,GS , respectively). The fuel command goes to the IC engine for the mechanical speed regulation of the synchronous generator, where ω GS and ω r,GS , respectively, represent the synchronous generator's electrical frequency and the mechanical speed of the rotor. The speed error, when passed through a PI controller, modifies the torque command, T cmd , according to the load demand of the synchronous generator. Impractical torque command production, especially in the case of sudden load variation, are prevented by a limiter. Later on, the torque command, T cmd , is converted into a fuel command, F cmd , which helps in decoupling the synchronous generator load. Finally, the fuel command is fed into the IC engine; that is, the prime mover. It produces mechanical power, P mech,GS , from the fuel command, F cmd . This conversion process includes the calculation of fuel torque (i.e., T Fu ), fuel power (i.e., F pow ) and friction power losses (i.e., P f l ), expressed as follows: where F cmd = K t f T cmd , with constant K t f > 0.
where η th , K f v , K ev and K m > 0 indicate constant parameters.

Proposed Distributed Finite-Time Consensus Protocol Design
The proposed distributed control scheme is presented in this section. The main disadvantage of the droop/primary control is the steady-state, load-dependent deviations in the frequency of an individual DG unit during the autonomous operation of the MG; in other words, the primary control alone cannot nullify these frequency deviations. Thus, the design of secondary control, together with primary control, becomes essential for the frequency restoration of each DG unit to its nominal value during the autonomous operation of the MG [16][17][18]. The distributed control scheme incorporates the advantages of both centralized and decentralized control schemes [44], and is more robust and scalable [45]. For this purpose, the secondary control is designed with a slower execution rate and longer time frame than the primary control. This also justifies the individual design and decoupled dynamic analysis of the two control loops [19].
In the proposed strategy, each DG unit is provided with a droop/primary controller as well as a distributed secondary consensus-based controller. Inspired by [46], the authors propose the following distributed secondary finite-time consensus-based control protocol: In order to achieve the following objective: . . , N = 3} indicates the set of the DG units, a ij is the entry of the adjacency matrix, A, α denotes a design parameter, where (0 > α > 1), c P > 0 is a consensus control gain, γ i (t) ∈ R N represents an internal (or auxiliary) state variable, r i (t) represents an external time-varying reference signal, P i,meas (t) ∈ R N represents the measured real power output of the ith DG unit, and sgn(·) represents the signum function, whose components can be expressed as follows: The time-varying reference signal, r i (t), in Equation (15), is actually utilized as the time-varying average microgrid load (i.e., r i (t) = P Li,avg (t) = 1 N ∑ N i=1 P i,meas (t)). The aim is to formulate a distributed control protocol for the ith DG unit so that all the DG units eventually start tracking the time-varying average active connected load, P Li,avg (t), in a finite time.
The initialization condition for the auxiliary state variable of the ith DG unit, γ i (t), is given below: Differentiating Equation (15) yields the closed-loop distributed finite-time consensus protocol, expressed as follows: where the initialization conditions are ∑ N i=1 P i,meas (0) = r i (0) = P Li, avg (0). The proposed distributed controller, expressed in Equation (18), dictates the updated active power references, P i,req , to the droop/primary controller of each DG unit. In response to these commands from the distributed controller, each DG unit dispatches equal real power depending upon the average microgrid load (i.e., P Li,avg (t)) at that time. Concurrently, all the DG units are forced to operate with their frequencies regulated to the reference microgrid frequency. The overall closed-loop implementation of the proposed distributed secondary control protocol is depicted in Figure 5. Consensus Proof. The active power consensus error, ζ i (t), for the ith DG unit, can be defined as below: For an undirected and connected communication graph, G, it is necessary to have 1 N ∑ N i=1Ṗ i,meas (t) = 0. This means that 1 N ∑ N i=1Ṗ i,meas (t) is time-invariant. Then, the corresponding differential error can be expressed as follows: Now, we define an undirected graph, G P , with an associated adjacency matrix, A P = [a Pij ] N×N = [(c P a ij ) 2 1+α ] N×N , and λ s is defined as the second smallest positive eigenvalue of the Laplacian matrix, L P . Then, we consider V 1 to be the Lyapunov function candidate, where V 1 can be expressed as follows [47,48]: where ζ i (t) = [ζ 1 (t), ζ 2 (t), . . . , ζ N (t)] T indicates the error vector. Thus, the time-derivative of Equation (21) yieldṡ  then, U(t) = 0 ∀ t ≥ t s , where the settling time, t s , can be estimated as follows [51]: Using Lemma 1, for 0 < α < 1, it follows that Then, from Lemma 2, it follows thaṫ Finally, from Lemma 3, it follows that the finite-time average active power consensus is achieved using the proposed control protocol, as expressed in Equation (18), with (0 < α < 1).

Numerical Simulation Results and Discussion
The correctness and effectiveness of the proposed control technique, expressed in Equation (18), were numerically tested in Matlab/Simulink on the MG testbench, as illustrated in Figure 1. Figure 5 indicates the overall implementation of the proposed control protocol. Various parameters of the main grid and the overall MG testbench are tabulated in Tables A1-A4 in Appendix A. The undirected communication graph, G, between DG units under normal conditions is illustrated in Figure 2.
The following six tests were conducted for performance assessment:

Test 1: Performance Assessment under Droop/Primary Control Only
First of all, the system was simulated with only the droop/primary control in place, while the proposed distributed secondary controller was deactivated. From the start of simulation (t = 0 s), the MG was operated in the grid-connected mode, and then it was switched to the islanded mode at t = 2 s. The phase-to-phase voltage set-points, V i,set , for all the three DG units were 208 V. The real power set-points, P i,set , for all the three DG units (i.e., ESS, MS and GS) were, respectively, 1 kW, 5 kW and 10 kW. The overall active load demand from t = 0 to 4 s was P L,Total = 28 kW, constituted by the loads connected at the four buses, as follows: P L,Bus1 = P L,Bus3 = P L,Bus4 = 8 kW, while P L,Bus2 = 4 kW. The stated overall active load demand was then increased to 32 kW by increasing P L,Bus2 from 4 to 8 kW, from t = 4 to 6 s. Figure 6a indicates the main grid behavior before and subsequent to disconnection, while Figure 6b-d, respectively, indicates the inverter-based ESS, inverter-based MS and diesel GS behavior under droop/primary control only. During switching to the islanded mode, the MG faced an absence of real power from the main grid. All the DG units adopted the Pω-droop characteristic and, consequently, their frequencies were allowed to drop slightly below the reference value (i.e., f 0 = 60 Hz). Moreover, to compensate for the real power loss from the main grid, each DG unit immediately began to increase its active power output. This process continued until the total existing real power demand was completely met. At this level, the real power generation of all the three DG units attained a constant value, as illustrated from t = 2 to 4 s. At t = 4 s, there was a load increase event. Due to their negligible inertias, both of the inverter-interfaced DG units (i.e., ESS and MS) further increased their real power generation to fulfill the extra power demand by further dropping their frequencies below the reference value. On the other hand, the rotating-type DG unit (i.e., diesel GS) possessed a high inertia and could not quickly pick up the increased load. Thus, the diesel GS almost retained its previous frequency and power level. It is important to mention that the frequency deviation of each DG unit conformed to the prescribed frequency droop value (i.e., ∆ f = 0.5 Hz or 0.833 %).  In the case of several DG units operating in parallel in an MG, the bus voltage regulation to a specific value causes reactive power to circulate between the DG units. This phenomenon enhances the DG units' rating and reduces the efficiency of the system. To mitigate this problem, a QV-droop strategy was adopted [52]. As depicted in Figure 6, the circulating reactive powers were easily observable prior to the islanding event at t = 2 s. However, once all the bus voltages were regulated (to V req = 120 V line-to-neutral or 208 V phase-to-phase), after the islanding event, the circulating reactive powers between the DG units were reduced to a minimal value. Upon an increase in load at t = 4 s, transient disturbances could be observed in the reactive power-sharing output of each DG unit. It is important to state that the voltage deviation of each bus conformed to the prescribed voltage droop magnitude (i.e., ∆V = 5 %).

Test 2: Performance Assessment under the Proposed Secondary Scheme with Plug-and-Play Test
In this test, the performance of the proposed control method was analyzed for equal power sharing, frequency regulation and the plug-and-play operation of DG units.
From the start of simulation (t = 0 s), the MG was operated in the grid-connected mode, and then it was switched to the islanded mode at t = 2 s. The overall active load demand from t = 0 to 7 s was P L,Total = 12 kW, constituted by the loads connected at the four buses, as follows: P L,Bus2 = P L,Bus3 = P L,Bus4 = 4 kW, while P L,Bus1 = 0 kW, thus giving an average load of, P Li,avg = 4 kW per DG unit. Then, the stated overall active demand was augmented to 16 kW by increasing P L,Bus2 from 4 to 8 kW, from t = 7 to 10 s, thus yielding an average load of P Li,avg = 5.33 kW per DG unit. From t = 10 to 13 s, P L,Bus2 was again reduced to 4 kW, thus resulting in an overall active load demand of P L,Total = 12 kW and average load of P Li,avg = 4 kW per DG unit.
The real powers externally requested from the DG units are illustrated in Figure 7. The proposed control algorithm, expressed in Equation (18), forced these powers to reach an average consensus in a finite time, with c P = 0.001 and α = 0.001. In response to these agreed-upon values of the requested real powers, each DG unit delivered equal real power despite load perturbations and tracked the system's average active demand continuously, as shown in Figure 8. Upon islanding at t = 2 s, the real power consensus between DG units was attained within 2 s. After load variation events at t = 7 s and 10 s, the consensus was achieved within 1 s. It can be observed that the individual contribution of each DG unit, in terms of real power, was equal to the system's average demand, whereas the total real power contribution of the three DG units, as shown in Figure 8, tracked/was equal to the system's overall active demand. The plug-and-play attribute for DG units was tested by unplugging the MS at t = 13 s and reconnecting it at t = 17 s. Note that unplugging the MS simultaneously disabled the two-way communication links (i.e., MS←→ESS and MS←→GS links), as illustrated in Figure 2. Moreover, unplugging the MS resulted in an increased average demand of P Li,avg = 6 kW per DG unit. It can be seen in Figure 8 that whether the MS was in service or out of service, average real power consensus was successfully achieved between the DG units in a finite time, and the total load demand was fully satisfied. Consequently, the proposed control strategy supported the plug-and-play operation of the DG units. Figure 9a-c illustrates the combined behavior of the inverter-based ESS, inverter-based MS and diesel GS, respectively. It is evident that the frequencies of the DG units were quite accurately restored to the reference value (i.e., 60 Hz) under the load perturbations and the plug-and-play events. The reactive power of each DG unit was minimized and the phase-to-neutral voltage of each DG unit was regulated to its nominal value (i.e., 120 V). Nonetheless, slight transient disturbances were also observable in the frequencies and voltages under the load perturbations and the plug-and-play events. Under load variations, the bus currents and the active power dispatches varied proportionally.

Test 3: Performance Assessment under the Proposed Secondary Scheme with Robustness Test against Communication Latency
In this test, the robustness of the proposed control technique to different communication latencies (i.e., 300 ms, 600 ms and 1 s) was evaluated. As illustrated in Figure 10a-c and Figure 11a-c, the system's closed-loop response (i.e., real powers and frequencies of the DG units) exhibited more oscillations in the case of communication latency. Moreover, the convergence was retarded under communication latency. It is observed that the oscillations varied in proportion with the communication latency while the convergence varied inversely with the communication latency. Nonetheless, the proposed secondary control technique still managed to fulfill its objectives and effectively tolerated the impact of communication latencies.

Test 4: Performance Comparison with the Existing Distributed Control Protocol
The performance of the proposed control technique was further compared with the existing distributed control protocol reported in [35][36][37], which can be specified as follows: where c P > 0. It can be seen in Figure 12a,b that the existing distributed control protocol reported in [35][36][37] demonstrated slower convergence as well as larger deviations in the power outputs of the DG units than the proposed distributed protocol illustrated in Figures 8 and 9, with similar conditions applied. These deviations were easily observable during the plugand-play event from t = 13 to 17 s. Likewise, under communication latencies, as shown in Figure 13a,b, the technique reported in [35][36][37] demonstrated much larger oscillations in the power outputs of DG units, especially under larger latencies (i.e., 500 ms), as compared to the proposed technique illustrated in Figure 10a-c. It is important to mention that under communication latencies, as shown in Figure 13c,d, the method reported in [35][36][37] demonstrated a larger steady-state error in the frequencies of the DG units, especially under larger latencies, where the frequencies were not precisely regulated. On the other hand, the proposed technique was still capable of precisely regulating the frequencies of the DG units, even under a sufficiently large latency of 1 s, as shown in Figure 11a-c.

Test 5: Sensitivity Analysis of the Proposed Control Scheme
This section demonstrates the sensitivity analysis of the proposed control strategy, as expressed in Equation (18), to gains of c P and α. It is important to mention that in Tests 1-3, as described in Section 5, the proposed control strategy was fine-tuned by choosing c P = 0.001 and α = 0.001. Now, if c P = 0.001 and α were increased alone, or α = 0.001 and c P were increased alone, the impact on the final results would be invisible to the naked eye. Thus, those results are not included in the article for the sake of brevity. However, it is worth mentioning that if both c P and α were increased simultaneously, the performance of the system would decline; thus, setting c P = 1 and α = 0.5 made the convergence much slower, as depicted in Figure 14a, from t = 4 to 10 s and beyond t = 17 s. Similarly, choosing c P = 5 and α = 0.9 greatly improved the convergence, as depicted in Figure 14b, from t = 4 to 10 s. However, the strategy failed to ensure a proper plug-and-play operation for the MS, as depicted in Figure 14b, where the algorithm did not converge from t = 13 to 17 s. Moreover, it rendered huge spikes upon the restoration of the MS at t = 17 s.

Test 6: Applicability of the Proposed Control Strategy to a Large System
This section demonstrates the applicability of the proposed control strategy, as expressed in Equation (18), to a large microgrid system. The stated system is shown in Figure 15, whereas its communication graph, G, is depicted in Figure 16. The overall active load demand from t = 0 to 7 s was P L,Total = 80 kW, constituted by the loads connected at various buses, thus giving an average load of P Li,avg = 6.66 kW per DG unit. Then, the stated overall active demand was augmented to P L,Total = 96 kW, from t = 7 to 10 s, thus yielding an average load of P Li,avg = 8 kW per DG unit. From t = 10 to 13 s, the overall active load demand was again reduced to P L,Total = 80 kW, thus giving an average load of P Li,avg = 6.66 kW per DG unit. It can be seen in Figure 17a that each DG unit quite accurately fulfilled the average load demand before and after the load perturbations, thus successfully meeting the overall load demand. At the same time, the frequencies of all DG units were regulated to the reference microgrid frequency (i.e., 60 Hz), as shown in Figure 17b. This implies that the proposed strategy can also be applied to a large microgrid system.

Conclusions
In this article, a fully-distributed finite-time consensus-based secondary control protocol is presented for droop-based AC microgrids. The proposed protocol is fully distributed in the sense that each agent of the communication network only requires its own information along with information of its neighbors. It was tested on small as well as large microgrid testbenches with multiple DG units in Matlab/Simulink using time-domain based numerical simulations. This article explicitly takes into account the hierarchical control structure of the DG units; primary control is achieved using the droop control method while secondary control is achieved using the proposed distributed finite-time consensus design. The proposed protocol adjusts the active power outputs of the DG units in such a way that they reach an agreed-upon level in a finite time. At the same time, the frequencies of the DG units are regulated to the reference microgrid frequency in a finite-time. The proposed design is robust to time-varying load perturbations and communication latencies. Moreover, it guarantees a plug-and-play attribute for DG units. The proposed distributed protocol was compared with the existing distributed protocol reported in [35][36][37]; it is observed that the proposed scheme demonstrates superior performance.   π rad s −1 ∆ω π rad s −1 P max 15 kW = 1 pu P max 15 kW = 1 pu P min 0 kW P min −2.50 kW = −0.1667 pu V req 208 V = 1 pu V req 208 V = 1 pu K P pro 3 K P pro 3 K P int 30