Optimal Energy Management of a Campus Microgrid Considering Financial and Economic Analysis with Demand Response Strategies

: An energy management system (EMS) was proposed for a campus microgrid ( μ G) with the incorporation of renewable energy resources to reduce the operational expenses and costs. Many uncertainties have created problems for microgrids that limit the generation of photovoltaics, causing an upsurge in the energy market prices, where regulating the voltage or frequency is a challenging task among several microgrid systems, and in the present era, it is an extremely im ‐ portant research area. This type of difficulty may be mitigated in the distribution system by utilizing the optimal demand response (DR) planning strategy and a distributed generator (DG). The goal of this article was to present a strategy proposal for the EMS structure for a campus microgrid to re ‐ duce the operational costs while increasing the self ‐ consumption from green DGs. For this reason, a real ‐ time ‐ based institutional campus was investigated here, which aimed to get all of its power from the utility grid. In the proposed scenario, solar panels and wind turbines were considered as non ‐ dispatchable DGs, whereas a diesel generator was considered as a dispatchable DG, with the inclusion of an energy storage system (ESS) to deal with solar radiation disruptions and high utility grid running expenses. The resulting linear mathematical problem was validated and plotted in MATLAB with mixed ‐ integer linear programming (MILP). The simulation findings demonstrated that the proposed model of the EMS reduced the grid electricity costs by 38% for the campus mi ‐ crogrid. The environmental effects, economic effects, and the financial comparison of installed ca ‐ pacity of the PV system were also investigated here, and it was discovered that installing 1000 kW and 2000 kW rooftop solar reduced the GHG generation by up to 365.34 kg CO 2 /day and 700.68 kg CO 2 /day, respectively. The significant economic and environmental advantages based on the cur ‐ rent scenario encourage campus owners to invest in DGs and to implement the installation of en ‐ ergy storage systems with advanced concepts.


Introduction
Power systems have been facing a lot of issues and challenges, including greenhouse gas (GHG) emissions, complicated network overloading, and rising consumption costs.

