Open access peer-reviewed chapter

Energy Management and Optimal Power Scheduling in a Smart Building under Uncertainty

Written By

Dimitrios Thomas and Evangelos Kotsakis

Submitted: 13 June 2020 Reviewed: 11 November 2020 Published: 17 December 2020

DOI: 10.5772/intechopen.94989

From the Edited Volume

Smart Cities - Their Framework and Applications

Edited by Anuar Mohamed Kassim and Lutfi Al-Sharif

Chapter metrics overview

508 Chapter Downloads

View Full Metrics


In this Chapter, we consider a microgrid with a certain number of distributed energy resources (DER) components connected to an office building (in a university campus) provided with electricity by a utility company. We develop the initial version of the energy management system which is responsible for the optimal energy scheduling of the microgrid’s distributed energy resources. These resources include a photovoltaic (PV) installation, a Storage Energy System (ESS), a small Combined Heat and Power (CHP) unit, and a fleet of electric vehicles (EVs) used for work-related trips. The mobility behavior of the EVs fleet is modeled considering deterministic realizations of the probabilistic distributions used for the arrival/departure, and the time EVs remain parked. To investigate the impact of renewable generation and load unpredictability on the energy management system (EMS) operation, PV production and electric load are modeled under uncertainty using actual smart meters data for the scenarios formulation. We also assume that each DER component, through an EMS, can communicate and control the power exchange from and towards this component and that, two way communication with the utility company can be reached through aggregators using advanced metering equipment. We also consider a simplified thermal model that provides a specific level of thermal comfort to the building’s occupants, by meeting the predicted heating load. The energy produced by the DERs can be sold back to the grid by the microgrid manager and/or it can be stored for future utilization.


  • energy management system
  • smart grid
  • electric vehicles
  • distributed energy resources
  • optimization

1. Introduction

Buildings have become the major energy consumers over the world as they consume around 40% of total end-use energy [1]. In Europe, the Directive on Energy Performance of Buildings establishes a “nearly Net Zero Energy buildings” (NZEBs) as the aim for all new buildings from 2020 [2]. In recent literature, more and more studies consider nZEBs as part of a smart grid or a micro-grid (MG) and identify trends on energy management techniques and technological solutions for electric power system management. The main advantages of nZEBs have been identified to be the integration of renewable energy sources; the integration of energy storage mechanisms such as plug-in electric vehicles and the implementation of zero-energy concepts such as net zero source energy, net zero energy costs and net zero emissions.

The renewable energy exploitation is one of the most important aspects of NZEBs. Renewable Energy Sources (RES) are those sources of energy that can be derived from natural processes and thus can be replenished continuously such as solar energy, wind energy, biomass, hydropower etc. The wind and solar energies are mostly used in green buildings modeling and design [3] but they come with a number of issues that have to be taken into consideration. The wind energy systems may not be technically feasible at all sites due to the low wind speeds and/or to high unpredictability with respect to solar energy. In addition, the availability of a specific resource depends each time on the corresponding season and may also vary during the day [4]. NZEBs, either as standalone or as parts of a Net Zero Energy District, could help improving the energy performance of an electrical grid by shifting loads and reducing peak demands. Buildings, as one of the most important contributors involved in a smart grid, can deliver useful information such as energy behaviors, power demand and the corresponding load shifting potentials for grid control and optimization [5].

A microgrid is an electric system of limited extent, typically the suburban/district level, that includes distributed generation (i.e., solar, wind, cogeneration, electric vehicles, etc.), consumers and storage facilities, and operates by intelligently managing its own costs and production capacity to ensure a level of quality service. It is connected to the global grid but is designed to operate independently if necessary (islanded mode). Microgrid can be understood as a case of a more general concept called ‘Smart grid’, collecting a set of technological solutions for electric power system management. Its localized nature allows responding efficiently and accurately the energy needs and ensuring adequate levels of quality, safety, security, reliability, and availability. It is able of being disconnected from the global network for several hours without loss of service while ensuring voltage and frequency stability. In addition, the proximity of the sources of production to the consumption allows reducing energy transmission losses. Thus, the use of such a system (mainly decentralized) has as an aim to gain flexibility and adaptability with respect to the classical centralized power system model.

The development and the extensive utilization of building automation systems, Information and Communication Technologies (ICT) and grid energy management system facilitates the bidirectional communication between buildings and a grid which can be widely established and therefore be used for interacting and optimizing the power supply and the demand. This chapter attempts to address the major issues that are related to the design and optimization of grid-connected nearly and/or net zero energy buildings as parts of a smart grid and on which several scholars/researchers have been working the last years.

In this work, a microgrid with a certain number of DER components connected to an office building (in a university campus) provided with electricity by a utility company is considered. These components include a PV installation, a Storage Energy System (ESS), a small Combined Heat and Power (CHP) unit, and a fleet of electric vehicles (EVs) used for work-related trips. The mobility behavior of the EVs fleet is modeled considering deterministic realizations of the probabilistic distributions used for the arrival/departure and the time EVs remain parked. PV production and electric load are modeled under uncertainty. We use actual data from smart meters to formulate the scenarios. We also assume that each DER element can, through an EMS controller, to communicate and control the power exchange from and towards this component. We also consider that two-way communication with the utility company can be achieved via aggregators using advanced metering infrastructure. The energy generated by the DERs can be sold to the grid by the microgrid building-manager, and/or it can be stored for future utilization. The recommended EMS configuration is shown in Figure 1.

