Renewable energy management in smart home environment via forecast
  embedded scheduling based on Recurrent Trend Predictive Neural Network
Smart home energy management systems help the distribution grid operate more
efficiently and reliably, and enable effective penetration of distributed
renewable energy sources. These systems rely on robust forecasting,
optimization, and control/scheduling algorithms that can handle the uncertain
nature of demand and renewable generation. This paper proposes an advanced ML
algorithm, called Recurrent Trend Predictive Neural Network based Forecast
Embedded Scheduling (rTPNN-FES), to provide efficient residential demand
control. rTPNN-FES is a novel neural network architecture that simultaneously
forecasts renewable energy generation and schedules household appliances. By
its embedded structure, rTPNN-FES eliminates the utilization of separate
algorithms for forecasting and scheduling and generates a schedule that is
robust against forecasting errors. This paper also evaluates the performance of
the proposed algorithm for an IoT-enabled smart home. The evaluation results
reveal that rTPNN-FES provides near-optimal scheduling $37.5$ times faster than
the optimization while outperforming state-of-the-art forecasting techniques.
Mert Nakıp, Onur Çopur, Emrah Biyik, Cüneyt Güzeliş
Renewable Energy Management in Smart Home Environment via Forecast Embedded Scheduling based on Recurrent Trend Predictive Neural Network

###### Abstract

Smart home energy management systems help the distribution grid operate more efficiently and reliably, and enable effective penetration of distributed renewable energy sources. These systems rely on robust forecasting, optimization, and control/scheduling algorithms that can handle the uncertain nature of demand and renewable generation. This paper proposes an advanced ML algorithm, called Recurrent Trend Predictive Neural Network based Forecast Embedded Scheduling (rTPNN-FES), to provide efficient residential demand control. rTPNN-FES is a novel neural network architecture that simultaneously forecasts renewable energy generation and schedules household appliances. By its embedded structure, rTPNN-FES eliminates the utilization of separate algorithms for forecasting and scheduling and generates a schedule that is robust against forecasting errors. This paper also evaluates the performance of the proposed algorithm for an IoT-enabled smart home. The evaluation results reveal that rTPNN-FES provides near-optimal scheduling 37.5 times faster than the optimization while outperforming state-of-the-art forecasting techniques.

keywords: energy management, forecasting, scheduling, neural networks, recurrent trend predictive neural network +
Footnote †: journal: Applied Energy

## 1 Introduction

Residential loads account for a significant portion of the demand on the power system. Therefore, intelligent control and scheduling of these loads enable a more flexible, robust, and economical power system operation. Moreover, the distributed nature of the local residential load controllers increases system scalability. On the distribution level, the smart grid benefits from the increased adoption of residential demand and generation control systems, because they improve system flexibility, help to achieve a better demand-supply balance, and enable increased penetration of renewable energy sources. Increasing flexibility of the building energy demand depends on multiple developments, including accurate forecasting and effective scheduling of the loads, incorporation of renewable energy sources such as solar and wind power, and integration of suitable energy storage technologies (e.g. batteries and/or electric vehicle charging) into the building energy management system. Advanced control, optimization and forecasting approaches are necessary to operate these complex systems seamlessly.
In this paper, in order to address this problem, we propose a novel embedded neural network architecture, called Recurrent Trend Predictive Neural Network based Forecast Embedded Scheduling (rTPNN-FES), which simultaneously forecasts the renewable energy generation and schedules the household appliances (loads). rTPNN-FES is a unique neural network architecture that enables both accurate forecasting and heuristic scheduling in a single neural network. This architecture is comprised of two main layers: 1) the Forecasting Layer which consists of replicated Recurrent Trend Predictive Neural Networks (rTPNN) with weight-sharing properties, and 2) the Scheduling Layer which contains parallel softmax layers with customized inputs each of which is assigned to a single load. In this paper, we also develop a 2-Stage Training algorithm that trains rTPNN-FES to learn the optimal scheduling along with the forecasting. However, the proposed rTPNN-FES architecture does not depend on the particular training algorithm, and the main contributions and advantages are provided by the architectural design. Note that the rTPNN model was originally proposed by Nakip et al. [1] for multivariate time series prediction, and its superior performance compared to other ML models was demonstrated when making predictions based on multiple time series features in the case of multi-sensor fire detection. On the other hand, rTPNN has not yet been used in an energy management system and for forecasting renewable energy generation.

Furthermore, the advantages of using rTPNN-FES instead of a separate forecaster and scheduler are in three folds:

1. rTPNN-FES learns how to construct a schedule adapted to forecast energy generation by emulating (mimicking) optimal scheduling. Thus, the scheduling via rTPNN-FES is highly robust against forecasting errors.
2. The requirements of rTPNN-FES for the memory space and computation time are significantly lower compared to the combination of a forecaster and an optimal scheduler.
3. rTPNN-FES proposes a considerably high scalability for the systems in which the set of loads varies over time, e.g. adding new devices into a smart home Internet of Things (IoT) network.

We numerically evaluate the performance of the proposed rTPNN-FES architecture against 7 different well-known ML algorithms combined with optimal scheduling. To this end, publicly available datasets [2; 3] are utilized for a smart home environment with 12 distinct appliances. Our results reveal that the proposed rTPNN-FES architecture achieves significantly high forecasting accuracy while generating a close-to-optimal schedule over a period of one year. It also outperforms existing techniques in both forecasting and scheduling tasks.

The remainder of this paper is organized as follows: Section 2 reviews the differences between this paper and the state-of-the-art. Section 3 presents the system set-up and initiates the optimization problem. Section 4 presents the rTPNN-FES architecture and the 2-Stage Training algorithm which is used to learn and emulate the optimal scheduling. Section 5 presents the performance evaluation and comparison. Finally, Section 6 summarizes the main contributions of this paper.

## 2 Related Works

In this section, we present the comparison of this paper with the-state-of-the art works in three categories: 1) The works in the first category develop an optimization-based energy management system without interacting with ML. 2) The works in the second category focus on forecasting renewable energy generation using either statistical or deep learning techniques. 3) The works in the last category develop energy management systems using ML algorithms.

### Optimization-based Energy Management Systems

We first review the recent works which developed optimization-based energy management
systems. In [4], Shareef et al. gave a comprehensive summary of heuristic optimization techniques used for home energy management systems. In [5], Nezhad et al. presented a model predictive controller for a home energy management system with loads, photovoltaic (PV) and battery electric storage. They formulated the MPC as a mixed-integer programming problem and evaluated its economic performance under different energy pricing schemes. In [6], Albogamy et al. utilized Lyapunov-based optimization to regulate HVAC loads in a home with battery energy storage and renewable generation. In [7], S. Ali et al. considered heuristic optimization techniques to develop a demand response scheduler for smart homes with renewable energy sources, energy storage, and electric and thermal loads. In [8], G. Belli et al. resorted to mixed integer linear programming for optimal scheduling of thermal and electrical appliances in homes within a demand response framework. They utilized a cloud service provider to compute and share aggregate data in a distributed fashion. In [9], variants of several heuristic optimization methods (optimal stopping rule, particle swarm optimization, and grey wolf optimization) were applied to the scheduling of home appliances under a virtual power plant framework for the distribution grid. Then, their performance was compared for three types of homes with different demand levels and profiles.

