Handling Load Uncertainty during On-Peak Time via Dual ESS and LSTM with Load Data Augmentation

: This paper proposes a scheduling method of dual ESSs (Energy Storage Systems) for the purpose of reducing the peak load when there are sudden loads or generation changes during the on-peak time. The ﬁrst ESS is scheduled once a day based on a day-ahead load prediction, and the second ESS is scheduled every 15 min during on-peak time based on a short-term load prediction by LSTM (Long Short-Term Memory). Special attention is paid to training the LSTM for the short-term load prediction by using the augmented past load data which is generated by adding possible uncertainties to the past load and temperature data. Based on the load forecast, optimization problems for the scheduling are formulated. The proposed scheduling method is validated using load and temperature data from a real building. In other words, when the proposed method is applied to the real building energy data in the case study, it not only shaves the peak load during on-peak time interval effectively but also results in lower electricity price although there are sudden load or temperature changes during the time interval.


Introduction
As the number of big buildings has increased, there has been an increase not only in their energy consumption and CO 2 emission but also in their proportion of global total energy consumption and CO 2 emissions. For instance, electricity consumption in buildings was about 55% of global total electricity consumption in the year 2019 [1]. Hence, it is of the utmost importance to devise building energy management systems (BEMS) in order to manage the total energy consumption efficiently.
In recent BEMS's research, a large amount of effort is directed to integrating renewable energy sources (RES) systematically [2]. Since RES is intermittent by nature and the load is unknown, inevitably BEMS has to be devised in such a way that it can deal with uncertainties in both the load and RES. ESS (Energy Storage Systems) are known to be the most efficient method to handle this problem. Consequently, one of the most important BEMS's tasks is to have an algorithm to charge and discharge ESS in such a way that the management of the building's energy is carried out successfully in terms of supply-demand balance, low electricity prices, and lower peak loads, etc. BEMS charges ESS when the demand is low and discharges it when the demand is high for the purpose of reducing electricity prices or the peak load during on-peak times [3,4].
The optimal ESS charging and discharging during a day has to be performed while taking the load into account. However, the load is unknown in advance, which means that BEMS has to be able to predict the load [5]. Various artificial intelligence-based methods for load prediction have been developed using ANN (Artificial Neural Network) [6,7] and RNN (Recurrent Neural Network) for sequential data prediction [8]. To overcome the weak long-term dependency of RNN, the LSTM (Long Short-Term Memory) network has been made and popularly applied to forecast loads [9][10][11]. Recently, GRU (Gated Recurrent Units) have been developed in order to reduce the number of parameters in LSTM and improve the convergence speed of training, and they are also employed to predict the load [12,13].
Usually, there are two approaches for ESS operation in BEMS. In the first approach, a day-ahead load prediction is made at the beginning of a day, and the schedule of charging and discharging is determined for the day considering the prediction. When a day starts, BEMS charges or discharges ESS following the determined schedule. In the offline scheduling approach, ESS works such that supply-demand balance is maintained and the electricity price according to ToU (Time-of-Use) is minimized [14,15]. This approach cannot deal with any uncertainties in the load or the temperature during the on-peak time since charging and discharging are scheduled at the beginning of a day. The other possible approach is to use another ESS, which is used online using real-time information on load and temperature to achieve the objectives of the BEMS, such as peak reduction. This second ESS is used under the assumption that the first ESS operates in accordance with the schedule made at the beginning of the day. As a compromise of these two approaches, in [16,17], only one ESS is employed, but it is re-scheduled at a certain time during a day based on real-time information.
Recently, renewable generation and EV (Electrical Vehicles) charging stations have been installed in buildings. Although they provide more electrical power and convenience, it is difficult to predict how much power must be generated by renewable generation sources and how much will be consumed by EVs during a day. If during on-peak times renewable generation produces less electricity than forecast or many EVs try to charge simultaneously, then the peak load can be very large. Hence, online real-time monitoring and ESS scheduling are important in order to deal with such situations. For instance, a real-time ESS operation method is developed to handle uncertainties [18][19][20]. A multi-time scale coordination is devised to reduce the effect of uncertainties [21,22] in BEMS operation. An optimal online ESS operation method to take uncertainties in solar generation and load variation into account using stochastic programming is designed in [23]. Furthermore, real-time energy management for apartment buildings using MPC (Model Predictive Control) [24], and energy management considering random events such as EV charging have been an emerging research area [25,26].
Along this line of research, this paper focuses on real-time ESS scheduling for peak load reduction when there is a large discrepancy in supply and demand during on-peak times. To this end, it is assumed in this paper that there are two ESSs: one (called ESS off hereafter) is scheduled offline using a day-ahead load prediction and the other (called ESS on hereafter) is scheduled online and is charged or discharged during on-peak time based on real-time short-term load predictions. ESS on is necessary because the scheduled plan for ESS off might not be effective to reduce the peak load due to the uncertainties during on-peak time period. Hence, the performance of ESS on is heavily dependent on real-time short-term load prediction. Roughly speaking, ESS off deals with a slowly varying deficient load and ESS on works for a rapidly varying deficient load.
The main contribution of the paper is twofold. First, for the purpose of scheduling ESS on , a short-term prediction based on LSTM and past temperature and load is developed. Especially, the training data for the LSTM is augmented such that the possible uncertainties during on-peak time are added to the past load and temperature data. The trained LSTM is used to predict the load during the on-peak time period. Second, using the short-term prediction by the LSTM, an optimization is formulated to make a plan for charging and discharging of ESS on . In the optimization, various requirements on, for example, SoC (State of Charge) limit of the amount of charging and discharging at a time are modeled as constraints in the optimization. A case study using real temperature and load data of a building shows that the proposed scheduling method for ESS on successfully reducing the peak load and thereby reducing the electricity cost. This means that the proposed method deals with uncertainties during the on-peak time efficiently.
In this paper, the variables with subscript 'off' mean that they are determined offline while the variables with subscript 'on' are determined online.
The paper is organized as follows. In Section 2, the configuration and objective of the paper are introduced. In Section 3, the proposed online ESS scheduling method is presented, which is followed by a case study based on real building data in Section 4. Section 5 concludes the paper.

