Decentralized Smart Energy Management in Hybrid Microgrids: Evaluating Operational Modes, Resources Optimization, and Environmental Impacts

Escalating energy demands and climate change challenges necessitate the adaptation of renewable-based microgrid systems in the energy sector. The proposed work employs a robust Multi Agent System (MAS) technique to achieve efficient and automated control of the hybrid microgrid operation. The hybrid microgrid system incorporates Renewable Energy Sources (RES), a diesel generator, and a battery storage system. The operation of the hybrid microgrid consists of three distinct modes: islanded, transition to grid, and grid-oriented mode. The system’s performance is optimized by considering factors like climatic patterns, energy costs, connected source characteristics, and load demand. Different climatic scenarios are assessed for each mode of operation, where the best, extreme sunny, extreme cloudy, and worst climate conditions are considered for islanded mode; sunny and cloudy scenarios are considered for transition to grid mode as well as grid-feed and grid-tied modes are considered for grid-oriented operation of the microgrid. The simulation studies are performed using the MATLAB/Simulink R2021a environment. Furthermore, Particle Swarm Optimization (PSO) is implemented to optimize power allocation within the microgrid and enhance its cost-effectiveness. The optimization results demonstrate efficient utilization of available energy sources along with effective energy management facilitated by the MAS control system. The results emphasize the importance of adopting a MAS approach for achieving smart energy management through comprehensive analysis and integrating decentralized energy management techniques for optimal accommodation of distributed energy resources in hybrid microgrids.


