Energy Management in High RER Multi-Microgrid System via Energy Trading and Storage Optimization

The increased addition of DERs, their intermittent nature, and the high cost of ESSs are the key hurdles for interconnected multi-microgrids to operate economically. It is important to have a system that is simple to adopt, computationally inexpensive, does not share private data. In this paper, an energy management scheme is proposed for multiple interconnected renewable energy resources within the multi-microgrid paradigm. The core objectives aimed at minimizing the operational cost of each microgrid and utilize RER most economically without any load interruptions. The proposed scheme is performed in two steps. In the first step, the load is shifted in accordance with the daily price curve via resource scheduling i.e., charging and discharging of battery storage, day-ahead forecast of RER generation, and respective loads. In the second stage, the cost of energy is further reduced using opportunistic trading with neighboring microgrids in real-time. The mismatch between forecasted generation and load is also adjusted via either energy trading or with efficient scheduling of available power that is stored during off-peak hours. The effectiveness of the proposed scheme is applied to a test system consisting of four interconnected microgrids. Results indicate that daily average power imported from the utility grid and peak demand is changed from 103 kW to 162 kW, and from 661 kW to 527 kW, respectively. Likewise, as per comparison, significantly favorable results have been achieved in terms of efficient available resources utilization, market trading, and reduction of the respective bills.

reliable manner. The traditional distribution grid was planned to control large power generation sources located far away from load centers and connected via transmission networks. The high intermittent renewable energy resources (RER) penetration in distribution grids is subjected to various challenges like resource scheduling and control. The RER generates power that fluctuates over multiple horizons. The lack of storage to match power demand and generation is still challenging in real-time (RT) and makes grids susceptible to blackouts [1]. The adjustments are required on small scale to balance the load and generation at any time that can be day-ahead (DA), intra-day, or RT adjustments. Conventional grid management methods may have limitation to address modernized grid issues that requires resource scheduling across small horizons.
The output in the solar system such as photovoltaic (PV) mainly depends on the irradiance during the day besides temperature, both of which vary throughout the day. The balance in PV output during the rise or fall is maintained with reserve generators, which ramps up quickly [2]. While costly fueled generators are put to rest during potential sun hours. Besides day/night, the output of PV is impacted via weather and makes it difficult to calculate the required power to match the demand. Likewise, in wind energy conversion systems (WECS), power output fluctuates with weather conditions and has negative impacts on power quality. These variations make it challenging to meet the standards for grid interoperability [3]. Energy storage systems (ESS) with various control strategies like low pass filters can be used to smooth out these fluctuations and provide a stable output from WECS [4].
In this era of grid modernization, microgrids (MG) play a vital role since they bridge several features that were limited in the traditional grids like self-healing, self-monitoring, adaptive, and intelligence, etc. Primary features of MG encapsulate the defined electrical boundaries that contain flexible loads and generation options [5]. This gives greater flexibility to match the generation-demand balance reliably and with economic viability. RER intermittence causes disturbances in the grid. However, if strategically placed and operated efficiently, they can support the grid [6]. Particularly a MG can continue to supply a local portion of load even after disconnection from the main grid. The RER accompanying storage units within MG are attributed to provide support to the main grid by reducing the load on the utility grid and continue to supply power during peak hours [8]. In a deregulated energy market, MG can provide lowcost and clean energy to neighboring MGs [9]. The MG features can intelligently make the power system more resilient, reliable, low cost, and eco-friendly within the smart grid (SG) paradigm [10]. In contrast to an individual MG, multi-microgrid (MMG) have additional benefits i.e., efficient power transactions, reconfigurable grid structures, and efficient storage utilization. In addition, MMG can create a more competitive market for energy trading among concerned stakeholders. MMG can substitute the need for long transmission lines, which costs a considerable portion of the consumer's bill [11].
Distributed energy resources (DER) are gaining popularity in present-day electricity markets due to environmental concerns, affordable prices of RER, and ESS [12]. Likewise, increasing DER penetration has transformed the electricity market from a centralized hierarchal model to a decentralized/deregulated one [13]. This deregulated market enables DER as an entity that is both a commodity and a reliable asset, besides providing support functions to the grid. The primary grid support functions attributed to DERs include voltage control with active/reactive power [14], frequency regulation through active power control [15], low voltage ride through (LVRT) [16], frequency ride through, and islanding [17]. The combination of DERs with fixed and flexible loads, and storage units, that are capable of running in grid-connected as well as in islanded mode makes a microgrid [18]. The clustered arrangement of MGs as MMG can enhance technoeconomic benefits with resiliency.
Since utility providers schedule to generate the expected energy for the next day. However, RER-based DER energy production is heavily dependent on geographical location, and weather conditions which result in uncertainty that disrupts operations in traditional grids. In comparison, to balance the generation-load mismatch in a MG, advanced power electronic and supervisory control systems are used. The functionalities can optimize the use of local ESSs in addition to RER-based DER, to meet the demand difference at any time. The supervisory control system implements algorithms of energy management that schedule the charging-discharging of the ESS along with the operating time of flexible loads, which aims at optimization of various objectives [19]. The development of information and communication technology has supported energy market deregulation and enabled the power system to evolve from a hierarchical to a distributed structure i.e., multiple MGs operating in parallel [20]. The new distributed grid structure creates competition and consumers can choose their energy provider even outside of their MG.
Several authors have used the multi-agent method and distributed decision-making subsystems to provide plug and play capability. In [21], authors have compared the combined and individual energy management of the MMG systems comprising of PV, wind, biomass generator, and electric vehicles. Its observed that energy management optimization of whole MMG is more beneficial as compared to single MG.
The authors in [22] utilized multi-agents to integrate DERs using a rule-based algorithm aiming at DA energy management considering the dynamic market price (feed-in tariff (FIT)). Due to the uncertainties in the solar irradiance, there remains some error in forecasted and real values. Thus, it is difficult to determine the ESS schedule for the next day. This limitation necessitates the development of a strategy to handle the difference in actual and scheduled values that are calculated using forecasted data.
A two-stage optimization in [23] shows an evaluation of the DA schedule via DA forecasted RER power in the first stage. Later, it uses near RT forecast that is highly accurate than DA, is used to optimize the remaining hours of the day. This method cuts penalty costs for mismatches among DA and RT operations. In [24], the economic dispatch of a DC MG containing wind, PV, and storage is carried out optimizing for operational cost, via a heuristic method based on a genetic algorithm. An RT online energy management strategy is implemented subjected to the status of RER and storage in RT rather than a forecast [25]. A multi-time-scale strategy based on Ng-Jordan-Weiss spectral clustering algorithm for economic scheduling is implemented in a virtual power plant that participates in the wholesale market aiming at enhancing overall economic impact [26].
Bridging of research gaps left in the commendable reviewed literature works serves as the very novelty of this paper. The key contributions are summarized as follows: • A two-stage energy management optimization scheme is presented with DA and RT trading in the MMG paradigm. • The energy mismatch between forecasted generation and load is adjusted via trading and/or importing additional power during off-peak hours. • Participating MGs that are sellers, get a greater value for their exported energy than FIT. • Participating MGs that are buyers get cheaper energy than the utility grid. • Grid support is provided via utilizing more energy during off-peak hours and reducing or providing energy during peak hours. • The deregulated retailer market is optimized with an advanced electricity marketing algorithm, using DA and RT information sharing. The paper is organized into the following sections. The proposed multi-stage optimization method is illustrated in section Ⅱ. In section Ⅲ, the modeling of MMG, RERs, battery storage system, and dynamic loads in individual MG are presented as stage-1. DA scheduling problem formulation is presented in section Ⅳ as stage-2. In section Ⅴ, RT operation scheme with 5 minutes ahead trading is presented. This section also presents a combined simulation of DA optimization and RT operation. The results of the simulation are analyzed and discussed in section Ⅵ. The conclusion of the paper is provided in section VII.

