|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
Functions | |
| Any | _patched (Any config, Optional[Dict[str, Dict[str, Any]]] patch) |
| Optional[str] | _sha256_file (Optional[Path] path) |
| Optional[str] | _sha256_dir (Path path, str pattern="*") |
| Tuple[Any, Dict[str, Any]] | load_engine_config (Any source=None) |
| Any | find_drawing (str name) |
| Optional[float] | _num (Any v) |
| Optional[float] | _first (*Any values) |
| Dict[str, Any] | metrics (Dict[str, Any] result, Any prep) |
| str | _git_describe () |
| Dict[str, Any] | _versions () |
| Dict[str, Any] | run_case (str name, *, Any config=None, Any config_source=None, Optional[float] dt=None, Optional[Callable[[str, float], None]] progress=None, bool keep_result=False) |
| Dict[str, Any] | run_baseline (Optional[Iterable[str]] cases=None, *, Any config_source=None, Optional[float] dt=None, bool embed_config=True, bool verbose=True) |
| str | _f (Any v, int nd=1, str unit="") |
| str | format_case (Dict[str, Any] case) |
| Any | _json_default (Any o) |
| int | main (Optional[List[str]] argv=None) |
Variables | |
| ROOT = Path(__file__).resolve().parents[1] | |
| float | PSI = 6894.757293168361 |
| str | DEFAULT_CONFIG = ROOT / "configs" / "ethalox_6800N.yaml" |
| float | STUDY_LOCKUP_PSIA = 564.7 |
| dict | CASES |
| BASELINE_CASES = tuple(k for k, v in CASES.items() if not v.get("supplementary")) | |
LE4 Layer X baseline ("golden") burns.
Runs Layer X in-process (no HTTP server) at today's default settings and reduces each burn to
the numbers a design review reads. The JSON it writes is the reference for the overnight rule
"a change that moves the LE4 baseline by more than 1 % must be reported"; the slow test
``tests/test_layerx_golden.py`` holds the pad helium case to it.
Cases (the engine is LE4, ``configs/ethalox_6800N.yaml`` unless ``--config`` says otherwise)::
he_pad copv_study_he on the pad, erosion replay on (the hot-fire drawing)
he_flight the same, flown at the design's liftoff mass (``liftoff_mass_kg`` unset: the
config's airframe plus motor, propellant and gases)
gn2_pad copv_study_gn2 on the pad (the drawing the Layer X tab selects by default)
Supplementary (``--all`` or ``--case``)::
gn2_flight copv_study_gn2 flown: the tab's out-of-the-box run (the UI defaults flight on)
he_flight_he_ullage he_flight with config.{lox,fuel}_tank.ullage_gas = Helium in the run's copy
of the config: a what-if, because at defaults the flight prices the ullage
refill as nitrogen and refuses the helium bottle (see CASES)
Settings are ``LayerXSettings``'s defaults except ``drawing_id``, ``flight`` and ``--dt``. The UI's
``DEFAULT_SETTINGS`` (frontend/src/api/layerx.ts) equal them except that the UI turns ``flight``
on; the pad cases are therefore one toggle away from the tab's out-of-the-box run.
The run is the router's (backend/routers/layerx.py ``start_run``): a private deepcopy of the
config, its own ``PintleEngineRunner`` (so the Forward cross-check runs), no restated drawing
parameters, ``run_prepared(prep, runner=..., replay=settings.replay, config=...)``.
Usage::
cd EngineDesign
PYTHONPATH=../lib/stardesign python3 scripts/layerx_baseline.py # the baseline's three
PYTHONPATH=../lib/stardesign python3 scripts/layerx_baseline.py --all \\
--out docs/layerx/baseline-2026-10-02.json # + supplementary
PYTHONPATH=../lib/stardesign python3 scripts/layerx_baseline.py --case he_pad --dt 0.02
PYTHONPATH=../lib/stardesign python3 scripts/layerx_baseline.py --config path/to/current.json
``--config`` takes a YAML config, an app document (``.userdata/.../current.json``, its ``config``
key), or a baseline JSON written by this script (its embedded ``inputs.config``), so a baseline
can be re-burned on exactly the design it was taken on.
Importable: ``run_case`` and ``run_baseline`` return plain dicts.
|
protected |
Definition at line 436 of file layerx_baseline.py.
References _num().
|
protected |
|
protected |
Definition at line 318 of file layerx_baseline.py.
Referenced by run_baseline().
|
protected |
Definition at line 474 of file layerx_baseline.py.
|
protected |
Definition at line 168 of file layerx_baseline.py.
|
protected |
Definition at line 100 of file layerx_baseline.py.
Referenced by run_case().
|
protected |
Definition at line 124 of file layerx_baseline.py.
Referenced by run_case().
|
protected |
Definition at line 114 of file layerx_baseline.py.
Referenced by run_case().
|
protected |
Definition at line 326 of file layerx_baseline.py.
Referenced by run_baseline().
| Any layerx_baseline.find_drawing | ( | str | name | ) |
Definition at line 156 of file layerx_baseline.py.
Referenced by run_case().
| str layerx_baseline.format_case | ( | Dict[str, Any] | case | ) |
Definition at line 441 of file layerx_baseline.py.
Referenced by run_baseline().
| Tuple[Any, Dict[str, Any]] layerx_baseline.load_engine_config | ( | Any | source = None | ) |
``(config, info)``. ``source``: None (LE4's YAML), a path (YAML, an app document JSON, or a baseline JSON from this script), or an already-built config dict.
Definition at line 135 of file layerx_baseline.py.
Referenced by run_baseline(), and run_case().
| int layerx_baseline.main | ( | Optional[List[str]] | argv = None | ) |
Definition at line 480 of file layerx_baseline.py.
References main(), and run_baseline().
| Dict[str, Any] layerx_baseline.metrics | ( | Dict[str, Any] | result, |
| Any | prep ) |
The baseline's figures from a ``run_prepared`` result. Engine quantities (impulse, thrust, Pc, Isp) are the *delivered* ones, EngineDesign's eroding replay, exactly as the Layer X tab's headline reads them (LayerXResult.tsx ``figureCells``); the twin's own are kept beside them. Feed quantities (burn time, tanks, bottle, O/F, stiffness) are the twin's last pass, also as the tab reads them.
Definition at line 184 of file layerx_baseline.py.
References _first(), _num(), and max.
Referenced by run_case().
| Dict[str, Any] layerx_baseline.run_baseline | ( | Optional[Iterable[str]] | cases = None, |
| * | , | ||
| Any | config_source = None, | ||
| Optional[float] | dt = None, | ||
| bool | embed_config = True, | ||
| bool | verbose = True ) |
Every case in ``cases`` (all by default) on one config. The config is embedded so the baseline can be burned again on exactly this design (``--config <baseline.json>``).
Definition at line 398 of file layerx_baseline.py.
References _git_describe(), _versions(), format_case(), load_engine_config(), and run_case().
Referenced by main().
| Dict[str, Any] layerx_baseline.run_case | ( | str | name, |
| * | , | ||
| Any | config = None, | ||
| Any | config_source = None, | ||
| Optional[float] | dt = None, | ||
| Optional[Callable[[str, float], None]] | progress = None, | ||
| bool | keep_result = False ) |
Burn one case and return ``{"case", "settings", "inputs", "metrics", ...}``.
``config``: an engine config to use (it is deep-copied, as the router does); otherwise
``config_source`` is loaded with :func:`load_engine_config`. ``dt`` overrides the default step.
Definition at line 337 of file layerx_baseline.py.
References _patched(), _sha256_dir(), _sha256_file(), find_drawing(), load_engine_config(), and metrics().
Referenced by run_baseline().
| layerx_baseline.BASELINE_CASES = tuple(k for k, v in CASES.items() if not v.get("supplementary")) |
Definition at line 97 of file layerx_baseline.py.
| dict layerx_baseline.CASES |
Definition at line 76 of file layerx_baseline.py.
| str layerx_baseline.DEFAULT_CONFIG = ROOT / "configs" / "ethalox_6800N.yaml" |
Definition at line 65 of file layerx_baseline.py.
| float layerx_baseline.PSI = 6894.757293168361 |
Definition at line 64 of file layerx_baseline.py.
| layerx_baseline.ROOT = Path(__file__).resolve().parents[1] |
Definition at line 60 of file layerx_baseline.py.
| float layerx_baseline.STUDY_LOCKUP_PSIA = 564.7 |
Definition at line 74 of file layerx_baseline.py.