#' Calculation of the operations points data
#'
#' @param op_data table with the operations data p1, p2, flow
#' @param cylinder cylinder name
#' @param marke Brand
#' @param diameter valve diameter
#' @param masl meters above sea level
#' @param temperature temperature in Celsius
#' @import purrr
#' @return tibble table
#' @export
#' @examples
#' op_data <- tibble::tibble(p1 = c(2,3), p2 = c(1,1), flow = c(500, 750))
#' operation_points(op_data, "VAG", "E", 200)
#'
operation_points <- function(op_data, marke, cylinder, diameter, masl = 0, temperature = 20){
# https://www.r-bloggers.com/2019/08/no-visible-binding-for-global-variable/
cyl_name <- position <- p1 <- p2 <- flow <- zv <- sigma_value <- cav_regime <- NULL
cyl_data <- cylinder_parameter(marke) %>%
dplyr::filter(cyl_name == cylinder)
op_points <- op_data %>%
dplyr::filter(.data$p1>0 & .data$p2>0 & .data$flow>0 ) %>%
dplyr::mutate(kv = hyd4gpv::kv(.data$p1, .data$p2,
.data$flow, temperature),
kv_kvs = kv/hyd4gpv::kv_value(diameter, cyl_data$zvs),
velocity = hyd4gpv::velocity(.data$flow/3600, diameter/1000)) %>%
dplyr::filter(.data$kv_kvs <= 1) %>%
dplyr::mutate(sigma_value = hyd4gpv::sigma_1(.data$p1, .data$p2, masl, temperature)) %>%
dplyr::mutate(position = purrr::pmap_dbl(list(.data$kv_kvs, cyl_data$kv_b,
cyl_data$kv_d, cyl_data$kv_e),
~hyd4gpv::inv_LL3(..1, ..2, ..3, ..4))) %>%
dplyr::mutate(zv = hyd4gpv::zv_function(position, cyl_data$kv_b,
cyl_data$kv_d, cyl_data$kv_e,
cyl_data$zvs)) %>%
dplyr::mutate(cav_regime = hyd4gpv::cavtation_regime(position,
cyl_data$kv_b, cyl_data$kv_d,
cyl_data$kv_e, cyl_data$fls, sigma_value)) %>%
dplyr::select(p1, p2, flow, velocity, position, kv, zv, sigma_value, cav_regime)
return(op_points)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.