Parameters related with the number of scenarios.

## Abstract

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.

### Keywords

- 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.

## 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.

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 scenarios | 6 scen. | 12 scen. | 24 scen. | 48 scen. |
---|---|---|---|---|

TESC ($) | 26.06 | 20.07 | 16.68 | 15.64 |

SD ($) | 23.22 | 24.33 | 24.35 | 24.45 |

Elapsed time (s) | 0.09 | 0.11 | 0.23 | 0.42 |

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.

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.

### 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: * 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

### 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,

*and parametrized with*t

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.

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.

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

The expected cost function (3) is a probability-weighted mean of all the scenarios considered. It minimizes the power requested from the grid

Finally, the third term of Eq. (3) introduces a prioritization mechanism in the form of a penalty factor. Parameters

### 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 * 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

### 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 * i*in every scenario

### 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

### 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

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

**. 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.**Section 2.3

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.

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

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

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

Case | Description | Total system cost |
---|---|---|

1 | No EMS in operation (average of all historical data) | 59.47 |

2 | With EMS in operation (average of all historical data) | 13.51 |

3 | Expected mean of all 24 scenarios | 16.68 |

4 | Most probable scenario of the 24 (prob. 9.3%) | 58.11 |

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

**. 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.**Section 2.1

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

**. (Figure 9).**most probable scenario

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.

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).

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.

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

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 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.

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

*, 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 “*shadow prices

*”. 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 improvement in the objective function value if the constraint is relaxed by one unit

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

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.