Optimizing Renewable Energy Integration through Innovative Hybrid Microgrid Design: A Case Study of Najran Secondary Industrial Institute in Saudi Arabia

: Amidst a growing global focus on sustainable energy, this study investigates the under-utilization of renewable resources in the southern region of Saudi Arabia, with a specific emphasis on the Najran Secondary Industrial Institute (NSII). This research presents an in-depth analysis of installing a hybrid microgrid (MG) system on the roofs of NSII buildings, exploring six cases with varying tilt and azimuth angles. The study innovatively integrates architectural design and system administration, a novel approach for this location, and benchmarks the optimal angles against Hybrid Optimization of Multiple Energy Resources (HOMER) software defaults. The proposed system consists of solar photovoltaic (PV) panels, a battery storage system (BSS), a converter, a diesel generator (DG), and a grid. The selected model balances technological and economic viability with environmental considerations, ensuring a reliable power supply within the NSII’s roof area constraints. An extensive sensitivity analysis evaluates the system’s resilience across different scenarios. The current system, which is grid-only, has an estimated Net Present Cost (NPC) of about USD 7.02M and emits 1.81M kg/yr of CO 2 . The findings point to installing a microgrid with a 20.97° tilt and 50° azimuth angle as optimal, demonstrating 54.69% lower NPC and 92% lower CO 2 emissions, along with zero kWh/year unmet electrical load when applying the resilience assessments. This outcome highlights Saudi Arabia’s southern region’s renewable energy potential, aligning with national mega-projects and energy initiatives.


Introduction
The global rise in demand for power due to globalization has led to an increased reliance on diverse power sources, which has required the addressing of environmental challenges like reducing carbon dioxide (CO 2 ) emissions and its associated costs.This underscores the importance of microgrids (MGs) as a sustainable solution.Saudi Arabia is unique in its direct use of crude oil for power generation, with nearly 60% of its electricity coming from oil, while the remainder is sourced from natural gas, as shown in Figure 1.The power generation sector, with other energy sectors, contributed to CO 2 emissions rising by 300% between 1990 and 2019 [1].Despite this reliance on fossil fuels, the country possesses significant untapped potential in renewable energy sources, including solar, wind, geothermal, and waste-to-energy resources.This potential represents a compelling opportunity for Saudi Arabia to diversify its energy mix and reduce its carbon footprint in line with global sustainability goals [2].Saudi Arabia's Vision 2030 focuses on the growth of energy and the expansion of non-associated natural gas.The goal is to decrease the country's dependence on oil (including natural gas) in favor of generating electricity using preferable (i.e., renewable) sources.The Saudi National Renewable Energy Program (NREP) aims to achieve 50% of the nation's electricity generation from renewables by 2030 [3,4].The NREP consists of 13 projects, with a combined capacity of 4870 MW.Solar energy dominates, accounting for 91.8% of this total, with wind energy accounting for the remaining 8.2%.By 2024, these projects aim to produce a total of 15,108,701 MWh of electricity per year, which is enough to cover the electricity demand for 692,557 households.These projects assume a reduction in fossil fuel consumption that will lead to an annual decrease of approximately 9,828,156 tons in CO 2 emissions by 2024 [5].The Kingdom of Saudi Arabia is working to lead the global energy sustainability campaign to reach net zero greenhouse gas emissions by 2060.
In this study, the underutilization of renewable resources in Saudi Arabia, with a case study on the Najran Secondary Industrial Institute (NSII), is investigated by an indepth analysis of a hybrid MG system at NSII, exploring six cases with varying tilt and azimuth angles.A benchmark study of the optimal angles against Hybrid Optimization of Multiple Energy Resources (HOMER) software defaults was conducted.Considering the NSII's roof area constraints, an approach ensuring a reliable power supply is presented for the selected model that balances technological and economic viability with environmental considerations.