Figure 1.

Energy management and system configuration.


2. Methods and scenario construction

2.1 Photovoltaic and electric load scenarios

To classify PV and electric load production, yearly data-measurements from smart meters installed in Walloon region, Belgium, have been used. The smart meters communicate with the utility company server every 15-min providing the updated PV and load measurements. The 15-min datasets were merged to formulate 8760 hourly readings (365 24-hour PV generation and load profiles). The total PV capacity is 50 kVA. The original datasets are shown in Figure 2.

Figure 2.

The 365 original profiles for (a) PV production, and (b) electric load demand.

We use the scenario reduction technique introduced in [6] to construct the scenarios. A script developed in Matlab based on [6] is utilized to aggregate the two sources of uncertainty into one. That is, a discrete probability has been assigned to each one of the generated scenarios. Every scenario comprises two 24-hour vectors where each vector corresponds to a specific profile (one vector for PV production and one for load demand). Moreover, this scenario construction technique considers the potential correlation within the data. The latter is very important as, for example, a sunny day with increased PV production is expected to affect the load demand downwards and vice-versa. Moreover, one may notice that the PV profiles of Figure 2a look asymmetric and seem to have been shifted towards the left side of the time axis. This is due to the minimum cut-in voltage level required from the power electronics of the inverter to start being operational.

It is important that the final number of generated scenarios retain most of the relevant information on the stochastic process contained in the original scenario sets, while significantly reducing its cardinality. A very large number of scenarios may result in a computationally intractable associated stochastic programming problem which would require both increased time and computational resources to be solved. On the other hand, a small number of scenarios might not be representative of the original data sets. Thus, in order to decide the appropriate number of scenarios we take into consideration the total expected system cost (TESC), its standard deviation (SD), and the total computational time, as shown in Table 1. Simulations take place on an Intel Core i7-5500U CPU @ 2.4 GHz with 16 GB memory.

Numb of scenarios6 scen.12 scen.24 scen.48 scen.
TESC ($)26.0620.0716.6815.64
SD ($)23.2224.3324.3524.45
Elapsed time (s)

Table 1.

Parameters related with the number of scenarios.

We can see in Table 1 that the TESC decreases considerably from the 6 to 12 scenarios, and from 12 to 24. On the other hand, the cost reduction from the 24 to 48 scenarios is smaller. The standard deviation of the TESC increases somehow from the 6 to 12 scenarios, but it remains relatively constant in the rest scenario cases. Finally, one may notice that the computational time needed to obtain the optimal solution is increased around 100% in both cases, from the 12 to 24 and from 24 to 48 scenarios. Considering all the information above, the case of 24 scenarios provides a favorable trade-off between a satisfactory scenario representation and a computationally tractable problem. One should also note that the constructed scenarios are not equiprobable, but probability weighted. The 24 scenarios for PV generation and load demand are illustrated in Figure 3.

Figure 3.

The 24 representative scenarios for (a) PV production, and (b) electric load demand.

For the deterministic approach, we used the average yearly profiles (obtained from the original datasets in Figure 2) for both PV production and the electric load demand. These profiles are illustrated in Figure 4.

Figure 4.

The average yearly profiles for (a) PV production, and (b) electric load demand.

2.2 EVs driving schedule

When connected to the microgrid, the charging and discharging behaviors of the EVs make them considered as either power supplies (when discharging) or power loads (when charging). Here, the EVs selected for the fleet are used for work-related trips and it is also assumed that the mobility behavior with the EVs remains similar as with conventional vehicles.

In this work, the mobility behavior profiles for a fleet of 30 EVs are generated. In Belgium, 82% of the population has fixed working hours and shifts [7]. Usual working hours are considered from 8 am to 6 pm but they are not binding. The arrival time distribution is fitted in the form of chi-square distribution [8] with its probability density function given by: ftarr,i=tarr,iυ2/2\etarr,i/22υ/2Γυ/2 where Γ· is defined as Γa=0ta1e1dt,a>0 with υ=4 degrees of freedom [9], and tarr,i is the arrival time for the i-th EV. The detention time of the EVs connected to the microgrid conforms to the normal distribution with a mean of 8 hours and a variance equal to 4 hours N822 assuming that the working time of most people is 8 hours. The initial state-of-energy of the EVs is decided by applying the uniform distribution with values between 0.3 and 0.8. One should also note that for the numerical evaluation in the Results section, we used deterministic realizations of all the uncertain characteristics of the EVs (arrival, stay duration, initial state-of-energy).

2.3 Simplified thermal model

To simulate the thermal performance of a building, engineers developed, among other tools, the thermal network method. Thermal networks have been used to study the internal mass effects [10], appliances, indoor air temperature and heating load [11] for different buildings. In addition, they represent a comprehensible idea about the heat transfer phenomena in buildings with a simple systematic formulation of the problem. In the thermal network method, the whole mass of the system is accumulated in finite number of nodes, which are connected to thermal capacitances. The heat transfer between two nodes occurs through thermal resistances. It has been shown, that the functionality of control systems can be improved by the implementation of the thermal network method and the system identification approach [12].

