1 Introduction

Recently, the active distribution system (ADS) has been globally recognized as an effective way to utilize the emerging diversity of distributed generators (DGs) at significantly high levels of penetration. For an ADS with a very large number of DGs, such as wind turbines, photovoltaic arrays, micro turbines, and electric vehicles, control and management becomes more difficult [1,2,3]. The uncertainty of the intermittent DGs, DG plug-in and plug-out, bidirectional power flow, as well as the diversity of loads, often cause disturbances such as over-voltage or reverse power flow in an ADS, hence, the ADS control has attracted increasing attention [4, 5].

Various types of control scheme have been proposed to overcome the limitations and bottlenecks of previous schemes. For instance, DG control [6, 7], load control [8, 9], the local optimized control scheme of DGs and energy storage systems (ESSs) [10], as well as the hierarchical control scheme [11,12,13] have all been proposed and applied. The coordination control strategy of ESSs was considered as an effective solution for stabilization of an ADS [14]. Due to the intermittency of the DGs and constantly changing load demand, the charging and discharging of various ESSs in an ADS need to be properly coordinated to enhance the reliability and efficiency of renewable energy utilization [15].

The coordination control of ESSs in a smart distribution network can be centralized or distributed. However, the centralized control strategies require a central controller, which can suffer from a failure to handle the huge amount of data. Furthermore, taking the uncertainty of intermittent DGs into consideration, the fluctuation of DGs may result in unintentional reconfiguration of an ADS, which will further increase the burden on centralized schemes [16, 17]. Additionally, the partially distributed scheme, which uses a leader agent to gather information from all of the other local agents and sum it to obtain global information, raises similar concerns about system performance and reliability when possible malfunctions and attacks occur at the leader agent [18]. Advantages of a fully distributed scheme include the ability to survive uncertain disturbances and decentralized data updating, which leads to efficient information sharing and eventually a faster decision-making process and operation [19,20,21,22].

Inspired from the two-layer consensus-based fully distributed method and the coordination of ESSs [10, 19,20,21,22], this study proposes a novel distributed coordination control (DCC) for ADSs that achieves the same performance as standard centralized hierarchical ADS control. As the most distinguishing features of this work, the two-layer consensus algorithm and pinning based DCC are systematically studied in this study. More specifically, the main contributions of this study are:

1) Proposal of a fully DCC by using a two-layer consensus algorithm, that gets global information using an information discovery layer and implements a fully DCC in the secondary layer.

2) Proposal of a pinning-based DCC approach to coordinate the ESSs considering marginal charging costs (MCCs), power mismatch, local consumption of renewable energy, and power transmission losses.

3) Proposal of two updating methods, for the communication coupling weight and the participating agent identity, to adaptively meet the requirements for changes in communication topology.

The rest of this paper is organized as follows: Section 2 presents a brief introduction on the two-layer consensus algorithm and formulates the problem of ESS coordination in an ADS; Section 3 elaborates on the DCC using a two-layer consensus in an ADS; the proposed DCC is simulated and investigated with a simulated system in Section 4; and finally, the conclusions are presented.

2 Preliminary

2.1 Two-layer consensus algorithm

To overcome the shortcoming of the leader-follower structured consensus algorithm in a multi-agent system (MAS), which needs a virtual leader [18], a two-layer consensus algorithm is proposed. It is applied to implement a fully DCC in the second layer, as illustrated in Fig. 1.

Fig. 1
figure 1

Two-layer agents of MAS

The information discovery layer guarantees the important global information is available in a distributed manner, where an agent can only communicate with its immediate neighboring agents in the communication topology. Meanwhile, the coordination control layer implements fully distributed control according to discovered global information and pinning presets.

1) Distributed information discovery algorithm in the first layer: assume that xi denotes the state variable of agent i, which could correspond to the charging power or charging efficiency of i-th ESS [23, 24]. The consensus algorithm in the first layer can be represented in discrete form as:

$$x_{i}^{{}} [k{ + }1] = \sum\limits_{j = 1}^{n} {w_{ij} x_{j}^{{}} } [k]$$
(1)

where i=1, 2, …, n; n is the total number of participating agents; k is the discrete-time index; xi[k+1] denotes the information discovered by agent i at (k+1)-th iteration; xj[k] is the information shared by agent j at the k-th iteration; wij is the communication coupling coefficient between agent i and j.

Then, the consensus process of the whole ADS in the first layer can be described using matrix format as:

$$\left\{ \begin{aligned} & \varvec{X}\text{[}k + 1\text{] = }\varvec{WX}\text{[}k\text{]} \hfill \\ & \varvec{W}\text{ = }(w_{ij} ) \hfill \\ \end{aligned} \right.$$
(2)

where X[k] and X[k+1] are the information matrix at the k-th and (k+1)-th iterations; W is the communication updating matrix that is determined according to the communication topology.

2) Pinning-based consensus algorithm in the second layer: with the discovered global information in the first layer, the DCC can be implemented using the pinning-based consensus algorithm as:

$$x_{i}^{{}} [k{ + }1] = \sum\limits_{j = 1}^{n} {w_{ij} x_{j}^{{}} } [k] - d_{i} (x_{i}^{{}} [k] - x^{*} )$$
(3)

where x* is the array of pinning consensus values determined from the discovered global information; di is the pinning gain of the i-th agent, generally, di≥0, and di=0 indicates that there is no control over the i-th agent.

Thus, the consensus process of the whole ADS in the first layer can then be described using matrix format as:

$$\varvec{X}[k{ + }1]\varvec{ = }\left( {\varvec{W} - (\varvec{D} \otimes \varvec{I}_{m} )} \right)\varvec{X}[k]{ = }\varvec{W}_{P} \varvec{X}[k{ + }1]$$
(4)

where WP is the communication updating matrix considering pinning control.

3) Adapt for communication topology changes: to adapt to communication link changes, an optimized communication coupling coefficient updating method is proposed as follows:

$$w_{ij} = \left\{ \begin{aligned} &\frac{2(1 - \lambda )}{{n_{i,\Delta (t)} + n_{j,\Delta (t)} }} \,\,\,\, \,\,\,\, \,\,\,\, \,\,\,\, \,\,\, \,\,\, \,\,\,\,\,\,\,\,j \in N_{i,\Delta (t)} \\ &1 - \sum\limits_{{j \in N_{i,\Delta (t)} }} {\frac{2(1 - \lambda )}{{n_{i,\Delta (t)} + n_{j,\Delta (t)} }}\,\,\,\, j = i} \\& 0 \,\,\,\,\, \,\,\, \,\,\, \,\,\,\,\,\,\,\,\,\, \,\,\, \,\,\,\,\,\,\,\,\,\, \,\,\, \,\,\,\,\,\,\,\,\,\, \,\,\, \,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,{\text{otherwise}} \\ \end{aligned} \right.$$
(5)

where Δ(t) expresses the changes in communication topology in an ADS; λ is the consensus constant, the value of which can affect the convergence characteristics of the two-layer algorithm, 0<λ<1; ni,Δ(t) and nj,Δ(t) indicate the number of agents in the neighborhood of agents i and j. Both ni,Δ(t) and nj,Δ(t) are local information which can be detected locally by corresponding agents, hence, (5) can adapt to communication link changes locally.

Additionally, to adapt changes in the number of agents and to meet the plug-and-play operational requirements for an ADS, a method is used to update the identities of the agents. If (2) is initialized with the predefined indices i of agents, it will converge to the average value of the total number of agents, thus the total number of agents in an ADS can be easily estimated as:

$$\left\{ \begin{aligned} & n_{A,i} = \frac{i}{{n_{\Delta (t)} }} \hfill \\ & n_{\Delta (t)} = \frac{i}{{{i \mathord{\left/ {\vphantom {i {n_{\Delta (t)} }}} \right. \kern-0pt} {n_{\Delta (t)} }}}} \hfill \\ \end{aligned} \right.$$
(6)

where nA,i is discovered average value of agent i; nΔ(t) is the total number of participating agents in the ADS, which will adaptively adjust as the number changes. For example, if a new agent is added because an ESS plugs in, (n+1) agents will participate in information discovery, the nA,i of the i-th agent will converge to i/(n+1) instead of i/n as in (4); that is, nΔ(t) can adapt to a plug-in operation in a distributed way. Similarly, if an ESS unplugs, nΔ(t) also can adjust from n to (n−1) accordingly.

4) Stability verification: first, a positive definite Lyapunov function is defined by (7).

$$\varvec{L} = (\varvec{X}\left[ k \right])^{\text{T}} \varvec{X}\left[ k \right]$$
(7)

Second, the partial derivative of L with respect to X[k] is derived as:

$$\begin{aligned} \Delta \varvec{L} = \left( {\varvec{X}\left[ k \right]} \right)^{\text{T}} \left( {\varvec{W}^{\text{T}} \varvec{W} - \varvec{I}} \right)\varvec{X}\left[ k \right] \le \hfill \\ \, - \sum\limits_{i = 1}^{n} {\sum\limits_{j = 1}^{n} {\left[ {\left( {w_{ij} + w_{ij}^{2} } \right)\left( {x_{j}^{{}} \left[ k \right] - x_{i}^{{}} \left[ k \right]} \right)^{2} } \right]} } + \hfill \\ \, \frac{1}{2}\sum\limits_{i = 1}^{n} {\sum\limits_{j = 1}^{n} {\left[ {\left( {n_{i,\Delta (t)} + n_{j,\Delta (t)} - 2} \right)w_{ij}^{2} \left( {x_{j}^{{}} \left[ k \right] - x_{i}^{{}} \left[ k \right]} \right)^{2} } \right]} } \le \hfill \\ \, - \sum\limits_{i = 1}^{n} {\sum\limits_{j = 1}^{n} {\left[ {\frac{{2 - \left( {n_{i,\Delta (t)} + n_{j,\Delta (t)} } \right)w_{ij} }}{2}w_{ij} \left( {x_{j}^{{}} \left[ k \right] - x_{i}^{{}} \left[ k \right]} \right)^{2} } \right]} } \le \hfill \\ \, - \sum\limits_{i = 1}^{n} {\sum\limits_{j = 1}^{n} {\left[ {\lambda (1 - \lambda )\frac{2}{{n_{i,\Delta (t)} + n_{j,\Delta (t)} }}\left( {x_{j}^{{}} \left[ k \right] - x_{i}^{{}} \left[ k \right]} \right)^{2} } \right]} } \hfill \\ \end{aligned}$$
(8)

Thus ΔL is the sum of products of three terms, of which 2/(ni,Δ(t) + nj,Δ(t)) and (xj[k] − xi[k])2 both are positive, so to ensure ΔL0, the stability condition is:

$$0 < \lambda < 1 \Rightarrow \Delta \varvec{L} \le {\mathbf{0}}$$
(9)

where ΔL0 implies that the stability of the proposed consensus can be reached asymptotically. In addition, the stability of the pinning-based consensus algorithm defined in (4) also can be ensured by using the same proof.

2.2 Problem formulation of ESS coordination in an ADS

1) Optimization problem formulation: the charging process of the i-th ESS is described as:

$$P_{E,i} = P_{E,C,i} \eta_{C,i}$$
(10)
$$P_{E,Dis,i}^{{}} = \frac{{P_{E,D,i} }}{{\eta_{D,i} }}$$
(11)

where PE,i is the charging power of the i-th ESS when it is positive; PE,C,i is the power that actually contributes to stored energy in the i-th ESS; ηC,i is the charging efficiency, which has remarkable dependence on the charging power. Correspondingly, the discharging process of the i-th ESS can be described as (11), where PE,Dis,i is the discharging power of the i-th ESS when it is positive; PE,D,i is the power actually extracted from stored energy in the i-th ESS; ηD,i is the discharging efficiency, which also has remarkable dependence on the discharging power. For simplicity, the rest of this paper discusses only the case when the ESSs are required to operate in charging mode. Note that, the same principle discussed in this study could be used when the ESSs operate in the discharging mode.

