Optimal ESS Scheduling for Peak Shaving of Building Energy Using Accuracy-Enhanced Load Forecast

: This paper proposes an optimal Energy Storage System (ESS) scheduling algorithm Building Energy Management System (BEMS). In particular, the focus is placed on how to reduce the peak load using ESS and load forecast. To this end, ﬁrst, an existing deep learning-based load forecast method is applied to a real building energy prediction and it is shown that the deep learning-based method leads to an accuracy-enhanced load forecast. Second, an optimization problem is formulated in order to devise an ESS scheduling. In the optimization problem, the objective function and constraints are deﬁned such that the peak load is reduced; the cost for electricity is minimized; and the ESS’s lifetime is elongated considering the accuracy-enhanced load forecast, real-time electricity price, and the state-of-charge of the ESS. For the purpose of demonstrating the effectiveness of the proposed ESS scheduling method, it is implemented using a real building load power and temperature data. The simulation results show that the proposed method can reduce the peak load and results in smooth charging and discharging, which is important for the ESS lifetime.


Introduction
In a city, buildings are the main consumers of electric energy, and their impact on the entire utility grid in cities is fast growing due to an increasing number of buildings and extreme weather changes. Especially, the peak load of huge buildings has been increasing. To supply the load demand even for the peak load, inevitably, the number of power plants needs to be increased, which is not only expensive, but also not good for global warming and CO 2 emission [1]. Therefore, many research efforts have been devoted to reducing the peak load without constructing additional power plants.
The Energy Storage System (ESS) is one of the most popular approaches for such peak shaving by moving the peak load to other times during a day [2][3][4]. As the ESS is expensive, it is important to compute the optimal capacity for a given purpose and to devise a charging and discharging scheme considering both the cost and the ESS's lifetime [5,6]. Recently, research interests are directed to Building Energy Management System (BEMS) or Home Energy Management System (HEMS) that propose ESS scheduling methods in order to decrease the cost for electricity in terms of consumers. Their primary objective is to make a scheduling scheme to charge the ESS during the off-peak time and discharge it during the on-peak time [7,8].
In order to design an optimal ESS scheduling, it is indispensable to have a load forecast method with high accuracy as charging and discharging ESS efficiently according to the load forecast with good accuracy can reduce the peak load and result in cost reduction [9][10][11][12]. Moreover, it is well known that the load power of a building is affected by the outdoor temperature as the use of air conditioning or heating systems can change greatly depending on the outdoor temperature. This means that the accuracy of the load forecast can be improved if better temperature information in terms of accuracy is available. Therefore, forecasting load power and temperature simultaneously for better ESS scheduling or using a method to use temperature information efficiently for load forecast is required. Due to the advances of deep learning, deep learning-based load forecast methods have been drawing attention [13,14]. In addition to the conventional neural network, Recurrent Neural Network (RNN) having feedback structures has been popularly used for the load and temperature forecast as the load demand and temperature during a day can be viewed as a time series which is repeated every day. As the RNN shows weak long-term dependency of the past data owing to its structure, Long Short-Term Memory (LSTM) has been developed and it is also widely used to predict load demand [15][16][17][18][19]. In this paper, both LSTM and Multi-Layer Perceptron (MLP) are used for load and temperature forecasts.
Day-ahead ESS scheduling is heavily dependent on load forecast [20]. Consequently, if the load forecast is not accurate enough, the performance of the ESS scheduling can be poor, which can result in non-trivial cost loss. Therefore, existing results in the literature focus on how to enhance the accuracy of the load forecast and use the load forecast in the ESS scheduling together with various real-time information [21,22]. As the outdoor temperature is the most influential element on the load power, better information on the outdoor temperature can improve the performance of ESS scheduling [15][16][17].
Along this line of research, this paper presents an optimal ESS scheduling method based on the load forecast generated by dual deep learning-based method in which the real-time outdoor temperature information is used to enhance the accuracy of the forecast. The contribution of the paper is threefold: First, it is shown that the recently proposed dual deep learning-based load forecast enhances forecast accuracy when it is applied to real building energy and temperature data. Second, an optimal ESS scheduling based on the accuracy-enhanced load forecast is proposed for peak shaving of building energy. Third, it is demonstrated using real building energy and its outdoor temperature data that the proposed ESS scheduling not only reduces the cost for electricity by achieving better peak shaving, but also takes the ESS's lifetime into account.
As depicted in Figure 1, this paper consists mainly of two parts: load forecast and ESS scheduling. In Section 2, the load forecast using the past load power and outdoor temperature data is described. In addition, it is presented how to enhance the forecast accuracy using the real-time outdoor temperature. Then, based on the load forecast, the proposed ESS scheduling is presented in Section 3. Finally, the performance of the proposed ESS scheduling is validated using the real building data in Section 4.

Building Load Forecast Using Real-Time Temperature Information
This section introduces how to predict the building load using the dual deep learning-based load forecast method proposed in [19]. The forecasting method in [19] is based mainly on two deep learning networks: LSTM and MLP. LSTM forecasts both building load and outdoor temperature for the next 24 h using past load and temperature data, and MLP compensates the load forecast for the next 16 h using the real-time temperature information for 8 h from when the load forecast by LSTM is made. The entire forecasting procedure is described in Figure 2. The trained LSTM is used to generate the load (P) and temperature (T) prediction using the past load P and temperature T. Then, the temperature prediction error ∆T is calculated using real-time temperature information T real-time . The trained MLP computes the expected load power variation ∆P induced by ∆T. Finally, the compensated load power forecastP comp is made by adding ∆P toP. In the next subsection, each network is briefly explained.

Load Demand Forecast Using LSTM
In this paper, LSTM is adopted to predict the building load as the load can be viewed as time-series data. A common LSTM is comprised of a hidden layer called a memory cell and three gates layer controlling the input-output behavior of the memory cell [23]. The three gates consist of one forget gate, one input gate, and one output gate, which are described in (1)-(3), respectively. Each gate has a sigmoid function σ(·) for the activation function, where h t−1 denotes the output of the hidden layer in the previous time step; x t is the input vector; W x and W h are weights for x t and h t−1 , respectively; and b is the bias. Equation (4) computes a candidate of the memory cell for the current time stamp t. From (5), the memory cell is calculated by considering its candidate value (i.e., i t ⊗C t ) and forgetting value in the previous time stamp (i.e., f t ⊗ C t−1 ). Last, the cell state is passed through an activation function as the hidden layer's output, as shown in Equation (6) .
In this work, LSTM is trained using past building load and temperature data such that it predicts both the load and temperature for the next 24 h when the past 24 h load and temperature are given. Figure 3 describes this, and the input and output data of the LSTM are given in the form of Equations (7)-(10), where the data are sampled at every hour, and T and P denote the normalized temperature and power, respectively. Note that the outdoor temperature is the most influential nature parameter on the load power. This is why the past temperature is another input to the LSTM together with the past load power.

Forecast Compensation Using Real-Time Temperature Data
As the building load is heavily dependent on the temperature, it is better to use the real-time temperature for enhancing the accuracy of the load forecast if possible. To this end, the temperate is measured from 00:00 to 07:00 and let us denote the measured temperature by T [0,7] . From 00:00 to 07:00, the load power is similar to the past load data since there are rare people in the building at that time. However, if the temperature is quite different from the past data during the time, the load forecast must be corrected considering the temperature variation. In other words, the load variation ∆P [8,23] can be inferred using the temperature difference ∆T [0,7] =: 7] and MLP. For the sake of correcting the load forecast, an MLP can be designed such that it approximates the following input-output relation (i.e., labeled data for supervised learning).
∆P [8,23] To be specific, in order to train the MLP [24] generating prediction ∆P [8,23] , the training data (∆T [0,7] , ∆P [8,23] ) is made usingP andT by LSTM. With the trained MLP and the measured temperature ∆T [0,7] , ∆P [8,23] is generated, which is added to theP [8,23] made by LSTM in order to compensate the accuracy due to the temperature variation. As ∆T [0,7] can be interpreted as real-time temperature data, this is how the real-time information can be used for the building load forecast. Figure 4 depicts such a prediction. Therefore, when the temperature is measured over [00:00,07:00], the load forecast is compensated as follows.