System identification is an approach to construct mathematical models of dynamic systems by means of measurements of the system’s input and output signals. The system identification needs the measured input and output signals from the system, a model structure, and an estimation method to estimate values for the adjustable parameters in the selected model structure. In a dynamic system, the output signal depends on both the instantaneous values of its input signals and on the initial conditions. In fact, a model is a mathematical relationship between a system’s input and output variables. Differential or difference equations, transfer functions, and state-space equations are common methods to describe a dynamic system. The RC model method describes the system with ordinary differential equations that can be easily represented with the state space method.

Obtaining a good model of the system depends on how well the measured data reflects the behavior of the system. For this purpose, the measured data must capture the dynamics of the system. It is necessary to measure the right variables with enough accuracy and duration to capture the dynamics of interest. In general, to supply an appropriate dataset, the following inputs that excite the system dynamics are important: data duration to capture the important time constants, a detailed analysis of signal-to-noise ratio, and finally measuring the outputs at appropriate sampling intervals [13].

The use of the RC model method provides the structure of the model, but not the numerical values of its parameters. Afterwards, it is possible to represent the system with a state-space model and estimate the values of its parameters from the data. This approach is known as gray-box modeling. The system identification approach refers to methods and algorithms that estimate the model parameters by minimizing the error function (cost function -- the mean square error), as shown below between the model output and the measured data.


where L is the number of data samples, eθtis a given error vector at time t and parametrized with θ. Then, parameters are obtainable with minimizing Vθ with respect to the parameter vector θ. After the model is estimated, quality metrics represent the quality of identified models.


The MATLAB® system identification toolbox is used in this work to minimize the cost function of Eq. 2 and to estimate the model parameters. MATLAB uses various minimization algorithms to perform the optimization. In our case, the ‘auto’ algorithm is used for the search method to minimize the cost function and to estimate model parameters, as it determines the optimized trajectory among different techniques at each iteration.

The simplified thermal model presented in [14] is used in this study to obtain the thermal load for the university building. The building is simulated using TRNSYS software utilizing weather data from the Uccle meteonorm file (Belgium). It has a heavy structured envelope and the buildings material properties are presented in [14]. Here a 4R2C model is proposed and used to simulate the thermal performance of the building. The corresponding proposed thermal network is represented in Figure 5.

Figure 5.

The proposed thermal network.

To determine the parameters in the thermal network, the system identification approach has been used. Data from TRNSYS have been used as the information matrix for the model to be trained. To identify the model’s parameters, the Matlab system identification toolbox is utilized. The information matrix contains one-month data. The model identification determines the values of each resistance and capacitance to achieve the highest fitness between the thermal network and the information matrix. Then, the identified model can predict the thermal performance of the building for a predetermined period of days.

To formulate a daily thermal load profile, so as it can be used by the EMS for its 24-hours scheduling horizon, the average heating load of the predicted working days is calculated. The calculated thermal load offers a temperature approximately around 22°C during working hours (from 9 am to 6 pm). The daily thermal load prediction is illustrated in Figure 6.

Figure 6.

Daily thermal load prediction.

The thermal load is low during the night and the early morning hours and starts increasing around 8 am. This is necessary, so as the targeted thermal comfort level to be achieved in the office building during the working hours. The thermal load is covered by CHP’s thermal production.


3. Mathematical formulation

The mathematical formulation of the EMS is presented in this Section. The objective function which minimizes the total expected system cost is given by Eq. (3) below:


where Ξ is the set that contains all the decision variables of the problem. The time horizon is 24 hours. One should notice that since the considered time step is one hour, power and energy values coincide. This is a mixed integer linear optimization problem (MILP).

The expected cost function (3) is a probability-weighted mean of all the scenarios considered. It minimizes the power requested from the grid pt,ωgrid,in at price εtbuy and the total power pt,ωCHP,tot for the CHP at a gas price equal to εgas. On the other hand, it maximizes the energy sold back to the grid pt,ωgrid,out at price εtsell, by those microgrid components that are able to generate energy (PV, ESS, EVs, and CHP). Parameter πω expresses the discrete probability assigned to each scenario ω. The second term and the third term of Eq. (3) are penalty factors. Specifically, the second term applies a small cost CEV,deg, every time an EV charges pi,t,ωEV,ch or discharges pi,t,ωEV,dis. This is to ensure that no unnecessary EV charges/discharges take place and to prevent EVs’ battery degradation. The penalty is normalized for every kWh of battery charging/discharging and it does not depend on how frequently the EVs charge or discharge.

Finally, the third term of Eq. (3) introduces a prioritization mechanism in the form of a penalty factor. Parameters λPV,λESS,λCHP, and λEV obtain excessively small positive values, so that the total cost function is not affected. The values of these parameters work as an artificial penalty and are determined by assumptions depending on which source is preferred by the EMS to give priority to selling the energy back to the grid. The smaller the relative value of parameter λ for a specific resource, the higher the priority in the EMS to sell the available energy from this resource first.

3.1 PV modeling

Eq. (4) enables the actual power generated by the PV to be utilized in three different directions. A portion can be sold directly to the grid pt,ωPV,grid, another portion can be used to cover the building’s load needs pt,ωPV,build, and the third option allows PV energy to be stored into the ESS pt,ωPV,stored and used at a later time frame. The sum of all the PV power variables must be less than or equal to the PV generation Pt,ωPV,gen at every time step t and scenario ω.


3.2 ESS modeling

The ESS operation is characterized by Eq. (5)–(10). The actual power provided by the ESS when discharges can be either sold back to the grid pt,ωESS,grid or used to cover a portion of the building load demand pt,ωESS,build. as shown in Eq. (5). Eqs. (6) and (7) establish the limitations for the charging pt,ωESS,ch and discharging pt,ωESS,dis power of the ESS with the assistance of binary variable ξt,ωESS. Constraint (8) ensures that the total power towards the ESS does not violate its maximum charging rate. The state-of-energy (soe) for the ESS is expressed by Eq. (9) and Eq. (10), while Eq. (11) sets the minimum and the maximum allowed limits for the ESS soe to prevent a deep discharge of the battery.


3.3 EVs modeling

The EVs operation is described in Eq. (12)–(18). Eq. (12) ensures that the discharge power of the EVs is either injected back to the grid pi,t,ωEV,grid and/or used to cover a part of the building load demand pi,t,ωEV,build. Constraints (13) and (14) set a limit on the charging pi,t,ωEV,ch and discharging power pi,t,ωEV,dis of the EVs with the assistance of the binary variable ξi,t,ωEV. For each EV i in every scenario ω, the available state can be charging, discharging, or remaining in idle state. Eqs. (15)(18) refer to the state-of-energy of the EVs. More specifically, Eq. (15) defines the state-of-energy of the EVs for initial conditions, while Eq. (16) describes the state-of-energy of each EV for the rest time steps. In Eq. (16), the state-of-energy of the current time interval for an EV is equal to the previous state plus the energy deriving from charging the EV battery (if charging) minus the energy that is subtracted if the EV battery is discharging. The nominal capacity of an EV’s battery is 24 kWh (Nissan Leaf) and the rated charging power of an individual charger deployed in the parking lots is 7.68 kW (SAE-J1772, level 2, 208–240 VAC) with a charging and discharging efficiency of 90% [15]. To avoid EVs’ batteries over-charge and over-discharge, Eq. (17) limits the batteries’ lowest state-of-energy at 20% of the EVs nominal capacity. Finally, constraint Eq. (18) sets the minimum state-of-energy for each EV upon its departure time.


3.4 CHP modeling

The utilization of small-sized CHP turbines is typical for covering thermal load demand and has been often proposed in literature as a distributed energy resource [16]. The equations that describe the operation of the CHP microturbine are presented in Eqs. (19)(24) below.


Constraint (19) states that the total power pt,ωCHP,tot generated by the CHP consists of its electrical pt,ωCHP,el, and its thermal pt,ωCHP,th production. Eqs. (20) and (21) relate the electrical and thermal production of the CHP with their corresponding efficiencies. Constraint (22) imposes the limits to the CHP’s minimum and maximum operation state. Eq. (23) ensures that the thermal load demand is met at any time by the CHP operation, while Eq. (24) describes the possible directions towards the electrical production of the CHP can be directed. More specifically, Eq. (24) states that a portion of the electric power produced is used to cover the building’s electrical load demand, another portion can be stored to the ESS for later exploitation, while an amount of CHP energy can be directly sold back to the grid. The main criterion based on which the CHP size has been selected, is its ability to fully cover the thermal load of the building during the whole day, including the peak time periods.

3.5 Power constraints

The total power injected to the grid is described in Eq. (25). The total power injected to the grid at time t and for each scenario ω consists of the power provided by the PV, the ESS, the CHP, and the sum of the power derived from EVs discharging and intended for the grid. In this work it is assumed that all the available energy to be injected into the grid can be acquired by the utility serving company at the time it is produced.


The power balance equation is defined in Eq. (26) below.


Constraint (26) forces the balance between the input and the output electric power of the EMS in each time interval. More specifically, it is stated in Eq. (26) that the total load consisting of the office-building electric load demand, the charging needs of the ESS and the sum of the charging needs for the EVs is covered by the power requested from the grid and/or by the combined procurement of power provided by the PV, the ESS, the sum of discharging power of the EVs, and the CHP.

Finally, Eq. (27) and Eq. (28) realize the logic of power exchange.


When the EMS needs to draw power from the grid, power is not allowed to be injected into the grid at the same time, and vice versa. The limitations in power exchange are imposed by parameter L which corresponds to the local line capacity. To avoid the installation of extra power facility infrastructure for the EMS, the potential limits of the university-building dedicated medium-voltage to low-voltage (MV/LV) transformer are used. The apparent power of the transformer is 160 kVA with MV input 10.5 kV and LV output 400 V. Assuming a whole building’s power factor of 0.9, the actual (useful) power that can be drawn from the grid at any time is 144 kW. This constraint can be also time-dependent and be imposed to lower values, for example, by an aggregator responsible for coordinating multiple microgrids owning EMS or by the utility company itself responsible for the smooth operation of electrification in the area.


