# New version of solaR (0.21)

**Omnia sunt Communia! » R-english**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

The version 0.21 of the *solaR* package is now available at CRAN. This package provides a set of calculation methods of solar radiation and performance of photovoltaic systems. The package has been uploaded to CRAN under the GPL-3 license.

*solaR* is now able to calculate from **both daily and sub-daily irradiation** values. Besides, there are more changes: NEWS. Anyway, you are invited to read the introduction vignette in order to learn the most important funcionalities of *solaR*.

For example, the Measurement and Instrumentation Data Center of the NREL (NREL-MIDC) provides meteorological data from a variety of stations. We will try the La Ola – Lanai station at Hawaii.

file='http://www.nrel.gov/midc/apps/plot.pl?site=LANAI&start=20090722&edy=19&emo=11&eyr=2010&zenloc=19&year=2010&month=11&day=1&endyear=2010&endmonth=11&endday=19&time=1&inst=3&inst=4&inst=5&inst=10&type=data&first=3&math=0&second=-1&value=0.0&global=-1&direct=-1&diffuse=-1&user=0&axis=1' dat <- read.table(file, header=TRUE, sep=',') lat=20.77 lon=-156.9339

We have to change the names of the columns and calculate the horizontal direct irradiation, since only the normal direct irradiation is included in the file.

names(dat) <- c('date', 'hour', 'G0', 'B', 'D0', 'Ta') dat$B0 <- dat$G0-dat$D0

The datalogger program runs using Greenwich Mean Time (GMT), and data is converted to Hawaiian Standard Time (HST) after data collection. With *local2Solar* we can calculate the Mean Solar Time of the index.

idxLocal <- with(dat, as.POSIXct(paste(date, hour), format='%m/%d/%Y %H:%M', tz='HST')) idx <- local2Solar(idxLocal, lon=lon)

Therefore, the object *Meteo* is obtained with:

z <- zoo(dat[,c('G0', 'D0', 'B0', 'Ta')], idx) NRELMeteo <- zoo2Meteo(z, lat=lat)

With this data, a *G0* object can be calculated. First, the direct and diffuse components of the data are used (corr=’none’):

g0NREL <- calcG0(lat=lat, modeRad='bdI', bdI=NRELMeteo, corr='none')

If these components were not available, a fd-kt hourly correlation is needed.. For example, we can use the model proposed by Ridley et al.:

g0BRL <- calcG0(lat=lat, modeRad='bdI', bdI=NRELMeteo, corr='BRL') xyplot(fd~kt, data=g0BRL, pch=19, alpha=0.3, cex=0.5)

Another example: you can compare the losses of a PV system with different configurations. First, we define the irradiation and temperature conditions:

lat=37.2; G0dm=c(2766, 3491, 4494, 5912, 6989, 7742, 7919, 7027, 5369, 3562, 2814, 2179) Ta=c(10, 14.1, 15.6, 17.2, 19.3, 21.2, 28.4, 29.9, 24.3, 18.2, 17.2, 15.2) prom=list(G0dm=G0dm, Ta=Ta)

Then, we can calculate the energy produced by three different PV systems with a two-axis tracker, an horizontal N-S axis tracker and a fixed system.

ProdFixed<-prodGCPV(lat=lat,prom=prom, keep.night=FALSE) Prod2x<-prodGCPV(lat=lat, prom=prom, modeTrk='two', keep.night=FALSE) ProdHoriz<-prodGCPV(lat=lat,prom=prom, modeTrk='horiz', keep.night=FALSE)

Last, we calculate the losses of each system and compare them:

compareLosses(ProdFixed, Prod2x, ProdHoriz)

with this result:

**leave a comment**for the author, please follow the link and comment on their blog:

**Omnia sunt Communia! » R-english**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.