II. PROPOSED MULTISTAGE OPTIMIZATION METHOD
In this paper, a multistage methodology is proposed based on four stages. The overall flow chart of the proposed multi-stage approach is demonstrated in Fig. 1.
In stage-1, preprocessed information is gathered based on RER forecast data, load forecast data, and DA forecast cost curve from the utility grid, aiming at the optimized output from assets.
In stage-2, the cost of energy from the grid is minimized using an ESS to shift load from peak to off-peak hours. Resolution of the time scale is kept at 5 minutes to encompass the impact of variability of RERs and aims at ESS charging/discharging schedule as well as respective energy price.
In stage-3, the data for RT trading is formulated aiming at sorting energy time stamp block based on bidding factor with reduced cost under deregulated market paradigm.
In stage-4, RT operation is carried out with the start of bidding in the best sorted PESS in descending order of cost with the respective timestamp. If renewable energy sources (RES) have more power, it is offered to sell in the deregulated market at a low cost as per bidding.

III. STAGE-1: SYSTEM MODELING
In this paper, an RER-based MMG test system consisting of four MGs has been considered. Fig. 2 shows the connection diagram of the whole test system. Each MG contains a fixed load, dynamic load that follows a predefined load curve, wind power system, and ESS. The power rating of RER in each MG is presented in Table I.

A. LOAD
A Simulink's system-level dynamic load block in simscape/powerlib library is used to simulate the dynamic load. For the loads attached to the MG, active power and reactive power are function of positive sequence voltage which can be mathematically represented as follows: Where: • is the initial positive sequence voltage.  (1) and (2). An array of two signals P and Q is used to control the active and reactive power in each MG. The dynamic load for RT implementation is modeled using the daily real power curve , reactive power is calculated using this and power factor of the load.
Where ( ) is the perpendicular solar irradiance and is the efficiency of the converter associated with the PV system. The PV generation from MG2 and MG3 are shown in Fig. B.

C. WIND POWER SYSTEM
Similarly, a system-level model for a wind power plant is implemented using (7) [29].
( ) Where, • is air density and is efficiency • is swept area of the rotor of wind turbine is the rated power of the WECS

D. ENERGY STORAGE SYSTEM
The state of health (SOH) of the ESS is determined from (8).
Where ( ) is the current status of energy in the ESS and is the rated storage capacity of the ESS. In this work, the degradation of ESS is modeled using the aging model of [30][31][32]. SOH is considered as the loss of capacity which in turn is deemed to be linear according to the depth of charge of the ESS [33].
The linear aging coefficient of = 3 × 10 −4 found in the study [34] has been used here. The RT capacity ( ) of the ESS is calculated as: The change in capacity ∆ ( ) is calculated using (10).
The specifications of the ESS are illustrated in Table II. Using (12), SOC of ESS is measured where, ℎ is charging efficiency, and is discharging efficiency of ESS. (12) Where: ( ) = Power, (-ve) when charging, (+ve) when discharging ℎ, = Charging/ Discharging efficiency ℎ = Rated capacity of ESS The output of the ESS is disabled if any of the overcharging (13) and undercharging (14) limits are violated. Reactive power capabilities ( ) are set as (15). Where,

E. GRID PRICE
The daily cost curve and cost of energy (or FIT) of the utility grid used in this study is shown in Fig. 3, the cost of utility grid peaks around 20:00 hrs.

IV. STAGE-2: DAY-AHEAD SCHEDULING
In this stage, MG-2 and MG-3 are optimized with solar irradiance on a sunny day, and MG-1 and MG-4 are optimized with wind speed as per load data and daily cost curve illustrated in in Fig. A, and Fig. 3 respectively.

A. OBJECTIVE FUNCTION
The objective function for DA optimization considering the DA cost curve is shown in (16).
Where, C(t) is the cost curve for 24 hours with a step size of 5 minutes, E(t) is energy stored in ESS as shown in (18), is the replacement cost of ESS. The unit time t is minutes.
Where: is the investment cost of ESS Subjected to constraints in (19) and (20). These equations are used to optimize individual MGs in a DA arrangement. This optimization problem is solved using the MATLAB optimization toolbox. The schedule of the ESS of each MG is given to the database of each MG controller for RT operation. Operation of the MG controller is independent of optimization algorithm, and the output of this optimization results in the minimum cost schedule for the forecasted value renewable resource and daily load curve.

B. Local Optimization of Multi-Microgrids
In this stage the ESS charging and discharging schedule is determined. It is assumed that forecast of load and RER generation is perfect. Whereas, in a real-world scenario, there is always some degree of error in load forecast as well as RER generation. If only this schedule is to be used for RT operation the mismatch between the schedule and actual load balance is met by importing out of schedule power from the grid. The time of occurrence of this mismatch can be at any hour throughout the day. Each MG must buy this extra power regardless of the price of energy at that time or it may shed some load to keep the system balanced. Utilities charge a penalty for this extra power which was not scheduled. This further increases the cost of energy bought from the utility.

C. MG1
The individual power generation of wind and power charging/discharging of ESS can be seen in Fig. 4(a).

Figure 5. Grid cost vs ESS charging/discharging
Whereas the effect of adding resources such as wind and ESS can-be observed in Fig. 4(b). Figure 5 compares the daily cost curve and ESS power for all four MGs. It has been discovered that ESS discharges at mid-peak and peak hours when the cost of the electric grid is highest. ESS charges during off-peak hours when grid costs are at their lowest.
Since the generation from RER is smaller than the load in MG1, the ESS charges by importing energy from the utility grid which can be observed during the off-peak hours of Fig.  6. Where, Fig. 6(a) shows grid cost for MG1 and Fig. 6(b) illustrates active power (Pgrid) import and export from MG1 to utility grid. During the peak hours starting from 18th hour till 22nd hour, ESS provides power until it reaches its minimum SOC. During this period the ESS serves the load and exports some power to the grid.

D. MG2
The results from the viewpoint of local optimization for MG2 are demonstrated in Fig. 7. Fig. 7(a) depicts the individual power generation of PV and the charging/discharging power of ESS. Fig. 7(b) depicts the demand on the utility caused by the addition of resources such as PV and ESS.
In MG2, the RER generation during the day is greater than the load. Therefore, the ESS in this MG charges using the energy from the PV system. MG2 imports power from the utility grid before the 3rd and 23rd hour when the utility price is low. During the daytime, MG2 feeds the power into the grid.
It is mentioned before in Fig. 5 regarding the comparison of ESS power and the daily cost curve. It is observed that ESS is providing power to the grid at mid-peak and peakhours after serving the load when the cost of the utility grid is higher. ESS charges during the daytime when PV power is greater than the load.
Since the generation from RER is greater than the load in MG2, the ESS charges by utilizing the excess PV power which can be observed during the off-peak hours in Fig. 8. Where, Fig. 8(a) shows grid cost for MG2 (same as MG1) and Fig. 8(b) illustrates active power (Pgrid) import and export from MG2 to utility grid. During the peak hours, the ESS provides the power to the load after the 18th hour when the prices are greater and exports to the grid as well. Since here the cost of the grid is maximum the ESS provides power until it reaches its minimum SOC.

E. MG3
The results from the viewpoint of local optimization for MG3 are shown in Fig. 9. The individual power generation of PV and power charging/discharging of ESS can be seen in the Fig. 9(a). The loading due to addition of resources i.e., PV and ESS on utility can-be observed in Fig. 9(b) During the day, the RER generation in MG3 exceeds the load. Therefore, the ESS in this MG charges using the energy from the PV system. MG3 imports some power from the utility grid before the 3rd hour and 23rd when the utility price is low. It also imports some power from the grid during peak hours because the load is currently greater than the maximum power rating of ESS. During the daytime, MG3 feeds the power into the grid.
Since the generation from RER is greater than the load in MG3, the ESS charges by utilizing the excess PV power, which can be observed during the off-peak hours of Fig. 10. During the peak hours, the ESS provides the power to the load after the 18th hour when the prices are greater and it imports some power from the grid as well here because the load is greater than the rated power output of ESS. The cost of the grid is maximum here the ESS provides power until it reaches its minimum SOC.

