Description Author(s) Examples
Sun irradiance and air temperature in Rome from October 2012 to October 2013 as scraped daily from meteo.enel.it.
Marco Bascietto marco@bascietto.name
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | library(reshape2)
library(lubridate)
library(ggplot2)
data(pvRome)
cfg <- list(
gamma = 0.4 # %/degree Celsius A typical polycristalline cell power coefficient
, etaStd = 15 # % A typical polycristalline cell efficiency
, NOCT = 45 # degree Celsius A typical polycristalline cell Nominal Operating Cell Temperature
, supPannello1kWp = 7 # m^2 A typical polycristalline cell area for 1kWp system
, PVlosses = 3+14 # % An estimate of PV system losses (Photovoltaic Geographical Information System, European Commission Joint Research Centre Ispra, Italy)
, tilt = 18 # degree Roof tilt
, geoCoord = matrix(
c(12.44, 41.79) # Longitude and latitude of...
, byrow = TRUE
, ncol = 2
, dimnames = list(c("Rome"))
)
)
# We only need air temperature and sun irradiance in order to estimate PV efficiency
pvRome <- pvRome[pvRome$variable %in% c("Te", "G"),]
pvRome <- within(pvRome, {
# Strip unused factors
variable <- factor(variable)
# Convert value to from factor to numeric
value <- as.numeric(as.character(value))
# Convert time from factor to POSIXct class
time <- ymd_hms(as.character(time), tz = "CET")
# Add location info
place <- factor("Rome")
})
pvRome <- dcast(pvRome, time + place ~ variable)
pvRome <- getPVEfficiency(pvRome, cfg)
pvRome <- within(pvRome, {
dayHourOfMonth <- mday(time) + hour(time) / 24
yearMonth <- month(time, label = TRUE, abbr = FALSE)
})
pvRome.m <- melt(
pvRome
, id.vars = c("time", "G", "dayHourOfMonth", "yearMonth", "place")
, variable.name = "variable"
)
TePlot <- ggplot(pvRome.m[pvRome.m$variable == "Te", ]) +
geom_line(aes(x = dayHourOfMonth, y = value, color = yearMonth, group = yearMonth)) +
labs(list(title = "Hourly air temperature", y = "Temperature (degree C)", x = "Day of month")) +
guides(colour = guide_legend("Temperature")) +
theme_bw()
TcPlot <- TePlot %+% pvRome.m[pvRome.m$variable == "Tc", ] +
labs(title = "Hourly PV cell temperature")
plot(TePlot)
plot(TcPlot)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.