37 fixed = solve_steady(net)
38 admittance, reference = 1.0e-6, 38.0e5
39 stored = solve_steady(net, storage={
"tank": (admittance, reference)})
41 assert stored.converged
42 p, flow = stored.pressures[
"tank"], stored.flows[
"SOL"]
43 assert flow == pytest.approx(admittance * (p - reference), rel=1e-6)
44 assert stored.max_mass_residual < 1e-9
46 assert reference < p < 40.0e5
47 assert 0.0 < flow < fixed.flows[
"SOL"]
49 assert net.nodes[
"tank"].pressure == 38.0e5
61def _hold(seconds: float = 1.5) -> tuple[C.Session, list[float], float, float]:
62 """Pad hold with both press valves open: the LOX ullage collapsing, the
63 mains shut. Returns the session, the tank spread over the last half, and
64 the gas the bottle gave and the ullages kept over the whole hold [kg]."""
65 session = _helium_stand()
66 for symbol
in press_valves(session):
67 session.set_valve(symbol,
True)
69 def bottles() -> float:
70 return sum(b.state.mass
for b
in session.bottles.values())
72 def ullages() -> float:
74 s.state.ullage.mass + s.state.vapour_mass
for s
in session.tanks.values()
77 gave, kept = bottles(), ullages()
79 while session.t < seconds:
81 if session.t > seconds / 2:
82 p = [psig(s.pressure)
for s
in session.tanks.values()]
83 spread.append(
max(p) -
min(p))
84 return session, spread, gave - bottles(), ullages() - kept