K_BUTTERFLY_VALVE
Overview
Calculate the loss coefficient (K) for a butterfly valve using the Crane method.
Excel Usage
=K_BUTTERFLY_VALVE(D, bfly_style)
D(float, required): Diameter of the pipe section the valve is mounted in [m]bfly_style(str, optional, default: “centric”): Valve style type
Returns (float): Loss coefficient K for the butterfly valve [-]
Examples
Example 1: Small centric butterfly valve
Inputs:
| D |
|---|
| 0.1 |
Excel formula:
=K_BUTTERFLY_VALVE(0.1)
Expected output:
| Result |
|---|
| 0.733 |
Example 2: Double offset butterfly valve
Inputs:
| D | bfly_style |
|---|---|
| 0.1 | double_offset |
Excel formula:
=K_BUTTERFLY_VALVE(0.1, "double_offset")
Expected output:
| Result |
|---|
| 1.2053 |
Example 3: Triple offset butterfly valve
Inputs:
| D | bfly_style |
|---|---|
| 0.1 | triple_offset |
Excel formula:
=K_BUTTERFLY_VALVE(0.1, "triple_offset")
Expected output:
| Result |
|---|
| 3.5509 |
Example 4: Large centric butterfly valve
Inputs:
| D |
|---|
| 0.5 |
Excel formula:
=K_BUTTERFLY_VALVE(0.5)
Expected output:
| Result |
|---|
| 0.2946 |
Python Code
import micropip
await micropip.install(["fluids"])
from fluids.fittings import K_butterfly_valve_Crane as fluids_k_butterfly_valve
def k_butterfly_valve(D, bfly_style='centric'):
"""
Calculate the loss coefficient (K) for a butterfly valve using the Crane method.
See: https://fluids.readthedocs.io/fluids.fittings.html#fluids.fittings.K_butterfly_valve_Crane
This example function is provided as-is without any representation of accuracy.
Args:
D (float): Diameter of the pipe section the valve is mounted in [m]
bfly_style (str, optional): Valve style type Valid options: Centric, Double Offset, Triple Offset. Default is 'centric'.
Returns:
float: Loss coefficient K for the butterfly valve [-]
"""
try:
D = float(D)
except (ValueError, TypeError):
return "Error: D must be a number."
if D <= 0:
return "Error: D must be positive."
style_map = {
'centric': 0,
'double_offset': 1,
'triple_offset': 2
}
style_int = style_map.get(bfly_style, 0)
try:
result = fluids_k_butterfly_valve(D=D, style=style_int)
return float(result)
except Exception as e:
return f"Error: {str(e)}"