4. Numerical results and discussion

To examine the effectiveness of the proposed EMS algorithm, the impact of different case studies on total system cost is evaluated. The proposed EMS framework is a mixed integer linear problem modeled in GAMS v.24.7.1 and solved by the IBM CPLEX Optimizer v.12.6. The time required to find the optimal solution varies from a few seconds to several minutes, depending on the model. The optimality gas has been set at 1.0E-04.

The electric load demand and PV scenarios are given in Section 2.1 along with the deterministic day-ahead (DA) forecasts. The thermal load demand prediction is shown in Section 2.3. It should be noted that as the PV generation data came from actual smart metering measurements, no study regarding the positioning and the installation of the PV panels was performed.

The bidirectional energy flows between the utility company and the end-user (the building-microgrid manager in this case) assume the utilization of smart-metering approach. The day-ahead time-varying price signal which represents the electricity cost at each time interval t is depicted in Figure 7. A time-varying rate has also been applied for the energy sold back to the grid. This rate is 20% lower than the aforementioned time-varying price signal, based on the assumption that the utility company would not buy energy at a more expensive rate than it would sell it. In this study, no other incentive-based scheme (e.g., selling green certificates for renewables) apart from the utility company price signal is applied.

Figure 7.

Day-ahead electricity price forecast.

The ESS consists of a battery group with a total capacity of 80 kWh. The maximum charging/discharging rate is 40 kW with corresponding power electronics efficiency of 0.88. The minimum allowed state-of-energy of the ESS has been set to 10 kWh (12.5% of max ESS capacity) to prevent deep battery discharging. The initial state-of-energy of the ESS is 40kWh.

The thermal efficiency ηCHP,th of the CHP microturbine is 0.51 and the electric efficiency ηCHP,el 0.36 resulting in an overall efficiency ηCHP,ovrl of 0.87. The overall efficiency of the CHP is kept constant regardless its load for sake of simplicity. The rated power of the CHP is 150 kW, and to avoid start-up costs, a minimum state of 10 kW has been set for the CHP operation.

As mentioned earlier, a bidirectional energy flow concept for EVs and their potential V2B and V2G capabilities could significantly reshape the current perception of power systems. The first step is their integration into the smart grid (or microgrid). The EVs are equipped with constantly bigger battery capacities increasing thus their potential contribution as DERs. The EVs could either be granted to (University’s or a company’s) personnel for commuting purposes under the form of a third-party contract and/or they could be privately owned. In both cases, it would make sense to assume that the EV users would be willing to allow the building-microgrid operators to use their batteries’ capacity but they would not prefer to have a lower state-of-energy upon departure compared to their arrival. In addition, in the case of self-owned EVs, possible monetary benefits for the EV owners may be needed for motivating them to opt-in the EMS scheme.

In our base case study, the first business model is considered, namely the EVs are provided to the personnel and, in exchange, the EVs’ users have to participate in the EMS framework. It is considered here that the final state-of-energy of the EVs should be at least equal to their initial one. We have also considered λPV<λESS<λCHP<λEV assigning a higher priority to the energy coming from PV to be sold to the grid, afterwards the energy from ESS, then the energy from CHP, and finally the energy from the EVs. The reason that the lowest priority has been assigned to EVs is to have as few charging/discharging cycles for the EVs as possible to prevent battery degradation.

First, we consider the total system cost (TSC), as shown in Table 2.

CaseDescriptionTotal system cost
1No EMS in operation (average of all historical data)59.47
2With EMS in operation (average of all historical data)13.51
3Expected mean of all 24 scenarios16.68
4Most probable scenario of the 24 (prob. 9.3%)58.11

Table 2.

Total system cost across all case [$].

The first case corresponds to an operation of the microgrid without the presence of an EMS and thus, no optimization takes place. That is, the loads cannot be shifted and are always met. In addition, as the EVs should depart at least having the same battery state of energy as the one they had when arrived, charging/discharging of the EVs are not activated. The ESS operation is also omitted, as its charging /discharging cannot be coordinated due to the absence of an EMS. Finally, when there is a net energy consumption at time t, electricity is bought at price εtbuy, while when there is a net supply of energy to the grid, it is sold at price εtsell. The second case corresponds to the minimization of the total system cost for one day of microgrid operation. The annual average values of the PV and electricity load historical data have been considered, among others, as input parameters. The third case minimizes the expected mean cost considering the 24 PV and electricity load probability-weighted scenarios, as these are determined in Section 2.1. A cost distribution for all scenarios considered in case 3 is shown in Figure 8. Finally, the fourth case minimizes the total system cost for the microgrid considering the most probable scenario (scenario 23 out of the 24). It should be noted that all cases apart from case 1 assume the presence of an EMS in microgrid’s operation.

Figure 8.

Total system cost distribution for the 24 scenarios.

