Computation of Energy in Currency Values Using Long Short-term Memory-based Approach for Energy Prediction

High electricity demand causes large amounts of energy to be wasted, indicating that many people are unaware of their energy consumption. This also results in higher energy costs in electricity bills. Tenaga Nasional Berhad (TNB), which is the largest electricity producer in Malaysia has resolved 85% of the more than 18,000 "sky-high" electricity bill complaints received from consumers, especially in April and May 2019. Therefore, accurate energy demand forecasts are crucial for users to understand their electricity consumption. This paper presents the method of load forecasting with analysis that has been done with different machine learning techniques namely Long Term Memory (LSTM) and Autoregression (AR). Both of these methods are used to study and predict energy consumption patterns. Accordingly, this study aims to examine whether and how newly developed deep learning algorithms such as Long Short Term Memory (LSTM) are better than traditional algorithms such as the Autoregression (AR) model. The model’s prediction performance was assessed using the Mean Absolute Percentage Error (MAPE) and R-square (R) regression score. Based on the analysis performed, LSTM was found to provide more accurate predictions than AR, especially for large-scale data sets. Therefore, the LSTM model was chosen as the forecast model used for the second key feature proposed in this project, which is to convert the energy consumption rate into currency value. Such conversions are made based on standard tariffs and trigger warnings to users to help them realize their energy consumption is more wasteful compared to their normal energy consumption patterns.


