#' Plot Flow coefficient Kv Value
#'
#' @param cyl_name Name of the control characteristic
#' @param b steepness
#' @param d upper value
#' @param e the effective dose
#' @param zvs Resistance Coefficient Zeta full open
#' @param dn dn diameter in millimeter (mm)
#' @import ggplot2 latex2exp glue hyd4gpv
#' @return ggplot graphic. Flow coefficient Kv Value
#' @export
#'
#' @examples
#' library(dplyr)
#' param <- cylinder_parameter("VAG") %>% filter(cyl_name == "E")
#' plot_kv(param$cyl_name, param$kv_b, param$kv_d, param$kv_e, param$zvs, dn =200)
#'
plot_kv <- function(cyl_name, b, d, e, zvs, dn){
x <- data.frame(x = 0:100)
kvs <- kv_value(dn, zvs)
y.max <- ceiling(kvs/1000)*1000 # Round kvs up to the nearest 50
Max.Kv <- format(kvs,digits = 2, nsmall = 0, big.mark = ',')
ggplot2::ggplot(data = x, mapping = aes(x = x)) +
stat_function( fun = function(x) {drm_LL3( x, b, d, e)*kvs}, size = 1, color = "blue") +
scale_x_continuous(breaks = seq(0, 100, 10)) +
scale_y_continuous(breaks = seq(0, y.max, ceiling(y.max/10))) +
labs( title = TeX(glue::glue("Flow Coefficient $K_v$ in (Cubic Meter/hour) for cilinder Typ <<cyl_name>>",
.open = "<<", .close = ">>")),
subtitle = latex2exp::TeX(glue::glue("For a DN-<<dn>> $mm$ with a $K_{v_{100\\%}}=$ <<Max.Kv>> $m^3/h$",
.open = "<<", .close = ">>")),
caption = "Dr.Trujillo",
x = "Opening degree (%)",
y = latex2exp::TeX('$k_{v} \\; (m^3/h)$')) +
theme_bw()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.