oscar perpin~an lamigueiro - comunidad r...

22
solaR: radiaci ´ on solar y sistemas fotovoltaicos con R Oscar Perpi˜ an Lamigueiro http://solar.r-forge.r-project.org 17 de Noviembre de 2011

Upload: others

Post on 20-May-2020

14 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Oscar Perpin~an Lamigueiro - Comunidad R Hispanor-es.org/3jornadasR/pdfs/2_perpinan_lamigueiro.pdf · Introducci on I Desde la geometr a solar, pasando por la irradiacion efectiva

solaR: radiacion solary sistemas fotovoltaicos con R

Oscar Perpinan Lamigueiro

http://solar.r-forge.r-project.org

17 de Noviembre de 2011

Page 2: Oscar Perpin~an Lamigueiro - Comunidad R Hispanor-es.org/3jornadasR/pdfs/2_perpinan_lamigueiro.pdf · Introducci on I Desde la geometr a solar, pasando por la irradiacion efectiva

Introduccion

I Desde la geometrıa solar, pasando por la irradiacionefectiva en un plano hasta la productividad de un sistemafotovoltaico.

I Clases y metodos S4.

I zoo para construir series temporales multivariantes.

I lattice y latticeExtra para metodos de visualizacion.

Page 3: Oscar Perpin~an Lamigueiro - Comunidad R Hispanor-es.org/3jornadasR/pdfs/2_perpinan_lamigueiro.pdf · Introducci on I Desde la geometr a solar, pasando por la irradiacion efectiva

Clases

Meteo

df2Meteo,

readSIAR, ...

Sol

calcSol

G0

calcG0

Gef

calcGef

ProdGCPV

prodGCPV

ProdPVPS

prodPVPS

Shade

calcShd

Page 4: Oscar Perpin~an Lamigueiro - Comunidad R Hispanor-es.org/3jornadasR/pdfs/2_perpinan_lamigueiro.pdf · Introducci on I Desde la geometr a solar, pasando por la irradiacion efectiva

Geometrıa solar

> lat = 37.2

> BTd = fBTd(mode = "serie")

> solStrous <- fSolD(lat, BTd, method = "strous")

> solSpencer <- fSolD(lat, BTd, method = "spencer")

> solCooper <- fSolD(lat, BTd, method = "cooper")

> solMichalsky <- fSolD(lat, BTd,

method = "michalsky")

> decDif <- solMichalsky$decl - cbind(solStrous$decl,

solSpencer$decl, solCooper$decl)

> names(decDif) <- c("strous", "spencer",

"cooper")

Page 5: Oscar Perpin~an Lamigueiro - Comunidad R Hispanor-es.org/3jornadasR/pdfs/2_perpinan_lamigueiro.pdf · Introducci on I Desde la geometr a solar, pasando por la irradiacion efectiva

Geometrıa solar

Time

−0.

005

0.00

00.

005

0.01

00.

015

0.02

0

ene abr jul oct ene

strousspencercooper

Page 6: Oscar Perpin~an Lamigueiro - Comunidad R Hispanor-es.org/3jornadasR/pdfs/2_perpinan_lamigueiro.pdf · Introducci on I Desde la geometr a solar, pasando por la irradiacion efectiva

Radiacion solar en el plano horizontal

> g0 <- calcG0(lat = 37.2, modeRad = "siar",

dataRad = list(prov = 28, est = 3,

start = "01/01/2009", end = "31/12/2009"))

Page 7: Oscar Perpin~an Lamigueiro - Comunidad R Hispanor-es.org/3jornadasR/pdfs/2_perpinan_lamigueiro.pdf · Introducci on I Desde la geometr a solar, pasando por la irradiacion efectiva

Radiacion solar en el plano horizontal

Time

Wh/

020

0040

0060

0080

00

ene abr jul oct ene

G0dD0dB0d

Page 8: Oscar Perpin~an Lamigueiro - Comunidad R Hispanor-es.org/3jornadasR/pdfs/2_perpinan_lamigueiro.pdf · Introducci on I Desde la geometr a solar, pasando por la irradiacion efectiva

SIAR

38

40

42

−8 −6 −4 −2 0

●● ●

●●●

●● ●●●

●●