Objective and Description of the Proposed Method
In this section, the problem under consideration and the structure of the proposed BEMS are described. The proposed BEMS schedules a dual ESS (ESS off and ESS on ) by solving optimization problems. The optimization problems rely on load predictions made by LSTM (Long Short-Term Memory). Figures 1 and 2 describes the proposed BEMS. The mathematical symbols in Figure 2 are explained in the next section.  To be specific, in offline mode, the two-deep learning networks LSTM off and LSTM on are trained using the past temperature and load data set. Then, at the beginning of a day, the trained LSTM off computes a day-ahead load prediction and the prediction is used to define an optimization problem with decision variables P ESS off,0 , · · · , P ESS off,23 for scheduling ESS off where P ESS off,t denotes the amount of charging or discharging for ESS off every hour (i.e., 24 times of charging or discharging a day). In addition, during an on-peak time period, LSTM on generates the load prediction every 15 min for the next 1 h to consider uncertain situations which are not taken into account in LSTM off (or scheduling ESS off ). Based on short-term predictions by LSTM on including current load (i.e., P 0 ,P on,1 , · · · ,P on,4 ), an optimization problem with decision variables P ESS on,0 , · · · , P ESS on,4 (i.e., 5 × 15 min) is defined for charging and discharging plan for ESS on . Then, only the first element P ESS on,0 of the optimal solution is applied to ESS on , and this procedure is repeated every 15 min similar to the receding horizon implementation in MPC (Model Predictive Control) [27]. The main objective of the BEMS design in this paper is to reduce the peak load during on-peak times by scheduling ESS on based on short-term load prediction by LSTM on , which is trained using the augmented load data to deal with abrupt large load changes. In achieving the objective, physical constraints such as SoC bounds or the limit of ESS output are taken into account.