The importance of considering an EMS in microgrid’s operation is depicted in the TSC results across all cases, as shown in Table 2. First, the total system cost of case 1, where no EMS is assumed, is 340% higher compared to case 2, where an EMS is present coordinating the microgrid operation (from $13.51 to $59.47). The expected TSC for case 3 is 23% higher compared to case 2 due to the impact of some extreme scenarios on the final result. Moreover, the total cost distribution across all the different scenarios (Figure 8) implies that the final total system payoff for the majority of the scenarios is positive in terms of cost (a positive value declares a cost, while a negative one declares a profit). Finally, one may notice that the TSC for the most probable scenario, as seen in case 4, is much higher compared to the other two cases (case 2 and 3) in which an EMS is also present on microgrid’s operation. The reason is that for this particular scenario, the PV generation and the building load demand are very different compared to the corresponding annual average values, as these are considered for case 2 (Figure 4). More specifically, the projected PV generation in the most probable scenario is much lower than the yearly average, as presented in case 2. On the contrary, the building load demand is higher than the average. Therefore, the results presented in this Section should be interpreted taking this context into account.

To analyze a few more aspects of the optimization results and examine the individual scheduling of each DER, as it is decided by the EMS, we compare the microgrid’s operation under two different case studies: case 2, which from now on will be referred to as simply the deterministic case, and case 4, which will be referred to as the most probable scenario. (Figure 9).

Figure 9.

Most probable scenario for (a) PV production, and (b) electric load demand.

Figure 10 presents the total power requested by the EMS from the grid and injected back to it for the deterministic approach and the most probable scenario.

Figure 10.

Power requested from and injected to the grid for the most probable scenario and the deterministic approach.

There are many observations one might make regarding Figure 10. First, notice that the power requested from the grid is zero during the whole 24-hour time horizon for the deterministic approach. This implies that the microgrid can fully cover its electric load demand using its own distributed energy resources. In addition, it is able to inject a great portion of its produced energy back to the grid. From 1 pm to 4 pm though, the microgrid neither requests nor injects power back to the grid. This means that the produced energy is entirely used to cover the local microgrid load demand.

On the other hand, we can see that during the most probable scenario, the microgrid draws power from the grid from around 9 am to 5 pm which indicates that the microgrid’s distributed energy resources cannot fully cover the load demand during that period. This is mostly due to the limited daily PV production assumed in this scenario in combination with a higher than average electric load demand. In addition, one may notice that the total power injected back to the grid is much lower in the most probable scenario.

To better understand how EMS coordinates the operation of the microgrid’s components, Figure 11 presents the decomposition of the total power injected to the grid for the involved DERs (PV, ESS, CHP, and EVs).

Figure 11.

Decomposition of power injected to the grid for the (a) deterministic approach, and (b) the most probable scenario.

In both the deterministic and the most probable scenario, CHP is the DER that injects most of the power back to the grid. We can see that in the deterministic case PV also contributes, especially during the noon hours. The ESS is more active in the case of the most probable scenario, while one might notice that the EVs are not used at all as a potential source for energy to be injected to the grid. This happens mainly due to the lowest prioritization factor EVs have for selling energy back to the grid as described earlier, but also due to the penalty that has been set to prevent EVs battery degradation. Finally, we can observe that in both the deterministic and the most probable scenario, the EMS tries to inject most of the power back to the grid during the peaks of electricity price (around 7 am and 6 pm as shown in Figure 7) to maximize the reward.

Figure 12 shows the decomposition of the projected PV generation for the deterministic approach and the most probable scenario.

Figure 12.

Decomposition of PV production for the (a) deterministic approach, and (b) the most probable scenario.

In the deterministic case study, PV production is mostly sold to the grid (early and noon hours) or stored in the ESS for future exploitation (afternoon hours). Only a small portion at 1 pm is used to cover the building’s load demand. On the contrary, in the most probable scenario, all the produced PV energy is used to meet the building’s load demand.

Figure 13 shows how the electric power produced by the CHP is divided among the grid, the ESS, and the local building load. Like the PV, most of the CHP electric production in the most probable scenario is used to cover the building’s load. Moreover, we can see that the EMS tries to inject most of the CHP’s produced energy back to the grid, during the electricity price peak hours. Finally, in both cases a smaller amount of the CHP’s produced energy is stored in the ESS for future implementation. The thermal load demand parameter Ptbuild,th is not an uncertainty-related parameter and thus, remains the same in each scenario. The thermal load demand is met by variable pt,ωCHP,th, as stated in Eq. (23).

Figure 13.

Decomposition of CHP electric produced power for the (a) deterministic approach, and (b) the most probable scenario.

Storage is an important distributed energy resource for the system. As stated in Eqs. (9)-(10), the ESS can either be charged from the grid, the PV, and the CHP. When discharging, its energy can be either injected into the grid and/or cover a portion in building’s load demand. Figure 14 shows the decomposition of the ESS available energy for the deterministic approach, as well as for the most probable scenario.

Figure 14.

Decomposition of ESS provided power for the (a) deterministic approach, and (b) the most probable scenario.

Figure 14 can be better analyzed taking into account Figure 15, which demonstrates the evolution of the ESS state of energy for the two aforementioned case studies.

Figure 15.

State of energy for the ESS for the (a) deterministic approach, and (b) the most probable scenario.