●●

● ●

● ●

●●●

●●

●●●●●

●●

●●

●●●

●●

●●

●●●

●●

●●●

●●

●●● ●●

●●

● ● ●●● ●

●●●

●●●

● ●

●●

●●

●●●

●●

● ●

●●

●●

●●

●●

●●

● ●

● ●●

●●

●●●

●●

●●

●● ●

●●

●●

●●

●●

●●

●●

●●●

●● ●

●●

●●●●

●●

●●

●●

●●●

● ●●

●●●●

●●

●●●

●●

●●

●●●

● ● ● ●

● ● ● ●

●● ●

● ●●● ●

●●●●●●

● ● ●

●● ●●● ●●●●● ●● ●●● ●● ●●● ●●●●

●●

AndaluciaAragónCastilla La ManchaCastilla y LeónComunidad de MadridComunidad ValencianaExtremaduraGaliciaNavarra

http://www.marm.es/siar

http://solar.r-forge.r-project.org/data/SIAR.csv

Page 9: Oscar Perpin~an Lamigueiro - Comunidad R Hispanor-es.org/3jornadasR/pdfs/2_perpinan_lamigueiro.pdf · Introducci on I Desde la geometr a solar, pasando por la irradiacion efectiva

SIAR

> Aranjuez <- readSIAR(28, 3, "01/01/2009",

"31/12/2009")

TempMedia

G0

0

2000

4000

6000

8000

●●

●●

●●

●●

●●

●●●

●●

●●

: month { 1 }

●●●

●●●

●●●●●●●●

●●●

●●

: month { 2 }

●●●●

●●●●●●●●●●●●

●●

●●

: month { 3 }

●● ●●

●●

●●●●

●●●●

●●

: month { 4 }

●●●●● ●

●●

●●

●●●●●

●●

●●

●●

●●

: month { 5 }

●●●

●●

●●

● ●

●●

●●●●●

●●

: month { 6 }

●●●●

●●●●●●●●●●●●●●

●●

●● ●●●●●●

: month { 7 }

●●

●●●●●

●●

●●●●●●

●●●●●●●

●●●●●●●

: month { 8 }

0

2000

4000

6000

8000

0 10 20 30

●●●●

●●●●●

●●

●●

●●

●●

●●●●

: month { 9 }

●●●

●●

●●●●●

●●●●●●

●●●●

●●●●

: month { 10 }

0 10 20 30

●●●

●● ●●

●●●

●●●

●●

●●●

● ●

●●

: month { 11 }

●●●

●●

●●

●●

●●

●●

●●●

● ●

●●

: month { 12 }

Page 10: Oscar Perpin~an Lamigueiro - Comunidad R Hispanor-es.org/3jornadasR/pdfs/2_perpinan_lamigueiro.pdf · Introducci on I Desde la geometr a solar, pasando por la irradiacion efectiva

Radiacion solar en un plano inclinado

> g0 <- calcG0(lat = 37.2, modeRad = "siar",

dataRad = list(prov = 28, est = 3,

start = "01/01/2009", end = "31/12/2009"))

> gef <- calcGef(lat = 37.2, modeRad = "prev",

dataRad = g0, beta = 30)

> xyplot(Gef/G ~ cosTheta | month,

data = gef, type = c("p", "smooth"),

cex = 0.4, alpha = 0.5)

Page 11: Oscar Perpin~an Lamigueiro - Comunidad R Hispanor-es.org/3jornadasR/pdfs/2_perpinan_lamigueiro.pdf · Introducci on I Desde la geometr a solar, pasando por la irradiacion efectiva

Radiacion solar en un plano inclinado

cosTheta

Gef

/G

0.4

0.6

0.8

1.0 : month { 1 } : month { 2 } : month { 3 } : month { 4 }

: month { 5 } : month { 6 } : month { 7 } : month { 8 }

0.4

0.6

0.8

1.0

0.0 0.2 0.4 0.6 0.8 1.0

: month { 9 } : month { 10 }

0.0 0.2 0.4 0.6 0.8 1.0

: month { 11 } : month { 12 }

