*Article* **Multi-Agent Consensus Algorithm-Based Optimal Power Dispatch for Islanded Multi-Microgrids**

#### **Xingli Zhai <sup>1</sup> and Ning Wang 2,\***


Received: 25 August 2019; Accepted: 19 September 2019; Published: 1 October 2019

**Abstract:** Islanded multi-microgrids formed by interconnections of microgrids will be conducive to the improvement of system economic efficiency and supply reliability. Due to the lack of support from a main grid, the requirement of real-time power balance of the islanded multi-microgrid is relatively high. In order to solve real-time dispatch problems in an island multi-microgrid system, a real-time cooperative power dispatch framework is proposed by using the multi-agent consensus algorithm. On this basis, a regulation cost model for the microgrid is developed. Then a consensus algorithm of power dispatch is designed by selecting the regulation cost of each microgrid as the consensus variable to make all microgrids share the power unbalance, thus reducing the total regulation cost. Simulation results show that the proposed consensus algorithm can effectively solve the real-time power dispatch problem for islanded multi-microgrids.

**Keywords:** islanded multi-microgrids; real-time power dispatch; multi-agent; consensus algorithm

#### **1. Introduction**

The emergence of microgrids (MG) provides a new technical means for the comprehensive utilization of renewable energy [1–3]. According to whether there is an electrical connection with the main grid, microgrids feature two typical operation modes, i.e., grid-connected and islanded. In general, microgrids can operate in grid-connected mode to exchange power with the main grid. On the other hand, when being used in a remote area or in an emergency situation, they can also be transferred to islanded mode to guarantee local grid services [4]. Therefore, an islanded microgrid is more suitable for remote areas without grid coverage, which can improve the utilization efficiency of local renewable energy and reduce the cost of power supply in remote areas. Recently, the multi-microgrids (MMGs) system has become an integrated, flexible network that incorporates multiple individual microgrids (MGs) [5,6], which are often geographically close and connected to a distribution bus. If the neighboring islanded microgrid in a remote area can realize the cluster operation through interconnection, the mutual energy between the microgrids not only helps to absorb excess power energy, but also supports each other as a backup power supply [7,8], which is beneficial to improving the overall power supply reliability and economy.

The islanded microgrids plays an important role in renewable energy applications and power sharing among different loads connected to multi-microgrid systems [9,10]. The key issue with islanded microgrids is how to ensure a power balance between generation and demand in a cost-effective way. Hence, problems of microgrid real-time dispatching and operations have received considerable attention in the literature. There are some achievements on the dispatching and operations of individual microgrids that mainly focus on reducing the regulation cost and the coordination of various devices in the microgrid. Due to the intermittency and variability of renewables-based distributed generation (DG), the methods for uncertainty power dispatch of individual microgrid are mainly classified into three categories: stochastic power dispatch [11], robust power dispatch [12,13], and rolling power dispatch [14]. In order to deal with the uncertainty of demand response and renewable energy, the authors of [11] presented a stochastic programming framework for 24-h optimal scheduling of combined heat and power (CHP) systems-based MG. Wang R. and Luo Z. of [12] and [13] adopted a robust optimization approach to accommodate the uncertainties of demand response and renewable energy; it performs better than deterministic optimization in terms of the expected operational costs. For a real renewable-based microgrid in the north of Chile, the authors of [14] proposed a moving horizon optimization strategy to eliminate the forecasting errors caused by renewable energy. The optimal dispatch of an individual microgrid owes more to the coordination of the controllable units in a microgrid. However, for multi-microgrids, the power dispatch between each microgrid is a critical issue, so the optimal dispatch of multi-microgrids is more complex.

Due to the frequent fluctuation of power supply and load on both sides, offline optimal dispatch methods have not been suitable for the multi-microgrids, especially for working in islanded mode, which lacks support from the main grid [15]. Therefore, the power dispatch of the islanded multi-microgrids should focus on real-time optimal dispatch capability in order to maintain a real-time power balance between power generation and load demand, ensure the stable operation of the multi-microgrids system, and take into account the economic operation of the system. As long as the power command calculation process is required for centralized optimization, it will cause a certain computational complexity. In the case of high real-time requirements, the requirements for the generation and delivery speed of dispatching command also increase. With the advantages of distributed control architecture in smart grids, the multi-agent theory [16] and distributed control method [17,18] are applied to the microgrid dispatching model. The authors of [19] developed a new hybrid intelligent algorithm called imperialist competitive algorithm-genetic algorithm (ICA-GA) to determine both the optimal location and operation of an islanded MG. In order to minimize the islanded microgrids' operational losses, the authors of [20] adopted the glow-worm swarm optimization (GSO) algorithm to solve an optimal power flow problem. However, these approaches are a centralized optimization method that collects the whole network's information via a central controller and uses an intelligent optimization algorithm, such as glow-worm swarm optimization, particle swarm optimization, ant colony optimization, etc. Although the centralized optimization method has high regulation accuracy, when the number of network nodes is large, the communication volume is too large, the communication line is required to be high, and the scalability is poor. In addition, the intelligent optimization algorithm is unstable and cannot guarantee convergence to the optimal solution, which could cause a decline in the control performance. A new distributed reinforcement learning approach based on the multi-agent systems algorithm was applied to minimize the power losses under given operational constraints in [21]. The multi-agent system based consensus method [22] provides a new way of solving the real-time power dispatch problem of islanded multi-microgrids. The main issue with a consensus problem is achieving agreement regarding certain quantities of interest associated with agents in multi-agent systems by utilizing a local information exchange [23]. The traditional consensus algorithm is a very simple local coordination rule, which results in agreement at the group level, and no centralized task planner or global information is required by the algorithm. Due to its distributed implementation, robustness, and scalability, multi-agent consensus algorithms have been widely applied in many coordination problems, such as power system economic dispatch [24,25], power allocation [26], optimal control [27,28], etc. Compared with the traditional centralized optimization algorithm, the consensus method only requires each agent to obtain the information on the local and neighboring agents in real time. Hence, it can obtain the ideal convergence value with less transmission information and a shorter optimization time.

