R code for the paper: "Clear sky solar irradiance models: a review of seventy models", Fernando Antonanzas, Ruben Urraca, Jesus Polo, Oscar Perpiñán, Rodrigo Escobar, Renewable and Sustainable Energy Reviews, Volume 107, 2019, Pages 374-387, ISSN 1364-0321,2019, 10.1016/j.rser.2019.02.032.
You may either clone the repository with
git or download a ZIP file with its content.
Clone with git:
git clone git://github.com/EDMANSolar/pcsol
Download a ZIP file.
Once cloned or downloaded, the repository provides a main function
clearSky. This function is an interface to the set of seventy
models. These models can be inspected in the file
Use the next code to load the required package,
solaR, configure the
working directory, and load the functions, and the list of models:
setwd('NAME_OF_YOUR_FOLDER') ## replace the text source('R_code/clearSky.R') source('R_code/csMother.R')
clearSky has three arguments:
meteo: a time series of meteorological measurements, including the variables required by the corresponding model. This time series must be a
zooobject (see zoo package).
loc: coordinates of the location where the model is to be evaluated. It must be a
model: name of the model to be evaluated. It must be included in the set of seventy models implemented in this code. This list can be obtained with
The repository includes the two datasets used in the paper:
## cabauw data.frame load('data_example/cabauw.RData') ## carpentras data.frame load('data_example/carpentras.RData')
The coordinates of these stations are available in the
file located in the
BSRNcc <- read.csv('data_example/stations.csv')
For example, the next code evaluates the ASHRAE1972 model in Cabauw:
cabauwASHRAE <- clearSky(meteo = cabauw, loc = BSRNcc[1, ], model = "ASHRAE1972")
The result is a
zoo object with three components,
Bn. Next code display a comparison with the measurements:
plot(cabauwASHRAE$G0, cabauw$G0, xlab = 'model', ylab = 'measurements')
evalCode.R in the
R_code folder evaluates the whole set
of models in the two stations, and creates target diagrams to show the
model statistics using the