You are on page 1of 9

Energy and Buildings 139 (2017) 1–9

Contents lists available at ScienceDirect

Energy and Buildings

journal homepage:

A two-stage Energy Management System for smart buildings reducing

the impact of demand uncertainty
M.C. Di Piazza ∗ , G. La Tona, M. Luna, A. Di Piazza
Consiglio Nazionale delle Ricerche (CNR), Istituto di Studi sui Sistemi Intelligenti per l’Automazione (ISSIA), via Dante, 12 90141 Palermo, ITALY

a r t i c l e i n f o a b s t r a c t

Article history: This paper proposes a novel two-stage Energy Management System (EMS) that is suitable for small-
Received 26 July 2016 scale grid-connected electrical systems, such as smart homes and buildings, encompassing renewable
Received in revised form generators and electrical storage. In such systems, forecast errors of renewable generation and energy
28 November 2016
demand profiles result in a significant uncertainty on the power exchanged between the end users and
Accepted 2 January 2017
the utility grid. The proposed EMS reduces such demand uncertainty and the electricity bill for end users,
Available online 4 January 2017
at the same time. The main novelty of the proposed technique is that it does not require any change in
pricing plans or user’s habits, differently from classical Demand Side Management schemes. Moreover,
Energy management
thanks to the increased predictability of the exchanged power, utility providers are facilitated in managing
Forecast error the wholesale risk, for example by designing appropriate pricing schemes. The proposed EMS is based
Demand uncertainty on an optimization algorithm. It starts from profiles of renewable generation and load demand, which
Optimization algorithm are obtained by a forecasting method based on suitably chosen and trained Artificial Neural Networks.
Furthermore, it has been designed to be suitable for an embedded implementation on low-performance
processing platforms. The proposed EMS has been validated using datasets coming from monitoring
campaigns. The considered case study is a smart home with an annual energy consumption of about
4500 kWh. It encompasses a grid-connected electrical distribution power plant with a 3 kW photovoltaic
generator and a 4.6 kWh battery electrical storage system. The results obtained for a sample month
demonstrate the effectiveness of the approach. As a matter of fact, the demand uncertainty is only 4.75%
against a cumulative forecast error of 10.35% expressed as normalized root mean square error. At the
same time, the end user’s cash flow is 2.43% higher than the income obtained without an EMS.
© 2017 Elsevier B.V. All rights reserved.

1. Introduction To mitigate the impact of uncertainty on their performance,

market actors must account for it in their planning and bidding
All the actors of the energy market need to forecast energy optimizations [8,9]. In fact, they need to take costly measures to be
requests to schedule their operations accordingly. In fact, electrical able to meet real-time demand deviations, like maintaining oper-
energy producers must account for many constraints (e.g., genera- ating reserves (spinning or non-spinning) and adopting financial
tors lead times, output ranges, minimum uptime, and downtime) tools to reduce their economic risk (e.g., risk hedging) [10]. There-
and to solve day-ahead unit commitment problems [1,2] to bid fore, actively reducing demand uncertainty, instead of passively
on the market [3,4]. For the same reason, utility providers bid on accounting for it, can simplify the operations of every energy mar-
the energy market anticipating energy demand profiles [5,6]. Fur- ket actor and cut ancillary costs that, ultimately, are indirectly paid
thermore, the grid manager needs to plan to avoid grid reliability by end users.
and stability issues [7]. However, due to uncertainty, market actors’ The increasing integration of distributed Renewable Energy Sys-
forecasting is subject to errors, which negatively affect generation tems (RES) adds the uncertainty of renewable energy generation to
schedules, cleared bids and operation plans. that due to user’s behavior; thus, the overall demand uncertainty in
terms of requested/injected power increases. In fact, the power out-
put of RES is usually non-flat and volatile. Also, if allowed, end users
and RES owners — being unaware of the consequences — tend to
∗ Corresponding author. sell as much generated power as possible to maximize their profit.
E-mail addresses: (M.C. Di Piazza), End users’ active participation is essential to improve
(G. La Tona), (M. Luna), (A. Di Piazza). energy efficiency, to reduce power consumption, and to reduce
0378-7788/© 2017 Elsevier B.V. All rights reserved.
2 M.C. Di Piazza et al. / Energy and Buildings 139 (2017) 1–9

demand/supply uncertainty. However, users care for their free- Table 1

Variables of the optimization problem.
dom and dislike changing their habits. Therefore, they need to
be involved in the issue, and they also require some incentive Symbol Description
to behave accordingly. For this reason, Demand Side Manage- soc Battery state of charge
ment (DSM) programs have been proposed to engage end users pgl Power flowing from grid to loads
in actively collaborating to maximize grid energy efficiency and to pgb Power flowing from grid to battery
reduce overall energy consumption; examples of DSM programs pbl Power flowing from battery to loads
ppb Power flowing from PV source to battery
are Real-time Pricing (RTP), Time of Use (TOU) pricing and Day-
ppl Power flowing from PV source to loads
Ahead Retail Pricing (DAP) schemes. ppg Power flowing from PV source to grid
Users’ participation can be direct or mediated. In the first case,
users must actively monitor and control their appliances, their gen-
erators output, and review utility signals to abide DSM policies. requirements, and of the impact of the starting time on the algo-
Conversely, in the latter case, users can rely on technological solu- rithm’s performance.
tions that manage energy consumption and generation pursuing The proposed technique is validated performing simulation
certain goals, e.g., cost reduction, response to DSM signals, energy tests in Matlab environment using data collected through mon-
efficiency, and demand uncertainty reduction. itoring campaigns. The considered case study is a smart home
Energy Management Systems (EMSs) enable end users to encompassing a grid-connected electrical distribution power plant
accomplish their energy goals and those of utility providers, start- with a photovoltaic (PV) generator and a BESS.
ing from models or forecasting of renewable generation and load The paper is organized as follows. Section 2 presents the sys-
demand profiles. After processing the data, they output the opera- tem architecture and the general formulation of the EMS. Next,
tional set points and use them as a reference for local control of the Sections 3 and 4 provide details on the stages of the algorithm.
electrical system devices. Several works on EMSs in technical liter- Section 5 presents simulation analyses and discusses the results.
ature explicitly avoid forecasting. In fact, they operate in real time Finally, Section 6 presents some concluding remarks.
starting from a set of rule-based operating modes corresponding to
different hours of the day [11–13]. However, these approaches are 2. The proposed Energy Management System
incompatible with the goal of demand/supply uncertainty reduc-
tion. Other works use forecast-based optimization algorithms to The proposed technique will be illustrated and validated refer-
schedule power flows [14–18]. However, most EMSs overlook ring to a smart home composed of an aggregated load, a 3 kW PV
demand uncertainty reduction as a goal, except for [17,18], which generator, a 4.6 kWh BESS, and a connection to the public grid.
propose a two-stage approach: a day-ahead phase and a real-time The case study is a single-family house (two floors, total sur-
phase. First, the system defines the demand/supply profile; then it face 160 m2 ), with four occupants and an annual average energy
minimizes deviations, which the utility bills to the user, from the consumption of about 4500 kWh. To simplify the discussion the
defined profile. In particular, [17] controls the demand varying the following working assumptions are made, which do not affect the
thermostat set-point of the building’s air-conditioning systems, but general validity of the proposed EMS:
it disregards the possibility of using electric energy storage units
and RES. On the other hand, [18] proposes a strategy where, after 1. the aggregated load profile is considered as input; if needed, a
a bidding process, the system reschedules energy storage and dis- lower-level control system can shift or schedule each load, while
patchable generators operations to minimize real-time deviations respecting the aggregated load profile;
from the negotiated profile. However, it requires a demanding data 2. the PV generator always works in the maximum power point
exchange between the user and the utility, and it implies a change for each environmental condition (solar irradiance and temper-
of the user’s habits. ature);
As a matter of fact, management of uncertainty and reduction 3. transferring power from the battery to the grid is not allowed
of its impact are still among the major open issues in the field of by the utility, following the technical rule for grid-connection in
EMSs [19]. Starting from a previous work [20], this paper presents a force in some European countries at the time of writing;
two-stage EMS for smart homes and buildings that reduces demand 4. the battery must be small and affordable for the end user, so it
uncertainty while maximizing the economic convenience for the is not suitable to sustain hours-long islanding.
user. It is designed to manage renewable electricity generation,
aggregated electrical load, and energy storage. The proposed EMS With regard to point 1) the aggregated load profile refers to the
forecasts renewable generation and load demand profiles using two user, which is ultimately the householder. Thus, the user’s demand
Artificial Neural Networks (ANNs), whose capability and perfor- is considered as a whole, without distinguishing the contribution of
mance have been previously demonstrated [21], [22]. each appliance. The proposed EMS must necessarily work with the
The main novelty of this work is to propose an EMS that provides house/building aggregated load profiles because it optimizes the
significant advantages both for the end users (optimizing their net power flow at the exchange node with the grid. Therefore, even
cash flow) and for the utility provider (reducing demand uncer- if specific load profiles were available, they should be aggregated.
tainty). The proposed EMS is compatible with TOU and DAP DSM As for point 3), removing such assumption would only imply
schemes. It is also designed to be noninvasive, since it does not increasing the number of variables, i.e., adding variable pbg to
require any change of user’s habits, and to be easily implemented Table 1 and modifying Eqs. (5) and (6) accordingly. Moreover, the
on low-performance embedded platforms. Coherently with cur- reverse power flow (i.e., grid to battery) is always allowed by the
rent trends in the literature [11,19,14], the proposed system uses a utility provider and required by the proposed EMS. The absence of
Battery Energy Storage System (BESS), which is an enabling tech- this degree of freedom would limit the buffer behavior of the BESS,
nology for the optimal exploitation of renewable generators [23]. preventing the proposed EMS from achieving the chosen goals.
Furthermore, several types of BESSs are technically mature and
commercially available [24]. 2.1. Synopsis of the EMS
Compared with [20], this paper provides a more extensive ana-
lytic formulation of the EMS, as well as three additional analyses, Three processing stages constitute the proposed EMS, i.e.,
i.e., the assessment of the monthly operation, of the computational Forecasting, Forecast-based Optimization and Local Command, as
M.C. Di Piazza et al. / Energy and Buildings 139 (2017) 1–9 3

in the building, as summarized in Table 1. In particular, the follow-

ing rule has been used to denote the power flows: the first letter is
always ’p’ for power flow, the second is the supply of power trans-
fer, and the third is the recipient. For example, pgl stands for ‘power
flow from grid to loads.’ Choosing power flows instead of net pow-
ers implies a logic representation that abstracts from the physical
connection of such devices to the distribution line. After the exe-
cution of each task, the results are brought back to the physical
domain, computing the net power at each device. Then, the system
transmits these values to the Local Command stage.
For each variable, N sets of optimal values must be determined,
one for each time step. Therefore, if the day is divided into N time
intervals, the number of variables involved in each optimization
problem is M = 7 · N.
In the following, for the sake of clarity, standard typeface
denotes scalar quantities, whereas bold typeface is used for
matrices and vectors. Uppercase font denotes constants, whereas
lowercase is used for variables and functions.
Variable x of the optimization problem is made up of N vectors
of grouped variables:

x = [x1 , x2 , . . ., xM ] = [g 1 , g 2 , . . ., g N ] (1)
Fig. 1. Synopsis of the proposed EMS.

consolidated in the most relevant literature, e.g., in [14]. In the first g i = [pgli , pgbi , pbli , ppbi , ppli , ppg i , soc i ] , i ∈ [1, N] (2)
stage, solar irradiance (tied to PV generation) and load demand are
At each time step, a power reference for each power electronic con-
forecast using past data. The more reliable the forecasting is, the
verter must be calculated and sent to the Local Command stage.
more efficient the EMS becomes.
Therefore, the elements of vector g i are used to compute the vector
The second stage considers forecast user needs and plans to sat-
of net powers at each system component:
isfy them while pursuing the chosen goals. In the proposed EMS,

this is accomplished executing two different tasks, i.e., Planning and pi = [pnpi , pnbi , png i , pnli ] (3)
Online Replanning. The Planning task optimizes the user’s cash flow
(CF) over the planned period, i.e., 24 hours. This economic index is with
the sum of the costs sustained by the user (for purchased energy), pnpi = ppbi + ppg i + ppli (4)
minus the received income (for energy sold to the utility). The out-
put of the Planning task is a set of power reference values, one for pnbi = ppbi + pgbi − pbli (5)
each system component.
png i = pgbi + pgli − ppg i (6)
In an EMS that does not correct forecast errors, this set is directly
transmitted to the Local Command stage to perform the instanta- pnli = pgli + pbli + ppli = png i + pnpi − pnbi (7)
neous control of the hardware. Instead, in the proposed EMS, the
Accordingly, the vector of power reference values for the whole
output of the Planning task is only used to compute the optimal
day is:
profile of the power exchanged with the grid, indicated in the fol-
lowing as GEPP (Grid-Exchanged Power Profile), for the whole next p = [p1 , p2 , . . ., pN ] (8)
day. This profile is transmitted to the utility manager/administrator
and represents an obligation, to which the user commits himself. At each time step, the Local Command subsystem receives vector
Forecasting and Planning tasks are executed just once in a day. pi .
Instead, the Online Replanning task is repeated hourly, aiming at Instead of being grouped according to the time step as in (8),
minimizing the deviation between the actual and the transmitted the power reference values can be grouped according to the system
GEPPs. Therefore, besides minimizing the user’s cash flow, the pro- component to which they refer. As an example, vector  is defined
posed EMS reduces the uncertainty of the power exchanged with for the PV generator as follows:
the grid. The public utility can exploit this feature to improve its  = [pnp1 , pnp2 , . . ., pnpN ] (9)
policy planning.
Finally, the Online Replanning task outputs a set of power ref- Similarly, vectors ˇ,  and  can be obtained grouping the power
erence values and transmits them to the Local Command stage. reference values for battery, grid, and loads, respectively. Besides,
Future works will investigate and implement the latter stage. Fig. 1 it is possible to group the battery SOC values, which result in the
shows the synopsis of the proposed EMS. It details the general daily SOC profile .
scheme proposed in [14], adding the two proposed sub-stages of Each quantity involved in the above definitions can appear in
the Forecast-based Optimization stage and specifying the repetition multiple contexts, so it is necessary to distinguish its role. For the
period for each stage. sake of clarity, a specific notation is used, and an example is given
2.2. General formulation of the optimization problems
• x is the generic variable of each optimization problem;
Planning and Online Replanning tasks are executed solving an • x* is the value of quantity x that is either directly measured or
optimization problem during each stage. The first variable is the computed from other measured quantities;
battery state of charge (SOC). For an easier formulation, the other • x̂ is the forecast value of quantity x;
chosen variables are the power flows between couples of devices • x̆ is the optimal value of x that is computed by the Planning task;
4 M.C. Di Piazza et al. / Energy and Buildings 139 (2017) 1–9

Fig. 2. Flowchart of the proposed EMS.

Table 2 are readily obtainable, since the PV generator and the storage sys-
Physical inputs of the proposed EMS.
tem are always equipped with measurement and control devices.
Symbol Description The Forecasting stage processes the measured temperature val-
 Outdoor temperature value ues of the past 24 h. The first ANN forecasts the 24 h-ahead solar
pnp Net power generated from PV source irradiance profile ; ˆ the second ANN forecasts the 24 h-ahead
pnb Net power supplied to battery aggregated load demand profile . ˆ Section 3 gives further details
png Net power requested to grid of these ANNs.
soc Battery state of charge ˆ the Planning task solves an
Using the obtained vectors ˆ and ,
optimization problem aiming at minimizing the cash flow of the
• x̃ is the optimal value of x that is computed by the Online Replan- end user. Section 4.1 specifies the definition of this optimization
ning task. problem. Then, from the solution x̆ of the optimization problem, the
system computes the daily vectors p̆ (net power references) and ˘
Given this notation, it is possible to introduce the flowchart of (planned GEPP) and transmits ˘ to the grid manager/administrator.
the proposed EMS, shown in Fig. 2. Referring to this figure, it is From this moment on, the system executes the Online Replan-
worth noting that the logic execution flow proceeds vertically (solid ning task during the N time intervals of the day. The EMS updates
lines) along the blocks, whereas the exchanged data flow proceeds its physical inputs using actual measurements at each time step
horizontally (dashed lines). i. The i-th temperature measurement i∗ is stored for populating
As shown in Table 2, five quantities must be measured and given vector  ∗ that the ANNs will use during the next execution of the