Literature Review
The case study in [7] involved designing a solar photovoltaic (PV) microgrid for a hospital in Dhaka.The electrical load and solar profiles were assessed.An optimization problem minimizing cost and emissions while maximizing reliability was solved using HOMER software.In reference [8], amid Saudi Arabia's escalating energy demands, the authors evaluated a grid-connected PV-wind system for a 15,000 kWh/day community electrical load.Using HOMER software and King Abdullah City for Atomic and Renewable Energy (KACARE) data, four cities were assessed, with Yanbu proving the most viable, with minimal costs and emissions, thereby suggesting a global potential for similar climates.Alhawsawi, in [9], used HOMER to design optimal hybrid renewable energy systems for an MG at Oakland University, whereby meeting unmet electrical loads and reducing greenhouse gas emissions were emphasized.The systems incorporated solar PV, energy storage system (ESS), combined heat and power (CHP), and wind turbines (WT), thus aiming for flexibility and scalability.The results showcased a sustainable energy solution with a peak electrical load of 9.958 MW, a net present cost (NPC) of USD 30M, and a levalized cost of energy (LCOE) at 0.00274 USD/kWh.The authors of [10] found that integrating renewable energy sources (RESs), specifically solar PV and wind energy, helped with achieving strategic objectives in Saudi Arabia.An optimal MG system for the Islamic University of Madinah was studied with the following three alternatives analyzed: PV, WT, and hybrid systems.Using real weather data, the results indicated that the PV system could provide up to 3.03% of the university's annual electrical consumption with an LCOE of 0.051 USD/kWh.The WT and hybrid options had different benefits and costs, but all contributed to reducing emissions, thus aligning with Saudi Arabia's strategic goals.To address the challenges posed by an increasing number of electric vehicles, specifically their energy sourcing and grid load, the researchers used HOMER software.A PV-WT hybrid energy-charging station was designed and optimized with applicability for worldwide use.The best solution comprised 44.4% wind and 55.6% solar energy, which produced an annual electricity of 843,150 kWh at a cost of 0.064 USD/kWh [11].The authors of [12] conducted a study focusing on New Sohag University in Egypt, and two MG systems based on renewable energy sources were compared.The first system comprised PV, a diesel generator (DG), and a converter.The second improved on this by incorporating ESS, including batteries for long-term storage and flywheels for shortterm use.Utilizing HOMER software, the economic and environmental outcomes of both systems were assessed, including the costs, CO 2 emissions, and degree of diesel consumption.Dahiru et al. [13], utilized HOMER for a techno-economic evaluation in various tropical regions in order to conduct a performance analysis of renewable-energybased distributed grids.Specifically, in the Sudan Savannah region of Nigeria, six scenarios with grid-connected nanogrids were proposed to meet a daily residential demand of 355 kWh and a per capita energy consumption of 150 kWh.The outcomes demonstrated an LCOE between 0.0110 USD/kWh and 0.0095 USD/kWh, as well as an NPC between USD 366,210 and USD 288,680, as negative values, thereby indicating potential for significant grid export.Remarkably, a renewable energy fraction of up to 98% was attained with greenhouse gas emissions as low as 2328 tons/year.Islam et al. [14] explored the rarely investigated hybridized PV/wind/hydro system with pumped hydro storage (PHS) for community electricity demand in Newfoundland, Canada.This PHS-based hybrid system was contrasted with battery-based configurations, with comprehensive assessments of techno-economic and environmental potentials over traditional battery and diesel-only systems.The findings highlighted the hybrid system's ability to provide electricity at a notably reduced cost (0.136USD/kWh) compared to dieselonly setups (0.355 USD/kWh), resulting in significant diesel and CO 2 savings annually.The PHS-based hybrid demonstrated cost and energy advantages over BSS, with hydro integration further reducing energy costs by 58% compared to PV/wind/PHS alone.The authors of [15] aimed to optimally size hybrid energy storage using a fuel cell (FC) system and supercapacitor (SC) for off-grid renewable applications, thus focusing on reliability and cost effectiveness.The optimal system, which was designed for a 20-year lifespan, consisted of 1351 kW PV panels and a 80 kW fuel cell stack, as well as other specified components, with the PV panels accounting for 98.2% of the electricity production.The NPC stood at USD 26.5M and the LCOE at 4.78 USD/kWh.A sensitivity analysis highlighted the significant impact of hydrogen storage costs on the overall system.The six cases studied in [16] were assessed with respect to their feasibility in a hybridized energy system with PV, WT, and DGs with BSS for a remote village in northern Bangladesh.Utilizing HOMER software, the optimal system was identified, which consisted of 73 kW PV arrays, a 57 kW DG, and a 387 kWh BSS.This system, with an LCOE of 0.37 USD/kWh and an NPC of USD 357,284, reduced CO 2 emissions by approximately 62% compared to the kerosene used in the current system and 67% versus the grid system.Utilizing the advanced capabilities of HOMER software, the authors of [17] innovatively integrated distributed and centralized generation, thereby incorporating a solar thermal system with five other technologies.Focusing on a seldom-addressed CHP microgrid design for a remote community in Newfoundland, the study found that renewable sources can supply all electric and majority thermal loads, thus proving to be more cost-effective than a diesel-only basis.A study that focused on the island of Favignana in Italy [18] employed HOMER software to explore sustainable energy solutions, particularly in terms of evaluating the integration of hydrogen and battery storage for both electricity and public transportation through electric FC and hydrogen-compressed natural gas vehicles.The results revealed that a hybrid storage system, one that utilizes batteries and an electrolyzer, emerged as a viable option to enhance energy independence and to decarbonize the transport sector in small islands, thereby aligning with both economic and environmental sustainability objectives.
In a study by Islam [19], the integration of a hybrid renewable energy system (HRES) in a large office building was examined in terms of minimizing grid electricity use and assessing the economic impacts of incorporating green vehicles.Utilizing HOMER software, it was found that implementing solar PV curtails grid electricity consumption by 43% and decreases the unit electricity cost by 10%, while also reducing emissions by over 90%.Another grid-connected system was introduced in [20] as an economical and technologically advanced solution for electrifying a rural village in India, and this was achieved by focusing on the optimal sizing of an integrated renewable energy system (IRES) coupled with a grid for consistent power.Through utilizing PV, BSS, and a grid, the system design and its sensitivity, as well as techno-economic analyses, were constructed using HOMER software, and this was achieved considering various electrical load profiles via a demand response strategy.Notably, the configuration boasting LCOE and TNPC alongside the highest renewable fraction was identified as optimal, thereby ensuring minimized CO 2 emissions and demonstrating effectiveness in offering a reliable 24/7 power supply, even with restricted grid availability.A techno-economic performance study of grid-connected PV power systems across five different climate zones in China, utilizing HOMER software for evaluation, was evaluated in [21].Through considering aspects like monthly average electric production, economics, and environmental impact, the study underscored that grid/PV systems are technically, economically, and environmentally viable across all investigated zones.
In a study addressing the resilience of a proposed MG [22], which encompassed PV, WT, ESS, DG, and converters, HOMER software played a crucial role in evaluating its operational robustness.Through the simulation of various challenges via randomized power outages across numerous days throughout the annual cycle, the software provided insights into the MG's performance amidst potential real-world disruptions.Additionally, a novel resilience index was introduced, thereby offering a metric to gauge the extent of unmet electrical load demands during such perturbations.The authors of [23] utilized HOMER software to explore the potential of significant renewable energy integration in a remote, sub-tropical island's power system.The study focused on contrasting the hybrid MG's benefits against a solely diesel-based configuration in terms of technical, financial, and environmental aspects.The findings revealed that the existing diesel system was economically burdensome for island inhabitants.However, a PV/wind/diesel/battery hybrid MG emerged as the most cost-effective solution, as it was notably cheaper in terms of NPC and per-unit electricity cost while achieving a 56% renewable energy share and reducing CO 2 emissions by 23%.Sawle et al. [24] studied an electrical load around 900 kWh/d with almost 100 kW peak in Ukai City, India.In that study, HOMER software was able to determine the most feasible hybrid system from four configurations, thereby settling on a PV, WT, MH (micro hydro), converter, battery, DG, and BG (biodiesel generator) hybrid system.This system offered the lowest COE and NPC at USD 0.196 and USD 831,217, respectively.Additionally, it boasted a high renewable factor of 81.2% and fewer emissions, thus making it more environmentally friendly.Table 1 summarizes most of the recent studies cited in this literature review.

