Optimal Scheduling for Campus Prosumer Microgrid Considering Price Based Demand Response

Existing energy systems face problems such as depleting fossil fuels, rising energy prices and greenhouse gas (GHG) emissions which seriously affect the comfort and affordability of energy for large-sized commercial customers. These problems may be mitigated by the optimal scheduling of distributed generators (DGs) and demand response (DR) policies in the distribution system. The focus of this paper is to propose an energy management system (EMS) strategy for an institutional microgrid ( $\mu \text{G}$ ) to reduce its operational cost and increase its self-consumption from green DGs. For this purpose, a real-time university campus has been considered that is currently feeding its load from the national grid only. However, under the proposed scenario, it contains building owned solar photovoltaic (PV) panels as non-dispatchable DG and diesel generator as dispatchable DG along with the energy storage system (ESS) to cope up with the intermittency of solar irradiance and high operational cost of grid energy. The resulting linear mathematical problem has been mapped in mixed-integer linear programming (MILP) and simulated in MATLAB. Simulations show that the proposed EMS model reduces the cost of grid electricity by 35% and 29% for summer and winter seasons respectively, while per day reductions in GHG emissions are 750.46 kg and 730.68 kg for the respective seasons. The effect of a half-sized PV installation on energy consumption cost and carbon emissions is also observed. Significant economic and environmental benefits as compared to the existing case are enticing to the campus owners to invest in DG and large-scale energy storage installation.

Energy systems have been facing problems such as inflating consumption cost, greenhouse gas (GHG) emission, network overloading, etc. The conventional grid may not resolve these problems, however, the emerging smart grid comprising of the smart distribution system equipped with distributed generators (DGs) and energy storage has the potential to overcome these issues considering resource scheduling through demand response (DR) programs. A microgrid (µG) is the combination of organized loads, onsite DGs and storage systems having defined electrical boundaries [1]. It may operate either in grid-connected mode or in islanded mode [2]. The emerging grid is well monitored and has the capabilities of self-healing, remote control and pervasive control due to the installation of sensors throughout [3]. The smart grid offers various opportunities for conservation and renewable energy integration to prosumer µGs by incorporating energy management systems (EMSs). Such energy management strategies require secure communication between prosumer and utility for the operation of intelligent control devices [4]. Since the distribution network consists of a collection of µGs where each µG acts as an independent distribution node, therefore, µGs equipped with onsite DGs, energy storage and DR programs that can play a key role by reducing energy cost and network overloading [5]. The mentioned benefits are more pronounced for µGs with heavy loads.
Institutional buildings are one of the heavy load µGs which fall under the class of mixed load consumers due to the diverse nature of their loads. Due to the presence of onsite generation resources, these buildings can export their surplus power to the grid network acting as a prosumer [6]. Similarly, they can import energy from the grid in heavy load conditions when onsite DGs and storages are insufficient to meet the total demand [7]. Effective participation of such µGs in grid operations not only reduces their operational energy cost but also supports the distribution network. Grid operators also offer various incentive and price-based DR programs to attract the active participation of such large scale consumers in electricity markets [8]. Energy management strategy through optimal dispatch of available resources meet their demand at reduced cost and ensures their effective participation to support grid operations [9]. This paper focuses on the development of an EMS for a prosumer µG having an energy storage facility and onsite DGs. The proposed EMS can optimally handle the bidirectional flow of energy between µG and utility network, and schedules the charging and discharging patterns of energy storage to minimize the energy cost. For analysis, the actual load of a real campus (U.E.T, Taxila) has been considered. Currently, the µG of the considered campus has a grid connection from the local distribution company named Islamabad Electric Supply Company (IESCO) along with a backup diesel generator. The economic and environmental effects of photovoltaic based energy production and energy storage in the proposed EMS are also analyzed.

