Energy Management System in Microgrids: A Comprehensive Review

: As promising solutions to various social and environmental issues, the generation and integration of renewable energy (RE) into microgrids (MGs) has recently increased due to the rapidly growing consumption of electric power. However, such integration can affect the stability and security of power systems due to its complexity and intermittency. Therefore, an optimal control approach is essential to ensure the efﬁciency, reliability, and quality of the delivered power. In addition, effective planning of policies for integrating MGs can help promote MG operations. However, outages may render these strategies inefﬁcient and place the power system at risk. MGs are considered an ideal candidate for distributed power systems, given their capability to restore these systems rapidly after a physical or cyber-attack and create reliable protection systems. The energy management system (EMS) in an MG can operate controllable distributed energy resources and loads in real-time to generate a suitable short-term schedule for achieving some objectives. This paper presents a comprehensive review of MG elements, the different RE resources that comprise a hybrid system, and the various types of control, operating strategies, and goals in an EMS. A detailed explanation of the primary, secondary, and tertiary levels of MGs is also presented. This paper aims to contribute to the policies and regulations adopted by certain countries, their protection schemes, transactive markets, and load restoration in MGs.


Introduction
Increasing energy demand is a key indicator of economic growth and social development. Such demand has been growing exponentially in various sectors, such as in the transportation, building, and manufacturing industries. However, energy consumption is directly linked to environmental issues due to the frequent use of fuel or coal as the main electricity generation sources that emit greenhouse gases (GHG). Therefore, many global actors, including the World Bank, are encouraging countries to generate clean energy by financially supporting their projects [1].
Renewable energy (RE) is an important energy source with an abundant supply in nature. RE is less carbon-intensive and more sustainable than traditional energy sources, hence explaining its growing popularity. Such green energy resources not only have limited impacts on the environment but also contribute to energy savings and reduce the dependence of industries on fossil fuels. Accordingly, many countries have promoted Ref Details [10] Addressed the issues affecting DC MG safety from different aspects, such as fault location detection, and evaluated some protective devices. [11] Comprehensively reviewed the stability issues being faced by MGs based on extant definitions and classifications of stability and illustrated these issues as modeling examples. [12] Examined the existing MG architectures in detail, and demonstrated the widely distributed technologies along with their advantages and disadvantages. [13] Highlighted several issues, challenges, and solutions related to the protection of an AC MG. [14] Represents features of, and the large-disturbance stability that prevails for, a power-converter-dominated MG, with some stability analysis highlighted. [15] Comprehensively reviewed the main components, size, and energy management of harbor MGs.
This work Comprehensively reviews the operation strategies and objectives used in EMSs and explains the architecture and elements of an EMS in an MG.
model for the massive integration of different DERs will solve the technical problems in traditional centralized distribution. The majority of the DERs that can be connected to an MG cannot be directly integrated into the power system due to the type of power they produce. Therefore, power electronic interfaces, such as inverter controls, are necessary. Moreover, an MG is guaranteed to operate continuously during normal operations and critical cases [17]. The MG central controller (MGCC) is considered the brain of an MG, responsible for enhancing its performance, calculating the optimal values, achieving some objective functions in consideration of the constraints, conducting additional operations based on the electricity and gas prices in the market, shouldering extra costs (e.g., for DER startup), and performing weather forecasting to ensure an optimal power generation. The MGCC also controls the loads in an MG by adequately managing the stability of the power system. The following subsections explain the different technologies and architectures that may be integrated into an MG installed in a power system [18].

Microgrid Elements
Different power technologies, such as DGs and ESSs, are characteristic attributes of MGs. This section discusses some technologies that have been developed to be integrated into MGs.

Distributed Generators
DGs are defined by the Institute of Electrical and Electronics Engineers Inc. (IEEE) as "The generation of electricity by facilities sufficiently smaller than central generating plants as to allow interconnection at nearly any point in a power system. DGs are a subset of distributed resources" [19].
DGs are dispatchable generating units, including fuel cell and diesel generators, or non-dispatchable generators, such as PV plants and wind turbines stations, that are placed at loading sites. The application of these generators is becoming increasingly popular given their role in satisfying the demand of consumers. These units are deployed to improve the efficiency and cleanliness of power generation by using RE resources. Deploying DGs can increase the resilience of a power system by supporting the growth of different resources for the partial distribution of power; for example, a natural disaster may result in largescale outages, and using diverse DGs will ensure that the power system will not be impacted by such phenomenon [20]. Meanwhile, integrating DERs into the distribution network improves the voltage profile, reduces line loss, and lowers power generation costs. These DGs can provide AC power outputs, such as combined heat and power (CHP), fuel cells, and gas turbines, or DC outputs, such as wind turbines or PV. Therefore, DGs comprise inverters that convert their output to suit the specifications of a power system. The capacity of DGs is also related to space and time [21]. Table 2 presents some DG technologies used in MGs.  [22] [23] [24] [25] [26] [27] [28] [29] [30] [31] [32] [33] [34] 1 Combined Heat and Power, 2 Diesel Generator, 3 Gas Generator, 4 Fuel Cell, 5 Microturbine, 6 Photovoltaic, 7 Hydropower, 8 Wind Turbine, 9 Tidal.