We can see that in both deterministic and most probable scenario cases, the ESS is mainly active during two distinct period of times, in the morning (between 7 am and 8 am), and in the afternoon (between 5 pm and 7 pm). There are two main observations one may make regarding the ESS operation. First, the ESS uses two discharge cycles in the deterministic approach, while it only discharges once in the most probable scenario. The relatively high PV generation considered in the deterministic scenario is responsible for this second cycle of charge/discharge. Looking at Figure 12, we notice that PV production during the afternoon hours is mostly directed to the ESS. Second, the ESS covers mainly the building’s load demand in the deterministic case, while in the most probable scenario the ESS injects most of its energy back to the grid.

EVs constitute the third available DER in the microgrid but contrary to the rest DERs (PV, ESS, and CHP), they are not actively involved in microgrid’s energy exchange. The EVs battery degradation cost on the one hand, and the lowest energy prioritization factor that has been assigned to them on the other hand, do not make the an attractive alternative power source for the EMS (in terms of cost). Nevertheless, the EVs can always be used as a back-up ancillary power source in case of an emergency situation.


5. Sensitivity analysis

Sensitivity analysis is used to study the robustness of the solution to a linear programming model. If there is cause for concern regarding the accuracy of the data used, sensitivity analysis is undertaken to determine the way the solution might change if the data were different. When the solution does not change (or when the nature of the solution does not change, as when the basis remains optimal), one may assume that the proposed solution is appropriate.

Dual variables, also known as shadow prices, are of great interest in the solution of a linear optimization problem. A dual variable is reported for each constraint. The dual variable is only positive when a constraint is binding. The dual price can be defined as “the improvement in the objective function value if the constraint is relaxed by one unit”. In the case of a less-than-or-equal constraint, such as a resource constraint, the dual variable gives the value of having one more unit of the resource represented by that constraint. In the case of a greater-than-or-equal constraint, such as a minimum production level constraint, the dual variable gives the cost of meeting the last unit of the minimum production target. The units of the dual prices are the units of the objective function divided by the units of the constraint. To obtain the values of the dual variables, we first solve the MILP to find the optimal allocation. Next, we remove the integrality constraints and insert equality constraints that force the integer variables to assume their optimal values in the resulting linear program [17].

The following example presents how the dual variable of a constraint can be used for the sensitivity analysis. Figure 16 shows the dual prices of constraint Eq. (4) for the 24 hours of the daily time horizon. One should recall that this is a resource constraint, and specifically it bounds the actual power generated by the PV to be less-than-or-equal-to the maximum PV generation, as this is defined by parameter PtPV,gen. Also note that this example refers to the EMS operation of case 2, as presented in Table 2.

Figure 16.

Value of sensitivity factor: Dual variable corresponding to the upper bound of constraint (4) [$/kWh].

This value implies the sensitivity of the system cost with respect to the actual PV power utilized by the system. Note that the positive value for this dual variable means that the total system cost decreases with the additional availability of PV power. More specifically, it indicates the decrease in the total system cost that corresponds to the increase of the available PV generation by 1 kWh. The fact that the value of the dual variable is positive during the whole day implies that additional PV potential has always positive impact on the total system cost, regardless the time of the day. However, one might also notice that there some time periods (7 am, from 5 pm to 9 pm), where the extra PV power would be more beneficial for the system compared to the rest time periods. In a similar way, one could evaluate the impact of the relaxation of the rest important resources to the total system cost.


6. Conclusion and future work

