STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
test_preset_fluid_drift.py
Go to the documentation of this file.
1
"""A design whose fluid block disagrees with its propellant preset says so.
2
3
An explicit ``fluids`` block wins over the preset on load, so a design saved before the ethalox
4
preset was corrected against CoolProp keeps LOX cp 2300 (CoolProp Oxygen 90 K: 1699 J/(kg K)),
5
bulk modulus 1.5e9 (rho a^2: 0.94e9 Pa) and viscosity 1.8e-4 (1.96e-4 Pa s) with no word. The LE4
6
(3) stand's engine carries that block: forward thrust barely moves, but its chug gate goes 1.445 ->
7
1.420, the LOX water hammer 3182 -> 2561 psi and the line quarter-wave 2697 -> 2170 Hz.
8
"""
9
10
from
__future__
import
annotations
11
12
from
pathlib
import
Path
13
14
import
pytest
15
16
REPO = Path(__file__).resolve().parents[1]
17
STALE_LOX = {
"specific_heat"
: 2300.0,
"bulk_modulus_pa"
: 1.5e9,
"viscosity"
: 1.8e-4}
18
19
20
def
_cfg
(path):
21
from
engine.pipeline.io
import
load_config
22
23
return
load_config(str(path))
24
25
26
def
test_the_stale_lox_block_is_named_with_the_presets_values
():
27
from
engine.pipeline.config_switch
import
design_staleness
28
29
cfg =
_cfg
(REPO /
"configs"
/
"ethalox_doublet_7000N.yaml"
)
30
for
k, v
in
STALE_LOX.items():
31
setattr(cfg.fluids[
"oxidizer"
], k, v)
32
w = design_staleness(cfg)
or
""
33
assert
"ethalox preset"
in
w, w
34
assert
"specific_heat 2300 (preset 1700)"
in
w
35
assert
"bulk_modulus_pa 1.5e+09 (preset 9.4e+08)"
in
w
36
assert
"viscosity 0.00018 (preset 0.0002)"
in
w
37
38
39
def
test_a_design_on_the_presets_fluids_is_quiet
():
40
from
engine.pipeline.config_switch
import
design_staleness
41
42
assert
design_staleness(
_cfg
(REPO /
"configs"
/
"default.yaml"
))
is
None
43
44
45
def
test_a_rounding_is_not_drift
():
46
"""default.yaml's LOX boiling point is 90.19 against the methalox preset's 90.2."""
47
from
engine.pipeline.config_switch
import
preset_fluid_drift
48
49
cfg =
_cfg
(REPO /
"configs"
/
"default.yaml"
)
50
cfg.fluids[
"oxidizer"
].temperature = 92.0
# a couple of kelvin warmer: still quiet
51
assert
preset_fluid_drift(cfg)
is
None
52
53
54
def
test_a_config_without_a_preset_is_not_compared
():
55
from
engine.pipeline.config_switch
import
preset_fluid_drift
56
57
cfg =
_cfg
(REPO /
"configs"
/
"ethalox_doublet_7000N.yaml"
)
58
cfg.fluids[
"oxidizer"
].specific_heat = 2300.0
59
cfg.propellant_preset =
None
60
assert
preset_fluid_drift(cfg)
is
None
61
62
63
@pytest.mark.parametrize("name", ["ethalox_doublet_7000N.yaml", "ethalox_8000N_designpoint.yaml"])
64
def
test_the_shipped_ethalox_designs_carry_the_corrected_lox
(name):
65
from
engine.pipeline.config_switch
import
preset_fluid_drift
66
67
cfg =
_cfg
(REPO /
"configs"
/ name)
68
lox = cfg.fluids[
"oxidizer"
]
69
assert
(lox.specific_heat, lox.bulk_modulus_pa, lox.viscosity) == pytest.approx((1700.0, 0.94e9, 2.0e-4))
70
assert
preset_fluid_drift(cfg)
is
None
engine.pipeline.config_switch
Definition
config_switch.py:1
engine.pipeline.io
Definition
io.py:1
test_preset_fluid_drift.test_a_config_without_a_preset_is_not_compared
test_a_config_without_a_preset_is_not_compared()
Definition
test_preset_fluid_drift.py:54
test_preset_fluid_drift.test_the_stale_lox_block_is_named_with_the_presets_values
test_the_stale_lox_block_is_named_with_the_presets_values()
Definition
test_preset_fluid_drift.py:26
test_preset_fluid_drift.test_a_design_on_the_presets_fluids_is_quiet
test_a_design_on_the_presets_fluids_is_quiet()
Definition
test_preset_fluid_drift.py:39
test_preset_fluid_drift.test_a_rounding_is_not_drift
test_a_rounding_is_not_drift()
Definition
test_preset_fluid_drift.py:45
test_preset_fluid_drift.test_the_shipped_ethalox_designs_carry_the_corrected_lox
test_the_shipped_ethalox_designs_carry_the_corrected_lox(name)
Definition
test_preset_fluid_drift.py:64
test_preset_fluid_drift._cfg
_cfg(path)
Definition
test_preset_fluid_drift.py:20
EngineDesign
tests
test_preset_fluid_drift.py
Generated by
1.15.0