This vignette presents an example of using the onlineforecast package for fitting a model for solar power forecasts.
Data for the forecasting examples is taken from a data set collected in Sønderborg, Denmark.
First Load the package:
library(onlineforecast)
The “Dsolarpower” data is downloaded and loaded. It’s a data.list (see the vignette onlineforecasting.pdf):
path <- paste0(tempdir(),"/Dsolarpower.rda")
download.file("https://onlineforecasting.org/examples/data/Dsolarpower.rda", path)
load(path)
class(Dsolarpower)
## [1] "data.list"
Keep it in D
and see the content:
D <- Dsolarpower
names(D)
## [1] "t" "PVpower" "I" "Ta" "I.obs" "Ta.obs" "cosAoi"
## [8] "sunElevation" "tday"
The solar power (in W) is kept in a data.frame. It was generated by transforming the observed global radiation (in ‘I.obs’) for PV panels with different angles of azimuth (m40 is pointing 40 deg. towards West, 0 is straight South, etc. They were all with tilt of 45 deg.):
head(D$PVpower)
## azimuth.m40 azimuth.m20 azimuth.0 azimuth.20 azimuth.40
## 9505 0 0 0 0 0
## 9506 0 0 0 0 0
## 9507 0 0 0 0 0
## 9508 0 0 0 0 0
## 9509 0 0 0 0 0
## 9510 0 0 0 0 0
The Numerical Weather Predictions (NWPs) of global radiation
head(D$I[ ,1:9])
## k1 k2 k3 k4 k5 k6 k7 k8 k9
## 9505 0 0.000 0.000 0.000 0.000 0.000 0.364 47.8 127.9
## 9506 0 0.000 0.000 0.000 0.000 0.364 47.778 127.9 181.0
## 9507 0 0.000 0.000 0.000 0.364 47.778 127.947 181.0 195.0
## 9508 0 0.000 0.000 0.373 42.316 113.756 145.173 152.6 134.4
## 9509 0 0.000 0.373 42.316 113.756 145.173 152.587 134.4 71.6
## 9510 0 0.373 42.316 113.756 145.173 152.587 134.382 71.6 18.2
Take the solar power (azimuth 20 degrees i.e. panel pointing slightly
west) and keep it as a vector y
:
D$y <- D$PVpower$azimuth.20
A time series plot, see “?plot_ts.data.list”:
plot_ts(D, c("^y","^I$"), kseq=c(1,12))