STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
feedtwin.comps.elements.Valve Class Reference
Inheritance diagram for feedtwin.comps.elements.Valve:
[legend]
Collaboration diagram for feedtwin.comps.elements.Valve:
[legend]

Public Member Functions

float effective_cv (self, float position)
bool isolates (self, Mapping[str, float]|None signals=None)
float pressure_drop (self, float mdot, FlowConditions flow)
float|None flow_ceiling (self, FlowConditions flow)
bool is_choked (self, float dp_available, FlowConditions flow)
float|None choked_dp (self, FlowConditions flow)
dict[str, float] diagnostics (self, float mdot, FlowConditions flow)
Public Member Functions inherited from feedtwin.comps.base.HydraulicComponent
None __init__ (self, ComponentInstance instance)
str id (self)
str type (self)
float static_head (self, FlowConditions flow)
float total_dp (self, float mdot, FlowConditions flow)
float signal (self, FlowConditions flow, str name, float default=1.0)
float|None pinned_flow (self, float dp_available, FlowConditions flow)
list[Violation] check (self)
int n_residuals (self)
Sequence[float] residuals (self, EvalContext ctx)
Mapping[str, float] outputs (self, EvalContext ctx)
FlowConditions conditions (self, PortState port, Mapping[str, float] signals)
str __repr__ (self)

Protected Member Functions

GasCv|None _gas (self, FlowConditions flow)
tuple[float, float]|None _gas_choke (self, FlowConditions flow)
float|None _legacy_liquid_ceiling (self, FlowConditions flow)

Additional Inherited Members

Public Attributes inherited from feedtwin.comps.base.HydraulicComponent
 instance = instance
 p = instance.si_params()
 opt = dict(instance.options)
Static Public Attributes inherited from feedtwin.comps.base.HydraulicComponent
str inlet_port = "inlet"
str outlet_port = "outlet"
bool symmetric = False
 conditions_provider = None

Detailed Description

A valve sized by flow coefficient, with position and choking.

Loss comes from the Cv-to-K conversion in ``fluids``, which reproduces the
definition of Cv itself -- one US gallon per minute of water at one psi --
to better than 0.1%, independently of bore.

Position enters through the inherent characteristic. A closed valve keeps a
small ``leak_closed`` capacity: real seats leak, and a capacity of exactly
zero makes the network singular rather than shut.

Definition at line 550 of file elements.py.

Member Function Documentation

◆ _gas()

◆ _gas_choke()

tuple[float, float] | None feedtwin.comps.elements.Valve._gas_choke ( self,
FlowConditions flow )
protected
``(x_critical, F_gamma)`` for this fluid, or None if it is not a gas.

``x`` is IEC 60534's pressure-drop ratio ``dp/p1``; choking begins at
``F_gamma * xT``. ``F_gamma = gamma / 1.40`` carries the ideal-gas
specific-heat ratio relative to air, which is what makes helium (1.667)
choke at a different ratio from nitrogen (1.40).

Reimplemented in feedtwin.comps.relief.ReliefValve.

Definition at line 642 of file elements.py.

References p, and feedtwin.comps.base.HydraulicComponent.p.

Referenced by _legacy_liquid_ceiling(), and is_choked().

◆ _legacy_liquid_ceiling()

float | None feedtwin.comps.elements.Valve._legacy_liquid_ceiling ( self,
FlowConditions flow )
protected
The old calibrated "sonic" ceiling, on anything not priced as a gas.
Unchanged; see :data:`_CHOKE_COEFFICIENT` for why it stays for now.

Definition at line 673 of file elements.py.

References feedtwin.comps.elements._calibrate_choke(), _gas_choke(), effective_cv(), feedtwin.comps.base.FlowConditions.signal(), feedtwin.comps.base.HydraulicComponent.signal(), fsw::config::T7Channel.signal, and fsw::t7::FakeT7Device::Options.signal.

Referenced by flow_ceiling().

◆ choked_dp()

float | None feedtwin.comps.elements.Valve.choked_dp ( self,
FlowConditions flow )
Pressure drop at which the liquid flow chokes, per IEC 60534.

``None`` when the fluid state does not say -- no saturation pressure
given, which is the honest answer for an incompletely specified liquid.
A gas is handled by :meth:`flow_ceiling` instead.

