1. Introduction
The heating, ventilation, and air conditioning (HVAC) system provides thermal comfort and acceptable indoor air quality. It is the single largest contributor to a home’s energy bills, accounting for 43% of residential energy consumption in the U.S., and 61% in Canada and the U.K., which have colder climates [
1,
2]. There has been some research focusing on decreasing the energy consumption by 25% while turning off the HVAC system with nobody in the room [
3], resulting in
$15 being saved per month for the average U.S. household [
1,
2,
3]. Therefore, it is necessary to develop different communication protocols to save energy and optimize the HVAC system, including the Automation Control Network (BACnet), Modbus, Local Operating Network (Lon Works) and Lon Talk.
Our research objectives include two aspects: (1) to build a low-cost hardware/software emulation platform to show the use of occupancy sensors for building energy analysis; (2) to use deep learning algorithms to predict the energy load in the next time window, based on the collected sensor data.
Our research principle includes two aspects, detailed below.
First, energy consumption is one of the biggest contributors to global warming, and most energy use is due to human activity; for example, electrical heating for commercial and residential buildings can consume almost half of the total energy production. Therefore, it is critical to manage energy use efficiently to reduce the negative environmental hazards, including carbon dioxide emissions. Energy systems often do not have dramatic changes in load supply, which makes it possible to perform a prediction of future loads with small errors. Due to the importance of energy scheduling and allocation, load prediction has attracted much attention from researchers.
Second, wireless sensors are widely used to collect energy-related data (such as the number of people in the building) due to their low cost and low power consumption. However, the popular uses of sensors also cause some issues, such as higher wireless transmission delay, poor RF transmission quality, and higher energy consumption. Meanwhile, some problems arise due to the reduction in the cost of a single sensor, including sensing errors, missing data, etc. To recover or correct the abnormal data, some features should be extracted when the data is being preprocessed. With data pre-processing, the data collection process can be optimized and the correlation between features may also be reduced. Therefore, the energy prediction models should overcome the above data collection issues.
There are two main scenarios: energy saving control in (1) commercial or (2) residential buildings. These will be used to evaluate the performance of the communication between sensors and the HVAC system. A commercial building consists of multiple single offices and classrooms, while residential buildings refer to individual houses. Various sensors are used to analyze the occupancy numbers for each room. There are two communication methods including wired and wireless, with Ethernet or USB connection being utilized for the former, and Wi-Fi and Bluetooth being used for the latter.
The interactions between occupancy sensors and HVAC controllers have the essential features of a typical cyber-physical system (CPS): (1) Physical-to-Cyber: The physical objects (occupants in the building) should be calculated to control the temperature levels of the HVAC systems in real-time. Such physical parameters can be captured by using cyber units; for example, some hardware with computation functions could collect occupancy numbers in any region/room of a building. Moreover, both wired and wireless sensors can be used. In this case, any required physical status can be collected by different sensors and sent to an HVAC server in real-time. (2) Cyber-to-Physical: The cyber units can be used to change the physical world. The occupancy allocation or distribution may be figured out by processing the sensor data. Therefore, it is possible to modify the physical objects based on the collected cyber data. For example, the fan/air circulation levels of HVAC units could be tuned here.
The architecture of such a building CPS is shown in
Figure 1. Different sensors can be used to help save energy by controlling the room temperature efficiently. An occupancy sensor may consist of a timer, as well as a human motion detector. Some other sensors can measure CO
2 levels, acoustic signals, human images, and more.
However, the CPS emulators for the occupancy-sensor-based building energy control system are not available yet, and only some pure software-based simulators without hardware units have been built. In this paper, two hardware emulators are illustrated, and the Raspberry Pi wireless board is used as a communication platform between hardware units, such as PIR sensors, and the thermostat. Our emulation platform shows the CPS interactions with the HVAC/sensor communication control within residential and commercial building environments.
There are three features for our emulator designs:
First, different types of sensors, such as acoustic, CO
2, and PIR sensors, can be used in HVAC systems based on various application requirements. Wired, as well as wireless, communication links can be established here. Moreover, both analog and digital sensors are used for wired sensors. The sensors can send data back to the server through RF (radio frequency) waves or USB/Ethernet interfaces. Some wireless RF communication methods include Bluetooth, ZigBee, and Wi-Fi. Additionally, TCP/IP protocols are recommended for the use of communication between units. Compared with other products shown in
Table 1, our entire wired and wireless hardware platform is portable and has a lower cost. The occupancy data can be collected from different sensors.
Second, various sensor deployments are considered for different building layouts. There are several attributes to modify for the deployment styles, including sensor locations such as in the door, walls, or ceilings, sensor density, and deployment topologies, such as a chain, mesh, or grid structure. Moreover, the multi-hop data relay protocols will also be used among sensors for transmission between sensors.
Third, sensor data fusion/processing is important since we need to establish an intelligent building energy-saving control system. In this case, it is easy to learn the occupancy distributions based on the sensor data, which is analyzed by the deep learning model. Specifically, deep learning models are used to predict the energy-saving patterns for the HVAC control system. Meanwhile, the occupancy number can be calculated for every room, after which the control signals are sent to the HVAC system in real-time. The occupancy number estimation is based on the coverage sizes of multiple sensors and considers overlapped sensing areas.
Instead of processing all the raw sensor data, the data transformation models can be used to find the occupants’ entrance/exit trends. Therefore, data processing could collect occupant information more efficiently and be used in real-time after adjusting the HVAC control.
Two different emulators of the building energy-saving systems have been established. The whole process is shown in
Figure 2. The Raspberry Pi is utilized for the hardware emulator for real-time sensor data communication, as well as for aggregation functions. Afterwards, occupancy numbers are computed in the
residential building. In this case, we can also get the energy prediction of the house with the deep learning model, and its airflow and temperature can be real-time changed.
The second emulator utilizes the BACnet protocol in the commercial building. In this case, it is easier to send the data from the data center to the HVAC control center. Wireless communication between the data collection center and control server could also be established with the BACnet protocol.
After extracting the data, the main uses of sensors also cause some issues, such as higher wireless transmission delay, poor RF transmission quality, and higher energy consumption. Meanwhile, due to the reduction of the cost of a single sensor, some problems arise, including hardware failure, data transmission failure, missing data, etc. To recover or correct the abnormal data, some features should be extracted when the data is being preprocessed.
Due to some stability of the surrounding environment (such as temperature consistency in the same room), there exist some correlations among sensor data. However, it is difficult to extract useful characteristics from the correlated data if we just use conventional machine learning methods. Therefore, in this paper, we propose to use deep learning to extract the relevant features. In particular, the convolutional neural network (CNN) can be utilized to process different types of data. CNN has translation invariance by calculating convolutional characteristics among data.
In this research, both the sensor data and energy consumption data from smart meters in the building will be used to build a load forecasting model. Compared with traditional machine learning models, such as Decision Trees and Support Vector Machine (SVM), deep neural networks (DNN) can achieve better prediction performance due to their powerful pattern extraction capability from raw data without the need for data preprocessing. However, general DNN can only take the current input to form the predictions. Therefore, some time-dependent features cannot be captured by DNN. The recurrent neural network (RNN) can be used to create a directed graph among nodes so that it is able to capture the time dependencies. Such a directed graph can be used to connect current inputs together with previous inputs. Thus, RNN could capture the dynamic behaviors of data. Additionally, long- and short-term memory (LSTM) is an improved model of RNN. Cell structure is used in the LSTM, and three gates in the cell (i.e., input gate, forget gate, and output gate) are used to determine whether data is chosen or discarded.
LSTMs have the advantage in analyzing temporal behaviors, and a Sequence-to-Sequence LSTM (Seq2Seq LSTM) is introduced in language translation models for powerful context capture. The Seq2Seq model structure consists of an encoder LSTM and a decoder LSTM. In this structure, data is encoded into a fixed-length input feature vector by an encoder, while the output data can be generated through the decoder. To find the most relevant information for each decoder output, attention mechanisms are introduced. The encoder can use an attention model to compress the required data into a fixed-size vector.
This paper is an extension of our conference paper [
4]. It proposes the use of Seq2Seq LSTM with an attention mechanism for energy prediction. Seq2Seq LSTM is adopted for energy prediction and deals with medium-term data independence. The attention mechanism is used to obtain the most relevant information among input data. It can also ease the connection between the encoder and decoder.
Some major acronyms we used in this article include: cyber-physical systems (CPS); heating, ventilation, and cooling (HVAC); sequence-to-sequence long short-term memory (Seq2Seq LSTM); convolutional neural network (CNN).
The remainder of this paper is organized as follows:
Section 2 summarizes the background and related work,
Section 3 introduces two hardware emulators,
Section 4 describes our testing platforms,
Section 5 explains the deep learning model used in energy prediction,
Section 6 discusses the experiments and results to validate the efficiency of our scheme, and
Section 7 details the conclusions.
2. Background and Related Work
The thermostat became the pillar of energy conservation products shortly after its invention. A setpoint is utilized to control the temperature with its sensing results. There is already some research on reprogrammable thermostats to select the optimal setback schedule based on the historical data automatically [
5]. Nevertheless, these studies only show how to generate a static control schedule. There are still some conflicts for energy-saving and human comfort, according to the dynamic occupancy patterns in real applications with a static schedule. Therefore, the real-time sensor data may be used for dynamic control of the HVAC system with the current occupancy numbers.
There are also some studies on how to calculate the energy consumption status by using pure simulations (without any hardware in the experiments). In [
6], some energy-saving simulations are established, which uses a data-driven model to illustrate occupant behaviors. The work in [
7] shows the wireless camera sensor network deployment to gather the occupancy numbers. In [
8], the researchers demonstrate a statistical model on the temporal occupancy of a building using a heterogeneous Markov chain model, which uses the occupancy number gathered from a sensor network. In [
9], the concept of a smart thermostat is proposed to get the occupancy statistics.
Software emulators have been generated for both academic and commercial applications. In response to a run-time real case simulation and testing, hardware emulators and testing platforms are often established. FPGA boards are used with a run-time scheduling framework [
10]. Besides, FPGA is also utilized as a hardware emulator for a DC motor controller in real-time [
11]. Raspberry Pi might be the cheaper choice compared to others and can also be used for image processing and control systems. For instance, the Raspberry Pi board is also used for the face recognition [
12] and vision navigation systems [
13]. The Raspberry Pi based temperature monitoring system can be used to handle the MySQL data [
14]. Therefore, Raspberry Pi could be the emulation and implementation platform. It contains a CPU core for data processing. In [
15], an energy-efficient Fi-WSN is illustrated, which shows the scenario of a residential building. Compared to these simulators, our emulation platform has the entire system with data collection, analysis, modeling, and control for building energy cyber-physical control.
Our proposed emulator can use several computing steps, including denoising, data fusion, and prediction to save energy. Deep learning can be used to predict building energy.
In recent works, recurrent neural networks (RNN) have also been used as one of the most popular models to predict energy consumption. RNNs can be used to extract the patterns of time dependencies. Some LSTM-based RNN models have been introduced to forecast the short-term load. Similarly, a deep RNN model based on pooling is also proposed, as is a standard LSTM model with a generic algorithm for load forecasting in short- and mid-term estimation problems. RNNs are used to handle multiple input sequences to extract the most relevant features among several time slots. Daily load forecasting has also been modeled using dynamic time warping, together with GRUs. A cycle-based long-/short-term memory and a time-dependent convolutional neural network are used to increase the prediction performance.
The sequence-to-sequence (S2S) models, together with the encoder and decoder neural networks, can be used to deal with some classification problems so that it can improve the statistical machine translation performance.
5. Platform Extensions with Deep Learning
The Transmission Control Protocol/Internet Protocol (TCP/IP) suite was generated by the Department of Defense (DoD); in this case, we can make sure and preserve the data integrity. It can maintain communications in the event of a catastrophic war. TCP/IP is one of the reliable protocols and can reside at the transport layer of the OSI reference model compared to other transmission protocols. The lost data re-transmission assures the data delivery. Therefore, TCP/IP packages can be collected without any specific order.
The IP layer could route the segments as packets through a subnetwork. Specifically, this step is started right after the transport layers receive data streams from its upper layer. In this case, all these segment packets are transmitted to the Host-to-Host layer protocol on the receiving host side. Additionally, the data stream can be recreated by the host layer protocol. The data will be handed to the upper-layer protocols and applications. TCP/IP generates a reliable session by establishing a virtual TCP connection and includes acknowledgements, sequence numbers, and a flow control window. The three-way handshakes are commonly used to set up TCP communication. The connection is uniquely identified by a combination of sources, as well as its destination IP port number or address.
Energy consumption is one of the biggest contributors to global warming, and most energy use is due to human activities; for example, electrical heating for commercial and residential buildings could consume almost half of the total energy production. Therefore, it is critical to manage energy use efficiently to reduce negative environmental hazards, including carbon dioxide emissions. Energy systems often do not have dramatic changes in load supply, which makes it possible to perform a prediction of future loads with small errors.
Due to the importance of energy scheduling and allocation, load prediction has attracted the attention of researchers. In this context, wireless sensors are widely used to collect energy-related data (such as the number of people in the building) due to their low cost and low power consumption. However, the popular uses of sensors also cause some issues, such as higher wireless transmission delay, poor RF transmission quality, and higher energy consumption. Meanwhile, due to the reduction of the cost of a single sensor, some problems arise, including hardware failure, data transmission failure, missing data, etc. To recover or correct abnormal data, some features should be extracted when the data is being preprocessed. With data pre-processing, the data collection process can be optimized and the correlation between features may also be reduced. Therefore, the energy prediction models should overcome the above data collection issues.
Building energy prediction models includes three main categories: short-term forecasting, mid-term forecasting, and long-term forecasting. The prediction algorithms are typically from the fields of statistics, physics, or machine learning. In this paper, our algorithm is based on machine learning and deep learning models. Some solutions use support vector machines (SVM) and neural networks to estimate energy consumption [
16,
17]. Due to the large size of the dataset, neural networks have been used to increase the prediction accuracy [
18,
19,
20]. A one-day-ahead energy prediction scheme is proposed with an ensemble parameter selection model [
21]. In [
22,
23], a Bayesian regularization algorithm is introduced to optimize the neural network prediction scheme. An anomaly detection model based on ensemble neural networks is proposed in [
24] to use a random forest to achieve the prediction-based classifiers.
In recent works, recurrent neural networks (RNN) have been used as one of the most popular models to predict energy consumption. RNNs can be used to extract the patterns of time dependencies. Some LSTM-based RNN models are introduced in [
25] to forecast the short-term load. Similarly, a deep RNN model based on pooling is also proposed in [
26], and a standard LSTM model with a generic algorithm is proposed in [
27] for load forecasting in short- and mid-term estimation problems. RNNs is used in [
28] to handle multiple input sequences so as to extract the most relevant features among several time slots. Daily load forecasting has also been modeled in [
29] using dynamic time warping, together with GRUs. In [
30] a cycle-based long-/short-term memory and a time-dependency convolutional neural network are used to increase the prediction performance.
RNNs and LSTMs have been shown to outperform most other predicting models [
25,
26,
29]. The sequence-to-sequence recurrent neural networks are originally used in language translation problems [
31]. The standard LSTM and LSTM-based sequence-to-sequence models in [
32] are applied to residential building energy prediction. A hybrid algorithm in [
33] is proposed to predict energy consumption using LSTM neural networks, empirical mode decomposition, and similar days selection. Two sequence-to-sequence LSTM-based models [
34] are used to predict medium- and long-term energy consumption.
In our paper, an S2S (encoder to decoder) neural network based on the deep LSTM attention model is proposed to predict building energy consumption. The LSTM is used to model time dependencies. The S2S (encoder to decoder) structure strengthens the ability to model time series data. The encoder is utilized to extract the relevant information and perform the prediction task, while the decoder can restore the extracted features. Additionally, the attention mechanism is used to get the relationship between the output and its corresponding input data. It can also build the connection between the encoder and decoder sequence model. Overall, the S2S model based on the deep LSTM attention mechanism outperforms all other models.
5.2. Model Structure
The deep learning model proposed in this paper optimizes the basic S2S (encoder to decoder) model structure. The idea is shown in
Figure 16. The encoder could extract different features to train the model in the pretraining steps of the deep neural network (DNN). Afterwards, the model is fine-tuned via supervised learning. Nevertheless, it is not effective to keep many parameters for subsequent supervised learning since it will take a long time to train the model. This could make it unsuitable for online processes. If we see DNN as an optimization problem, it is difficult to achieve the global optimization since the model may easily get trapped into the local optimal.
This generates a reliable session by establishing a virtual TCP connection that includes acknowledgements, sequence numbers, and a flow control window. The three-way handshakes are commonly used to set up TCP communication. The connection is uniquely identified by a combination of sources, as well as its destination IP port number or address.
To deal with the problems illustrated above, it is important to change the training pattern of the S2S model structure. Therefore, the attention mechanism can be used as a constraint added in the middle of the S2S neural network, as shown in
Figure 16. In this model, two processes are used to optimize the training loss. Meanwhile, the final loss in the last step is calculated through the sum of these two losses. As can be seen from the encoder, the parameters of the encoder sequence are the same since they all share the same feature extraction layer. The encoder part can learn the most efficient expression of data features. Therefore, the model can be trained with high accuracy.
Additionally, to capture the long-distance relevant information and get better prediction performance, the traditional LSTM models in the DNN are replaced by the attention mechanism. In the proposed model structure, three modules are used for the model construction, i.e., encoder module, decoder module, and prediction module.
Encoder module: the attention mechanism is used to extract the relevant input information. The output of the attention layers in the encoder can be utilized as the input to the decoder sequence to restore previous input data. Moreover, it can also be used to predict the energy consumption in the prediction module. Adding this constraint in the module can prevent the encoder module from copying the input embeddings directly to the output. Instead, the encoder is forced to learn more characteristics of the input embeddings so as to improve the load forecasting performance at the next timestamp. Besides, the key and value matrix generated by the attention mechanism in the encoder module can also be used in the transition layer between the encoder and decoder modules.
Decoder module: the extracted features from the encoder module are restored. In this case, by comparing the differences between the original input data with the restored embeddings, the validity can be calculated and verified.
Predict module: this predicts energy consumption by using the embeddings generated from the encoder module. Instead of directly using the information, it must first be flattened and processed by the fully connected layer. Therefore, the feature dimensions can be modified for the specific prediction task.
Moreover, a multi-step training approach is used in our model for the multi-tasking problems. In our proposed model, the multi-tasking training method is used first, before being split into several single task trainings. In the single training process, the extracted relevant data is used for load forecasting. Specifically, in our proposed method, all relevant feature embeddings can be extracted by using the multi-tasking model. When the model prediction is close to the convergence point, it is necessary to learn some unique information to improve the prediction performance. Therefore, after the multi-tasking process, the encoder can be used to continue the prediction task by using the step-by-step training approach. The prediction performance can eventually be improved with this training method.