def __init__(self, initial_pos, initial_vel, atmosphere): # setup physical properties radius = 3.66 / 2 # meters # ignore the side boosters for now - and use fins with a drag and lift # curve area = math.pi * radius**2 # I'm not sure about these numbers. Not sure why thrust is ~20x weight # fully loaded. For now set throttle to 5 or 6% to get realistic # acceleration mass = 1420000 / 9.8 # kg thrust = 22241102 # N length = 70 # m # cylinder # 1/12 * mass * length^2 + 1/4 * mass * radius^2 moment = 1 / 12 * mass * length**2 + 1 / 4 * mass * radius**2 state = physics.State(position=initial_pos, velocity=initial_vel, orientation=Angle(90)) Airplane.__init__(self, state, mass, moment, atmosphere) # setup aerodynamic properties drag_curve = drag.Parasitic(.35) surface = flight.Surface("rocket", atmosphere=atmosphere, drag_curve=drag_curve, area=area) stab_lift_curve = lift.LiftingLine(3.62) stab_drag_curve = drag.LiftingLine(3.62, efficiency_factor=0.6) stab = Surface("stabilizer", Vector2D(-33, 0), 0, Angle(0), 136, stab_lift_curve, stab_drag_curve, atmosphere) self._surfaces = [surface, stab] engine = Engine("1d merlin", Vector2D(-21, 0), Angle(0), 0, thrust) engine.set_throttle(100) self._engines = [engine]
def __init__(self, position, velocity): atmosphere = Atmosphere() state = State(position, velocity, Angle(0), 0) Airplane.__init__(self, state, self._mass(), self._mass_moment_of_inertia(), atmosphere) wing_lift_curve = lift.Linear(6.98, 0.29, 5.5) wing_drag_curve = drag.LiftingLine(6.98, 0.0305, 0.75) self._wing = Surface("wing", Vector2D(0, 0), 0, Angle(2.4), 510.97, wing_lift_curve, wing_drag_curve, atmosphere) stab_lift_curve = lift.LiftingLine(3.62) stab_drag_curve = drag.LiftingLine(3.62, efficiency_factor=0.6) self._horizontal_stabilizer = Surface("stabilizer", Vector2D(-33, 0), 0, Angle(0), 136, stab_lift_curve, stab_drag_curve, atmosphere) fusilage_drag_curve = drag.Parasitic(0.27) # 747 cabin = ~19x6 meters self._fusilage = Surface("fusilage", self.cg(), 0, Angle(0), 118, None, fusilage_drag_curve, atmosphere) self._surfaces = [] self._surfaces.append(self._wing) self._surfaces.append(self._horizontal_stabilizer) self._surfaces.append(self._fusilage) # don't have yaw forces (or a 3rd axis) to put engines out on wings # so they all go at cg self._engines = [] self._engines.append(Engine("engine 1", self.cg(), Angle(0), 0, 275000)) self._engines.append(Engine("engine 2", self.cg(), Angle(0), 0, 275000)) self._engines.append(Engine("engine 3", self.cg(), Angle(0), 0, 275000)) self._engines.append(Engine("engine 4", self.cg(), Angle(0), 0, 275000))
def test_cla_lifting_line(self): lift_curve = lift.LiftingLine(7.37) self.assertAlmostEqual(4.942, lift_curve.lift_slope_3d, 3)
def get_cessna_wing(self): wing_lift_curve = lift.LiftingLine(7.37) wing_drag_curve = drag.LiftingLine(7.37, 0.027, 0.75) return Surface("cessna 172 wing", Vector2D(0, 0), 0, Angle(0), 16.2, wing_lift_curve, wing_drag_curve, Atmosphere())
def get_cessna_lift_curve(self): return lift.LiftingLine(7.37)