STI 4.0 8346 Camera Ready

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

2022 4th International Conference on Sustainable Technologies for

Industry 4.0 (STI), 17-18 December, Dhaka

Forecasting of Solar Photovoltaic Output Energy


using LSTM Machine Learning Algorithm
Md. Badrul Ahsan Tamal, Md. Ahsanul Alam, Md. Nayem Sharker, Mohibul Islam Sazib
Dept. of EEE, Green University of Bangladesh, Dhaka, Bangladesh
Email: [email protected], [email protected], [email protected], [email protected]

Abstract— Due to its appealing qualities, solar photovoltaic the grid can all benefit from these estimates. Technical and
(PV) energy generation has received much attention worldwide financial risks are decreased for all market players with
by the researchers and practitioners. However, the biggest knowledge about the evolution of future energy generation in
challenge in producing solar energy is the unpredictable the system [5].
intermittent power output of PV systems, which is mostly
caused by weather conditions. This variation in power Forecasts for wind and solar energy are usually made usi
generation usually causes significant economic loss. Accurate ng machine learning or statistical learning methods.
forecasting of output power a day ahead or hourly ahead is the Traditionally, forecasting algorithms are based on physical
efficient way for the management of the power production. models, which provide forecasts based on information about
This paper offers a dependable short-term, hourly-ahead the power plant and the weather [6]. These models
forecasting method of PV power generation for the delivery commonly determine the power curves for solar and wind
and storage mostly for the grid optimization. A long short-term turbines. It is simple to understand, but accuracy depends on
memory (LSTM)- based deep learning method is used for its the parameters that can be measured properly.
dependability for the long data along with feature of time series
data. The historical dataset in between 1990-2013 in Australian Deep learning (DL), a variation of machine learning (ML),
locations were used. By appropriately functioning dependent and its various variants are now widely available in the
features with the independent features a correlation between literature. Recurrent Neural Networks (RNN), Generative
them is developed. This resulted in excellent power output Adversarial Networks (GAN), Boltzmann Machine (BM),
forecast of RMSE 0.27%. The accuracy of this simple system is Feedforward Deep Networks (FDN), Deep Belief Networks
much better than the recently proposed more complex hybrid (DBN) and Long-Short Term Memory (LSTM) Networks are
system like LSTM+CNN, LSTM+SVM+RNN. a few of these. The most well-liked CNNs that use time
series data are the LSTM and RNN. RNN, however, is
Keywords—forecasting, deep learning, solar energy,
backward dependent. For graphical or image processing,
reliability, long short-term memory, renewable energy sources,
accuracy.
CNN is the ideal option, but not for time series data. LSTM
can handle long data and has no dependency issues. Artificial
I. INTRODUCTION neural networks, also known as (multi) linear regression
algorithms or Deep Neural Networks (DNN), are a class of
In recent years, solar energy production has grown substa neural networks with several hidden layers that have
ntially but without pattern. Bangladesh with eighth-most pop effectively advanced in the machine learning area over the
ulous country in the world, has little energy resources. Bangl past few years with a concentration on the time series model
adesh's primary energy source is natural gas. According to th
[7]. The single-layer and multi-layer Perceptron, LSTM
e Bangladesh Power Development Board, fossil fuels memory networks, and physical forecasting model are all
accounts for 92.54% of Bangladesh's total electricity generati examined in this paper. MATLAB is used to implement the
on, and that for PV is only 1.06% [1]. complete procedure. Mean Absolute Percentage Error
Switching from non-renewable fuel-based energy generat (MAPE), Root Mean Square Error (RMSE) and Mean
ion to sustainable renewable sources are advantageous for a n Absolute Error (MAE) are a few of the often-utilized
umber of reasons. Solar is one of the best options for fossil fu performance indicators [8]. The obtained RMSE for this
el alternatives and the energy sector is going through a treme study is 0.27%, indicating high model accuracy.
ndous revolution. This require technological solutions that c The remaining sections of the paper are laid out as follows.
an support such growth along with the need for sustainable e Section II, thoroughly reviews the different solar power
nergy alternatives [2]. Among these, the stable readiness for t forecasting techniques proposed to date. Section III details
he grid connection is very much needed. For that purpose, th the core idea behind the LSTM model and its implementation
e forecasting is ahead to the system [3]. The market analysis techniques. Details of proposed LSTM implementation in PV
and the needs that escalate recently among the energy expert energy is given in this section. The prediction results with the
is renewable and most usable are the solar and wind [4]. But proposed LSTM model, and comparison with recently
the PV system's erratic intermittent power output, primarily c proposed hybrid models are given in Section IV. Conclusion
aused by weather conditions, is the most important and diffic and future works are given in Section V.
ult problem in the production of solar energy. The quality of t
he PV power generation can be significantly impacted by cha II. RELATED WORK
nges in the temperature and irradiance [2]. So, sophisticated
algorithms must be developed to predict the future energy The subject of predicting the power of renewable energy
generation in an efficient manner. Operators of power plants, sources is not new. Many works related to application of
participants in the energy trading market, and managers of machine learning in energy forecasting are available in the
literature. Excellent work related to solar power forecasting

978-1-6654-9045-0/22/$31.00 ©2022 IEEE


can be found in [3]. Common method for forecasting could Figure 1 demonstrations the basic work flow of RNN, where
be anything starting from recurrent neural network (RNN), a neural networks (NN) input is x t and output is ht that
artificial neural network (ANN) [9], time series prediction denotes hidden layer of the learning and extracting
with long short-term memory (LSTM) and support vector information state of RNN.
machines (SVM) based in [3], [10]. The design of a power
grid backup with a high PV system penetration can employ Mathematically,
the long-term forecasts PV.

{( 0 ,t=0
The deep learning topologies along with the clear concept
of supervised learning and the other parameters are described ht = (1 )
in [7]. The models and the output with least possible error via
φ W x , x t ) , otherwise
support-vector regression are shown in [4] where the hybrid s where φ is a non-linear function and the update of
ystem of ANN, MLR and SVR is demonstrated. More LSTM recurrent hidden state is realized as follows:
and CNN works and the prospection are shown in [2], [3].
Also, some studies with deep learning method have individua ht =g ( W x +uht −1 ) ( 2 )
t
lly used LSTM and SVM in various application including for
ecasting of PV output has shown. A performance comparison where g is a hyperbolic tangent function (tanh). W xt are
between LSTN and Formal Conceptual Analysis of Neural
the weights, u mean and ht −1 is the previous state.
Network (FCANN) in assessing stochastic solar projections f
or the next 24 hours is shown in [8]. Due to its capacity for g In RNN, it is usually difficult to capture long-term
eneralization, supervised and unsupervised feature learning, sequential relationships in time series. Therefore, Long
deep learning in particular has received more attention. Short-Term Memory Networks (LSTM) models have been
Complex problems that need the use of a wide variety of created to get around this restriction. LSTM is more
unstructured and interconnected features from a dataset are improved version than the RNN and it can also deal
well within the capabilities of deep learning. The BP neural efficiently time-dependency in a data.
network, high-performing support vector machines for
regression applications, and the gray-model theory for
processing tiny samples. Some examples of machine
learning/deep learning methods are the recurrent neural
network (RNN), which uses dependencies to outperform the
LSTM model, the convolutional neural network (CNN),
which is effective for both long data and image classification,
and the support vector machine (SVM), which uses kernel
functions based on the non-linear mapping theory to solve
binary classification problems but struggles with multi-
classification issues. There are benefits to be had from each
model that make it superior than its forerunner, as well as
drawbacks to the current system that could be overcome with Fig 2. Schematic diagram of LSTM model
additional research. Using a deep learning model with long
short-term memory (LSTM), this paper makes short-term Figure 2 displays the schematic diagram of LSTM model.
predictions about the system. The memory cell with state c t −1 interacts with the hidden
III. DEEP LEARNING AND FORECASTING OF PV POWER state output ht −1 and the input of x t to define which
Machine learning issues have been effectively solved usi component of the internal vector should be updated. It is
ng recurrent neural networks (RNNs) [11], [12]. And to addr maintained or removed based on the outputs of the previous
ess time-dependent learning issues, several approaches have time and input time. The internal architecture of the LSTM
been suggested. RNN uses the sequential data reading model also defines the input node gt , input gate i t , forget
considering the previous state or initial state. With the current gate f t and output gate o t .
state it gives the output if an input is given to the system
between two objects. A. Long short-term memory (LSTM) models
LSTM is a deep learning method that reduces issues with
long-term dependency or removes the dependency by using a
chain-like topology. Hochreiter and Schmidhuber proposed
LSTM initially, and subsequent research has refined and
perfected the concept. LSTM is superior to recurrent neural
networks because it retains all the states it has ever been in
(RNN). The recurrent neural network is another form of
network (RNN). As an advantage over other sequence
learning methods such as artificial neural network (ANN)
models, hidden Markov models, and others, LSTM models
are less sensitive to the duration of the gaps between
examples. It's the same as if a whole cell's forget gate, input
gate, and output gate were combined into one. Memory is
locked away behind these gates until it is no longer useful.
Like the 0-1 logic, it determines whether the data should be
Fig 1. Basic Diagram of RNN
reserved or added. Long short-term memory (LSTM) models
were developed to deal with the exploding and disappearing
gradient difficulties that might occur during training regular
RNNs. Each RNN-LSTM consists of two states, the input
state and the preceding state's hidden state. Activation
functions like tanh, softmax, sigmoid, and Adam are used to
calculate the final output.
In LSTM model shown in Figure 2 the sigmoid activation
−1
functionσ ( x )=( 1+ e−x ) is used. From the previous time
state is ht −1, the output time-series ht is generated according
to the following mathematical relations [3].
i t =σ ( W xi x t + ht −1 W hi +b i) ( 3 )
f t=σ ( W xf x t +ht −1 W hf + b f ) ( 4 )
o t=σ ( W xo x t +ht −1 W ho +b o ) ( 5 ) Fig 3. Basic LSTM model for prediction

gt =tanh ( W xc x t +ht −1 W hc +b c ) (6) In this paper, the PV power output is forecasted using
the LSTM models with long-term memory function. It has
c t =f t ʘ c t −1+i t ʘ gt ( 7 ) strong prediction accuracy, and ideal for issues heavily
ht =o t ʘ tanh ( c t ) ( 8 ) connected to time series. As mentioned earlier, LSTM can
address the issue that the standard neural network needs - a
Where i t , f t ,o t are input gate, forget gate, and output gate large number of local optimal solution and samples training.
The implementation steps are – (i) first the collected data is
respectively, W xi ,W xf ,W xo and W hi ,W hf ,W ho are weight
pre-processed or clustered, and (ii) then normalized with the
parameters and b i, b f , b o are bias parameters. c t is the state mean, standard deviation as shown in Figure 3.
of present memory cells and c t −1 is the previous state
C. Dataset Preparation and Standardization
memory cells and then ht is the output time series hidden
Several parts of Australia's geography were used to
state. compile the data used in this study. In order to provide
For each individual input, the forget gate determines how standard, comprehensive and ordered data, the model first
much of the previous state the system wants to let in, and the preprocesses the original data using interpolation and
input gate specifies how much of the newly calculated state normalization. In the next step, the filtered data is used as
one wishes to let through. It is the job of the output gate to input to the LSTM model after being filtered with the
decide how much of the internal state to broadcast to the chosen features. Selected dependent features and
outside network (higher layers and the next time step). independent features are compare using Pearson method to
LSTM model needs to be taken into candidate memory cell enhance the accuracy. When first starting out, 70% of data is
which is c t (memory cells) shown in equation (6). Its used for training and 30% is used for testing. This model is
computational capability is similar to forget gate, input gate then trained on another 80% of data and evaluated on the
and output gates (6) with the collaboration of tanh remaining 20%. Figure 4 depicts system testing and training
activation function value range from [-1,1]. ❑ is an operator procedures. With consistent training and testing (train for
function for the elementwise multiplication. The c t memory 90% of the data and test for 10% of the complete data), the
cells combinedly control the flows of information with help best prediction model may be developed.
of previous time state memory cells c t −1 and candidate
memory cells ( gt ) by the input gate and output gate as shown
in equation (7). If the system wants to control more
information, it is appreciated to use the hidden state ht shown
in (8) through the output gate. The activation function tanh
will make sure that it remains in exact value range [-1, 1].

B. Proposed Approach for PV Power Forecasting Fig 4. Division of training and testing data

Along with the volume of training data, other important


aspects of the LSTM model's accuracy include the network's
design, its use of hyper-parameters, and its optimization
techniques as shown in Table I.

TABLE I. LSTM MODEL PARAMETER


LSTM Parameters
Model
Parameters Value
LSTM No. of LSTM layers 2
Loss function Cross-entropy large epochs with relatively small batch sizes can
Initial learning rate 0.005 yield promising results [13].
Optimizer Adam
Drop Factor 0.2
Number of hidden E. Indicators of the forecasting models
200
units
Number of training Commonly used statistical indicators to measure the
250
epochs systems accuracy are: mean absolute error (MAE), root
mean square error (RMSE). Mathematically,
D. Performance enhancement of the forecasting model: 1
The following factors are taken into account in order to
MAE=
n
∑|x^ −x|( 9 )


improve the forecasting model's performance:
∑|x^ −x| (10 )
2
 Activation function: Unit or the rectified linear unit
(ReLU) activation functions for non-linear functions RMSE=
n
only permit rescaling to values in the range [0, 1]
with logic function, but hyperbolic tangent (tanh) where x represents the measured values, then ^x represent
activation functions rescale the data inside [1, 1]. the LSTM model's corresponding anticipated values, and
Activation function has a big impact on the neural n represent the number of measurements.
network's final response [2], [3], [13].
IV. RESULT AND DISCUSSIONS
 Optimizer: Optimization is used in the training
process to minimize the error. In this paper Adam The proposed model was implemented in MATLAB
function was used [5]. 2021a with the help of deep learning LSTM algorithm for the
 Drop Factor: This is a recognized stochastic forecasting of solar output energy. With the data 70% for trai
regularization technique used to prevent prediction ning and 30% for testing, the initial RMSE is about 3.4879%,
and the result is shown in Figure 5. Subsequent run with data
error and improve RNN models' predictive power
80% for training and 20% for testing gives RMSE values of
[13].
5.5432%, and the result is depicted in Fig 6. Finally, the pre-
 Batches and Epochs: The batch and epochs size are trained model run with data 90% for training and 10% for tes
two essential parameters to consider while developing ting. With the Adam optimizer in the short-term model the
Forecast with Updates

deep learning models. The findings suggest that using


600

500 obtained RMSE value is about 0.27164% as shown in Figure Observed


Forecast

7.
400
Output Power

300

200

100

-100
0 200 400 600 800 1000 1200 1400 1600 1800 2000
Time

RMSE=3.4879
150

100

50
Error

-50

-100
0 200 400 600 800 1000 1200 1400 1600 1800 2000
Months

Fig 5. Result with data 70% for training and 30% for testing

Forecast with Updates


600
Observed
500 Forecast

400
Output Power

300

200

100

-100
0 200 400 600 800 1000 1200 1400
Time

RMSE=5.5432
150

100

50
Error

-50

-100

-150
0 200 400 600 800 1000 1200 1400
Months

Forecast with Updates

Fig 6. Result with data 80% for training and 20% for testing
600
Observed
500 Forecast

400
Output Power

300

200

100

-100
0 100 200 300 400 500 600 700
Time

RMSE=0.27164
150
data1

100

50
Error

-50

-100
0 100 200 300 400 500 600 700
Months
Fig 7. Result with data 90% for training and 10% for testing
These results show the proposed method of one-hour ahead A. Comparative Analysis
double layer LSTM model. On the other hand, single layer Table III compares the results of the proposed model to
consists in 70% training and 30% tested RMSE about those of similar studies that have been conducted. RMSE
246.9117%, whereas in 80% training and 20% testing indices of a wide range methods are compared like- LSTM,
RMSE was 250.3434% and in the last data division of 10% RNN, SVM, CNN, PCA-LSTM, VMD-ACO-2NN. Netsanet
tested shows RMSE of 176.21%. These results are inferior et al. [13] performed VMD-ACO-2NN model with average
to the double layer LSTM model and not that accurate for RMSE 1.2381% and hybrid model 97.68% consist NN,GA-
prediction. That is why this paper focused on the double NN, Huang et al. [14] used hybrid CNN+LSTM method and
layer LSTM model. The summary of results is given in the obtained average RMSE was 163.1513%, Mellit et al.
Table II. Double-layer LSTM models serve their intended [15]
reviewed many research paper among them one
purpose more precisely than their single-layer counterparts. performed a LSTM model with one hour duration contains
There was a demonstration of the double layer model in the the RMSE of 82.15%. Lee et al. performed
(Fig 3). SVR+RNN+LSTM+DNN that consist MAE of 0.23% [16].
TABLE II RMSE SUMMERY Li et al. [17] performed LSTM model and the average RMSE
was 1.0382%. Ge et al. [18] implemented three hybrid
Summary of LSTM RMSE model with average RMSE 4.41%, H Lateko et al. [19]
Training Data Test Data RMSE% performed LSTM model with average RMSE about 9.81%,
70% 30% 3.4879 Chen et al. [20] performed LSTM model with RMSE of
0.121%. This proposed method with one-hour ahead double
80% 20% 5.5432
layer LSTM model produced the RMSE of 0.2716%.
90% 10% 0.2716

V. CONCLUSION
TABLE III. COMPARISON WITH STUDY RESULTS Forecasting PV power generation is addressed, and a
reliable short-term hourly ahead method is proposed. The
Method
proposed method applied on 24 years long dataset from
Published Time
Year Accuracy Australian locations. Selecting model parameters
Ref. used Duration appropriately allowed the development of an optimum
correlation between the dependent and independent features.
This resulted in the excellent prediction model with a RMSE
VMD- RMSE: 1.2381%
Short- accuracy of 0.2716%. With regard to RMSE value, the model
[13] 2022 ACO- Average value. performance is compared with recently published similar
Term
2NN Hybrid: 97.68% works employing different degrees of complex methods. This
comparison result shows that the proposed method
outperforms in terms of accuracy and simplicity. Thus, it can
CNN+LS RMSE:
[14] 2019 1-D a preferred candidate for the prediction of PV power
TM 163.1513%, generation which is very essential for the planning,
operations, grid scheduling and storage of the renewable
based energy resources. In future works, this work can be
[15] 2020 LSTM 1-H RMSE: 82.15%
extended for long-term LSTM model with other optimization
factor, and activation function such as ReLU.
SVR+RN
VI. ACKNOWLEDGMENT
[16] 2019 N+LSTM, 1-H MAE: 0.23%
This work was supported in part by the Center for Resear
DNN ch, Innovation and Transformation (CRIT) of Green Universi
ty of Bangladesh (GUB).
[17] 2020 LSTM 1-H RMSE: 1.0382%
REFERENCES

PCA- RMSE: 4.41% [1] http://119.40.95.168/bpdb/power_generation_unit


[18] 2020 1-D
(accessed Nov. 27, 2022).
LSTM Average Value
[2] A. Krizhevsky, I. Sutskever, and G. E. Hinton, “ImageNet
classification with deep convolutional neural networks,”
RMSE:9.81% Commun ACM, vol. 60, no. 6, pp. 84–90, Jun. 2017, doi:
[19] 2021 LSTM 1-3-D 10.1145/3065386.
Average value [3] B. Ray, R. Shah, M. R. Islam, and S. Islam, “A New Data
Driven Long-Term Solar Yield Analysis Model of Photovoltaic
Power Plants,” IEEE Access, vol. 8, pp. 136223–136233, 2020,
[20] 2021 LSTM 1-H RMES: 0.121% doi: 10.1109/ACCESS.2020.3011982.
[4] G. Alkhayat and R. Mehmood, “A review and taxonomy of
wind and solar energy forecasting methods based on deep
RMSE: learning,” Energy and AI, vol. 4. Elsevier B.V., Jun. 01, 2021.
Proposed Method 1-H doi: 10.1016/j.egyai.2021.100060.
0.27164% [5] F. Harrou, A. Dairi, B. Taghezouit, and Y. Sun, “An
unsupervised monitoring procedure for detecting anomalies in
photovoltaic systems using a one-class Support Vector
Machine,” Solar Energy, vol. 179, pp. 48–58, Feb. 2019, doi: Energy Reports, vol. 8, pp. 2022–2035, Nov. 2022, doi:
10.1016/j.solener.2018.12.045. 10.1016/j.egyr.2022.01.120.
[6] 2018 Fourth International Conference on Computing [14] C. J. Huang and P. H. Kuo, “Multiple-Input Deep Convolutional
Communication Control and Automation (ICCUBEA). Neural Network Model for Short-Term Photovoltaic Power
[7] Y. Lecun, Y. Bengio, and G. Hinton, “Deep learning,” Nature, Forecasting,” IEEE Access, vol. 7, pp. 74822–74834, 2019, doi:
vol. 521, no. 7553. Nature Publishing Group, pp. 436–444, May 10.1109/ACCESS.2019.2921238.
27, 2015. doi: 10.1038/nature14539. [15] A. Mellit, A. M. Pavan, E. Ogliari, S. Leva, and V. Lughi,
[8] V. Sharma, J. A. G. Ordiano, R. Mikut, and U. Cali, “Advanced methods for photovoltaic output power forecasting:
“Probabilistic Solar Power Forecasting: Long Short-Term A review,” Applied Sciences (Switzerland), vol. 10, no. 2.
Memory Network vs Simpler Approaches,” Jan. 2021, [Online]. MDPI AG, Jan. 01, 2020. doi: 10.3390/app10020487.
Available: http://arxiv.org/abs/2101.08236 [16] D. Lee and K. Kim, “Recurrent neural network-based hourly
[9] W. Kong, Z. Y. Dong, Y. Jia, D. J. Hill, Y. Xu, and Y. Zhang, prediction of photovoltaic power output using meteorological
“Short-Term Residential Load Forecasting Based on LSTM information,” Energies (Basel), vol. 12, no. 2, Jan. 2019, doi:
Recurrent Neural Network,” IEEE Trans Smart Grid, vol. 10, 10.3390/en12020215.
no. 1, pp. 841–851, Jan. 2019, doi: 10.1109/TSG.2017.2753802. [17] P. Li, K. Zhou, X. Lu, and S. Yang, “A hybrid deep learning
[10] J. Zeng and W. Qiao, “Short-term solar power prediction using a model for short-term PV power forecasting,” Appl Energy, vol.
support vector machine,” Renew Energy, vol. 52, pp. 118–127, 259, Feb. 2020, doi: 10.1016/j.apenergy.2019.114216.
Apr. 2013, doi: 10.1016/j.renene.2012.10.009. [18] L. Ge, Y. Xian, J. Yan, B. Wang, and Z. Wang, “A Hybrid
[11] F. Wang, Z. Xuan, Z. Zhen, K. Li, T. Wang, and M. Shi, “A Model for Short-term PV Output Forecasting Based on PCA-
day-ahead PV power forecasting method based on LSTM-RNN GWO-GRNN,” Journal of Modern Power Systems and Clean
model and time correlation modification under partial daily Energy, vol. 8, no. 6, pp. 1268–1275, Nov. 2020, doi:
pattern prediction framework,” Energy Convers Manag, vol. 10.35833/MPCE.2020.000004.
212, May 2020, doi: 10.1016/j.enconman.2020.112766. [19] A. A. H Lateko et al., “Stacking Ensemble Method with the
[12] S. Hochreiter and J. ¨ Urgen Schmidhuber, “Long Short-Term RNN Meta-Learner for Short-Term PV Power Forecasting,”
Memory.” 2021, doi: 10.3390/xxxxx.
[13] S. Netsanet, D. Zheng, W. Zhang, and G. Teshager, “Short-term [20] H. Chen and X. Chang, “Photovoltaic power prediction of
PV power forecasting using variational mode decomposition LSTM model based on Pearson feature selection,” Energy
integrated with Ant colony optimization and neural network,” Reports, vol. 7, pp. 1047–1054, Nov. 2021, doi:
10.1016/j.egyr.2021.09.167.

You might also like