39 """Quantifies the defect on the 180 lb / 11 L point, so the fix has a number on it.
41 Two different numbers, and they are not the same size -- worth keeping straight:
43 * the IDEAL rocket equation gains ~51 m/s from flying 1.551 kg of gas as propellant;
44 * the SIMULATED trajectory only gained 183 ft of apogee (12522 -> 12339 ft at
45 eta_c* 0.9315, measured A/B on this vehicle).
47 The trajectory effect is far smaller because the mass comes off gradually and the
48 flight is drag-dominated at Mach 0.87. Do not quote the 51 m/s as an apogee error.
50 m_wet, m_prop, m_gas = 180 * 0.45359237, 10.7375, 1.551
51 isp_eff = 238.72 * 9.80665
52 dv_wrong = isp_eff * math.log(m_wet / (m_wet - m_prop - m_gas))
53 dv_right = isp_eff * math.log(m_wet / (m_wet - m_prop))
54 assert dv_wrong > dv_right,
"expelling the gas must inflate the mass ratio"
55 assert dv_wrong - dv_right == pytest.approx(51.0, abs=2.0), (
56 f
"ideal-dv overstatement changed: {dv_wrong - dv_right:.1f} m/s"
59 apogee_bug_ft, apogee_fixed_ft = 12522.0, 12339.0
60 assert apogee_bug_ft > apogee_fixed_ft
61 assert (apogee_bug_ft / apogee_fixed_ft - 1) == pytest.approx(0.0148, abs=0.004), (
62 "the simulated apogee inflation was 1.5 %, not the 15 % the rocket equation implies"
112 """A flat 0.01 kg added ALONGSIDE the liquid over-filled the COPV.
114 With density derived as m_pressurant/V, the tank then held m_pressurant + 0.01 kg =
115 0.0050322 m3 in a 0.0050000 m3 bottle, and RocketPy rejected it:
116 "Input Function image (0.00503...) must be within the domain (0.0, 0.005)".
118 src = FLIGHT_SIM.read_text()
119 assert "initial_gas_mass=0.01," not in src,
"the additive 0.01 kg stub is back"
120 assert "initial_liquid_mass=max(0.0, m_pressurant - 1.0e-4)," in src
121 assert "initial_gas_mass=1.0e-4," in src
126 assert (m + 0.01) / rho == pytest.approx(0.0050322, abs=1e-6),
"the overflow"
127 assert (m + 0.01) / rho > V,
"additive stub must exceed the tank"
128 assert m / rho == pytest.approx(V, rel=1e-12),
"taking the stub out of m conserves volume"