PV
A photovoltaic cell is a device that directly transforms energy into usable electricity through a physical and chemical phenomenon known as the photovoltaic effect.These cells fall under the category of devices, which means that they undergo changes in properties (such as current, voltage, and resistance) when exposed to light from natural sunlight or artificial sources.Solar cells play a role as components in PV modules, which are commonly known as solar panels.Furthermore, they have the ability to function as photo detectors by sensing light or electromagnetic radiation within the spectrum, and they can also measure its intensity [25].

ESS
Energy storage refers to the process of capturing and storing the energy to be released when a system needs it.It has a critical role in addressing the challenges associated with supply-demand fluctuations and supporting the integration of RES into the grid.Energy storage serves both short-and long-term needs, thereby offering frequency control, stability, and energy management.It complements primary generation by providing reserve power, thus enhancing the effectiveness of the electric supply network [26].Various energy storage systems have been developed to include pumped hydro power, compressed air energy storage, batteries, flywheel super capacitors, and hydrogen.

Electrical Load
The concept of electrical load refers to the quantity of power or energy used by devices and systems in a particular circuit or network.It indicates the demand imposed on the supply.The electrical load is usually measured in terms of electrical current (amperes) or power (watts).Having knowledge about electrical loads and their effective handling is crucial for ensuring the stability and effectiveness of systems.

DG
In a hybrid MG, a diesel generator often serves several key purposes such as backup power, supply stability, peak shaving, energy cost optimization, or as emergency services (especially in critical facilities like hospitals).Overall, the role of a DG in a hybrid MG is to complement RESs by ensuring that the power supply is both reliable and continuous.

PV Modeling
The PV system plays a crucial role in harnessing electricity from solar energy.Various environmental factors, including the surrounding temperature and the intensity of solar radiation, significantly influence the PV system's power output.To accurately model and predict the performance of the PV system, the following equation was employed [27,28]: where f PV is the PV derating factor (%); Y PV refers to the rated capacity of the PV array (kW); G T is the global solar radiation incident on the surface of the PV array in the current time step (kW/m 2 ); G T,STC = 1 kW/m 2 is the standard amount of incident radiation at standard test conditions (STC), (25 • C); and α P is the temperature coefficient of power (%/ • C).Meanwhile, T C and T C,STC are the PV cell temperature under operating conditions and the PV cell temperature under the STC, respectively.The PV cell temperature was determined by the following Equation [29]: where T a indicates the surrounding temperature in ( • C), and NOCT is the value of nominal operating cell temperature, which is typically between 45 • C and 47 • C.

BSS Modeling
In MG systems, RESs are subject to constant fluctuations and intermittence in power generation due to their dependence on environmental conditions.ESSs, particularly battery banks, play a pivotal role in stabilizing these irregularities and ensuring a reliable power supply.The battery bank acts as a buffer; moreover, it stores the excess energy produced during peak production periods and then supplies it during times of insufficient generation from RESs.This ensures continuous and balanced power delivery, thus mitigating the risks associated with unpredictable power generation.In extreme cases, where RESs are insufficient to meet the electrical load demands, the system can rely on alternative power sources like diesel generators to fill the gap.However, the integration of battery storage significantly reduces the dependency on such non-renewable backup sources, thus promoting a more sustainable and resilient energy ecosystem within the MG.
The following equation indicates the state of charge (SoC) of the BSS depending on the charging and discharging status [30,31]: where P L (t) is the electrical load demand; P PV (t) indicates the PV output power in kW; η inv refers to the efficiency of the inverter (%); σ b is the BSS rate of the self-discharge (%); and η C and η D represent the charging and discharging efficiencies of the BSS (%), respectively.
To preserve the operational longevity of ESSs, it is imperative to maintain the SoC within the established maximum SoC max and minimum SoC min thresholds as per the following: SoC min ≤ SoC ≤ SoC max . (5)

Converter Modeling
Converters play a crucial role in MG systems by facilitating the energy flow between different components.They can function both as inverters, converting direct current (DC) to alternative current (AC), and as rectifiers, transforming AC to DC.This is particularly vital in hybrid systems to ensure a steady energy exchange between DC and AC parts.The inverter's capacity and limits, P inv , are detailed in the following Equations [22,32]: η dc/ac P BSS,ch/dis (t) + P PV (t) ≤ P inv , ( 7) where P inv indicates the converter capacity in kW and E L (max) is the maximum electrical load demand in Wh, while η dc/ac and η ac/dc are the converter efficiencies for DC to AC and AC to DC current conversion, respectively.Moreover, P BSS,ch/dis is the charge/discharge of the BSS, whereas P PV and P G are the PV and import/export grid powers, respectively.

DG Modeling
An automatically sized genset generator was incorporated utilizing the HOMER library.The generator automatically sizes its capacity to meet the electrical load, which leads to avoiding the capacity shortages in all sensitivity cases.

Simulation Methodology
HOMER serves as a pivotal tool for formulating various hybrid energy configurations, which span renewable MGs, grid-connected energy systems, and islanded hybrid energy systems, among others [33].HOMER's central aim is to ascertain the minimal economic objectives such as the NPC [34] and the LCOE.This is in addition to possessing the ability to assess the reliability and objectives of the system.Users input data including types of energy sources, the components for energy storage, the electrical load, and the costs associated with these components.In response, HOMER outputs crucial parameters such as the NPC, LCOE, surplus energy, fuel consumption, and the utilization of renewable energy.Moreover, the software aids in selecting the optimal control strategy for the system, wherein it provides options like load following (LF) and cycle charging (CC) control [35].Figure 2 illustrates the flowchart of HOMER optimization.

HOMER Software Dispatch Strategy (Controller)
A dispatch strategy in HOMER software defines the operational rules for generators and battery banks within a power system.The software can simulate two main strategies (with the optimal choice depending on various factors): CC and LF.These factors include the size of generators and battery banks, as well as fuel prices, the operation and maintenance (O&M) costs of the generators, the quantity of renewable energy in the system, and the nature of renewable resources.

•
LF Strategy: The LF strategy ensures that generators produce just enough power to meet immediate electrical demand, thus leaving the charging of the storage banks to the renewable energy sources.This approach proves optimal in systems that are rich in renewable energy sources, particularly when these sources sometimes generate power more than the demand; • CC Strategy: The CC strategy drives generators to operate at full capacity, directing surplus power to charge the battery bank.This strategy shows its strengths in systems with minimal to no renewable energy sources, thus making the most of the available generator capacity to store energy for future use.

HOMER Software Optimization Criteria
• Economic: -Total NPC: This represents the financial performance, which accounts for all incurred costs and generated revenues over the system's lifespan.It includes initial capital costs, costs for replacements, (O&M) expenses, fuel expenditures, possible emissions penalties, and the costs associated with purchasing power from the main grid.On the revenue side, it considers any salvage value and income from selling power back to the main grid [33]: where C NPC,tot represents the total NPC, C ann,tot is the total of annualized costs in (USD/yr), CRF() is the capital recovery factor, N is the project lifetime, and i indicates the discount rate; -LCOE: This is a widely utilized indicator in the field of energy.HOMER describes LCOE as the mean cost per kWh for the useful electrical power generated by the system [33,36]: where C boiler is the marginal cost of the boiler in (USD/kWh), H served is the total of the served thermal load in (kWh/yr) (this term is equal to zero in systems that do not have thermal loads), and E served indicates the total electrical load (kWh/yr); • Environmental: HOMER has the ability to estimate the emissions of six pollutants: carbon dioxide (CO 2 ), sulfur dioxide (SO 2 ), nitrogen oxides (NO x ), particulate matter (PM), unburned hydrocarbons (UHC), and carbon monoxide (CO).This functionality is essential in designing MGs in terms of reducing the emissions of toxic gases [37]; • Reliability: -Unmet load: In MGs, insufficient generation leads to unserved electrical load.The fraction of the unmet electrical load f unmet is given by the proportion of that unserved electrical load E unmet to the total annual electrical load E demand , as per the following [33]:

-
Capacity shortage: This is the amount of shortfall when the system's actual operating capacity is less than the required operating capacity, for both electrical load and reserve load, in a specific period.The capacity shortage fraction f cs is the total amount of capacity shortage E cs that occurs through the year, which is then divided by the total annual electrical load, as per the following [33]:

Constraints
• Maximum Annual Capacity Shortage: The percentage of the permissible value of the f cs ; • Minimum Renewable Fraction: This constraint limits the fraction of the energy that serves the electrical load from only the renewable energy components: where f ren indicates the renewable fraction in (%), E nonren is the production in kWh/yr from non-renewable sources, E served is the total electrical served load for the system in kWh/yr, and H nonren and H served are the thermal production from nonrenewable sources and the thermal served load, respectively, [33].The terms for thermal Served load and thermal production are equal to zero in systems that do not have thermal production.