Energy Storage Devices
An MG has a slight generating capability given that some DGs, such as RE resources, can change the output power and pose technical challenges [35]. Therefore, MGs require an energy storage system (ESS) to solve mismatch problems and suit the power system requirements. ESSs can store and provide surplus energy when needed. These systems can also promote the reliability of the power system, improve the performance of an MG, achieve power balance among end-users, and reduce peak demand. ESS devices also satisfy mismatched energy requirements to ensure a continuous energy supply [36].
ESS technologies have promising uses in MG deployment. Konstantinopoulos et al. [37] used hydrogen for production and storage, given that the power generated from RE resources is assumed to exceed the power demand. Hou et al. [38] integrated hybrid energy storage into MG and used flywheel storage to allow the application of two strategies in the system. Mousavi et al. [39] proposed a novel design for storing surplus energy by using a hydro pump to ensure the efficient performance of MGs in rural areas. Jia et al. [40] used ultracapacitor storage to minimize the total costs and applied the charging/discharging method to manage the power storage. Guo et al. [41] integrated lead-acid batteries into a standalone MG model to minimize the total net present cost and carbon dioxide emissions. Table 3 summarizes the various ESSs that have been studied in the literature. Table 3. Reviews/surveys relating to ESSs.

Ref
Details [42] Comprehensively reviewed the challenges, modeling approaches, and estimation of impact on market structures when utilizing energy storage. [43] Presented an overview of the applications of ESSs, which may introduce challenges to MGs. [44] Comprehensively reviewed the most recent ESS innovations in MG technologies, including the concepts and optimization techniques, architectures, control techniques, future trends, and challenges in ESSs. [45] Addressed some factors in sizing of the ESSs in MGs and various applications through the integration with RE.
[46] Presented a comprehensive techno-economic analysis of the battery storage system under various MG system configurations.
Regardless of their advantages, ESS technologies have not been used in MG applications given some limitations, their cost, and their difficulty to control. Table 4 presents the limitations, advantages, disadvantages, and generation costs of each DER technology during MG operation. DGs and ESSs can supply either electrical or thermal loads. The defined loads are treated as input parameters in scheduled energy management studies where the load profiles change according to the activities of customers and the weather conditions. The loads in MGs are classified into critical and non-critical loads, of which the latter does not require DERs to be connected to their buses or local generators. These loads should have the potential to disconnect during emergency cases to preserve balance in the power system. Meanwhile, critical loads are a very sensible and high priority; some of these loads, includ-ing commercial and industrial loads, need to be supplied continuously, whereas others can be connected individually to DERs [47].

Additional Elements
An MG must conduct power management and ensure controllable load sharing. Intelligent circuit breakers are required in an MG to manage and control the interconnection. Most intelligent circuit breakers are located in the point of connection between the MG and the rest of the DERs, and may apply certain techniques, such as power switching, protective relaying, metering, and communication. The interconnection breakers should meet the general standards, such as the IEEE 1547 and UL 1741 in North America, to ensure the safe operation of MGs and to enable the application of DERs or power converters [48].
Power converters, such as intelligent inverters, are used in MGs to ensure their efficient and autonomous operation with limited capacity which is managed via the AC/DC conversion, or vice versa. These converters serve as the interface between the energy generation resources and the end-user, and are utilized to manage, form, and feed the power system. The different technologies described above need to share information with one another before taking the prerequisite actions. Consequently, a robust communication system is needed to ensure a continuous and accurate sharing of information [49].

Control Scheme of MGs
The control schemes used in MGs can be classified into centralized and decentralized. Centralized control collects all data from a single MGCC unit that can execute the required calculations and define the control procedures and actions. This approach requires comprehensive communication between the MGCC and other substation units [50]. Meanwhile, decentralized control employs the local controller to operate the unit. Figure 4 illustrates the communication and actions that take place between the controller and its unit. Table 5 summarizes previous surveys related to centralized and decentralized control schemes in an MG.

Ref
Type Remarks [51] Centralized Proposed an MG control based on a centralized architecture where different DERs are connected to a single bus, and applied a centralized heuristic approach to managing the reliability and economical use of energy.
[52] Performed a centralized real-time simulation in an MG connected to DERs and found that the optimization model in a centralized control can operate a virtual power of DERs. [53] Proposed a centralized control for an intelligent network of greenhouses connected to an MG. The control of stochastic power DERs was based on model predictive control (MPC) to optimize crop production and control indoor climate conditions. [54] Managed the active and reactive power in a power system by using centralized control in an MG connected to the primary grid, which can provide an auxiliary to control frequency and voltage. [55] Employed an optimal operation approach to schedule energy in multiple MGs and allocated economic benefits.
[56] Decentralized Developed a multi-agent system relying on an MG cluster (MGC). Performed multi-time scale optimization to control and manage the EMS in the MGC and to schedule the day based on stability and economy. [57] Proposed and simulated an adaptive control with DERs, including an ESS, to adjust the power injection by managing the DC voltage bus on an efficiency point. [58] Applied the decentralized control of an MG to ensure the robustness and reliability of the power system by considering several objectives, such as economic power dispatch and reduction in power transmission losses.
[59] Promoted decentralized control by using a near real-time algorithm that operates the elements of an MG at the event of changing conditions.
The employment of each control scheme is associated with the type of MG, the elements being used, and the geographic area. Although centralized and decentralized control approaches have many advantages (e.g., low-performance complexity), they also have limited reliability, expandability, and flexibility. These approaches typically follow the same hierarchical control structure as illustrated in Figure 5, which shows three levels of control, namely, primary, secondary, and tertiary, with each level having unique features in response, operation, and communication speed [12].

