Abstract
This paper presents deep learning neural network models for photovoltaic output current prediction. The proposed models are long short-term memory and gated recurrent unit neural networks. The proposed models can predict photovoltaic output current for each second for a week time by using global solar radiation and ambient temperature values as inputs. These models can predict the output current of the photovoltaic system for the upcoming seven days after being trained by half-day data only. Python environment is used to develop the proposed models, and experimental data of a 1.4 kWp PV system are used to train, validate and test the proposed models. Highly uncertain data with steps in seconds are used in this research. Results show that the proposed models can accurately predict photovoltaic output current whereas the average values of the root mean square error of the predicted values by the proposed LSTM and GRU are 0.28 A and 0.27 A (the maximum current of the system is 7.91 A). In addition, results show that GRU is slightly more accurate than LSTM for this purpose and utilises less processor capacity. Finally, a comparison with other similar methods is conducted so as to show the significance of the proposed models.
Introduction
Recently, photovoltaic (PV) energy is attracting focus as it is clean, abundant and environment friendly. PV systems can be grid connected system, standalone PV systems and hybrid PV systems. With all types of the aforementioned systems, accurate control of system's performance is required depending on system's types and configuration (Khatib and Elmenreich, 2016). As a fact, in all control techniques, PV system output power or current is a control key factor whereas the whole control strategy is done based on that (Bermejo et al., 2019). PV output current is usually preferred in all types of control system, as it is the varying factor while system's voltage is usually maintained by using power electronic features (Yang et al., 2014). PV output current varies according to solar radiation and ambient temperature. The relation between PV output current and solar radiation is proportional and is considered the most important relation as compared to the relation of PV output current with another factors such as solar cell temperature (Yang et al., 2014). Thus, due to the nature of the global solar radiation (sun rays inside the atmosphere), the uncertainty of PV systems’ output current is a major challenge for any prediction model (Yang et al., 2014). The uncertainty of PV output current is usually because of the uncertainty of the global solar radiation which is because of clouds movement and other weather conditions.
Based on that, many researchers have proposed models to predict the output current (sometimes output power) of the PV system. These models can be classified as empirical models, statistical models and artificial neural network based models (Ayompe et al., 2010). Here the prediction of PV system output power and output current does not matter and are considered similar as system's voltage is considered stable during operation time.
In (Ayompe et al., 2010) PV system output power prediction is done empirically by proposing models for PV modules cell temperature and efficiency. The idea in such a model is to predict the output power depending on the ideal theoretical value, and then by estimating system's losses and efficiency, the final value of the output power is predicted. Similar examples of empirical models are presented in (Cucumo et al., 2006; Durisch et al., 2007; Hove, 2000; Navabi et al., 2015; Wang et al., 2015). Empirical models are considered accurate under stable solar radiation conditions. However, under highly uncertain solar radiation condition, these models fall to predict the output power of the system in an accurate way.
On the other hand, PV output power or current can be predicted by time series and regression models (Bacher et al., 2009; Hammer et al., 1999; Li et al., 2014; Ran and Guangmin, 2008). These models can predict PV output power accurately in a well-behaved PV system with stable performance (Wong et al., 2010). However, here also such models fall to perform well under highly uncertain conditions.
Thus, artificial neural networks (ANNs) models as alternative models are proposed to overcome the drawbacks of empirical and statistical models. Artificial neural network based models are used to overcome the problem of the uncertain weather conditions that is usually represented by a non-linear relationship between the input vector and the output vector (target). The self-learning ability of ANNs is the key feature that helps in overcoming the impact of uncertain weather conditions. Thus, the proposal of ANNs shows accurate models that are able to predict PV output power or current under all weather conditions. In (Sulaiman et al., 2012), hybrid multi-layer feed forward neural network is used to prediction the output power of PV system. The proposed model used solar radiation and PV module's temperature as input variables. However, a very short dataset was used in this research for training and testing. This actually limited the proposed model from being expert in all year weather profile and consequently affected its ability to predict future targets. Meanwhile, in (Brano et al., 2014) different topologies of ANNs are proposed for PV output power perdition. Three types of ANNs were utilised in this research which were multilayer layer perceptron (MLP), gamma memory (GM) trained with the back propagation and a recursive neural network (RNN). The proposed models were trained using ambient temperature, solar radiation and wind speed. Meanwhile, historical PV output power dataset was used as a target. After that, a comparison between the proposed models was done so as to pick out the best model based on prediction accuracy. More examples of ANNs based models for PV system output power prediction can be found in (Ameen et al., 2015; Chow et al., 2012).
In all previous ANN based models (Ameen et al., 2015; Brano et al., 2014; Chow et al., 2012; Sulaiman et al., 2012), the prediction process is accurate in a very good way, however, models accuracy is not everything to consider when comparing these models. In most of these models (Ameen et al., 2015; Brano et al., 2014; Chow et al., 2012; Sulaiman et al., 2012), the authors have used large dataset (at least for one year time) to train the models. These datasets were mostly hourly datasets but in sometimes these datasets were in seconds such as in (Ameen et al., 2015). This means that these datasets are huge to handle and process. However, the use of such huge datasets is a must so as to allow the models to master the nonlinear relation between input vector and output vector under highly uncertain weather conditions. Here as far as the dataset is large, the required computational power becomes higher and the way to embed these models becomes harder. In fact, no one has discussed this issue before as most of these researchers are conducted by using normal computers or super computers where such a problem will never pop up. However, when it comes to ANNs based models that are applied to physical systems such as PV systems or electrical power systems, the easiness of embedding this model is one of the most important issues to be considered. Thus, there is a dire need to have ANNs based models that can be trained by using minimum data and have the ability then to predict future data in accurate way. It is also important to have models that are able to handle the uncertainty of weather conditions. All these features should be in the desired model at minimum computational power and processing time.
For this purpose deep learning based ANNs were proposed before for such a purpose such as long short-term memory (LSTM) and gated recurrent unit (GRU) neural networks (Zang et al., 2020) The authors of (Zang et al., 2020) has stated that deep learning machines such as LSTM and GRU are better than artificial neural network and scalar vector machine based models for solar radiation prediction especially in short-term form. In (Lee and Kim, 2019), the authors utilised LSTM to predict one day a head of solar radiation by using a 30 min step dataset. The authors have used solar radiation as an input. This means that the prediction was an online ahead prediction. The average root mean square error for this process was about 8.2 W/m2. Similar work was done in (Ghimire et al., 2019) but by using hourly dataset. GRU was also utilised in (Ghimire et al., 2019) beside LSTM. This research showed the importance of using dataset with small step whereas the use of hourly dataset makes the RMSE for the LSTM model reaches 109 W/m2, while it was 59 W/m2 for GRU. By comparing these results to the results of (Lee and Kim, 2019), it is very clear that the step of the dataset plays an important role in obtaining accurate results. In (Aslam et al., 2019) the authors predicted a one day ahead of solar radiation by using LSTM based on hourly step dataset as well, but with an input vector that contains temperature, humidity, wind speed, visibility and dew point. The increase of inputs increases the accuracy of LSTM model to be 76 W/m2 as compared to (Ghimire et al., 2019). Based on that, many researchers have considered more inputs to increase the accuracy of the LSTM model as in (He et al., 2020; Jeon and Kim, 2020; Qing and Niu, 2018; Wojtkiewicz et al., 2019). In (Yu et al., 2019), the authors have used a one minute step database to train LSTM and GRU models for solar radiation prediction of 30 min ahead. The RMSE values were 58 W/m2 and 55 W/m2 respectively.
Similar methodologies were presented to model PV output power based on LSTM and GRU models (Abdel-Nasser and Mahmoud, 2019; Lee et al., 2019; Lee and Kim, 2019; Li et al., 2019; Wang et al., 2018, 2019; Wen et al., 2019; Yan et al., 2020). In all of these methods input vectors that contain ambient temperature, wind speed, humidity, solar radiation, wind direction, direct solar radiation and diffuse solar radiation were used for online prediction. In some other cases only PV power was used for short term prediction (online a head prediction). All of these methods which are presented in (Abdel-Nasser and Mahmoud, 2019; Lee et al., 2019; Lee and Kim, 2019; Li et al., 2019; Wang et al., 2018, 2019; Wen et al., 2019; Yan et al., 2020) are based on hourly datasets, while a maximum of “one day ahead” prediction was done in these researches. Thus, in this research it is aimed to propose LSTM and GRU models for longer term prediction as compared to the methods in (Abdel-Nasser and Mahmoud, 2019; Lee et al., 2019; Lee and Kim, 2019; Li et al., 2019; Wang et al., 2018, 2019; Wen et al., 2019; Yan et al., 2020). The significance of this research as compared to other researches, that it aims to propose a model to predict a one week ahead (seven days) based on minimum training data (half-day) by using very sensitive dataset (second step data). This assures proposing an accurate model that is capable of predicting one week time of PV power records under uncertain conditions at minimum requirements of computational power and training data.
Photovoltaic output current characteristics and models
Figure 1 shows the one diode model equivalent circuit for a solar cell output. The equivalent circuit consists of a current source that represents the photo current of the solar cell, a reverse diode which represents the solar cell in the absence of sunlight, a shunt resistance which has a very large value and it represents the surface quality along the periphery and a series resistance with a very small value that represents the contact resistance between the semiconductor and the metal. The value of the shunt resistance is very large compared to the series resistance. and therefore it can be neglected.

Pv module equivalent circuit.
From Figure 1, the solar cell output current (IL) is given by the following relation (Khatib and Elmenreich, 2016);
The diode saturation current,
A typical grid connected PV system (GCPV) is usually consisted of a PV array and power conditioners such as maximum power point tracker and inverter. The general working concept of GCPV is that the incident radiation of the sun on the PV array is collected and converted to a DC current. This DC current is injected to the grid after passing through a controller and an inverter. Thus, the output current of a PV array can be described as follows (Khatib and Elmenreich, 2016).
Regression analysis can be considered as one of the most famous techniques that are used for analysing multi factor data. Regression analysis is a statistical process that is utilised to predict and express the relationships between the variables of interest (dependent variable and independent variables). The simplest regression model is represented by a simple linear regression model which is a model with a single explanatory variable that has a relationship with the response in straight line as illustrated below (Khatib and Elmenreich, 2016),
On the other hand, other form of regression analysis is the multiple regression models. This model considers more than one independent variable. In other words, multiple regressions simultaneously consider the influence of multiple explanatory variables on a response variable. The basic model for linear multiple regression is (Khatib and Elmenreich, 2016),
Proposed deep learning machines models
In this paper, two deep learning based machines are proposed to predict the output current of a photovoltaic system with high sensitivity. The predicted values are in seconds and based on two main meteorological factors which are ambient temperature and solar radiation. Long short-term memory (LSTM) artificial recurrent neural network and Gated recurrent unit (GRU) neural network are used for this purpose. The data utilised in this research are data for seconds with high variation of daylight so as to reflect the uncertainty in system's output. Table 1 shows the utilised inputs and outputs for the proposed model.
Notations of the inputs and output for the x-th second in the j-th day utilised in the proposed models.
For representing the status of the x-th second in the y-th day, a two dimensional input vector, are assumed as below,
The utilised data are divided into two sets which are training and testing sets. The training set is a set of n input vectors that consists of ambient temperature records and solar radiation records for the y-th day. Meanwhile, the training samples are entered respectively to avoid using the x-th second and y-th day as inputs which means fewer inputs as shown in Figure 2.

Proposed neural network framework for secondly PV power prediction.
The proposed model consists of an input layer with n nodes, where each node is for a particular second, and an output layer with n nodes, where each node is for a particular second corresponding to its input node. Data for one solar day in seconds is only used in the training (6:00am–6:00pm) for the y-th day. These data are represented by 43,200 nodes in the training process as illustrated in Figure 3.

Structure of the proposed GRU model for secondly PV output current prediction.
LSTM-Based PV output current prediction
LSTM-based model is developed in a way to capture the sequential PV power output patterns hidden across days. In other words, LSTM model tries to learn the long-term relationships among ambient temperature and solar radiation. In addition, it understands the short-term relationships across the PV output power records. The proposed model consists of a block that is called a block cell. This cell collectively determines the intermediate outputs based on the current and the past input values by utilising the long- and short-term sequential memories, which is the basic concept of LSTM (Sharadga et al., 2020). Figure 4 illustrated the main concept of the utilised LSTM model.

Block cell structure of the proposed LSTM model.
From Figure 4, the construction of a block cell for the x-th second in the y-th day consists of three gates: input, forget and output gates denoted as
Sigmoid function is applied in this research for the weighted summations of the inputs. The past outputs and the bias values for each gate to calculate the output for each of the three gates accordingly as three main steps.
The output for the update gate is calculated using equation (17).
Meanwhile, the output for the forget gate is calculated using equation (18). This value indicates how much information is obtained from the previous cell which is used for the current cell.