Optimal ESS Scheduling for Peak Shaving
This section presents the two-step ESS scheduling scheme for peak shaving of building energy using the accuracy-enhanced load forecast in the previous section. First, a day-ahead ESS schedule is made at midnight usingP for the next 24 h [00:00, 23:00]. Second, ESS rescheduling for the next 16 h [08:00, 23:00] is made at 8 AM whenP comp is computed. Figure 6 shows when the scheduling and rescheduling are performed using which load forecast information. As shown in Figure 7, the BEMS determines the amount of charging and discharging of the ESS for a day in order to reduce the peak load using the information on the electricity price, the state of the charge of the ESS, and the load forecast. The proposed ESS scheduling method aims to decrease load peak during the day, thereby reducing electricity price to pay, and also consider ESS lifetime.

Day-Ahead ESS Scheduling
WhenP is generated in the load forecasting, the first step of the ESS scheduling is performed by solving the following optimization problem, (14) subject to ∀t ∈ {0, 1, · · · , 23} where w 1 , w 2 , w 3 , w 4 are constant weights, P (t) ess denotes the amount of charging and discharging from the ESS, c (t) is time-varying electricity price, and P (t) shave is the load power in between the load forecast and P peak . Here, P peak is a tuning parameter and denotes the desired peak load. Therefore, the load power higher than P peak has to be provided by the ESS for peak shaving. P (t) shave implies the shaved load power by the ESS. This is modeled by the first term P (t) shave +P (t) ess in the objective function, see Figure 8. Besides, SoC (t) denotes the state of charge of the ESS,P (t) grid is the estimated amount of electricity purchasing from the utility grid in the proposed scheduling, P max is the maximum output of the ESS, and SoC min and SoC max are the minimum and maximum of SoC (t) . E c denotes the capacity of the ESS and η efficiency of charging and discharging. In Equation (22), α is a small constant.
The objective function in (14) consists of four parts. The first term represents the cost of ESS scheduling. To be specific, the scheduling algorithm determines P (t) ess considering c(t) and P

(t)
shave such that the corresponding cost for the peak shaving becomes as cheap as possible.Consequently, the first term makes the ESS charge when the electricity price is cheap and discharge when it is expensive such as during the on-peak time. The second term makes the ESS used as small as possible. The third term tries to achieve peak shaving as much as possible. Note that reducing the size ofP (t) grid −P peak by discharging means increasing the amount of the peak shaving. The fourth term prevents P (t) ess from rapidly changing. Therefore, the first and third terms consider the peak load shaving, and the second and last terms take the ESS's lifetime into account.
Equations (15)-(22) represent constraints modeling various situations in the ESS scheduling. Equation (15) denotes the estimated amount of provided electricity from the utility grid, and P (t) ess ≥ 0 implies charging and P (t) ess < 0 implies discharging in this paper. Equation (16) is a natural constraint on the positiveness of the provided electricity from the utility grid. Constraints (17) means that load only higher than P peak is shaved by the ESS, which means that the ESS provides electricity only when [0,23] ≥ P peak , as shown in Figure 8. Equation (18) implies that P (t) ess can not shave (i.e., discharge) more than P (t) shave . Moreover, constraint (18) implies that P (t) ess is affected by P peak owing to the definition of P (t) shave . Equation (19) shows how SoC (t) evolves according to the charging or discharging where Equations (20) and (21) are the upper and lower bounds of charging and discharging, and SoC (t) . Equation (22) makes SoC (t) of the ESS at 23:00 similar every day in order to make the ESS be ready for the next day since the sum of the amount of charging and discharging is equal to almost zero (i.e., α). Notice that the third term in the objective function makes the ESS charge after the on-peak time but the ESS also has to satisfy constraint (22). In such an optimization based decision making, recursive feasibility is important. Note that the optimization problem (14) is always feasible asP (t) grid is not bounded above. As seen in the optimization (14), the performance of the scheduling is heavily dependent on the accuracy of the load forecastP (t) . Therefore, if it is allowed to use the load forecast with better accuracy, it is also possible to obtain better performance of ESS scheduling, i.e., better peak shaving. In the next section, it is shown how the accuracy-enhanced load forecast is used in the ESS rescheduling.

