Consensus Design for Heterogeneous Battery Energy Storage Systems with Droop Control Considering Geographical Factor

: This paper proposes a hierarchical control strategy to coordinate battery energy storage devices based on a multi-agent system. The heterogeneous nature of the battery volume is paid much more attention in designing the proportional protocol of the consensus controller. Besides that, a cluster algorithm based on Minimum Spanning Tree (MST) is suggested to represent geographical factor, and on account of that, each Battery Energy Storage System (BESS) is classiﬁed into its speciﬁc cluster zone. Further, an active leader is assigned to be in charge of information from the external side in every cluster. The consensus algorithm reconciles all clusters in a step-by-step way. Energy level, voltage, frequency and active / reactive power sharing of every BESS can reach consensus by an information exchange within and among clusters respectively. Further, a virtual leader is taken into the active leader role in directing frequency and voltage to the reference values. To verify the consensus algorithm, a modiﬁed IEEE 57-bus is employed for time-domain simulations in an islanded mode and all BESSs are working in a discharge model.


Introduction
Energy storage technology is becoming the main method to stabilize the microgrid. A scheduling method for peak load shift of an energy storage system can increase power energy utilization rates and reduce economic expenditure of residents and power plants. Nowadays, more and more kinds of grid-connected renewable energy sources will contribute to the fluctuation of voltage and frequency, which can cause instability in the microgrid. An energy storage system can function as a power buffer and improve the quality of voltage and frequency. In other words, energy storage systems can be empowered as spare power sources when a fault appears in the grid [1][2][3][4][5][6][7].
Generally, the controller of energy storage is centralized or fully distributed. Compared with the centralized control, every energy storage only processes its relevant data in a distributed manner [8,9]. Therefore, distributed control has the characteristics of flexibility and reliability and is the common way in an energy storage system. In [10], distributed control is used to keep the balance between power output and load. To eliminate the attack of communication jamming, a distributed fuzzy logic-based control is adopted to ensure convergence under cyber-attack scenarios in [11].
A multi-agent system can cope with complex problems effectively in a power system and improve the robustness, reliability and flexibility of the system [12]. Therefore, lots of papers bring a multi-agent method into the controller of an energy storage system. For example, [13] introduces a multi-agent based distributed algorithm, by which the state-of-charge (SoC) of all energy storage units can reach average consensus. In [14], a consensus algorithm based on a multi-agent system is proposed to solve the energy management problem.
In a single energy storage system, P/Q control and U/f control are the common methods, and the former carries out in a grid-connection mode while the latter puts into effect to retain the stability of voltage and frequency in island mode [15]. However, in the smart grid with multi storage systems, droop control is adopted to support load reliably [16,17] and propose a sparse communication network-based droop control to achieve power sharing, which can overcome the influence of output line impedances. Moreover, since microgrid does not have the characteristics of anti-interference capability, a PWM power converter of energy storage with droop control can operate in double quadrants, which can improve the inertia and damping of the grid. Thus, droop control can improve the capacity of resisting disturbance [18,19].
Challenges brings about power supply instability in the process of distributed generation integration into a power system, such as a voltage flicker [20]. Based on the above analysis, many researches focus on the performance of the storage incorporated into microgrid. [21] proposes the non-uniform droop gain ratio scheme to attain more accurate power sharing and restrain voltage and frequency fluctuation in the wind farm combined with the energy storage system. In [22], a flywheel merged into a wind farm can operate in an island model and support load to synchronize the system under the framework of a distributed algorithm. [23,24] proposed a distributed cooperative system and a secondary frequency controller for energy storages, whose power and energy level can reach a balance among the storages while the frequency can restore to the nominal value. In [25], the concept of heterogeneous nature of battery volume representing the capacity of power generation is drawn into a distributed controller to reach the power sharing consensus. Hierarchical control is applied to stabilize the frequency and voltage and restore the frequency and voltage to the nominal values by the secondary controller designed in [26]. Similarly, [27] designed a secondary voltage controller with feedback linearization to regulate the voltage of the distributed generation to the set values.
In fact, a large-scale power system is a common form in a large region, where the power generations can be distributed in a certain distance from each other. However, in all of the above existing studies, the location feature has not been considered. Therefore, inspired by [28] and in order to improve the cooperative control of the energy storage system [29], this paper designs a distributed step-by-step consensus algorithm based on droop controller considering geographical location. According to different geographical distributions, all BESSs can be divided into several clusters by the clustering algorithm based on Kruskal, which is a kind of MST algorithm [30]. The controller input can eliminate the gap of energy level, active power, voltage, frequency and reactive power among all BESSs. It is worth mentioning that the function of this consensus controller is similar to the primary controller. In addition, a virtual leader is built into the frequency and voltage inputs [31], which functioned as the secondary controller [32]. To be simplified, the hierarchical structure of the heterogeneous BESS model is compacted by the droop controller.
The left parts of the paper are arranged as follows. Section 2 presents the necessary preliminaries, which contains the Laplacian matrix and the clustering algorithm based on MST. The consensus algorithm is described in Section 3. IEEE 57-bus system is put use to test the proposed designs in Section 4. Finally, Section 5 is the summary of this paper.

