chord=339 / 51.8, span=51.8, Cl_max=1.4, Lam=35.0, tc_max=0.12, W_0=2710000, W_fuel=None, cj=None, T_a_sl=800000, atmosphere=std_atm_earth()) """QUESTION 1 PLOT""" plane.set_altitude(0) # meters T_a = plane.jet_thrust_available() # N V_limits = plane.speed_min_max(T_a) # m/s V_range = np.arange(V_limits[0, 0], V_limits[1, 0] + 5, 5) Cd_inc = plane.Cd(plane.Cd_i(plane.Cl(V_range))) Cd_com = Cd_inc + plane.Cd_c(plane.Cl(V_range), V_range) D_inc = plane.drag(Cd_inc, V_range) / 1000 D_com = plane.drag(Cd_com, V_range) / 1000 plt.plot(V_range, D_inc, '-r', label='Drag (incompressible)') plt.plot(V_range, D_com, '--r', label='Drag (compressible)') plt.plot(V_range, [T_a / 1000 for i in range(V_range.shape[0])], '-b', label='Thrust Available') plt.xlim(V_range.min() - 10, V_range.max() + 10) plt.ylim(D_inc.min() - 50, D_inc.max() + 10) plt.title('Drag vs Velocity for MD-11 at Sea Level') plt.xlabel('Velocity [m/s]')
if __name__ == '__main__': from haydens_code.atmosphere import std_atm_earth from haydens_code.plane import Plane # Initialize The Global Flyer plane object plane = Plane( Cd_0=0.016, Em=None, e=0.94, chord=37.2 / 34.8,# MAC span=34.8, Cl_max=1.2, Lam=None, tc_max=None, W_0=98000, W_1=14900, cj=0.42, T_a_sl=10200, atmosphere=std_atm_earth() ) plane.set_altitude_range(500, 10000, 100) drag = plane.drag(plane.Cd(plane.Cd_i(plane.Cl(80))), 80) t_a = plane.jet_thrust_available() R_C = 80*(t_a - drag)/98000 print(R_C) plane.set_altitude(10000) print(plane.jet_thrust_available()) print(plane.speed_min_max(plane.jet_thrust_available()))
Lam=31.6, tc_max=0.13, W_0=2380000, W_1=None, cj=None, T_a_sl=342000 * 2, atmosphere=std_atm_earth()) """QUESTION 1 and 2 PLOTS ---------------------------------------------------------------------------------------""" # FOR 0m -------------------------------------------------------------------------------------------------------- # compute velocity range plane.set_altitude(0) # meters T_a = plane.jet_thrust_available() # N V_limits = plane.speed_min_max(T_a) # m/s V_range = np.arange(V_limits[0, 0], V_limits[1, 0] + 5, 5) # compute drag Cd_inc = plane.Cd(plane.Cd_i(plane.Cl(V_range))) Cd_com = Cd_inc + plane.Cd_c(plane.Cl(V_range), V_range) D_inc = plane.drag(Cd_inc, V_range) D_com = plane.drag(Cd_com, V_range) # compute R/C RC_inc = plane.rate_of_climb(D_inc, V_range) RC_com = plane.rate_of_climb(D_com, V_range) print('% Difference (R/C max @ 0km), Incompressible and Compressible: {}'. format(100 * (RC_inc.max() - RC_com.max()) / RC_inc.max())) # plot plt.plot(V_range / plane.sound_speed, RC_inc, '-r', label='R/C (incompressible), 0m') plt.plot(V_range / plane.sound_speed, RC_com,
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] data = [[a, v_Cl, d_Cl, d_210] for a, v_Cl, d_Cl, d_210 in zip( alt_str, v_const_Cl_str, d_const_Cl_str, d_210_str)]
plane = Plane(145000, 17.6, 2.676, 0.032, 0.87, 1.2, 80000) """QUESTION 1 - PART A""" altitude = 11500 # m plane.set_altitude(altitude) density = atm.density_at(altitude) thrust_avail = plane.jet_thrust_available() # Generate data at requested velocities speeds = [] lift_coeffs = [] drag_coeffs = [] drags = [] for speed in range(20, 301, 5): Cl = plane.Cl(speed) Cd = plane.Cd(plane.Cd_i(plane.Cl(speed))) drag = plane.drag(Cd, speed) speeds.append(speed) lift_coeffs.append(Cl) drag_coeffs.append(Cd) drags.append(drag) # Start working with matplotlib to view data from matplotlib import pyplot as plt from matplotlib.font_manager import FontProperties plt.plot(speeds, drags, '-r', label='T_r') # plt.title('Drag vs. Velocity at 500m') plt.xlabel('Velocity [m/s]') plt.ylabel('Drag (T_r) [N]')