A Nonintrusive Load Monitoring Method for Office Buildings Based on Random Forest

: Load monitoring can help users learn end ‐ use energy consumption so that specific energy ‐ saving actions can be taken to reduce the energy consumption of buildings. Nonintrusive monitor ‐ ing (NIM) is preferred because of its low cost and nondisturbance of occupied space. In this study, a NIM method based on random forest was proposed to determine the energy consumption of building subsystems from the building ‐ level energy consumption: the heating, ventilation and air conditioning system; lighting system; plug ‐ in system; and elevator system. Three feature selection methods were used and compared to achieve accurate NIM based on weather parameters, wavelet analysis, and principal component analysis. The implementation of the proposed method in an of ‐ fice building showed that it can obtain the subloads accurately, with root ‐ mean ‐ square errors of less than 46.4 kW and mean relative errors of less than 12.7%. The method based on weather parameters can provide the most accurate results. The proposed method can help improve the energy efficiency of building service systems during the operation or renovation stage.


Introduction
Buildings can account for 50% of the total energy consumption of society and 30% of greenhouse gas emissions [1]. Therefore, decreasing the energy consumption of buildings plays a key role in sustainable development. For buildings, the energy consumption mainly includes embodied energy and operational energy. The embodied energy consists of energy used in the process of manufacturing building material, constructing buildings, and destructing buildings [2]. The operational energy often results from the heating, ventilation, and air conditioning (HVAC) system; lighting system; plug-in system; and elevator system [3], which accounts for 80-90% of the life-cycle energy consumption [4]. By reducing the operational energy, life-cycle energy can decline obviously. For existing buildings in operation, performance evaluation and renovation projects play an important role in reducing operational energy consumption and carbon emission.
Monitoring the energy consumption of subsystems is an effective approach to evaluate building efficiency and provide guidance for renovation. A study showed that detailed feedback information from monitoring systems could be provided for users, which can encourage energy-saving behavior, improve energy management, and upgrade fault diagnosis [5]. Buildings can achieve more than 10% of potential carbon savings by obtaining details on energy consumption, indicating its importance in energy management [6].
The general approach to obtain device-level energy consumption is to install sensors for the devices of interest, which is called intrusive monitoring [5]. Although the approach can obtain accurate data on energy consumption, it is expensive and complex with privacy concerns [7][8][9]. A more promising approach for monitoring the individual energy consumption of devices is nonintrusive monitoring (NIM). NIM measures only the total power consumption and the energy consumption of each appliance, which is calculated by intelligent algorithms [10,11]. After it was first proposed by Hart [12], many algorithms have been introduced into NIM approaches, such as hidden Markov models [10], discriminative sparse coding [13], deep learning [14], random forest (RF) [15], and neural networks [16]. A NIM method based on a decision bagging tree classifier was proposed in [17], which applies principal component analysis (PCA) to extract the fused time-domain features. The proposed method showed excellent performance on three real household datasets with an accuracy of over 98%. A convolutional neural network-based NIM model with differential input was applied to appliance-level load monitoring in residential buildings [18]. The model accurately identified the energy consumption of refrigerators, microwaves, and dishwashers with a low mean square error (MSE) and mean absolute error. A NIM algorithm based on Karhunen-Loeve expansion was proposed to disaggregate household appliances using voltage-specific appliance signatures to ensure the accuracy of disaggregation in the case of large voltage fluctuations [19]. The disaggregation algorithm yielded accurate results with an average accuracy of over 92.5%, even under severe voltage fluctuations. A hybrid NIM algorithm was proposed for residential power load disaggregation, which combined factorial hidden Markov models and iterative subsequence dynamic time warping to accurately identify the characteristics of appliances and decrease the intrusiveness of offline training [20]. The approach can accurately disaggregate multiple operating appliances and performed better than the existing factorial hidden Markov model benchmark. Current research has focused on residential buildings rather than commercial buildings because most domestic appliances have limited states (on/off or multiple stages), where their loads are easy to obtain from the total load. However, commercial buildings consume large quantities of energy and it is necessary to monitor their energy consumption for energy conservation.
In office buildings, there are four main subsystems, namely HVAC systems, lighting systems, elevator systems, and plug-in systems. The HVAC system provides a comfortable indoor environment for occupants, and its load results from outdoor parameters and occupant activities. The lighting system provides occupants with a comfortable luminous environment. Its load is associated with the usage duration and type of lighting devices. The elevator system performs the function of transportation in office buildings and its load is mainly influenced by the commute time. The plug-in system includes plug-in office devices such as desktops, printers, and copiers. Its load is determined by the usage duration and rated power consumption of these devices. The energy consumption data of these subsystems would provide useful information on the energy efficiency and usage of buildings, such as typical and atypical operating conditions and characterizing dynamics in building operations. The information obtained can help energy managers develop dynamic solutions for the optimal control of subsystems and targeted energy efficiency measures to improve the performance of subsystems. Results have shown that this optimal control can help save 10% of energy for HVAC systems [21] and up to 50% of energy for lighting systems [22].
Research on NIM in commercial buildings began in 1996 [23]. The energy consumption of commercial buildings can be divided into the energy consumption of different subsystems according to the services provided by the buildings, including loads of the HVAC system, elevator system, plug-in system, and lighting system. A NIM method was proposed to obtain the energy consumption of a lighting system based on virtual submetering disaggregation [24]. The results showed that the data analytics method can accurately monitor the energy consumption of the lighting system, and the relative difference between the disaggregation results and monitoring data was less than 5%. A NIM method based on an event detection algorithm was developed, which identified the state and type of appliances and then calculated the required electric power of lighting systems [25]. A NIM framework was developed to identify the energy consumption of HVAC systems [26]. The energy consumption of plug-in devices and lighting systems was first modeled by the Fourier series, and then the energy consumption of the HVAC system was calculated by subtracting it from the total energy consumption. A NIM model was proposed to obtain the plug-in load in an office building [27]. The model could identify the profiles of the measured appliances and found those with significant impact in buildings. Most research has focused on one type of energy-use system, while few have reported the disaggregation of building-level energy consumption into more detailed subloads. Detailed information is important to coordinate the operation of the four subsystems and improve the efficiency of buildings.
The above review shows that NIM can be applied to obtain subsystem load information for operation optimization. However, system-level NIM needs further exploration due to the following gaps: 1. Most research has mainly concentrated on how to identify the states, types, and energy use of devices in residential buildings. There are limited studies on system-level disaggregation in office buildings, which can provide detailed information on system operation optimization. 2. Existing NIM research on commercial buildings has focused on one type of subsystem, while studies on multiple subsystem load disaggregation from building-level energy data are limited. Thus, it is necessary to propose a new NIM method to determine the energy consumption of multiple subsystems (i.e., the four main subsystems).
In this study, a NIM method based on RF was proposed to obtain the energy consumption details of multiple subsystems in office buildings from the total energy consumption data. RF belongs to an ensemble approach and produces the final result by averaging the output of a series of independent weak learners. RF was used in the study because of its stable nonlinear mapping ability with easy parameter tuning [28]. The total energy consumption of an office building was disaggregated into four parts based on their function and operation characteristics: the HVAC system, lighting system, plug-in system, and elevator system. Based on the information provided by this method, the performance of each subsystem can be determined, and the corresponding energy efficiency measures can be taken to improve their performance. Feature selection influences the accuracy of NIM models, so three feature selection methods were used and compared in this study to improve the accuracy of the NIM model.
The remainder of this paper is organized as follows. Section 2 presents the NIM method and the steps based on RF. In Section 3, an office building is used as a case study to verify the proposed method. Section 4 presents the disaggregation results based on different feature selections. The conclusions is displayed in Section 5.

The NIM Approach Based on Random Forest
In this study, RF was applied to perform the NIM. RF is an ensemble learning algorithm that consists of several tree-based weak learners that are built independently to simultaneously decrease variances and biases [29]. It adopts bootstrap resampling to generate several training sets. Each tree is developed based on these training sets with random feature selection at every split, which ensures diverse results for each tree [30]. The final output is the average of the results for all the trees, as shown in Equation (1). RF is widely applied in classification and regression problems, such as energy forecasting and load identification [31,32]. The framework of the NIM method based on RF is shown in Figure  1 and the primary steps are introduced in detail.
where x are the inputs of every tree, C is the number of developed trees, Ti(x) are the outputs of every tree, and y are the results of RF.

Data Collection
The first step is to collect the data including the weather data and energy consumption. Weather data include dry-bulb temperature and relative humidity because they are related to the cooling/heating demand of buildings and influence the energy consumption of HVAC systems. Energy consumption includes the total energy consumption and the energy consumption of subsystems. The total energy consumption can be used to extract features to disaggregate subsystem load while the energy consumption of subsystems is applied to train and test the approach.

Feature Selection
The total energy consumption was disaggregated into four types of subsystem loads (i.e., loads of the HVAC system, elevator system, plug-in system, and lighting system). Time is an influential factor and was included in the inputs because it is closely related to the utilization of these subsystems. These subsystems are frequently used during, instead of after, working hours. For the HVAC system load, weather conditions significantly influence the heat gain and loss into the indoor environment. Hence, weather data should be considered as another input. However, weather data may not be monitored in practice, in which case wavelet analysis and PCA are applied to extract features from the total energy consumption. Therefore, three types of inputs are discussed in this study.

