25 t = np.linspace(0.0, BURN_S, n)
26 F = 6500.0 + (6601.9 - 6500.0) * t / BURN_S
27 md = 2.7976 + (2.8550 - 2.7976) * t / BURN_S
28 return t, F, md * OF / (1 + OF), md / (1 + OF)
42def roomy_tanks(cfg, load_factor: float = 1.001, fill: float = 0.8):
43 """Tanks sized so the curve's own propellant fills them to `fill`: no cap can bite."""
45 cfg.design_requirements.lox_tank_capacity_kg =
None
46 cfg.design_requirements.fuel_tank_capacity_kg =
None
47 for sec, h, r, m, rho
in (
48 (cfg.lox_tank,
"lox_h",
"lox_radius", IO, cfg.fluids[
"oxidizer"].density),
49 (cfg.fuel_tank,
"rp1_h",
"rp1_radius", IF, cfg.fluids[
"fuel"].density),
51 V = m * load_factor / rho / fill
52 sec.tank_volume_m3 = V
53 setattr(sec, h, V / (math.pi * getattr(sec, r) ** 2))
57def fly(cfg, curve=None):
58 """ui.flight_sim.setup_flight on the curve, quietly."""
59 from scipy.interpolate
import interp1d
63 cfg = copy.deepcopy(cfg)
64 cfg.thrust.burn_time = float(t[-1])
65 f =
lambda y: interp1d(t, y, bounds_error=
False, fill_value=0.0)
66 with contextlib.redirect_stdout(io.StringIO()):
67 return setup_flight(cfg, f(F), f(mO), f(mF))