1"""The tank columns a burn records, and the liquid surface among them.
3A saturation margin at the tank is the tank pressure against the vapour pressure
4of the liquid the ullage touches. With stratification on that is the surface
5layer, not the bulk, and the trace has to carry it (EngineDesign/docs/layerx/
6AUDIT.md 5.4). Off, the surface *is* the bulk, and the column says so exactly.
9from __future__
import annotations
12from pathlib
import Path
21STAR = Path(__file__).resolve().parents[3]
22STAND = STAR /
"feed-twin" /
"backend" /
"diagrams" /
"ethalox_stand.json"
23TABLES = STAR /
"feed-twin" /
"backend" /
"statemachines"
25pytestmark = pytest.mark.skipif(
26 not (STAND.exists()
and TABLES.is_dir()), reason=
"stand drawing or tables absent"
29PLAN =
BurnPlan(tank_psi=550.0, settle=
False, lead_in_s=0.5, horizon_s=0.0)
33 model = assemble_model(
34 read_diagram(json.loads(STAND.read_text()), name=
"ethalox_stand"),
35 diagram_id=
"ethalox_stand.json",
37 session = open_session(
38 model, load_machine(tables=TABLES), setup=burn_setup(**setup)
40 return session, run_burn(session, PLAN)
44 assert "surface_temperature_K" in TANK_FIELDS
46 for tank, columns
in trace.tank.items():
47 assert len(columns[
"surface_temperature_K"]) == len(trace.t)
49 assert columns[
"surface_temperature_K"] == columns[
"liquid_temperature_K"]
53 session, trace =
_trace(stratification=
True)
54 for tank, sim
in session.tanks.items():
55 column = trace.tank[tank][
"surface_temperature_K"]
56 assert sim.state.surface_temperature
is not None
57 assert column[-1] == sim.state.surface_temperature
60 lox = session.tanks[
"OXT"]
61 T_surface = trace.tank[
"OXT"][
"surface_temperature_K"][-1]
63 assert T_surface > trace.tank[
"OXT"][
"liquid_temperature_K"][-1] + 0.01
64 p_sat = lox.tank.liquid.get(
"p", T=T_surface, q=0.0)
65 margin = trace.tank[
"OXT"][
"pressure_Pa"][-1] - p_sat
None test_with_stratification_on_it_is_the_layer()
None test_the_surface_temperature_is_recorded()