R/cavtation_index.R

Defines functions cavtation_index

Documented in cavtation_index

#' Cavitation Index (Regime)
#'
#' @param x valve position
#' @param b steepness
#' @param d upper value
#' @param e the effective dose
#' @param fls liquid pressure recovery full open (max between fl and Flp/Fp)
#' @param sigma_value cavitation index (Reference downstream pressure P2)
#'
#' @return index 0 = free; 1 <- incipient; 2 <- constant; 3 <- maximum
#' @export
#'
cavtation_index <- function(x, b, d, e, fls, sigma_value) {
  limit_1 <- sigma_i(x, b, d, e, fls)
  limit_2 <- sigma_c(x, b, d, e, fls)
  limit_3 <- sigma_mv(x, b, d, e, fls)

  index <- dplyr::case_when(
    sigma_value > limit_1 ~ 1,
    sigma_value < limit_1 & sigma_value > limit_2 ~ 2,
    sigma_value < limit_2 & sigma_value > limit_3 ~ 3,
    sigma_value < limit_3 ~ 4
  )

  return(index)
}
ratral/hyd4gpv documentation built on Feb. 5, 2022, 10:30 p.m.