Sunshine duration is the period of time during which the ground surface receives radiation by direct sunlight [1]. This sunshine duration period is defined by the World Meteorological Organization (WMO) in 2003 to be the length of time during which direct solar irradiance exceeds a threshold of 120 W/m2 [2].
According to Stambouli et al. [3], the sunshine duration over the whole Algerian territory exceeds 3,000 h annually and may reach 3,900 h in high plains and Sahara region. This huge quantity of sunshine per year makes Algeria one of the countries with the highest solar radiation levels in the world.
Knowledge of sunshine duration is mandatory for the design and optimization of renewable solar energy systems, but its measurements are always not available due to high costs and technical complexities.
Modeling and simulation of the nonlinear continuous variation of sunshine duration is to know how this parameter will behave without doing experimental measurements. Due to complexity of the relationship between sunshine duration and its dependent operating parameters, computational intelligence models are often more flexible against statistical models. Nowadays, a powerful method based on artificial intelligence namely Artificial Neural Networks (ANN), Random Forest (RF), Extreme Gradient Boosting (XGBoost), Support Vector Regression (SVR) and Adaptive Neuro-fuzzy Inference System (ANFIS) in modeling complex phenomena has been successfully used [4], [5].
Therefore, various approaches have been proposed in literature to predict sunshine duration data in some parts of the world.
Mohandes and Rehman [1] made a comparison between two algorithms, namely, Particle Swarm Optimization (PSO) and Support Vector Machine (SVM) to estimate the sunshine duration of any region in Saudi Arabia. The best model was found with PSO algorithm.
Kabaa et al. [6] evaluated the potential of SVM approach for estimating daily sunshine duration using three different kernels of SVM, linear, polynomial, and Radial Basis Function (RBF). Results have shown that the SVM methodology can be a good alternative to those conventional and ANN methods for estimating daily sunshine duration.
Rahimikhoob [7] designed a Multi-Layer Perceptron (MLP) to estimate sunshine duration based on air temperature and humidity data under arid environment south- east of Iran. Results show that modeling by ANN technique made satisfactory estimates.
Kandirmaz et al. [8] uses an ANN approach for estimating monthly mean daily values of global sunshine duration for Turkey. Statistical indicators have shown that, Generalized Regression Neural Network (GRNN) and MLP models produced better results than the RBF model and can be used safely for the estimation of monthly mean daily values of global sunshine duration.
In comparison to aforementioned methods, ANN can be used to model many complex processes due to its robustness, simplicity, non-linearity and its ability to learn from experimental samples without any prior assumptions about their nature.
To this date, there is no comprehensive ANN model that is able to estimate sunshine duration. The novelty of this study is to investigate the feasibility of using three layers feed forward back propagation ANN algorithm to model the nonlinear continuous variation of monthly mean daily values of global sunshine duration in Algeria. These sunshine duration data are desirable for calculating many important parameters such as reference evapotranspiration and daily solar radiation.
The ANN implementation consists of several stages which are explained in detail below and summarized in the flow chart shown in Figure 1 [9], [10]:
In this study, data were arbitrarily split into 3 groups;
33% for training stage (11 × 124);
33% for testing stage (11 × 124);
33% for validation stage (11 × 124);
The training is carried out through the exposition of the network to a specific data set of information as well as by applying a training algorithm to produce the desired output from the network [11]. The efficiency of the trained network was tested and validated by using new sets of input not used in the training stage;
Back-propagation networks refer to a multi-layered, feed-forward preceptor trained with an error back-propagation algorithm. Inputs are propagated forward through each layer to appear as outputs. The error function (i.e. objective function) between the latter and the desired ones are then propagated backward, then the weights and thresholds are adjusted to minimize the sum Square Error (MSE). Details of this algorithm are presented in the literature [12]-[14];
In this study, Levenberg-Marquardt algorithm [15] was adopted to minimize the objective function;
Despite the fact that there are some published methods showing how to initiate weights [16], which are important factors of ANN, these suggestions are not generalized;
To improve the learning speed, a linear normalization in the range of [−1, +1] has been adopted in this study using eq. (1) and eq. (2) hereinafter summarized in Table 1 [17];
As ANNs are sensitive to the number of hidden neurons, their selection has to be done by trial and error method independently of the number of inputs [18]. The ANNs need to remain the simplest possible (parsimony principle) [19];
Different types of transfer functions are proposed in the literature [15]. The sigmoid activation function [Table 1, eq. (3)] in the hidden layers is commonly used to introduce nonlinearity into the network and the purelin transfer function [Table 1, eq. (4)] can satisfy the requirement in the output layer [20], [21];
Each topology was repeated several times to avoid the overfitting of the designed model caused by the initial random initialization of weights and thresholds [22], [23];
Percentage Root Mean Square Error (%RMSE), Mean Absolute Percentage Error(MAPE) and Coefficient of determination (R2), eq. (5) to eq. (7) respectively, illustrating the performance of the ANN model [24], are listed in Table 1;
To optimize ANN parameters, all the aforementioned steps will be programmed using Matlab software [25].
Flow chart of ANN training processes [28]