Recent Research Work: A Detailed Review
A microgrid model was developed for the Malta University Campus by [10]. In this study, the design factor of such a microgrid was developed. It was analyzed under different functional controlling modes, such as peak controlling mode and continuous power mode. This design was demonstrated for the 3D Micro-Grid project [11]. The results were evaluated under different operating modes that analyzed the performance of a microgrid. It showed that the microgrid delivered a constant 50 kW of power between 8 am and 1 pm and it reduced the peak power flow between 5:35 pm and 10 pm in which its consumption was 90 kW. Another microgrid model is presented in [12] for the University of Coimbra, Portugal, which consisted of a PV plant, Li-ion batteries, uni/bidirectional charging of EV, and controllers. The main objective of this microgrid system was to achieve sustainable energy, install the RER resources, and maximize the economic benefit. The results show that it achieved less energy consumption (50 kWh/m 2 ) and the PV system covered 22.3% of the yearly electricity demand.
A system was proposed by [13] that comprised PV, energy storage cells, and a gasoperated small microturbine to effectively control the number of electric vehicles while making it compatible with the transformers that were also coupled with the microgrid. In the proposed system, LOL calculations were performed, which calculated the number of electric vehicle charges during the 24 h while the supporting transformer was also connected. Using this proposition, the transformer was compatible and supported 17.4 kW on average and had the charging capacity of 30 electric vehicles during a 24 h timespan. This system increased the capacity by about 33% compared with the system that was not connected with μG. The results showed that this system accomplished demand response strategies, energy management scheduling, and maintaining the level of PV through V2G (vehicle-to-grid) technology. Furthermore, advancement was needed in demand response management on the utility side where utility cost reduction was concerned.
The authors of [14] also proposed a distributed DR (demand response)-based algorithm to control the load at the peak time for the Connecticut Campus microgrid, USA. The campus microgrid consisted of a co-generating power plant. The ADMM (alternating directional multiplier method)-based strategy was implemented to analyze the energy consumption scenarios for multiple buildings on campus. The results show that it reduced the energy consumption ratio for multiple buildings (10 buildings here) and it improved the satisfaction level among customers. Fahad et al. [15] presented a costeffective microgrid solution with the consideration of many feasible cases to optimally schedule the energy for the University AMU (Ali Garh Muslim University), India. They devised the most optimal solution for the AMU campus using HOMER software in which a wind, PV, and grid combination system was the final solution. They calculated the NPC (net present cost) as $17.3 million/year and the CO2 emissions for the system as 35,792 kg/year. A novel integrated design was proposed for the size of batteries in [16]. In this study, the exhaustion method was used to obtain the energy management design parameter "d", which mainly focuses on profit maximization. The effects of the SOC (state of charge) and non-operation time "T" were also calculated for the lead-acid battery. The results derived from a utility power company for the interval of 1 min from a PV plant with actual load data showed that using lithium-ion batteries maximized the profit by a 6% margin compared with the lead-acid battery, which had a negative profit margin. Franz et al. [17] initiated a microgrid project at the Siemens campus, Vienna, Austria. The microgrid campus consisted of solar PV panels (1600 m 2 ), a Siemens controller, Siemens building management systems, Siemens EV charging stations, and 500 kWh battery storage. The project's main objective was to facilitate researchers in the research activities in their respective areas and to optimize the microgrid with the updated energy management systems. It resulted in a peak output of 312 kW and reduced GHG emissions by almost 100 metric tons of CO2/year. Furthermore, Abhishek et al. [18] considered a solar PV system, a bio-gas plant diesel generator, and a BESS storage system for multiple universities based in different countries. This study demonstrated the technical aspects, architecture, and load types of different universities based in Iran, the USA, Saudi Arabia, India, China, etc. The technofinancial analysis of this proposed hybrid system was undertaken using the HOMER Pro software. The results showed that the levelized cost for the grid system was in the range of 0.18-1.39 INR/kWh in contrast to the off-grid range of 11.96-18.47 INR/kWh. Moreover, in [19], Dongshin University initiated a self-sufficient smart grid system that contained 1 MW solar PV, a CHP system, an energy storage system, and fuel cells. The main objective was to monitor the power flow information in real time, to monitor the energy consumption, and to stabilize the energy for the campus microgrid. The results showed that this combined energy management system was an optimal solution for the Dongshin Campus.
The majority of these studies were focused on the EMS of μGs and on optimal PV, ESS, and system scheduling. Some studies concentrated only on the economic viability of solar with an ESS as a campus μG, whilst it also estimated the cost savings from PV integration and a properly scheduled ESS. As demonstrated in Table 1, the economic analysis determined the LCOE while including the power interchange between utility, batteries, the ESS, photovoltaic uncertainty, and DRs. This study considered all of this research work in parallel and it provides a structural explanation of the EMS of a campus μG with an optimal sizing and the uncertainties of a photovoltaic system that was deployed in a grid exchange environment to use its real power and load data for different seasons.
This study's key contributions may be summarized as follows: (1) A smart energy management system was suggested to optimize the scheduling process of onsite DGs, ESSs, and grid energy utilizing MILP with the consideration of the TOU-based demand response to enhance the consumption from RERs and to lessen operating electricity costs and the system load during the peak consumption hours.
(2) Degrading costs of the battery are also considered with stochastic PV production that was employed in a campus prosumer μG.
(3) An economic and financial analysis was also conducted here to observe the technoeconomic effects of different sizes with an environmentally friendly DG and an optimal ESS was also investigated here, which focused on a net-metering-based TOU environment.
The rest of this paper is laid out as follows. The system model and solution technique are described in Section 2. In Section 3, the detailed problem formulation is provided. Section 4 contains several case studies, as well as numerical findings. Finally, Section 5 contains the concluding thoughts, as well as some recommendations for further research.