Page 12: Oscar Perpin~an Lamigueiro - Comunidad R Hispanor-es.org/3jornadasR/pdfs/2_perpinan_lamigueiro.pdf · Introducci on I Desde la geometr a solar, pasando por la irradiacion efectiva

Radiacion solar en un plano inclinadosolaR y raster

> library("raster")

[...]

> foo <- function(x, ...) {

gef <- calcGef(lat = x[1],

dataRad = list(G0dm = x[2:13]))

result <- as.data.frameY(gef)[c("Gefd",

"Befd", "Defd")]

as.numeric(result)

}

> latLayer <- init(SISmm, v = "y")

> gefS <- calc(stack(latLayer, SISmm),

foo, filename = "CMSAF/gefCMSAF",

overwrite = TRUE)

Page 13: Oscar Perpin~an Lamigueiro - Comunidad R Hispanor-es.org/3jornadasR/pdfs/2_perpinan_lamigueiro.pdf · Introducci on I Desde la geometr a solar, pasando por la irradiacion efectiva

Radiacion solar en un plano inclinadosolaR y raster

Longitude

Latit

ude

36°N

38°N

40°N

42°N

44°N

10°W 5°W 0°

1200 1400 1600 1800 2000 2200

Page 14: Oscar Perpin~an Lamigueiro - Comunidad R Hispanor-es.org/3jornadasR/pdfs/2_perpinan_lamigueiro.pdf · Introducci on I Desde la geometr a solar, pasando por la irradiacion efectiva

Productividad de un SFCR

> EstMadrid <- subset(SIAR, Provincia == "Madrid")

> nEstMadrid <- nrow(EstMadrid)

> namesMadrid <- EstMadrid$Estacion

> prodMadrid <- lapply(1:nEstMadrid, function(x) {

try(prodGCPV(lat = 41, modeRad = "siar",

dataRad = 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]

> YfMadrid <- do.call(mergesolaR, prodMadrid)

Page 15: Oscar Perpin~an Lamigueiro - Comunidad R Hispanor-es.org/3jornadasR/pdfs/2_perpinan_lamigueiro.pdf · Introducci on I Desde la geometr a solar, pasando por la irradiacion efectiva

Productividad de un SFCR

Time

Ara

njue

zA

rgan

daC

hinc

hón

Fue

ntid

ueña

de

Tajo

San

Mar

tín d

e la

Veg

a

2009−01 2009−07 2010−01 2010−07 2011−01

Vill

a de

l Pra

do

−4.363

−2.909

−1.454

0

1.454

2.909

4.363

Page 16: Oscar Perpin~an Lamigueiro - Comunidad R Hispanor-es.org/3jornadasR/pdfs/2_perpinan_lamigueiro.pdf · Introducci on I Desde la geometr a solar, pasando por la irradiacion efectiva

Sombras en un SFCR

> struct2x = list(W = 23.11, L = 9.8,

Nrow = 2, Ncol = 8)

> dist2x = list(Lew = c(30, 50),

Lns = c(20, 50))

> ShdM2x <- optimShd(lat = lat, dataRad = prom,

modeTrk = "two", modeShd = c("area",

"prom"), distances = dist2x,

struct = struct2x, res = 5,

prog = FALSE)

> shadeplot(ShdM2x)

Page 17: Oscar Perpin~an Lamigueiro - Comunidad R Hispanor-es.org/3jornadasR/pdfs/2_perpinan_lamigueiro.pdf · Introducci on I Desde la geometr a solar, pasando por la irradiacion efectiva

Sombras en un SFCR

0.90

0.92

0.94

0.96

0.98

1−FS

30 35 40 45 50

20

25

30

35

40

45

50

0.92 0.93 0.94 0.95

0.96

0.97

0.98

3 4

5

6

7

8

9

10

Lew

L ns

Page 18: Oscar Perpin~an Lamigueiro - Comunidad R Hispanor-es.org/3jornadasR/pdfs/2_perpinan_lamigueiro.pdf · Introducci on I Desde la geometr a solar, pasando por la irradiacion efectiva

Target Diagram

> data("prodEx")

> ndays = c(5, 10, 15, 20)

> palette = brewer.pal(n = length(ndays), name = "Set1")

> TDColor <- TargetDiagram(prodEx, end = day,

ndays = ndays,

color = palette)

Page 19: Oscar Perpin~an Lamigueiro - Comunidad R Hispanor-es.org/3jornadasR/pdfs/2_perpinan_lamigueiro.pdf · Introducci on I Desde la geometr a solar, pasando por la irradiacion efectiva

Target Diagram

σD ⋅ sign(σ*)

D

−0.2

−0.1

0.0

0.1

−0.15 −0.10 −0.05 0.00 0.05 0.10

1

2

3

4

5

67

8

9

10

11

12

13

14

15

16

1718

19

20

21

22

1

2

3

4

5

67

8

9

10

11

12

13

14

15

16

1718

19

20

21

22

1

2

3

4

5

67

8

9

10

11

1213

14

15

16

17

18

19

20

21

221

2

3

4

5

67

8

9

10

11

12

13

14

15

16

17

18

19

20

21

220.053 0.082 0.12ndays

5101520

Page 20: Oscar Perpin~an Lamigueiro - Comunidad R Hispanor-es.org/3jornadasR/pdfs/2_perpinan_lamigueiro.pdf · Introducci on I Desde la geometr a solar, pasando por la irradiacion efectiva

Bibliografıa I

[1] Jolliff, J.; Kindle, J. C.; Shulman, I.; Penta, B.;Friedrichs, M. A. M.; Helber, R. y Arnone, R. A.:Summary Diagrams for Coupled

Hydrodynamic-Ecosystem Model Skill Assessment .Journal of Marine Systems, 2009, 76, pp. 64–82.

[2] Perpinan, O.: Statistical Analysis of the Performanceand Simulation of a Two-Axis Tracking PV System . SolarEnergy, 2009, 83(11), pp. 2074–2085. ISSN 0038-092X.doi: 10.1016/j.solener.2009.08.008.

[3] ——: CMSAF, SIAR and R , 2011. Incluido en unProyecto de Fin de Master de la EOI.https://r-forge.r-project.org/scm/viewvc.php/

drafts/kriging.R?view=markup&root=solar

[4] ——: Energıa Solar Fotovoltaica, 2011.http://procomun.wordpress.com/libroesf

Page 21: Oscar Perpin~an Lamigueiro - Comunidad R Hispanor-es.org/3jornadasR/pdfs/2_perpinan_lamigueiro.pdf · Introducci on I Desde la geometr a solar, pasando por la irradiacion efectiva

Bibliografıa II

[5] Perpinan, O. y Lorenzo, E.: Analysis and Synthesis ofthe Variability of Irradiance and PV Power Time Serieswith the Wavelet Transform . Solar Energy, 2011, 85(1),pp. 188 – 197. ISSN 0038-092X. doi:DOI:10.1016/j.solener.2010.08.013.

[6] Sarkar, D.: Lattice: Multivariate Data Visualization withR. Springer, New York, 2008. ISBN 978-0-387-75968-5.http://lmdvr.r-forge.r-project.org

[7] Sarkar, D. y Andrews, F.: latticeExtra: Extra GraphicalUtilities Based on Lattice, 2010. R package version0.6-12/r148.http:

//R-Forge.R-project.org/projects/latticeextra/

[8] Taylor, K. E.: Summarizing Multiple Aspects of ModelPerformance in a Single Diagram . Informe tecnico, 2000.http://www-pcmdi.llnl.gov/publications/pdf/55.pdf

Page 22: Oscar Perpin~an Lamigueiro - Comunidad R Hispanor-es.org/3jornadasR/pdfs/2_perpinan_lamigueiro.pdf · Introducci on I Desde la geometr a solar, pasando por la irradiacion efectiva

Bibliografıa III

[9] Ummel, K.: SEXPOT: A Spatiotemporal LinearProgramming Model to Simulate Global Deployment ofRenewable Power Technologies. Tesina o Proyecto, CentralEuropean University, Budapest, 2011.http://dl.dropbox.com/u/14314000/ThesisMedia/

Kevin_Ummel_CEU_2011.pdf

[10] Zeileis, A. y Grothendieck, G.: zoo: S3 Infrastructurefor Regular and Irregular Time Series . Journal ofStatistical Software, 2005, 14(6), pp. 1–27.http://www.jstatsoft.org/v14/i06/