1. Introduction
Electrical energy is a very important but scarce resource available to humans. It has become an integral part of our lives and we cannot think of a world without electricity. Many household appliances are running on electricity and its demand is rapidly growing. Industries are also putting more pressure on electricity generating companies to produce more and more energy [
1]. According to a report by US-Energy Information Administration (EIA), a
increase in global energy demand is expected by 2040 [
2]. To meet the rising worldwide demand for energy, efforts are made in two main directions: (a) increase electric power production capacity by exploiting existing and renewable energy sources and solutions (b) effectively utilize existing resources of energy by avoiding energy wastage and unnecessary usage. Both of these approaches are equally important and complement each other. In fact, the effective utilization of existing resources of energy is more desirable because it is economical and easy to adopt. Improper utilization of resources results in energy wastage which can otherwise be utilized in some useful application. To avoid wastage and unnecessary usage of energy, intelligent solutions are needed to ensure efficient utilization of energy.
Internet of Things (IoT)-based applications have shown promising results in many different fields by improving system efficiency, accuracy, process automation and overall profit maximization. IoT based technologies are also very useful in realizing the concept of smart homes. IoT devices are small devices attached to daily life objects for purpose of monitoring or controlling [
3]. The devices have the capability of communication so that it can be accessed over the Internet. Integration of IoT with artificial intelligence algorithms provides the basic building blocks for the future smart world. To achieve energy efficiency in buildings, various IoT-based solutions can be found in the literature. According to a survey, energy efficiency and management are the second most promising domain for IoT applications in South Korea [
4]. IoT devices have tiny sensors attached that can be used to gather sensing data about indoor building environment and appliances can intelligently be controlled according to user preferences [
5]. Operating the electrical appliances only when required through IoT devices helps in avoiding energy wastage. However, any such solution for saving energy shall not have any negative impact on user comfort and convenience. In other words, the objective is to gain optimal utilization of energy without degrading user comfort.
Using IoT devices, we can collect desired context information about indoor environment including temperature, illumination, user occupancy, appliances operational status, etc. Various machine learning algorithms can be applied to collected context data to predict future conditions and corresponding energy requirement. Prediction energy requirement is both useful for home users and power generating companies. Home users can choose alternate strategies to reduce their energy expense e.g., automated switching from external power sources to an internal power source (e.g., solar system) when feasible. Furthermore, accurate estimation of future energy requirement can also help in identification and optimization of the peak hours for energy consumption. Better capacity planning can be done for managing on-site renewable energy generation and thus helpful in achieving the target of the zero-energy building. Similarly, energy prediction data can be used by power companies to timely adjust their generating capacity and optimize power load distribution. According to report by Korean Energy Economics Institute (KEEI) South Korea,
of national energy consumption is covered by commercial and residential sector as shown in
Figure 1 [
6]. As electricity is contributing heavily to home user monthly expenses, therefore little achievement in optimal utilization of energy will cause a major reduction in overall expenses. Therefore, development of an intelligent IoT-based solution for achieving energy efficiency is highly desirable which is subject to this paper.
This paper is focused on the development of Hidden Markov Model (HMM) based algorithm to predict energy consumption in residential buildings. We have developed an HMM-based layered architecture for energy prediction in smart homes. The proposed architecture has four layers (a) Data acquisition layer is used to collect data including indoor environmental parameters, actuators status, and users occupancy information; (b) Pre-processing layer prepares the context data for upper layers; (c) Afterwards, hidden Markov models are generated and stored; (d) Finally, computed models are used at the application layer for energy prediction. For experimental analysis, we have used the data collected from four multi-storied buildings located in Seoul, South Korea. Comparative analysis shows that proposed model has achieved better results than Support Vector Machine (SVM), Artificial Neural Network (ANN) and Classification and Regression Trees (CART).
The rest of the paper is structured as follows.
Section 2 present a brief overview on related work. A detailed discussion of hidden Markov modeling for proposed system is given
Section 3 along with its pseudo code and flow diagram for HMM generation and training. The architecture of proposed HMM-based model for prediction of energy consumption is discussed in
Section 4 along with its design. A brief discussion of collected data and its transformation is presented in
Section 5.
Section 6 presents model validation, comparative and temporal analysis along with a detailed discussion on results. Finally, the paper is concluded in
Section 7 along with future work directions.
2. Related Work
Energy is considered as one of the most important and scarce resources due to the constant increase in its demand. Energy saving is not only desired for promoting a green environment for future sustainability but also important for the home users and energy production companies. Consumers want to reduce their monthly expenses in which electricity cost is a major contributor. Power generating companies are under pressure for producing more energy to fulfill commercial and domestic energy requirements. Thus, solutions for efficient energy utilization is desirable by all stock holders.
In the recent past, tremendous efforts have been invested in building smart homes solutions by researchers and manufacturing industry. In smart homes application domain, diverse nature of research directions can be found ranging from monitoring, prediction, optimization, security, privacy, and control. Energy optimization is also a profound area of research in building smart grids and smart homes. The objective is to provide maximum user comfort at the cost of minimum energy consumption [
7,
8,
9].
Development of building energy management systems have been investigated based on various control systems [
10,
11,
12]. Among the major reasons for energy inefficiencies and overutilization is that trivial systems often do not consider environmental factors and user occupancy. For instance, typical heating, ventilation, and air conditioning (HVAC) systems will assume that space is fully occupied and it will try to maintain the desired atmosphere without caring if a hall is fully occupied or only a few persons inside. Various algorithms are applied to predict user occupancy and corresponding energy requirement in order to improve system efficiency. Support vector machine and artificial neural networks-based algorithms are the two most widely used algorithms for energy prediction [
13]. For instance, to improve the efficiency of a steam boiler in buildings, a data-driven scheme is proposed in [
14] using artificial neural networks to achieve optimal cooling/heating. Their model can be used for estimation of steam consumption in future using forecasted weather data. Similarly, a model predictive control (MPC) based system is developed in [
15] for saving of energy consumed by heating systems in buildings. Using forecasted weather data together with users occupancy information, the behavior of the building is modeled in terms of selected operational strategies. Their goal is to develop a control system that can achieve user desired parameters settings with minimum energy consumption. For indoor comfort and energy management, an intelligent multi-agent optimization based control system is presented in [
16]. They try to achieve maximum user comfort with reduced energy consumption by fusing information using weighted aggregation.
Building energy management systems can be classified broadly into two categories based on adapted modeling strategies i.e., inverse and forward modeling [
17]. A system based on an inverse modeling scheme tries to capture the dependencies among various inputs (e.g., users occupancy data, weather information, building structural parameters) and output data (i.e., required energy) in the form of a mathematical equation. However, this kind of system requires strong background knowledge to derive such a mathematical expression. In contrast, a system based on forward modeling schemes tries to generate an optimal schedule for operation along with estimated required energy by using input data such as building structural design parameters (e.g., size, material) along with weather and environmental information. Many software frameworks based on forward modeling schemes can be found in the literature. A comparative study of two of the most popular forward modeling-based software packages i.e., EnergyPlus and DOE-2 can be found in [
18]. DOE-2 is famous simulation tool for energy usage estimation in residential and commercial buildings. Recent development in information and communication technologies (ICT) has given birth to new modeling schemes i.e., data-driven. Data-driven models are based on input data regarding outdoor and indoor environment collected through various sensors. In fact, this new sensor technologies-based data-driven approach is a hybrid model of both forward and inverse model for energy management. Forward models are based on input data which is supplied by various sensors readings. Inverse models are based on some mathematical relationship between inputs and outputs which can be derived by using various statistical or machine learning algorithms. A comprehensive review of data-driven approaches for prediction of energy consumption in buildings can be found in [
19]. Since inception, sensing technologies-based models for energy management have attracted significant research attention. Several energy management systems are proposed in the literature for estimation and prediction of energy consumption by using hybrid models i.e., a combination of sensing technology with artificial intelligence algorithms. For instance, a study presented in [
20] illustrate the application of several statistical methods in order to improve neural networks prediction for efficient energy consumption in buildings. Similarly, a hybrid model of adaptive-neuro-fuzzy system with genetic algorithm (GA-ANFIS) is presented in [
21] for further improvement of conventional neural networks. Significant improvement in prediction results is reported by using the proposed hybrid model. Ali et al. proposed a hybrid energy prediction model to improve power consumption optimization based on pre and post processing in [
22].
For required heating load prediction, Kalogirou et al. used back propagation neural networks for given parameters of building space such as windows area and type, walls size, ceiling design, etc. [
23]. Olofsson and Andersson [
24] developed a model for making long-term predictions of energy demand based on short-term recorded data using neural networks. The model parameters include temperature difference between indoor and outdoor environment and energy required for heating and other utilities. A study presented in [
25] shows that accuracy of prediction algorithms deteriorates as they try to predict further ahead in future. They also observed that algorithms can normally predict the peak energy consumption up to one week ahead of time with
accuracy. A comprehensive survey of neural networks based energy applications in buildings is presented in [
26].
User occupancy-based system for efficient utilization of HVAC energy is proposed in [
27] based on Markov model. They have used real-time occupancy data collected from various sensors to evaluate their system. Results of simulation in EnergyPlus simulator shows that
annual savings can be achieved by using context-aware system. In [
28], a context-aware model for user occupancy prediction in the building is proposed using Semi Markov Models. Using historical occupancy data along with current contextual information, occupancy models are created for different zones of building with varying time intervals for short and mid-term prediction. Hidden Markov Models (HMM) are useful in time series data analysis, however, its application in building energy sector is not so much investigated. Tehseen et al. has developed an HMM-based procedure in [
29] for identification of individual household appliances from collective energy consumption data. However, this requires HMM models to be trained for individual appliance energy consumption profile. An HMM-based modeling scheme is presented in [
30] for energy level prediction in wireless sensor networks nodes. They consider node energy level as a stochastic variable having values within certain fixed range forming hidden state for their HMM model whereas nodes energy consumption is treated as observed state. HMM model is trained during operation of WSN and used to predict energy levels for the sensing nodes in order to maximize network overall lifetime. HMM models are also used to predict description of device behavior based on training through previously collected energy consumption data for an individual devices [
31]. This model requires a system with known composition and cannot be applied to residential buildings where system load is constantly changing. Besides energy prediction, HMM-based models are used for other purposes, e.g., an input/output hidden Markov model is developed by Gonzalez et al. for electricity prices modeling and prediction in [
32].
In this paper, we have proposed a Hidden Markov Model based algorithm to predict energy consumption in smart buildings. We have used energy consumption data collected from four multi-storied buildings located in Seoul, South Korea for model validation and results analysis.
3. Hidden Markov Modeling for Proposed System
Markov chain/models are named after its inventor Andry Markov who is known for his studies on stochastic processes. Basic Markov models are useful for finding long-term steady-state probabilities of the system having a finite number of possible states, using inter-state transition probabilities. Many variations of basic Markov model are used in diverse applications. Hidden Markov Model (HMM) is an advanced form of basic Markov model that is specifically formulated for the phenomenon where system state is not directly visible i.e., hidden, but output, depending upon the internal states, is visible. In HMM, we have hidden and observed states, state probability vector
, inter-state transition probability matrix
and emission probability matrix
as shown in
Figure 2. Hidden states represent the system internal states which is normally not directly visible to the user. Observed states are directly visible to the user and can be used to make an intelligent guess about system’s corresponding hidden state. State probability vector
gives information about the probability of the system being in any state at a given instant of time. Inter-state transition probability matrix
express the probability of going from one hidden state to another. Emission probability matrix
is used express the relationship between hidden and observed states, governing the distribution of the observed state at a particular time given the information about system hidden state at that time.
For HHM models generation and training, we have used hourly energy consumption data collected from smart meters installed in the selected residential building of Seoul, South Korea for period of one (01) year. Through data transformation process, we convert the hourly energy consumption data to get floor-wise occupancy sequence. Details about data transformation process is provided in
Section 5. Through this transformation, we get numerous different combinations for occupancy sequence. With every occupancy sequence, we have associated a class label based on total energy consumption. It is quite understandable that same occupancy sequence may result in different total energy consumption on different floors, on different days, on different timings.
Let
S be our set of all occupancy sequences. For every
, we have corresponding class label for energy consumption i.e.,
. Depending upon the unique values in the input sequence, we also assign a state label to each sequence
. Let,
T be the total number of classes in our data where each class corresponds to a unique combination of
and
. Similarly, we can express a total number of unique labels for energy consumption as
Y (irrespective of occupancy sequence). A brief description of the terms used in our HMM is given in
Table 1.
There are three main phases:
3.1. HMM Models Creation and Initialization
First, we create desired number of HMMs for the available dataset. Total 108 different models are created as we have 108 unique combinations of class and state labels in our dataset. All these models are initialized with starting transition and emission probabilities and finally stored in
structure. Let
be the ith HMM model which is expressed as below:
where
is the state probabilities vector,
is the inter-state transition probabilities and
is the emission probabilities. These probabilities vectors/matrices are initialized as below:
where
is number of unique values in corresponding input sequence
s.
Above scheme ensure summation of all row vectors to be 1 to satisfy Markov condition.
Figure 2 shows the typical structure of ith HMM model after initialization.
3.2. HMM Models Training
In the second phase, we train the models with the available dataset. For every unique combination of energy label
and state label
, we have created a hidden Markov model with initial probabilities as shown in
Figure 2. For training of each specific model, first, we extract set of corresponding input sequences that have same energy label
and state label
. Baum-Welch algorithm is used for training of HMMs [
34]. For given set of training observation sequences and initial structure of HMM (numbers of hidden and visible states), Baum-Welch algorithm determines HMM parameters (state transition and emission probabilities) that best fit to the training data. After, model training, these probabilities are replaced with system steady-state probabilities for each model. Flowchart given in
Figure 3 explains the initialization and training process of our HMMs.
3.3. Prediction using HMM Models
Finally, we perform prediction for every input sequence to compute predicted energy consumption. Here, we compute the likelihood (probability) of every trained HMM model for generating the given input sequence using Baum-Welch’s forward algorithm. As we have created
T HMMs and each model is trained for a particular energy consumption (energy label) using corresponding estimated occupancy sequence. Thus, for any given occupancy sequence
s, we will compute the likelihood for every ith model to generate given input observation sequence i.e.,
. The model with maximum likelihood will be selected and its corresponding energy label will be considered as predicted energy consumption as shown in
Figure 4.
Figure 5 presents pseudo-code for HMM creation, training and testing based on Accord.NET framework [
33].
5. Data Collection and Transformation
Given the occupancy pattern information, we can predict energy consumption. In the available data, we have floor-wise hourly energy consumption information collected from smart meters installed in the selected residential building of Seoul, South Korea for period of one (01) year i.e., January 2010 to December 2010. To have an idea about dataset, hourly energy consumption distribution for complete data-set is provided in
Figure 8 in the form of box plot. We can easily figure out from the box plot that energy consumption is low in early morning and afternoon where peak energy consumption is observed during noon and night timings. This is due to the fact that residential buildings have maximum occupancy during noon and night times which results in higher energy consumption. This also indicates that there is a strong positive correlation between energy consumption and occupancy in the collected dataset.
We can relate user occupancy data with hourly energy consumption by using simple linear transformation but we cannot directly conclude total energy consumption from given occupancy information. For example, two rooms having same user occupancy but different electrical equipment will have different energy consumption ratio. However, if we can have user occupancy pattern then we can predict total energy consumption. Therefore, we need to transform the existing data into a sequence in order to get observation sequence for our Hidden Markov Model. As we observed from data that there is a strong positive correlation between energy consumption and occupancy, so mathematically we can express it as below.
where
is energy consumption at ith floor,
is estimated occupancy of the ith floor and
C is proportionality constant i.e., per occupant per hour energy consumption. Assuming per person per hour power consumption to be about 10 kWh (approximately), we consider
in these experiments. Using a different value of
C will results in a different observation sequence for HMM but it will rarely affect the model results as the output (i.e., total energy consumption) remains the same for which model is trained. To get estimated occupancy information from consumed energy, we can re-write Equation (
6) as below.
Afterwards, we apply data smoothing filter in order to reduce the number of state transitions using moving average filter with a span of 3 using Equation (
7).
After smoothing filter operation, the resultant data has a fractional part which is simply removed by rounding the data to the nearest integer value as each value form a state in Markov model.
Table 2 illustrate these operations on sample data. Number of states are calculated by computing the unique values in input data sequence and state transitions are calculated by counting the number of state changes while moving from left to right of input data sequence. We can see that after smoothing, the number of states reduced from 5 to 4 and inter-state transitions from 7 to 5 for this sample data.
Finally, we get user occupancy data as an observation sequence and for which we use Hidden Markov Model to predict energy consumption as shown in
Figure 9. Floor-wise per hour energy consumption data gives us user occupancy pattern in the building which serves as input (observation sequence) to our Markov model whereas total energy consumption for a particular input pattern is associated with the model as a tag which is also referred as a predicted class label.
For each input sequence, we have defined a class label, depending upon the total energy consumption for corresponding input sequence e.g., if total energy consumption for a particular input sequence is N (say N=36) then we assign that sequence with a class label as EN i.e., E36. Furthermore, for every input sequence, we also record a state count i.e., the number of unique values in corresponding input sequence as shown in the third column in
Figure 9.
7. Conclusions and Future Work
In this paper, we have presented a hidden Markov model-based algorithm for prediction of energy consumption in smart buildings. We have used real data collected through smart meters in selected buildings at Seoul, South Korea for model validation and results analysis. Proposed model prediction results are compared with three well-known prediction algorithms i.e., ANN, SVM, and CART. Statistical analysis shows that our proposed model results are 2.96% better than ANN results in terms of RMSE metric, better than SVM and 9.03% better than CART results. To further establish and validate prediction results of our proposed model, we have performed temporal granularity analysis. For this purpose, we have evaluated its results for hourly, daily and weekly data aggregation. Prediction accuracy in terms of root mean square error metric for hourly, daily and weekly data is 2.62, 1.54 and 0.46 respectively. This shows that our model prediction accuracy improves for coarse grain data. Higher prediction accuracy gives us the confidence to explore proposed model application in building control systems for achieving better energy efficiency. We have selected HMM for prediction due to its inherent benefits over other AI-based algorithms. HMM-based trained models can be used to identify underlying appliances used from cumulative energy consumed. Furthermore, HMM models can perform automated fault monitoring and appliances health assessment by performing analysis of individual device energy consumption pattern. At the first step, we tried to establish that HMM models can accurately predict energy consumption which was the subject matter of this paper. These initial results give us confidence and we are currently exploring various alternatives and collecting data to extend this work in aforementioned directions.