Hence, the objective for coordinating multiple ESSs in charging mode is to maximize the total charging power:

$$\left\{ \begin{aligned} &{ \hbox{max} }\sum\limits_{{i \in N_{i} }} {P_{E,C,i} \eta_{C,i} } \\ &{\text{s}} . {\text{t}} . { }\sum\limits_{{i \in N_{i} }} {P_{E,C,i} = P_{M} = \sum\limits_{{i \in N_{i} }} {P_{M,i} } } \\ & \,\,\,\,\,\,\,\,\, P_{M,i} = P_{G,i} - P_{L,i} - P_{Loss,i} \\ & \,\,\,\,\,\,\,\,\,P_{E,C,i}^{ \hbox{min} } < P_{E,C,i} < P_{E,C,i}^{ \hbox{max} } \\ \end{aligned} \right.$$
(12)

where Ni is the index set of the ESSs; \(P_{E,C,i}^{\hbox{min} }\) and \(P_{E,C,i}^{\hbox{max} }\) are the lower and upper charging power limits; PM is the global power mismatch between supply and demand, which is required to be shared among ESSs and will be accomplished by controlling the charging power of each ESS PE,C,i. However, it is hard to estimate PM through PE,C,i in a distributed manner, thus, local estimation of the power mismatch at the i-th agent PM,i is defined. PM,i can be calculated using local information, including the power generation PG,i, the load demand PL,i, and the power loss PLoss,i, as shown in (12). It is worth noting that the major factors that have impact on charging efficiency ηC,i are the instantaneous charging power and maximum designed charging rate of the ESS [25]. Reference [26] shows by experiment that the charging efficiency is in a linear relationship with the charging power given by:

$$\eta_{C,i} { = }\alpha_{i} - \beta_{i} P_{E,C,i}$$
(13)

where αi, βi are constant coefficients for i-th ESS.

2) Optimization problem solution: the i-th ESS has a quadratic cost function, and its associated marginal charging cost (MCC) of i-th ESS is derived as:

$$\rho_{C,i} { = }\frac{{\partial \left[ {P_{E,C,i} (\alpha_{i} - \beta_{i} P_{E,C,i} )} \right]}}{{\partial P_{E,C,i} }}{ = }\alpha_{i} - 2\beta_{i} P_{E,C,i}$$
(14)

Accordingly, the optimal objective of (12) will be reached when the MCCs of the ESSs in the ADS converge to a common value \(\rho_{C}^{*}\), as in [27, 28]. Hence, an optimal solution to coordinate the MCCs among the distributed ESSs can be achieved by the pinning-based DCC as follows:

$$\rho_{i}^{{}} [k + 1] = \sum\limits_{j = 1}^{n} {w_{ij} \rho_{j}^{{}} [k]} - d_{i} (\rho_{i}^{{}} [k] - \rho_{C}^{*} )$$
(15)

Accordingly, the charging power reference values of the ESSs can be calculated as:

$$P_{E,C,i}^{{}} { = }\frac{{\alpha_{i} - \rho_{C}^{*} }}{{2\beta_{i} }}$$
(16)

By controlling the charging reference values of the ESSs, the total power actually stored in the ESSs can be maximized, and power losses occurring due to charging the ESS are minimized.

3 Two-layer consensus based DCC for ESSs

3.1 Flowchart of proposed DCC

In this study, the two-layer consensus method for a MAS is proposed to solve the optimization problem of (12) in a distributed manner. In this way, by using the global power mismatch discovered in the first layer, the proposed DCC using pinning can be achieved in the second layer to coordinate all ESSs in the system.

Figure 2 illustrates the flowchart of the proposed DCC for the ESSs in an ADS.