Proposed Conceptual Model
The structural description of the proposed framework is illustrated in Figure 1, which constituted an EMS, a prosumer μG, and a utility grid. The campus prosumer μG comprised a variety of academic loads and storages facility, as well as two energy supplies (solar and a diesel engine). The prosumer, on the other hand, had a net-metering-based agreement with the electricity provider and was able to trade any excess energy back to the utility grid.
The proposed energy management structure at the prosumer building collected the load demand consumption data, weather forecast statistics, TOU pricing data, the ESS primary condition, as well as its feed-in constraints as input conditions and identified the best way to satisfy the load demand using available resources while staying within the operational and design limitations. The control scheduler used these optimal solutions to allocate the available resources. A facility for storing data of some significant parameters was indeed accessible for the suggested energy management system that will be manipulated for countless future profits. Energy trade data, TOU price data, and prosumer loading information was stored in a real-time database, marketplace database, and prosumer database. The formulation of the proposed approach is given in the next sections.

Problem Formulation
This suggested mathematical system model is presented with the linear optimization method with the aim to reduce the prosumer operational cost while considering the lifespan of the battery system.

Objective Function
The goal of the suggested model was to minimize the operating cost of a microgrid that incurred costs related to the energy exchange, WT, DG, and electricity storage degradation (Equations (2)-(5)). The total costs are represented in Equation (1). As illustrated in Equations (4)-(6), the battery life is determined by a variety of parameters, including the number of cycles utilized, capital expenditures, and total system capacity, whereas the storage is expressed by , , , and , which are separately denoted in Equation (7). . .
where , , , and [37] are the costs of the energy exchange, WT, diesel generators, and battery degradation at any particular time t. IESCO's time-of-use (TOU) pricing tariff was acquired from the university. The energy trade with the utility and their unit prices are indicated with and during any hour t. was calculated with the help of the diesel generator nominal rated capacity (TG = 600 kW), fuel intercept curve ( = 0.0166 L/h per kW), nominal fuels slope curve given by β = 0.277 L/h per kW, and the overall power generation from DG given by . denotes the specific cost and denotes the rated power [38]. The frequent battery charging efficiency, charging power of the battery, discharging efficiency, and battery discharging powers are characterized by , , , and , respectively [39], while denotes the specific cost of energy storage indicated in Equation (5). In Equation (6), denotes the size of the battery, denotes the maintenance cost of the ESS, and denotes the maintenance factor. The total battery power is given by , which is indicated in Equation (7).

Load-Balancing Equality Constraint
The load-balancing constraint basically expresses the supply-demand equilibrium constraints. Equation (8) should be met and satisfied in order to achieve this equilibrium.
and [40] are the output of the solar power generation (kW) and the prosumer load, respectively.

ESS Constraints
The ESS should not be overlooked in energy management, as it supports the control of the electrical load, mostly in the occurrence of a grid inability and grid failures [41]. Because the ESS is typically difficult to charge or discharge rapidly, its power limit was considered in the limitations (Equations (9)-(13)). The battery charge in the ESS relies on its earlier state , which was integrated into Equation (14) at any time t .
The maximum and minimum limits, denoted with and , were included in Equation (15) to avoid the ESS overloading and complete discharge [42]. The battery's state-of-charge at the day's end is equivalent to the start of the battery state at the beginning of the day, as indicated in Equation (16).
To properly schedule the energy usage in the EMS, the battery output power was included in the equality constraint stated in Equation (8). ESS charging/discharging are represented by the simulated values of . The two integer variables and represent the ESS charging/discharging, respectively, in just about any interval "t". To simply avoid the BESS charging/discharging issue for the equivalent durations, the binary pattern characteristics that are shown in Equations (11)-(13) may not be "1" at the regular intervals. For most of these variables, a value equal to "1" expresses the activation mode. The power output gradient of its battery storage is provided below:

Limitations of the Diesel Generator and Grid
As all utility companies integrate their components depending on the load demand, users continuously sign peak periods agreements with customers. Any request that exceeds the terms of this contract will result in fines or a termination of the power supply. Diesel generators, similarly, cannot handle loads that exceed their rated capacity. Expressions are used to account for power supply constraints for the diesel generator and grid connection (Equations (18) and (19)) [43].

Energy Exchange between the Grid and Prosumer
The power system energy ( ) transacted with the grid in a day is shown below, where power import minus export from and to the grid are denoted by :

Probabilistic PV Model
The energy generation of wind and solar energy is unpredictable and highly dependent on the environment and solar irradiance. The data from the entire year was evaluated under random situations. This analysis used a previously constructed solar irradiance model [44]. It also evaluated the variables of the probability density function (PDF). A total of 365 scenarios may be created in 24 h utilizing the Latin hypercube (LHS) universal sampling approach [45]. As previously stated, the goal was to reduce the calculation or computation load [46]. The fast-forwarding method was utilized to lessen the randomly produced scenarios to about 40 [47].
In Equation (21), the normal distribution function, or Gaussian function, was applied to analyze the uncertainty model for solar irradiation [48], where , J, I, and are the solar panel's efficiency (17%), total operational cost, the solar irradiance pattern (kW/m 2 ), and the solar panel's area (m 2 ), respectively, while μ and σ indicate the normal distribution mean and standard deviation, respectively. Equation (22), which is based on the solar irradiation of a specific region, indicates the output of solar PV and is given above as . Figure 2 illustrates the normal distribution with the standard deviation for the photovoltaic irradiance's predictable pattern in the region of Taxila in Pakistan. The Taxila region's latitude and longitude are 33.746° N and 72.839° E, respectively, corresponding to a daily irradiance value of 5.3 kWh/m 2 [49].

Grid Energy Exchange: Wind Turbine Operation
Equation (23) expresses the wind power output exchanged with the utility grid: 0 , where is the minimal cut-in speed necessary for the WT to generate electricity. The maximal cut-out speed at which optimal electricity may be produced is indicated as ; if this speed is surpassed, the turbine is switched off in order to avoid damage.

Levelized Cost of Energy (LCOE)
The levelized energy cost is assessed in different scenarios when performing a fair and equitable analysis for the systems. It is defined as the ratio of the entire system cost of installation (USD) to the total energy generated (kWh). The LCOE of storage or a particular energy source is stated in USD per kilowatt-hour. It covers all the associated expenses, which include the cost of installation, operating costs, maintenance, and capital investments. It can also be defined as the lowest possible price at which electricity is generated and used during the lifetime of a particular energy source or storage equipment in order to attain the breakeven point [50]. The LCOE formula may be expressed mathematically as follows:

Solution Methodology
Because the suggested system's model's objective function and its related constraints are generally linear models with many integer variables, MILP programming was implemented since it is excellent for solving linear programming problems. This same MILP technique is widely used globally as an optimization method for resolving various kinds of optimization problems associated with marketing and optimal scheduling [51]. Furthermore, it is compared to various metaheuristic approaches that yield inferior results, while MILP yields the most optimal results. As a result, the MILP method is widely used in EMS optimization [52]. The basic structure of a mixed-integer problem is described as follows: (25) . .
In Equations (25) and (26), xb, yb, x, b, , and are vectors, where and are matrixes. The main flow diagram for controlling the proposed campus μG is given in Figure 3. Initially, one hour before each day's arrival, all of the input data that is required for the day is loaded; the forecasted irradiance, load patterns, temperature, ESS starting state, TOU tariff information, and its related parameters are all part of the data. The simulation of the provided optimization method was based on a regular period of each hour prior to usage. The suggested technique was emulated in MATLAB software, version R2017a, with an Intel (R) core (TM) i7-7700 @ 2.80 GHz processor with 8 GB RAM.
Examine the existing situation with the seasons of the year/weekday/time during the day (pricing, temperature, energy load demand, and beginning ESS condition) Check the comparison with energy demand and solar PV; it must be Solar PV generation > Energy load demand Verify the discharging constraint

