Intro

This vignette presents an example of using the onlineforecast package for fitting a model for solar power forecasts.

Data

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 available here on the website. Its a data.list (see the vignette onlineforecasting.pdf):

load("data/Dsolarpower.rda")
class(Dsolarpower)
##     [1] "data.list"

Keep it in D and see the content:

D <- Dsolarpower
names(D)
##     [1] "t"            "PVpower"      "I"            "Ta"           "I.obs"       
##     [6] "Ta.obs"       "cosAoi"       "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))

A shorter period and note how the forecasts I_kxx are lagged (12 step forecast is lagged 12 steps) such that they are all aligned in time:

plot_ts(D, c("^y|I.obs","^I$"), c("2010-07-01","2010-07-15"), kseq=c(1,12))