R/ZTTrainTiSpecificTurbineModel.R

#' Create a power curve for a specific Ti level using the zero turbulence method
#' 
#' \code{ZTTrainTiSpecificTurbineModel} calculates the site-specific power curve using the 
#' zero-turbulence method set out in the draft version of IEC 61400-12-1 (2013).
#' This should be the fourth (and final) stage in calculating a site-specific 
#' power curve using the zero-turbulence power curve methdology.
#' 
#' The input to this function is generated by 
#' \code{\link{ZTTrainFinalTurbineModel}}.
#' 
#' @param PC.param a set of parameters describing the power curve
#' @param ws observations of wind speed
#' @param Ti observations of turbulence intensity
#' @param power observations of power
#' @param rho
#' @param NewTi the new value of turbulence intensity
#' @return ZTTiSpecificTurbineModel site specific power curve
#' @export
#' 
#' @family zero-turbulence power curve methods
#'   

ZTTrainTiSpecificTurbineModel <- function(PC.param,
                                          ws,
                                          Ti,                                    
                                          power,
                                          rho = 1.225,
                                          newTi){
  # start by simulating the integral power for the time series of wind speed and
  # turbulence during power performance testing
  PsimIobs = SimPC(PC.param = PC.param, # PC.param contains power.rated.
                   ws = ws,
                   Ti = Ti,
                   rho = rho)
  
  # simulate the integral power for the test site time series, using the
  # turbulence at the target site. For data that are outside the range, we use the nearest extreme.  
  if (NROW(newTi) == 1){
    newTi = rep(newTi,NROW(ws))
  }
  PsimNewSite = SimPC(PC.param = PC.param,
                      ws = ws,
                      Ti = newTi,
                      rho = rho)
  
  # Now use the test site power data to "correct" the observed power.  
  PINewSite = power - PsimIobs + PsimNewSite  
  
  # finally bin the data to create a power curve for the target site, and return it
  return(ZTTiSpecificTurbineModel = PCTrainTurbineModel(ws = ws,                                            
                                                        power = PINewSite,
                                                        ws.max = max(ws)))    
}
AndyClifton/PowerPerformance documentation built on May 5, 2019, 6 a.m.