Data collection
Weather data Energy consumption If weather data are monitored, the total energy consumption, dry-bulb temperature, relative humidity, and the time and days of the week are taken as inputs. This approach considers factors that are directly related.
(2) Approach II Wavelet analysis is used to extract information hidden in the total energy consumption. Wavelet analysis is a common tool to disaggregate the original series and improve model accuracy in load forecasting [33]. A series of functions are used to represent data or functions [34]. The theory behind this is to obtain information at different scales or resolutions by high-pass and low-pass filters and to produce a series of wavelet coefficients that contribute to extracting characteristics in the frequency domain. In this approach, the total energy consumption is disaggregated into low-frequency coefficients (approximation) and high-frequency coefficients (details) using wavelet analysis at level 1, as shown in Equation (2) [35]. Then, the wavelet coefficients from the total energy consumption, time, and days of the week are taken as inputs.
where , and ∅ , represent the bases of scaling functions and wavelets, and , and , represent low-frequency and high-frequency coefficients.
(3) Approach III PCA is used as the feature extraction method. PCA is a general approach to handle multivariate problems in raw data for load prediction and NIM [36]. PCA transforms the observed values into nonlinearly correlated principal components, which are sorted in descending order according to their variability [37]. The theory of PCA can be expressed in Equation (3). In this approach, the daily total energy consumption is considered as 24 features that are then projected to a lower-dimensional space spanned by four principal components obtained from PCA. The rationale behind the four principal components is that these can represent the four types of subsystem loads without increasing the computational complexity. The new data transformed from daily energy consumption, time, and days of the week are considered as Approach III.
where X represents an (M N) matrix, si is the ith principal component's score vector, li is the ith principal component's loading vector, and R represents an (M N) residual matrix. S is an (M Q) matrix of M scores on Q principal components, and L is an (N Q) matrix of N loadings on Q principal components.

Model Construction
The NIM method based on RF was modeled in the scikit-learn [38] module in Python. The adjustable hyperparameters included the number of estimators, the maximum depth of individual trees, the number of features, the minimum samples for a split, and the minimum sample leaf. The RF models are relatively sensitive to the number of estimators and the maximum depth of individual trees, so they were adjusted for improved model performance [39]. The remaining hyperparameters were set to the default values. The number of estimators is relevant to the number of weak learners and the computation requirements. The maximum depth of individual trees depends on the data characteristics and deeper trees can have better performance [40]. A grid search was applied to identify the optimal hyperparameters [41]. More detailed hyperparameters are listed in Section 3.
To evaluate the NIM results, two evaluation indices (MRE and RMSE) were used, as shown in Equations (4) and (5). The MRE measures the relative bias of the models, while the RMSE quantifies the absolute deviation.
where y i is the disaggregation load of the NIM model, y i is the actual value, and N is the number of samples.