Fig. 2
figure 2

Flowchart of proposed DCC using two-layer consensus

The corresponding steps are outlined as follows and then described in detail below:

Step 1: When a power mismatch caused by fluctuation of intermittent DGs or changing load demand occurs in the ADS, the power mismatch \(\Delta P_{M,i}\) is estimated and shared locally as described in (17).

Step 2: The global power mismatch \(\Delta P_{M}\) is discovered through the consensus algorithm in the first layer, as illustrated in (17) and (18).

Step 3: In the second layer, the optimal solution of (12) is obtained and the pinning consensus value is preset depending on \(\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\frown}$}}{\rho }_{C}^{ *}\) as in (19).

Step 4: By using the pinning-based DCC in the second layer, all the MCCs converge to the predefined pinning consensus value asymptotically according to the synchronization process, as described in (20).

Step 5: The charging power reference values of all the ESSs are adjusted through the proposed fully DCC taking into account the state of charge (SOC) limits and the charging power limits, as shown in (21) and (22).

3.2 Two-layer consensus-based DCC

1) Global information discovery layer: the average consensus algorithm described in (1)–(4), which relies on local information of agents, is used to guarantee the global information be shared in a distributed way. During the process of the two-layer consensus-based DCC, the total power mismatch between supply and demand of the entire ADS PM is the key information, as illustrated earlier in (12), the discovery of which can be accomplished as:

$$\left\{ \begin{array}{ll} \Delta P_{M,i}^{{}} [k] = P_{G,i}^{{}} [k] - (1 + \sigma_{Loss,i} )P_{L,i}^{{}} [k] \hfill \\ \Delta P_{M,i}^{{}} [k + 1] = \Delta P_{M,i}^{{}} [k] + \sum\limits_{{j \in N_{i} }} {w_{ij} \Delta P_{M,j}^{{}} [k]} \hfill \\ \end{array} \right.$$
(17)

where ΔPM,i[k] and ΔPM,i[k+1] denote the power mismatch of agent i at iteration k and k+1, respectively; σLoss,i is the power transmission loss weighting, typically about 5%~7% of the total load [29], so the transmission loss is modeled by multiplying the load demand by a weighting. It is worth noting that, to meet the stability condition in (9), the communication topology of the ADS must be strongly connected [21, 22], and no agent can be isolated from the communication network, that is, at least one communication link must exist with its neighboring agents. Under stable conditions, an agent can adjust its coefficients locally to adapt to changes of system configuration, such as plug-and-play operations, to ensure shared information among the entire MAS.

When a power disturbance occurs in an ADS, global information (such as the number of agents n, and the total power mismatch ΔPM) can be calculated and shared among the distributed agents. When the average consensus of (17) is reached, all ΔPM,i will converge to a common value \(\Delta P_{M}^{*}\). By combining with the total number of participating agents nΔ(t) as described in (6), the global information ΔPM can be discovered as:

$$\Delta P_{M}^{*} = \frac{{\sum\limits_{i} {\Delta P_{M,i} } }}{{n_{\Delta (t)} }} \Rightarrow \Delta P_{M} = n_{\Delta (t)} \Delta P_{M}^{*} = \sum\limits_{i} {\Delta P_{M,i} }$$
(18)

2) DCC layer: using the global power mismatch discovered in the first layer, the pinning-based DCC is implemented in the second layer. The objective of the DCC is to maximize the charging power of all ESSs in the ADS while balancing the power supply and demand and reducing corresponding power losses.

Firstly, in this layer, the solution of the distributed optimization problem in (12) will reached when the following two conditions are met: ① the total charging power of all the ESSs is equal to the discovered power mismatch \(\Delta P_{M}^{*}\); ② all the MCCs of the ESSs reach the common value \(\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\frown}$}}{\rho }_{C}^{ *}\) as follows:

$$\left\{ \begin{aligned} & \overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\frown}$}}{\rho }_{C,i}^{{}} [k]{ = }\alpha_{i} - 2\beta_{i} \overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\frown}$}}{P}_{E,C,i}^{{}} [k] = \alpha_{i} - 2\beta_{i} (P_{E,C,i}^{{}} [k] + \gamma_{i} \Delta P_{M} ) \hfill \\ & \overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\frown}$}}{\rho }_{C,i}^{{}} [\infty ]{ = }\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\frown}$}}{\rho }_{C}^{ *} \hfill \\ & \sum\limits_{i} {\gamma_{i} \Delta P_{M,i} = } \Delta P_{M}^{*} \hfill \\ \end{aligned} \right.$$
(19)

where \(\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\frown}$}}{P}_{E,C,i}^{{}} [k]\) denotes the adjusted changing power of agent i at iteration k considering power mismatch balancing; \(\gamma_{i}\) is the power mismatch dispatching coefficient of the i-th agent; \(\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\frown}$}}{\rho }_{C,i}^{{}} [k]\) is the adjusted MCC of agent i at iteration k. All the MCCs will reach the common value \(\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\frown}$}}{\rho }_{C}^{ *}\), and the value of \(\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\frown}$}}{\rho }_{C}^{ *}\) is preset as the pinning value of DCC in the second layer.

Hence, the synchronization process of the pinning-based DCC for the i-th ESS in the second layer can be illustrated as follows:

$$\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\frown}$}}{\rho }_{i} [k + 1] = \sum\limits_{j = 1}^{n} {w_{ij} \overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\frown}$}}{\rho }_{j} [k]} - d_{i} (\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\frown}$}}{\rho }_{i} [k] - \overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\frown}$}}{\rho }_{C}^{ *} )$$
(20)

Finally, the optimal charging power reference value of the i-th ESS can be determined, noting that, as well as the charging power limits in (12), the limits of the SOC also need to be considered, because the charging efficiency of the ESS may drop to a very low value when SOC is near the limit [25]. To address these two limits, the charging power reference value of the i-th ESS can be calculated by:

$$\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\frown}$}}{P}_{E,C,i} = \left\{ \begin{array}{ll} P_{E,C,i}^{ \hbox{min} } & \frac{{\alpha_{i} - \overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\frown}$}}{\rho }_{C}^{ *} }}{{2\beta_{i} }} < P_{E,C,i}^{ \hbox{min} } \,\&\, \zeta_{i}^{ \hbox{min} } < \zeta_{i} < \zeta_{i}^{ \hbox{max} } \hfill \\ \frac{{\alpha_{i} - \overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\frown}$}}{\rho }_{C}^{ *} }}{{2\beta_{i} }} & P_{E,C,i}^{ \hbox{min} } < \frac{{\alpha_{i} - \overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\frown}$}}{\rho }_{C}^{ *} }}{{2\beta_{i} }} < P_{E,C,i}^{ \hbox{max} } \,\& \\ & \,\,\,\, \zeta_{i}^{ \hbox{min} } < \zeta_{i} < \zeta_{i}^{ \hbox{max} } \hfill \\ P_{E,C,i}^{ \hbox{max} } & \frac{{\alpha_{i} - \overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\frown}$}}{\rho }_{C}^{ *} }}{{2\beta_{i} }} > P_{E,C,i}^{ \hbox{max} } \, \&\,\zeta_{i}^{ \hbox{min} } < \zeta_{i} < \zeta_{i}^{ \hbox{max} } \hfill \\ 0 & \zeta_{i} < \zeta_{i}^{ \hbox{min} } {\text{ or }}\zeta > \zeta_{i}^{ \hbox{max} } \hfill \\ \end{array} \right.$$
(21)

where ζi is the SOC of the i-th ESS; \(\zeta_{i}^{\hbox{min} }\) and \(\zeta_{i}^{\hbox{max} }\) are the lower and upper SOC limits, respectively. The SOC in (21) can be calculated as:

$$\zeta_{i}^{{}} [k]{ = }\zeta_{i}^{{}} [k - 1]{ + }\frac{{P_{E,C,i}^{{}} [k - 1]\eta_{C,i}^{{}} [k - 1]\Delta T}}{{C_{E,i} }}$$
(22)

where ΔT is the discrete time interval and CE,i is the storage capacity of i-th ESS. Overall, using the global power mismatch discovered in the first layer, the entire ADS can implement a fully DCC in the second layer and reach a new optimal state that achieves power supply and demand balance and accounts for the MCC of the ESSs through pinning control.

4 Case studies

To verify the effectiveness of proposed control strategy, a simulation system based on PSCAD/EMTDC has been developed based on the IEEE 33-bus system [21]. The configuration of the ADS and its corresponding communication topology are shown in Fig. 3. Note that an agent can only communicate with its immediate neighboring agents in this communication topology.

Fig. 3
figure 3

IEEE 33-bus ADS connected with ESSs and DGs

The MAS-based ADS is modeled by PSCAD/EMTDC and MATLAB together. More specifically, all the ESSs are modeled as battery ESSs, the ADS is simulated and operated in PSCAD, and the two-layer consensus algorithm of the MAS is simulated in MATLAB. The user-defined interface (UDI) models in PSCAD are defined to associate these two platforms together. Each agent exchanges information with neighboring agents and updates its local information every 0.1 s. Through these interfaces, the proposed DCC using two-layer consensus algorithm can be implemented and verified [21, 22]. The main parameters of the simulated ESSs are shown in Table 1.

Table 1 Parameters of ESSs in ADS

Three representative simulation cases are implemented to investigate the effectiveness and adaptability of the proposed DCC under multiple conditions, as illustrated in Table 2. The corresponding communication topology changes are also indicated in Fig. 3.

Table 2 Simulation cases

4.1 Case A

At the beginning of the simulated period, the ADS is in a stable condition, when t=1 s, the ADS experiences a sudden increase in load, as a result the power balance between supply and demand fails at that moment, and the DCC is implemented immediately. The control parameters of the proposed DCC are given in Table 3.

Table 3 Parameters of DCC in Case A

1) Global information discovery in the first layer: according to the flowchart described in Fig. 2, in the first layer, the power mismatch ΔPM,i is estimated locally and discovered through the information discovery algorithm to achieve the total power mismatch of the ADS ΔPM, according to (17) and (18). The information discovery process is shown in Fig. 4(a).

Fig. 4
figure 4

Control process of proposed DCC in Case A

2) Pinning-based fully DCC in the second layer: in the second layer, using the optimization solution from (19), the pinning consensus value is preset as \(\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\frown}$}}{\rho }_{C}^{*} = 0.3065\). Then, all the MCCs converge to the predefined pinning consensus value asymptotically according to the synchronization process defined in (19), as shown in Fig. 4(b).

Finally, all the charging power reference values of the ESSs are adjusted based on the synchronization process of the MCCs through the proposed fully DCC. The corresponding control process is shown in Fig. 4(c), in which the charging power reference values reach and maintain new states.

Considering the SOC constraints: assume that ESS3 reaches the maximum limit \(P_{E,C,i}^{\hbox{max} }\) because of the SOC constraints described in (21), so \(\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\frown}$}}{P}_{E,C,i}^{{}} [k]\) remains unchanged during the whole control process. The control performance of the proposed DCC is illustrated as in Fig. 5.

Fig. 5
figure 5

Control process of proposed DCC in Case A considering SOC constraints

It can be seen that the charging power reference value of ESS3 remains equal to 22 kW during the entire control process because of the relevant SOC constraint. Meanwhile, the other three ESSs implement the proposed DCC to eliminate the power mismatch and reach a new consensus for the MCCs as \(\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\frown}$}}{\rho }_{C}^{*} = 0.1947\). The ESS1, ESS2 and ESS4 arrive at corresponding new charging reference values as shown in Fig. 5(b).

4.2 Case B