Computing update, forget and output gate in LSTM model.
The final output of the current cell for the x-th second of the y-th day is then calculated by using equation (20). To force the values to be between 1 and −1, tanh function is used. Then, the result are multiplied by the output gate value to get the final output.

Computing the output of the current cell in LSTM model.
GRU-Based PV output current prediction
Figure 7 shows the construction for the x-th second in the y-th day. It consists of two gates which are reset and update gates which are denoted as

Block cell structure of the proposed GRU model.
The output of the reset gate which indicates how much unimportant information from previous cell that is needed to be forgotten is calculated first by using equation (23).

Computing the update and reset gates in GRU model.
Based on equation (25), the value of the reset gate that is used to know how much information is taken from the previous cell and use it as new memory content is used. After that, the weighted sum for the input

Computing the output of the current cell in GRU model.
Proposed models development
In this research, LSTM & GRU methods are implemented by using python as it is considered to be the best for machine learning projects because of its simplicity, flexibility and its consistency of tremendous libraries for artificial intelligence and machine learning. The utilised computer kit consists of an Intel® Core™ i7-8565U CPU @ 1.80 GHz and 8 GB RAM. The proposed models are built by using some of the deep learning toolkits such as Numpy, Tensorflow, Keras, Pandas, Matplotlib, Pylab and Datetime.
Firstly, data preprocessing is done to make the data suitable for proposed model by removing all comas and converting data to matrix shape format. In this stage, data features are scaled to a range from 0 to 1 to achieve a better performance. Afterwards, two arrays are created; one is called X_train and the other y_train. X_train consists of number of samples (rows) that is used for training, the number of left rows and the number of inputs. Meanwhile, y_train consists of the number of samples (rows) that is left after taking the samples that are used in training (the same of the second number that used in X_train array) and the number of outputs. Then the neural network is initialised by adding one hidden layer which is defined with 100 neurons. In addition, a regulation technique that is called Dropout with dropout rate equals to 0.25 so as to prevent model from overfitting is used. The model is compiled with the efficient Adam version of stochastic gradient descent and linear activation function. It is also fitted with 10 training epochs and a batch size 256. After that, selecting features process is started (columns) to be involved into training and prediction which are solar radiation, ambient temperature and photovoltaic system output current. After finishing training, future prediction is started for specified period which is considered as a parameter in date_range() function and then compared the results of prediction with the actual values.
Proposed model evaluation
In this research R-Squared error, mean absolute error (MAPE), mean bias error (MBE) and root mean squared error (RMSE) are used to evaluate the proposed models. MAPE indicates model's general accuracy, where it can be calculated by comparing the measured values of the current with the predicted values of the current at specific test conditions. MAPE is computed by,
Results and discussion
In this research, experimental data of a 1.4 kWp PV system are utilised in developing the proposed models. The specifications of the adopted system are as shown in Table 2. The performance of the system (output current and voltage) is recorded every one second. The monitoring system consists of solar radiation transmitter of high-stability silicon photovoltaic detector model WE300 with accuracy of ±1%, temperature sensor for the surface of the PV panel model WE710 with accuracy of ±0.25°C, air temperature sensor model WE700 with range of −50°C to +50°C and accuracy of ±0.1°C, and current transducer Model: CTH-050 with input range of 0–50 A (DC) and output of 4–20 mA.
Specifications of the PV system that is adapted in this research.
On the other hand, Table 3 shows the adapted cases in this research, while, Figure 10 shows the profiles that are used in training the proposed model for each case.

Training datasets for all testing cases. (a) Training data for case 1, (b) Training data for case 2 and 4, (c) Training data for case 3, (d) Training data for case 5 and 8, (e) Training data for case 6, (f) Training data for case 7.
Selected cases for training and testing the proposed models.
Figures 11 and 12 show the prediction results for both models and all cases. From the figures, it seems that both models could predict the photovoltaic output current accurately. However, in order to validate the results the evaluation metrics adapted in this research are presented in Tables 4 and 5.

GRU results for PV ouput current prediction using different traning and testing sets.

LSTM results for PV ouput current prediction using different traning and testing sets.
Evaluation of the proposed GRU model.
Evaluation of the proposed LSTM model.
Tables 4 and 5 show evaluation of the proposed models based on the adapted three statistical errors. From Table 4, the MAE of the proposed GRU accuracy is in the range of (7.7–19.2)% for all cases. The worst case is Case 4 when an uncertain day is used for training. Meanwhile, the best is when half of unstable day is used for training in order to predict two stable days. Here MAE results cannot be conclusive for these cases as it is somehow close and varying depending on day profile. However what we can read from MAE values that when profile (b) in Figure 10 is used for training, the worst results are obtained. As for the RMSE and MBE values, the situation is somehow close the MAE values whereas the RMSE values are in the range of 0.12–0.30 A, while MBE values are in the range of (−0.04–0.9) A respectively. Both RMSE and MBE show acceptable accuracy for both models. However, in this research the focus is given to Case 4 and Case 8. In these cases the relatively high MAE is noted because of the night time values between the days and therefore, the focus is given more to the RMSE and MBE to evaluate these cases. The RMSE and MBE are better for Case 8 although less data are used for training. This is mainly because of the utilised profile for training. Although the same day was used for the training, but it is very clear that the morning (1st half of the day) is better than the 2nd half whereas current values are reduced very much. This means that the profile of the first half of the day is more consistent and therefore, the results were better for this part.
As for LSTM model, Table 5 shows somehow similar scenario and analysis to the GRU model whereas the range of MAE, RMSE and MBE values are (8.9–19.2)%, (0.12–0.32) A and (−0.002–0.071) A respectively. Here also results of Case 8 are slightly better than results of Case 4.
Anyway, with both models, case 8 (the preferred case) accuracy is very close to the results of other cases and thus, it is possible to consider the use of half of a day for training is enough for one week time prediction considering highly sensitive data.
Table 6 shows the utlization of the processor based on the case and the utlizated model. In fact, it is expected that as far as, the required training data is smaller, the utlization of the processor is lower. This means less required computunal power and consquently esier to embed the model on controller as a physical system. In Table 6, Case 4 means that one day is used for training, meanwhile, case 8 means that only half a day is used for training. From the table, Case 8 utlized less than Case 4 of the processor meanwhile GRU model requires less power than LSTM to exctute the process. Therefore, GRU is prefered for such a task as it is slightly more accurate than LSTM and requires less computional power.
Computational power required for PV output power prediction by using GRU and LSTM model.
To present the results of the proposed models in a better way, a comparison with methods presented in (Abdel-Nasser and Mahmoud, 2019; Lee et al., 2019; Lee and Kim, 2019; Li et al., 2019; Wang et al., 2018, 2019; Wen et al., 2019; Yan et al., 2020) is conducted in Table 7. The comparison is done considering number and types of inputs (G: solar radiation, T: ambient temperature, W: wind speed, H: relative humidity), required data for training, length of predicted data, type of the model, and sensitivity of the data utilised. From the table the proposed models have used the minimum training data to predict the maximum period at the best accuracy. This is because of the utilisation of high sensitive data (in seconds), whereas models are able to learn in much better way than models that are developed based on datasets in minutes or hours.
Comparison between the proposed models and other similar models.
Conclusion
In this research, two deep learning neural network models were proposed to predict photovoltaic output current. The proposed models were long short-term memory and gated recurrent unit neural networks. The proposed models were developed based on minimum data for training so as to predict one week time by utilising performance datasets in seconds for a PV system. The proposed model is assumed to predict photovoltaic output current at each second for one week time by using global solar radiation and ambient temperature values as inputs. Python environment were used to develop the proposed models, while, three statistical errors were used to evaluate the proposed models which were mean absolute percentage error, root mean square error and mean bias error. Results showed that the proposed model could accurately predict photovoltaic output current whereas the root mean square error values are in the range of 0.12–0.30 A, while mean bias error values were in the range of (−0.04–0.9) A for the proposed GRU model. Meanwhile root mean square error and mean bias error values were (8.9–19.2)%, (0.12–0.32)A and (−0.002–0.071) A respectively. Based on that, it was concluded that GRU is better than LSTM as it could predict photovoltaic output current slightly better. GRU it utilised less capacity of the utilised processor as compared to LSTM. Finally a comparison with other similar methods was conducted so as to show the significance of the proposed models. Based on this comparison, the utilisation of highly sensitive data (in seconds) made the proposed model more accurate in predicting targets as the utilisation of such data made the learning process of the machines more efficient.
Footnotes
Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Data Availability
Data is available upon request from the author.
Funding
The author(s) received no financial support for the research, authorship and/or publication of this article.
