Optimal Power Management of Interconnected Microgrids Using Virtual Inertia Control Technique

: Two interconnected AC microgrids are proposed based on three renewable energy sources (RESs): wind, solar, and biogas. The wind turbine drives a permanent magnet synchronous generator (PMSG). A solar photovoltaic system (SPVS) with an appropriate inverter was incorporated. The biogas genset (BG) consists of a biogas engine coupled with a synchronous generator. Two interconnected AC microgrids, M 1 and M 2 , were considered for study in this work. The microgrid M 2 is connected to a diesel engine (DE) characterized by a continuous power supply. The distribution power loss of the interconnected AC microgrids comprises in line loss. The M 1 and M 2 losses are modeled as an objective function (OF). The power quality enhancement of the interconnected microgrids will be achieved by minimizing this OF. This research also created a unique frequency control method called virtual inertia control (VIC), which stabilizes the microgrid frequency using an optimal controller. In this paper, the following five controllers are studied: a proportional integral controller (PI), a fractional order PI controller (FOPI), a fuzzy PI controller (FPI), a fuzzy fractional order PI controller (FFOPI), and a VIC based on FFOPI controller. The five controllers were tuned using particle swarm optimization (PSO) to minimize the (OF). The main contribution of this paper is the comprehensive study of the performance of interconnected AC microgrids under step load disturbances, step changes in wind/solar input power, and eventually grid following/forming contingencies as well as the virtual inertia control of renewable energy resources used in the structure of the microgrids.


Introduction
The rapid growth of renewable energy sources (RESs) in recent years has been attributed to the growing concerns about environmental factors, greenhouse gases (particularly CO2), and global warming.As a result, numerous issues with the integration of renewable energy into networks as well as their solutions have been discussed in the literature.The primary traits of RESs that make it difficult to integrate them with the grid and the load are the intermittent availability of the input source, which results in extremely intermittent power, inconsistent power output and low flux density, meaning they require more space per unit of power generation than conventional generators, and low inertia.
RESs, such as SPVSs (solar photovoltaic systems) and WECSs (wind energy conversion systems), have lower inertia than conventional sources, limiting the grid's potential to improve stability.
Various integrations of RES sources and their data have been discussed in the literature.The stability of microgrids is of particular interest.Many authors [1] have discussed and introduced some aspects of microgrids in the literature.Sustained low frequency deviations, as studied in [2][3][4], are one of the problems in microgrids.Another issue in microgrid systems is voltage control [5,6].There is literature that solves these problems separately and jointly.Because of the intermittent nature of solar and wind power, a backup is required.One of the proposals made in [7,8] is inverter-connected battery backup.The other option is a connected diesel/biogas power plant [9].In a wind-solar-a diesel system, many control strategies are implemented using various optimizing techniques [10][11][12].Some proposals on AC and DC microgrids have been made [13,14].Furthermore, the rate of generation deviation in SPVS is extremely high due to cloud changes [15].An inverter connects the SPVS's PV plant to the power system.As a result, control of the PV unit is provided by inverter control [16].
Due to its aerodynamic properties, a wind turbine's output power is proportional to the square of the rotor diameter and the cube of the wind speed [17].In WECSs, a permanent magnet synchronous generator (PMSG) is frequently used.PMSGs, however, are reliable and do not require a separate field control system [18].Power inverters connect SPVSs and WECSs to the point of common coupling (PCC).Additionally, the network receives virtual inertia from the associated inverter [19].There is literature that demonstrates how the virtual inertia of WECSs and SPVSs, which is based on inverters, can almost act as conventional generators that can be employed for power grid dynamic stability.However, it is necessary to keep an energy buffer [20].
As the fuel input for a BG-based Genset can be regulated, a biogas Genset (BG) and diesel Genset may be utilized as the controlled generating unit for a low power network, such as an SPVS and WECS.In the last decade, urban electrification has advanced dramatically.Electrification has occurred in developing countries, but uninterrupted power supply remains a problem.These areas have been without power for some time.The primary causes of disrupted power supply are insufficient grid supplies, reliance on conventional generation, long-length transmission, and the value of urban and industrial parts [21,22].The authors presented numerous microgrid methods based on a review of the literature.However, it was not reasonable to donate an interconnected self-sufficient city with power availability relying on load segregation and setting the priority loads.To ensure an uninterrupted power supply, a stability enhancement for interconnected microgrids has been proposed to observe network dynamics while transferring power among both microgrids.
The importance of reducing power loss in the production of electricity is being emphasized in another effort to reduce CO2 emissions and the effects of global warming.As a result, there is little heat produced.The amount of heat that needs to be cooled is modest [23][24][25], so in theory energy conservation can further reduce the price and energy used by the cooling apparatus.To minimize online power loss, it is possible to determine the ideal reference voltage [26] and the best power flow [27,28] for each microgrid.An offline optimization approach [29] is offered to improve the load sheading machine's working point and reduce loss, but using an offline solution requires optimum operational conditions with little to no variable change.Meanwhile, power converter losses are given consideration.
In the AC microgrid, the converter loss may account for more than half of the total distribution loss [30].Therefore, incorporating it into the control structures would significantly reduce the distribution power loss.In [31], a function of active and reactive power was almost perfectly suited to the entire distribution power loss of two connected AC microgrids.The active and reactive power of each generation unit was then divided using the optimization algorithm.The objective function of the power loss of each generator unit and the AC link between two areas was used to estimate the overall distribution power loss of two interconnected AC microgrids, which includes line loss and power loss of each region.In order to meet the need of the load according to the objective function, you should also think about splitting power between two locations.Therefore, by offline adaptively modifying the controller's optimal settings, the minimization of the distribution loss can be achieved.
A distributed optimization approach for global distribution loss minimization is given with power sharing across generation units [32,33].The findings of the simulation support the proposed control method for lowering the distribution power loss of two connected AC microgrids.
The final difficulty is enhancing the frequency of the microgrid under the conditions of the significant penetration of renewable energy sources.Installing low-inertia power generation units through fast-acting energy storage systems (ESS) with virtual inertia controllers, which have been the subject of much recent research [34][35][36][37][38][39][40][41], is one approach.Every control method has advantages and limitations of its own.The microgrid system's position enables ideal energy management.To maximize power flow inside the setup, a local energy management system may control generators (and presumably also loads).Depending on the kind of operation, several objectives are set for energy management: grid-connected or an island [42].The typical goals in the grid-connected mode are to reduce the price of the energy import at the PCC, advance the power factor at the PCC, and optimize the voltage profile through the microgrid [43].The primary objectives of power management in the islanded mode, as described in [43], are system improvement and the encouragement of a high frequency and voltage flexibility.We concentrated on a virtual inertia control method intended to reduce frequency deviation issues in islanded AC interconnected microgrids as opposed to the following thorough reviews, which concentrated on the implementation of virtual inertia topologies [41], virtual inertia and frequency control for distributed energy generation units [44], and inertia valuation improvement in power systems [45].In particular, we sought to explain why specific control methods are more effective under various circumstances and which control methods will receive greater attention in the coming years.Finally, we suggest some analyses for the AC interconnected microgrid applications' use of the virtual inertia control approach.In this paper, five controllers, i.e., a proportional integral controller (PI), a fractional order PI controller (FOPI), a fuzzy PI controller (FPI), a fuzzy fractional order PI controller (FFOPI), and a VIC based on FFOPI, are used for controlling the frequency, voltage, and optimal power management of two interconnected microgrids.The optimal parameters of the controllers were optimized using particle swarm optimization (PSO).The objective function was considered to be the multi-objective function of integral time square error (ITSE) of the frequency, voltage, and the total distributed power loss of the two AC interconnected microgrids.This model was developed based on realistic city generation availability and was tested in a typical scenario.
Despite the rich literature review, and much research dealing with power quality enhancement in interconnected microgrids, the contributions of this paper are manifold.(a) The novelty of this modelling, in contrast to [22], is demonstrated to achieve the sharing of the active and reactive power of both generation units and between both microgrids through a tie line to guarantee the conception of an uninterrupted power supply.(b) The novelty of this work, in addition to [22,26,28], is demonstrated to achieve optimal power management for two areas' interconnected hybrid microgrid systems by using a multiobjective function equation for minimizing voltage deviation, frequency deviation, and the total distribution power loss of the AC interconnected microgrid.(c) In addition to [38], the proposed ESS based on virtual inertia control is a grid-forming element that can operate with an RES without requiring conventional energy sources.As a result, it improves the supply reliability during grid forming unit outages and solves the frequency regulation problem in islanded AC interconnected microgrids.(d) In addition to [46,47], under step load disturbances, step changes in wind/solar input power, and severe disturbances such as eventual grid following/forming contingencies, the improvement of the system performance using a PI, FOPI, FPI, FFOPID, and VIC based on FFOPI controllers for mitigating frequency and voltage oscillation and achieving optimal power management in two AC interconnected microgrids with a multi objective function is investigated.(e) The PSO technique is utilized to automatically optimize the controller parameters while considering the system nonlinearity, converters and line dynamics, and the interaction components.This technique helps to reduce design work and costs.Additionally, any other optimization technique may be employed in future work to be compared with the PSO technique.This paper is organized as follows: In Section 2, the system under study and the mathematical modelling of the individual components system is explained.A study of the stability and power quality enhancement problems are discussed, and the utilized multi-objective function is stated, in Section 3. FPI and FFOPI block diagrams, membership functions, and rules are presented in Section 4, and virtual inertia control is proposed in Section 5.The optimization technique PSO is used in the optimization of five controller parameters in Section 6.The results and discussions are given in Section 7. Finally, Section 8 provides an overview of the provided work's conclusions.The appendix contains the system parameters, a list of symbols, and a list of abbreviations.

System under Study and Mathematical Modelling of the Two Interconnected Microgrids Component
The connected system is modelled under the presumption that microgrid M1 has 50 kW of excess power that is sent to microgrid M2.Under any circumstance, a steady-state variation in the power delivered over the interconnection occurs.Changes in demand or generation are handled locally by the microgrid systems.Figure 1 is a single line diagram (SLD) that shows the interconnected microgrid system.Equations ( 1) and ( 2) can be used to express the real and reactive power balance at a steady state.

𝑃 = 𝑃 + 𝑃 + 𝑃 + 𝑃 ± 𝑃
(1) Equations ( 1) and ( 2) can be expressed as follows for a minor disturbance in power flows: Real power demand and generation changes would affect the system's frequency, which in the Laplace domain can be expressed as follows: The system bus voltage changes as a result of a change in the reactive power mismatch, as shown by:

Modelling of WECS with PMSG
A wind turbine with a permanent magnet synchronous generator that is connected to the common bus by a transformer and an AC/DC/AC power electronic interface was considered as a WECS.An easy line diagram is displayed in Figure 2. The real and reactive power flow equations are described by [22].
In the Laplace domain, a slight disturbance in power flows can be expressed as: ´ () =   () +  () +   +   () (10) where, The system's inertia is credited with the delay as: The block diagram of the WECS can be created using Equations ( 9)-( 12), as shown in Figure 3.

Modelling of a Solar PV System with an Inverter (SPVS)
A PV panel generates direct current as its form of power.Therefore, power is routed through a DC/DC/AC power electronic interface before connecting to the common bus, and it is then connected to the bus by a transformer.In Figure 4, the SLD figure is displayed, as in the case of the WECS.The following are the power flow equations that take into account internal reactance (XTPV) are described by [22]: where

and 𝐾 =
The delay due to inertia of the system is accounted as: Using Equations ( 15)-( 18), the transfer function block diagram of SPVS can be constructed as shown in Figure 5.

Modelling of BG
The BG model is based on [22].Figure 6a The voltage regulation operation of the AVR (automatic voltage regulator) and exciter is responsible for controlling reactive power in biogas (Figure 6).The equations for real and reactive powers are obtained and provided by considering the dynamic state after disregarding the saturation function: where  = ´ ´ ,  = ´ ,  = ´ ( ) ,  = ( ) ´ and  = ´ ( ) ´

Modelling of DE
In a power-controlled DE system, the energy delivered daily is left unchanged but with a lowered, consistent, and continuous power supply.This keeps the power given by the diesel engine constant during the time period.
Following a perturbation, Equations ( 21) and ( 22) can be written as: where , and  =

Modelling of AC Interconnection
The interconnection was modelled taking into account an AC short transmission line.The line cannot be regarded as lossless because of its high R/X ratio.Figure 7 displays the AC line's transfer function block diagram.Such a line's source of power flow is: where  is the line's angle between Ra and X and ϕ12 is the difference between the voltage angles of bus 1 and bus 2. The Laplace domain Equations ( 25) and ( 26) have the following form for a minor perturbation: The microgrids were modelled using the above individual models of generation units.The data for microgrid M2 was taken from [22,23] and the data for M1 arose from slightly changing the data for M2.Four medium-sized villages, each of which is anticipated to use roughly 1600 kW of electricity, are served by M2, which was created to satisfy their demands.M2 has a maximum diversity demand of 1000 kW.(approx.).The power supply has a frequency of 50 Hz and a rated voltage of 1 pu.The M1 model was created for a group of both tiny and medium sized settlements.M1 has a nominal generating capacity of 1150 kW and a maximum demand capacity of 700 kW, 50 Hz, and a rated voltage of 1 pu.Table 1 shows the steady state generation characteristics of the two microgrids.In total, 50 kW of continuous power are transmitted through an AC link from the M1 microgrid to the M2 microgrid, and, after losses, 40.6 kW are delivered to the M2 microgrid.Table 2 provides a summary of the total power consumption, the power transfer from the AC link, and the generation from all the generating units in M1 and M2.The novelty of this modelling, in contrast to [22,23], is demonstrated to achieve the sharing of active and reactive power together for the wind and solar generation units s well as between both microgrids to guarantee the conception of an uninterrupted power supply through a continuous generation-demand balance.

Fuzzy PI (FPI) and Fuzzy Fractional Order PI (FFOPI) For Interconnected Microgrids
The FPI controller has three coefficients, with these three being the normalized gains K1, K2, and K3, as shown in Figure 8a, whereas the FFOPI controller has four coefficients, with three of them being the normalized gains K1, K2, and K3 and one being a fractional order control system λ, as shown in Figure 8b.The FPI and FFOPI have two inputs named error  and rate of change of error  and one output.PSO was used to make offline tuning for the three parameters for the FPI and four parameters for the FFOPI of each controller on the six controllers that are associated with each microgrid and the three controllers responsible for tie lines between them.There are fifteen controllers in the two AC interconnected microgrids.PSO was used to search the optimized parameters of the FPI and FFOPI controllers to minimize the objective function according to the following equation: The fuzzy logic (FLC) rules are listed as follows in Table 3. Figure 9 show the membership of output and input, where N = negative, p = positive, SP = small positive, Z = zero, SN = small negative, LP = large positive, and LN = large negative [47].Any crisp value is defined in two fuzzy sets thanks to the uniform distribution of the input sets, which are triangle and cross neighbor sets with a membership value of 0.5.For ease of defuzzification, the output membership functions are assumed to be uniformly distributed singletons.
The first phase in the design method was to transfer the PI and FOPI gains to the linear fuzzy controller by replacing the known PI and FOPI with a linear FPI and linear FFOPI.According to the feed-back error signal e(n), the traditional PI controller and FOPI controller signal u(n) at any given time instant n can be stated either in absolute form, as in Equations ( 30) and (31), or incremental form, as in Equations ( 32)- (34).
where, Ts is the sampling period, Kp and KI are the proportional and integral gains, respectively, and λ is the integral fractional order control system.The most often used defuzzification technique uses the concept of the center of gravity and is expressed as follows: where u(ui) represents the element's membership grade or weight, which is the result of the rule i.

Multi-Objective Function for Interconnected Microgrids
Numerical simulations were used to demonstrate the stability study (SS) in two interconnected systems for a disturbance, such as an increase in real and reactive power demand in both microgrids by each one, increased wind speed, solar radiation, and emergency/recovery from generation.The five controllers can reduce the step disturbance-induced steady-state error in frequency and voltage in the interconnected microgrids.The distribution power loss (DPL) in two interconnected microgrids is composed of eight parts: three parts for the first microgrid, which includes the power loss from the wind, PV, and biogas sources; four parts for the second microgrid, which includes the power loss from the wind, PV, biogas, and diesel engines; and one part for the AC interconnected line power loss.The average conduction losses of the PMSG, rectifier, inverter, and transformer are included in the wind power loss, whereas the average conduction losses of the DC-DC converter, inverter, and transformer are included in the PV power loss, the average conduction losses of the synchronous generator are included in the BG power loss, the average conduction losses of the diesel engine and transformer are included in the DE power loss, and the average conduction losses of the tie-line impedance are included in the line power loss.The distribution power loss of two interconnected microgrids is given by: To guarantee power quality enhancement, the OF must include two terms.The first term will achieve stability study by minimizing the OF based on ITSE criteria for the voltage and frequency of two interconnected microgrids.The second term will achieve optimal power flow by minimizing the OF based on ITSE criteria for the DPL of two interconnected microgrids.The five controllers' parameters are tuned using the PSO algorithm for minimizing the OF based on ITSE criteria for the voltage, frequency, and distribution power loss of two interconnected microgrids, as shown in Equation (39), and the tuned values are listed in Tables 4-6.

Virtual Inertia Control for Interconnected Microgrids
The substitute power for the real synchronous machine is provided by the virtual synchronous generator (VSG) [35,39].In networks with a significant amount of renewable energy, this generator can be employed to increase the frequency stability.A particular VSG component known as a virtual inertia (VI) is used to make up for a lack of inertia via a power injection approach.Active frequency support is not possible due to the limitations of the virtual inertia mechanism.To handle nonlinearities in low-inertia systems, an extra robust controller is therefore required.The virtual inertia control structure (Figure 10) contains a derivative unit, a designed controller FFOPI, virtual inertia control (energy storage system and virtual inertia variable gain), and a power limiter ( , ,  , ).The energy storage system (ESS), which may offer frequency smoothness and balance for subsequent dispatch, has emerged during the past ten years as a crucial component in renewable energy networks.The following characteristics of the ESS model are distinguishable: Using the ITSE criteria, the FFOPI controller is set to minimize the OF.According to the ITSE requirements and as given in Equation (38), the PSO algorithm is used to optimize the FFOPI controller's parameters.Tables 7-9 include information on the FFOPI's tuned gain parameters.PSO also gives the values of Kv1, Tv1, which are 0.8 and 10, respectively.13.85 0.8968

Particle Swarm Optimization (PSO)
PSO replicates a swarm's collective activity when looking for food.The method is an iterative procedure that seeks to locate a solution within a search space that fulfils a fitness function [48].The inherited composite nature, however, has been updated in various ways by PSO [46].The PSO method is predicated on the idea that particles update their location and velocity after each iteration.As a result, with each iteration k, the current position X is modified in accordance with the particle's new velocity using the personnel best (PB) and the global best (GB), as shown in Equations ( 40) and (41), respectively.
For the suggested PI, FOPI, FPI, FFOPI, and VIC based on FFOPI controllers, the PSO was employed in this study to improve controllers' parameters.Figure 11 depicts the PSO flow chart for the suggested application on the microgrid.Section 4 provides a thorough illustration of the objective function (j).The parameters for the optimization method are population = 50; iterations = 70; velocity clamping factor v = 2; cognitive C = 2; social constant C = 2; minimum inertial constant w = 0.4; maximum inertia constant w = 0.9.The PSO method has only been suggested for results analysis.Additionally, any other optimization technique may be employed without greatly affecting on the results.

Result and Discussion
The stability study, optimal power management, and virtual inertia control of the proposed interconnected two microgrids using five controllers based on PSO through a multi-objective function that were investigated by each controller include multiple disturbances.Each controller includes load disturbances, wind speed variation, solar radiation variation, and contingency/recovery of generation.The simulation results of the studied microgrid were carried out using MATLAB/Simulink software.The PI, FOPI, FPI, FFOPI and VIC based on FFOPI controllers using PSO through a multi-objective function will be discussed for each disturbance.The data of the system considered for simulation studies is given in the Appendix A.

Increasing Wind Speed with Load Variation Disturbance
The overall power generated on the microgrid increases as a result of the increased wind speed output power.This variance results in a power differential between the power that is generated and that which is needed, which may affect the microgrid's power management and frequency.In this scenario, the wind speed is suddenly increased by 1% in both microgrids at zero seconds while the load change demand is maintained at 0.01 pu.Without VIC, the inertia of the BG and the virtual inertia of the inverter coupled to the PVS and WECS balance out the energy imbalance.Contrarily, with VIC, the energy imbalance is balanced by the BG's inertia, the virtual inertia of the inverter connected to the PVS and WECS, and then the ESS of VIC, which supports the frequency during the period of disturbance until the BG's isochronous governor reacts to restore the steady-state frequency, thereby improving the frequency response.The change in the frequencies and voltages of microgrids M1 and M2 are shown in Figure 12.The dynamic specification (settling time (Ts), overshoot (Os), and undershoot (Us)) of frequencies and voltage deviation at each controller can be summarized in Table 10.
From Table 10, after the comparison of the five controllers, the VIC based on FFOPI minimizes overshoots Os and undershoots Us, improves system stability, and reduces the settling time Ts of the system for frequency deviation of both interconnected microgrids and, as a result, employs VIC based on FFOPI, which offers a superior response in terms of frequency enhancement compared to other controllers.Table 11 demonstrates the power-sharing of each generating unit in two microgrids at each controller, balancing for the power differential during this disturbance through a multi-objective function which supports the minimum total power loss.The investigation of Figures 13 and 14 can be justified in Table 11.Due to the increase in wind speed disturbance, the new value of the change in the active power of the WECS for both microgrids, M1 and M2, equals (0.01 * Pw) added to the change in the active power of the WECS at step load change only without wind speed disturbance.As can be seen from Table 11, the ESS acts through VIC as a load to support the frequency.Equation ( 38) can be used to calculate the power loss of two interconnected microgrids, and the results are 7.6 × 10 −9 for the PI controller, 2.7 × 10 −9 for the FOPI, 1.96 × 10 −11 for the FPI, 6.3 × 10 −12 for the FFOPI, and 2.2 × 10 −13 for the VIC based on FFOPI due to the minimum value of power sharing (ΔPIC and ΔQIC) through the tie line at the VIC case.As a result, the best frequency performance and the optimal power flow are achieved in the case of the VIC based on FFOPI controller.

Increasing Solar Radiation with Load Variation Disturbance
The overall power generated on the microgrid increases due to an increase in solar radiation output power.With this variance, there is a power differential between the power that is generated and the power that is demanded, which may affect the microgrid's frequency and power management.In this scenario, the solar radiation is abruptly increased by 1% in both microgrids at zero seconds while the load fluctuation demand is maintained constant at 0.01 P.U.
Without VIC, the inertia of the BG and the virtual inertia of the inverter coupled to the PVS and WECS balance out the energy imbalance.While using VIC, the energy imbalance is balanced by the BG's inertia, the inverter's virtual inertia when connected to the PVS and WECS, and then the ESS of VIC, which supports the frequency during a disturbance period until the BG's isochronous governor reacts to recover the steady-state frequency.Figure 15 shows the change in frequencies and voltages of microgrids M1 and M2.The dynamic specification (Ts, Os, and Us) of frequencies and voltage deviation at each controller can be summarized in Table 12.As can be seen from Table 12 and a comparison of the five controllers, the VIC based on FFOPI provided the best response properties in terms of the Ts, Os, and Us of the system for both frequency deviations of the two interconnected microgrids.As a result, using VIC based on FFOPI offered a better response in terms of frequency enhancement when compared to the other controllers.
Table 13 show how the power-sharing of each generation unit in M1 and M2 at each controller compensate for the power imbalance during this disturbance through a multiobjective function to minimize the total power loss.The investigation of Figures 16 and 17 can be justified in Table 13.Due to the increase in solar radiation disturbance, the new value of the change in the active power of the SPVS for both microgrids M1 and M2 equals (0.01 * PPV) added to the change in the active power of the SPVS at step load change only without solar radiation disturbance.As can be seen from Table 13, the ESS acts through VIC as a load to support the frequency.The power loss of the two interconnected microgrids can be calculated using Equation (38), which resulted in 7.5 × 10 −9 in the case of the PI controller, 2.7 × 10 −9 in the case of the FOPI, 1.6 × 10 −11 in the case of the FPI, 7.3 × 10 −12 in the case of the FFOPI, and 7.1 × 10 −14 in the case of the VIC based on FFOPI due to the minimum value of power sharing (ΔPIC and ΔQIC) through the tie line at the VIC case.So, the VIC based on FFOPI controller provided a superior response with respect to frequency enhancement and optimal power managements compared to the other controllers.

Contingency Event Disturbances Analysis
In this section, the microgrid was subjected to a large disturbance that resulted in a severe power imbalance, impacting on the frequency and power response as well as a brief outage of the tie line.
Case1: Disconnecting the Tie Line with Load Variation Disturbance Other severe disturbances include the sudden outage of the tie line, which prevents power from transferring from one microgrid to another.Each microgrid is in charge of satisfying the demand load at its PCC.The tie line between two microgrids is activated at zero seconds in a sudden outage, while the load change demand is maintained at 0.01 pu throughout the simulation period.This variance results in a power differential between the power that is generated and that which is required, which may affect the microgrid's power management and frequency.
The inertia of the BG and the virtual inertia of the inverter instantly linked to the PVS and WECS of each microgrid correct for the frequency variation.However, employing the ESS could improve stability during a disturbance period until the BG's isochronous governor intervenes to restore the steady-state frequency.Figure 18 displays the variations in frequencies and voltages of microgrids M1 and M2.The dynamic specification of frequencies and voltage deviation at each controller can be summarized in Table 14.As can be seen from Table 14 and a comparison of five controllers, the VIC based on FFOPI minimizes the Os and Us, improves system stability, and reduces the Ts of the system for both frequency deviations of the two interconnected microgrids; as a result, employing VIC offered a superior response in terms of frequency enhancement compared to the other controllers.
Table 15 illustrates the power-sharing of each generating unit in two microgrids at each controller balance for the power imbalance during this disturbance through a multiobjective function which supported the minimum total power loss.Table 15 facilitates the investigation of Figure 19.As can be seen from Table 15, the ESS acts through VIC as a load to support the frequency.Equation (38) can be used to calculate the power loss of two interconnected microgrids, and the results are 8.9 × 10 −11 for the PI controller, 9.97 × 10 −13 for the FOPI, 1.6 × 10 −13 for the FPI, 6.4 × 10 −15 for the FFOPI, and 1.6 × 10 −15 for the VIC based on FFOPI.As a result, the best frequency performance and the optimal power flow are achieved in the case of the VIC based on FFOPI during the disturbance of disconnecting the tie line.
Based on the analysis of the total power loss at each disturbance, the magnitude of the total power loss of two interconnected microgrids at disconnected tie line disturbance is smaller than the magnitude of the total power loss at wind speed disturbance and solar radiation disturbance due to the lossless power of the tie line in the event of a disconnected tie line disturbance.

Conclusions and Perspectives
The need for clean but intermittent energy sources, as well as for power, is increasing in growing countries.Power delivery that is reliable and constant is extremely difficult.The use of microgrids has been suggested as a solution to the problem of grid outages.There were two types of microgrids taken into consideration, one without diesel engine support and the other with diesel engine support.The microgrid M1 was without diesel engine support, while the microgrid M2 had diesel engine support.An AC short transmission line was used to connect these two microgrids.It was suggested that additional power produced in M2 is transmitted to M1 to maintain a steady supply of electricity for the group of villages represented by M2.Photovoltaic (PV) modules, a WECS, and biogas gensets are all forms of renewable energy sources found in the microgrids M1 and M2.In order to achieve optimal power management in two AC interconnected microgrids and to improve frequency stability, VIC was used to compensate for the lack of inertia using a power injection mechanism through a multi-objective function when subjected to different disturbances of wind speed variation, solar radiation variation, load variation, and generation contingencies.The paper investigated how to tune PI, FOPI, FPI, FPI, FFOPI, and VIC based on FFOPI controllers using PSO to mitigate frequency and voltage oscillation.
Power imbalances between generated and consumed energy can result from variations in wind, solar, and other energy sources, which can affect the microgrid's frequency and power management.The inertia of the BG, the virtual inertia of the inverter connected to the PVS, and a WECS in the absence of VIC all work together to balance out the energy imbalance.But when VIC is present, the compensatory method used in the absence of VIC is followed by the ESS's virtual inertia control, with the ESS acting as a load to support the frequency.The best power-sharing between each generating unit is used in each controller to compensate for the power differential during disturbances through a multi-objective function, with the smallest value being recorded for total power loss in the case of VIC based on FFOPI controller, compared to the other controllers, due to the minimum value of power sharing (ΔPIC and ΔQIC) through the tie line at the VIC case.The results demonstrate that, in comparison to the other controllers, the VIC based on FFOPI controller achieves the greatest frequency performance and the optimal power flow.
The dynamics of the system can be significantly impacted by the severity of contingencies.Due to the inertia of the BG and virtual inertia of the inverter connected to the PVSS and WECS of each microgrid in the case of an outage of the tie line, an outage of the tie line without VIC affects microgrid stability but not a factor in microgrid instability.The VIC based on FFOPI controller provided a reaction that is superior in terms of frequency enhancement and optimal power management compared to the other controllers.However, using the ESS could enhance the stability during the disturbance period until the BG's isochronous governor responds to return the frequency to steady-state.The power imbalance during contingency disturbance is balanced by the optimal power-sharing of each generation unit at each controller through a multi-objective function which supported the minimum total power loss in the case of the VIC based on FFOPI controller.
The voltages and frequencies of both microgrids fluctuate within the allowable limits and then settle with zero steady-state error following a disturbance within 0.5s with less overshoots/undershoots (3.7e-5/−0.12e-3)using FFOPI based on VIC, which validates the

Figure 6 .
Figure 6.(a) Block diagram of real power generation of biogas and (b) block diagram of reactive power generation of biogas.

Figure 7 .
Figure 7. Transfer function block diagram of AC line.

Figure 10 .
Figure 10.Typical structure of a virtual inertia control block.

Table 1 .
Steady-state generation values for both microgrids.

Table 2 .
Energy balance at a steady state in both microgrids.

Table 6 .
Controller gains of AC line for PI, FOPI, FPI, and FFOPI controllers.

Table 7 .
FFOPI controller gains of microgrid system M1 in the case of VIC.

Table 8 .
FFOPI controller gains of microgrid system M2 in the case of VIC.

Table 9 .
FFOPI controller gains of AC line in the case of VIC.

Table 10 .
Dynamic specification of frequencies and voltage deviation for each controller at wind speed disturbance.

Table 12 .
Dynamic specification of frequencies and voltage deviation for each controller at solar radiation disturbance.

Table 13 .
Power flow in pu of microgrid system M1 and M2 for each controller at solar radiation disturbance.

Table 14 .
Dynamic specification of frequencies and voltage deviation for each controller at disconnecting tie line.

Table 15 .
Power flow in pu of microgrid system M2 and M2 for each controller at disconnecting tie line.