II. RELATED WORK
Microgrid facilitates bi-directional energy exchange with a national power pool or may operate independently in islanded mode possessing enough onsite generation. For this purpose, researchers have already researched as presented below.
A µG model comprising of diesel engines, combined heat power (CHP), solar panel, and battery for different cities of Pakistan was presented in [10] using HOMER Pro software. The objectives were to reduce net cost, energy generation cost and annual GHG emissions while maximizing annual waste heat recovery from thermal units and grid sales. The analysis had been carried out in grid-connected and islanded modes. It was investigated that every city has one unique optimum objective function, therefore, decision making rests upon the competent authority to decide optimal city in the light of their objective. The analysis revealed that Lahore has the lowest GHG emissions of 1000.214 tons/year while the Quetta has the highest grid sales of 8,322,268 kWh/year among different cities. Rehman et al. [11] devised the µG model for residential customers having PV unit, battery, national grid and critical and responsive loads while considering grid reliability. The viability of the proposed system was validated in terms of net present cost and the Levelized cost of energy (LCOE) using HOMER Pro software. The cost of energy was found to be 0.135$/kWh with no grid outages. The effects of the grid outages and fluctuating solar irradiance were also analyzed. The best configuration for a household was found to be 2 kW PV capacity, 1200 Ah of battery storage, and a power converter of 1 kW. Under this setup, the capital, replacement, and operation & maintenance costs of the system were $7610, $2833, and $6522 respectively. In [12], the authors devised VOLUME 8, 2020 a PV-storage µG scheduling framework taking into account the battery running and degradation costs. The mixed-integer linear programming (MILP) model was proposed and validated by comparing the results with existing literature. The proposed system contained a PV plant and a battery energy storage system. The model reduced the energy cost, peak demand violation penalty, and battery degradation cost. Furthermore, two practical issues regarding the minimization of irradiance forecast error and optimal usage of the battery through real-time control schemes (RTCS) were addressed. Flexible assignment method (FAM) with RTCS2 was applied for state of charge (SOC) management and cost was reduced from 36,286,370 KRW to 34,354,995 KRW.
In [13], the authors presented a grid load reduction model for residential applications considering the grid availability using linear programming in MATLAB. Low-cost hardware of PV-storage was presented by considering various load shedding hours through online optimization techniques while ignoring the random presence of DGs. Different scenarios of load shedding were analyzed, and it was deduced that 8 hours load shedding could save up to 1000kWh for a typical household of 1200W. Furthermore, the authors found that a scenario with 4 hours of load shedding reduces the monthly consumption cost by 16%. Li et al. [2] presented a probabilistic spinning reserve solution for isolated µG using chance constraint programming. The proposed problem was converted into a MILP based model and solved in GAMS using CPLEX solver. The objective of the system was to reduce the cost and computational time and to present a trade-off strategy for the cost and reliability of µG. The proposed method reduced the cost from $396.5 to $394.3 while computational time was reduced from 673.5s to 2s as compared to a hybrid intelligent algorithm (HIA). Authors of ref. [14] devised an optimal model for multiple benefits of privately-owned battery systems. This work focused on four services: energy arbitrage, frequency regulation, investment deferral, and energy reserves. Initially, each service was individually analyzed to calculate the obtained profits for a private owner. Then, an analysis using different combinations of services was also carried out using 2015 data of the day-ahead market of CAISO. Results indicated that frequency regulation earned the highest revenue of $121,265 among individual services while energy arbitrage had the lowest earning of $18,983. When all the parameters were analyzed together, the revenue obtained was $221,817. Zhang [15] presented the campus µG testbed project of Georgia Tech. The proposed model was analyzed on the OpenDSS platform considering a group of 200 buildings and 400 net meters. The advanced data management system was utilized to handle a large amount of distributed system data. The demand response strategies were incorporated to enhance building-to-grid interaction. Future requirements of campus µG such as generation expansion planning, etc. were also studied.
Several researchers have been working on the optimal scheduling of energy management of a µG. Yu Zheng et al. presented the battery energy storage modeling for DISCOs profit enhancement [16]. The Natural Aggregation (NA) and Conic relaxation techniques were implemented for bidding strategy and cost reduction. The DG uncertainties were considered for error minimization and the proposed model reduced transaction risk. Two-layered operation module was presented for real-time and day-ahead optimization. A sensitivity analysis was performed to investigate the model's effectiveness. Different types of case studies were analyzed and tested on IEEE 15 bus system with and without the integration of the battery energy storage system (BESS). Integration of BESS reduced the energy cost from $448.49 to $433.63 in the day-ahead (DA) market. However, financial feasibility was ignored in the proposed model.
Perković et al. [17] analyzed the hypothetical factory model with a factory acting as prosumer. The multi-objective model was developed to determine the value of optimal energy exchange considering conflicting costs (operating and investment costs). The linear programming technique was used to solve the proposed system on octave 2015 and the Pareto fronts technique was applied to find the optimal values of conflicting parameters. The market-clearing price (MCP) was taken as input and was examined in five scenarios. The proposed technique significantly reduced the operational and investment cost of the prosumer. In [18], the authors scheduled multiple µGs to form a virtual power plant (VPP) using a binary backtracking algorithm (BBSA). The sustainable energy sources were integrated by an optimal controller and the proposed model was validated on IEEE 14 bus system. The fitness function of the proposed model was much better as compared to binary particle swarm optimization. Reductions in operating cost and power losses while enhancing reliability were found. The savings by the proposed method were increased from 187926.386 to 222246.9262 RM (Malaysian Ringgit). Day-ahead (DA) scheduling of µG resources to minimize the operational cost and peak load was presented in [19]. The day ahead load and variable prices were forecasted using the neural network for a near-optimal solution. The proposed mixed-integer linear programming (MILP) model was solved using the CPLEX solver in a mathematical programming language (AMPL) platform. The energy storage system (ESS) life cycles were also reduced to increase the storage's life. Detailed case studies were analyzed with different ESS scenarios and the operational cost was reduced from $89.58 to $41.21.
Dahraie et al. [20] devised a two-stage stochastic model for the simultaneous benefits supply and demand entities considering the frequency security provision. The proposed model was solved by CPLEX solver in GAMS and significant outcomes in the electricity market were found due to the participation of customers. The residential load model was considered using the price-based demand response (DR) strategies. The cost was reduced from $835.52 to $773.75 in the proposed model using the incentive-based DR. Sattarpour et al. [21] scheduled energy resources and appliances in a smart home considering the ESS and PHEV. The proposed bi-objective linear model was solved using CPLEX 12.4 solver in GAMS to reduce the payment cost and load deviation. Three scenarios were analyzed, where each scenario was containing two cases. It was found that the reduction of cost might be theoretically possible but technically it might not be suitable for µG operator (MGO). In the first case, authors only considered the cost, whereas in the second case, load variations were also analyzed with the cost. The presence of PHEV and ESS was employed for valley filling and peak shaving purposes. Load profile deviation (LPD) was minimized from 25.34 kW to 14.66 kW without compromising the operational cost. Yang et al. [22] scheduled the generation of multi-energy resources in a hub. The proposed mixed-integer programming (MIP) model was solved in GAMS considering the time of use (TOU) pricing scheme. Randomness in DGs and load with different confidence levels were considered while reducing the cost and increasing the efficiency of energy utilization. The analysis inferred the increase in operational cost with an increase in confidence level. The results of summer and winter seasons were analyzed with two subcases in each season to find the total operational cost of energy. A cost reduction from $1092.7 to $955.9 was observed in summer, while the reduction in winter was observed from $1328.6 to $1105.8. Li et al. [23] presented the DA scheduling of isolated µG for cost minimization considering the EV battery station. The proposed bi-level model reduced the cost and maximized the profits respectively. Hybrid heuristic (Jaya) and analytic (branch and bound) algorithm were implemented to solve the system. The uncertainties of wind turbine (WT), photovoltaic (PV) and load were modelled using various distribution functions. The obtained results were compared with the other methods and significant reduction in cost was found. Case studies were carried out to analyze the effect of demand response (DR) but storage life was ignored. The improvements in cost and computational time were from $183.16 to $176.43 and 364.7s to 37.5s respectively, while the profit though proposed approach was increased from $140.23 to $147.15 as compared to HIA.
Chen and Trifkovic [24] modeled µG scheduling using the Kelly criterion. The uncertainty of different parameters such as load, renewable resources, and prices were considered to remove the dependency on meteorological data. The proposed model maximized the profit using artificial neural network (ANN) considering to tackle the uncertainties in the system. For the validation and efficacy of the proposed model, case studies were carried out for different pricing and level of volatility scenarios. In [25], the authors presented the design of an EMS for the prosumer-based system. Different types of protocols were discussed for various applications of market and energy scenarios. The OASIS based protocols were implemented for different services considering the practical architecture of the system, communication protocols and interaction between virtual end node (prosumers). Raj and Kowli [26] devised the prosumer scheduling considering the forecast error. The stochastic MILP was implemented to solve the different types of scenarios. The forecast and resource-based scheduling were presented for controllable and uncontrollable loads. Two-stage stochastic control was introduced for the prosumer with energy storage to compensate for the uncertainties.
In [27], the energy sharing provider (ESP) strategy was presented for the community of prosumers. The proposed model was useful for both customers and utility and was solved using stochastic game theory. The results of the proposed work were compared with the Cournot model for validation. The consumption and production models of prosumers were discussed considering various aspects of metering types. Hao and Coe [28] devised the scheduling model of BESS for DR issues. The proposed model reduced the operational cost and uncertainty in DR deployment. The total cost was reduced from $85.10 to $42.72 with DR participation.
Energy storage has found diverse applications in the management of µGs and utility grids. Among different applications, frequency regulation [31], voltage regulation [32], [33], energy arbitrage [34], off-grid system applications [35], distribution system deferral [36], demand-side management [34], [37], power system reliability [38], peak reductions [39] etc. are some of its main contributions in energy systems. Many types of ESSs such as BESS, compressedair, flywheels, ultracapacitors, etc. are available [40]. Li-ion batteries are getting rising adoption as BESS due to more reliability, high energy/power density, low self-discharge, and long lifespan energy storage system [41]. The optimal charging/discharging of ESS can further enhance its efficiency and life. Due to these advantages, BESS based on Li-ion batteries is considered in this work.
Most of the works related to EMS of µGs have considered PV, ESS, and optimal scheduling. Some researchers solely focused on the financial feasibility of PV and ESS integration in µGs, whereas others had merely calculated cost savings due to PV integration and optimally scheduled ESS. Economic analysis calculating LCOE while considering energy exchange with grid, battery based-ESS degradation cost, PV uncertainties, and DR simultaneously had been rarely investigated as shown in Table 1. This research considers all these research components simultaneously in a single work and presents a more comprehensive model for the EMS of an institutional µG by optimal scheduling of the proposed ESS and uncertainties of proposed PV installations using its actual load data of summer and winter in a grid exchange environment.
The main contributions of this paper are as follows.
• An intelligent EMS is proposed for optimal scheduling of onsite ESS, DGs, and grid power using MILP considering the price-based DR to improve self-consumption and to reduce the operational cost of energy and network load in peak hours.
• Battery degradation cost and probabilistic PV generation are incorporated to improve the mathematical model of campus µG.
• Techno-economic and environmental impacts of two different sizes of green DGs and optimally scheduled VOLUME 8, 2020 ESS are analyzed in a time-of-use (TOU) based net-metering environment.
The remaining paper is comprised of the following sections. The architecture of the proposed system and its formulation are presented in Section III. Section IV presents the results and discussion of the proposed model, while Section V concludes the findings of this paper.

III. PROPOSED SYSTEM ARCHITECTURE AND FORMULATION A. PROPOSED MODEL
The conceptual framework of the proposed model shown in Figure 1 is comprised of a utility grid, EMS and prosumer µG. The prosumer µG consists of various types of loads, and energy storage facilities and two distributed energy resources (PV and diesel generator). The prosumer has a net-metering contract with the utility company and can sell its surplus energy to the grid. The proposed EMS implemented at the prosumer facility takes demand data, weather data, price data, the initial status of the ESS and its related parameters as input and finds an optimal solution to meet load demand through available resources without violating their operating and designed constraints. This optimal solution is sent to the control scheduler to dispatch available resources. A provision of storing different important parameters is also available in the proposed EMS which could be exploited for multiple benefits in the future. Real-Time Database (DB), market DB and prosumer DB store energy exchange data, price data and prosumer load data. The next subsection formulates the proposed model.

B. PROBLEM FORMULATION
The mathematical model of the proposed system is formulated as a linear optimization problem with objectives to reduce the operational cost of the prosumer µG considering the life of the battery energy storage system. All other system constraints related to various components of the proposed model are described below.

C. OBJECTIVE FUNCTION
This model aims to reduce the total operational cost (J ) of µG which involves energy exchange cost, diesel generator cost, and energy storage degradation cost. The summation of different types of costs are given in equation (1). The battery lifetime depends on many factors such as its capital cost, number of cycles that are used and its total capacity as represented in equation (4). where, where C e t , C dg t , and C es t are energy exchange cost, diesel generator cost, and battery degradation cost at any time t respectively. The university has taken the time of use (TOU) connection from IESCO. During any hour t, the power exchange with grid and its unit price are denoted by p g t and λ t respectively. C dg t is calculated using the diesel generator rated capacity (T G = 600kW ), fuel curve intercept (α =0.0165 l/h/kW), fuel curve slop (β =0.267 l/h/kW) and total generated power ( p dg t ) from the diesel generator [44] as shown in Figure 2. The charging efficiency, discharging efficiency, charging power and discharging power of the battery storage is represented by η ch , η dch, p ch t and p dch t respectively and the net power of the battery (p bat t ) is represented in equation (5).

