K_SWING_CHECK_VALVE
Overview
Calculate the loss coefficient (K) for a swing check valve using the Crane method.
Excel Usage
=K_SWING_CHECK_VALVE(D, angled)
D(float, required): Diameter of the pipe attached to the valve [m]angled(bool, optional, default: true): If true, angled swing check valve (K is 2x straight)
Returns (float): Loss coefficient K for the swing check valve [-]
Examples
Example 1: Angled swing check valve
Inputs:
| D |
|---|
| 0.02 |
Excel formula:
=K_SWING_CHECK_VALVE(0.02)
Expected output:
| Result |
|---|
| 2.3974 |
Example 2: Straight swing check valve
Inputs:
| D | angled |
|---|---|
| 0.02 | false |
Excel formula:
=K_SWING_CHECK_VALVE(0.02, FALSE)
Expected output:
| Result |
|---|
| 1.1987 |
Example 3: Large angled swing check valve
Inputs:
| D |
|---|
| 0.1 |
Excel formula:
=K_SWING_CHECK_VALVE(0.1)
Expected output:
| Result |
|---|
| 1.6288 |
Example 4: Large straight swing check valve
Inputs:
| D | angled |
|---|---|
| 0.1 | false |
Excel formula:
=K_SWING_CHECK_VALVE(0.1, FALSE)
Expected output:
| Result |
|---|
| 0.8144 |
Python Code
import micropip
await micropip.install(["fluids"])
from fluids.fittings import K_swing_check_valve_Crane as fluids_k_swing_check
def k_swing_check_valve(D, angled=True):
"""
Calculate the loss coefficient (K) for a swing check valve using the Crane method.
See: https://fluids.readthedocs.io/fluids.fittings.html#fluids.fittings.K_swing_check_valve_Crane
This example function is provided as-is without any representation of accuracy.
Args:
D (float): Diameter of the pipe attached to the valve [m]
angled (bool, optional): If true, angled swing check valve (K is 2x straight) Default is True.
Returns:
float: Loss coefficient K for the swing check valve [-]
"""
try:
D = float(D)
except (ValueError, TypeError):
return "Error: D must be a number."
if D <= 0:
return "Error: D must be positive."
try:
result = fluids_k_swing_check(D=D, angled=angled)
return float(result)
except Exception as e:
return f"Error: {str(e)}"