Primary Control Level
Primary control, also known as the field control or the first level of control, is completely based on the variables and local measurements (e.g., voltage and frequency) of the system. The different elements and other categories of droop controls at this level do not require communication tools. This level aims to ensure reliability, effective power-sharing, enhanced performance, and plug-and-play capability for DERs. The implementation of active/reactive power mode (PCM) or the voltage control mode (VCM) in DERs allows users to control the active and reactive power output and coordinate power-sharing among DERs as managed by voltage source inverter (VSI) controllers. The PCM and VCM are operated in the grid-connected and island modes in an MG, respectively. To adjust output power-sharing from the VSI, the droop characteristics should be applied to control the active/reactive power or voltage and frequency [60].
Droop control is an autonomous approach for controlling the frequency and voltage amplitude of power dispatch in an MG. Droop is a standard power-sharing method that has been mainly applied in MGs. This method aims to promote power-sharing among DER inverters, given the uncertainty of line impedances and the power delivered from RE resources, which leads to an unbalanced power system. Various approaches for droop control have been designed, such as conventional and non-conventional droop control. The traditional droop control aims to set the steady droop gain. An accurate gain in droop control affects the stability of an MG, the voltage regulation, and the management of power-sharing [61]. Conventional droop control is formulated as: where k p and k q denote active and reactive power gains, respectively, in the droop control; ω 0 and V 0 denote the DER output angular frequency and voltage values; ω and V denote the adjusted frequency and voltage; and P g and Q g denote the injected active and reactive powers, where: P 0 and Q 0 represent the active and reactive power delivered from DERs, respectively, and P * and Q * denote the reference active and reactive power values. Figure 6 presents a block diagram of the conventional droop control strategy. Many methods have been proposed to further improve the accuracy of droop gain. For instance, Datta et al. [62] proposed a conventional droop control that adjusts the droop gain in two stages, namely, the lower and higher gains for the low and high frequencies, respectively. Datta, Kalam, et al. [63] adjusted a multi-gain using the droop control approach to manage power-sharing in a wind farm and then integrated this method into two types of angle controls in a proportional comparative study. Joung et al. [64] studied the droop gain in traditional droop control for decoupling the frequency and voltage control of DERs, which can preserve the frequency and voltage constants in a grid. Although conventional droop control lacks complexity in its implementation and application, such method has some drawbacks when applied in MGs, such as reducing the voltage due to the current equality, its inability to handle non-linear loads, and the ingrained trade-off between voltage and power-sharing [65]. Therefore, non-conventional droop control has been used to address these shortcomings. Several techniques have also been applied to improve droop control in MGs, such as load sharing [66], voltage-active power droop (VPD) and frequency-reactive power boost (FQB) [67], virtual output impedance [68], and adaptive voltage droop [69], as described in Table 6. Table 6. Non-conventional droop control techniques used in MGs.

Method Description Advantages Disadvantages
VPD & FQB method [67] This approach solves many shortcomings in MG applications. VPD and FQB can support those DERs with power factor impedance and help control the low voltage of highly resistive transmission lines where the common bus voltage Vbus is adjusted to manage a reference voltage Vref for a specific bus.
-May disturb the connection to non-linear loads. Table 6. Cont.

Method Description Advantages Disadvantages
Adaptive voltage droop control [69] The voltage response coefficient is changed adaptively, based on the operating state of the converter station in DERs.
-Improves power sharing, reliability, and flexibility in MGs. -More accurate voltage in MGs across various conditions.
-May fail to provide the appropriate voltage and power-sharing in a large DC MG.
virtual output impedance [68] A virtual impedance is used to cancel out the negative impedance by simplifying the coupling relationship of active and reactive power.
-Functions with linear and non-linear loads. -Improves the balance of DER output voltages.
-Voltage regulation is not guaranteed in a large-scale implementation.
Virtual transformation method [66] This method uses an instantaneous power calculation unit, a coordinate rotation transformation unit, and an adaptive inverse control unit, the last of which can adjust and modify the active power frequency droop control module by using a different optimization technique.
-Requires prior knowledge about the physical parameters that can affect voltage and frequency.
Angle droop control [70] The angle of the reference voltage in the inverters is used to control the active power and the frequency produced from DERs.
-Controls the output voltage of converters with low THD. -Control the voltage at the PCC.
-May fail to handle non-linear loads.
Synchronized reactive power compensation [71] To recognize the errors in power sharing, the system injects a real-reactive power transient coupling term and then compensates for the errors by using a slow integral term for regulating the DG voltage magnitude.
-Effective in slow inner communications. -Does not require configurations in MGs.
-May fail to handle non-linear loads. -Complex implementation.
Self-Adjusting control [72] The control method uses a multi-droop controller whose parameters are adjusted based on the power consumption from the local loads. Virtual inductive impedance is used to improve the control of voltage and transient responses of the power sharing. -Can disturb the connection to non-linear loads.

Secondary Control Level
The secondary control level aims to address the shortcomings in the primary control level of MGs, including voltage deviations. This level is also known as the EMS level, which enhances power quality, restores the power system, ensures economical operations, and eliminates the frequency and voltage deviations and fluctuations caused by the droop control at the primary level [73]. Figure 7 presents the problems encountered in MGs that are solved using an EMS. This system can determine the optimal output power for each DER, the optimal network design for the restoration, and the stability of an MG by solving a single objective or multiple objectives in the grid depending on user preferences, geographical areas, available equipment, and their capacity, government regulations, types of tariffs, and DER/battery energy storage system (BESS) constraints. The secondary control level is considered a challenge in MGs. Given that the variations in employment and the power dispatched from DERs, the command and update between the loads and DERs must be in high communication and speed to ensure a subsequent power generation in MGs. The subsections below present the goals and objectives of EMSs in MGs. The following subsections present the goals and objectives of EMSs in MGs.

Minimize the Cost
Minimizing costs has different objectives, as shown in Figure 8. The objectives may be expressed as mathematical models, as shown in Table 7. The literature review reveals that the cost-minimization problems in the EMS are solved using many approaches. Some studies have applied classical approaches to solve EMS problems. For instance, Lu et al. [74] proposed quadratic programing to solve and analyze the economic power dispatch of DERs in MGs. Economic costs involve the costs of shutting down, starting up, and generating power from DERs. Luna et al. [75] analyzed an EMS in an MG integrated with a grid-connected BESS that applies mixed-integer linear programming (MILP) to minimize the operating costs and improve the self-consumption strategy. Jabarnejad et al. [76] developed an MILP approach to ensure an optimal power flow and to reduce the electricity generation costs and GHG emissions. Sarabi et al. [77] proposed linear programming (LP) to minimize the annual energy invoice of railway station parking using plug-in electric vehicles (EV). Riffonneau et al. [78] proposed an optimal power management strategy using dynamic programming for connected grids, PVs, and BESSs. The proposed control maximizes the economic benefits and minimizes the degradation in BESSs. Maroufmashat et al. [79] used LP to solve EMS problems, such as minimizing the capital, operation, and maintenance costs in a hydrogen refueling station. Dong et al. [80] presented an MG based on CHP and RE while taking economy, environment, and flexibility into consideration to reduce the operation costs and CO 2 emissions. Garcia et al. [81] proposed a novel MPC model that minimizes power loss in an ESS in real-time. Sultana et al. [82] developed an EMS controller that reduces the voltage drop and improves the life cycle of Li-ion batteries. Chiang et al. [83] created an EMS controller to reduce the voltage drop in an aim to improve the life cycle of lithium-ion batteries. Ju et al. [84] applied mathematical optimization to prevent shortages in various DERs via a day-ahead output prediction. Zhao et al. [85] developed an optimization strategy for MGs that uses day-head market operations to minimize the demand response costs. Zhen Wang et al. [86] proposed a risk-based method that enhances the overall transient stability of power systems by using LP to minimize shedding costs. Y. Cao et al. [87] proposed an intelligent approach based on a mathematical model to reduce the charging costs in an EV in response to the time-of-use price in the electricity market. In [88] developed a model for reducing the charging and discharging costs in an EV connected to a PV station and grid. Giraldo et al. [89] proposed a comprehensive MG framework that operates in grid-connected and isolated modes, where the objective function is solved using the convex mixed-integer technique.
Several metaheuristic optimization approaches have also been used to solve EMS problems in MGs. For example, Mohammadi-ivatloo et al. [90] used the imperialist competitive algorithm to reduce the operation cost of fuel units, whose objective function involves the dynamic economic dispatch problem. Elsied et al. [91] used an advanced real-time EMS that applies the genetic algorithm (GA) to minimize the energy cost and carbon emissions and to maximize the power penetrating from REs simultaneously. Grisales-Noreña et al. [92] applied particle swarm optimization (PSO) to reduce the cost of energy purchased from utility grids. The MG implemented in this work comprised various DERs, such as PV, WT, and BESS. Marzband et al. [93] used an artificial bee colony (ABC) to obtain the optimal production cost and increase the power penetrating from RE in MGs. K. Roy et al. [94] explored an EMS using an ant-lion optimizer, which parameterizes the uncertainty in solar and wind energy generation in an MG. This optimizer meets the load demand at an optimal cost and takes the constraints into account. Other metaheuristic optimization techniques have also been applied, including the Jaya algorithm (JAYA) [95], teaching-learning based optimization (TLBO) [96], differential evolution (DE) [97], gray wolf optimizer (GWO) [98], firefly algorithm (FA) [99], moth-flame optimization [100], and the crow search algorithm (CSA) [101].
Some papers have used hybrid or modified optimization techniques, such as a hybrid of the bacterial forging optimization algorithm and GA, to reduce the electricity costs and to curtail the peak-to-average ratio [102]; and the hybrid ABC-PSO to analyze the technoeconomic MG and reduce the total cost [103]. Other hybrid metaheuristic techniques have also been proposed, including the optimal stopping rule (OSR) and GA (OSR-GA), OSR-TLBO, and OSR-FA in [104]; DE and sequential quadratic programming (DE-SQP) in [105]; the GA and whale optimization algorithm in [106]; Jaya-TLBO in [107]; the genetic harmony search algorithm in [108]; and the wind-driven bacterial foraging algorithm in [109]. Some of these algorithms are developed based on other approaches, such as artificial neural networks (ANN) [110], multi-agent systems [111], and fuzzy control [112].
Other researchers have considered additional objective functions to solve EMS problems. Some of them treat such problems as multi-objective, which may involve minimizing the costs (for operation, maintenance, fuel, and battery charging/discharging), emissions, and penalties. For instance, Swain et al. [113] proposed DE to solve the multiple objectives of the economic emission load dispatch problem. Xiong et al. [114] analyzed the effect of adding EMS to a grid connected to REs. Three objective functions were considered to mini-mize electricity bills, reduce the cost of power purchased from the main grid, and optimize power quality, and a novel multi-agent system was developed to optimize these objectives. Teo et al. [115] presented a fuzzy logic-based energy management system integrated with a grid-connected integrated with EMS. The model incorporates multi-objective optimization into NSGA-II to reduce the average peak load and operating costs by controlling the BESS status and the electricity market. Ren et al. [116] designed an optimal design for fast EV charging stations using WT, PV, and a BESS and for minimizing electricity costs and pollution emissions. This model is solved by using a hybrid optimization algorithm that combines the multi-objective particle swarm optimization algorithm with TOPSIS. Table 7. Objectives in cost minimization.

Objective Equation Details
Operation i, t : number of DERs and time of operation respectively. P g : t Thermal unit dispatch at hour t. I : solar cell terminal current. SU : start-up cost of the thermal unit i at time t. SD : shutdown of thermal unit i at time t.
Operating Cost [75] T E d g : energy delivered from dispatchable resources. E nd g : energy delivered from non-dispatchable resources. C(i nd ) and C(i d ): unitary cost of each non-dispatchable and dispatchable generator i at time t.

+BrC (∆t)]
Where: C DERi , C ESSj : costs of the output power of the i, j generator. C gr , C gs : cost of buying and selling power to the main grid. P gr , P gs : power received from and sold to the main grid. D DERi , D ESSj : state vectors that may be either 0 or 1. SUC DERi : startup cost of each generator i. P DERi , P ESSj : power delivered from DERs and ESS, respectively. Grid Cost [81] T ∑ t P grid,t * C grid,t P grid,t : power consumption from the main grid at time t, where P grid = P Load − P pv − P BESS . C grid,t : cost of power consumption at time t.
The production Cost [90] ∑ t a i P 2 it + b i P it + c i + e i sin f i P min The production Cost [93] T

Carbon Dioxide Emission
Cost [80] C CO 2 = P CO 2 C gt P t GT + H t GT + C gb H t GB + C grid Pm t 1 .∆t P CO 2 : carbon tax. C gt , C gb , C grid : carbon dioxide emissions per unit. Pm t 1 : electricity purchased from the main grid. H t GB : power output of the gas boiler. H t GT : heat produced by the micro gas turbine (GT).

Annual Power Loss [118]
N ∑ g=1 P lossg * P C g * J P lossg : power loss in state g. P C g : probability of any combination of load and wind-based DG output. J : takes a value of either 90 or 8760. N : number of discrete states.  P cn n,c (t)e cn n,c (t) − P g,in (t)e g,in (t) P f n,d : discharging price per unit of energy for EV. e f n,d : discharging rate for EV. P g,out : selling price of electricity sold by the grid to the charging station. e g,out : Amount of electricity that the charging station buys from the grid. P f n,c : charging price per unit of energy for EV. e f n,c : charging rate for conservative EV. P s n,c : charging price per unit of energy for premium EV. e s n,c : charging rate for premium EV. P cn n,c : charging price per unit of energy for conservative EV. e cn n,c : charging rate for conservative EVs. P g,in : price of electricity purchased by the grid from the charging station. e g,in : amount of electricity sold to the grid.

Power Loss [95]
Purchase Cost [120] T ∑ t=1 C pur (t) P pur (t) T s − C sold (t) P sold (t) T s C pur , C sold : prices of the sold and purchased energy at time t. P pur , P sold : purchased and sold power from the grid at time t.
Start-up Cost [120] C Shortage Cost [121] n ∑ i=1 m ∑ j=1 K pi P ij + K pi P ij K pi , K pi : loss factors of nodes i and j.P ij : power shortage between nodes i and j.

Objective Equation Details
Shortage Cost [84] T ∑ t=1 ρ sp,t g sp, t ρ sp : penalty price for power shortage. g sp : electricity of power shortages. ∑ t=1 ∑ s w s C grid + C wpc + C ess + C mtg + C dr w s : probability of scenario s. C grid : transaction cost in the electricity market. C wpc : cost of wind power curtailment. C ess : cost of the energy storage operation. C mtg : cost of the micro-gas turbine resource. C dr : cost of the electrical demand.
Electrical demand response [85] C dr = P mtg P down (t, s) + P up (t, s) ∆t

Restoration
Blackout events in power systems have dramatically increased due to weather events, natural disasters, or vandalism. These power outages greatly affect the economic, social, and industrial sectors. Any outage in a network will result in supply interruption for customers of the defective section. To reduce the gravity of the consequences, the scale of different power system damages needs to be evaluated, and system restoration actions need to be taken. Resiliency describes the ability of a power system to persevere in the face of high-impact, low-probability events (HILP) and to quickly restore its operations, either completely or partially, by using all the available resources within a short timeframe with constricted costs [123]. Previous studies have referred to resilience using various terms, such as resourcefulness, self-healing, adaptability, and flexibility. Figure 9 shows how the performance level of a power system changes during HILP events. To improve the resilience of power systems, some measures must be implemented in plant management, restoration service programs, and hardware designs [124]. Figure 10 presents a comprehensive classification of power system resilience.  The EMS has various computational tools that control and operate the resilience of a power system by introducing advanced computational algorithms. Mathematically, the restoration problem in MGs is viewed as an objective of maximizing the supply for as many customers as possible, minimizing the switching costs, changing the status of line loading, and addressing the radial network constraints as shown in Table 8. Different reconfiguration techniques have been proposed in the literature to solve this problem.
As an important feature of an EMS, service restoration has also received much research attention. Poudel et al. [125] restored the services in a power distribution system by monitoring status switches to isolate the outage area and to maximize the number of restored loads; they modeled this problem in MILP to ensure large-scale flexibility. Gholami et al. [126] proposed two heuristic approaches for solving the restoration problem that involves maximizing the total and priority of loads restored and minimizing the number of switching operations; which are graph-based to optimize the objectives function proposed. Alowaifeer et al. [127] improved the resilience of a power system by relying on a dynamic prioritization of customers. The priority of loads is influenced by many factors, including the criticality of the load and the cost of interruption. Shen et al. [128] proposed a comprehensive framework that involves theoretical and quantitative indicators of self-healing in a power system during its restoration process, including the credibility, rate, speed, and benefits of MGs. Jiao et al. [129] proposed the wide-area measurement/information (WAM/WAI) control to handle the restoration speed problem in MGs. WAM/WAI was applied based on the unified power flow controller, which allows the redistribution of power flow in areas affected by the outage. Yang et al. [130] improved the resilience of a distribution network in three stages. First, the emergency system restored the critical load by applying the tree restoration method. Second, EV was used as an emergency power supply. Third, the restoration model restored the non-critical loads during faults. Zidan et al. [131] proposed a multiagent system that determines, and isolates faults based on several objectives by minimizing the number of switches and power loss, and by maximizing the number of restored critical loads. Romero et al. [132] developed a mathematical model by abstracting multiple objectives into a single objective. Lin et al. [133] proposed the term "electrical betweenness" to determine the optimal restoration path during self-healing operations and used complex network theory to restart the non-black-start generators and to identify the priority loads to be restored. Liu et al. [134] used the WAM system to estimate the restorable size of power load after outages and to control the stability of the system during the load restoration operation. Qianqian et al. [135] developed a two-stage mathematical model for centralized self-healing in an electrical distribution system that isolates the damage zone by minimizing the de-energized area, load shedding, and active power losses. Patsakis et al. [136] proposed an optimal allocation of black-start units to restore the power system. However, these units have a high maintenance cost, which can affect the self-healing process. Cao et al. [137] adopted the concept of top-down power system restoration where black-start resources were used to address the shortcomings of the non-black-start units and sub-transmission systems, and to restore the power system after encountering defaults.
Leite et al. [138] applied a multiagent system to collect and update local information and to quickly isolate the nearest damage location. Wang et al. [139] proposed a multiobjective formulation of service restoration and improved the efficiency of this framework in three steps. Gu et al. [140] introduced a two-level self-healing framework for service restoration, a problem which they formulated as a multi-objective function. Afterward, they applied the lexicographic optimization method to solve this problem. Chen et al. [141] used multiple MGs energized by DERs to restore the critical loads after the occurrence of faults. Zhaoyu et al. [142] proposed a comprehensive framework that applies two strategies based on the self-healing concept. The primary mode minimizes the operation cost and maximizes the profit, and the system enters the self-healing mode after the occurrence of a fault. The sectionalization method applies rolling-horizon optimization to isolate the damaged section and to restart the other utilities in the network system. Dimitrijevic et al. [143] reduced the restoration costs by supplying loads with a low switching cost and by applying the minimum spanning trees algorithm to address the proposed objective function. Rodríguez et al. [144] applied systematic measures to integrate algebraic calculations and heuristic rules that help distribution management systems find the optimal switching selection operation for the rapid isolation and restarting of DERs. Wang et al. [145] proposed the stochastic response method for reducing load loss within a minimum switching time, while allowing for a standard design of the network reconfiguration and islanding section. Widiputra et al. [146] developed a novel restoration algorithm that uses discrete PSO to solve the clod load pick up and conservation voltage reduction problems in service restoration. Vieira et al. [147] integrated the protection constraints in service restoration for a distributed power network by using the multi-objective evolutionary algorithm to enhance the protection efficiency of the device. Ma et al. [148] proposed a three-level optimization problem to minimize the investment and load-shedding costs during extreme weather events, and applied the greedy searching algorithm to optimize the formulation proposed in a multi-study of scenarios. Arif et al. [149] modeled the uncertainty of end-user consumption and power dispatch from DERs to facilitate the service restoration of an MG by using a stochastic mixed-integer linear program to maximize the served load. Xu et al. [150] introduced the resilience-oriented method to optimize the restoration problem in secondary network distribution systems, which are directly controlled by the unit commitment in an EMS. Khatib et al. [151] applied the probabilistic operational planning method to achieve distribution automation by placing the ESS in the fault area. They formulated the objective function to reduce the total energy cost and enhance reliability. Abniki et al. [152] applied a BESS as a backup utility to restore the de-energized portion of the system and formulated the objective function as an MINLP to minimize the total cost of interruption. Table 8. Objectives for improving reliability.

Objective Equation Details
The restored Load [125] ∑ i∈ v ∅ ∈ {a,b,c} ∑ w i s i P ∅ Li w i : the weight factors for each load. s i : the load pick-up. P ∅ Li : complex power demand at i.

Number of Switches [125]
∑  The resilience [130] n MG n MG : number of loads. t sdi : the travel time. n EPS : the number of restored loads. P i and P is : the active power dispatch from the microgrid and EV, respectively. C i : the cost utilities. α : the unit capacity consumption cost.
The restoration paths [133] ∑ j∈Ω T i UR α P Gj +β P Lj E dsj−1 Ω T i UR : the set of nodes of the power grid. P Gj : the power dispatched from DER.P Lj : the power consumed by each node. α, β : coefficients for measuring the relative importance. E : coefficient of exponential decay.
The centralized Self-healing [135] Ω z : set of loads, Ω b : set of nodes, Ω l : set of branches, Ω sw : set of switches, P D i : active power requested in node i. R ij : resistance branch ij. I sqr ij : current in branch ij. C R z : cost of de-energizing. C Is i , C lss : cost of load-shedding and loss cost, respectively. C sw : cost of switch operation.
The total generation capability [137] n L ∑ i=1 n p,i ∑ j=1 E P, ij n L : number of loads, n p,i : number of non-black start generators. E P, ij : the power capability of the generator.
Out-of-service Area [153]  Ω z : set of zones, Ω s : set of sequence, C U z,s : cost od de-energizing, x z,s : binary variable. C sw : operating cost. Ω sw: set of switches. ∆y + ij,s , ∆y − ij,s : opening and closing of switch operation.
The network layer unit restarting [140] n G : number of DERs, G ij : the unit j in the plan i. α : weight factor. P G,ij : the power delivered from j. µ : distributing factor. P M,ij : the maximum output of DERs.

Objective Equation Details
Restore the outage area [142] γ s : probability of the scenario. V k,s,t: : voltage magnitude, V n : basic voltage. x kj : indicator of boundary line. w k : priority index of the load. P D k,s,t : active power, y k,t : the status of the switch.
Served Loads [149] ∑ ∀s Pr(s) ∑ ∀t ∑ ∀ i∈I D y i w i P D i,t,s + ∑ ∀ i∈I CL P CL i,t P CL i,t : controllable loads, P D i,t,s : non-controlable loads, w i : weight factor, y i : connecting status of the loads. Pr(s) : priority of the loads s.

Power Quality
The proliferation of nonlinear, unbalanced loads and loads shedding during the restoration process may compromise the power quality in MGs and distribution systems. Meanwhile, the intermittency and instability of RE sources can result in fluctuations in power quality and stability [155]. The EMS can improve power quality and stability in the power system by monitoring the control equipment using control theories and optimization techniques [156]. Table 9 shows the objective function used to enhance the power quality in MGs. Several control strategies and approaches in EMSs for improving power quality have been proposed in the literature. For instance, Mei et al. [157] proposed the moth-flame optimization technique to minimize the voltage deviation and total system transmission loss, and to improve power stability via reactive compensators sizing. Jian et al. [158] developed a service model for an unbalanced three-phase active process distributed using a multi-terminal soft open point system to realize power flow in DERs and supply the outage area. The formulation was summarized as a combination of objectives, including maximizing the restored load and minimizing the voltage unbalance and power loss. Mousavi et al. [156] proposed a novel control that uses the PV and battery energy storage interfacing inverter to improve power quality while taking several constraints into consideration, such as battery service life and charging/discharging status. Sahoo et al. [159] proposed a novel centralized energy management approach for stabilizing the voltage flow and the flexibility of inverters in a solar-battery hybrid MG. Ravinder et al. [160] used the shunt active power filter integrated with the PV and battery to improve the quality of power in an MG. The shunt active power filter was controlled using ACO to minimize the total harmonic distortion. Aljohani et al. [161] utilized the vector-decouple algorithm to preserve stability and to control the hybrid MG, and proposed a controller that measures efficiency and robustness and improves the quality of the voltage output and frequency. Nasr et al. [162] proposed a multi-objective function that includes minimizing the voltage deviation in an MG to ensure voltage balance and to satisfy the contingency constraint. Han et al. [163] enhanced the power quality in a power system by using two levels of an EMS. In the first level, the control based on MPPT was used to improve the output power penetration from the PV. In the second level, droop control was applied to monitor the inverter in the power system. Agnoletto et al. [164] formulated the EMS as an optimal power flow problem, and considered both the operating cost and power loss in the optimization process by using the ∈ constraint method. Zhang et al. [165] addressed a multi-objective function optimal reactive power dispatch problem and proposed a model that minimizes active power loss and voltage deviations using multi-objective optimization techniques. Leonori et al. [166] developed an optimal power flow strategy for a grid connected to a BESS, utilized the BESS to improve power stability, and used a fuzzy EMS controller to manage power in real time. Table 9. Objectives in improving power quality.

Objective Equation Details
Voltage deviation [157]  Voltage deviation [165] N load K : reference voltage. V lower : is the lower limit of load bus voltage. V upper : the upper limit of load.
The voltage unbalance [158] ∑ t T 2 Ω b : the set of the distributed system. U t i : is the voltage in each phase.

Tertiary Control Level
As the top-level control, the tertiary control level preserves the optimality of the operation, specifically the efficiency and cost between the MG and the primary grid, and vice-versa. This level usually has a slow dynamic response to define the optimal active and reactive power references of each DG due to the complexity of the calculation and the prediction model of economic and meteorological data [167]. The prediction model helps classify the weather, network optimization, and uncertainty quantification. Different methods are applied at this level to formulate the forecasting and prediction model, such as machine learning [168], long short-term memory (LSTM) [169], k-nearestneighbors (KNN) [170], generalized regression neural network [171], neural network ensemble [172] and deep recurrent neural networks [173]. While the secondary level focuses on the power quality and sharing among DERs, the tertiary control focuses on economic aspects, electricity market participation, and power-sharing trends. This level guarantees high power-sharing quality by defining the error between the reference and actual values, whose values are computed as [73]: where P * G and Q * G are the active and reactive power references from the DER to the main grid, respectively; ω * and V * are the frequency and voltage errors; and k p and k i are the gains of the PI controller. The tertiary control level is generally endowed with the familiar concept of the tending of the electricity and the financial market, such as mentioned and discussed in the next section.

Transactive Energy Market in Microgrids
The MG energy market not only allows the trading of local power generation among consumers but also fosters sustainable and efficient power use. MG markets also help reduce the cost of transporting energy while keeping losses at a minimum [174]. This market design schedules the load profile and power generation from DERs in preparation for the dispatching process to reduce the energy costs. Transactive energy management (TEM) is a comprehensive framework that introduces several features for integrating DER utilities and MGs into power systems. TEM also allows small and large energy consumers or producers to trade energy under market rules. TEM promotes the demand-side based on sharing among prosumers, and the economic signals that are in line with optimal operation targets to ensure the suitability and reliability of the system. This framework optimizes system performance by ensuring a dynamic alignment among local objectives and by using different approaches to determine the tariffs, bilateral contracts, penalties, and organized markets [175]. With TEM, customers can trade their surplus energy either in real-time or on a deferred basis. Nevertheless, the application of TEM to MGs requires a design track to manage complex operations in a way that ensures transparency, freedom, and fairness for prosumers. To design a proper TEM structure, several design principles that are related to agent properties, pricing mechanisms, and internal and external markets must be considered [12].
Xue et al. [176] argued that the technology of the power market and the transactive energy in a large grid are not suitable for MGs. Therefore, the power industry proposed energy trading based on blockchain to allow trading in dynamic P2P networks, distributed networks, cryptography, and others such as those discussed in [177]. Janko et al. [178] proposed multi-agent control as a well-known technique for transactive energy trading due to its ability to improve system scalability, flexibility, autonomy, and transparency. Therefore, this market design can reduce the risks of price oscillation for small customers and increase their profit. Other approaches proposed in the literature including direct acyclic graph [179], hash graph [180], flow chain [181], and game-theory [182].

Protection Systems
The excess generation capacity of DERs in an MG can provide the primary grid or other connected MGs the necessary system recovery resources to enhance their resilience and shorten the outage duration. However, the resilience of an MG is not entirely protected from short-circuit faults, which could increase the rated current by hundreds of times, thereby necessitating the replacement of CBs. The protection system in an MG is aimed at identifying the fault location. After locating the fault, the protective device in the MG isolates and repairs the fault section quickly [10].
Short-circuit fault is the most common type of fault in an MG that can damage consumer appliances. Therefore, MGs require an overcurrent protection protocol and schemes that protect against external and internal faults. To avoid high voltage in MGs during external faults, a protective relay must be installed to automatically detect faults and assist the CBs to isolate such faults. In the connected mode, the protection is usually placed at the PCC level, whereas in the island mode, the protection is placed depending on the inverters. Rapid automatic detection of faults requires a fast communication system. Therefore, automatic detection schemes should be evaluated based on their speed, sensitivity, selectivity, and reliability [36].
Several schemes have also been proposed in the literature to address the most common issues associated with overcurrent protection in MGs as shown in Table 10.

Policy of Microgrid
Most power consumer countries are exploring alternative energy sources, such as RE, to reduce their dependence on fossil fuels and lower the associated costs. However, RE lacks a widely accepted framework for implementation due to policy reasons and its experimental nature. Therefore, various policies have been implemented to encourage the deployment of RE and DER technologies [189].
MG regulation in the EU faces many challenges related to protection, consumers and power supplier engagements, legalities, limitations, and interconnection with the main grid. To achieve a sustainable and secure energy supply, the EU issued a policy that aimed to reduce its fuel consumption by 20% by 2020. In 2014, the EU launched its 2030 vision, which involves increasing the penetration of RE technologies by up to 27% and reducing its GHG emissions by 40% to 95% by 2050 [190]. In 2016, the EU launched the IEC TS 62257-9-2 standard, followed by IEC TS 62898-1/2/3 in 2018, and PD IEC TS 62898-2 in 2020.
Since the oil and gas crises in the late 1970s, the US has issued several energy policies, including the IEEE standard 1547-Family, which was launched in 2005. This standard has a vital role in ensuring energy security and power quality. These policies issue financial incentives, such as the exemption of transmission and transmission loss charges, as well as climate change levy exemption. Other policies in the US have focused on R&D programs, software and tools, grants, and funding support to incentivize demonstration projects [191].
The tariff policy in China aims to promote the exploration of RE. This tariff policy is able to offer a continuing purchase price to the electricity seller to the grid corporation with a fit market competition by giving privileged prices [192]. Over the years, China has issued several policies and programs to promote the utilization of the RE, such as the national climate change program in 2002, renewable energy law amendments in 2009, and preferential tax policies for renewable energy in 2015. Table 11 summarizes the MG policies implemented in the EU, US, and China.

Perspective and Discussion
Regardless of the yearly changes in power generation, the authors expect the following services from electricity systems: • Future MGs may rely on a progressive combination of energy resources, including large-scale decentralized resources, to be suitable and variable. Energy storage systems have the potential to alter the nature of production and transmission; • The deployment of the ESS only targets a few countries, such as Australia, Germany, and Japan. Such deployment is expected to cover 40% more countries every year until 2025 [193]; • A different change will occur in countries determined by market policy and regulatory structures, and the diversity of the resources supplying customers; • While MGs are considered the best solution to local and general problems, they are essentially a novel architecture paradigm that offers higher flexibility and reliability against outages; • Future MGs may improve their fault detection and self-healing capabilities to shorten recovery time, maximize loads restored, and identify gaps between research and implementation; • The Internet of Things facilitates the emergence of real-time platforms and serves as an important link between decentralized and transactive energy markets. Moreover, from their previous research, the authors have determined that bidirectional exchanges of energy between customers and producers are considered the most challenging for the future; however, future techniques are expected to solve this challenge; • The application of deep learning, including ANN, in MGs instead of classical and mathematical methods warrants exploration to achieve a dynamic adjustment of energy flow, reduction in GHG emissions, and enhanced protection for MGs; • The use of blockchains and smart contracts in MGs should be promoted to guarantee secure energy transactions and DER operations.

•
Integrating quantum computers into the MG may allow the system to restore more loads within a short period, use deep learning and machine learning methods for improving forecasting models, and apply algorithms for quickly directing DER dispatches; • MG controllers should be evaluated and tested in controlled laboratory environments to minimize risks. Testing various technologies, such as hardware-in-theloop, is expected to become a practical approach for evaluating controllers before their deployment.

Summary
MGs are primarily composed of various DERs, EVs, EMSs, loads, and communication devices. The development of MGs has become a requirement for the integration of REs in remote areas and the deployment of smart grids. MGs with an EMS are promising technologies that not only promote system efficiency and economic achievability but also ensure sustainable development and reduce GHG emissions. Many researchers have examined the development of EMSs and their operations, stability, reliability, costs, and utilization in MGs. This review paper presents a comprehensive and critical review of the elements in MGs. The MG has three levels, namely: • Primary control, which guarantees reliable operation by maintaining voltage and frequency stability; • Secondary control, which optimizes the power quality of the system; and • Tertiary control, which achieves economic optimization according to the prices in the electricity market.
At the secondary control level, the EMS aims to optimize operation, energy planning, and system reliability in either the grid-connected or islanded mode. This extensive review addresses the mathematical objectives of minimizing the cost of restoration and improving power quality. The review also indicates that the design of an autonomous, reliable, and flexible EMS is essential to adapt to different configurations. It is compulsory to design optimal controller's schemes that are capable of controlling MG elements smoothly and fitting the changes in the environment without human interference or restructuring the entire controller. In this context, methods empowered with forecasting models, such as metaheuristics and AI techniques, are promising for the MG. Furthermore, EMSs must be capable of handling the fluctuations of the power generation dispatch from the RE resources by considering data forecasts. Several techniques have illustrated their ability to overcome these problems. This paper also explores the TEM and the protection schemes mostly applied in MGs. Currently, the MG as a technology is still in its infancy stage. However, several countries, such as China and the US, have already started to encourage its adoption. This paper also discusses the perspectives of authors about the future of EMSs and MGs.