I. INTRODUCTION
The global increase in carbon emissions from anthropogenic activities is severely leading to global warming with an increase in temperature, causing severe climate change.
According to the 6 th report from the Intergovernmental Panel on Climate Change (IPCC), a 2 • C increase in the global temperature is expected around 2040.Thus, the 2021 IPCC report has issued an early alarm that the earth's warming beyond 1.5 • C will have detrimental effects on the planet, causing sea level rise, droughts, and floods [1].It has also recommended switching from fossil fuels to Renewable Energy Sources (RES) for energy generation and consumption.According to SDG 7, access to clean and affordable energy is the right of every household.Hence, this can be ensured by developing alternative energy sources that can tackle climate change related challenges and overcome the energy supply and demand gap.The microgrid seems to be a viable option as it utilizes RES and other small generation sources compared to a traditional power grid (primarily dependent on conventional energy sources) [2].A generalized structure of a microgrid model is presented in Figure 1.Implementing renewable energy-based technologies to improve the energy efficiency of the current power systems is among the alternatives discussed for climate change mitigation and adaptation by the energy sector [3].Adefarati and Bansal [4] studied RES environmental and economic impacts and their feasibility in a microgrid system.The proposed study demonstrates that using RES in a microgrid can reduce several extreme factors like GHG emissions, peak energy costs, load demand fluctuations, and load side losses.Blake and O'Sullivan [5] discussed the impacts of integrating RES with an industrial microgrid by considering key parameters like energy costs and GHG emissions.The study's results demonstrate a significant drop in energy costs, decreased carbon footprints and reduced GHG emissions.Hence, RES are the best remedy to achieve cost savings and environmental benefits; however, RES, like solar and wind, have a stochastic nature that varies according to climatic conditions.
Luo et al. [6] discussed the intermittent nature of wind and PV concerning grid power dispatching using a shortterm-based hybrid model that effectively compensates the forecast errors and provides uninterruptable power to load.Prajapati and Mahajan [7] proposed Demand Response Programs (DRPs) to address the uncertainties of RES and congestion management problems in microgrid operation.Wang et al. [8] considered three loads with different DRPs based on RES uncertainty, Energy Storage System (ESS), and the cost function based on market price using the PSO algorithm.The results indicate the benefits of DR, a 3.4% enhancement in voltage profile and a 20-30% decrease in total cost.Similarly, Jiao et al. [9] proposed a multi-objective model to provide a trade-off solution between maximum profits and minimum risks by considering the uncertainties involving solar and wind RES in a standalone microgrid.The proposed model can create coordination between diesel generator, PV and wind power that improves penetration of RES and maximizes the profit in standalone microgrid operation and planning.Ramadan et al. [10] considered the intermittent nature of RES and its impact on the loads based on the optimal placement and sizing of RES in a radial system using the Artificial Hummingbird algorithm.The results of the study indicate significant improvement in the parameters of the distribution bus systems.
Moreover, the energy management system control of microgrids enables managing the uncertainties of RES sources effectively and simultaneously controls the balance between energy demand and consumption.Khan et al. [11] provided insight into the operations and impacts of multi-source-based microgrids by discussing their various architectures, control strategies for their reliable operations and the solutions for meeting the requirements of their control and communication.Anvari-Moghaddam et al. [12] suggested an energy management control structure for monitoring and controlling microgrid operation in real-time through MAS based on defined standards.Results show that the suggested approach addresses the consumer's demand during uncertainties and reduces energy costs, thus ensuring optimal microgrid operation.Alam et al. [13] proposed an energy management control strategy by considering a DC microgrid in which RES and ESS are integrated.Results indicate that the integration of RES and ESS is reliable when it meets the load demand in case of transient conditions like fluctuations in the power generation of RES and abrupt changes in the load demand.Further, the researchers in [14] suggested that a stand-alone microgrid with its controllers can serve as a gateway for supplying power to remote areas without access to the utility grid.The microgrid control strategy is designed so that when the RES can't meet the load demand, the ESS provides extra power to fulfill the load demand.
Similarly, different research studies have proposed many approaches to schedule and adequately distribute the power generation from RES. Implementing an energy management system utilizing MAS can provide a reliable solution for microgrids to supply power to loads to fulfill energy demands.Kofinas et al. [15] proposed a Fuzzy Q-Learning energy management control strategy to ensure real-time control and monitoring of microgrid operations.Salam et al. [16] proposed a microgrid model based on centralized MAS control by dividing the load into critical and non-critical loads.The RES is scheduled by utilizing the Demand Side Management (DSM) technique such that the non-critical load sheds its power to support the critical load in case of low power supply to the critical load.
Jabeur et al. [17] considered a microgrid comprising PV and ESS and proposed its application for smart homes.By implementing MAS, the microgrid agents can communicate and function according to the changes in system configuration due to uncertain situations like changes in solar irradiance and variations in battery State of Charge (SoC).Moreover, Wang et al. [18] developed a communication mechanism that combines MAS and microgrid control to optimize microgrid operation.The Multi Agent Chaotic Particle Swarm Optimization (MACPSO) algorithm is designed to optimize storage techniques by considering a time-based electrical power price mechanism.The result of the proposed model indicates a reduction in environmental and operation costs.Boussaada et al. [19] have proposed an energy management system model based on the MAS technique for an islanded microgrid that supplies a sailboat using RES.AI techniques are also utilized to ensure the security of microgrid agents, real-time user interface updates, and prediction of the energy produced by the RES.The results demonstrate the model's efficiency and better security by considering the constraints of the sailboat.Abdelsalam et al. [20] considered three microgrids and employed MAS and DSM techniques for power management between them and controlling the load during different time intervals related to tariffs.Study results demonstrate reduced prices in consumer electric bills and minimization of the peak load demand.
Shi et al. [21] proposed a ring-based MAS strategy for energy management for a microgrid cluster to achieve smooth grid connection and off-grid operation.The study results show that the MAS control framework helps achieve a stable operation of the microgrid cluster through an efficient and reliable decentralized approach that improves the robustness and autonomous operation of the system.Hamidi et al. [22] proposed a MAS-based framework for intelligent energy management of a grid-connected microgrid.The framework can achieve self-reliance by resulting in 82.34% energy saving and showing the potential to reduce the need for energy storage and GHG emissions.Salehirad et al. [23] presented an energy management strategy based on MAS for an AC microgrid using Mealey machine topology and dividing the microgrid components into six different agents.The study results demonstrate that the proposed framework achieves an efficient performance of the overall system by showing improvement in power quality, enhancement of the self-reliance of the microgrid and reduction in power losses.Areekkara et al. [24] designed an energy management control framework using MAS in a real-time network for an offgrid microgrid.The study results indicate better microgrid performance in reducing power losses and meeting the load demand when tested in different scenarios involving variations in the sources and loads.Abdulmohsen and Omran [25] proposed a two-stage strategy based on the MAS framework for optimal power scheduling in an islanded microgrid.The study's results demonstrate the proposed study's effectiveness by reducing the forecasting errors and the power mismatch in real time-based operations.
Different energy management optimization techniques are used to manage the sources and loads in the microgrid.Energy management optimization results in profiting the end and utility user and balancing the demand and supply of power.Azaroual et al. [26] proposed a model comprising a smart metering system and utilization of a DR strategy that uses Time of Use (TOU) pricing.The results indicate significant daily energy and operational cost savings, efficient dynamic model performance and reduced GHG emissions.Imani et al. [27] developed a model based on DRPs that incorporated incentive-based and time-based programs by considering the price elasticity of demand and the benefits of the grid-connected microgrids.The study's findings demonstrate that implementing DRPs results in reduced operational costs, decreased load demand during peak hours, minimization of losses in the power system, enhanced microgrid reliability and facilitation of customers through energy trade.Chamandoust et al. [28] modelled the day-ahead scheduling problem of a Smart Microgrid (SMG) by creating a multi-objective function that integrates the DSM strategies with the scheduling problem in the presence of a wind energy system.The model's effectiveness is tested by implementing it on a 24-node microgrid, with the results indicating a reduction of operating cost and emission pollution.
Kumar et al. [29] considered a RES-based grid-connected microgrid and devised a Quantum Particle Swarm Optimization (QPSO) to achieve an optimal power dispatch strategy for the Distributed Generation (DG) units that maximizes the power-sharing with the utility grid.The results indicate a significant decrease in the overall energy costs and provide a path for analyzing load participation profiles to provide operational flexibility for the utility grid.Luo et al. [30] designed an Energy Management Strategy (EMS) for a grid-connected microgrid by incorporating adequate realtime data.The Modified Bat Algorithm (MBA) is utilized to tackle the uncertainties related to the microgrid, and its results are compared with other algorithms.The results indicate that the EMS system, in collaboration with MBA, has high computation speed and obtains a significant reduction in the total operational cost.Ferahtia et al. [31] considered a DC microgrid and devised an EMS strategy based on the Salp Swarm Algorithm (SSA).The results indicate a better performance by considering the power constraints and a better power quality where the overshoot is limited to under 10%.
Yousif et al. [32] considered three microgrids and proposed an approach for minimizing carbon emissions and reducing the energy costs of the microgrids by utilizing the PSO technique.Results indicate that the proposed strategy can develop an efficient energy dispatch scheduling strategy for energy sources that further yields increased microgrid self-reliance and reduced transmission losses.Further, Kerboua et al. [33] also applied PSO to minimize the energy cost of a smart city to which a microgrid supplies power.The algorithm focuses on considering optimal points where the demands of non-shiftable loads and scheduling the shiftable load to avoid peak hours.The results of the proposed study indicate a significant reduction in energy cost bills and an improvement in renewable power generation.Wynn et al. [34] modelled a decentralized energy management system to reduce operational costs under RES.The model applies PSO for optimal RES generation and load demand schedule.The results indicate the minimization of the operational costs under the worst-case scenario and the reduction of peak load demand.Salam et al. [35] also employed the PSO technique to optimize the integration of renewable-based distributed generation sources into the utility distribution system, considering their uncertainty.Their study findings demonstrate reduced power losses, enhanced system reliability and operational constraints, and maximum load sharing with substations due to implementing PSO.Aguila-Leon et al. [36] proposed an EMS strategy for an islanded microgrid by incorporating artificial neural networks and utilizing PSO to ensure optimal microgrid operation.The study's results illustrate a 59% error reduction and improved energy forecasting.
Table 1 compares the proposed study with the previous research performed on microgrids.The microgrids considered in some previous research studies are simulation-based and in some, they are optimization based.However, the proposed study performs both the simulation and optimization of the microgrid and provides a whole insight into the microgrid analysis.Also, the microgrid considered in the proposed study performs operations in both islanded and grid-connected modes, along with environmental and cost analysis.Further, using a robust MAS control strategy, the proposed microgrid ensures automated load control.The microgrid also uses the PSO algorithm to optimize the microgrid along with the MAS control strategy, thus ensuring power scheduling and cost optimization concerning the weather pattern in the environment.
Based on the above literature review and background, the major contributions of the proposed study are as follows: • The study introduces a novel hybrid microgrid incor- porating Renewable Energy Sources (RES) with robust control and automation features.Then the study presents the application of the Multi Agent System (MAS) control technique and Particle Swarm Optimization (PSO) technique to achieve smart energy management in hybrid microgrid operation.This strategy ensures that the microgrid adapts optimally to changing conditions, ensuring an improved sustainable power system operation.
• The study proposes a refined microgrid classification framework based on three distinct modes: islanded operation, transition to grid, and grid-oriented operation.This classification aids in better understanding and modelling of microgrid behaviour across various operational scenarios.
• The study contributes by devising an optimization approach for microgrid operation.This enables efficient utilization of available resources while minimizing operational costs.Additionally, the study focuses on reducing reliance on conventional energy sources and maximizing the utilization of RES.This aligns with sustainable energy goals and contributes to environmental preservation.
The rest of the article is structured as follows: Section II briefly describes the materials and methods used by the proposed study.Section III discusses the study results and analysis based on study outcomes.Section IV investigates the cost analysis and environmental impacts of RES in the microgrid.Section V concludes the article.