Motivated by these works, this paper provides a multi-agent system-based consensus algorithm to solve the real-time power dispatch problem of islanded multi-microgrids, which have a lower communication burden and better dynamic performance. In order to ensure the overall real-time power balance of the islanded multi-microgrids and reduce the power regulation costs, the real-time cooperative power dispatch framework of the islanded multi-microgrids is built by using a multi-agent system consensus algorithm. Simultaneously, the real-time dispatch of power imbalance is optimized to reduce the overall regulation costs of the islanded multi-microgrids, so as to ensure that each microgrid is responsible for the corresponding power regulation tasks according to its own situation. At the same time, the speed of dispatching command generation and release is accelerated because of avoiding centralized optimization, so the system can better adapt to the dynamic requirements of real-time power dispatch of the islanded multi-microgrids. Based on the consensus method, the real-time power dispatch strategy works in a fully distributed manner without a central coordinator; communication occurs only between the device and its neighbors. The main contributions of this paper are as follows:


The remainder of this paper is organized as follows. In Section 2, we establish a cooperative power dispatch framework for islanded multi-microgrids based on the consensus algorithm. We then model the regulation cost of each controllable unit in the microgrid to quantify the regulation costs of each controllable unit participating in the real-time control process in Section 3. The power dispatch consensus algorithm is designed for an islanded multi-microgrid in Section 4. Several numerical simulations are conducted and analyzed in Section 5, and Section 6 concludes this paper.

#### **2. Cooperative Power Dispatch Framework of Islanded Multi-Microgrids**

#### *2.1. Cooperative Power Dispatch Framework Based on Consensus Algorithm*

The microgrid is equipped with a microgrid controller (MGC) according to the requirements of the control. The MGC is responsible for ensuring the stable real-time operation of the microgrid. When many microgrids, through interconnection, constitute a multi-microgrids system, the traditional centralized dispatch framework requires the upper system to gather real-time information on each microgrid. This information is distributed and dispatched to each unit after centralized optimization. Although this method can more fully acquire system information and adapt to various optimization algorithms, it increases the burden on the communication network and the controller. At the same time, it cannot adapt to the requirements of plug and play and real-time control.

The number of controllable units and amount of data in multi-microgrids is large. The multi-microgrids' interconnection makes the operation mode diversified and requires the control mode to be easily extended, which need to satisfies the requirement of "plug and play." Therefore, the architecture and operational characteristics of the islanded multi-microgrids determine that it is suitable to adopt a decentralized control architecture [29]. This paper establishes a real-time cooperative dispatch framework for islanded multi-microgrids based on the multi-agent consensus method, which is shown in Figure 1.

**Figure 1.** Real-time cooperative dispatch framework for islanded multi-microgrids.

The control objective is to ensure the overall real-time power balance of islanded multi-microgrids and reduce the power regulation costs, which is equivalent to the problem of converting the economic dispatch problem into the consensus of the regulation costs in the power allocation process [30]. Therefore, the role of each MGC is as the agent in the network and the regulation cost of each microgrid is the concerned consensus variable. Under the premise that interconnected multi-microgrids system belongs to the same community of interests, the regulation of each microgrid is guided by the economic signal of the whole system, i.e., the regulation cost signal. Thus the economy of islanded multi-microgrids operation can be improved by reasonably allocating the regulation power. The islanded multi-microgrids adopt the "leader-follower" model [31,32]. The leader MGC is a communication center of all microgrids, which calculates the total power command, communicates and cooperates with other MGs, and balances the power of the entire control area. The follower exchanges the regulation costs with its adjacent MGs. After the communication iteration of each microgrid, the total power command is delivered to each microgrid and the MGC delegates the power commands of each control unit in the microgrid according to the established strategy. Because each MGC does not need to acquire the global information of the system, the information needed by each microgrid in the iteration is only local information, and the regulation cost information transmitted by the neighbors, so the communication burden is small.

#### *2.2. Power Dispatch Strategy of Microgrid*

After receiving the allocated power command, each microgrid needs to decentralize the power commands of the controllable units according to the power allocation strategy. It is assumed that each microgrid includes the following units: photovoltaic (PV), wind turbine (WT), energy storage device (ES), and controllable micro-power sources, such as diesel engine (DE) or interruptible load (IL).

Considering the regulation costs and dispatching priority of various regulation methods, the decision order of power allocation strategy for positive and negative power command is specified as follows.


#### **3. Microgrid Regulation Cost Modeling**

In this section, the regulation cost of each controllable unit in the microgrid is modeled to quantify the regulation cost of each controllable unit participating in the real-time control process, thus providing a basis for calculating the consensus power allocation.

Considering that the regulation cost of most controllable units is more suitable to be measured by electricity, the state duration window *T*<sup>S</sup> is introduced here. When calculating the regulation cost of each controllable unit at time *t*, the cumulated regulation power of each controllable unit in *T*<sup>S</sup> period starting from time *t* is calculated by using real-time power commands, so that the real-time regulation cost of each microgrid at time *t* can be quantified according to the amount of electricity. The significance of the regulation cost described in this paper is to calculate the regulation cost of running each microgrid in the state specified by the current power command within a given time window, and to quantify the regulation cost by converting the power into electricity.

#### *3.1. Regulation Cost of Energy Storage Battery*

The regulation cost of an energy storage battery includes the damage to the battery life caused by the charge and discharge behavior and the corresponding maintenance cost, which is related to the charge and discharge power and the state of charge (SOC). According to the working requirements of an energy storage battery, four reference limits are selected to divide the battery capacity of an energy storage battery into five areas, as shown in Figure 2.

**Figure 2.** Schematic diagram for energy storage system SOC subarea: (**a**) Description of the SOC operating area; (**b**) Description of the regulation cost.

The four reference limits are *SOC*max, *SOC*high, *SOC*low, and *SOC*min, which are 90%, 70%, 30%, and 10%, respectively. Between *SOC*min and *SOC*max is the working area. It is required that the SOC of an energy storage battery be confined to within this range. The ideal working area (30-70%) is the optimal range of SOC. When the SOC enters the early-warning working area, it should not further approach the prohibited working area. In order to enable the dispatching energy storage battery to conform to the above basic idea, the unit regulation cost of each area is set according to the charge and discharge process in the working area, and it satisfies *r*ES1 < *r*ES2 < *r*ES3. For example, in the early-warning area with high SOC, if the charging continues, the unit regulation cost will be higher. It can be considered that the damage to the battery will be greater, however. Conversely, the discharging will help the SOC approach the ideal working area. It can be considered that this is beneficial to the life of the battery and will lead to lower regulation costs. Therefore, the real-time maximum charge and discharge power of the energy storage system are given as follows:

$$\begin{split}P\_{\text{ES}+}^{\text{max}} &= \begin{cases} \frac{\eta \big(SOC(t-\Delta t) - SOC\_{\text{min}} \big) V\_{\text{ES}}}{\Delta t}, \text{SOC}(t) < \text{SOC}\_{\text{min}}\\ \eta P\_{\text{ES}}^{\text{max}}, \text{SOC}(t) \ge \text{SOC}\_{\text{min}} \end{split} \tag{1} \\ \begin{cases} \text{SOC}(t) = \text{SOC}(t-\Delta t) - \frac{P\_{\text{ES}}^{\text{max}} \Delta t}{\mathcal{V}\_{\text{ES}}} \end{cases} \tag{1} \\ \begin{cases} \end{cases}$$

$$\begin{array}{l}P\_{\text{ES}}^{\text{max}} = \begin{pmatrix} P\_{\text{ES}}^{\text{max}} & \text{SOC}(t) \leq \text{SOC}\_{\text{max}}\\ \frac{(\text{SOC}\_{\text{max}} - \text{SOC}(t - \Delta t))V\_{\text{ES}}}{\eta \Delta t}, \text{SOC}(t) > \text{SOC}\_{\text{max}}\\ \text{SOC}(t) = \text{SOC}(t - \Delta t) + \frac{\eta P\_{\text{ES}}^{\text{max}}\Delta t}{V\_{\text{ES}}}\end{array} \tag{2}$$

where Δ*t* is the time interval of power command; *SOC*(*t*) and *SOC*(*t* − Δ*t*) represent the current SOC calculated value and the actual SOC value of the previous time point, respectively; and *V*ES, *P*max ES , and η are the energy storage system capacity, power limits, and efficiency, respectively.

*V*ES

The real-time regulation cost of the energy storage system can be expressed as follows:

$$\begin{cases} \mathsf{C\_{ES}} (\Delta P\_{\mathrm{ES}}) = V\_{\mathrm{ES}} T\_{\mathrm{S}} \sum\_{i=1}^{3} r\_{\mathrm{ES}i} \Delta S\_{i} \\ \Delta P\_{\mathrm{ES}} \Delta P \ge 0 \\ -P\_{\mathrm{ES}-}^{\mathrm{max}} \le \Delta P\_{\mathrm{ES}} \le P\_{\mathrm{ES}+}^{\mathrm{max}} \end{cases} \tag{3}$$

where Δ*P*ES is the power command of the energy storage device, *C*ES(Δ*P*ES) is the regulation cost generated when the energy storage system is adjusted to the power command Δ*P*ES and the regulation cost in the other adjustment modes below is the same, and Δ*P* is the total power imbalance of the multi-microgrids, that is, the real-time power imbalance. Δ*Si* is the SOC change caused by the SOC area with a regulation cost of *r*ES*<sup>i</sup>* after running the *T*<sup>S</sup> period with the current power command. The interval that the SOC may actually traverse during the calculation of the real-time power command is also related to the selection of the state duration window *T*S. *P*max ES<sup>−</sup> and *<sup>P</sup>*max ES<sup>+</sup> are the maximum charge and discharge power of the energy storage system, respectively.

#### *3.2. Regulation Cost of Diesel Generator*

The generation cost of the diesel generator is determined by its fuel consumption coefficient and fuel unit price. In this paper, the power commands of diesel generators in the power allocation process refer to the output value within the range of its adjustable output force, i.e.,

$$\begin{cases} \begin{aligned} \text{C\_{DE}} (\Delta P\_{\text{DE}}) &= r\_{\text{DE}} \Delta P\_{\text{DE}} T\_{\text{S}} = \lambda r\_{\text{coll}} \Delta P\_{\text{DE}} T \\ \Delta P\_{\text{DE}} &= P\_{\text{DE}}(t) - P\_{\text{DE}}^{\text{min}} \\ \Delta P\_{\text{DE}}^{\text{max}} &= P\_{\text{DE}}^{\text{max}} - P\_{\text{DE}}^{\text{min}} \\ P\_{\text{DE}}^{\text{min}} &= \max\{0.3 P\_{\text{DE}}^{\text{N}}, P\_{\text{DE}} (t - \Delta t) - R\_{\text{d}} \Delta t \} \\ P\_{\text{DE}}^{\text{max}} &= \min\{P\_{\text{DE}}^{\text{N}}, P\_{\text{DE}} (t - \Delta t) + R\_{\text{u}} \Delta t \} \\ P\_{\text{DE}}^{\text{min}} &\leq P\_{\text{DE}}(t) \leq P\_{\text{DE}}^{\text{max}} \\ 0 \leq \Delta P\_{\text{DE}} &\leq \Delta P\_{\text{DE}}^{\text{max}} \end{aligned} \end{cases} \tag{4}$$

where Δ*P*DE is the power command of the diesel generator; *r*DE, λ, and *r*oil are the unit generation cost, unit fuel coefficient, and fuel unit cost of the diesel generator, respectively. *P*<sup>N</sup> DE, *<sup>P</sup>*max DE , and *<sup>P</sup>*min DE are the rated power and real-time output upper and lower limit of diesel generators, respectively. Δ*P*max DE is the upper limit of diesel generator power command. *Ru* and *R*<sup>d</sup> are the rates of increasing and decreasing output of diesel generators, respectively.

Here Δ*P*DE is the excess part of the current real-time output *P*DE(*t*), relative to the lower limit of output *P*min DE at this time. That is, the *<sup>P</sup>*min DE output part is regarded as the unadjustable part in the power allocation calculation process, which is recorded as the forced output. The operation cost generated by *P*min DE is recorded as the forced cost, which is not included in the regulation cost of the microgrid.

In this paper, the starting and stopping of the diesel generator are determined by setting the start and stop thresholds, given the start and stop coefficients *k*DE\_on and *k*DE\_off. When the power shortage of the *i*-th microgrid equipped with diesel generator exceeds *k*DE\_on*P*<sup>N</sup> DE and the diesel generator satisfies the other operational constraints, the diesel generator is started. If the power shortage of the *i*-th microgrid is lower than *k*DE\_off*P*<sup>N</sup> DE, and the diesel generator has satisfied the other operation constraints, the diesel generator is shut down. When the diesel generator enters the start-stop state, it runs according to the increase/decrease output rate until the state transition is completed.

#### *3.3. Regulation Cost of Other Units*

For interruptible load and DG, the following assumptions are made in this paper: (1) when a part of the interruptible load needs to be cut off, the current calculation point calculates the current interruptible load amount and the next calculation point restores part of the load under the necessary conditions by default. If the next calculation point is still unable to restore the load, that part will be delayed according to the actual demand; (2) photovoltaic or wind turbines operate in the maximum power point tracking (MPPT) mode. When the output of distributed generation needs to be reduced, the current calculation point calculates the reduction command at the current maximum output, and the next calculation point is still calculated by the maximum output by default, so there is no need to consider the increase of the distributed generation output.

The regulation costs of load shedding and distributed generation abandoned generation are as follows:

$$\begin{cases} \mathbb{C}\_{\text{IL}}(\Delta P\_{\text{IL}}) = r\_{\text{IL}} \Delta P\_{\text{IL}} T\_{\text{S}}\\ 0 \le \Delta P\_{\text{IL}} \le P\_{\text{IL}}^{\text{max}}\\ P\_{\text{IL}}^{\text{max}} = P\_{\text{IL}}(t) \end{cases} \tag{5}$$

