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

Classes

class  PidNode
class  PidEdge
class  Diagram

Functions

dict[str, Param] _params (Any raw, str where, str symbol="")
dict[str, str] _options (Any raw)
dict[str, dict[str, str]] _ports (Any raw)
float _fraction (Any raw, float default)
float _rotation (Any raw)
Diagram read_diagram (Mapping[str, Any] payload, *, str name="diagram")
PidNode _gas_tank_as_bottle (PidNode node)
PidNode _liquid_dewar_as_tank (PidNode node)
Diagram load_diagram (str|Path path)

Variables

 INLINE_TYPES = frozenset({"MAN", "ROT", "SOL", "MOV", "PR", "RV", "CV", "QD"})
 SOURCE_TYPES = frozenset({"TANK", "KBOTTLE", "DEWAR"})
 BOUNDARY_TYPES = frozenset({"ENGINE", "INJECTOR", "VENT"})
 INSTRUMENT_TYPES = frozenset({"PT", "PG", "RTD", "TC", "LC"})
 ANNOTATION_TYPES = frozenset({"TEXT", "REGION"})
dict _PROVENANCE = {p.value: p for p in Provenance}

Detailed Description

A P&ID as a document, before it is a network.

pid-designer stores a drawing as ``{"nodes": [...], "edges": [...]}`` -- React
Flow's own shape, with the engineering carried in each item's ``data``. This
module reads that into typed records and does nothing else. No physics, no
topology, no opinions: parsing and interpreting are separated because the parse
must succeed on a drawing that is half-finished, and the interpretation must be
allowed to refuse one.

The field names are pid-designer's, unchanged. A translation table between the
two apps would be a third place for a name to be wrong, and the whole reason
the drawing stores ``feedtwin.model.Param``'s exact shape is so that no such
table is needed.

Function Documentation

◆ _fraction()

float feedtwin.pid.document._fraction ( Any raw,
float default )
protected
A fraction in [0, 1], or ``default`` when it is missing or not a number.

Definition at line 203 of file document.py.

References max, and min.

Referenced by read_diagram().

◆ _gas_tank_as_bottle()

PidNode feedtwin.pid.document._gas_tank_as_bottle ( PidNode node)
protected
A TANK that can only hold gas is the pressurant supply: read it as one.

pid-designer offers ``copv`` as a tank *wall material*, so a COPV is easily
drawn with the propellant-tank symbol. Read as drawn it supplies nothing --
the press lines land on the tanks' liquid side -- and a stand cannot even
open, because a propellant tank starts from a saturated liquid that does not
exist above the critical point.

Only when the drawing itself rules out a liquid: the fluid and the
temperature are both stated, and the temperature is above that fluid's
critical temperature. A LOX tank that merely forgot its temperature is left
alone (and warned about as a missing temperature, which is what it is).
Nothing is invented -- the pressure, fluid and volume are the drawing's own.

Definition at line 303 of file document.py.

Referenced by read_diagram().

◆ _liquid_dewar_as_tank()

PidNode feedtwin.pid.document._liquid_dewar_as_tank ( PidNode node)
protected
A dewar holding liquid is a liquid supply: read it as a tank.

A LOX dewar was read as a pressurant bottle -- a gas volume -- which the
GN2 High Press charge then tried to pump to 4,500 psig, and which no fill
line could draw liquid from. As a tank it holds its liquid under its own
ullage, and on the ground-support side of a drawing it is the supply the
flight tank is loaded from (``BuiltNetwork.supplies``).

Only when the drawing says so: fluid and temperature stated, the
temperature below the fluid's critical point. A dewar used as a gas source
(warm, or above critical) is left as drawn.

Definition at line 334 of file document.py.

Referenced by read_diagram().

◆ _options()

dict[str, str] feedtwin.pid.document._options ( Any raw)
protected

Definition at line 187 of file document.py.

Referenced by read_diagram().

◆ _params()

dict[str, Param] feedtwin.pid.document._params ( Any raw,
str where,
str symbol = "" )
protected
Read a ``{name: {value, unit, source, reference}}`` block.

A parameter with no ``source`` is refused rather than defaulted. The drawing
goes out of its way to always ask, so a missing one means the document was
written by something else -- and silently calling it a default would turn a
format mismatch into a number nobody checked.

Definition at line 151 of file document.py.

Referenced by read_diagram().

◆ _ports()

dict[str, dict[str, str]] feedtwin.pid.document._ports ( Any raw)
protected

Definition at line 193 of file document.py.

Referenced by read_diagram().

◆ _rotation()

float feedtwin.pid.document._rotation ( Any raw)
protected

Definition at line 214 of file document.py.

Referenced by read_diagram().

◆ load_diagram()

Diagram feedtwin.pid.document.load_diagram ( str | Path path)

Definition at line 363 of file document.py.

References read_diagram().

◆ read_diagram()

Diagram feedtwin.pid.document.read_diagram ( Mapping[str, Any] payload,
* ,
str name = "diagram" )
Parse a saved drawing. Lenient by design -- see the module docstring.

Definition at line 221 of file document.py.

References _fraction(), _gas_tank_as_bottle(), _liquid_dewar_as_tank(), _options(), _params(), _ports(), and _rotation().

Referenced by load_diagram().

Variable Documentation

◆ _PROVENANCE

dict feedtwin.pid.document._PROVENANCE = {p.value: p for p in Provenance}
protected

Definition at line 148 of file document.py.

◆ ANNOTATION_TYPES

feedtwin.pid.document.ANNOTATION_TYPES = frozenset({"TEXT", "REGION"})

Definition at line 46 of file document.py.

◆ BOUNDARY_TYPES

feedtwin.pid.document.BOUNDARY_TYPES = frozenset({"ENGINE", "INJECTOR", "VENT"})

Definition at line 38 of file document.py.

◆ INLINE_TYPES

feedtwin.pid.document.INLINE_TYPES = frozenset({"MAN", "ROT", "SOL", "MOV", "PR", "RV", "CV", "QD"})

Definition at line 31 of file document.py.

◆ INSTRUMENT_TYPES

feedtwin.pid.document.INSTRUMENT_TYPES = frozenset({"PT", "PG", "RTD", "TC", "LC"})

Definition at line 43 of file document.py.

◆ SOURCE_TYPES

feedtwin.pid.document.SOURCE_TYPES = frozenset({"TANK", "KBOTTLE", "DEWAR"})

Definition at line 34 of file document.py.