Case Study
In this study, a hybrid MG system was applied to a Saudi government facility, TVTC (Technical and Vocational Training Corporation)'s NSII, and then evaluated.The current system, grid-only, has an NPC of USD 7.02M and an LCOE of 0.098 USD/kWh.The proposed work was intended to establish the outcomes of the most economic, reliable, and environmental configuration while satisfying all the economic and technical constraints.The sensitivity was assessed using multiple grid outages in the system.Figure 3 illustrates the schematic of the proposed system, while Figure 4 shows an aerial view of the site indicating the roofs under study.The total roof area was determined as 12,000 m 2 .

The contributions of this work involve the following:
-To meet the escalating renewable energy demands across Saudi Arabia, it is essential to leverage this type of research, which bolsters the renewable energy sector in the Najran region; -This study encompasses both an enhanced architectural design and administration of the selected site in an approach that has not been previously executed; -Most of the recent studies that obtained optimal tilt and azimuth angles were compared to HOMER's default angles for the benefit of the proposed location; -The proposed model picks the most feasible techno-economic, environmental, and technical architectures that satisfy the electrical load demand and available roof area; - The proposed system was subjected to an extensive analysis that included a sensitivity analysis of the system's resilience.6 ′ E) is located in the heart of Najran City, which lies in the southern region of Saudi Arabia.This area experiences a humid-subtropical climate with a dry-winter zone (classified as "CWa" by the Köppen-Geiger system) [38].It receives ample solar energy throughout the year [39], thus making it highly suitable for solar energy utilization, as shown in Figure 5.For more accurate input data, global horizontal irradiance (GHI) data were imported from KACARE.Figures 6 and 7 show the GHI and clearness index data, as well as the annual average ambient temperature.The annual average received GHI at NSII was 7.07 kWh/m 2 /day.

Electrical Load Data
The electrical load data for the site under study were collected based on the electricity bills for an entire year.Figure 8 illustrates the average monthly electrical load data of the NSII.It can be seen that there is an increase in the electrical load demand during the warmer months of the year due to increased air−conditioning usage.September is the peak month.Therefore, it is important to make sure that the design is capable of meeting the high electricity needs during this time.Table 2 provides additional information about the electrical load.According to Table 2, the peak electrical load and hourly average electrical load were 2160 kW and 327.32 kWh, respectively.The total amount of the electrical load demand was 2, 865, 749 kW.The electrical load factor was 0.15, which is a dimensionless number calculated by dividing the electrical load average by the peak load.

Technical and Economic Data for System Components
In Saudi Arabia, the electricity generation cost for government facilities is set at 0.098 USD/kWh, including VAT.The Arab Petroleum Investments Corporation (APICORP), owned by the Organization of Arab Petroleum Exporting Countries (OAPEC), reported no change in the governmental electrical use tariff [41].Although the proposed MG is expected to generate excess energy, this study does not include the selling back of energy to the main grid, making this study a conservative estimate of viability.Table 3 summarizes the most important financial and technical specifications of the system components.• Economic constraints: For the economic constraints, due to the recent chaos in both political and economic affairs around the region, the authors prefer to keep the value of inflation rate equal to zero, as well as the discount rate, while the project lifetime is set at 25 years.The tariff for for government sector is 0.098 USD/KWh including VAT [42]; • Power reliability constraints: The reliability of the proposed system is constrained by limiting the annual f cs and the f ren as expressed below: With respect to the maximum capacity shortage, HOMER eliminates systems that do not serve 100% of the electrical load.With respect to the renewable energy fraction limitation, HOMER will display all the possible systems that can serve the entire electrical load with or without renewable energy components (e.g., with or without the grid); • BSS constraints: Over-charging and over-discharging are harmful.Thus, the boundaries of the battery state of charge, SoC max and SoC min , were limited to 100% and 20%, respectively; • The nubmer of PV panels (N PV ): where N PV,max is the maximum number of PV panels that are equivalent to the roof area.

