Optimization and planning of renewable energy sources based microgrid for a residential complex

World population growth and increased energy demand are taking a heavy toll on the environment. Aside from developed countries, the adverse effects are far more apparent in third‐world countries, which are also affected by climate change, pollution, and fuel scarcity. One of the primary solutions to this challenge is the implementation of cleaner and more sustainable energy resources. Building scale renewable integration is one of the solutions included in hybrid energy systems. The article aims to design a grid‐tied hybrid energy system for a residential complex in Dhaka, Bangladesh. The design includes several combinations of the photovoltaic system, diesel generator, and battery energy storage system (BESS). The key objectives of the analysis are to minimize system costs, reduce grid dependency, and reduce emissions. Various models were simulated in Hybrid optimization of multiple energy resources (HOMER Pro) to obtain a suitable system with maximum renewable usage. Several systems were compared based on different parameters such as net present cost (NPC), operating cost, cost of energy (COE), and carbon emissions. A grid‐tied system with PV and lithium battery storage was found to be the most suitable system for powering the residential load. From the analysis, the preferred system can reduce COE by 53%, NPC by 26%, and operating costs by 54%. Also, the total emission is reduced by 31%. Aside from being cost‐effective, the proposed system is also convenient and sustainable, with fewer salvageable parts owing to its use of lithium‐based BESS.

In the energy sector, there has been a significant amount of study and implementation to promote efficient use and the proper integration of renewable sources. A grid-tied solar home system was proposed by Mahmud et al. for a residential building in a dense urban area. 10 The design goal was to reduce energy costs and NPC as much as possible. The study's conclusions resulted in a life cycle cost of $35,365, an energy cost of $0.021/kWh, and a 17,839 kg/year carbon emission. However, the low-cost system was chosen by omitting the battery bank was not included in the design, as people often prefer a cost-efficient system over a reliable supply in such a scenario.
The author also proposed that the concept be expanded by modeling a community microgrid in the same location. 11 The work investigates various configurations including systems using rooftop PV array, VAWT, and BESS in chosen buildings that are interconnected via utility grid. For this study, a PV-Grid design was deemed to be appropriate and cost-effective, as adding BESS to the system reduced the amount of unmet load by 13% but did not eliminate it. Furthermore, due to insufficient wind speed and structural constraints in Dhaka, using rooftop VAWT is not practically viable, as reflected in the fact that the renewable fraction increased by just 2.3% in the case with wind turbines versus the optimum case. Furthermore, Islam et al. proposed a standalone microgrid for community electrification in Cumilla, Bangladesh. 12 The system designed to power the 35-house rural neighborhood was made up of PV, WT, and DG. The proposed approach reduced life cycle cost and energy cost by 74% compared to a DG-only case.
The study by Rehman et al. presented an off-grid PV system for residential loads in Larkana, Pakistan. 13 According to the findings, the system with battery storage was connected to an unreliable grid that had an energy cost that was 48% higher than a grid-tied PV installation. Their assessment shows that designing for such an unreliable power system can increase COE by 30% compared to an ideal stable system. The study proposed that a grid-connected PV installation with a battery storage system would be the best solution for such residential loads.
Furthermore, a hybrid energy system for the remote residential load was investigated by Shezan. 14 The proposed system was designed using PV, DG, and battery bank. The reduction in system cost and CO 2 emission were compared to the results of other conventional and planned hybrid renewable energy systems (HRESs). The author found a 40.8% decrease in emissions and a 50% reduction in NPC compared to conventional power plants. In this research, HOMER Pro was used as a simulation tool and validated by Photovoltaic System Tools (PVsyst) software.
While grid-connected systems reduce energy costs and emissions, on the other hand off-grid systems provide power to nonelectrified and distant places. Feasibility analysis for an off-grid DG and PV-based microgrid for alluvial land in Bangladesh is done by author. 15 However, grid extension is a complicated and expensive task for such a remote site, and the cost of energy and life cycle cost found in the assessment was cost-effective. During comparison with other off-grid systems in this research, the proposed system energy cost was dropped by 30% and emissions were reduced by 69%. The southern side of Bangladesh has a lot of rivers and canals, which possess huge potential for implementing small-scale hydropower sources. A standalone microgrid based on PV, DG, and micro-hydro turbines is proposed for an isolated village from the main grid. 16 From the analysis, micro-hydro turbines appeared to be a preferable choice compared to DG in such remote areas surrounded by waterbody. The authors found that the proposed system could reduce NPC by 27% and COE by 28%. A study proposed by Shezan et al. proposed an offgrid PV, wind turbine, and DG-powered system for a resort on Penang Island, Malaysia. 17 The system was designed in HOMER Pro, and its stability for different cases is visualized through MATLAB simulation.
The optimized system has a system cost of $21.66 million, an energy cost of $0.17/kWh, and a yearly emission of 1735 tons of CO 2 . Rousis et al. created a comparable off-grid configuration. The loads chosen were a pair of houses on a Greek island that had been modified with PV, BESS, and DG. 18 The main objective of the analysis was to design a system that was both cost-effective and emitted the lesser emission when compared to the Base case, which was a DG-only solution.
The microgrid configurations discussed in the literature review are primarily focused on residential applications. Although many systems may appear to be similar, each one is unique due to its intended application, loads, location, and resource availability, and it is regarded to be optimal depending on these criteria. Table 1 outlines the configurations based on these key parameters. For instance, consumers may choose economic viability over resource diversification, storage systems, and supply continuity based on certain loads and resource availability. In other circumstances, combining renewable and nonrenewable energy systems provides relatively similar cost-effectiveness with the added benefit of lowering emissions. For most of these studies, consumption, load classification, and power generation profile are often postulated, generalized, and simulated respectively. This study, however, has the advantage of utilizing consumption data from actual electricity usage and loads and modeling the generation profile from a functional DG that is currently providing power to the chosen site.
The main objective of this study is to assess the feasibility of a hybrid PV system for an existing building complex in Uttarkhan, Dhaka-1230. The design goals include a cost-effective, convenient system with a minimum 40% renewable share, 0% loss of load capability, and a low carbon footprint. For works such as feasibility studies, the originality of the work is defined by constraints like specific applications, demographic perspectives, geographical location, and resource utilization. Nevertheless, there had been no past study for such deployment of renewables for a suburban area in that particular location. Furthermore, the present residential building RES integration in Dhaka lacks significant prospects such as effective optimization, consumption pattern observation, proper grid integration with energy storage, and selecting the optimal components. The study addresses these issues as well as the research gaps, by defining an appropriate consumption pattern, identifying suitable solutions through specific requirements and constraints, designing a decision matrix, as well as conducting a sensitivity analysis to address the uncertainties. The remainder of the article is structured as follows: Section 2 addresses methodology, Section 3 discusses result analysis and discussion, and Section 4 concludes the study. can be utilized for harvesting solar energy through PV panels. Normally, the building's energy demand is fulfilled by taking power from the utility grid and a 32 KW DG provides power during outages. In addition, power consumption increases from mid-spring to late autumn (March-October), and declines during winter (mid-November to February). Table 2 illustrates the regularly used appliances in each flat and their seasonal consumption. Fluctuating loads such as refrigerators and air conditioners are modeled by resampling observed load data. 19 The average daily consumption of each flat for the winter is 3.32 kWh and for the rest of the year is 8.65 kWh. Figure 1. shows the location of the building complex for the assessment.
In addition, a 5.2 kW water pump runs for a total of 3 h a day which can be considered a deferrable load. Building lights are in operation for 11 h in winter and 10 h for the rest. Monthly consumption by all residential loads is shown in Figure 2. The total average daily consumption for the whole building complex is discussed in Table 3.
In this analysis, all the considered scenarios are compared against the base case. The base case is the current situation of the building: loads are connected to the grid and a 32 kW DG via a transfer switch, only powering a small selection of loads during outages. The average daily consumption of the housing complex is 237.74 kWh, and the peak load is 41.36 kW (from the yearly load profile). The average annual outage frequency for the assessment was set to 200/year, which was obtained by averaging the DG runtime per year. The average outage time is set to 1 h/day, with a 10% variation. The tariff rate was set to $0.093/kWh and the grid buyback price was set to $0.069/kWh.  rooftop space. Solar irradiation data were obtained from the NASA Power data access using the area's latitude and longitude. 20 The selected site receives an annual average solar irradiation of 4.65 kWh/m 2 /day. Daily Solar irradiation for each month with a clearness index is shown in Figure 3. Apart from good quality solar cells, the performance of PV panels is also dependent on the permittivity and performance of the panel's glass encapsulation. 21 Overall losses considering shading, soiling, cell mismatch, connection, and light-induced degradation were considered 13.5%. 22 In addition, a hybrid inverter with a 95% efficiency was chosen for the assessment.

| Resource characteristics
Because renewable resources are inherently intermittent, an cost of buying from the grid. The revenue portion not only includes the salvage value but also grid buyback revenue. The following equation was used to calculate NPC (C NP ), Where R t is the cash flow over time, N is the project lifetime and i is the real interest rate. The real interest rate depends on the inflation rate. The equation for the real interest rate is given below, In the equation, i' is the nominal interest rate, and f is the inflation rate. Salvage value (S) which is the depreciation value after the component's lifetime is considered revenue. It can be calculated by In the equation, C rep is the replacement value, R rem is the remaining life of the component in years, and R comp is the lifetime of the component in years. COE can be calculated by dividing the total annualized cost, C TAN, by the total served load, L served .
F I G U R E 2 Energy requirement of the buildings on an hourly basis.
T A B L E 3 Total consumption of the residential complex. Moreover, the total annualized cost is the product of NPC and the capital recovery factor (CRF). CRF can be calculated from the following equation, The renewable fraction, RF of the system is calculated by equation 6, where E NR is the electricity generated from non-renewable sources.
Equation 7 is used to aid in the calculation of NPC and COE for the base case. Monthly energy purchase cost from the grid (C m:grid ), Where n is the step number, P n is consumption at the corresponding step, and R n is the energy rate at that step. R d is the demand rate, and D m is the maximum demand.
For a complete economic assessment, several cost components were considered in the calculation. Inflation and interest rates are projected at 5.88% and 8%, respectively. Mounting structure sizing was determined using local PV installation guidelines. It was estimated that the maximum PV array that could be installed with a proper cleaning facility and without being influenced by shading is 60 kW. Table 4 highlights the cost of the components chosen for the microgrid's design and optimization.

| System categorization
The key focus of this analysis is to design a robust RES-based system to provide uninterrupted power during interruptions or grid maintenance periods while lowering energy costs and emissions. The components' costs from Table 4 were applied in HOMER Pro simulations based on available resources and building characteristics. The optimum and near-optimum scenarios are categorized into 6 classes based on their economic value, impact on the environment, and reliability among the numerous outcomes. All considered scenarios, along with the base case, are given in Table 5. For the rest of the tables and graphs, each scenario is denoted in a shorter form (S1, S2 …). Figure 5 provides simplified depictions of the aforementioned scenarios.
As per the assertions, S1 appears to be the most cost-effective and emission-free option. However, one limitation is that the system lacks energy storage to provide power during interruptions. Furthermore, because of the anti-islanding characteristics of such a design, the system will be unable to harvest energy during the daytime outage. 28 Although, the highest capacity shortage is found in this case.
S2 also appears to be cost-effective. However, after considering other factors, it will not be the finest option because the DG contrib- year. However, the NPC of S5 is larger than S3 due to the frequent replacement of lead-acid BESS. Also, for S5, BESS replacement costs are incurred in the 6th, 12th, 18th, and 24th years, in addition to inverter replacement costs in the 10th and 20th years. However, S4, the grid-only option, appears to be more cost-effective than S5 due to the high cost of replacement. As a result, S5 is the worst-case scenario economically.
The capacity of the components was set within an allowed range to determine the best sizing parameters. However, for BESS, the suitable capacity was found by adjusting the sizing value until there was a significant change in the capacity shortage. In addition, the inverter was sized based on the total maximum power demand of the building.
From the assessment, it is observed that 37 kW is the optimum capacity of the inverter for most scenarios (without BESS). In Table 6, the optimum sizing outcomes were discussed for each system. It is also evident that dispatch techniques have a higher impact on overall system cost and renewable fraction since selecting the best dispatch strategy ensures maximum output.

| Emission Comparison
To compare emission scenarios, the impact of four significant pollutants, carbon dioxide, carbon mono oxide, sulfur dioxide, and nitrous oxide, was considered. S1, S3, and S5 have identical emission results due to the absence of a DG. All three systems emit a total of 42.06 tonnes of CO 2 each year. S4 and base case both make a major contribution to carbon emissions. S4 and base case emit 58.0 and 61.2 tonnes of CO 2 per year, respectively. Furthermore, the incorporation of DG increased carbon emissions by 6% in S2 compared to S1, S3, and S5. Figure 8 depicts a detailed comparison of annual emissions.

| Selecting the suitable system
Several factors and considerations influence the optimal design. This assigns the primary goal to a number of objectives to evaluate in order to discover the best solution, similar to multi-criteria decision analysis. 29,30 A weighted decision matrix is used to identify the best suitable system from the financial outcome, environmental impact, reliability, and maintenance standpoints. Weights were assigned based on the system's acceptability by building occupants, how long it can be left unattended, and the system's failure rate. The decision matrix prioritized cost and emission minimization over reliability and simplicity in order to determine the most suitable solution. Each system was graded on a scale of 1 $ 5, and its score was multiplied by the weightage allocated to each criterion. Table 7 shows the weighted decision matrix for identifying the appropriate system.
According to the decision matrix, S3 (PV-Li BESS-Grid) is the best fit among all scenarios if the design considerations are cost-effectiveness, low CO 2 emissions, reliability, and occasional servicing.

| Sensitivity analysis
After modeling and selecting the best-optimized solution, there will be some uncertainty about whether the process will operate as planned. Different input data vary in real life, and this will have a direct impact on the system. For instance, a fixed value for the grid buyback price was specified throughout the optimization process.  economic impacts on the system are discussed with a 20% change in different parameters. Figure 9. shows the impact of diesel prices on NPC and COE. It appears that the association between NPC and COE and fuel price change is linear. With the rise of the diesel price, NPC also increases. For S2, a 31% increase in diesel price raised NPC and COE by 9% and 10%, respectively. A gradual increase in the price of diesel can make the user shift to other cost-effective renewable energy resources, which results in reduced emissions.
Also, the variation of solar irradiation will be impactful on the cost of the system. From Figure 10, it is found that the gradual decrease in the PV arrays should be set up in a suitable area where shading loss is minimal and also cope with the lower irradiation periods.
In the future, there could be a considerable change in load. People are often encouraged to buy newer products when the prices of various appliances fall or are discounted, and the household loads may increase dramatically as a result. The impact of the increase in daily load is depicted in Figure 11. In the instance of S3, NPC increased by 13% and COE climbed by 7% for a 12% average load increase. In such a circumstance, the system cost and the capacity shortage will arise after serving a certain range of loads. However, extending the BESS capacity and the PV capacity as well as the usage of energy-efficient appliances may tackle this issue.
F I G U R E 9 Impact of fuel price on system cost. be increased, and the necessary capacity expansion is also depicted in Figure 12. To reduce cost, load shifting is a further measure that can be implemented alongside capacity increase.

| CONCLUSION
The main objectives of the study were to design a cost-effective grid-tied PV microgrid system for residential loads as well as reduce grid dependency and carbon emissions. Moreover, load data was developed using the 12-month usage of the housing complex for better accuracy. After performing numerous simulations, the suitable configuration was identified through a decision matrix with different criteria. S3, a grid-connected system consisting of a 55 kW PV array, a 48 kW inverter, and 119 kWh BESS should be the preferred one for delivering uninterrupted power and reducing emissions for the daily load of 237.74 kWh. Among the considered systems, it proved to be one of the most cost-effective, with the third-lowest COE and operational cost. The COE of the selected system is 0.041$/kWh. The preferred system reduced NPC by 26%, COE by 53%, and emissions by 31% compared to the base case. The lifetime of the lithium-ion BESS was considered 15 years.
However, if battery throughput was considered, then the theoretical lifetime would be 130 years, and in real implementation, the BESS might not have to be replaced. Thus, the NPC and COE will reduce further after the system is implemented. The optimization outcomes from HOMER classified S1 as the best alternative. However, in terms of reliability and zero unmet loads, systems with BESS should be considered for implementation. Moreover, the system with lead-acid BESS is not economical and environmentally friendly as found in the assessment and it requires frequent maintenance and replacement. In the future, the system can be more optimized with additional resources, such as running on biomass from household waste to raise the renewable percentage and achieve net-zero energy goals.

DATA AVAILABILITY STATEMENT
The data that support the findings of this study are available from the corresponding author upon reasonable request.