STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
test_layerx_dome.py
Go to the documentation of this file.
1
"""The dome dial is an input (2026-10-07): the drawing's by default, the rail's when set, solved for a
2
tank pressure when that is what the rail gives. Every pressure on the rail is absolute.
3
4
On the helium study drawing the dial is PR-CTRL's 500 psig setpoint (a dome loader on PR-DOME), so the
5
default lockup is what that dial gives, not the config's 578 psia design tank pressure.
6
"""
7
8
from
__future__
import
annotations
9
10
import
copy
11
from
pathlib
import
Path
12
13
import
pytest
14
15
pytest.importorskip(
"feedtwin"
, reason=
"lib/feedtwin is not installed"
)
16
17
ROOT = Path(__file__).resolve().parents[1]
18
CONFIG = ROOT /
"configs"
/
"ethalox_6800N.yaml"
19
ATM_PSIA = 101325.0 / 6894.757293168361
20
21
22
@pytest.fixture(scope="module")
23
def
setup
():
24
from
engine.layerx
import
DrawingStore
25
from
engine.pipeline.io
import
load_config
26
27
drawing = next(d
for
d
in
DrawingStore(
None
).list()
if
d.name ==
"copv_study_he"
)
28
return
load_config(str(CONFIG)), drawing
29
30
31
def
_prep
(setup, **settings):
32
from
engine.core.runner
import
PintleEngineRunner
33
from
engine.layerx
import
LayerXSettings, prepare
34
35
config, drawing = setup
36
cfg = copy.deepcopy(config)
37
return
prepare(cfg, PintleEngineRunner(cfg), drawing, LayerXSettings(drawing_id=drawing.id, **settings), [])
38
39
40
def
test_by_default_the_dial_is_the_drawings
(setup):
41
p =
_prep
(setup)
42
d = p.derived
43
assert
p.ok
44
assert
d[
"dome_source"
] ==
"as drawn"
45
assert
d[
"dome_regulator_label"
] ==
"PR-CTRL"
46
assert
d[
"dome_psia"
] == pytest.approx(500.0 + ATM_PSIA, abs=1e-6)
47
assert
d[
"dome_psia"
] == pytest.approx(d[
"dome_drawn_psia"
], abs=1e-9)
48
# Not the config's 578 psia: the drawing's dial sets the tanks.
49
assert
d[
"target_lockup_psia"
] < 575.0
50
51
52
def
test_a_dome_on_the_rail_sets_the_lockup
(setup):
53
base =
_prep
(setup).derived
54
up =
_prep
(setup, dome_psia=base[
"dome_psia"
] + 20.0).derived
55
assert
up[
"dome_source"
] ==
"set on the rail"
56
assert
up[
"target_lockup_psia"
] == pytest.approx(base[
"target_lockup_psia"
] + 20.0, abs=1.0)
57
58
59
def
test_a_tank_pressure_on_the_rail_solves_the_dome
(setup):
60
d =
_prep
(setup, tank_pressure_psia=578.0).derived
61
assert
d[
"dome_source"
] ==
"solved for the rail's tank pressure"
62
assert
d[
"target_lockup_psia"
] == pytest.approx(578.0, abs=1e-9)
63
back =
_prep
(setup, dome_psia=d[
"dome_psia"
]).derived
64
assert
back[
"target_lockup_psia"
] == pytest.approx(578.0, abs=0.01)
65
66
67
def
test_the_bottle_in_psia_is_the_bottle_in_psig
(setup):
68
a =
_prep
(setup, copv_pressure_psia=4000.0 + ATM_PSIA).derived
69
b =
_prep
(setup, copv_pressure_psig=4000.0).derived
70
assert
a[
"copv_psia"
] == pytest.approx(b[
"copv_psia"
], abs=1e-9)
71
assert
a[
"copv_psia"
] == pytest.approx(4000.0 + ATM_PSIA, abs=1e-9)
72
73
74
def
test_naming_a_regulator_the_drawing_does_not_have_refuses_the_run
(setup):
75
p =
_prep
(setup, dome_regulator=
"nope"
)
76
assert
not
p.ok
77
assert
[c.key
for
c
in
p.checks
if
c.status ==
"fail"
] == [
"dome_regulator"
]
78
79
80
def
test_naming_the_default_regulator_changes_nothing
(setup):
81
auto =
_prep
(setup).derived
82
named =
_prep
(setup, dome_regulator=auto[
"dome_regulator"
]).derived
83
assert
named[
"target_lockup_psia"
] == pytest.approx(auto[
"target_lockup_psia"
], abs=1e-6)
engine.core.runner
Definition
runner.py:1
engine.layerx
Definition
__init__.py:1
engine.pipeline.io
Definition
io.py:1
test_layerx_dome.setup
setup()
Definition
test_layerx_dome.py:23
test_layerx_dome.test_a_dome_on_the_rail_sets_the_lockup
test_a_dome_on_the_rail_sets_the_lockup(setup)
Definition
test_layerx_dome.py:52
test_layerx_dome.test_naming_a_regulator_the_drawing_does_not_have_refuses_the_run
test_naming_a_regulator_the_drawing_does_not_have_refuses_the_run(setup)
Definition
test_layerx_dome.py:74
test_layerx_dome.test_by_default_the_dial_is_the_drawings
test_by_default_the_dial_is_the_drawings(setup)
Definition
test_layerx_dome.py:40
test_layerx_dome.test_naming_the_default_regulator_changes_nothing
test_naming_the_default_regulator_changes_nothing(setup)
Definition
test_layerx_dome.py:80
test_layerx_dome.test_the_bottle_in_psia_is_the_bottle_in_psig
test_the_bottle_in_psia_is_the_bottle_in_psig(setup)
Definition
test_layerx_dome.py:67
test_layerx_dome._prep
_prep(setup, **settings)
Definition
test_layerx_dome.py:31
test_layerx_dome.test_a_tank_pressure_on_the_rail_solves_the_dome
test_a_tank_pressure_on_the_rail_solves_the_dome(setup)
Definition
test_layerx_dome.py:59
EngineDesign
tests
test_layerx_dome.py
Generated by
1.15.0