Frequency Stability and Economic Operation of Transactive Multi-Microgrid Systems with Variable Interconnection Conﬁgurations

: With the progressive addition of microgrids at the distribution level, complex networks of interconnected microgrids and the utility grid are likely to emerge. In such a scenario, advanced microgrid controllers are required to achieve operational stability objectives while maintaining a cost-e ﬀ ective operation. This paper investigates the control strategies, trading mechanisms, and interconnection conﬁgurations of a multi-microgrid and utility grid system for frequency stability analysis and operational cost optimization. The analysis is performed on a model of two interconnected microgrids and the utility grid, all possible interconnection conﬁgurations are tested. A robust controller is designed and the control parameters are later optimized to ensure that the frequency stability of the system is maintained under normal operating conditions and under various disturbances. A new control element based on switching between interconnection conﬁgurations is introduced to handle the power that ﬂows between microgrids, aiming to minimize inter-microgrid energy trading cost while maintaining the system frequency ﬂuctuations within tolerance levels. The e ﬀ ectiveness of the designed controller is demonstrated in this work. This work is expected to provide new insights in the ﬁeld of multi-microgrid system design.


Introduction
Several factors, including environmental concerns, power grid modernization, and access to power in underdeveloped or remote areas, have stimulated extensive research in the area of renewable energy and distributed generations. Microgrid (MG) and associated technologies have been developed as a promising solution. MG typically consists of electric loads, various types of distributed generators (DGs) including wind turbine generators (WTGs), solar photovoltaic (PV) units, microturbines (MTs), and in some cases electrolyzer (ES), fuel cells (FC), and various types of energy storage systems [1]. MGs can operate in several modes: (1) interconnected to other MGs (but disconnected from the utility grid (UG)), (2) connected only to the utility grid (UG), (3) connected simultaneously to other MGs and the UG, and (4) disconnected from other MGs and the UG (island mode). In an alternate current (AC) MG, its connection to neighboring MGs and the UG are mainly for operational cost reduction and improved reliability and stability. Through energy trading, an MG can take advantage of the diversity of supplies and demands in neighboring MGs and UG to achieve a mutual benefit while meeting system stability requirements [2]. Given the stochastic nature of electrical loads, the variable power output of solar PV and WTG generators, the diverse MG operational modes, and the highly complex interactions between interconnected MGs and the UG, it is advised to use an optimal robust microgrid controller (MGC) to achieve power quality goals.
For an MG illustrated in Figure 1, proportional-integral (PI) controllers are proposed to adjust MT (generation) and ES (load) to minimize the power imbalances and the resulting frequency fluctuations in both island and grid-connected modes [3]. In [4], the proposed MG, the PV, WTG, and loads are generally stochastic and passively monitored by the MGC. In [5], a similar MG was studied, and particle swarm optimization (PSO) algorithm was implemented to select the appropriate PI controller parameters. Linear [6] and nonlinear [7] droop controls were also developed to optimize MG operation. Therefore, in the case of a single MG, optimal robust MGC has been well-established. To simulate the dynamic behavior of MG components, a simple but widely adopted [3][4][5]8] microgrid modeling technique was applied. This approach outputs a fair approximation of the dynamic response of the system, needed to generate valid conclusions for the work.
Hao et al. [9] and Jadhav et al. [10], investigated a system of three interconnected MGs, with one of the MGs connected to the UG through a passive link. A variety of components including a battery energy storage system (BESS), flywheel energy storage, diesel generators, heat pumps, and electric vehicles (EVs) were added in the model. Operation costs were included as part of the optimization objectives [9]. Voltage stability was also considered in MGC design [10]. The concepts of energy internet and power router were discussed. However, the system under study was essentially one large MG with a fixed configuration and UG connection. It is of both theoretical and practical interests to explore the possible consequences of variable or flexible configurations. As shown in Figure 2, the power lines that connect the two MGs between them and with the UG are switchable, meaning that the lines can be connected or disconnected by the controller to improve frequency stability and/or to reduce the operational cost. For an MG illustrated in Figure 1, proportional-integral (PI) controllers are proposed to adjust MT (generation) and ES (load) to minimize the power imbalances and the resulting frequency fluctuations in both island and grid-connected modes [3]. In [4], the proposed MG, the PV, WTG, and loads are generally stochastic and passively monitored by the MGC. In [5], a similar MG was studied, and particle swarm optimization (PSO) algorithm was implemented to select the appropriate PI controller parameters. Linear [6] and nonlinear [7] droop controls were also developed to optimize MG operation. Therefore, in the case of a single MG, optimal robust MGC has been well-established. To simulate the dynamic behavior of MG components, a simple but widely adopted [3][4][5]8] microgrid modeling technique was applied. This approach outputs a fair approximation of the dynamic response of the system, needed to generate valid conclusions for the work.
Hao et al. [9] and Jadhav et al. [10], investigated a system of three interconnected MGs, with one of the MGs connected to the UG through a passive link. A variety of components including a battery energy storage system (BESS), flywheel energy storage, diesel generators, heat pumps, and electric vehicles (EVs) were added in the model. Operation costs were included as part of the optimization objectives [9]. Voltage stability was also considered in MGC design [10]. The concepts of energy internet and power router were discussed. However, the system under study was essentially one large MG with a fixed configuration and UG connection. It is of both theoretical and practical interests to explore the possible consequences of variable or flexible configurations. As shown in Figure 2, the power lines that connect the two MGs between them and with the UG are switchable, meaning that the lines can be connected or disconnected by the controller to improve frequency stability and/or to reduce the operational cost.  For an MG illustrated in Figure 1, proportional-integral (PI) controllers are proposed to adjust MT (generation) and ES (load) to minimize the power imbalances and the resulting frequency fluctuations in both island and grid-connected modes [3]. In [4], the proposed MG, the PV, WTG, and loads are generally stochastic and passively monitored by the MGC. In [5], a similar MG was studied, and particle swarm optimization (PSO) algorithm was implemented to select the appropriate PI controller parameters. Linear [6] and nonlinear [7] droop controls were also developed to optimize MG operation. Therefore, in the case of a single MG, optimal robust MGC has been well-established. To simulate the dynamic behavior of MG components, a simple but widely adopted [3][4][5]8] microgrid modeling technique was applied. This approach outputs a fair approximation of the dynamic response of the system, needed to generate valid conclusions for the work.
Hao et al. [9] and Jadhav et al. [10], investigated a system of three interconnected MGs, with one of the MGs connected to the UG through a passive link. A variety of components including a battery energy storage system (BESS), flywheel energy storage, diesel generators, heat pumps, and electric vehicles (EVs) were added in the model. Operation costs were included as part of the optimization objectives [9]. Voltage stability was also considered in MGC design [10]. The concepts of energy internet and power router were discussed. However, the system under study was essentially one large MG with a fixed configuration and UG connection. It is of both theoretical and practical interests to explore the possible consequences of variable or flexible configurations. As shown in Figure 2, the power lines that connect the two MGs between them and with the UG are switchable, meaning that the lines can be connected or disconnected by the controller to improve frequency stability and/or to reduce the operational cost.   In recent years, the economic operation of multi-MG systems has attracted plenty of research attention. Hussain et al. [12] proposed a method for energy trading between microgrids located in a distribution network. Key elements of their approach included a simple pricing mechanism and a mediator protecting buyer and seller interests. Park et al. [13] introduced a new energy management system for networked MGs. The objective for island operation and grid-connected modes was to minimize operating costs. The time horizon for the analysis was day-ahead. Wang et al. [14], proposes, for networked MGs, a "distributor" which collects all energy surplus from any MG and then distributes it to others based on each MG's historical contribution and the maximization of each consumer's utility. Wu et al. [15] proposes a bilevel approach to energy management in MG networks. With a distribution network operator in the first level and multiple MGs in the second level, the objective is to minimize overall operating costs. Kou et al. [16], presented a decentralized optimal control algorithm by considering the distribution network as a collection of coupled MGs. Each MG in the distribution system must share information with the rest. Individual MG controllers use local information as well as the received information to select the right trading action to achieve local and global objectives. In Gregoratti and Matamoros [17] work, a group of neighboring MGs in the same distribution network trade power based on the information collected and shared by a DNO. The distributed economic model predictive control is developed to coordinate the multi-MG system under uncertainty. Zhao et al. [18], proposed a distributed dual decomposition algorithm controller for a group of MGs not connected to the utility grid, each MG has a generation cost, the cost of network utilization is also considered. The objective is to find the optimal amount of traded energy that will minimize overall operational costs. Wang and Huang [19], used an energy management system to solve the problem of unbalanced supply and demand. The optimization was performed on two levels, individual MG level, and multi-MG level. The coordinated operation is preferable since it was shown that while individual MGs can achieve local objectives, the whole system could have an expensive operation cost. Bullich-Massagué et al. [20], used a decentralized algorithm method with minimum information exchange to coordinate inter-MG energy trading. The case study demonstrated that, through energy trading, an individual MG reduced its operation cost by up to 29.4% and all MGs in the system reduced the overall cost by 13.2%. Gazijahani et al. [21] presents a summary of interconnection architectures for multi-MG systems along with comparisons of cost, stability, protection, scalability, reliability, communications, and business models. Arefifar et al. [22] presents a risk-based multi-objective approach for energy exchange optimization among networked MGs. The authors also suggest that coordinated MGs can achieve reduced operational costs. In our previous work [11], a centralized day-ahead energy management system for interconnected MGs that aims to minimize operating cost is used to define the optimal value of the decision variables (dispatchable generation).
Most of the relevant literature indicates that energy management or coordination at the inter-MG level can help achieve reduced operational costs. However, the research attention has been given mainly to the economic aspects such as operational costs rather than system stability (it was assumed that MGs can always self-stabilize). The main contributions of this work are as follows: • Development of a multi-MG simulation framework with the capability of optimizing MG controller parameters for frequency stability. Implemented in MATLAB/SIMULINK, the controller parameter selection is much more important and consequential in the case of islanded MGs. For interconnected MGs, it is found that joint optimization of the parameters of the controllers of all MGs can help reduce system frequency deviation.