Roof Area and Inter-Row Distance
For limited-area PV systems, it is essential to know the inter-row distance, to avoid or limit the shadow cast by one PV row on another.To effectively assess shading throughout the year, it is crucial to track the sun's path at the system's location, particularly on 21 December (which is the day of maximum potential shading in the northern hemisphere [43]).
The inter-row distance D was calculated as follows: where ∆H is the PV height from the lower terminal; L is the PV length; and θ tilt , θ az , and θ elev are the angles for the PV array tilt, the azimuth angle, and the sun elevation angle, respectively, as illustrated in Figure 9.

Cases under Study
This study was controlled by the (CC) strategy.Under this strategy, the generator is run at a higher power level than the immediate demand, and the excess power generated is used to charge the batteries until the batteries are fully charged or reach SoC max .In a recent study [40], the tilt angle was evaluated in Najran City in all seasons.According to that study, the optimal annual angle for all seasons was obtained as 20.97 • .In our study, the system was examined under various tilt angles that were based on [40] and HOMER software default values, while the azimuth angles were chosen as 0 • and 50 • degrees.The NSII total roof area was established as 12,000 m 2 after excluding 5-8% from each roof for maintenance purposes.Based on this (and the equation for the inter-row distance), N PV,max for each case was equivalent to the total roof area.Table 4 shows the different cases for the examined system under various tilt and azimuth angles, as well as values for N PV,max .

Results
This section details the simulation and optimization outcomes obtained with the HOMER software.For a comprehensive evaluation of these results, three distinct analyses were delivered: economic, environmental, and reliability assessments.Within the economic analysis, the focus was on identifying the most cost-effective system setups, using NPC and LCOE as the determining factors.The environmental analysis ranked the optimal cases by the emissions of CO 2 and the f ren metrics.Lastly, the reliability assessment determined the best system configurations by examining the extent of the electrical load that was not served.
Table 5 illustrates the economic analysis for the cases under study.It shows that all cases recorded a significant saving in the NPC in comparison with the current system, grid-only, configuration.The current system has an NPC of USD 7.02M and an LCOE of 0.098 USD/kWh.Case 6 has the minimum NPC and LCOE values, which are USD 3.18M and 0.0442 USD/kWh, respectively, and this was found to be 2% lower than the HOMER default case, which had NPC and LCOE that were equal to USD 3.2M and 0.04523 USD/kWh, respectively.
For the environmental comparison, especially with respect to measuring the amount of CO 2 emissions, there was a huge difference in favor of the hybrid system for all the cases compared to the current grid-only system (which emits 1,812,134 kg/yr of CO 2 ).Case 6 reduced the emissions of CO 2 by 92% at 142,410 kg/yr compared to the grid-only system, and this reduction relied on its high f ren , which was 92.1%.In contrast, Case 3 had the lowest f ren at 80.7%, as well as reduced emissions in CO 2 of 81% at 350,413 kg/yr.Table 6 outlines the environmental comparison for all the configurations when compared with the current grid-only system.For the reliability assessment, and due to the constraint f cs , an excess energy is expected.Excess energy refers to the energy that cannot be utilized or stored, thereby resulting in the need to discard or reduce it.This situation arises when there is an excess of power generated, either from RESs or when the generator produces more electricity than required, and the batteries are unable to absorb all of it.All cases showed an unmet load of zero; meanwhile, there was a significant amount of surplus that also varied between all cases.However, the study does not include selling back of energy to the main grid, in which case, producing excess electricity would be an advantage of the system.The excess electricity fraction, f excess , refers to the ratio of the total excess electricity to the total produced electricity.Therefore, Case 6 showed the greatest surplus compared to the other cases, as Table 7 indicates, while Case 3 had the lowest f excess .
Among all the cases under this study, Case 6, with a 20.97 • tilt angle and a 50 • azimuth angle, shows superiority in the economic, environmental, and reliability criteria assessments compared to the current system.Case 6 achieved a lower NPC at USD 3,184,478 reducing the total cost by 54.67%.In the environmental evaluation, Case 6 emitted only 142,410 kg/yr of CO 2 reducing the emissions by 92%.For the reliability assessments, and despite selling back the excess electricity to the main grid is not considered in the study, Case 6 shows 1,154,073 KWh/yr excess energy, which might be converted to profits by participating in other systems.Table 8 shows the optimal cases based on the three criteria assessments.