No Yes
To optimally schedule with the MILP model, equality and inequality constraints must be met.

Start
Verify the charging constraint Grid Energy exchange with decision-making variables. Figure 3. Proposed solution methodology flowchart.

Results and Discussions
The concept shown here is used for the prosumer microgrid in Section 3 of the Punjab province. There are eight hostel residences for university students, fourteen departments for different fields, and six faculties. At the moment, the university's load is fed by a 2 MW grid interconnection. The capability of the university rooftop solar panel installation is measured as being 4 MW using a concise assessment of the available space for the university rooftop.
Since NEPRA (National Electric Power Regulatory Agency, Pakistan) enables only 1 MW of energy exchange for an electricity grid, we had a capacity constraint of 4 MW for the campus due to limited resources. In our situation, as compared to the distributed generation sizing, we concentrated on the method applied in [53]. An onsite 2 MW solar photovoltaic setup was taken into consideration for extensive economic and technical analysis. Additional effects highlighted here include utilization of the existing backup generator in the case of a power grid breakdown.
Furthermore, the proposed framework was planned to have an effective netmetering infrastructure that permitted power outflow regulated up to 1 MW to offset the cost of prosumer energy use while fulfilling charging/discharging constraints. The campus load varied constantly due to the loads of the hostels, academic buildings, administrative offices, and housing colonies on campus in summer and winter, which were incorporated into the constraints, as shown in Figure 3.
According to the report of [54], Pakistan generates 5100 kWh of energy production per day through a 1 MW solar facility. As a result, in this study, we found a solution by constructing a photovoltaic system for the campus μG. Further, in our approach, a BESS system was also proposed. In this approach, Li-ion batteries were presented, with the benefits of their extended lifetime, exceptional performance, good power output, high dependability, and minimal self-discharge [55].

Case Study
In the given scenario, an optimal scheduling strategy was given for the university microgrid with different peak timings and off-peak timings year-round. Variance in the load patterns was commonly observed here in this study, and for the convenience of this study, these patterns were assumed equivalent for all seasons. In Pakistan, the maximum energy consumption periods are May-August, but the data were analyzed for the whole year [56]. Peak load statistics for all months are studied here for the economic analysis, with worst-case scenarios included. Choosing the worst-case scenario yielded the best potential result in terms of cost reduction. To maximize the benefit, the energy produced by solar can be transferred to the grid.
The actual power consumption of the institution was taken into account in regular periods and data from a nearby grid was used to assess the electricity generation expenses on a regular basis.
The load fluctuation behavior that was observed for different seasons is illustrated in Figure 4, while the load allocation patterns between academic blocks, hostels, and campus office buildings are presented in Figure 5.  The loads of the administrative and academic blocks were scheduled to be higher is when the university is on, while the peak electricity demands in the hostels and resident colonies were monitored until midnight. Table 2 represents the numerous factors that were interconnected with the system, whereas Table 3 describes the TOU agreement's power-pricing information [57]. The comprehensive solar irradiance patterns analyzed here were acquired from [58], and the data features were modeled and evaluated using the previously described probability density function (PDF) in Equation (19). The primary goal of using the PDF was to create regular irradiance patterns, while the previously generated solar irradiance pattern predicted the PV production power consumption patterns using Equation (20). Table 4 provides the case study data.

Different Seasons Case Study
In this case scenario, the energy exchange evaluation among the grids and energy demand were analyzed using the price-based data presented in Table 3. Several strategies were developed here to better understand the energy consumption for different seasons. These case scenarios were developed to maximize the dependability of solar PV, where the daily hours of sunlight were 8-10 h in summer and 6-8 h in winter; different case scenarios were implemented to get the most economical result by optimally scheduling the different resources to minimize the dependence on the grid and to minimize the campus grid electricity cost.
Case (1) (energy received from the grid): In the first case, the campus's energy demands were fulfilled completely by the utility. For the campus, no solar PV, ESS, wind, or DG were considered in this case. The operating costs of the electricity were determined using the time-of-use (TOU) rate, which was USD 1430.8. In this scenario, the LCOE was determined as 0.0988 USD/kWh.
The analysis indicated that the energy operational cost in the first case was exceptionally expensive, but this was utilized as a study case for comparison with other cases for evaluation regarding each season.
Case (2) (energy exchange between PV and grid): In the second case, solar PV was connected with a prosumer microgrid as shown in Figure 6, and this was interconnected to manage both the import of necessary energy from and export of surplus energy to the grid. The rooftop PV system produced 8925.7 kWh, indicating the PV's performance throughout the peak periods of the year, especially in summer. The LCOE for the rooftop PV was 0.055 USD/kWh here. Therefore, the grid power net cost for 24 h dropped by 43.6% relative to the baseline to USD 798.5.

Case (3) (ESS integration with PV and the grid):
In the third case, the ESS was connected with the solar and the grid. The proposed methodology was used to calculate the net electricity costs of USD 819.9 and to best plan for the behavior of battery charge-discharge patterns while taking into account all related associated costs. The LCOE was determined to be 0.056 USD/kWh using TOU-based pricing and optimal BESS scheduling, as presented in Table 5. When compared to the baseline scenario (case 1), it decreased the electricity net cost by 42.8%. Figure 7 represents the energy exchange with the electricity grid, with upper positive and lower negative values representing the energy import and export. The optimal scheduling outcome of the ESS demonstrated that the battery terminated operation at the same amount of SOC, i.e., it continued to operate at 50% precisely based on what it began the current day with. Furthermore, as shown in Figure 8, the ESS intelligently saved excess electricity during off-peak and peak hours and released it proportionately to decrease the operating cost of electricity where Figure 9 state-of-charge of a battery with unit prices with respect to time.    Case (4) (DG integration with the PV, ESS, and grid): In the fourth case, the campus microgrid combined a diesel generator (DGen) with rooftop solar and a BESS structure to minimize the potential peak demand of energy from the utility grid, even during the summer season (8:00 AM-6:00 PM). The grid consumed electricity up to 50 kW, which was the limit for the smart grid, while the DGen's output power consumption was restricted to 400 kW only in peak hours, as illustrated in Figure 10.
After the optimal BESS scheduling, the net cost of power was determined to be USD 843.5 each day. In this case, the measured LCOE was 0.058 USD/kWh, which when compared with the baseline (case (1)), was 40.2% lower with the 2.2 s execution time during the respective seasons, especially in summer because it experienced the lengthy peak periods. Case (5) (proposed scheduling): The wind turbine system (100 kW) was combined with the PV, ESS, diesel generator, and grid connection in the proposed case, as shown in Figure 11. The wind turbine's power and wind speeds are often 3-5 times greater in August and September. The campus μG used a wind turbine with a power rating of 10 kW and a height of 36.6 m, a rating speed of 9 m/s, a wind cut-in velocity of 3.6 m/s, and a wind cut-out velocity of 26 m/s as the best option among the wind turbines examined. The LCOE computed for wind energy was 0.060 USD/kWh, which was 38.3% less than the baseline case (and better than the 35% found by [53]), which was calculated for a hot or windy weather condition. It was estimated that by integrating the wind turbine system with the ESS, solar PV, DG, and national grid (WAPDA), the UET Taxila university's campus energy net cost will be reduced by 3%. Figure 11. Grid scheduling for the proposed case (5).

Effects of the Sizing of Solar PV on Electricity Cost and Reduction in GHG Emissions with Financial Feasibility
The impact of various solar PV sizes on the obtaining cost of electricity with the utility and the decrease of carbon emissions each day were investigated. When the PV integration was doubled, greenhouse gas emissions were reduced by half, as well as the costs, as illustrated briefly in Table 6.  Figure 12 contains a bar graph that includes the solar PV incorporation in the proposed scenario and the cost consequences for the electricity obtained from the utility. We evaluated the differences in the operational costs of electricity based on the figures acquired in the prior cases. Table 7 depicts the techno-economic assessment data with various components utilized for the proposed system; this assessment included all of the suggested system's maintenance, operating, and capital expenses.   Table 8 shows the cash flow analysis of the respective campus microgrids with the consideration of a year-wise comparison for up to 10 years. It gives a brief comparison for investments, feed-in/export tariff, electricity savings, annual cash flow, and accrued cash flow (cash balance). In Figure 13, a financial analysis was freshly proposed here in this study to observe the financial performance of the campus microgrid. The cash balance was generated with a year-wise comparison to illustrate the accrued cash flow up to almost 20 years. In Figure 14, the financial feasibility was calculated for up to almost 20 years; it shows the annual energy cost for solar PV before and after the installation.   The research showed that incorporating distributed generating systems offered several advantages, including self-consumption, load demand flexibility, cost savings, and minimized GHG emissions. Therefore, due to these consequences, the proposed approach may be used to reduce the operational costs of campus energy consumption. To properly regulate the distributed generators, a control facility is required. Furthermore, unloading the grid enhances the grid efficiency by incorporating renewable sources. In other situations, capital and installation expenses will be distributed, enabling campus investors to invest further in storage installations and in DG. Grid outages (organized load shedding) are rather common in developing nations due to a variety of difficulties. When the grid is unavailable, diesel generators and the energy storage system can be utilized as backups. Scheduled high load shedding is typical throughout peak times. As a result, diesel generators are employed at peak periods in those specific situations.
The proposed model shown in Table 9 achieved the optimal results for our campus microgrid due to the utilization of demand response strategies, utilization of renewable energy resources, and optimal scheduling such that it achieved a 38.3% economic benefit to our microgrid, which is the most economical up-to-date.

Conclusions
In this study, the effective scheduling of a BESS and the effects of PV systems were analyzed for a campus μG to minimize the energy operating costs for a prosumer microgrid with the implementation of actual load data. The suggested system utilized solar energy, a BESS, and diesel generators in several scenarios and their consequences were investigated. The optimal scheduling was implemented in MATLAB and formed as a MILP problem. The TOU pricing-based DR was investigated here as part of a financial and economic analysis, and the ESS was used as a flexible DR framework that could be charged or discharged wisely at various times to meet the budget target without compromising its durability. Without the DG or ESS, the utility grid supplied all the campus μG's required energy, leading to higher operational expenses. However, when the solar PV, DGen, WT, and especially ESS were combined into the prosumer μG, the daily benefits in different seasons was an approximate 38.3% cost reduction. The environmental effects of various sizes of the installed capacity of the PV system were also investigated here, where it was discovered that installing 1000 kW rooftop solar in hot months may save between 365.34 kg CO2/day. If 2000 kW of rooftop solar was incorporated in the network, the savings were improved by 700.68 kg CO2/day. The cost of energy was reduced based on a variety of factors, such as energy consumption, feed-in tariff (FIT), and region. In Pakistan, the FIT has separate prices for importing and exporting energy to those in several other countries, although the cost of supplying energy to the utilities was considerably cheaper than the cost of purchasing energy from the utilities. As a consequence, by investing in on-site solar PV and ESS systems using an appropriate timetable that depends on FIT, location, and load usage, investors may expect their electricity prices to rise by 20-30%. As a result, the optimal charge-discharge method for the ESS plays an important role in the economic performance of prosumer μG with internal RER installations. In a future study, DG uncertainty will be investigated using more advanced mathematical models with many power systems and DR kinds. Acknowledgments: The authors would like to thank the UET, Pakistan, for giving a formal atmosphere to conduct this research.

Conflicts of Interest:
The authors declare no conflict of interest.

Nomenclature and Acronym
The following acronyms and nomenclature are used in this manuscript: