Energy Management in Smart Buildings and Homes: Current Approaches, a Hypothetical Solution, and Open Issues and Challenges

Energy plays a pivotal role for economic development of a country. A reliable energy source is needed to improve the living standards of people. To achieve such a goal, governments and industries are trying to install a new energy infrastructure called the “Smart Grid”. This helps to manage the electricity generation and distribution in an efficient manner. Buildings and other structures are the biggest consumers of electricity. There is a need to reduce the energy consumption so that the resources can be utilized efficiently. Therefore, in this paper, we give a comprehensive state-of-the-art on various recent techniques and solutions which provide energy savings in smart homes and buildings. This includes statistical models, cloud computing based solutions, fog computing and smart metering based architectures, and several other IoT (internet of things) inspired solutions. We also present a hypothetical model that treats energy supply and usage in buildings as a self-managing energy system (SES). This paper is concluded by highlighting several open issues and challenges related to energy management in buildings


I. INTRODUCTION
Effective utilization of energy and usage of cleaner energy resources become highly significant due to the scarcity of fossil fuel. In this context, smart grid is an energy infrastructure used to better manage the processes of energy generation, transmission, and distribution. A smart grid allows two-way communication between all the stakeholders, thus, providing an effective mechanism for production, distribution, and consumption of energy. Buildings such as offices, shopping malls, and other infrastructures are the largest consumers of energy. Studies show that buildings consume almost 40% of energy in majority of developed countries [1]. This energy consumption is higher than industrial and transportation sectors. Furthermore, due to the limited industrial and transport sectors, the energy usage of buildings in developing The associate editor coordinating the review of this manuscript and approving it for publication was Lei Wang. countries is very high. Therefore, efficient use of energy and utilizing alternate cleaner sources of energy in buildings are considered to be the 'most important fuel' for solving the higher energy usage problem. The real-time energy usage information is extremely important for achieving the goal of energy conservation. This information helps in planning the energy usage in different hours of the day. The usage of alternate energy sources such as turbines and solar cells in buildings is also extremely beneficial for energy conservation and cost reduction.
On the other hand, the Internet of things (IoT) is a paradigm which is getting huge attention in the context of modern wireless communications. The basic idea is the connectivity of different objects through a network. The objects exchange useful information which is utilized to optimize the performance of the system. These objects include sensors, cell phones, vehicles, RFID (radio frequency identification) tags, etc. The coupling of smart grid with IoT makes a highly dynamic and efficient system for energy distribution and consumption. This system shares the information using the sensors and other similar objects for optimizing the performance and achieving energy efficiency. The network consists of embedded computing devices equipped with sensing and communication technologies organized together to achieve a common objective. The aim of this cooperation is to handle the complexity through collecting information and then using that information towards energy efficiency. The essential prerequisite here is the ability to interact and communicate with other objects. In many cases, this collaboration is application specific; however, the cooperation among heterogeneous devices can be supported by shared abstractions [2]. Moreover, the addition of cloud and fog computing architectures with smart metering would also facilitate the real-time energy management of IoT devices in buildings, thus, setting up a 'smart building infrastructure. ' Based on the above arguments, the focus of this paper remains on exploring various aspects related to energy management in smart buildings. At first, we dig into the recent work in the related area in quite detail. This includes highlighting various 'recent' smart solutions for energy management in buildings and houses covering the domains of statistical models, cloud and fog computing, smart metering, and several other approaches. This part of our paper contains most of the important and relevant solutions that have been proposed for energy management over the past five to six years (till 2020), respectively. It is to be noted that the main contribution of our paper is this Section (Section 2) where we summarize very important solutions for energy management in buildings. This section allows readers to compare fog computing based solutions with cloud computing and statistical models. It also highlights the benefits smart metering brings in conjunction with cloud and fog computing. To the best of our knowledge, a work covering all these domains together with smart metering has not been done in the recent surveys such as [3]- [9]. Most of these surveys are discussed in our forthcoming sections.
Later, we propose a framework capable of energy conservation and usage in buildings. This conservation of energy does not necessarily mean obtaining the optimization by interfering the normal day-to-day operations of a building's residents, but, we hypothesize that in order to conserve energy, the energy supply and usage in buildings must be treated as a self-managing energy system (SES). An SES in buildings will be able to get goals, priorities, and constraints from the consumers. Using this information and information on the energy supply and demand at the grid-level, our SES will optimize energy usage. If an alternate source of energy such as a solar cell, wind energy or a PHEV (plug-in hybrid electric vehicle) is available, then our SES will be able to incorporate it seamlessly into the system. To control heavy electric devices such as air conditioners, the proposed SES will use a home area network (HAN) to communicate with the devices and set the usage appropriately. This HAN will be designed using the concept of IoT. It is noted that our design is at the hypothetical level and its implementation and testing will be done as a part of our on-going and future work. With our proposed idea of SES, we plan to achieve the following key benefits in future: • Allow consumers to state goals, priorities, and constraints on energy usage in a typical building to automatically plan the energy usage through controlling devices.
• Make the consumers aware of their energy and cost savings by modifying energy usage patterns.
• Design a localized low-cost HAN for controlling heavy duty electric appliances for energy conservation.
• Be able to seamlessly integrate alternate sources of energy such as solar energy in the overall energy systems of buildings. In addition to above, we also highlight some open issues and challenges related to energy management in buildings and smart homes. The rest of the paper is organized as follows. In the next section, we provide a detail state-of-the-art on recent approaches for energy management in buildings and homes. In Section 3, we present our hypothetical solution. Section 4 lists the important issues and challenges related to energy management in buildings. Finally, Section 5 concludes this paper. In addition, Table 1 shows the list of acronyms and abbreviations used throughput the article. . These approaches are mainly categorized in statistical models, cloud computing solutions, fog computing and smart metering based designs, and other relevant solutions, however, some references may belong to more than one categories (ex. Ref [22] belongs to Sec A. and Sec. C, respectively).

