def main(): vehicle = vehicle_setup() configs = configs_setup(vehicle) # --- Takeoff Configuration --- configuration = configs.takeoff configuration.wings['main_wing'].flaps_angle = 20. * Units.deg configuration.wings['main_wing'].slats_angle = 25. * Units.deg configuration.V2_VS_ratio = 1.21 analyses = SUAVE.Analyses.Analysis.Container() analyses = base_analysis(configuration) analyses.aerodynamics.settings.maximum_lift_coefficient_factor = 0.90 # --- Airport definition --- airport = SUAVE.Attributes.Airports.Airport() airport.tag = 'airport' airport.altitude = 0.0 * Units.ft airport.delta_isa = 0.0 airport.atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976() # Set Tofl target_tofl = 1487.92650289 # Compute take off weight given tofl max_tow = find_take_off_weight_given_tofl(configuration, analyses, airport, target_tofl) truth_max_tow = 46656.50026628 max_tow_error = np.max(np.abs(max_tow[0] - truth_max_tow)) print('Range Error = %.4e' % max_tow_error) assert (max_tow_error < 1e-6) return
def main(): # ---------------------------------------------------------------------- # Main # ---------------------------------------------------------------------- # --- Vehicle definition --- vehicle = vehicle_setup() configs=configs_setup(vehicle) # --- Landing Configuration --- landing_config = configs.landing landing_config.wings['main_wing'].flaps.angle = 30. * Units.deg landing_config.wings['main_wing'].slats.angle = 25. * Units.deg landing_config.wings['main_wing'].high_lift = True # Vref_V2_ratio may be informed by user. If not, use default value (1.23) landing_config.Vref_VS_ratio = 1.23 # CLmax for a given configuration may be informed by user # landing_config.maximum_lift_coefficient = 2.XX # Used defined ajust factor for maximum lift coefficient landing_config.max_lift_coefficient_factor = 0.90 # --- Airport definition --- airport = SUAVE.Attributes.Airports.Airport() airport.tag = 'airport' airport.altitude = 0.0 * Units.ft airport.delta_isa = 0.0 airport.atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976() # ===================================== # Landing field length evaluation # ===================================== w_vec = np.linspace(20000.,44000.,10) landing_field_length = np.zeros_like(w_vec) for id_w,weight in enumerate(w_vec): landing_config.mass_properties.landing = weight landing_field_length[id_w] = estimate_landing_field_length(landing_config,landing_config,airport) truth_LFL = np.array( [ 723.67022689 , 786.82625714 , 849.98228739 , 913.13831764 , 976.29434789 , 1039.45037815 , 1102.6064084 , 1165.76243865 , 1228.9184689 , 1292.07449915]) LFL_error = np.max(np.abs(landing_field_length-truth_LFL)) print('Maximum Landing Field Length Error= %.4e' % LFL_error) title = "LFL vs W" plt.figure(1); plt.plot(w_vec,landing_field_length, 'k-', label = 'Landing Field Length') plt.title(title); plt.grid(True) plt.figure(1); plt.plot(w_vec,truth_LFL, label = 'Landing Field Length (true)') legend = plt.legend(loc='lower right', shadow = 'true') plt.xlabel('Weight (kg)') plt.ylabel('Landing Field Length (m)') #assert( LFL_error < 1e-5 ) return
def main(): # ---------------------------------------------------------------------- # Main # ---------------------------------------------------------------------- # --- Vehicle definition --- vehicle = vehicle_setup() configs=configs_setup(vehicle) # --- Landing Configuration --- landing_config = configs.landing landing_config.wings['main_wing'].flaps.angle = 30. * Units.deg landing_config.wings['main_wing'].slats.angle = 25. * Units.deg landing_config.wings['main_wing'].high_lift = True # Vref_V2_ratio may be informed by user. If not, use default value (1.23) landing_config.Vref_VS_ratio = 1.23 # CLmax for a given configuration may be informed by user # landing_config.maximum_lift_coefficient = 2.XX # Used defined ajust factor for maximum lift coefficient landing_config.max_lift_coefficient_factor = 0.90 # --- Airport definition --- airport = SUAVE.Attributes.Airports.Airport() airport.tag = 'airport' airport.altitude = 0.0 * Units.ft airport.delta_isa = 0.0 airport.atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976() # ===================================== # Landing field length evaluation # ===================================== w_vec = np.linspace(20000.,44000.,10) landing_field_length = np.zeros_like(w_vec) for id_w,weight in enumerate(w_vec): landing_config.mass_properties.landing = weight landing_field_length[id_w] = estimate_landing_field_length(landing_config,landing_config,airport) truth_LFL = np.array( [ 723.67022689 , 786.82625714 , 849.98228739 , 913.13831764 , 976.29434789 , 1039.45037815 , 1102.6064084 , 1165.76243865 , 1228.9184689 , 1292.07449915]) LFL_error = np.max(np.abs(landing_field_length-truth_LFL)) print 'Maximum Landing Field Length Error= %.4e' % LFL_error title = "LFL vs W" plt.figure(1); plt.hold plt.plot(w_vec,landing_field_length, 'k-', label = 'Landing Field Length') plt.title(title); plt.grid(True) plt.figure(1); plt.plot(w_vec,truth_LFL, label = 'Landing Field Length (true)') legend = plt.legend(loc='lower right', shadow = 'true') plt.xlabel('Weight (kg)') plt.ylabel('Landing Field Length (m)') #assert( LFL_error < 1e-5 ) return
def full_setup(): # vehicle data vehicle = vehicle_setup() configs = configs_setup(vehicle) # vehicle analyses configs_analyses = analyses_setup(configs) # mission analyses mission = mission_setup(configs_analyses) analyses = SUAVE.Analyses.Analysis.Container() analyses.configs = configs_analyses analyses.missions = mission return configs, analyses
def full_setup(): # vehicle data vehicle = vehicle_setup() configs = configs_setup(vehicle) # vehicle analyses configs_analyses = analyses_setup(configs) # mission analyses mission = mission_setup(configs_analyses) analyses = SUAVE.Analyses.Analysis.Container() analyses.configs = configs_analyses analyses.missions = mission return configs, analyses
def setup(): nexus = Nexus() problem = Data() nexus.optimization_problem = problem # ------------------------------------------------------------------- # Inputs # ------------------------------------------------------------------- # [ tag , initial, (lb,ub) , scaling , units ] problem.inputs = np.array([ [ 'wing_area' , 95 , ( 90. , 130. ) , 100. , Units.meter**2], [ 'cruise_altitude' , 11 , ( 9 , 14. ) , 10. , Units.km], ]) # ------------------------------------------------------------------- # Objective # ------------------------------------------------------------------- # throw an error if the user isn't specific about wildcards # [ tag, scaling, units ] problem.objective = np.array([ [ 'fuel_burn', 10000, Units.kg ] ]) # ------------------------------------------------------------------- # Constraints # ------------------------------------------------------------------- # [ tag, sense, edge, scaling, units ] problem.constraints = np.array([ [ 'design_range_fuel_margin' , '>', 0., 1E-1, Units.less], #fuel margin defined here as fuel ]) # ------------------------------------------------------------------- # Aliases # ------------------------------------------------------------------- # [ 'alias' , ['data.path1.name','data.path2.name'] ] problem.aliases = [ [ 'wing_area' , ['vehicle_configurations.*.wings.main_wing.areas.reference', 'vehicle_configurations.*.reference_area' ]], [ 'cruise_altitude' , 'missions.base.segments.climb_5.altitude_end' ], [ 'fuel_burn' , 'summary.base_mission_fuelburn' ], [ 'design_range_fuel_margin' , 'summary.max_zero_fuel_margin' ], ] # ------------------------------------------------------------------- # Vehicles # ------------------------------------------------------------------- vehicle = vehicle_setup() nexus.vehicle_configurations = configs_setup(vehicle) # ------------------------------------------------------------------- # Analyses # ------------------------------------------------------------------- nexus.analyses = Analyses2.setup(nexus.vehicle_configurations) # ------------------------------------------------------------------- # Missions # ------------------------------------------------------------------- nexus.missions = Missions2.setup(nexus.analyses) # ------------------------------------------------------------------- # Procedure # ------------------------------------------------------------------- nexus.procedure = Procedure2.setup() # ------------------------------------------------------------------- # Summary # ------------------------------------------------------------------- nexus.summary = Data() return nexus
def main(): # ---------------------------------------------------------------------- # Main # ---------------------------------------------------------------------- # --- Vehicle definition --- vehicle = vehicle_setup() configs = configs_setup(vehicle) # --- Landing Configuration --- landing_config = configs.landing landing_config.wings[ 'main_wing'].control_surfaces.flap.deflection = 30. * Units.deg landing_config.wings[ 'main_wing'].control_surfaces.slat.deflection = 25. * Units.deg landing_config.wings['main_wing'].high_lift = True # Vref_V2_ratio may be informed by user. If not, use default value (1.23) landing_config.Vref_VS_ratio = 1.23 # CLmax for a given configuration may be informed by user # Used defined ajust factor for maximum lift coefficient analyses = base_analysis(vehicle) analyses.aerodynamics.settings.maximum_lift_coefficient_factor = 0.90 # --- Airport definition --- airport = SUAVE.Attributes.Airports.Airport() airport.tag = 'airport' airport.altitude = 0.0 * Units.ft airport.delta_isa = 0.0 airport.atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976() # ===================================== # Landing field length evaluation # ===================================== w_vec = np.linspace(20000., 44000., 10) landing_field_length = np.zeros_like(w_vec) for id_w, weight in enumerate(w_vec): landing_config.mass_properties.landing = weight landing_field_length[id_w] = estimate_landing_field_length( landing_config, analyses, airport) truth_LFL = np.array([ 736.09211533, 800.90439737, 865.71667941, 930.52896146, 995.3412435, 1060.15352554, 1124.96580759, 1189.77808963, 1254.59037167, 1319.40265372 ]) LFL_error = np.max(np.abs(landing_field_length - truth_LFL)) assert (LFL_error < 1e-6) print('Maximum Landing Field Length Error= %.4e' % LFL_error) title = "LFL vs W" plt.figure(1) plt.plot(w_vec, landing_field_length, 'k-', label='Landing Field Length') plt.title(title) plt.grid(True) plt.figure(1) plt.plot(w_vec, truth_LFL, label='Landing Field Length (true)') legend = plt.legend(loc='lower right', shadow='true') plt.xlabel('Weight (kg)') plt.ylabel('Landing Field Length (m)') #assert( LFL_error < 1e-5 ) return
def main(): # ---------------------------------------------------------------------- # Main # ---------------------------------------------------------------------- vehicle = vehicle_setup() configs = configs_setup(vehicle) # --- Takeoff Configuration --- configuration = configs.takeoff configuration.wings['main_wing'].flaps_angle = 20. * Units.deg configuration.wings['main_wing'].slats_angle = 25. * Units.deg # V2_V2_ratio may be informed by user. If not, use default value (1.2) configuration.V2_VS_ratio = 1.21 analyses = SUAVE.Analyses.Analysis.Container() analyses = base_analysis(vehicle) analyses.aerodynamics.settings.maximum_lift_coefficient_factor = 0.90 # CLmax for a given configuration may be informed by user # configuration.maximum_lift_coefficient = 2.XX # --- Airport definition --- airport = SUAVE.Attributes.Airports.Airport() airport.tag = 'airport' airport.altitude = 0.0 * Units.ft airport.delta_isa = 0.0 airport.atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976() w_vec = np.linspace(40000., 52000., 10) engines = (2, 3, 4) takeoff_field_length = np.zeros((len(w_vec), len(engines))) second_seg_clb_grad = np.zeros((len(w_vec), len(engines))) compute_clb_grad = 1 # flag for Second segment climb estimation for id_eng, engine_number in enumerate(engines): configuration.propulsors.turbofan.number_of_engines = engine_number for id_w, weight in enumerate(w_vec): configuration.mass_properties.takeoff = weight takeoff_field_length[id_w,id_eng],second_seg_clb_grad[id_w,id_eng] = \ estimate_take_off_field_length(configuration,analyses,airport,compute_clb_grad) truth_TOFL = np.array([[1132.02796293, 735.9383927, 532.69742204], [1197.35974193, 774.67804758, 560.33363101], [1265.59738094, 814.98266121, 589.04125774], [1336.81070755, 856.87662796, 618.83286389], [1411.07189875, 900.38501278, 649.7212839], [1488.45551849, 945.53356385, 681.71963124], [1569.03855498, 992.34872487, 714.84130444], [1652.90045778, 1040.85764732, 749.09999299], [1740.12317463, 1091.08820251, 784.50968324], [1830.79118831, 1143.06899356, 821.08466403]]) print(' takeoff_field_length = ', takeoff_field_length) print(' second_seg_clb_grad = ', second_seg_clb_grad) truth_clb_grad = np.array([[0.06842616, 0.24573587, 0.42304558], [0.0624858, 0.23365346, 0.40482112], [0.05691173, 0.22233091, 0.38775008], [0.05167129, 0.21169929, 0.3717273], [0.04673554, 0.20169777, 0.35666], [0.04207879, 0.19227239, 0.34246598], [0.03767816, 0.18337517, 0.32907217], [0.03351319, 0.17496329, 0.31641339], [0.02956553, 0.16699843, 0.30443134], [0.02581868, 0.15944617, 0.29307367]]) TOFL_error = np.max(np.abs(truth_TOFL - takeoff_field_length) / truth_TOFL) GRAD_error = np.max( np.abs(truth_clb_grad - second_seg_clb_grad) / truth_clb_grad) print('Maximum Take OFF Field Length Error= %.4e' % TOFL_error) print('Second Segment Climb Gradient Error= %.4e' % GRAD_error) import pylab as plt title = "TOFL vs W" plt.figure(1) plt.plot(w_vec, takeoff_field_length[:, 0], 'k-', label='2 Engines') plt.plot(w_vec, takeoff_field_length[:, 1], 'r-', label='3 Engines') plt.plot(w_vec, takeoff_field_length[:, 2], 'b-', label='4 Engines') plt.title(title) plt.grid(True) plt.plot(w_vec, truth_TOFL[:, 0], 'k--o', label='2 Engines [truth]') plt.plot(w_vec, truth_TOFL[:, 1], 'r--o', label='3 Engines [truth]') plt.plot(w_vec, truth_TOFL[:, 2], 'b--o', label='4 Engines [truth]') legend = plt.legend(loc='lower right', shadow='true') plt.xlabel('Weight (kg)') plt.ylabel('Takeoff field length (m)') title = "2nd Segment Climb Gradient vs W" plt.figure(2) plt.plot(w_vec, second_seg_clb_grad[:, 0], 'k-', label='2 Engines') plt.plot(w_vec, second_seg_clb_grad[:, 1], 'r-', label='3 Engines') plt.plot(w_vec, second_seg_clb_grad[:, 2], 'b-', label='4 Engines') plt.title(title) plt.grid(True) plt.plot(w_vec, truth_clb_grad[:, 0], 'k--o', label='2 Engines [truth]') plt.plot(w_vec, truth_clb_grad[:, 1], 'r--o', label='3 Engines [truth]') plt.plot(w_vec, truth_clb_grad[:, 2], 'b--o', label='4 Engines [truth]') legend = plt.legend(loc='lower right', shadow='true') plt.xlabel('Weight (kg)') plt.ylabel('Second Segment Climb Gradient (%)') assert (TOFL_error < 1e-6) assert (GRAD_error < 1e-6) return
def main(): # ---------------------------------------------------------------------- # Main # ---------------------------------------------------------------------- vehicle = vehicle_setup() configs = configs_setup(vehicle) # --- Takeoff Configuration --- configuration = configs.takeoff configuration.wings['main_wing'].flaps_angle = 20. * Units.deg configuration.wings['main_wing'].slats_angle = 25. * Units.deg # V2_V2_ratio may be informed by user. If not, use default value (1.2) configuration.V2_VS_ratio = 1.21 configuration.max_lift_coefficient_factor = 0.90 analyses = SUAVE.Analyses.Analysis.Container() analyses.base = base_analysis(vehicle) # CLmax for a given configuration may be informed by user # configuration.maximum_lift_coefficient = 2.XX # --- Airport definition --- airport = SUAVE.Attributes.Airports.Airport() airport.tag = 'airport' airport.altitude = 0.0 * Units.ft airport.delta_isa = 0.0 airport.atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976() w_vec = np.linspace(40000., 52000., 10) engines = (2, 3, 4) takeoff_field_length = np.zeros((len(w_vec), len(engines))) second_seg_clb_grad = np.zeros((len(w_vec), len(engines))) compute_clb_grad = 1 # flag for Second segment climb estimation for id_eng, engine_number in enumerate(engines): configuration.propulsors.turbofan.number_of_engines = engine_number for id_w, weight in enumerate(w_vec): configuration.mass_properties.takeoff = weight takeoff_field_length[id_w,id_eng],second_seg_clb_grad[id_w,id_eng] = \ estimate_take_off_field_length(configuration,analyses,airport,compute_clb_grad) truth_TOFL = np.array([[1188.96105839, 769.70626688, 556.7892293], [1258.89622705, 811.03166826, 586.22911148], [1331.98245573, 854.04157057, 616.81833361], [1408.2986729, 898.76345152, 648.5709987], [1487.92650289, 945.22556064, 681.5015251], [1570.95030987, 993.45693386, 715.62465361], [1657.45724176, 1043.48740797, 750.95545452], [1747.53727375, 1095.34763481, 787.50933445], [1841.28325183, 1149.06909545, 825.30204308], [1938.7909361, 1204.68411412, 864.34967986]]) print(' takeoff_field_length = ', takeoff_field_length) print(' second_seg_clb_grad = ', second_seg_clb_grad) truth_clb_grad = np.array([[0.0802881, 0.25686068, 0.43343326], [0.07416381, 0.2446121, 0.41506038], [0.0684322, 0.23314888, 0.39786556], [0.06305712, 0.22239872, 0.38174032], [0.05800668, 0.21229785, 0.36658901], [0.0532527, 0.20278987, 0.35232705], [0.04877011, 0.19382471, 0.3388793], [0.04453662, 0.18535773, 0.32617884], [0.04053228, 0.17734905, 0.31416581], [0.03673921, 0.16976291, 0.3027866]]) TOFL_error = np.max(np.abs(truth_TOFL - takeoff_field_length) / truth_TOFL) GRAD_error = np.max( np.abs(truth_clb_grad - second_seg_clb_grad) / truth_clb_grad) print('Maximum Take OFF Field Length Error= %.4e' % TOFL_error) print('Second Segment Climb Gradient Error= %.4e' % GRAD_error) import pylab as plt title = "TOFL vs W" plt.figure(1) plt.plot(w_vec, takeoff_field_length[:, 0], 'k-', label='2 Engines') plt.plot(w_vec, takeoff_field_length[:, 1], 'r-', label='3 Engines') plt.plot(w_vec, takeoff_field_length[:, 2], 'b-', label='4 Engines') plt.title(title) plt.grid(True) plt.plot(w_vec, truth_TOFL[:, 0], 'k--o', label='2 Engines [truth]') plt.plot(w_vec, truth_TOFL[:, 1], 'r--o', label='3 Engines [truth]') plt.plot(w_vec, truth_TOFL[:, 2], 'b--o', label='4 Engines [truth]') legend = plt.legend(loc='lower right', shadow='true') plt.xlabel('Weight (kg)') plt.ylabel('Takeoff field length (m)') title = "2nd Segment Climb Gradient vs W" plt.figure(2) plt.plot(w_vec, second_seg_clb_grad[:, 0], 'k-', label='2 Engines') plt.plot(w_vec, second_seg_clb_grad[:, 1], 'r-', label='3 Engines') plt.plot(w_vec, second_seg_clb_grad[:, 2], 'b-', label='4 Engines') plt.title(title) plt.grid(True) plt.plot(w_vec, truth_clb_grad[:, 0], 'k--o', label='2 Engines [truth]') plt.plot(w_vec, truth_clb_grad[:, 1], 'r--o', label='3 Engines [truth]') plt.plot(w_vec, truth_clb_grad[:, 2], 'b--o', label='4 Engines [truth]') legend = plt.legend(loc='lower right', shadow='true') plt.xlabel('Weight (kg)') plt.ylabel('Second Segment Climb Gradient (%)') assert (TOFL_error < 1e-6) assert (GRAD_error < 1e-6) return
def main(): # ---------------------------------------------------------------------- # Main # ---------------------------------------------------------------------- vehicle = vehicle_setup() configs=configs_setup(vehicle) # --- Takeoff Configuration --- configuration = configs.takeoff configuration.wings['main_wing'].flaps_angle = 20. * Units.deg configuration.wings['main_wing'].slats_angle = 25. * Units.deg # V2_V2_ratio may be informed by user. If not, use default value (1.2) configuration.V2_VS_ratio = 1.21 configuration.max_lift_coefficient_factor = 0.90 analyses = SUAVE.Analyses.Analysis.Container() analyses.base = base_analysis(vehicle) # CLmax for a given configuration may be informed by user # configuration.maximum_lift_coefficient = 2.XX # --- Airport definition --- airport = SUAVE.Attributes.Airports.Airport() airport.tag = 'airport' airport.altitude = 0.0 * Units.ft airport.delta_isa = 0.0 airport.atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976() w_vec = np.linspace(40000.,52000.,10) engines = (2,3,4) takeoff_field_length = np.zeros((len(w_vec),len(engines))) second_seg_clb_grad = np.zeros((len(w_vec),len(engines))) compute_clb_grad = 1 # flag for Second segment climb estimation for id_eng,engine_number in enumerate(engines): configuration.propulsors.turbofan.number_of_engines = engine_number for id_w,weight in enumerate(w_vec): configuration.mass_properties.takeoff = weight takeoff_field_length[id_w,id_eng],second_seg_clb_grad[id_w,id_eng] = \ estimate_take_off_field_length(configuration,analyses,airport,compute_clb_grad) truth_TOFL = np.array([[ 1118.63611639, 727.97884809, 527.01392339], [ 1182.89024405, 766.11098981, 554.22570668], [ 1249.99344765, 805.78023921, 582.49069546], [ 1320.01349207, 847.01029051, 611.82110075], [ 1393.02041385, 889.82548587, 642.22939685], [ 1469.08655728, 934.2508275 , 673.72832735], [ 1548.28661027, 980.31198958, 706.33091096], [ 1630.69763999, 1028.03532998, 740.05044723], [ 1716.39912829, 1077.44790196, 774.9005222 ], [ 1805.47300708, 1128.57746562, 810.89501387]]) print ' takeoff_field_length=', takeoff_field_length print ' second_seg_clb_grad = ', second_seg_clb_grad truth_clb_grad = np.array([[ 0.07389745, 0.25138656, 0.42887567], [ 0.06775111, 0.23909388, 0.41043665], [ 0.06199853, 0.22758873, 0.39317893], [ 0.05660348, 0.21679862, 0.37699377], [ 0.051534 , 0.20665966, 0.36178532], [ 0.04676181, 0.19711529, 0.34746877], [ 0.04226183, 0.18811533, 0.33396883], [ 0.03801168, 0.17961503, 0.32121838], [ 0.03399137, 0.17157441, 0.30915745], [ 0.03018298, 0.16395762, 0.29773227]]) TOFL_error = np.max(np.abs(truth_TOFL-takeoff_field_length)/truth_TOFL) GRAD_error = np.max(np.abs(truth_clb_grad-second_seg_clb_grad)/truth_clb_grad) print 'Maximum Take OFF Field Length Error= %.4e' % TOFL_error print 'Second Segment Climb Gradient Error= %.4e' % GRAD_error import pylab as plt title = "TOFL vs W" plt.figure(1); plt.hold plt.plot(w_vec,takeoff_field_length[:,0], 'k-', label = '2 Engines') plt.plot(w_vec,takeoff_field_length[:,1], 'r-', label = '3 Engines') plt.plot(w_vec,takeoff_field_length[:,2], 'b-', label = '4 Engines') plt.title(title); plt.grid(True) plt.plot(w_vec,truth_TOFL[:,0], 'k--o', label = '2 Engines [truth]') plt.plot(w_vec,truth_TOFL[:,1], 'r--o', label = '3 Engines [truth]') plt.plot(w_vec,truth_TOFL[:,2], 'b--o', label = '4 Engines [truth]') legend = plt.legend(loc='lower right', shadow = 'true') plt.xlabel('Weight (kg)') plt.ylabel('Takeoff field length (m)') title = "2nd Segment Climb Gradient vs W" plt.figure(2); plt.hold plt.plot(w_vec,second_seg_clb_grad[:,0], 'k-', label = '2 Engines') plt.plot(w_vec,second_seg_clb_grad[:,1], 'r-', label = '3 Engines') plt.plot(w_vec,second_seg_clb_grad[:,2], 'b-', label = '4 Engines') plt.title(title); plt.grid(True) plt.plot(w_vec,truth_clb_grad[:,0], 'k--o', label = '2 Engines [truth]') plt.plot(w_vec,truth_clb_grad[:,1], 'r--o', label = '3 Engines [truth]') plt.plot(w_vec,truth_clb_grad[:,2], 'b--o', label = '4 Engines [truth]') legend = plt.legend(loc='lower right', shadow = 'true') plt.xlabel('Weight (kg)') plt.ylabel('Second Segment Climb Gradient (%)') assert( TOFL_error < 1e-6 ) assert( GRAD_error < 1e-6 ) return
def main(): # ---------------------------------------------------------------------- # Main # ---------------------------------------------------------------------- vehicle = vehicle_setup() configs = configs_setup(vehicle) # --- Takeoff Configuration --- configuration = configs.takeoff configuration.wings['main_wing'].flaps_angle = 20. * Units.deg configuration.wings['main_wing'].slats_angle = 25. * Units.deg # V2_V2_ratio may be informed by user. If not, use default value (1.2) configuration.V2_VS_ratio = 1.21 analyses = SUAVE.Analyses.Analysis.Container() analyses = base_analysis(vehicle) analyses.aerodynamics.settings.maximum_lift_coefficient_factor = 0.90 # CLmax for a given configuration may be informed by user # configuration.maximum_lift_coefficient = 2.XX # --- Airport definition --- airport = SUAVE.Attributes.Airports.Airport() airport.tag = 'airport' airport.altitude = 0.0 * Units.ft airport.delta_isa = 0.0 airport.atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976() w_vec = np.linspace(40000., 52000., 10) engines = (2, 3, 4) takeoff_field_length = np.zeros((len(w_vec), len(engines))) second_seg_clb_grad = np.zeros((len(w_vec), len(engines))) compute_clb_grad = 1 # flag for Second segment climb estimation for id_eng, engine_number in enumerate(engines): configuration.propulsors.turbofan.number_of_engines = engine_number for id_w, weight in enumerate(w_vec): configuration.mass_properties.takeoff = weight takeoff_field_length[id_w,id_eng],second_seg_clb_grad[id_w,id_eng] = \ estimate_take_off_field_length(configuration,analyses,airport,compute_clb_grad) truth_TOFL = np.array([[1173.30474724, 760.43161763, 550.17542593], [1241.97048851, 801.0454711, 579.11942109], [1313.71925195, 843.31076941, 609.19124856], [1388.62740991, 887.25412516, 640.40457932], [1466.77393275, 932.90289417, 672.77338767], [1548.24043104, 980.28518949, 706.31195806], [1633.11119749, 1029.42989526, 741.03489188], [1721.47324876, 1080.36668034, 776.95711399], [1813.41636696, 1133.12601188, 814.09387926], [1909.0331412, 1187.7391687, 852.46077892]]) print(' takeoff_field_length = ', takeoff_field_length) print(' second_seg_clb_grad = ', second_seg_clb_grad) truth_clb_grad = np.array([[0.07244437, 0.24921567, 0.42598697], [0.06651232, 0.23715452, 0.40779672], [0.06094702, 0.22585304, 0.39075907], [0.05571568, 0.21524227, 0.37476886], [0.0507893, 0.20526131, 0.35973331], [0.04614213, 0.19585619, 0.34557024], [0.04175123, 0.18697891, 0.33220659], [0.03759607, 0.17858664, 0.3195772], [0.03365829, 0.17064104, 0.30762378], [0.02992135, 0.16310768, 0.29629402]]) TOFL_error = np.max(np.abs(truth_TOFL - takeoff_field_length) / truth_TOFL) GRAD_error = np.max( np.abs(truth_clb_grad - second_seg_clb_grad) / truth_clb_grad) print('Maximum Take OFF Field Length Error= %.4e' % TOFL_error) print('Second Segment Climb Gradient Error= %.4e' % GRAD_error) import pylab as plt title = "TOFL vs W" plt.figure(1) plt.plot(w_vec, takeoff_field_length[:, 0], 'k-', label='2 Engines') plt.plot(w_vec, takeoff_field_length[:, 1], 'r-', label='3 Engines') plt.plot(w_vec, takeoff_field_length[:, 2], 'b-', label='4 Engines') plt.title(title) plt.grid(True) plt.plot(w_vec, truth_TOFL[:, 0], 'k--o', label='2 Engines [truth]') plt.plot(w_vec, truth_TOFL[:, 1], 'r--o', label='3 Engines [truth]') plt.plot(w_vec, truth_TOFL[:, 2], 'b--o', label='4 Engines [truth]') legend = plt.legend(loc='lower right', shadow='true') plt.xlabel('Weight (kg)') plt.ylabel('Takeoff field length (m)') title = "2nd Segment Climb Gradient vs W" plt.figure(2) plt.plot(w_vec, second_seg_clb_grad[:, 0], 'k-', label='2 Engines') plt.plot(w_vec, second_seg_clb_grad[:, 1], 'r-', label='3 Engines') plt.plot(w_vec, second_seg_clb_grad[:, 2], 'b-', label='4 Engines') plt.title(title) plt.grid(True) plt.plot(w_vec, truth_clb_grad[:, 0], 'k--o', label='2 Engines [truth]') plt.plot(w_vec, truth_clb_grad[:, 1], 'r--o', label='3 Engines [truth]') plt.plot(w_vec, truth_clb_grad[:, 2], 'b--o', label='4 Engines [truth]') legend = plt.legend(loc='lower right', shadow='true') plt.xlabel('Weight (kg)') plt.ylabel('Second Segment Climb Gradient (%)') assert (TOFL_error < 1e-6) assert (GRAD_error < 1e-6) return
def main(): # ---------------------------------------------------------------------- # Main # ---------------------------------------------------------------------- vehicle = vehicle_setup() configs = configs_setup(vehicle) # --- Takeoff Configuration --- configuration = configs.takeoff configuration.wings['main_wing'].flaps_angle = 20. * Units.deg configuration.wings['main_wing'].slats_angle = 25. * Units.deg # V2_V2_ratio may be informed by user. If not, use default value (1.2) configuration.V2_VS_ratio = 1.21 configuration.max_lift_coefficient_factor = 0.90 analyses = SUAVE.Analyses.Analysis.Container() analyses.base = base_analysis(vehicle) # CLmax for a given configuration may be informed by user # configuration.maximum_lift_coefficient = 2.XX # --- Airport definition --- airport = SUAVE.Attributes.Airports.Airport() airport.tag = 'airport' airport.altitude = 0.0 * Units.ft airport.delta_isa = 0.0 airport.atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976() w_vec = np.linspace(40000., 52000., 10) engines = (2, 3, 4) takeoff_field_length = np.zeros((len(w_vec), len(engines))) second_seg_clb_grad = np.zeros((len(w_vec), len(engines))) compute_clb_grad = 1 # flag for Second segment climb estimation for id_eng, engine_number in enumerate(engines): configuration.propulsors.turbofan.number_of_engines = engine_number for id_w, weight in enumerate(w_vec): configuration.mass_properties.takeoff = weight takeoff_field_length[id_w,id_eng],second_seg_clb_grad[id_w,id_eng] = \ estimate_take_off_field_length(configuration,analyses,airport,compute_clb_grad) truth_TOFL = np.array([[1116.10635509, 726.47454766, 525.93957657], [1180.15587618, 764.49121395, 553.07064632], [1247.04359555, 804.03963238, 581.25141247], [1316.83687778, 845.14335923, 610.49401596], [1389.60534387, 887.82659431, 640.81085913], [1465.42090714, 932.1141929, 672.21461168], [1544.3578087, 978.0316776, 704.71821645], [1626.49265282, 1025.60525002, 738.33489512], [1711.90444209, 1074.86180226, 773.07815381], [1800.67461244, 1125.82892836, 808.96178847]]) print ' takeoff_field_length=', takeoff_field_length print ' second_seg_clb_grad = ', second_seg_clb_grad truth_clb_grad = np.array([[0.07441427, 0.25242021, 0.43042615], [0.06825112, 0.24009391, 0.4119367], [0.0624828, 0.22855727, 0.39463173], [0.05707296, 0.21773759, 0.37840221], [0.05198957, 0.20757081, 0.36315205], [0.04720429, 0.19800024, 0.34879619], [0.04269194, 0.18897554, 0.33525915], [0.0384301, 0.18045186, 0.32247363], [0.03439872, 0.1723891, 0.31037949], [0.03057983, 0.16475133, 0.29892282]]) TOFL_error = np.max(np.abs(truth_TOFL - takeoff_field_length)) GRAD_error = np.max(np.abs(truth_clb_grad - second_seg_clb_grad)) print 'Maximum Take OFF Field Length Error= %.4e' % TOFL_error print 'Second Segment Climb Gradient Error= %.4e' % GRAD_error import pylab as plt title = "TOFL vs W" plt.figure(1) plt.hold plt.plot(w_vec, takeoff_field_length[:, 0], 'k-', label='2 Engines') plt.plot(w_vec, takeoff_field_length[:, 1], 'r-', label='3 Engines') plt.plot(w_vec, takeoff_field_length[:, 2], 'b-', label='4 Engines') plt.title(title) plt.grid(True) plt.plot(w_vec, truth_TOFL[:, 0], 'k--o', label='2 Engines [truth]') plt.plot(w_vec, truth_TOFL[:, 1], 'r--o', label='3 Engines [truth]') plt.plot(w_vec, truth_TOFL[:, 2], 'b--o', label='4 Engines [truth]') legend = plt.legend(loc='lower right', shadow='true') plt.xlabel('Weight (kg)') plt.ylabel('Takeoff field length (m)') title = "2nd Segment Climb Gradient vs W" plt.figure(2) plt.hold plt.plot(w_vec, second_seg_clb_grad[:, 0], 'k-', label='2 Engines') plt.plot(w_vec, second_seg_clb_grad[:, 1], 'r-', label='3 Engines') plt.plot(w_vec, second_seg_clb_grad[:, 2], 'b-', label='4 Engines') plt.title(title) plt.grid(True) plt.plot(w_vec, truth_clb_grad[:, 0], 'k--o', label='2 Engines [truth]') plt.plot(w_vec, truth_clb_grad[:, 1], 'r--o', label='3 Engines [truth]') plt.plot(w_vec, truth_clb_grad[:, 2], 'b--o', label='4 Engines [truth]') legend = plt.legend(loc='lower right', shadow='true') plt.xlabel('Weight (kg)') plt.ylabel('Second Segment Climb Gradient (%)') assert (TOFL_error < 1e-5) assert (GRAD_error < 1e-5) return
def setup(): nexus = Nexus() problem = Data() nexus.optimization_problem = problem # ------------------------------------------------------------------- # Inputs # ------------------------------------------------------------------- # [ tag , initial, (lb,ub) , scaling , units ] problem.inputs = np.array([ ['wing_area', 95, (90., 130.), 100., Units.meter**2], ['cruise_altitude', 11, (9, 14.), 10., Units.km], ]) # ------------------------------------------------------------------- # Objective # ------------------------------------------------------------------- # throw an error if the user isn't specific about wildcards # [ tag, scaling, units ] problem.objective = np.array([['fuel_burn', 10000, Units.kg]]) # ------------------------------------------------------------------- # Constraints # ------------------------------------------------------------------- # [ tag, sense, edge, scaling, units ] problem.constraints = np.array([ ['design_range_fuel_margin', '>', 0., 1E-1, Units.less], #fuel margin defined here as fuel ]) # ------------------------------------------------------------------- # Aliases # ------------------------------------------------------------------- # [ 'alias' , ['data.path1.name','data.path2.name'] ] problem.aliases = [ [ 'wing_area', [ 'vehicle_configurations.*.wings.main_wing.areas.reference', 'vehicle_configurations.*.reference_area' ] ], ['cruise_altitude', 'missions.base.segments.climb_5.altitude_end'], ['fuel_burn', 'summary.base_mission_fuelburn'], ['design_range_fuel_margin', 'summary.max_zero_fuel_margin'], ] # ------------------------------------------------------------------- # Vehicles # ------------------------------------------------------------------- vehicle = vehicle_setup() nexus.vehicle_configurations = configs_setup(vehicle) # ------------------------------------------------------------------- # Analyses # ------------------------------------------------------------------- nexus.analyses = Analyses2.setup(nexus.vehicle_configurations) # ------------------------------------------------------------------- # Missions # ------------------------------------------------------------------- nexus.missions = Missions2.setup(nexus.analyses) # ------------------------------------------------------------------- # Procedure # ------------------------------------------------------------------- nexus.procedure = Procedure2.setup() # ------------------------------------------------------------------- # Summary # ------------------------------------------------------------------- nexus.summary = Data() return nexus