Exemple #1
0
 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)
Exemple #2
0
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
Exemple #3
0
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
Exemple #4
0
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
Exemple #5
0
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
Exemple #6
0
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
Exemple #7
0
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
Exemple #8
0
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
Exemple #9
0
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
Exemple #10
0
 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)