Implementation of the Method
When all necessary data are collected, the whole implementation of the method works as the following process: Step 1: The obtained data are preprocessed to extract the features used for model input. For Approach I, the total energy consumption, dry-bulb temperature, relative humidity, and the time and days of the week are integrated as the inputs. For Approach II, the total energy consumption is disaggregated into low-frequency coefficients and highfrequency coefficients using wavelet analysis at level 1 first. The wavelet coefficients from the total energy consumption, time, and days of the week are taken as inputs. For Approach III, the daily total energy consumption is projected to a lower-dimensional space spanned by four principal components obtained from PCA. The new data transformed from daily energy consumption, time, and days of the week are considered as inputs.
Step 2: The extracted features are integrated with the corresponding subsystem load to form the sample set. Then, 80% of samples are used as the training set and the remainder are used as the testing set.
Step 3: The RF model is trained based on the training set and the hyperparameters are adjusted using grid search.
Step 4: The model is tested based on the testing set and RMSE, and MRE is used to evaluate the accuracy of the model.

Case Study
An office building located in a hot summer and cold winter region was chosen to demonstrate the performance of the load disaggregation approach. The building covered an area of approximately 32,000 m 2 , with 23 floors above the ground, and the physical model of the building was modeled in Google Sketchup, as shown in Figure 2. The window-wall ratio of the whole building was approximately 74% and the story height was 4 m. In the office building, there are four main subsystems, namely the HVAC system, the lighting system, the elevator system, and the plug-in system, and related parameter settings, including building physical information and internal heat gain, are shown in Table  1. Considering the randomness of occupant behavior, ±20% of perturbations were added to the daily basic schedule.
where Echiller, Echilled_pump, Ecooling_pump, and EHVAC are the energy consumption of the chillers, chilled water pumps, cooling water pumps, and HVAC systems, respectively; Qcooling/heating is the cooling and heating loads of the office building; COP is the coefficient of performance of the chillers; x is the part load ratio of the chillers; a, b, c, and d are fitting coefficients between the COP and part load ratio of the chillers; g is the gravitational acceleration; m is the mass flow rate; h is the pump lift; c is the heat capacity of water; and ∆t is the temperature difference between supply and return water from the chillers. The related parameters about the energy consumption of the HVAC system were chosen as follows: for Equation (7), a, b, c, and d were 3.9, −11.9, 12.1, and 1.1, which were obtained from a fitting of a chiller sample. For Equation (8), g was 9.8 m/s 2 and h was 60 m. For Equation (9), c was 4.2kJ/kg K and ∆t was 5 K.
The energy consumption of the elevator system, plug-in system, and lighting system was calculated by schedule, design density, and floor area, as shown in Equation (12).
where E is the energy consumption of the elevator system, plug-in system, and lighting system; density is the design density of the elevator system, plug-in system, and lighting system; and area is the related area of design density. The annual hourly energy consumption is shown in Figure 3. The load varies greatly during the entire year, i.e., higher in summer than in winter, with a peak of 2099.9 kW. Figure 4 shows the total loads and four subsystem loads in a typical week for winter and summer. The total load peaks at 9:00-18:00. The valley periods are 1:00-7:00 and 22:00-24:00 because of the working hours. The loads from the HVAC system vary significantly and are influenced by the weather and schedule. The profiles of the total load and HVAC system load are similar because the load fluctuations mainly result from the HVAC system. Loads of lighting, plug-in devices, and elevators regularly fluctuate owing to the periodic schedules of occupants.  The NIM models based on RF for the building were built in Python. A single RF model was built for every approach to obtain the individual energy consumption of each subsystem. A grid search was conducted to search for the optimal hyperparameters, where the number of estimators and the maximum depth of individual trees ranged from 10 to 200 and 1 to 30, respectively. All optimized hyperparameters applied in the study are listed in Table 2. For reproducible results, the random state (the seed used by the random number generator) was fixed at a certain value.

Results and Analysis
The performance of the proposed NIM method is discussed in this section. The disaggregation results based on three feature selection approaches are first introduced, and Lighting Plug-in Elevator HVAC Total the accuracy for each subsystem load is analyzed. Then, the performance of the models based on the three approaches is compared and discussed.