•
Investigation of three different power trading mechanisms between MGs, namely, natural, conservative, and active trading mechanisms. For each mechanism, we tested the frequency deviations under disturbances and demonstrate their respective advantages. The results regarding frequency stability with these mechanisms are novel and of relevance and may serve as "limiting cases" for other more advanced trading mechanisms.

•
Comparison of MG operation costs under different interconnection configurations and trading mechanisms. On the one hand, it is suggested that given the UG price signal and the multi-MG Energies 2020, 13, 2485 4 of 20 system operational characteristics, cost performance can be improved when switching to other interconnection configurations. On the other hand, it is also shown that at least in some cases there is a trade-off between cost reduction and frequency stability.
The specific innovative part of this work compared to similar studies can be summarized as three power trading mechanisms in combination with different interconnection configurations that are used to improve frequency stability and operational cost of interconnected MGs. The other sections of this paper are organized as follows. Section 2 describes the model formulation, model parameters, and the three trading mechanisms. Section 3 presents the results on the frequency stability of single MG and two connected MG, as well as the operational costs in different scenarios. The conclusions are stated in Section 4.

Methodology
In this section, a model of two interconnected MGs and the UG was presented. The main control of the system was achieved through PI controllers within each MG. For each mode of operation, a control objective was presented. In the grid-tie mode, the control objective was to minimize power from UG while minimizing power mismatch at the MG bus. In the island mode, the MG controller objective was to minimize power mismatch at the MG bus.

