def CalculatePerformance(self, dv, pressure): if self.sfb is None and self.liquidfuel is not None: # liquid fuel only self.performance = physics.lf_performance(dv, physics.engine_isp(self.mainengine, pressure), physics.engine_force(self.mainenginecount, self.mainengine, pressure), pressure, self.mass - self.liquidfuel, self.liquidfuel*8/9, 1/8) elif self.sfb is None and self.liquidfuel is None: # atomic fuel, monopropellant or xenon f_e = self.mainengine.f_e self.performance = physics.lf_performance(dv, physics.engine_isp(self.mainengine, pressure), physics.engine_force(self.mainenginecount, self.mainengine, pressure), pressure, self.mass - self.specialfuel, self.specialfuel/(1+f_e), f_e) else: # liquid fuel + solid fuel self.performance = physics.sflf_performance(dv, physics.engine_isp(self.mainengine, pressure), physics.engine_isp(self.sfb, pressure), physics.engine_force(self.mainenginecount, self.mainengine, pressure), physics.engine_force(self.sfbcount, self.sfb, pressure), pressure, self.mass - self.liquidfuel - self.sfbmountmass - self.sfbcount*self.sfb.m_full, self.liquidfuel*8/9, self.sfbmountmass, self.sfbcount*self.sfb.m_full, self.sfbcount*self.sfb.m_empty)
def CalculatePerformance(self, dv, pressure): if self.sfb is None and self.liquidfuel is not None: # liquid fuel only self.performance = physics.lf_performance( dv, physics.engine_isp(self.mainengine, pressure), physics.engine_force(self.mainenginecount, self.mainengine, pressure), pressure, self.mass - self.liquidfuel, self.liquidfuel * 8 / 9, 1 / 8) elif self.sfb is None and self.liquidfuel is None: # atomic fuel, monopropellant or xenon f_e = self.mainengine.f_e self.performance = physics.lf_performance( dv, physics.engine_isp(self.mainengine, pressure), physics.engine_force(self.mainenginecount, self.mainengine, pressure), pressure, self.mass - self.specialfuel, self.specialfuel / (1 + f_e), f_e) else: # liquid fuel + solid fuel self.performance = physics.sflf_performance( dv, physics.engine_isp(self.mainengine, pressure), physics.engine_isp(self.sfb, pressure), physics.engine_force(self.mainenginecount, self.mainengine, pressure), physics.engine_force(self.sfbcount, self.sfb, pressure), pressure, self.mass - self.liquidfuel - self.sfbmountmass - self.sfbcount * self.sfb.m_full, self.liquidfuel * 8 / 9, self.sfbmountmass, self.sfbcount * self.sfb.m_full, self.sfbcount * self.sfb.m_empty)
def CreateRadialLFESFBDesign(payload, pressure, dv, acc, eng, size, count, sfb, sfbcount): design = Design(payload, eng, count, size) design.AddSFB(sfb, sfbcount) lf = physics.sflf_needed_fuel(dv, physics.engine_isp(eng, pressure), physics.engine_isp(sfb, pressure), design.mass - design.sfbmountmass - sfbcount*sfb.m_full, design.sfbmountmass, sfbcount*sfb.m_full, sfbcount*sfb.m_empty) if lf is None: return None design.AddLiquidFuelTanks(9/8 * lf) design.CalculatePerformance(dv, pressure) if not design.EnoughAcceleration(acc): return None design.SetSFBLimit(pressure, acc) return design
def CreateSingleLFESFBDesign(payload, pressure, dv, acc, eng, sfb, sfbcount): design = Design(payload, eng, 1, eng.size) design.AddSFB(sfb, sfbcount) lf = physics.sflf_needed_fuel( dv, physics.engine_isp(eng, pressure), physics.engine_isp(sfb, pressure), design.mass - design.sfbmountmass - sfbcount * sfb.m_full, design.sfbmountmass, sfbcount * sfb.m_full, sfbcount * sfb.m_empty) if lf is None: return None design.AddLiquidFuelTanks(9 / 8 * lf) design.CalculatePerformance(dv, pressure) if not design.EnoughAcceleration(acc): return None design.SetSFBLimit(pressure, acc) 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 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