Sensitivity Resilience
On 22 September, a day that was characterized by significant electrical demand, every component of the system was actively involved in handling the electrical load demand continuously for the entire 24 h.A thorough resilience evaluation was conducted using four principal scenarios.These were then applied to Case 6, as this was deemed the most effective among all the cases studied.As depicted in Table 9, these scenarios encompassed situations of grid outage, planned downtime for battery maintenance, and planned downtime for PV maintenance, as well as instances where all conditions occurred simultaneously.Figure 10 demonstrates how the various elements of the system engaged.It is notable that the DG did not operate continuously over a 24-h period.Conversely, the BSS uniquely addressed the electrical load requirements from 7 PM until the early morning hours.During the peak load period from 6 AM to 6 PM, all system components, excluding the DG, were actively involved in meeting the load demand.
The ideal system configuration, i.e., one that balances both economic efficiency and resilience, can be determined through optimization.The optimization results were classified and grouped according to the resilience assessment scenarios presented in Table 10.When comparing the normal operation, i.e., Case 6, to Scenarios 1, 2, and 3, it was notable that the NPC increased by approximately 0.2%, 0.16%, and 0.72%, respectively.However, Scenario 4 showed a significant change in the NPC, with a 2.68% increase compared to normal operation.In Scenario 1, the DG system served as a backup during grid absence, as shown in Figure 11.In Scenario 2, the grid acted as a substitute for the BSSs when they were under maintenance, as depicted in Figure 12.Scenario 3 addressed the PV power absence by increasing the grid purchases.Furthermore, from Figure 13, it is evident that the BSSs did not draw power from the grid.Scenario 4 represents the worst−case scenario, where there was an energy shortfall due to grid, PV, and BSS supply absence.Notably, during this comprehensive outage period, the DG demonstrated its capacity to meet the load demand for a day, as illustrated in Figure 14.Furthermore, it was notable that all the scenarios resulted in meeting load demands with 0 kWh/year unmet load, which matched the operating conditions.

Conclusions
In this study, the application of a hybrid MG system at the NSII, which is located in Najran City in the southern region of Saudi Arabia, was investigated with a focus on assessing its economic, environmental, and reliability aspects under various tilt and azimuth angles.This research contributes to the renewable energy sector in the Najran region, thereby addressing the growing demand for renewable energy sources across Saudi Arabia.A novel aspect of this study lies in the comprehensive approach it takes, whereby it integrates both innovative architectural design and effective system management for the chosen site.Additionally, the study incorporated the latest research findings to determine the optimal tilt and azimuth angles for the specific location, which was achieved by comparing them to the default angles from the HOMER software.
The proposed model selects technically and economically feasible configurations, which were achieved by analyzing environmental considerations while ensuring the reliable supply of electrical load demands within the available roof area.The study also conducted an extensive sensitivity analysis, and it assessed the system's resilience under various scenarios.
Among the six different cases considered, the configuration in Case 6, with a tilt angle of 20.97°and an azimuth angle of 50°, emerged as the most favorable in terms of economic considerations, environmental impact, and system reliability.It achieved reductions of 54.69% in NPC and 92% in CO 2 compared with the current grid-only system, all while meeting the entire electrical demand for all of the applied resilience scenarios.

Figure 1 .
Figure 1.Electric power generation by sources in Saudi Arabia from 2016 to 2022 [6].

Figure 3 .
Figure 3.A schematic of the proposed system.

Figure 5 .
Figure 5. Map of the global horizontal solar irradiation of Saudi Arabia [40].

Figure 9 .
Figure 9. Schematic of the proposed system's calculated angles.

Figure 12 .
Figure 12.System performance on a BSS maintenance schedule.

Figure 13 .
Figure 13.System performance on a PV maintenance schedule.

Figure 14 .
Figure 14.System performance during a comprehensive outage.

Table 1 .
Survey of previous works.

Table 2 .
Annual electrical load data.
Figure 8.The average monthly electrical load.

Table 3 .
Technical and economic data.

Table 4 .
System cases based on tilt and azimuth angles.

Table 5 .
Economic comparative optimization results based on the current system (grid-only).

Table 6 .
Environmental comparative optimization results based on the current system (grid-only).

Table 7 .
Reliability comparative optimization results.

Table 8 .
Comparative analysis based on economic, environmental, and reliability criteria.

Table 10 .
The resilience assessment results.