Model Formulation
The control system schematic of a single MG is presented in Figure 3. To minimize power mismatch on the MG, the generation must match the demand as described in the next equation: where ∆P is the power deviation at the MG bus, P G is the total power generation and P D is the total power demand. P G and P D are further described in the following Equations (2) and (3): where P WTG is the power from the WTGs, P PV is the power output of the solar PV system, P FC is the power output of the FC, P MT is the power output of the MT, P UG is the power from and to the UG, P MG1−MG2 is power from and to the neighboring MG, P Load is the power demand of the MG load, and P ES is the power demand of ES. P WTG , P PV , P FC and P MT generations and P ES demand are within respective bounds as detailed in Table 1. P UG and P MG1−MG2 are not constrained. Initial values for the model are given in Table 1.
The precise simulation of MG components dynamics such as MT, FC, and ES, requires high-order mathematical models that consider physical constraints and nonlinearities. However, simplified models are generally employed. In this work, simplified models of the system components in the form of low-order transfer functions were presented. Examples of these transfer functions are Equations (3)- (6) where the dynamic behavior of the device is determined only by a gain and a time constant. Following the work of Li et al. [3], the controller transfer functions that govern the adjustment of the electrical power consumption of the ES ∆P ES , the power generated by the FC ∆P FC , and MT ∆P MT , respond to the frequency deviation ∆ f from nominal values observed in the MG are:  The precise simulation of MG components dynamics such as MT, FC, and ES, requires highorder mathematical models that consider physical constraints and nonlinearities. However, simplified models are generally employed. In this work, simplified models of the system components in the form of low-order transfer functions were presented. Examples of these transfer functions are Equations (3)- (6) where the dynamic behavior of the device is determined only by a gain and a time constant. Following the work of Li et al. [3], the controller transfer functions that govern the adjustment of the electrical power consumption of the ES ∆ , the power generated by the FC ∆ , and MT ∆ , respond to the frequency deviation ∆ from nominal values observed in the MG are: where , and are ES, FC, and MT proportional gain factors and and are the ES and FC time constants.
When connected to UG, the MG PI controllers that govern MT generation and ES demand are set to minimize the amount of power traded with UG and are described by the following equations [8]: where ∆ and ∆ are control signals for grid-connected ES and MT, When operating in the island mode, The MG PI controllers that govern MT generation and ES demand are set to minimize the generation/demand imbalance and are described by the following equations:  When connected to UG, the MG PI controllers that govern MT generation and ES demand are set to minimize the amount of power traded with UG and are described by the following equations [8]: where ∆P ESGTC and ∆P MTGTC are control signals for grid-connected ES and MT, KP ESGT and KP MTGT are the proportional gains for ES and MT, and KI ESGT and KI MTGT are the integral gains of ES and MT.
(∆P re f − P UG ) is the deviation from the expected value. When operating in the island mode, The MG PI controllers that govern MT generation and ES demand are set to minimize the generation/demand imbalance and are described by the following equations: where ∆P ESISC and ∆P MTISC are control signals for island operation of ES and MT. KP ESIS and KP MTIS are the proportional gains for ES and MT. KI ESIS and KI MTIS are the integral gains of ES and MT.
(∆P re f − ∆P) is the power mismatch at the MG bus. From the work of Vachirasricirikul et al. [5], the standard deviation from an initial value σP PV and σP WTG of the solar PV and WTG generation is presented in Figure 3 (insert) and are modeled as: Similarly, the standard deviation of the load σP Load from an initial value is modeled as: To model P PV , P WTG and P Load , a noise block times a first-order low-pass filter is multiplied by the standard deviations of initial values (11-13) as described in Figure 3. The power flow from UG to MG, P UG is: where X PG is line reactance between MG and UG and θ obtained from θ = 2π f 0 ∆ f dt where f 0 is 60 Hz and ∆ f = 1 M 1 s + D 1 ∆P, is the relative phase angle. Since electrical loads and renewable generation fluctuate randomly, a robust MG controller is necessary to achieve frequency stability throughout the system. In this work we proposed a method to obtain an optimal set of controller parameters for (1) a single MG in stand-alone and UG connected mode, and (2) for two interconnected MGs in the stand-alone and UG connected mode. For a larger system of interconnected MGs and the UG, the method would be similar. In this work, robustness is measured from a practical point of view, for example, after a disturbance, the frequency deviation will return to within the tolerance window. To achieve power balance in the MG, the devices subject to control are ES (controllable load), MT, and FC (controllable generators). Three types of disturbances are considered, MT generator failure, PV generation loss, and MG a sudden increase in MG load. For each case, we implemented a particular objective function. In the results section, for each result, the objective function was described. To minimize the objective functions, in all cases, genetic algorithm was implemented. MATLAB/SIMULINK software was used to implement the models. When dealing with interconnected MGs, one of the MGs may trade power with a nearby MG or with the UG, this condition may lead to an additional optimization layer. Cost minimization (which includes switch operation and power trading) is achieved by distributed decision making, as shown in Figure 2. Each MG controller can import power from the most affordable source and export power to the highest bidder. For this to happen, energy prices (actual and projected) must be communicated between parties in real-time.
In the results section, we only proved the frequency stability of the system under topology switching. Using our preliminary work [11] as a starting point, for each MG, a set of initial and fixed parameters is given in Table 1. The initial MG controller parameters are described in Table 2. Optimized parameters are given later in Table 3.  Table 3. Optimized parameters.