There is a wealth of research on optimization and model predictive controller-based scheduling of residential loads. In this literature, usually, prediction of the load demand and generation (if available) are pursued independently from the scheduling algorithm and are merely used as a constraint parameter in the optimization problem. The discrepancy in predicted and observed demand and generation may lead to poor performance and robustness issues. The proposed rTPPN-FES in this paper handles forecast and scheduling in a unified way and, therefore, provides robustness in the presence of forecasting errors.

### Forecasting of Renewable Energy Generation

We now briefly review the related works on forecasting renewable energy generation, which have also been reviewed in more detail in the literature, i.e. [10; 11].

The earlier research in this category forecast energy generation using statistical methods. For example, in [12], Kushwaha et al. use the well-known seasonal autoregressive integrated moving average technique to forecast the PV generation in 20-minute intervals. In [13], Rogier et al. evaluated the performance of a nonlinear autoregressive neural network on forecasting the PV generation data collected through a LoRa-based IoT network. In [14], Fentis et al. used Feed Forward Neural Network and Least Square Support Vector Regression with exogenous inputs to perform short-term forecasting of PV generation. In [15] analyzed the performances of (Autoregressive Integrated Moving Average) ARIMA and Artificial Neural Network (ANN) for forecasting the PV energy generation. In [16], Atique et al. used ARIMA with parameter selection based on Akaike information criterion and the sum of the squared estimate to forecast PV generation. In [17], Erdem and Shi analyzed the performance of autoregressive moving averages to forecast wind speed and direction in four different approaches such as decomposing the lateral and longitudinal components of the speed. In [18], Cadenas et al. performed a comparative study between ARIMA and nonlinear autoregressive exogenous artificial neural network on the forecasting wind speed.

The recent trend of research focuses on the development of ML and (neural network-based) deep learning techniques. In [19], Pawar et al. combined ANN and Support Vector Regressor (SVR) to predict renewable energy generated via PV. In [20], Corizzo et al. forecast renewable energy using a regression tree with an adopted Tucker tensor decomposition. In [21] forecast the PV generation based on the historical data of some features such as irradiance, temperature and relative humidity. In [22], Shi et al. proposed a pooling-based deep recurrent neural network technique to prevent overfitting for household load forecast. In [23], Zheng et al. developed an adaptive neuro-fuzzy system that forecasts the generation of wind turbines in conjunction with the forecast of weather features such as wind speed. In [24], Vandeventer et al. used
a genetic algorithm to select the parameters of SVM to forecast residential PV generation. In [25], van der Meer et al. performed a probabilistic forecast of solar power using quantile regression and dynamic Gaussian process. In [26], He and Li have combined quantile regression with kernel density estimation to predict wind power density. In [27], Alessandrini et al. used an analogue ensemble method to problematically forecast wind power. In [28], Cervone et al. combined ANN with the analogue ensemble method to forecast the PV generations in both deterministic and probabilistic ways. Recently in [29], Guo et al. proposed a combined load forecasting method for a Multi Energy Systems (MES) based on Bi-directional Long Short-Term Memory (BiLSTM). The combined load forecasting framework is trained with a multi-tasking approach for sharing the coupling information among the loads.

Although there is a significantly large number of studies to forecast renewable energy generation and/or other factors related to generation, this paper differs sharply from the existing literature as it proposes an embedded neural network architecture called rTPNN-FES that performs both forecasting and scheduling simultaneously.

### Machine Learning Enabled Energy Management Systems

In this category, we review the recent studies that aim to develop energy management systems enabled by ML, especially for residential buildings.

The first group of works in this category used scheduling (based on either optimization or heuristic) using the forecasts provided by an ML algorithm. In [30], Elkazaz et al. developed a heuristic energy management algorithm for hybrid systems using an autoregressive ML for forecasting and optimization for parameter settings. In [31], Zaouali et al. developed an auto-configurable middle-ware using Long-Short Term Memory (LSTM) based forecasting of renewable energy generated via PV. In [32], Shakir et al. developed a home energy management system using LSTM for forecasting and Genetic Algorithm for optimization. In [33], Manue et al. used LSTM to forecast the load for battery utilization in a solar system in a smart home system. In [34] developed a hybrid system of renewable and grid-supplied energy via exponential weighted moving average-based forecasting and a heuristic load control algorithm. In [35], Aurangzeh et al. developed an energy management system which uses a convolutional neural network to forecast renewable energy generation. Finally, in [36], in order to distribute the load and decrease the costs, Sarker et al. developed a home energy management system based on heuristic scheduling.

The second group of works in this category developed energy management systems based on reinforcement learning. In [37], Ren et al. developed a model-free Dueling-double deep Q-learning neural network for home energy management systems. In [38], Lissa et al. used ANN-based deep reinforcement learning to minimize energy consumption by adjusting the hot water temperature in the PV-enabled home energy management system. In [39], Yu et al. developed an energy management system using a deep deterministic policy gradient algorithm. In [40], Wan et al. used a deep reinforcement learning algorithm to learn the energy management strategy for a residential building. In [41], Mathew et al. developed a reinforcement learning-based energy management system to reduce both the peak load and the electricity cost. In [42], Liu et al. developed a home energy management system using deep and double deep Q-learning techniques for scheduling home appliances. In [43], Lu et al. developed an energy management system with hybrid CNN-LSTM based forecasting and rolling horizon scheduling. In [44], Ji et al. developed a microgrid energy management system using the Markov decision process for modelling and ANN-based deep reinforcement learning for determining actions.

Deep learning-based control systems are also very popular for off-grid scenarios, as off-grid energy management systems are gaining increasing attention to provide sustainable and reliable energy services. In References [45] and [46], the authors developed algorithms based on deep reinforcement to deal with the uncertain and stochastic nature of renewable energy sources.

All of these works have used ML techniques, especially deep learning and reinforcement learning, to
-based scheduling. However, in contrast with rTPNN-FES proposed in this paper, none of them has used ANN to generate scheduling or combined forecasting and scheduling in a single neural network architecture.

## 3 System Setup and Optimization Problem

In this section, we present the assumptions, mathematical definitions and the optimization problem related to the system setup which is used for embedded forecasting scheduling via rTPNN-FES and shown in Figure 1. During this paper, rTPNN-FES is assumed to perform at the beginning of a scheduling window that consists of equal-length \(S\) slots and has a total duration of \(H\) in actual time (i.e. the horizon length). In addition, the length of each slot \(s\) equals \(H/S\), and the actual time instance at which the slot \(s\) starts is denoted by \(m_{s}\). Then, we let \(g^{m_{s}}\) denote the power generation by the renewable energy source within slot \(s\). Also, \(\hat{g}^{m_{s}}\) denotes the forecast of \(g^{m_{s}}\).

We let \(\mathcal{N}\) be the set of devices that need to be scheduled until \(H\) (in other words until the end of slot \(S\)), and \(N\) denote the total number of devices, i.e. \(|\mathcal{N}|=N\). Each device \(n\in\mathcal{N}\) has a constant power consumption per slot denoted by \(E_{n}\). In addition, \(n\) should be active uninterruptedly for \(a_{n}\) successive slots. That is, when \(n\) is started, it consumes \(a_{n}E_{n}\) until it stops. Moreover, we assume that the considered renewable energy system contains a battery with a capacity of \(B_{max}\), where the stored energy in this battery is used via an inverter with a supply limit of \(\Theta\). We assume that there is enough energy in total (the sum of the stored energy in the battery and total generation) to supply all devices within \([0,H]\).

At the beginning of the scheduling window, we forecast the renewable energy generation and schedule the devices accordingly. To this end, as the main contribution of this paper, we combine the forecaster and scheduler in a single neural network architecture, called rTPNN-FES, which shall be presented in Section 4.

**Optimization Problem:** We now define the optimization problem for the non-preemptive scheduling of the starting slots of devices to minimize _user dissatisfaction_. In other words, this optimization problem aims to distribute the energy consumption over slots prioritizing "user satisfaction", assuming that the operation of each device is uninterruptible. In this article, we consider a completely off-grid system -which utilizes only renewable energy sources- where it is crucial to achieve near-optimal scheduling

Figure 1: The illustration of the system considered by rTPNN-FES
to use limited available resources. Recall that this optimization problem is re-solved at the beginning of each scheduling window for the available set of devices \(\mathcal{N}\) using the forecast generation \(\hat{g}^{m_{s}}\) over the scheduling window in Figure 1.

Moreover, for each \(n\in\mathcal{N}\), there is a predefined cost of user dissatisfaction, denoted by \(c_{(n,s)}\), for scheduling the start of \(n\) at slot \(s\). This cost can take value in the range of \([0,+\infty)\), and \(c_{(n,s)}\) set to \(+\infty\) if the user does not want slot \(s\) to be reserved for device \(n\). As we shall explain in more detail in Section 5, we determine the user dissatisfaction cost \(c_{(n,s)}\) as the increasing function of the distance between \(s\) and the desired start time of the considered device \(n\). We should note that the definition of the user dissatisfaction cost only affects the numerical results since the proposed rTPNN-FES methodology does not depend on its definition.

Then, we let \(x_{(n,s)}\) denote a binary schedule for the start of the activity of device \(n\) at slot \(s\). That is, \(x_{(n,s)}=1\) if device \(n\) is scheduled to start at the beginning of slot \(s\), and \(x_{(n,s)}=0\) otherwise. In addition, in our optimization program, we let \(x_{(n,s)}^{*}\) be a binary decision variable and denote the optimal value of \(x_{(n,s)}\). Accordingly, we define the optimization problem as follows:

\[\textit{min}\ \ \sum_{n\in\mathcal{N}}\sum_{s=1}^{S}x_{(n,s)}^{*}c_{(n,s)} \tag{1}\]

subject to

\[\sum_{s=1}^{S-(a_{n}-1)}x_{(n,s)}^{*}=1,\qquad\forall n\in \mathcal{N} \tag{2}\] \[\sum_{n\in\mathcal{N}}\sum_{s^{\prime}=[s-(a_{n}-1)]^{*}}^{s}E_{n }x_{(n,s^{\prime})}^{*}\leq\Theta,\quad\forall s\in\{1,\ldots,S\}\] (3) \[\sum_{n\in\mathcal{N}}\sum_{s^{\prime}=[s-(a_{n}-1)]^{*}}^{s}E_{n }x_{(n,s^{\prime})}^{*}\leq\hat{g}^{m_{s}}+B_{max},\] (4) \[\forall s\in\{1,\ldots,S\}\] \[\sum_{n\in\mathcal{N}}\sum_{s^{\prime}=1}^{s}\sum_{s^{\prime\prime }=[s^{\prime}-(a_{n}-1)]^{*}}^{s^{\prime}}E_{n}x_{(n,s^{\prime\prime})}^{*} \leq B+\sum_{s^{\prime}=1}^{s}\hat{g}^{m_{s^{\prime}}},\] (5) \[\forall s\in\{1,\ldots,S\}\]

where \([\Xi]^{+}=\Xi\) if \(\Xi\geq 1\); otherwise, \([\Xi]^{+}=1\). The objective function (1) minimizes the total user dissatisfaction cost over all devices as (\(\sum_{n\in\mathcal{N}}\sum_{s=1}^{S}x_{(n,s)}^{*}c_{(n,s)}\)). While minimizing user dissatisfaction, the optimization problem also considers the following constraints:

* **Uniqueness and Operation** constraint in (2) ensures that each device \(n\) is scheduled to start exactly at a single slot between 1-st and \([S-(a_{n}-1)]\)-th slot. The upper limit for the starting of the operation of device \(n\) is set to \([S-(a_{n}-1)]\) because \(n\) must operate for successive \(a_{n}\) slots before the end of the last slot \(S\).
* **Inverter Limitation** constraint in (3) limits total power consumption at each slot \(s\) to the maximum power of \(\Theta\) that can be provided by the inverter. Note that the term \(\sum_{s^{\prime}=s-(a_{n}-1)}^{s}x_{(n,s^{\prime})}^{*}\) is a convolution which equals 1 if device \(n\) is scheduled to be active at slot \(s\) (i.e. \(n\) is scheduled to start between \(s-(a_{n}-1)\) and \(s\)).
* **Maximum Storage** constraint in (4) ensures that the scheduled consumption at each slot \(s\) does not exceed the sum of the predicted generation (\(\hat{g}^{m_{s}}\)) at this slot and the maximum energy (\(B_{max}\)) that can be stored in the battery.
* **Total Consumption** constraint in (5) ensures that the scheduled total power consumption until each slot \(s\) is not greater than the summation of the stored energy, \(B\), at the beginning of the scheduling window and the total generation until \(s\). This constraint is used as we are considering a completely off-grid system.

## 4 Recurrent Trend Predictive Neural Network based Forecast Embedded Scheduling (rTPNN-FES)

In this section, we present our rTPNN-FES neural network architecture. Figure 2 displays the architectural design of rTPNN-FES which aims to generate scheduling for the considered window while forecasting the power generation through this window automatically and simultaneously. To this
end, rTPNN-FES is comprised of two main layers of "Forecasting Layer" and "Scheduling Layer", and it is trained using the "2-Stage Training Procedure".