D. LOAD BALANCE CONSTRAINT
The equality constraint essentially represents the supplydemand balance constraint. To achieve this balance, equation (6) must be satisfied.
where p pv t and p l t are output power of the solar PV in kW and load demand of the prosumer respectively.

E. ESS CONSTRAINTS
ESS is an unavoidable element of the energy management system as it supports supply loads in case of grid failures [45].
Since an ESS cannot be charged or discharged instantly, therefore, the limits of its power are incorporated in constraints (7)- (11). The battery state of the charge (BSOC) in ESS at any interval t 'BSOC t ' is dependent on its previous state (BSOC t−1 ) which is incorporated in equation (12). To avoid overcharging and complete discharging of ESS, upper and lower limits of BSOC are defined by BSOC max and BSOC min respectively in expression (13). It is assumed that the state of battery charge at the end of the day (BSOC T ) is equal to its initial state of charge (BSOC 0 ) that occurred at VOLUME 8, 2020 the beginning of the day as given in equation (14).
The battery output power, p bat t is already added in equality constraint defined by equation (6) to schedule its participation in EMS. The negative and positive values of the p bat t shows the discharging and charging of the ESS respectively. Charging or discharging mode of the ESS in any interval 't' is represented by two integer variables u ch t and u dch t respectively. The binary variables used in expressions (9)-(11) cannot be '1' simultaneously to avoid charging and discharging of the BESS at the same time. A value equal to '1' for any of these variables represents the activation of the associated mode and vice versa.
The gradient of storage output power can be controlled as follows:

F. LIMITATIONS OF GRID AND DIESEL GENERATOR
Since utilities install their components according to load demand, they always make a maximum demand contract with the consumer. Any demand exceeding this contractual demand will result in a penalty or loss of connection. Similarly, a diesel generator is also incapable to meet the load exceeding its rated capacity. These power supply limitations of grid connection and the diesel generator are considered using expressions (16)- (17). The net energy (E g net ) exchanged with the grid during a day is as follows: The import from the grid and export to the grid energy is represented by positive and negative values of p g t respectively.

H. PROBABILISTIC PV MODEL
The solar PV generation is highly intermittent and dependent on the weather and solar irradiance. In stochastic conditions, one-year data is analyzed. This paper uses an already developed model of solar irradiance [46]. The parameters are calculated for probability density function (PDF) of normal distribution. Latin hypercube sampling technique is used which generates 365 scenarios and in 24 hours [47]. To reduce the computational burden, the Fast forward method is used to reduce the scenarios to 40 as given in [48]. The normal distribution function [49] given in expression (19) is used to model the uncertainty associated with solar irradiance.
where η pv,j , β pv and I are solar panel efficiency (17%), solar panel area (m 2 ) and solar irradiance (kW/m 2 ) respectively. µ and σ denote the mean and standard deviation of the normal distribution respectively. Equation (20) shows the solar output power p pv t that mainly depends on the irradiance of the specific area. The values of the mean and the standard deviation of the solar irradiance pattern for the region Taxila, where the considered campus µG is situated, are given in Figure 3. The annual mean daily solar global horizontal insolation for Taxila having latitude '' 33.7463 • N '' and longitude '' 72.8397 • E '' is 5.30 kWh/m 2 /day [50].

I. LEVELIZED COST OF ENERGY
To have a fair economic analysis, the Levelized cost of energy (LCOE) is considered in different scenarios. Levelized cost of energy (LCOE) can be defined as the ratio of the total cost ($) of the system installation to the produced or processed energy (kWh). LCOE from a particular energy source or storage is represented in $/kWh. It covers all the associated costs such as capital cost, installation cost, operation and maintenance costs, etc. It can be regarded as the minimum cost at which electricity must be sold out to achieve break-even over the lifetime of the generation or storage component [51]. Mathematically, LCOE can be expressed as:

J. SOLUTION METHODOLOGY
As the objective function of the proposed system model and all the relevant constraints are linear with some integer variables, therefore mixed-integer linear programming (MILP) is used to solve this optimization problem. MILP is a popular global optimization technique for solving different types of linear optimization problems related to scheduling, marketing, production schedules, etc. [53]. Furthermore, MILP gives global optimal results as compared to other metaheuristic techniques that give suboptimal results. Therefore, MILP is widely used for the optimization of building EMSs [54]. The basic structure of MILP is as follows: Subject to where x (intcon) are integers In equation (23), x(intcon), x, b, b eq , f , lb and ub are vectors where A eq , A are matrices. Figure 4 shows the general flowchart that controls the proposed µG of the campus. At the initial stage, all the input data required by the program for the optimal scheduling of any day are loaded one hour before the arrival of that day. This data contains load pattern, forecasted temperature, forecasted irradiance, TOU tariff information, the initial condition of ESS and its related parameters, etc. The simulations of the proposed model are based on the daily upfront using the interval duration of one-hour. The proposed algorithm is solved in MATLAB R2017a environment on Intel (R) core i5-4670 @3.4 GHz processor with 4GB RAM.

IV. RESULTS AND DISCUSSION
The proposed model described in Section III is applied to smart campus prosumer microgrid (SCPM) situated in the province of Punjab. The campus has six faculties, fourteen departments, and eight hostels. Currently, the campus has only a grid connection of 2 MW to feed its loads. The rooftop capacity of the campus is found to be 4 MW through a detailed survey of the rooftop area available for PV installation. Since National Electric Power Regulatory Agency (NEPRA).
Pakistan allows energy exchange up to 1MW only, therefore we cannot install 4 MW PV due to budget constraints and regulatory requirements. As the sizing of distributed generation is not being addressed in our work, a 2 MW of onsite solar PV installation is assumed for detailed technoeconomic analysis. The effects of reducing its size to half are briefly described as well. Rating of the Li-ion based BESS is assumed to be 800kWh [55], while the 600 kW diesel generator is already available in the existing system as a backup to power the loads in case of grid failure.
Besides, it is assumed that the grid connection from utility has a net-metering facility in which regulations allow power exports up to 1MW to grid network to minimize the energy consumption cost of the prosumer. The campus load is diverse as there are academic and administration blocks, residential colony, and hostels.
With almost 300 sunny days per annum and 8 sun hours a day, the integration of solar PV is a viable solution to manage the energy problems of Pakistan [56]. About 5100 kWh of energy is reported to be produced per day from 1MW solar PV [57]. Therefore, we have proposed the integration of the PV installation with campus µG in this work. Similarly, Li-ion batteries are proposed as BESS in this work due to their superior efficiency, high reliability, improved power/energy density, low self-discharge and long lifetime [41]. The optimal charging/discharging of ESS proposed in this work can further stretch their life.

A. CASE STUDY
Scheduling of µG in winter and summer seasons is presented in this case study, as two main seasons mostly occur in Pakistan. Load patterns of the typical summer and winter days are taken for the analysis purpose and these patterns are assumed to be the same throughout the season for ease in the analysis. January and August are the peak load months of winter and summer seasons respectively. Peak load days from these months are taken as typical days for analyzing each season to cover the worst-case scenario. Selecting the worst case for the economic analysis gives careful judgment about cost savings. Savings are underestimated using the peak load. When the load is less, most of the generated electricity from PV will be exported to the grid resulting in more savings.
The actual field data of campus consumption for the typical days are taken from the meters installed at the local substation to analyze the daily cost of electrical energy. These selected load patterns for analyzing the two seasons are shown in Figure 5, while the average load distribution among residential block, academic block, and hostels is shown in Figure 6.
Loads of the academic and admin blocks are high during the campus timings while the peak energy demands in residential colony and hostels are observed after the campus time up to midnight. Table 2 represents various parameters  associated with the system, while the information about electricity price in the TOU tariff scheme is given in Table 3 [58]. Solar irradiance data used in the study is collected from [59], and the characteristics of this data are modeled by using a normal probability distribution-based function (PDF) defined in equation (19). The defined PDF is used to generate daily solar irradiance patterns. The generated irradiance pattern is used to calculate the output power of PV generation by equation (20), where Table 4 shows the profile of case studies.

B. CASE 01 (SUMMER SEASON)
In this case, a typical summer season is discussed for energy consumption and exchange investigation using the price information given in Table 3.
Scenario 1(a): In this scenario, the energy demand is provided through the grid only. No ESS, PV installation and the diesel generator are available in this case. The operational cost of energy per day using time of use (TOU) tariff is calculated to be $1448. 16. LCOE, in this case, is found to be 0.099$/kWh as shown in Table 5.
From the result, it is evident that the daily operation cost of energy is very high in this scenario and this scenario is considered as a base for comparing different scenarios of the summer season.
Scenario 1(b): In this scenario, solar PV is integrated with prosumer µG, not only to feed its loads but also for energy export to the utility grid. The energy produced by solar PV is 8884.5 kWh which shows the effectiveness of solar PV in the summer season. LCOE of solar PV generated is taken as 0.048$/kWh in this case. Therefore, the net cost of electricity per day becomes $ 804.12 which is reduced by 44% from the base case.

