diff --git a/DESCRIPTION b/DESCRIPTION index 18a9d221efbee4b37e16a03c7d294e97a9445159..dfea00eacdfbaec8857e73d3a2bebc400bb21c1a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,8 @@ Package: CSIndicators Title: Sectorial Indicators for Climate Services from Sub-Seasonal Forecast to Decadal Predictions Version: 0.0.1 Authors@R: c( - person("Nuria", "Perez-Zanon", , "nuria.perez@bsc.es", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-8568-3071"))) + person("Núria", "Pérez-Zanón", , "nuria.perez@bsc.es", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-8568-3071")), + person("Llorenç", "Lledó", , "llorenc.lledo@bsc.es", role = "aut")) Description: The package contains the definition-based computation of the sectoral indicators for the Climate Service. Depends: R (>= 3.6.0) @@ -13,7 +14,11 @@ Imports: ClimProjDiags Suggests: testthat, - CSTools + CSTools, + knitr, + markdown, + rmarkdown +VignetteBuilder: knitr License: Apache License 2.0 URL: https://earth.bsc.es/gitlab/es/csindicators/ BugReports: https://earth.bsc.es/gitlab/es/csindicators/-/issues diff --git a/NAMESPACE b/NAMESPACE index 09b570971b6851d4262b72debe1af64a9c728ced..a4b53eb076983de92bee3940a7d4773696246ca5 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -11,6 +11,8 @@ export(CST_SelectPeriodOnData) export(CST_Threshold) export(CST_TotalSpellTimeExceedingThreshold) export(CST_TotalTimeExceedingThreshold) +export(CST_WindCapacityFactor) +export(CST_WindPowerDensity) export(PeriodAccumulation) export(PeriodMean) export(QThreshold) @@ -19,8 +21,12 @@ export(SelectPeriodOnDates) export(Threshold) export(TotalSpellTimeExceedingThreshold) export(TotalTimeExceedingThreshold) +export(WindCapacityFactor) +export(WindPowerDensity) import(multiApply) importFrom(ClimProjDiags,Subset) importFrom(s2dv,Reorder) +importFrom(stats,approxfun) importFrom(stats,ecdf) importFrom(stats,quantile) +importFrom(utils,read.delim) diff --git a/R/WindCapacityFactor.R b/R/WindCapacityFactor.R new file mode 100644 index 0000000000000000000000000000000000000000..2b60ae483cb96126cf55357ddd6132074f4e3203 --- /dev/null +++ b/R/WindCapacityFactor.R @@ -0,0 +1,68 @@ +#'Wind capacity factor on s2dv_cube objects +#' +#'@author Llorenç Lledó, \email{llledo@bsc.es} +#'@description Wind capacity factor computes the wind power generated by a specific wind turbine model under specific wind speed conditions, and expresses it as a fraction of the rated capacity (i.e. maximum power) of the turbine. +#'@description It is computed by means of a tabular power curve that relates wind speed to power output. The tabular values are interpolated with a linear piecewise approximating function to obtain a smooth power curve. Five different power curves that span different IEC classes can be selected (see below). +#'@references Lledó, Ll., Torralba, V., Soret, A., Ramon, J., & Doblas-Reyes, F. J. (2019). Seasonal forecasts of wind power generation. Renewable Energy, 143, 91–100. https://doi.org/10.1016/j.renene.2019.04.135 +#'@references International Standard IEC 61400-1 (third ed.) (2005) +#' +#'@param wind a s2dv_cube object with instantaneous wind speeds expressed in m/s. +#'@param IEC_class a string indicating the IEC wind class (see IEC 61400-1) of the turbine to be selected. Classes \code{'I'}, \code{'II'} and \code{'III'} are suitable for sites with an annual mean wind speed of 10, 8.5 and 7.5 m/s respectively. Classes \code{'I/II'} and \code{'II/III'} indicate intermediate turbines that fit both classes. More details of the five turbines and a plot of its power curves can be found in Lledó et al. (2019). +#'@return A s2dv_cube object containing the Wind Capacity Factor (unitless). +#' +#'@examples +#'wind <- array(rweibull(n = 100, shape = 2, scale = 6), c(member = 10, lat = 2, lon = 5)) +#'wind <- CSTools::s2dv_cube(data = wind, lat = c(40, 41), lon = 1:5, +#' Variable = list(varName = 'sfcWind', level = 'Surface'), +#' Datasets = 'synthetic', when = Sys.time(), +#' Dates = list(start = '1990-01-01 00:00:00', end = '1990-01-01 00:00:00'), +#' source_file = NA) +#'WCF <- CST_WindCapacityFactor(wind, IEC_class = "III") +#' +#'@export +CST_WindCapacityFactor <- function(wind, IEC_class = c("I", "I/II", "II", "II/III", "III")) { + if (!inherits(wind, 's2dv_cube')) { + stop("Parameter 'wind' must be of the class 's2dv_cube', ", + "as output by CSTools::CST_Load.") + } + wind$data <- WindCapacityFactor(wind$data, IEC_class = IEC_class) + if ('Variable' %in% names(wind)) { + if ('varName' %in% names(wind$Variable)) { + wind$Variable$varName <- 'WindCapacityFactor' + } + } + return(wind) +} +#'Wind capacity factor +#' +#'@author Llorenç Lledó, \email{llledo@bsc.es} +#'@description Wind capacity factor computes the wind power generated by a specific wind turbine model under specific wind speed conditions, and expresses it as a fraction of the rated capacity (i.e. maximum power) of the turbine. +#'@description It is computed by means of a tabular power curve that relates wind speed to power output. The tabular values are interpolated with a linear piecewise approximating function to obtain a smooth power curve. Five different power curves that span different IEC classes can be selected (see below). +#'@references Lledó, Ll., Torralba, V., Soret, A., Ramon, J., & Doblas-Reyes, F. J. (2019). Seasonal forecasts of wind power generation. Renewable Energy, 143, 91–100. https://doi.org/10.1016/j.renene.2019.04.135 +#'@references International Standard IEC 61400-1 (third ed.) (2005) +#' +#'@param wind a multidimensional array, vector or scalar with instantaneous wind speeds expressed in m/s. +#'@param IEC_class a string indicating the IEC wind class (see IEC 61400-1) of the turbine to be selected. Classes \code{'I'}, \code{'II'} and \code{'III'} are suitable for sites with an annual mean wind speed of 10, 8.5 and 7.5 m/s respectively. Classes \code{'I/II'} and \code{'II/III'} indicate intermediate turbines that fit both classes. More details of the five turbines and a plot of its power curves can be found in Lledó et al. (2019). +#'@return An array with the same dimensions as wind, containing the Wind Capacity Factor (unitless). +#' +#'@importFrom stats approxfun +#'@importFrom utils read.delim +#'@examples +#'wind <- rweibull(n = 100, shape = 2, scale = 6) +#'WCF <- WindCapacityFactor(wind, IEC_class = "III") +#' +#'@export +WindCapacityFactor <- function(wind, IEC_class = c("I", "I/II", "II", "II/III", "III")) { + IEC_class <- match.arg(IEC_class) + pc_files <- c( + "I" = "Enercon_E70_2.3MW.txt", + "I/II" = "Gamesa_G80_2.0MW.txt", + "II" = "Gamesa_G87_2.0MW.txt", + "II/III" = "Vestas_V100_2.0MW.txt", + "III" = "Vestas_V110_2.0MW.txt" + ) + pc_file <- system.file("power_curves", pc_files[IEC_class], package = "CSIndicators", mustWork = T) + pc <- read_pc(pc_file) + cf <- wind2CF(wind, pc) + return(cf) +} diff --git a/R/WindPowerDensity.R b/R/WindPowerDensity.R new file mode 100644 index 0000000000000000000000000000000000000000..a231e45eed15a0debac55c9a77f722015e06291d --- /dev/null +++ b/R/WindPowerDensity.R @@ -0,0 +1,52 @@ +#'Wind power density on s2dv_cube objects +#' +#'@author Llorenç Lledó, \email{llledo@bsc.es} +#'@description Wind Power Density computes the wind power that is available for extraction per square meter of swept area. +#'@description It is computed as 0.5*ro*wspd^3. As this function is non-linear, it will give inaccurate results if used with period means. +#' +#'@param wind a s2dv_cube object with instantaneous wind speeds expressed in m/s obtained from CST_Load or s2dv_cube functions from CSTools pacakge +#'@param ro a scalar, or alternatively a multidimensional array with the same dimensions as wind, with the air density expressed in kg/m^3. By default it takes the value 1.225, the standard density of air at 15ºC and 1013.25 hPa. +#'@return A s2dv_cube object containing Wind Power Density expressed in W/m^2. +#' +#'@examples +#'wind <- array(rweibull(n = 100, shape = 2, scale = 6), c(member = 10, lat = 2, lon = 5)) +#'wind <- CSTools::s2dv_cube(data = wind, lat = c(40, 41), lon = 1:5, +#' Variable = list(varName = 'sfcWind', level = 'Surface'), +#' Datasets = 'synthetic', when = Sys.time(), +#' Dates = list(start = '1990-01-01 00:00:00', end = '1990-01-01 00:00:00'), +#' source_file = NA) +#'WPD <- CST_WindPowerDensity(wind) +#' +#'@export +CST_WindPowerDensity <- function(wind, ro = 1.225) { + if (!inherits(wind, 's2dv_cube')) { + stop("Parameter 'wind' must be of the class 's2dv_cube', ", + "as output by CSTools::CST_Load.") + } + wind$data <- WindPowerDensity(wind$data, ro = ro) + if ('Variable' %in% names(wind)) { + if ('varName' %in% names(wind$Variable)) { + wind$Variable$varName <- 'WindPowerDensity' + } + } + return(wind) +} + +#'Wind power density on multidimensional array objects +#' +#'@author Llorenç Lledó, \email{llledo@bsc.es} +#'@description Wind Power Density computes the wind power that is available for extraction per square meter of swept area. +#'@description It is computed as 0.5*ro*wspd^3. As this function is non-linear, it will give inaccurate results if used with period means. +#' +#'@param wind a multidimensional array, vector or scalar with instantaneous wind speeds expressed in m/s. +#'@param ro a scalar, or alternatively a multidimensional array with the same dimensions as wind, with the air density expressed in kg/m^3. By default it takes the value 1.225, the standard density of air at 15ºC and 1013.25 hPa. +#'@return An array with the same dimensions as wind, containing Wind Power Density expressed in W/m^2. +#' +#'@examples +#'wind <- rweibull(n = 100, shape = 2, scale = 6) +#'WPD <- WindPowerDensity(wind) +#' +#'@export +WindPowerDensity <- function(wind, ro = 1.225) { + return(0.5 * ro * wind^3) +} diff --git a/R/zzz.R b/R/zzz.R index 33660aa50e7013f6219bfeccabe8053a6a61fbd7..35cd5a6b8f9deff819f5cea73a89e610f598fad9 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -23,3 +23,40 @@ } return(position) } + + +#======================= +# Read a powercurve file +# Create the approximation function +#======================= +read_pc <- function(file) { + pc <- list() + + # Read pc points + pc$points <- rbind(c(0, 0), read.delim(file, comment.char = "#")) + + # Create an approximating function + pc$fun <- approxfun(pc$points$WindSpeed, pc$points$Power, method = "linear", yleft = NA, yright = 0) + + # Get the rated power from the power values + pc$attr$RatedPower <- max(pc$points$Power) + + return(pc) +} + +#======================= +# Evaluate the linear piecewise approximation function with the wind speed inputs to get wind power +#======================= +wind2power <- function(wind, pc) +{ power <- pc$fun(wind) + return(power) +} + +#======================= +# Convert wind to power, and divide by rated power to obtain Capacity Factor values +#======================= +wind2CF <- function(wind, pc) +{ power <- wind2power(wind, pc) + CF <- power / pc$attr$RatedPower + return(CF) +} diff --git a/inst/power_curves/Enercon_E70_2.3MW.txt b/inst/power_curves/Enercon_E70_2.3MW.txt new file mode 100644 index 0000000000000000000000000000000000000000..da4be6196a51fbfa9e4186da472b02e7d8bd5ba6 --- /dev/null +++ b/inst/power_curves/Enercon_E70_2.3MW.txt @@ -0,0 +1,38 @@ +#--------------------------- +# TURBINE CHARACTERISTICS +#--------------------------- +# Name: Enercon_E70_2.3MW [string] +# Manufacturer: Enercon [string] +# Diameter: 71 m +# CutIn: 2 m/s +# CutOut: 25 m/s +# ReCutIn: unknown m/s +# RatedSpeed: 16 m/s +# RatedPower: 2310 kW +# IECClass: Ia [Ia/IIa/IIIa/S] +# Control: pitch [pitch/stall/active_stall/flaps] +# HubHeights: 57,64,74,85,98,113 m +# +#--------------------------- +# POWER CURVE +# Density: 1.225 kg/m^3 +#--------------------------- +WindSpeed Power +1.0 0 +2.0 2 +3.0 18 +4.0 56 +5.0 127 +6.0 240 +7.0 400 +8.0 626 +9.0 892 +10.0 1223 +11.0 1590 +12.0 1900 +13.0 2080 +14.0 2230 +15.0 2300 +16.0 2310 +25.0 2310 +25.5 0 diff --git a/inst/power_curves/Gamesa_G80_2.0MW.txt b/inst/power_curves/Gamesa_G80_2.0MW.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b3c0bf5abba461bb93f361fdb88f2c0891e4634 --- /dev/null +++ b/inst/power_curves/Gamesa_G80_2.0MW.txt @@ -0,0 +1,37 @@ +#--------------------------- +# TURBINE CHARACTERISTICS +#--------------------------- +# Name: Gamesa_G80_2.0MW [string] +# Manufacturer: Gamesa [string] +# Diameter: 80 m +# CutIn: 4 m/s +# CutOut: 25 m/s +# ReCutIn: unknown m/s +# RatedSpeed: 17 m/s +# RatedPower: 2000 kW +# IECClass: Ia/IIa [Ia/IIa/IIIa/S] +# Control: pitch [pitch/stall/active_stall/flaps] +# HubHeights: 60,67,78,100 m +# +#--------------------------- +# POWER CURVE +# Density: 1.225 kg/m^3 +#--------------------------- +WindSpeed Power +3.0 0 +4.0 66 +5.0 152 +6.0 280 +7.0 457 +8.0 690 +9.0 978 +10.0 1296 +11.0 1598 +12.0 1818 +13.0 1935 +14.0 1980 +15.0 1995 +16.0 1999 +17.0 2000 +25.0 2000 +25.5 0 diff --git a/inst/power_curves/Gamesa_G87_2.0MW.txt b/inst/power_curves/Gamesa_G87_2.0MW.txt new file mode 100644 index 0000000000000000000000000000000000000000..eefee507096bb06b101ad99b2d11136117854d11 --- /dev/null +++ b/inst/power_curves/Gamesa_G87_2.0MW.txt @@ -0,0 +1,36 @@ +#--------------------------- +# TURBINE CHARACTERISTICS +#--------------------------- +# Name: Gamesa_G87_2.0MW [string] +# Manufacturer: Gamesa [string] +# Diameter: 87 m +# CutIn: 4 m/s +# CutOut: 25 m/s +# ReCutIn: unknown m/s +# RatedSpeed: 16 m/s +# RatedPower: 2000 kW +# IECClass: IIa [Ia/IIa/IIIa/S] +# Control: pitch [pitch/stall/active_stall/flaps] +# HubHeights: 67,78,90,100 m +# +#--------------------------- +# POWER CURVE +# Density: 1.225 kg/m^3 +#--------------------------- +WindSpeed Power +3.0 0 +4.0 79 +5.0 181 +6.0 335 +7.0 550 +8.0 832 +9.0 1175 +10.0 1530 +11.0 1816 +12.0 1963 +13.0 1988 +14.0 1996 +15.0 1999 +16.0 2000 +25.0 2000 +25.5 0 diff --git a/inst/power_curves/Vestas_V100_2.0MW.txt b/inst/power_curves/Vestas_V100_2.0MW.txt new file mode 100644 index 0000000000000000000000000000000000000000..462aeaaaa00c7fc98b810d5a9bf9f04768bded05 --- /dev/null +++ b/inst/power_curves/Vestas_V100_2.0MW.txt @@ -0,0 +1,42 @@ +#--------------------------- +# TURBINE CHARACTERISTICS +#--------------------------- +# Name: Vestas_V100_2.0MW [string] +# Manufacturer: Vestas [string] +# Diameter: 100 m +# CutIn: 3 m/s +# CutOut: 20 m/s +# ReCutIn: 18 m/s +# RatedSpeed: 12 m/s +# RatedPower: 2000 kW +# IECClass: IIa/IIIa [Ia/IIa/IIIa/S] +# Control: pitch [pitch/stall/active_stall/flaps] +# +#--------------------------- +# POWER CURVE +# Density: 1.225 kg/m^3 +# noise_mode: 0 +#--------------------------- +WindSpeed Power +2.5 0 +3 13 +3.5 51 +4 107 +4.5 175 +5 253 +5.5 346 +6 454 +6.5 584 +7 738 +7.5 912 +8 1109 +8.5 1321 +9 1538 +9.5 1734 +10 1873 +10.5 1951 +11 1984 +11.5 1995 +12 2000 +20 2000 +20.5 0 diff --git a/inst/power_curves/Vestas_V110_2.0MW.txt b/inst/power_curves/Vestas_V110_2.0MW.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e7657cdc43daa17d4fa4e5b4d301b2e474291bb --- /dev/null +++ b/inst/power_curves/Vestas_V110_2.0MW.txt @@ -0,0 +1,41 @@ +#--------------------------- +# TURBINE CHARACTERISTICS +#--------------------------- +# Name: Vestas_V110_2.0MW [string] +# Manufacturer: Vestas [string] +# Diameter: 110 m +# CutIn: 3 m/s +# CutOut: 20 m/s +# ReCutIn: unknown m/s +# RatedSpeed: 11.5 m/s +# RatedPower: 2000 kW +# IECClass: IIIa [Ia/IIa/IIIa/S] +# Control: pitch [pitch/stall/active_stall/flaps] +# HubHeights: 80,95,125 m +# +#--------------------------- +# POWER CURVE +# Density: 1.225 kg/m^3 +#--------------------------- +WindSpeed Power +2.5 0 +3.0 23 +3.5 80 +4.0 140 +4.5 223 +5.0 314 +5.5 422 +6.0 549 +6.5 703 +7.0 900 +7.5 1123 +8.0 1347 +8.5 1555 +9.0 1775 +9.5 1907 +10.0 1972 +10.5 1997 +11.0 1999 +11.5 2000 +20.0 2000 +20.5 0 diff --git a/man/CST_WindCapacityFactor.Rd b/man/CST_WindCapacityFactor.Rd new file mode 100644 index 0000000000000000000000000000000000000000..0c75557b9491379589791e60c32907fa17cdd915 --- /dev/null +++ b/man/CST_WindCapacityFactor.Rd @@ -0,0 +1,39 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/WindCapacityFactor.R +\name{CST_WindCapacityFactor} +\alias{CST_WindCapacityFactor} +\title{Wind capacity factor on s2dv_cube objects} +\usage{ +CST_WindCapacityFactor(wind, IEC_class = c("I", "I/II", "II", "II/III", "III")) +} +\arguments{ +\item{wind}{a s2dv_cube object with instantaneous wind speeds expressed in m/s.} + +\item{IEC_class}{a string indicating the IEC wind class (see IEC 61400-1) of the turbine to be selected. Classes \code{'I'}, \code{'II'} and \code{'III'} are suitable for sites with an annual mean wind speed of 10, 8.5 and 7.5 m/s respectively. Classes \code{'I/II'} and \code{'II/III'} indicate intermediate turbines that fit both classes. More details of the five turbines and a plot of its power curves can be found in Lledó et al. (2019).} +} +\value{ +A s2dv_cube object containing the Wind Capacity Factor (unitless). +} +\description{ +Wind capacity factor computes the wind power generated by a specific wind turbine model under specific wind speed conditions, and expresses it as a fraction of the rated capacity (i.e. maximum power) of the turbine. + +It is computed by means of a tabular power curve that relates wind speed to power output. The tabular values are interpolated with a linear piecewise approximating function to obtain a smooth power curve. Five different power curves that span different IEC classes can be selected (see below). +} +\examples{ +wind <- array(rweibull(n = 100, shape = 2, scale = 6), c(member = 10, lat = 2, lon = 5)) +wind <- CSTools::s2dv_cube(data = wind, lat = c(40, 41), lon = 1:5, + Variable = list(varName = 'sfcWind', level = 'Surface'), + Datasets = 'synthetic', when = Sys.time(), + Dates = list(start = '1990-01-01 00:00:00', end = '1990-01-01 00:00:00'), + source_file = NA) +WCF <- CST_WindCapacityFactor(wind, IEC_class = "III") + +} +\references{ +Lledó, Ll., Torralba, V., Soret, A., Ramon, J., & Doblas-Reyes, F. J. (2019). Seasonal forecasts of wind power generation. Renewable Energy, 143, 91–100. https://doi.org/10.1016/j.renene.2019.04.135 + +International Standard IEC 61400-1 (third ed.) (2005) +} +\author{ +Llorenç Lledó, \email{llledo@bsc.es} +} diff --git a/man/CST_WindPowerDensity.Rd b/man/CST_WindPowerDensity.Rd new file mode 100644 index 0000000000000000000000000000000000000000..a0d552c25ebde4910a91654b951999761cf628d1 --- /dev/null +++ b/man/CST_WindPowerDensity.Rd @@ -0,0 +1,34 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/WindPowerDensity.R +\name{CST_WindPowerDensity} +\alias{CST_WindPowerDensity} +\title{Wind power density on s2dv_cube objects} +\usage{ +CST_WindPowerDensity(wind, ro = 1.225) +} +\arguments{ +\item{wind}{a s2dv_cube object with instantaneous wind speeds expressed in m/s obtained from CST_Load or s2dv_cube functions from CSTools pacakge} + +\item{ro}{a scalar, or alternatively a multidimensional array with the same dimensions as wind, with the air density expressed in kg/m^3. By default it takes the value 1.225, the standard density of air at 15ºC and 1013.25 hPa.} +} +\value{ +A s2dv_cube object containing Wind Power Density expressed in W/m^2. +} +\description{ +Wind Power Density computes the wind power that is available for extraction per square meter of swept area. + +It is computed as 0.5*ro*wspd^3. As this function is non-linear, it will give inaccurate results if used with period means. +} +\examples{ +wind <- array(rweibull(n = 100, shape = 2, scale = 6), c(member = 10, lat = 2, lon = 5)) +wind <- CSTools::s2dv_cube(data = wind, lat = c(40, 41), lon = 1:5, + Variable = list(varName = 'sfcWind', level = 'Surface'), + Datasets = 'synthetic', when = Sys.time(), + Dates = list(start = '1990-01-01 00:00:00', end = '1990-01-01 00:00:00'), + source_file = NA) +WPD <- CST_WindPowerDensity(wind) + +} +\author{ +Llorenç Lledó, \email{llledo@bsc.es} +} diff --git a/man/WindCapacityFactor.Rd b/man/WindCapacityFactor.Rd new file mode 100644 index 0000000000000000000000000000000000000000..789a9016b5ff5378d698298cfd4d522ec9c4a722 --- /dev/null +++ b/man/WindCapacityFactor.Rd @@ -0,0 +1,34 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/WindCapacityFactor.R +\name{WindCapacityFactor} +\alias{WindCapacityFactor} +\title{Wind capacity factor} +\usage{ +WindCapacityFactor(wind, IEC_class = c("I", "I/II", "II", "II/III", "III")) +} +\arguments{ +\item{wind}{a multidimensional array, vector or scalar with instantaneous wind speeds expressed in m/s.} + +\item{IEC_class}{a string indicating the IEC wind class (see IEC 61400-1) of the turbine to be selected. Classes \code{'I'}, \code{'II'} and \code{'III'} are suitable for sites with an annual mean wind speed of 10, 8.5 and 7.5 m/s respectively. Classes \code{'I/II'} and \code{'II/III'} indicate intermediate turbines that fit both classes. More details of the five turbines and a plot of its power curves can be found in Lledó et al. (2019).} +} +\value{ +An array with the same dimensions as wind, containing the Wind Capacity Factor (unitless). +} +\description{ +Wind capacity factor computes the wind power generated by a specific wind turbine model under specific wind speed conditions, and expresses it as a fraction of the rated capacity (i.e. maximum power) of the turbine. + +It is computed by means of a tabular power curve that relates wind speed to power output. The tabular values are interpolated with a linear piecewise approximating function to obtain a smooth power curve. Five different power curves that span different IEC classes can be selected (see below). +} +\examples{ +wind <- rweibull(n = 100, shape = 2, scale = 6) +WCF <- WindCapacityFactor(wind, IEC_class = "III") + +} +\references{ +Lledó, Ll., Torralba, V., Soret, A., Ramon, J., & Doblas-Reyes, F. J. (2019). Seasonal forecasts of wind power generation. Renewable Energy, 143, 91–100. https://doi.org/10.1016/j.renene.2019.04.135 + +International Standard IEC 61400-1 (third ed.) (2005) +} +\author{ +Llorenç Lledó, \email{llledo@bsc.es} +} diff --git a/man/WindPowerDensity.Rd b/man/WindPowerDensity.Rd new file mode 100644 index 0000000000000000000000000000000000000000..b0dfd775c0d60cf341045d1efa819321c4a26807 --- /dev/null +++ b/man/WindPowerDensity.Rd @@ -0,0 +1,29 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/WindPowerDensity.R +\name{WindPowerDensity} +\alias{WindPowerDensity} +\title{Wind power density on multidimensional array objects} +\usage{ +WindPowerDensity(wind, ro = 1.225) +} +\arguments{ +\item{wind}{a multidimensional array, vector or scalar with instantaneous wind speeds expressed in m/s.} + +\item{ro}{a scalar, or alternatively a multidimensional array with the same dimensions as wind, with the air density expressed in kg/m^3. By default it takes the value 1.225, the standard density of air at 15ºC and 1013.25 hPa.} +} +\value{ +An array with the same dimensions as wind, containing Wind Power Density expressed in W/m^2. +} +\description{ +Wind Power Density computes the wind power that is available for extraction per square meter of swept area. + +It is computed as 0.5*ro*wspd^3. As this function is non-linear, it will give inaccurate results if used with period means. +} +\examples{ +wind <- rweibull(n = 100, shape = 2, scale = 6) +WPD <- WindPowerDensity(wind) + +} +\author{ +Llorenç Lledó, \email{llledo@bsc.es} +} diff --git a/vignettes/EnergyIndicators.Rmd b/vignettes/EnergyIndicators.Rmd new file mode 100644 index 0000000000000000000000000000000000000000..1209c2d82242f7e8c2bcf833fa87b740b5a3a4a7 --- /dev/null +++ b/vignettes/EnergyIndicators.Rmd @@ -0,0 +1,83 @@ +--- +title: "Energy Indicators" +author: "Llorenç Lledó, Earth Sciences department, Barcelona Supercomputing Center (BSC)" +date: "`r Sys.Date()`" +output: rmarkdown::html_vignette +vignette: > + %\VignetteEngine{knitr::knitr} + %\VignetteIndexEntry{Energy Indicators} + %\usepackage[utf8]{inputenc} +--- + +Energy Indicators +----------------------- + +## Introduction + +The energy sector is affected by the atmospheric ciruclation in many ways. On the one hand energy supply from renewable sources like wind, solar or hydropower relies on availability of wind, sunshine or water. On the other hand, energy demand is affected by changes in near-surface temperature. A number of indicators derived from atmospheric variables can be useful as proxies of energy production/demand. + +Currently, this package provides two indicators for wind power generation: + +--- +1. **WindPowerDensity -** Wind power that is available for extraction from the wind flow, per square meter of swept area. +2. **WindCapacityFactor -** Wind power generation of a wind turbine, normalized by the maximum power that the turbine can deliver (rated capacity). +--- + +### 1. Wind Power Density + +`WindPowerDensity` computes the kinetic energy that is available in the wind flow that traverses a unit of area swept by a wind turbine. For an instantaneous wind speed value, it is computed as: `WPD = 0.5 * ro * wspd^3` where `ro` is the air density in Kg/m^3 and `wspd` is the instantaneous wind speed at hub height in m/s. +Although wind turbines cannot extract all of the kinetic energy in the wind, and their efficiency can vary substantially at different wind speeds and among different wind turbines, this indicator provides a simple estimation of the wind resource quality. Typically, Wind Power Density is computed over a long period and its mean value is reported. + +As an example, we simulate a time series of 1000 wind speed values from a Weibull distribution with scale factor of 6 and a shape factor of 2, which represent a sample of wind speed values obtained at a single location. The Weibull distribution is often assumed to fit observed wind speed values to a probability distribution function. Then, each instantaneous wind speed value is converted to its equivalent WPD. +The `mean` and `sd` of the WPD can be employed to summarize the wind resource in that location. Otherwise, we can plot the histograms to see the full distribution of values: + +```{r} +library(CSIndicators) +wind <- rweibull(n = 1000, shape = 2, scale = 6) +WPD <- WindPowerDensity(wind) +mean(WPD) +sd(WPD) +par(mfrow=c(1, 2)) +hist(wind, breaks = seq(0, 20)) +hist(WPD, breaks = seq(0, 4000, 200)) +``` + + +As you can see the histogram of the WPD is highly skewed, even if the wind speed was only a little skewed! + +If not specified, an air density of 1.225 kg/m^3 is assumed. Otherwise, the parameter `ro` can be set to a fixed value (for instance the mean air density at the site elevation could be used), or a timeseries of density values measured at each time stamp can be used to obtain more accurate results. + +```{r} +WPD <- WindPowerDensity(wind, ro = 1.15) +``` + +### 2. Wind Capacity Factor +`WindCapacityFactor` transforms wind speed values into normalized wind power values. The transformation is made employing manufacturer-provided power curves, for five different turbines, as described in Lledó et al. (2019). +The generation is normalized by the rated power of the turbine (i.e. the maximum power output it can achieve). This allows for comparisons between turbines of different sizes and wind farms of different installed capacities. Beware that the Capacity Factor (CF) values provided do not take into account any losses due to wakes, electricity transport, blade degradation, curtailments or maintenance shutdowns. + +The function allows to choose from five different power curves that are suited for a different range of wind speed conditions. Each of the provided turbines is a representative of a IEC wind class. Generally speaking, commercially available wind turbines can be certified as IEC class I, II, III or a combination of them (I/II and II/III), according to their efficency at different wind speeds and the loads they can withstand. The basic idea is that most turbines in a same IEC class have similar power curves, and the differences of power output can be thoroughly studied with only this set of five turbines. + +Notice that power curves are intended to be used with 10-minutal steady wind speed values at hub height, which in modern wind turbines varies between 80 and 120m typically. As the transformation of wind speed into wind power is non-linear, it is recomended to use instantaneous or 10-minutal wind speed values as input. Employing longer period means will produce inaccurate results, as far as the wind is not steady during that period. + +Following on the previous example, we will compute now the CF that would be obtained from our sample of 1000 wind speed values when using a turbine of class IEC I, and compare it to the CF values for a class III: + +```{r} +WCFI <- WindCapacityFactor(wind, IEC_class = "I") +WCFIII <- WindCapacityFactor(wind, IEC_class = "III") +par(mfrow=c(1, 3)) +hist(wind, breaks = seq(0, 20)) +hist(WCFI, breaks = seq(0, 1, 0.05), ylim = c(0, 500)) +hist(WCFIII, breaks = seq(0, 1, 0.05), ylim = c(0, 500)) +``` + + + +From the CF histograms we can see that, for this particular wind speed distribution, the IEC I turbine (designed for high winds) producess less energy than the IEC III turbine, which is more suitable for this range of wind speed values. + +### References +* Lledó, Ll., Torralba, V., Soret, A., Ramon, J., & Doblas-Reyes, F.J. (2019). Seasonal forecasts of wind power generation. Renewable Energy, 143, 91–100. https://doi.org/10.1016/j.renene.2019.04.135 + +* International Standard IEC 61400-1 (third ed.) (2005) + + + diff --git a/vignettes/figures/WCF_histogram.png b/vignettes/figures/WCF_histogram.png new file mode 100644 index 0000000000000000000000000000000000000000..493f2256b3342322aaf1680e38732f9a88fc1962 Binary files /dev/null and b/vignettes/figures/WCF_histogram.png differ diff --git a/vignettes/figures/WPD_histogram.png b/vignettes/figures/WPD_histogram.png new file mode 100644 index 0000000000000000000000000000000000000000..870aa7419bec3eccfad89b83a0a87f69255f5c29 Binary files /dev/null and b/vignettes/figures/WPD_histogram.png differ