The comp_valve submodule
Hydraulic valve component models.
This module provides valve-related resistance components used to model controllable pressure losses in hydraulic systems.
Main ideas:
valves are modeled as resistance components,
valve behavior is state-dependent (opening/position logic defined by each subclass),
loss is evaluated through valve-specific coefficients and converted to head.
Design conventions:
mounting direction is port 1 -> port 2,
runtime flow direction is represented by
sense,valve classes inherit from
Comp_Valveand specializecalcKand/or related helper methods,resulting head loss is returned through
calcHin the same unit conventions as other components.
Typical extension pattern:
Subclass
Comp_Valve.Define how
statemaps to hydraulic behavior.Implement
calcK(or equivalent) for that state.Reuse the base
calcHconversion pipeline.
Example:
valve = Comp_Valve(D=50)
valve.state = 1.0
H = valve.calcH(2.0 * u.m**3 / u.h, sense=1)
Valve subclasses in this module are intended to be combined with pumps, pipes, and fittings inside paths or full network solves.
- class fluidsolve.comp_valve.Comp_Valve(**kwargs: Any)[source]
Bases:
Comp_BaseGeneric valve base class.
State meaning is defined by subclasses.
- Parameters:
D (int | float | Quantity, optional) – Valve bore diameter (default in mm).
- _group: str = 'Resistance'
- _part: str = 'Valve'
- _prefix: str = 'V'
- _conn: dict = {1: [[1, 2]]}
- property state: float
Valve state.
- Returns:
State value.
- Return type:
int | float
- connections(state: Any | None = None) Any[source]
Return open port connections for the given valve state.
- Parameters:
state (Any, optional) – Valve state override. Uses current state when omitted.
- Returns:
List of open port-pair tuples.
- Return type:
Any
- calcK(Q: Quantity, sense: int, pin: int = 1, pout: int = 2) float[source]
Default valve behavior: open.
- class fluidsolve.comp_valve.Comp_Valve_NR(**kwargs: Any)[source]
Bases:
Comp_ValveNon-return (check) valve.
- Mounted flow direction:
port 1 -> port 2 = allowed flow
- _part: str = 'Valve_NR'
- class fluidsolve.comp_valve.Comp_Valve_01(**kwargs: Any)[source]
Bases:
Comp_ValveOn/off valve.
- state:
0.0 = closed 1.0 = fully open
- _part: str = 'Valve_01'
- class fluidsolve.comp_valve.Comp_Valve_Kv(**kwargs: Any)[source]
Bases:
Comp_ValveThrottling valve with equal percentage characteristic.
state: valve position (0.0 = closed, 1.0 = fully open) Kv at position s = Kvs * (R^s - 1) / (R - 1)
- _part: str = 'Valve_KV'
- property Kvs: float
Fully-open flow coefficient Kvs.
- Returns:
Kvs value (m³/h at 1 bar).
- Return type:
float
- property R: float
Valve rangeability (authority ratio).
- Returns:
R value (Kvs / Kvmin), default 3.0.
- Return type:
float
- class fluidsolve.comp_valve.Comp_Valve_3W(**kwargs: Any)[source]
Bases:
Comp_Valve3-way valve.
- Ports:
1 = common 2 = branch A 3 = branch B
- state:
1 -> connect 1-2 2 -> connect 1-3
- _part: str = 'Valve_3W'
- _nports: int = 3
- _ports: list = [[1, 2], [1, 3], [2, 3]]
- _conn: dict = {1: [[1, 2]], 2: [[1, 3]]}
- class fluidsolve.comp_valve.Comp_Valve_DS(**kwargs: Any)[source]
Bases:
Comp_ValveDouble seat valve.
- Ports:
state 1: 1-2 and 3-4 open state 2: 1-2 and 3-4 remain open, plus 1-3 opens
- _part: str = 'Valve_DS'
- _nports: int = 4
- _ports: list = [[1, 2], [1, 3], [3, 4]]
- _conn: dict = {1: [[1, 2], [3, 4]], 2: [[1, 2], [1, 3], [3, 4]]}