Definition at line 697 of file elements.py.

References p, and feedtwin.comps.base.HydraulicComponent.p.

Referenced by diagnostics(), and is_choked().

◆ diagnostics()

dict[str, float] feedtwin.comps.elements.Valve.diagnostics ( self,
float mdot,
FlowConditions flow )
Derived quantities worth reporting: velocity, Reynolds number, K.

Never consumed by a solver. This is what a frame and a report show, and
what makes a result inspectable rather than just a number.

Reimplemented from feedtwin.comps.base.HydraulicComponent.

Reimplemented in feedtwin.comps.relief.ReliefValve.

Definition at line 714 of file elements.py.

References choked_dp(), effective_cv(), p, feedtwin.comps.base.HydraulicComponent.p, feedtwin.comps.base.HydraulicComponent.pressure_drop(), feedtwin.comps.base.FlowConditions.signal(), feedtwin.comps.base.HydraulicComponent.signal(), fsw::config::T7Channel.signal, and fsw::t7::FakeT7Device::Options.signal.

◆ effective_cv()

◆ flow_ceiling()

float | None feedtwin.comps.elements.Valve.flow_ceiling ( self,
FlowConditions flow )
Choked mass flow through the valve [kg/s], or None for a liquid.

IEC 60534-2-1 at the critical ratio ``x = F_gamma . xT``, where the
expansion factor is exactly ``2/3`` and the flow stops responding to
downstream pressure. A liquid should have no such ceiling, and still
has the old one (:func:`_legacy_liquid_ceiling`; deferred, R037).

Reimplemented from feedtwin.comps.base.HydraulicComponent.

Reimplemented in feedtwin.comps.relief.ReliefValve.

Definition at line 660 of file elements.py.

References _gas(), and _legacy_liquid_ceiling().

◆ is_choked()

bool feedtwin.comps.elements.Valve.is_choked ( self,
float dp_available,
FlowConditions flow )
Whether ``dp_available`` puts this component past its choking point.

Load-bearing for the solver, not just a report. A branch's usual
equation is ``(p_up - p_dn) - dp(mdot) = 0``, which presumes the drop
is a function of the flow. Past choking it is not: mass flow stops
depending on downstream pressure entirely, and the drop can be anything
at or above the critical value. The relation is no longer invertible
and Newton, asked to invert it anyway, runs away -- which is exactly
what a relief valve venting to atmosphere does to a naive solver.

When this returns true the solver writes ``mdot = flow_ceiling``
instead, and reports the branch as choked.

Reimplemented from feedtwin.comps.base.HydraulicComponent.

Definition at line 689 of file elements.py.

References _gas_choke(), and choked_dp().

◆ isolates()

bool feedtwin.comps.elements.Valve.isolates ( self,
Mapping[str, float] | None signals = None )
Commanded shut, so the branch is an open circuit this solve.

The threshold is on *travel*, not on the resulting Cv: a valve at 0.5%
open is shut as far as any stand is concerned, and leaving it in the
network buys a row Newton cannot move.

Reimplemented from feedtwin.comps.base.HydraulicComponent.

Reimplemented in feedtwin.comps.relief.ReliefValve.

Definition at line 589 of file elements.py.

◆ pressure_drop()

float feedtwin.comps.elements.Valve.pressure_drop ( self,
float mdot,
FlowConditions flow )
Flow-dependent pressure loss [Pa]. Always non-negative.

A *loss*: it opposes the flow, so it lowers the downstream pressure
whichever way the fluid is going. Reverse flow is each component's own
business -- symmetric for a pipe, very much not for a check valve.

Anything that does **not** depend on the direction of flow belongs in
:meth:`static_head`, not here. See that method for why the distinction
is load-bearing rather than tidy.

Reimplemented from feedtwin.comps.base.HydraulicComponent.

Reimplemented in feedtwin.comps.relief.ReliefValve.

Definition at line 603 of file elements.py.

References feedtwin.comps.elements._dynamic_head(), _gas(), effective_cv(), p, feedtwin.comps.base.HydraulicComponent.p, feedtwin.comps.base.FlowConditions.signal(), feedtwin.comps.base.HydraulicComponent.signal(), fsw::config::T7Channel.signal, and fsw::t7::FakeT7Device::Options.signal.


The documentation for this class was generated from the following file: