STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
feedtwin.comps.base Namespace Reference

Classes

class  InfeasibleOperatingPoint
class  FlowConditions
class  Violation
class  HydraulicComponent

Functions

None register_builder (str type_name, str model, Builder builder)
HydraulicComponent build_component (ComponentInstance instance)
list[tuple[str, str]] registered_builders ()

Variables

float R_UNIVERSAL = 8.31446261815324
 Builder = Callable[[ComponentInstance], HydraulicComponent]
dict _BUILDERS = {}

Detailed Description

What every hydraulic component is, and how one gets built.

Each component exposes its physics **twice**, and the split is deliberate.

``pressure_drop(mdot, flow)`` is the causal form: given a mass flow and the
fluid's state, what is the loss. Most liquid plumbing genuinely is this -- a
pipe's Δp is a function of ṁ -- and it is the form that can be checked against a
worked example in a book without a solver in the way. Every validation test in
this phase calls it.

``residuals(ctx)`` is the acausal form the network solver will consume, and it
is derived from the first for simple components. Components whose behaviour is
*not* a function -- a check valve with a discrete open state, a regulator whose
poppet has its own dynamics -- override it.

The protocol is still provisional (see :mod:`feedtwin.model.component`). Phase
04 assembles a real Jacobian against it and is expected to reshape it. Keeping
the physics in ``pressure_drop`` is what makes that cheap: when the solver
interface moves, this module's ``residuals`` adapters move and no correlation
is touched.

Function Documentation

◆ build_component()

HydraulicComponent feedtwin.comps.base.build_component ( ComponentInstance instance)
Build the physics for a configured component.

Raises:
    SpecError: no implementation is registered for that type and model --
        which is the honest failure when a schema declares a model that
        Phase 03 has not implemented yet.

Definition at line 393 of file base.py.

◆ register_builder()

None feedtwin.comps.base.register_builder ( str type_name,
str model,
Builder builder )
Register the physics for one (component type, fidelity model) pair.

Keyed on both because that pair is exactly what a fidelity model *is*: an
orifice evaluated with a fixed discharge coefficient and the same orifice
evaluated through ISO 5167 are different physics behind one declaration.

Definition at line 383 of file base.py.

◆ registered_builders()

list[tuple[str, str]] feedtwin.comps.base.registered_builders ( )

Definition at line 413 of file base.py.

Variable Documentation

◆ _BUILDERS

dict feedtwin.comps.base._BUILDERS = {}
protected

Definition at line 380 of file base.py.

◆ Builder

feedtwin.comps.base.Builder = Callable[[ComponentInstance], HydraulicComponent]

Definition at line 378 of file base.py.

◆ R_UNIVERSAL

float feedtwin.comps.base.R_UNIVERSAL = 8.31446261815324

Definition at line 32 of file base.py.