as inputs to the proposed EMS. It is worth remarking that only a Forecasting task. Then, the system computes pnli starting from the
temperature sensor must be added to an existing plant to imple- three measured powers and using (7). As for the net PV and load
ment the proposed EMS. In fact, the necessary electrical quantities powers of later time intervals, the forecast values are used. In this
M.C. Di Piazza et al. / Energy and Buildings 139 (2017) 1–9 5

4. Forecast-based Optimization stage

This Section describes the formulation of the two tasks that

compose the Forecast-based Optimization stage as mathematical
optimization problems.

4.1. Planning

The Planning stage plans the next day operation, minimizing the
end user cash flow, and transmits the planned GEPP ˘ to the utility.
The objective function of the optimization problem of the Planning
stage is the end user cash flow, which is:


Fig. 3. Structure of the “open loop” NARX ANN. fobj (x) = CF t (11)

(pgbt + pglt − ppg t ) t Cbuy if pgbt + pglt ≥ ppg t
 CF t = (12)
way, two new vectors can be constructed, i.e., [pnp∗i ,  ˆ i+1 , · · ·, 
ˆ N]
(pgbt + pglt − ppg t ) t Csell otherwise
∗ ˆ 
ˆ ∗
and [pnli ,  i+1 , · · ·, N ] . These vectors are used, together with soc i ,
to set the constraints of the second optimization problem. This where Csell and Cbuy are the prices of sold/purchased energy, respec-
process aims at finding the solution x̃ that minimizes the devi- tively. The following notation is used to take the time variable into
ation between the actual GEPP () ˜ and the self-committed GEPP account: t is the discrete variable representing the time steps, ran-
˘ Contrarily to the optimization problem of the Planning stage, ging from one to N; i denotes the current time step and t is the
the second optimization problem considers a number of time steps duration of each time step: t = 24 h/N. Unless otherwise specified,
that decreases throughout the day. The same happens to the num- t ∈ [1, N] is implied in the equations presented in this Section and
ber M of total variables. Section 4.2 gives further details on this the Appendix.
optimization problem. The objective function (11) must be minimized in a domain
Finally, the system sends the net power references p̃i (computed that is expressed through a set of physical and design constraints,
by the Online Replanning task) to the subsystem that implements which must be applied at each time step. The Appendix describes
the Local Command stage. these constraints in detail, and the following numbered list briefly
summarizes them:

3. Forecasting stage 1. non-negative value for each variable;

2. power balance at PV generation node;
PV generation and load demand forecasting are based on the 3. power balance at load node;
nonlinear autoregressive network with exogenous inputs (NARX). 4. maximum contractual grid-exchanged power;
This ANN has been successfully used in time-series modeling 5. maximum battery charging/discharging power;
thanks to its simple implementation and its adaptive learning pro- 6. minimum and maximum SOC values;
cess, also with small-scale data [21,22,25]. The NARX network 7. continuity of SOC between consecutive days;
consists of a multilayer perceptron (MLP) network, which takes 8. evolution of SOC between time steps;
as input a window of present and past independent (exogenous) 9. cyclicity of SOC profile between consecutive days.
inputs and past outputs to compute the current output. In the stud-
ied case the exogenous input is the environmental temperature. The first seven constraints are straightforward, whereas the last
The mathematical formulation of the NARX model is the follow- two constraints are detailed as follows. The SOC evolution between
ing: time steps must be computed using the following equation:
⎧ t
⎨  C (ppbt + pgbt − pblt ) if ppbt + pgbt ≥ pblt
ŷt = f (ut , ut−1 , . . ., ut−nu , ŷt−1 , . . ., ŷt−ny ) (10) soc t+1 − soc t =
⎩ t
(ppbt + pgbt − pblt ) otherwise
where ŷt and ut are the output and the input of the model at a
discrete time step t; nu , ny are the input and output memory orders Furthermore, exact cyclicity would imply that the end-of-day bat-
(delays), with nu , ny ≥ 1, nu ≤ ny ; f is the mapping realized by the tery SOC should be equal to that at the beginning of the same day.
MLP network [25]. However, this constraint would be too stringent. Thus, an accept-
The details on the structure selection, on training, and on fore- able range is defined for the final SOC, and two concurrent aspects
casting performed by the NARX in the case of solar radiation define it. First, a tolerance on the final SOC value is allowed, i.e., 15%.
(directly related to PV power production) are given in [22]. Unlike On the other hand, the end-of-day SOC must allow discharging or
previous application [22], in this paper a 24 h time offset between recharging the battery at the very beginning of the following day.
the independent (temperature) and dependent (load/radiation) Hence, absolute limits for the end-of-day SOC are defined, i.e., [45%,
variables is imposed in the training phase. In this way, the NARX 85%].
ANN can be used in its open loop form, providing a 24 h-ahead fore-
cast of the dependent variable (load/radiation) during the recalling 4.2. Online Replanning
phase. Fig. 3 shows a synopsis of the NARX network in open loop
form. The NARX used here consists of two input neurons, a delay As for the Online Replanning stage, its aim is to correct deviations
equal to seven, ten neurons in the hidden layer and one output of the actual GEPP from the previously planned and transmitted
neuron. GEPP, due to forecast errors in PV generation and load demand.
6 M.C. Di Piazza et al. / Energy and Buildings 139 (2017) 1–9

Table 3 Table 4
System parameters. Performance indices of the NARX networks.

Parameter Value Description NARX for PV NARX for load