ESS Rescheduling Using Accuracy-Enhanced Load Forecast
WhenP (t) comp (i.e., compensatedP [8,23] ) is computed as explained in the previous section, ESS charging and discharging can be rescheduled usingP (t) comp for the rest of the day, i.e., from 08:00 to 23:00. The optimization problem for ESS rescheduling is given by subject to ∀t ∈ {8, 9, · · · , 23} Note that, in (23), the same variable names are used as in (14) for only notational simplicity. Compared with (14), the main difference isP (t) comp in (26) instead ofP (t) . All the others are exactly the same as (14). Because the accuracy ofP (t) comp is better thanP (t) [8,23] , the performance of peak shaving can be improved since the scheduler tries to charge or discharge better in advance in order to handle the peak load more efficiently using the accuracy-enhanced load forecastP (t) comp . In the next section, the proposed ESS scheduling is implemented using real building load and temperature data. It is shown that the ESS scheduling with the accuracy-enhanced load forecast indeed leads to better peak shaving.

Case Study
In this section, the previously presented load forecast and ESS scheduling are implemented using real building load data and it is shown that the proposed method leads to lower cost by doing peak shaving better.

Load Demand Forecast
For the purpose of training the LSTM and MLP network, energy and temperature data from the real building obtained from the work in [25] are used. The building is located at Richland, WA and the consumed electric power and temperature outside the building are measured at every hour of weekdays from 2009 to 2011. Especially, summer data from June to September is used. For example, Figure 9 depicts the consumed power and temperature for every July from 2009 to 2011. In other words, daily data of the load power and outdoor temperature are overlapped for July of 2009 to 2011. In view of Figure 9, the outdoor temperature and load power show synchronous behavior, which confirms the underlining assumption that the outdoor temperature is the most influential on the load power.
For the LSTM, data from 2009 is used for training and data from 2010 for testing. The LSTM and MLP parameters are given in Table 1 and these parameters are chosen by trial and error considering the performance of the forecast. The training is implemented using Tensorflow 2.0 in Intel(R) Core(TM) i7-4790 with 8GB memory [26].  The trained LSTM is tested using the data from 86 weekdays of 2010. Among the testing result (i.e., forecast), the forecast for five consecutive days is shown in Figure 10 in which the upper panel is about load demand and the lower panel the temperature. Figure 10 demonstrates that the load and temperature forecast are similar to their real values but there are nontrivial errors. In view of the relation between real data and forecast in Figure 10, two observations can be made. First, the load power (i.e., consumed electric power) relies heavily on the temperature. Although it is well-known and natural, it can be verified from data and prediction. This again means that the better temperature information can bring about better load forecast. Second, ∆T := T −T > 0 is obtained in the third and fifth days and ∆T < 0 in the other days. When ∆T > 0, the corresponding ∆P := P −P is high. On the other hand, when ∆T < 0, the corresponding ∆P is small. Such a relation is also observed in the temperature and load forecast for most 86 days. This can be interpreted as more energy is consumed when the true temperature is higher than the forecast (i.e., expected temperature). However, when the true temperature is lower than the forecast, energy consumption is similar to the past consumption.