Proposed Method
In this section, details of the proposed method are described. The results consist of offline ESS scheduling and online scheduling. The offline ESS scheduling is a modified result of that in [17] and the focus of this paper is mainly placed on the online ESS scheduling. Hence, offline ESS scheduling is briefly reviewed for the self-sufficient presentation of the main result and then the proposed online ESS scheduling is presented. In building energy management, a day-ahead load prediction is indispensable for optimization-based ESS scheduling. Since LSTM is efficient at predicting time series data [28], it is employed to forecast the load demand of the building. Since LSTM is already a well-known deep learning technique, it is not explained here. For details, see [17,28].

ESS off
For a day-ahead prediction, LSTM off is trained using past building loads. In this work, the load data are assumed to be measured and saved every hour. Moreover, to enhance the prediction accuracy, hourly measured outdoor temperature data are also used. Hence, the input data to LSTM off for training is of the form {P t−j , T t−j } (j = 1, · · · , 24) and {P t , P t+1 , · · · , P t+23 } is used as the output of the network. When LSTM off is trained, if {P t −j , T t −j } (j = 1, · · · , 24) is injected into the trained LSTM off , LSTM off generates {P off,t ,P off,t +1 , · · · ,P off,t +23 } as the load prediction for the next 24 h.

Scheduling ESS off via Optimization
For the purpose of scheduling ESS off , the trained LSTM off generates the load prediction P off,t at midnight for the next 24 h using the load and temperature data from the previous day. Then, to decide the amount of charging and discharging P ESS off,t for the next 24 h, an optimization problem is formulated on the basis of the prediction as follows: where C g,t is the constant denoting the electricity price at time t andP g1,t is the estimated amount of electricity to be used. Hence, the first term C g,tPg1,t in the objective function denotes the estimated electricity cost that will be paid. w i (i = 1, 2, 3) are weights that make each term contribute similarly to the entire objective function. P g,min in (1c) represents the contracted minimum amount of electricity from the main grid during on-peak time.
It is assumed that the operator of the building's energy provides the main grid operator with this information. It is useful to define P g,min for not only the energy manager of the building's energy but also the main grid operator since the existence of such a value can help make a long-term energy plan for both the building and the main grid. P gL1,t is the difference between P g,min andP g1,t at time t during the on-peak time. Since the contract is made between the building energy operator and the grid operator such that the building spends at least P g,min electricity during the on-peak time, a penalty has to be imposed on P gL1,t , which is expressed using the second term w 1 P gL1,t . P ESS off,t is the amount of charging or discharging from ESS off at time t. Hence, the third and fourth terms in the objective function imply that the variation and amount of charging or discharging have to be small. Such consideration is helpful for both health and lifetime of the ESS. Note that P ESS off,t ≥ 0 implies charging and P ESS off,t < 0 means discharging. (1d) denotes how SoC off,t changes according to P ESS off,t where η and E c1 denote the efficiency of P ESS off,t and the capacity of ESS off . (1e,f) are the constraints on SoC off,t and P ESS off,t , respectively. The last constraint (1g) is used to maintain the initial value of SoC off,t to a constant value at the beginning of a day by setting the α small enough. Note that α ≡ 0 leads to an equality constraint that can restrict the feasibility of the problem. The optimization problem is a modified version of that in [17].
After computing the predictionP off,t by LSTM off , if the operator solves the optimization problem (1), the result can be depicted by Figure 3. In Figure 3, k is the start point of the on-peak time period and p is the length of the on-peak time period, andP off,t andP g1,t denote the load power prediction before and after ESS off is applied, respectively. Note that the peak ofP off,t is reduced thanks to ESS off . Mostly, ESS off discharges during on-peak time ∈ [k, k + p] to reduce the electricity cost with P g,min being the minimum, and charges during off-peak time to satisfy (1g). Therefore, comparingP off,t withP g1,t employing ESS off , peak reduction is achieved, thereby resulting in lower cost. Note that reducing the peak ofP g1,t can bring about a reduction of the real consumed power. On the other hand, if the load uncertainty in real-time is denoted by ϕ t , then the real load can be expressed by P g1,t =P off,t + P ESS off,t + ϕ t . This means that the cost for buying electricity from the main grid can vary significantly depending on the load uncertainty from the offline forecast. If the uncertainty is small, the cost variation becomes acceptable, but the cost will not be trivial if the uncertainty is significant due to, for example, abrupt large load changes such as charging electric vehicles. To deal with these situations, we present strategies on how to reduce the effect of the uncertain load during the on-peak times by improving the performance of the short-term load prediction, and how to operate ESS on based on the enhanced short-term load prediction.