t 1 (h) Duration of each time step NRMSE 9.41% 11.70%

 0.95 Battery efficiency CV 34.33% 55.89%
Pxp 3 (kW) Max. power of the PV generator
Pxg 3 (kW) Max. power drawn from the grid
Pxc 1.5 (kW) Max. battery charging power The proposed EMS was preliminarily assessed during a sample
Pxd 1.5 (kW) Max. battery discharging power
day, and the results were already presented in [20]. In particular,
SOCmin 20% Lower bound for battery SOC
SOCmax 100% Upper bound for battery SOC it was compared to a traditional system with no battery and to an
Cbuy 0.1024 (D /kWh) Price of purchased energy EMS that does not correct forecast errors [27], which is referred
Csell 0.0850 (D /kWh) Price of sold energy to as the reference EMS in the following. The results are briefly
Cb 4.6 (kWh) Battery capacity
recalled here. The simulations showed the correct operation of the
Vn 200 (V) Battery nominal voltage
proposed EMS during a sample day and its advantages, based on
the following considerations:
Hence, the L∞ norm of the difference between the two profiles can
• despite non-negligible forecast errors (up to 41% for PV gen-
be chosen as the objective function to be minimized:
eration and up to 14% for load demand), the proposed EMS
fobj (x) = maxi≤t≤N |˘ t − (pgbt + pglt − ppg t )| (14) succeeded in effectively minimizing the deviation from the com-
mitted GEPP; the maximum deviation, normalized respect to Pxg ,
At each execution, the algorithm decides the power flow values was 6%;
and the SOC value for the current time step t = i (using measure- • the reference EMS only applied the planned decision, instead of
ments), and for the following steps t ≤ N (using forecast values). performing an Online Replanning to correct deviations between
Hence, the system avoids greedy minimizations of instantaneous actual and forecast data; therefore, the maximum deviation on
differences to obtain a better result in the long run. In any case, at the GEPP was 44%;
each execution, the system sends only the reference power values • obviously, the forecast errors and the effort to adhere to the com-
for the current time step (t = i) to the Local Command subsystem, mitted GEPP reduced the actual end user’s cash flow (−7.3%)
whereas it discards the other values (for t > i). compared to the planned value; however, the final income for
The constraints of the optimization problem of the Online the end user was still 10% higher than that without an EMS;
Replanning stage are easily adapted from those of the Planning stage. • besides being lower than that of the proposed EMS, the actual
In particular: income for the reference EMS was even worse (−51%) than that
of a traditional system with no battery and no EMS; this was due
• the time intervals on which they are defined must be changed; to the absence of the Online Replanning stage.
• power balance constraints must be split to account for measured
values at the current time step and for forecast values at the Starting from the listed results, this paper presents three additional
remaining time steps. analyses, which are explained in the following, namely the assess-
ment of the monthly operation, of the computational requirements,
The above-described optimization problems are non-linear and of the impact of the starting time on the algorithm’s perfor-
because (12), (13) and (14) are piecewise-linear (PWL) functions. mance.
One possible approach is to transform them into equivalent Mixed-
Integer Linear Programming (MILP) or Dynamic Programming (DP) 5.1. Assessment of monthly operation
problems. The obtained problems have the same feasible sets and
the same optimal solutions, and they can be solved using state-of- The behavior of the proposed EMS, the reference EMS and the
the-art MILP/DP solvers. traditional system has been simulated for four consecutive weeks,
i.e., from 12-May-2008 to 8-June-2008. Then, the most significant
5. Simulation and results statistical indices, i.e., the NRMSE and the normalized maximum
absolute error (NMAE), have been computed on input/output pro-
The developed algorithm has been implemented in Matlab, tak- files. Furthermore, being the two sources of error uncorrelated
ing advantage of the Optimization Toolbox. A series of simulations (forecast errors of PV generation and load demand profiles), the
has been performed dividing each day into 24 time steps and using two input NRMSE indices have been combined in quadrature to
the parameters of the case study that Table 3 reports. It is worth obtain the cumulative error. Finally, the four-week cash flow has
noting that the prices of purchased and sold energy are average been computed for the proposed EMS, the reference EMS, and the
values currently in force in Italy. traditional system. To this aim, it is worth reminding that a negative
Starting from a typical load demand profile for Italian dwellings cash flow denotes an income.
[26], a first part of the dataset has been used to train and to vali- The simulations have shown a correct operation and signifi-
date the first ANN. The remaining part has been considered as the cant advantages of the proposed EMS. Table 5 summarizes the
actual load profile to be compared with the forecast profile. The obtained results. Despite the forecast errors and the effort to adhere
same approach has been used for the second ANN, which forecasts to the committed GEPP, the user earned a total of 27.61D during
hourly solar irradiance values. In this case, the dataset has been pro- the four-week period using the proposed EMS. This result is com-
vided by SIAS (Servizio Informativo Agrometeorologico Siciliano). parable to that of the reference EMS and it is 2.43% higher than
Table 4 shows the performance indices of the ANNs: normalized the income obtained without an EMS. The actual profit could have
root mean square error (NRMSE) and coefficient of variation (CV) been even higher using the proposed EMS if the public utility pro-
of the NRMSE. It is worth noting that CV is higher than NRMSE, posed economic incentives to reward the end user for reducing the
because it is normalized using the average value of the observed demand uncertainty. On the other hand, the proposed EMS showed
data. The latter is significantly lower than the normalizing factor of its robustness to forecast errors because the NRMSE of the GEPP was
the NRMSE, i.e., the maximum excursion of the observed data. only 4.75%, despite a cumulative input NRMSE of 10.35%. Coherent
M.C. Di Piazza et al. / Energy and Buildings 139 (2017) 1–9 7