II. ENERGY MANAGEMENT IN SMART BUILDINGS AND HOMES: RECENT TECHNIQUES AND APPROACHES
A number of approaches has been proposed to minimize the energy consumption in smart environments. Often these problems are formulated as the optimization problems with objectives such as determining the power flow values while minimizing the cost of the system. For the sake of simplicity and as shown in Fig. 1, we have divided the existing architectures related to energy management in buildings and homes in four broad categories such as A) statistical models with energy usage as the prime parameter, B) smart metering and fog computing based architectures, C) approaches based on real implementation of IoT architectures in buildings, and D) other general solutions based on data mining, software-defined buildings and so on. Considering the scope of this paper, in this section, our focus mostly remains on research works presented from the year 2017 onwards, however, we have still cited some important references from year 2014-2016, respectively.

A. STATISTICAL MODELS FOR SMART BUILDINGS
A famous approach named as 'dayfilter' has been proposed in [10] which uses symbolic aggregate approximation [11] (SAX: a time series data mining technique) to categorize energy usage of various buildings into frequent and infrequent patterns and later making these patterns humanly visible using the VizTree tool. Practically, the energy usage patterns from a school building and an office building are examined over a period of 407 and 474 days, respectively. The extracted patterns reveal several important findings such low energy usage during normal office hours, higher energy usage during extracurricular activities at the school, certain abnormal energy consumption by the air units at night time, and so on. All these finding and results can help the school and the office administrations for distributing the energy (such as daily cooling) according to the actual need. The dayfilter approach is quite promising and the authors presented numerous results and discussions to prove the efficiency of their proposed solution. However, as specified in [12], the time series analysis may seem far from applicable to smart buildings due to the uncertainties (such as nonlinearity) caused by the huge amount of data generated by these buildings. Likewise, the authors of [13] also provide an interactive interface for users to check a building's energy usage and look for any irregularities in overall energy consumption. These usage patterns and possible irregularities are communicated to the system analyst based on the generalized additive statistical modelling [14]. Though the design presented in [13] is quite promising, the paper still needs further details on how the statistical models were applied to the building. Moreover, the work presented in [15] is based on similar concepts as [14] but for forecasting a building's gas usage patterns.
In [16], the authors use the SAX technique to monitor the daily energy usage of buildings. Basically, SAX allows the building's data to be categorized in the form of number of time windows which shows a simple representation of complex big datasets. In its core, the authors propose an enhancement to the basic SAX technique where they apply regression models to first generate the time series with unequal energy values and later, separate the ones with abnormal variations. These separations can help experts to identify the energy related anomalies at an early stage thus, preventing any mishaps/accidents in the buildings. Extensive simulation results are presented in terms of energy demand and usage to support authors claims. In [17], SAX is used in combination with gradual pattern mining (a data mining technique) for symbolic representation of buildings data and extract significant variations in data, respectively. The experiments are performed on a dataset collected from a building in Hong Kong with several staff offices and laboratories in it. Through tabular representation, the authors claim to achieve knowledge efficiency in big data (BD) processing however, no graphs were provided nor any comparisons with other approaches were performed to support their claim. SAX is also being used in [18] to detect energy anomalies in buildings by examining the thermal images. We summarize the main points of [18] and other mentioned approaches in this section in Table 2.
Slightly different from above, the work presented in [19] defines a smart building as a collection of many sensors which monitors the energy related activities of individuals in a building. This sensory data is then collected by the actuators which in turn send all the necessary information back to the centralized controlling point. Theoretically, the paper discusses various important factors that are required in statistical decision making such as sampling, aggregation, segmentation, time span, imputation, etc. Through collected data from various buildings, the authors conclude that the sampling time should vary from 60 seconds up to an hour based on the users comfort in a building. Unfortunately, despite such a long discussion in the paper, no other point was highlighted. An approach inspired by [19] is presented in [20] where case based reasoning (CBR) analysis has been applied for building management with swarm intelligence. The statistical results from the CBR are then passed to a SCADA (supervisory control and data acquisition) home intelligent tool which adjusts the energy values according to an acceptable threshold. Extensive simulations are performed and compared with similar approach presented in [19] considering a real-life case study of a home with four habitants. The results are promising which show the significant energy reductions the proposed approach might achieve in the future. CBR and SCADA are used in conjunction with multi-agent systems (MAS) based societies in [21]. The MAS can model the energy usage on different parts of a building and share it with other agents to create an energy usage model for the entire building. Likewise, in [22], the energy usage of a smart home equipped with sensors is considered with swarm intelligence embedded in the fog nodes. This model continuously monitors the energy consumed by various appliances inside a home and generates an alarm to the consumer if an abnormality is detected. The authors present extensive simulation results to validate the accuracy and timeliness of their proposed approach. In [23], the authors use graph theory and clustering to characterize a building's various temperature ranges. Famously used Gaussian mean model is applied to determine the size, mean, and standard deviation of each cluster. Later, an IoT slicing algorithm is designed to control the high temperature values. The algorithm works by getting the temperature values from a building's control room as an input, determining the state on IoT node (ex. functional or failure), and controlling the temperature based on the coalitions formed by various IoT nodes using game theory. Despite proposing an interesting temperature controlling approach, the authors did not present the comprehensive experimental results to validate the efficacy of their algorithm.

B. CLOUD COMPUTING FOR ENERGY MANAGEMENT IN BUILDINGS/HOMES
Cloud computing and energy management in buildings go hand-in-hand since cloud is an important source for storing and managing building related information especially when most parameters are real-time. As elaborated in [24], cloud computing is the availability of computer resources whenever needed by the users. These resources may include data storage and computing power, however, all these resources are not managed by the user directly, rather they are provided by a third party as a service. Cloud computing is an indispensable asset when it comes to non-native computer support due to which it has gained huge amount of attention in the recent years with its integration in energy management systems (EMS) for buildings and homes with the goal of power conservation.
Related to above, the authors of [25] implement an IoT system to monitor and control the appliances in a household. This system is implemented within the confines of a local network where a central resource management system inside the house is used as a cloud service. The paper makes an argument about the wastage of energy in a household when appliances are left unsupervised and based on this argument, an IoT system is proposed that controls and monitors all the appliances in a house. The appliances are turned off when there is no human activity inside the house, hence, the 'energy saving'. Moreover, the authors utilize the received signal strength indicator (RSSI) to localize individuals inside the house without the use of any specialized hardware. In contrast to [25], the work presented in [26] discusses the limitations of locally hosted cloud for energy management in terms of limited computational resources, thus, favoring the offsite cloud platforms that provide heavy computational power.
The main contribution of this paper is a gateway design that is used to integrate all the sensors within the LAN of a smart building to the cloud service with the support of a network address translation (NAT) layer. Though, the authors of [25] and [26] provide good reasons for using locally hosted/offsite cloud servers, we still believe that the usage of locally hosted cloud services for small households is not a good idea due to the cost and the maintenance issues. Moreover, neither of the papers shows any results depicting energy conservation of households.
The authors of [27] implement the famous heating, ventilation and air conditioning (HVAC) system inside a house where an Android application is used by the consumers to view the energy consumption over time allowing them to control the appliances accordingly. The Android application fetches its data from 'Amazon Cloud Services' cloud platform where all the sensory information is uploaded from the home network. Likewise, in [28], the authors take a real-world approach to designing an IoT system that controls the HVAC within a building. This type of a control is implemented by dynamically changing the network architecture and accommodating new sensors and actuators to the IoT system without changing the system manually. The main contribution of this work is to develop a learning mechanism deployed on a cloud platform that learns about the important appliances (along with their related features) within the building. This system then turns an appliance on or off based on its importance and energy usage helping users to conserve energy as can be seen from the results presented in the paper. In [29], a method to calculate an automatic thermal model of a building is proposed based on the temperature data over a period of time (such as the summer season). The proposed model provides the users with different thermal zones within a building which can be targeted specifically to automate the HVAC system. The authors define this method as the ''plug and play'' because smart thermostats monitor the temperature data and process it on a cloud platform. Also, the thermal model is configured without any human intervention.
Above, we discussed cloud-based models for a single building or a house, however, such cloud integrations are not hard to manage. The difficulty arises when we have to deal with an entire city or a collection of buildings where the handling of a large amount of sensory data and controlling buildings simultaneously become the major challenges [30]. These types of issues have been dealt in [31] and [32]. In [31], the authors monitor multiple buildings at the Tunghai University through smart meters (to be discussed in our forthcoming section) and they use the famous Hadoop system to process the large amount of real-time data on a cluster computer. Hadoop also stores the sensory data on a distributed storage, therefore, improving the data capacity. In contrast, the authors of [32] do not process the data in real-time, rather, the buildings data is used to train an intelligent system that learns patterns and makes predictions to control the appliances. The system is trained and it is available from a cloud platform. The proposed model is implemented on a library building in the South China University with an overall energy saving of almost 35% compared to previous readings. The authors claim that their system can be deployed on multiple buildings without any major architectural change. Similarly, in [33], another automated cloud-based generalized method is introduced where a smart building template is created which can be used on multiple different buildings, however, no concrete results are presented showing that the proposed approach can also result in optimizing energy on several buildings.
Majority of the consumers of electrical energy are houses and the literature pays great attention to techniques used to conserve energy in these homes. In [34], a technique is developed that detects an appliance's activity through a single energy meter. The authors hypothesize that every appliance has a unique fingerprint associated with it which is appliance and context based, thus, in order to differentiate between different appliances, a novel approach known as the fingerprint weighting k-neighbors nearest (FWKNN) is introduced. The algorithm is implemented on the cloud and it outperforms other benchmark methods. Similarly, the technique discussed in [35] focuses on the household appliances and switches them on and off during the hours when the electricity is charged at high rates based on the information provided by the cloud. The solutions presented in [34] and [35] require a great deal of preparation before the smart building system is implemented, therefore, the authors of [36] take a minimalistic approach in making a building 'smart' by only automating a single wall socket. Different stats of the electrical sockets are then collected over time and made readily available to the consumers via an Android application that fetches data from a cloud service, respectively.
Most of the above cloud-based solutions focus on energy saving at the consumer side, however, the production side can also save energy by observing the patterns in the energy consumption and making changes in the power generation accordingly [37]. Related to this, in [38], a scheduler is used to switch between the power grid and the local energy storage facilities to manage the energy load inside a house. The scheduler is a bi-level quadratic optimization of a convex function. The power usage is uploaded to a cloud platform, which is then used by the utility companies to shed the electrical load when most houses are operating on the local energy storage. Likewise, the method proposed in [39] takes the load from the power grid using a smart city cloud controller (SCCC) and encourages the use of renewable energy, respectively.
The literature discussed in Section II-B uses cloud computing to complement the smart building components by adding automation in buildings/homes energy consumptions. Though, we briefly highlighted the idea for each of the above schemes, we still believe that a clear understanding is needed to list the important findings from the above mentioned solutions, which are summarized in Table 3.
Above we discussed some important cloud-based solutions for energy management in buildings and homes. The benefits offered by the cloud can further be enhanced if the intelligent metering is introduced in capturing the data and additional intermediary 'fog' nodes can be added to quickly process the information with improved security and reliability. Our next subsection is thus based on the inclusion of fog computing and smart metering for energy management in smart environments.

C. FOG COMPUTING AND SMART METERING BASED ARCHITECTURES
Before detailing various solutions related to this subsection, let us briefly explain the concepts of fog computing and smart metering. Basically, fog computing (as shown in Fig. 2) is considered to be an added layer in modern day storage networks having its tight coupling with cloud computing and IoT. According to the facts mentioned in [41], fog computing is a layered extension to the cloud computing environment combining the traditional coordination and efficiency features of cloud with additional security, reliability, and scalability in communication and data storage. As specified in a famous blog [42], fog computing solves the problem of what data to be processed at the local edge and what data to be sent to the cloud for storage. All these prominent features (such VOLUME 9, 2021 as convenient storage, fast information retrieval, security of information, etc.) make fog computing a suitable candidate for building management systems. Smart metering, on the other hand, provides accurate and real-time energy or gas readings to all the connected parties such as consumers, suppliers, regulators, and other concerned authorities. Smart meters are highly beneficial for energy management in buildings, since the consumers can continuously monitor their energy consumptions allowing them to adjust the power usage at homes accordingly. This can significantly reduce their monthly/annual bills. We show a smart meter (SM) with its important features/benefits summarized in Fig. 3. The advantages of fog computing can be combined with data collected from smart meters to provide consumers and suppliers with better energy management in buildings.
In regards to above, several efforts have been made to exploit the benefits of fog computing and smart metering (separately) for energy management in buildings. The authors of [3], presented a comprehensive survey detailing all the papers related to fog computing in smart homes/buildings from the year 2014 to May 2019. Basically, they divide the existing literature in the categories of resource management based and service management based solutions, respectively. In the former, the approaches covering points such as scheduling of tasks, provision of energy and cloud/fog based resources, and power/energy balancing are considered. In the latter, security, energy management, and privacy of information are examined. Since this survey already presents many important approaches related to fog based energy management in buildings and homes, therefore, in our section, we summarize only those important solutions which were either missing in [3], are most relevant to the current section, or have been published within last couple of years, respectively. Likewise, for smart metering, readers can refer to the following surveys [4]- [6] especially the work presented in [4] highlighting various smart metering based solutions till the year 2016.

1) FOG COMPUTING BASED TECHNIQUES FOR ENERGY MANAGEMENT IN BUILDINGS/HOMES
The authors of [44] believe that correct load prediction is very important for managing a building's energy, therefore, they propose a fuzzy logic based load filtering strategy. Basically, a combination of fog and cloud is used such that the fog layer collects and computes data from smart meters and sends this data to cloud for pre-processing and load prediction. The cloud data can then be sent to various computers running fuzzy logic based algorithms (such as fisher score, total feature weight, etc.) to exclude irrelevant features (ex. time, season, weather, etc.) from the data. In the result section, the focus remains on validating feature extraction strategies without the depiction of any results or betterments caused by the inclusion of cloud-fog based architecture. Another fuzzy-fog model is presented in [45] where fog layer acts as a middleware between cloud and edge layers. The data collected from the sensors using edge layer is processed at the fog layer using fuzzy logic which is referred as the reactive intelligence throughout the paper. Here the fuzzy logic is applied on different temperature readings and light levels, for instance, the temperature can either be hot or cold in normal circumstances but fuzzy logic can provide different observations about the temperature by categorizing it in slightly hot, pretty hot, very hot, and similar other readings. The authors further perform extensive simulations considering a simulated smart home and a real smart home to prove the energy efficiency of their fuzzy-fog architecture, however as stated in the paper itself, the idea still needs to be tested on more than one homes or an entire building which may significantly change the energy efficiency values achieved by the proposed approach.
Unlike above, a totally different game-theoreticalcloud-fog approach is presented in [47] where several houses in a building are considered to be game players having pay-offs of energy surplus. This work is basically an extension of authors previous work in which they considered only the homes-coalition scenario, in contrary to this work, where the homes can communicate with or without forming coalitions. Fog is basically used to handle energy related issues such as price and maximum generation limit. To balance the supply and demand of energy, the houses having surplus power form coalitions with those in deficit which is shown via extensive experimental results. The results also conclude that processing time and memory resources augment with increasing number of homes, therefore, fog layer's incorporation is a must. Nevertheless, the benefits of including fog in the proposed game-theoretical model are not shown in the results. In addition to [47], the same group of scientists have published several other articles on smart homes with fog computing (such as job scheduling based solution in [48], greedy algorithm based approach in [49], an MAS-based genetic algorithm in [50], and many others), therefore, the interested readers can refer to these researches if required. Likewise, another game-theoretical model is provided in [51] where a multi-leader-follower game approach is used to model the interaction between energy providers and consumers as game players, however, fog computing is not addressed in this paper. The same group of authors used the game-theoretical approach combined with fog computing in [52]. The idea is to develop a cooperative game where each game player (a smart home here) shares its energy usage schedule with other players with the goal of decreasing the energy cost of all the players. The fog layer is introduced for energy scheduling which incurs less delay compared to the cloud computing layer as shown in the results section. Another similar concept based on swarm intelligence combined with fog computing is addressed in [22] which has already been discussed in Section A.
In [53], an interesting novel concept is presented where two additional layers such as fog-computing and cloud-computing layers are added in traditional TCP/IP model. These additional layers add flexibility to a smart home environment by providing lower latency and real-time processing of consumer data. The fog computing layer is equipped with sensors for data concentration at the edge. Likewise, the cloud computing layer handles the huge amount of BD that cannot be dealt at the edge. The authors test their layered architecture on famous SSH (smarter safer home) and AAU (Alborg university) platforms which allow them to graphically represent consumers behavior, energy consumption of appliances at a home, temperature values, and other related factors based on the data collected via various temperature, power, and motion sensors, respectively. The authors believe their proposed architecture can be used in future to provide unlimited storage and scalable processing of smart homes BD compared to traditional smart home architectures which are limited in storage and processing capabilities. Likewise, in [54], another cloud-fog combo is presented where the fog layer combined with an edge layer collect and process the initial readings (such as the room temperature, hue light bulbs with different colors, and gas measurements) generated from various sensors in a building. These readings are then transferred to the cloud layer for further analysis. The authors prove the viability of their design using a real-time environment with various deployed sensors and the implementation of edge and fog layers at Raspberry Pi. Two algorithms are proposed to collect data from sensors at edge/fog layers and later to distribute this data to cloud for further analysis. In results section, it is evident that the latency remains lower when the cloud-fog combination is used compared to the traditional cloud model. Different from cloud-fog based approach presented in [53], a fog-to-fog strategy is delineated in [55]. The name fogto-fog comes from the fact that there are multiple horizontal layers of fog handling most of the sensory data processing and storage. Cloud is only accessed to report an anomaly in the building reducing the burden on clouds, hence the latency. The authors test this multi-layered architecture on a real-world environment by deploying almost 50 temperature sensors on an office floor. Through graphical representation, a heatmap of various sensor readings is shown where normal and abnormal temperature values are identified with different colors. An abnormal condition is considered when the temperature exceeds a certain threshold value (ex. the mean value of all sensors). Due to multiple fog layers and proper sensor placement, the proposed algorithm achieves higher prediction efficiency than traditional heuristics approach. The authors of [56] on the other hand keep their focus entirely on fog-based building energy management (BEM) system without going into the details of cloud computing. The idea in [56] is to use time series analysis to predict a consumer's hourly energy consumption by making her aware of energy usage and expected price ranges. Time series analysis enables this energy forecasting based on calculating variance, correlation functions, and additive forms. The next step is to identify a set of appliances which consume most energy based on discriminant analysis. The authors further introduce the concept of a fog router on which the discriminant analysis can be performed and the results are stored, however, this claim seems only hypothetical and no results are shown to highlight the cons this fog router can bring to the proposed model. Another hypothetical model is proposed in [57] where fog computing is used for energy optimization of a university campus. In such an environment, fog layer can get data from several light, air conditioning, and water sensors to propose optimized results.
Above, we have presented several solutions which combine the benefits of fog computing with fuzzy logic, edge computing, game-theory, and multiagent systems in order to smartly allocate energy in buildings and homes. These benefits can be further fruitful if the fast and efficient computing power of fogs is combined with the data generated by various smart meters. Several efforts such as [58], [59] discuss the smart meters in conjunction with fog computing however, the emphasis of these papers are not really on designing a fog-SM combined architecture. These approaches rather focus on privacy and security issues in smart environments. Thus, further research efforts are required in future to design a fog-SM combined solution.