In this case, the power mismatch caused by fluctuating DG output occurs in the ADS at = 1 s, and also a new communication link between agent 1 (A1) and agent 4 (A4) switches on, as illustrated in Fig. 3 (see blue line). The parameters of the proposed DCC in Case B are shown in Table 4.

Table 4 Parameters of DCC in Case B

As in Case A, by using the proposed DCC approach in Case B, the global information ΔPM,i = 50 kW is discovered in the first layer, and the pinning consensus value of the MCC can be preset as \(\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\frown}$}}{\rho }_{C}^{*} = 0.448\). The corresponding changes in charging power reference values for all 4 ESSs are respectively 11.89 kW, 12.10 kW, 16.47 kW, and 9.54 kW.

To address the problem caused by changing communication topology, the communication coupling coefficient wij updates as described in (5). Then, by using the proposed distributed discovery algorithm in the first layer, the total power mismatch ΔPM is discovered, as discussed in Section 3.2. According to the discovered power mismatch, the pinning consensus value of the MCC is preset as described in (19). Accordingly, the pinning-based DCC is applied in the second layer, and the charging power reference values of the ESSs can be then determined according to (20) and (21). The synchronization process of the two-layer consensus and the adjustments of the charging power references are both shown in Fig. 6.

Fig. 6
figure 6

Control process of proposed DCC in Case B

It can be seen in Fig. 6 that the power mismatch and the MCCs both converge asymptotically to the new common values after the synchronization process of DCC, when the power mismatch changes at the same time as the communication topology changes, unlike Case A which had only a power mismatch. Meanwhile, the charging power reference values adjust adaptively through the pinning-based DCC to improve the charging efficiencies and maintain power supply and demand.

Additionally, it can be seen in Fig. 7 that the voltages are regulated and adjusted according to the proposed method. Eventually, the voltages achieve their associated values and reach a new state where the power losses are decreased, because all the voltages become closer to 1 p.u. and consequently the voltage deviations between the ESSs are decreased.

Fig. 7
figure 7

Voltage control performances in Case B

4.3 Case C

In this case, a new ESS named ESS5 plugs into the ADS and its corresponding agent 5 (A5) plugs in accordingly. As a result, the communication topology of the simulated ADS changes, as shown in Fig. 3 (see red line). In addition, when = 1 s, the power mismatch caused by changing load demand and fluctuating DG output occurs in the ADS. The parameters are given in Table 5 and the proposed DCC is implemented as follows.

Table 5 Parameters of DCC in Case C

Firstly, the communication updating matrix W updates according to the participating agents updating method described in (6) to adapt to the plug-in operation. By using the proposed identity updating method, only the neighboring agents of A5 need to update during the plug-in operation. After the adaptive updating, the global power mismatch can be discovered in the first layer and the pinning-based DCC can be implemented in the second layer, as in Cases A and B. The total power mismatch in Case C is ΔP= 80 kW, the pinning consensus value of the MCC is preset as \(\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\frown}$}}{\rho }_{C}^{ *} = 0.335\), and the corresponding charging power reference values change respectively for five ESSs.

It can be seen in Fig. 8 that the total power mismatch and the MCCs both converge asymptotically to the new common values after the synchronization process, and the charging power references of all the ESSs are coordinated accordingly, which indicates that the proposed DCC can adaptively be achieved after pugging in a new agent.

Fig. 8
figure 8

Control process of proposed DCC in Case C

5 Conclusion

This study proposed a fully DCC using the two-layer consensus algorithm to improve charging efficiencies of the ESSs in an ADS. Three key features of the proposed scheme, including the global information discovery in the first layer, the pinning consensus value presetting considering MCCs, and the adaptation of DCC for communication changes have been discussed in detail. Representative cases are simulated to demonstrate the advantages of the proposed method: ① the fully distributed control characteristics of the proposed two-layer consensus algorithm; ② the features of the pinning-based DCC which considers the MCCs of the ESSs, the local power consumption, as well as the power losses; ③ the ability to adapt to changes in the communication topology.