Disaggregation Results Based on Approach I
The training and testing results of the NIM model based on Approach I are shown in Table 3. The approach takes the total energy consumption, dry-bulb temperature, relative humidity, and the time and days of the week as the inputs. The RMSEs and MREs of the training results of the four disaggregated subsystem loads range between 1.3 kW and 7.8 kW, and 1.3% and 3.4%, respectively. The RMSEs and MREs of the testing results of the four disaggregated subsystem loads range between 4.4 kW and 28.8 kW, and 7.1% and 11.0%, respectively. The results imply that the approach can accurately disaggregate the total energy consumption. For the four subsystems, the disaggregation results of the HVAC system load have the highest accuracy, followed by the elevator system load, plugin system load, and lighting system load. The high accuracy of the disaggregation results of the HVAC system load is attributed to the strong correlation between the climate parameters and the HVAC system load, which enhances the mapping capability of the model. The comparison between the calculated loads from the software and the disaggregation results was analyzed. The calculation loads were marked as Actual load, while the disaggregation loads were marked as NIM load. The test results for the whole test set are shown in Figure 5. Overall, most of the points evenly distribute on both sides of the line y = x, which indicates that the disaggregation results obtained by Approach I are accurate. Among the four types of subsystem loads, the disaggregation results of the lighting system and elevator system loads mainly concentrate on both ends of the line, while the disaggregation results of the plug-in system and HVAC system loads evenly concentrate on the whole line. This indicates that the lighting system and elevator system loads mainly consist of two types of high and low load levels, while the plug-in system and HVAC system loads have more states. (c) (d) The test results for a typical week ( Figure 6) show that the disaggregation results closely follow the actual loads, with limited absolute differences between them in most cases. Large differences mainly result from a sharp change in loads, such as the start and end of working hours. For the lighting system, plug-in system, elevator system, and HVAC system loads, most of the relative differences range between −5.69% and 6.90%, −7.32% and 5.04%, −6.51% and 4.81%, and −1.64% and 6.94%, respectively. Most of the relative differences are less than 8%, which indicates that the NIM models based on Approach I can obtain the subloads accurately. Figure 6 shows that the MREs can be large in some cases (i.e., the start or end of work) because the absolute values of these loads are very low, and small deviations lead to large relative errors. The training and testing results of the NIM models based on Approach II are presented in Table 4. The approach applies the low-frequency and high-frequency coefficients from the disaggregated total energy consumption, the time, and the days of the week as inputs. The RMSEs and MREs of the training results of the four disaggregated subsystem loads range between 1.8 kW and 13.5 kW, and 2.3% and 5.0%, respectively. The RMSEs and MREs of the testing results of the four disaggregated subsystem loads range between 5.5 kW and 46.2 kW, and 8.8% and 12.7%, respectively. These results indicate that the approach can achieve accurate load disaggregation of the total energy consumption. For the four subsystems, the disaggregation results of the elevator system load are the most accurate, followed by the plug-in system and HVAC system. The disaggregation results of the lighting system load are not as accurate as those of the others. The comparison between the calculated loads from the software and the disaggregation results was analyzed. The test results for the whole test set are shown in Figure 7. There are differences in distribution between the disaggregation results and actual loads, although most of the points distribute on both sides of the line y = x, which indicates that Approach II can disaggregate energy consumption accurately. Overall, the disaggregation results of elevator system load are more concentrated than other subsystem loads with more accurate results. The possible reason is that the energy consumption patterns of the elevator system are easy, contributing to learning the mapping relationship. The test results for a typical week are shown in Figure 8. The disaggregation results match well with the actual loads in most cases, with a small gap between them. A sharp change in load sometimes causes large errors. For the lighting system, plug-in system, elevator system, and HVAC system loads, most of the relative differences range between −7.41% and 8.88%, −8.25% and 7.30%, −7.80% and 6.57%, and −3.23% and 11.16%, respectively. Most of the relative differences are less than 12%, which demonstrates that the NIM models based on Approach II can disaggregate the building-level energy consumption accurately. Large relative errors mainly occur when the loads are low (i.e., weekends). These small deviations lead to large relative errors owing to the small real values.