II. MATERIALS AND METHODS
In this proposed study, a hybrid microgrid is modelled, and the MAS control technique is implemented by designing an MAS controller using the MATLAB/Simulink R2021a environment.Furthermore, through mathematical modelling in MATLAB, PSO is implemented for power and cost optimization of the microgrid.

A. MICROGRID DESCRIPTION
The microgrid model consists of AC and DC sources, as presented in Figure 2. The microgrid control and scheduling operation is done with the help of a robust MAS technique.
According to the MAS technique, the microgrid components are divided into agents.The source agent comprises of PV power system, wind power system, ESS and diesel generator.The load agent comprises of two industrial and residential loads, each of 5 kW, with an overall power load demand of 10 kW, including industrial and residential loads, each of 5 kW.The industrial load is prioritized over the residential load among these two loads.Further, the utility grid is also included and termed as grid agent.The grid agent ensures support for the microgrid in uncertain conditions during the worst climate scenario.The components of the source agents are integrated through a 3-phase full bridge inverter that supplies the load agent and supports the grid loads in case of grid-oriented operations.Moreover, the agents are connected to the MAS controller, which utilizes the operation of the agents by controlling the sources and loads.The energy scheduling is done based on the agent performance, and the source and load operation results are shown on the output meter.Further, the Battery Storage System (BSS) acts as a backup source while the utility grid-connected to the microgrid plays its role during grid-oriented mode operations.When the RES is insufficient to meet the load demand, the microgrid operates in gridconnected mode, buying power from the utility grid.In case of excess power of RES, the microgrid sells power to the utility grid.Furthermore, the agents have no direct communication in the traditional sense.The MAS strategy operates by involving a decentralized framework where the agents interact indirectly based on local information through a shared environment such as their current states, available energy resources and environmental conditions.The MAS controller serves as a coordinator between the agents that aggregates and processes all the information from the agents.It also analyzes the collective state of the microgrid and communicates instructions to the individual agents to ensure a coordinated response to the changing environmental conditions.
By considering the mathematical parameters of the microgrid, PSO is implemented to obtain optimized power and cost curves.The mathematical model comprises estimations regarding power generation sources and forecasting of the electric load operations.

B. PV
The proposed PV model is the Trina Solar TSM-250PA05.08model, whose features are described in Table 2.The PV used in the proposed hybrid microgrid is of 9 kW.The PV is set to give maximum power by utilization of a boost converter and MPPT controller.The MPPT controller uses observe and perturb algorithm to track the maximum power of the PV panel.The MPPT controls the boost converter to achieve maximum efficiency.The cost of the power generated by the PV power system can be explained by Eq. ( 1): where C p = Cost per Watts; O p = Operation & Maintenance Cost; P PV = Power generated by the wind power system.

C. WIND
The wind power system comprises of wind turbines that act as prime movers and are coupled to the shafts of the generators used.The kinetic energy of the wind spins the turbines of the wind turbine and produces mechanical energy.The mechanical energy is converted into electrical energy through the generators connected further to wind turbines [37].The power produced by wind turbines depends upon the wind speed and the installed capacity of the generators connected.Eq. ( 2) can show the cost function of the wind power system.
where C W = Cost per Watts; O W = Operation & Maintenance Cost; P WT = Power generated by the wind power system.

D. DIESEL GENERATOR
The diesel generator model comprises a synchronous machine, governor and excitation system.Its cost function comprises fuel cost, operation and maintenance cost, replacement cost and startup cost [38].
where, F D = Amount of Fuel Consumed; C diesel = Price of diesel where, ρ = Operating cost (0.008 $/kWh); P D = Power generated by Diesel Generator; where, P DG = Price of Diesel Generator, N DG = Number of Diesel Generators, f r = inflation Rate, i r = Interest Rate In this study, the Lithium-ion (Li-ion) battery model is utilized as the BSS because of its better efficiency and reliability compared to other battery models.When the RES are insufficient to meet the load demand, and the microgrid operates in islanded mode, the BSS acts as a backup agent to balance the supply and demand ratio.
The BSS system model comprises a Li-ion battery connected to a bi-direction DC to DC buck-boost converter and a PID controller.The buck-boost converter is a bi-directional DC-DC converter that enables the power flow between the microgrid and the battery [39].In the case of charging, the battery acts as a load, and in the case of discharging state, the battery acts as a DC source.Moreover, the PID controller manages the charging and discharging to maintain the balance between the BSS and the microgrid power infrastructure.

F. INVERTER
In this study, a three-phase full bridge inverter is designed in which the thyristors conduct for 180 degrees.A threephase full-bridge inverter transforms DC power input into three-phase power output.It is a six-step bridge inverter that utilizes six thyristors.A step is defined that shifts the firing from one thyristor to the next one in a specific order.Each step has a 60-degree interval for producing a 360-degree cycle.The thyristors can be gated in two ways, where each thyristor conducts for 180 degrees in one pattern and 120 degrees in the other [40].
PV and wind are integrated to form a hybrid combination of RES.As the load is AC, the PV and wind RES supplying power in DC are coupled with the three-phase inverter to convert their DC power into AC power.The AC power is then supplied to the AC load bus comprising of a 10 kW load, classified into residential and industrial loads, each of 5 kW.

G. UTILITY GRID
The utility grid in the proposed study is 11 kV, with two loads connected to it.The two loads are termed as grid loads, and they are dependent on the grid power supply.When the microgrid has excess power, it supplies power to the grid, minimizing the power losses that are faced by its loads.Moreover, when the RES are insufficient to operate the microgrid loads, the microgrid operates in grid-connected mode and supplies power to the residential and industrial loads operating under the microgrid.
The utility grid is integrated with the microgrid to sell and purchase electricity.Using the net metering protocol, the microgrids participate in the electricity market and benefit from the price set according to the Time of Use (TOU) mechanism.Eq. ( 8) represents the utility grid's cost function.
where C G = Price of the unit offered by the utility Grid, P G = Power of the Utility Grid.

H. OBJECTIVE FUNCTION
The main objective function of the optimization strategy is to minimize the energy cost of the microgrid when operated by the RES (PV and wind).
I. MAS STRATEGY MAS comprises independent agents that perform autonomous actions to execute the assigned tasks.The MAS control scheme is designed to schedule sources and loads by considering the operation modes of the microgrid [41].The MAS agents include the Source agent, grid agent and load agent.The source agent comprises PV, wind, diesel generator and BSS.The grid agent includes the utility grid, while the load agent includes entities of 10 kW.The proposed study establishes a relation between the agents by designing a controller based on MAS, which recognizes the power of the agents and the loads.Then, it schedules the sources and the loads according to their availability and penetration and supplies power to the loads.proposed strategy, the power of RES, including wind and PV, is determined by considering the BSS performance, diesel generator power and utility grid performance.
According to Figure 3, the sources' performance depends upon weather uncertainties when the microgrid operates in islanded mode.Hence, the high-RES penetration during the best climate scenario can charge the BSS and operate both the industrial and residential load.In the extreme cloudy climate scenario in the evening or extreme sunny conditions at noon, the microgrid can get power from one RES, depending on the condition.The battery is scheduled with the available RES to meet the load demand.Moreover, during the worst climate scenario, blackouts arise due to adverse weather conditions.The diesel generator is utilized to supply power to the microgrid, which is further scheduled to operate the industrial load as the industrial load is prioritized over the residential load.
The transition to grid mode process occurs when the BSS can't further discharge.Hence, two scenarios based on the climatic patterns, including the sunny and cloudy climate scenarios, are considered during the transition case, as shown in Figure 4. First, for high PV penetration and low wind power during sunny climate scenario, the utility grid is scheduled with the PV such that the utility grid supply operates the residential load and the PV operates the industrial load.Similarly, in the cloudy climate scenario, the utility grid is scheduled with the available wind power in such a way that the wind power supports the residential load.In contrast, the industrial load is supported through the utility grid.In grid-oriented mode, the scenarios include grid-tied and grid-feed modes, as shown in Figure 5.When the wind and PV cannot generate power due to uncertain weather and the BSS can't meet the high load power demand, the microgrid is scheduled to buy power from the utility grid.In such a scenario, the microgrid operates in grid-tied mode.Furthermore, during the grid-feed mode, the microgrid operates in islanded mode, with high RES penetration.The microgrid can feed the utility grid, helping it recover its load losses.The grid feed mode can also be economically profitable for microgrid users as the power is sold to the utility grid.

J. PSO
PSO is a technique for solving optimization problems by simulating the behaviour of birds searching for food in a flock.Each bird is considered a particle with a fitness value determined by the optimized function.Moreover, each particle has velocities that determine how it moves.The main objective of the algorithm is to find the best possible optimized solution by adjusting the velocities of the particles concerning their positions [42].
Figure 6 represents the strategy according to which optimization of the microgrid is performed.First, the parameters of PV, wind, diesel generator, BSS and utility grid are considered and designed to generate power according to the requirement.By considering the powers of the sources, the cost functions of the sources are designed.Hence, the objective function is developed considering the sources' cost functions.The goal of the objective function is to minimize the energy costs of RES and minimize the use of diesel generator (fossil fuel-based source).

III. RESULTS AND DISCUSSION
The simulation of the proposed study was performed in MAT-LAB Simulink.A hybrid microgrid comprising DC and AC sources was modelled, and three modes of operation were considered with different scenarios.The three operation cases include islanded mode, Transition to grid mode and gridoriented mode.
Table 4 shows the overall analysis of the microgrid operations and their climate-based scenarios on which the results are determined.The islanded mode operation is divided into 4 scenarios: the best climate where all the RES are available, extreme sunny climate where the PV source is available only along with the battery, and extreme cloudy climate where the wind power source is available.It is scheduled with the batter and worst climate where only the diesel generator is available.The transition to grid operation is classified into sunny and cloudy climates, where the grid operation is scheduled with the respective available PV and wind power sources.Further, the grid-oriented operation is divided into grid-tied scenario where the microgrid buys power from the utility grid to meet its load demand and grid feed mode, where the microgrid sells surplus power to the utility grid.

A. ISLANDED MODE
In islanded mode operation, the microgrid operates on the sources connected to it.Three climatic scenarios are considered to analyze the islanded mode of operation.
Further, the data of the cases is optimized through the PSO algorithm, which results in a power curve and cost curve.The power curve indicates the analysis of the whole scenario with the help of the PSO algorithm for 24 hours forecast.The cost curve indicates the monthly cost of energy utilization of the loads for utilization of different scenarios involved with the islanded microgrid mode of operation.

1) SCENARIO 1: BEST CLIMATE
During the best climate scenario, the RES, including PV and wind, are sufficiently available to operate the microgrid loads.PV power is available at its maximum power of 9 kW.
Wind power is also available at its maximum limit of 5 kW.The total load demand is 10 kW, including the industrial and residential load, each 5 kW.Moreover, the diesel generator is not utilized and is turned off while the RES charges the BSS.As both RES are available, the supply is enough to meet the load demand; there is no need for running the backup diesel generator.The battery SoC is set to 50% and acts as a load by operating in charging mode.Figures 7 and 8 show the power output of the residential and industrial loads.After optimizing the data of the best climate scenario with the help of the PSO algorithm, the optimized power curve and cost curve are obtained.The optimized power scheduling curve in Figure 9 indicates that the RES are high and try to meet the load demand of 10 kW.It is also demonstrated in the power curve that when the load demand is high between 10 to 15 hours, the wind and PV are designated to meet the load demand of 10 kW.Further, the operational cost curve in Figure 10 indicates the monthly cost of the scenario and performs the cost optimization for 100 iterations.The cost starts from 4586 Cents and stabilizes at 4578 Cents.As no extra taxes are related to the RES utilization, its energy cost is economical compared to the utilization of diesel generator.

2) SCENARIO 2: EXTREME SUNNY CLIMATE
During an extreme sunny climate scenario from 12-13 hours, the PV irradiance is high, and the wind speed flow is less, so the PV power is at its maximum peak while the wind power is at its lowest level.Therefore, to support the overall load demand of 10 kW, the 5 kWh BSS will operate and balance the load demand comprising of a 5 kW industrial load and a 5 kW residential load.The wind power is thus insufficient to meet the load demand of 10 kW, due to which the 5 kWh BSS discharges and balances the load demand requirements.Figures 11 and 12 show the demand for residential and industrial loads, respectively.Each load is 5 kW, and they are operated by the PV power system supported by the 5 kWh BSS.
Figure 13 indicates the power curve based on 24 hours.The microgrid behaves as a non-hybrid microgrid and depends  on PV and battery.When the load demand is high at 14 to 15 hours and 19 to 20 hours, and the PV power is less due to the uncertainties involved, the battery operates along with the PV to meet the load demand according to the requirement.

3) SCENARIO 3: EXTREME CLOUDY CLIMATE
When the wind speed becomes high and the solar irradiance is low at 17-18 hours, the wind power plant gives a maximum peak power of 5 kW.Hence, the wind power system is 5 kW, which operates along with the battery to meet the load demand.The backup diesel generator does not operate and is on standby mode while the battery SoC indicates the discharging status.The industrial and residential loads, as shown in Figures 15 and 16, will thus operate at 5 kW each, and the supply-demand ratio will be balanced.Moreover, according to the MAS strategy, the BSS operates the industrial load while the wind power system operates the residential load.Figure 17 demonstrates that during cloudy climatic condition, when the load demand is high before 15 hours and the wind is unavailable, the battery and the backup diesel generator will operate and try to meet the load demand.When the wind power is high after 20:00 hours, the load demand will be met by the parallel operation of the battery along with the wind power system.Figure 18 indicates the optimized operational cost, which is higher as compared to scenarios 1 and 2. The cost curve is stabilized at 5348 Cents, by starting from 5430 Cents.

4) SCENARIO 4: WORST CLIMATE
Figures 19 and 20 show the output powers of the two loads, including the residential and industrial loads.The residential load does not operate, and the microgrid MAS scheduling controller prioritizes the industrial load of 5 kW.The worst climate scenario occurs at 22:00 to 23:00 hours due to uncertain weather conditions like storms or blackouts.In this scenario, RES comprising wind and solar power, along with BSS, are unavailable.Thus, a backup diesel generator source is used to operate the industrial load as it is given high priority over the residential load.The diesel generator is an AC power source connected to the microgrid.With the help of the PSO optimization technique, the power and cost curves are obtained, as shown in Figures 21 and 22. Figure 21 shows the optimized power curve of 24 hours.When the load demand is high at 14:00 hours, the microgrid is unable to meet the load demand as the diesel generator is prioritized for supporting industrial load of 5kW at high priority.Furthermore, Figure 22 shows the optimized cost curve based on the monthly operational cost.The cost curve stabilizes at 6220 cents.The cost in this scenario will be high due to the carbon emission taxes related to the operation of the diesel generator.

B. TRANSITION TO GRID MODE
The transitions from islanded mode to grid mode can be planned and unplanned.Planned transitions involve initiated return transfers from islanded to grid-oriented operations.In contrast, the unplanned transition involves automatic transfer from islanded to grid-tied operation due to a utility grid disturbance.

1) SCENARIO 1: SUNNY CLIMATE
Figure 23 shows the output of the residential load supported by the utility grid.From 13:00 to 14:00 hours, the PV penetration is high while the wind speed is lower, so the wind operates at a less power while PV operates with its maximum power.When the battery capacity becomes less, the sources are scheduled such that the PV supports the industrial load, and the grid support becomes necessary.Hence, the 11 kV utility grid supports the microgrid residential load.shows the output of the industrial load supported by the PV power system, respectively.
The optimized power curve shown in Figure 25 indicates the behaviour of the scenario for 24 hours, depicting that in case of high load demand, when PV is high and the wind is less, other power sources are utilized to keep the microgrid in operation.In the case of low availability of RES (PV and wind), the utility grid is necessarily required to support the whole load, and thus, it is suitable to shift to grid-tied mode.Moreover, the estimated cost curve in Figure 26 shows the operational cost, which starts from 5707 Cents and becomes stable at 5693 Cents.The obtained cost in this case is higher as compared to scenario 2 (extreme sunny climate scenario) of the islanded mode operation, because the utilization of the utility grid indicates the microgrid's transition to the gridconnected operation.2) SCENARIO 2: CLOUDY CLIMATE During 18:00-19:00 hours, there is high wind speed and a lower irradiance, so maximum wind power around 5 kW and lower solar power is available.The microgrid is scheduled such that the wind power system supplies power to the residential load while the PV system is not utilized.Hence, power is bought from the utility grid of 11 kV to support  the industrial load.Figures 27 and 28 show the load outputs of residential and industrial loads where the wind power system supports the residential load and the industrial load is supported by the utility grid, respectively.
When optimization is performed, the optimized power and operational cost curves are obtained, as shown in Figures 29 and 30  grid is utilized along with the wind power system, the optimized cost is high compared to scenario 3 (extreme cloudy climate scenario) in the islanded mode case.

C. GRID ORIENTED MODE
In grid-oriented mode, the RES supports its loads and the grid in case of excess supply.The MAS scheduled technique is such that in case of excess power, the microgrid sources supply power to the utility grid to support it.Moreover, in case of less penetration of RES, the grid is scheduled to support the residential and industrial loads operated by the microgrid.

1) SCENARIO 1: GRID FEED MODE
The weather condition is better from 10:00 to 11:00 hours, and both the RES, including the PV and wind power systems, are available.Before the feed by the microgrid, the power supplied to the load is 5 kW, and there are losses of 2 kW, because of which the load cannot operate reliably.When the microgrid is scheduled such that to supply power to the utility grid, the losses of 2 kW in the grid load are countered, and as a result, the grid load operates on 7 kW power without showing any losses.Figures 31 and 32 show the power of the load operated by the grid before and after microgrid support.33 that when the RES are available in high penetration and the load demand is high from 12:00 to 14:00 hours, the microgrid can meet the load demand and supply power to the utility grid.Furthermore, Figure 34 shows the operational cost curve, stabilizing at 4317 Cents and indicating an economical operational cost compared to the previous cases.

2) SCENARIO 2: GRID TIED MODE
The 11 kV utility grid supplies power to the residential and industrial load to meet the load demand, as shown in Figures 35 and 36.When the weather is uncertain from 20:00 to 21:00 hours such that the PV and wind powers are insufficient to support the 10 kW load demand (comprising of industrial and residential loads), the energy management is done such that the utility grid supports the overall 10 kW load operated by the microgrid.
The power and operational cost curves are obtained when optimization is performed, as shown in Figures 37 and 38.The operational cost curve stabilizes at 6020 Cents.The cost is high in this scenario due to the tariffs and taxes involved with the main grid that is to be paid by the utility and end consumers.

IV. COST AND ENVIRONMENTAL ANALYSIS A. ANALYSIS BASED ON COST
Table 5 shows the costs of the sources and microgrid operation costs.According to the IRENA Report [43], the PV operation and maintenance cost is 0.057 $/W and the LCOE is 0.040 $/W.The LCOE for wind is 0.084 $/W and O&M is 0.05 $/W [44].The utility grid LCOE is 0.11 $/W [45].Further, the diesel generator fuel cost is 0.3 $/litre [46], which determines the fuel consumption cost.These costs are further utilized in the optimization process of the microgrid through PSO for determining the optimized cost curves.Moreover, the table also explains the optimized costs for microgrid operations, demonstrating that when the microgrid is in islanded  and grid feed, it is more economical compared to grid-tied mode.The diesel generator operation is costly as compared to the operation of other cases.
Figure 39 presents the optimized operational costs of the considered microgrid scenarios.In grid-oriented mode, Scenario 1 (grid-feed) achieves the most economical operation with the optimized cost of $43.17 as the microgrid operates independently and sells surplus power to the utility grid.Scenario 4 (worst climate scenario) of the islanded mode operation is the least economical, with an optimized cost of $ 62.3, as the microgrid depends upon the diesel generator.Furthermore, scenario 2 (grid-tied) is also the least economical in grid-oriented mode, with the optimized cost of $60.22, as the microgrid purchases power from the utility grid.

B. ANALYSIS BASED ON ENVIRONMENT
According to IPCC, the CO 2 emission from solar is 41 g of CO 2 per kWh of electricity generated [47].Thus, the carbon footprint for 9 kW solar is 369 g CO 2 /hour and 10.05 kg CO 2 per day.According to the US Department of Energy, wind produces 11 grams of CO 2 per kWh of electricity generated [48].The carbon footprint for 5 kW wind power is 55 g CO 2 /hour.According to [49], the emission factor for diesel generator is 1.27 kg CO 2 /kWh.The carbon footprint for 5kw wind power is 8.9 kg CO 2 /kWh.According to [50], the battery's average CO 2 emission rate is 150 g CO 2 /kWh.So, for the BSS of 5 kWh, the CO 2 emissions will be 750 g CO 2 /kWh.According to [51], the average CO 2 emission rate for utility electricity generation is 0.855 pounds of CO 2 , equivalent to 0.387 kg CO 2 /kWh.The evaluations given in Table 6 show the carbon footprint for the sources utilized by the microgrid.The wind and solar RES have the lowest carbon footprint compared to the diesel generator.The diesel generator and utility grid have the highest carbon footprint compared to the RES.Thus, the analysis indicates that RES are environmentally friendly due to their low emission rate compared to the utility grid and the diesel generator.Moreover, the diesel generator has the highest carbon footprint, which shows it is not environmentally friendly.

V. CONCLUSION
The proposed study focuses on the integration of renewable energy-based microgrids by modelling a hybrid microgrid and presenting a robust MAS-based control technique for optimal operation and scheduling.The study analyses the microgrid operations by dividing them into islanded, transition to grid and grid-oriented modes according to different climatic scenarios.During favourable climatic conditions, the microgrid loads are powered by renewable energy sources, including PV and wind.In contrast, the microgrid prioritizes the diesel generator to operate the critical industrial load during the worst climatic conditions.During the later transition to grid operation mode, the MAS effectively coordinates the utility grid and the available power sources to ensure reliable power supply to the microgrid loads.In grid-oriented operation, during the grid-feed mode, the microgrid sells surplus power to the utility grid, whereas, in grid-tied mode, the microgrid relies on the utility grid to fulfill its load demand.
Furthermore, the utilization of PSO to optimize the power allocation of the microgrid and costs across each operational mode demonstrates the effectiveness of the hybrid MAS-PSO approach.Under the different climatic scenarios, the optimized operational cost shows significant variations, with $45.7 during the best climate scenario and $62.20 during the worst climate scenario.During the transition to grid mode, the optimized operational cost is raised due to the utility grid's high LCOE of $0.11 as compared to that of PV ($0.040) and wind ($0.084).In the grid feed scenario, the microgrid efficiently sells its surplus power to the utility grid, resulting in an optimized operational cost of $43.17, while in the gridtied scenario, the optimized operational cost is $60.22 due to the high reliance on the utility grid.
The study highlights the cost-effectiveness of the islanded mode of microgrid operation as compared to grid-tied operation, with the diesel generator exhibiting a higher carbon footprint of 8.9 kg CO 2 /kWh as compared to wind and PV sources, which have carbon footprints of 55 g CO2/kWh and 369 g CO 2 /kWh, respectively.The proposed study serves as an energy framework for other researchers.Future work can involve integrating the microgrid simulation with various metaheuristic algorithms and forecasting techniques to gain deeper insights into source and load behaviours and microgrid operations.Different microgrid based power systems can be analysed by considering changing weather patterns and environmental fluctuations and results can be compared with this proposed approach.

FIGURE 1 .
FIGURE 1.A generalized structure of a microgrid model.

7 )
) where, σ D = Hot Startup, δ D = Cold Startup, T OFF,D = Off time, T D = Cooling Time, u (t−1),D = Status of Diesel Generator • Overall Cost Function C DG = C fuel + C O&M + R DG + C startup (

Figures 3 ,
4 and 5 show the microgrid operation and control strategy by utilizing the MAS strategy.According to the

Figure 14
Figure14indicates the monthly operational cost of the scenario.The cost curve rises from 5440 Cents and stabilizes at 5430 Cents.Moreover, in this case, as wind power is not utilized, the energy cost is high compared to the hybrid microgrid.

Figures 33 and 34
Figures 33 and 34  show the optimized scheduled power curves and operational cost.It is demonstrated in Figure33that when the RES are available in high penetration and the load demand is high from 12:00 to 14:00 hours, the microgrid can meet the load demand and supply power to the utility grid.Furthermore, Figure34shows the operational cost curve, stabilizing at 4317 Cents and indicating an economical operational cost compared to the previous cases.

TABLE 1 .
Literature analysis table.

TABLE 4 .
Microgrid operational modes and their respective scenarios.

TABLE 6 .
Carbon footprint of the microgrid sources.