Learn R Programming

solaR (version 0.46)

A2_calcG0: Irradiation and irradiance on the horizontal plane.

Description

This function obtains the global, diffuse and direct irradiation and irradiance on the horizontal plane from the values of daily and intradaily global irradiation on the horizontal plane. It makes use of the functions calcSol, fCompD, fCompI, fBTd and readBD (or equivalent).

Besides, if information about maximum and minimum temperatures values are available it obtains a series of temperature values with fTemp.

Usage

calcG0(lat, modeRad = 'prom', dataRad,
       sample = 'hour', keep.night = TRUE,
       sunGeometry = 'michalsky',
       corr, f, ...)

Arguments

lat

numeric, latitude (degrees) of the point of the Earth where calculations are needed. It is positive for locations above the Equator.

modeRad

A character string, describes the kind of source data of the global irradiation and ambient temperature.

It can be modeRad = 'prom' for monthly mean calculations. With this option, a set of 12 values inside dataRad must be provided, as defined in readG0dm.

modeRad = 'aguiar' uses a set of 12 monthly average values (provided with dataRad) and produces a synthetic daily irradiation time series following the procedure by Aguiar etal. (see reference below).

If modeRad = 'bd' the information of daily irradiation is read from a file, a data.frame defined by dataRad, a zoo or a Meteo object. (See readBD, df2Meteo and zoo2Meteo for details).

If modeRad = 'bdI' the information of intradaily irradiation is read from a file, a data.frame defined by dataRad, a zoo or a Meteo object. (See readBDi, dfI2Meteo and zoo2Meteo for details).

dataRad
  • If modeRad = 'prom' or modeRad = 'aguiar', a numeric with 12 values or a named list whose components will be processed with readG0dm.

  • If modeRad = 'bd' a character (name of the file to be read with readBD), a data.frame (to be processed with df2Meteo), a zoo (to be processed with zoo2Meteo), a Meteo object, or a list as defined by readBD, df2Meteo or zoo2Meteo. The resulting object will include a column named Ta, with information about ambient temperature.

  • If modeRad = 'bdI' a character (name of the file to be read with readBDi), a data.frame (to be processed with dfI2Meteo), a zoo (to be processed with zoo2Meteo), a Meteo object, or a list as defined by readBDi, dfI2Meteo or zoo2Meteo. The resulting object will include a column named Ta, with information about ambient temperature.

sample

character, containing one of <U+2018>"sec"<U+2019>, <U+2018>"min"<U+2019>, <U+2018>"hour"<U+2019>. This can optionally be preceded by a (positive or negative) integer and a space, or followed by <U+2018>"s"<U+2019> (used by seq.POSIXt). It is not used when modeRad = "bdI".

keep.night

logical. When it is TRUE (default) the time series includes the night.

sunGeometry

character, method for the sun geometry calculations. See calcSol, fSolD and fSolI.

corr

A character, the correlation between the the fraction of diffuse irradiation and the clearness index to be used.

With this version several options are available, as described in corrFdKt. For example, the FdKtPage is selected with corr = 'Page' while the FdKtCPR with corr = 'CPR'.

If corr = 'user' the use of a correlation defined by a function f is possible.

If corr = 'none' the object defined by dataRad should include information about global, diffuse and direct daily irradiation with columns named G0d, D0d and B0d, respectively (or G0, D0 and B0 if modeRad = 'bdI'). If corr is missing, then it is internally set to CPR when modeRad = 'bd', to Page when modeRad = 'prom' and to BRL when modeRad = 'bdI'.

f

A function defininig a correlation between the fraction of diffuse irradiation and the clearness index. It is only neccessary when corr = 'user'

...

Additional arguments for fCompD or fCompI

Value

A G0 object.

References

  • Perpi<U+00F1><U+00E1>n, O, Energ<U+00ED>a Solar Fotovoltaica, 2015. (https://oscarperpinan.github.io/esf/)

  • Perpi<U+00F1><U+00E1>n, O. (2012), "solaR: Solar Radiation and Photovoltaic Systems with R", Journal of Statistical Software, 50(9), 1-32, 10.18637/jss.v050.i09

  • Aguiar, Collares-Pereira and Conde, "Simple procedure for generating sequences of daily radiation values using a library of Markov transition matrices", Solar Energy, Volume 40, Issue 3, 1988, Pages 269<U+2013>279

See Also

calcSol, fCompD, fCompI, readG0dm, readBD, readBDi, corrFdKt.

Examples

Run this code
# NOT RUN {
G0dm = c(2.766, 3.491, 4.494, 5.912, 6.989, 7.742, 7.919, 7.027, 5.369, 3.562, 2.814, 2.179)*1000;
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)

g0 <- calcG0(lat = 37.2, modeRad = 'prom', dataRad = list(G0dm = G0dm, Ta = Ta))
print(g0)
xyplot(g0)

## Aguiar et al.

g0 <- calcG0(lat = 37.2, modeRad = 'aguiar', dataRad = G0dm)
print(g0)
xyplot(g0)

##Now the G0I component of g0 is used as
##the bdI argument to calcG0 in order to
##test the intradaily correlations of fd-kt

BDi = as.zooI(g0)
BDi$Ta = 25 ##Information about temperature must be contained in BDi

g02 <- calcG0(lat = 37.2, 
            modeRad = 'bdI', 
            dataRad = list(lat = 37.2, file = BDi), 
            corr = 'none')

print(g02)

g03 <- calcG0(lat = 37.2, 
            modeRad = 'bdI', 
            dataRad = list(lat = 37.2, file = BDi), 
            corr = 'BRL')
print(g03)

xyplot(fd ~ kt, data = g03, pch = 19, alpha = 0.3)

# }
# NOT RUN {
##NREL-MIDC
##La Ola, Lanai
##Latitude: 20.76685o North
##Longitude: 156.92291o West
##Elevation: 381 meters AMSL
##Time Zone: -10.0

NRELurl <- 'http://goo.gl/fFEBN'

dat <- read.table(NRELurl, header = TRUE, sep = ',')
names(dat) <- c('date', 'hour', 'G0', 'B', 'D0', 'Ta')

##B is direct normal. We need direct horizontal.
dat$B0 <- dat$G0 - dat$D0

##http://www.nrel.gov/midc/la_ola_lanai/instruments.html:
##The datalogger program runs using Greenwich Mean Time (GMT), 
##data is converted to Hawaiin Standard Time (HST) after data collection
idxLocal <- with(dat, as.POSIXct(paste(date, hour), format = '%m/%d/%Y %H:%M', tz = 'HST'))
idx <- local2Solar(idxLocal, lon = -156.9339)

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

lat = 20.77

g0 <- calcG0(lat = lat, modeRad = 'bdI', dataRad = NRELMeteo, corr = 'none')
xyplot(g0)
xyplot(as.zooI(g0), superpose = TRUE)

g02 <- calcG0(lat = lat, modeRad = 'bdI', dataRad = NRELMeteo, corr = 'BRL')
xyplot(g02)
xyplot(as.zooI(g02), superpose = TRUE)
xyplot(fd ~ kt, data = g02, pch = 19, cex = 0.5, alpha = 0.5)

g03 <- calcG0(lat = lat, modeRad = 'bdI', dataRad = NRELMeteo, corr = 'CLIMEDh')
xyplot(g03)
xyplot(as.zooI(g03), superpose = TRUE)
xyplot(fd ~ kt, data = g03, pch = 19, cex = 0.5, alpha = 0.5)
# }

Run the code above in your browser using DataLab