F. MG4
The FIT for the DER is typically low when compared to the energy bought from the utility grid [35]. In this study, the FIT of Fig. 3 has been used. The results of local optimization for MG4 are illustrated in Fig. 11 and Fig. 12. In Fig. 11(b), the effect of adding resources like wind and ESS can be seen, and the individual power generation of wind and Power charging/discharging of ESS can be seen in Fig 11(a).
Since the generation from RER is smaller than the load in MG4, the ESS charges by importing energy from the utility grid. This behavior can be observed during the off-peak hours in Fig. 12. During peak hours, the ESS feeds the load and exports power to the grid after the 18th hour, when the grid costs more, until it hits its minimal SOC.  Table III shows the number of units each MG has consumed from the utility grid and the number of units injected into the utility grid throughout the day. MG1 imports more units than it exports because the generation in this MG is smaller. Since the generation is highest after 20th hour, at this time it exports some power. MG2 has a solar RER which produces more power during daytime. The rated power of the PV system is larger than the load and power required by ESS for charging. Thus, it exports more units than it acquires power from the grid. MG3 also has a rated PV capacity that is larger than the maximum demand of the load. During the daytime, it stores extra power into ESS and uses this power later during peak hours. MG4 has wind power rated greater than the maximum power demand but the wind resource is not as abundant as solar power. However, the load connected to MG 4 is smaller therefore it imports fewer units from the grid throughout the day.

G. BILLING INFORMATION
Table IV depicts the billing information for 24 hours. The cost of energy used thought out the day is calculated using the daily cost curve of Fig. 3. The optimization in the first step ensures the required units are acquired during off-peak hours. While the bill for power exported is calculated using the FIT. Although this behavior benefits the prosumers by selling their extra power to the grid, the price they get is less than the retail price of the grid at that time.

H. Total Grid power import and total load
The impact of the whole MMG system on the utility grid can be seen in Fig. 13. The substantial reverse power flow is uncertain, and causes reliability issues which may cause problems in the operation of the utility grid.
As previously stated, Table III displays the energy imported by each MG and the electricity fed into the grid by each MG. The MG2 and MG3 have more generation than the load demand they export more power than the rest of MGs. Both MGs import some power when solar energy is not available. However, by utilizing its ESS, these MGs import the aforementioned electricity at off-peak hours when grid prices are at their lowest.
If the number of RER-based DERs is large, it can compromise the thermal limits of the line. Therefore, instead of feeding this clean energy into the grid, it can be shared with neighboring MGs. This can reduce the excursions of power in the utility grid and provide a clean source of energy for the local MG, instead of a fossil fuel-based utility grid. The FIT is usually less than the retail price of electricity.

V. STAGE-3: REAL-TIME ENERGY TRADING.
Energy can be traded at a cost where the seller earns more money than the FIT and the buyer consumes power at a lower cost than the retail price of utility. The market-clearing price approach is depicted in this section.
Every 5 minutes, each buyer submits a demand bid consisting of the quantity of energy and price willing to buy, and the seller submits an offer consisting of the amount of energy selling and price.
The market then analyzes the bid and accepts the seller's offer if power is required and the offer price is less than the grid cost at that time. The buyers are accepted for competing if their bids are more than the FIT.
First, the total power that is available to trade is identified. Then, the buyers are prioritized based on their bids. The highest bidder gets the power first. If the power available for trade is greater or equal to the bidder's requested amount, the bidder is allotted the requested amount of power. After that, the remaining power is given to the next bidder in the priority list. If the power available is less than the bidder's request, the bidder with the highest priority only gets the available power. After the trade has occurred, the information is sent back to each MG to perform the transaction.
In this way when the price is less than the grid price, MGs would get the required energy from the market or sell their excess in the market. In the case of buyers, if they don't win in the bidding process, they can choose to get their needed energy from the grid at the pre-scheduled time as done in stage 1 optimization when the price of the grid is minimum. For sellers, if their selling offer is not accepted, they can sell to the grid at FIT or store the power to bid in the next slot or use it later. The controller with respective functionalities for each MG is illustrated in Fig. 14.

