Present power systems face problems such as rising energy charges and greenhouse gas (GHG) releases. These problems may be assuaged by participating distributed generators (DGs) and demand response (DR) policies in the distribution system (DS). The main focus of this paper is to propose an energy management system (EMS) approach for campus microgrid (µG). For this purpose, a Pakistani university has been investigated and an optimal solution has been proposed. Conventionally, it contains electricity from the national grid only as a supply to fulfil the energy demand. Under the proposed setup, it contains campus owned nondispatchable DGs such as solar photovoltaic (PV) panels and microturbines (MTs) as dispatchable sources. To overcome the random nature of solar irradiance, station battery has been integrated as energy storage. The subsequent nonlinear mathematical problem has been scheduled by mixed-integer nonlinear programming (MINLP) in MATLAB for saving energy cost and battery aging cost. The framework has been validated under deterministic and stochastic environments. Among random parameters, solar irradiance and load have been taken into consideration. Case studies have been carried out considering the demand response strategies to analyze the proposed model. The obtained results show that optimal management and scheduling of storage in the presence of DGs mutually benefit by minimizing consumption cost (customer) and grid load (utility) which show the efficacy of the proposed model. The results obtained are compared to the existing literature and a significant cost reduction is found.

1. Introduction

Energy systems have been facing problems such as inflating consumption cost [1] and greenhouse gas (GHG) emission [24], as well as network overloading [2, 511]. The conventional grid may not resolve these problems; however, a smart distribution system (DS) equipped with DGs and demand response (DR) has the potential to overcome these issues. A microgrid may be defined as a combination of DGs, well-defined load, and storage system. DR policies and energy storages are used to help reduce energy cost and network overloading, etc [12, 13]. Microgrids with heavy load have a more pronounced impact on the stated problems. Among different types of high load µGs, institutional buildings falling under the class of commercial customers, need an optimal energy management strategy for consumption cost reduction. Microgrid facilitates bidirectional energy exchange with national power pool or may operate independently in islanded mode possessing enough on-site generation [14], while various energy management systems are given in [15]. For this purpose, researchers have already researched the following.

The smart microgrid energy management system is implemented in various countries in the world due to its multibenefits [16]. In a conventional system, one way of energy flow was in practice and consumer act was a passive entity of the power system [1720]. While, in microgrid, having some distributed energy resources and storages can operate in grid-connected and islanded mode [21, 22]. In microgrid, prosumer which is a consumer can participate in the electricity market through the selling of surplus energy to the national grid or nearby customers [23]. Different types and levels of prosumers can operate in microgrid operation [24]. The commercial prosumers have high energy demand along with large-scale distributed resources. Prosumer stores surplus energy from various sources such as solar PV, wind, and biomass during off-peak hours and sells in peak hours [25]. Energy forms RERs, which are intermittent because they depend on weather and temperature [26]. So, the energy storage system [27] requires continual operation with multibenefits such as price arbitrage, frequency regulation, RE integration, and backup power [28]. Different types of storage systems are used in microgrid operation such as electrical, electromagnetic, electrochemical, mechanical, thermal, and chemical. Electrochemical energy storage can convert chemical energy to electrical energy, i.e., batteries [29]. Different types of batteries are used in microgrid operation for smooth function. As compared to other types of batteries the initial cost of lithium-ion batteries is high but more reliable with a competitive number of life cycles [30]. The degradation of battery energy storage system (BESS) depends on many factors, such as external temperature, internal resistance, depth of discharge (DOD), and a number of cycles [31]. The optimal scheduling of distributed energy resources in a microgrid is the proposed model considering system constraints.

Some other contribution of our work can be summarized as follows:(i)Campus microgrid nonlinear model is devised considering the battery degradation cost and demand response strategies(ii)Randomness in solar irradiance and load are modelled for day-ahead scheduling operation(iii)Grid support and grid outage-based modes are also considered for emergency operations to analyze the effects on the operational cost supply continuity

The remaining paper is comprised of the following sections. Section 2 presents the literature review. In Section 3, the proposed system model is presented, while in Sections 4 and 5, problem formulation of day-ahead scheduling and proposed solution are presented. Results and discussion are given in Section 6. Section 7 concludes the findings of this paper.

2. Literature Review

Several kinds of literature have been working in resource management in a microgrid. Like other developing countries, Pakistan is also facing energy shortage and issues due to some regulatory and managerial reasons. Scheduled grid outage is in practice from 4 to 6 h per day [32]. Hassan et al. [33] proposed the model of a microgrid in Pakistani environment, considering the stability, power quality, and load tracking. Historical and real-time data of Islamabad was used to design an energy management system strategy for said goals. The proposed model is solved using power algorithm in MATLAB, which is popular software in optimization [3444] and machine learning [4550] literature as well. Waqar et al. [51] presented a microgrid model for Pakistani environment. A combined heat and power- (CHP-) based multitasking analysis of six cities was analyzed on HOMER and the most suitable city for CHP integration was found. Rehman et al. [52] devised the PV integrated microgrid model considering grid reliability. The feasibility analysis was carried out to find the optimal condition of available resources. Furthermore, greenhouse gas (GHG) emission was also investigated for on HOMER software. Zia and Shaikh [53] analyzed the economic and environmental impact of a microgrid in Baluchistan. The proposed model investigated on HOMER and the total amount for the initial investment was found. The system comprised of solar PV, wind, and diesel generators, and its net present cost (NPC) was found.

Energy systems and their related research are very popular and widespread among engineers [5456]. Different types of microgrid models are introduced in the existing literature to improve the resilience and reduce the operational cost. A general proposed model of the microgrid system is given in Figure 1 which elaborates the microgrid energy and information flow system. Uncertainty of renewable energy resources, loads, and grid intermittency was incorporated in some microgrid models such as Gao et al. [57], who presented the model for microgrid cost reduction considering penalty factors and uncertainty of renewable energy resources (RERs). Rehman et al. [52, 58] presented the PV energy storage system considering grid intermittency. Nasir et al. [59] presented the grid load reduction model considering the grid availability using linear programming in MATLAB. Low-cost hardware PV-storage solution was proposed in the Pakistani environment considering the various loads’ shedding hours through online optimization technique. Li et al. [60] presented a probabilistic spinning reserve solution for isolated microgrid using chance constraint programming. The proposed problem was converted into MILP-based model and solved in GAMS by using the CPLEX solver. The proposed system reduced the cost and computation time and presented a trade-off strategy for cost and reliability. Similarly, in [61], the authors devised the scheduling of campus microgrid using the MIP however and ignored the uncertainties of DGs. Ahmad et al. [62] investigated the university campus in India. The HOMER-based analysis revealed that the optimal siting and sizing of DGs attract the investors for microgrid establishment. Soleja et al. [63] analyzed the economical analysis of the PV grid system. The payback period with other financial parameters was also calculated for South Asian Countries. However, the energy storage system was ignored, that is, the most important part of the energy management system. Liu et al. [64] explored the prosumer-based energy management system. The proposed model found that the scheduling of peer-to-peer prosumer enhanced the energy trading potential of customers. In [65], the authors investigated the Korean campus to find the viability of microgrid implementation especially investors. The payback period revealed that the initial cost will cover within a few years and shifted the conventional system into a smart [6668] power system. In [69], the authors analyzed a large number of customers in the US region. The base system is investigated that the specific values of both PV and energy storage system (ESS) might attract the consumers to install the PV-storage system. The analysis discovered that the retail electricity price should be above $0.4/kWh and feed-in tariff below $0.05/kWh. Rodríguez-Gallegos et al. [70] devised the optimal scheduling, considering the economic benefits. The results revealed the importance of ESS in the microgrid operation system. Liu and Wang [71] investigated energy trading with national grid considering the operational cost.

Literature survey shows that placing the ESS in microgrids makes it robust, cost-effective [72], and capable to integrate large-scale RERs. The energy storage system which has microgrid energy management has many issues such as energy consumption cost reduction and maximizes the profit of utility grid. So, the resilient smart microgrid is the potential solution for developing countries [59]. In South Asia, Pakistan has great potential for solar PV and other renewable energy resources (RERs) [73], as discussed earlier.

Net metering was launched in 2016 which promoted the passive consumer to active prosumer. In this work, an institutional microgrid has been devised for optimal energy exchanges between a university campus building and the national grid. The existing literature addressed the microgrid considering uncertainties but ignored the battery life which is a very important factor. Optimal energy management system considered the mixed price-based/incentive-based demand response, and ESS life is incorporated in our proposed system.

3. Proposed System Architecture

The transition of the legacy power system into a smart power system is at the initial stage after the net metering installation. The net metering has started in 2016 from the Government of Pakistan but needs regulatory system improvement. Given this step, we proposed UET Taxila as a campus microgrid to get the economic and environmental benefits. The Taxila city location has latitude and longitude as 33.70 and 72.840, respectively, and aerial view is shown in Figure 2. In the day time, the energy demand is high as compared to evening although evening classes are also offered on campus. To control the whole resources and storage scheduling, a scheduler is designed for optimal operation. In the control room, the signals are received from each entity through the Internet of Things (IoT). In critical situations, such as grid outages and other emergency events, the controller curtails the noncritical loads.

The database has historical weather and load data for the last ten years and does the forecasting.

The day-ahead scheduling considering the uncertainties of RERs is modelled in Section 4. In the proposed model, ESS stores surplus energy during the off-peak hours and sells the stored energy to the nearby consumer of the national grid in peak hours, as shown in Figure 3. Feed-in-tariff (FIT) is an important factor of energy-sharing willingness. Here, we assumed that the selling and purchasing energy prices are the same, which motivate the prosumers to sells its surplus energy to the national grid. The detailed layered structure of the proposed scheduler is resented in Figure 4 with its functions.

4. Problem Formulation

In this study, various types of distributed generation are integrated. Rooftop solar PV is taken in large scale with energy storage (ES). The proposed model comprised of the national grid, diesel generator, solar PV, and ESS. The ESS has many advantages over the single solar PV grid system such as backup storage, grid stability, and frequency regulation. The rooftop capacity of the campus is 4 MW, but we take only 2 MW. A mathematical model of day-ahead scheduling is presented in the next section following the network constraints. Initially, the deterministic model is analyzed for a proposed system. While in the second part, the real-time stochastic-based system is analyzed using historical data.

4.1. Objective Function

To optimize the proposed model, a nonlinear objective function is modelled. As the real-time model of ESS is nonlinear,

The goal of this study is to investigate the resource scheduling considering the system constraints. The exchange energy with the grid is beneficial for both utility and customers. In equation (1), the first part is energy exchange with the grid, while the second part calculates the battery aging cost. The battery aging depends on some specific factors, i.e., the number of cycles, internal resistance, and depth of discharge (DoD). Exchange power with the grid is expressed as , while the unit prices’ buying and selling rates and are expressed, respectively. The state of energy (SOE) shows the battery energy state in percentage concerning its total capacity, with J as a weighting factor for the whole operation which is taken as 0.5 here. It is analyzed for 24 hours with one hour time interval. The undetermined variables are grid exchange power, state of charge, and storage output power.

4.2. Power Balance Equation

To reduce the supply and demand gap, a power balance constraint is expressed as

The output power of storage and the grid should be equal to the sum of all powers in the right-hand side, as prosumer load, contracted power and the output power of solar PV , respectively. The positive and negative storage output powers have expressed the discharge and charging of the battery system, respectively.

4.3. Energy Trading

Prosumer can sell its surplus energy to the utility grid, especially in contracted hours. In emergency cases, the grid support mode is also carried out for peak shaving:

Total selling and buying power are presented by the following equations, considering system limitations. In the prosumer market, the large commercial customer also exchanges energy with the utility grid which is allowed about 1 MW:

The export energy mainly depends on the distributed generation utilization scheduling. As the solar PV irradiance gets in a normal pattern, extra energy is stored in the batteries. The lithium-ion batteries are utilized due to its competitive features. As the length of complete transmission lines is short, so considering only active power and neglected the line losses.

4.4. Constraints of Battery Storage

Energy storage has some upper and lower bounds for smooth operation. As the life of the battery depends on many factors as discussed earlier, its output power also is controlled by the following constraints (6) and (7):

The capacity of storage system is given by the manufacturer. Three modes of batteries are usually observed: charging state, discharging state, and standby position:

The current state of energy is determined by equation (7), while the starting and ending of operation are controlled using equation (8) for next-day energy participation:

In a one-time step, a specific amount of power can deliver and emit in the form of energy for the storage, which is expressed in equation (9) as a gradient of power:

The national grid has some specific values for energy exchange given in (10). The storage upper and lower bound is represented in equation (11). To model the uncertainty of solar PV and loads, the following sections present the probability distribution functions.

4.5. Probabilistic Load and Solar PV Modelling

The load of the campus is varying variable and change with time. In order to model the uncertainty of load, the normal distribution is used:where is the active power and and are mean and standard deviation concerning [23]:

Distributed generation such as solar PV is highly intermittent. Aside from its numerous advantages, the distribution function is used to model the uncertainty in solar irradiance. The beta distribution, as presented in equation (16), is the function of solar irradiance uncertainty. To generate the scenarios based on historical data, Latin hypercube sampling technique [74] is used. The generated samples are 545 which are reduced to about ten by fast forward reduction method [75], where are parameters for the beta distribution function. These parameters are determined by the following expressions (17) and (19). The mean and standard deviation are and , respectively, which are used to calculate parameters of the beta distribution function of the random variable irradiance “.

The output power of solar PV is calculated using the following expression [76]:where is the efficiency of installed solar PV panels, is the covered rooftop area (m2) of solar PV panels, and is the irradiance of solar (kW/m2), respectively.

4.6. Demand Response Constraints

Demand response is the branch of energy management which optimally reduces the peak load demand by involving the customers in the electricity market. For the system reliability, it is necessary to operate the system.

4.7. Real-Time Pricing

In real-time pricing, the retail prices of electricity vary during the day and effect on the customer consumption cost. In our study, 0%, 10%, and 20% DR are analyzed using the optimal load curtailment, considering the following constraint:

4.8. Time of Use Pricing

The time of use model is expressed in (18)–(21):where and are the energy demand and the pricing, respectively, in the peak and off-peak time.

5. Methodology

The proposed system is a single nonlinear objective, with linear constraints. As the mathematical differential technique, it generates an exact solution with some other features, so quadratic programming is used to solve the model. The general expression of QP is given in the following equation:

Solver interior-point convex technique is used in MATLAB to solve the proposed system. In Section 6, the obtained results are presented.

The interior-point convex algorithm of linear programming is used in MATLAB R2018a environment on Dell Latitude System with i5 4670 processor @3.4 GHz and 4 GB RAM.

6. Results

Optimal scheduling of reserves is analyzed to utilize the dispatchable and nondispatchable energy resources. A load of the campus is taken from nearby grid station and a model is proposed as presented above.

Demand response programs such as incentive and price based are analyzed. The exponential increasing energy consumption cost of the existing campus is shown in Figure 5. The case study has been carried out to separately investigate the time of use (TOU) and real-time pricing (RTP). The exchange energy with the grid is based on the following flowchart steps.

6.1. Case Studies

As described earlier, the grid outage is also the problem of developing countries such as Pakistan. So, it is also considered here with a grid support case. Here, we suppose the energy exchange with the grid at the same unit prices. The basic parameters of the proposed model are given in Table 1.

Two types of pricing are analyzed, as shown in Figure 6: time of use (TOU) and real-time pricing [77]. AC loads are attached and are composed of air conditions, lighting, fans, and PCs, as shown in Figure 7, whereas solar PV output power is expressed in Figure 8. Furthermore, loads are divided into critical and noncritical loads. The critical loads cannot curtail and must run loads [78].

Figure 9 shows the flowchart of the proposed strategy.

6.1.1. Case 01 A (Real-Time Pricing Analysis/with 0% DR)

Case 1(a) (grid available mode (existing system)): in this case, the campus has only one energy source to supply the energy and operate all its loads. The total operational cost of this case is $2422.2 which will be considered as the base case.

Case 1(b) (operational cost without scheduling): In this case, DG solar PV and ESS are utilized without any schedule. The result obtained is $1349.9. The installation and replacement cost is not included in this case.

Case 1(c) (cost after grid outage for two hours): in this case, the scheduled outage of the grid is analyzed as shown in Figure 10. The operational one-day cost is $1354.3. The predefined outage is compensated through BESS and solar PV, as a time of outage is 10 to 11 AM. The solar PV is available and can run the whole system smoothly at critical peak pricing [79].

Case 1(d) (grid support in emergency case): in this case, the consumer received a signal from the grid to support the grid. So, the consumer acts as energy importer to the grid through an aggregator. The operational cost, in this case, is $1332.4.

Case 1(e) (proposed scheduling mode): in this case, available resources are utilized optimally through price-based scheduling. The contracted neighbour of prosumer power is also supplied at 15:00 to 16:00 PM for two hours, as shown in Figure 11. The total cost reduced about 65.3% compared to the base case is expressed in Table 2.

6.1.2. Case 1. B: With Load Curtailment (10% DR)

Case 1(f) grid available mode (existing system): in this case, the campus has only one energy source to supply the energy and operate all its loads. The total operational cost of this case is $2422.2 which will be considered as the base case.

Case 1(g) (operational cost without scheduling): in this case, DG solar PV and ESS are utilized without any schedule. The result obtained is $1349.9. The installation and replacement cost is not included in this case.

Case 1(h) (cost after grid outage for two hours): in this case, the scheduled outage of the grid is analyzed, as shown in Figure 12. The operational one-day cost is $1354.3. The predefined outage is compensated trough BESS and solar PV, as a time of outage is 10 to 11 AM. The solar PV is available and can run the whole system smoothly.

Case 1(i) (grid support in emergency case): in this case, the consumer received a signal from the grid to support the grid. So, the consumer acts as the energy importer to the grid through an aggregator. The operational cost, in this case, is $1332.4, as shown in Figure 13.

Case 1(j) (proposed scheduling mode): in this case, available resources are utilized optimally through price-based scheduling. The contracted neighbour of prosumer power is also supplied at 15:00 to 16:00 PM for two hours, as shown in Figure 14. The total cost reduced about 65.3% as compared to the base case as expressed in Table 2.

6.1.3. Case 1. C: With Load Curtailment (20% DR)

Case 1(k) (grid only mode with DR): this case is the combination of incentive and price-based demand response, with 20% load curtailment during the high-cost hours.

In the base case, the only grid is available as an energy source and witnessed a result of $2290.5. The difference between the above Case 1(a) is significant and reduced from 2442.6 to 2290.5 which is 6%.

Case 1(l) (total cost without scheduling with DR): in this case, the total operational cost is reduced to 1217.8 as solar PV and ESS are incorporated. The output power of solar PV and ESS utilized randomly without considering any constraints’ schedule.

Case 1(m and n) (grid outage and grid support with DR): both cases have similar situations, as described in Case 1(c and d), besides its reduced cost. In grid support mode, cost is reduced from $1332 to $809.2. In this case, the storage output power supports the grid from 10:00 to 11:00 for two hours. The state of energy shifts in the discharging mode until the request is complete. In grid outage, that is, due to the energy shortfall, scheduled grid outage occurs at the same time any day from 10:00 to 11:00, as shown in Figure 15. The cost is reduced from $1354.3 to $1137.5, due to load curtailment during these hours.

Case 1(o) (proposed scheduling with DR): in this case, the scheduler considered the available resources and loads and generated a controlled signal for optimal operation. In this case, significant cost is reduced from $2290.5 to $809.29, which is about 64% as compared to the base case. Similarly, the whole process with defined parameters is presented in Table 2.

6.1.4. Case 02: Time of Use- (TOU-) Based Analysis without Demand Response

Case 2(a) (grid only (base case)): in this case, as discussed earlier in Case 1, the grid is an available source of energy. So, operational cost is calculated $1648.9, which is an existing system.

Case 2(b) (without scheduling): in this case, solar PV and storage are available for backup. The solar PV output power is utilized for self-consumption that reduced the energy consumption cost from $1648.9 to $1325.7. The charging-discharging of energy storage is randomly utilized and free from any bound. So, it is economical but needs proper usage for optimal operation, while Figure 16 shows the real-time pricing.

Case 2(c) (grid outage without DR): the scheduled grid outage hours are from 10:00 to 11:00 for two hours and PV-storage compensates the loss of grid. So, the cost is reduced as compared to the above two subcases and is found to be $1301.9.

Case 2(d) (grid support case): in this case, prosumer receives emergency signals from the grid for support due to peak hours, contract, or some incident. The cost is calculated after the fulfilment of grid requirement is about $1180.5, as shown in Figure 17.

Case 2(e) (proposed scheduling): in this case, cost reduced from $1325.7 to $990.6 which is about 39%, as shown in Figure 18. All parameters are representing in the graph using different colours. As the load changes, PV-storage operates accordingly considering the time of use prices and contracted power.

Case 2(f) (grid only (base case)): in this case, load curtails according to the peak hours and the load is shifted into off-peak hours. The cost is reduced from $1648.9 to $1620.2.

Case 2(g) (energy reserve utilization without scheduling): in this case, PV-storage is utilized with scheduling with the grid-connected mode. The cost is calculated as $1297, as compared to without load curtail in previous case 2(b) which was high about 2%. This shows the benefits of load curtailment for economical operation.

Case 2(h) (grid outage with DR): a scheduled grid outage is considered in this case and the result after analyzing the system is found. The grid outage in our case is from 11:00 to 12:00 for two hours. The obtained result is $1070 considering the 20% load curtailment scenarios, as shown in Figure 16.

Case 2(i) (grid support mode): in this case, the whole scenario will be like case 2(d), but, considering the load curtailment, the total cost is found to be about $961.59 which is 18% less than the case of 0% incentive-based demand response (IBDR). The detailed features of this case are presented in Figure 19.

Case 2(j) (proposed scheduling): in this case, all parameters are scheduled through a microgrid-proposed scheduler that optimally utilizes the energy reserves. The contracted power shows from 15:00 to 16:00 for two hours.

The state of charge and storage output power is expressed in black and hollow square symbols. When the prices are high, the storage power retains itself to more charging. Figure 20 shows the optimal scheduling of all parameters in time of use demand response environment. Table 3 presents all the results of TOU price-based demand response.

7. Discussion

Form the above analysis, it is deduced that both price-based and incentive-based demand response strategies are beneficial for the customer in the electricity market. The analysis is carried out for the Pakistani environment, which is a developing country. The renewable integration with the existing grid by optimal scheduling of the available resources is analyzed and a significant reduction in scheduled utilization is found. So, a microgrid scheduler is necessary for smooth and economical operation. Furthermore, the obtained results show that the RTP reduction is more as compared to TOU strategy.

8. Conclusion

Optimal scheduling of DGs and ESS are addressed in the literature; however, the storage degradation cost and some system constraints are missed. In this paper, we investigated the campus microgrid energy management system with real-time local problems such as grid outage, grid support, and demand response strategies. As the storage system is highly nonlinear in nature, a nonlinear model is solved using quadratic programming. Two price-based cases, TOU and RTP, are analyzed in incentive-/nonincentive-based environment which were not addressed earlier. The prosumer-based market model is presented and contracted with the utility and neighbour customer. Results reveal that operation cost and peak load reduced to serve both customer and utility.


:Grid power at time t
:Storage power at time t
:Energy demand of the prosumer
:Contracted power
:Output power of solar PV
:State of charge at time t
:Battery energy capacity
CHP:Combined heat and power
RERs:Renewable energy resources
DG:Distributed generation
ESS:Energy storage system
MILP:Mixed integer linear programming
DR:Demand response
DS:Distribution system
EMS:Energy management system
DSM:Demand-side management.

Data Availability

The load grid data used to support the findings of this study are available from the corresponding author upon request.

Conflicts of Interest

The authors declare that they have no conflicts of interest.


The authors are grateful to Aamir Raza Naqvi for his valuable suggestions and revision to complete this work. The authors are also grateful to U.E.T., Taxila, Pakistan, for providing a conducive environment for the completion of this research work. The authors are also thankful to the management of Taxila substation for data providing. This work was partially supported by the National Natural Science Foundation of China under contract no. 71761030 and Natural Science Foundation of Inner Mongolia under contract no. 2019LH07003.