Introduction
As the world continues to evolve with cutting-edge technology, more and more people are looking for light bulbs, dishwashers, or other energy-efficient appliances to save energy. Energy efficiency plays an important role in controlling energy consumption as well as reducing costs and maintaining a comfortable environment in the building (Abu Bakar et al., 2015). This is one of the important things to do as the users should continue to pay attention to their purchases. However, solutions to save energy cannot achieve its objectives if people are unable to change their habit of using energy. They should be aware that their behavior using electricity plays an important role in determining the overall cost of their energy consumption.
Another problem that may arise in connection with this research study is that people tend to use so much electricity in daily life without thinking about the consequences. Sometimes, people will use more energy than their normal energy consumption. Therefore, this condition can cause a person to become unaware and unknowingly waste energy in their daily use. So by not realizing whether they are wasting or saving energy, this will usually cause the problem of users wasting energy either at home or at work. This problem shows that it is very important to give an overview of the actual energy consumption to help people know how much energy they are using in real-time. One study (Charnon, 2017) shows that if people do not know how much energy their facilities use, then how will they know how much is wasted? People should be able to know how much money they are spending on every energy they spend. Looking at this scenario, we realize the importance of translating energy consumption into currency so that people can see and evaluate how much money they can save if they reduce their energy consumption.
The current issue related to the scope of this research is the problem of rising electricity bills which has caused public outrage. During movement control order (MCO), the problem of electricity billing became a serious problem as many consumers had complained about the sudden increase in electricity bills. Concerning this incident, there was an increase in electricity consumption for residential consumers in Peninsular Malaysia by 23% according to the current Minister of Energy and Natural Resources. It was expected that this situation will occur as most people spend their time at home. This problem shows that most consumers are not aware of their energy consumption. They cannot expect their current bill (during MCO) to be lower or equal to the previous bills.
In addition to problems with high electricity bills, the effects of uncontrolled and excessive electricity consumption also cause environmental pollution. Malaysia is rich in various natural resources for electricity. Energy generation in Malaysia is mainly derived from fossil fuels such as coal, natural gas and fuel oil (EIA, 2017). Environmental effects based on all forms of electricity generation include air, water, and land. Planned production and consumption of electricity will reduce the amount of fuel needed to generate electricity as well as the amount of greenhouse gases and other air pollution. Today, the world is focused on reducing electricity consumption and focusing more on renewable energy (Le et al., 2017). The coal used in Malaysia is fully imported, and given its low prices and abundant supply, the Energy Commission's Peninsular Malaysia Electricity Outlook 2017 highlights the increase in coal for the country. However, coal, as a long-term source of energy, has various negative effects on the environment. The European Union aims to eliminate coal power plants after 2020 (All, 2018).
In this domain, most studies focus on the importance of having an energy monitoring system. Related reports (Charnon, 2017) show that we can reduce energy consumption by 5-15% as a potential energy monitoring system at home. However, the effect of energy monitoring at home no longer works for the medium and long term as consumers no longer pay attention. To approach this problem, it is recommended to provide users with learning tool mechanisms such as the design of energy monitoring systems to enable users to learn about energy management. Moreover, another paper (Kasun,2017) states that there is a correlation with a 10.2% increase in the loss of unused electricity consumption. For example, household appliances that use energy even when not in use such as TVs and air conditioners.
These are some examples that most users are often unable to prepare for (Firth, 2008;Ploysuwa, 2019). Therefore, optimization of energy consumption and waste reduction on the floor of a building or in a residential area requires accurate forecasts or energy forecasts. This is possible with technological approaches such as smart meters that make energy consumption data available (Sima, 2018). In this context, load forecasts are categorized into three different classes: Short-term load forecasts (one hour to one week), medium-term load forecasts (weeks to a year), and long-term load forecasts (longer than a year) (Sima, 2018). Unfortunately, long-term load forecasting still poses some problems for researchers.
Based on the key problems identified, this project aims to develop a model that can predict the latest energy consumption based on the energy use history of the user. Methods of predicting energy consumption can be classified into two categories: (1) linear prediction and (2) nonlinear prediction (Azzouni & Pujolle, 2017). Linear prediction methods include the ARIMA model while non-linear methods include Feed Forward Neural Network (FFNN) and Recurrent Neural Network (RNN). To develop such a model, the initial work in this study focuses on research on modernly developed in-depth learning algorithms to predict timeseries data, such as Long Short-Term Memory (LSTM), better and how it can overcome conventional algorithms. univariate Autoregressive (AR) is a traditional technique for accurately predicting future time-series data (Sima, 2018). This technique can be combined with the Moving Average (MA) model to form the Univariate Auto-Regressive Integrated Moving Average (ARIMA) model. Autoregressive Moving Average (ARMA) is also one of the linear models of the time series (Anna, 2018). It has been observed that the AR model variable is easier to operate which is calculated to be simpler. With such advantages, the AR model gets more attention and is widely used than the ARMA model in the field of engineering. Besides, the real-time performance of the AR model is better and the high order of the AR model can be used to approach the ARMA model (Wang & Yuan, 2017). Moreover, the advantage of using the AR model is that it only requires smaller data for the modelling process, and the neural network model has good properties such as nonlinear mapping and self-learning (Wang,2017). Besides, neural networks can also be combined with AR models to achieve more accurate prediction model accuracy. Linear stationary AR models can also represent a non-linear time series in a short interval because several processes can be explained in terms of models that change linear time (Ekaterina, 2013).
Cahng (2017) states that the exchange of energy with other utilities is beneficial in predicting energy load. Machine learning techniques such as Recurrent Neural Network (RNN), and Long Short-Term Memory (LSTM) have captured much attention over the last few years with their application (Sima, 2018). The LSTM model has a natural propensity to draw out rugged patterns for an input function space and can effectively manage MIMO systems by providing a lot of flexibility for the system (Haider et al., 2019). Also, the LSTM system can handle nonlinear systems thanks to their specialized LSTM nodes, which can produce a better result after learning. For the present, the most sequential models used in practical application are called gated RNNs, including long short-term memory (LSTM) (Liu et al., 2017). As the concept of the LSTM is to use memory units to render longer sequences for a stronger abstract or memory, is has found to be effective in many implementations. Comparison methods such as GBM (Gradient Boosting Machine), Support Vector Machine with Radial Kernel, and RF (Random Forest) can also boost the forecasting efficiency of the LSTM model (Ploysuwa, 2019). This study focused on the RNN-LSTM based model as it is becoming increasingly popular among for time series regression problems together with the GRU based RNNs model (Sehovac et al.,2019). Based on the previous research paper that is being discussed, the LSTM model can be a powerful tool that we can use but it may take a long time to run, need more data to train than the other model, and also have a lot of input to tune. Most of the study overstated the data to predict energy consumption such as seasonality and also the temperature while this study only proposes a single data prediction. Unlike other research papers, this study proposed a feature to convert the energy consumption to its currency value according to the tariff. This feature will act as a learning tool for the user to understand their consumption behaviour.
There are two major ways in forecasting energy, which are a physics principles-based model and statistical or machine learning-based model (Cao et al., 2015). In this paper, the second model is used. Deep Learning Recurrent Neural Network -Long-Short Term Memory (RNN-LSTM) is proposed to predict the energy consumption since based on this approach, the prediction of energy consumption is shown to be precise and accurate (Ryu & Kim, 2017). At the beginning of this study, Autoregression (AR) was explored and tested to predict energy consumption. As the result is not so good for a large-scale dataset, another technique has been proposed namely RNN-LSTM. Therefore, by having these two methods readily coded in the system, they can easily be compared. In a nutshell, the purpose of this study is to compared the Autoregression (AR) model and the RNN-LSTM based model to predict energy consumption. The forecasted energy consumption will then be converted to its currency value according to the building's tariff. The system will also display warning messages when the actual energy is higher than the predicted energy.

Method
Activities of this study began by conducting a selection process for the best prediction model between Autoregression (AR) and the RNN-LSTM. Based on a previous study (Siami-Namini et al., 2018), it is reported that deep learning-based algorithms such as the Long Short-Term Memory (LSTM) outperform traditionally based algorithms such as the Autoregressive Integrated Moving Average (ARIMA) model. Therefore, this paper will look at the key questions about how accurate and robust this newly introduced approach such as Long Short-Term Memory (LSTM) when compared to other traditional algorithms such as the Autoregression (AR) model. Fig. 1 shows the flowchart of the model selection process to be used for forecasting the energy consumption data. The analysis was done between the Autoregression (AR) and the RNN-LSTM models. The models are then developed using the preprocessed data. The study includes calculation of mean absolute error (MAE), root mean squared error (RMSE), and correlation coefficient (R-value) as the three output metrics used for comparison. The Rvalue is used to determine the correlation between the actual and predicted value. The closer the R-value to one, the higher the correlation which means complete correspondence.  Fig. 2 shows the overall system architecture proposed for the energy monitoring system. The proposed algorithm carried out by the system begins by predicting energy consumption trends by using the RNN-LSTM model to identify future energy used by consumers. Later, the system began to convert monthly energy into currency values as it was a subset of energy consumption trend predictions. It is important to predict energy consumption or load demand for consumers to be able to know whether they are using more or less energy compared to their normal behavioral consumption. Many methods can be used to predict energy data such as deep learning, Artificial Intelligence, etc.

Flowchart of the Model Selection Process
After analysis, it is shown that the method used in the system which is a model of deep learning RNN-LSTM gives more accurate results compared to the Autoregression model to predict and predict the pattern of energy use. Once the system obtains data for monthly energy consumption forecasts, the system will provide information and warn users whether they are using more or less energy compared to their actual use of behavior. Finally, the system will deduce how much energy is stored or wasted in the value of the currency. This is one of the important steps implemented in the system, especially to provide users with learning tools as well as knowledge to help them find out about their monthly electricity costs. The software used in developing the system is Anaconda and Jupyter Notebook as the Integrated Development Environment (IDE) to code all Python programs developed for this project.  Fig. 3 shows the flowchart for the RNN-LSTM prediction used in the system. Firstly, the data is collected by a smart meter installed in the building. Digital smart meter is one of the devices that apply the Internet of Things (IoT) technology to collect and store data on the internet. The dataset being used in this study is provided by a third party consisting of one complete year of energy data. The data starts to be taken and gathered from January 2017 until December 2017 for every fifteen minutes every day. All of this data are later used for classification. There is a total of 34944 data that had been collected for 12 months. The next step is to preprocess and prepare the data into their respective datasets. This is done to separate the data into the training and testing datasets. Then, the LSTM model will train the data from the training dataset. Based on the trained model, the system will then convert the predicted and the actual monthly energy consumption into the currency values according to the building's tariff that is being predefined by the TNB. By comparing these two values, i.e. predicted vs actual; the user will be able to know the exact amount in currency values for a monthly total of energy cost; either being saved or wasted. Fig. 4 shows the flowchart of a sub-process of the LSTM prediction model. The first step is to import all the required libraries and local from the files. Then, the data is split into the training and testing parts. The following step is to scale the data. The training data is being fit transform and the testing data is only transforming. The min-max scaler is also being done to pre-process the data. The next step is to create a batch function to feed batches into the training data. After that, the constant which is the number of input and output, learning rate, number of neurons, iteration, and batch size is being identified and also the process of setting the RNN model. Before the test data start to be predicted, the LSTM cell will be created using Wrapper and the MSE loss function and optimizer are created to minimize an Adam Optimizer.

Results and Discussion
The proposed methodology starts with a test to compare the Autoregression and the RNN-LSTM models for predicting energy consumption patterns based on the user's past energy consumption data. The analysis was performed to compare both methods to find a more accurate method for forecasting energy consumption. Besides the analysis and results, this section also shows the detailed implementation of the system.

Result of the Analysis
Figures below show the prediction results of one-month testing data on the building's energy consumption for both methods. Roughly from the plot of these two results, we can see the difference in the accuracy of each model. Fig. 5, we can observe that the Autoregression model cannot work in forecasting a huge amount of data, as it can only perform well when dealing with a small amount of data as shown in Fig. 6. Besides that, we can also conclude that this Autoregression model can only perform well on the stationary time series data.  Table 1). In this study, we only used the value of the MSE to evaluate the accuracy of the prediction for each iteration for the RNN-LSTM model as it is the more preferred technique for the system. The MAE and R-Squared regression are used for the whole prediction for both methods. The accuracy of the prediction will better if the value of MSE and MAE is approaching zero percent, while the R-squared is better as the value is approaching 100%.

Autoregression Model: Based on
The closer the result of MAE and R-squared to the value the more accurate the prediction will be. Based on the analysis performed on the Autoregressive and the LSTM model, it is found that more accurate predictions can be generated by the LSTM model, especially for a large dataset. So, LSTM has been selected to be employed to generate the predictions in this system, since a large dataset will be used i.e., the data recorded for one year.

System Results
This section shows the implementation of the system after the training data had been forecasted by using the RNN-LSTM model which is selected based on the analysis that had been done. The result from the training data will be resampled to find how much is the exact sum of the energy data that has been taken and recorded every fifteen minutes in a day (see Fig. 8). From the resampled data, the total daily kWh of the energy consumption will then be calculated and will be converted to the currency value according to its tariff which is in this case the system is using the tariff B for the low voltage commercial tariff (see Fig. 9).  Fig. 10 shows the codes run to display the warning message, while Fig. 11 illustrates a pop-up warning message that acts as an alert that will be triggered when the actual consumption exceeds 5% of the predicted usage. The system compares the actual and predicted data. If the predicted data is 5% more than the actual data, it will be categorized as the energy saved by the user, while if the actual data is more than the predicted data, it will be categorized as the energy being wasted by the user. A warning message will be triggered to a certain threshold limit of waste energy which is when the actual consumption exceeds 5% of the predicted usage. Fig. 12 shows an example of the waste energy, which will trigger the warning message to indicate an over usage of energy by the user. The total currency value of saved, estimated, and actual monthly energy of the user will be displayed in the system. Fig. 14 shows the total currency value for December for the building's energy consumption. Finally, the system also will then conclude and display a conversion of the actual and predicted bills from kWh to RM as shown in Fig. 15.

Conclusion
Energy consumption forecasts give customers the possibility to link past and current consumption behaviors with future costs. Based on this main idea, the objective of the study focuses on letting users benefit from solution predictions through a greater understanding of their energy consumption and their future projections. This will also allow them to better manage their electricity consumption costs. Also, another purpose of this project is to warn people so that they know when they are using more energy than their normal use. This is achieved in this study by comparing the forecast and actual energy consumption. When people understand how much energy they normally expand, then they will be able to plan energy use more efficiently in the future. Accordingly, the system presented in this paper can be beneficial for users as it helps them save energy by planning their actions accordingly. It was found that many relevant studies have not applied the idea to show the amount of energy used in the exact value of the currency. And thus this system has considered and implemented this solution because people will understand the value of currency more than the value of energy in kWh. To improve the existing system, in the future more data should be collected to validate and improve system performance and accuracy