Etiquetas

,

The version 0.22 of solaR includes a new method, mergesolaR. It is designed to merge daily time series of several solaR objects.
For example, we can obtain the daily irradiation of the whole set of meteorological stations of Madrid (Spain) and use this information to calculate the productivity of a grid connected PV system. It is possible to complete this process with the lapply function. Therefore, we obtain a list of ProdGCPV objects:


EstMadrid <- subset(RedEstaciones, NomProv=='Madrid')
nEstMadrid <- nrow(EstMadrid)
namesMadrid <- EstMadrid$NomEst

prodMadrid <- lapply(1:nEstMadrid,
 function(x){try(prodGCPV(lat=41, modeRad='mapa',
 mapa=list(prov=28, est=x,
 start='01/01/2009', end='31/12/2010'))
 )})
names(prodMadrid) <- namesMadrid
okMadrid <- lapply(prodMadrid, class)!='try-error'
prodMadrid <- prodMadrid[okMadrid]

In order to prevent from the erroneous behaviour of some stations, the code includes the use of try.

Now it’s time for mergesolaR. Since we have a list of objects, do.call can solve the problem:


YfMadrid <- do.call(mergesolaR, prodMadrid)

The mergesolaR for a set of ProdGCPV objects merges the daily time series of the Yf variable of each object. The result is a multivariate zoo object which can be displayed (for example) with the horizonplot function.

Previously, the row mean is substracted from each column in order to show the deviation of each meteorological station from the daily mean of the set of stations.

horizonplot(YfMadrid-rowMeans(YfMadrid),
 origin=0,
 scales=list(y=list(relation='same')),
 colorkey=TRUE)

Besides, the function TargetDiagram is an alternative tool to show the behaviour of the set of meteorological stations.

From both graphics you should guess that the behaviour of the station “Center_Finca_Experimental” is clearly different from the rest of the group.

TargetDiagram(YfMadrid, end=as.POSIXct('2010-12-31'), ndays=c(10, 20, 30, 40, 50, 60))