We let \(\mathcal{F}\) be the set of features and \(\mathcal{F}\equiv\{1,\ldots,F\}\). In addition, \(z_{f}^{m_{s}}\) denotes the value of input feature \(f\) in slot \(s\) which starts at \(m_{s}\), where this feature can be considered as any external data, such as weather predictions, that are directly or indirectly related to power generation \(g^{m_{s}}\). We also let \(\tau_{f}\) be a duration of time when the system developer has observed that the feature \(f\) has periodicity; \(\tau_{0}\) represents the periodicity duration for \(g^{m_{s}}\). Note that we do not assume that the features will have a periodic nature. If there is no observed periodicity, \(\tau_{f}\) can be set to \(H\).

As shown in Figure 2, the inputs of rTPNN-FES are \(\{g^{m_{s}-2\tau_{0}},g^{m_{s}-\tau_{0}}\}\) and \(\{z_{f}^{m_{s}-2\tau_{f}},z_{f}^{m_{s}-\tau_{f}}\}\) for \(f\in\mathcal{F}\), and the output of that is \(\{x_{n,s}\}_{n\in\{1,\ldots,N\}}\).

Figure 2: Recurrent Trend Predictive Neural Network based Forecast Embedded Scheduling (rTPNN-FES)
### Forecasting Layer

Forecasting Layer is responsible for forecasting the power generation within the architecture of rTPNN-FES. For each slot \(s\) in the scheduling window, rTPNN-FES forecasts the renewable energy generation \(\hat{g}^{m_{s}}\) based on the collection of the past feature values for two periods, \(\{z_{f}^{m_{s}-2\tau_{f}},z_{f}^{m_{s}-\tau_{f}}\}_{f\in\mathcal{F}}\), as well as the past generation for two periods \(\{g^{m_{s}-2\tau_{0}},g^{m_{s}-\tau_{0}}\}\). To this end, this layer consists of \(S\) parallel rTPNN models that share the same parameter set (connection weights and biases). That is, in this layer, there are \(S\) replicas of a single trained rTPNN; in other words, one may say that a single rTPNN is used with different inputs to forecast the traffic generation for each slot \(s\). Therefore, all but one of the Trained rTPNN blocks are shown as transparent in Figure 2.

The weight sharing among rTPNN models (i.e. using replicated rTPNNs) has the following advantages:

* The number of parameters in the Forecasting Layer decreases by a factor of \(S\); thus reducing both time and space complexity.
* By avoiding rTPNN training repeated \(S\) times, the training time is also reduced by a factor of \(S\).
* Because a single rTPNN is trained on the data collected over \(S\) different slots, the rTPNN can now capture recurrent trends and relationships with higher generalization ability.

#### 4.1.1 Structure of rTPNN

We now briefly explain the structure of rTPNN, which has been originally proposed in [1], for our rTPNN-FES neural network architecture. As shown in Figure 3 displaying the structure of rTPNN, for any \(s\), the inputs of rTPNN are \(\{g^{m_{s}-2\tau_{0}},g^{m_{s}-\tau_{0}}\}\) and \(\{z_{f}^{m_{s}-2\tau_{f}},z_{f}^{m_{s}-\tau_{f}}\}\) for \(f\in\mathcal{F}\), and the output is \(\hat{g}^{m_{s}}\). In addition, the rTPNN architecture consists of \((F+1)\) Data Processing (DP) units and \(L\) fully connected layers, including the output layer.

#### 4.1.2 DP units

In the architecture of rTPNN, there is one DP unit either for the past values of energy generation, denoted by DP\({}_{0}\) or for each time series feature \(f\), denoted by DP\({}_{f}\). That is, DP\({}_{f}\) for any feature \(f\) (including \(f=0\)) has the same structure but its corresponding input is different for each \(f\). For example, the input of DP\({}_{f}\) is \(\{z_{f}^{m_{s}-2\tau_{f}},z_{f}^{m_{s}-\tau_{f}}\}\) corresponding to any time series feature \(f\in\{1,\ldots,F\}\) while the input of DP\({}_{0}\) is the past values of energy generation \(\{g^{m_{s}-2\tau_{0}},g^{m_{s}-\tau_{0}}\}\). Thus, one may notice that DP\({}_{0}\) is the only unit with a special input.

During the explanation of the DP unit, we focus on a particular instance DP\({}_{f}\), which is also shown in detail in Figure 3. Using \(\{z_{f}^{m_{s}-2\tau_{f}},z_{f}^{m_{s}-\tau_{f}}\}\) input pair, DP\({}_{f}\) aims to learn the relationship between this pair and each of the predicted trend \(t_{f}^{s}\) and the predicted level \(l_{f}^{s}\). To this end, DP\({}_{f}\) consists of Trend Predictor and Level Predictor sub-units each of which is a linear recurrent neuron.

As shown in Figure 3, Trend Predictor of DP\({}_{f}\) computes the weighted sum of the change in the value of feature \(f\) from \(m_{s}-2\tau_{f}\) to \(m_{s}-\tau_{f}\) and the previous value of the predicted trend. That is, DP\({}_{f}\) calculates the sum of the difference between \((z_{f}^{m_{s}-\tau_{f}}-z_{f}^{m_{s}-2\tau_{f}})\) with connection weight of \(\alpha_{f}^{1}\) and the previous value of the predicted trend \(t_{f}^{s-1}\) with the connection weight of \(\alpha_{f}^{2}\) as

\[t_{f}^{s}=\alpha_{f}^{1}\,(z_{f}^{m_{s}-\tau_{f}}-z_{f}^{m_{s}-2\tau_{f}})+ \alpha_{f}^{2}\,t_{f}^{s-1} \tag{6}\]

By calculating the trend of a feature and learning the parameters in (6), rTPNN is able to capture behavioural changes over time, particularly those related to the forecasting of \(\hat{g}^{m_{s}}\).

Level Predictor sub-unit of DP\({}_{f}\) predicts the level of feature value, which is the smoothed version of the value of feature \(f\), using only \(z_{f}^{m_{s}-\tau_{f}}\) and the previous state of the predicted level \(l_{f}^{s-1}\). To this end, it computes the sum of the \(z_{f}^{m_{s}-\tau_{f}}\) and \(l_{f}^{s-1}\) with weights of \(\beta_{f}^{1}\) and \(\beta_{f}^{2}\) respectively as

\[l_{f}^{s}=\beta_{f}^{1}\,z_{f}^{m_{s}-\tau_{f}}+\beta_{f}^{2}\,l_{f}^{s-1} \tag{7}\]

By predicting the level, we can reduce the effects on the forecasting of any anomalous instantaneous changes in the measurement of any other feature \(f\).

Note that parameters \(\alpha_{f}^{1}\), \(\alpha_{f}^{2}\), \(\beta_{f}^{1}\) and \(\beta_{f}^{2}\) of Trend Predictor and Level Predictor sub-units are learned
during the rTPNN training like all other parameters (i.e. connection weights).

#### 4.1.3 Feed-forward of rTPNN

