R/duty_factor_transformer_11_20kv.R

Defines functions duty_factor_transformer_11_20kv

Documented in duty_factor_transformer_11_20kv

#' @title Duty Factor for 6.6/11kV and 20kV Transformers
#' @description This function calculates the duty factor for 6.6/11kV and 20kV
#' transformers depending on the maximum percentage utilisation under normal
#' operating conditions.
#' The duty factor is used in the deriviation of the expected life of an asset.
#' See e.g. \code{\link{expected_life}()}. For more general information about
#' the derivation of the duty factor see section 6.6 on page 51 in CNAIM (2021)
#' @param utilisation_pct Numeric. The max percentage of utilisation
#' under normal operating conditions.
#' @param gb_ref_given optional parameter to use custom reference values
#' @return Numeric. Duty factor for 6.6/11kV or 20kV transformer.
#' @source DNO Common Network Asset Indices Methodology (CNAIM),
#' Health & Criticality - Version 2.1, 2021:
#' \url{https://www.ofgem.gov.uk/sites/default/files/docs/2021/04/dno_common_network_asset_indices_methodology_v2.1_final_01-04-2021.pdf}
#' @export
#' @examples
#' duty_factor_transformer_11_20kv(utilisation_pct = 95)

duty_factor_transformer_11_20kv <- function(utilisation_pct = "Default",
                                            gb_ref_given = NULL) {

  if(is.null(gb_ref_given)){
    gb_ref_taken <- gb_ref
  }else{
    check_gb_ref_given(gb_ref_given)
    gb_ref_taken <- gb_ref_given
  }

  duty_factor_table <- gb_ref_taken$duty_factor_lut_distrib_tf

  for (n in 1:nrow(duty_factor_table)){
    if (utilisation_pct == 'Default'){
      duty_factor <- duty_factor_table$`Duty Factor`[nrow(duty_factor_table)]
      break
    } else if (utilisation_pct > as.numeric(duty_factor_table$Lower[n]) &
        utilisation_pct <= as.numeric(duty_factor_table$Upper[n])){
      duty_factor <- duty_factor_table$`Duty Factor`[n]
      break
    }
  }

  return(duty_factor)
}
Utiligize/CNAIM documentation built on Sept. 10, 2022, 9:19 a.m.