STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
engine.layerx.diag.ladder Namespace Reference

Functions

np.ndarray arr (Optional[Iterable[Any]] values, Optional[int] n=None)
List[Optional[float]] out (Iterable[float] values, Optional[int] digits=None)
Optional[float] scalar (Any v)
Dict[str, Any] unavailable (str error)
Dict[str, Any] inp (Any value, str unit, str provenance)
Dict[str, Any] model_block (str name, str source, Sequence[str] assumptions, Mapping[str, Dict[str, Any]] inputs)
np.ndarray series_t (Mapping[str, Any] result)
np.ndarray firing_mask (Mapping[str, Any] result, int n)
Mapping[str, Any] network_of (Mapping[str, Any] result)
np.ndarray node_p (Mapping[str, Any] net, str node, int n)
np.ndarray node_T (Mapping[str, Any] net, str node, int n)
np.ndarray branch_dp (Mapping[str, Any] net, str bid, int n)
Dict[str, Any] _element (str eid, str label, str kind, np.ndarray dp, str frm, str to)
List[Dict[str, Any]] side_elements (Mapping[str, Any] net, str side, int n, Optional[Mapping[str, Any]] series_side=None)
Dict[str, Any] build_ladder (Mapping[str, Any] result, Any prep=None, Any config=None)
List[Dict[str, Any]] element_series (Mapping[str, Any] ladder, str side, str kind)

Variables

float PSI = 6894.757293168361
tuple SIDES = ("ox", "fuel")
dict SIDE_ROLE = {"ox": "oxidiser", "fuel": "fuel"}
dict SIDE_CONFIG = {"ox": "oxidizer", "fuel": "fuel"}
int SUM_TOLERANCE_PSI = 1e-6

Detailed Description

The pressure ladder: bottle to chamber, element by element, per side, at every twin step.

``build_ladder(result, prep=None, config=None)`` reads ``result["network"]`` (DATA-CONTRACT 2) and
returns ``diagnostics.ladder`` (DATA-CONTRACT 3). It is bookkeeping, not a model: every drop is a
difference of the twin's own node pressures, so the elements of one side telescope to the
end-to-end drop by construction. The sum check is still made, on the branches' recorded
``dp_psi`` against the end nodes, because a recorder that writes a component's own loss (static
head left out, say) would break that identity and the ladder should say so rather than hide it.

Conventions (AUDIT 9.6 B1-B4):

* Node pressures only. ``series.copv_psia`` and ``series.*.tank_psia`` are post-step vessel
  states; the network's nodes are the solve's boundaries (1645.6 against 1651.4 psia at burnout
  on the bottle). Mixing the two in one ladder leaves a residual that is not a loss (AUDIT 5.5).
* Liquid-line nodes carry **total** pressure (lumped K, Borda dump at the manifold), so a
  wall-mounted PT reads about one dynamic head lower than the node.
* The tank is its own element: ullage node -> outlet node is the liquid head (a gain, negative).
* The engine card's injector branch (line exit -> chamber) is split, where the series carry the
  split, into the Borda dump at the manifold entrance and the orifice drop (manifold -> chamber).

The helpers at the top (``PSI``, ``arr``, ``out``, ``unavailable``, ``model_block``, ``inp``) are
shared by the other ``engine.layerx.diag`` modules of this set.

Function Documentation

◆ _element()

Dict[str, Any] engine.layerx.diag.ladder._element ( str eid,
str label,
str kind,
np.ndarray dp,
str frm,
str to )
protected

Definition at line 157 of file ladder.py.

Referenced by side_elements().

◆ arr()

np.ndarray engine.layerx.diag.ladder.arr ( Optional[Iterable[Any]] values,
Optional[int] n = None )
A float array with NaN where the input has None (JSON null) or a non-number.

Definition at line 51 of file ladder.py.

Referenced by branch_dp(), node_p(), node_T(), series_t(), and side_elements().

◆ branch_dp()

np.ndarray engine.layerx.diag.ladder.branch_dp ( Mapping[str, Any] net,
str bid,
int n )
A branch's own drop [psi]: the recorded ``dp_psi``, else from/to node pressures.

Definition at line 147 of file ladder.py.

References arr(), and node_p().

Referenced by side_elements().

◆ build_ladder()

Dict[str, Any] engine.layerx.diag.ladder.build_ladder ( Mapping[str, Any] result,
Any prep = None,
Any config = None )
``diagnostics.ladder`` from ``result["network"]``. Never raises.

Per side: ``elements`` [{id, label, kind, from, to, dp_psi, share}], ``total_psi`` (first node of
the path minus its last), ``sum_psi`` (the elements added up), ``residual_psi`` and
``max_abs_residual_psi`` (sum minus total) and ``closes`` (the residual within
``SUM_TOLERANCE_PSI``). ``share`` is each drop over ``total_psi`` (null where the total is 0).
``prep`` and ``config`` are not needed; they are accepted for a uniform signature.

Definition at line 216 of file ladder.py.

References network_of(), node_p(), out(), scalar(), series_t(), side_elements(), and unavailable().

◆ element_series()

List[Dict[str, Any]] engine.layerx.diag.ladder.element_series ( Mapping[str, Any] ladder,
str side,
str kind )
The ladder elements of one ``kind`` on one side (for the regulator/solenoid blocks).

Definition at line 271 of file ladder.py.

◆ firing_mask()

np.ndarray engine.layerx.diag.ladder.firing_mask ( Mapping[str, Any] result,
int n )
``series.firing`` as booleans (all False when absent).

Definition at line 110 of file ladder.py.

◆ inp()

Dict[str, Any] engine.layerx.diag.ladder.inp ( Any value,
str unit,
str provenance )
One entry of a model block's ``inputs``.

Definition at line 93 of file ladder.py.

References scalar().

◆ model_block()

Dict[str, Any] engine.layerx.diag.ladder.model_block ( str name,
str source,
Sequence[str] assumptions,
Mapping[str, Dict[str, Any]] inputs )
DATA-CONTRACT ``model``: what produced a block, so the run record can list it.

Definition at line 100 of file ladder.py.

◆ network_of()

Mapping[str, Any] engine.layerx.diag.ladder.network_of ( Mapping[str, Any] result)
``result["network"]`` checked against ``series.t``; raises ValueError with the reason.

Definition at line 118 of file ladder.py.

Referenced by build_ladder().

◆ node_p()

np.ndarray engine.layerx.diag.ladder.node_p ( Mapping[str, Any] net,
str node,
int n )

Definition at line 130 of file ladder.py.

References arr().

Referenced by branch_dp(), build_ladder(), and side_elements().

◆ node_T()

np.ndarray engine.layerx.diag.ladder.node_T ( Mapping[str, Any] net,
str node,
int n )
A node's temperature [K]; NaN where it is missing or not positive (the recorder writes 0.0
for a node the step's enthalpy walk did not reach).

Definition at line 137 of file ladder.py.

References arr().

◆ out()

List[Optional[float]] engine.layerx.diag.ladder.out ( Iterable[float] values,
Optional[int] digits = None )
A JSON-safe list: non-finite -> None.

Definition at line 67 of file ladder.py.

Referenced by build_ladder().

◆ scalar()

Optional[float] engine.layerx.diag.ladder.scalar ( Any v)
A JSON-safe float or None.

Definition at line 79 of file ladder.py.

Referenced by build_ladder(), inp(), and side_elements().

◆ series_t()

np.ndarray engine.layerx.diag.ladder.series_t ( Mapping[str, Any] result)

Definition at line 106 of file ladder.py.

References arr().

Referenced by build_ladder().

◆ side_elements()

List[Dict[str, Any]] engine.layerx.diag.ladder.side_elements ( Mapping[str, Any] net,
str side,
int n,
Optional[Mapping[str, Any]] series_side = None )
The elements along ``net["paths"][side]``, with every gap between consecutive branches
filled by a vessel element (a tank's liquid head) and the injector branch split into dump and
orifices when ``series_side`` carries ``dump_psi`` and ``dp_injector_psi``. The orifice
element's ``check_psi`` is the largest gap between its drop and ``series.*.dp_injector_psi``
on the steps the series carry one (0 on the card).

Definition at line 161 of file ladder.py.

References _element(), arr(), branch_dp(), node_p(), and scalar().

Referenced by build_ladder().

◆ unavailable()

Dict[str, Any] engine.layerx.diag.ladder.unavailable ( str error)
DATA-CONTRACT: a block that could not be computed. It never raises.

Definition at line 88 of file ladder.py.

Referenced by build_ladder().

Variable Documentation

◆ PSI

float engine.layerx.diag.ladder.PSI = 6894.757293168361

Definition at line 32 of file ladder.py.

◆ SIDE_CONFIG

dict engine.layerx.diag.ladder.SIDE_CONFIG = {"ox": "oxidizer", "fuel": "fuel"}

Definition at line 41 of file ladder.py.

◆ SIDE_ROLE

dict engine.layerx.diag.ladder.SIDE_ROLE = {"ox": "oxidiser", "fuel": "fuel"}

Definition at line 38 of file ladder.py.

◆ SIDES

tuple engine.layerx.diag.ladder.SIDES = ("ox", "fuel")

Definition at line 35 of file ladder.py.

◆ SUM_TOLERANCE_PSI

int engine.layerx.diag.ladder.SUM_TOLERANCE_PSI = 1e-6

Definition at line 44 of file ladder.py.