We now describe the calculations performed during the execution of the rTPNN; that is, when making a prediction via rTPNN. To this end, first, let \(\mathbf{W}_{l}\) denote the connection weight matrix for the inputs of hidden layer \(l\), and \(\mathbf{b}_{l}\) denote the vector of biases of \(l\). Thus, for each \(s\), the forward pass of rTPNN is as follows:

1. Trend Predictors of DP\({}_{0}\)-DP\({}_{F}\): \[t_{0}^{s}=\alpha_{0}^{1}(g^{m_{s}-\tau_{0}}-g^{m_{s}-2\tau_{0}})+ \alpha_{0}^{2}t_{0}^{s-1},\] \[t_{f}^{s}=\alpha_{f}^{1}(z_{f}^{m_{s}-\tau_{f}}-z_{f}^{m_{s}-2 \tau_{f}})+\alpha_{f}^{2}t_{f}^{s-1},\quad\forall f\in\mathcal{F}\] (8) \[t_{0}^{s}=\alpha_{0}^{1}(g^{m_{s}-\tau_{0}}-g^{m_{s}-2\tau_{0}})+ \alpha_{0}^{2}t_{0}^{s-1},\] \[t_{f}^{s}=\alpha_{f}^{1}(z_{f}^{m_{s}-\tau_{f}}-z_{f}^{m_{s}-2 \tau_{f}})+\alpha_{f}^{2}t_{f}^{s-1},\quad\forall f\in\mathcal{F}\] (9) \[t_{0}^{s}=\beta_{0}^{1}s^{m_{s}-\tau_{0}}+\beta_{0}^{2}t_{0}^{s- 1},\] \[t_{f}^{s}=\beta_{f}^{1}z_{f}^{m_{s}-\tau_{0}}+\beta_{f}^{2}t_{f}^{ s-1},\qquad\forall f\in\mathcal{F}\] (10)
2. Concatenation of the outputs of DP\({}_{0}\)-DP\({}_{F}\) to feed to the hidden layers: \[\mathbf{z}^{s}=[t_{0}^{s},t_{0}^{s},g^{m_{s}-\tau_{0}},\ldots,t_{F}^{s},I_{F}^ {s},z_{F}^{m_{s}-\tau_{F}}]\] (11)
3. Hidden Layers from \(l=1\) to \(l=L\): \[\mathbf{O}_{1}^{s}=\Psi(\mathbf{W}_{1}(\mathbf{z}^{s})^{T}+ \mathbf{b}_{1}),\] (12) \[\mathbf{O}_{l}^{s}=\Psi(\mathbf{W}_{l}\mathbf{O}_{l-1}^{s}+ \mathbf{b}_{l}),\quad\forall l\in\{2,\ldots,L-1\}\] (13) \[\hat{g}^{m_{s}}=\Psi(\mathbf{W}_{L}\mathbf{O}_{L-1}^{s}+\mathbf{ b}_{L}),\] (14)

where \((\mathbf{z}^{s})^{T}\) is the transpose of the input vector \(\mathbf{z}^{s}\)

Figure 3: The structure of rTPNN used in rTPNN-FES
\(\mathbf{O}_{i}^{g}\) is the output vector of hidden layer \(l\), and \(\Psi(\cdot)\) denotes the activation function as an element-wise operator.

### Scheduling Layer

The Scheduling Layer consists of \(N\) parallel softmax layers, each responsible for generating a schedule for a single device's start time. A single softmax layer for device \(n\) is shown in Figure 4. Since this layer is cascaded behind the Forecasting Layer, each device \(n\) is scheduled to be started at each slot \(s\) based on the output of the Forecasting Layer \(\hat{g}^{m_{s}}\) as well as the system parameters \(c_{(n,s)}\), \(E_{n}\), \(B\), \(B_{max}\) and \(\Theta\) for this device \(n\) and this slot \(s\).

In Figure 4, each arrow represents a connection weight. Accordingly, for device \(n\) for slot \(s\) in a softmax layer of the Scheduling Layer, a neuron first calculates the weighted sum of the inputs as

\[\alpha_{(n,s)} = w_{(n,s)}^{g}g^{m_{s}}+w_{(n,s)}^{B}\frac{B}{S}-w_{(n,s)}^{c}c_{(n,s)}\] \[-w_{(n,s)}^{E}E_{n}-w_{(n,s)}^{\Theta}\Theta-w_{(n,s)}^{B_{max}}B_ {max}\]

where all connection weights of \(w_{(n,s)}^{g}\), \(w_{(n,s)}^{B}\), \(w_{(n,s)}^{c}\), \(w_{(n,s)}^{E}\), \(w_{(n,s)}^{\Theta}\), and \(w_{(n,s)}^{B_{max}}\) are _strictly positive_. In addition, the signs of the terms are determined considering the intuitive effect of the parameter on the schedule decision for device \(n\) at slot \(s\). For example, the higher \(g^{m_{s}}\) makes slot \(s\) a better candidate to schedule \(n\), while the higher user dissatisfaction cost \(c_{(n,s)}\) makes slot \(s\) a worse candidate. In addition, a softmax activation is applied at the output of this neuron:

\[x_{(n,s)}\ =\ \Phi(\alpha_{(n,s)})\ =\ \frac{e^{\alpha_{(n,s)}}}{\sum_{s=1}^{S} \alpha_{(n,s)}} \tag{15}\]

### 2-Stage Training Procedure

We train our rTPNN-FES architecture to learn the optimal scheduling of devices as well as the forecasting of energy generation in a single neural network. To this end, we first assume that there is a collected dataset comprised of the actual values of \(g^{m_{s}}\) and \(\{z_{f}^{m_{s}}\}_{f\in\mathcal{F}}\) for \(s\in\{1,\ldots,S\}\) for multiple scheduling windows. Note that rTPNN-FES does not depend on the developed 2-stage training procedure, so it can be used with any training algorithm. For each window in this dataset, the 2-stage procedure works as follows:

#### 4.3.1 Stage 1 - Training of rTPNN Separately for Forecasting

In this first stage of training, in order to create a forecaster, the rTPNN model (Figure 3) is trained separately from the rTPNN-FES architecture (Figure 2). To this end, the deviation of \(\hat{g}^{m_{s}}\) from \(g^{m_{s}}\) for \(s\in\{1,\ldots,S\}\), i.e. the forecasting error of rTPNN, is measured via Mean Squared Error as

\[MS\,E_{\text{forecast}}\equiv\frac{1}{S}\sum_{s=1}^{S}(g^{m_{s}}-\hat{g}^{m_ {s}})^{2} \tag{16}\]

We update the parameters (connection weights and biases) of rTPNN via back-propagation with gradient descent, in particular the Adam algorithm, to minimize \(MS\,E_{\text{forecast}}\), where the initial parameters are set to parameters found in previous training. We repeat updating parameters as many epochs as required without over-fitting to the training samples.

When Stage 1 is completed, the parameters of "Trained rTPNN" in Figure 2 are replaced by the resulting parameters found in this stage. Then, the parameters of Trained rTPNN are frozen to continue further training of rTPNN-FES in Stage 2. That is, the parameters of Trained rTPNN are not updated in Stage 2.

#### 4.3.2 Stage 2 - Training of rTPNN-FES for Scheduling

In Stage 2 of training, in order to create a scheduler emulating optimization, the rTPNN-FES architecture (Figure 2) is trained following the steps shown in Figure 5.

Figure 4: The structure of Scheduling Layer
The steps in Stage 2 shown in Figure 5 are as follows:

1. The optimal schedule, \(\{x_{n,s}^{*}\}_{n\in\{1,\ldots,N\}}^{s\in\{1,\ldots,S\}}\) is computed by solving the optimization problem given in Section 3 in (1)-(5).
2. The feed-forward output of rTPNN-FES, \(\{x_{n,s}\}_{n\in\{1,\ldots,N\}}^{s\in\{1,\ldots,S\}}\), which is the estimation of scheduling, is computed through (6)-(15) using the architecture in Figure 2.
3. The performance of rTPNN-FES for scheduling, i.e. total estimation error of rTPNN-FES, is measured via Categorical Cross-Entropy as \[CCE_{\text{schedule}}\equiv-\sum_{n=1}^{N}\sum_{s=1}^{S}x_{n,s}^{*}\log(x_{n,s})\] (17)
4. The parameters (connection weights and biases) in the "Scheduling Layers" of rTPNN-FES are updated via back-propagation with gradient decent (using Adam optimization algorithm) to minimize \(CCE_{\text{schedule}}\).

As soon as this training procedure is completed, i.e. during real-time operation, rTPNN-FES generates both forecasts of renewable energy generations, \(\{\hat{g}^{m_{s}}\}_{s\in\{1,\ldots,S\}}\) and a schedule \(\{x_{n,s}\}_{n\in\{1,\ldots,N\}}^{s\in\{1,\ldots,S\}}\) that emulates the optimization.

## 5 Results

In this section, we aim to evaluate the performance of our rTPNN-FES. To this end, during this section, we first present the considered datasets and hyper-parameter settings. We also perform a brief time-series data analysis aiming to determine the most important features for the forecasting of PV energy generation. Then, we numerically evaluate the performance of our technique and compare that with some existing techniques.

### Methodology of Experiments

#### 5.1.1 Datasets

For the performance evaluation of the proposed rTPNN-FES, we combine two publicly available datasets [2] and [3]. The first dataset [2] consists of hourly solar power generation (kW) of various residential buildings in Konstanz, Germany between 22-05-2015 and 12-03-2017. Within this dataset, we consider only the residential building called "freq_DE_KN_residential1_pv" which corresponds to 15864 samples in total. The second dataset contains weather-related information which is scraped with World Weather Online (WWO) API [3]. This API provides 19 features related to temperature, precipitation, illumination and wind.

#### 5.1.2 Experimental Set-up

Considering the limitations of the available dataset, we perform our experiments on a virtual

Figure 5: The steps in Stage 2 training of rTPNN-FES to learn to schedule
residential building which is, each year, actively used between May and September. It is assumed that there are 12 different smart home appliances in active months. These appliances are shown in Table 1, where each appliance should operate at least once a day. Note that Electric Water Heater and Central AC operate twice a day, where the desired start times are 6:00 and 17:00 for the heater, and 6:00 and 18:00 for the AC. In order to produce sufficient energy for the operation of these appliances, this building has its own PV system which consists of the following elements: 1) PV panels for which the generations are taken from the dataset [2] explained above, 2) three batteries with 13.5 kWh capacity of each, and 3) inverter with a power rate of 10kW.

Furthermore, during our experimental work, we set \(H=24\)\(h\), and we define the user dissatisfaction cost \(c_{(n,s)}\) for each device \(n\) at each slot \(s\) based on the "Desired Start Time", which is given in Table 1, as

\[c_{(n,s)}=1-\frac{1}{\sigma_{n}\sqrt{2\pi}}\,\exp\left(-\frac{1}{2}\left(\frac{ s-\mu_{n}}{\sigma_{n}}\right)^{2}\right) \tag{18}\]

where \(\mu_{n}\) is the desired start time of \(n\), and \(\sigma_{n}\) is the acceptable variance for the start of \(n\). The value of \(\sigma_{n}\) is 1 for Iron and Electric Water Heater, 2 for TV, Oven, Dishwasher and AC, 3 for Washing Machine and Dryer, and 5 for Robot Vacuum Cleaner. Also, the value of \(c_{(n,s)}\) is set to infinity for \(s\) lower than the earliest start time and for that greater than the latest start time.

Recall that the Water Heater and AC, which are activated twice a day, are modelled as two separate devices.

#### 5.1.3 Implementation and Hyper-Parameter Settings for rTPNN-FES

We implemented rTPNN-FES by using Keras API on Python 3.7.13. The experiments are executed on the Google Colab platform with an operating system of Linux 5.4.144 and a 2.2GHz processor with 13 GB RAM.

Forecasting Layer is trained on this platform via the adam optimizer for 40 epochs with \(10^{-3}\) initial learning rate. In order to exploit the PV generation trend on daily basis, the batch size is fixed at 24. Moreover, an \(L_{2}\) regularization term is injected into Trend and Level Predictors in the rTPNN layer in order to avoid gradient vanishing. Finally, we used fully connected layers of rTPNN which are respectively comprised of \(F+1\) and \(\lceil(F+1)/2\rceil\) neurons with sigmoid activation. Scheduling Layer of each device is trained on the same platform also using the adam optimizer for 20 epochs with a batch size of 1 and initial learning rate of \(10^{-3}\). Note that setting the batch size to 1 is due to the particular implementation of rTPNN-FES which uses the Keras library. In addition, the infinity values of \(c_{(n,s)}\) are set to 100 at the inputs of the scheduling layer in order to be able to calculate the neuron activation. We also set the periodicity \(\tau_{0}\) of \(g^{m_{s}}\) as 24 \(h\).

\begin{table}
\begin{tabular}{|l l l l|} \hline Appliance Name & Power Consumption (kW) & Active Duration & Desired Start Time \\ \hline \hline Washing Machine (warm wash) & 2.3 & 2 & 14 \\ Dryer (avg. load) & 3 & 2 & 16 (earliest 15) \\ Robot Vacuum Cleaner & 0.007 & 2 & 15 \\ Iron & 1.08 & 2 & 8 \\ TV & 0.15 & 3 & 20 \\ *Refrigerator & 0.083 & 24 & non-stop \\ Oven & 2.3 & 1 & 18 \\ Dishwasher & 2 & 2 & 21 \\ Electric Water Heater & 0.7 & 1 & 6, 17 \\ Central AC & 3 & 2 & 6, 18 \\ Pool Filter Pump & 1.12 & 8 & 10 \\ Electric Vehicle Charger & 7.7 & 8 & 21 (earliest 18 latest 23) \\ \hline \end{tabular}
\end{table}
Table 1: Household Appliances in the Smart Home Environment
Furthermore, the source codes of the rTPNN-FES and experiments in this paper are shared in [48] in addition to the repository of the original rTPNN.

#### 5.1.4 Genetic Algorithm-based Scheduling for Comparison

Genetic algorithms (GAs) have been widely used in scheduling tasks due to their ability to effectively solve complex optimization problems. GAs are able to incorporate various constraints and prior knowledge into the optimization process, making them well-suited for scheduling tasks with many constraints. GAs are also able to efficiently search through a vast search space to find near-optimal solutions, even for problems with a large number of variables [49]. These characteristics make GAs powerful tools for finding high-quality solutions in our experimental setup and good candidates to compare against rTPNN-FES.

The experiments are executed on the Google Colab platform with the same hardware configurations of rTPNN-FES. In this experimental setting, a chromosome is a daily schedule matrix. The cross-over is made by swapping device schedules by selecting a random cross-over point out of the total number of devices and mutation is introduced by changing the scheduled time of a single device randomly with probability 0.1. The GA application starts with sampling feasible solutions out of 5000 random solutions as an initial population. After that, 1000 new generations are simulated while the population size is fixed to 200 by making selections in an elitist style.

### Forecasting Performance of rTPNN-FES

We now compare the forecasting performance of rTPNN with the performances of LSTM, MLP, Linear Regression, Lasso, Ridge, ElasticNet, Random Forest as well as 1-Day Naive Forecast.1 Recall that in recent literature, References [31; 32; 33] used LSTM, and Reference [14; 15; 19; 38] used MLP.

Footnote 1: 1-Day Naive Forecast equals to the original time series with 1-day lag.

During our experimental work, the dataset is partitioned into training and test sets with the first 300 days (corresponding to 7200 samples) and the rest 361 days (corresponding to 8664 samples) respectively.

First, Table 2 presents the performances of all models on both training and test sets with respect to Mean Squared Error (MSE), Mean Absolute Error (MAE), Mean Absolute Percentage Error (MAPE) and Symmetric Mean Absolute Percentage Error (SMAPE) metrics, which are calculated as

\[MSE = \frac{1}{S}\sum_{s=1}^{S}(g^{m_{s}}-\hat{g}^{m_{s}})^{2} \tag{19}\] \[MAE = \frac{1}{S}\sum_{s=1}^{S}\left|g^{m_{s}}-\hat{g}^{m_{s}}\right|\] (20) \[MAPE = \frac{100\%}{S}\sum_{s=1}^{S}\left|\frac{g^{m_{s}}-\hat{g}^{m_{ s}}}{g^{m_{s}}}\right|\] (21) \[SMAPE = \frac{100\%}{S}\sum_{s=1}^{S}\frac{\left|g^{m_{s}}-\hat{g}^{m_{ s}}\right|}{(|g^{m_{s}}|+|\hat{g}^{m_{s}}|)/2} \tag{22}\]

In Table 2, the results on the test set show that rTPNN outperforms all of the other forecasters for the majority of the error metrics while some forecasters may perform better in individual metrics. However, observations on an individual error metric (without considering the other metrics) may be misleading due to its properties. For example, the MAPE of Ridge Regression is significantly low but MSE, MAE and SMAPE of that are high. The reason is that Ridge is more accurate in forecasting samples with high energy generation than forecasting those with low generations. Moreover, rTPNN is shown to have high generalization ability since it performs well for both training and test sets with regard to all metrics. Also, only rTPNN and LSTM are able to achieve better performances than the benchmark performance of the 1-Day Naive Forecast with respect to MSE, MAE and SMAPE.

We also see that SMAPE yields significantly larger values than those of other metrics (including MAPE) because SMAPE takes values in [0, 200] and has a scaling effect as a result of the denominator in (22). In particular, the absolute deviation of forecast values from the actual values is divided by the sum of those. Therefore, under- and over-forecasting have different effects on SMAPE,
where under-forecasting results in higher SMAPE.

Next, in Figure 6, we present the actual energy generation between the fifth and the seventh days of the test set as well as those forecast by the best three techniques (rTPNN, LSTM and MLP). Our results show that the predictions of rTPNN are the closest to the actual generation within the predictions of these three techniques. In addition, we see that rTPNN can successfully capture both increases and decreases in energy generation while LSTM and MLP struggle to predict sharp increases and decreases.

Finally, Figure 7 displays the histogram of the forecasting error that is realized by each of rTPNN, LSTM, and MLP on the test set. Our results in this figure show that the forecasting error of rTPNN is around zero for the significantly large number of samples (around 5000 out of 8664 samples). We also see that the absolute error is smaller than 2 for 93% of the samples. We also see that the overall forecasting error is lower for rTPNN than both LSTM and MLP.

### Scheduling Performance of rTPNN-FES

We now evaluate the scheduling performance of rTPNN-FES for the considered smart home energy management system. To this end, we compare the schedule generated by rTPNN-FES with that by optimization (solving (1)-(5)) using actual energy generations as well as the GA-based scheduling (presented in Section 5.1.4). Note that although the schedule generated by the optimization using actual generations is the best achievable schedule, it is practically not available due to the lack of future information about the actual generations.

\begin{table}
\begin{tabular}{|c||c|c|c|c||c|c|c|c|} \hline \multirow{2}{*}{**Forecasting Methods**} & \multicolumn{4}{c||}{**Training Set**} & \multicolumn{4}{c|}{**Test Set**} \\ \cline{2-10}  & **MSE** & **MAE** & **MAPE** & **SMAPE** & **MSE** & **MAE** & **MAPE** & **SMAPE** \\ \hline
**rTPNN** & 2.23 & 1.13 & 3.72 & 51.84 & 2.58 & 1.21 & 10.67 & 54.42 \\ \hline
**LSTM** & 2.18 & 1.18 & 4.95 & 54.83 & 2.56 & 1.26 & 13.59 & 57.98 \\ \hline
**MLP** & 2.77 & 1.35 & 6.33 & 60.57 & 3.09 & 1.42 & 14.25 & 63.06 \\ \hline
**Linear Regression** & 2.78 & 1.28 & 4.92 & 57.71 & 3.16 & 1.35 & 6.08 & 60.38 \\ \hline
**Lasso Regression** & 8.61 & 2.12 & 4.06 & 88.68 & 8.7 & 2.14 & 11.16 & 90.68 \\ \hline
**Ridge Regression** & 2.78 & 1.29 & 4.93 & 57.74 & 3.16 & 1.36 & 6.11 & 60.41 \\ \hline
**ElasticNet Regression** & 8.61 & 2.12 & 4.06 & 88.68 & 8.7 & 2.14 & 11.16 & 90.69 \\ \hline
**RandomForestRegressor** & 0.3 & 0.41 & 1.5 & 24.75 & 3.18 & 1.36 & 6.82 & 60 \\ \hline
**1-Day Naive Forecast** & 3.68 & 1.25 & 2.76 & 56.63 & 4.25 & 1.37 & 1.26 & 58.29 \\ \hline \end{tabular}
\end{table}
Table 2: Comparison of the forecasting performance of rTPNN with that of state-of-the-art forecasters with respect to MSE, MAE, MAPE, and SMAPE excluding nights

