# Short-term demand forecasting at building/ portfolio level

**5. Heating Demand Forecasting at Building Level**

**5.1 Rationale & Link to BEYOND Apps**

Predicting energy consumption in buildings is of crucial importance for better grasping and analysing its overall energy behaviour over time, seasons, years. Under the scope of Beyond project demand forecasting is directly linked to the self-consumption optimization problem for minimizing energy costs (T6.1). For T6.2, demand forecasting is also necessary for the creation of the optimized demand curves needed for the consumer’s elasticity estimation. Finally, building demand forecasting is also necessary for the VPP optimization strategies of T6.5.

**5.2 Overview of relevant implementations**

The problem of short-term demand forecasting has been approached with two different techniques: conventional statistical methods and ML methods. Autoregressive moving average (ARMA) models were among the first used in Short Term Load Forecasting (STLF) [1 - 3]. Soon they were replaced by autoregressive integrated moving average (ARIMA) models [4] and seasonal ARIMA models [5] to deal with time variance often exhibited by load consumption profiles. Other examples of statistical methods used in STLF are multiple regression [6], exponential smoothing [7], adaptive load forecasting [8, 9] and Kalman filtering [10, 11]. In the recent years, ML based methods have shown great performance in the field of STLF. The most used ML algorithms for STLF are support vector machines (SVM) [12, 13], random forest [14, 15] and artificial neural networks (ANNs) [16]. Over the past few years, Deep Learning has been a subject of intense study in many fields, especially in time-series prediction. Deep neural networks (DNNs) have shown the capability to approximate any complex function with arbitrary precision. In [17], the authors showed that some DNN architectures are able to outperform classical ML approaches in the load forecasting task. The authors of [18] proposed convolutional neural network (CNN), as an effective and accurate approach for household-level load forecasting. Compared with conventional feedforward neural networks, recurrent neural networks (RNNs) have the advantage of coping with historical data through a feedback connection. In [19], the authors presented a deep RNN to predict electricity consumption for commercial and residential buildings. As an extension of RNN, long short-term memory (LSTM) networks have been used in the load forecasting field in the last few years [20].

**5.3 Implementation in BEYOND**

For the implementation in BEYOND project we have chosen to use the LSTM method.

**5.3.1. Data inputs and Analytics Pipeline (incl. assumptions /limitations)**

The dataset used for the implementation is an open dataset known as the Building Data Genome 2 dataset, whose detailed documentation is provided in the research paper by Miller et al. [21]. BDG2 is an open data set made up of 3,053 energy meters from 1,636 buildings. The time range of the times-series data is the two full years (2016 and 2017) and the frequency is hourly measurements of electricity, heating and cooling water, steam, and irrigation meters. Of course, this open data set was already cleaned for us, by filling the following data with NaN: • Outliers, detected with Seasonal Hybrid ESD (S-H-ESD).

• Zero readings longer than 24 continuous hours: is assumed here that continous zero-readings that long are consequence of a problem in the meter or that the system is down because of the season.

• Zero readings in electricity: electricity meter reading shouldn't be absolute zero.

So, we have a total of 17544 cleaned data points for our LSTM network.

The steps of the analytics pipeline for training are explained below:

1. We extract the hour of the day based on the timestamp and we add it as a column in the dataset to use this feature during training.

2. We scale the features using the MinMaxScaler method in the range of [0,1].

3. We shift the rows in order to build the dataset for supervised learning, such that the last day’s features are used to predict the next day’s consumption.

4. We split the dataset to train/test set based on the timestamp. We use the first 20 months for training and the last 4 months for testing. This accounts for 80% training set and 20% test set.

5. We train based on Keras Model Gridsearch, in order to tune the hyperparameters, such as batch size, epochs, number of nodes, dropout, etc.

6. After the Keras Model Gridsearch gives the best parameters, we train again the LSTM with these parameters.

7. After the training is done, then we predict the future values of the test set, and we invert the results to their original scale.

8. We evaluate the results based on mean absolute error and mean squared error.

**5.3.2. Analytics Libraries Employed**

The libraries employed for this algorithm are:

- Pandas

- Numpy

- Sklearn

- Tensorflow.keras

**References**

[1] Chen, J.-F.; Wang, W.-M.; Huang, C.-M. Analysis of an adaptive time-series autoregressive moving-average (ARMA) model for short-term load forecasting. Electr. Power Syst. Res. 1995, 34, 187–196.

[2] Huang, S.-J.; Shih, K.-R. Short-term load forecasting via ARMA model identification including non-gaussian process considerations. IEEE Trans. Power Syst. 2003, 18, 673–679.

[3] Pappas, S.; Ekonomou, L.; Karamousantas, D.; Chatzarakis, G.; Katsikas, S.; Liatsis, P. Electricity demand loads modeling using AutoRegressive Moving Average (ARMA) models. Energy 2008, 33, 1353–1360.

[4] Lee, Y.-S.; Tong, L.-I. Forecasting time series using a methodology based on autoregressive integrated moving average and genetic programming. Knowl.-Based Syst. 2011, 24, 66–72.

[5] Chakhchoukh, Y.; Panciatici, P.; Mili, L. Electric Load Forecasting Based on Statistical Robust Methods. IEEE Trans. Power Syst. 2010, 26, 982–991.

[6] Papalexopoulos, A.; Hesterberg, T. A regression-based approach to short-term system load forecasting. IEEE Trans. Power Syst. 1990, 5, 1535–1547.

[7] Göb, R.; Lurz, K.; Pievatolo, A. Electrical load forecasting by exponential smoothing with covariates. Appl. Stoch. Model. Bus. Ind. 2013, 29, 629–645.

[8] Lu, Q.C.; Grady, W.M.; Crawford, M.M.; Anderson, G.M. An adaptive nonlinear predictor with orthogonal escalator structure for short-term load forecasting. IEEE Trans. Power Syst. 1989, 4, 158–164.

[9] Vazquez, R.; Amaris, H.; Alonso, M.; López, G.; Moreno, J.I.; Olmeda, D.; Coca, J. Assessment of an Adaptive Load Forecasting Methodology in a Smart Grid Demonstration Project. Energies 2017, 10, 190.

[10] Al-Hamadi, H.; Soliman, S. Short-term electric load forecasting based on Kalman filtering algorithm with moving window weather and load model. Electr. Power Syst. Res. 2004, 68, 47–59.

[11] Takeda, H.; Tamura, Y.; Sato, S. Using the ensemble Kalman filter for electricity load forecasting and analysis. Energy 2016, 104, 184–198.

[12] Li, G.; Cheng, C.-T.; Lin, J.-Y.; Zeng, Y. Short-Term Load Forecasting Using Support Vector Machine with SCE-UA Algorithm. In Proceedings of the Third International Conference on Natural Computation (ICNC 2007), Haikou, China, 24–27 August 2007; Volume 1, pp. 290–294.

[13] Mohandes, M. Support vector machines for short-term electrical load forecasting. Int. J. Energy Res. 2002, 26, 335–345.

[14] Dudek, G. Short-Term Load Forecasting Using Random Forests. Adv. Intell. Syst. Comput. 2015, 323, 821–828.

[15] Cheng, Y.-Y.; Chan, P.P.; Qiu, Z.-W. Random forest based ensemble system for short term load forecasting. In Proceedings of the 2012 International Conference on Machine Learning and Cybernetics, Xian, China, 15–17 July 2012; Volume 1, pp. 52–56.

[16] Mandal, P.; Senjyu, T.; Funabashi, T. Neural networks approach to forecast several hour ahead electricity prices and loads in deregulated market. Energy Convers. Manag. 2006, 47, 2128–2142.

[17] Hosein, S.; Hosein, P. Load forecasting using deep neural networks. In Proceedings of the 2017 IEEE Power & Energy Society Innovative Smart Grid Technologies Conference (ISGT), Washington, DC, USA, 23–26 April 2017; pp. 1–5.

[18] Acharya, S.K.;Wi, Y.M.; Lee, J. Short-Term Load Forecasting for a Single Household Based on Convolution Neural Networks Using Data Augmentation. Energies 2019, 12, 3560.

[19] Rahman, A.; Srikumar, V.; Smith, A.D. Predicting electricity consumption for commercial and residential buildings using deep recurrent neural networks. Appl. Energy 2018, 212, 372–385.

[20] Kong,W.; Dong, Z.Y.; Jia, Y.; Hill, D.J.; Xu, Y.; Zhang, Y. Short-Term Residential Load Forecasting Based on LSTM Recurrent Neural Network. IEEE Trans. Smart Grid 2017, 10, 841–851.

[21] Miller, C., Kathirgamanathan, A., Picchetti, B. et al. The Building Data Genome Project 2, energy meter data from the ASHRAE Great Energy Predictor III competition. Sci Data 7, 368 (2020). https://doi.org/10.1038/s41597-020-00712-x