Fig. 4. Comparison between transmitted and actual GEPPs of the first week.

Table 5 Table 7
Simulation results for the sample 4-week period. Simulation results for the first week (cash flow in D ).

NRMSE NMAE No EMS Prop. EMS Ref. EMS Var. prop-no EMS

PV 0.0951 0.5824 Mon −0.7152 −0.7512 −0.7733 5.02%

Load 0.0408 0.1993 Tue −0.0899 −0.1614 −0.1585 79.40%
Cumulative 0.1035 Wed −0.7735 −0.8407 −0.8340 8.69%
Prop. GEPP 0.0475 0.3593 Thu −1.2927 −1.3501 −1.3524 4.44%
Ref. GEPP 0.1046 0.6101 Fri −1.0654 −1.0808 −1.1289 1.45%
Sat −1.0539 −1.0684 −1.1205 1.38%
cash flow (D ) Sun −1.1881 −1.2084 −1.2325 1.70%

No EMS −26.9528
Prop. EMS −27.6070
Ref. EMS −27.3477 ject to regular charging/discharging cycles. Furthermore, the figure
shows how the end-of-day SOC was constrained, highlighting:

results have also been obtained for the NMAE. These results indicate • the tolerance interval, centered on the value of the SOC at the end
that even large punctual forecast errors were suitably compen- of the previous day (depicted by a star);
sated by the Online Replanning stage of the proposed EMS, resulting • the restriction of this interval considering the absolute limits
in an effective reduction of the demand uncertainty. Instead, the [45%, 85%].
reference EMS exhibited worse results because it only aimed at
optimizing the end user’s cash flow, disregarding the reduction of 5.2. Evaluation of computational requirements
the demand uncertainty.
Moreover, the results obtained during the first week have been To assess the suitability of the proposed EMS for an embed-
reported and commented in the following to provide further details ded implementation, the Planning and Online Replanning problems
on the EMS’s performance. Fig. 4 shows close matching between have been formulated and solved both as MILP problems and as
the transmitted and the actual GEPPs. The highest reduction of the DP problems. In particular, in the DP approach the state of the
demand uncertainty occurred on Wednesday (−7.54%), whereas system corresponds to the battery SOC and it must be a discrete
the smallest one was on Thursday (−1.56%), as shown in Table 6. quantity. Hence, two different discretization step sizes have been
Coherent results have been obtained for the NMAE. Again, the ref- considered: 0.5% and 0.2% increments.
erence EMS always exhibited worse results. Computational requirements, i.e., execution time and memory
As for the daily cash flow, it was around 1D using the proposed occupation, have been evaluated running the Planning task and the
EMS, as shown in Table 7. The increase of the daily income against first time step of the Online Replanning task through Matlab Profiler.
a traditional system with no EMS was significant. Similar results The simulations have been executed on a quad-core (i5 3.2 GHz)
have been obtained using the reference EMS. However, as previ- desktop PC with 8GB of memory; 64bit versions of Matlab R2014b
ously said, even better cash flow values could have been obtained and Microsoft Windows 7 were used. Results are summarized in
using the proposed EMS in the presence of economic incentives.
Finally, Fig. 5 shows the profile of the battery SOC for the pro-
posed EMS during the first week. As expected, the battery was sub-

Table 6
Simulation results for the first week (error metrics).

PV Load Cumulative Prop. GEPP Ref. GEPP

Mon NRMSE 0.1047 0.0423 0.1129 0.0774 0.1140

NMAE 0.3537 0.3537 0.3594 0.4166
Tue NRMSE 0.1205 0.0248 0.1230 0.0672 0.1214
NMAE 0.3057 0.3057 0.2184 0.2866
Wed NRMSE 0.1846 0.0352 0.1879 0.1125 0.1846
NMAE 0.5267 0.5267 0.3070 0.5152
Thu NRMSE 0.0472 0.0323 0.0571 0.0415 0.0616
NMAE 0.1038 0.1038 0.0852 0.1360
Fri NRMSE 0.0637 0.0253 0.0685 0.0312 0.0633
NMAE 0.1917 0.1917 0.0948 0.1658
Sat NRMSE 0.0872 0.0269 0.0913 0.0281 0.0941
NMAE 0.3045 0.3045 0.0825 0.3381
Sun NRMSE 0.0499 0.0412 0.0647 0.0245 0.0688
NMAE 0.1507 0.1507 0.0542 0.1991
Fig. 5. Profile of battery state of charge during the first week.
8 M.C. Di Piazza et al. / Energy and Buildings 139 (2017) 1–9

Table 8 effectiveness of the approach. As a matter of fact, the demand

Computational requirements of MILP/DP implementations.
uncertainty is only 4.75% against a cumulative forecast error of
Time [s] Alloc. memory [MB] Peak memory [MB] 10.35% expressed as NRMSE. At the same time, the end user’s
Planning cash flow is 2.43% higher than the income obtained without an
MILP 159.05 13.38 1.13 EMS. Shifting the starting time of the algorithm forward has a
DP 0.5% 930.07 82.27 9.98 significant impact on its performance: the demand uncertainty is
DP 0.2% 14234.79 107.92 61.95 further reduced, whereas the cash flow degrades. Finally, the pro-
Online Replanning (first time step)
posed EMS has low computational requirements and needs only
MILP 0.13 14.48 4.00
DP 0.5% 27.76 124.59 160.87 a daily unidirectional data-exchange between the end user and
DP 0.2% 177.17 763.53 662.58 the utility manager. Hence, it is suitable to be implemented on
low-performance embedded platforms, fostering its quick market
Table 9
Effect of the starting time on the EMS performance.
t0 CF NRMSE NMAE End-of-day SOC