Improved Laplacian Matrix
In a multi-agent system, agents communicate with each other by an undirected connected graph G(∆, Γ), which contains a vertex set ∆ and an edge set Γ. In the edge set Γ, the weight a ij of edge (i, j) ∈ Γ is equal to 0 or 1. That is, if agent j is connected to i, a ij = 1; if not, a ij = 0. And the neighbor of agent i is denoted by N i = j : a ij 0 . In addition, the degree matrix D is a diagonal matrix and is the adjacency matrix of G. Considering the location feature of each agent, an improved Laplacian matrix with the weight corresponding to each edge is adopted in this paper. In the edge set Γ, a ij is the reciprocal of relative distance between i and j in communication topology and implies the communication intensity of agent i and j.

MST and Kruskal
In G(∆, Γ), we can find one subgraph g(∆, ε) which contains all vertexes and only a path from agent i to agent j for ∀i, j ∈ ∆ and the sum of whose distances w = (i,j)∈ε 1/a ij are the smallest, where Kruskal is a kind of greedy algorithm based on union-find sets algorithm. It works out MST by traversing the edge as follows. Firstly, arrange all edges in ascending order. Secondly, traverse the shortest edge, processing it by union-find sets in turn. Finally, g(∆, ε) contains n vertexes and n − 1 edges.

A Clustering Algorithm Based on Kruskal
In this paper, BESSs are classified by clustering based on the Kruskal algorithm. Herein, ε 0 is the set of all edges, and ε k is the result of the algorithm in k th iteration, where one edge of ε k−1 is removed in order to get a new set ε k under the condition that the objective function δ k in Equation (1) can get the maximum. When the inequality Equation (2) is satisfied, the iteration of the algorithm ends and this algorithm runs out.
where δ(ε k ) is the variance of ε k . An isolated BESS will cause instability, especially when the load changes. It is reasonable that the isolated one is classified to the cluster of its nearest BESS, which belongs according to the location.

The Consensus Design
This paper proposes a step-by-step consensus algorithm with several active leaders or a virtual leader. In fact, active leaders are some agents while the virtual leader is an external command. All active leaders can reach consensus by exchanging information with each other and other agents can reach consensus according to their leader. The virtual leader can force all agents to follow the leader. Figure 1 is a diagram of the step-by-step consensus controller. As shown in Figure 1, all agents are classified by the clustering algorithm in the last section, then select an agent as the leader in each cluster, i.e., L1 and L2. L1 in Cluster 1 and L2 in Cluster 2 are the active leaders in a), where they exchange information of their clusters with each other. L is the virtual leader in b), where L1 and L2 can receive the information from the leader. Accordingly, other agents in the set F1 and F2 will reach consensus under the guidance of their leader in each cluster. Every active leader in the cluster can play the role of active leader. For fast consensus, one can be select as active leader who has the largest number of neighbors. In order to save hardware/software, the virtual leader L should be incorporated into the active leader L1 and L2.

The Input Design of the Consensus for BESS
Generally, the control structure of BESS shown in Figure 2 contains the inner current controller, the voltage controller, power calculation and droop controller [33][34][35]. However, the inner current controller and the voltage controller respond faster than the droop controller, and they can be ignored reasonably [36,37]. In other word, the control structure can be simplified by the droop controller expressed by Equation (3) which is used to maintain the stability of frequency and voltage in BESS.
where i ω and i V are the frequency and voltage separately,  [23] proposes a simplified model based on a droop controller for a large-scale energy system simulation. So, this paper designs a series of inputs of the simplified model to synchronize all BESSs, i.e., Equations (4) and (5).

The Input Design of the Consensus for BESS
Generally, the control structure of BESS shown in Figure 2 contains the inner current controller, the voltage controller, power calculation and droop controller [33][34][35]. However, the inner current controller and the voltage controller respond faster than the droop controller, and they can be ignored reasonably [36,37]. In other word, the control structure can be simplified by the droop controller expressed by Equation (3) which is used to maintain the stability of frequency and voltage in BESS.
where ω i and V i are the frequency and voltage separately, ω 0 i and V 0 i are the nominal frequency and the nominal voltage, K p i and K Q i are the droop gains. For simplicity, K P i P i and K P i Q i are denoted by P i and Q i in this paper. Similarly, [23] proposes a simplified model based on a droop controller for a large-scale energy system simulation. So, this paper designs a series of inputs of the simplified model to synchronize all BESSs, i.e., Equations (4) and (5).
where ω i , P i , E i , V i and Q i are the frequency, active power, energy, voltage and reactive power of BESS respectively, u ω i , u P i , u E i , u V i and u

The Design of the Input for Consensus
This paper adopts the method of multi-agent to design the input presented in Equation (6).
K represent the ratio of active and reactive power and the capacity ratio of BESSs in [36].

The Design of the Input for Consensus with a Virtual Leader (Leader-Follower Consensus Algorithm)
In order to realize the grid connection of BESS, frequency and voltage must restore to the nominal value of the grid. So, this paper introduces a virtual leader ( , )  (7) and (8).
where 0i a represents whether BESS i is connected to the leader, i.e., in Equation (9).

The Design of the Input for Consensus
It is assumed that 0 ij τ > is the delay time on communication between from j to i . In [38], a model with the communication delay in the topology of agents was proposed. Therefore, the same concept is introduced to this paper and the adjacency matrix is rewritten as Equation (10), which is applied to the step-by-step algorithm with the virtual leader.

The Design of the Input for Consensus
This paper adopts the method of multi-agent to design the input presented in Equation (6).
where L i is the i th row of the Laplacian matrix L corresponding to the topology G of communication structure of BESSs, the column vector ω 0 , P, E, V 0 and Q are synthesis of the nominal frequency, active power, energy, the nominal voltage and reactive power of n BESSs represented by ω 0 = T , 1/K P i and 1/K Q i represent the ratio of active and reactive power and the capacity ratio of BESSs in [36].

The Design of the Input for Consensus with a Virtual Leader (Leader-Follower Consensus Algorithm)
In order to realize the grid connection of BESS, frequency and voltage must restore to the nominal value of the grid. So, this paper introduces a virtual leader 0(ω r , V r ) incorporated into a BESS, which can lead frequency and voltage of all BESSs to ω r and V r . Improved inputs are shown in Equations (7) and (8).
where a 0i represents whether BESS i is connected to the leader, i.e., in Equation (9).

The Design of the Input for Consensus
It is assumed that τ ij > 0 is the delay time on communication between from j to i. In [38], a model with the communication delay in the topology of agents was proposed. Therefore, the same concept is introduced to this paper and the adjacency matrix is rewritten as Equation (10), which is applied to the step-by-step algorithm with the virtual leader.
Appl. Sci. 2020, 10, 726 6 of 14 where A τ (i, j) is the element in row i, column j, z −τ ij is the delay operator.

The Design of the Input for Consensus
In Figure 3, the weight of each edge represents relative distance between two BESSs and set the distance between BESS 2 and BESS 7 as 1. The result of the classification by the clustering algorithm is shown in Figure 3d. It shows that BESS 1,2,3,7 are in the same cluster while others are in the other cluster. To facilitate communication among the members of every cluster and between two clusters, BESS 7 and BESS 5 are selected as the active leader. The virtual leader is incorporated into BESS 7 and 5.

The Design of the Input for Consensus
In Figure 3, the weight of each edge represents relative distance between two BESSs and set the distance between BESS 2 and BESS 7 as 1. The result of the classification by the clustering algorithm is shown in Figure 3d. It shows that BESS 1,2,3,7 are in the same cluster while others are in the other cluster. To facilitate communication among the members of every cluster and between two clusters, BESS 7 and BESS 5 are selected as the active leader. The virtual leader is incorporated into BESS 7 and 5.

Simulation Results
To verify the proposed algorithm, this paper adopts the IEEE 57-bus System as the test system [39]. The IEEE 57-bus System has seven generators and 42 load nodes shown in Figure 4. All generators are replaced by BESSs. According to [40][41][42], MatDyn is programmed for the dynamic simulation of synchronous generators, which is a toolbox based on the power flow calculation MATLAB Toolbox MATPOWER.

Simulation Results
To verify the proposed algorithm, this paper adopts the IEEE 57-bus System as the test system [39]. The IEEE 57-bus System has seven generators and 42 load nodes shown in Figure 4. All generators are replaced by BESSs. According to [40][41][42], MatDyn is programmed for the dynamic simulation of synchronous generators, which is a toolbox based on the power flow calculation MATLAB Toolbox MATPOWER. To verify the proposed algorithm, this paper designs five cases in island mode and compares them with each other, where the specific values of droop gains are presented in Table 1. To verify the proposed algorithm, this paper designs five cases in island mode and compares them with each other, where the specific values of droop gains are presented in Table 1.

Case 1 Consensus Controller without Leader Regardless of Geographic Factors
This case is used to test the consensus algorithm without considering geographic factors proposed in this paper. The communication graph of BESSs is shown in Figure 3a, and the whole system is working in islanded mode. The consensus controller begins to work at 10 s. All BESSs will reach consensus at 12 s. In addition, there is a 1.26 + j1.26 per unit (p.u) load decrease after 20 s and a 2.52 + j2.52p.u load increase after 30 s. It is noteworthy that load changes are fully distributed among loads. As can be seen from Figure 5, whatever the load decreases or increases, active and reactive power sharing, frequency, voltage and energy level of all BESSs also can be synchronized and their final state can reach the average of their initial value. In addition, it can be observed that the consensus controller can act as the primary frequency/voltage controller.

Case 1 Consensus Controller without Leader Regardless of Geographic Factors
This case is used to test the consensus algorithm without considering geographic factors proposed in this paper. The communication graph of BESSs is shown in Figure 3a, and the whole system is working in islanded mode. The consensus controller begins to work at 10 s. All BESSs will reach consensus at 12 s. In addition, there is a 1. 26  load increase after 30 s. It is noteworthy that load changes are fully distributed among loads. As can be seen from Figure 5, whatever the load decreases or increases, active and reactive power sharing, frequency, voltage and energy level of all BESSs also can be synchronized and their final state can reach the average of their initial value. In addition, it can be observed that the consensus controller can act as the primary frequency/voltage controller.

Case 2 Consensus Controller without Leader Considering Geographic Factors
Under the same operating point change as in case 1, this case is used to test consensus controller considering the geographic factor without leaders. Similarly, all BESSs are working in an isolated model, and the communication topology of all BESSs is shown in Figure 3a. At the same time, a load decrement of 1.26 1.26 .
j pu + and a load increment of 2.52 2.52 . j pu + at each load node occur at 20 s and 30 s respectively. Unlike case 1, the geographic factor is considered and the improved Laplacian matrix is applied in this case. It can be observed in Figure 6 that all BESSs reach consensus in this case

Case 2 Consensus Controller without Leader Considering Geographic Factors
Under the same operating point change as in case 1, this case is used to test consensus controller considering the geographic factor without leaders. Similarly, all BESSs are working in an isolated model, and the communication topology of all BESSs is shown in Figure 3a. At the same time, a load decrement of 1.26 + j1.26p.u and a load increment of 2.52 + j2.52p.u at each load node occur at 20 s and 30 s respectively. Unlike case 1, the geographic factor is considered and the improved Laplacian matrix is applied in this case. It can be observed in Figure 6 that all BESSs reach consensus in this case slower than case 1, where BESS 4 is the slowest one. That is because there is a longer distance between BESS 4 and other BESSs, and every BESS reaches consensus at a different time according to the distance from its neighbor. Therefore, the convergence speed is affected by the geographic location.
slower than case 1, where BESS 4 is the slowest one. That is because there is a longer distance between BESS 4 and other BESSs, and every BESS reaches consensus at a different time according to the distance from its neighbor. Therefore, the convergence speed is affected by the geographic location.

Case 3 Step-By-Step Case without the Virtual Leader
This case is used to test the effect of a step-by-step consensus algorithm considering geographic factors. The communication topology of all BESSs is shown in Figure 3e. The consensus controller is activated at 10 s. All BESSs in each cluster will reach consensus at 17 s, and then two clusters are coordinated. In addition, there is a  Figure 7 that all BESSs can reach consensus in two steps. Firstly, BESS 1,2,3 and 7 in cluster 1 and BESS 4,5 and 6 in cluster 2 reach consensus respectively. Secondly, cluster 1 and cluster 2 reach consensus. Compared with case 1 and 2, the consensus speed is slower. It is noted that the speed of every BESS is negatively correlated with distance.

Case 3 Step-By-Step Case without the Virtual Leader
This case is used to test the effect of a step-by-step consensus algorithm considering geographic factors. The communication topology of all BESSs is shown in Figure 3e. The consensus controller is activated at 10 s. All BESSs in each cluster will reach consensus at 17 s, and then two clusters are coordinated. In addition, there is a 1.26 + j1.26p.u load decrease after 30 s and a 2.52 + j2.52p.u load increase after 50 s. It can be observed in Figure 7 that all BESSs can reach consensus in two steps. Firstly, BESS 1,2,3 and 7 in cluster 1 and BESS 4,5 and 6 in cluster 2 reach consensus respectively. Secondly, cluster 1 and cluster 2 reach consensus. Compared with case 1 and 2, the consensus speed is slower. It is noted that the speed of every BESS is negatively correlated with distance.
Appl. Sci. 2019, 9, x FOR PEER REVIEW 10 of 15 slower than case 1, where BESS 4 is the slowest one. That is because there is a longer distance between BESS 4 and other BESSs, and every BESS reaches consensus at a different time according to the distance from its neighbor. Therefore, the convergence speed is affected by the geographic location.

Case 3 Step-By-Step Case without the Virtual Leader
This case is used to test the effect of a step-by-step consensus algorithm considering geographic factors. The communication topology of all BESSs is shown in Figure 3e. The consensus controller is activated at 10 s. All BESSs in each cluster will reach consensus at 17 s, and then two clusters are coordinated. In addition, there is a  Figure 7 that all BESSs can reach consensus in two steps. Firstly, BESS 1,2,3 and 7 in cluster 1 and BESS 4,5 and 6 in cluster 2 reach consensus respectively. Secondly, cluster 1 and cluster 2 reach consensus. Compared with case 1 and 2, the consensus speed is slower. It is noted that the speed of every BESS is negatively correlated with distance.

4.2.4.
Step-By-Step Case with the Virtual Leader (Leader-Follower Consensus Algorithm) This case is used to test the leader-follower consensus algorithm proposed in this paper. The communicate topology of all BESSs in Figure 3e is adopted. The consensus controller begins to work at five seconds. What is more, the same load change of each load node as the case 3 occurs at 50 s and 90 s. It is shown in Figure 8 that energy level, voltage, frequency, active power and reactive power can reach consensus in two steps just as case 3. Furthermore, frequency and voltage restore to the nominal value 1 p.u whatever load changes. It can be observed that the leader-follower consensus controller can play a part of the secondary frequency/voltage controller.

4.2.4.
Step-By-Step Case with the Virtual Leader (Leader-Follower Consensus Algorithm) This case is used to test the leader-follower consensus algorithm proposed in this paper. The communicate topology of all BESSs in Figure 3e is adopted. The consensus controller begins to work at five seconds. What is more, the same load change of each load node as the case 3 occurs at 50 s and 90 s. It is shown in Figure 8 that energy level, voltage, frequency, active power and reactive power can reach consensus in two steps just as case 3. Furthermore, frequency and voltage restore to the nominal value 1 .
pu whatever load changes. It can be observed that the leader-follower consensus controller can play a part of the secondary frequency/voltage controller.

The Effect of Communication Delay
This case is used to cope with the delay of the communication topology proposed under the same operating point change in case 4. All BESSs communicate with each other over a topology structure shown in Figure 3e. Besides, the load change is the same as in case 4. To facilitate grid connection, the reference values of voltage and frequency in the virtual leader are set as 1 .
pu. The delay time is set as 100 ms and is far beyond the upper limit, which is defined as 16 ms by the IEEE and international electro-technical commission (IEC) to ensure the stability of the grid [43]. As shown in Figure 9, although communication delay causes some oscillations and a longer time to reach consensus, energy level, voltage, frequency and active/reactive power all can be synchronized.
Besides, voltage and frequency can be regulated to 1 . pu, which are the most important conditions for the grid connection of the microgrid.

The Effect of Communication Delay
This case is used to cope with the delay of the communication topology proposed under the same operating point change in case 4. All BESSs communicate with each other over a topology structure shown in Figure 3e. Besides, the load change is the same as in case 4. To facilitate grid connection, the reference values of voltage and frequency in the virtual leader are set as 1 p.u. The delay time is set as 100 ms and is far beyond the upper limit, which is defined as 16 ms by the IEEE and international electro-technical commission (IEC) to ensure the stability of the grid [43]. As shown in Figure 9, although communication delay causes some oscillations and a longer time to reach consensus, energy level, voltage, frequency and active/reactive power all can be synchronized. Besides, voltage and frequency can be regulated to 1 p.u, which are the most important conditions for the grid connection of the microgrid. Appl. Sci. 2019, 9, x FOR PEER REVIEW 12 of 15

Conclusions
This paper proposes a distributed control method to coordinate multi BESSs in a microgrid working in an island model. Based on a geographical factor, a cluster algorithm based on MST proposed is used to classify BESS. Meanwhile, a simplified model of heterogeneous BESS with a secondary droop controller is applied in this paper. Furthermore, the step-by-step consensus

Conclusions
This paper proposes a distributed control method to coordinate multi BESSs in a microgrid working in an island model. Based on a geographical factor, a cluster algorithm based on MST proposed is used to classify BESS. Meanwhile, a simplified model of heterogeneous BESS with a secondary droop controller is applied in this paper. Furthermore, the step-by-step consensus algorithm based on a geographical factor is put into effect to realize the balance of the active/reactive power sharing, energy level, voltage, frequency among all BESSs. To facilitate the grid connection of BESSs, the reference incorporated into the active leader can lead to the reference value of voltage and frequency. Compared with the average consensus algorithm regardless of a geographical factor, the consensus algorithm proposed can realize not only the synchronization of BESSs, but also that the synchronization speed varies depending on location. It remains stable and synchronizes when the system meets the communication delay.  The (i, j)-th element of A g The topology of MST The active/reactive power, frequency, voltage and energy level of BESS i The rated frequency and voltage of BESS i V r , ω r The reference frequency and voltage The designed input of BESS i The coefficient of droop controller for BESS i τ ij The delay time from BESS j to i A τ The adjacency matrix of the communication graph with delay time