Scenario 1(c):
In this scenario, the presence of ESS is assumed in a prosumer facility in addition to PV installation and grid connection. The proposed scheme is applied to optimally schedule the charging and discharging patterns of ESS and the net energy cost obtained is $894.97 by considering all the associated costs of all components in this scenario. The LCOE in this case after optimal scheduling of BESS in TOU based tariff comes to be $ 0.061/kWh as shown in Table 5. This slight increase in LCOE is due to the cost of BESS involved in the case. The comparison reveals that the percentage reduction in the net cost of electricity is in this scenario is about 38% as compared to base scenario 1(a). The power exchange with a grid is shown in Figure 7 where the negative and positive values indicate the export and import of energy respectively. The scheduling result of the ESS indicates that the end of battery operation occurs at the same SOC i.e.50% from where its operation begins at the start of the day. Furthermore, the ESS attempts to stores the energy intelligently in off-peak hours and discharges in peak hours to minimize the operational cost of energy as shown in Figure 8.

Scenario 1(d):
In this scenario, the availability of onsite diesel generator (DGen) is also assumed in campus µG along with PV and BESS to relax the grid network in peak hours (19:00 HRS to 23:00 HRS for summer). The energy import from the grid is restricted to 50 kW and the power output of the DGen is limited to 400 kW during these hours, as shown in Figure 9. The net cost of electricity after optimal scheduling of BESS comes to be $ 951.53 per day. LCOE obtained, in this case, is 0.065 $/kWh which is 35% less as compared to the base case which only considers a grid connection and the computational/execution time noted is 2.2 seconds for the summer season.

C. CASE 02 (WINTER SEASON)
In the winter season, the load demand is greater as compared to summer, so intelligent scheduling is crucial to meet the demand optimally. During the weekdays, all the academic departments and administrative offices are in working condition and peak load demand goes beyond 1 MW. Different scenarios of this case study are given below. Scenario 2(a): Like scenario 1(a) of the summer, the energy demand in this winter scenario is merely fulfilled from the grid connection. A TOU-based tariff is considered to calculate the cost of grid electricity. No PV, BESS or DGen. are considered in this case. The obtained result is $1730.98 which is higher as compared to scenario 1(a) of the summer due to increased load in winter. This scenario is used as a base case for the winter season.
Scenario 2(b): In this case, we assumed the onsite installation of a 2MW solar PV plant on a rooftop in a grid exchange net metering environment. Surplus energy is instantly sold to the utility grid without any schedule. The net cost is reduced to $1100.3 i.e. a reduction of 37% as compared to the base case scenario (a) where the cost is $1730.98. The reason behind the net cost reduction is the cheap energy generation from solar PV. However, it relies on grid availability and weather condition. During the cloudy day or grid outage, this scenario could not give continuous supply. So, in the next scenarios, ESS and DGen are added to analyze their effect.
Scenario 2(c): From the tariff given in Table 3, the peak hours are from 17:00 to 21:00 for the winter season. In this scenario, energy storage is also added to better manage the energy exchange with utility. The net cost of electricity is reduced from $1730.9 to $1202.7 i.e. a reduction of 31% from the base scenario 2(a). The proposed scheme is applied to optimally schedule the charging and discharging patterns of ESS to obtain financial savings as shown in Figure 10. Although the cost of grid electricity is reduced in this case as optimizer tries to sell energy to the grid in peak times through ESS, the net cost of electricity is still higher in this scenario due to costs involved with the installation, operation, and maintenance of BESS. The comparison reveals that the percentage reduction in LCOE is 31% as compared to base scenario 2(a).
Scenario 2(d) : In this scenario, the availability of onsite diesel generator is also assumed in campus µG to relax the grid network in peak hours. The energy import from the grid is restricted to 50 kW. An additional benefit of DGen is the continuity of electric supply in the case of grid outages. Figure 11 shows the state of charge of the battery, which  indicated the available energy ratio as compared to the total capacity.
The blue bar in Figure 11 shows the operation of DGen while relaxing the grid network in peak hours.
Although the operating cost per day recorded in this scenario is $1233.3 that is $30.6 higher as compared to $1202.7 observed in scenario 2(c), this increase is negligible as compared to stability achieved in the grid network. The computational/ execution time noted is 2.4 seconds for the winter season. From all these discussions and analysis, solar PV, scheduled ESS with utility grid is an optimal solution for cost reduction as compared to case 2(d). While Figure 12 shows the comparison of both cases of summer and winter seasons. All the results of winter case studies are given in Table 6. Table 7 shows the comparison of the proposed model with the existing work.

D. EFFECT OF PV SIZING ON ENERGY COST AND CARBON EMISSION REDUCTIONS
The effect of different sizing of PV integration in prosumer µG on the purchasing cost of energy from grid and emission reductions of CO 2 per day is analyzed. As the solar  PV integration double, the GHG reduced two times along with the cost reduction and are shown in Table 8. The bar chart in Figure 13 also illustrates different types of solar PV integration in the proposed model and their effect on the cost of electricity purchased from the grid. Based on the values obtained in the above cases, we can analyze the difference in the operational cost of energy.
The analysis reveals that the distributed generation integration has many advantages, such as cost reduction, selfconsumption, emission reduction, and load flexibility. So, the proposed system can implement using the proposed model to reduce the campus operational cost of energy consumption. It needs a control center that controls all types of  loads and sources optimally. Moreover, grid load reduction also improves network efficiency through renewable integration. The installation and capital cost will payback in a few ears that enticing the campus owners to invest in DG and battery installation. In developing countries, grid outage (scheduled load shedding) is common due to various kinds of issues. ESS and diesel generators are used as a backup during the grid unavailability. Scheduled load shedding usually occurs during peak hours. So, diesel generator was also considered especially in peak hours.

E. EFFECT OF LOAD VARIATIONS ON COST OF ELECTRICITY/DAY AND LCOE
The load consumption patterns used for detailed savings and economic analysis are based on peak consumption. However, the effect of load variations has also been observed on the net cost of electricity per day and LCOE. For this purpose, days of lowest, average and peak load consumption for the summer and winter seasons are analyzed with the optimally scheduled campus µG having PV, ESS, and DGen along with grid connection. The results obtained for different load VOLUME 8, 2020  patterns using 2000 kW of PV installation in summer and winter seasons are given in Table 9.
For the lowest consumption day of the summer season, energy import from the grid network is 2917.92 kWh/day while the net cost of electricity is $570.74/day. LCOE, based on the lowest consumption, becomes $0.048/kWh. On a summer day with an average load consumption, energy import from the grid is more as compared to the day with the lowest consumption. The net cost of electricity and LCOE is $4376.88 and 0.064$/kWh respectively for this case. For a peak consumption day in summer, the net cost of electricity is increased to $951.53/day and LCOE becomes 0.065$/kWh. The same results of LCOE and the net cost of electricity per day for the various load consumption patterns of winter are also presented in Table 9.

V. CONCLUSION
In this paper, impacts of PV and optimally scheduled ESS are studied for the campus µG of a university to minimize the operational cost of energy for the commercial prosumer using the actual load data. The proposed model considered solar PV, diesel generator, and battery storage system in different cases and observed their effects in various scenarios. The scheduling problem was mapped in a mixedinteger linear optimization problem and was simulated in MATLAB considering the battery life. TOU tariff (a price-based DR) was considered and ESS was used as DR flexible system which can be intelligently charged and discharged during different times to achieve cost minimization objective without compromising its life span. Without any DGs and ESSs, all the energy required by the campus µG was supplied by the utility company which resulted in higher operational cost. But when PV, DGen and ESS were integrated with the prosumer, daily percentage savings of 35% and 29% were observed in the summer and winter seasons respectively. Environmental effects of the different PV installation sizes were also observed, and it was found that about 375.23 and 365.34 kg/day of CO 2 can be saved by installing 1000 kW PV installation in summer and winter seasons respectively. These savings are stretched to 750.46 and 730.68 kg/day in the summer and winter seasons respectively if 2000 kW PV is integrated. The savings in electricity cost depend on many parameters such as Feed-in-Tariffs (FITs), location, demand, etc. In Pakistan, FIT has the same cost of selling and buying electricity as compared to many other countries where selling the cost of electricity to the grid network is lower than the purchasing cost of electricity from the grid network. Therefore, the investors can expect a 20-30% decrease in their cost of electricity by investing in onsite PV systems and optimally scheduled ESS depending upon their FIT, location and load consumption. This concludes that the optimal charging-discharging strategy for ESS plays a vital role in the economic operation of commercial prosumer buildings having in-house RERs installations. DG uncertainties, more complex mathematical models with multiple energy storage systems considering DR types along with the sensitivity analysis will be analyzed in future work.