00:00 −0.7711 10.30% 44.58% 70.45% This work was funded by the following research projects: CNR
04:00 −0.7739 8.21% 38.34% 68.76%
per il Mezzogiorno, RITmare, TESEO.
08:00 −0.7531 7.86% 31.62% 70.71%
12:00 −0.7122 4.04% 15.55% 85.00%
16:00 −0.7293 5.42% 22.71% 78.99% Appendix A. Constraints of the optimization problems
20:00 −0.7133 5.23% 24.05% 85.00%

The optimization problem of the Planning stage has been pre-

sented in Section 4.1, giving the objective function (11) and the
Table 8 and demonstrate that the proposed EMS is suitable for an
numbered list of constraints. The mathematical expression of each
embedded implementation in two scenarios: MILP implementation
constraint follows:
and DP implementation with 0.5% SOC step size.
As a matter of fact, the EMS must complete the Planning task and pglt ≥ 0, pgbt ≥ 0, pblt ≥ 0, ppbt ≥ 0, pplt ≥ 0, ppg t ≥ 0, soc t ≥ 0
each execution of the Online Replanning task within a single time
step. However, the solution of the DP problem with 0.2% SOC step (A.1)
size takes about four hours, so it is not compatible with t = 1 h.
ppbt + ppg t + pplt = 
ˆt (A.2)
As for the two feasible scenarios, although DP is somewhat eas-
ier to implement compared to MILP, the Planning task implemented ˆt
pplt + pblt + pglt =  (A.3)
using DP runs about 5.8 times slower and allocates 515% more
memory than MILP. The computational requirements of Online pgbt + pglt − ppg t ≤ Pxg (A.4)
Replanning follow the same trend. ppbt + pgbt − pblt ≤ Pxc (A.5)

5.3. Influence of the starting time pblt − ppbt − pgbt ≤ Pxd (A.6)

SOC min ≤ soc t ≤ SOC max (A.7)

Additional simulations have been performed to put in evidence
the impact of the starting time on the algorithm’s performance. The soc 1 = s
oc end (A.8)
first day of the monthly validation dataset has been considered. The ⎧ t
same initial SOC of the battery (80%) has been maintained, while the ⎨  C (ppbt + pgbt − pblt ) if ppbt + pgbt ≥ pblt
EMS simulations have been repeated with different starting times. soc t+1 − soc t = (A.9)
Table 9 summarizes the results.
⎩ t
(ppbt + pgbt − pblt ) otherwise
These preliminary simulations show that the starting time of the ⎧ t
EMS considerably affects the results. In particular, two trends can ⎨  C (ppbN + pgbN − pblN ) if ppbN + pgbN ≥ pblN
be observed when the starting time is shifted: the Online Replan- soc end − soc N = (A.10)
ning performance indices (NRMSE and NMAE) improve, whereas ⎩ t
(ppbN + pgbN − pblN ) otherwise
the end user’s economic convenience (CF) degrades. The NRMSE of
the GEPP decreases as much as 6.26% when the EMS starts in the late max{SOC end,min , (1 − SOC tol ) · soc 1 } ≤ soc end
morning, which is the time of peak PV production. Conversely, the (A.11)
soc end ≤ min{SOC end,max , (1 + SOC tol ) · soc 1 }
economic advantage for the end user decreases as the start time
is moved forward; starting the EMS at noon, results in the worst It is worth noting that:
(7.63% higher) cash flow for the end user. These data suggest the
need for further analysis in future works. • t ∈ [1, N − 1] in (A.9);
• s
oc end in (A.8) is the value of the end-of-day SOC that was com-
6. Conclusion puted the previous day with (A.10), during the last execution of
the Online Replanning task.
A novel two-stage optimization-based EMS has been proposed
and validated in simulation. The proposed EMS allows minimiz- Similarly, the optimization problem of the Online Replanning
ing the cash flow of the user without requiring a change in his/her stage has been presented in Section 4.2, giving the objective func-
habits. On the other hand, the EMS makes a continuous effort to cor- tion (14). As for the constraints, (A.1) remains unchanged, whereas
rect forecast errors, thus reducing demand uncertainty. This result the other constraints are easily adapted from those of the Planning
is a significant advantage for all the actors of the energy market. stage.
The proposed EMS has been validated in simulation for a In particular, (A.12)–(A.13) are used in place of (A.2)– (A.3):
typical smart home using datasets coming from monitoring cam- ∗
paigns. The results obtained for a sample month demonstrate the ppbi + ppg i + ppli = pnp∗i , ppli + pbli + pgli = pnli (A.12)
M.C. Di Piazza et al. / Energy and Buildings 139 (2017) 1–9 9

ppbt + ppg t + pplt = 

ˆ t, ˆt.
pplt + pblt + pglt =  (A.13) [14] Y. Riffonneau, S. Bacha, F. Barruel, S. Ploix, Optimal power flow management
for grid connected PV systems with batteries, IEEE Trans. Sustain. Energy 2
where t ∈ [i + 1, N]. (2011) 309–320.
[15] B. Yuce, Y. Rezgui, M. Mourshed, ANN-GA smart appliance scheduling for
Furthermore, (A.8) is substituted with the following equation: optimised energy management in the domestic sector, Energy Build. 111
(2016) 311–325.
soc i = soc ∗i (A.14) [16] M. Rastegar, M. Fotuhi-Firuzabad, Load management in a residential energy
hub with renewable distributed energy resources, Energy Build. 107 (2015)
The other constraints, expressed by (A.4)–(A.7) and (A.9)–(A.11), 234–242.
are adapted by changing the time intervals on which they are [17] J. Zhu, S.A. Vaghefi, M.A. Jafari, Y. Lu, A. Ghofrani, Managing demand
defined, i.e., using i ≤ t ≤ N instead of 1 ≤ t ≤ N. uncertainty with cost-for-deviation retail pricing, Energy Build. 118 (2016)
[18] I. Atzeni, L.G. Ordonez, G. Scutari, D.P. Palomar, J.R. Fonollosa, Noncooperative
References day-ahead bidding strategies for demand-side expected cost minimization
with real-time adjustments: A GNEP approach, IEEE Trans. Signal Process. 62
[1] N.P. Padhy, Unit commitment problem under deregulated environment-a (2014) 2397–2412.
review, 2003 IEEE Power Eng. Soc. Gen. Meet. 2 (2003) 1088–1094. [19] C. Zhao, S. Dong, F. Li, Y. Song, Optimal home energy management system
[2] C.W. Richter, A profit-based unit commitment GA for the competitive with mixed types of loads, CSEE J. Power Energy Syst. 1 (2015) 29–37.
environment, IEEE Trans. Power Syst. 15 (2000) 715–721. [20] M.C. Di Piazza, G. La Tona, M. Luna, A. Di Piazza, A novel EMS for residential
[3] S. Soleymani, A. Ranjbar, A. Shirani, New approach to bidding strategies of microgrids reconciling end-user and utility needs, in: Clean Electr. Power
generating companies in day ahead energy market, Energy Convers. Manage. (ICCEP), 2015 Int. Conf., IEEE, 2015, pp. 146–152.
49 (2008) 1493–1499. [21] A. Di Piazza, M. Di Piazza, G. Vitale, Estimation and forecast of wind power
[4] F. Wen, A. David, Strategic bidding for electricity supply in a day-ahead generation by FTDNN and NARX-net based models for energy management
energy market, Electr. Power Syst. Res. 59 (2001) 197–206. purpose in smart grids, Renew. Energies Power Qual. J. 12 (2014).
[5] R. Herranz, A. Munoz San Roque, J. Villar, F.A. Campos, Optimal demand-side [22] A. Di Piazza, M. Di Piazza, G. Vitale, Solar radiation forecasting based on
bidding strategies in electricity spot markets, IEEE Trans. Power Syst. 27 artificial neural networks optimized by genetic algorithm for energy
(2012) 1204–1213. management in smart grids, in: Eur. PV Sol. Energy Conf. Exhib. (EU PVSEC
[6] A. Philpott, E. Pettersen, Optimizing demand-side bids in day-ahead 2014), 2014, pp. 2574–2579.
electricity markets, IEEE Trans. Power Syst. 21 (2006) 488–498. [23] P. Denholm, R.M. Margolis, Evaluating the limits of solar photovoltaics (PV) in
[7] X. Fang, S. Misra, G. Xue, D. Yang, Smart grid - the new and improved power electric power systems utilizing energy storage and other enabling
grid: A survey, IEEE Commun. Surv. Tutorials 14 (2012) 944–980. technologies, Energy Policy 35 (2007) 4424–4433.
[8] G. Li, J. Shi, Agent-based modeling for trading wind power with uncertainty in [24] H. Chen, T.N. Cong, W. Yang, C. Tan, Y. Li, Y. Ding, Progress in electrical energy
the day-ahead wholesale electricity markets of single-sided auctions, Appl. storage system: A critical review, Prog. Nat. Sci. 19 (2009) 291–312.
Energy 99 (2012) 13–22. [25] H. Siegelmann, B. Horne, C. Giles, Computational capabilities of recurrent
[9] A.G. Bakirtzis, N.P. Ziogos, A.C. Tellidou, G.A. Bakirtzis, Electricity producer NARX neural networks, IEEE Trans. Syst. Man Cybern. Part B 27 (1997)
offering strategies in day-ahead energy market with step-wise offers, IEEE 208–215.
Trans. Power Syst. 22 (2007) 1804–1818. [26] A. Borghetti, Definizione del modello di carico elettrico e termico di tipiche
[10] R. Dahlgren, J. Lawarree, Risk assessment in energy trading, IEEE Trans. Power utenze civili - Allegato 1, Technical Report A1-006660, CESI - Centro
Syst. 18 (2003) 503–511. Elettrotecnico Sperimentale Italiano, 2000, URL: http://www.rse-
[11] S.-t. Kim, S. Bae, Y.C. Kang, J.-w. Park, Energy management based on the originalURI=/documenti/documento/155507&
photovoltaic HPCS with an energy storage device, IEEE Trans. Ind. Electron. 62 RSE manipulatePath=yes&country=ita.
(2015) 4608–4617. [27] T. Ikegami, Y. Iwafune, K. Ogimoto, Optimum operation scheduling model of
[12] S. Chiang, K. Chang, C. Yen, Residential photovoltaic energy storage system, domestic electric appliances for balancing power supply and demand, in:
IEEE Trans. Ind. Electron. 45 (1998) 385–394. 2010 Int. Conf. Power Syst. Technol., IEEE, 2010, pp. 1–8.
[13] N. Liu, Q. Chen, J. Liu, X. Lu, P. Li, J. Lei, J. Zhang, A heuristic operation strategy
for commercial building microgrids containing EVs and PV system, IEEE Trans.
Ind. Electron. 62 (2015) 2560–2570.