85 """Choked (x None: discharge to atmosphere) and not: ``fluids`` sizes the
86 valve for the flow this one passes, and returns this valve's Cv."""
88 p1 = from_psig(SET_PSI * 1.10)
90 p2 = ATMOSPHERE
if x
is None else p1 * (1.0 - x)
92 assert valve.is_choked(p1 - p2, flow)
93 mdot = valve.flow_ceiling(flow)
94 assert mdot == pytest.approx(valve.rated_capacity(flow), rel=1e-12)
96 assert not valve.is_choked(p1 - p2, flow)
98 gas =
GasCv(5.0, BORE_MM / 1e3, 0.70)
99 mdot = gas.flow(p1, flow.rho, flow.gamma_ideal, p1 - p2)
100 assert flow.gamma_ideal == pytest.approx(5.0 / 3.0, rel=1e-5)
101 assert valve.pressure_drop(mdot, flow) == pytest.approx(p1 - p2, rel=1e-9)
102 assert mdot
is not None and mdot > 0.0
103 molar_mass = 4.002602
104 rho_normal = ATMOSPHERE * molar_mass * 1e-3 / (8.314462618 * 273.15)
105 sized = size_control_valve_g(
110 Z=
Fluid(
"helium").get(
"Z", p=p1, T=293.15),
121 assert Kv_to_Cv(sized) == pytest.approx(5.0, rel=3e-3)
139 overpressure=
Param(0.10,
"-", Provenance.ESTIMATED,
"test"),
140 blowdown=
Param(0.07,
"-", Provenance.ESTIMATED,
"test"),
142 p_set = SET_PSI * PSI
143 reseat, full = 0.93 * p_set, 1.10 * p_set
144 assert valve.reseat_pressure == pytest.approx(reseat)
145 assert valve.full_lift_pressure == pytest.approx(full)
148 for fraction
in (0.5, 0.93, 0.99, 0.9999):
149 assert valve.lift_for(fraction * p_set, was_open=
False) == (0.0,
False)
150 lift, is_open = valve.lift_for(p_set, was_open=
False)
151 assert is_open
and lift == pytest.approx((p_set - reseat) / (full - reseat))
152 assert valve.lift_for(full,
True) == (1.0,
True)
153 assert valve.lift_for(1.3 * p_set,
True) == (1.0,
True)
155 lift, is_open = valve.lift_for(0.96 * p_set, was_open=
True)
156 assert is_open
and 0.0 < lift < 0.41
158 assert valve.lift_for(0.929 * p_set, was_open=
True) == (0.0,
False)
160 assert valve.lift_for(0.96 * p_set, was_open=
False) == (0.0,
False)
296 """The dome regulator failed wide open (dome above the bottle) into the fuel
297 tank alone, a relief set at 750 psig on the tank. Half full, so the ullage
298 is litres rather than the shipped 0.43 L and the test runs in seconds.
300 Below set the relief is shut. Failed open, the tank pops it and is held
301 under set + 10 % (the overpressure at which the valve is at full lift) with
302 the relief passing what the regulator delivers. Regulator restored, the tank
303 vents down *past* set to the reseating pressure before the valve shuts.
306 model = assemble_model(
309 session = open_session(model, load_machine(tables=TABLES), setup=burn_setup())
310 session.prime(fill_fraction=0.5, tank_psi=550.0, copv_psi=4500.0, state=
"Ready")
311 session.set_valve(
"SV_FUEL_PRESS",
True)
312 session.set_valve(
"SV_LOX_PRESS",
False)
313 tank = session.tanks[
"FUT"]
314 relief = model.built.network.branches[
"RV_FU"].component
315 assert isinstance(relief, ReliefValve)
316 p_set = from_psig(SET_PSI)
317 reseat = ATMOSPHERE + relief.reseat_pressure
318 full = ATMOSPHERE + relief.full_lift_pressure
321 return tank.state.ullage.mass + tank.state.vapour_mass
323 def run(seconds: float):
325 for _
in range(int(round(seconds / 0.02))):
327 sample = session.step(0.02)
331 sample.signals.get(
"RV-FUEL.lift", 0.0),
332 sample.flows.get(
"RV_FU", 0.0),
333 sample.flows.get(
"PR_D", 0.0),
334 (held() - before) / 0.02,
337 assert not session.tripped
342 assert all(p < p_set
for p, *_
in quiet)
343 assert all(lift == 0.0
and flow == 0.0
for _, lift, flow, *_
in quiet)
346 session.setup = replace(session.setup, dome_psi=6000.0)
348 peak =
max(p
for p, *_
in failed)
349 assert peak > p_set,
"the regulator never carried the tank to the relief"
350 assert peak < full, (peak / PSI, full / PSI)
353 assert peak < p_set + 0.5 * (full - p_set), (peak / PSI, full / PSI)
354 assert any(lift > 0.0
for _, lift, *_
in failed)
359 for p, lift, out, inflow, gained
in failed[-5:]:
360 assert 0.0 < lift < 1.0
361 assert 0.5 * inflow < out < inflow
362 assert inflow - out == pytest.approx(gained, rel=0.15, abs=1e-4)
365 session.setup = replace(session.setup, dome_psi=500.0)
367 shut_at = next(i
for i, (_, lift, *_)
in enumerate(restored)
if lift == 0.0)
368 assert restored[shut_at][0] < p_set - 0.5 * (p_set - reseat)
369 assert restored[shut_at][0] > reseat - 0.04 * (p_set - ATMOSPHERE)
370 assert all(lift == 0.0
and flow == 0.0
for _, lift, flow, *_
in restored[shut_at:])