# Initialize B-2 Spirit plane object plane = Plane(1420000, 52.4, 9.1, 0.0090, 0.92, 1.22) # Generate data at requested altitudes altitudes = [] speed_const_Cl = [] speed_stall = [] drag_const_Cl = [] drag_210 = [] for i in range(0, 20001, 500): plane.set_altitude(i) altitudes.append(i) density = atm.density_at(i) speed_stall.append(plane.speed_stall()) speed = plane.speed(plane.Cl_min_drag) speed_const_Cl.append(speed) Cd_min = plane.Cd(plane.Cd_i(plane.Cl_min_drag)) drag_const_Cl.append(plane.drag(Cd_min, speed)) speed = 210 # m/s Cd = plane.Cd(plane.Cd_i(plane.Cl(speed))) drag_210.append(plane.drag(Cd, speed)) # Reformat as Strings alt_str = ['%d' % i for i in altitudes] v_const_Cl_str = ['%.1f' % i for i in speed_const_Cl] d_const_Cl_str = ['%.2f' % (i / 1000.0) for i in drag_const_Cl] d_210_str = ['%.2f' % (i / 1000.0) for i in drag_210]
T_a_Drag_min_Ratios = [] for i in range(0, 20001, 500): altitudes.append(i) density = atm.density_at(i) speed = plane.speed(plane.Cl_min_drag) Cd_min = plane.Cd(plane.Cd_i(plane.Cl_min_drag)) drag_min = plane.drag(Cd_min, speed) thrust_avail = plane.jet_thrust_available() thrust_drag_ratio = thrust_avail / drag_min T_a_Drag_min_Ratios.append(thrust_drag_ratio) speed_stall = plane.speed_stall() Cl_stall = plane.Cl(speed_stall) Cd_stall = plane.Cd(plane.Cd_i(Cl_stall)) stall_drags.append(plane.drag(Cd_stall, speed_stall)) plt.cla() plt.clf() plt.plot(altitudes, T_a_Drag_min_Ratios) plt.title('T_a/D_min Ratio vs. Altitude') plt.xlabel('Altitude [m]') plt.ylabel('T_a/D_min Ratio') plt.show() """QUESTION 5""" plt.cla() plt.clf() plt.plot(altitudes, stall_drags)