2) SMART METERING AND ENERGY MANAGEMENT IN BUILDINGS/HOMES
A number of approaches is available with various SM designs and consumption estimation techniques. In [60], separate meter designs are proposed for consumers and power distributers which are connected to a SCADA monitoring system using PLC (programmable logic controller) hardware design. The smart meters (SMs) contain a sensor unit for getting the energy readings with a mobile display. The authors design has been tested in a real environment taking temperature readings from a conference room situated in a building, however, the main focus of the work remains on highlighting the hardware aspects of SM without having a comprehensive discussion on obtained results. In [61], a SM is shown to communicate energy price values with the HEMS (home energy management system) using a LAN, however, the focus of the paper remains entirely on energy optimization without highlighting any special architectural or design aspects of smart metering. Additionally, a very interesting idea of changing consumers perception and understanding of energy values is presented in [62] where consumers behaviors are analyzed based on different feedbacks displayed on their SMs. These feedbacks range from normal energy consumption (in kWh) plus unit price to comprehensive readings with prompt messages such as If you reduced the thermostat temperature in your house one degree you would save 11 kWh; this is equivalent to £1.43. Through comprehensive analyses and feedback from users, the authors show that the SM readings with simplified feedback result in reduced energy usage. Likewise, a similar consumer-based survey-like approach is delineated in [63] where the SM data of several homes is analyzed to see the impact of the air temperature on consumers energy usage. Though, the paper does not contain any novel feature or design for SMs, it still presents some interesting set of results showing consumers energy consumptions based on the house's structure, quality of heating/cooling equipment, consumers in-house habits, monthly income, and so forth.
In [64], the SM data collected from over 500 homes has been analyzed and classified into different categories (such as average morning consumption, peak of consumption, etc.) using the Random Forest classifier [68]. This extracted data is correlated with weather data (ex. wind speed, precipitation) to see the impact of certain weather conditions on average user's electricity consumption. Through extensive simulation results, the authors prove that a timely extraction of SM data leads to better energy predictions and thus, increases the economic viability of household consumers. In [65], again the Random Forest classifying technique is used however, the focus mainly remains on developing a flexible SM architecture to predict a small building's energy consumption. This work basically focuses on the design of an SM therefore, the OSI (open system interconnection) layer model has been adjusted to show the link between the consumers, the providers, and the cloud service using Zigbee. The readings from the designed SM are then used to depict consumers energy usage patterns e.g., high energy consumption during office hours etc.
Somewhat similar to above, the work proposed by researchers from Stanford University in [66] correlates data from SMs with weather conditions using Quantile Regression modeling. This type of modeling is chosen to better understand the relationship between a building's energy consumption and its explanatory variables (such as the average household income). Through SM data analysis of almost a year, the authors are able to derive the twelve most frequently used variables (ex. standard temperature, average household income, and several others) and measure the percentage impact these variables have on consumers energy usage. Likewise, the work in [69] uses highly comparative time-series analysis (HCTSA) to differentiate energy consumptions and other factors such as electricity breakouts and failures between residential and institutional (ex. lab) buildings. HCTSA can prove to be an affective technique for SM data categorization which is shown in the paper using various model charts and heating/cooling maps. This work however only focuses on monitoring daily energy consumption of users which can further be refined (in future) by extracting more important features from SM data such as weather conditions as done in [64] and [66], respectively.
Slightly different from above, in [67] an energy anomaly detection model has been proposed by collecting the data from fifty different SMs. An anomaly here is termed as an unexpected condition which is unlikely to happen in majority of the meters but it is reflected in some meters (e.g., a certain increase in energy consumption of a few SMs when all others show a decrement pattern) and therefore, detected using the heuristics approach. Extensive simulation results have been provided to show energy anomalies during different times of day, month, and year and these results are later discussed with building's administration for future rectification.
Some researchers have also used clustering methods such as K-means clustering [70], [72] to classify and arrange data received from SMs. In [70], the collected readings from an SM are grouped into different categories e.g., kitchen lights and AC in bedroom. Later, K-mean clustering technique is applied to group the appliances in their relevant cluster e.g., LED (light-emitting diode) lights belong to the least energy consumption cluster. Though, the presented idea is interesting and novel, it nevertheless does not discuss the SM aspect in more detail (SM is only highlighted one to two times). In [72], K-means clustering is used to group buildings according to their power consumption, however, the SM is used for the namesake and no real discussion/detail is provided for it. To further elaborate on grouping and analyzing SM's data, in [46], an interesting pre-screening approach is presented. In this work, the SM is screened through five different methods exploring consumers energy usage based on frequency of usage, days, weeks, and outside weather conditions. This data is then analyzed through extensive simulation results to look for opportunities for possible energy savings. The work presented in [46] is simple, quite comprehensive, and easy to understand and thus, can set the benchmark for upcoming SM data analysis strategies in future.
Different from above, in [71], an SM is designed using fuzzy logic with the objective of minimizing consumers cost of energy provided with an increased security. The SM's design contains traditional LCD (liquid crystal display), buttons, power supply, and serial port modules with the WiFi connectivity. This design is then implemented and tested in a real laboratory with the support of a complete equipment such as switchboards and storage modules. Fuzzy rules are then applied to the designed hardware in order to manage users energy consumption and production. The paper also highlights simulation results showing the difference in average daily load with and without the inclusion of proposed SM, however, these results are not very well-explained and need further analysis.
We summarize the main points of all discussed techniques in this section in Table 4. It is to be noted that most of the techniques discussed in this section can also be included in Section A since they are based on smart metering with mathematical and statistical analysis, respectively.

D. OTHER RELEVANT APPROACHES FOR ENERGY MANAGEMENT IN BUILDINGS/HOMES
Several researchers have explored energy management in buildings and smart homes considering the domains of big data (BD) analysis, data science and artificial intelligence (AI), general IoT, and many other areas. Considering the scope of this work, we cannot detail all the articles here, however, since these domains are quite famous and common, therefore, many survey related works exist in literature summarizing the usage of aforementioned domains for energy management in buildings. Thus, in this subsection, we summarize some important survey related works related to the above mentioned topics.
Starting with BD analysis using IoTs for buildings and homes, a promising survey is presented in [73]. The authors categorize BD in four important areas such as storage, cleansing, analysis, and visualization and examine the impact these four factors have on IoT domains such as healthcare, building automation, and smart cities. In contrary, the survey in [74] explores the advantages of BD and AI for energy management in buildings. This paper highlights related works on usage of AI and BD for smart walls, intelligent architectures, temperature control and power management, advance energy forecasts, solar energy, and several other aspects till the year 2019, respectively.
In continuation to above, AI and data science related algorithms have widely been explored for energy management in buildings and various important survey related papers are available in literature. The work presented in [75] discusses applications of data science for energy management in buildings. Data science techniques such as regression, clustering, and sequence exploration are examined for energy prediction, failure prevention, load balancing, and fault detection in buildings till the year 2017. In [76], a comprehensive review is presented detailing various approaches for modeling the energy usage of buildings from the year 2010 to 2018, respectively. The paper includes a comprehensive discussion on various steps involved in converting a building's geometrical design into energy related design. It also lists certain tools and algorithms which can perform the aforementioned conversions such as the geometry simplification tool (GST), EnergyPlus. common boundary intersection projection (CBIP) algorithm, and several others. Slightly different, the survey presented in [77] highlights numerous data science techniques for energy forecasting in buildings specifically those related to machine learning till the year 2019. These include the grey and white box approaches (using the laws of physics to forecast energy consumptions), the time-series solutions, and some hybrid machine learning techniques. The authors of [77] conclude that most of the existing machine learning approaches focus on commercial and educational buildings with less number of solutions for residential buildings. Thus, more research is needed for residential buildings. Moreover, they also highlight certain limitations of machine learning techniques (such as lack of generality, too much data to deal with, etc.) and stress on relying on physics-related parameters instead of time-related ones to develop optimized solutions for energy management in buildings such as the one presented in [78]. Similarly, the work in [79] surveys more than 200 research articles considering the usage of renewable energy sources (ex. solar, wind, geothermal, etc.). The authors perform a thorough analysis of various renewable techniques till the year 2020 by dividing these approaches in machine learning, artificial neural networks, and ensemble based approaches, respectively. The findings of this survey paper can set benchmarks in renewable energy forecasting and usage in buildings and thus, provide researchers with a comprehensive viewpoint in choosing the right data science model.
Related to fog computing for energy management in buildings, we provided a comprehensive discussion in subsection C, however, there are not many survey related papers on this topic. The only detailed recent survey we found is the one proposed in [80], but this paper details fog computing related solution for smart cities. Energy management in buildings is considered only as a small part under the ''application classification'' section where the authors highlight two related solutions. Thus, our subsection C contributes to the existing literature on fog computing for energy management in buildings by summarizing numerous novel, important, and valuable solutions.
Some very interesting surveys also highlight the general IoT-based solutions for energy management in buildings and homes such as [81], [82], and [83] published in years 2017, 2018, and 2019, respectively. In [81], the authors keep their focus on IoT's implementation in smart homes mainly considering the networking and the interoperability issues of smart devices. Different approaches from the year 2010 to 2016 have been summarized. The energy and consumers utility management perspectives have also been discussed, but not in detail. The survey in [82] focuses on IoT's applications in smart grids by exploring the research till year 2017. The paper also elaborates a four-layered grid model focusing on application, management, gateway, and connectivity aspects of energy management in IoT based smart grids. In [83], the importance of IoT and its applications for energy management in buildings is discussed in greater detail. The authors thoroughly elaborate on the essence of the application, network, and perception layers for building management. Later, various IoT related research efforts in different building types such hospitals, museums, apartments, office buildings, and several others are discussed. These works focus on aspects such as energy and facility management, resource tracking, and comfort enhancement. The authors highlighted open issues related to IoT security, data acquisition, and lack of communication between researchers and building industry, which we believe are equally important for energy management in buildings with or without the inclusion of IoT support. Other than IoT, readers can also refer to the recent surveys presented in [84], [85] and [86] based on modelling building information and data, energy optimization, cost minimization and residents comfort, and key factors (climate and users response) for energy optimization in buildings, respectively. Fig. 4 shows the main components of the proposed selfmanaging energy system for smart buildings. The micro grid is the central module, which is responsible for taking the distribution decisions. It also represents a small-scale set of loads, which is localized on a specific feeder of distribution network and capable of meeting some or all of its demands through small-scale generation sources such as solar cell, wind turbines, photovoltaic panels, micro-turbines, and diesel generator, respectively. The micro grid is composed of several other energy components such as the distributed energy sources and the load controller. By integrating these two VOLUME 9, 2021 components in the distribution network, the micro grid is able to operate in different modes. Moreover, it facilitates in storing the surplus energy generated through different renewable sources, which can later be used during peak timing. Micro grid is designed as an off-grid or stand-alone structure or a single connected grid. Three typical issues in a micro grid are security, efficiency, and power quality. The energy demand variations in smart buildings make the aforementioned issues even more complicated. However, the incorporation of IoT may help in resolving these problems. The real essence of using a micro grid in our proposed design is to have a centralized module capable of an integrated information flow, simplified flow of day-to-day operations, and analysis of the power distribution system.

III. PROPOSED HYPOTHETICAL SELF-MANAGING ENERGY SYSTEM (SES)
The second component of the architecture is forecasting and optimization. The generation and storage along with the energy consumption in the micro grid creates a very sophisticated architecture. It is very important to predict the supply and demand for maintaining energy balance and providing the required services. Forecasting (or energy forecasting) is performed at different intervals and acquired results are provided for optimization module in the same block. Due to the dynamic nature of demand in smart buildings, the forecasting process becomes rather more challenging. Though, as specified in our previous sections, there are several models available for forecasting based on historical data to mathematical models, however, in order to analyze and manage large complex networks efficiently, the forecasting should include the detailed weather integration and the load profiling. Our forecasting module can also predict micro grid's renewable generation. The incorporation of IoT improves the control over of the grid components and can take the characteristics of all sources into account for the whole system generation. This led to the improvement of power system performance as well as an effective use of renewable energy resources. Based on forecasting control, the energy related decision making is required to optimize the flow by adjusting the power imported from the grid. Typical example of optimization decisions includes the demand response and the emery/power management. In addition, the data from buildings and homes must be analyzed properly, providing insights to better understand the characteristics of energy activities.
In case of several connected grids, the security can be compromised due to reciprocal stability. Therefore, an IoT enabled network must be used to collect data from the available sensors and process the data to obtain the real-time state of the critical parameters.
Another important element of our proposed model in Fig. 4 is the integration of the metering infrastructure. This component is an integrated system of smart meters and communication networks, which enables a two-way communication between the utilities and the customers. The system provides several important functions, such as the ability to automatically and remotely measure electricity use, connect and disconnect service, detect tampering, identify and isolate outages, and monitor voltage. This system is integrated with several customer technologies such as the programmable thermostats and the in-home displays. Advance metering infrastructure (AMI) is one of the modules in this component. It provides incentives and programs to the customers for managing their energy usage and reduce the peak demands.

IV. ENERGY MANAGEMENT IN BUILDINGS: OPEN ISSUES AND CHALLENGES
The common objectives of an EMS in smart buildings is to reduce the energy consumption and decrease the greenhouse gas emissions. However, changing weather conditions greatly effects the overall efficiency of the EMS [87]. The authors in [88] suggested a 34% decrease in the heating demand while 72% increase in cooling demand by at the end of this century. Therefore, it is very important that an efficient EMS must be scalable, secure, cost effective, and reliable [89].

A. SCALABILITY
The concept of scalability in the context of smart buildings refers to the ability for extension. This extension includes adding new modules and different devices in the building. It is extremely important to ensure the power quality of the EMS when new services, applications, and devices are added [90]. A non-scalable EMS cannot handle the expansion and thus, will become unreliable and need a replacement in future. Therefore, with the increasing number of consumers and demands, the EMS in smart buildings must be scalable [91].

B. SECURITY AND PRIVACY
The concept of security and privacy are inter-related. If the level of security is poor, the EMS is vulnerable to unauthorized manipulation and consumers privacy will be affected. Due to the lack of common standards for IoT security in smart buildings, it is very difficult to guarantee a high level of privacy and security [90]. One of the essential components of an IoT-based EMS is data collection and analysis. This data is mostly collected in the form of energy consumption and maintenance over regular intervals. After analyzing the collected data, decisions are made regarding the efficient operations in the buildings. Although an advanced data management system can be used to measure the building's energy performance, the presence of a common IoT-based security standard would still be mandatory. Furthermore, in [92], the authors suggest the most essential security requirements are information integrity, mutual trust, and authentication.
Apart from security, privacy is also very important to ensure users trust on EMS. Usage of smart devices with personal and sensitive information requires strong privacy protocols to protect customers private information [93]. Generally, there are three key areas relevant to privacy challenges. These are personal privacy, privacy-preserving data mining, and underlying privacy of used technologies. Standard regulations must be followed for these three aspects. Furthermore, the limitations in IoT sensors' capability make privacy and security issues more complicated meaning that the sensors cannot handle the complicated security protocols. This challenge is mentioned in [94] where the authors suggest to design a public-private key for the IoT security.

C. PERFORMANCE MANAGEMENT
IoT-based smart buildings consist of billions of internet based devices. The management of these devices must be done through a system, which ensures proper fault detection and tolerance. Thus, it is very important to have a service that manages the communication between the IoT devices, their configuration, and the accessibility of different user levels [95].

D. COST EFFECTIVENESS
There are several costs associated with energy usage in smart buildings. These costs include devices, operating cost, technological services cost, and maintenance cost. Moreover, since different sources of energy are integrated in an EMS, thus, there is an integration cost as well. On one end, the high cost of an EMS has a direct effect on the consumers. On the other hand, reducing the cost by using cheaper material might effect the performance of the system. It is thus essential to maintain a balance between both. Currently, many IoT products for smart buildings and other industrial applications are expensive which is not really affordable for most private customers [88].

E. BIG DATA PROCESSING
The higher volume of data in IoT-based systems demands an efficient handling and processing. It is not practical to use the traditional methods and tools for data processing. In IoT-based smart buildings, the real-time data is collected and processed to facilitate the decision making process. Therefore, modern methods and tools are required for processing [96]. Some of these tools used local processing of data. Devices are aware of the state of the main server and their neighbors making it possible to save more network bandwidth. In addition, by using the localized algorithms, it is possible to deal with huge amount of big data, as it is mostly processed locally [96].

F. A UNIVERSAL ENERGY ARCHITECTURE
The typical architecture of an IoT-based EMS consists of three layers [97]. These layers are application, network, and perception, respectively. The application layer receives the data from the network layer and processes it to provide the desired services. The network layer acts as a communication layer between the application and the perception layers. The perception layer is responsible for collecting data from various deployed sensors and actuators. This type of a structure is commonly used due to its simplicity and ease of deployment. However, some new architectures have been proposed with some additional layers and features. For example, the security is added as an important feature in these VOLUME 9, 2021 new architectures [98]. Still, it is really important to design a general architecture for the EMS which can easily trade-off among system goals, components, and scale.

V. CONCLUSION
This paper is an effort to familiarize readers with several important factors related to energy management in buildings. In our work, we have tried to explain the most important research related to energy management in smart environments under one umbrella. This includes a detail state-ofthe-art section on statistical, cloud, fog, smart meter, and several other domains based solutions proposed within the energy management context. We have also proposed a hypothetical solution for smart buildings/homes which can set a benchmark for future researchers. In the near future, we will be focusing on implementing our proposed design on some local buildings and homes and extracting the important results which can show the impact of our design on energy savings and consumers cost effectiveness.