ESS on Scheduling
Under the assumption that ESS off is scheduled, this section presents a scheduling method for ESS on which works mainly during the on-peak time period. LSTM on is trained using augmented past load and temperature data for online short-term load forecasting first, and then a charging and discharging strategy is proposed using the online load forecast by using LSTM on and convex optimization.

Online Short-Term Load Forecast via LSTM with Data Augmentation
ESS on is employed in this work for the purpose of handling sudden large variations in load or temperature during the on-peak time period and is scheduled based on short-term load forecasts by LSTM on . Hence, LSTM on has to be trained such that it can generate short-term load forecasts even when there are unexpected load or temperature variations that do not exist in the past data. To this end, the past load and temperature data can be augmented [29]. The augmented data can be generated by adding possible values of sudden uncertainties (synthetic uncertainties) considering the possible situations in the building to past load and temperature data. To generate the synthetic uncertainties systematically, a probability density function (PDF) such as a Gaussian distribution can be used [30].
In other words, the synthetic uncertainties are generated by sampling data using a PDF, and it is added to the past data. For details, see the next section.
With this augmented data, LSTM on is trained such that its input {P t−i∆t m , T t−i∆t m }(i = 0, · · · , 7) and its output {P t+∆t m , · · · , P t+4∆t m }, where ∆t m is 15 min. When the training is complete, the trained LSTM on generates {P on,t +∆t m , · · · ,P on,t +4∆t m } when {P t −i∆t m , T t −i∆t m } is given as the input to LSTM on . Hence, the trained LSTM on forecasts the next one-hour load and its resolution is 15 min. Such LSTM on is expected to generate more accurate shortterm load forecasts compared with the day-ahead load forecast when there are nontrivial variations in load or temperature.

Online ESS Operation
This subsection presents a scheduling ESS on via convex optimization based on the short-term load forecastP on,t by LSTM on .
During on-peak times, a short-term load prediction is made every 15 min for the next hour. In other words, at time k during the on-peak time period, the short-term load forecast {P on,k+∆t m , · · · ,P on,k+4∆t m } is generated every ∆t m . Then, the following optimization problem is solved with the forecast.
P gL2,t = P g,min −P g2,t ,P g2,t < P g,min 0, else (2d) where P ESS on,t denotes the amount of charging or discharging from ESS on at time t. In the cost function (2a), w 4 P gU2,t penalizes the power when it is higher thanP g1,t + δ. The first term makes ESS on work only when the difference between the required loadP g2,t computed online andP g1,t computed offline is higher than δ. Since ESS on is usually expensive equipment, it is used only when there are large uncertainties. As depicted in Figure 4, ESS on makesP g2,t be between the two red dashed lines,P g1,t + δ and P g,min , during on-peak time.
In other words, if the uncertainties predicted by the online load forecast are small, ESS on does not do anything, which is helpful for the lifetime of ESS on . On the contrary, if the estimated uncertainty is nontrivial, ESS on tries to reduce the effect of the uncertainty. In the first term of the cost function,P g2,t means estimates of the required load power since it is the sum of the estimated powerP on,t and the outputs of the two ESSs. The other terms in the cost are similar to the cost function (1). Figure 5 summarizes how the online load forecast and ESS on work during on-peak time. At time t = k, LSTM on generates short-term load forecast {P on,k+∆t m , · · · ,P on,k+4∆t m }. Based on this short-term forecast, the optimization problem (2) is solved to determine P ESS on,k , P ESS on,k+∆t m , · · · , P ESS on,k+4∆t m . P ESS on,k is applied for 15 min, and this procedure is repeated during on-peak time. After the on-peak time, to maintain the initial value of SoC on,t , the following optimization problem is solved. This procedure can be seen as (1g) in ESS off scheduling. The cost function is similar to the third and fourth terms in the objective function (1), considering the health and lifetime of the ESS on . At time t = k + p + 1, right after the on-peak time, ESS on charges or discharges for two hours considering P ESS on,t during the on-peak time. Note that γ is a small constant. subject to ∀t ∈ {k + p + 1, k + p + 1 + ∆t m , · · · , k + p Algorithm 1 summarizes the proposed energy management method using LSTM with the augmented dataset, dual ESSs, and convex optimization. Moreover, Figure 2 illustrates Algorithm 1.

Offline
Train LSTM off using past load and temperature data set Train LSTM on using augmented past load and temperature data set Online Repeat at t = 00:00 A day-ahead load forecast using LSTM off Make charging and discharging scheduling of ESS off by solving the optimization (1) / * Repeat the following every 15 min during on-peak time * / for t ∈ on-peak time do Short-term load forecast using LSTM on Make charging and discharging scheduling of ESS on by solving the optimization (2) end for Initialize SoC on,t by solving the optimization (3)

Case Study
This section shows the application of the proposed energy management scheme using data from a real building. It is shown that the online short-term forecast-based ESS scheduling can reduce the peak load effectively even when there are nontrivial load uncertainties during the on-peak time. This is because the trained LSTM on using augmented datasets generate better load forecasts, which is not easy to accomplish for a day-ahead load forecast.

Training Data and Data Augmentation
For training LSTM off , load and outdoor temperature datasets are taken from [31] and they are measured for a commercial building located in Richland, WA, during the summer season (June-September) from 2009 to 2011.
For training the LSTM on , the dataset is augmented for the purpose of obtaining a better load prediction when there are severe load uncertainties during on-peak time. To be specific, the dataset is augmented by adding the synthetic uncertainties to the original dataset. To augment the dataset systematically, the value of the synthetic uncertainty is generated using the normal distribution in (4) with a mean µ and a standard deviation σ as follows: where β ∈ [−40, 40] is a scaling factor. µ ∈ [10,18] and σ ∈ [1,3] are chosen to create a variety of uncertainties. Several examples of synthetic uncertainties generated by f aug (t) are shown in Figure 6.

Offline and Online Load Forecast by the Trained LSTMs
This section shows how accurately the trained LSTM off using the past dataset and LSTM on using the augmented past dataset generate load forecasts when there are uncertainties. Table 1 summarizes the structures and hyperparameters of LSTM off and LSTM on . For training the LSTMs, Tensorflow 2.0 in Intel(R) Core(TM) i7-4790 with 8GB memory was used [32].  Figures 8-10, the blue solid lines are the load forecastP off,t by LSTM off . As seen in the figures, the load forecast by LSTM off is not accurate. This is natural since LSTM off is trained using the red lines but actually used the black lines (i.e., input to the trained LSTM off ) for the forecast. On the other hand, on the right of Figures 8-10, the short lines with various colors denote the one-hour load forecast by LSTM on . Note that the online load forecast by LSTM on for the next one hour period is carried out every 15 min repeatedly during the on-peak time. In view of the forecast results in Figures 8-10, LSTM on generates better load forecasts for a load with uncertainties than LSTM off . For quantitative comparison, the forecast errors are computed using Root Mean Square Error (RMSE) for the test data. Each RMSE for offline and online is given in (5a,b) considering the different resolutions. N is the number of test data and only the forecast during the on-peak time is calculated. Note that the online load forecast is repeated every 15 min. LSTM off results in 5.611 kW and LSTM on does 2.022 kW. Hence, the load forecast by LSTM on can be used for ESS scheduling in scenarios where there are sudden load changes during on-peak times.

ESS Scheduling Based on Online Load Forecast
Using the offline load estimateP off,t and online estimateP on,t , P ESS off,t and P ESS on,t are determined by solving the convex optimization (1) and (2), respectively. For optimization, the CVX MATLAB toolbox is employed [33] and the tuning parameters for the optimization problems are given in Table 2. Each weight w i is chosen such that each term in the objective function has a similar influence on the entire cost function. For both ESS off and ESS on , the initial SoC are set to 0.5, and P g,min is 0.8 times the peak of the average real load data. During the on-peak time, when the real power P g1,t and P g2,t bought from the main grid are smaller than P g,min , then the penalty is calculated as C pen off = ∑ t∈j C p,t (P g,min − P g1,t ); {j|P g1,j < P g,min }, (6a) C pen on = ∑ t∈i C p,t (P g,min − P g2,t ); {i|P g2,i < P g,min } (6b) where the penalty price C p,t is adjusted as double the value of C g,t . Hence, the resulting costs for offline ESS scheduling and online ESS operations are given by where period t ∈ [k, k + p + 2 + 3∆t m ] is the time when ESS on is operated. The simulation results are given in Figures 11-13 when P ESS off,t and P ESS on,t are applied to the cases with positive, negative, and sign indefinite synthetic uncertainties. Scheduling results are given on the left column in Figures 11-13 when only ESS off (i.e., P ESS off,t ) is used. On the other hand, scheduling results are given on the right column in Figures 11-13 when both ESS off and ESS on (i.e., P ESS off,t , P ESS on,t ) are used.  Figure 11 is the operation result when the uncertainty is positive. In Figure 11a,b,P off,t andP on,t are given, which are also presented in Figure 8. In Figure 11c,d, the power P g1,t and P g2,t bought from the main grid are depicted together with corresponding estimate P g1,t and P g,min . The green solid line denotes the electricity price C g,t ; ToU pricing, where the start point of on-peak time k is 11:00; and the peak period p is 4 h. The price for off-peak time is 1 USD/kWh and on-peak time is 5 USD/kWh. In Figure 11e,f, P ESS off,t , P ESS on,t (i.e., amount of charging and discharging of ESS off and ESS on ), and corresponding SoC (i.e., SoC off,t , SoC on,t ) are presented. The grey solid line denotes the constraints of SoC, SoC min and SoC max , respectively.
When Figure 11a,c are compared, the estimated powerP g1,t denoted by the blue line is reduced during on-peak time based on the optimization (1) but the real power P g1,t denoted by the brown line becomes higher thanP g1,t due to uncertain load that is not predicted bŷ P off,t . In the case of offline scheduling, since using only ESS off based on a day-ahead load forecast cannot consider the uncertainties during on-peak times, this results a higher cost.
On the other hand, when the brown lines denoting P g1,t in Figure 11c and the red lines denoting P g2,t in Figure 11d are compared, it is verified that the proposed scheduling method for ESS on effectively reduces the peak load during the on-peak time. To be more specific, the effect of the uncertain load is eliminated by optimization (2c) based on the online short-term load forecastP on,t , which has better performance thanP off,t . By adding ESS on , peak load reduction is achieved when considering the uncertain load and reducing the required payment. This can be confirmed by the final cost paid. For Figure 11c, it costs 2072 but only 2042 for Figure 11d.  Figure 12 shows the operation results obtained by the proposed scheduling method when the uncertainty is negative. Similar observations to those in Figure 11 are possible. The brown line denoting P g1,t in Figure 12c becomes lower than P g,min during the on-peak time due to the negative uncertain load, resulting in a penalty, but in the case of P g2,t as denoted by the red line in Figure 12d, it does not deviate from P g,min constraints through ESS on . It is verified that the proposed scheduling for ESS on can effectively reduce the effect of the negative variations. Quantitatively, for Figure 12c, it costs 2079 but only 2042 for Figure 12d. The estimated powerP g1,t and real power P g1,t from the main grid by using only ESS off , (d) The estimated powerP g1,t and real power P g2,t from the main grid by using both ESS off and ESS on , (e) The amount of charging or discharging of ESS off and SoC off,t , (f) The amount of charging or discharging of ESS on and SoC on,t .
As the last case study, Figure 13 presents the operation results of the proposed ESS scheduling when the variation can be indefinite (i.e., either positive or negative). In Figure 13

Discussion
This section analyzes the effect of parameters δ and the initial value of SoC on,t on P ESS on,t (i.e., amount of charging or discharging of ESS on ). Figures 14 and 15 represent the operation results with both ESS for the same condition as in Figure 11 with different values of δ. δ = 1 is used in Figure 11. Figure 14 corresponds to δ = 0 and results in a cost value of 2035, and Figure 15 shows δ = 4 and cost of 2062. As the value of δ becomes smaller, ESS on has to deal with more uncertainties according to the optimization (2c). This is verified by comparing Figure 11 (δ = 1) with Figure 14 (δ = 0) since P ESS on,t discharges more in Figure 14. On the other hand, P ESS on,t discharges less in Figure 15 since δ = 4 makes ESS on cover less uncertainties compared with the previous cases. Therefore, the proper choice of δ must be used since ESS on has to consider the constraints in (2f).

Effect of SoC on,t on the Initial Value
Figures 16 and 17 validate why it makes sense to set the initial value of SoC on,t to 0.5. The configuration of Figure 16 is the same as that of Figure 11 except for the initial value of SoC on,t = 0.2. As seen in Figure 16, ESS on starts to discharge in order to handle the uncertainties but stops discharging after a short time due to the SoC constraints. This makes P g2,t violate the constraint onP g1,t + δ, thereby leading to the value of the cost being 2050, which is larger than the case in Figure 11 with the initial value of SoC on,t 0.5.
Conversely, in Figure 17, the initial value of SoC on,t is set to 0.8 and all the other settings are the same as those in Figure 12. At this time, ESS on has to charge to deal with the negative uncertainties, but it reaches the upper limit soon. Hence, it can not charge any more. As a result, P g2,t becomes smaller than P g,min sometimes. This results in the value of the cost being 2028, which is larger than that in Figure 12 with the initial value of SoC on,t set to 0.5.
Hence, since it is unknown which uncertainties occur during on-peak times, it is reasonable to set the initial value of SoC on,t to 0.5. The estimated powerP g1,t and real power P g2,t from the main grid by using both ESS off and ESS on , (c) The amount of charging or discharging of ESS on and SoC on,t .

Conclusions
In this paper, a method for building energy management through real-time ESS operations is presented for a case where a sudden load variation occurs. For this, the LSTM network-based load forecast method was used for both the offline and online forecasts. In addition, to increase the prediction accuracy, the load of the building and the outdoor temperature were selected as input variables for the network. For the online load forecast, the LSTM network was trained using augmented past load and temperature data. Based on the day-ahead load forecast, the offline ESS was scheduled. On top of this, the online ESS is scheduled to reduce the effect of load uncertainties during on-peak times by using short-term load forecasts. For the scheduling of the two ESSs, optimization problems were formulated considering various physical constraints. In a case study, it was confirmed that the proposed method can reduce the effect of the uncertainties during on-peak times, which then leads to lower costs.

Institutional Review Board Statement: Not applicable.
Informed Consent Statement: Not applicable.

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

Abbreviations
The following abbreviations are used in this manuscript: