#' @title Resistance coefficients of all fittings attached to the control valve
#' @description The algebraic sum of all effective resistance coefficients of
#' all fittings attached to the control valve.
#' @param dn valve diameter (mm).
#' @param d1 downstream pipe diameter (mm).
#' @param d2 upstream pipe diameter (mm)
#' @return Resistance coefficient.
#' @export
resistance_coefficient <- function(dn, d1, d2){
reducer = 0.5 * ((1-(dn/d1)^2)^2)
diffuser = ((1-(dn/d2)^2)^2)
bernulli = (dn/d2)^4 - (dn/d1)^4
result = reducer + diffuser + bernulli
return(result)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.