Model Parameters
The specification of the two MG2 considered in this study is presented in Table 1. At time zero, for each of ES, FC, MT, WTG, PV, and load, a value is also given to ensure the power balance. The initial MG controller parameters are set as shown in Table 2.

Mechanisms of Energy Trading
One of the main contributions of this work was the analysis of configurable interconnections combined with three different types of power trading mechanisms. Before we explain how each of the trading mechanisms works, we would like to underscore that these mechanisms are based on frequency stability considerations, not from any specific market designs. On the one hand, these mechanisms can be viewed as limiting cases of market designs; and on the other hand, the study of these mechanisms facilitates the exploration of the relations between trading and stability.

Natural Power Trading
We denoted "natural power trading" as the power flowing from one MG to the other when connected directly with a line from one bus to the other. This is modeled by: where, X PG is the line reactance the tie between MG1 with MG2 and θ obtained from θ = 2π f 0 ∆ f dt where f 0 is 60 Hz and ∆ f = 1 M 1 s + D 1 ∆P, is the relative phase angle.

Conservative Power Trading
We denoted "conservative power trading" as the trading between interconnected MGs subject to the following rules: where P Cons MG1−MG2 is the power flow between MGs under conservative power trading, ∆P MG1 is the power deviation in MG1 bus, and ∆P MG2 is the power deviation in the MG2 bus.

Active Power Trading
In "active power trading", trading is allowed only under certain circumstances. For this paper we set the following restrictions: where P Active MG1−MG2 is the power flow between MGs under active power trading. ∆ f MG1 and ∆ f MG2 are the frequency deviations from the nominal value at the MG1 and MG2 buses respectively. In active power trading, more power support can be requested compared to conservative trading, but only to a limit that prevents cascade failure under large disturbances.