Summary of some mathematical equations used to calculate the ANN accuracy
Eq. |
Measure and Matlab code |
Calculation |
Nomenclature |
---|---|---|---|
(1) |
X is the original data value (input) and Y is the corresponding normalized variable. Tansig transfer function ranges between [−1, +1], this implies that Ymin = −1 and Ymax = 1 |
||
(2) |
De-normalizing (to real value) of data estimated by ANN (postmnmx) [17], [26] |
||
(3) |
Hyperbolic tangent sigmoid transfer function (tansig) [26] |
f denotes tansig transfer function |
|
(4) |
Linear function (purelin) [27] |
g denotes purelin transfer function |
|
(5) |
Percentage Root Mean Square Error [8] |
Ti and Pi denote target and ANN predicted values respectively and N denotes the number of data points in the used set |
|
(6) |
Mean Absolute Percentage Error [1] |
||
(7) |
Coefficient of determination [27] |
The neural network toolbox of Matlab software (Matlab Version 7.9.0 R2009b) has been employed to develop the desired feed-forward MLP network.
Due to paucity of data, ten parameters were selected as inputs for the ANN to model the sunshine duration in three sites in Algeria.
In this work, meteorological data were obtained from the National Office of Meteorology (ONM) Algiers-Algeria. Detailed geographic, climatic characteristics and source of data used for training/validation and testing of ANN model are given in Table 2. The experimental data gathered for the three selected cities were analyzed to delete outliers manually. This stage has been done by plotting the variation of each parameter in Matlab software. Results revealed that about 2% of data lie outside the expected range due to the equipment failure and other technical problems.
Geographic, climatic characteristics of the study stations
Sites |
Latitude (N°) |
Longitude (E°) |
Altitude [m] |
Points |
Period |
|
---|---|---|---|---|---|---|
Médéa |
36.45 |
2.75 |
1,030 |
Mediterranean |
132 |
2000-2009 and 2011 |
Tlemcen |
35.01 |
1.28 |
246 |
Mediterranean |
120 |
1996-2005 |
Batna |
35.45 |
6.19 |
822 |
Semi-arid climate |
120 |
1996-2005 |
The distribution of measured sunshine duration data has been depicted in Figure 2.
Distribution of the monthly measured sunshine duration used to design the ANN

The feed forward ANN type with Levenberg-Marquardt Back Propagation training algorithm was chosen because it is suitable for modeling the relationship between input and output variables [28].
In this paper, the performance of ANN with varying number of neurons (1-35) in the hidden layer was investigated where each ANN- architecture was trained 10 times in order to avoid random effects. Tests have been performed on two hidden layers and with different parameters. However, no improvements have been reported.
Results demonstrated that architectures with one hidden layer were able to reach the goal in term of errors and determination coefficient. Table 3 shows the structure of the optimized ANN model. The accuracy of the networks was evaluated for each epoch in the training through Mean Squared Error (MSE). The best validation performance is 10−3 at epoch (iterations) 1,000 for the best network topology with overall MAPE of 2.0152% and %RMSE of 2.7411%, indicating an accurate mapping of the data.
Architecture of the optimized ANN model
Type of network |
Training algorithm |
Input layer |
Hidden layer number: 01 |
Output |
||
No. of neurons |
No. of neurons |
Activation function |
No. of neurones |
Activation function | ||
---|---|---|---|---|---|---|
FFBP NN (newff Matlab function) |
Levenberg-Marquardt Backpropagation (trainlm Matlab function) |
10 |
25 |
Hyperbolic tangent sigmoid (tansig Matlab function) |
01 |
Linear (purelin Matlab function |
The performance of the designed ANN is given in Table 4.
Performances of MLP
MAPE [%] |
%RMSE [%] |
R2 |
|
---|---|---|---|
Training |
1.9547 |
2.6236 |
0.9994 |
Test |
2.2567 |
2.9374 |
0.9991 |
Validation |
1.8343 |
2.4557 |
0.9994 |
All |
2.0152 |
2.7411 |
0.9993 |
Figure 3 shows a comparison between experimental and predicted values of sunshine duration during training and test stage. As this plot shows, there is very good agreement between target data and the results obtained from the ANN model with an overall R2 of 0.9993. The R2 value for the sunshine duration is close to 1.00 for the training, validation, test and overall data sets showing that the model has captured the features quite accurately. Results revealed that an accurate correlation exists between the correlated data by ANN model and experimental ones.
Experimental vs. predicted sunshine duration: for the training data set (a); for the test data set (b); for the validation data set (c) and overall data set (d)

Figure 4 shows a comparison between experimental data and NN predicted results. This figure shows an excellent agreement between real data (shown as white face markers) and the NN predicted results (shown as colored face markers). The predicted data curves follow the same trend of the experimental data with slight difference. Overall, results show a good predictive ability of the NN model for sunshine duration estimation. The proposed approach can be used as a method to estimate sunshine duration in the remote and rural locations in Algeria with no direct measurement devices at least in regions with similar weather conditions. An accurate preliminary statistical analysis of the data used in this study with maximums, minimums, standard deviations, standard error, variances, kurtosis and skewness has been done in Table 5.
Comparison between experimental data and NN predicted results during the test stage: Batna city (a); Tlemcen (b) and Médéa city (c)

Input and output parameters used in modeling
Variable category |
No. |
Parameters |
Unit |
Minimum |
Maximum |
Standard deviations |
Standard error |
Variances |
Kurtosis |
Skewness |
---|---|---|---|---|---|---|---|---|---|---|
Input |
1 |
Year |
[-] |
1996 |
2011 |
3.8 |
0.2 |
14.1 |
2.564 |
0.322 |
2 |
Month number |
[-] |
1 |
12 |
3.5 |
0.2 |
11.9 |
1.783 |
0.000 |
|
3 |
Longitude |
[°] |
35.01 |
36.45 |
0.6 |
0.0 |
0.4 |
1.413 |
0.353 |
|
4 |
Latitude |
[°] |
1.28 |
6.19 |
2.0 |
0.1 |
4.1 |
1.560 |
0.482 |
|
5 |
Altitude |
[m] |
246 |
1,030 |
331.9 |
17.2 |
110,128.3 |
1.761 |
−0.553 |
|
6 |
Minimum air temperature |
[°C] |
−3.6 |
22.3 |
6.6 |
0.3 |
43.9 |
1.801 |
0.174 |
|
7 |
Average air temperature |
[°C] |
2.9 |
29.2 |
7.4 |
0.4 |
55.0 |
1.653 |
0.189 |
|
8 |
Maximum air temperature |
[°C] |
5.7 |
39.3 |
8.7 |
0.5 |
76.1 |
1.761 |
0.094 |
|
9 |
Wind speed |
[m/s] |
0.8 |
5.7 |
0.9 |
0.0 |
0.8 |
2.840 |
0.497 |
|
10 |
Relative humidity |
[%] |
32 |
89 |
12.7 |
0.7 |
161.3 |
2.593 |
−0.502 |
|
Output |
11 |
Sunshine duration |
[h] |
91 |
390.2 |
66.1 |
3.4 |
4,370.6 |
2.155 |
−0.059 |
The developed model is given by the following formula [eq. (8)]:
where s is the number of neurons in the hidden layer (S = 25), k is the number of neurons in the input layer (K = 10), l is the number of neurons in output layer (l = 1), Wi, W0 and b1(s), b2(l) are weights and biases, respectively. The major disadvantage of this technique is that it can be used only in the range in which it has been trained as it is empirical in nature. For this reason, ranges of the used database for the model are shown in Table 5.
Once a satisfactory degree of input-output mapping was achieved. The network training was stopped and a set of completely unknown test data was applied for verification.
The performance of the herein developed ANN model is compared to the previously developed ones in literature for prediction of sunshine duration [1], [7], [8]. Details of the comparison are given in Table 6 in terms of R2 and different errors. Based on the obtained results, the determination coefficient and the different errors obtained in the present study are very acceptable than those ones published in literature.
Review of the proposed ANN models for sunshine duration estimation using ANN
Authors |
Type |
R2 test |
MAPE |
---|---|---|---|
[1] |
Two NN algorithms: |
||
PSO algorithm |
0.612 |
2.3%-22.9% overall average of 6.9% |
|
SVM |
0.668 |
2.7%-16.7% overall average of 6.5% |
|
[7] |
MLP |
0.81 |
%RMSE of 6.3% |
[8] |
GRNN |
0.9530 |
9.88 |
MLP |
0.9563 |
9.36 |
|
RBF |
0.8902 |
10.75 |
|
[6] |
SVM-RBF |
0.8435 |
RMSE = 1.5105 h |
This study |
MLP |
0.9993 |
Overall average MAPE of 2.0125% Overall average %RMSE of 2.7411% |
In this study, a multilayer feedforward neural network with a learning scheme of the BP of errors and the Levenberg-Marquardt algorithm for the adjustment of the connecting weights were applied for modeling ground measurement sunshine duration. The best network topology was obtained as (10-25-1) with the hyperbolic sigmoid as transfer function for the hidden layers and linear transfer function of the output layer. The neural network model presently developed gives an overall MAPE of 2.015% and %RMSE of 2.741% which led to a significantly better estimation of sunshine duration. This was further confirmed by the value of coefficient of determination which is 0.9993.
After the comparison between the predicted results and those of the four published models, it has been shown that the proposed ANN models have a better performance than the literature models. The optimized ANN can be used in these three cities to:
Complete some missing data due to heavy power-cuts especially in summers;
Complete data when it lies outside the expected range due to equipment failure and other problems like (calibration problems, dirt on the sensor, accumulated water, shading of the sensor by masts);
Design and optimize solar appliances;
Dispense with the use of a heliograph and finally.
As no model can be considered as the best one and with more available experimental data the model can be improved to be applicable for many cities in Algeria.
Estimation of Sunshine duration in Saudi Arabia ,J. Renew. Sustain. Energy , Vol. 5 (3), :1-142013, https://doi.org/10.1063/1.4811284
, - , Operation and Control of Renewable Energy Systems, 2017
A review on the renewable Energy development in Algeria: Current Perspective, Energy Scenario and sustainability Issues ,Renew. Sustain. Energy Rev , Vol. 16 (7), :4445-44602012, https://doi.org/10.1016/j.rser.2012.04.031
, Comparison of support Vector Machine and extreme gradient boosting for predicting daily Global Solar radiation using Temperature and Precipitation in Humid Subtropical Climates: A Case Study in China ,Energy Convers. Manag. , Vol. 164 , :102-1112018, https://doi.org/10.1016/j.enconman.2018.02.087
, Applications of Artificial Neural Networks for adsorption removal of Dyes from Aqueous Solution: A review ,Adv. Colloid Interface Sci , Vol. 245 , :20-392017, https://doi.org/10.1016/j.cis.2017.04.015
, Estimation of daily Sunshine duration using support Vector Machines ,Int. J. Green Energy , Vol. 14 (4), :430-4412017, https://doi.org/10.1080/15435075.2016.1265971
, Estimating Sunshine duration from other Climatic Data by artificial Neural Network for ET0 estimation in an Arid Environment ,Theor. Appl. Climatol. , Vol. 118 (1-2), :1-82014, https://doi.org/10.1007/s00704-013-1047-1
, Estimation of Monthly Sunshine duration in Turkey using artificial Neural Networks ,Int. J. Photoenergy , Vol. 2014 , :92014, https://doi.org/10.1155/2014/680596
, Optimisation of the predictive ability of Artificial Neural Network (ANN) Models: A comparison of three ANN Programs and four Classes of training Algorithm ,Eur. J. Pharm. Sci. , Vol. 25 (4-5), :395-4052005, https://doi.org/10.1016/j.ejps.2005.04.010
, - , Neural Networks: A Comprehensive Foundation (1st ed.), 1994
Applications of artificial Neural-Networks for Energy Systems ,Appl. Energy , Vol. 67 (1-2), :17-352000, https://doi.org/10.1016/S0306-2619(00)00005-2
, Application of artificial Neural Network for predicting Crack growth Direction in Multiple Cracks Geometry ,Appl. Soft Comput. J , Vol. 30 , :514-5282015, https://doi.org/10.1016/j.asoc.2015.02.003
, Using Neural Networks for forecasting volatility of S&P 500 Index Futures Prices ,J. Bus. Res , Vol. 57 (10), :1116-11252004, https://doi.org/10.1016/S0148-2963(03)00043-2
, Prediction of Global Solar Radiation in India using artificial Neural Network ,J. Sustain. Dev. Energy, Water Environ. Syst. , Vol. 42016 (2), :94-106, https://doi.org/10.13044/j.sdewes.2016.04.0009
, Prediction of Hydrocarbon densities using an artificial Neural Network-Group contribution Method up to high Temperatures and Pressures ,Thermochim. Acta , Vol. 556 , :89-962013, https://doi.org/10.1016/j.tca.2013.01.038
, Estimation of hourly average Solar Radiation on tilted Surface via ANNs ,Int. J. Neural Syst. , Vol. 12 (1), :1-132002, https://doi.org/10.1142/S0129065702001035
, New combined Models for estimating daily global Solar Radiation from measured Air Temperature in Semi-Arid Climates: Application in Ghardaïa ,Energy Convers. Manag. , Vol. 79 , :606-6152014, https://doi.org/10.1016/j.enconman.2013.12.057
, Neural Networks for predicting compressive Strength of structural light weight Concrete ,Constr. Build. Mater. , Vol. 23 (6), :2214-22192009, https://doi.org/10.1016/j.conbuildmat.2008.12.003
, Neural Network approach to estimate 10-min Solar global irradiation Values on tilted Planes ,Renew. Energy , Vol. 50 , :576-5842013, https://doi.org/10.1016/j.renene.2012.07.035
, Real-Time deformation of Structure using finite Element and Neural Networks in Virtual Reality Applications ,Finite Elem. Anal. Des. , Vol. 42 (11), :985-9912006, https://doi.org/10.1016/j.finel.2006.03.008
, Neural Network design for Engineering Applications ,Comput. Struct. , Vol. 79 (17), :1541-15522001, https://doi.org/10.1016/S0045-7949(01)00039-6
, Novel approach for estimating solubility of solid Drugs in supercritical Carbon Dioxide and critical properties using direct and inverse artificial Neural Network (ANN) ,Neural Comput. Appl. , Vol. 28 (1), :87-992017, https://doi.org/10.1007/s00521-015-2038-1
, An integrated treatment of domestic Wastewater using sequencing batch Biofilm Reactor combined with vertical Flow constructed Wetland and its artificial Neural Network Simulation Study ,Ecol. Eng. , Vol. 64 , :18-262014, https://doi.org/10.1016/j.ecoleng.2013.12.040
, Estimation of Solar radiation using artificial Neural Networks with different input Parameters for Mediterranean Region of Anatolia in Turkey ,Expert Syst. Appl. , Vol. 38 (7), :8756-87622011, https://doi.org/10.1016/j.eswa.2011.01.085
, Prediction of Vehicle reliability Performance using artificial Neural Networks ,Expert Syst. Appl. , Vol. 34 (4), :2360-23692008, https://doi.org/10.1016/j.eswa.2007.03.014
, Multilayer feedforward Networks are universal approximators ,Neural Networks , Vol. 2 (5), :359-3661989, https://doi.org/10.1016/0893-6080(89)90020-8
, Viscosity prediction of ternary Mixtures containing ILs using Multi-Layer Perceptron artificial Neural Network ,Fluid Phase Equilib. , Vol. 326 , :15-202012, https://doi.org/10.1016/j.fluid.2012.04.017
, Supervised artificial Neural Network-Based Method for conversion of Solar Radiation Data (Case Study: Algeria) ,Theor. Appl. Climatol. , Vol. 128 (1-2), :439-4512017, https://doi.org/10.1007/s00704-015-1720-7
, Parabolic trough Solar Thermal Power Plant: Potential, and Projects development in Algeria ,Renew. Sustain. Energy Rev , Vol. 21 , :288-2972013, https://doi.org/10.1016/j.rser.2012.11.074
,