1. Introduction
With the improvement of people’s living standards, heating, ventilation, and air conditioning (HVAC) systems have been widely applied to meet people’s requirements for the comfort of indoor building environments. However, building energy consumption has also been continuously increasing. In 2021, the operation of buildings accounted for 30% of global final energy consumption and 27% of total energy sector emissions [
1]. HVAC accounts for 38% of buildings consumption [
2]. The HVAC system directly affects indoor thermal comfort and building energy consumption. For commercial office buildings, indoor thermal comfort has an impact on the productivity of indoor personnel [
3], and thus, ensuring good indoor thermal comfort is one of the key factors in maintaining its commercial operation. At the same time, the level of building energy consumption is directly related to the evaluation of building owners. Therefore, how to effectively reduce the energy consumption of HVAC equipment while ensuring indoor comfort has become an important research direction, which has promoted the emergence and development of Building energy management systems (BEMS). This system controls and monitors energy use and indoor environmental conditions through the use of appropriate operating strategies to maintain a satisfactory level of indoor building environment and achieve building energy efficiency [
4].
A superior operating strategy is the key to the efficient operation of BEMS. Research shows that implementing efficient energy management strategies can lead to 5~15% energy savings in existing buildings [
5]. Learning optimal control strategies from optimized operating datasets is a feasible method for improving the HVAC system efficiency [
6]. In the monitoring and management of building energy equipment, predictive results of indoor environmental parameters can serve as an important basis for formulating operating strategies. Among these parameters, air temperature is the most relevant in terms of indoor thermal comfort and it significantly influences building energy consumption [
7]. By combining real-time and accurate indoor temperature prediction models, BEMS can effectively control indoor temperature setpoints and implement more efficient energy-saving HVAC control strategies, leading to optimized building energy consumption and improved indoor thermal conditions [
8]. Such an indoor temperature prediction model can be of immense value to the building facility manager, and it should be scalable and parameter adjustable for different real-world situations. The prediction algorithm can be integrated with smart sensors and predictive control systems which can be trained for future scenarios [
9]. With the widespread application of building automatic systems (BAS), a large amount of building operation data such as indoor environmental parameters and power consumption data can be accumulated, which provides fundamental data support for the development of online prediction models for indoor temperatures.
In recent years, the methods for predicting indoor temperature based on data mining technology have been discussed and experimented with by more and more researchers. However, there are many differences in the selection of model input parameters, design of prediction time length, and selection of model and algorithms.
Table 1 summarizes the different methods used by related scholars in predicting room temperature.
First, the selection of input variables is an essential part of model development [
16]. Using too few parameters will lead to poorly accurate prediction results, and using excess or redundant input parameters creates unnecessary complexity and decreases the computation speed. Mba et al. [
10] used only indoor and outdoor temperatures and relative humidity to predict future changes in indoor air temperature and relative humidity. Xu et al. [
11] used only historical indoor temperatures as an input to the model to predict future temperature trends. Zakia Afroza et al. [
17] used 12 characteristic parameters of the air conditioning equipment system to predict the changes in indoor temperature. The aforementioned situations represent the main types of input parameters commonly used in this kind of research model. However, in practical engineering applications, it is preferable to select parameters that are related to indoor temperature and easy to obtain as the research objects, in order to avoid the increased costs associated with installing a large number of sensors. Secondly, in the face of multiple selectable parameters, several studies have started to show interest in and experiment with the selection of effective parameters [
18,
19,
20]. Yadav et al. [
18] and Talebi et al. [
19] used sensitivity analysis techniques to exclude input parameters with low correlation. Guo et al. [
20] used the Pearson simple correlation coefficient method to calculate the correlation coefficient between two variables and selected the variables with high correlation to form the feature set of the model. The aforementioned practices are highly recommended for adoption.
The time granularity of indoor temperature prediction is concentrated around 5 min [
11,
15,
21], but the prediction lengths in this field of study are widely distributed, with the shortest prediction lengths being about 15 min [
12], longer prediction lengths being about a week, and the longest prediction lengths being up to 28 days [
15]. Xie et al. [
13] made use of the adaptive neuro-fuzzy inference system (ANFIS) and the dynamic model constructed based on the energy balance equation (EBE) to predict indoor air temperature for the next 6 days based on 3 months of observed data, respectively. Zakia et al. [
22] used a nonlinear autoregressive network (NARX) to achieve temperature prediction for nearly one month by virtue of a 1-year-long training dataset with a total of 12 data features, through the division of the model for different seasons. The prediction accuracy decreased with the growth of the prediction time length, and the short-time indoor temperature prediction had a high practical value from the point of view of guiding the operation and regulation of building air conditioning systems.
In the selection of model algorithms, various types of regression models, especially neural network models, are widely used. Mustafaraj et al. [
21] developed and validated two models using external and indoor climate data recorded over three months to predict dry bulb temperature and relative humidity at different time-scales (30 min to 3 h ahead), finding that the neural network-based nonlinear autoregressive model with external inputs (NNARX) model is superior to the linear parametric autoregressive model with external inputs (ARX) model. In similar studies, e.g., Refs. [
23,
24,
25], the NARX network has the advantages of fast convergence and good generalization ability compared to other networks in dealing with time series datasets. Several previous studies, e.g., Refs. [
14,
26], compared different data-driven modeling techniques in predicting indoor space temperature or other related parameters and found that nonlinear models, such as neural networks, gave satisfactory results in predicting indoor temperatures. Thomas et al. [
12] predicted the indoor temperatures of two buildings for the next 15 to 30 min, finding that a nonlinear ANN model trained using the Levenberg–Marquaurdt algorithm gave more accurate temperature predictions than a linear regression ARX model using the least squares method. Mirzaei et al. [
27] found that an advanced model with more input parameters has significantly higher prediction accuracy compared to a simple model, although the computation time is slightly longer, and its advantages greatly outweigh the disadvantages. This modeling technique has become increasingly popular in recent years. There are also researchers in related fields using recurrent neural networks such as long short-term memory (LSTM) to predict temporal changes in temperature and achieving good results [
11,
28,
29,
30], and LSTM is a special type of recurrent neural network (RNN) that is capable of learning long-term dependencies, which is more evident in the prediction of temporal sequences.
It should be noted that currently, most research adopts a single model to solve machine learning problems, which has some obvious drawbacks, such as the inability to leverage the advantages of multiple models, poor generalization ability, high dependence on datasets, etc. As a result, it restricts the overall performance and robustness of machine learning algorithms. In contrast, ensemble learning models can improve the stability and accuracy of models by combining the predictions of multiple models [
31]. Ensemble learning can better generalize in various complex data situations and is more tolerant to noise and outliers. Therefore, in future research, more attention should be paid to the application of ensemble learning models. Moreover, current research generally validates the accuracy of models using validation or testing sets partitioned from offline data, with relevant metrics applicable to offline datasets. However, there is less research on methods for online temperature prediction that have greater engineering application value.
In summary, the current research lacks discussion of the adjustment of the practical application model or technical solution, including the selection of the input and output data characteristics of the model, and the selection of the model and the application mode, and thus, there is a certain research and development space. To fill the above gaps, the main contributions in this study are as follows.
- (1)
In this study, the categories of relevant factors affecting room temperature and the detectability of their data were discussed, and the reasonable input parameters of the temperature prediction model were selected via correlation analysis.
- (2)
In this study, the prediction performance of multiple popular algorithms under the same dataset is compared horizontally, the superiority of the ensemble learning algorithm is verified, and the temperature prediction model is further designed based on such algorithms.
- (3)
The temperature change rate is studied and selected as the output parameter of the model to improve the prediction effect. The scheduler mechanism is designed to make the model run online and improve the accuracy and stability of the prediction system.
- (4)
Accurate and effective temperature online prediction can not only reduce building energy consumption and improve indoor comfort, but it can also provide new methods and ideas for the operation of the building energy system, enhancing its flexibility.
The structure of this paper is as follows:
Section 1 reviews related work and explains the aims and main contributions of this paper.
Section 2 provides a detailed introduction to the research methods, including model parameter selection, algorithm comparison, and online operation methods.
Section 3 describes the experimental results obtained from the tests carried out in a case building. Based on the above content, the conclusion and limitations of this paper are presented in
Section 4.
2. Methodology
This article proposes an online temperature prediction method for office buildings, which decouples indoor temperature prediction into three stages: model training, model prediction, and online operation. Decoupling the model training phase from the model prediction phase is due to the fact that during the model training phase, the completeness and accuracy of the data can be ensured through data preprocessing. However, during the model prediction phase, the data quality cannot be guaranteed, which often results in prediction biases and program errors. At the same time, considering that indoor temperature may be affected by factors that are not monitored by the building data system, resulting in theoretically unpredictable temperature changes, the model prediction stage is decoupled from the online operation stage, and a scheduler mechanism is introduced to realize the online operation of the model and ensure the accuracy of temperature prediction. The system framework is shown in
Figure 1. Before designing the online operation method for the model, this article discusses the selection of model input parameters and designs experimental comparisons that include several mainstream algorithms such as single models and ensemble learning algorithms to select the best-performing model as the core prediction model in this article.
2.1. Indoor Temperature Collection
Firstly, it is necessary to collect temperature data from indoor office buildings for model training and online prediction. An indoor temperature online monitoring system based on Internet of Things technology and temperature sensors is used to achieve 24 h monitoring of indoor temperature. The indoor temperature online monitoring system is based on LoRa technology and combines Wi-Fi to cover remote areas where LoRa signals cannot reach. The upper-level application layer protocol uses the MQTT protocol based on TCP/UDP. The system monitors at a time granularity of 5 min and uploads the temperature data to a web server for storage and record keeping.
2.2. Select Model Input and Output Parameters
2.2.1. Selection of Input Parameters
Insufficient input parameters in a model can lead to low prediction accuracy, while an excessive number of parameters can increase the difficulty of prediction and reduce computational efficiency. This article analyzes the selection of model input parameters by focusing on the factors that affect indoor temperature. Indoor temperature is mainly influenced by four factors: “outdoor weather”, “enclosure structure”, “personnel and equipment”, and “HVAC systems”. The theoretical analysis of relevant parameters that affect indoor temperature in this article focuses on their detectability. This is because a necessary condition for model input parameters is that the data can be monitored, collected, and transferred to the model for processing. The specific analysis of relevant parameters that affect indoor temperature is described in the following text.
Firstly, meteorological parameters are among the monitorable parameters. For office buildings, we can easily obtain real-time and future meteorological parameters from various weather stations. These parameters are closely related to indoor temperature. Secondly, the thermal performance of traditional building envelope structures is often difficult to monitor in real time. However, once the envelope structure of most buildings is built, its basic performance will remain relatively stable or change slowly. Therefore, when analyzing the indoor environment, the performance parameters of the envelope structure can be considered as a stable influencing factor. Then, although some parameters of personnel and equipment can theoretically be monitored (e.g., the number of personnel can be recorded through punching cards, AI image recognition, and other techniques, and the power status of equipment can be uploaded to the cloud for recording and analysis through IoT technologies such as Zigbee, NB-IoT, and LoRa), in practice, comprehensive monitoring often requires high equipment costs. Moreover, considering the increase in people’s privacy protection awareness, setting up a series of sensors inside commercial office buildings may be resisted by tenants and even cause disputes related to commercial secrets. In addition, in terms of personnel activities inside buildings, the feasibility of recording daily activities through relevant equipment or technologies is low, so this type of parameter is excluded. Finally, the system form of the HVAC (heating, ventilation, and air conditioning) of a building can be considered as a fixed influencing factor along with the building envelope. Although the operational status of the HVAC system can be monitored (e.g., the operation status of chillers, air conditioning units, and fresh air units can be monitored through additional sensors), their parameters are complex, mostly featuring switch status parameters, and their power consumption weights are different. Therefore, calculating the correlation results with the changing indoor temperature may often result in deviation. In addition, the collectible energy consumption data are often the overall energy consumption data of the HVAC system or subsystem, rather than the energy consumption data of the temperature prediction area. Therefore, HVAC system-related data are not considered. At the same time, considering that the type of date (whether a certain day is a working day) will also affect indoor temperature, this study eventually selects outdoor meteorological parameters and date type as input parameters for the model.
2.2.2. Correlation Analysis of Outdoor Meteorological Parameters
Meteorological parameters can be obtained from the meteorological departments of various countries or regions. Due to the numerous types of parameters, they can be combined with the indoor temperature online monitoring system proposed in
Section 2.1 to collect room temperature data for correlation analysis. Parameters with a strong correlation to room temperature changes can be selected as input parameters for the model. There are three commonly used correlation coefficients: Pearson linear correlation coefficient (PLCC), Spearman rank-order correlation coefficient (SRCC), and Kendall rank-order correlation coefficient (KROCC) [
32]. When the data distribution does not meet normal distribution, the analysis results of PLCC may be biased. At the same time, because the PLCC is calculated based on the variance and covariance of the original data, it is relatively sensitive to outliers, and it measures linear correlation. Therefore, even if the PLCC is 0, it can only indicate that there is no linear correlation between variables, but it is still possible to have nonlinear correlation. KROCC is used to reflect the index of correlation between categorical variables, and is suitable for situations where both variables are ordered categories. It is not suitable for correlation analysis in this paper. SRCC uses the rank order of two variables for linear correlation analysis and does not require the original variable distribution, making it a non-parametric statistical method. Even if outliers appear in the data, the impact on SRCC coefficient is very small because the rank of outliers is usually not significantly different. Therefore, the correlation coefficient used in this article is the SRCC, which is calculated by the following formula:
In the formula, Ui and Vi correspond to the relative position or order of the specific values of X and Y. n denotes the number of singular data samples. Substituting position for absolute value of data improves the robustness of Spearman rank-order correlation coefficient (SRCC) to the distribution of data to a certain extent, making it more suitable for correlation analysis of data that does not meet normal distribution or linear correlation. The relationship between meteorological data and indoor temperature in this article may not be linearly correlated, and the distribution of data in meteorological data is not all normal distribution. Therefore, the SRCC is used. The closer the correlation coefficient is to −1 or 1, the stronger the correlation between variables; the closer the correlation coefficient is to 0, the weaker the correlation between variables.
2.2.3. Selection of Output Parameters
In this paper, the rate of change in the indoor temperature is utilized as the output parameter for the model prediction instead of the actual numerical value of the indoor temperature. The reason for this is that the predicted rate of temperature change, combined with easily obtainable real-time indoor temperature data, can result in a more accurate prediction of temperature. The combination of the two parameters can offer a better precision level. Additionally, the combination of predicted temperature change rate and real-time temperature can respond to abnormal changes in actual indoor temperature, making temperature prediction more flexible.
2.3. Model Algorithm Comparison and Selection
Comparing horizontally the mainstream regression prediction algorithms based on data mining in recent years, we select the best performing algorithm to conduct online prediction experiments. The algorithms compared in this paper include linear regression, support vector regression (SVR), regression tree, artificial neural network (ANN) in the single model algorithms, and Extreme Gradient Boosting (XGBoost) [
33] in the ensemble learning algorithms. XGBoost is an optimized distributed gradient boosting library designed to be highly efficient, flexible, and portable. It implements machine learning algorithms under the Gradient Boosting framework. XGBoost provides a parallel tree boosting (also known as GBDT, GBM) that solves many data science problems in a fast and accurate way.
The input data for these models were meteorological data, date type, and HVAC energy consumption, filtered using the method described in
Section 2.2.2, and the output data were the predicted indoor temperature change rate in the future. Historical datasets were divided into training and testing sets in a 7:3 ratio. All five algorithms adopted default parameter settings to ensure relative fairness in the comparison of methods. Specific parameter settings are shown in
Table 2. Each model was firstly trained using the training set, and subsequently used the input parameters of the testing set to predict the temperature change rate. Considering the sensitivity of artificial neural network’s predictive accuracy to network structure, we need to construct different forms of neural networks for testing to find the optimal neural network structure, so as to avoid significant deviation caused by parameter settings.
The detailed prediction errors of each model algorithm are evaluated using the mean absolute error (MAE) and mean squared error (MSE). A smaller MAE and MSE represent better model prediction performance. The specific calculation formulas are as follows:
2.4. Offline Prediction Method of Models
After selecting the optimal model using the method designed in
Section 2.3, the model was trained and used to offline predict the rate of temperature change for the following day. It is worth noting that although using larger time span datasets during the training process often results in better predictive performance, in practical engineering applications, most public buildings currently do not have a comprehensive data collection system, which cannot provide larger time span datasets for training models. The collection of larger time span datasets will delay the design of building energy management systems, thereby affecting the construction period of relevant new construction or renovation projects. Therefore, the actual historical dataset used here should not be too large, and it is recommended to choose a period of about one week to match practical engineering application scenarios.
When predicting the rate of temperature change for the next day offline, input data similar to those used in the training phase of the same model are constructed as the input data for the prediction model in order to achieve a prediction. Future meteorological parameter data can be obtained through meteorological network APIs in various countries or regions; future time data are generated through program-generated timing information and date type; future energy consumption data are an additional part that need to be considered in the model prediction and can be predicted by constructing a prediction model for the running time of the refrigeration unit and the refrigeration energy consumption combined with historical energy consumption data. Based on the above data, the model will predict the rate of future temperature change for the next day, which will serve as the basic data for the model’s online operation in the following sections.
2.5. Online Operation Method of Models
This paper designs a scheduling mechanism to realize the online operation of the prediction system and uses online information to improve the accuracy of indoor temperature prediction. The scheduler can convert the predicted temperature change rate outputted by the model prediction phase into a predicted temperature and improve the accuracy and stability of temperature prediction using the indoor online temperature information. The triggers and adaptive prediction methods in the designed scheduler can solve the problems of temperature prediction execution time and execution method (
Figure 2).
By designing triggers to solve the problem of predicting execution time, the online system only predicts the indoor temperature for the future period when the trigger is activated at a specific time, in order to reduce computational load. Based on this, this paper designs prediction error triggers and timed operation triggers. When unpredictable factors such as indoor human activity cause prediction errors, the prediction error trigger activates the system to recalculate. The temperature prediction system needs to be regularly re-run to avoid possible temperature prediction errors, so a timed operation trigger is designed to guide the prediction calculation time.
Predictive execution method refers to generating predicted temperature values by combining the predicted temperature change rate with the actual temperature. Based on the current actual temperature, temperature prediction is achieved by accumulating the predicted temperature change rate (
Figure 3). Due to the possible occurrence of sudden temperature changes and the problem of low accuracy of the predicted temperature change rate, the direct accumulation of temperature change rate to predict temperature may result in predictions that do not match reality. Therefore, it is necessary to correct the predicted temperature change rate. This article further designs an adaptive prediction correction method, which improves the online temperature prediction effect by adaptively correcting the predicted temperature change rate based on the prediction deviation that occurred in the past.
The corrected predicted temperature change rate consists of two parts: the historical actual temperature change rate over a certain period of time and the offline-predicted temperature change rate proposed in
Section 2.4. The proportion of the actual historical temperature rate is determined by the prediction error over the past period of time. The proportion follows the following principle: the greater the offline prediction error over the past period of time, the more inclined it is to use the historical actual temperature change rate. Guided by this principle, this article proposes the following mathematical formula for automatically adjusting the proportion of historical actual temperature change rates:
In Equation (4), y represents the actual temperature rate ratio over a past period. The parameter ‘a’ is related to the maximum allowable cumulative error, maxerr, over the same period, and its calculation is given in Equation (5). The specific growth trend of the ratio y is correlated to parameter ‘b’: when b is greater than 1, the function exhibits exponential growth; when b is equal to 1, the function exhibits linear growth; and when b is between 0 and 1, the function exhibits decreasing growth.
4. Conclusions
The predicted values of the indoor temperature in large office buildings can provide important data support for the development of HVAC operation strategies. However, most of the current research focuses on offline prediction using single models, and the associated indicators are only applicable to offline datasets, with relatively little research on the technology of online temperature prediction. In this paper, an online prediction method for indoor temperature in office buildings based on the XGBoost algorithm was designed, and a scheduler was developed with the purpose of ensuring online operation and predicting accuracy. The impact of different parameter configurations of the scheduler on the prediction results was also discussed. The effectiveness and accuracy of the method were validated using actual data from a commercial office building in Haidian District, Beijing. The specific conclusions are as follows:
- (1)
Through analysis, it was determined that outdoor meteorological parameters and date type can be used as input parameters for the model. Additionally, the suitability of time information and outdoor temperature as input parameters for this experiment was proven through Spearman rank-order correlation coefficient (SRCC) calculation.
- (2)
Through the designed experiments, a horizontal comparison of several mainstream single model algorithms and ensemble learning algorithms, including the XGBoost algorithm, was carried out to verify the superiority of the ensemble learning algorithm XGBoost. To avoid the influence of the ANN model structure on the test accuracy, six additional ANN models were constructed and added to the comparative experiments to improve the experimental rigor.
- (3)
The temperature change rate was selected as the output parameter of the core temperature prediction model, and relevant explanations were provided. The proposed dispatching mechanism can improve the accuracy and stability of the prediction system by utilizing online information while realizing the online operation of the model. The test results of online operation showed no obvious bias and had a low overall error.
The indoor temperature online prediction method proposed in this paper can assist BEMS in executing more efficient HVAC system group control strategies in a timely fashion based on the predictive results. This can achieve desired objectives such as improving the effectiveness of group control strategies for chillers or heat pumps, thereby reducing building energy consumption and enhancing indoor comfort. In addition, the actual operation of the building will be recorded in the historical indoor temperature monitoring platform and power monitoring platform, providing data support for the building operation strategy library system.
Due to the complexity of the experiment, further investigation is needed to explore whether there is a synergistic effect between different hyperparameters and schedulers. At the same time, due to the limitations of the current experimental conditions, the impact of solar radiation and indoor carbon dioxide on the model prediction and the performance differences in models in different seasons will be the focus of future research in this field of study.