Results
This section provides representative results that show the robustness of individual MGs (both island and grid-connected modes) and interconnected MGs, the effects of energy transactions on operational costs, and the optimal interconnection strategies for multi-MG systems. . Since these cases are grid-connected scenarios, only the grid-connected PI controller parameters are optimized. Optimized parameters can be seen in Table 3. All cases are analyzed from the perspective of MG1. Figure 4a shows the optimization convergence process of J and Figure 4b the optimized frequency deviation of MG1 in normal operation with no disturbances applied. Since the MG is connected to UG, the frequency deviation is minimal. For the following cases, we considered three types of local disturbances within the MG. In Figure 5, the PV generation failed (instantaneous PV plant shut down) at t = 60 s. This disturbance produced a frequency sag; however, the decline was within the frequency threshold. In Figure 6, at t = 60 s, MG1 was subject to a sudden load increase (40 kW in 2 s). This disturbance produced a frequency sag and a subsequent spike, both within the threshold boundaries. In Figure 7, at t = 60 s, the MT lost power by 70 kW in 20 s. This disturbance was barely noticeable mainly due to the relatively long term (20 s) development. We could conclude, for all cases (Figures 4-7), as long as MG1 was connected to the UG (and by default, there were no restrictions on the power flow between MG1 and UG), the frequency deviation was minimal (within ± 0.05 Hz range). In figure captions, the symbol ⇔ was used to denote "connected" and the symbol was used to denote "disconnected".        Figures 8-11 show the optimization convergence process and frequency deviation of a single MG in the island mode. Here we wanted to tune the island mode controller parameters to minimize frequency deviation. The objective function is as described earlier. Since these were island mode Energies 2020, 13, 2485 11 of 20 cases, the PI controller parameters to be optimized were for the island mode PI controller as seen in Figure 3. Optimized parameters for all cases can be seen in Table 3. All the tests are presented from the perspective of MG1. Figure 8 shows the optimization results and frequency deviation of MG1 in normal operation with no disturbances applied. Comparing Figure 8 (island mode) with Figure 4 (grid-connected), it is obvious that ∆ f was more significant in the island mode than in the grid-connected mode; both it is still well within the tolerance threshold. In Figure 9, at t = 60 s, a disturbance was applied (instantaneous PV plant shut down). This event prompted a frequency deviation beyond the tolerance level for approximately one second. The same disturbance did not breach the threshold in grid-connected mode. In Figure 10, at t = 60 s, the load increased by 40 kW in a 2 s ramp. This disturbance produced an out of tolerance effect on the MG frequency, which was extended for about 6 s. In Figure 11, at t = 60 s, the MT lost power by 70 kW in 20 s. We could conclude, in all cases (Figures 8-11), disturbances could have a temporary detrimental effect on frequency stability. However, shortly after the disturbances, the frequency stabilizes without the support from external sources such as the UG of a neighboring MG.  Figure 5 produces a frequency sag outside of the desired threshold. However, the system returns to the desired range in a short time. Figure 10 and 11 show similar behavior.  Figure 5 produces a frequency sag outside of the desired threshold. However, the system returns to the desired range in a short time. Figure 10 and 11 show similar behavior. Above, we optimized the MG controller parameters for each case and plotted the frequency fluctuations under optimized parameter settings. To tune the controller for applications, it is necessary to find an optimal set of parameters that work well in different disturbance scenarios. The objective function can be defined as (minimize) ∑ where represents the likelihood (weight) of the i-th scenario and is the average absolute frequency deviation in the ith scenario. Now we chose = 0.6, = 0.3, and = 0.1, where , , and respectively stand for the weight factors of PV loss, load increase, and MT failure likelihood of the scenario. The results of this approach are shown in Figure 12a single set of controller parameters was applied for all cases. The analyzed scenario was for an islanded MG. Figure 12a shows the optimization convergence process. Figure  12b,c were very close to Figures 9b and 10b (the first two scenarios), while the results in Figure 12d was not as good as Figure 11 due to the low weight assigned. Above, we optimized the MG controller parameters for each case and plotted the frequency fluctuations under optimized parameter settings. To tune the controller for applications, it is necessary to find an optimal set of parameters that work well in different disturbance scenarios. The objective function can be defined as (minimize) ∑ where represents the likelihood (weight) of the i-th scenario and is the average absolute frequency deviation in the ith scenario. Now we chose = 0.6, = 0.3, and = 0.1, where , , and respectively stand for the weight factors of PV loss, load increase, and MT failure likelihood of the scenario. The results of this approach are shown in Figure 12a single set of controller parameters was applied for all cases. The analyzed scenario was for an islanded MG. Figure 12a shows the optimization convergence process. Figure  12b,c were very close to Figures 9b and 10b (the first two scenarios), while the results in Figure 12d was not as good as Figure 11 due to the low weight assigned. Above, we optimized the MG controller parameters for each case and plotted the frequency fluctuations under optimized parameter settings. To tune the controller for applications, it is necessary to find an optimal set of parameters that work well in different disturbance scenarios. The objective function can be defined as (minimize) i ω i J i where ω i represents the likelihood (weight) of the i-th scenario and J i is the average absolute frequency deviation in the ith scenario. Now we chose ω 1 = 0.6, ω 2 = 0.3, and ω 3 = 0.1, where ω 1 , ω 2 , and ω 3 respectively stand for the weight factors of PV loss, load increase, and MT failure likelihood of the scenario. The results of this approach are shown in Figure 12a single set of controller parameters was applied for all cases. The analyzed scenario was for an islanded MG. Figure 12a shows the optimization convergence process. Figure 12b,c were very close to Figures 9b and 10b (the first two scenarios), while the results in Figure 12d was not as good as Figure 11 due to the low weight assigned.

Robustness of Individual Microgrids
In Figure 13, we implement a similar approach as in the case presented in Figure 12. However, an alternative objective function was used: (minimize) i ω i T i where T i is the time (in seconds) that the frequency stays outside the defined range in the i-th scenario. The results were similar to Figure 12. For simplicity, we used the objective function in Figure 12 hereafter. In Figure 13, we implement a similar approach as in the case presented in Figure 12. However, an alternative objective function was used: (minimize) ∑ where is the time (in seconds) that the frequency stays outside the defined range in the i-th scenario. The results were similar to Figure  12. For simplicity, we used the objective function in Figure 12 hereafter.

Robustness of the Inter-Connected Two-Microgrid System
In all the simulated scenarios above, the optimized MGC could maintain grid-connected and islanded MG frequency stability to a satisfactory level. However, in the island mode, temporary breaches of frequency threshold could be observed, always returning to a stable operation after the disturbance was cleared. Now with the controller design validated, we analyzed the impact of interconnecting adjacent MGs on frequency stability. We tested the three types of power trading as described in the methodology section. In Figure 14, two adjacent MGs were connected while both disconnected from UG. We sought to optimize the island mode controller parameters in both MGs. The objective function is (minimize) ∑ where corresponds to each of the interconnected MGs and therefore, = |∆ |d is the average absolute value of frequency deviation on each of the interconnected MG. For the simulation, is = 0 s and is = 120 s. describes the average of the absolute value of the frequency deviation ∆ from the nominal value during the studied time interval [ , ]. In Figure 14, the two adjacent MGs were initially disconnected from each other. At = 20 s, they became connected. The trading mechanism established for this case was natural power trading as defined before. In Figure 14a the optimization convergence process is presented. In Figure  14b, once the MGs were connected, their frequency deviations converged. In Figure 14c, at = 40 s, the PV plant in MG2 failed. The impact on ∆ of this disturbance was larger on MG2 but it was also transferred to MG1. At = 80 s, MG1 load increased 40 kW in 2 s. The impact of the disturbance on ∆ was now greater in MG1. In both cases, the frequency deviation could fall outside of the ∆ threshold but the magnitude was smaller than those observed on a single islanded MG (as in Figure 13b,c), demonstrating that interconnected MGs had increased resiliency to disturbances. In Figure  14d, a large load increase was observed in MG2 at = 80 s (120 kW in 4 s). This disturbance exceeded the generation capacity of MG2 and made MG1's MT and ES reach the maximum and minimum limits. Evidently, natural power trading could lead to the collapse of both MGs, because there was no mechanism to limit the destabilizing disturbance transmission between them.  Figure 12) are similar to the ones observed in Figure 12.
To reduce the "negative impact" propagation among interconnected MGs, we tested two alternative power trading methods. In Figure 15 we implemented conservative power trading. In Figure 15b, the interconnected MGs were trading. In contrast with natural power trading shown in Figure 14b, the frequencies in each MG remained independent. In Figure 15c, MG1 frequency deviation was compared between no-trading (islanding) and conservative-trading cases. In both cases, a 40 kW load increase in 2 s was applied. The stabilization effect of the trading method on frequency was not much improved since the capacity of MGs supporting each other was limited. However, conservative trading could prevent a disturbance cascade between MGs. In Figure 15c, we

Robustness of the Inter-Connected Two-Microgrid System
In all the simulated scenarios above, the optimized MGC could maintain grid-connected and islanded MG frequency stability to a satisfactory level. However, in the island mode, temporary breaches of frequency threshold could be observed, always returning to a stable operation after the disturbance was cleared. Now with the controller design validated, we analyzed the impact of interconnecting adjacent MGs on frequency stability. We tested the three types of power trading as described in the methodology section. In Figure 14, two adjacent MGs were connected while both disconnected from UG. We sought to optimize the island mode controller parameters in both MGs. The objective function is (minimize)  Figure 14, the two adjacent MGs were initially disconnected from each other. At t = 20 s, they became connected. The trading mechanism established for this case was natural power trading as defined before. In Figure 14a the optimization convergence process is presented. In Figure 14b, once the MGs were connected, their frequency deviations converged. In Figure 14c, at t = 40 s, the PV plant in MG2 failed. The impact on ∆ f of this disturbance was larger on MG2 but it was also transferred to MG1. At t = 80 s, MG1 load increased 40 kW in 2 s. The impact of the disturbance on ∆ f was now greater in MG1. In both cases, the frequency deviation could fall outside of the ∆ f threshold but the magnitude was smaller than those observed on a single islanded MG (as in Figure 13b,c), demonstrating that interconnected MGs had increased resiliency to disturbances. In Figure 14d, a large load increase was observed in MG2 at t = 80 s (120 kW in 4 s). This disturbance exceeded the generation capacity of MG2 and made MG1 s MT and ES reach the maximum and minimum limits. Evidently, natural power trading could lead to the collapse of both MGs, because there was no mechanism to limit the destabilizing disturbance transmission between them.
To reduce the "negative impact" propagation among interconnected MGs, we tested two alternative power trading methods. In Figure 15 we implemented conservative power trading. In Figure 15b, the interconnected MGs were trading. In contrast with natural power trading shown in Figure 14b, the frequencies in each MG remained independent. In Figure 15c, MG1 frequency deviation was compared between no-trading (islanding) and conservative-trading cases. In both cases, a 40 kW load increase in 2 s was applied. The stabilization effect of the trading method on frequency was not much improved since the capacity of MGs supporting each other was limited. However, conservative trading could prevent a disturbance cascade between MGs. In Figure 15c, we used the controller parameters for MG1 and MG2 obtained from single islanded MG optimization (e.g., Figure 12). In Figure 15d, we compared the trading case of Figure 15c with the case in which the two MG controllers' parameters were jointly optimized (using the Figure 15c parameters as initial values). The optimization convergence process is shown in Figure 15a. The frequency deviation was substantially reduced. Figure 16c with the case in which the two MG controllers' parameters were jointly optimized (using the Figure 16c parameters as initial values) and observed an additional reduction of frequency deviation. It has been shown that this method could transfer power between interconnected MGs up to a limit that was higher than conservative trading. If the disturbance is too large and one of the MGs is likely to collapse, the other will support up to a certain point and then disengage (unlike natural trading). The optimized parameters for all the above cases (1 through 13) are listed in Table 3 below. In Figure 17, we present some results from the perspective of power flow. Figure 17a shows the power output of MTs in both MGs with no disturbances applied. Figure 17b shows the power flow between MG1 and MG2 under "natural power trading" with no disturbance (blue line) and disturbance case (at t = 400, 40 kW in 2 s load increase in MG1). Large power flow was observed from MG2 to MG1. In Figure 17c, the disturbance case (orange line) of Figure 17c was compared to the same case under the active trading mechanism. The power transfer between MGs was clearly affected by the trading mechanism, which subsequently also affected the frequency stability of the interconnected system.  As an intermediate mechanism between "natural power trading" and "conservative power trading", the "active power trading" was as follows: power trading was allowed when frequency deviation was between 0.051 to 0.1 Hz and −0.1 to −0.051 Hz and no trading between −0.05 and 0.05 Hz. In Figure 16b, as long as both MGs remained within this frequency deviation threshold, they remained independent. In Figure 16c, we applied a large disturbance in MG1 t = 60 s (80 kW in 2 s) this additional load exceeded the MT and ES controlling capacity. The orange line shows the frequency deviation of MG1 under the conservative trading method, leading to the MG1 collapse. The blue line shows the effect of the active trading method where despite large transient sag, the frequency returns to be within the safety threshold. In Figure 16d, we compared the blue line of Figure 16c with the case in which the two MG controllers' parameters were jointly optimized (using the Figure 16c parameters as initial values) and observed an additional reduction of frequency deviation. It has been shown that this method could transfer power between interconnected MGs up to a limit that was higher than conservative trading. If the disturbance is too large and one of the MGs is likely to collapse, the other will support up to a certain point and then disengage (unlike natural trading). The optimized parameters for all the above cases (1 through 13) are listed in Table 3 below. In Figure 17, we present some results from the perspective of power flow. Figure 17a shows the power output of MTs in both MGs with no disturbances applied. Figure 17b shows the power flow between MG1 and MG2 under "natural power trading" with no disturbance (blue line) and disturbance case (at t = 400, 40 kW in 2 s load increase in MG1). Large power flow was observed from MG2 to MG1. In Figure 17c, the disturbance case (orange line) of Figure 17c was compared to the same case under the active trading mechanism. The power transfer between MGs was clearly affected by the trading mechanism, which subsequently also affected the frequency stability of the interconnected system.

Effects of Energy Transactions on Operational Costs
In Figure 17d, still with both MGs disconnected from UG, we calculated the kWh cost for the simulation period (10 min). The operational cost calculation was performed (time omitted) by: where 1 is the operational cost of MG1. $ ℎ is the cost of generating 1 kWh using MG1 MT. $ ℎ is the cost of buying 1 kWh from the UG. $ ℎ is the cost of buying 1 kWh from MG2. $ ℎ is the income obtained from selling 1 kWh to the UG. $ ℎ is the income obtained from selling 1 kWh to MG2. In the absence of disturbances, the three mechanisms have the same cost performance. In the case of load increase in MG1, the operating cost of MG1 was highest under active trading, because a net import of power from MG2 was dominant (Figure 17c). Similarly, in the case of a load increase in MG2, the operating cost of MG1 was lowest under active trading.
Next, we analyzed how the different interconnections between MGs and UG could affect operational costs. The main objective in this section was to show that switching interconnection configuration could lead to an optimized operation cost. The operational cost calculation was performed only from the perspective of MG1. Natural power trading was selected as the interconnection method between MGs, this was due to the larger amount of traded energy between MGs, which allowed more evident results. Two cases were analyzed in Figure 18. For case a, we assumed the following: (1) the kWh unit price for buying and selling from UG = 1, (2) the kWh unit price for buying and selling from a neighbor MG = 0.8, and (3) the cost of producing 1 kWh with the

Effects of Energy Transactions on Operational Costs
In Figure 17d, still with both MGs disconnected from UG, we calculated the kWh cost for the simulation period (10 min). The operational cost calculation was performed (time omitted) by: where MG1 opcost is the operational cost of MG1. $kWh MT1 gen is the cost of generating 1 kWh using MG1 MT. $kWh UG buy is the cost of buying 1 kWh from the UG. $kWh MG2 buy is the cost of buying 1 kWh from MG2. $kWh UG sell is the income obtained from selling 1 kWh to the UG. $kWh MG2 sell is the income obtained from selling 1 kWh to MG2. In the absence of disturbances, the three mechanisms have the same cost performance. In the case of load increase in MG1, the operating cost of MG1 was highest under active trading, because a net import of power from MG2 was dominant (Figure 17c). Similarly, in the case of a load increase in MG2, the operating cost of MG1 was lowest under active trading.
Next, we analyzed how the different interconnections between MGs and UG could affect operational costs. The main objective in this section was to show that switching interconnection configuration could lead to an optimized operation cost. The operational cost calculation was performed only from the perspective of MG1. Natural power trading was selected as the interconnection method between MGs, this was due to the larger amount of traded energy between MGs, which allowed more evident results. Two cases were analyzed in Figure 18. For case a, we assumed the following: (1) the kWh unit price for buying and selling from UG = 1, (2) the kWh unit price for buying and selling from a neighbor MG = 0.8, and (3) the cost of producing 1 kWh with the MT is 0.5. No disturbances were applied to this case. For case b, we assumed that the kWh unit price for buying and selling from UG = 1.5. In both cases, a 40 kW load increase (in 2 s) was applied at t = 60 s and the simulation time was Energies 2020, 13,2485 18 of 20 120 s. In Figure 18, one could see that depending on the UG electricity price and the real-time multi-MG system operational characteristics, it was possible to change the interconnection configuration to reduce operating costs. change the interconnection configuration to reduce operating costs.

Optimal Interconnection Strategies for System Operation
To illustrate the findings in the previous subsection, we implemented an example (Figure 19) based on the conditions established for Figure 18 case b. Assuming an increase of the energy price signal from 1 to 1.5 (Figure 19a), a tradeoff between power quality and costs could be observed. When connected to UG and MG2 (case b-A) the operation cost will naturally go up. If the interconnection was switched from case b-A to case b-E, an operational cost reduction could be achieved (Figure 19c), while frequency deviation became more significant (Figure 19b).

Conclusions
This work developed the simulation model of a multi-MG system, which included several distributed generation resources, loads, a controllable power generator (microturbine), and a

Optimal Interconnection Strategies for System Operation
To illustrate the findings in the previous subsection, we implemented an example ( Figure 19) based on the conditions established for Figure 18 case b. Assuming an increase of the energy price signal from 1 to 1.5 (Figure 19a), a tradeoff between power quality and costs could be observed. When connected to UG and MG2 (case b-A) the operation cost will naturally go up. If the interconnection was switched from case b-A to case b-E, an operational cost reduction could be achieved (Figure 19c), while frequency deviation became more significant (Figure 19b).
Energies 2020, 13, x 18 of 20 MT is 0.5. No disturbances were applied to this case. For case b, we assumed that the kWh unit price for buying and selling from UG = 1.5. In both cases, a 40 kW load increase (in 2 s) was applied at t = 60 s and the simulation time was 120 s. In Figure 18, one could see that depending on the UG electricity price and the real-time multi-MG system operational characteristics, it was possible to change the interconnection configuration to reduce operating costs.

Optimal Interconnection Strategies for System Operation
To illustrate the findings in the previous subsection, we implemented an example ( Figure 19) based on the conditions established for Figure 18 case b. Assuming an increase of the energy price signal from 1 to 1.5 (Figure 19a), a tradeoff between power quality and costs could be observed. When connected to UG and MG2 (case b-A) the operation cost will naturally go up. If the interconnection was switched from case b-A to case b-E, an operational cost reduction could be achieved (Figure 19c), while frequency deviation became more significant (Figure 19b).

Conclusions
This work developed the simulation model of a multi-MG system, which included several distributed generation resources, loads, a controllable power generator (microturbine), and a controllable load (electrolyzer). Various interconnection configurations of the MGs and the UG were

Conclusions
This work developed the simulation model of a multi-MG system, which included several distributed generation resources, loads, a controllable power generator (microturbine), and a controllable load (electrolyzer). Various interconnection configurations of the MGs and the UG were considered. Using MATLAB/SIMULINK and genetic algorithm, we optimized the controller parameters to minimize frequency deviation when the MGs were in island mode. In the grid-connected mode, the frequency