$$\begin{cases} \text{C\_{DG}} (\Delta P\_{\text{DG}-}) = r\_{\text{DG}} | \Delta P\_{\text{DG}-}| T\_{\text{S}} \\ -P\_{\text{DG}-}^{\text{max}} \le \Delta P\_{\text{DG}-} \le 0 \\\ P\_{\text{DG}}^{\text{max}} = P\_{\text{PV}}(t) + P\_{\text{WT}}(t) \end{cases} \tag{6}$$

where Δ*P*IL and Δ*P*DG<sup>−</sup> are the power commands of the interruptible load and the distributed generation output reduction, respectively. *r*IL and *r*DG are the unit regulation costs of the interruptible load and the distributed generation output reduction, respectively. *P*max IL and *<sup>P</sup>*max DG<sup>−</sup> are the upper limit of interruptible load and the distributed generation output reduction, respectively. *P*max IL is the real-time maximum load *P*IL(*t*) of the current interruptible load, i.e., *P*max DG<sup>−</sup> is the sum of the real-time output of PV (*P*PV(*t*)) and the real-time output of (*P*WT(*t*)).

#### *3.4. Regulation Cost Function of Microgrid*

Combining with the microgrid power allocation strategy and the regulation cost model of each controllable unit, the regulation cost function of each microgrid can be constructed as shown in Figure 3.

**Figure 3.** Regulation cost function of microgrids.

From the previous analysis, it can be seen that the regulation cost of each controllable unit can be approximated as a linear or piecewise linear function (e.g., the SOC variation in the charge and discharge process of energy storage system spans two areas of different unit regulation cost). It can be seen from Figure 3 that, when considering the dispatch priority, this paper can combine the regulation cost model of each controllable unit with the segmental linear function according to the power allocation strategy decision order of positive and negative power commands, that is, the microgrid regulation cost function.

This profile has the following salient features:


#### **4. Consensus Algorithm Design for Power Dispatch**

#### *4.1. Cooperative Power Dispatch Model for Islanded Multi-Microgrids*

In this paper, a power dispatch consensus algorithm is designed for islanded multi-microgrids, which take the regulation cost of each microgrid as a consensus variable and use the discrete-time first-order consensus algorithm [33] to solve the problem iteratively. Hence, the total regulation cost of the multi-microgrids is chosen as the objective function. The mathematical model is constructed as follows: ⎧

$$\begin{cases} \min F &= \sum\_{i=1}^{n} f\_{\mathsf{C}} (\Delta P\_{\mathsf{MGi}}) \\ \text{s.t. } \Delta P = \sum\_{i=1}^{n} \Delta P\_{\mathsf{MGi}} \\ &= \sum\_{i=1}^{n} \left( P\_{\mathsf{Load}i} - P\_{\mathsf{P}Vi} - P\_{\mathsf{WTi}} - P\_{\mathsf{DE}i}^{\min} \right) \\ & \qquad \Delta P\_{\mathsf{MGi}i} = \Delta P\_{\mathsf{ESi}i} + \Delta P\_{\mathsf{DE}i} + \Delta P\_{\mathsf{IL}i} + \Delta P\_{\mathsf{DG}-i} \\ & \qquad \Delta P \Delta P\_{\mathsf{MGi}} > 0 \\ & \qquad \Delta P\_{\mathsf{MGi}}^{\min} \le \Delta P\_{\mathsf{MGi}} \le \Delta P\_{\mathsf{MGi}}^{\max} \end{cases} \tag{7}$$

where the total power command Δ*P* of the islanded multi-microgrids is the difference between the total load and the total output of the wind power, PV, and the forced output of the energy storage device. Δ*P*MG*<sup>i</sup>* is the power command of the *i*-th microgrid, that is, the power regulation amount of the *i*-th microgrid. *f*C(Δ*P*MG*i*) is the regulation cost of the *i*-th microgrid, which is a function of the microgrid power regulation. *P*Load*<sup>i</sup>* is the total load of the *i*-th microgrid. Δ*P*max MG*<sup>i</sup>* and <sup>Δ</sup>*P*min MG*<sup>i</sup>* are the upper and lower limits of the power regulation of the *i*-th microgrid, respectively, which depend on the real-time status of each control unit in the microgrid. *n* is the number of microgrids.

Therefore, when a power imbalance occurs in the islanded multi-microgrids, it will be jointly undertaken by all the microgrids that can participate in the regulation. Selecting the regulation cost

of the microgrid as the consensus variable can enable each microgrid to participate in the regulation according to its own resources. Its essence is to allocate the power regulation amount to each microgrid according to the slope value of each segment of each microgrid regulation cost function, which aims at reducing the overall regulation cost of the multi-microgrids.

#### *4.2. Microgrid Regulation Cost Consensus*

