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

Classes

class  Drawing
class  DrawingStore

Functions

Path feedtwin_root ()
Path shipped_drawings_dir ()
Path feedtwin_library_dir ()
Path sample_dir ()
Path machines_dir ()
Optional[float] _fallback_psi (str kind, str name)
List[str] source_problems ()
Optional[Path] cea_table_path (Any config)
str sha256 (bytes data)
str drawing_id (bytes data)
bytes normalise (Mapping[str, Any] payload)
Dict[str, Any] summarize (Mapping[str, Any] payload, str name="")
str display_name (str name)
str origin_words (str source)
Optional[bytes] _read (Path path)

Variables

 _ENGINE_ROOT = Path(__file__).resolve().parents[2]
 _STAR_ROOT = _ENGINE_ROOT.parent
dict _STEM_WORDS = {"copv": "COPV", "gn2": "GN2", "he": "helium", "n2": "N2", "ln2": "LN2", "lox": "LOX", "le4": "LE4"}
dict _GAS_WORDS = {"GN2", "helium", "N2", "LN2"}
dict _SHIPPED_CACHE = {}

Detailed Description

Where Layer X's drawings, state machines and combustion tables come from.

A drawing is the hardware record (ADR-0002): topology, line geometry, tank and
bottle volumes, the regulator. Layer X never edits one. It reads drawings from
these places and treats them identically once read, because what identifies a
drawing is its **bytes**:

* the feed-twin set shipped in ``feed-twin/backend/diagrams`` (the stand and the
  two COPV-study drawings), listed as benchmarks;
* the feed twin's own library, and the sample set it bundles in
  ``feed-twin/backend/sample`` (the team's current stand, which is *featured*:
  a browser with no drawing of its own opens on it);
* drawings uploaded to Layer X, kept per user;
* pid-designer documents, pulled by the router (it owns the HTTP) and stored
  here like an upload, with where they came from recorded.

Every record carries the sha256 of its bytes. A run quotes it, so "which drawing
was this" is answerable without trusting a name.

Function Documentation

◆ _fallback_psi()

Optional[float] engine.layerx.sources._fallback_psi ( str kind,
str name )
protected
The feed twin's own default for a parameter a drawing leaves out, as a difference in psi.

Definition at line 62 of file sources.py.

Referenced by summarize().

◆ _read()

◆ cea_table_path()

Optional[Path] engine.layerx.sources.cea_table_path ( Any config)
The engine's own CEA cache, resolved the way EngineDesign's CEACache resolves it.

Definition at line 89 of file sources.py.

◆ display_name()

str engine.layerx.sources.display_name ( str name)
A drawing's name as a person reads it. A file stem (``copv_study_he``, what a shipped drawing
is named by) comes back in words (``COPV study, helium``); any other name, which a person chose,
comes back as it is.

Definition at line 214 of file sources.py.

◆ drawing_id()

str engine.layerx.sources.drawing_id ( bytes data)

◆ feedtwin_library_dir()

Path engine.layerx.sources.feedtwin_library_dir ( )
The feed twin's own library: every drawing its cockpit can open (the shipped ones and what it
pulled from pid-designer), as ``manifest.json`` plus ``blobs/``.

Definition at line 45 of file sources.py.

References feedtwin_root().

Referenced by engine.layerx.sources.DrawingStore._feedtwin_library(), and source_problems().

◆ feedtwin_root()

Path engine.layerx.sources.feedtwin_root ( )
The feed-twin app checkout, whose shipped drawings and DAQ tables Layer X reads.

Definition at line 36 of file sources.py.

Referenced by feedtwin_library_dir(), machines_dir(), sample_dir(), and shipped_drawings_dir().

◆ machines_dir()

Path engine.layerx.sources.machines_dir ( )
The DAQ's state-machine tables, as feed-twin ships them (see NEEDS-REPAIR.md there).

Definition at line 57 of file sources.py.

References feedtwin_root().

Referenced by source_problems().

◆ normalise()

bytes engine.layerx.sources.normalise ( Mapping[str, Any] payload)
A pid-designer document reduced to what feed-twin reads, as stable bytes.

Definition at line 117 of file sources.py.

Referenced by engine.layerx.sources.DrawingStore.add().

◆ origin_words()

str engine.layerx.sources.origin_words ( str source)
Where a drawing came from, in words, for the menu's second line (the raw ``source`` stays in
the run record).

Definition at line 228 of file sources.py.

◆ sample_dir()

Path engine.layerx.sources.sample_dir ( )
The sample set feed-twin bundles (the team's current stand drawing and engine): the drawing
in it is the featured one, the stand a fresh browser opens on.

Definition at line 51 of file sources.py.

References feedtwin_root().

Referenced by engine.layerx.sources.DrawingStore._sample(), and source_problems().

◆ sha256()

◆ shipped_drawings_dir()

Path engine.layerx.sources.shipped_drawings_dir ( )

Definition at line 41 of file sources.py.

References feedtwin_root().

Referenced by engine.layerx.sources.DrawingStore._shipped(), and source_problems().

◆ source_problems()

List[str] engine.layerx.sources.source_problems ( )
Each place Layer X reads drawings from that is not there, in words, for the server log and
``GET /api/layerx/status``. A missing one lists nothing and says nothing: the deployed image
resolved the twin's library and sample set to ``/feed-twin/backend/...`` (no checkout beside it),
so production Layer X never saw what the cockpit holds, nor the featured stand.

Definition at line 74 of file sources.py.

References feedtwin_library_dir(), machines_dir(), sample_dir(), and shipped_drawings_dir().

◆ summarize()

Dict[str, Any] engine.layerx.sources.summarize ( Mapping[str, Any] payload,
str name = "" )
What a person choosing a drawing needs to see, without building a network.

Read through feedtwin's own reader so a drawing it cannot read says so here,
not halfway into a run.

Definition at line 125 of file sources.py.

References _fallback_psi().

Referenced by engine.layerx.sources.DrawingStore._feedtwin_library(), engine.layerx.sources.DrawingStore._sample(), and engine.layerx.sources.DrawingStore.add().

Variable Documentation

◆ _ENGINE_ROOT

engine.layerx.sources._ENGINE_ROOT = Path(__file__).resolve().parents[2]
protected

Definition at line 32 of file sources.py.

◆ _GAS_WORDS

dict engine.layerx.sources._GAS_WORDS = {"GN2", "helium", "N2", "LN2"}
protected

Definition at line 211 of file sources.py.

◆ _SHIPPED_CACHE

dict engine.layerx.sources._SHIPPED_CACHE = {}
protected

Definition at line 289 of file sources.py.

◆ _STAR_ROOT

engine.layerx.sources._STAR_ROOT = _ENGINE_ROOT.parent
protected

Definition at line 33 of file sources.py.

◆ _STEM_WORDS

dict engine.layerx.sources._STEM_WORDS = {"copv": "COPV", "gn2": "GN2", "he": "helium", "n2": "N2", "ln2": "LN2", "lox": "LOX", "le4": "LE4"}
protected

Definition at line 210 of file sources.py.