K_BALL_VALVE
Overview
Calculate the loss coefficient (K) for a ball valve using the Crane method.
Excel Usage
=K_BALL_VALVE(D_valve, D_pipe, angle)
D_valve(float, required): Diameter of the valve seat bore [m]D_pipe(float, required): Diameter of the pipe attached to the valve [m]angle(float, required): Angle formed by the reducer in the valve [degrees]
Returns (float): Loss coefficient K for the ball valve [-]
Examples
Example 1: Reduced port ball valve at 50 degrees
Inputs:
| D_valve | D_pipe | angle |
|---|---|---|
| 0.01 | 0.02 | 50 |
Excel formula:
=K_BALL_VALVE(0.01, 0.02, 50)
Expected output:
| Result |
|---|
| 14.0513 |
Example 2: Full bore ball valve
Inputs:
| D_valve | D_pipe | angle |
|---|---|---|
| 0.05 | 0.05 | 0 |
Excel formula:
=K_BALL_VALVE(0.05, 0.05, 0)
Expected output:
| Result |
|---|
| 0.0572 |
Example 3: Small angle ball valve
Inputs:
| D_valve | D_pipe | angle |
|---|---|---|
| 0.04 | 0.05 | 20 |
Excel formula:
=K_BALL_VALVE(0.04, 0.05, 20)
Expected output:
| Result |
|---|
| 0.4046 |
Example 4: Steep angle ball valve (60 degrees)
Inputs:
| D_valve | D_pipe | angle |
|---|---|---|
| 0.03 | 0.05 | 60 |
Excel formula:
=K_BALL_VALVE(0.03, 0.05, 60)
Expected output:
| Result |
|---|
| 5.3478 |
Python Code
import micropip
await micropip.install(["fluids"])
from fluids.fittings import K_ball_valve_Crane as fluids_k_ball_valve
def k_ball_valve(D_valve, D_pipe, angle):
"""
Calculate the loss coefficient (K) for a ball valve using the Crane method.
See: https://fluids.readthedocs.io/fluids.fittings.html#fluids.fittings.K_ball_valve_Crane
This example function is provided as-is without any representation of accuracy.
Args:
D_valve (float): Diameter of the valve seat bore [m]
D_pipe (float): Diameter of the pipe attached to the valve [m]
angle (float): Angle formed by the reducer in the valve [degrees]
Returns:
float: Loss coefficient K for the ball valve [-]
"""
try:
D1 = float(D_valve)
D2 = float(D_pipe)
angle = float(angle)
except (ValueError, TypeError):
return "Error: D_valve, D_pipe, and angle must be numbers."
if D1 <= 0 or D2 <= 0:
return "Error: Diameters must be positive."
if D1 > D2:
return "Error: D_valve must be <= D_pipe."
if angle < 0:
return "Error: Angle must be non-negative."
try:
result = fluids_k_ball_valve(D1=D1, D2=D2, angle=angle)
return float(result)
except Exception as e:
return f"Error: {str(e)}"