The regulation cost of each microgrid is selected as the consensus variable, which is abbreviated as *C*. Based on the discrete-time first-order consensus algorithm [33], the formula for updating the consensus variables of each agent is as follows:

$$\mathbf{C}\_{i}^{(k+1)} = \sum\_{j=1}^{n} d\_{ij}^{(k)} \mathbf{C}\_{j}^{(k)}.\tag{8}$$

where *<sup>C</sup>*(*k*) *<sup>i</sup>* is the regulation cost calculated by the *k*-th iteration of the *i*-th microgrid. *d* (*k*) *ij* is the *i*-th row and *j*-th column element of the row-stochastic matrix *D* when iterating at the *k*-th step. The row-stochastic matrix *D* is obtained from the Laplacian matrix *L* of the communication topology and is related to the structure of the communication topology, which is defined by the following:

$$d\_{ij} = \frac{\left| l\_{ij} \right|}{\sum\_{j=1}^{n} \left| l\_{ij} \right|}, \ i = 1, \cdots, n \text{ with } \begin{cases} l\_{ii} = \sum\_{j \neq j} a\_{ij} \\ l\_{ij} = -a\_{ij} \end{cases},\tag{9}$$

where *aij* is the (*i*, *j*) entry of the adjacency matrix *A*. In this paper, the adjacency matrix *A* is

$$A = \begin{bmatrix} 0 & 1 & 1 \\ 1 & 0 & 1 \\ 1 & 1 & 0 \end{bmatrix}. \tag{10}$$

It can be known from Equation (8) that each agent obtains the state information of the previous iteration of the neighboring agent by means of the row stochastic matrix *D*, which is related to the communication topology to update its state. In order to ensure the power balance, the leader guides the regulation direction and magnitude of the regulation cost. As a leader, the microgrid regulation cost update formula is given as follows:

$$\mathbf{C}\_{i}^{(k+1)} = \begin{cases} \sum\_{j=1}^{n} d\_{ij}^{(k)} \mathbf{C}\_{j}^{(k)} + \mu \Delta P\_{\text{error}} & \Delta P > 0\\ \sum\_{j=1}^{n} d\_{ij}^{(k)} \mathbf{C}\_{j}^{(k)} - \mu \Delta P\_{\text{error}} & \Delta P < 0 \end{cases} \tag{11}$$

where μ is the error adjustment step size; Δ*P*error is the deviation between the total power command and the sum of the microgrid power commands, which ignores the line loss of the islanded multi-microgrids system. The expression of Δ*P*error is:

$$
\Delta P\_{\text{error}} = \Delta P - \sum\_{i=1}^{n} \Delta P\_{\text{MGi}}.\tag{12}
$$

The error adjustment step size μ can be artificially given an appropriate parameter or adaptively adjusted by detecting Δ*P*error. The meaning of Equation (10) can be explained as follows: taking the current total power command Δ*P* > 0 as an example, if Δ*P*error > 0, the sum of the power commands of each microgrid is still insufficient to balance the current power imbalance, and the regulation cost needs to be increased accordingly; if Δ*P*error < 0, the regulation cost can be reduced.

In principle, the selection of leaders should be determined by the regulation capability. Selecting the microgrid with the largest regulation capability as the leader can reduce the need to replace leaders. The so-called regulation capability can be reflected by the parameters that reflect the regulatable resource of microgrid, such as energy storage capacity, diesel generator capacity, interruptible load capacity, etc.

In summary, the regulation cost of each microgrid in the iterative process is the weighted average of the regulation cost of the local and neighbors' previous iterations, so the communication burden on the network is small. When some microgrids have reached the limit of the power regulation, they should quit the communication topology and stop updating. The adjacent microgrids should also modify the corresponding row random matrix elements according to the new communication topology. In the convergence process of the consensus algorithm, |Δ*P*error| ≤ ε is taken as the convergence condition, where ε is the convergence error.

When the regulation cost is updated by communication interaction between microgrids, the power command of each unit needs to be inversely solved by the variable of regulation cost and the corresponding regulation cost function. Because the regulation cost function is a piecewise linear function and has a unique solution, the calculation process is not complicated, and each MGC can quickly solve and calculate the microgrid total power command for the next iteration. The flowchart of the proposed consensus algorithm for real-time cooperative power dispatch of islanded multi-microgrids is shown in Figure 4.

**Figure 4.** Flowchart of consensus algorithm for real-time cooperative power dispatch of islanded multi-microgrids.

#### **5. Numerical Simulations**

#### *5.1. Simulation Parameter Setting*

In this paper, an islanded multi-microgrids model formed by three interconnected microgrids is established. The main program is carried out in a Matlab 2015b (USA mathworks company) environment. The communication topology is shown in Figure 1. In the absence of power overrun in microgrids, there is communication between any two microgrids. Considering the regulatable resources of each microgrid, MG1 is the leader, and MG2 and MG3 are followers.

The equipment parameters of the multi-microgrids are given in Table 1. The minimum output of the diesel generator is 30% of the rated output, the minimum running time is 60 min, the minimum stop time is 30 min, and the start and stop coefficients *kDE*\_*on* and *kDE*\_*off* are set at 1.5 and 0.5, respectively. The regulation cost parameters are given in Table 2.


**Table 1.** Equipment parameters of multi-microgrids.

**Table 2.** Parameters of regulating cost.


#### *5.2. Simulation of Multi-Microgrids Power Allocation*

The simulation analysis of continuous real-time power allocation is performed at intervals of 1 min. The total duration is 24 h. The shorter interval is also applicable in practical applications. The time window is taken as *T*<sup>S</sup> = 30 min or 0.5 h, the error adjustment step size of consensus algorithm is μ = 0.01, and the convergence error is Δ*P*error = 0.1 kW.

The load curve of the multi-microgrids, the total output curve of wind power and photovoltaics, and the corresponding power imbalance curve are shown in Figure 5, whose data source is an actual islanded multi-microgrid [34]. It can be seen that the power imbalance mainly occurs at 09:00–22:00. On the one hand, due to the large PV output at noon, there is a situation of excess power, and then a power shortage occurs after the peak load arrives at night.

**Figure 5.** Power unbalance of multi-microgrids.

After simulation, the power command of each microgrid basically follows the trend of the total power command. The regulation power of each unit throughout the day and the corresponding microgrid regulation cost are given in Table 3. The total regulation cost of MG1 and MG2 includes the forced cost corresponding to the unadjustable part of the output of the energy storage device. Since MG1 and MG2 are equipped with energy storage devices, the actual regulation costs of MG1 and MG2 are higher than that of MG3. The power command curves of each microgrid and the output curves of various distributed generations are shown in Figures 6 and 7, respectively.

**Table 3.** Regulation power and cost.


**Figure 6.** Power command curve of each microgrid.

**Figure 7.** Power curve of DGs.

The results of charge and discharge power control of each microgrid energy storage unit are analyzed. The real-time power curve and SOC curve of each microgrid energy storage unit are shown in Figures 8 and 9. It can be seen that the energy storage units of each microgrid are charged during the period of excessive photovoltaic output during the daytime, and discharge is completed during the peak load period, which is in accordance with the scheduling rules. The SOC change trend of each

 

   

 

energy storage is basically the same, the capacity can be effectively utilized, and the power command allocation is reasonable.

**Figure 9.** SOC curve of each ES.

The consensus convergence process of the two sections in the continuous simulation process is selected. The power command is Δ*P* = −205 kW, Δ*P* = +210 kW, respectively. The convergence process curves are shown in Figures 10 and 11.

**Figure 10.** Consensus convergence process (Δ*P* = −205 kW): (**a**) Description of the three MG iteration process; (**b**) Description of the three ES iteration process.

**Figure 11.** Consensus convergence process (Δ*P* = +210 kW): (**a**) Description of the three MG iteration processes; (**b**) Description of the three ES and two DE iteration processed.

As can be seen from Figure 10, the current total power command is negative; the energy storage device in each microgrid charges to balance the corresponding unbalance amount, of which MG3 bears the largest regulation power. The reason is that the energy storage device of MG3 has the maximum capacity and rated power. When the energy storage devices of MG1 and MG2 reach the charge limit in the iteration process, it is necessary to adopt a regulation approach with a higher regulation cost. The energy storage device bears the low cost of power regulation. When each microgrid consumes a consensus regulation cost, MG3 would bear more power regulation.

Similarly, as shown in Figure 11, when the current total power command is positive, each microgrid should increase its power generation to balance the corresponding unbalance. Each energy storage device discharges and two diesel generators have been turned on. When the output of ES1 and ES2 reaches the limit, the corresponding DE1 and DE2 gradually increase their output in the iteration process to promote the consensus regulation cost of each microgrid.

#### *5.3. Comparative Analysis under Di*ff*erent Operation Modes*

In order to reflect the advantages of the interconnected operation of microgrid and consensus power allocation model, the different operation modes of microgrid are compared and analyzed in this section, including the following three cases.

Mode 1: each microgrid operates independently [35].

Mode 2: the multi-microgrids are interconnected to form a microgrid cluster and each microgrid gives priority to autonomous operation. When its own power commands are different from the total power command of the microgrid cluster, it actively exchanges power with the microgrid cluster system [36].

Mode 3: the multi-microgrids are interconnected to form a microgrid cluster and the power allocation is based on the real-time cooperative power dispatch model established in this paper.

The three models are simulated continuously throughout the day and the regulation costs of each microgrid and microgrid cluster are given in Table 4. From the perspective of total regulation costs, the order is mode 1 > mode 2 > mode 3. Under mode 1, each microgrid operates independently and can only rely on its own supply for balance. When the generation and load are not balanced, there will be more abandoned power generation or load shedding, which would lead to the regulation costs being higher. The interconnection of the microgrids in mode 2 will reduce the regulation costs, which reflects the advantages of cluster operation of adjacent microgrids to a certain extent. However, the benefits of clustering operations have not been fully explored due to the priority of autonomous balance of microgrids. Mode 3 adopts the cooperative power dispatch strategy in which three microgrids in total are dispatched, and the energy transfer between each microgrid is mutually beneficial. Each microgrid allocates the regulation power reasonably according to the signal of regulation costs. Overall, the regulation capability of the microgrid cluster system has been optimized and the economy has been improved.


**Table 4.** Regulation costs under the three modes.

Figure 12 shows the MG1 power command under the three modes; the PV configuration of MG1 is the largest. It can be seen that the negative power command of MG1 at noon is smaller than that of the other two modes. Modes 1 and 2 decrease obviously at noon due to the bias towards autonomy. Under mode 3, due to the interconnection of each microgrid, the surplus output of MG1 can partly support the other two microgrids, thus reducing the negative power command in this period.

**Figure 12.** Power command of MG1 under the three modes.

#### *5.4. Comparison with Centralized Optimization*

From the perspective of engineering applications, this paper compares the optimization of performance with the centralized optimization method. Aiming at the time section of power command *P* = +210 kW, a multiple population genetic algorithm (MPGA) [37] is selected for centralized optimization, in which the MPGA runs 10,000 times and the results are compared with those of the proposed consensus algorithm. The CPU (central processing unit) used in the simulation is 3.2 GHz, with 2 GB memory. A performance comparison of the two optimization approaches is given in Table 5.

**Table 5.** Comparison of optimization performance.


From Table 5, it can be seen that the consensus algorithm belongs to distributed optimization technology, and its convergence time is greatly reduced compared with centralized optimization. As the scale of the microgrid clusters further increases, its advantages will become more obvious. MPGA is optimized 10,000 times and the optimal regulation cost is better than that of the consensus algorithm. It can be seen that the optimization result of the consensus algorithm is not the global optimal solution. The mean value of 10,000 optimization results obtained by MPGA is slightly lower than that of the consensus algorithm. According to statistics, the probability that the MPGA optimization result will be better than the consensus algorithm is about 30.69%. For the comparison of the optimization results shown in Figure 13, most of the optimization algorithms belong to static optimization, and it is difficult to solve the real-time dynamic problem.

**Figure 13.** Comparison of optimization results.

#### *5.5. Impact Analysis of Di*ff*erent TS*

The value of time window *T*<sup>S</sup> will affect the results, as reflected in the power control of the energy storage. The reason is that the SOC electricity calculation of the energy storage is related to the length of the time window. This section compares the impact of different *T*S.

Taking ES3 as an example, the power curve and SOC curve of ES3 are shown in Figures 14 and 15, respectively. Figure 14a shows the overall situation throughout the day and Figure 14b,c shows that the time period has a significant impact under different *T*S. Between 11:00 and 14:00, because of the high photovoltaic output at noon, the charge of the energy storage device is close to the SOC upper limit. When *T*<sup>S</sup> is small (such as *T*<sup>S</sup> = 10/60 h), the power command of the energy storage device will quickly drop to 0 and stop charging until the SOC reaches the upper limit. If *T*<sup>S</sup> is large (such as *T*<sup>S</sup> = 90/60 h), the energy storage device will start earlier to reduce the charge power. This proves that the control of the TS energy storage device tends to be conservative when *T*<sup>S</sup> is large, i.e., a larger *T*<sup>S</sup> can control the SOC of the energy storage device to avoid approaching the limit value.

**Figure 14.** Power curve of ES3 with different *T*s: (**a**) Description of the Power curve of ES3 with different *T*s from 0:00 to 24: 00; (**b**) Description of the Power curve of ES3 with different *T*s from 10:30 to 14: 20; (**c**) Description of the Power curve of ES3 with different *T*s from 18:40 to 22: 20.

**Figure 15.** SOC curve of ES3 with different *T*s.

However, the larger *T*<sup>S</sup> will increase the regulation cost of other controllable units, that is, the power regulation capability of the energy storage device is restricted in some time periods and the corresponding parts need to be borne by other controllable units. Table 6 gives the regulation cost under different values. Generally speaking, *T*<sup>S</sup> should not be too large or too small. The value of *T*<sup>S</sup> can be determined by reference to the type of energy storage battery and the consideration of the life of the energy storage battery, as well as the actual application requirements. The recommended value is 0.5–1.5 h.


**Table 6.** Regulation cost with different *T*s.

#### **6. Conclusions**

In recent years, the development of microgrids has attracted interest to its related topics. This paper studies the real-time power allocation problem of islanded multi-microgrids. Considering the architecture and operational characteristics of islanded multi-microgrids, it is suitable to adopt a decentralized control architecture. A real-time cooperative power dispatch framework for islanded multi-microgrids is proposed. The microgrid regulation cost is modeled and a consensus algorithm is introduced to realize the power allocation. The conclusions are as follows:


**Author Contributions:** All the authors have contributed to this paper in different aspects. X.Z. proposed the original concept and wrote the original draft. N.W. acted as supervisor and gave suggestions on paper improvement.

**Funding:** This research received no external funding.

**Conflicts of Interest:** The authors declare no conflict of interest.

#### **Abbreviations and Nomenclature**



#### **References**


© 2019 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).