The transition to the new “smart” era requires the utilization of smart technology through comprehensive and efficient energy management functions. We propose in this study, a two-way communication energy management framework for a microgrid in a university campus including local renewable energy sources, a storage system, a combined heat and power small turbine, and a fleet of EVs used for work-related trips. Two-way energy exchange is allowed using net metering technology. The developed MILP framework incorporates an optimizer which decides the power exchange among the DER components of the microgrid and the grid, exploiting the V2B and V2G capabilities of the distributed energy resources. It also provides a specific level of thermal comfort to the building’s occupants by meeting the predicted heating load. The formulation of an EMS model which takes into account the PV and load variability is very important if we want to consider the impact of planning for one scenario, and having another scenario occurs. To overcome this challenge, actual smart metering data for a period of one year have been used to construct a number of potential scenarios. The PV and load demand data are classified using a scenario construction technique, leading to the formulation of 24 different PV and electric load scenarios, each one represented by a designated probability. The importance of considering an EMS in microgrid’s operation is depicted in the total system cost across all cases. Results confirm that the EMS substantially decreases the total system cost by optimally coordinating and scheduling the microgrid operation. An additional significant remark is that the majority of the total daily system’s cost is due to the natural gas expenses required for the operation of the CHP microturbine. Finally, we compare the optimal scheduling of the microgrid’s DERs under the deterministic case and the most probable scenario. The most probable scenario assumes a lower PV production and a higher building electric load demand than the average values considered in the deterministic case, resulting in a substantially different energy scheduling for the DERs. It is worth noting that under the deterministic approach and the current design, the microgrid seems to be self-sufficient in terms of covering its energy demand. However, this is not the case under the most probable scenario approach, where the microgrid relies also on grid energy to meet its load demand, on top of the energy production of its own DERs. Suggestions for future work include the introduction of additional stochasticity parameters (e.g., electricity price) and the integration of power flow constraints into the optimization problem.


  1. 1. D. Kolokotsa, D. Rovas, E. Kosmatopoulos, and K. Kalaitzakis, “A roadmap towards intelligent net zero- and positive-energy buildings,” Solar Energy, vol. 85, no. 12, pp. 3067–3084, 2011, doi: 10.1016/j.solener.2010.09.001.
  2. 2. Y. Lu, S. Wang, Y. Zhao, and C. Yan, “Renewable energy system optimization of low/zero energy buildings using single-objective and multi-objective optimization methods,” Energy and Buildings, vol. 89, pp. 61–75, 2015, doi: 10.1016/j.enbuild.2014.12.032.
  3. 3. C. Xia, Y. Zhu, and B. Lin, “Renewable energy utilization evaluation method in green buildings,” Renewable Energy, vol. 33, no. 5, pp. 883–886, 2008, doi: 10.1016/j.renene.2007.10.005.
  4. 4. P. Nema, R. K. Nema, and S. Rangnekar, “A current and future state of art development of hybrid energy system using wind and PV-solar: A review,” Renewable and Sustainable Energy Reviews, vol. 13, no. 8, pp. 2096–2103, 2009, doi: 10.1016/j.rser.2008.10.006.
  5. 5. X. Xue, S. Wang, Y. Sun, and F. Xiao, “An interactive building power demand management strategy for facilitating smart grid optimization,” Applied Energy, vol. 116, pp. 297–310, 2014, doi: 10.1016/j.apenergy.2013.11.064.
  6. 6. N. Growe-Kuska, H. Heitsch, and W. Romisch, “Scenario reduction and scenario tree construction for power management problems,” in 2003 IEEE Bologna Power Tech, Bologna, Italy, pp. 152–158.
  7. 7. J. van Roy, N. Leemput, F. Geth, J. Buscher, R. Salenbien, and J. Driesen, “Electric Vehicle Charging in an Office Building Microgrid With Distributed Energy Resources,” IEEE Trans. Sustain. Energy, vol. 5, no. 4, pp. 1389–1396, 2014, doi: 10.1109/TSTE.2014.2314754.
  8. 8. D. Wang, X. Guan, J. Wu, P. Li, P. Zan, and H. Xu, “Integrated Energy Exchange Scheduling for Multimicrogrid System With Electric Vehicles,” IEEE Trans. Smart Grid, vol. 7, no. 4, pp. 1762–1774, 2016, doi: 10.1109/TSG.2015.2438852.
  9. 9. W. Guan, Y. Tan, H. Zhang, and J. Song, “Distribution system feeder reconfiguration considering different model of DG sources,” International Journal of Electrical Power & Energy Systems, vol. 68, pp. 210–221, 2015, doi: 10.1016/j.ijepes.2014.12.023.
  10. 10. S. Wang and X. Xu, “Parameter estimation of internal thermal mass of building dynamic models using genetic algorithm,” Energy Conversion and Management, vol. 47, 13–14, pp. 1927–1941, 2006, doi: 10.1016/j.enconman.2005.09.011.
  11. 11. H. Park, M. Ruellan, N. Martaj, R. Bennacer, and E. Monmasson, “Generic thermal model of electrical appliances in thermal building: Application to the case of a refrigerator,” Energy and Buildings, vol. 62, pp. 335–342, 2013, doi: 10.1016/j.enbuild.2013.02.061.
  12. 12. T. Dewson, B. Day, and A. D. Irving, “Least squares parameter estimation of a reduced order thermal model of an experimental building,” Building and Environment, vol. 28, no. 2, pp. 127–137, 1993, doi: 10.1016/0360-1323(93)90046-6.
  13. 13. L. Ljung, System identification. New Jersey: Prentice Hall, 1987.
  14. 14. A. Bagheri, V. Feldheim, D. Thomas, and C. S. Ioakimidis, “Coupling building thermal network and control system, the first step to smart buildings,” in 2016 IEEE International Smart Cities Conference (ISC2), Trento, Italy, 2016, pp. 1–6.
  15. 15. P. Richardson, D. Flynn, and A. Keane, “Optimal Charging of Electric Vehicles in Low-Voltage Distribution Systems,” IEEE Trans. Power Syst., vol. 27, no. 1, pp. 268–279, 2012, doi: 10.1109/TPWRS.2011.2158247.
  16. 16. D. Thomas, A. Bagheri, V. Feldheim, O. Deblecker, and C. S. Ioakimidis, “Energy and thermal comfort management in a smart building facilitating a microgrid optimization,” in IECON 2017 - 43rd Annual Conference of the IEEE Industrial Electronics Society, Beijing, pp. 3621–3626.
  17. 17. R. P. O'Neill, P. M. Sotkiewicz, B. F. Hobbs, M. H. Rothkopf, and W. R. Stewart, “Efficient market-clearing prices in markets with nonconvexities,” European Journal of Operational Research, vol. 164, no. 1, pp. 269–285, 2005, doi: 10.1016/j.ejor.2003.12.011.

Written By

Dimitrios Thomas and Evangelos Kotsakis

Submitted: 13 June 2020 Reviewed: 11 November 2020 Published: 17 December 2020