VI. STAGE-4: REAL-TIME OPERATION.
The RT operation of each MG is performed by four modules. Fig. 14 shows the interaction between different modules.
The main controller of MG is where stage-1 DA optimization occurs. In RT, this controller is responsible for keeping the system balanced and protected against faults. It also implements the schedule that is found via optimization and makes the decisions regarding participation in trading with neighboring MGs.
It have 4 modules named communication module (CM), real-time monitoring (RTM), database, and real-time operator (RTO). The CM is used for bidding in the market and get back the required information whereas, RTM module monitors the RER generation and load changes so that the adjustments must be made in RT to keep the system balanced. Database stores the results of the DA optimization schedule, ESS charge/discharge schedule, and the schedule of importing power from the grid. The database is updated every 5 minutes depending on the participation of MG in trading. The RTO performs the low-level control and implements the schedule commanded by the controller. MG Controller integrates all these modules, uses their resources to generate commands for RTO, and implements the energy level management.
The CM sends the data from MG to the market controller and receives data from the market after the trade is done.
MG controller decides when to send the data to market, the sending data include either bid for selling power and the price, or extra power that the MG wants to sell in the next 5 minutes. The RTM module monitors the SOC of battery, load connected to MG, and the RER and provides RT data to the MG controller.
The database also holds schedule from the previous stage optimization. The controller executes this schedule if no trading happens and decides the trading option whether to sell or buy power based on this schedule (next 5 minutes). This decision is dependent on the status of the ESS, and the RT load and generation in the MG.
The RTO executes the low-level controls of power balance, protection i.e. faults, overcurrent, undervoltage, etc., LVRT, and islanding. The trading algorithm applied is shown in the following subsection.
Where, Pseller is Psold by the seller MG. The deregulated market operation is the functional block diagram of the trading market where the trading algorithm has been implemented. The pseudo-code for the deregulated market trading algorithm is shown in Table V. The total power imported from the grid after trading is shown in Fig. 15. In comparison with the previously mentioned result in Fig. 13, shows that due to trading, the reverse flow of power does not occur for this load. However, this may not be the case for a different load. If power generation is greater than all the loads connected in MMG, the power may flow in reverse. For our test case, the power produced in MMG has been traded among MGs and there is no reverse power flow. This has reduced the stress on the utility grid and reduced load during peak hours. The power during off-peak has also been increased, which increases the load factor of the system. Peak power drawn from the utility grid without trading was 661 kW which is reduced to 327 kW after the trading is enabled. The average power flow to/from the utility grid during 24 h without trading was 103 kW which is reduced to 25 kW after trading. Table VI and VII shows a comparative analysis of the reduction in the reverse power flow in the power-line connecting the MMG system to the utility grid during peak hours of the day. The Fig. 16 represents the market-clearing price along with the utility price and feed-in price. The time intervals during which no trading occurs have no clearing price.
It can be seen from Fig. 16 that at the market-clearing price, sellers get a price greater than the FIT while the sellers get a price that is lower than the utility price at that time. Fig. 17 depicts the power sold by MG1 in the market, power bought from market and power sold at FIT to utility, and power bought from utility grid. Fig. 18 represents the power sold by MG2 in the market, power bought from the market and power sold at FIT to utility, and power bought from utility grid as well. The Fig. 19 shows power sold by MG3 in the market, power bought from the market, power sold at FIT to utility, and power bought from utility grid.
In Fig. 20, the power sold by MG4 in the market, power bought from the market and power sold at FIT to utility and power bought from utility grid are illustrated.

VII. CONCLUSION
Trading of excess energy in the market makes up to further defer the energy usage from the grid. The MGs involved in trading can benefit by selling the excess energy for prices greater than the FIT. Buying energy from neighboring MGs that is clean and at a lower cost than the utility grid during peak hours. This helps the utility by increasing the load during the off-peak hours and reducing it during the peak hours. When MGs participate in the market, they bid for the highest block of power they were to buy from the grid if they follow the DA schedule. This block of power is usually at peak hours. Once the MG gets the maximum cost block of power, for the next time, the MG will bid for the next highest price of power. This way all MGs will replace their block of power which they are to buy from the grid at peak time with power from neighboring MG. This way of trading provides all MGs with the opportunity to get their highest-cost power purchase with a cheaper one from the market. As more MGs replace their schedule by shifting away from peak load to off-peak by sharing power with each other, the peak load on the utility grid decreases. It is also observed that the average power imported from the utility grid for 24 hours is reduced from 103 kW to 162 kW and peak demand has also been reduced from 661 kW to 527 kW. This results in an increase in load factor from 16 % to 30 %. The sharing of power among MGs also reduces transmission and distribution losses. In the future work, this scheme will be implemented using the blockchain to make the system further secure and cost-efficient.