You are on page 1of 21

Available online at www.sciencedirect.

com
ScienceDirect

Energy Reports 7 (2021) 699–719


www.elsevier.com/locate/egyr

Tmrees, EURACA, 28 to 30 May 2021, Athens, Greece

Design and implementation of an AI-based & IoT-enabled Home


Energy Management System: A case study in Benguerir — Morocco
Abdelilah Rochda ,∗, Aboubakr Benazzouza , Ibtihal Ait Abdelmoulaa , Abdelhadi Raihanib ,
Abdellatif Ghenniouia , Zakaria Naimia , Badr Ikkena
a Green Energy Park, Regional Road Kelaa km3, R206, 43150, Benguerir, Morocco
b SSDIA Laboratory, ENSET Mohammedia, Hassan II University of Casablanca, Morocco
Received 14 July 2021; accepted 27 July 2021

Abstract
Home Energy Management Systems (HEMS) are of great importance today and have attracted a great deal of interest from
both, academic researchers, and industrial engineers. These systems are considered as the intersection point between the smart
grid and the smart home. Indeed, they can communicate with the user, home appliances, on-site generation sources, storage
devices, and the grid operator to make dynamic decisions enabling intelligent and efficient energy management.
This work aims to design and implement a smart HEMS that ensures renewable energy integration and energy efficiency
improvement in residential buildings. The system designed in this work has been implemented as part of a pilot project in a
testbed house of the Smart Campus — Green & Smart Building Park, Benguerir, Morocco.
The proposed HEMS framework is based on two control strategies that work jointly: the first concerns the scheduling and
control of power dispatch among generation, consumption, and storage agents (Supply-Side Management), while the second
concerns the scheduling and control of flexible appliances for optimal load profile modulation (Demand-Side Management).
The management of energy flows is based on grid electricity price, forecasting data (PV generation and weather conditions)
and user preferences. The two designed control strategies are combined into an AI-based multi-objective optimization algorithm
that minimizes costs and maximizes comfort level simultaneously.
The obtained results validate the effectiveness of the proposed algorithm and indicate that it would significantly increase
the penetration of PV energy for self-consumption and reduce electricity costs, while ensuring a proper compromise between
monetary spending and comfort level. The large-scale implementation of such systems would help decarbonize residential
energy sector through higher renewable energy integration and energy efficiency improvement in buildings.
⃝c 2021 Published by Elsevier Ltd. This is an open access article under the CC BY-NC-ND license
(http://creativecommons.org/licenses/by-nc-nd/4.0/).
Peer-review under responsibility of the scientific committee of the Tmrees, EURACA, 2021.

Keywords: Energy management; Smart grid; Smart home; Renewable energy; Energy efficiency; Digitalization; Multi-objective optimization;
Artificial intelligence

∗ Corresponding author.
E-mail address: rochd@iresen.org (A. Rochd).

https://doi.org/10.1016/j.egyr.2021.07.084
2352-4847/⃝ c 2021 Published by Elsevier Ltd. This is an open access article under the CC BY-NC-ND license (http://creativecommons.org/
licenses/by-nc-nd/4.0/).
Peer-review under responsibility of the scientific committee of the Tmrees, EURACA, 2021.
A. Rochd, A. Benazzouz, I. Ait Abdelmoula et al. Energy Reports 7 (2021) 699–719

Nomenclature
AI Artificial Intelligence
ANFIS Adaptive Neural Fuzzy Inference System
ANN Artificial Neural Network
BPSO Binary Particle Swarm Optimization
CD Clothes Dryer
CO2 Carbon Dioxide
DR Demand Response
DSM Demand-Side Management
DW Dish Washer
EWH Electrical Water Heater
FLC Fuzzy Logic Control
GA Genetic Algorithm
GSBP Green & Smart Building Park
HAN Home Area Network
HEMS Home Energy Management System
HMI Human–Machine Interface
HVAC Heating-Ventilating and Air Conditioning
HV High Voltage
IoT Internet of Things
kW kilowatts
kWh kilowatts-hour
MAD Moroccan Dirham
MPC Model Predictive Control
MV Medium Voltage
ONEE Office National de l’Electricité et de l’Eau
PHEV Plug-in Hybrid Electric Vehicle
PSO Particle Swarm Optimization
PV Photovoltaics
RES Renewable Energy Sources
ROI Return on Investment
RTP Real-time Pricing
SI Swarm Intelligence
SSM Supply-Side Management
ToU Time of Use
V2H Vehicle-to-Home
V2G Vehicle-to-Grid
WM Washing-Machine

1. Introduction
Since the beginning of the 21st century, global energy consumption has experienced very strong growth in all
regions of the world. It seems that tendentially, energy consumption will continue to increase, under the effect of
economic growth on the one hand, and demographic increase and electricity consumption per capita on the other
hand [1]. Reducing CO2 emissions and improving energy supply constitute a dual objective of many countries’
energy policy, including Morocco. This objective coincides with the increasing use of renewable energies for
electricity generation. By 2030, Morocco aims to increase the share of renewable energies to reach 52% of its
700
A. Rochd, A. Benazzouz, I. Ait Abdelmoula et al. Energy Reports 7 (2021) 699–719

energy mix. However, the connection of a large amount of renewable generation, intermittent and variable in nature,
changes the central configuration of energy flows in transmission and distribution circuits, which could threaten the
grid stability. One of possible solutions to limit this increased variability, caused by renewable sources, is to integrate
large-scale energy storage systems into the power system. This is often impractical today due to a set of technical
and economic constraints [2]. Demand flexibility is seen, however, as another way to enable the massive integration
of renewable energy on a large scale [3]. In fact, as the traditional grid is penetrated by conventional sources which
are generally controllable (e.g., thermal power plants), energy management is therefore carried out based on demand
forecasting and supply planning.
Inversely, as modern grids will be penetrated by RES, energy management will consequently be based on
supply forecasting and demand planning. Of course, the demand-side can never be fully schedulable because of
the stochastic nature of energy use by end consumers. However, a large flexible part of the demand could be
object of planning, which will allow a better renewable sources integration into the grid. As a result, unlike the
traditional grid users, Smart Grid users will no longer be pure “consumers”, but “prosumers”. The generation,
storage and management of energy will all be distributed. Users will, therefore, gradually shift from pure consumers
to small units of consumption, storage, and production. The control and management of such a system, complex
and multiplayer, is very difficult and cannot be performed by traditional centralized control approaches [4].
Therefore, it will be needed to develop new “decentralized solutions” for energy management, focusing not only
on consumption planning and load profiles shaping, but also on the integration and management of distributed
generation and storage; the coordination between supply and demand; the response to the incentives offered by
the supplier, etc. In fact, HEMS could be a suitable solution to this problematic as they can communicate with
the user, household appliances, local generation sources, storage devices and the grid operator to make dynamic
decisions allowing intelligent and efficient management of energy flows [5]. Although the numerous advantages
of HEMS, we can evoke some challenges related mainly to infrastructure lacking, forecast uncertainty, device
heterogeneity modeling, multi-objective optimization complexity, computational limitations, comfort modeling, and
timing considerations [6].
In literature, hundreds of papers have been proposed for HEMS development using various approaches, consid-
ering demand response (DR), multi-objectivity, comfort, uncertainty, and communication infrastructure modeling.
According to [7], HEMS scheduling methods can be classified into three categories:
• Rule-based techniques: They are used to manage distributed sources and/or household appliances using if/then
rules based on high-to-low priority. Although their ease-of-use, the main shortcoming of these techniques is
the unsuitability for extensions as they cannot rely on rules to extend the system. Authors in [8] proposed an
energy management strategy in a real case scenario of a hybrid wind-solar power station using a rule-based
hierarchical approach. Also, a rule-based approach was proposed in [9] to manage different types of load
appliances and multiple operators, provide a suitable solution to decrease energy cost, as well as control price
fluctuation under real-time pricing.
• AI-based techniques: AI-based HEMS controllers are based on artificial neural network (ANN), fuzzy logic
control (FLC), and adaptive neural fuzzy inference system (ANFIS). ANN-based solutions can be used instead
of simulation tools to create a fast solution for problems in control and prediction. This method, which is an
information processing algorithm that models non-linear systems and simulates the human brain, has been
utilized as an intelligent controller to control home appliances in [10].
• Optimization-based techniques: These techniques find the most suitable solutions to problems after determin-
ing the objective function subjected to constraints. The objective function is often formulated based on certain
applications, and it can take the form of minimal error, minimal cost, optimal design, and optimal management.
Various optimization techniques have been used to help end users create optimal appliance scheduling of
energy usage based on different feed-in tariffs, pricing schemes, and comfort settings [11]. According to [12],
Model Predictive Control (MPC), Genetic Algorithm (GA), and Particle Swarm Optimization (PSO) are the
most used optimization techniques in HEMS scheduling. PSO was used to optimize desirable points during
the appliances’ operation time in [13]. Weather conditions, user preferences, and appliance priorities were
considered in this technique. The BPSO technique was also used for scheduling four controllable residential
distributed energy resources and interruptible appliances [14].
701
A. Rochd, A. Benazzouz, I. Ait Abdelmoula et al. Energy Reports 7 (2021) 699–719

This paper aims to describe the adopted approach for the design of an AI-based & IoT-oriented HEMS to be
demonstrated within the Green & Smart Building Park’s Living-lab. The overall system architecture will be as well
presented along with demand and supply sides control strategies. Finally, to evaluate the reliability of the control
strategies, some case studies will be performed to assess their direct impact on costs and comfort.

2. Living-lab presentation

The Green & Smart Building Park “GSBP” in Benguerir — Morocco is an innovative platform dedicated to
research and development in the field of green buildings, energy efficiency, smart grids, and electric mobility (Fig. 1).
The aim of this platform is to contribute to the development of sustainable and smart cities through the integration
of renewable energy and digitization as well as pooling the resources and efforts of various academic and socio-
economic partners in the sectors of sustainable construction and smart grids [15]. GSBP is composed of indoor and
outdoor laboratories, equipped with cutting-edge technologies. One of the main outdoor laboratories is the Smart
Campus Living-lab which is composed currently of 10 testbed houses and is equipped with high-tech to duplicate
the model of smart and sustainable cities.

Fig. 1. 3D presentation of Green & Smart Building Park platform. (For interpretation of the references to color in this figure legend, the
reader is referred to the web version of this article.)

The objectives of the Smart Campus are:


• Testing and evaluating the energy performance of different materials for sustainable construction. Some living-
labs were built with conventional materials (e.g., concrete, red brick, wood, etc.), while others were built with
valued materials (e.g., earth, hemp, stone, etc.). These houses have the same architecture and are placed under
the same climatic, technical, and functional conditions to compare their performances, linked particularly to
thermal insulation.
• Testing of different communication protocols (wired and wireless). A variety of protocols with different
communication architectures have been implemented.
• Testing home automation strategies promoting energy efficiency, particularly in lighting and HVAC systems
control.
• Testing different control strategies, optimization techniques and energy management approaches for microgrids
and electric mobility. From grid connectivity point of view, the Smart Campus is composed of two Microgrids:
a grid-connected (including the testbed house of Fig. 2) and an off-grid Microgrids.

702
A. Rochd, A. Benazzouz, I. Ait Abdelmoula et al. Energy Reports 7 (2021) 699–719

Fig. 2. (a) Testbed house localization; (b) 3D design of the testbed house hosting the proposed HEMS.

Fig. 3. A modular functional architecture of the proposed HEMS.

3. Proposed HEMS framework

3.1. Functional approach

A modular functional approach of the system is given by Fig. 3. As shown, the data measured by the various
sensors and meters is acquired via a “Monitoring Module” which stores them in a database. The database makes
part of a “Data Management Module” which also includes a forecasting sub-module. The data is visualized through
a “Human–Machine Interface” (HMI), ensuring total visibility of the current, past, and future state of the system.
The HMI module also allows the user to interact with the system by specifying their comfort preferences. These,
added to the measured and forecast data, constitute the dynamic part of the optimization problem to be solved by the
“Decision-Making Module”. After making the decision regarding the system operation, an “Execution Module” is
responsible for sending the orders to actuators in the form of setpoints to control them according to the optimization
algorithm outputs. From this description, it is remarkable that the system operates in a closed loop, consisting of
a measurement chain and a control chain. The following section will give the overall physical architecture of the
proposed HEMS. Then, the focus will be addressed on decision-making module by designing control strategies for
supply and demand sides management.
703
A. Rochd, A. Benazzouz, I. Ait Abdelmoula et al. Energy Reports 7 (2021) 699–719

3.2. Household appliances classification

In terms of scheduling possibilities, household appliances can be divided into two categories: flexible loads and
critical loads. Flexible loads refer to devices whose operation can be scheduled to a degree without reducing the
user comfort level, such as washing-machine (WM), clothes-dryer (CD), dishwasher (DW), heating-ventilation &
air conditioning (HVAC), electric water heater (EWH) and plug-in electric vehicle (PHEV).
Flexible loads can be classified into two sub-categories: Interruptible Loads (Elastic) and Non-Interruptible Loads
(Shiftable). Non-interruptible loads refer to devices whose operation may be delayed, but once they are in operation,
they must remain operating until the end of their tasks, such as WM, CD and DW. For interruptible loads, they are
in our case: PHEV, HVAC and EWH. On the other hand, critical loads are devices whose operation must be started
immediately when users need their services, such as a computer, television, microwave and lighting, or continuous
consumer devices like the freezer, the fridge, etc. The models and constraints corresponding to flexible appliances
are inspired from the article presented in reference [16].

3.3. HEMS architecture

The proposed HEMS architecture is illustrated by Fig. 4. The scope of this work includes flexible loads, critical
loads, a grid-connected photovoltaic energy system of 3.75 kWp and energy storage batteries with a capacity of 6.4
kWh.

Fig. 4. Global architecture of the system.

The considered assumptions and the functional constraints of the system are detailed as follow:
• The HEMS is expected to perform two functions:

◦ Supply-Side Management: optimal scheduling and control of energy exchanges between generation,
consumption, and storage elements.
◦ Demand-Side Management: optimal scheduling and control of flexible loads operation.

• The HEMS planning horizon is fixed at 24 h with a resolution of 10 min.


• The optimization objectives are the minimization of costs and the maximization of the user comfort based on
the price of electricity, user preferences and PV generation forecasting.
704
A. Rochd, A. Benazzouz, I. Ait Abdelmoula et al. Energy Reports 7 (2021) 699–719

• Through the HMI (Human–Machine Interface) unit, the user can define their preferences and configure the
system.
• Each HEMS component communicates with the controller (Processing and Control Unit) via a HAN (Home
Area Network), which is supposed to be implemented via Zigbee communication technology.
• The two-way energy and information exchange between the HEMS and the grid is carried out via a smart
meter which is responsible for transmitting user’s consumption data to the grid operator and the electricity
price signals from the operator to the HEMS.
• In the following simulations, we will assume that the adopted pricing scheme is RTP (Real-Time Pricing): the
price of electricity for each hour is published by the operator to residents one day in advance.
• PHEV is considered a load only in this study. Although, it can be used in other configurations as an energy
source through a V2G (Vehicle to Grid) or V2H (Vehicle to Home) scheme.

4. Energy management strategy design


As loads planning and power dispatching strategies are the two main factors that affect the total monetary
expenditure, we propose then to design in the following an algorithm allowing to manage, simultaneously, the
supply-side (SSM) and the demand-side (DSM).

4.1. Supply-side control strategy

In this section, an advanced rule-based control strategy is proposed to manage energy sharing among power
sources to fulfill optimally the demand. The strategy to be designed will result in self-consumption improvement,
grid dependence minimization and battery-life enhancement. The distribution of energy flows among loads, batteries,
PV generator and the grid, is illustrated in Fig. 5:

Fig. 5. Power distribution possibilities among the system agents.

• The delimited components by the dotted line belong to the user and constitute the scheduling objects of the
algorithm to be proposed.
• The power feed-in into the grid is not allowed in our case.
• Batteries can be charged from the grid when the price of energy is low.
ptG2L denotes the power transmitted from the grid to the load at time t. Similarly, ptP2L and ptB2L represent,
respectively, the power transmitted from the photovoltaic generator and the power transmitted from the batteries
to the load. While ptG2B and ptP2B represent the powers transmitted from the grid and from PV, respectively, to
batteries.
Note that in dynamic tariff schemes like RTP, it is sometimes useful to charge the batteries from the grid when
the price of energy is low to reuse it when the energy is expensive. This makes it possible to avoid calling the grid
during peak periods.
705
A. Rochd, A. Benazzouz, I. Ait Abdelmoula et al. Energy Reports 7 (2021) 699–719

Fig. 6. Proposed flowchart for power dispatching.

Fig. 6 presents the flowchart proposed for optimal power sharing. Simulations have proven that this rule-based
control strategy effectively maximizes self-sufficiency and self-consumption rates, minimizes grid dependence, and
optimizes battery life.

4.2. Demand-side control strategy

Unlike the rule-based supply-side control strategy, the demand-side control strategy to be proposed is an
optimization-based strategy whose setpoints are calculated by resolving an optimization problem. Therefore, some
objective functions (namely cost and comfort) and decision variables will be defined in the following. A PSO-based
algorithm will be designed and mixed with the supply-side control strategy to schedule optimally the appliances
operation.

4.2.1. Formulation of the optimization problem


a. Cost Function definition
The overall cost of electricity to minimize over the planning horizon is given by Eq. (1), which is made up of two
parts: the first element represents the cost of purchasing electricity from the grid, either for direct use, or to charge
the batteries (short-term costs). The second element corresponds to the cost of batteries degradation (long-term
costs).
Nslot Nslot
∑[ grid
] ∑[
( ptG2L + ptG2B ) × ∆t × ct ( ptB2L + ptP2B + ptG2B ) × ∆t × cdeg
]
Fcost = + (1)
t=1 t=1

• ptG2L : indicates the power transmitted from the Grid to the Loads. The other symbols have a similar meaning
(kW).
• ∆t : is the length of a time slot (h).
grid
• ct : is the price of electricity in time slot t when the user purchases electricity from the network (MAD/kWh).
706
A. Rochd, A. Benazzouz, I. Ait Abdelmoula et al. Energy Reports 7 (2021) 699–719

• cdeg : is the equivalent cost of battery degradation (MAD/kWh),


• Nslot : Number of daily time slots.

b. Comfort Function definition


In terms of comfort, the user may have various concerns depending on the type of household appliance. For
example, for HVAC and Electric Water Heater, the user pays more attention to the temperature. However, for
PHEV, Washing Machine, Clothes Dryer and Dishwasher, the user focuses on when the tasks for these devices are
completed. By measuring the comfort of all flexible appliances, it is possible to schedule their operations in an
efficient way, while ensuring a suitable user comfort level. Table 1 assigns a comfort parameter to each device.

Table 1. Comfort parameters for flexible loads.


Appliance Comfort parameter
HVAC, EWH Temperatures (Tt H V AC , Tt E W H )
PHEV, WM, CD, DW End times of tasks (t Pf SHOC , tend , tend
EV W M CD
, tend
DW
)

A set of comfort level indicators have been proposed depending on the type of device. For HVAC system for
example, to quantify user level comfort, we define a Comfort Level Indicator whose definition is based on the
following assumption: if the ambient temperature inside the house is equal to the user’s set temperature, the user is
in the most comfortable state. Otherwise, if the ambient temperature deviates from the set temperature, the comfort
level will be reduced [17]. This indicator is calculated as follows:
Nslot
1 ∑ dtRoom
I H V AC = Room
× 100 (2)
Nslot t=1 ∆Tmax

Room
( Room Room Room Room
)
Where ∆Tmax = max Tset − Tmin ; Tmax − Tset

Tset − Tt Room , i f ≤ Tt Room < Tset


⎧ Room Room

⎪ Tmin Room
− ∆TLRoom
, if Room
− ∆TLRoom ≤ TtPièce ≤ Tset
Room
− ∆TURoom

⎨ 0 Tset
And dtRoom =


⎪ Tt Room − Tset
Room
, if Room
Tset + ∆TU Room
≤ Tt Room < Tmax
Room

Room
, else

∆Tmax
where TsetRoom
is the desired indoor temperature defined by the user and ∆TLRoom and ∆TURoom are two parameters
related to the comfortable zone of the HVAC system temperature and user preferences. For example, in summer, the
user prefers coolness. Therefore, in this case, ∆TLRoom > ∆TURoom . Nslot represents the number of daily time slots.
According to the definition of the I H V AC indicator, it is in the interval [0, 100]. The indoor temperature variability
range is divided into three zones, namely, comfortable zone, tolerable zone, and intolerable zone. Fig. 7 highlights
these areas as well as the relationships between the other parameters [17].

Fig. 7. Relationships between the parameters of HVAC system comfort level indicator.

707
A. Rochd, A. Benazzouz, I. Ait Abdelmoula et al. Energy Reports 7 (2021) 699–719

Based on the above definitions, the overall comfort level of the user during the planning period is formulated as
follows:
1 ∑
Fconfort = Ia (3)
N A a∈A
A = {ML, SL, LV, CVC, CEE, PHEV}.
Ia : designates the value of the comfort level indicator of the device a.
N A : is the number of appliances in the set A of household appliances that can be planned.
c. Definition of the total objective function
The multi-objective optimization model for HEMS can be formulated as follows:
{
min Fcost
(4)
min Fcom f or t
To simplify, the optimization model is transformed into a single-objective optimization model using a weighting
method:
min Ftotal = α Fcost + (1 − α) Fcom f or t (5)
where α represents the user preference factor (0 ≤ α ≤ 1) by which a user can easily compromise between the cost
of electricity and the level of comfort.

4.2.2. Multi-objective optimization of the HEMS using PSO


a. Presentation of PSO algorithm
The algorithms of Swarm Intelligence (SI) consist generally of a population of agents which interact locally
with each other and with their environment. Particle Swarm Optimization (PSO) algorithm is a discipline of SI.
This method optimizes a problem by testing, iteratively, several candidate solutions. This solves a problem by
having a population of candidate solutions, here particles, each of dimension n, by moving them in the search space
according to a stochastic law. The key words of this algorithm are Learning (cognitive factor) and Communication
(social factor). The example of Fig. 8 highlights the process of finding the optimal point using PSO algorithm. It
is a maximization of a given objective function. As shown, the particles are first randomly initialized in the search
area. After a few iterations, and thanks to learning and communication, the particles converge towards the optimal
zone [18,19].

Fig. 8. Example of the optimization process using PSO algorithm.

To illustrate the principle of this algorithm, Fig. 9 gives a schematic drawing of the optimization process for a
given problem. Suppose a population of particles (represented by the yellow color) is looking for the optimal point.
Each particle of the population moves, iteratively, in the search area which represents all the potential solutions
and updates its speed vi and its position xi based on its personal experience (represented by pbest
i
: best position
708
A. Rochd, A. Benazzouz, I. Ait Abdelmoula et al. Energy Reports 7 (2021) 699–719

Fig. 9. Geometric representation of PSO algorithm. (For interpretation of the references to color in this figure legend, the reader is referred
to the web version of this article.)

individual visited by particle i) and on social experience (represented by gbest : best overall position visited by the
entire population).
{
vi (k + 1) = w (k) vi (k) + c1r1 pbest − xi (k) + c2 r2 [ gbest − xi (k)]
[ i ]
(6)
xi (k + 1) = xi (k) + vi (k + 1)
• vi (k + 1) et vi (k) : designate the velocities of particle i in iterations k + 1 et k.
• xi (k + 1) et xi (k) : designate the positions of particle i in iteration k + 1 et k.
• c1 et c2 : are, respectively, cognitive, and social learning factors.
• r1 et r1 : are two stochastic aleatory variables within the interval [0, 1].
i
• pbest et gbest : are, respectively, the best personal position of particle i and the best global position of the
entire population.
The binary version of the PSO algorithm, denoted BPSO (Binary PSO), is proposed for binary problems. In this
type of problems, a particle will decide “yes” or “no”, “true” or “false”, etc. The best personal and global positions
are updated just like in the real value version. The main difference between the binary PSO and the real-valued
version is that the particle velocities are rather defined in terms of the probabilities that a bit will go from 0 to 1.
Using this definition, a speed must be restricted in the range [0,1]. A transformation is therefore introduced to map
the values of the real speeds to the interval [0,1]. The transformation function used here is a sigmoid function such
as [20,21]:
1
vi′ (k) = Sigmoı̈de (vi (k)) = (7)
1 + exp (−vi (k))
Thus, the update of the position is done according to the following equation:
1

⎨1 i f r 3 <
xi (k) =
( )
1 + exp −vi, j (k) (8)

0 else
where r3 is a stochastic number varying randomly within the interval [0,1].
Based on PSO algorithm described above, a multi-objective optimization algorithm has been developed to
optimize the HEMS. Fig. 10 gives the flowchart of the proposed algorithm for solving the optimization problem.
In this algorithm, the decision vector of the optimization model (9) is the position vector X i of particle i and
709
A. Rochd, A. Benazzouz, I. Ait Abdelmoula et al. Energy Reports 7 (2021) 699–719

Fig. 10. Flowchart of the proposed PSO-based algorithm for solving the optimization problem.

corresponds to a consumption profile. It is given by:


X i = [SC V C , SC E E , S P H E V , Tstart ] (9)
SC V C , SC E E and S P H E V are binary vectors and Tstart is a discrete vector. Therefore, the decision vector X i is
a hybrid vector with a dimension of 3Nslot + 4 − t plug . For example, if the day is subdivided with a resolution of
10 min (Nslot = 144), and the electric vehicle plug-in time is 6:30 P.M (t plug = 111), the dimension of the vector
X i is 325. Table 2 gives the components of the decision vector as well as associated characteristics.

5. Case studies: Simulations and results


In this section, we propose to perform some simulations to validate the proposed algorithm. The algorithm was
coded and studied on MATLAB environment. The scheduling horizon for the simulation is 24 h divided into 144
equal time slots, each corresponding to 10 min.
710
A. Rochd, A. Benazzouz, I. Ait Abdelmoula et al. Energy Reports 7 (2021) 699–719

Table 2. Decision vector components.


Sub-vector Expression Dimension Type
SC V C [S1C V C , S2C V C , . . . , S NCslot
VC
] Nslot Binary
SC E E [S1C E E , S2C E E , . . . , S NCslot
EE
] Nslot Binary
SP H E V H EV , SP H EV , . . . , SP H EV ]
[StPplug Nslot − t plug + 1 Binary
t plug +1 Nslot

Tstar t M L , t SL , t LV ]
[tstar 3 Discrete
t star t star t

5.1. Case study N◦ 1: Evaluation of the HEMS potential savings

5.1.1. Description
This case study aims to identify the potential savings of the energy management activity. Thus, we propose to
perform a mono-objective optimization with the concern to reduce electricity costs without considering the comfort
function.

5.1.2. Results and discussion


Fig. 11 highlights the optimization process obtained by applying the proposed algorithm. Fig. 12 gives the results
of the supply-side control strategy adopted for optimal power sharing between the consumption, generation, and
storage elements. Figs. 13 and 14 correspond to the results of demand-side control strategy. They give, respectively,
the optimal scheduling of interruptible and non-interruptible appliances according to the proposed algorithm. While
Fig. 15 shows the real-time costs of grid energy and batteries.

Fig. 11. Optimization process of the objective function.

We can notice that whether for direct use or for charging batteries, energy was only purchased from the grid
when its price was low. Indeed, as the optimization objective here is to reduce costs, calling the grid only when
energy is cheaper is, therefore, justified. Note that charging batteries from the grid during off-peak hours is useful
to avoid calling it during peak hours.
The energy real-time cost corresponding to batteries increases with the charging power from the grid and
decreases with the charging power from PV. This is expected as PV energy is free and, therefore, prioritized to
711
A. Rochd, A. Benazzouz, I. Ait Abdelmoula et al. Energy Reports 7 (2021) 699–719

Fig. 12. Supply-side management results — Dispatching scheduling.

Fig. 13. Demand-side management results — Interruptible appliances scheduling.

be consumed. On the other hand, grid energy is not free, and its cost should be reflected in the stored energy. These
two facts justify the evolution of the battery energy cost in the observed way.
712
A. Rochd, A. Benazzouz, I. Ait Abdelmoula et al. Energy Reports 7 (2021) 699–719

Fig. 14. Demand-side management results — Non-interruptible appliances scheduling.

Fig. 15. Real-time energy prices.

Otherwise, we can notice that the optimization percentage in terms of cost (85%) is greater than in terms of
energy (30%), when they should normally be equal! This could be interpreted by the fact that the two percentages
should be equal only when the grid tariff is fixed. As this is not the case for this simulation, the percentage of savings
in cost (MAD) is not necessarily equal to that in energy (kWh) because the price of kWh is simply variable.
To quantify the benefits of the proposed HEMS, a non-HEMS based simulation has been performed and compared
to the simulation above. The comparison results are summarized in Table 3.
The table above allowed to identify the potential savings due to HEMS deployment, but on a daily basis (short-
term impact). To assess the HEMS impact on long-term PV system profitability, we will assume that the HEMS
enhances the self-sufficiency rate by 30% (Fig. 16) during the PV project lifetime (estimated to 25 years). Table 4
allows to compare some financial parameters for the two scenarios.
From this case study, we can conclude that energy management can significantly affect, both, the short-term
savings, and the long-term profitability of PV systems for residential use. This will encourage residential users to
resort to self-consumption by means of photovoltaic energy. However, attractive profitability could be achieved not
713
A. Rochd, A. Benazzouz, I. Ait Abdelmoula et al. Energy Reports 7 (2021) 699–719

Table 3. Comparison of daily-based KPIs for cases with/without HEMS deployment.


Variable With HEMS Without HEMS Grid only Main findings
Self-consumption rate 90% 60% 0% Optimization of the self-consumption of 30% compared to the
case without HEMS
Emissions savings (kg) 12.01 8.4 – limitation of CO2 emissions by 30% compared to the case
without HEMS deployment
Grid dependence 10% 40% 100% Optimization of the grid independence of 30% compared to the
case without HEMS
Monetary spending 1.33 8.891 21.839 Optimization of the monetary spending of 85% compared to the
(Bill in MAD/day) case without HEMS, and 94% compared to the case with the
grid only

Fig. 16. Self-sufficiency rates for the cases with/without HEMS deployment.

Table 4. Comparison of long-term financial parameters for cases with/without HEMS deployment.
Variable With the HEMS Without the HEMS Main findings
Annual Cash-flow (MAD) 8674.76 5783.17 Optimization of the annual cash-flow of 33.33% compared to the
case without energy management.
Payback period (Years) 11 17 Optimization of the payback period by 6 years compared to the
case without energy management.
Return on investment (%) 90% 34% Optimization of the ROI of 56% compared to the case without
energy management.

only by increasing grid independence, but also by considering battery life to minimize maintenance and replacement
costs. Otherwise, simulations have shown that selling energy surplus to the grid at a suitable feed-in tariff could boost
photovoltaic systems profitability. By combining energy management and energy surplus selling, the profitability
of photovoltaic systems becomes much more interesting [22,23].
Considering the legal framework, Morocco has established legislative and regulatory texts to serve the imple-
mentation of the national energy strategy [24], such as Law No. 13–09 on renewable energies that opened the HV
electricity market; Law No. 58–15 (modifying and supplementing law No. 13–09) that provided the possibility of
selling up to 20% of annual production to the national network operator (ONEE) and Law No. 16–08 that authorized
individuals to produce their own electricity for self-consumption [25]. However, the legal framework is not open
yet for LV. Utility companies do not compensate homeowners or other producers for the energy feedback into the
grid. Consequently, HEMS deployment could be a suitable solution to increase PV systems profitability in countries
lacking feed-in tariff or net-metering policies such as Morocco.

5.2. Case study N◦ 2: “Costs/Comfort” analysis

5.2.1. Description
Generally, a high level of comfort corresponds to high money expenses. Attempting to reduce these expenses
could have a negative impact on the comfort level. The inverse proportionality existing between these two variables
714
A. Rochd, A. Benazzouz, I. Ait Abdelmoula et al. Energy Reports 7 (2021) 699–719

is commonly known as the “Cost-Comfort Dilemma”. Therefore, the challenge is to find a way ensuring a good
comfort level, while reducing costs.
This case study will analyze the relationship between cost and comfort to find a suitable trade-off between these
two variables. It is, therefore, a multi-objective optimization which simultaneously considers the cost function and
the comfort function defined above. Consequently, the objective function in this case is given by:
Fobjective = αFcost + (1 − α) Fcomfort (10)

5.2.2. Results and discussion


Several simulations were performed with different values of the weighting coefficient α. Note that the cost
function in this case study corresponds to the total cost of electricity. Fig. 17 highlights the relationship between
the overall cost and the comfort level in function with the user preference factor α. We can notice that when the
coefficient α goes from 1 to 0, the level of comfort is optimized by 100% (the user’s preferences are perfectly
satisfied). On the other hand, the total cost of electricity is increased by 38.72%. To illustrate the effect of varying
the preference factor α on the comfort level, Figs. 18 and 19 show that the air and water temperature profiles are
smoother and less oscillatory with α = 0 than with α = 1.

Fig. 17. Relationship between user preferences coefficient and optimization results.

To conclude, the cost/comfort dilemma can be solved by the preference factor α which allows the user to easily
find a suitable trade-off between monetary expenditure and comfort level.

5.3. Case study N◦ 3: Evaluation of the grid pricing scheme impact on consumption optimization

5.3.1. Description
Demand Response (DR) is being currently an important element of the Smart Grids solutions’ portfolio [26]. It
is defined as the energy consumption pattern modulation by end-users that are intended to alter the timing, level
of instantaneous demand, or total electricity consumption according to [27]. Currently, standard billing systems
in many countries are based on a monthly averaged rate rather than dynamic rates reflecting the power market
fluctuations [28]. To address electricity pricing issues, several alternative pricings models have been proposed such
as time-of-use, real-time pricing, critical peak pricing, incremental block rates, etc. [29].
Dynamic pricing is considered as a DR mechanism to achieve several goals, such as: balancing supply and
demand; achieve energy savings for the end user; educate consumers; more actively engage end users and
decentralized producers [30].
This study is devoted to analyzing the effect of the pricing scheme nature on potential savings achievable by
energy management for residential case. Thus, three simulations are to be compared, each corresponding to a
different pricing model. Fig. 20 illustrates the used tariff models, which are:
• Real-Time Pricing (RTP): The price of electricity varies hourly. It is published one day-ahead by the grid
operator to residents.
• Time-of-Use (ToU) Pricing: In this model, we will use the three tariffs used by manufacturers — MV in
Morocco (off-peak hours, full hours, peak hours).
• A static pricing model: like the one currently used by residential users in Morocco.

715
A. Rochd, A. Benazzouz, I. Ait Abdelmoula et al. Energy Reports 7 (2021) 699–719

Fig. 18. Interruptible appliances operation with α = 1.

Fig. 19. Interruptible appliances operation with α = 0.

716
A. Rochd, A. Benazzouz, I. Ait Abdelmoula et al. Energy Reports 7 (2021) 699–719

Fig. 20. Pricing schemes during a day.

Table 5. Main results of the 3rd case study.


Pricing scheme Grid costs (MAD) Battery degradation costs (MAD) Fcost (MAD)
RTP 3.4773 18.4526 21.9299
ToU 4.1784 21.0748 25.2532
Fixed tariff 5.7852 24.2463 30.0315

5.3.2. Results and discussion


The corresponding simulation results are summarized in Table 5. From the obtained results, it turns out that RTP
scheme optimizes the overall cost by 13.16% compared to the ToU scheme, and by 26.27% compared to the fixed
tariff scheme. We can notice that time-varying pricing schemes allow more savings for the end-user. However, as
it is difficult for residential consumers to spend time analyzing electricity prices fluctuations and micro-managing
household devices operation for money savings, the implementation of smart technologies (i.e.: HEMS) would
considerably enable end-users harnessing the DR potential savings through efficient consumption scheduling.
In Morocco, industrials can adjust their manufacturing systems according to an hourly-varying tariff system
(three bands per day). Inversely, residential clients are subject to a fixed rate regulated by the State, which depends
on the consumption levels. However, a major project to reform the electricity tariff system in Morocco, which has
been launched a few years ago by the Ministry of General Affairs and Governance, is on the verge of completion.
Moreover, ONEE (national grid operator in Morocco) has launched lately a new time-varying pricing scheme for big
residential consumers (> 500 kWh/month) to encourage them consume during off-peak hours: For each shifted kWh,
1 MAD is saved [31]. Consequently, the development of energy management systems considering local specificities
is crucial to accompany the Moroccan energy transition.

6. Conclusion
The Moroccan energy transition will only succeed by achieving the strategic objectives that have been fixed in
terms of renewables development and energy efficiency improvement. In fact, the achievement of these two goals
could be greatly accelerated by developing two key elements in parallel: the smart grid and the smart home. In the
digital era, betting on “intelligence” is, therefore, a necessity.
In modern grids era, energy management systems are important components in energy saving and play a key role
to promote renewable energy integration, thus protecting the environment. In this perspective, an intelligent HEMS
has been developed to optimally use energy within a smart home under smart grid paradigm, addressing the local
context and energy demand habits. After defining the study context, a HEMS framework was proposed. Then, two
717
A. Rochd, A. Benazzouz, I. Ait Abdelmoula et al. Energy Reports 7 (2021) 699–719

control strategies were designed to work jointly: supply-side control strategy, and demand-side control strategy. By
mixing the two named strategies, a multi-objective optimization algorithm has been developed to minimize costs and
maximize comfort level simultaneously. The management of energy flows has considered electricity prices, forecast
data and user preferences. The results of the simulations have shown that energy management enables considerable
savings to be exploited. The cumulative effect of these savings has a notable impact on PV system profitability.
The “Cost/Comfort” dilemma has been solved with an efficient weighting method which allows the user to find
a suitable trade-off among monetary expense and comfort level. The user is, therefore, a key player in energy
management activities. The grid operator is another key player who could significantly influence consumption
patterns. Indeed, the adoption of a dynamic pricing scheme such as RTP or ToU allows significant savings for
the user. Consequently, such a scheme could also be an effective means of raising awareness to engage, more
actively, end users in energy management activities. This will enable a decentralized management of the electric
system, which constitutes the backbone of smart grids. The reform of the pricing system launched in Morocco
should therefore result in adopting a dynamic pricing scheme in order to achieve this purpose.
The set of results obtained in this work show that the HEMS constitutes a multi-dimensional solution and a point
of convergence of several cutting-edge topics: smart grid, smart home, energy efficiency and renewable energies
integration into buildings. The deployment of these systems on a large scale could have considerable impacts on
both the socio-economic ecosystem and the environment. However, considering the afore-mentioned challenges, a
successful integration of HEMS into homes will require more efforts to be undertaken regarding implementation
costs, modeling complexity, and forecasting uncertainty.

Declaration of competing interest


We address our thanks to the Green Energy Park for its financial and technical support. In addition, this article
and the research behind it would not have been possible without the exceptional collaboration between the authors.

References
[1] Kingdom of Morocco, Ministry of Energy, Mines, Water and Environment. National energy strategy. 2014, p. 10.
[2] Yao Liangzhong, Yang Bo, Cui Hongfen, Zhuang Jun. Challenges and progresses of energy storage technology and its application in
power systems. 2016, p. 6–8.
[3] Ekanayake Janaka, Liyanage Kithsiri, Wu Jianzhong, Yokoyama Akihiko, Jenkins Nick. Smart grid: Technology and applications. 2012,
p. 83.
[4] Berger Lars T, Iniewski Krzysztof. Smart grids : Applications, communications and security. 2012, p. 91–9.
[5] Aman S, Simmhan Y, Prasanna VK. Energy management systems: State of the art and emerging trends. IEEE; 2013, p. 1–2.
[6] Zareipour Hamidreza, Beaudin Marc. Home energy management systems: A review of modelling and complexity. In: Energy solutions
to combat global warming. 2017, p. 753–93.
[7] Shareef Hussain, Ahmed Maytham S, Mohamed Azah, Al Hassan Eslam. Review on home energy management system considering
demand responses, smart technologies, and intelligent controllers. In: IEEE access, special section on energy management in buildings,
Vol. 8. 2018.
[8] Raihani A, Khalili T, Rafik M, Zaggaf MH, Bouattane O. Towards a real time energy management strategy for hybrid wind-PV power
system based on hierarchical distribution of loads. Int J Adv Comput Sci Appl 2019;10(5):396–406.
[9] Althaher S, Mutale J. Management and control of residential energy through implementation of real time pricing and demand response.
In: IEEE power energy soc. general meeting, San Diego, CA, USA. 2012, p. 1–7.
[10] Ahmed MS, Mohamed A, Shareef H, Homod RZ, Ali JA. Artificial neural network-based controller for home energy management
considering demand response events. In: Proc. Adv. ICAEES, Putrajaya, Malaysia. 2016, p. 506–9.
[11] Shareef H, et al. Review on HEMS considering DRs, smart technologies, and intelligent controllers. 2018, p. 8.
[12] Shah Abdul Salam, Nasir Haidawati, Fayaz Muhammad, Lajis Adidah, Shah Asadullah. A review on energy consumption optimization
techniques in IoT based smart building environment. 2018, p. 12.
[13] Wang Z, Yang R, Wang L. Multi-agent control system with intelligent optimization for smart and energy-efficient buildings. In: Proc.
IECON. 2010, p. 1144–49.
[14] Pedrasa M, Spooner E, MacGill I. Robust scheduling of residential distributed energy resources using a novel energy service
decision-support tool. In: Proc. ISGT. 2011, p. 1–8.
[15] Official website of IRESEN (Institut de Recherche en Energie Solaire et Energies Nouvelles) : www.iresen.org.
[16] Zhang Yanyu, Zeng Peng, Li Shuhui, Zang Chuanzhi, Li Hepeng. A novel multi-objective optimization algorithm for home energy
management system in smart grid. 2015, p. 4–7.
[17] Zhang Y, Zeng P, Znag C. Multi-objective optimal control algorithm for HVAC based on particle swarm optimization. In: 5th
international conference on intelligent control and information processing. China; 2014.
[18] Lazinica Aleksandar. Particle swarm optimization. 2009, p. 1–2.
718
A. Rochd, A. Benazzouz, I. Ait Abdelmoula et al. Energy Reports 7 (2021) 699–719

[19] Talbi El-Ghazali. Metaheuristics from design to implementation. 2009, p. 25.


[20] Menhas Ilyas, Fei MinRui, Wang Ling, Fu Xiping. A novel hybrid binary PSO algorithm. 2016, p. 2.
[21] Abid Samia. Particle swarm optimization technique and its variant binary PSO (BPSO). 2016, p. 15.
[22] Dijkgraaf E, Van Dorp TP, Maasland Emiel. On the effectiveness of feed-in tariffs in the development of solar photovoltaics. 2018,
p. 1.
[23] Milanes-Montero Patricia, Arroyo-Farrona Alberto, Perez-Calderon Esteban. Assessment of the influence of feed-in tariffs on the
profitability of European photovoltaic companies. 2018, p. 1.
[24] Official website of Ministry of Energy, Mines, Water and Environment: www.mem.gov.ma.
[25] Kingdom of Morocco Ministry of Energy, Mines, Water and Environment. Law No. 58-15 amending and supplementing Law No.
13-09 relating to renewable energies. 2015, p. 1.
[26] Ipakchi A, Albuyeh F. Grid of the future. In: Power and energy magazine. IEEE; 2009, p. 52–62.
[27] Albadi, El-Saadany E. A summary of demand response in electricity markets. Electr Power Syst Res 2008;(78).
[28] Borenstein S, Jaske M, Rosenfeld A. Dynamic pricing, advanced metering and demand response in electricity markets. Technical report,
University of California; 2002, p. 2–3.
[29] Faruqui A, Sergici S. Household response to dynamic pricing of electricity: A survey of seventeen pricing experiments. 2007, p. 68–77.
[30] Breukers DrSC, Mourik DrRM. The end-users as starting point for designing dynamic pricing approaches to change household energy
consumption behaviours. 2013, p. 6.
[31] Official website of ONEE (Office National de l’Electricité et de l’Eau): www.one.org.ma.

719

You might also like