def test_lf_needed_fuel(self): m_c = physics.lf_needed_fuel([1750, 580, 310, 792], 4 * [345], 1500, 1 / 8) self.assertAlmostEqual(m_c, 3378.94, places=1) m_c = physics.lf_needed_fuel([1750, 580, 310, 792], 3 * [345] + [300], 1500, 1 / 8) self.assertAlmostEqual(m_c, 3625.64, places=1)
def CreateRadialLFEnginesDesign(payload, pressure, dv, acc, eng, size, count): design = Design(payload, eng, count, size) lf = physics.lf_needed_fuel(dv, physics.engine_isp(eng, pressure), design.mass, 1/8) if lf is None: return None design.AddLiquidFuelTanks(9/8 * lf) design.CalculatePerformance(dv, pressure) if not design.EnoughAcceleration(acc): return None return design
def CreateRadialLFEnginesDesign(payload, pressure, dv, acc, eng, size, count): design = Design(payload, eng, count, size) lf = physics.lf_needed_fuel(dv, physics.engine_isp(eng, pressure), design.mass, 1 / 8) if lf is None: return None design.AddLiquidFuelTanks(9 / 8 * lf) design.CalculatePerformance(dv, pressure) if not design.EnoughAcceleration(acc): return None return design
def CreateMonoPropellantEngineDesign(payload, pressure, dv, acc, engine, tank, count): design = Design(payload, engine, count, tank.size) f_e = engine.f_e mp = physics.lf_needed_fuel(dv, physics.engine_isp(engine, pressure), design.mass, f_e) if mp is None: return None design.AddMonoPropellantTanks((1+f_e) * mp, tank) design.CalculatePerformance(dv, pressure) if not design.EnoughAcceleration(acc): return None return design
def CreateElectricPropulsionSystemDesign(payload, pressure, dv, acc): design = Design(payload, parts.ElectricPropulsionSystem, 1, parts.RadialSize.Tiny) f_e = parts.ElectricPropulsionSystem.f_e xf = physics.lf_needed_fuel(dv, physics.engine_isp(parts.ElectricPropulsionSystem, pressure), design.mass, f_e) if xf is None: return None design.AddXenonTanks((1+f_e) * xf) design.CalculatePerformance(dv, pressure) if not design.EnoughAcceleration(acc): return None return design
def CreateAtomicRocketMotorDesign(payload, pressure, dv, acc): design = Design(payload, parts.AtomicRocketMotor, 1, parts.RadialSize.Small) f_e = parts.AtomicRocketMotor.f_e af = physics.lf_needed_fuel(dv, physics.engine_isp(parts.AtomicRocketMotor, pressure), design.mass, f_e) if af is None: return None design.AddAtomicFuelTanks((1+f_e) * af) design.CalculatePerformance(dv, pressure) if not design.EnoughAcceleration(acc): return None return design
def CreateMonoPropellantEngineDesign(payload, pressure, dv, acc, engine, tank, count): design = Design(payload, engine, count, tank.size) f_e = engine.f_e mp = physics.lf_needed_fuel(dv, physics.engine_isp(engine, pressure), design.mass, f_e) if mp is None: return None design.AddMonoPropellantTanks((1 + f_e) * mp, tank) design.CalculatePerformance(dv, pressure) if not design.EnoughAcceleration(acc): return None return design
def CreateElectricPropulsionSystemDesign(payload, pressure, dv, acc): design = Design(payload, parts.ElectricPropulsionSystem, 1, parts.RadialSize.Tiny) f_e = parts.ElectricPropulsionSystem.f_e xf = physics.lf_needed_fuel( dv, physics.engine_isp(parts.ElectricPropulsionSystem, pressure), design.mass, f_e) if xf is None: return None design.AddXenonTanks((1 + f_e) * xf) design.CalculatePerformance(dv, pressure) if not design.EnoughAcceleration(acc): return None return design
def CreateAtomicRocketMotorDesign(payload, pressure, dv, acc): design = Design(payload, parts.AtomicRocketMotor, 1, parts.RadialSize.Small) f_e = parts.AtomicRocketMotor.f_e af = physics.lf_needed_fuel( dv, physics.engine_isp(parts.AtomicRocketMotor, pressure), design.mass, f_e) if af is None: return None design.AddAtomicFuelTanks((1 + f_e) * af) design.CalculatePerformance(dv, pressure) if not design.EnoughAcceleration(acc): return None return design
def test_lf_needed_fuel(self): m_c = physics.lf_needed_fuel([1750, 580, 310, 792], 4*[345], 1500, 1/8) self.assertAlmostEqual(m_c, 3378.94, places=1) m_c = physics.lf_needed_fuel([1750, 580, 310, 792], 3*[345]+[300], 1500, 1/8) self.assertAlmostEqual(m_c, 3625.64, places=1)