Compensating Load Forecast
In order to compensate the load forecast, the MLP presented in the previous section is trained. For training data of the MLP, ∆T [0,7] and ∆P [8,23] are computed using Equations (11) and (12) based on the data from 2010 and they are shown in Figure 11. ∆T [0,7] denotes the temperature deviation from 00:00 to 07:00 and ∆P [8,23] represents the load power deviation from 08:00 to 23:00.
In Figure 11b, ∆P [8,23] after 18:00 is quite small as the dependency between load and temperature is weak during that time period. Note that the building under consideration is a commercial building and there are rare people in the building after 18:00. The parameters of the MLP are shown in Table 1. The testing result with arbitrary value of ∆T [0,7] is shown in Figure 12a,b. In light of Figure 12a,b, it can be shown that reasonable ∆P [8,23] is generated according to positive and negative ∆T [0,7] . These testing results are consistent with the observation made in Figure 10 in the sense that ∆T > 0 leads to relatively high ∆P and ∆T < 0 results in negligible ∆P. To see the compensation performance, the data from 2011 is used. First, the trained LSTM generates the load forecastP for 2011. Second, the compensation ∆P [8,23] made by the MLP is added toP over the time interval [8,23] in accordance with Equation (13). By doing this repeatedly,P comp is generated for 85 days and the forecast pattern and accuracy are similar for 85 days. The forecast of 5 days out of them is depicted in Figure 13. (a) ∆P [8,23] with arbitrary positive value of ∆T [0,7] (b) ∆P [8,23] with arbitrary negative value of ∆T [0,7] Figure 12. ∆P [8,23] with arbitrary ∆T [0,7] . Figure 13 shows that the performance of the compensated load forecast is indeed better than the forecast by only the LSTM, which can also be verified using Root Mean Square Error (RMSE) given in Table 2.

RMSE Value
PredictionP by only the LSTM 5.078 Compensated predictionP comp 4.306

ESS Scheduling
Based on the compensated load forecast using real building data, the ESS scheduling depicted in Figure 6 is done by solving the optimization problems (14) and (23). The optimization problems are solved using the CVX toolbox in MATLAB [27], and the parameters are shown in Table 3. The scheduling result is shown in Figure 14. In Figure 14, the first panel shows the real load power P real ,P by LSTM only, andP comp . Note that the ESS is scheduled to dispatch for only the load in between the load forecast (i.e.,P orP comp ) and P peak . For instance, in Figure 14 the red area is wider than the blue area asP comp is much closer to the real load thanP. In the second panel of Figure 14, the blue line is the provided power from the utility grid without using the ESS, the orange line the provided power using the ESS scheduling withP, and the red dashed line the provided power using the ESS scheduling witĥ P comp . The red dashed line shows that the proposed ESS scheduling reduces the peak load successfully especially when the accuracy-enhanced load forecast is employed. Besides, the green line denotes the electricity price for a day. The on-peak time is defined from 11:00 to 15:00 on which the price is 5 times more expensive than the normal price. In the third panel in Figure 14, the orange line and the red dashed line are the ESS outputs when the scheduling is done withP andP comp , respectively. The circle and asterisk denote the corresponding SoC evolution. Note that the ESS scheduling based onP comp charges more during the off-peak time in order to reduce the peak load during the on-peak time. As the ESS is charged during the off-peak time and discharge more during the on-peak time, the electricity price to pay is reduced. Indeed, the cost (i.e., c (t) P (t) grid ) for consumed electricity is 1772 when the ESS scheduling is based onP comp while 1887 when the ESS scheduling usesP computed by LSTM only. Note that P (t) grid denotes consumed electricity, i.e., the total electricity provided by the utility grid, and that P (t) grid is used for computing the cost instead ofP (t) grid , which is used in the optimization (14) and (23) for the scheduling. Moreover, note that the ESS starts to charge right after on-peak time due to the constraint (31) (or (22)). In the simulation of Figure 14, P peak is determined such that the blue area becomes 50% of the ESS capacity.  In Figure 15, similar simulation is done but different electricity price (c (t) ) profile is used. In the second figure of Figure 15, the green line denotes the electricity price (c (t) ) profile. Again, the red dashed line shows that the proposed method reduces the peak load successfully this electricity price (c (t) ) profile. The price has three levels: off-peak, shoulder, and on-peak. The on-peak time is the same as the previous simulation, and the shoulder time is from 05:00 to 10:00 and from 16:00 to 18:00, and the other times are off-peak times. During the shoulder, the electricity price is double that of the off-peak time and it is five times during the on-peak time. In view of the simulation results with this setting in Figure 15, again, it is verified that the ESS scheduling with the accuracy-enhanced load forecast leads to cheaper cost compared with that using LSTM based load forecast. In other words, the cost changes from 2193 to 2094. Figure 16 shows the cost before (blue bar) and after (red bar) compensation for the total test data. It is shown that the proposed ESS scheduling using the compensated load forecast leads to a lower cost for the most testing days. Considering the sum of the electricity rate for all testing 85 days, it costs 136,550 before compensation while 133,590 after compensation.

Discussion: Effect of Tuning Parameters on Performance
In the proposed ESS scheduling method, there are two kinds of tuning parameters: w 1 , w 2 , w 3 , w 4 and P peak . As the role of w 1 and w 2 is rather straightforward, in this section, it is shown that how parameters w 3 , w 4 and P peak influence on the performance of the ESS scheduling. For comparison purpose, the parameters setting used in Figure 14 are the baseline case. Figure 17 shows how the cost (i.e., c (t) P (t) grid ) changes according to w 3 and w 4 . With the parameters w 3 = 0.015 and w 4 = 0.008 resulting in the lowest cost, all the previous simulations are done. As not only the cost but also ESS lifetime matter in this paper, ESS charging and discharging pattern are investigated in accordance with various w 3 and w 4 in Figures 18 and 19. Note that smooth charging and discharging are helpful to the ESS lifetime in addition to satisfaction of SoC constraints (28). As seen in Figures 18, the peak shaving is carried out better as w 3 increases with fixed w 4 = 0.008. Furthermore, the charging and discharging become smoother as w 4 increases with fixed w 3 = 0.015 in Figures 19.

Effect of P peak
In Figures 20 and 21, the effect of parameter P peak is tested, and Table 4 summarizes the parameters setting and simulation results. As shown in Table 4, when P peak is lower than the baseline (i.e., Case 1), the resulting cost is reduced since the amount of charging and discharging becomes larger. However, such active charging and discharging can decrease the lifetime of the ESS. In contrast, when P peak is higher than the baseline (i.e., Case 2), the situation is the other way around. Therefore, a trade-off has to be considered in real application between the reduced electricity cost and the cost due to the reduced lifetime of the ESS.

Conclusions
This paper proposed an ESS scheduling for peak load shaving in building energy management. Especially, a focus is placed on how to use the load forecast effectively in the ESS scheduling. To this end, first, an existing method to enhance the accuracy of the load forecast is applied to real building energy and temperature data and it is verified that the accuracy of the resulting load forecast is indeed improved. Second, an optimization problem is formulated for the ESS scheduling using the previously obtained accuracy-enhanced load forecast. The proposed ESS scheduling is tested using load power and temperature data from a real commercial building. Simulation results demonstrate that the proposed ESS scheduling reduces the peak load successfully. Moreover, it is discussed how to tune the parameters in the optimization in order to take both the reduced cost by the peak shaving and the ESS lifetime into account. One implication of this paper is that not only historical data but also real-time data on nature and building need to be used properly for efficient building energy management in today's big data era. Therefore, more effort has to be put to collect and analyze the data, and to extract required important information from the data for better building energy management.
Only the outdoor temperature is considered, which has an effect on the load power in this paper and the detailed information of the building is not used in the forecast and the ESS scheduling. Therefore, a natural future work is to take more information affecting the load power such as humidity into account for load forecast and to consider various indoor building parameters for the ESS scheduling. Furthermore, another promising future work includes reinforcement learning based ESS scheduling which can replace the optimization in this paper.

Conflicts of Interest:
The authors declare no conflicts of interest.

Abbreviations
The following abbreviations are used in this manuscript.

∆T
Deviation of temperature prediction (T −T). ∆P Deviation error of load prediction (P −P). P comp Compensated prediction of the load power.

ESS Scheduling t
Hourly time interval.
Power from the ESS.
Power between the load forecast and P peak .
Estimated power purchased from the utility. P peak A tuning parameter for peak shaving.
State of charge of the ESS. c (t) Electricity price.
Power purchased from the utility.