Disaggregation Results Based on Approach III
The training and testing results of the NIM models based on Approach III are shown in Table 5. The approach employs new data transformed from daily energy consumption, time, and days of the week as the inputs. The RMSEs and MREs of the training results of the four disaggregated subsystem loads range between 1.4 kW and 10.3 kW, and 1.7% and 3.6%, respectively. The RMSEs and MREs of the testing results of the four disaggregated subsystem loads range between 6.4 kW and 46.4 kW, and 9.3% and 11.9%, respectively. The results indicate that the approach can disaggregate the total energy consumption accurately. For the four subsystem loads, the disaggregation results of the elevator system load are the most accurate, while those of the lighting system load have the lowest accuracy. The comparison between the calculated loads from the software and the disaggregation results was analyzed. The test results for the whole test set are shown in Figure 9. Overall, most of the points evenly distribute on both sides of the line y = x and there are no obvious differences in distribution between the disaggregation results and actual loads. This indicates that the disaggregation results obtained by Approach III are accurate and the selected features are roughly suitable for the four types of subsystem loads. The test results for a typical week in Figure 10 show that the disaggregation results and actual loads are well-matched in most cases, with limited absolute errors. Large errors mainly occur when the subsystem loads are at a high level. For the lighting system, plugin system, elevator system, and HVAC loads, most of the relative differences range between −8.54% and 8.02%, −8.28% and 6.07%, −8.48% and 6.41%, and −3.22% and 9.68%, respectively. Most of the relative differences are less than 10%, which demonstrates that the NIM models based on Approach III can disaggregate the building-level energy consumption accurately. Large relative errors mainly occur when the loads are low (i.e., weekends). This is because the small deviations lead to large relative errors owing to the small real values.

Performance Comparison of the Three Approaches
The subsystem loads can be identified precisely by the NIM methods based on the three approaches. The performance of these three approaches is compared in Table 6 and it indicates that the performance of Approach I is better than those of the other two approaches. One possible reason is that the outdoor weather variables are highly relevant features for the HVAC system load, which contributes to improving the accuracy of the overall disaggregation results. The dry-bulb temperature and relative humidity are considered in Approach I, and extra sensors for monitoring the two variables should be installed. Although the accuracy of the other two approaches is not as high as that of Approach I, they reduce the difficulty of data collection because only the total load is required. When weather data are inaccessible, the NIM methods based on Approach II and Approach III are recommended with acceptable accuracy.
Loads of the HVAC system, elevator system, plug-in system, and lighting system can be categorized as nonperiodic and periodic loads, which results in various performances for the three approaches. For periodic loads (loads of the elevator system, plug-in system, and lighting system), the differences in the accuracy of the three approaches are limited. The possible reason for this is that the characteristics selected in all three methods are similar to the correlations of these three types of loads. For the nonperiodic HVAC system load, Approach I outperforms Approach II and Approach III because outdoor weather variables, which are strongly related to the cooling loads of HVAC systems, are used as inputs in Approach I.

Conclusions
A NIM method based on RF was proposed to disaggregate the building-level energy consumption into the energy consumption of subsystems. Given the services provided by the buildings, four subsystem loads were disaggregated: loads of the HVAC system, elevator system, plug-in system, and lighting system. Three types of features were chosen to realize the NIM depending on the availability of weather data. By considering the case study of an office building, the following conclusions can be drawn: 1. The proposed NIM method based on RF can achieve subsystem load disaggregation accurately. The RMSEs and MREs of the NIM results are less than 46.4 kW and 12.7%, respectively. 2. All four subloads can be disaggregated with high accuracy. For the lighting system, plug-in system, elevator system, and HVAC system loads, the RMSEs (MREs) range from 16.8 kW to 25.0 kW (11.0% to 12.7%), 12.7 kW to 16.8 kW (8.2% to 10.1%), 4.4 kW to 6.4 kW (7.2% to 9.3%), and 28.8 kW to 46.4 kW (7.1% to 12.1%), respectively. 3. The three proposed approaches can achieve subsystem load disaggregation accurately. When weather data are obtained, Approach I achieves the most accurate NIM results with RMSEs and MREs of less than 28.8 kW and 11.0%, respectively. When weather data are inaccessible, the NIM method based on Approach II and Approach III is recommended with acceptable accuracy, with RMSEs and MREs of less than 46.4 kW and 12.7%, respectively. 4. For periodic loads (loads of the elevator system, plug-in system, and lighting system), the differences in the accuracy of the three approaches are small. For the nonperiodic HVAC system loads, Approach I outperforms Approach II and Approach III.
The proposed NIM method can perform the NIM of subsystem loads and it is based on supervised algorithms. The collection of training samples is significant for supervised algorithms. Obtaining the subsystem loads and the total load is a problem when the method is used. In addition, to promote the application of the NIM method, unsupervised methods without training the models should be developed, which would be addressed in the future study.
Funding: This research was funded by the National Natural Science Foundation of China, grant number 51808238.