Figure 6: Forecasting results of the three most competitive models (rTPNN, LSTM and MLP) with respect to results in Table 2 for the time between fifth and seventh days in the test set

Figure 7: Histogram of the forecasting error in kW measured as (\(\hat{g}^{m_{s}}-g^{m_{s}}\)) for each \(m_{s}\) in the test set
Figure 8 (top) displays the comparison of rTPNN-FES against the optimal scheduling and the GA-based scheduling regarding the cost value for the days of the test set. In this figure, we see that rTPNN-FES significantly outperforms GA-based scheduling achieving close-to-optimal cost. In other words, the user dissatisfaction cost - which is defined in (1) - of rTPNN-FES is significantly lower than the cost of GA-based scheduling, and it is slightly higher than that of optimal scheduling. The average cost difference between rTPNN-FES and optimal scheduling is 1.3% and the maximum difference is about 3.48%.

Furthermore, Figure 8 (bottom) displays the summary of the statistics for the cost difference between rTPNN-FES and the optimal scheduling as well as the difference between GA-based and optimal scheduling as a boxplot. In Figure 8 (bottom), we first see that the cost difference is significantly lower for rTPNN-FES, where even the upper quartile of rTPNN-FES is smaller than the lower quartile of GA-based scheduling. We also

Figure 8: Comparison of rTPNN-FES against the optimal scheduling and GA-based scheduling with respect to the scheduling cost (top) for the days of the test set and (bottom) as the boxplot of the cost difference.
see that the median of the cost difference between rTPNN-FES and optimal scheduling is 0.13 and the upper quartile of that is about 0.146. That is, the cost difference is less than 0.146 for 75% of the days in the test set. In addition, we see that there are only 7 outlier days for which the cost is between 0.19 and 0.3. According to the results presented in Figure 8, rTPNN-FES can be considered as a successful heuristic with a low increase in cost.

### Evaluation of the Computation Time

In Table 3, we present measurements on the training and execution times of each forecasting model. Our results first show that the execution time of rTPNN (0.17 \(ms\)) is comparable with the execution time of LSTM and highly acceptable for real-time applications. On the other hand, the training time measurements show that the training of rTPNN takes longer than that of other forecasting models. Accordingly, one may say that there is a trade-off between training time and the forecasting performance of rTPNN.

Figure 9 displays the computation time of rTPNN-FES and that of optimization combined with LSTM (the second-best forecaster after rTPNN) in seconds. Note that we do not present the computation of GA-based scheduling in this figure since it takes 4.61 seconds on average - which is approximately 3 orders of magnitude higher than the computation time of rTPNN-FES and 1 order of magnitude higher than that of optimization - to find a schedule for a single window. Our results in this figure show that rTPNN-FES requires significantly lower computation time than optimization to generate a daily schedule of household appliances. The average computation time of rTPNN-FES is about 4 \(ms\) while that of optimization with LSTM is 150 \(ms\). That is, rTPNN-FES is 37.5 times faster than optimization with LSTM to simultaneously forecast and schedule. Although the absolute computation time difference seems insignificant for a small use case (as in this paper), it would have important effects on the operation of large renewable energy networks with a high number of sources and devices.

## 6 Conclusion

We have proposed a novel neural network architecture, called Recurrent Trend Predictive Neural Network based Forecast Embedded Scheduling (namely rTPNN-FES), for smart home energy management systems. The rTPNN-FES architecture forecasts renewable energy generation and schedules household appliances to use renewable energy efficiently and to minimize user dissatisfaction. As the main contribution of rTPNN-FES, it performs both forecasting and scheduling in a single architecture. Thus, it 1)

\begin{table}
\begin{tabular}{|c|c|c|} \hline Forecasting & Training Time & Execution Time \\ Methods & (seconds) & (milliseconds) \\ \hline rTPNN & 210 & 0.17 \\ \hline LSTM & 70 & 0.14 \\ \hline MLP & 47 & 0.08 \\ \hline Random & \multirow{2}{*}{11.8} & \multirow{2}{*}{0.12} \\ Forest & & \\ \hline Linear & \multirow{2}{*}{0.004} & \multirow{2}{*}{0.0025} \\ Regression & & \\ \hline Lasso & \multirow{2}{*}{0.005} & \multirow{2}{*}{0.0012} \\ Regression & & \\ \hline Ridge & \multirow{2}{*}{0.004} & \multirow{2}{*}{0.0012} \\ Regression & & \\ \hline Elastic Net & \multirow{2}{*}{0.007} & \multirow{2}{*}{0.0012} \\ Regression & & \\ \hline \end{tabular}
\end{table}
Table 3: Training and Execution Times for Forecasting

Figure 9: Computation time (in seconds) comparison between rTPNN-FES and optimal scheduling under LSTM forecaster
provides a schedule that is robust against forecasting and measurement errors, 2) requires significantly low computation time and memory space by eliminating the use of two separate algorithms for forecasting and scheduling, and 3) offers high scalability to grow the load set (i.e. adding devices) over time.

We have evaluated the performance of rTPNN-FES for both forecasting renewable energy generation and scheduling household appliances using two publicly available datasets. During the performance evaluation, rTPNN-FES is compared against 8 different techniques for forecasting and against the optimization and genetic algorithm for scheduling. Our experimental results have drawn the following conclusions:

* The forecasting layer of rTPNN-FES outperforms all of the other forecasters for the majority of MSE, MAE, MAPE, and SMAPE metrics.
* rTPNN-FES achieves a highly successful schedule which is very close to the optimal schedule with only 1.3% of the cost difference.
* rTPNN-FES requires a much shorter time than both optimal and GA-based scheduling to generate embedded forecasts and scheduling, although the forecasting time alone is slightly higher than other forecasters.

Future work shall improve the training of rTPNN-FES by directly minimizing the cost of user dissatisfaction (or other scheduling costs) to eliminate the collection of optimal schedules for training. In addition, the integration of a predictive dynamic thermal model into the rTPNN-FES framework shall be pursued in future studies. (Such integration is required to utilize more advanced HVAC scheduling/control system designs.) It would also be interesting to observe the performance of rTPNN-FES for large-scale renewable energy networks. Furthermore, since the architecture of rTPNN-FES is not dependent on the particular optimization problem formulated in this paper, rTPNN-FES shall be applied for other forecasting/scheduling problems such as optimal dispatch in microgrids, flow control in networks, and smart energy distribution in future work.
