From 86226eca88bc09fe4006a016729a4f9c5d8ba8c7 Mon Sep 17 00:00:00 2001 From: Tim MacDonald Date: Mon, 14 Aug 2017 13:50:56 -0700 Subject: [PATCH 01/19] updated vehicle definitions --- BWB_CFD/BWB.py | 20 +- Regional_Jet_Optimization/Analyses.py | 2 +- .../Optimize_Surrogate.py | 1 - Solar_UAV_Optimization/Analyses.py | 4 +- tut_concorde.py | 177 +++++++- tut_lithium_air_jet_sizing.py | 2 +- tut_mission_B737.py | 408 +++++++++++------- tut_payload_range.py | 4 +- tut_solar_uav.py | 2 +- 9 files changed, 421 insertions(+), 199 deletions(-) diff --git a/BWB_CFD/BWB.py b/BWB_CFD/BWB.py index abfe7f1..af7b593 100644 --- a/BWB_CFD/BWB.py +++ b/BWB_CFD/BWB.py @@ -98,7 +98,7 @@ def base_analysis(vehicle): # ------------------------------------------------------------------ # Weights - weights = SUAVE.Analyses.Weights.Weights() + weights = SUAVE.Analyses.Weights.Weights_BWB() weights.vehicle = vehicle analyses.append(weights) @@ -291,15 +291,15 @@ def vehicle_setup(): segment.thickness_to_chord = 0.10 wing.Segments.append(segment) - segment = SUAVE.Components.Wings.Segment() - segment.tag = 'section_7' - segment.percent_span_location = 0.97 - segment.twist = 0. * Units.deg - segment.root_chord_percent = 0.086 - segment.dihedral_outboard = 73. * Units.degrees - segment.sweeps.quarter_chord = 55. * Units.degrees - segment.thickness_to_chord = 0.10 - wing.Segments.append(segment) + #segment = SUAVE.Components.Wings.Segment() + #segment.tag = 'section_7' + #segment.percent_span_location = 0.97 + #segment.twist = 0. * Units.deg + #segment.root_chord_percent = 0.086 + #segment.dihedral_outboard = 73. * Units.degrees + #segment.sweeps.quarter_chord = 55. * Units.degrees + #segment.thickness_to_chord = 0.10 + #wing.Segments.append(segment) # add to vehicle vehicle.append_component(wing) diff --git a/Regional_Jet_Optimization/Analyses.py b/Regional_Jet_Optimization/Analyses.py index 53792ad..a81bb58 100644 --- a/Regional_Jet_Optimization/Analyses.py +++ b/Regional_Jet_Optimization/Analyses.py @@ -51,7 +51,7 @@ def base(vehicle): # ------------------------------------------------------------------ # Weights - weights = SUAVE.Analyses.Weights.Weights() + weights = SUAVE.Analyses.Weights.Weights_Tube_Wing() weights.vehicle = vehicle analyses.append(weights) diff --git a/Regional_Jet_Optimization/Optimize_Surrogate.py b/Regional_Jet_Optimization/Optimize_Surrogate.py index 8b166ec..023767b 100644 --- a/Regional_Jet_Optimization/Optimize_Surrogate.py +++ b/Regional_Jet_Optimization/Optimize_Surrogate.py @@ -18,7 +18,6 @@ from SUAVE.Optimization import Nexus, carpet_plot import SUAVE.Optimization.Package_Setups.scipy_setup as scipy_setup from SUAVE.Optimization.Surrogate_Optimization import Surrogate_Optimization -import VyPy import pyOpt # ---------------------------------------------------------------------- # Run the whole thing diff --git a/Solar_UAV_Optimization/Analyses.py b/Solar_UAV_Optimization/Analyses.py index ce0d577..3eda688 100644 --- a/Solar_UAV_Optimization/Analyses.py +++ b/Solar_UAV_Optimization/Analyses.py @@ -44,8 +44,8 @@ def base(vehicle): # ------------------------------------------------------------------ # Weights # ------------------------------------------------------------------ - weights = SUAVE.Analyses.Weights.Weights() - weights.settings.empty_weight_method = SUAVE.Methods.Weights.Correlations.UAV.Empty + weights = SUAVE.Analyses.Weights.Weights_UAV() + weights.settings.empty_weight_method = SUAVE.Methods.Weights.Correlations.UAV.empty weights.vehicle = vehicle analyses.append(weights) diff --git a/tut_concorde.py b/tut_concorde.py index 93b64fd..495e71c 100644 --- a/tut_concorde.py +++ b/tut_concorde.py @@ -107,7 +107,7 @@ def base_analysis(vehicle): # ------------------------------------------------------------------ # Weights - weights = SUAVE.Analyses.Weights.Weights() + weights = SUAVE.Analyses.Weights.Weights_Tube_Wing() weights.vehicle = vehicle analyses.append(weights) @@ -184,10 +184,10 @@ def vehicle_setup(source_ratio=1.): wing.tag = 'main_wing' wing.aspect_ratio = 1.83 - wing.sweeps.quarter_chord = 59.5 * Units.deg + wing.sweeps.quarter_chord = 59.5 * Units.deg wing.thickness_to_chord = 0.03 wing.taper = 0. - wing.span_efficiency = 0.74 + wing.span_efficiency = .8 wing.spans.projected = 25.6 @@ -197,6 +197,9 @@ def vehicle_setup(source_ratio=1.): wing.chords.mean_aerodynamic = 18.4 wing.areas.reference = 358.25 + wing.areas.wetted = 653. - 12.*2.4*2 # 2.4 is engine area on one side + wing.areas.exposed = 326.5 + wing.areas.affected = .6*wing.areas.reference wing.twists.root = 0.0 * Units.degrees wing.twists.tip = 0.0 * Units.degrees @@ -212,6 +215,61 @@ def vehicle_setup(source_ratio=1.): wing.dynamic_pressure_ratio = 1.0 + wing_airfoil = SUAVE.Components.Wings.Airfoils.Airfoil() + wing_airfoil.coordinate_file = 'NACA65-203.dat' + + wing.append_airfoil(wing_airfoil) + + # set root sweep with inner section + segment = SUAVE.Components.Wings.Segment() + segment.tag = 'section_1' + segment.percent_span_location = 0. + segment.twist = 0. * Units.deg + segment.root_chord_percent = 33.8/33.8 + segment.dihedral_outboard = 0. + segment.sweeps.quarter_chord = 67. * Units.deg + segment.vsp_mesh = Data() + segment.vsp_mesh.inner_radius = 1./source_ratio + segment.vsp_mesh.outer_radius = 1./source_ratio + segment.vsp_mesh.inner_length = .044/source_ratio + segment.vsp_mesh.outer_length = .044/source_ratio + segment.vsp_mesh.matching_TE = False + segment.append_airfoil(wing_airfoil) + wing.Segments.append(segment) + + # set mid section start point + segment = SUAVE.Components.Wings.Segment() + segment.tag = 'section_2' + segment.percent_span_location = 6.15/(25.6/2) + wing.Segments['section_1'].percent_span_location + segment.twist = 0. * Units.deg + segment.root_chord_percent = 13.8/33.8 + segment.dihedral_outboard = 0. + segment.sweeps.quarter_chord = 48. * Units.deg + segment.vsp_mesh = Data() + segment.vsp_mesh.inner_radius = 1./source_ratio + segment.vsp_mesh.outer_radius = .88/source_ratio + segment.vsp_mesh.inner_length = .044/source_ratio + segment.vsp_mesh.outer_length = .044/source_ratio + segment.vsp_mesh.matching_TE = False + segment.append_airfoil(wing_airfoil) + wing.Segments.append(segment) + + # set tip section start point + segment = SUAVE.Components.Wings.Segment() + segment.tag = 'section_3' + segment.percent_span_location = 5.95/(25.6/2) + wing.Segments['section_2'].percent_span_location + segment.twist = 0. * Units.deg + segment.root_chord_percent = 4.4/33.8 + segment.dihedral_outboard = 0. + segment.sweeps.quarter_chord = 71. * Units.deg + segment.vsp_mesh = Data() + segment.vsp_mesh.inner_radius = .88/source_ratio + segment.vsp_mesh.outer_radius = .22/source_ratio + segment.vsp_mesh.inner_length = .044/source_ratio + segment.vsp_mesh.outer_length = .011/source_ratio + segment.append_airfoil(wing_airfoil) + wing.Segments.append(segment) + # add to vehicle vehicle.append_component(wing) @@ -237,6 +295,9 @@ def vehicle_setup(source_ratio=1.): wing.chords.mean_aerodynamic = 8.66 wing.areas.reference = 33.91 # + wing.areas.wetted = 76. + wing.areas.exposed = 38. + wing.areas.affected = 33.91 wing.twists.root = 0.0 * Units.degrees wing.twists.tip = 0.0 * Units.degrees @@ -251,6 +312,43 @@ def vehicle_setup(source_ratio=1.): wing.dynamic_pressure_ratio = 1.0 + tail_airfoil = SUAVE.Components.Wings.Airfoils.Airfoil() + tail_airfoil.coordinate_file = 'supertail_refined.dat' + + wing.append_airfoil(tail_airfoil) + + # set root sweep with inner section + segment = SUAVE.Components.Wings.Segment() + segment.tag = 'section_1' + segment.percent_span_location = 0.0 + segment.twist = 0. * Units.deg + segment.root_chord_percent = 14.5/14.5 + segment.dihedral_outboard = 0. + segment.sweeps.quarter_chord = 63. * Units.deg + segment.vsp_mesh = Data() + segment.vsp_mesh.inner_radius = 2.9/source_ratio + segment.vsp_mesh.outer_radius = 1.5/source_ratio + segment.vsp_mesh.inner_length = .044/source_ratio + segment.vsp_mesh.outer_length = .044/source_ratio + segment.append_airfoil(tail_airfoil) + wing.Segments.append(segment) + + # set mid section start point + segment = SUAVE.Components.Wings.Segment() + segment.tag = 'section_2' + segment.percent_span_location = 2.4/(6.0) + wing.Segments['section_1'].percent_span_location + segment.twist = 0. * Units.deg + segment.root_chord_percent = 7.5/14.5 + segment.dihedral_outboard = 0. + segment.sweeps.quarter_chord = 40. * Units.deg + segment.vsp_mesh = Data() + segment.vsp_mesh.inner_radius = 1.5/source_ratio + segment.vsp_mesh.outer_radius = .54/source_ratio + segment.vsp_mesh.inner_length = .044/source_ratio + segment.vsp_mesh.outer_length = .027/source_ratio + segment.append_airfoil(tail_airfoil) + wing.Segments.append(segment) + # add to vehicle vehicle.append_component(wing) @@ -279,13 +377,13 @@ def vehicle_setup(source_ratio=1.): fuselage.heights.at_wing_root_quarter_chord = 3.32 # fuselage.heights.at_three_quarters_length = 3.32 # - fuselage.areas.wetted = 523. - fuselage.areas.front_projected = 7.55 + fuselage.areas.wetted = 447. + fuselage.areas.front_projected = 11.9 fuselage.effective_diameter = 3.1 - fuselage.differential_pressure = 7.4e4 * Units.pascal # Maximum differential pressure + fuselage.differential_pressure = 7.4e4 * Units.pascal # Maximum differential pressure # add to vehicle vehicle.append_component(fuselage) @@ -301,10 +399,12 @@ def vehicle_setup(source_ratio=1.): # setup turbojet.number_of_engines = 4.0 - turbojet.engine_length = 12.5 - turbojet.nacelle_diameter = 1.60 + turbojet.engine_length = 12.0 + turbojet.nacelle_diameter = 1.3 + turbojet.inlet_diameter = 1.1 turbojet.areas = Data() - turbojet.areas.wetted = 12.5*1.6*8. # essentially rectangles attached to the wings + turbojet.areas.wetted = 12.5*4.7*2. # 4.7 is outer perimeter on one side + turbojet.origin = [[37.,6.,-1.3],[37.,5.3,-1.3],[37.,-5.3,-1.3],[37.,-6.,-1.3]] # working fluid turbojet.working_fluid = SUAVE.Attributes.Gases.Air() @@ -430,17 +530,22 @@ def vehicle_setup(source_ratio=1.): # add to network turbojet.append(nozzle) + # ------------------------------------------------------------------ + # Component 9 - Divergening Nozzle + + + # ------------------------------------------------------------------ - #Component 9 : thrust (to compute the thrust) + #Component 10 : thrust (to compute the thrust) thrust = SUAVE.Components.Energy.Processes.Thrust() thrust.tag ='compute_thrust' - # total design thrust (includes all the engines) + #total design thrust (includes all the engines) thrust.total_design = 4*140000. * Units.N #Newtons # Note: Sizing builds the propulsor. It does not actually set the size of the turbojet - # Design sizing conditions + #design sizing conditions altitude = 0.0*Units.ft mach_number = 0.01 isa_deviation = 0. @@ -467,18 +572,58 @@ def vehicle_setup(source_ratio=1.): # --------------------------------------------------------------------- def configs_setup(vehicle): - + # ------------------------------------------------------------------ # Initialize Configurations # ------------------------------------------------------------------ - + configs = SUAVE.Components.Configs.Config.Container() - + base_config = SUAVE.Components.Configs.Config(vehicle) base_config.tag = 'base' - configs.append(base_config) + configs.append(base_config) + + # ------------------------------------------------------------------ + # Cruise Configuration + # ------------------------------------------------------------------ + + config = SUAVE.Components.Configs.Config(base_config) + config.tag = 'cruise' + + configs.append(config) + + + # ------------------------------------------------------------------ + # Takeoff Configuration + # ------------------------------------------------------------------ + + config = SUAVE.Components.Configs.Config(base_config) + config.tag = 'takeoff' + + config.wings['main_wing'].flaps.angle = 0. * Units.deg + config.wings['main_wing'].slats.angle = 0. * Units.deg + + config.V2_VS_ratio = 1.21 + config.maximum_lift_coefficient = 2. + + configs.append(config) + + + # ------------------------------------------------------------------ + # Landing Configuration + # ------------------------------------------------------------------ + config = SUAVE.Components.Configs.Config(base_config) + config.tag = 'landing' + + config.wings['main_wing'].flaps_angle = 0. * Units.deg + config.wings['main_wing'].slats_angle = 0. * Units.deg + config.Vref_VS_ratio = 1.23 + config.maximum_lift_coefficient = 2. + + configs.append(config) + # done! return configs diff --git a/tut_lithium_air_jet_sizing.py b/tut_lithium_air_jet_sizing.py index 13b8f99..4eb90a6 100644 --- a/tut_lithium_air_jet_sizing.py +++ b/tut_lithium_air_jet_sizing.py @@ -179,7 +179,7 @@ def base_analysis(vehicle): # ------------------------------------------------------------------ # Weights - weights = SUAVE.Analyses.Weights.Weights() + weights = SUAVE.Analyses.Weights.Weights_Tube_Wing() weights.settings.empty_weight_method= \ SUAVE.Methods.Weights.Correlations.Tube_Wing.empty weights.vehicle = vehicle diff --git a/tut_mission_B737.py b/tut_mission_B737.py index 23a46c3..8b36f83 100644 --- a/tut_mission_B737.py +++ b/tut_mission_B737.py @@ -138,7 +138,7 @@ def base_analysis(vehicle): # ------------------------------------------------------------------ # Weights - weights = SUAVE.Analyses.Weights.Weights() + weights = SUAVE.Analyses.Weights.Weights_Tube_Wing() weights.vehicle = vehicle analyses.append(weights) @@ -181,15 +181,15 @@ def base_analysis(vehicle): # ---------------------------------------------------------------------- def vehicle_setup(): - + # ------------------------------------------------------------------ # Initialize the Vehicle # ------------------------------------------------------------------ - + vehicle = SUAVE.Vehicle() - vehicle.tag = 'Boeing_737_800' - - + vehicle.tag = 'Boeing_737800' + + # ------------------------------------------------------------------ # Vehicle-level Properties # ------------------------------------------------------------------ @@ -197,9 +197,12 @@ def vehicle_setup(): # mass properties vehicle.mass_properties.max_takeoff = 79015.8 # kg vehicle.mass_properties.takeoff = 79015.8 # kg - vehicle.mass_properties.max_zero_fuel = 0.9 * vehicle.mass_properties.max_takeoff + vehicle.mass_properties.operating_empty = 62746.4 # kg + vehicle.mass_properties.takeoff = 79015.8 # kg + vehicle.mass_properties.max_zero_fuel = 62732.0 # kg #0.9 * vehicle.mass_properties.max_takeoff vehicle.mass_properties.cargo = 10000. * Units.kilogram - + + # envelope properties vehicle.envelope.ultimate_load = 2.5 vehicle.envelope.limit_load = 1.5 @@ -210,41 +213,65 @@ def vehicle_setup(): vehicle.systems.control = "fully powered" vehicle.systems.accessories = "medium range" - + # ------------------------------------------------------------------ + # Landing Gear + # ------------------------------------------------------------------ + #used for noise calculations + landing_gear = SUAVE.Components.Landing_Gear.Landing_Gear() + landing_gear.tag = "main_landing_gear" + landing_gear.main_tire_diameter = 1.12000 * Units.m + landing_gear.nose_tire_diameter = 0.6858 * Units.m + landing_gear.main_strut_length = 1.8 * Units.m + landing_gear.nose_strut_length = 1.3 * Units.m + landing_gear.main_units = 2 #number of main landing gear units + landing_gear.nose_units = 1 #number of nose landing gear + landing_gear.main_wheels = 2 #number of wheels on the main landing gear + landing_gear.nose_wheels = 2 #number of wheels on the nose landing gear + vehicle.landing_gear=landing_gear + + # ------------------------------------------------------------------ # Main Wing # ------------------------------------------------------------------ - + wing = SUAVE.Components.Wings.Main_Wing() wing.tag = 'main_wing' - - wing.aspect_ratio = 10.18 # Not set - wing.thickness_to_chord = 0.1 # Not set + + wing.aspect_ratio = 10.18 + wing.sweeps.quarter_chord = 25 * Units.deg + wing.thickness_to_chord = 0.1 wing.taper = 0.1 wing.span_efficiency = 0.9 - - wing.spans.projected = 34.32 - + + wing.spans.projected = 34.32 + wing.chords.root = 7.760 * Units.meter wing.chords.tip = 0.782 * Units.meter wing.chords.mean_aerodynamic = 4.235 * Units.meter - - wing.areas.reference = 124.862 # Not set - wing.sweeps.quarter_chord = 25. * Units.degrees - + + wing.areas.reference = 124.862 + wing.twists.root = 4.0 * Units.degrees wing.twists.tip = 0.0 * Units.degrees - wing.dihedral = 2.5 * Units.degrees - + wing.origin = [13.61,0,-1.27] - wing.aerodynamic_center = [0,0,0] - + wing.aerodynamic_center = [0,0,0] #[3,0,0] + wing.vertical = False wing.symmetric = True wing.high_lift = True - + wing.dynamic_pressure_ratio = 1.0 - + + # ------------------------------------------------------------------ + # Flaps + # ------------------------------------------------------------------ + wing.flaps.chord = 0.30 + wing.flaps.span_start = 0.10 # -> wing.flaps.area = 97.1112 + wing.flaps.span_end = 0.75 + wing.flaps.type = 'double_slotted' # -> wing.flaps.number_slots = 2 + + # add to vehicle vehicle.append_component(wing) @@ -252,74 +279,73 @@ def vehicle_setup(): # ------------------------------------------------------------------ # Horizontal Stabilizer # ------------------------------------------------------------------ - + wing = SUAVE.Components.Wings.Wing() wing.tag = 'horizontal_stabilizer' - - wing.aspect_ratio = 6.16 # Not set - wing.thickness_to_chord = 0.08 # Not set + + wing.aspect_ratio = 6.16 # + wing.sweeps.quarter_chord = 40 * Units.deg + wing.thickness_to_chord = 0.08 wing.taper = 0.2 wing.span_efficiency = 0.9 - - wing.spans.projected = 14.2 - - wing.chords.root = 4.70 - wing.chords.tip = 0.955 - wing.chords.mean_aerodynamic = 2.5 - - wing.areas.reference = 42.65 - - wing.twists.root = 0.0 * Units.degrees # Not set - wing.twists.tip = 0.0 * Units.degrees # Not set - - wing.sweeps.quarter_chord = 40.0 * Units.degrees - + + wing.spans.projected = 14.2 # + + wing.chords.root = 4.7 + wing.chords.tip = .955 + wing.chords.mean_aerodynamic = 8.0 + + wing.areas.reference = 32.488 # + wing.areas.exposed = 199.7792 # Exposed area of the horizontal tail + wing.areas.wetted = 249.724 # Wetted area of the horizontal tail + wing.twists.root = 3.0 * Units.degrees + wing.twists.tip = 3.0 * Units.degrees + wing.origin = [32.83,0,1.14] wing.aerodynamic_center = [0,0,0] - wing.dihedral = 8.63 * Units.degrees - + wing.vertical = False wing.symmetric = True - - wing.dynamic_pressure_ratio = 0.9 - + + wing.dynamic_pressure_ratio = 0.9 + # add to vehicle vehicle.append_component(wing) - - + + # ------------------------------------------------------------------ # Vertical Stabilizer # ------------------------------------------------------------------ - + wing = SUAVE.Components.Wings.Wing() wing.tag = 'vertical_stabilizer' - - wing.aspect_ratio = 1.91 - wing.sweeps.quarter_chord = 25. * Units.deg + + wing.aspect_ratio = 1.91 # + wing.sweeps.quarter_chord = 25 * Units.deg wing.thickness_to_chord = 0.08 wing.taper = 0.25 wing.span_efficiency = 0.9 - - wing.spans.projected = 7.77 + + wing.spans.projected = 7.777 # wing.chords.root = 8.19 wing.chords.tip = 0.95 wing.chords.mean_aerodynamic = 4.0 - - wing.areas.reference = 27.316 - + + wing.areas.reference = 27.316 # + wing.twists.root = 0.0 * Units.degrees wing.twists.tip = 0.0 * Units.degrees - + wing.origin = [28.79,0,1.54] - wing.aerodynamic_center = [0,0,0] - + wing.aerodynamic_center = [0,0,0] #[2,0,0] + wing.vertical = True wing.symmetric = False wing.t_tail = False - + wing.dynamic_pressure_ratio = 1.0 - + # add to vehicle vehicle.append_component(wing) @@ -327,93 +353,103 @@ def vehicle_setup(): # ------------------------------------------------------------------ # Fuselage # ------------------------------------------------------------------ - + fuselage = SUAVE.Components.Fuselages.Fuselage() fuselage.tag = 'fuselage' - + + fuselage.number_coach_seats = vehicle.passengers + #fuselage.number_coach_seats = 200. fuselage.seats_abreast = 6 fuselage.seat_pitch = 1 - - fuselage.fineness.nose = 1.57 - fuselage.fineness.tail = 3.2 - - fuselage.lengths.nose = 8.0 - fuselage.lengths.tail = 12. - fuselage.lengths.cabin = 28.85 - fuselage.lengths.total = 38.02 + + fuselage.fineness.nose = 1.6 + fuselage.fineness.tail = 2. + + fuselage.lengths.nose = 6.4 + fuselage.lengths.tail = 8.0 + fuselage.lengths.cabin = 28.85 #44.0 + fuselage.lengths.total = 38.02 #58.4 fuselage.lengths.fore_space = 6. fuselage.lengths.aft_space = 5. - - fuselage.width = 3.76 - - fuselage.heights.maximum = 3.76 - fuselage.heights.at_quarter_length = 3.76 - fuselage.heights.at_three_quarters_length = 3.65 - fuselage.heights.at_wing_root_quarter_chord = 3.76 - - fuselage.areas.side_projected = 142.1948 - fuselage.areas.wetted = 446.718 + + fuselage.width = 3.74 #4. + + fuselage.heights.maximum = 3.74 #4. # + fuselage.heights.at_quarter_length = 3.74 # Not correct + fuselage.heights.at_three_quarters_length = 3.65 # Not correct + fuselage.heights.at_wing_root_quarter_chord = 3.74 # Not correct + + fuselage.areas.side_projected = 142.1948 #4.* 59.8 # Not correct + fuselage.areas.wetted = 446.718 #688.64 fuselage.areas.front_projected = 12.57 - - fuselage.effective_diameter = 3.76 - + + fuselage.effective_diameter = 3.74 #4.0 + fuselage.differential_pressure = 5.0e4 * Units.pascal # Maximum differential pressure - - + # add to vehicle vehicle.append_component(fuselage) - - + + # ------------------------------------------------------------------ # Turbofan Network # ------------------------------------------------------------------ - + #instantiate the gas turbine network turbofan = SUAVE.Components.Energy.Networks.Turbofan() turbofan.tag = 'turbofan' - + # setup turbofan.number_of_engines = 2.0 turbofan.bypass_ratio = 5.4 - turbofan.engine_length = 4.1 - turbofan.nacelle_diameter = 0.85 + turbofan.engine_length = 2.71 + turbofan.nacelle_diameter = 2.05 + # This origin is overwritten by compute_component_centers_of_gravity(base,compute_propulsor_origin=True) turbofan.origin = [[13.72, 4.86,-1.9],[13.72, -4.86,-1.9]] - + + #compute engine areas + Awet = 1.1*np.pi*turbofan.nacelle_diameter*turbofan.engine_length + + #Assign engine areas + turbofan.areas.wetted = Awet + + + # working fluid turbofan.working_fluid = SUAVE.Attributes.Gases.Air() - - + + # ------------------------------------------------------------------ # Component 1 - Ram - + # to convert freestream static to stagnation quantities - + # instantiate ram = SUAVE.Components.Energy.Converters.Ram() ram.tag = 'ram' - + # add to the network turbofan.append(ram) # ------------------------------------------------------------------ # Component 2 - Inlet Nozzle - + # instantiate inlet_nozzle = SUAVE.Components.Energy.Converters.Compression_Nozzle() inlet_nozzle.tag = 'inlet_nozzle' - + # setup inlet_nozzle.polytropic_efficiency = 0.98 inlet_nozzle.pressure_ratio = 0.98 - + # add to network turbofan.append(inlet_nozzle) - - + + # ------------------------------------------------------------------ # Component 3 - Low Pressure Compressor - + # instantiate compressor = SUAVE.Components.Energy.Converters.Compressor() compressor.tag = 'low_pressure_compressor' @@ -421,44 +457,44 @@ def vehicle_setup(): # setup compressor.polytropic_efficiency = 0.91 compressor.pressure_ratio = 1.14 - + # add to network turbofan.append(compressor) - + # ------------------------------------------------------------------ # Component 4 - High Pressure Compressor - + # instantiate compressor = SUAVE.Components.Energy.Converters.Compressor() compressor.tag = 'high_pressure_compressor' - + # setup compressor.polytropic_efficiency = 0.91 compressor.pressure_ratio = 13.415 - + # add to network turbofan.append(compressor) # ------------------------------------------------------------------ # Component 5 - Low Pressure Turbine - + # instantiate turbine = SUAVE.Components.Energy.Converters.Turbine() turbine.tag='low_pressure_turbine' - + # setup turbine.mechanical_efficiency = 0.99 turbine.polytropic_efficiency = 0.93 - + # add to network turbofan.append(turbine) - - + + # ------------------------------------------------------------------ # Component 6 - High Pressure Turbine - + # instantiate turbine = SUAVE.Components.Energy.Converters.Turbine() turbine.tag='high_pressure_turbine' @@ -466,47 +502,47 @@ def vehicle_setup(): # setup turbine.mechanical_efficiency = 0.99 turbine.polytropic_efficiency = 0.93 - + # add to network turbofan.append(turbine) - - + + # ------------------------------------------------------------------ # Component 7 - Combustor - + # instantiate combustor = SUAVE.Components.Energy.Converters.Combustor() combustor.tag = 'combustor' - + # setup combustor.efficiency = 0.99 combustor.alphac = 1.0 combustor.turbine_inlet_temperature = 1450 combustor.pressure_ratio = 0.95 combustor.fuel_data = SUAVE.Attributes.Propellants.Jet_A() - + # add to network turbofan.append(combustor) - + # ------------------------------------------------------------------ # Component 8 - Core Nozzle - + # instantiate nozzle = SUAVE.Components.Energy.Converters.Expansion_Nozzle() nozzle.tag = 'core_nozzle' - + # setup nozzle.polytropic_efficiency = 0.95 nozzle.pressure_ratio = 0.99 - + # add to network turbofan.append(nozzle) # ------------------------------------------------------------------ # Component 9 - Fan Nozzle - + # instantiate nozzle = SUAVE.Components.Energy.Converters.Expansion_Nozzle() nozzle.tag = 'fan_nozzle' @@ -514,14 +550,14 @@ def vehicle_setup(): # setup nozzle.polytropic_efficiency = 0.95 nozzle.pressure_ratio = 0.99 - + # add to network turbofan.append(nozzle) - - + + # ------------------------------------------------------------------ # Component 10 - Fan - + # instantiate fan = SUAVE.Components.Energy.Converters.Fan() fan.tag = 'fan' @@ -529,40 +565,50 @@ def vehicle_setup(): # setup fan.polytropic_efficiency = 0.93 fan.pressure_ratio = 1.7 - + # add to network turbofan.append(fan) - - + + # ------------------------------------------------------------------ #Component 10 : thrust (to compute the thrust) thrust = SUAVE.Components.Energy.Processes.Thrust() thrust.tag ='compute_thrust' - + #total design thrust (includes all the engines) thrust.total_design = 2*24000. * Units.N #Newtons - + #design sizing conditions altitude = 35000.0*Units.ft mach_number = 0.78 isa_deviation = 0. - + + #Engine setup for noise module + + # add to network turbofan.thrust = thrust + turbofan.core_nozzle_diameter = 0.92 + turbofan.fan_nozzle_diameter = 1.659 + turbofan.engine_height = 0.5 #Engine centerline heigh above the ground plane + turbofan.exa = 1 #distance from fan face to fan exit/ fan diameter) + turbofan.plug_diameter = 0.1 #dimater of the engine plug + turbofan.geometry_xe = 1. # Geometry information for the installation effects function + turbofan.geometry_ye = 1. # Geometry information for the installation effects function + turbofan.geometry_Ce = 2. # Geometry information for the installation effects function + + + + + #size the turbofan turbofan_sizing(turbofan,mach_number,altitude) - - #computing the engine length and diameter - compute_turbofan_geometry(turbofan,None) - - print "sls thrust : ",turbofan.sealevel_static_thrust - print "engine length : ",turbofan.engine_length - - # add gas turbine network gt_engine to the vehicle + + # add gas turbine network turbofan to the vehicle vehicle.append_component(turbofan) - - + + # ------------------------------------------------------------------ # Vehicle Definition Complete # ------------------------------------------------------------------ @@ -576,11 +622,10 @@ def vehicle_setup(): # --------------------------------------------------------------------- def configs_setup(vehicle): - - # ------------------------------------------------------------------ + + # ------------------------------------------------------------------ # Initialize Configurations # ------------------------------------------------------------------ - configs = SUAVE.Components.Configs.Config.Container() base_config = SUAVE.Components.Configs.Config(vehicle) @@ -590,28 +635,45 @@ def configs_setup(vehicle): # ------------------------------------------------------------------ # Cruise Configuration # ------------------------------------------------------------------ - config = SUAVE.Components.Configs.Config(base_config) config.tag = 'cruise' - configs.append(config) - # ------------------------------------------------------------------ # Takeoff Configuration # ------------------------------------------------------------------ - config = SUAVE.Components.Configs.Config(base_config) config.tag = 'takeoff' - config.wings['main_wing'].flaps.angle = 20. * Units.deg config.wings['main_wing'].slats.angle = 25. * Units.deg + config.max_lift_coefficient_factor = 1. #0.95 + #Noise input for the landing gear + config.landing_gear.gear_condition = 'up' + config.output_filename = 'Flyover_' - config.V2_VS_ratio = 1.21 - config.maximum_lift_coefficient = 2. + config.propulsors['turbofan'].fan.rotation = 3470. #N1 speed + config.propulsors['turbofan'].fan_nozzle.noise_speed = 315. + config.propulsors['turbofan'].core_nozzle.noise_speed = 415. configs.append(config) + + # ------------------------------------------------------------------ + # Cutback Configuration + # ------------------------------------------------------------------ + config = SUAVE.Components.Configs.Config(base_config) + config.tag = 'cutback' + config.wings['main_wing'].flaps.angle = 20. * Units.deg + config.wings['main_wing'].slats.angle = 20. * Units.deg + config.max_lift_coefficient_factor = 1. #0.95 + #Noise input for the landing gear + config.landing_gear.gear_condition = 'up' + config.output_filename = 'Cutback_' + + config.propulsors['turbofan'].fan.rotation = 2780. #N1 speed + config.propulsors['turbofan'].fan_nozzle.noise_speed = 210. + config.propulsors['turbofan'].core_nozzle.noise_speed = 360. + configs.append(config) # ------------------------------------------------------------------ # Landing Configuration @@ -620,16 +682,32 @@ def configs_setup(vehicle): config = SUAVE.Components.Configs.Config(base_config) config.tag = 'landing' - config.wings['main_wing'].flaps_angle = 30. * Units.deg - config.wings['main_wing'].slats_angle = 25. * Units.deg + config.wings['main_wing'].flaps.angle = 30. * Units.deg + config.wings['main_wing'].slats.angle = 25. * Units.deg + config.max_lift_coefficient_factor = 1. #0.95 + #Noise input for the landing gear + config.landing_gear.gear_condition = 'down' + config.output_filename = 'Approach_' - config.Vref_VS_ratio = 1.23 - config.maximum_lift_coefficient = 2. + config.propulsors['turbofan'].fan.rotation = 2030. #N1 speed + config.propulsors['turbofan'].fan_nozzle.noise_speed = 109.3 + config.propulsors['turbofan'].core_nozzle.noise_speed = 92. configs.append(config) + # ------------------------------------------------------------------ + # Short Field Takeoff Configuration + # ------------------------------------------------------------------ + + config = SUAVE.Components.Configs.Config(base_config) + config.tag = 'short_field_takeoff' + + config.wings['main_wing'].flaps.angle = 20. * Units.deg + config.wings['main_wing'].slats.angle = 20. * Units.deg + config.max_lift_coefficient_factor = 1. #0.95 + + configs.append(config) - # done! return configs # ---------------------------------------------------------------------- diff --git a/tut_payload_range.py b/tut_payload_range.py index d4f9ad7..b25bf2e 100644 --- a/tut_payload_range.py +++ b/tut_payload_range.py @@ -16,7 +16,7 @@ import copy, time from SUAVE.Core import ( -Data, Container, Data_Exception, Data_Warning, +Data, Container, ) from SUAVE.Methods.Propulsion.turbofan_sizing import turbofan_sizing @@ -116,7 +116,7 @@ def base_analysis(vehicle): # ------------------------------------------------------------------ # Weights - weights = SUAVE.Analyses.Weights.Weights() + weights = SUAVE.Analyses.Weights.Weights_Tube_Wing() weights.vehicle = vehicle analyses.append(weights) diff --git a/tut_solar_uav.py b/tut_solar_uav.py index e12ebf6..d7cc489 100644 --- a/tut_solar_uav.py +++ b/tut_solar_uav.py @@ -349,7 +349,7 @@ def base_analysis(vehicle): # ------------------------------------------------------------------ # Weights - weights = SUAVE.Analyses.Weights.Weights() + weights = SUAVE.Analyses.Weights.Weights_UAV() weights.settings.empty_weight_method = \ SUAVE.Methods.Weights.Correlations.Human_Powered.empty weights.vehicle = vehicle From 71249f91289042a1edc168854b212067355a9c19 Mon Sep 17 00:00:00 2001 From: Emilio Botero Date: Mon, 14 Aug 2017 14:46:50 -0700 Subject: [PATCH 02/19] clean up of B737-800 --- tut_mission_B737.py | 366 ++++++++++++-------------------------------- 1 file changed, 97 insertions(+), 269 deletions(-) diff --git a/tut_mission_B737.py b/tut_mission_B737.py index 8b36f83..40a1581 100644 --- a/tut_mission_B737.py +++ b/tut_mission_B737.py @@ -1,28 +1,19 @@ # tut_mission_B737.py # # Created: Aug 2014, SUAVE Team -# Modified: Jan 2017, SUAVE Team - -""" setup file for a mission with a 737 -""" - +# Modified: Aug 2017, SUAVE Team # ---------------------------------------------------------------------- # Imports # ---------------------------------------------------------------------- -import SUAVE -from SUAVE.Core import Units - +# Python Imports import numpy as np import pylab as plt -import copy, time - -from SUAVE.Core import ( -Data, Container -) - +# SUAVE Imports +import SUAVE +from SUAVE.Core import Data, Units from SUAVE.Methods.Propulsion.turbofan_sizing import turbofan_sizing from SUAVE.Methods.Geometry.Two_Dimensional.Cross_Section.Propulsion import compute_turbofan_geometry from SUAVE.Input_Output.Results import print_parasite_drag, \ @@ -30,6 +21,7 @@ print_engine_data, \ print_mission_breakdown, \ print_weight_breakdown + # ---------------------------------------------------------------------- # Main # ---------------------------------------------------------------------- @@ -73,10 +65,8 @@ def main(): # plt the old results plot_mission(results) - return - # ---------------------------------------------------------------------- # Analysis Setup # ---------------------------------------------------------------------- @@ -113,14 +103,6 @@ def analyses_setup(configs): analysis = base_analysis(config) analyses[tag] = analysis - # adjust analyses for configs - - # takeoff_analysis - analyses.takeoff.aerodynamics.settings.drag_coefficient_increment = 0.0000 - - # landing analysis - aerodynamics = analyses.landing.aerodynamics - return analyses def base_analysis(vehicle): @@ -146,8 +128,6 @@ def base_analysis(vehicle): # Aerodynamics Analysis aerodynamics = SUAVE.Analyses.Aerodynamics.Fidelity_Zero() aerodynamics.geometry = vehicle - - aerodynamics.settings.drag_coefficient_increment = 0.0000 analyses.append(aerodynamics) # ------------------------------------------------------------------ @@ -187,28 +167,26 @@ def vehicle_setup(): # ------------------------------------------------------------------ vehicle = SUAVE.Vehicle() - vehicle.tag = 'Boeing_737800' - + vehicle.tag = 'Boeing_737-800' # ------------------------------------------------------------------ # Vehicle-level Properties # ------------------------------------------------------------------ # mass properties - vehicle.mass_properties.max_takeoff = 79015.8 # kg - vehicle.mass_properties.takeoff = 79015.8 # kg - vehicle.mass_properties.operating_empty = 62746.4 # kg - vehicle.mass_properties.takeoff = 79015.8 # kg - vehicle.mass_properties.max_zero_fuel = 62732.0 # kg #0.9 * vehicle.mass_properties.max_takeoff + vehicle.mass_properties.max_takeoff = 79015.8 * Units.kilogram + vehicle.mass_properties.takeoff = 79015.8 * Units.kilogram + vehicle.mass_properties.operating_empty = 62746.4 * Units.kilogram + vehicle.mass_properties.takeoff = 79015.8 * Units.kilogram + vehicle.mass_properties.max_zero_fuel = 62732.0 * Units.kilogram vehicle.mass_properties.cargo = 10000. * Units.kilogram - # envelope properties vehicle.envelope.ultimate_load = 2.5 vehicle.envelope.limit_load = 1.5 # basic parameters - vehicle.reference_area = 124.862 + vehicle.reference_area = 124.862 * Units['meters**2'] vehicle.passengers = 170 vehicle.systems.control = "fully powered" vehicle.systems.accessories = "medium range" @@ -216,20 +194,20 @@ def vehicle_setup(): # ------------------------------------------------------------------ # Landing Gear # ------------------------------------------------------------------ - #used for noise calculations + # used for noise calculations landing_gear = SUAVE.Components.Landing_Gear.Landing_Gear() landing_gear.tag = "main_landing_gear" + landing_gear.main_tire_diameter = 1.12000 * Units.m landing_gear.nose_tire_diameter = 0.6858 * Units.m - landing_gear.main_strut_length = 1.8 * Units.m - landing_gear.nose_strut_length = 1.3 * Units.m - landing_gear.main_units = 2 #number of main landing gear units - landing_gear.nose_units = 1 #number of nose landing gear + landing_gear.main_strut_length = 1.8 * Units.m + landing_gear.nose_strut_length = 1.3 * Units.m + landing_gear.main_units = 2 #number of main landing gear units + landing_gear.nose_units = 1 #number of nose landing gear landing_gear.main_wheels = 2 #number of wheels on the main landing gear landing_gear.nose_wheels = 2 #number of wheels on the nose landing gear - vehicle.landing_gear=landing_gear - - + vehicle.landing_gear = landing_gear + # ------------------------------------------------------------------ # Main Wing # ------------------------------------------------------------------ @@ -242,25 +220,17 @@ def vehicle_setup(): wing.thickness_to_chord = 0.1 wing.taper = 0.1 wing.span_efficiency = 0.9 - wing.spans.projected = 34.32 - wing.chords.root = 7.760 * Units.meter wing.chords.tip = 0.782 * Units.meter wing.chords.mean_aerodynamic = 4.235 * Units.meter - - wing.areas.reference = 124.862 - + wing.areas.reference = 124.862 * Units['meters**2'] wing.twists.root = 4.0 * Units.degrees wing.twists.tip = 0.0 * Units.degrees - wing.origin = [13.61,0,-1.27] - wing.aerodynamic_center = [0,0,0] #[3,0,0] - wing.vertical = False wing.symmetric = True wing.high_lift = True - wing.dynamic_pressure_ratio = 1.0 # ------------------------------------------------------------------ @@ -270,12 +240,10 @@ def vehicle_setup(): wing.flaps.span_start = 0.10 # -> wing.flaps.area = 97.1112 wing.flaps.span_end = 0.75 wing.flaps.type = 'double_slotted' # -> wing.flaps.number_slots = 2 - - + # add to vehicle vehicle.append_component(wing) - # ------------------------------------------------------------------ # Horizontal Stabilizer # ------------------------------------------------------------------ @@ -283,73 +251,56 @@ def vehicle_setup(): wing = SUAVE.Components.Wings.Wing() wing.tag = 'horizontal_stabilizer' - wing.aspect_ratio = 6.16 # + wing.aspect_ratio = 6.16 wing.sweeps.quarter_chord = 40 * Units.deg wing.thickness_to_chord = 0.08 wing.taper = 0.2 wing.span_efficiency = 0.9 - - wing.spans.projected = 14.2 # - - wing.chords.root = 4.7 - wing.chords.tip = .955 - wing.chords.mean_aerodynamic = 8.0 - - wing.areas.reference = 32.488 # - wing.areas.exposed = 199.7792 # Exposed area of the horizontal tail - wing.areas.wetted = 249.724 # Wetted area of the horizontal tail + wing.spans.projected = 14.2 + wing.chords.root = 4.7 * Units.meter + wing.chords.tip = .955 * Units.meter + wing.chords.mean_aerodynamic = 8.0 * Units.meter + wing.areas.reference = 32.488 * Units['meters**2'] + wing.areas.exposed = 199.7792 * Units['meters**2'] + wing.areas.wetted = 249.724 * Units['meters**2'] wing.twists.root = 3.0 * Units.degrees wing.twists.tip = 3.0 * Units.degrees - wing.origin = [32.83,0,1.14] - wing.aerodynamic_center = [0,0,0] - wing.vertical = False wing.symmetric = True - wing.dynamic_pressure_ratio = 0.9 # add to vehicle vehicle.append_component(wing) - # ------------------------------------------------------------------ # Vertical Stabilizer # ------------------------------------------------------------------ wing = SUAVE.Components.Wings.Wing() wing.tag = 'vertical_stabilizer' - - wing.aspect_ratio = 1.91 # - wing.sweeps.quarter_chord = 25 * Units.deg + + wing.aspect_ratio = 1.91 + wing.sweeps.quarter_chord = 25. * Units.deg wing.thickness_to_chord = 0.08 wing.taper = 0.25 wing.span_efficiency = 0.9 - - wing.spans.projected = 7.777 # - - wing.chords.root = 8.19 - wing.chords.tip = 0.95 - wing.chords.mean_aerodynamic = 4.0 - - wing.areas.reference = 27.316 # - + wing.spans.projected = 7.777 * Units.meter + wing.chords.root = 8.19 * Units.meter + wing.chords.tip = 0.95 * Units.meter + wing.chords.mean_aerodynamic = 4.0 * Units.meter + wing.areas.reference = 27.316 * Units['meters**2'] wing.twists.root = 0.0 * Units.degrees wing.twists.tip = 0.0 * Units.degrees - - wing.origin = [28.79,0,1.54] - wing.aerodynamic_center = [0,0,0] #[2,0,0] - + wing.origin = [28.79,0,1.54] wing.vertical = True wing.symmetric = False wing.t_tail = False - wing.dynamic_pressure_ratio = 1.0 # add to vehicle vehicle.append_component(wing) - # ------------------------------------------------------------------ # Fuselage # ------------------------------------------------------------------ @@ -358,39 +309,31 @@ def vehicle_setup(): fuselage.tag = 'fuselage' fuselage.number_coach_seats = vehicle.passengers - #fuselage.number_coach_seats = 200. fuselage.seats_abreast = 6 fuselage.seat_pitch = 1 - fuselage.fineness.nose = 1.6 fuselage.fineness.tail = 2. - - fuselage.lengths.nose = 6.4 - fuselage.lengths.tail = 8.0 - fuselage.lengths.cabin = 28.85 #44.0 - fuselage.lengths.total = 38.02 #58.4 - fuselage.lengths.fore_space = 6. - fuselage.lengths.aft_space = 5. - - fuselage.width = 3.74 #4. - - fuselage.heights.maximum = 3.74 #4. # - fuselage.heights.at_quarter_length = 3.74 # Not correct - fuselage.heights.at_three_quarters_length = 3.65 # Not correct - fuselage.heights.at_wing_root_quarter_chord = 3.74 # Not correct - - fuselage.areas.side_projected = 142.1948 #4.* 59.8 # Not correct - fuselage.areas.wetted = 446.718 #688.64 - fuselage.areas.front_projected = 12.57 - - fuselage.effective_diameter = 3.74 #4.0 - + fuselage.lengths.nose = 6.4 * Units.meter + fuselage.lengths.tail = 8.0 * Units.meter + fuselage.lengths.cabin = 28.85 * Units.meter + fuselage.lengths.total = 38.02 * Units.meter + fuselage.lengths.fore_space = 6. * Units.meter + fuselage.lengths.aft_space = 5. * Units.meter + fuselage.width = 3.74 * Units.meter + fuselage.heights.maximum = 3.74 * Units.meter + fuselage.effective_diameter = 3.74 * Units.meter + fuselage.areas.side_projected = 142.1948 * Units['meters**2'] + fuselage.areas.wetted = 446.718 * Units['meters**2'] + fuselage.areas.front_projected = 12.57 * Units['meters**2'] fuselage.differential_pressure = 5.0e4 * Units.pascal # Maximum differential pressure + fuselage.heights.at_quarter_length = 3.74 * Units.meter + fuselage.heights.at_three_quarters_length = 3.65 * Units.meter + fuselage.heights.at_wing_root_quarter_chord = 3.74 * Units.meter + # add to vehicle vehicle.append_component(fuselage) - - + # ------------------------------------------------------------------ # Turbofan Network # ------------------------------------------------------------------ @@ -400,30 +343,22 @@ def vehicle_setup(): turbofan.tag = 'turbofan' # setup - turbofan.number_of_engines = 2.0 + turbofan.number_of_engines = 2 turbofan.bypass_ratio = 5.4 - turbofan.engine_length = 2.71 - turbofan.nacelle_diameter = 2.05 - # This origin is overwritten by compute_component_centers_of_gravity(base,compute_propulsor_origin=True) + turbofan.engine_length = 2.71 * Units.meter + turbofan.nacelle_diameter = 2.05 * Units.meter turbofan.origin = [[13.72, 4.86,-1.9],[13.72, -4.86,-1.9]] #compute engine areas - Awet = 1.1*np.pi*turbofan.nacelle_diameter*turbofan.engine_length - - #Assign engine areas - turbofan.areas.wetted = Awet - - + turbofan.areas.wetted = 1.1*np.pi*turbofan.nacelle_diameter*turbofan.engine_length # working fluid turbofan.working_fluid = SUAVE.Attributes.Gases.Air() - # ------------------------------------------------------------------ # Component 1 - Ram # to convert freestream static to stagnation quantities - # instantiate ram = SUAVE.Components.Energy.Converters.Ram() ram.tag = 'ram' @@ -431,7 +366,6 @@ def vehicle_setup(): # add to the network turbofan.append(ram) - # ------------------------------------------------------------------ # Component 2 - Inlet Nozzle @@ -446,7 +380,6 @@ def vehicle_setup(): # add to network turbofan.append(inlet_nozzle) - # ------------------------------------------------------------------ # Component 3 - Low Pressure Compressor @@ -460,7 +393,6 @@ def vehicle_setup(): # add to network turbofan.append(compressor) - # ------------------------------------------------------------------ # Component 4 - High Pressure Compressor @@ -476,7 +408,6 @@ def vehicle_setup(): # add to network turbofan.append(compressor) - # ------------------------------------------------------------------ # Component 5 - Low Pressure Turbine @@ -490,7 +421,6 @@ def vehicle_setup(): # add to network turbofan.append(turbine) - # ------------------------------------------------------------------ # Component 6 - High Pressure Turbine @@ -504,8 +434,7 @@ def vehicle_setup(): turbine.polytropic_efficiency = 0.93 # add to network - turbofan.append(turbine) - + turbofan.append(turbine) # ------------------------------------------------------------------ # Component 7 - Combustor @@ -524,7 +453,6 @@ def vehicle_setup(): # add to network turbofan.append(combustor) - # ------------------------------------------------------------------ # Component 8 - Core Nozzle @@ -539,7 +467,6 @@ def vehicle_setup(): # add to network turbofan.append(nozzle) - # ------------------------------------------------------------------ # Component 9 - Fan Nozzle @@ -554,7 +481,6 @@ def vehicle_setup(): # add to network turbofan.append(nozzle) - # ------------------------------------------------------------------ # Component 10 - Fan @@ -569,7 +495,6 @@ def vehicle_setup(): # add to network turbofan.append(fan) - # ------------------------------------------------------------------ #Component 10 : thrust (to compute the thrust) thrust = SUAVE.Components.Energy.Processes.Thrust() @@ -584,39 +509,21 @@ def vehicle_setup(): isa_deviation = 0. #Engine setup for noise module - - # add to network turbofan.thrust = thrust - turbofan.core_nozzle_diameter = 0.92 - turbofan.fan_nozzle_diameter = 1.659 - turbofan.engine_height = 0.5 #Engine centerline heigh above the ground plane - turbofan.exa = 1 #distance from fan face to fan exit/ fan diameter) - turbofan.plug_diameter = 0.1 #dimater of the engine plug - turbofan.geometry_xe = 1. # Geometry information for the installation effects function - turbofan.geometry_ye = 1. # Geometry information for the installation effects function - turbofan.geometry_Ce = 2. # Geometry information for the installation effects function - - - - - #size the turbofan turbofan_sizing(turbofan,mach_number,altitude) # add gas turbine network turbofan to the vehicle vehicle.append_component(turbofan) - # ------------------------------------------------------------------ # Vehicle Definition Complete # ------------------------------------------------------------------ return vehicle - - # ---------------------------------------------------------------------- # Define the Configurations # --------------------------------------------------------------------- @@ -646,7 +553,8 @@ def configs_setup(vehicle): config.tag = 'takeoff' config.wings['main_wing'].flaps.angle = 20. * Units.deg config.wings['main_wing'].slats.angle = 25. * Units.deg - config.max_lift_coefficient_factor = 1. #0.95 + config.max_lift_coefficient_factor = 1. + #Noise input for the landing gear config.landing_gear.gear_condition = 'up' config.output_filename = 'Flyover_' @@ -665,6 +573,7 @@ def configs_setup(vehicle): config.wings['main_wing'].flaps.angle = 20. * Units.deg config.wings['main_wing'].slats.angle = 20. * Units.deg config.max_lift_coefficient_factor = 1. #0.95 + #Noise input for the landing gear config.landing_gear.gear_condition = 'up' config.output_filename = 'Cutback_' @@ -685,6 +594,7 @@ def configs_setup(vehicle): config.wings['main_wing'].flaps.angle = 30. * Units.deg config.wings['main_wing'].slats.angle = 25. * Units.deg config.max_lift_coefficient_factor = 1. #0.95 + #Noise input for the landing gear config.landing_gear.gear_condition = 'down' config.output_filename = 'Approach_' @@ -710,10 +620,6 @@ def configs_setup(vehicle): return configs -# ---------------------------------------------------------------------- -# Sizing for the Vehicle Configs -# ---------------------------------------------------------------------- - # ---------------------------------------------------------------------- # Plot Mission # ---------------------------------------------------------------------- @@ -731,14 +637,8 @@ def plot_mission(results,line_style='bo-'): for segment in results.segments.values(): time = segment.conditions.frames.inertial.time[:,0] / Units.min - Lift = -segment.conditions.frames.wind.lift_force_vector[:,2] - Drag = -segment.conditions.frames.wind.drag_force_vector[:,0] / Units.lbf Thrust = segment.conditions.frames.body.thrust_force_vector[:,0] / Units.lbf - eta = segment.conditions.propulsion.throttle[:,0] - mdot = segment.conditions.weights.vehicle_mass_rate[:,0] - thrust = segment.conditions.frames.body.thrust_force_vector[:,0] - sfc = 3600. * mdot / 0.1019715 / thrust - + eta = segment.conditions.propulsion.throttle[:,0] axes = fig.add_subplot(2,1,1) axes.plot( time , Thrust , line_style ) @@ -754,7 +654,6 @@ def plot_mission(results,line_style='bo-'): plt.savefig("B737_engine.pdf") plt.savefig("B737_engine.png") - # ------------------------------------------------------------------ # Aerodynamics 2 # ------------------------------------------------------------------ @@ -764,12 +663,9 @@ def plot_mission(results,line_style='bo-'): time = segment.conditions.frames.inertial.time[:,0] / Units.min CLift = segment.conditions.aerodynamics.lift_coefficient[:,0] CDrag = segment.conditions.aerodynamics.drag_coefficient[:,0] - Drag = -segment.conditions.frames.wind.drag_force_vector[:,0] - Thrust = segment.conditions.frames.body.thrust_force_vector[:,0] aoa = segment.conditions.aerodynamics.angle_of_attack[:,0] / Units.deg l_d = CLift/CDrag - axes = fig.add_subplot(3,1,1) axes.plot( time , CLift , line_style ) axes.set_ylabel('Lift Coefficient',axis_font) @@ -832,18 +728,13 @@ def plot_mission(results,line_style='bo-'): fig = plt.figure("Altitude_sfc_weight",figsize=(8,10)) for segment in results.segments.values(): - time = segment.conditions.frames.inertial.time[:,0] / Units.min - CLift = segment.conditions.aerodynamics.lift_coefficient[:,0] - CDrag = segment.conditions.aerodynamics.drag_coefficient[:,0] - Drag = -segment.conditions.frames.wind.drag_force_vector[:,0] - Thrust = segment.conditions.frames.body.thrust_force_vector[:,0] - aoa = segment.conditions.aerodynamics.angle_of_attack[:,0] / Units.deg - l_d = CLift/CDrag - mass = segment.conditions.weights.total_mass[:,0] / Units.lb + time = segment.conditions.frames.inertial.time[:,0] / Units.min + aoa = segment.conditions.aerodynamics.angle_of_attack[:,0] / Units.deg + mass = segment.conditions.weights.total_mass[:,0] / Units.lb altitude = segment.conditions.freestream.altitude[:,0] / Units.ft - mdot = segment.conditions.weights.vehicle_mass_rate[:,0] - thrust = segment.conditions.frames.body.thrust_force_vector[:,0] - sfc = 3600. * mdot / 0.1019715 / thrust + mdot = segment.conditions.weights.vehicle_mass_rate[:,0] + thrust = segment.conditions.frames.body.thrust_force_vector[:,0] + sfc2 = (mdot / Units.lb) / (thrust /Units.lbf) * Units.hr axes = fig.add_subplot(3,1,1) axes.plot( time , altitude , line_style ) @@ -851,7 +742,8 @@ def plot_mission(results,line_style='bo-'): axes.grid(True) axes = fig.add_subplot(3,1,3) - axes.plot( time , sfc , line_style ) + axes.plot( time , sfc1 , line_style ) + axes.plot( time , sfc2 , 'ro-') axes.set_xlabel('Time (min)',axis_font) axes.set_ylabel('sfc (lb/lbf-hr)',axis_font) axes.grid(True) @@ -865,25 +757,20 @@ def plot_mission(results,line_style='bo-'): plt.savefig("B737_mission.png") # ------------------------------------------------------------------ - # Aerodynamics 2 + # Velocities # ------------------------------------------------------------------ fig = plt.figure("Velocities",figsize=(8,10)) for segment in results.segments.values(): - time = segment.conditions.frames.inertial.time[:,0] / Units.min - Lift = -segment.conditions.frames.wind.lift_force_vector[:,2] - Drag = -segment.conditions.frames.wind.drag_force_vector[:,0] / Units.lbf - Thrust = segment.conditions.frames.body.thrust_force_vector[:,0] / Units.lbf - eta = segment.conditions.propulsion.throttle[:,0] - mdot = segment.conditions.weights.vehicle_mass_rate[:,0] - thrust = segment.conditions.frames.body.thrust_force_vector[:,0] - sfc = 3600. * mdot / 0.1019715 / thrust - velocity = segment.conditions.freestream.velocity[:,0] - pressure = segment.conditions.freestream.pressure[:,0] + time = segment.conditions.frames.inertial.time[:,0] / Units.min + Lift = -segment.conditions.frames.wind.lift_force_vector[:,2] + Drag = -segment.conditions.frames.wind.drag_force_vector[:,0] / Units.lbf + Thrust = segment.conditions.frames.body.thrust_force_vector[:,0] / Units.lb + velocity = segment.conditions.freestream.velocity[:,0] + pressure = segment.conditions.freestream.pressure[:,0] density = segment.conditions.freestream.density[:,0] - EAS = velocity * np.sqrt(density/1.225) - mach = segment.conditions.freestream.mach_number[:,0] - + EAS = velocity * np.sqrt(density/1.225) + mach = segment.conditions.freestream.mach_number[:,0] axes = fig.add_subplot(3,1,1) axes.plot( time , velocity / Units.kts, line_style ) @@ -918,9 +805,6 @@ def simple_sizing(configs): wing.areas.exposed = 0.8 * wing.areas.wetted wing.areas.affected = 0.6 * wing.areas.wetted - # fuselage seats - base.fuselages['fuselage'].number_coach_seats = base.passengers - # diff the new data base.store_diff() @@ -968,9 +852,8 @@ def mission_setup(analyses): # base segment base_segment = Segments.Segment() - # ------------------------------------------------------------------ - # First Climb Segment: constant Mach, constant segment angle + # First Climb Segment: Constant Speed, Constant Rate # ------------------------------------------------------------------ segment = Segments.Climb.Constant_Speed_Constant_Rate(base_segment) @@ -986,9 +869,8 @@ def mission_setup(analyses): # add to misison mission.append_segment(segment) - # ------------------------------------------------------------------ - # Second Climb Segment: constant Speed, constant segment angle + # Second Climb Segment: Constant Speed, Constant Rate # ------------------------------------------------------------------ segment = Segments.Climb.Constant_Speed_Constant_Rate(base_segment) @@ -1003,9 +885,8 @@ def mission_setup(analyses): # add to mission mission.append_segment(segment) - # ------------------------------------------------------------------ - # Third Climb Segment: constant Mach, constant segment angle + # Third Climb Segment: constant Speed, Constant Rate # ------------------------------------------------------------------ segment = Segments.Climb.Constant_Speed_Constant_Rate(base_segment) @@ -1020,9 +901,8 @@ def mission_setup(analyses): # add to mission mission.append_segment(segment) - # ------------------------------------------------------------------ - # Cruise Segment: constant speed, constant altitude + # Cruise Segment: Constant Speed, Constant Altitude # ------------------------------------------------------------------ segment = Segments.Cruise.Constant_Speed_Constant_Altitude(base_segment) @@ -1031,15 +911,14 @@ def mission_setup(analyses): segment.analyses.extend( analyses.cruise ) segment.air_speed = 230.412 * Units['m/s'] - segment.distance = (3933.65 + 770 - 92.6) * Units.km + segment.distance = 2490. * Units.nautical_miles # add to mission mission.append_segment(segment) - -# ------------------------------------------------------------------ -# First Descent Segment: consant speed, constant segment rate -# ------------------------------------------------------------------ + # ------------------------------------------------------------------ + # First Descent Segment: Constant Speed, Constant Rate + # ------------------------------------------------------------------ segment = Segments.Descent.Constant_Speed_Constant_Rate(base_segment) segment.tag = "descent_1" @@ -1053,9 +932,8 @@ def mission_setup(analyses): # add to mission mission.append_segment(segment) - # ------------------------------------------------------------------ - # Second Descent Segment: consant speed, constant segment rate + # Second Descent Segment: Constant Speed, Constant Rate # ------------------------------------------------------------------ segment = Segments.Descent.Constant_Speed_Constant_Rate(base_segment) @@ -1063,8 +941,6 @@ def mission_setup(analyses): segment.analyses.extend( analyses.landing ) - analyses.landing.aerodynamics.settings.spoiler_drag_increment = 0.00 - segment.altitude_end = 6.0 * Units.km segment.air_speed = 195.0 * Units['m/s'] segment.descent_rate = 5.0 * Units['m/s'] @@ -1072,16 +948,14 @@ def mission_setup(analyses): # add to mission mission.append_segment(segment) - # ------------------------------------------------------------------ - # Third Descent Segment: consant speed, constant segment rate + # Third Descent Segment: Constant Speed, Constant Rate # ------------------------------------------------------------------ segment = Segments.Descent.Constant_Speed_Constant_Rate(base_segment) segment.tag = "descent_3" segment.analyses.extend( analyses.landing ) - analyses.landing.aerodynamics.settings.spoiler_drag_increment = 0.00 segment.altitude_end = 4.0 * Units.km @@ -1091,30 +965,25 @@ def mission_setup(analyses): # add to mission mission.append_segment(segment) - # ------------------------------------------------------------------ - # Fourth Descent Segment: consant speed, constant segment rate + # Fourth Descent Segment: Constant Speed, Constant Rate # ------------------------------------------------------------------ segment = Segments.Descent.Constant_Speed_Constant_Rate(base_segment) segment.tag = "descent_4" segment.analyses.extend( analyses.landing ) - analyses.landing.aerodynamics.settings.spoiler_drag_increment = 0.00 segment.altitude_end = 2.0 * Units.km segment.air_speed = 150.0 * Units['m/s'] segment.descent_rate = 5.0 * Units['m/s'] - # add to mission mission.append_segment(segment) - - # ------------------------------------------------------------------ - # Fifth Descent Segment: consant speed, constant segment rate + # Fifth Descent Segment: Constant Speed, Constant Rate # ------------------------------------------------------------------ segment = Segments.Descent.Constant_Speed_Constant_Rate(base_segment) @@ -1123,12 +992,10 @@ def mission_setup(analyses): segment.analyses.extend( analyses.landing ) analyses.landing.aerodynamics.settings.spoiler_drag_increment = 0.00 - segment.altitude_end = 0.0 * Units.km segment.air_speed = 145.0 * Units['m/s'] segment.descent_rate = 3.0 * Units['m/s'] - # append to mission mission.append_segment(segment) @@ -1149,48 +1016,9 @@ def missions_setup(base_mission): missions.base = base_mission - - # ------------------------------------------------------------------ - # Mission for Constrained Fuel - # ------------------------------------------------------------------ - fuel_mission = SUAVE.Analyses.Mission.Mission() #Fuel_Constrained() - fuel_mission.tag = 'fuel' - fuel_mission.range = 1277. * Units.nautical_mile - fuel_mission.payload = 19000. - missions.append(fuel_mission) - - - # ------------------------------------------------------------------ - # Mission for Constrained Short Field - # ------------------------------------------------------------------ - short_field = SUAVE.Analyses.Mission.Mission(base_mission) #Short_Field_Constrained() - short_field.tag = 'short_field' - - #airport - airport = SUAVE.Attributes.Airports.Airport() - airport.altitude = 0.0 * Units.ft - airport.delta_isa = 0.0 - airport.atmosphere = SUAVE.Attributes.Atmospheres.Earth.US_Standard_1976() - airport.available_tofl = 1500. - short_field.airport = airport - missions.append(short_field) - - - - # ------------------------------------------------------------------ - # Mission for Fixed Payload - # ------------------------------------------------------------------ - payload = SUAVE.Analyses.Mission.Mission() #Payload_Constrained() - payload.tag = 'payload' - payload.range = 2316. * Units.nautical_mile - payload.payload = 19000. - missions.append(payload) - - # done! return missions if __name__ == '__main__': main() - plt.show() - + plt.show() \ No newline at end of file From 3e3befc7e34075f916d7570f4a01777101bf8741 Mon Sep 17 00:00:00 2001 From: Emilio Botero Date: Mon, 14 Aug 2017 14:52:32 -0700 Subject: [PATCH 03/19] fixing sfc error --- tut_mission_B737.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tut_mission_B737.py b/tut_mission_B737.py index 40a1581..10397e2 100644 --- a/tut_mission_B737.py +++ b/tut_mission_B737.py @@ -734,7 +734,7 @@ def plot_mission(results,line_style='bo-'): altitude = segment.conditions.freestream.altitude[:,0] / Units.ft mdot = segment.conditions.weights.vehicle_mass_rate[:,0] thrust = segment.conditions.frames.body.thrust_force_vector[:,0] - sfc2 = (mdot / Units.lb) / (thrust /Units.lbf) * Units.hr + sfc = (mdot / Units.lb) / (thrust /Units.lbf) * Units.hr axes = fig.add_subplot(3,1,1) axes.plot( time , altitude , line_style ) @@ -742,8 +742,7 @@ def plot_mission(results,line_style='bo-'): axes.grid(True) axes = fig.add_subplot(3,1,3) - axes.plot( time , sfc1 , line_style ) - axes.plot( time , sfc2 , 'ro-') + axes.plot( time , sfc , line_style ) axes.set_xlabel('Time (min)',axis_font) axes.set_ylabel('sfc (lb/lbf-hr)',axis_font) axes.grid(True) From 91770a941ca0f02630b6fca4d7c1688ff4b90032 Mon Sep 17 00:00:00 2001 From: Emilio Botero Date: Mon, 14 Aug 2017 14:57:49 -0700 Subject: [PATCH 04/19] solar uav clean up --- tut_mission_B737.py | 3 --- tut_solar_uav.py | 33 +++++++++------------------------ 2 files changed, 9 insertions(+), 27 deletions(-) diff --git a/tut_mission_B737.py b/tut_mission_B737.py index 10397e2..d7360e9 100644 --- a/tut_mission_B737.py +++ b/tut_mission_B737.py @@ -153,7 +153,6 @@ def base_analysis(vehicle): atmosphere.features.planet = planet.features analyses.append(atmosphere) - # done! return analyses # ---------------------------------------------------------------------- @@ -821,7 +820,6 @@ def simple_sizing(configs): # diff the new data landing.store_diff() - # done! return # ---------------------------------------------------------------------- @@ -1015,7 +1013,6 @@ def missions_setup(base_mission): missions.base = base_mission - # done! return missions if __name__ == '__main__': diff --git a/tut_solar_uav.py b/tut_solar_uav.py index d7cc489..de2ab62 100644 --- a/tut_solar_uav.py +++ b/tut_solar_uav.py @@ -1,22 +1,17 @@ # tut_solar_UAV.py # # Created: Jul 2014, E. Botero -# Modified: Jan 2017, E. Botero +# Modified: Aug 2017, E. Botero #---------------------------------------------------------------------- # Imports # ---------------------------------------------------------------------- import SUAVE -from SUAVE.Core import Units - -from SUAVE.Core import ( -Data, Container -) +from SUAVE.Core import Units, Data import numpy as np import pylab as plt -import matplotlib -import copy, time +import time from SUAVE.Components.Energy.Networks.Solar import Solar from SUAVE.Methods.Propulsion import propeller_design @@ -104,7 +99,7 @@ def vehicle_setup(): wing.tag = 'main_wing' wing.areas.reference = vehicle.reference_area - wing.spans.projected = 40.0 + wing.spans.projected = 40.0 * Units.meter wing.aspect_ratio = (wing.spans.projected**2)/wing.areas.reference wing.sweeps.quarter_chord = 0.0 * Units.deg wing.symmetric = True @@ -149,7 +144,7 @@ def vehicle_setup(): wing.spans.projected = np.sqrt(wing.aspect_ratio*wing.areas.reference) wing.twists.root = 0.0 * Units.degrees wing.twists.tip = 0.0 * Units.degrees - + wing.vertical = False wing.symmetric = True wing.dynamic_pressure_ratio = 0.9 @@ -182,7 +177,6 @@ def vehicle_setup(): wing.chords.root = wing.areas.reference/wing.spans.projected wing.chords.tip = wing.areas.reference/wing.spans.projected wing.chords.mean_aerodynamic = wing.areas.reference/wing.spans.projected - wing.areas.wetted = 2.0 * wing.areas.reference wing.areas.exposed = 0.8 * wing.areas.wetted wing.areas.affected = 0.6 * wing.areas.wetted @@ -209,7 +203,7 @@ def vehicle_setup(): net.nacelle_diameter = 0.2 net.engine_length = 0.01 net.areas = Data() - net.areas.wetted = 0.01*(2*np.pi*0.01/2) + net.areas.wetted = 0.01*(2*np.pi*0.01/2.) # Component 1 the Sun? sun = SUAVE.Components.Energy.Processes.Solar_Radiation() @@ -228,18 +222,17 @@ def vehicle_setup(): net.esc = esc # Component 5 the Propeller - # Design the Propeller prop_attributes = Data() prop_attributes.number_blades = 2.0 - prop_attributes.freestream_velocity = 40.0 # freestream m/s + prop_attributes.freestream_velocity = 40.0 * Units['m/s']# freestream prop_attributes.angular_velocity = 150. * Units['rpm'] prop_attributes.tip_radius = 4.25 prop_attributes.hub_radius = 0.05 prop_attributes.design_Cl = 0.7 prop_attributes.design_altitude = 14.0 * Units.km prop_attributes.design_thrust = 0.0 - prop_attributes.design_power = 3500.0 + prop_attributes.design_power = 3500.0 * Units.watts prop_attributes = propeller_design(prop_attributes) prop = SUAVE.Components.Energy.Converters.Propeller() @@ -289,7 +282,6 @@ def vehicle_setup(): return vehicle - # ---------------------------------------------------------------------- # Define the Configurations # --------------------------------------------------------------------- @@ -315,7 +307,6 @@ def configs_setup(vehicle): configs.append(config) - # done! return configs @@ -576,7 +567,6 @@ def plot_mission(results): cdm = drag_breakdown.miscellaneous.total[:,0] cd = drag_breakdown.total[:,0] - axes.plot( time , cdp , 'ko-', label='CD_P' ) axes.plot( time , cdi , 'bo-', label='CD_I' ) axes.plot( time , cdc , 'go-', label='CD_C' ) @@ -590,7 +580,6 @@ def plot_mission(results): axes.set_ylabel('CD') axes.grid(True) - # ------------------------------------------------------------------ # Battery Energy # ------------------------------------------------------------------ @@ -680,8 +669,6 @@ def plot_mission(results): axes.grid(True) plt.ylim((0,1)) - - # ------------------------------------------------------------------ # Flight Conditions # ------------------------------------------------------------------ @@ -718,7 +705,6 @@ def plot_mission(results): # ------------------------------------------------------------------ # Solar Flux, Charging Power, Battery Energy # ------------------------------------------------------------------ - fig = plt.figure("Electric Outputs") for segment in results.segments.values(): @@ -744,10 +730,9 @@ def plot_mission(results): axes.set_ylabel('Battery Energy (MJ)') axes.grid(True) - return if __name__ == '__main__': main() - plt.show() + plt.show() \ No newline at end of file From 8f5cd70dbce23f27d5fd6164636673459ffe081a Mon Sep 17 00:00:00 2001 From: Emilio Botero Date: Mon, 14 Aug 2017 15:12:12 -0700 Subject: [PATCH 05/19] cleanup concorde --- tut_concorde.py | 206 +++++++++++++++--------------------------------- 1 file changed, 64 insertions(+), 142 deletions(-) diff --git a/tut_concorde.py b/tut_concorde.py index 495e71c..d1b0b83 100644 --- a/tut_concorde.py +++ b/tut_concorde.py @@ -2,29 +2,22 @@ # # Created: Aug 2014, SUAVE Team # Modified: Jan 2017, T. MacDonald +# Aug 2017, E. Botero """ setup file for a mission with a concorde """ - # ---------------------------------------------------------------------- # Imports # ---------------------------------------------------------------------- import SUAVE -from SUAVE.Core import Units +from SUAVE.Core import Units, Data +from SUAVE.Methods.Propulsion.turbojet_sizing import turbojet_sizing import numpy as np import pylab as plt -import copy, time - -from SUAVE.Core import ( -Data, Container, -) - -from SUAVE.Methods.Propulsion.turbojet_sizing import turbojet_sizing - # ---------------------------------------------------------------------- # Main # ---------------------------------------------------------------------- @@ -52,7 +45,6 @@ def main(source_ratio=1.): return - # ---------------------------------------------------------------------- # Analysis Setup # ---------------------------------------------------------------------- @@ -74,7 +66,6 @@ def full_setup(source_ratio=1.): analyses.configs = configs_analyses analyses.missions = missions_analyses - return configs, analyses # ---------------------------------------------------------------------- @@ -113,9 +104,7 @@ def base_analysis(vehicle): # ------------------------------------------------------------------ # Aerodynamics Analysis - aerodynamics = SUAVE.Analyses.Aerodynamics.Supersonic_Zero() - aerodynamics.geometry = vehicle aerodynamics.settings.drag_coefficient_increment = 0.0000 analyses.append(aerodynamics) @@ -154,23 +143,22 @@ def vehicle_setup(source_ratio=1.): vehicle = SUAVE.Vehicle() vehicle.tag = 'Concorde' - # ------------------------------------------------------------------ # Vehicle-level Properties # ------------------------------------------------------------------ # mass properties - vehicle.mass_properties.max_takeoff = 185000. # kg - vehicle.mass_properties.operating_empty = 78700. # kg - vehicle.mass_properties.takeoff = 185000. # kg - vehicle.mass_properties.cargo = 1000. * Units.kilogram + vehicle.mass_properties.max_takeoff = 185000. * Units.kilogram + vehicle.mass_properties.operating_empty = 78700. * Units.kilogram + vehicle.mass_properties.takeoff = 185000. * Units.kilogram + vehicle.mass_properties.cargo = 1000. * Units.kilogram # envelope properties vehicle.envelope.ultimate_load = 3.5 vehicle.envelope.limit_load = 1.5 # basic parameters - vehicle.reference_area = 358.25 + vehicle.reference_area = 358.25 * Units['meter**2'] vehicle.passengers = 100 vehicle.systems.control = "fully powered" vehicle.systems.accessories = "long range" @@ -188,31 +176,24 @@ def vehicle_setup(source_ratio=1.): wing.thickness_to_chord = 0.03 wing.taper = 0. wing.span_efficiency = .8 - - wing.spans.projected = 25.6 - - wing.chords.root = 33.8 - wing.total_length = 33.8 - wing.chords.tip = 1.1 - wing.chords.mean_aerodynamic = 18.4 - - wing.areas.reference = 358.25 + wing.spans.projected = 25.6 * Units.meter + wing.chords.root = 33.8 * Units.meter + wing.total_length = 33.8 * Units.meter + wing.chords.tip = 1.1 * Units.meter + wing.chords.mean_aerodynamic = 18.4 * Units.meter + wing.areas.reference = 358.25 * Units['meter**2'] wing.areas.wetted = 653. - 12.*2.4*2 # 2.4 is engine area on one side - wing.areas.exposed = 326.5 - wing.areas.affected = .6*wing.areas.reference - + wing.areas.exposed = 326.5 * Units['meter**2'] + wing.areas.affected = .6 * wing.areas.reference wing.twists.root = 0.0 * Units.degrees wing.twists.tip = 0.0 * Units.degrees - wing.origin = [14,0,-.8] wing.aerodynamic_center = [35,0,0] - wing.vertical = False wing.symmetric = True wing.high_lift = True wing.vortex_lift = True wing.high_mach = True - wing.dynamic_pressure_ratio = 1.0 wing_airfoil = SUAVE.Components.Wings.Airfoils.Airfoil() @@ -273,7 +254,6 @@ def vehicle_setup(source_ratio=1.): # add to vehicle vehicle.append_component(wing) - # ------------------------------------------------------------------ # Vertical Stabilizer # ------------------------------------------------------------------ @@ -281,35 +261,28 @@ def vehicle_setup(source_ratio=1.): wing = SUAVE.Components.Wings.Wing() wing.tag = 'vertical_stabilizer' - wing.aspect_ratio = 0.74 # + wing.aspect_ratio = 0.74 wing.sweeps.quarter_chord = 60 * Units.deg wing.thickness_to_chord = 0.04 wing.taper = 0.14 wing.span_efficiency = 0.9 - - wing.spans.projected = 6.0 # - - wing.chords.root = 14.5 - wing.total_length = 14.5 - wing.chords.tip = 2.7 - wing.chords.mean_aerodynamic = 8.66 - - wing.areas.reference = 33.91 # - wing.areas.wetted = 76. - wing.areas.exposed = 38. - wing.areas.affected = 33.91 - - wing.twists.root = 0.0 * Units.degrees - wing.twists.tip = 0.0 * Units.degrees - + wing.spans.projected = 6.0 * Units.meter + wing.chords.root = 14.5 * Units.meter + wing.total_length = 14.5 * Units.meter + wing.chords.tip = 2.7 * Units.meter + wing.chords.mean_aerodynamic = 8.66 * Units.meter + wing.areas.reference = 33.91 * Units['meter**2'] + wing.areas.wetted = 76. * Units['meter**2'] + wing.areas.exposed = 38. * Units['meter**2'] + wing.areas.affected = 33.91 * Units['meter**2'] + wing.twists.root = 0.0 * Units.degrees + wing.twists.tip = 0.0 * Units.degrees wing.origin = [42.,0,1.] wing.aerodynamic_center = [50,0,0] - wing.vertical = True wing.symmetric = False wing.t_tail = False wing.high_mach = True - wing.dynamic_pressure_ratio = 1.0 tail_airfoil = SUAVE.Components.Wings.Airfoils.Airfoil() @@ -324,7 +297,7 @@ def vehicle_setup(source_ratio=1.): segment.twist = 0. * Units.deg segment.root_chord_percent = 14.5/14.5 segment.dihedral_outboard = 0. - segment.sweeps.quarter_chord = 63. * Units.deg + segment.sweeps.quarter_chord = 63 * Units.deg segment.vsp_mesh = Data() segment.vsp_mesh.inner_radius = 2.9/source_ratio segment.vsp_mesh.outer_radius = 1.5/source_ratio @@ -352,43 +325,31 @@ def vehicle_setup(source_ratio=1.): # add to vehicle vehicle.append_component(wing) - # ------------------------------------------------------------------ # Fuselage # ------------------------------------------------------------------ fuselage = SUAVE.Components.Fuselages.Fuselage() fuselage.tag = 'fuselage' - fuselage.seats_abreast = 4 fuselage.seat_pitch = 1 - - fuselage.fineness.nose = 4.3 - fuselage.fineness.tail = 6.4 - - fuselage.lengths.total = 61.66 - - fuselage.width = 2.88 - - fuselage.heights.maximum = 3.32 # - - fuselage.heights.maximum = 3.32 # - fuselage.heights.at_quarter_length = 3.32 # - fuselage.heights.at_wing_root_quarter_chord = 3.32 # - fuselage.heights.at_three_quarters_length = 3.32 # - - fuselage.areas.wetted = 447. - fuselage.areas.front_projected = 11.9 - - - fuselage.effective_diameter = 3.1 - + fuselage.fineness.nose = 4.3 * Units.meter + fuselage.fineness.tail = 6.4 * Units.meter + fuselage.lengths.total = 61.66 * Units.meter + fuselage.width = 2.88 * Units.meter + fuselage.heights.maximum = 3.32 * Units.meter + fuselage.heights.maximum = 3.32 * Units.meter + fuselage.heights.at_quarter_length = 3.32 * Units.meter + fuselage.heights.at_wing_root_quarter_chord = 3.32 * Units.meter + fuselage.heights.at_three_quarters_length = 3.32 * Units.meter + fuselage.areas.wetted = 447. * Units['meter**2'] + fuselage.areas.front_projected = 11.9 * Units['meter**2'] + fuselage.effective_diameter = 3.1 * Units.meter fuselage.differential_pressure = 7.4e4 * Units.pascal # Maximum differential pressure # add to vehicle vehicle.append_component(fuselage) - - + # ------------------------------------------------------------------ # Turbojet Network # ------------------------------------------------------------------ @@ -400,16 +361,15 @@ def vehicle_setup(source_ratio=1.): # setup turbojet.number_of_engines = 4.0 turbojet.engine_length = 12.0 - turbojet.nacelle_diameter = 1.3 - turbojet.inlet_diameter = 1.1 + turbojet.nacelle_diameter = 1.3 * Units.meter + turbojet.inlet_diameter = 1.1 * Units.meter turbojet.areas = Data() - turbojet.areas.wetted = 12.5*4.7*2. # 4.7 is outer perimeter on one side + turbojet.areas.wetted = 12.5*4.7*2. * Units['meter**2'] # 4.7 is outer perimeter on one side turbojet.origin = [[37.,6.,-1.3],[37.,5.3,-1.3],[37.,-5.3,-1.3],[37.,-6.,-1.3]] # working fluid turbojet.working_fluid = SUAVE.Attributes.Gases.Air() - - + # ------------------------------------------------------------------ # Component 1 - Ram @@ -422,7 +382,6 @@ def vehicle_setup(source_ratio=1.): # add to the network turbojet.append(ram) - # ------------------------------------------------------------------ # Component 2 - Inlet Nozzle @@ -437,7 +396,6 @@ def vehicle_setup(source_ratio=1.): # add to network turbojet.append(inlet_nozzle) - # ------------------------------------------------------------------ # Component 3 - Low Pressure Compressor @@ -452,7 +410,6 @@ def vehicle_setup(source_ratio=1.): # add to network turbojet.append(compressor) - # ------------------------------------------------------------------ # Component 4 - High Pressure Compressor @@ -467,7 +424,6 @@ def vehicle_setup(source_ratio=1.): # add to network turbojet.append(compressor) - # ------------------------------------------------------------------ # Component 5 - Low Pressure Turbine @@ -482,7 +438,6 @@ def vehicle_setup(source_ratio=1.): # add to network turbojet.append(turbine) - # ------------------------------------------------------------------ # Component 6 - High Pressure Turbine @@ -497,7 +452,6 @@ def vehicle_setup(source_ratio=1.): # add to network turbojet.append(turbine) - # ------------------------------------------------------------------ # Component 7 - Combustor @@ -515,7 +469,6 @@ def vehicle_setup(source_ratio=1.): # add to network turbojet.append(combustor) - # ------------------------------------------------------------------ # Component 8 - Core Nozzle @@ -529,15 +482,10 @@ def vehicle_setup(source_ratio=1.): # add to network turbojet.append(nozzle) + # ------------------------------------------------------------------ - # Component 9 - Divergening Nozzle - - - - - # ------------------------------------------------------------------ - #Component 10 : thrust (to compute the thrust) + #Component 9 : Thrust (to compute the thrust) thrust = SUAVE.Components.Energy.Processes.Thrust() thrust.tag ='compute_thrust' @@ -559,14 +507,12 @@ def vehicle_setup(source_ratio=1.): # add gas turbine network gt_engine to the vehicle vehicle.append_component(turbojet) - # ------------------------------------------------------------------ # Vehicle Definition Complete # ------------------------------------------------------------------ return vehicle - # ---------------------------------------------------------------------- # Define the Configurations # --------------------------------------------------------------------- @@ -592,7 +538,6 @@ def configs_setup(vehicle): configs.append(config) - # ------------------------------------------------------------------ # Takeoff Configuration # ------------------------------------------------------------------ @@ -608,7 +553,6 @@ def configs_setup(vehicle): configs.append(config) - # ------------------------------------------------------------------ # Landing Configuration # ------------------------------------------------------------------ @@ -624,13 +568,8 @@ def configs_setup(vehicle): configs.append(config) - # done! return configs -# ---------------------------------------------------------------------- -# Sizing for the Vehicle Configs -# ---------------------------------------------------------------------- - # ---------------------------------------------------------------------- # Plot Mission # ---------------------------------------------------------------------- @@ -648,13 +587,11 @@ def plot_mission(results,line_style='bo-'): for segment in results.segments.values(): time = segment.conditions.frames.inertial.time[:,0] / Units.min - Thrust = segment.conditions.frames.body.thrust_force_vector[:,0]*0.224808943 + Thrust = segment.conditions.frames.body.thrust_force_vector[:,0] /Units.lbf eta = segment.conditions.propulsion.throttle[:,0] - axes = fig.add_subplot(2,1,1) axes.plot( time , Thrust , line_style ) - #axes.set_xlabel('Time (min)',axis_font) axes.set_ylabel('Thrust (lbf)',axis_font) axes.grid(True) @@ -664,7 +601,6 @@ def plot_mission(results,line_style='bo-'): axes.set_ylabel('eta (lb/lbf-hr)',axis_font) axes.grid(True) - # ------------------------------------------------------------------ # Aerodynamics # ------------------------------------------------------------------ @@ -677,16 +613,13 @@ def plot_mission(results,line_style='bo-'): aoa = segment.conditions.aerodynamics.angle_of_attack[:,0] / Units.deg l_d = CLift/CDrag - axes = fig.add_subplot(3,1,1) axes.plot( time , CLift , line_style ) - #axes.set_xlabel('Time (min)',axis_font) axes.set_ylabel('Lift Coefficient',axis_font) axes.grid(True) axes = fig.add_subplot(3,1,2) axes.plot( time , l_d , line_style ) - #axes.set_xlabel('Time (min)',axis_font) axes.set_ylabel('L/D',axis_font) axes.grid(True) @@ -696,7 +629,6 @@ def plot_mission(results,line_style='bo-'): axes.set_ylabel('AOA (deg)',axis_font) axes.grid(True) - # ------------------------------------------------------------------ # Drag # ------------------------------------------------------------------ @@ -738,21 +670,18 @@ def plot_mission(results,line_style='bo-'): fig = plt.figure("Altitude_sfc_weight",figsize=(8,10)) for segment in results.segments.values(): - time = segment.conditions.frames.inertial.time[:,0] / Units.min - mass = segment.conditions.weights.total_mass[:,0]*2.20462 - altitude = segment.conditions.freestream.altitude[:,0] / Units.km *3.28084 *1000 - mach = segment.conditions.freestream.mach_number[:,0] - + time = segment.conditions.frames.inertial.time[:,0] / Units.min + mass = segment.conditions.weights.total_mass[:,0] / Units.lb + altitude = segment.conditions.freestream.altitude[:,0] / Units.feet + mach = segment.conditions.freestream.mach_number[:,0] axes = fig.add_subplot(3,1,1) axes.plot( time , altitude , line_style ) - #axes.set_xlabel('Time (min)',axis_font) axes.set_ylabel('Altitude (ft)',axis_font) axes.grid(True) axes = fig.add_subplot(3,1,2) axes.plot( time , mass , 'ro-' ) - #axes.set_xlabel('Time (min)',axis_font) axes.set_ylabel('Weight (lb)',axis_font) axes.grid(True) @@ -817,7 +746,7 @@ def mission_setup(analyses): # ------------------------------------------------------------------ - # First Climb Segment: constant Mach, constant segment angle + # First Climb Segment # ------------------------------------------------------------------ segment = Segments.Climb.Constant_Speed_Constant_Rate(base_segment) @@ -838,7 +767,7 @@ def mission_setup(analyses): # ------------------------------------------------------------------ - # Second Climb Segment: constant Speed, constant segment angle + # Second Climb Segment # ------------------------------------------------------------------ segment = Segments.Climb.Constant_Speed_Constant_Rate(base_segment) @@ -855,7 +784,7 @@ def mission_setup(analyses): # ------------------------------------------------------------------ - # Third Climb Segment: linear Mach, constant segment angle + # Third Climb Segment: linear Mach # ------------------------------------------------------------------ segment = Segments.Climb.Linear_Mach_Constant_Rate(base_segment) @@ -872,7 +801,7 @@ def mission_setup(analyses): mission.append_segment(segment) # ------------------------------------------------------------------ - # Fourth Climb Segment: linear Mach, constant segment angle + # Fourth Climb Segment: linear Mach # ------------------------------------------------------------------ segment = Segments.Climb.Linear_Mach_Constant_Rate(base_segment) @@ -890,11 +819,9 @@ def mission_setup(analyses): # ------------------------------------------------------------------ - # Fourth Climb Segment: linear Mach, constant segment angle + # Fourth Climb Segment # ------------------------------------------------------------------ - - ## Cruise-climb - + segment = Segments.Climb.Constant_Mach_Constant_Rate(base_segment) segment.tag = "climb_5" @@ -907,9 +834,8 @@ def mission_setup(analyses): # add to mission mission.append_segment(segment) - # ------------------------------------------------------------------ - # Cruise Segment: constant speed, constant altitude + # Cruise Segment # ------------------------------------------------------------------ segment = Segments.Cruise.Constant_Mach_Constant_Altitude(base_segment) @@ -922,9 +848,8 @@ def mission_setup(analyses): mission.append_segment(segment) - # ------------------------------------------------------------------ - # First Descent Segment: linear mach, constant segment rate + # First Descent Segment # ------------------------------------------------------------------ segment = Segments.Descent.Linear_Mach_Constant_Rate(base_segment) @@ -941,7 +866,7 @@ def mission_setup(analyses): mission.append_segment(segment) # ------------------------------------------------------------------ - # Second Descent Segment: linear mach, constant segment rate + # Second Descent Segment # ------------------------------------------------------------------ segment = Segments.Descent.Linear_Mach_Constant_Rate(base_segment) @@ -958,7 +883,7 @@ def mission_setup(analyses): mission.append_segment(segment) # ------------------------------------------------------------------ - # Third Descent Segment: consant speed, constant segment rate + # Third Descent Segment # ------------------------------------------------------------------ segment = Segments.Descent.Constant_Speed_Constant_Rate(base_segment) @@ -995,7 +920,4 @@ def missions_setup(base_mission): if __name__ == '__main__': - main() - - #plt.show() - + main() \ No newline at end of file From e9e22cff0249aacbaa36f2eee8dfd66a5b2d8133 Mon Sep 17 00:00:00 2001 From: Tim MacDonald Date: Mon, 14 Aug 2017 15:14:54 -0700 Subject: [PATCH 06/19] 737 updates --- .../Optimize_Surrogate.py | 197 ------------------ tut_mission_B737.py | 45 +--- 2 files changed, 10 insertions(+), 232 deletions(-) delete mode 100644 Regional_Jet_Optimization/Optimize_Surrogate.py diff --git a/Regional_Jet_Optimization/Optimize_Surrogate.py b/Regional_Jet_Optimization/Optimize_Surrogate.py deleted file mode 100644 index 023767b..0000000 --- a/Regional_Jet_Optimization/Optimize_Surrogate.py +++ /dev/null @@ -1,197 +0,0 @@ -# Optimize.py -# Created: Feb 2016, M. Vegh -# Modified: - -# ---------------------------------------------------------------------- -# Imports -# ---------------------------------------------------------------------- - -import SUAVE -from SUAVE.Core import Units, Data -import numpy as np -import Vehicles -import Analyses -import Missions -import Procedure -import Plot_Mission -import matplotlib.pyplot as plt -from SUAVE.Optimization import Nexus, carpet_plot -import SUAVE.Optimization.Package_Setups.scipy_setup as scipy_setup -from SUAVE.Optimization.Surrogate_Optimization import Surrogate_Optimization -import pyOpt -# ---------------------------------------------------------------------- -# Run the whole thing -# ---------------------------------------------------------------------- -def main(): - problem = setup() - number_of_points = 10 - build_surrogate(problem, number_of_points) - output = problem.objective() #uncomment this line when using the default inputs - - ''' - #uncomment these lines when you want to start an optimization problem from a different initial guess - inputs = [1.28, 1.38] - scaling = problem.optimization_problem.inputs[:,3] #have to rescale inputs to start problem from here - scaled_inputs = np.multiply(inputs,scaling) - problem.optimization_problem.inputs[:,1] = scaled_inputs - ''' - #output = scipy_setup.SciPy_Solve(problem,solver='SLSQP') - - - - #variable_sweep(problem) #uncomment this to view some contours of the problem - print 'fuel burn=', problem.summary.base_mission_fuelburn - print 'fuel margin=', problem.all_constraints() - - Plot_Mission.plot_mission(problem) - - return - - - -# ---------------------------------------------------------------------- -# Inputs, Objective, & Constraints -# ---------------------------------------------------------------------- - -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 - # ------------------------------------------------------------------- - nexus.vehicle_configurations = Vehicles.setup() - - - # ------------------------------------------------------------------- - # Analyses - # ------------------------------------------------------------------- - nexus.analyses = Analyses.setup(nexus.vehicle_configurations) - - - # ------------------------------------------------------------------- - # Missions - # ------------------------------------------------------------------- - nexus.missions = Missions.setup(nexus.analyses) - - - # ------------------------------------------------------------------- - # Procedure - # ------------------------------------------------------------------- - nexus.procedure = Procedure.setup() - - # ------------------------------------------------------------------- - # Summary - # ------------------------------------------------------------------- - nexus.summary = Data() - nexus.total_number_of_iterations = 0 - return nexus - -def variable_sweep(problem): - number_of_points=5 - outputs=carpet_plot(problem, number_of_points, 0, 0) #run carpet plot, suppressing default plots - inputs =outputs.inputs - objective=outputs.objective - constraints=outputs.constraint_val - plt.figure(0) - CS = plt.contourf(inputs[0,:],inputs[1,:], objective, 20, linewidths=2) - cbar = plt.colorbar(CS) - - cbar.ax.set_ylabel('fuel burn (kg)') - CS_const=plt.contour(inputs[0,:],inputs[1,:], constraints[0,:,:]) - plt.clabel(CS_const, inline=1, fontsize=10) - cbar = plt.colorbar(CS_const) - cbar.ax.set_ylabel('fuel margin') - - - - plt.xlabel('wing area (m^2)') - plt.ylabel('cruise_altitude (km)') - - ''' - #now plot optimization path (note that these data points were post-processed into a plottable format) - wing_1 = [95 , 95.00000149 , 95 , 95 , 95.00000149 , 95 , 95 , 95.00000149 , 95 , 106.674165 , 106.6741665 , 106.674165 , 106.674165 , 106.6741665 , 106.674165 , 106.674165 , 106.6741665 , 106.674165 , 105.6274294 , 105.6274309 , 105.6274294 , 105.6274294 , 105.6274309 , 105.6274294 , 105.6274294 , 105.6274309 , 105.6274294 , 106.9084316 , 106.9084331 , 106.9084316 , 106.9084316 , 106.9084331 , 106.9084316 , 106.9084316 , 106.9084331 , 106.9084316 , 110.520489 , 110.5204905 , 110.520489 , 110.520489 , 110.5204905 , 110.520489 , 110.520489 , 110.5204905 , 110.520489 , 113.2166831 , 113.2166845 , 113.2166831 , 113.2166831 , 113.2166845 , 113.2166831 , 113.2166831 , 113.2166845 , 113.2166831 , 114.1649262 , 114.1649277 , 114.1649262 , 114.1649262 , 114.1649277 , 114.1649262 , 114.1649262 , 114.1649277 , 114.1649262 , 114.2149828] - alt_1 = [11.0 , 11.0 , 11.000000149011612, 11.0 , 11.0 , 11.000000149011612, 11.0 , 11.0 , 11.000000149011612, 9.540665954351425 , 9.540665954351425 , 9.540666103363037 , 9.540665954351425 , 9.540665954351425 , 9.540666103363037 , 9.540665954351425 , 9.540665954351425 , 9.540666103363037 , 10.023015652305284, 10.023015652305284, 10.023015801316896, 10.023015652305284, 10.023015652305284, 10.023015801316896, 10.023015652305284, 10.023015652305284, 10.023015801316896, 10.190994033521863, 10.190994033521863, 10.190994182533474, 10.190994033521863, 10.190994033521863, 10.190994182533474, 10.190994033521863, 10.190994033521863, 10.190994182533474, 10.440582829327589, 10.440582829327589, 10.4405829783392 , 10.440582829327589, 10.440582829327589, 10.4405829783392 , 10.440582829327589, 10.440582829327589, 10.4405829783392 , 10.536514606250261, 10.536514606250261, 10.536514755261873, 10.536514606250261, 10.536514606250261, 10.536514755261873, 10.536514606250261, 10.536514606250261, 10.536514755261873, 10.535957839878783, 10.535957839878783, 10.535957988890395, 10.535957839878783, 10.535957839878783, 10.535957988890395, 10.535957839878783, 10.535957839878783, 10.535957988890395, 10.52829047] - wing_2 = [128 , 128.0000015, 128 , 128 , 128.0000015, 128 , 128 , 128.0000015, 128 , 130 , 130.0000015, 130 , 130 , 130.0000015, 130 , 130 , 130.0000015, 130 , 122.9564124, 122.9564139, 122.9564124, 122.9564124, 122.9564139, 122.9564124, 122.9564124, 122.9564139, 122.9564124, 116.5744347, 116.5744362, 116.5744347, 116.5744347, 116.5744362, 116.5744347, 116.5744347, 116.5744362, 116.5744347, 116.3530891, 116.3530906, 116.3530891, 116.3530891, 116.3530906, 116.3530891, 116.3530891, 116.3530906, 116.3530891] - alt_2 = [13.8, 13.799999999999999, 13.80000014901161, 13.799999999999999, 13.799999999999999, 13.80000014901161, 13.799999999999999, 13.799999999999999, 13.80000014901161, 11.302562430674953, 11.302562430674953, 11.302562579686565, 11.302562430674953, 11.302562430674953, 11.302562579686565, 11.302562430674953, 11.302562430674953, 11.302562579686565, 11.158808932491421, 11.158808932491421, 11.158809081503033, 11.158808932491421, 11.158808932491421, 11.158809081503033, 11.158808932491421, 11.158808932491421, 11.158809081503033, 11.412913394878741, 11.412913394878741, 11.412913543890353, 11.412913394878741, 11.412913394878741, 11.412913543890353, 11.412913394878741, 11.412913394878741, 11.412913543890353, 11.402627869388722, 11.402627869388722, 11.402628018400334, 11.402627869388722, 11.402627869388722, 11.402628018400334, 11.402627869388722, 11.402627869388722, 11.402628018400334] - - - opt_1 = plt.plot(wing_1, alt_1, label='optimization path 1') - init_1 = plt.plot(wing_1[0], alt_1[0], 'ko') - final_1 = plt.plot(wing_1[-1], alt_1[-1], 'kx') - - opt_2 = plt.plot(wing_2, alt_2, 'k--', label='optimization path 2') - init_2 = plt.plot(wing_2[0], alt_2[0], 'ko', label= 'initial points') - final_2 = plt.plot(wing_2[-1], alt_2[-1], 'kx', label= 'final points') - ''' - plt.legend(loc='upper left') - plt.show() - - - - return -def build_surrogate(problem, number_of_points): - - surrogate_optimization = Surrogate_Optimization() #create surrogate optimization_problem - surrogate_optimization.sample_plan = VyPy.sampling.lhc_uniform - surrogate_optimization.optimizer = pyOpt.pySNOPT.SNOPT() - surrogate_optimization.problem = problem - surrogate_optimization.number_of_points = number_of_points - surrogate_optimization.surrogate_model = 'GPR' - surrogate_optimization.optimization_filename = 'results.txt' - surrogate_optimization.build_surrogate() - output, surrogate_problem = surrogate_optimization.iterative_optimization() - - -if __name__ == '__main__': - main() - - diff --git a/tut_mission_B737.py b/tut_mission_B737.py index d7360e9..c97c6fd 100644 --- a/tut_mission_B737.py +++ b/tut_mission_B737.py @@ -219,14 +219,14 @@ def vehicle_setup(): wing.thickness_to_chord = 0.1 wing.taper = 0.1 wing.span_efficiency = 0.9 - wing.spans.projected = 34.32 + wing.spans.projected = 34.32 * Units.meter wing.chords.root = 7.760 * Units.meter wing.chords.tip = 0.782 * Units.meter wing.chords.mean_aerodynamic = 4.235 * Units.meter wing.areas.reference = 124.862 * Units['meters**2'] wing.twists.root = 4.0 * Units.degrees wing.twists.tip = 0.0 * Units.degrees - wing.origin = [13.61,0,-1.27] + wing.origin = [13.61,0,-1.27] # meters wing.vertical = False wing.symmetric = True wing.high_lift = True @@ -235,10 +235,10 @@ def vehicle_setup(): # ------------------------------------------------------------------ # Flaps # ------------------------------------------------------------------ - wing.flaps.chord = 0.30 - wing.flaps.span_start = 0.10 # -> wing.flaps.area = 97.1112 + wing.flaps.chord = 0.30 # 30% of the chord + wing.flaps.span_start = 0.10 # 10% of the span wing.flaps.span_end = 0.75 - wing.flaps.type = 'double_slotted' # -> wing.flaps.number_slots = 2 + wing.flaps.type = 'double_slotted' # add to vehicle vehicle.append_component(wing) @@ -255,7 +255,7 @@ def vehicle_setup(): wing.thickness_to_chord = 0.08 wing.taper = 0.2 wing.span_efficiency = 0.9 - wing.spans.projected = 14.2 + wing.spans.projected = 14.2 * Units.meter wing.chords.root = 4.7 * Units.meter wing.chords.tip = .955 * Units.meter wing.chords.mean_aerodynamic = 8.0 * Units.meter @@ -264,7 +264,7 @@ def vehicle_setup(): wing.areas.wetted = 249.724 * Units['meters**2'] wing.twists.root = 3.0 * Units.degrees wing.twists.tip = 3.0 * Units.degrees - wing.origin = [32.83,0,1.14] + wing.origin = [32.83,0,1.14] # meters wing.vertical = False wing.symmetric = True wing.dynamic_pressure_ratio = 0.9 @@ -291,7 +291,7 @@ def vehicle_setup(): wing.areas.reference = 27.316 * Units['meters**2'] wing.twists.root = 0.0 * Units.degrees wing.twists.tip = 0.0 * Units.degrees - wing.origin = [28.79,0,1.54] + wing.origin = [28.79,0,1.54] # meters wing.vertical = True wing.symmetric = False wing.t_tail = False @@ -346,7 +346,7 @@ def vehicle_setup(): turbofan.bypass_ratio = 5.4 turbofan.engine_length = 2.71 * Units.meter turbofan.nacelle_diameter = 2.05 * Units.meter - turbofan.origin = [[13.72, 4.86,-1.9],[13.72, -4.86,-1.9]] + turbofan.origin = [[13.72, 4.86,-1.9],[13.72, -4.86,-1.9]] # meters #compute engine areas turbofan.areas.wetted = 1.1*np.pi*turbofan.nacelle_diameter*turbofan.engine_length @@ -444,8 +444,7 @@ def vehicle_setup(): # setup combustor.efficiency = 0.99 - combustor.alphac = 1.0 - combustor.turbine_inlet_temperature = 1450 + combustor.turbine_inlet_temperature = 1450 # K combustor.pressure_ratio = 0.95 combustor.fuel_data = SUAVE.Attributes.Propellants.Jet_A() @@ -553,14 +552,6 @@ def configs_setup(vehicle): config.wings['main_wing'].flaps.angle = 20. * Units.deg config.wings['main_wing'].slats.angle = 25. * Units.deg config.max_lift_coefficient_factor = 1. - - #Noise input for the landing gear - config.landing_gear.gear_condition = 'up' - config.output_filename = 'Flyover_' - - config.propulsors['turbofan'].fan.rotation = 3470. #N1 speed - config.propulsors['turbofan'].fan_nozzle.noise_speed = 315. - config.propulsors['turbofan'].core_nozzle.noise_speed = 415. configs.append(config) @@ -572,14 +563,6 @@ def configs_setup(vehicle): config.wings['main_wing'].flaps.angle = 20. * Units.deg config.wings['main_wing'].slats.angle = 20. * Units.deg config.max_lift_coefficient_factor = 1. #0.95 - - #Noise input for the landing gear - config.landing_gear.gear_condition = 'up' - config.output_filename = 'Cutback_' - - config.propulsors['turbofan'].fan.rotation = 2780. #N1 speed - config.propulsors['turbofan'].fan_nozzle.noise_speed = 210. - config.propulsors['turbofan'].core_nozzle.noise_speed = 360. configs.append(config) @@ -593,14 +576,6 @@ def configs_setup(vehicle): config.wings['main_wing'].flaps.angle = 30. * Units.deg config.wings['main_wing'].slats.angle = 25. * Units.deg config.max_lift_coefficient_factor = 1. #0.95 - - #Noise input for the landing gear - config.landing_gear.gear_condition = 'down' - config.output_filename = 'Approach_' - - config.propulsors['turbofan'].fan.rotation = 2030. #N1 speed - config.propulsors['turbofan'].fan_nozzle.noise_speed = 109.3 - config.propulsors['turbofan'].core_nozzle.noise_speed = 92. configs.append(config) From fb89cf251a9211a94587a66148d63f6a14bd71fd Mon Sep 17 00:00:00 2001 From: Emilio Botero Date: Mon, 14 Aug 2017 15:25:25 -0700 Subject: [PATCH 07/19] updating payload range --- tut_payload_range.py | 241 +++++++++++++------------------------------ 1 file changed, 71 insertions(+), 170 deletions(-) diff --git a/tut_payload_range.py b/tut_payload_range.py index b25bf2e..d05bada 100644 --- a/tut_payload_range.py +++ b/tut_payload_range.py @@ -2,26 +2,19 @@ # # Created: Aug 2014, SUAVE Team # Modified: Apr 2016, T. Orra +# Aug 2017, E. Botero # ---------------------------------------------------------------------- # Imports # ---------------------------------------------------------------------- import SUAVE -from SUAVE.Core import Units - -import numpy as np -import pylab as plt - -import copy, time - -from SUAVE.Core import ( -Data, Container, -) - +from SUAVE.Core import Units, Data from SUAVE.Methods.Propulsion.turbofan_sizing import turbofan_sizing from SUAVE.Methods.Performance import payload_range +import numpy as np +import pylab as plt # ---------------------------------------------------------------------- # Main @@ -76,7 +69,6 @@ def full_setup(): return configs, analyses - # ---------------------------------------------------------------------- # Define the Vehicle Analyses # ---------------------------------------------------------------------- @@ -95,10 +87,6 @@ def analyses_setup(configs): # takeoff_analysis analyses.takeoff.aerodynamics.drag_coefficient_increment = 0.1000 - # landing analysis - aerodynamics = analyses.landing.aerodynamics - # do something here eventually - return analyses def base_analysis(vehicle): @@ -136,7 +124,7 @@ def base_analysis(vehicle): # ------------------------------------------------------------------ # Propulsion Analysis energy= SUAVE.Analyses.Energy.Energy() - energy.network = vehicle.propulsors #what is called throughout the mission (at every time step)) + energy.network = vehicle.propulsors analyses.append(energy) # ------------------------------------------------------------------ @@ -150,10 +138,8 @@ def base_analysis(vehicle): atmosphere.features.planet = planet.features analyses.append(atmosphere) - # done! return analyses - # ---------------------------------------------------------------------- # Define the Vehicle # ---------------------------------------------------------------------- @@ -172,13 +158,13 @@ def vehicle_setup(): # ------------------------------------------------------------------ # mass properties - vehicle.mass_properties.max_takeoff = 51800.0 # kg - vehicle.mass_properties.operating_empty = 29100.0 # kg - vehicle.mass_properties.takeoff = 51800.0 # kg - vehicle.mass_properties.max_zero_fuel = 45600.0 # kg - vehicle.mass_properties.cargo = 0.0 * Units.kg - vehicle.mass_properties.max_payload = 11786. * Units.kg - vehicle.mass_properties.max_fuel = 12970. + vehicle.mass_properties.max_takeoff = 51800.0 * Units.kg + vehicle.mass_properties.operating_empty = 29100.0 * Units.kg + vehicle.mass_properties.takeoff = 51800.0 * Units.kg + vehicle.mass_properties.max_zero_fuel = 45600.0 * Units.kg + vehicle.mass_properties.cargo = 0.0 * Units.kg + vehicle.mass_properties.max_payload = 11786. * Units.kg + vehicle.mass_properties.max_fuel = 12970. * Units.kg # envelope properties vehicle.envelope.ultimate_load = 3.5 @@ -202,28 +188,20 @@ def vehicle_setup(): wing.thickness_to_chord = 0.11 wing.taper = 0.16 wing.span_efficiency = 1.0 - - wing.spans.projected = 27.8 - - wing.chords.root = 5.7057 - wing.chords.tip = 0.9129 - wing.chords.mean_aerodynamic = 3.8878 - - wing.areas.reference = 92.0 - wing.areas.wetted = 2.0 * wing.areas.reference - wing.areas.exposed = 0.8 * wing.areas.wetted - wing.areas.affected = 0.6 * wing.areas.wetted - - wing.twists.root = 2.0 * Units.degrees - wing.twists.tip = 0.0 * Units.degrees - - wing.origin = [20,0,0] - wing.aerodynamic_center = [3,0,0] - + wing.spans.projected = 27.8 * Units.meter + wing.chords.root = 5.7057 * Units.meter + wing.chords.tip = 0.9129 * Units.meter + wing.chords.mean_aerodynamic = 3.8878 * Units.meter + wing.areas.reference = 92.0 * Units['meters**2'] + wing.areas.wetted = 2.0 * wing.areas.reference + wing.areas.exposed = 0.8 * wing.areas.wetted + wing.areas.affected = 0.6 * wing.areas.wetted + wing.twists.root = 2.0 * Units.degrees + wing.twists.tip = 0.0 * Units.degrees + wing.origin = [20.,0,0] wing.vertical = False wing.symmetric = True - - wing.dynamic_pressure_ratio = 1.0 + wing.dynamic_pressure_ratio = 1.0 # add to vehicle vehicle.append_component(wing) @@ -240,28 +218,21 @@ def vehicle_setup(): wing.thickness_to_chord = 0.11 wing.taper = 0.11 wing.span_efficiency = 0.9 - - wing.spans.projected = 11.958 - - wing.chords.root = 3.9175 - wing.chords.tip = 0.4309 - wing.chords.mean_aerodynamic = 2.6401 - - wing.areas.reference = 26.0 - wing.areas.wetted = 2.0 * wing.areas.reference - wing.areas.exposed = 0.8 * wing.areas.wetted - wing.areas.affected = 0.6 * wing.areas.wetted - + wing.spans.projected = 11.958 * Units.meter + wing.chords.root = 3.9175 * Units.meter + wing.chords.tip = 0.4309 * Units.meter + wing.chords.mean_aerodynamic = 2.6401 * Units.meter + wing.areas.reference = 26.0 * Units['meters**2'] + wing.areas.wetted = 2.0 * wing.areas.reference + wing.areas.exposed = 0.8 * wing.areas.wetted + wing.areas.affected = 0.6 * wing.areas.wetted wing.twists.root = 2.0 * Units.degrees wing.twists.tip = 2.0 * Units.degrees - wing.origin = [50,0,0] wing.aerodynamic_center = [2,0,0] - wing.vertical = False wing.symmetric = True - - wing.dynamic_pressure_ratio = 0.9 + wing.dynamic_pressure_ratio = 0.9 # add to vehicle vehicle.append_component(wing) @@ -278,28 +249,21 @@ def vehicle_setup(): wing.thickness_to_chord = 0.12 wing.taper = 0.10 wing.span_efficiency = 0.9 - - wing.spans.projected = 5.2153 # - - wing.chords.root = 5.5779 - wing.chords.tip = 0.5577 - wing.chords.mean_aerodynamic = 3.7524 - - wing.areas.reference = 16.0 # - wing.areas.wetted = 2.0 * wing.areas.reference - wing.areas.exposed = 0.8 * wing.areas.wetted - wing.areas.affected = 0.6 * wing.areas.wetted - + wing.spans.projected = 5.2153 * Units.meter + wing.chords.root = 5.5779 * Units.meter + wing.chords.tip = 0.5577 * Units.meter + wing.chords.mean_aerodynamic = 3.7524 * Units.meter + wing.areas.reference = 16.0 * Units['meters**2'] + wing.areas.wetted = 2.0 * wing.areas.reference + wing.areas.exposed = 0.8 * wing.areas.wetted + wing.areas.affected = 0.6 * wing.areas.wetted wing.twists.root = 0.0 * Units.degrees wing.twists.tip = 0.0 * Units.degrees - wing.origin = [50,0,0] wing.aerodynamic_center = [2,0,0] - wing.vertical = True wing.symmetric = False - - wing.dynamic_pressure_ratio = 1.0 + wing.dynamic_pressure_ratio = 1.0 # add to vehicle vehicle.append_component(wing) @@ -314,30 +278,23 @@ def vehicle_setup(): fuselage.number_coach_seats = vehicle.passengers fuselage.seats_abreast = 4 fuselage.seat_pitch = 0.7455 - fuselage.fineness.nose = 2.0 fuselage.fineness.tail = 3.0 - - fuselage.lengths.nose = 6.0 - fuselage.lengths.tail = 9.0 - fuselage.lengths.cabin = 21.24 - fuselage.lengths.total = 36.24 - fuselage.lengths.fore_space = 0. - fuselage.lengths.aft_space = 0. - - fuselage.width = 3.0 - - fuselage.heights.maximum = 3.4 - fuselage.heights.at_quarter_length = 3.4 - fuselage.heights.at_three_quarters_length = 3.4 - fuselage.heights.at_wing_root_quarter_chord = 3.4 - - fuselage.areas.side_projected = 239.20 - fuselage.areas.wetted = 327.01 - fuselage.areas.front_projected = 8.0110 - - fuselage.effective_diameter = 3.2 - + fuselage.lengths.nose = 6.0 * Units.meter + fuselage.lengths.tail = 9.0 * Units.meter + fuselage.lengths.cabin = 21.24 * Units.meter + fuselage.lengths.total = 36.24 * Units.meter + fuselage.lengths.fore_space = 0. * Units.meter + fuselage.lengths.aft_space = 0. * Units.meter + fuselage.width = 3.0 * Units.meter + fuselage.heights.maximum = 3.4 * Units.meter + fuselage.heights.at_quarter_length = 3.4 * Units.meter + fuselage.heights.at_three_quarters_length = 3.4 * Units.meter + fuselage.heights.at_wing_root_quarter_chord = 3.4 * Units.meter + fuselage.areas.side_projected = 239.20 * Units['meters**2'] + fuselage.areas.wetted = 327.01 * Units['meters**2'] + fuselage.areas.front_projected = 8.0110 * Units['meters**2'] + fuselage.effective_diameter = 3.2 * Units.meter fuselage.differential_pressure = 10**5 * Units.pascal # Maximum differential pressure # add to vehicle @@ -358,11 +315,7 @@ def vehicle_setup(): gt_engine.nacelle_diameter = 2.05 #set the working fluid for the network - working_fluid = SUAVE.Attributes.Gases.Air - - #add working fluid to the network - gt_engine.working_fluid = working_fluid - + gt_engine.working_fluid = SUAVE.Attributes.Gases.Air #Component 1 : ram, to convert freestream static to stagnation quantities ram = SUAVE.Components.Energy.Converters.Ram() @@ -371,7 +324,6 @@ def vehicle_setup(): #add ram to the network gt_engine.ram = ram - #Component 2 : inlet nozzle inlet_nozzle = SUAVE.Components.Energy.Converters.Compression_Nozzle() inlet_nozzle.tag = 'inlet nozzle' @@ -382,7 +334,6 @@ def vehicle_setup(): #add inlet nozzle to the network gt_engine.inlet_nozzle = inlet_nozzle - #Component 3 :low pressure compressor low_pressure_compressor = SUAVE.Components.Energy.Converters.Compressor() low_pressure_compressor.tag = 'lpc' @@ -393,8 +344,6 @@ def vehicle_setup(): #add low pressure compressor to the network gt_engine.low_pressure_compressor = low_pressure_compressor - - #Component 4 :high pressure compressor high_pressure_compressor = SUAVE.Components.Energy.Converters.Compressor() high_pressure_compressor.tag = 'hpc' @@ -405,7 +354,6 @@ def vehicle_setup(): #add the high pressure compressor to the network gt_engine.high_pressure_compressor = high_pressure_compressor - #Component 5 :low pressure turbine low_pressure_turbine = SUAVE.Components.Energy.Converters.Turbine() low_pressure_turbine.tag='lpt' @@ -416,8 +364,6 @@ def vehicle_setup(): #add low pressure turbine to the network gt_engine.low_pressure_turbine = low_pressure_turbine - - #Component 5 :high pressure turbine high_pressure_turbine = SUAVE.Components.Energy.Converters.Turbine() high_pressure_turbine.tag='hpt' @@ -428,12 +374,9 @@ def vehicle_setup(): #add the high pressure turbine to the network gt_engine.high_pressure_turbine = high_pressure_turbine - - #Component 6 :combustor combustor = SUAVE.Components.Energy.Converters.Combustor() combustor.tag = 'Comb' - combustor.efficiency = 0.99 combustor.alphac = 1.0 combustor.turbine_inlet_temperature = 1500 @@ -443,8 +386,6 @@ def vehicle_setup(): #add the combustor to the network gt_engine.combustor = combustor - - #Component 7 :core nozzle core_nozzle = SUAVE.Components.Energy.Converters.Expansion_Nozzle() core_nozzle.tag = 'core nozzle' @@ -455,7 +396,6 @@ def vehicle_setup(): #add the core nozzle to the network gt_engine.core_nozzle = core_nozzle - #Component 8 :fan nozzle fan_nozzle = SUAVE.Components.Energy.Converters.Expansion_Nozzle() fan_nozzle.tag = 'fan nozzle' @@ -466,8 +406,6 @@ def vehicle_setup(): #add the fan nozzle to the network gt_engine.fan_nozzle = fan_nozzle - - #Component 9 : fan fan = SUAVE.Components.Energy.Converters.Fan() fan.tag = 'fan' @@ -478,8 +416,6 @@ def vehicle_setup(): #add the fan to the network gt_engine.fan = fan - - #Component 10 : thrust (to compute the thrust) thrust = SUAVE.Components.Energy.Processes.Thrust() thrust.tag ='compute_thrust' @@ -507,7 +443,6 @@ def vehicle_setup(): return vehicle - # ---------------------------------------------------------------------- # Define the Configurations # --------------------------------------------------------------------- @@ -533,7 +468,6 @@ def configs_setup(vehicle): configs.append(config) - # ------------------------------------------------------------------ # Takeoff Configuration # ------------------------------------------------------------------ @@ -549,7 +483,6 @@ def configs_setup(vehicle): configs.append(config) - # ------------------------------------------------------------------ # Landing Configuration # ------------------------------------------------------------------ @@ -565,11 +498,8 @@ def configs_setup(vehicle): configs.append(config) - - # done! return configs - # ---------------------------------------------------------------------- # Define the Mission # ---------------------------------------------------------------------- @@ -600,9 +530,8 @@ def mission_setup(analyses): # base segment base_segment = Segments.Segment() - # ------------------------------------------------------------------ - # First Climb Segment: constant Mach, constant segment angle + # First Climb Segment # ------------------------------------------------------------------ segment = Segments.Climb.Constant_Speed_Constant_Rate(base_segment) @@ -620,9 +549,8 @@ def mission_setup(analyses): # add to misison mission.append_segment(segment) - # ------------------------------------------------------------------ - # Second Climb Segment: constant Speed, constant segment angle + # Second Climb Segment # ------------------------------------------------------------------ segment = Segments.Climb.Constant_Speed_Constant_Rate(base_segment) @@ -639,9 +567,8 @@ def mission_setup(analyses): # add to mission mission.append_segment(segment) - # ------------------------------------------------------------------ - # Third Climb Segment: constant Mach, constant segment angle + # Third Climb Segment # ------------------------------------------------------------------ segment = Segments.Climb.Constant_Speed_Constant_Rate(base_segment) @@ -660,7 +587,7 @@ def mission_setup(analyses): # ------------------------------------------------------------------ - # Cruise Segment: constant speed, constant altitude + # Cruise Segment # ------------------------------------------------------------------ segment = Segments.Cruise.Constant_Speed_Constant_Altitude(base_segment) @@ -673,22 +600,15 @@ def mission_setup(analyses): segment.atmosphere = atmosphere segment.planet = planet - segment.air_speed = 447. * Units.knots #230. * Units['m/s'] - ## 35kft: - # 415. => M = 0.72 - # 450. => M = 0.78 - # 461. => M = 0.80 - ## 37kft: - # 447. => M = 0.78 + segment.air_speed = 447. * Units.knots segment.distance = 2100. * Units.nmi # add to mission mission.append_segment(segment) - -# ------------------------------------------------------------------ -# First Descent Segment: consant speed, constant segment rate -# ------------------------------------------------------------------ + # ------------------------------------------------------------------ + # First Descent Segment + # ------------------------------------------------------------------ segment = Segments.Descent.Constant_Speed_Constant_Rate(base_segment) segment.tag = "descent_1" @@ -704,9 +624,8 @@ def mission_setup(analyses): # add to mission mission.append_segment(segment) - # ------------------------------------------------------------------ - # Second Descent Segment: consant speed, constant segment rate + # Second Descent Segment # ------------------------------------------------------------------ segment = Segments.Descent.Constant_Speed_Constant_Rate(base_segment) @@ -715,7 +634,6 @@ def mission_setup(analyses): # connect vehicle configuration segment.analyses.extend( analyses.landing ) - analyses.landing.aerodynamics.settings.spoiler_drag_increment = 0.00 # segment attributes segment.altitude_end = 6.0 * Units.km segment.air_speed = 195.0 * Units['m/s'] @@ -726,7 +644,7 @@ def mission_setup(analyses): # ------------------------------------------------------------------ - # Third Descent Segment: consant speed, constant segment rate + # Third Descent Segment # ------------------------------------------------------------------ segment = Segments.Descent.Constant_Speed_Constant_Rate(base_segment) @@ -735,7 +653,6 @@ def mission_setup(analyses): # connect vehicle configuration segment.analyses.extend( analyses.landing ) - analyses.landing.aerodynamics.settings.spoiler_drag_increment = 0.00 # segment attributes segment.altitude_end = 4.0 * Units.km segment.air_speed = 170.0 * Units['m/s'] @@ -744,9 +661,8 @@ def mission_setup(analyses): # add to mission mission.append_segment(segment) - # ------------------------------------------------------------------ - # Fourth Descent Segment: consant speed, constant segment rate + # Fourth Descent Segment # ------------------------------------------------------------------ segment = Segments.Descent.Constant_Speed_Constant_Rate(base_segment) @@ -754,8 +670,6 @@ def mission_setup(analyses): segment.analyses.extend( analyses.landing ) - analyses.landing.aerodynamics.settings.spoiler_drag_increment = 0.00 - segment.altitude_end = 2.0 * Units.km segment.air_speed = 150.0 * Units['m/s'] segment.descent_rate = 5.0 * Units['m/s'] @@ -764,24 +678,19 @@ def mission_setup(analyses): # add to mission mission.append_segment(segment) - - # ------------------------------------------------------------------ - # Fifth Descent Segment: consant speed, constant segment rate + # Fifth Descent Segment # ------------------------------------------------------------------ segment = Segments.Descent.Constant_Speed_Constant_Rate(base_segment) segment.tag = "descent_5" segment.analyses.extend( analyses.landing ) - analyses.landing.aerodynamics.settings.spoiler_drag_increment = 0.00 - segment.altitude_end = 0.0 * Units.km segment.air_speed = 145.0 * Units['m/s'] segment.descent_rate = 3.0 * Units['m/s'] - # append to mission mission.append_segment(segment) @@ -790,8 +699,6 @@ def mission_setup(analyses): # ------------------------------------------------------------------ return mission -#: def define_mission() - # ---------------------------------------------------------------------- # Plot Mission @@ -812,7 +719,6 @@ def plot_mission(results,line_style='bo-'): axes.set_ylabel('Throttle') axes.grid(True) - # ------------------------------------------------------------------ # Angle of Attack # ------------------------------------------------------------------ @@ -827,7 +733,6 @@ def plot_mission(results,line_style='bo-'): axes.set_ylabel('Angle of Attack (deg)') axes.grid(True) - # ------------------------------------------------------------------ # Fuel Burn Rate # ------------------------------------------------------------------ @@ -841,7 +746,6 @@ def plot_mission(results,line_style='bo-'): axes.set_ylabel('Fuel Burn Rate (kg/s)') axes.grid(True) - # ------------------------------------------------------------------ # Altitude # ------------------------------------------------------------------ @@ -855,7 +759,6 @@ def plot_mission(results,line_style='bo-'): axes.set_ylabel('Altitude (km)') axes.grid(True) - # ------------------------------------------------------------------ # Vehicle Mass # ------------------------------------------------------------------ @@ -869,7 +772,6 @@ def plot_mission(results,line_style='bo-'): axes.set_ylabel('Vehicle Mass (kg)') axes.grid(True) - # ------------------------------------------------------------------ # Aerodynamics # ------------------------------------------------------------------ @@ -970,5 +872,4 @@ def plot_mission(results,line_style='bo-'): if __name__ == '__main__': main() - plt.show() - + plt.show() \ No newline at end of file From 8cd51a3ec09fafaef4663e15ee4b374ca2b13720 Mon Sep 17 00:00:00 2001 From: Tim MacDonald Date: Mon, 14 Aug 2017 15:30:00 -0700 Subject: [PATCH 08/19] concorde still with segments --- tut_concorde.py | 69 ++++++++++--------------------------------------- 1 file changed, 13 insertions(+), 56 deletions(-) diff --git a/tut_concorde.py b/tut_concorde.py index d1b0b83..b929848 100644 --- a/tut_concorde.py +++ b/tut_concorde.py @@ -22,9 +22,9 @@ # Main # ---------------------------------------------------------------------- -def main(source_ratio=1.): +def main(): - configs, analyses = full_setup(source_ratio) + configs, analyses = full_setup() simple_sizing(configs) @@ -49,10 +49,10 @@ def main(source_ratio=1.): # Analysis Setup # ---------------------------------------------------------------------- -def full_setup(source_ratio=1.): +def full_setup(): # vehicle data - vehicle = vehicle_setup(source_ratio) + vehicle = vehicle_setup() configs = configs_setup(vehicle) # vehicle analyses @@ -134,7 +134,7 @@ def base_analysis(vehicle): # done! return analyses -def vehicle_setup(source_ratio=1.): +def vehicle_setup(): # ------------------------------------------------------------------ # Initialize the Vehicle @@ -187,8 +187,8 @@ def vehicle_setup(source_ratio=1.): wing.areas.affected = .6 * wing.areas.reference wing.twists.root = 0.0 * Units.degrees wing.twists.tip = 0.0 * Units.degrees - wing.origin = [14,0,-.8] - wing.aerodynamic_center = [35,0,0] + wing.origin = [14,0,-.8] # meters + wing.aerodynamic_center = [35,0,0] # meters wing.vertical = False wing.symmetric = True wing.high_lift = True @@ -196,11 +196,6 @@ def vehicle_setup(source_ratio=1.): wing.high_mach = True wing.dynamic_pressure_ratio = 1.0 - wing_airfoil = SUAVE.Components.Wings.Airfoils.Airfoil() - wing_airfoil.coordinate_file = 'NACA65-203.dat' - - wing.append_airfoil(wing_airfoil) - # set root sweep with inner section segment = SUAVE.Components.Wings.Segment() segment.tag = 'section_1' @@ -209,13 +204,6 @@ def vehicle_setup(source_ratio=1.): segment.root_chord_percent = 33.8/33.8 segment.dihedral_outboard = 0. segment.sweeps.quarter_chord = 67. * Units.deg - segment.vsp_mesh = Data() - segment.vsp_mesh.inner_radius = 1./source_ratio - segment.vsp_mesh.outer_radius = 1./source_ratio - segment.vsp_mesh.inner_length = .044/source_ratio - segment.vsp_mesh.outer_length = .044/source_ratio - segment.vsp_mesh.matching_TE = False - segment.append_airfoil(wing_airfoil) wing.Segments.append(segment) # set mid section start point @@ -226,13 +214,6 @@ def vehicle_setup(source_ratio=1.): segment.root_chord_percent = 13.8/33.8 segment.dihedral_outboard = 0. segment.sweeps.quarter_chord = 48. * Units.deg - segment.vsp_mesh = Data() - segment.vsp_mesh.inner_radius = 1./source_ratio - segment.vsp_mesh.outer_radius = .88/source_ratio - segment.vsp_mesh.inner_length = .044/source_ratio - segment.vsp_mesh.outer_length = .044/source_ratio - segment.vsp_mesh.matching_TE = False - segment.append_airfoil(wing_airfoil) wing.Segments.append(segment) # set tip section start point @@ -243,12 +224,6 @@ def vehicle_setup(source_ratio=1.): segment.root_chord_percent = 4.4/33.8 segment.dihedral_outboard = 0. segment.sweeps.quarter_chord = 71. * Units.deg - segment.vsp_mesh = Data() - segment.vsp_mesh.inner_radius = .88/source_ratio - segment.vsp_mesh.outer_radius = .22/source_ratio - segment.vsp_mesh.inner_length = .044/source_ratio - segment.vsp_mesh.outer_length = .011/source_ratio - segment.append_airfoil(wing_airfoil) wing.Segments.append(segment) # add to vehicle @@ -277,18 +252,13 @@ def vehicle_setup(source_ratio=1.): wing.areas.affected = 33.91 * Units['meter**2'] wing.twists.root = 0.0 * Units.degrees wing.twists.tip = 0.0 * Units.degrees - wing.origin = [42.,0,1.] - wing.aerodynamic_center = [50,0,0] + wing.origin = [42.,0,1.] # meters + wing.aerodynamic_center = [50,0,0] # meters wing.vertical = True wing.symmetric = False wing.t_tail = False wing.high_mach = True wing.dynamic_pressure_ratio = 1.0 - - tail_airfoil = SUAVE.Components.Wings.Airfoils.Airfoil() - tail_airfoil.coordinate_file = 'supertail_refined.dat' - - wing.append_airfoil(tail_airfoil) # set root sweep with inner section segment = SUAVE.Components.Wings.Segment() @@ -298,12 +268,6 @@ def vehicle_setup(source_ratio=1.): segment.root_chord_percent = 14.5/14.5 segment.dihedral_outboard = 0. segment.sweeps.quarter_chord = 63 * Units.deg - segment.vsp_mesh = Data() - segment.vsp_mesh.inner_radius = 2.9/source_ratio - segment.vsp_mesh.outer_radius = 1.5/source_ratio - segment.vsp_mesh.inner_length = .044/source_ratio - segment.vsp_mesh.outer_length = .044/source_ratio - segment.append_airfoil(tail_airfoil) wing.Segments.append(segment) # set mid section start point @@ -314,12 +278,6 @@ def vehicle_setup(source_ratio=1.): segment.root_chord_percent = 7.5/14.5 segment.dihedral_outboard = 0. segment.sweeps.quarter_chord = 40. * Units.deg - segment.vsp_mesh = Data() - segment.vsp_mesh.inner_radius = 1.5/source_ratio - segment.vsp_mesh.outer_radius = .54/source_ratio - segment.vsp_mesh.inner_length = .044/source_ratio - segment.vsp_mesh.outer_length = .027/source_ratio - segment.append_airfoil(tail_airfoil) wing.Segments.append(segment) # add to vehicle @@ -365,7 +323,7 @@ def vehicle_setup(source_ratio=1.): turbojet.inlet_diameter = 1.1 * Units.meter turbojet.areas = Data() turbojet.areas.wetted = 12.5*4.7*2. * Units['meter**2'] # 4.7 is outer perimeter on one side - turbojet.origin = [[37.,6.,-1.3],[37.,5.3,-1.3],[37.,-5.3,-1.3],[37.,-6.,-1.3]] + turbojet.origin = [[37.,6.,-1.3],[37.,5.3,-1.3],[37.,-5.3,-1.3],[37.,-6.,-1.3]] # meters # working fluid turbojet.working_fluid = SUAVE.Attributes.Gases.Air() @@ -460,8 +418,7 @@ def vehicle_setup(source_ratio=1.): combustor.tag = 'combustor' # setup - combustor.efficiency = 0.99 - combustor.alphac = 1.0 + combustor.efficiency = 0.99 combustor.turbine_inlet_temperature = 1450. combustor.pressure_ratio = 1.0 combustor.fuel_data = SUAVE.Attributes.Propellants.Jet_A() @@ -489,11 +446,11 @@ def vehicle_setup(source_ratio=1.): thrust = SUAVE.Components.Energy.Processes.Thrust() thrust.tag ='compute_thrust' - #total design thrust (includes all the engines) + # total design thrust (includes all the engines) thrust.total_design = 4*140000. * Units.N #Newtons # Note: Sizing builds the propulsor. It does not actually set the size of the turbojet - #design sizing conditions + # design sizing conditions altitude = 0.0*Units.ft mach_number = 0.01 isa_deviation = 0. From 0758da22625515f3895dce44b6a360f7cf754e8f Mon Sep 17 00:00:00 2001 From: Emilio Botero Date: Mon, 14 Aug 2017 15:33:22 -0700 Subject: [PATCH 09/19] remove lithium air and clean up bwb --- BWB_CFD/BWB.py | 401 +++++------ tut_lithium_air_jet_sizing.py | 1238 --------------------------------- tut_mission_B737.py | 340 ++++----- 3 files changed, 352 insertions(+), 1627 deletions(-) delete mode 100644 tut_lithium_air_jet_sizing.py diff --git a/BWB_CFD/BWB.py b/BWB_CFD/BWB.py index af7b593..ca37dbb 100644 --- a/BWB_CFD/BWB.py +++ b/BWB_CFD/BWB.py @@ -1,7 +1,7 @@ # BWB.py # # Created: Jan 2017, E. Botero -# Modified: +# Modified: Aug 2017, E. Botero # ---------------------------------------------------------------------- # Imports @@ -12,7 +12,7 @@ import numpy as np import pylab as plt -from SUAVE.Core import Data, Container, Units +from SUAVE.Core import Data, Units from SUAVE.Input_Output.OpenVSP import write from SUAVE.Input_Output.OpenVSP.get_vsp_areas import get_vsp_areas @@ -184,7 +184,7 @@ def vehicle_setup(): vehicle.mass_properties.max_takeoff = 823000. * Units.lb vehicle.mass_properties.takeoff = 823000. * Units.lb vehicle.mass_properties.max_zero_fuel = 0.9 * vehicle.mass_properties.max_takeoff - vehicle.mass_properties.cargo = 00. * Units.kilogram + vehicle.mass_properties.cargo = 0. * Units.kilogram # envelope properties vehicle.envelope.ultimate_load = 2.5 @@ -208,27 +208,20 @@ def vehicle_setup(): wing.thickness_to_chord = 0.15 wing.taper = 0.0138 wing.span_efficiency = 0.95 - wing.spans.projected = 289.0 * Units.feet - wing.chords.root = 145.0 * Units.feet - wing.chords.tip = 3.5 * Units.feet - wing.chords.mean_aerodynamic = 86. * Units.feet - + wing.chords.tip = 3.5 * Units.feet + wing.chords.mean_aerodynamic = 86. * Units.feet wing.areas.reference = 15680. * Units.feet**2 wing.sweeps.quarter_chord = 33. * Units.degrees - wing.twists.root = 0.0 * Units.degrees wing.twists.tip = 0.0 * Units.degrees wing.dihedral = 2.5 * Units.degrees - wing.origin = [0.,0.,0] wing.aerodynamic_center = [0,0,0] - wing.vertical = False wing.symmetric = True wing.high_lift = True - wing.dynamic_pressure_ratio = 1.0 segment = SUAVE.Components.Wings.Segment() @@ -318,7 +311,6 @@ def vehicle_setup(): turbofan.bypass_ratio = 8.1 turbofan.engine_length = 289. * Units.inches turbofan.nacelle_diameter = 3.96 * Units.meters - #turbofan.cooling_ratio = 1.0 turbofan.origin = [[133.0 *Units.feet, 25.0*Units.feet, 6.5*Units.feet],[145.0 *Units.feet, 0.0*Units.feet, 6.5*Units.feet],[133.0 *Units.feet, -25.0*Units.feet, 6.5*Units.feet]] # working fluid @@ -492,7 +484,6 @@ def vehicle_setup(): vehicle.append_component(turbofan) - # ------------------------------------------------------------------ # Vehicle Definition Complete # ------------------------------------------------------------------ @@ -518,194 +509,8 @@ def configs_setup(vehicle): write(vehicle,base_config.tag) - - # done! return configs -# ---------------------------------------------------------------------- -# Sizing for the Vehicle Configs -# ---------------------------------------------------------------------- - -# ---------------------------------------------------------------------- -# Plot Mission -# ---------------------------------------------------------------------- - -def plot_mission(results,line_style='bo-'): - - axis_font = {'fontname':'Arial', 'size':'14'} - - # ------------------------------------------------------------------ - # Aerodynamics - # ------------------------------------------------------------------ - - - fig = plt.figure("Aerodynamic Forces",figsize=(8,6)) - for segment in results.segments.values(): - - time = segment.conditions.frames.inertial.time[:,0] / Units.min - Lift = -segment.conditions.frames.wind.lift_force_vector[:,2] - Drag = -segment.conditions.frames.wind.drag_force_vector[:,0] / Units.lbf - Thrust = segment.conditions.frames.body.thrust_force_vector[:,0] / Units.lbf - eta = segment.conditions.propulsion.throttle[:,0] - mdot = segment.conditions.weights.vehicle_mass_rate[:,0] - thrust = segment.conditions.frames.body.thrust_force_vector[:,0] - sfc = 3600. * mdot / 0.1019715 / thrust - - - axes = fig.add_subplot(2,1,1) - axes.plot( time , Thrust , line_style ) - axes.set_ylabel('Thrust (lbf)',axis_font) - axes.grid(True) - - axes = fig.add_subplot(2,1,2) - axes.plot( time , eta , line_style ) - axes.set_xlabel('Time (min)',axis_font) - axes.set_ylabel('Throttle',axis_font) - axes.grid(True) - - - - # ------------------------------------------------------------------ - # Aerodynamics 2 - # ------------------------------------------------------------------ - fig = plt.figure("Aerodynamic Coefficients",figsize=(8,10)) - for segment in results.segments.values(): - - time = segment.conditions.frames.inertial.time[:,0] / Units.min - CLift = segment.conditions.aerodynamics.lift_coefficient[:,0] - CDrag = segment.conditions.aerodynamics.drag_coefficient[:,0] - Drag = -segment.conditions.frames.wind.drag_force_vector[:,0] - Thrust = segment.conditions.frames.body.thrust_force_vector[:,0] - aoa = segment.conditions.aerodynamics.angle_of_attack[:,0] / Units.deg - l_d = CLift/CDrag - - - axes = fig.add_subplot(3,1,1) - axes.plot( time , CLift , line_style ) - axes.set_ylabel('Lift Coefficient',axis_font) - axes.grid(True) - - axes = fig.add_subplot(3,1,2) - axes.plot( time , l_d , line_style ) - axes.set_ylabel('L/D',axis_font) - axes.grid(True) - - axes = fig.add_subplot(3,1,3) - axes.plot( time , aoa , 'ro-' ) - axes.set_xlabel('Time (min)',axis_font) - axes.set_ylabel('AOA (deg)',axis_font) - axes.grid(True) - - # ------------------------------------------------------------------ - # Aerodynamics 2 - # ------------------------------------------------------------------ - fig = plt.figure("Drag Components",figsize=(8,10)) - axes = plt.gca() - for i, segment in enumerate(results.segments.values()): - - time = segment.conditions.frames.inertial.time[:,0] / Units.min - drag_breakdown = segment.conditions.aerodynamics.drag_breakdown - cdp = drag_breakdown.parasite.total[:,0] - cdi = drag_breakdown.induced.total[:,0] - cdc = drag_breakdown.compressible.total[:,0] - cdm = drag_breakdown.miscellaneous.total[:,0] - cd = drag_breakdown.total[:,0] - - if line_style == 'bo-': - axes.plot( time , cdp , 'ko-', label='CD parasite' ) - axes.plot( time , cdi , 'bo-', label='CD induced' ) - axes.plot( time , cdc , 'go-', label='CD compressibility' ) - axes.plot( time , cdm , 'yo-', label='CD miscellaneous' ) - axes.plot( time , cd , 'ro-', label='CD total' ) - if i == 0: - axes.legend(loc='upper center') - else: - axes.plot( time , cdp , line_style ) - axes.plot( time , cdi , line_style ) - axes.plot( time , cdc , line_style ) - axes.plot( time , cdm , line_style ) - axes.plot( time , cd , line_style ) - - axes.set_xlabel('Time (min)') - axes.set_ylabel('CD') - axes.grid(True) - - # ------------------------------------------------------------------ - # Altitude, sfc, vehicle weight - # ------------------------------------------------------------------ - - fig = plt.figure("Altitude_sfc_weight",figsize=(8,10)) - for segment in results.segments.values(): - - time = segment.conditions.frames.inertial.time[:,0] / Units.min - CLift = segment.conditions.aerodynamics.lift_coefficient[:,0] - CDrag = segment.conditions.aerodynamics.drag_coefficient[:,0] - Drag = -segment.conditions.frames.wind.drag_force_vector[:,0] - Thrust = segment.conditions.frames.body.thrust_force_vector[:,0] - aoa = segment.conditions.aerodynamics.angle_of_attack[:,0] / Units.deg - l_d = CLift/CDrag - mass = segment.conditions.weights.total_mass[:,0] / Units.lb - altitude = segment.conditions.freestream.altitude[:,0] / Units.ft - mdot = segment.conditions.weights.vehicle_mass_rate[:,0] - thrust = segment.conditions.frames.body.thrust_force_vector[:,0] - sfc = 3600. * mdot / 0.1019715 / thrust - - axes = fig.add_subplot(3,1,1) - axes.plot( time , altitude , line_style ) - axes.set_ylabel('Altitude (ft)',axis_font) - axes.grid(True) - - axes = fig.add_subplot(3,1,3) - axes.plot( time , sfc , line_style ) - axes.set_xlabel('Time (min)',axis_font) - axes.set_ylabel('sfc (lb/lbf-hr)',axis_font) - axes.grid(True) - - axes = fig.add_subplot(3,1,2) - axes.plot( time , mass , 'ro-' ) - axes.set_ylabel('Weight (lb)',axis_font) - axes.grid(True) - - # ------------------------------------------------------------------ - # Aerodynamics 2 - # ------------------------------------------------------------------ - fig = plt.figure("Velocities",figsize=(8,10)) - for segment in results.segments.values(): - - time = segment.conditions.frames.inertial.time[:,0] / Units.min - Lift = -segment.conditions.frames.wind.lift_force_vector[:,2] - Drag = -segment.conditions.frames.wind.drag_force_vector[:,0] / Units.lbf - Thrust = segment.conditions.frames.body.thrust_force_vector[:,0] / Units.lbf - eta = segment.conditions.propulsion.throttle[:,0] - mdot = segment.conditions.weights.vehicle_mass_rate[:,0] - thrust = segment.conditions.frames.body.thrust_force_vector[:,0] - sfc = 3600. * mdot / 0.1019715 / thrust - velocity = segment.conditions.freestream.velocity[:,0] - pressure = segment.conditions.freestream.pressure[:,0] - density = segment.conditions.freestream.density[:,0] - EAS = velocity * np.sqrt(density/1.225) - mach = segment.conditions.freestream.mach_number[:,0] - - - axes = fig.add_subplot(3,1,1) - axes.plot( time , velocity / Units.kts, line_style ) - axes.set_ylabel('velocity (kts)',axis_font) - axes.grid(True) - - axes = fig.add_subplot(3,1,2) - axes.plot( time , EAS / Units.kts, line_style ) - axes.set_xlabel('Time (min)',axis_font) - axes.set_ylabel('Equivalent Airspeed',axis_font) - axes.grid(True) - - axes = fig.add_subplot(3,1,3) - axes.plot( time , mach , line_style ) - axes.set_xlabel('Time (min)',axis_font) - axes.set_ylabel('Mach',axis_font) - axes.grid(True) - - return - def simple_sizing(configs): base = configs.base @@ -714,12 +519,6 @@ def simple_sizing(configs): # zero fuel weight base.mass_properties.max_zero_fuel = 0.9 * base.mass_properties.max_takeoff - ## wing areas - #for wing in base.wings: - #wing.areas.wetted = 2.0 * wing.areas.reference - #wing.areas.exposed = 0.8 * wing.areas.wetted - #wing.areas.affected = 0.6 * wing.areas.wetted - # Areas wetted_areas = get_vsp_areas(base.tag) @@ -731,7 +530,6 @@ def simple_sizing(configs): # diff the new data base.store_diff() - # done! return # ---------------------------------------------------------------------- @@ -761,7 +559,7 @@ def mission_setup(analyses): base_segment = Segments.Segment() # ------------------------------------------------------------------ - # First Climb Segment: constant Mach, constant segment angle + # First Climb Segment # ------------------------------------------------------------------ segment = Segments.Climb.Constant_Speed_Constant_Rate(base_segment) @@ -782,7 +580,7 @@ def mission_setup(analyses): # ------------------------------------------------------------------ - # Second Climb Segment: constant Speed, constant segment angle + # Second Climb Segment # ------------------------------------------------------------------ segment = Segments.Climb.Constant_Speed_Constant_Rate(base_segment) @@ -816,7 +614,7 @@ def mission_setup(analyses): # ------------------------------------------------------------------ - # Cruise Segment: constant speed, constant altitude + # Cruise Segment # ------------------------------------------------------------------ segment = Segments.Cruise.Constant_Mach_Constant_Altitude(base_segment) @@ -832,7 +630,7 @@ def mission_setup(analyses): # ------------------------------------------------------------------ -# First Descent Segment: consant speed, constant segment rate +# First Descent Segment # ------------------------------------------------------------------ segment = Segments.Descent.Constant_Speed_Constant_Rate(base_segment) @@ -866,7 +664,7 @@ def mission_setup(analyses): # ------------------------------------------------------------------ - # Third Descent Segment: consant speed, constant segment rate + # Third Descent Segment # ------------------------------------------------------------------ segment = Segments.Descent.Constant_Speed_Constant_Rate(base_segment) @@ -883,7 +681,7 @@ def mission_setup(analyses): # ------------------------------------------------------------------ - # Fourth Descent Segment: consant speed, constant segment rate + # Fourth Descent Segment # ------------------------------------------------------------------ segment = Segments.Descent.Constant_Speed_Constant_Rate(base_segment) @@ -899,10 +697,8 @@ def mission_setup(analyses): # add to mission mission.append_segment(segment) - - # ------------------------------------------------------------------ - # Fifth Descent Segment: consant speed, constant segment rate + # Fifth Descent Segment # ------------------------------------------------------------------ segment = Segments.Descent.Constant_Speed_Constant_Rate(base_segment) @@ -914,7 +710,6 @@ def mission_setup(analyses): segment.air_speed = 145.0 * Units['m/s'] segment.descent_rate = 3.0 * Units['m/s'] - # append to mission mission.append_segment(segment) @@ -935,10 +730,178 @@ def missions_setup(base_mission): missions.base = base_mission - - # done! return missions +# ---------------------------------------------------------------------- +# Plot Mission +# ---------------------------------------------------------------------- + +def plot_mission(results,line_style='bo-'): + + axis_font = {'fontname':'Arial', 'size':'14'} + + # ------------------------------------------------------------------ + # Aerodynamics + # ------------------------------------------------------------------ + + + fig = plt.figure("Aerodynamic Forces",figsize=(8,6)) + for segment in results.segments.values(): + + time = segment.conditions.frames.inertial.time[:,0] / Units.min + Thrust = segment.conditions.frames.body.thrust_force_vector[:,0] / Units.lbf + eta = segment.conditions.propulsion.throttle[:,0] + + axes = fig.add_subplot(2,1,1) + axes.plot( time , Thrust , line_style ) + axes.set_ylabel('Thrust (lbf)',axis_font) + axes.grid(True) + + axes = fig.add_subplot(2,1,2) + axes.plot( time , eta , line_style ) + axes.set_xlabel('Time (min)',axis_font) + axes.set_ylabel('Throttle',axis_font) + axes.grid(True) + + plt.savefig("B737_engine.pdf") + plt.savefig("B737_engine.png") + + # ------------------------------------------------------------------ + # Aerodynamics 2 + # ------------------------------------------------------------------ + fig = plt.figure("Aerodynamic Coefficients",figsize=(8,10)) + for segment in results.segments.values(): + + time = segment.conditions.frames.inertial.time[:,0] / Units.min + CLift = segment.conditions.aerodynamics.lift_coefficient[:,0] + CDrag = segment.conditions.aerodynamics.drag_coefficient[:,0] + aoa = segment.conditions.aerodynamics.angle_of_attack[:,0] / Units.deg + l_d = CLift/CDrag + + axes = fig.add_subplot(3,1,1) + axes.plot( time , CLift , line_style ) + axes.set_ylabel('Lift Coefficient',axis_font) + axes.grid(True) + + axes = fig.add_subplot(3,1,2) + axes.plot( time , l_d , line_style ) + axes.set_ylabel('L/D',axis_font) + axes.grid(True) + + axes = fig.add_subplot(3,1,3) + axes.plot( time , aoa , 'ro-' ) + axes.set_xlabel('Time (min)',axis_font) + axes.set_ylabel('AOA (deg)',axis_font) + axes.grid(True) + + plt.savefig("B737_aero.pdf") + plt.savefig("B737_aero.png") + + # ------------------------------------------------------------------ + # Aerodynamics 2 + # ------------------------------------------------------------------ + fig = plt.figure("Drag Components",figsize=(8,10)) + axes = plt.gca() + for i, segment in enumerate(results.segments.values()): + + time = segment.conditions.frames.inertial.time[:,0] / Units.min + drag_breakdown = segment.conditions.aerodynamics.drag_breakdown + cdp = drag_breakdown.parasite.total[:,0] + cdi = drag_breakdown.induced.total[:,0] + cdc = drag_breakdown.compressible.total[:,0] + cdm = drag_breakdown.miscellaneous.total[:,0] + cd = drag_breakdown.total[:,0] + + if line_style == 'bo-': + axes.plot( time , cdp , 'ko-', label='CD parasite' ) + axes.plot( time , cdi , 'bo-', label='CD induced' ) + axes.plot( time , cdc , 'go-', label='CD compressibility' ) + axes.plot( time , cdm , 'yo-', label='CD miscellaneous' ) + axes.plot( time , cd , 'ro-', label='CD total' ) + if i == 0: + axes.legend(loc='upper center') + else: + axes.plot( time , cdp , line_style ) + axes.plot( time , cdi , line_style ) + axes.plot( time , cdc , line_style ) + axes.plot( time , cdm , line_style ) + axes.plot( time , cd , line_style ) + + axes.set_xlabel('Time (min)') + axes.set_ylabel('CD') + axes.grid(True) + plt.savefig("B737_drag.pdf") + plt.savefig("B737_drag.png") + + # ------------------------------------------------------------------ + # Altitude, sfc, vehicle weight + # ------------------------------------------------------------------ + + fig = plt.figure("Altitude_sfc_weight",figsize=(8,10)) + for segment in results.segments.values(): + + time = segment.conditions.frames.inertial.time[:,0] / Units.min + aoa = segment.conditions.aerodynamics.angle_of_attack[:,0] / Units.deg + mass = segment.conditions.weights.total_mass[:,0] / Units.lb + altitude = segment.conditions.freestream.altitude[:,0] / Units.ft + mdot = segment.conditions.weights.vehicle_mass_rate[:,0] + thrust = segment.conditions.frames.body.thrust_force_vector[:,0] + sfc = (mdot / Units.lb) / (thrust /Units.lbf) * Units.hr + + axes = fig.add_subplot(3,1,1) + axes.plot( time , altitude , line_style ) + axes.set_ylabel('Altitude (ft)',axis_font) + axes.grid(True) + + axes = fig.add_subplot(3,1,3) + axes.plot( time , sfc , line_style ) + axes.set_xlabel('Time (min)',axis_font) + axes.set_ylabel('sfc (lb/lbf-hr)',axis_font) + axes.grid(True) + + axes = fig.add_subplot(3,1,2) + axes.plot( time , mass , 'ro-' ) + axes.set_ylabel('Weight (lb)',axis_font) + axes.grid(True) + + plt.savefig("B737_mission.pdf") + plt.savefig("B737_mission.png") + + # ------------------------------------------------------------------ + # Velocities + # ------------------------------------------------------------------ + fig = plt.figure("Velocities",figsize=(8,10)) + for segment in results.segments.values(): + + time = segment.conditions.frames.inertial.time[:,0] / Units.min + Lift = -segment.conditions.frames.wind.lift_force_vector[:,2] + Drag = -segment.conditions.frames.wind.drag_force_vector[:,0] / Units.lbf + Thrust = segment.conditions.frames.body.thrust_force_vector[:,0] / Units.lb + velocity = segment.conditions.freestream.velocity[:,0] + pressure = segment.conditions.freestream.pressure[:,0] + density = segment.conditions.freestream.density[:,0] + EAS = velocity * np.sqrt(density/1.225) + mach = segment.conditions.freestream.mach_number[:,0] + + axes = fig.add_subplot(3,1,1) + axes.plot( time , velocity / Units.kts, line_style ) + axes.set_ylabel('velocity (kts)',axis_font) + axes.grid(True) + + axes = fig.add_subplot(3,1,2) + axes.plot( time , EAS / Units.kts, line_style ) + axes.set_xlabel('Time (min)',axis_font) + axes.set_ylabel('Equivalent Airspeed',axis_font) + axes.grid(True) + + axes = fig.add_subplot(3,1,3) + axes.plot( time , mach , line_style ) + axes.set_xlabel('Time (min)',axis_font) + axes.set_ylabel('Mach',axis_font) + axes.grid(True) + + return + if __name__ == '__main__': main() plt.show() diff --git a/tut_lithium_air_jet_sizing.py b/tut_lithium_air_jet_sizing.py deleted file mode 100644 index 4eb90a6..0000000 --- a/tut_lithium_air_jet_sizing.py +++ /dev/null @@ -1,1238 +0,0 @@ -# tut_lithium_air_jet.py -# -# Created: Jun 2015, SUAVE Team -# Modified: - -""" setup file for a mission with an all electric airliner -""" - - -# ---------------------------------------------------------------------- -# Imports -# ---------------------------------------------------------------------- - -import SUAVE -from SUAVE.Core import Units, Data - -import numpy as np -import copy, time - -import matplotlib -import pylab as plt - - -from SUAVE.Methods.Performance import estimate_take_off_field_length -from SUAVE.Methods.Performance import estimate_landing_field_length -from SUAVE.Methods.Geometry.Two_Dimensional.Planform import wing_planform -from SUAVE.Methods.Propulsion.ducted_fan_sizing import ducted_fan_sizing -from SUAVE.Methods.Geometry.Two_Dimensional.Cross_Section.Propulsion.compute_ducted_fan_geometry import compute_ducted_fan_geometry -matplotlib.interactive(True) - -# ---------------------------------------------------------------------- -# Main -# ---------------------------------------------------------------------- - -def main(): - - # define the problem - #initial guesses - m_guess = 64204.6490117 - Ereq_guess =251.58 * 10.**9. - Pmotor =13.78 * 10.**6. - - tol=.01 #percentage difference in mass and energy between iterations - dm=10000. #initialize error - dE=10000. - - max_iter=10 - Ereq=[Ereq_guess] - Preq=[] - mass=[ m_guess ] - cruise_alt=10.255*Units.km #cruise altitude - j=0 - - - while abs(dm)>tol or abs(dE)>tol: #size the vehicle - m_guess=mass[j] - Ereq_guess=Ereq[j] - configs, analyses = full_setup(m_guess, Ereq_guess, Pmotor, cruise_alt) - simple_sizing(configs,analyses, m_guess,Ereq_guess,Pmotor) - mission = analyses.missions.base - battery=configs.base.energy_network['battery'] - battery.current_energy=battery.max_energy - configs.finalize() - analyses.finalize() - configs.cruise.energy_network['battery']=battery #make it so all configs handle the exact same battery object - configs.takeoff.energy_network['battery']=battery - configs.landing.energy_network['battery']=battery - #initialize battery in mission - mission.segments[0].battery_energy=battery.max_energy - results = evaluate_mission(configs,mission) - - mass.append(results.segments[-1].conditions.weights.total_mass[-1,0] ) - Ereq.append(results.e_total) - - #Preq.append(results.Pmax) - dm=(mass[j+1]-mass[j])/mass[j] - dE=(Ereq[j+1]-Ereq[j])/Ereq[j] - - - #display convergence of aircraft - print 'mass=', mass[j+1] - print 'dm=', dm - print 'dE=', dE - print 'Ereq_guess=', Ereq_guess - print 'Preq=', results.Pmax - j+=1 - if j>max_iter: - print "maximum number of iterations exceeded" - break - #vehicle sized:now find field length - print 'total range=', results.segments[-1].conditions.frames.inertial.position_vector[-1,0]/1000. - results = evaluate_field_length(configs,analyses, mission,results) #now evaluate field length - plot_mission(results,configs) - - return - - -# ---------------------------------------------------------------------- -# Analysis Setup -# ---------------------------------------------------------------------- - -def full_setup(m_guess, Ereq_guess, Preq_guess, cruise_altitude): - - # vehicle data - vehicle = vehicle_setup(cruise_altitude) - configs = configs_setup(vehicle) - - # vehicle analyses - configs_analyses = analyses_setup(configs, Ereq_guess, Preq_guess) - - # mission analyses - mission = mission_setup(configs_analyses) - missions_analyses = missions_setup(mission) - - #initialize battery in mission - mission.segments[0].battery_energy=configs.base.energy_network.battery.max_energy - - analyses = SUAVE.Analyses.Analysis.Container() - analyses.configs = configs_analyses - analyses.missions = missions_analyses - - return configs, analyses - - -# ---------------------------------------------------------------------- -# Define the Vehicle Analyses -# ---------------------------------------------------------------------- - -def analyses_setup(configs, Ereq, Preq): - - analyses = SUAVE.Analyses.Analysis.Container() - - # build a base analysis for each config - for tag,config in configs.items(): - analysis = base_analysis(config) - analyses[tag] = analysis - - # adjust analyses for configs - - # takeoff_analysis - analyses.takeoff.aerodynamics.drag_coefficient_increment = 0.0000 - - # landing analysis - aerodynamics = analyses.landing.aerodynamics - - - # ----------------------------------- - # Battery Setup - # ----------------------------------- - - # required mission energy, chosen via guess and check - - # initialize the battery - battery = configs.base.energy_network['battery'] - battery.specific_energy= 2000*Units.Wh/Units.kg - battery.specific_power = .67*Units.kW/Units.kg - SUAVE.Methods.Power.Battery.Sizing.initialize_from_energy_and_power(battery,Ereq,Preq) - battery.current_energy= [battery.max_energy] - configs.base.store_diff() - - # Update all configs with new base data - for config in configs: - config.pull_base() - - return analyses - -def base_analysis(vehicle): - - # ------------------------------------------------------------------ - # Initialize the Analyses - # ------------------------------------------------------------------ - analyses = SUAVE.Analyses.Vehicle() - - # ------------------------------------------------------------------ - # Basic Geometry Relations - sizing = SUAVE.Analyses.Sizing.Sizing() - sizing.features.vehicle = vehicle - analyses.append(sizing) - - # ------------------------------------------------------------------ - # Weights - weights = SUAVE.Analyses.Weights.Weights_Tube_Wing() - weights.settings.empty_weight_method= \ - SUAVE.Methods.Weights.Correlations.Tube_Wing.empty - weights.vehicle = vehicle - analyses.append(weights) - - # ------------------------------------------------------------------ - # Aerodynamics Analysis - aerodynamics = SUAVE.Analyses.Aerodynamics.Fidelity_Zero() - aerodynamics.geometry = vehicle - aerodynamics.settings.drag_coefficient_increment = 0.0000 - analyses.append(aerodynamics) - - # ------------------------------------------------------------------ - # Stability Analysis - stability = SUAVE.Analyses.Stability.Fidelity_Zero() - stability.geometry = vehicle - analyses.append(stability) - - # ------------------------------------------------------------------ - # Propulsion Analysis - energy= SUAVE.Analyses.Energy.Energy() - energy.network = vehicle.energy_network # SEE THIS - analyses.append(energy) - - # ------------------------------------------------------------------ - # Planet Analysis - planet = SUAVE.Analyses.Planets.Planet() - analyses.append(planet) - - # ------------------------------------------------------------------ - # Atmosphere Analysis - atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976() - atmosphere.features.planet = planet.features - analyses.append(atmosphere) - - # done! - return analyses - - -# ---------------------------------------------------------------------- -# Define the Vehicle -# ---------------------------------------------------------------------- - -def vehicle_setup(cruise_altitude): - - # ------------------------------------------------------------------ - # Initialize the Vehicle - # ------------------------------------------------------------------ - - vehicle = SUAVE.Vehicle() - vehicle.tag = 'Embraer_E190' - - # ------------------------------------------------------------------ - # Vehicle-level Properties - # ------------------------------------------------------------------ - ''' - # mass properties - vehicle.mass_properties.max_takeoff = 92110. #use landing mass as - vehicle.mass_properties.operating_empty = 34551. - vehicle.mass_properties.takeoff = 80721. - vehicle.mass_properties.max_zero_fuel = 92110. #equivalent landing mass - vehicle.mass_properties.cargo = 0.0 - vehicle.mass_properties.max_payload = 0.0 - vehicle.mass_properties.max_fuel = 0.0 - ''' - - # envelope properties - vehicle.envelope.ultimate_load = 3.5 - vehicle.envelope.limit_load = 1.5 - - # basic parameters - vehicle.reference_area = 100.0 - vehicle.passengers = 114 - vehicle.systems.control = "partially powered" - vehicle.systems.accessories = "medium range" - vehicle.w2h = 16. * Units.meters # Length from the mean aerodynamic center of wing to mean aerodynamic center of the horizontal tail - vehicle.w2v = 20. * Units.meters # Length from the mean aerodynamic center of wing to mean aerodynamic center of the vertical tail - # ------------------------------------------------------------------ - # Main Wing - # ------------------------------------------------------------------ - - wing = SUAVE.Components.Wings.Wing() - wing.tag = 'main_wing' - - wing.aspect_ratio = 8.3 - wing.sweeps.quarter_chord = 0.002 * Units.deg - wing.thickness_to_chord = 0.105 - wing.taper = 0.28 - wing.span_efficiency = 1.0 - - wing.spans.projected = 28.81 - - wing.chords.root = 5.4 - wing.chords.tip = 1.5185 - wing.chords.mean_aerodynamic = 3.8371 - - wing.areas.reference = 100.0 - wing.areas.wetted = 2.0 * wing.areas.reference - wing.areas.exposed = 150.0 - wing.areas.affected = 60.0 - - wing.twists.root = -0.311 * Units.degrees - wing.twists.tip = -0.315 * Units.degrees - - wing.origin = [00,0,0] - wing.aerodynamic_center = [0.914,0,0] - - wing.vertical = False - wing.symmetric = True - - wing.dynamic_pressure_ratio = 1.0 - - # add to vehicle - vehicle.append_component(wing) - - # ------------------------------------------------------------------ - # Horizontal Stabilizer - # ------------------------------------------------------------------ - - wing = SUAVE.Components.Wings.Wing() - wing.tag = 'horizontal_stabilizer' - - wing.aspect_ratio = 5.5 - wing.sweeps.quarter_chord = 0.002 * Units.deg - wing.thickness_to_chord = 0.11 - wing.taper = 0.11 - wing.span_efficiency = 0.9 - - wing.spans.projected = 11.213 - - wing.chords.root = 3.6733 - wing.chords.tip = 0.4040 - wing.chords.mean_aerodynamic = 2.4755 - - wing.areas.reference = 22.85 - wing.areas.wetted = 45.71 - wing.areas.exposed = 34.28 - wing.areas.affected = 13.71 - - wing.twists.root = 0.0 * Units.degrees - wing.twists.tip = 0.0 * Units.degrees - - wing.origin = [50,0,0] - wing.aerodynamic_center = [16.9144, 0.0, 0.0] - - wing.vertical = False - wing.symmetric = True - - wing.dynamic_pressure_ratio = 0.9 - - # add to vehicle - vehicle.append_component(wing) - - # ------------------------------------------------------------------ - # Vertical Stabilizer - # ------------------------------------------------------------------ - - wing = SUAVE.Components.Wings.Wing() - wing.tag = 'vertical_stabilizer' - - wing.aspect_ratio = 1.7 # - wing.sweeps.quarter_chord = 0.001 * Units.deg - wing.thickness_to_chord = 0.12 - wing.taper = 0.10 - wing.span_efficiency = 0.9 - - wing.spans.projected = 4.6945 # - - wing.chords.root = 5.0209 - wing.chords.tip = 0.5020 - wing.chords.mean_aerodynamic = 3.3777 - - wing.areas.reference = 12.96 - wing.areas.wetted = 25.92 - wing.areas.exposed = 19.44 - wing.areas.affected = 7.778 - - wing.twists.root = 0.0 * Units.degrees - wing.twists.tip = 0.0 * Units.degrees - - wing.origin = [0,0,0] - wing.aerodynamic_center = [0,0,0] - - wing.vertical = True - wing.symmetric = False - - wing.dynamic_pressure_ratio = 1.0 - - # add to vehicle - vehicle.append_component(wing) - - # ------------------------------------------------------------------ - # Fuselage - # ------------------------------------------------------------------ - - fuselage = SUAVE.Components.Fuselages.Fuselage() - fuselage.tag = 'fuselage' - - fuselage.number_coach_seats = vehicle.passengers - fuselage.seats_abreast = 4 - fuselage.seat_pitch = 0.7455 - - fuselage.fineness.nose = 1.5 - fuselage.fineness.tail = 1.8 - - fuselage.lengths.nose = 4.5 - fuselage.lengths.tail = 5.4 - fuselage.lengths.cabin = 21.24675 - fuselage.lengths.total = 31.14675 - fuselage.lengths.fore_space = 0. - fuselage.lengths.aft_space = 0. - - fuselage.width = 3.0 - - fuselage.heights.maximum = 3.4 # - fuselage.heights.at_quarter_length = 3.4 - fuselage.heights.at_three_quarters_length = 3.4 - fuselage.heights.at_wing_root_quarter_chord = 3.4 - - fuselage.areas.side_projected = 79.462 - fuselage.areas.wetted = 288.521422366 - fuselage.areas.front_projected = 8.011 - - fuselage.effective_diameter = 3.2 - - fuselage.differential_pressure = 10**5 * Units.pascal - - # add to vehicle - vehicle.append_component(fuselage) - - # ------------------------------------------------------------------ - # Propulsion - # ------------------------------------------------------------------ - - atm = SUAVE.Analyses.Atmospheric.US_Standard_1976() - - conditions1 = atm.compute_values(0.) - conditions2 = atm.compute_values(cruise_altitude) - p1 = conditions1.pressure - p2 = conditions2.pressure - T1 = conditions1.temperature - T2 = conditions2.temperature - rho1 = conditions1.density - rho2 = conditions2.density - a1 = conditions1.speed_of_sound - a2 = conditions2.speed_of_sound - mu1 = conditions1.dynamic_viscosity - mu2 = conditions2.dynamic_viscosity - - mach_number = .729 - #Create Energy Network - #create battery - battery = SUAVE.Components.Energy.Storages.Batteries.Variable_Mass.Lithium_Air() - battery.tag = 'battery' - - ducted_fan = SUAVE.Components.Energy.Networks.Ducted_Fan() - network = SUAVE.Components.Energy.Networks.Battery_Ducted_Fan() - working_fluid = SUAVE.Attributes.Gases.Air - - #add working fluid to the network - ducted_fan.working_fluid = working_fluid - - - #Component 1 : ram, to convert freestream static to stagnation quantities - ram = SUAVE.Components.Energy.Converters.Ram() - ram.tag = 'ram' - - #add ram to the network - ducted_fan.ram = ram - - - #Component 2 : inlet nozzle - inlet_nozzle = SUAVE.Components.Energy.Converters.Compression_Nozzle() - inlet_nozzle.tag = 'inlet nozzle' - - inlet_nozzle.polytropic_efficiency = 0.98 - inlet_nozzle.pressure_ratio = 0.98 # turbofan.fan_nozzle_pressure_ratio = 0.98 #0.98 - - #add inlet nozzle to the network - ducted_fan.inlet_nozzle = inlet_nozzle - - - #Component 8 :fan nozzle - fan_nozzle = SUAVE.Components.Energy.Converters.Expansion_Nozzle() - fan_nozzle.tag = 'fan nozzle' - - fan_nozzle.polytropic_efficiency = 0.95 - fan_nozzle.pressure_ratio = 0.99 - - #add the fan nozzle to the network - ducted_fan.fan_nozzle = fan_nozzle - - - - #Component 9 : fan - fan = SUAVE.Components.Energy.Converters.Fan() - fan.tag = 'fan' - - fan.polytropic_efficiency = 0.93 - fan.pressure_ratio = 1.5 - - #add the fan to the network - ducted_fan.fan = fan - - #Component 10 : thrust (to compute the thrust) - thrust = SUAVE.Components.Energy.Processes.Thrust() - thrust.tag ='compute_thrust' - thrust.total_design = 121979.18 # Preq*1.5/V_cruise - ducted_fan.thrust = thrust - ducted_fan.tag ='ducted_fan' - ducted_fan.number_of_engines = 2.0 - - - #compute conditions for engine - conditions = SUAVE.Analyses.Mission.Segments.Conditions.Aerodynamics() - conditions.freestream.altitude = np.atleast_1d(cruise_altitude) - conditions.freestream.mach_number = np.atleast_1d(mach_number) - conditions.freestream.pressure = np.atleast_1d(p2) - conditions.freestream.temperature = np.atleast_1d(T2) - conditions.freestream.density = np.atleast_1d(rho2) - conditions.freestream.dynamic_viscosity = np.atleast_1d(mu2) - conditions.freestream.gravity = np.atleast_1d(9.81) - conditions.freestream.gamma = np.atleast_1d(1.4) - conditions.freestream.Cp = 1.4*287.87/(1.4-1) - conditions.freestream.R = 287.87 - conditions.freestream.speed_of_sound = np.atleast_1d(a2) - conditions.freestream.velocity = conditions.freestream.mach_number * conditions.freestream.speed_of_sound - - #size mass flow - ducted_fan_sizing(ducted_fan, mach_number, cruise_altitude) - #now size geometry - compute_ducted_fan_geometry(ducted_fan, conditions) - - # ------------------------------------------------------------------ - # Energy Network - # ------------------------------------------------------------------ - - #define the energy network - net = SUAVE.Components.Energy.Networks.Battery_Ducted_Fan() - net.tag = 'network' - - net.propulsor = ducted_fan - net.append(ducted_fan) - net.battery = battery - - net.nacelle_diameter = ducted_fan.nacelle_diameter - net.engine_length = ducted_fan.engine_length - net.number_of_engines = ducted_fan.number_of_engines - net.motor_efficiency =.95 - vehicle.propulsors.append(ducted_fan) - vehicle.energy_network = net - - - # ------------------------------------------------------------------ - # Vehicle Definition Complete - # ------------------------------------------------------------------ - - - return vehicle - -def evaluate_field_length(configs,analyses,mission,results): - - # unpack - airport = mission.airport - - takeoff_config = configs.takeoff - landing_config = configs.landing - - # evaluate - - TOFL = estimate_take_off_field_length(takeoff_config,analyses.configs,airport) - LFL = estimate_landing_field_length (landing_config, analyses.configs,airport) - - # pack - field_length = SUAVE.Core.Data() - field_length.takeoff = TOFL[0] - field_length.landing = LFL[0] - - results.field_length = field_length - - - return results - - - -# ---------------------------------------------------------------------- -# Define the Configurations -# --------------------------------------------------------------------- - -def configs_setup(vehicle): - - # ------------------------------------------------------------------ - # Initialize Configurations - # ------------------------------------------------------------------ - - configs = SUAVE.Components.Configs.Config.Container() - - base_config = SUAVE.Components.Configs.Config(vehicle) - base_config.tag = 'base' - configs.append(base_config) - - # ------------------------------------------------------------------ - # Cruise Configuration - # ------------------------------------------------------------------ - - config = SUAVE.Components.Configs.Config(base_config) - config.tag = 'cruise' - - configs.append(config) - - - # ------------------------------------------------------------------ - # Takeoff Configuration - # ------------------------------------------------------------------ - - config = SUAVE.Components.Configs.Config(base_config) - config.tag = 'takeoff' - - config.wings['main_wing'].flaps.angle = 20. * Units.deg - config.wings['main_wing'].slats.angle = 25. * Units.deg - - config.V2_VS_ratio = 1.21 - config.maximum_lift_coefficient = 2. - - configs.append(config) - - - # ------------------------------------------------------------------ - # Landing Configuration - # ------------------------------------------------------------------ - - config = SUAVE.Components.Configs.Config(base_config) - config.tag = 'landing' - - config.wings['main_wing'].flaps_angle = 30. * Units.deg - config.wings['main_wing'].slats_angle = 25. * Units.deg - - config.Vref_VS_ratio = 1.23 - config.maximum_lift_coefficient = 2. - - configs.append(config) - - - # done! - return configs - - - -def simple_sizing(configs, analyses, m_guess, Ereq, Preq): - from SUAVE.Methods.Geometry.Two_Dimensional.Planform import wing_planform - -# ------------------------------------------------------------------ - # Define New Gross Takeoff Weight - # ------------------------------------------------------------------ - #now add component weights to the gross takeoff weight of the vehicle - - base = configs.base - base.pull_base() - base.mass_properties.max_takeoff=m_guess - base.mass_properties.max_zero_fuel=m_guess #just used for weight calculation - mission=analyses.missions.base.segments - airport=analyses.missions.base.airport - atmo = airport.atmosphere - #determine geometry of fuselage as well as wings - fuselage=base.fuselages['fuselage'] - SUAVE.Methods.Geometry.Two_Dimensional.Planform.fuselage_planform(fuselage) - fuselage.areas.side_projected = fuselage.heights.maximum*fuselage.lengths.cabin*1.1 # Not correct - base.wings['main_wing'] = wing_planform(base.wings['main_wing']) - base.wings['horizontal_stabilizer'] = wing_planform(base.wings['horizontal_stabilizer']) - - base.wings['vertical_stabilizer'] = wing_planform(base.wings['vertical_stabilizer']) - #calculate position of horizontal stabilizer - base.wings['horizontal_stabilizer'].aerodynamic_center[0]= base.w2h- \ - (base.wings['horizontal_stabilizer'].origin[0] + \ - base.wings['horizontal_stabilizer'].aerodynamic_center[0] - \ - base.wings['main_wing'].origin[0] - base.wings['main_wing'].aerodynamic_center[0]) - #wing areas - for wing in base.wings: - wing.areas.wetted = 2.00 * wing.areas.reference - wing.areas.affected = 0.60 * wing.areas.reference - wing.areas.exposed = 0.75 * wing.areas.wetted - - - cruise_altitude= mission['climb_5'].altitude_end - conditions = atmo.compute_values(cruise_altitude) - sizing_segment = SUAVE.Core.Data() - sizing_segment.M = mission['cruise'].air_speed/conditions.speed_of_sound - sizing_segment.alt = cruise_altitude - sizing_segment.T = conditions.temperature - sizing_segment.p = conditions.pressure - conditions0 = atmo.compute_values(12500.*Units.ft) #cabin pressure - p0 = conditions0.pressure - fuselage_diff_pressure= max(conditions0.pressure-conditions.pressure,0) - fuselage.differential_pressure = fuselage_diff_pressure - - battery =base.energy_network['battery'] - ducted_fan=base.propulsors['ducted_fan'] - SUAVE.Methods.Power.Battery.Sizing.initialize_from_energy_and_power(battery,Ereq,Preq) - - battery.current_energy =[battery.max_energy] #initialize list of current energy - m_air =SUAVE.Methods.Power.Battery.Variable_Mass.find_total_mass_gain(battery) - #now add the electric motor weight - motor_mass=ducted_fan.number_of_engines*SUAVE.Methods.Weights.Correlations.Propulsion.air_cooled_motor((Preq)*Units.watts/ducted_fan.number_of_engines) - propulsion_mass=SUAVE.Methods.Weights.Correlations.Propulsion.integrated_propulsion(motor_mass/ducted_fan.number_of_engines,ducted_fan.number_of_engines) - - ducted_fan.mass_properties.mass=propulsion_mass - - breakdown = analyses.configs.base.weights.evaluate() - breakdown.battery=battery.mass_properties.mass - breakdown.air=m_air - base.mass_properties.breakdown=breakdown - m_fuel=0. - #print breakdown - base.mass_properties.operating_empty = breakdown.empty - #weight =SUAVE.Methods.Weights.Correlations.Tube_Wing.empty_custom_eng(vehicle, ducted_fan) - m_full=breakdown.empty+battery.mass_properties.mass+breakdown.payload - m_end=m_full+m_air - base.mass_properties.takeoff = m_full - base.store_diff() - - # Update all configs with new base data - for config in configs: - config.pull_base() - - - ############################################################################## - # ------------------------------------------------------------------ - # Define Configurations - # ------------------------------------------------------------------ - landing_config=configs.landing - landing_config.wings['main_wing'].flaps.angle = 20. * Units.deg - landing_config.wings['main_wing'].slats.angle = 25. * Units.deg - landing_config.mass_properties.landing = m_end - landing_config.store_diff() - # ------------------------------------------------------------------ - # Vehicle Definition Complete - # ------------------------------------------------------------------ - - return - - - - - - -# ---------------------------------------------------------------------- -# Define the Mission -# ---------------------------------------------------------------------- -def mission_setup(analyses): - - # ------------------------------------------------------------------ - # Initialize the Mission - # ------------------------------------------------------------------ - - mission = SUAVE.Analyses.Mission.Sequential_Segments() - mission.tag = 'embraer_e190ar test mission' - - # atmospheric model - atmosphere = SUAVE.Attributes.Atmospheres.Earth.US_Standard_1976() - planet = SUAVE.Attributes.Planets.Earth() - - #airport - airport = SUAVE.Attributes.Airports.Airport() - airport.altitude = 0.0 * Units.ft - airport.delta_isa = 0.0 - airport.atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976() - mission.airport = airport - - # unpack Segments module - Segments = SUAVE.Analyses.Mission.Segments - - - # ------------------------------------------------------------------ - # First Climb Segment: Constant Speed, Constant Throttle - # ------------------------------------------------------------------ - - segment = Segments.Climb.Constant_Speed_Constant_Rate() - segment.tag = "climb_1" - - # connect vehicle configuration - segment.analyses.extend( analyses.takeoff ) - - # define segment attributes - segment.atmosphere = atmosphere - segment.planet = planet - - segment.altitude_start = 0.0 * Units.km - segment.altitude_end = 0.353 * Units.km - segment.air_speed = 111.932 - segment.climb_rate = 3000. * Units['ft/min'] - - # add to misison - mission.append_segment(segment) - - # ------------------------------------------------------------------ - # Second Climb Segment: Constant Speed, Constant Throttle - # ------------------------------------------------------------------ - - segment = Segments.Climb.Constant_Speed_Constant_Rate() - segment.tag = "climb_2" - - # connect vehicle configuration - segment.analyses.extend( analyses.cruise ) - - # segment attributes - segment.atmosphere = atmosphere - segment.planet = planet - - segment.altitude_end = 1.157 * Units.km - segment.air_speed = 163.71 - segment.climb_rate = 2500. * Units['ft/min'] - - # add to mission - mission.append_segment(segment) - - # ------------------------------------------------------------------ - # Third Climb Segment: Constant Speed, Constant Throttle - # ------------------------------------------------------------------ - - segment = Segments.Climb.Constant_Speed_Constant_Rate() - segment.tag = "climb_3" - - # connect vehicle configuration - segment.analyses.extend( analyses.cruise ) - - # segment attributes - segment.atmosphere = atmosphere - segment.planet = planet - - segment.altitude_end = 1.236 * Units.km - segment.air_speed = 193.25 - segment.climb_rate = 1800. * Units['ft/min'] - - # add to mission - mission.append_segment(segment) - - # ------------------------------------------------------------------ - # Fourth Climb Segment: Constant Speed, Constant Throttle - # ------------------------------------------------------------------ - - segment = Segments.Climb.Constant_Speed_Constant_Rate() - segment.tag = "climb_4" - - # connect vehicle configuration - segment.analyses.extend( analyses.cruise ) - - # segment attributes - segment.atmosphere = atmosphere - segment.planet = planet - - segment.altitude_end = 1.807 * Units.km - segment.air_speed = 194.17 - segment.climb_rate = 900. * Units['ft/min'] - - # add to mission - mission.append_segment(segment) - - # ------------------------------------------------------------------ - # Fifth Climb Segment: Constant Speed, Constant Throttle - # ------------------------------------------------------------------ - - segment = Segments.Climb.Constant_Speed_Constant_Rate() - segment.tag = "climb_5" - - # connect vehicle configuration - segment.analyses.extend( analyses.cruise ) - - # segment attributes - segment.atmosphere = atmosphere - segment.planet = planet - - segment.altitude_end = 6.255 * Units.km - segment.air_speed = 176.03 - segment.climb_rate = 300. * Units['ft/min'] - - # add to mission - mission.append_segment(segment) - - # ------------------------------------------------------------------ - # Cruise Segment: constant speed, constant altitude - # ------------------------------------------------------------------ - - segment = Segments.Cruise.Constant_Speed_Constant_Altitude() - segment.tag = "cruise" - - # connect vehicle configuration - segment.analyses.extend( analyses.cruise ) - - # segment attributes - segment.atmosphere = atmosphere - segment.planet = planet - - segment.air_speed = 230. - segment.distance = 1947. * Units.nmi - - # add to mission - mission.append_segment(segment) - - # ------------------------------------------------------------------ - # First Descent Segment: consant speed, constant segment rate - # ------------------------------------------------------------------ - - segment = Segments.Descent.Constant_Speed_Constant_Rate() - segment.tag = "descent_1" - - # connect vehicle configuration - segment.analyses.extend( analyses.cruise ) - - # segment attributes - segment.atmosphere = atmosphere - segment.planet = planet - - segment.altitude_end = 6.26 * Units.km - segment.air_speed = 440.0 * Units.knots - segment.descent_rate = 2400. * Units['ft/min'] - - # add to mission - mission.append_segment(segment) - - - # ------------------------------------------------------------------ - # Second Descent Segment: consant speed, constant segment rate - # ------------------------------------------------------------------ - - segment = Segments.Descent.Constant_Speed_Constant_Rate() - segment.tag = "descent_2" - - # connect vehicle configuration - segment.analyses.extend( analyses.cruise ) - - # segment attributes - segment.atmosphere = atmosphere - segment.planet = planet - - segment.altitude_end = 2.132 * Units.km - segment.air_speed = 365.0 * Units.knots - segment.descent_rate = 2000. * Units['ft/min'] - - # append to mission - mission.append_segment(segment) - - - # ------------------------------------------------------------------ - # Third Descent Segment: consant speed, constant segment rate - # ------------------------------------------------------------------ - - segment = Segments.Descent.Constant_Speed_Constant_Rate() - segment.tag = "descent_3" - - # connect vehicle configuration - segment.analyses.extend( analyses.cruise ) - - # segment attributes - segment.atmosphere = atmosphere - segment.planet = planet - - segment.altitude_end = 0.0 * Units.km - segment.air_speed = 250.0 * Units.knots - segment.descent_rate = 1500. * Units['ft/min'] - - # append to mission - mission.append_segment(segment) - - - # ------------------------------------------------------------------ - # Mission definition complete - # ------------------------------------------------------------------ - - return mission - -#: def define_mission() - -# ---------------------------------------------------------------------- -# Evaluate the Mission -# ---------------------------------------------------------------------- -def evaluate_mission(configs,mission): - - # ------------------------------------------------------------------ - # Run Mission - # ------------------------------------------------------------------ - - - results = mission.evaluate() - - #determine energy characteristiscs - e_current_min=1E14 - Pmax=0. - for i in range(len(results.segments)): - if np.min(results.segments[i].conditions.propulsion.battery_energy)Pmax: - Pmax=np.max(np.abs(results.segments[i].conditions.propulsion.battery_draw)) - results.e_total=results.segments[0].conditions.propulsion.battery_energy[0,0]-e_current_min - results.Pmax=Pmax - print 'e_current_min=',e_current_min - print "e_total=", results.e_total - print "Pmax=", Pmax - return results - - -def missions_setup(base_mission): - - # the mission container - missions = SUAVE.Analyses.Mission.Mission.Container() - missions.base = base_mission - - return missions -# ---------------------------------------------------------------------- -# Plot Mission -# ---------------------------------------------------------------------- - -def plot_mission(results,configs,line_style='bo-'): - - if line_style == 'k-': - line_width = 2. - else: - line_width = 1. - - - # ------------------------------------------------------------------ - # Throttle - # ------------------------------------------------------------------ - plt.figure("Throttle History") - axes = plt.gca() - for i in range(len(results.segments)): - time = results.segments[i].conditions.frames.inertial.time[:,0] / Units.min - eta = results.segments[i].conditions.propulsion.throttle[:,0] - axes.plot(time, eta, line_style) - axes.set_xlabel('Time (mins)') - axes.set_ylabel('Throttle') - axes.grid(True) - - - # ------------------------------------------------------------------ - # Angle of Attack - # ------------------------------------------------------------------ - - plt.figure("Angle of Attack History") - axes = plt.gca() - for i in range(len(results.segments)): - time = results.segments[i].conditions.frames.inertial.time[:,0] / Units.min - aoa = results.segments[i].conditions.aerodynamics.angle_of_attack[:,0] / Units.deg - axes.plot(time, aoa, line_style) - axes.set_xlabel('Time (mins)') - axes.set_ylabel('Angle of Attack (deg)') - axes.grid(True) - - - # ------------------------------------------------------------------ - # Mass Rate - # ------------------------------------------------------------------ - plt.figure("Mass Rate") - axes = plt.gca() - for i in range(len(results.segments)): - time = results.segments[i].conditions.frames.inertial.time[:,0] / Units.min - mdot = -results.segments[i].conditions.weights.vehicle_mass_rate[:,0] - axes.plot(time, mdot, line_style) - axes.set_xlabel('Time (mins)') - axes.set_ylabel('Mass Rate (kg/s)') - axes.grid(True) - - - # ------------------------------------------------------------------ - # Altitude - # ------------------------------------------------------------------ - plt.figure("Altitude") - axes = plt.gca() - for i in range(len(results.segments)): - time = results.segments[i].conditions.frames.inertial.time[:,0] / Units.min - altitude = results.segments[i].conditions.freestream.altitude[:,0] / Units.km - axes.plot(time, altitude, line_style) - axes.set_xlabel('Time (mins)') - axes.set_ylabel('Altitude (km)') - axes.grid(True) - - - # ------------------------------------------------------------------ - # Vehicle Mass - # ------------------------------------------------------------------ - plt.figure("Vehicle Mass") - axes = plt.gca() - for i in range(len(results.segments)): - time = results.segments[i].conditions.frames.inertial.time[:,0] / Units.min - mass = results.segments[i].conditions.weights.total_mass[:,0] - axes.plot(time, mass, line_style) - axes.set_xlabel('Time (mins)') - axes.set_ylabel('Vehicle Mass (kg)') - axes.grid(True) - - - # ------------------------------------------------------------------ - # Aerodynamics - # ------------------------------------------------------------------ - fig = plt.figure("Aerodynamic Forces") - for segment in results.segments.values(): - - time = segment.conditions.frames.inertial.time[:,0] / Units.min - Lift = -segment.conditions.frames.wind.lift_force_vector[:,2] - Drag = -segment.conditions.frames.wind.drag_force_vector[:,0] - Thrust = segment.conditions.frames.body.thrust_force_vector[:,0] - - axes = fig.add_subplot(3,1,1) - axes.plot( time , Lift , line_style ) - axes.set_xlabel('Time (min)') - axes.set_ylabel('Lift (N)') - axes.grid(True) - - axes = fig.add_subplot(3,1,2) - axes.plot( time , Drag , line_style ) - axes.set_xlabel('Time (min)') - axes.set_ylabel('Drag (N)') - axes.grid(True) - - axes = fig.add_subplot(3,1,3) - axes.plot( time , Thrust , line_style ) - axes.set_xlabel('Time (min)') - axes.set_ylabel('Thrust (N)') - axes.grid(True) - - - # ------------------------------------------------------------------ - # Aerodynamics 2 - # ------------------------------------------------------------------ - fig = plt.figure("Aerodynamic Coefficients") - for segment in results.segments.values(): - - time = segment.conditions.frames.inertial.time[:,0] / Units.min - CLift = segment.conditions.aerodynamics.lift_coefficient[:,0] - CDrag = segment.conditions.aerodynamics.drag_coefficient[:,0] - Drag = -segment.conditions.frames.wind.drag_force_vector[:,0] - Thrust = segment.conditions.frames.body.thrust_force_vector[:,0] - - axes = fig.add_subplot(3,1,1) - axes.plot( time , CLift , line_style ) - axes.set_xlabel('Time (min)') - axes.set_ylabel('CL') - axes.grid(True) - - axes = fig.add_subplot(3,1,2) - axes.plot( time , CDrag , line_style ) - axes.set_xlabel('Time (min)') - axes.set_ylabel('CD') - axes.grid(True) - - axes = fig.add_subplot(3,1,3) - axes.plot( time , Drag , line_style ) - axes.plot( time , Thrust , 'ro-' ) - axes.set_xlabel('Time (min)') - axes.set_ylabel('Drag and Thrust (N)') - axes.grid(True) - - - # ------------------------------------------------------------------ - # Aerodynamics 3 - # ------------------------------------------------------------------ - fig = plt.figure("Drag Components") - axes = plt.gca() - for i, segment in enumerate(results.segments.values()): - - time = segment.conditions.frames.inertial.time[:,0] / Units.min - drag_breakdown = segment.conditions.aerodynamics.drag_breakdown - cdp = drag_breakdown.parasite.total[:,0] - cdi = drag_breakdown.induced.total[:,0] - cdc = drag_breakdown.compressible.total[:,0] - cdm = drag_breakdown.miscellaneous.total[:,0] - cd = drag_breakdown.total[:,0] - - if line_style == 'bo-': - axes.plot( time , cdp , 'ko-', label='CD_P' ) - axes.plot( time , cdi , 'bo-', label='CD_I' ) - axes.plot( time , cdc , 'go-', label='CD_C' ) - axes.plot( time , cdm , 'yo-', label='CD_M' ) - axes.plot( time , cd , 'ro-', label='CD' ) - if i == 0: - axes.legend(loc='upper center') - else: - axes.plot( time , cdp , line_style ) - axes.plot( time , cdi , line_style ) - axes.plot( time , cdc , line_style ) - axes.plot( time , cdm , line_style ) - axes.plot( time , cd , line_style ) - - axes.set_xlabel('Time (min)') - axes.set_ylabel('CD') - axes.grid(True) - - - # ------------------------------------------------------------------ - # Flight Conditions - # ------------------------------------------------------------------ - fig = plt.figure("Flight Conditions",figsize=(6.5,10)) - for segment in results.segments.values(): - - time = segment.conditions.frames.inertial.time[:,0] / Units.min - altitude = segment.conditions.freestream.altitude[:,0] / Units.km - mach = segment.conditions.freestream.mach_number[:,0] - distance = segment.conditions.frames.inertial.position_vector[:,0] / Units.km - - axes = fig.add_subplot(3,1,1) - axes.plot( time, distance, line_style ) - axes.set_ylabel('Distance (km)') - axes.grid(True) - - axes = fig.add_subplot(3,1,2) - axes.plot( time , altitude , line_style , lw=line_width ) - axes.set_ylabel('Altitude (km)') - axes.grid(True) - - axes = fig.add_subplot(3,1,3) - axes.plot( time , mach, line_style , lw=line_width ) - axes.set_xlabel('Time (min)') - axes.set_ylabel('Mach Number (-)') - axes.grid(True) - - # ------------------------------------------------------------------ - # Mass, State of Charge, Power - # ------------------------------------------------------------------ - - fig = plt.figure("Electric Aircraft Outputs",figsize=(6.5,10)) - for segment in results.segments.values(): - - time = segment.conditions.frames.inertial.time[:,0] / Units.min - mass = segment.conditions.weights.total_mass[:,0] - - axes = fig.add_subplot(3,1,1) - axes.plot( time , mass , line_style , lw=line_width ) - axes.set_ylabel('Vehicle Mass (kg)') - axes.grid(True) - - try: - battery=configs.base.energy_network['battery'] - state_of_charge=segment.conditions.propulsion.battery_energy/battery.max_energy - battery_power=-segment.conditions.propulsion.battery_draw/Units.MW - except: - continue - - axes = fig.add_subplot(3,1,2) - axes.plot( time , state_of_charge , line_style , lw=line_width ) - axes.set_ylabel('State of Charge (-)') - axes.set_ylim([-0.005,1.005]) - axes.grid(True) - - axes = fig.add_subplot(3,1,3) - axes.plot( time , battery_power , line_style , lw=line_width ) - axes.set_xlabel('Time (min)') - axes.set_ylabel('Discharge Power (MW)') - axes.grid(True) - - - raw_input('Press Enter To Quit') - return - - -if __name__ == '__main__': - main() - plt.show() \ No newline at end of file diff --git a/tut_mission_B737.py b/tut_mission_B737.py index c97c6fd..5b4f365 100644 --- a/tut_mission_B737.py +++ b/tut_mission_B737.py @@ -594,176 +594,6 @@ def configs_setup(vehicle): return configs -# ---------------------------------------------------------------------- -# Plot Mission -# ---------------------------------------------------------------------- - -def plot_mission(results,line_style='bo-'): - - axis_font = {'fontname':'Arial', 'size':'14'} - - # ------------------------------------------------------------------ - # Aerodynamics - # ------------------------------------------------------------------ - - - fig = plt.figure("Aerodynamic Forces",figsize=(8,6)) - for segment in results.segments.values(): - - time = segment.conditions.frames.inertial.time[:,0] / Units.min - Thrust = segment.conditions.frames.body.thrust_force_vector[:,0] / Units.lbf - eta = segment.conditions.propulsion.throttle[:,0] - - axes = fig.add_subplot(2,1,1) - axes.plot( time , Thrust , line_style ) - axes.set_ylabel('Thrust (lbf)',axis_font) - axes.grid(True) - - axes = fig.add_subplot(2,1,2) - axes.plot( time , eta , line_style ) - axes.set_xlabel('Time (min)',axis_font) - axes.set_ylabel('Throttle',axis_font) - axes.grid(True) - - plt.savefig("B737_engine.pdf") - plt.savefig("B737_engine.png") - - # ------------------------------------------------------------------ - # Aerodynamics 2 - # ------------------------------------------------------------------ - fig = plt.figure("Aerodynamic Coefficients",figsize=(8,10)) - for segment in results.segments.values(): - - time = segment.conditions.frames.inertial.time[:,0] / Units.min - CLift = segment.conditions.aerodynamics.lift_coefficient[:,0] - CDrag = segment.conditions.aerodynamics.drag_coefficient[:,0] - aoa = segment.conditions.aerodynamics.angle_of_attack[:,0] / Units.deg - l_d = CLift/CDrag - - axes = fig.add_subplot(3,1,1) - axes.plot( time , CLift , line_style ) - axes.set_ylabel('Lift Coefficient',axis_font) - axes.grid(True) - - axes = fig.add_subplot(3,1,2) - axes.plot( time , l_d , line_style ) - axes.set_ylabel('L/D',axis_font) - axes.grid(True) - - axes = fig.add_subplot(3,1,3) - axes.plot( time , aoa , 'ro-' ) - axes.set_xlabel('Time (min)',axis_font) - axes.set_ylabel('AOA (deg)',axis_font) - axes.grid(True) - - plt.savefig("B737_aero.pdf") - plt.savefig("B737_aero.png") - - # ------------------------------------------------------------------ - # Aerodynamics 2 - # ------------------------------------------------------------------ - fig = plt.figure("Drag Components",figsize=(8,10)) - axes = plt.gca() - for i, segment in enumerate(results.segments.values()): - - time = segment.conditions.frames.inertial.time[:,0] / Units.min - drag_breakdown = segment.conditions.aerodynamics.drag_breakdown - cdp = drag_breakdown.parasite.total[:,0] - cdi = drag_breakdown.induced.total[:,0] - cdc = drag_breakdown.compressible.total[:,0] - cdm = drag_breakdown.miscellaneous.total[:,0] - cd = drag_breakdown.total[:,0] - - if line_style == 'bo-': - axes.plot( time , cdp , 'ko-', label='CD parasite' ) - axes.plot( time , cdi , 'bo-', label='CD induced' ) - axes.plot( time , cdc , 'go-', label='CD compressibility' ) - axes.plot( time , cdm , 'yo-', label='CD miscellaneous' ) - axes.plot( time , cd , 'ro-', label='CD total' ) - if i == 0: - axes.legend(loc='upper center') - else: - axes.plot( time , cdp , line_style ) - axes.plot( time , cdi , line_style ) - axes.plot( time , cdc , line_style ) - axes.plot( time , cdm , line_style ) - axes.plot( time , cd , line_style ) - - axes.set_xlabel('Time (min)') - axes.set_ylabel('CD') - axes.grid(True) - plt.savefig("B737_drag.pdf") - plt.savefig("B737_drag.png") - - # ------------------------------------------------------------------ - # Altitude, sfc, vehicle weight - # ------------------------------------------------------------------ - - fig = plt.figure("Altitude_sfc_weight",figsize=(8,10)) - for segment in results.segments.values(): - - time = segment.conditions.frames.inertial.time[:,0] / Units.min - aoa = segment.conditions.aerodynamics.angle_of_attack[:,0] / Units.deg - mass = segment.conditions.weights.total_mass[:,0] / Units.lb - altitude = segment.conditions.freestream.altitude[:,0] / Units.ft - mdot = segment.conditions.weights.vehicle_mass_rate[:,0] - thrust = segment.conditions.frames.body.thrust_force_vector[:,0] - sfc = (mdot / Units.lb) / (thrust /Units.lbf) * Units.hr - - axes = fig.add_subplot(3,1,1) - axes.plot( time , altitude , line_style ) - axes.set_ylabel('Altitude (ft)',axis_font) - axes.grid(True) - - axes = fig.add_subplot(3,1,3) - axes.plot( time , sfc , line_style ) - axes.set_xlabel('Time (min)',axis_font) - axes.set_ylabel('sfc (lb/lbf-hr)',axis_font) - axes.grid(True) - - axes = fig.add_subplot(3,1,2) - axes.plot( time , mass , 'ro-' ) - axes.set_ylabel('Weight (lb)',axis_font) - axes.grid(True) - - plt.savefig("B737_mission.pdf") - plt.savefig("B737_mission.png") - - # ------------------------------------------------------------------ - # Velocities - # ------------------------------------------------------------------ - fig = plt.figure("Velocities",figsize=(8,10)) - for segment in results.segments.values(): - - time = segment.conditions.frames.inertial.time[:,0] / Units.min - Lift = -segment.conditions.frames.wind.lift_force_vector[:,2] - Drag = -segment.conditions.frames.wind.drag_force_vector[:,0] / Units.lbf - Thrust = segment.conditions.frames.body.thrust_force_vector[:,0] / Units.lb - velocity = segment.conditions.freestream.velocity[:,0] - pressure = segment.conditions.freestream.pressure[:,0] - density = segment.conditions.freestream.density[:,0] - EAS = velocity * np.sqrt(density/1.225) - mach = segment.conditions.freestream.mach_number[:,0] - - axes = fig.add_subplot(3,1,1) - axes.plot( time , velocity / Units.kts, line_style ) - axes.set_ylabel('velocity (kts)',axis_font) - axes.grid(True) - - axes = fig.add_subplot(3,1,2) - axes.plot( time , EAS / Units.kts, line_style ) - axes.set_xlabel('Time (min)',axis_font) - axes.set_ylabel('Equivalent Airspeed',axis_font) - axes.grid(True) - - axes = fig.add_subplot(3,1,3) - axes.plot( time , mach , line_style ) - axes.set_xlabel('Time (min)',axis_font) - axes.set_ylabel('Mach',axis_font) - axes.grid(True) - - return - def simple_sizing(configs): base = configs.base @@ -990,6 +820,176 @@ def missions_setup(base_mission): return missions +# ---------------------------------------------------------------------- +# Plot Mission +# ---------------------------------------------------------------------- + +def plot_mission(results,line_style='bo-'): + + axis_font = {'fontname':'Arial', 'size':'14'} + + # ------------------------------------------------------------------ + # Aerodynamics + # ------------------------------------------------------------------ + + + fig = plt.figure("Aerodynamic Forces",figsize=(8,6)) + for segment in results.segments.values(): + + time = segment.conditions.frames.inertial.time[:,0] / Units.min + Thrust = segment.conditions.frames.body.thrust_force_vector[:,0] / Units.lbf + eta = segment.conditions.propulsion.throttle[:,0] + + axes = fig.add_subplot(2,1,1) + axes.plot( time , Thrust , line_style ) + axes.set_ylabel('Thrust (lbf)',axis_font) + axes.grid(True) + + axes = fig.add_subplot(2,1,2) + axes.plot( time , eta , line_style ) + axes.set_xlabel('Time (min)',axis_font) + axes.set_ylabel('Throttle',axis_font) + axes.grid(True) + + plt.savefig("B737_engine.pdf") + plt.savefig("B737_engine.png") + + # ------------------------------------------------------------------ + # Aerodynamics 2 + # ------------------------------------------------------------------ + fig = plt.figure("Aerodynamic Coefficients",figsize=(8,10)) + for segment in results.segments.values(): + + time = segment.conditions.frames.inertial.time[:,0] / Units.min + CLift = segment.conditions.aerodynamics.lift_coefficient[:,0] + CDrag = segment.conditions.aerodynamics.drag_coefficient[:,0] + aoa = segment.conditions.aerodynamics.angle_of_attack[:,0] / Units.deg + l_d = CLift/CDrag + + axes = fig.add_subplot(3,1,1) + axes.plot( time , CLift , line_style ) + axes.set_ylabel('Lift Coefficient',axis_font) + axes.grid(True) + + axes = fig.add_subplot(3,1,2) + axes.plot( time , l_d , line_style ) + axes.set_ylabel('L/D',axis_font) + axes.grid(True) + + axes = fig.add_subplot(3,1,3) + axes.plot( time , aoa , 'ro-' ) + axes.set_xlabel('Time (min)',axis_font) + axes.set_ylabel('AOA (deg)',axis_font) + axes.grid(True) + + plt.savefig("B737_aero.pdf") + plt.savefig("B737_aero.png") + + # ------------------------------------------------------------------ + # Aerodynamics 2 + # ------------------------------------------------------------------ + fig = plt.figure("Drag Components",figsize=(8,10)) + axes = plt.gca() + for i, segment in enumerate(results.segments.values()): + + time = segment.conditions.frames.inertial.time[:,0] / Units.min + drag_breakdown = segment.conditions.aerodynamics.drag_breakdown + cdp = drag_breakdown.parasite.total[:,0] + cdi = drag_breakdown.induced.total[:,0] + cdc = drag_breakdown.compressible.total[:,0] + cdm = drag_breakdown.miscellaneous.total[:,0] + cd = drag_breakdown.total[:,0] + + if line_style == 'bo-': + axes.plot( time , cdp , 'ko-', label='CD parasite' ) + axes.plot( time , cdi , 'bo-', label='CD induced' ) + axes.plot( time , cdc , 'go-', label='CD compressibility' ) + axes.plot( time , cdm , 'yo-', label='CD miscellaneous' ) + axes.plot( time , cd , 'ro-', label='CD total' ) + if i == 0: + axes.legend(loc='upper center') + else: + axes.plot( time , cdp , line_style ) + axes.plot( time , cdi , line_style ) + axes.plot( time , cdc , line_style ) + axes.plot( time , cdm , line_style ) + axes.plot( time , cd , line_style ) + + axes.set_xlabel('Time (min)') + axes.set_ylabel('CD') + axes.grid(True) + plt.savefig("B737_drag.pdf") + plt.savefig("B737_drag.png") + + # ------------------------------------------------------------------ + # Altitude, sfc, vehicle weight + # ------------------------------------------------------------------ + + fig = plt.figure("Altitude_sfc_weight",figsize=(8,10)) + for segment in results.segments.values(): + + time = segment.conditions.frames.inertial.time[:,0] / Units.min + aoa = segment.conditions.aerodynamics.angle_of_attack[:,0] / Units.deg + mass = segment.conditions.weights.total_mass[:,0] / Units.lb + altitude = segment.conditions.freestream.altitude[:,0] / Units.ft + mdot = segment.conditions.weights.vehicle_mass_rate[:,0] + thrust = segment.conditions.frames.body.thrust_force_vector[:,0] + sfc = (mdot / Units.lb) / (thrust /Units.lbf) * Units.hr + + axes = fig.add_subplot(3,1,1) + axes.plot( time , altitude , line_style ) + axes.set_ylabel('Altitude (ft)',axis_font) + axes.grid(True) + + axes = fig.add_subplot(3,1,3) + axes.plot( time , sfc , line_style ) + axes.set_xlabel('Time (min)',axis_font) + axes.set_ylabel('sfc (lb/lbf-hr)',axis_font) + axes.grid(True) + + axes = fig.add_subplot(3,1,2) + axes.plot( time , mass , 'ro-' ) + axes.set_ylabel('Weight (lb)',axis_font) + axes.grid(True) + + plt.savefig("B737_mission.pdf") + plt.savefig("B737_mission.png") + + # ------------------------------------------------------------------ + # Velocities + # ------------------------------------------------------------------ + fig = plt.figure("Velocities",figsize=(8,10)) + for segment in results.segments.values(): + + time = segment.conditions.frames.inertial.time[:,0] / Units.min + Lift = -segment.conditions.frames.wind.lift_force_vector[:,2] + Drag = -segment.conditions.frames.wind.drag_force_vector[:,0] / Units.lbf + Thrust = segment.conditions.frames.body.thrust_force_vector[:,0] / Units.lb + velocity = segment.conditions.freestream.velocity[:,0] + pressure = segment.conditions.freestream.pressure[:,0] + density = segment.conditions.freestream.density[:,0] + EAS = velocity * np.sqrt(density/1.225) + mach = segment.conditions.freestream.mach_number[:,0] + + axes = fig.add_subplot(3,1,1) + axes.plot( time , velocity / Units.kts, line_style ) + axes.set_ylabel('velocity (kts)',axis_font) + axes.grid(True) + + axes = fig.add_subplot(3,1,2) + axes.plot( time , EAS / Units.kts, line_style ) + axes.set_xlabel('Time (min)',axis_font) + axes.set_ylabel('Equivalent Airspeed',axis_font) + axes.grid(True) + + axes = fig.add_subplot(3,1,3) + axes.plot( time , mach , line_style ) + axes.set_xlabel('Time (min)',axis_font) + axes.set_ylabel('Mach',axis_font) + axes.grid(True) + + return + if __name__ == '__main__': main() plt.show() \ No newline at end of file From 5861b59843a6b63763877e6452bca536372f3a27 Mon Sep 17 00:00:00 2001 From: Tim MacDonald Date: Mon, 14 Aug 2017 15:36:22 -0700 Subject: [PATCH 10/19] removed concorde segments --- tut_concorde.py | 52 +------------------------------------------------ 1 file changed, 1 insertion(+), 51 deletions(-) diff --git a/tut_concorde.py b/tut_concorde.py index b929848..acc0edd 100644 --- a/tut_concorde.py +++ b/tut_concorde.py @@ -194,37 +194,7 @@ def vehicle_setup(): wing.high_lift = True wing.vortex_lift = True wing.high_mach = True - wing.dynamic_pressure_ratio = 1.0 - - # set root sweep with inner section - segment = SUAVE.Components.Wings.Segment() - segment.tag = 'section_1' - segment.percent_span_location = 0. - segment.twist = 0. * Units.deg - segment.root_chord_percent = 33.8/33.8 - segment.dihedral_outboard = 0. - segment.sweeps.quarter_chord = 67. * Units.deg - wing.Segments.append(segment) - - # set mid section start point - segment = SUAVE.Components.Wings.Segment() - segment.tag = 'section_2' - segment.percent_span_location = 6.15/(25.6/2) + wing.Segments['section_1'].percent_span_location - segment.twist = 0. * Units.deg - segment.root_chord_percent = 13.8/33.8 - segment.dihedral_outboard = 0. - segment.sweeps.quarter_chord = 48. * Units.deg - wing.Segments.append(segment) - - # set tip section start point - segment = SUAVE.Components.Wings.Segment() - segment.tag = 'section_3' - segment.percent_span_location = 5.95/(25.6/2) + wing.Segments['section_2'].percent_span_location - segment.twist = 0. * Units.deg - segment.root_chord_percent = 4.4/33.8 - segment.dihedral_outboard = 0. - segment.sweeps.quarter_chord = 71. * Units.deg - wing.Segments.append(segment) + wing.dynamic_pressure_ratio = 1.0 # add to vehicle vehicle.append_component(wing) @@ -259,26 +229,6 @@ def vehicle_setup(): wing.t_tail = False wing.high_mach = True wing.dynamic_pressure_ratio = 1.0 - - # set root sweep with inner section - segment = SUAVE.Components.Wings.Segment() - segment.tag = 'section_1' - segment.percent_span_location = 0.0 - segment.twist = 0. * Units.deg - segment.root_chord_percent = 14.5/14.5 - segment.dihedral_outboard = 0. - segment.sweeps.quarter_chord = 63 * Units.deg - wing.Segments.append(segment) - - # set mid section start point - segment = SUAVE.Components.Wings.Segment() - segment.tag = 'section_2' - segment.percent_span_location = 2.4/(6.0) + wing.Segments['section_1'].percent_span_location - segment.twist = 0. * Units.deg - segment.root_chord_percent = 7.5/14.5 - segment.dihedral_outboard = 0. - segment.sweeps.quarter_chord = 40. * Units.deg - wing.Segments.append(segment) # add to vehicle vehicle.append_component(wing) From 3f72c69cfd4c129ce681fa252b123f671df9fce2 Mon Sep 17 00:00:00 2001 From: Tim MacDonald Date: Mon, 14 Aug 2017 15:57:17 -0700 Subject: [PATCH 11/19] more minor tutorial edits --- tut_concorde.py | 2 +- tut_mission_B737.py | 2 +- tut_payload_range.py | 68 ++++++++++++++++++++++---------------------- tut_solar_uav.py | 37 ++++++++++++------------ 4 files changed, 54 insertions(+), 55 deletions(-) diff --git a/tut_concorde.py b/tut_concorde.py index acc0edd..ad820bf 100644 --- a/tut_concorde.py +++ b/tut_concorde.py @@ -240,7 +240,7 @@ def vehicle_setup(): fuselage = SUAVE.Components.Fuselages.Fuselage() fuselage.tag = 'fuselage' fuselage.seats_abreast = 4 - fuselage.seat_pitch = 1 + fuselage.seat_pitch = 1 * Units.meter fuselage.fineness.nose = 4.3 * Units.meter fuselage.fineness.tail = 6.4 * Units.meter fuselage.lengths.total = 61.66 * Units.meter diff --git a/tut_mission_B737.py b/tut_mission_B737.py index 5b4f365..aaf1067 100644 --- a/tut_mission_B737.py +++ b/tut_mission_B737.py @@ -309,7 +309,7 @@ def vehicle_setup(): fuselage.number_coach_seats = vehicle.passengers fuselage.seats_abreast = 6 - fuselage.seat_pitch = 1 + fuselage.seat_pitch = 1 * Units.meter fuselage.fineness.nose = 1.6 fuselage.fineness.tail = 2. fuselage.lengths.nose = 6.4 * Units.meter diff --git a/tut_payload_range.py b/tut_payload_range.py index d05bada..e9a1fef 100644 --- a/tut_payload_range.py +++ b/tut_payload_range.py @@ -198,7 +198,7 @@ def vehicle_setup(): wing.areas.affected = 0.6 * wing.areas.wetted wing.twists.root = 2.0 * Units.degrees wing.twists.tip = 0.0 * Units.degrees - wing.origin = [20.,0,0] + wing.origin = [20.,0,0] # meters wing.vertical = False wing.symmetric = True wing.dynamic_pressure_ratio = 1.0 @@ -228,8 +228,8 @@ def vehicle_setup(): wing.areas.affected = 0.6 * wing.areas.wetted wing.twists.root = 2.0 * Units.degrees wing.twists.tip = 2.0 * Units.degrees - wing.origin = [50,0,0] - wing.aerodynamic_center = [2,0,0] + wing.origin = [50,0,0] # meters + wing.aerodynamic_center = [2,0,0] # meters wing.vertical = False wing.symmetric = True wing.dynamic_pressure_ratio = 0.9 @@ -244,7 +244,7 @@ def vehicle_setup(): wing = SUAVE.Components.Wings.Wing() wing.tag = 'vertical_stabilizer' - wing.aspect_ratio = 1.7 # + wing.aspect_ratio = 1.7 wing.sweeps.quarter_chord = 25 * Units.deg wing.thickness_to_chord = 0.12 wing.taper = 0.10 @@ -259,8 +259,8 @@ def vehicle_setup(): wing.areas.affected = 0.6 * wing.areas.wetted wing.twists.root = 0.0 * Units.degrees wing.twists.tip = 0.0 * Units.degrees - wing.origin = [50,0,0] - wing.aerodynamic_center = [2,0,0] + wing.origin = [50,0,0] # meters + wing.aerodynamic_center = [2,0,0] # meters wing.vertical = True wing.symmetric = False wing.dynamic_pressure_ratio = 1.0 @@ -277,7 +277,7 @@ def vehicle_setup(): fuselage.number_coach_seats = vehicle.passengers fuselage.seats_abreast = 4 - fuselage.seat_pitch = 0.7455 + fuselage.seat_pitch = 0.7455 * Units.meters fuselage.fineness.nose = 2.0 fuselage.fineness.tail = 3.0 fuselage.lengths.nose = 6.0 * Units.meter @@ -305,7 +305,7 @@ def vehicle_setup(): # ------------------------------------------------------------------ - #initialize the gas turbine network + # initialize the gas turbine network gt_engine = SUAVE.Components.Energy.Networks.Turbofan() gt_engine.tag = 'turbofan' @@ -314,116 +314,116 @@ def vehicle_setup(): gt_engine.engine_length = 2.71 gt_engine.nacelle_diameter = 2.05 - #set the working fluid for the network + # set the working fluid for the network gt_engine.working_fluid = SUAVE.Attributes.Gases.Air - #Component 1 : ram, to convert freestream static to stagnation quantities + # Component 1 : ram, to convert freestream static to stagnation quantities ram = SUAVE.Components.Energy.Converters.Ram() ram.tag = 'ram' - #add ram to the network + # add ram to the network gt_engine.ram = ram - #Component 2 : inlet nozzle + # Component 2 : inlet nozzle inlet_nozzle = SUAVE.Components.Energy.Converters.Compression_Nozzle() inlet_nozzle.tag = 'inlet nozzle' inlet_nozzle.polytropic_efficiency = 0.98 inlet_nozzle.pressure_ratio = 0.99 - #add inlet nozzle to the network + # add inlet nozzle to the network gt_engine.inlet_nozzle = inlet_nozzle - #Component 3 :low pressure compressor + # Component 3 :low pressure compressor low_pressure_compressor = SUAVE.Components.Energy.Converters.Compressor() low_pressure_compressor.tag = 'lpc' low_pressure_compressor.polytropic_efficiency = 0.91 low_pressure_compressor.pressure_ratio = 1.9 - #add low pressure compressor to the network + # add low pressure compressor to the network gt_engine.low_pressure_compressor = low_pressure_compressor - #Component 4 :high pressure compressor + # Component 4 :high pressure compressor high_pressure_compressor = SUAVE.Components.Energy.Converters.Compressor() high_pressure_compressor.tag = 'hpc' high_pressure_compressor.polytropic_efficiency = 0.91 high_pressure_compressor.pressure_ratio = 10.0 - #add the high pressure compressor to the network + # add the high pressure compressor to the network gt_engine.high_pressure_compressor = high_pressure_compressor - #Component 5 :low pressure turbine + # Component 5 :low pressure turbine low_pressure_turbine = SUAVE.Components.Energy.Converters.Turbine() low_pressure_turbine.tag='lpt' low_pressure_turbine.mechanical_efficiency = 0.99 low_pressure_turbine.polytropic_efficiency = 0.99 - #add low pressure turbine to the network + # add low pressure turbine to the network gt_engine.low_pressure_turbine = low_pressure_turbine - #Component 5 :high pressure turbine + # Component 5 :high pressure turbine high_pressure_turbine = SUAVE.Components.Energy.Converters.Turbine() high_pressure_turbine.tag='hpt' high_pressure_turbine.mechanical_efficiency = 0.99 high_pressure_turbine.polytropic_efficiency = 0.99 - #add the high pressure turbine to the network + # add the high pressure turbine to the network gt_engine.high_pressure_turbine = high_pressure_turbine - #Component 6 :combustor + # Component 6 :combustor combustor = SUAVE.Components.Energy.Converters.Combustor() - combustor.tag = 'Comb' + combustor.tag = 'comb' combustor.efficiency = 0.99 combustor.alphac = 1.0 combustor.turbine_inlet_temperature = 1500 combustor.pressure_ratio = 0.95 combustor.fuel_data = SUAVE.Attributes.Propellants.Jet_A() - #add the combustor to the network + # add the combustor to the network gt_engine.combustor = combustor - #Component 7 :core nozzle + # Component 7 :core nozzle core_nozzle = SUAVE.Components.Energy.Converters.Expansion_Nozzle() core_nozzle.tag = 'core nozzle' core_nozzle.polytropic_efficiency = 0.95 core_nozzle.pressure_ratio = 0.99 - #add the core nozzle to the network + # add the core nozzle to the network gt_engine.core_nozzle = core_nozzle - #Component 8 :fan nozzle + # Component 8 :fan nozzle fan_nozzle = SUAVE.Components.Energy.Converters.Expansion_Nozzle() fan_nozzle.tag = 'fan nozzle' fan_nozzle.polytropic_efficiency = 0.95 fan_nozzle.pressure_ratio = 0.98 - #add the fan nozzle to the network + # add the fan nozzle to the network gt_engine.fan_nozzle = fan_nozzle - #Component 9 : fan + # Component 9 : fan fan = SUAVE.Components.Energy.Converters.Fan() fan.tag = 'fan' fan.polytropic_efficiency = 0.93 fan.pressure_ratio = 1.7 - #add the fan to the network + # add the fan to the network gt_engine.fan = fan - #Component 10 : thrust (to compute the thrust) + # Component 10 : thrust (to compute the thrust) thrust = SUAVE.Components.Energy.Processes.Thrust() thrust.tag ='compute_thrust' - #total design thrust (includes all the engines) + # total design thrust (includes all the engines) thrust.total_design = 37278.0* Units.N #Newtons - #design sizing conditions + # design sizing conditions altitude = 35000.0*Units.ft mach_number = 0.78 isa_deviation = 0. @@ -431,7 +431,7 @@ def vehicle_setup(): # add thrust to the network gt_engine.thrust = thrust - #size the turbofan + # size the turbofan turbofan_sizing(gt_engine,mach_number,altitude) # add gas turbine network gt_engine to the vehicle diff --git a/tut_solar_uav.py b/tut_solar_uav.py index de2ab62..8a98c23 100644 --- a/tut_solar_uav.py +++ b/tut_solar_uav.py @@ -114,13 +114,12 @@ def vehicle_setup(): wing.twists.tip = 0.0 * Units.degrees wing.highlift = False wing.vertical = False - wing.eta = 1.0 wing.number_ribs = 26. wing.number_end_ribs = 2. wing.transition_x_upper = 0.6 wing.transition_x_lower = 1.0 - wing.origin = [3.0,0.0,0.0] - wing.aerodynamic_center = [3.0,0.0,0.0] + wing.origin = [3.0,0.0,0.0] # meters + wing.aerodynamic_center = [3.0,0.0,0.0] # meters # add to vehicle vehicle.append_component(wing) @@ -152,8 +151,8 @@ def vehicle_setup(): wing.chords.root = wing.areas.reference/wing.spans.projected wing.chords.tip = wing.areas.reference/wing.spans.projected wing.chords.mean_aerodynamic = wing.areas.reference/wing.spans.projected - wing.origin = [10.,0.0,0.0] - wing.aerodynamic_center = [0.5,0.0,0.0] + wing.origin = [10.,0.0,0.0] # meters + wing.aerodynamic_center = [0.5,0.0,0.0] # meters # add to vehicle vehicle.append_component(wing) @@ -182,8 +181,8 @@ def vehicle_setup(): wing.areas.affected = 0.6 * wing.areas.wetted wing.twists.root = 0.0 * Units.degrees wing.twists.tip = 0.0 * Units.degrees - wing.origin = [10.,0.0,0.0] - wing.aerodynamic_center = [0.5,0.0,0.0] + wing.origin = [10.,0.0,0.0] # meters + wing.aerodynamic_center = [0.5,0.0,0.0] # meters wing.symmetric = True wing.vertical = True wing.t_tail = False @@ -200,8 +199,8 @@ def vehicle_setup(): # build network net = Solar() net.number_of_engines = 1. - net.nacelle_diameter = 0.2 - net.engine_length = 0.01 + net.nacelle_diameter = 0.2 * Units.meters + net.engine_length = 0.01 * Units.meters net.areas = Data() net.areas.wetted = 0.01*(2*np.pi*0.01/2.) @@ -227,11 +226,11 @@ def vehicle_setup(): prop_attributes.number_blades = 2.0 prop_attributes.freestream_velocity = 40.0 * Units['m/s']# freestream prop_attributes.angular_velocity = 150. * Units['rpm'] - prop_attributes.tip_radius = 4.25 - prop_attributes.hub_radius = 0.05 + prop_attributes.tip_radius = 4.25 * Units.meters + prop_attributes.hub_radius = 0.05 * Units.meters prop_attributes.design_Cl = 0.7 prop_attributes.design_altitude = 14.0 * Units.km - prop_attributes.design_thrust = 0.0 + prop_attributes.design_thrust = 0.0 prop_attributes.design_power = 3500.0 * Units.watts prop_attributes = propeller_design(prop_attributes) @@ -242,31 +241,31 @@ def vehicle_setup(): # Component 4 the Motor motor = SUAVE.Components.Energy.Converters.Motor() motor.resistance = 0.008 - motor.no_load_current = 4.5 + motor.no_load_current = 4.5 * Units.Ampere motor.speed_constant = 120. * Units['rpm'] # RPM/volt converted to (rad/s)/volt motor.propeller_radius = prop.prop_attributes.tip_radius motor.propeller_Cp = prop.prop_attributes.Cp motor.gear_ratio = 12. # Gear ratio motor.gearbox_efficiency = .98 # Gear box efficiency motor.expected_current = 160. # Expected current - motor.mass_properties.mass = 2.0 + motor.mass_properties.mass = 2.0 * Units.kg net.motor = motor # Component 6 the Payload payload = SUAVE.Components.Energy.Peripherals.Payload() - payload.power_draw = 50. #Watts + payload.power_draw = 50. * Units.Watts payload.mass_properties.mass = 5.0 * Units.kg net.payload = payload # Component 7 the Avionics avionics = SUAVE.Components.Energy.Peripherals.Avionics() - avionics.power_draw = 50. #Watts + avionics.power_draw = 50. * Units.Watts net.avionics = avionics # Component 8 the Battery bat = SUAVE.Components.Energy.Storages.Batteries.Constant_Mass.Lithium_Ion() bat.mass_properties.mass = 55.0 * Units.kg - bat.specific_energy = 450.*Units.Wh/Units.kg + bat.specific_energy = 450. * Units.Wh/Units.kg bat.resistance = 0.05 initialize_from_mass(bat,bat.mass_properties.mass) net.battery = bat @@ -418,8 +417,8 @@ def mission_setup(analyses,vehicle): segment.mach = 0.12 segment.distance = 3050.0 * Units.km segment.battery_energy = vehicle.propulsors.network.battery.max_energy*0.2 #Charge the battery to start - segment.latitude = 37.4300 - segment.longitude = -122.1700 + segment.latitude = 37.4300 # this defaults to degrees (do not use Units.degrees) + segment.longitude = -122.1700 # this defaults to degrees mission.append_segment(segment) From a91725911349bf0f92989f6adb1e7e0cb1062af8 Mon Sep 17 00:00:00 2001 From: Emilio Botero Date: Mon, 14 Aug 2017 16:40:31 -0700 Subject: [PATCH 12/19] first clean up of regional jet --- Regional_Jet_Optimization/Analyses.py | 17 +- Regional_Jet_Optimization/Missions.py | 35 +--- Regional_Jet_Optimization/Optimize.py | 59 +----- Regional_Jet_Optimization/Plot_Mission.py | 44 ++--- Regional_Jet_Optimization/Procedure.py | 44 +---- Regional_Jet_Optimization/Vehicles.py | 231 +++++++--------------- 6 files changed, 111 insertions(+), 319 deletions(-) diff --git a/Regional_Jet_Optimization/Analyses.py b/Regional_Jet_Optimization/Analyses.py index a81bb58..9c5c510 100644 --- a/Regional_Jet_Optimization/Analyses.py +++ b/Regional_Jet_Optimization/Analyses.py @@ -1,7 +1,7 @@ # Analyses.py # -# Created: Mar. 2016, M. Vegh -# Modified: +# Created: Mar 2016, M. Vegh +# Modified: Aug 2017, E. Botero # ---------------------------------------------------------------------- # Imports @@ -22,14 +22,6 @@ def setup(configs): analysis = base(config) analyses[tag] = analysis - # adjust analyses for configs - - # takeoff_analysis - analyses.takeoff.aerodynamics.settings.drag_coefficient_increment = 0.0000 - - # landing analysis - aerodynamics = analyses.landing.aerodynamics - return analyses # ---------------------------------------------------------------------- @@ -59,8 +51,6 @@ def base(vehicle): # Aerodynamics Analysis aerodynamics = SUAVE.Analyses.Aerodynamics.Fidelity_Zero() aerodynamics.geometry = vehicle - - aerodynamics.settings.drag_coefficient_increment = 0.0000 analyses.append(aerodynamics) # ------------------------------------------------------------------ @@ -72,7 +62,7 @@ def base(vehicle): # ------------------------------------------------------------------ # Energy energy= SUAVE.Analyses.Energy.Energy() - energy.network = vehicle.propulsors #what is called throughout the mission (at every time step)) + energy.network = vehicle.propulsors analyses.append(energy) # ------------------------------------------------------------------ @@ -86,5 +76,4 @@ def base(vehicle): atmosphere.features.planet = planet.features analyses.append(atmosphere) - # done! return analyses \ No newline at end of file diff --git a/Regional_Jet_Optimization/Missions.py b/Regional_Jet_Optimization/Missions.py index 1554147..cf16070 100644 --- a/Regional_Jet_Optimization/Missions.py +++ b/Regional_Jet_Optimization/Missions.py @@ -1,8 +1,7 @@ # Missions.py # # Created: Mar 2016, M. Vegh -# Modified: - +# Modified: Aug 2017, E. Botero # ---------------------------------------------------------------------- # Imports @@ -28,13 +27,7 @@ def setup(analyses): base_mission = base(analyses) missions.base = base_mission - - - - - return missions - def base(analyses): @@ -169,7 +162,7 @@ def base(analyses): # ------------------------------------------------------------------ - # Cruise Segment: constant speed, constant altitude + # Cruise Segment: Constant Speed, Constant Altitude # ------------------------------------------------------------------ segment = Segments.Cruise.Constant_Speed_Constant_Altitude() @@ -189,7 +182,7 @@ def base(analyses): mission.append_segment(segment) # ------------------------------------------------------------------ - # First Descent Segment: consant speed, constant segment rate + # First Descent Segment: Constant Speed, Constant Rate # ------------------------------------------------------------------ segment = Segments.Descent.Constant_Speed_Constant_Rate() @@ -209,9 +202,8 @@ def base(analyses): # add to mission mission.append_segment(segment) - # ------------------------------------------------------------------ - # Second Descent Segment: consant speed, constant segment rate + # Second Descent Segment: Constant Speed, Constant Rate # ------------------------------------------------------------------ segment = Segments.Descent.Constant_Speed_Constant_Rate() @@ -231,9 +223,8 @@ def base(analyses): # append to mission mission.append_segment(segment) - # ------------------------------------------------------------------ - # Third Descent Segment: consant speed, constant segment rate + # Third Descent Segment: Constant Speed, Constant Rate # ------------------------------------------------------------------ segment = Segments.Descent.Constant_Speed_Constant_Rate() @@ -263,10 +254,6 @@ def base(analyses): ### Reserve mission #------------------------------------------------------------------ - # ------------------------------------------------------------------ - # First Climb Segment: constant Mach, constant segment angle - # ------------------------------------------------------------------ - # ------------------------------------------------------------------ # First Climb Segment: Constant Speed, Constant Throttle # ------------------------------------------------------------------ @@ -288,8 +275,6 @@ def base(analyses): # add to misison mission.append_segment(segment) - - # ------------------------------------------------------------------ # Cruise Segment: constant speed, constant altitude @@ -318,7 +303,6 @@ def base(analyses): mission.append_segment(segment) - # ------------------------------------------------------------------ # Final Descent Segment: consant speed, constant segment rate # ------------------------------------------------------------------ @@ -327,13 +311,9 @@ def base(analyses): segment.tag = "reserve_descent_1" segment.analyses.extend( analyses.landing ) - analyses.landing.aerodynamics.settings.spoiler_drag_increment = 0.00 - segment.altitude_end = 0.0 * Units.km segment.descent_rate = 3.0 * Units['m/s'] - - segment.mach_end = 0.24 segment.mach_start = 0.3 @@ -344,13 +324,8 @@ def base(analyses): ### Reserve mission completed #------------------------------------------------------------------ - return mission - - - - # ---------------------------------------------------------------------- # Call Main # ---------------------------------------------------------------------- diff --git a/Regional_Jet_Optimization/Optimize.py b/Regional_Jet_Optimization/Optimize.py index 635aac4..db5d13a 100644 --- a/Regional_Jet_Optimization/Optimize.py +++ b/Regional_Jet_Optimization/Optimize.py @@ -1,6 +1,6 @@ # Optimize.py # Created: Feb 2016, M. Vegh -# Modified: +# Modified: Aug 2017, E. Botero # ---------------------------------------------------------------------- # Imports @@ -17,8 +17,7 @@ import matplotlib.pyplot as plt from SUAVE.Optimization import Nexus, carpet_plot import SUAVE.Optimization.Package_Setups.scipy_setup as scipy_setup -#import VyPy -#import pyOpt + # ---------------------------------------------------------------------- # Run the whole thing # ---------------------------------------------------------------------- @@ -39,15 +38,13 @@ def main(): #variable_sweep(problem) #uncomment this to view some contours of the problem - print 'fuel burn=', problem.summary.base_mission_fuelburn - print 'fuel margin=', problem.all_constraints() + print 'fuel burn = ', problem.summary.base_mission_fuelburn + print 'fuel margin = ', problem.all_constraints() #Plot_Mission.plot_mission(problem) return - - # ---------------------------------------------------------------------- # Inputs, Objective, & Constraints # ---------------------------------------------------------------------- @@ -67,9 +64,7 @@ def setup(): [ 'wing_area' , 95 , ( 90. , 130. ) , 100. , Units.meter**2], [ 'cruise_altitude' , 11 , ( 9 , 14. ) , 10. , Units.km], ]) - - - + # ------------------------------------------------------------------- # Objective # ------------------------------------------------------------------- @@ -80,7 +75,6 @@ def setup(): [ 'fuel_burn', 10000, Units.kg ] ]) - # ------------------------------------------------------------------- # Constraints # ------------------------------------------------------------------- @@ -103,39 +97,22 @@ def setup(): [ 'fuel_burn' , 'summary.base_mission_fuelburn' ], [ 'design_range_fuel_margin' , 'summary.max_zero_fuel_margin' ], ] - ''' - #TASOPT imports - from mission_B737_TASOPT import full_setup, mission_setup - - configs, analyses = full_setup() - nexus.vehicle_configurations = configs - nexus.analyses = analyses - nexus.mission = analyses.mission - #nexus.mission = mission_setup(nexus.analyses) - ''' - # ------------------------------------------------------------------- # Vehicles # ------------------------------------------------------------------- - - #import Vehicle_TASOPT - #nexus.vehicle_configurations = Vehicle_TASOPT.setup() nexus.vehicle_configurations = Vehicles.setup() - # ------------------------------------------------------------------- # Analyses # ------------------------------------------------------------------- nexus.analyses = Analyses.setup(nexus.vehicle_configurations) - # ------------------------------------------------------------------- # Missions # ------------------------------------------------------------------- nexus.missions = Missions.setup(nexus.analyses) - # ------------------------------------------------------------------- # Procedure # ------------------------------------------------------------------- @@ -164,27 +141,10 @@ def variable_sweep(problem): cbar = plt.colorbar(CS_const) cbar.ax.set_ylabel('fuel margin') - - plt.xlabel('wing area (m^2)') plt.ylabel('cruise_altitude (km)') - - wing_1 = np.array([ 0.95, 0.9500000149011611, 0.95, 0.95, 0.9500000149011611, 0.95, 0.95, 0.9500000149011611, 0.95, 1.0830895945429801, 1.0830896094441413, 1.0830895945429801, 1.0830895945429801, 1.0830896094441413, 1.0830895945429801, 1.0830895945429801, 1.0830896094441413, 1.0830895945429801, 1.021757391325076, 1.0217574062262371, 1.021757391325076, 1.021757391325076, 1.0217574062262371, 1.021757391325076, 1.021757391325076, 1.0217574062262371, 1.021757391325076, 0.923430766276824, 0.9234307811779852, 0.923430766276824, 0.923430766276824, 0.9234307811779852, 0.923430766276824, 0.923430766276824, 0.9234307811779852, 0.923430766276824, 0.9458241453484385, 0.9458241602495997, 0.9458241453484385, 0.9458241453484385, 0.9458241602495997, 0.9458241453484385, 0.9458241453484385, 0.9458241602495997, 0.9458241453484385, 0.943053052966747, 0.9430530678679082, 0.943053052966747, 0.943053052966747, 0.9430530678679082, 0.943053052966747, 0.943053052966747, 0.9430530678679082, 0.943053052966747, 0.90000000000000002, 0.90000000000000002, 0.90000000000000002, 0.90000000000000002, 0.90000000000000002, 1.0, 1.0, 1.0, 1.0, 1.0, 1.1000000000000001, 1.1000000000000001, 1.1000000000000001, 1.1000000000000001, 1.1000000000000001, 1.2, 1.2, 1.2, 1.2, 1.2, 1.3, 1.3, 1.3, 1.3, 1.3, 0.94305305 ])*100. - alt_1 = [11. , 11. , 11.00000015, 11. , 11. , 11.00000015, 11. , 11. , 11.00000015, 9. , 9. , 9.00000015, 9. , 9. , 9.00000015, 9. , 9. , 9.00000015, 9. , 9. , 9.00000015, 9. , 9. , 9.00000015, 9. , 9. , 9.00000015, 9. , 9. , 9.00000015, 9. , 9. , 9.00000015, 9. , 9. , 9.00000015, 9. , 9. , 9.00000015, 9. , 9. , 9.00000015, 9. , 9. , 9.00000015, 9. , 9. , 9.00000015, 9. , 9. , 9.00000015, 9. , 9. , 9.00000015, 9. , 10.25 , 11.5 , 12.75 , 14. , 9. , 10.25 , 11.5 , 12.75 , 14. , 9. , 10.25 , 11.5 , 12.75 , 14. , 9. , 10.25 , 11.5 , 12.75 , 14. , 9. , 10.25 , 11.5 , 12.75 , 14. , 9. ] - - wing_2 = np.array([1.28, 1.2800000149011612, 1.28, 1.28, 1.2800000149011612, 1.28, 1.28, 1.2800000149011612, 1.28, 1.3, 1.3000000149011612, 1.3, 1.3, 1.3000000149011612, 1.3, 1.3, 1.3000000149011612, 1.3, 1.2512983213829585, 1.2512983362841197, 1.2512983213829585, 1.2512983213829585, 1.2512983362841197, 1.2512983213829585, 1.2512983213829585, 1.2512983362841197, 1.2512983213829585, 1.2027018036450188, 1.20270181854618, 1.2027018036450188, 1.2027018036450188, 1.20270181854618, 1.2027018036450188, 1.2027018036450188, 1.20270181854618, 1.2027018036450188, 0.9696195074510734, 0.9696195223522346, 0.9696195074510734, 0.9696195074510734, 0.9696195223522346, 0.9696195074510734, 0.9696195074510734, 0.9696195223522346, 0.9696195074510734, 0.9356100057984995, 0.9356100206996607, 0.9356100057984995, 0.9356100057984995, 0.9356100206996607, 0.9356100057984995, 0.9356100057984995, 0.9356100206996607, 0.9356100057984995, 0.9442290521247874, 0.9442290670259486, 0.9442290521247874, 0.9442290521247874, 0.9442290670259486, 0.9442290521247874, 0.9442290521247874, 0.9442290670259486, 0.9442290521247874, 0.90000000000000002, 0.90000000000000002, 0.90000000000000002, 0.90000000000000002, 0.90000000000000002, 1.0, 1.0, 1.0, 1.0, 1.0, 1.1000000000000001, 1.1000000000000001, 0.94422905 ])* 100. - - alt_2 = [ 13.8 , 13.8 , 13.80000015 , 13.8 , 13.8 , 13.80000015 , 13.8 , 13.8, 13.80000015 , 10.86578142 , 10.86578142, 10.86578157 , 10.86578142 , 10.86578142 , 10.86578157 , 10.86578142, 10.86578142 , 10.86578157 , 9. , 9. , 9.00000015 , 9., 9., 9.00000015 , 9. , 9. , 9.00000015 , 9.26299784 , 9.26299784 , 9.26299799 , 9.26299784 , 9.26299784 , 9.26299799 , 9.26299784 , 9.26299784 , 9.26299799 , 9.21358943 , 9.21358943 , 9.21358957 , 9.21358943 , 9.21358943 , 9.21358957 , 9.21358943 , 9.21358943 , 9.21358957 , 9. , 9., 9.00000015 , 9., 9. , 9.00000015 , 9., 9. , 9.00000015 , 9. , 9., 9.00000015 , 9. , 9. , 9.00000015 , 9. , 9., 9.00000015 , 9. , 10.25 , 11.5 , 12.75, 14., 9.,10.25 , 11.5 , 12.75 , 14. , 9. , 10.25 , 9. ] - - - #now plot optimization path (note that these data points were post-processed into a plottable format) - #wing_1 = [95 , 95.00000149 , 95 , 95 , 95.00000149 , 95 , 95 , 95.00000149 , 95 , 106.674165 , 106.6741665 , 106.674165 , 106.674165 , 106.6741665 , 106.674165 , 106.674165 , 106.6741665 , 106.674165 , 105.6274294 , 105.6274309 , 105.6274294 , 105.6274294 , 105.6274309 , 105.6274294 , 105.6274294 , 105.6274309 , 105.6274294 , 106.9084316 , 106.9084331 , 106.9084316 , 106.9084316 , 106.9084331 , 106.9084316 , 106.9084316 , 106.9084331 , 106.9084316 , 110.520489 , 110.5204905 , 110.520489 , 110.520489 , 110.5204905 , 110.520489 , 110.520489 , 110.5204905 , 110.520489 , 113.2166831 , 113.2166845 , 113.2166831 , 113.2166831 , 113.2166845 , 113.2166831 , 113.2166831 , 113.2166845 , 113.2166831 , 114.1649262 , 114.1649277 , 114.1649262 , 114.1649262 , 114.1649277 , 114.1649262 , 114.1649262 , 114.1649277 , 114.1649262 , 114.2149828] - #alt_1 = [11.0 , 11.0 , 11.000000149011612, 11.0 , 11.0 , 11.000000149011612, 11.0 , 11.0 , 11.000000149011612, 9.540665954351425 , 9.540665954351425 , 9.540666103363037 , 9.540665954351425 , 9.540665954351425 , 9.540666103363037 , 9.540665954351425 , 9.540665954351425 , 9.540666103363037 , 10.023015652305284, 10.023015652305284, 10.023015801316896, 10.023015652305284, 10.023015652305284, 10.023015801316896, 10.023015652305284, 10.023015652305284, 10.023015801316896, 10.190994033521863, 10.190994033521863, 10.190994182533474, 10.190994033521863, 10.190994033521863, 10.190994182533474, 10.190994033521863, 10.190994033521863, 10.190994182533474, 10.440582829327589, 10.440582829327589, 10.4405829783392 , 10.440582829327589, 10.440582829327589, 10.4405829783392 , 10.440582829327589, 10.440582829327589, 10.4405829783392 , 10.536514606250261, 10.536514606250261, 10.536514755261873, 10.536514606250261, 10.536514606250261, 10.536514755261873, 10.536514606250261, 10.536514606250261, 10.536514755261873, 10.535957839878783, 10.535957839878783, 10.535957988890395, 10.535957839878783, 10.535957839878783, 10.535957988890395, 10.535957839878783, 10.535957839878783, 10.535957988890395, 10.52829047] - #wing_2 = [128 , 128.0000015, 128 , 128 , 128.0000015, 128 , 128 , 128.0000015, 128 , 130 , 130.0000015, 130 , 130 , 130.0000015, 130 , 130 , 130.0000015, 130 , 122.9564124, 122.9564139, 122.9564124, 122.9564124, 122.9564139, 122.9564124, 122.9564124, 122.9564139, 122.9564124, 116.5744347, 116.5744362, 116.5744347, 116.5744347, 116.5744362, 116.5744347, 116.5744347, 116.5744362, 116.5744347, 116.3530891, 116.3530906, 116.3530891, 116.3530891, 116.3530906, 116.3530891, 116.3530891, 116.3530906, 116.3530891] - #alt_2 = [13.8, 13.799999999999999, 13.80000014901161, 13.799999999999999, 13.799999999999999, 13.80000014901161, 13.799999999999999, 13.799999999999999, 13.80000014901161, 11.302562430674953, 11.302562430674953, 11.302562579686565, 11.302562430674953, 11.302562430674953, 11.302562579686565, 11.302562430674953, 11.302562430674953, 11.302562579686565, 11.158808932491421, 11.158808932491421, 11.158809081503033, 11.158808932491421, 11.158808932491421, 11.158809081503033, 11.158808932491421, 11.158808932491421, 11.158809081503033, 11.412913394878741, 11.412913394878741, 11.412913543890353, 11.412913394878741, 11.412913394878741, 11.412913543890353, 11.412913394878741, 11.412913394878741, 11.412913543890353, 11.402627869388722, 11.402627869388722, 11.402628018400334, 11.402627869388722, 11.402627869388722, 11.402628018400334, 11.402627869388722, 11.402627869388722, 11.402628018400334] - ''' opt_1 = plt.plot(wing_1, alt_1, label='optimization path 1') init_1 = plt.plot(wing_1[0], alt_1[0], 'ko') @@ -197,12 +157,7 @@ def variable_sweep(problem): plt.legend(loc='upper left') plt.show(block=True) - - return - - + if __name__ == '__main__': - main() - - + main() \ No newline at end of file diff --git a/Regional_Jet_Optimization/Plot_Mission.py b/Regional_Jet_Optimization/Plot_Mission.py index dd32283..095d7f0 100644 --- a/Regional_Jet_Optimization/Plot_Mission.py +++ b/Regional_Jet_Optimization/Plot_Mission.py @@ -25,17 +25,14 @@ def plot_mission(nexus,line_style='bo-'): # Aerodynamics # ------------------------------------------------------------------ fig = plt.figure("Aerodynamic Coefficients",figsize=(8,10)) - for segment in results.base.segments.values(): + for segment in results.segments.values(): time = segment.conditions.frames.inertial.time[:,0] / Units.min CLift = segment.conditions.aerodynamics.lift_coefficient[:,0] CDrag = segment.conditions.aerodynamics.drag_coefficient[:,0] - Drag = -segment.conditions.frames.wind.drag_force_vector[:,0] - Thrust = segment.conditions.frames.body.thrust_force_vector[:,0] aoa = segment.conditions.aerodynamics.angle_of_attack[:,0] / Units.deg l_d = CLift/CDrag - axes = fig.add_subplot(3,1,1) axes.plot( time , CLift , line_style ) axes.set_ylabel('Lift Coefficient',axis_font) @@ -87,44 +84,37 @@ def plot_mission(nexus,line_style='bo-'): axes.grid(True) # ------------------------------------------------------------------ - # Altitude, vehicle weight + # Altitude, sfc, vehicle weight # ------------------------------------------------------------------ - fig = plt.figure("Altitude, Weight",figsize=(8,10)) - for segment in results.base.segments.values(): + fig = plt.figure("Altitude_sfc_weight",figsize=(8,10)) + for segment in results.segments.values(): - time = segment.conditions.frames.inertial.time[:,0] / Units.min - CLift = segment.conditions.aerodynamics.lift_coefficient[:,0] - CDrag = segment.conditions.aerodynamics.drag_coefficient[:,0] - Drag = -segment.conditions.frames.wind.drag_force_vector[:,0] - Thrust = segment.conditions.frames.body.thrust_force_vector[:,0] - aoa = segment.conditions.aerodynamics.angle_of_attack[:,0] / Units.deg - l_d = CLift/CDrag - mass = segment.conditions.weights.total_mass[:,0] / Units.lb + time = segment.conditions.frames.inertial.time[:,0] / Units.min + aoa = segment.conditions.aerodynamics.angle_of_attack[:,0] / Units.deg + mass = segment.conditions.weights.total_mass[:,0] / Units.lb altitude = segment.conditions.freestream.altitude[:,0] / Units.ft - mdot = segment.conditions.weights.vehicle_mass_rate[:,0] - thrust = segment.conditions.frames.body.thrust_force_vector[:,0] - sfc = 3600. * mdot / 0.1019715 / thrust + mdot = segment.conditions.weights.vehicle_mass_rate[:,0] + thrust = segment.conditions.frames.body.thrust_force_vector[:,0] + sfc = (mdot / Units.lb) / (thrust /Units.lbf) * Units.hr - axes = fig.add_subplot(2,1,1) + axes = fig.add_subplot(3,1,1) axes.plot( time , altitude , line_style ) axes.set_ylabel('Altitude (ft)',axis_font) axes.grid(True) - + axes = fig.add_subplot(3,1,3) + axes.plot( time , sfc , line_style ) + axes.set_xlabel('Time (min)',axis_font) + axes.set_ylabel('sfc (lb/lbf-hr)',axis_font) + axes.grid(True) - axes = fig.add_subplot(2,1,2) + axes = fig.add_subplot(3,1,2) axes.plot( time , mass , 'ro-' ) axes.set_ylabel('Weight (lb)',axis_font) axes.grid(True) - - - - - plt.show(block=True) - return if __name__ == '__main__': diff --git a/Regional_Jet_Optimization/Procedure.py b/Regional_Jet_Optimization/Procedure.py index f016666..93dda53 100644 --- a/Regional_Jet_Optimization/Procedure.py +++ b/Regional_Jet_Optimization/Procedure.py @@ -1,16 +1,16 @@ # Procedure.py # # Created: Mar 2016, M. Vegh -# Modified: +# Modified: Aug 2017, E. Botero # ---------------------------------------------------------------------- # Imports # ---------------------------------------------------------------------- +import numpy as np + import SUAVE from SUAVE.Core import Units, Data -import numpy as np -import copy from SUAVE.Analyses.Process import Process from SUAVE.Methods.Propulsion.turbofan_sizing import turbofan_sizing from SUAVE.Methods.Geometry.Two_Dimensional.Cross_Section.Propulsion.compute_turbofan_geometry import compute_turbofan_geometry @@ -45,10 +45,8 @@ def setup(): # post process the results procedure.post_process = post_process - # done! return procedure - # ---------------------------------------------------------------------- # Target Range Function # ---------------------------------------------------------------------- @@ -95,8 +93,6 @@ def design_mission(nexus): return nexus - - # ---------------------------------------------------------------------- # Sizing # ---------------------------------------------------------------------- @@ -113,7 +109,6 @@ def simple_sizing(nexus): freestream = atmosphere.compute_values(altitude) freestream0 = atmosphere.compute_values(6000.*Units.ft) #cabin altitude - diff_pressure = np.max(freestream0.pressure-freestream.pressure,0) fuselage = base.fuselages['fuselage'] fuselage.differential_pressure = diff_pressure @@ -129,19 +124,15 @@ def simple_sizing(nexus): conditions = SUAVE.Analyses.Mission.Segments.Conditions.Aerodynamics() #assign conditions in form for propulsor sizing conditions.freestream = freestream - for config in configs: config.wings.horizontal_stabilizer.areas.reference = (26.0/92.0)*config.wings.main_wing.areas.reference for wing in config.wings: wing = SUAVE.Methods.Geometry.Two_Dimensional.Planform.wing_planform(wing) - wing.areas.exposed = 0.8 * wing.areas.wetted wing.areas.affected = 0.6 * wing.areas.reference - - fuselage = config.fuselages['fuselage'] fuselage.differential_pressure = diff_pressure @@ -163,7 +154,6 @@ def simple_sizing(nexus): altitude = nexus.missions.base.segments[-1].altitude_end atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976() freestream_landing = atmosphere.compute_values(0.) - #p, T, rho, a, mu = atmosphere.compute_values(0.) landing_conditions.freestream.velocity = nexus.missions.base.segments['descent_3'].air_speed landing_conditions.freestream.density = freestream_landing.density landing_conditions.freestream.dynamic_viscosity = freestream_landing.dynamic_viscosity @@ -177,7 +167,6 @@ def simple_sizing(nexus): altitude = nexus.missions.base.airport.altitude freestream_takeoff = atmosphere.compute_values(altitude) - #p, T, rho, a, mu = atmosphere.compute_values(altitude) takeoff_conditions.freestream.velocity = nexus.missions.base.segments.climb_1.air_speed takeoff_conditions.freestream.density = freestream_takeoff.density takeoff_conditions.freestream.dynamic_viscosity = freestream_takeoff.dynamic_viscosity @@ -190,7 +179,6 @@ def simple_sizing(nexus): base_conditions.freestream = takeoff_conditions.freestream max_CL_base,CDi = compute_max_lift_coeff(base,base_conditions) base.maximum_lift_coefficient = max_CL_base - # done! return nexus @@ -219,15 +207,13 @@ def weight(nexus): empty_weight =vehicle.mass_properties.operating_empty passenger_weight=vehicle.passenger_weights.mass_properties.mass for config in nexus.vehicle_configurations: - #config.mass_properties.max_zero_fuel = empty_weight+passenger_weight config.mass_properties.zero_fuel_center_of_gravity = vehicle.mass_properties.zero_fuel_center_of_gravity config.fuel = vehicle.fuel return nexus - # ---------------------------------------------------------------------- -# Finalizing Function (make part of optimization nexus)[needs to come after simple sizing doh] +# Finalizing Function # ---------------------------------------------------------------------- def finalize(nexus): @@ -236,8 +222,6 @@ def finalize(nexus): return nexus - - # ---------------------------------------------------------------------- # Post Process Results to give back to the optimizer # ---------------------------------------------------------------------- @@ -263,8 +247,6 @@ def post_process(nexus): if max_CMA>CMA: CMA=max_CMA - - summary.static_stability = CMA #throttle in design mission @@ -273,7 +255,6 @@ def post_process(nexus): max_segment_throttle = np.max(segment.conditions.propulsion.throttle[:,0]) if max_segment_throttle > max_throttle: max_throttle = max_segment_throttle - summary.max_throttle = max_throttle @@ -287,20 +268,6 @@ def post_process(nexus): summary.max_zero_fuel_margin = (design_landing_weight - zero_fuel_weight)/zero_fuel_weight summary.base_mission_fuelburn = design_takeoff_weight - results.base.segments['descent_3'].conditions.weights.total_mass[-1] - - - - hf = vehicle.fuselages.fuselage.heights.at_wing_root_quarter_chord - wf = vehicle.fuselages.fuselage.width - Lf = vehicle.fuselages.fuselage.lengths.total - Sw = vehicle.wings.main_wing.areas.reference - cw = vehicle.wings.main_wing.chords.mean_aerodynamic - b = vehicle.wings.main_wing.spans.projected - Sh = vehicle.wings.horizontal_stabilizer.areas.reference - Sv = vehicle.wings.vertical_stabilizer.areas.reference - lh = vehicle.wings.horizontal_stabilizer.origin[0] + vehicle.wings.horizontal_stabilizer.aerodynamic_center[0] - vehicle.mass_properties.center_of_gravity[0] - lv = vehicle.wings.vertical_stabilizer.origin[0] + vehicle.wings.vertical_stabilizer.aerodynamic_center[0] - vehicle.mass_properties.center_of_gravity[0] - #when you run want to output results to a file filename = 'results.txt' @@ -326,7 +293,4 @@ def post_process(nexus): file.close() ''' - - - return nexus diff --git a/Regional_Jet_Optimization/Vehicles.py b/Regional_Jet_Optimization/Vehicles.py index 9c4c38c..10f8118 100644 --- a/Regional_Jet_Optimization/Vehicles.py +++ b/Regional_Jet_Optimization/Vehicles.py @@ -1,7 +1,7 @@ # Vehicles.py # # Created: Feb. 2016, M. Vegh -# Modified: +# Modified: Aug. 2017, E. Botero # ---------------------------------------------------------------------- # Imports @@ -21,8 +21,7 @@ def setup(): configs = configs_setup(base_vehicle) return configs - - + def base_setup(): # ------------------------------------------------------------------ @@ -37,13 +36,13 @@ def base_setup(): # ------------------------------------------------------------------ # mass properties - vehicle.mass_properties.max_takeoff = 52000 #79090#. # kg - vehicle.mass_properties.operating_empty = 27837. # kg - vehicle.mass_properties.takeoff = 52000 #50989. #51800. # kg - vehicle.mass_properties.max_zero_fuel = 42977. #60899.3 # kg - vehicle.mass_properties.cargo = 0.0 * Units.kg + vehicle.mass_properties.max_takeoff = 52000 * Units.kg + vehicle.mass_properties.operating_empty = 27837. * Units.kg + vehicle.mass_properties.takeoff = 52000 * Units.kg + vehicle.mass_properties.max_zero_fuel = 42977. * Units.kg + vehicle.mass_properties.cargo = 0.0 * Units.kg vehicle.mass_properties.max_payload = 13063. * Units.kg - vehicle.mass_properties.max_fuel = 12971. + vehicle.mass_properties.max_fuel = 12971. * Units.kg vehicle.mass_properties.center_of_gravity = [18. , 0, 0] vehicle.mass_properties.moments_of_inertia.tensor = [[10 ** 5, 0, 0],[0, 10 ** 6, 0,],[0,0, 10 ** 7]] # Not Correct @@ -53,7 +52,7 @@ def base_setup(): vehicle.envelope.limit_load = 1.5 # basic parameters - vehicle.reference_area = 92.00 + vehicle.reference_area = 92.00 * Units['meters**2'] vehicle.passengers = 114 vehicle.systems.control = "fully powered" vehicle.systems.accessories = "medium range" @@ -70,31 +69,22 @@ def base_setup(): wing.thickness_to_chord = 0.11 wing.taper = 0.28 wing.span_efficiency = 1.0 - - wing.spans.projected = 27.8 - - wing.chords.root = 5.203 - wing.chords.tip = 1.460 - wing.chords.mean_aerodynamic = 3.680 - - wing.areas.reference = 92.0 - wing.areas.wetted = 2.0 * wing.areas.reference - wing.areas.exposed = 0.8 * wing.areas.wetted - wing.areas.affected = 0.6 * wing.areas.reference - - wing.twists.root = 2.0 * Units.degrees - wing.twists.tip = 0.0 * Units.degrees - - wing.origin = [13.2,0,0] # Need to fix - # wing.aerodynamic_center = [3,0,0] # Need to fix ---> MUST INCLUDE A SIZING CALL, TO GENERATE PLANFORM - + wing.spans.projected = 27.8 * Units.meter + wing.chords.root = 5.203 * Units.meter + wing.chords.tip = 1.460 * Units.meter + wing.chords.mean_aerodynamic = 3.680 * Units.meter + wing.areas.reference = 92.0 * Units['meters**2'] + wing.areas.wetted = 2.0 * wing.areas.reference + wing.areas.exposed = 0.8 * wing.areas.wetted + wing.areas.affected = 0.6 * wing.areas.reference + wing.twists.root = 2.0 * Units.degrees + wing.twists.tip = 0.0 * Units.degrees + wing.origin = [13.2,0,0] wing.vertical = False wing.symmetric = True - wing.high_lift = True wing.flaps.type = "double_slotted" - wing.flaps.chord = 0.280 - + wing.flaps.chord = 0.280 * Units.meter wing.dynamic_pressure_ratio = 1.0 # add to vehicle @@ -112,28 +102,20 @@ def base_setup(): wing.thickness_to_chord = 0.11 wing.taper = 0.11 wing.span_efficiency = 0.9 - - wing.spans.projected = 11.958 - - wing.chords.root = 3.030 - wing.chords.tip = 0.883 - wing.chords.mean_aerodynamic = 2.3840 - - wing.areas.reference = 26.0 - wing.areas.wetted = 2.0 * wing.areas.reference - wing.areas.exposed = 0.8 * wing.areas.wetted - wing.areas.affected = 0.6 * wing.areas.reference - + wing.spans.projected = 11.958 * Units.meter + wing.chords.root = 3.030 * Units.meter + wing.chords.tip = 0.883 * Units.meter + wing.chords.mean_aerodynamic = 2.3840 * Units.meter + wing.areas.reference = 26.0 * Units['meters**2'] + wing.areas.wetted = 2.0 * wing.areas.reference + wing.areas.exposed = 0.8 * wing.areas.wetted + wing.areas.affected = 0.6 * wing.areas.reference wing.twists.root = 2.0 * Units.degrees wing.twists.tip = 2.0 * Units.degrees - - wing.origin = [31.,0,0] # need to fix - # wing.aerodynamic_center = [3,0,0] # Need to fix ---> MUST INCLUDE A SIZING CALL, TO GENERATE PLANFORM - + wing.origin = [31.,0,0] wing.vertical = False wing.symmetric = True - - wing.dynamic_pressure_ratio = 0.9 + wing.dynamic_pressure_ratio = 0.9 # add to vehicle vehicle.append_component(wing) @@ -145,33 +127,25 @@ def base_setup(): wing = SUAVE.Components.Wings.Wing() wing.tag = 'vertical_stabilizer' - wing.aspect_ratio = 1.7 # + wing.aspect_ratio = 1.7 wing.sweeps.quarter_chord = 35 * Units.deg wing.thickness_to_chord = 0.11 wing.taper = 0.31 wing.span_efficiency = 0.9 - - wing.spans.projected = 5.270 # - - wing.chords.root = 4.70 - wing.chords.tip = 1.45 - wing.chords.mean_aerodynamic = 3.36 - - wing.areas.reference = 16.0 # - wing.areas.wetted = 2.0 * wing.areas.reference - wing.areas.exposed = 0.8 * wing.areas.wetted - wing.areas.affected = 0.6 * wing.areas.reference - - wing.twists.root = 0.0 * Units.degrees - wing.twists.tip = 0.0 * Units.degrees - + wing.spans.projected = 5.270 * Units.meter + wing.chords.root = 4.70 * Units.meter + wing.chords.tip = 1.45 * Units.meter + wing.chords.mean_aerodynamic = 3.36 * Units.meter + wing.areas.reference = 16.0 * Units['meters**2'] + wing.areas.wetted = 2.0 * wing.areas.reference + wing.areas.exposed = 0.8 * wing.areas.wetted + wing.areas.affected = 0.6 * wing.areas.reference + wing.twists.root = 0.0 * Units.degrees + wing.twists.tip = 0.0 * Units.degrees wing.origin = [29.5,0,0] - # wing.aerodynamic_center = [3,0,0] # Need to fix ---> MUST INCLUDE A SIZING CALL, TO GENERATE PLANFORM - wing.vertical = True wing.symmetric = False - - wing.dynamic_pressure_ratio = 1.0 + wing.dynamic_pressure_ratio = 1.0 # add to vehicle vehicle.append_component(wing) @@ -182,35 +156,28 @@ def base_setup(): fuselage = SUAVE.Components.Fuselages.Fuselage() fuselage.tag = 'fuselage' - fuselage.origin=[0,0,0] fuselage.number_coach_seats = vehicle.passengers fuselage.seats_abreast = 4 fuselage.seat_pitch = 0.7455 - fuselage.fineness.nose = 2.0 fuselage.fineness.tail = 3.0 - - fuselage.lengths.nose = 6.0 - fuselage.lengths.tail = 9.0 - fuselage.lengths.cabin = 21.24 - fuselage.lengths.total = 36.24 - fuselage.lengths.fore_space = 0. - fuselage.lengths.aft_space = 0. - - fuselage.width = 3.18 - - fuselage.heights.maximum = 3.50 - fuselage.heights.at_quarter_length = 3.35 - fuselage.heights.at_three_quarters_length = 3.35 - fuselage.heights.at_wing_root_quarter_chord = 3.50 - - fuselage.areas.side_projected = 239.20 - fuselage.areas.wetted = 327.01 - fuselage.areas.front_projected = 8.0110 - + fuselage.lengths.nose = 6.0 * Units.meter + fuselage.lengths.tail = 9.0 * Units.meter + fuselage.lengths.cabin = 21.24 * Units.meter + fuselage.lengths.total = 36.24 * Units.meter + fuselage.lengths.fore_space = 0. * Units.meter + fuselage.lengths.aft_space = 0. * Units.meter + fuselage.width = 3.18 * Units.meter + fuselage.heights.maximum = 3.50 * Units.meter + fuselage.areas.side_projected = 239.20 * Units['meters**2'] + fuselage.areas.wetted = 327.01 * Units['meters**2'] + fuselage.areas.front_projected = 8.0110 * Units['meters**2'] fuselage.effective_diameter = 3.18 - - fuselage.differential_pressure = 10**5 * Units.pascal # Maximum differential pressure + fuselage.differential_pressure = 10**5 * Units.pascal + + fuselage.heights.at_quarter_length = 3.35 * Units.meter + fuselage.heights.at_three_quarters_length = 3.35 * Units.meter + fuselage.heights.at_wing_root_quarter_chord = 3.50 * Units.meter # add to vehicle vehicle.append_component(fuselage) @@ -219,7 +186,6 @@ def base_setup(): # Turbofan Network # ------------------------------------------------------------------ - #initialize the gas turbine network gt_engine = SUAVE.Components.Energy.Networks.Turbofan() gt_engine.tag = 'turbofan' @@ -230,10 +196,7 @@ def base_setup(): gt_engine.nacelle_diameter = 2.05 #set the working fluid for the network - working_fluid = SUAVE.Attributes.Gases.Air - - #add working fluid to the network - gt_engine.working_fluid = working_fluid + gt_engine.working_fluid = SUAVE.Attributes.Gases.Air #Component 1 : ram, to convert freestream static to stagnation quantities @@ -243,18 +206,16 @@ def base_setup(): #add ram to the network gt_engine.ram = ram - #Component 2 : inlet nozzle inlet_nozzle = SUAVE.Components.Energy.Converters.Compression_Nozzle() inlet_nozzle.tag = 'inlet nozzle' inlet_nozzle.polytropic_efficiency = 0.98 - inlet_nozzle.pressure_ratio = 0.98 # turbofan.fan_nozzle_pressure_ratio = 0.98 #0.98 + inlet_nozzle.pressure_ratio = 0.98 #add inlet nozzle to the network gt_engine.inlet_nozzle = inlet_nozzle - #Component 3 :low pressure compressor low_pressure_compressor = SUAVE.Components.Energy.Converters.Compressor() low_pressure_compressor.tag = 'lpc' @@ -265,9 +226,7 @@ def base_setup(): #add low pressure compressor to the network gt_engine.low_pressure_compressor = low_pressure_compressor - - - #Component 4 :high pressure compressor + #Component 4: high pressure compressor high_pressure_compressor = SUAVE.Components.Energy.Converters.Compressor() high_pressure_compressor.tag = 'hpc' @@ -277,7 +236,6 @@ def base_setup(): #add the high pressure compressor to the network gt_engine.high_pressure_compressor = high_pressure_compressor - #Component 5 :low pressure turbine low_pressure_turbine = SUAVE.Components.Energy.Converters.Turbine() low_pressure_turbine.tag='lpt' @@ -288,8 +246,6 @@ def base_setup(): #add low pressure turbine to the network gt_engine.low_pressure_turbine = low_pressure_turbine - - #Component 5 :high pressure turbine high_pressure_turbine = SUAVE.Components.Energy.Converters.Turbine() high_pressure_turbine.tag='hpt' @@ -300,7 +256,6 @@ def base_setup(): #add the high pressure turbine to the network gt_engine.high_pressure_turbine = high_pressure_turbine - #Component 6 :combustor combustor = SUAVE.Components.Energy.Converters.Combustor() combustor.tag = 'Comb' @@ -314,8 +269,6 @@ def base_setup(): #add the combustor to the network gt_engine.combustor = combustor - - #Component 7 :core nozzle core_nozzle = SUAVE.Components.Energy.Converters.Expansion_Nozzle() core_nozzle.tag = 'core nozzle' @@ -326,7 +279,6 @@ def base_setup(): #add the core nozzle to the network gt_engine.core_nozzle = core_nozzle - #Component 8 :fan nozzle fan_nozzle = SUAVE.Components.Energy.Converters.Expansion_Nozzle() fan_nozzle.tag = 'fan nozzle' @@ -337,8 +289,6 @@ def base_setup(): #add the fan nozzle to the network gt_engine.fan_nozzle = fan_nozzle - - #Component 9 : fan fan = SUAVE.Components.Energy.Converters.Fan() fan.tag = 'fan' @@ -371,43 +321,19 @@ def base_setup(): vehicle.append_component(gt_engine) #now add weights objects - landing_gear=SUAVE.Components.Landing_Gear.Landing_Gear() - vehicle.landing_gear=landing_gear - - - control_systems=SUAVE.Components.Physical_Component() - vehicle.control_systems=control_systems - - electrical_systems=SUAVE.Components.Physical_Component() - vehicle.electrical_systems=electrical_systems - - avionics=SUAVE.Components.Energy.Peripherals.Avionics() - vehicle.avionics=avionics - - passengers=SUAVE.Components.Physical_Component() - vehicle.passenger_weights=passengers - - furnishings=SUAVE.Components.Physical_Component() - vehicle.furnishings=furnishings - - air_conditioner=SUAVE.Components.Physical_Component() - vehicle.air_conditioner=air_conditioner - - - fuel=SUAVE.Components.Physical_Component() - vehicle.fuel=fuel - - apu=SUAVE.Components.Physical_Component() - vehicle.apu=apu - - hydraulics=SUAVE.Components.Physical_Component() - vehicle.hydraulics=hydraulics - - optionals=SUAVE.Components.Physical_Component() - vehicle.optionals=optionals - - rudder=SUAVE.Components.Physical_Component() - vehicle.wings['vertical_stabilizer'].rudder=rudder + vehicle.landing_gear = SUAVE.Components.Landing_Gear.Landing_Gear() + vehicle.control_systems = SUAVE.Components.Physical_Component() + vehicle.electrical_systems = SUAVE.Components.Physical_Component() + vehicle.avionics = SUAVE.Components.Energy.Peripherals.Avionics() + vehicle.passenger_weights = SUAVE.Components.Physical_Component() + vehicle.furnishings = SUAVE.Components.Physical_Component() + vehicle.air_conditioner = SUAVE.Components.Physical_Component() + vehicle.fuel = SUAVE.Components.Physical_Component() + vehicle.apu = SUAVE.Components.Physical_Component() + vehicle.hydraulics = SUAVE.Components.Physical_Component() + vehicle.optionals = SUAVE.Components.Physical_Component() + + vehicle.wings['vertical_stabilizer'].rudder = SUAVE.Components.Physical_Component() # ------------------------------------------------------------------ # Vehicle Definition Complete @@ -415,9 +341,6 @@ def base_setup(): return vehicle - - - # ---------------------------------------------------------------------- # Define the Configurations # --------------------------------------------------------------------- @@ -461,7 +384,6 @@ def configs_setup(vehicle): configs.append(config) - # ------------------------------------------------------------------ # Landing Configuration # ------------------------------------------------------------------ @@ -490,9 +412,6 @@ def configs_setup(vehicle): config.V2_VS_ratio = 1.21 config.maximum_lift_coefficient = 2. - # payload? - configs.append(config) - # done! return configs From b3be1a6cf8cc9b523b9fe1d1912a52dcc9964fbf Mon Sep 17 00:00:00 2001 From: Emilio Botero Date: Mon, 14 Aug 2017 16:43:48 -0700 Subject: [PATCH 13/19] solar uav op clean up --- Solar_UAV_Optimization/Vehicles.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/Solar_UAV_Optimization/Vehicles.py b/Solar_UAV_Optimization/Vehicles.py index 542a615..d558bbb 100644 --- a/Solar_UAV_Optimization/Vehicles.py +++ b/Solar_UAV_Optimization/Vehicles.py @@ -46,7 +46,7 @@ def base_setup(): vehicle.reference_area = 1.0 vehicle.envelope.ultimate_load = 2.0 vehicle.envelope.limit_load = 1.5 - vehicle.envelope.maximum_dynamic_pressure = 115.*1.25 #Max q + vehicle.envelope.maximum_dynamic_pressure = 115.*1.25 * Units.pascals #Max q # ------------------------------------------------------------------ # Main Wing @@ -56,7 +56,7 @@ def base_setup(): wing.tag = 'main_wing' wing.areas.reference = vehicle.reference_area - wing.spans.projected = 40.0 + wing.spans.projected = 40.0 * Units.meters wing.aspect_ratio = (wing.spans.projected**2)/wing.areas.reference wing.sweeps.quarter_chord = 0.0 * Units.deg wing.symmetric = True @@ -77,7 +77,6 @@ def base_setup(): wing.transition_x_upper = 0.6 wing.transition_x_lower = 1.0 wing.origin = [3.0,0.0,0.0] - wing.aerodynamic_center = [3.0,0.0,0.0] # add to vehicle vehicle.append_component(wing) @@ -110,7 +109,6 @@ def base_setup(): wing.chords.tip = wing.areas.reference/wing.spans.projected wing.chords.mean_aerodynamic = wing.areas.reference/wing.spans.projected wing.origin = [10.,0.0,0.0] - wing.aerodynamic_center = [0.5,0.0,0.0] # add to vehicle vehicle.append_component(wing) @@ -132,15 +130,13 @@ def base_setup(): wing.chords.root = wing.areas.reference/wing.spans.projected wing.chords.tip = wing.areas.reference/wing.spans.projected - wing.chords.mean_aerodynamic = wing.areas.reference/wing.spans.projected - + wing.chords.mean_aerodynamic = wing.areas.reference/wing.spans.projected wing.areas.wetted = 2.0 * wing.areas.reference wing.areas.exposed = 0.8 * wing.areas.wetted wing.areas.affected = 0.6 * wing.areas.wetted wing.twists.root = 0.0 * Units.degrees wing.twists.tip = 0.0 * Units.degrees - wing.origin = [10.,0.0,0.0] - wing.aerodynamic_center = [0.5,0.0,0.0] + wing.origin = [10.,0.0,0.0] wing.symmetric = True wing.vertical = True wing.t_tail = False From 6ea06002b43d5efabec2b91965fcccabb29e96ba Mon Sep 17 00:00:00 2001 From: Emilio Botero Date: Mon, 14 Aug 2017 17:22:36 -0700 Subject: [PATCH 14/19] minor spacing fix on b737 --- tut_mission_B737.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tut_mission_B737.py b/tut_mission_B737.py index aaf1067..7f3fe72 100644 --- a/tut_mission_B737.py +++ b/tut_mission_B737.py @@ -528,7 +528,7 @@ def vehicle_setup(): def configs_setup(vehicle): - # ------------------------------------------------------------------ + # ------------------------------------------------------------------ # Initialize Configurations # ------------------------------------------------------------------ configs = SUAVE.Components.Configs.Config.Container() From 35688c972e54282a39cf8d933dc56509bf8485f1 Mon Sep 17 00:00:00 2001 From: Tim MacDonald Date: Mon, 14 Aug 2017 19:54:35 -0700 Subject: [PATCH 15/19] updates to regional jet opt script --- Regional_Jet_Optimization/Analyses.py | 3 ++ Regional_Jet_Optimization/Missions.py | 2 +- Regional_Jet_Optimization/Optimize.py | 58 ++++++++++------------- Regional_Jet_Optimization/Plot_Mission.py | 4 +- Regional_Jet_Optimization/Vehicles.py | 11 +++++ Solar_UAV_Optimization/Vehicles.py | 1 - 6 files changed, 42 insertions(+), 37 deletions(-) diff --git a/Regional_Jet_Optimization/Analyses.py b/Regional_Jet_Optimization/Analyses.py index 9c5c510..0e0fa9b 100644 --- a/Regional_Jet_Optimization/Analyses.py +++ b/Regional_Jet_Optimization/Analyses.py @@ -20,8 +20,11 @@ def setup(configs): # build a base analysis for each config for tag,config in configs.items(): analysis = base(config) + if tag == 'cruise_spoilers': + analysis.aerodynamics.settings.spoiler_drag_increment = 0.005 analyses[tag] = analysis + return analyses # ---------------------------------------------------------------------- diff --git a/Regional_Jet_Optimization/Missions.py b/Regional_Jet_Optimization/Missions.py index cf16070..c49e5c0 100644 --- a/Regional_Jet_Optimization/Missions.py +++ b/Regional_Jet_Optimization/Missions.py @@ -210,7 +210,7 @@ def base(analyses): segment.tag = "descent_2" # connect vehicle configuration - segment.analyses.extend( analyses.cruise ) + segment.analyses.extend( analyses.cruise_spoilers ) # segment attributes segment.atmosphere = atmosphere diff --git a/Regional_Jet_Optimization/Optimize.py b/Regional_Jet_Optimization/Optimize.py index db5d13a..4607c82 100644 --- a/Regional_Jet_Optimization/Optimize.py +++ b/Regional_Jet_Optimization/Optimize.py @@ -23,25 +23,27 @@ # ---------------------------------------------------------------------- def main(): problem = setup() - output = problem.objective() - #uncomment these lines when you want to start an optimization problem from a different initial guess - ''' - inputs = [1.28, 1.38] - scaling = problem.optimization_problem.inputs[:,3] #have to rescale inputs to start problem from here - scaled_inputs = np.multiply(inputs,scaling) - problem.optimization_problem.inputs[:,1] = scaled_inputs - ''' - - #optimize + + ## Base Input Values + #output = problem.objective() + + ## Uncomment to view contours of the design space + #variable_sweep(problem) + + ## Uncomment for the first optimization #output = scipy_setup.SciPy_Solve(problem,solver='SLSQP') - #print output - + #print output - #variable_sweep(problem) #uncomment this to view some contours of the problem + ## Uncomment these lines when you want to start an optimization problem from a different initial guess + #inputs = [1.28, 1.38] + #scaling = problem.optimization_problem.inputs[:,3] #have to rescale inputs to start problem from here + #scaled_inputs = np.multiply(inputs,scaling) + #problem.optimization_problem.inputs[:,1] = scaled_inputs + print 'fuel burn = ', problem.summary.base_mission_fuelburn print 'fuel margin = ', problem.all_constraints() - #Plot_Mission.plot_mission(problem) + Plot_Mission.plot_mission(problem) return @@ -126,34 +128,24 @@ def setup(): return nexus def variable_sweep(problem): - number_of_points = 5 - outputs=carpet_plot(problem, number_of_points, 0, 0) #run carpet plot, suppressing default plots - inputs =outputs.inputs - objective=outputs.objective - constraints=outputs.constraint_val + number_of_points = 20 + outputs = carpet_plot(problem, number_of_points, 0, 0) #run carpet plot, suppressing default plots + inputs = outputs.inputs + objective = outputs.objective + constraints = outputs.constraint_val plt.figure(0) - CS = plt.contourf(inputs[0,:],inputs[1,:], objective, 20, linewidths=2) + CS = plt.contourf(inputs[0,:],inputs[1,:], objective, 20, linewidths=2) cbar = plt.colorbar(CS) cbar.ax.set_ylabel('fuel burn (kg)') - CS_const=plt.contour(inputs[0,:],inputs[1,:], constraints[0,:,:]) + CS_const = plt.contour(inputs[0,:],inputs[1,:], constraints[0,:,:]) plt.clabel(CS_const, inline=1, fontsize=10) cbar = plt.colorbar(CS_const) cbar.ax.set_ylabel('fuel margin') - plt.xlabel('wing area (m^2)') - plt.ylabel('cruise_altitude (km)') - - #now plot optimization path (note that these data points were post-processed into a plottable format) - ''' - opt_1 = plt.plot(wing_1, alt_1, label='optimization path 1') - init_1 = plt.plot(wing_1[0], alt_1[0], 'ko') - final_1 = plt.plot(wing_1[-1], alt_1[-1], 'kx') + plt.xlabel('Wing Area (m^2)') + plt.ylabel('Cruise Altitude (km)') - opt_2 = plt.plot(wing_2, alt_2, 'k--', label='optimization path 2') - init_2 = plt.plot(wing_2[0], alt_2[0], 'ko', label= 'initial points') - final_2 = plt.plot(wing_2[-1], alt_2[-1], 'kx', label= 'final points') - ''' plt.legend(loc='upper left') plt.show(block=True) diff --git a/Regional_Jet_Optimization/Plot_Mission.py b/Regional_Jet_Optimization/Plot_Mission.py index 095d7f0..3f3e15e 100644 --- a/Regional_Jet_Optimization/Plot_Mission.py +++ b/Regional_Jet_Optimization/Plot_Mission.py @@ -17,7 +17,7 @@ # ---------------------------------------------------------------------- def plot_mission(nexus,line_style='bo-'): - results=nexus.results + results = nexus.results.base axis_font = {'fontname':'Arial', 'size':'14'} @@ -54,7 +54,7 @@ def plot_mission(nexus,line_style='bo-'): # ------------------------------------------------------------------ fig = plt.figure("Drag Components",figsize=(8,10)) axes = plt.gca() - for i, segment in enumerate(results.base.segments.values()): + for i, segment in enumerate(results.segments.values()): time = segment.conditions.frames.inertial.time[:,0] / Units.min drag_breakdown = segment.conditions.aerodynamics.drag_breakdown diff --git a/Regional_Jet_Optimization/Vehicles.py b/Regional_Jet_Optimization/Vehicles.py index 10f8118..0edb837 100644 --- a/Regional_Jet_Optimization/Vehicles.py +++ b/Regional_Jet_Optimization/Vehicles.py @@ -367,6 +367,17 @@ def configs_setup(vehicle): configs.append(config) config.maximum_lift_coefficient = 1.2 + + # ------------------------------------------------------------------ + # Cruise with Spoilers Configuration + # ------------------------------------------------------------------ + + config = SUAVE.Components.Configs.Config(base_config) + config.tag = 'cruise_spoilers' + + configs.append(config) + + config.maximum_lift_coefficient = 1.2 # ------------------------------------------------------------------ diff --git a/Solar_UAV_Optimization/Vehicles.py b/Solar_UAV_Optimization/Vehicles.py index d558bbb..32364a9 100644 --- a/Solar_UAV_Optimization/Vehicles.py +++ b/Solar_UAV_Optimization/Vehicles.py @@ -71,7 +71,6 @@ def base_setup(): wing.twists.tip = 0.0 * Units.degrees wing.highlift = False wing.vertical = False - wing.eta = 1.0 wing.number_ribs = 26. wing.number_end_ribs = 2. wing.transition_x_upper = 0.6 From 37222782076e5f1be8759018d576140be97df68f Mon Sep 17 00:00:00 2001 From: Tim MacDonald Date: Mon, 14 Aug 2017 19:58:18 -0700 Subject: [PATCH 16/19] reset number of points to 5 --- Regional_Jet_Optimization/Optimize.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Regional_Jet_Optimization/Optimize.py b/Regional_Jet_Optimization/Optimize.py index 4607c82..893fe72 100644 --- a/Regional_Jet_Optimization/Optimize.py +++ b/Regional_Jet_Optimization/Optimize.py @@ -1,6 +1,7 @@ # Optimize.py # Created: Feb 2016, M. Vegh # Modified: Aug 2017, E. Botero +# Aug 2018, T. MacDonald # ---------------------------------------------------------------------- # Imports @@ -128,7 +129,7 @@ def setup(): return nexus def variable_sweep(problem): - number_of_points = 20 + number_of_points = 5 outputs = carpet_plot(problem, number_of_points, 0, 0) #run carpet plot, suppressing default plots inputs = outputs.inputs objective = outputs.objective From 8b95ad7ada127f094d90b6c2400e4964a1665d3b Mon Sep 17 00:00:00 2001 From: Tim MacDonald Date: Mon, 14 Aug 2017 20:12:29 -0700 Subject: [PATCH 17/19] more regional jet cleaning --- Regional_Jet_Optimization/Analyses.py | 1 + Regional_Jet_Optimization/Optimize.py | 4 +- Regional_Jet_Optimization/Procedure.py | 97 +++++++++----------------- Regional_Jet_Optimization/Vehicles.py | 4 +- 4 files changed, 38 insertions(+), 68 deletions(-) diff --git a/Regional_Jet_Optimization/Analyses.py b/Regional_Jet_Optimization/Analyses.py index 0e0fa9b..f18b449 100644 --- a/Regional_Jet_Optimization/Analyses.py +++ b/Regional_Jet_Optimization/Analyses.py @@ -21,6 +21,7 @@ def setup(configs): for tag,config in configs.items(): analysis = base(config) if tag == 'cruise_spoilers': + # this is done since drag is not sufficient for the desired profile analysis.aerodynamics.settings.spoiler_drag_increment = 0.005 analyses[tag] = analysis diff --git a/Regional_Jet_Optimization/Optimize.py b/Regional_Jet_Optimization/Optimize.py index 893fe72..f3eebbd 100644 --- a/Regional_Jet_Optimization/Optimize.py +++ b/Regional_Jet_Optimization/Optimize.py @@ -26,7 +26,7 @@ def main(): problem = setup() ## Base Input Values - #output = problem.objective() + output = problem.objective() ## Uncomment to view contours of the design space #variable_sweep(problem) @@ -40,6 +40,8 @@ def main(): #scaling = problem.optimization_problem.inputs[:,3] #have to rescale inputs to start problem from here #scaled_inputs = np.multiply(inputs,scaling) #problem.optimization_problem.inputs[:,1] = scaled_inputs + #output = scipy_setup.SciPy_Solve(problem,solver='SLSQP') + #print output print 'fuel burn = ', problem.summary.base_mission_fuelburn print 'fuel margin = ', problem.all_constraints() diff --git a/Regional_Jet_Optimization/Procedure.py b/Regional_Jet_Optimization/Procedure.py index 93dda53..f32cc18 100644 --- a/Regional_Jet_Optimization/Procedure.py +++ b/Regional_Jet_Optimization/Procedure.py @@ -53,30 +53,30 @@ def setup(): def find_target_range(nexus,mission): - segments=mission.segments - cruise_altitude=mission.segments['climb_5'].altitude_end - climb_1=segments['climb_1'] - climb_2=segments['climb_2'] - climb_3=segments['climb_3'] - climb_4=segments['climb_4'] - climb_5=segments['climb_5'] + segments = mission.segments + cruise_altitude = mission.segments['climb_5'].altitude_end + climb_1 = segments['climb_1'] + climb_2 = segments['climb_2'] + climb_3 = segments['climb_3'] + climb_4 = segments['climb_4'] + climb_5 = segments['climb_5'] - descent_1=segments['descent_1'] - descent_2=segments['descent_2'] - descent_3=segments['descent_3'] + descent_1 = segments['descent_1'] + descent_2 = segments['descent_2'] + descent_3 = segments['descent_3'] - x_climb_1=climb_1.altitude_end/np.tan(np.arcsin(climb_1.climb_rate/climb_1.air_speed)) - x_climb_2=(climb_2.altitude_end-climb_1.altitude_end)/np.tan(np.arcsin(climb_2.climb_rate/climb_2.air_speed)) - x_climb_3=(climb_3.altitude_end-climb_2.altitude_end)/np.tan(np.arcsin(climb_3.climb_rate/climb_3.air_speed)) - x_climb_4=(climb_4.altitude_end-climb_3.altitude_end)/np.tan(np.arcsin(climb_4.climb_rate/climb_4.air_speed)) - x_climb_5=(climb_5.altitude_end-climb_4.altitude_end)/np.tan(np.arcsin(climb_5.climb_rate/climb_5.air_speed)) - x_descent_1=(climb_5.altitude_end-descent_1.altitude_end)/np.tan(np.arcsin(descent_1.descent_rate/descent_1.air_speed)) - x_descent_2=(descent_1.altitude_end-descent_2.altitude_end)/np.tan(np.arcsin(descent_2.descent_rate/descent_2.air_speed)) - x_descent_3=(descent_2.altitude_end-descent_3.altitude_end)/np.tan(np.arcsin(descent_3.descent_rate/descent_3.air_speed)) - - cruise_range=mission.design_range-(x_climb_1+x_climb_2+x_climb_3+x_climb_4+x_climb_5+x_descent_1+x_descent_2+x_descent_3) + x_climb_1 = climb_1.altitude_end/np.tan(np.arcsin(climb_1.climb_rate/climb_1.air_speed)) + x_climb_2 = (climb_2.altitude_end-climb_1.altitude_end)/np.tan(np.arcsin(climb_2.climb_rate/climb_2.air_speed)) + x_climb_3 = (climb_3.altitude_end-climb_2.altitude_end)/np.tan(np.arcsin(climb_3.climb_rate/climb_3.air_speed)) + x_climb_4 = (climb_4.altitude_end-climb_3.altitude_end)/np.tan(np.arcsin(climb_4.climb_rate/climb_4.air_speed)) + x_climb_5 = (climb_5.altitude_end-climb_4.altitude_end)/np.tan(np.arcsin(climb_5.climb_rate/climb_5.air_speed)) + x_descent_1 = (climb_5.altitude_end-descent_1.altitude_end)/np.tan(np.arcsin(descent_1.descent_rate/descent_1.air_speed)) + x_descent_2 = (descent_1.altitude_end-descent_2.altitude_end)/np.tan(np.arcsin(descent_2.descent_rate/descent_2.air_speed)) + x_descent_3 = (descent_2.altitude_end-descent_3.altitude_end)/np.tan(np.arcsin(descent_3.descent_rate/descent_3.air_speed)) + + cruise_range = mission.design_range-(x_climb_1+x_climb_2+x_climb_3+x_climb_4+x_climb_5+x_descent_1+x_descent_2+x_descent_3) - segments['cruise'].distance=cruise_range + segments['cruise'].distance = cruise_range return nexus @@ -151,9 +151,9 @@ def simple_sizing(nexus): landing.mass_properties.landing = 0.85 * config.mass_properties.takeoff # Landing CL_max - altitude = nexus.missions.base.segments[-1].altitude_end + altitude = nexus.missions.base.segments[-1].altitude_end atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976() - freestream_landing = atmosphere.compute_values(0.) + freestream_landing = atmosphere.compute_values(0.) landing_conditions.freestream.velocity = nexus.missions.base.segments['descent_3'].air_speed landing_conditions.freestream.density = freestream_landing.density landing_conditions.freestream.dynamic_viscosity = freestream_landing.dynamic_viscosity @@ -165,19 +165,19 @@ def simple_sizing(nexus): takeoff_conditions = Data() takeoff_conditions.freestream = Data() altitude = nexus.missions.base.airport.altitude - freestream_takeoff = atmosphere.compute_values(altitude) + freestream_takeoff = atmosphere.compute_values(altitude) takeoff_conditions.freestream.velocity = nexus.missions.base.segments.climb_1.air_speed takeoff_conditions.freestream.density = freestream_takeoff.density takeoff_conditions.freestream.dynamic_viscosity = freestream_takeoff.dynamic_viscosity - max_CL_takeoff,CDi = compute_max_lift_coeff(takeoff,takeoff_conditions) + max_CL_takeoff, CDi = compute_max_lift_coeff(takeoff,takeoff_conditions) takeoff.maximum_lift_coefficient = max_CL_takeoff #Base config CL_max base = nexus.vehicle_configurations.base base_conditions = Data() base_conditions.freestream = takeoff_conditions.freestream - max_CL_base,CDi = compute_max_lift_coeff(base,base_conditions) + max_CL_base, CDi = compute_max_lift_coeff(base,base_conditions) base.maximum_lift_coefficient = max_CL_base return nexus @@ -191,21 +191,14 @@ def weight(nexus): # weight analysis weights = nexus.analyses.base.weights.evaluate() - - ''' - compute_component_centers_of_gravity(vehicle) - nose_load_fraction=.06 - compute_aircraft_center_of_gravity(vehicle,nose_load_fraction) - ''' - weights = nexus.analyses.cruise.weights.evaluate() vehicle.mass_properties.breakdown = weights weights = nexus.analyses.landing.weights.evaluate() weights = nexus.analyses.takeoff.weights.evaluate() weights = nexus.analyses.short_field_takeoff.weights.evaluate() - empty_weight =vehicle.mass_properties.operating_empty - passenger_weight=vehicle.passenger_weights.mass_properties.mass + empty_weight = vehicle.mass_properties.operating_empty + passenger_weight = vehicle.passenger_weights.mass_properties.mass for config in nexus.vehicle_configurations: config.mass_properties.zero_fuel_center_of_gravity = vehicle.mass_properties.zero_fuel_center_of_gravity config.fuel = vehicle.fuel @@ -230,12 +223,6 @@ def post_process(nexus): # Unpack data vehicle = nexus.vehicle_configurations.base - - ''' - print 'base.mass_properties.takeoff = ', vehicle.mass_properties.takeoff - print 'takeoff.mass_properties.takeoff = ', nexus.vehicle_configurations.takeoff.mass_properties.takeoff - print 'vehicle.mass_properties.empty = ', vehicle.mass_properties.operating_empty - ''' results = nexus.results summary = nexus.summary missions = nexus.missions @@ -243,14 +230,14 @@ def post_process(nexus): # Static stability calculations CMA = -10. for segment in results.base.segments.values(): - max_CMA=np.max(segment.conditions.stability.static.cm_alpha[:,0]) - if max_CMA>CMA: - CMA=max_CMA + max_CMA = np.max(segment.conditions.stability.static.cm_alpha[:,0]) + if max_CMA > CMA: + CMA = max_CMA summary.static_stability = CMA #throttle in design mission - max_throttle=0 + max_throttle = 0 for segment in results.base.segments.values(): max_segment_throttle = np.max(segment.conditions.propulsion.throttle[:,0]) if max_segment_throttle > max_throttle: @@ -272,25 +259,5 @@ def post_process(nexus): #when you run want to output results to a file filename = 'results.txt' write_optimization_outputs(nexus, filename) - ''' - unscaled_inputs = nexus.optimization_problem.inputs[:,1] #use optimization problem inputs here - input_scaling = nexus.optimization_problem.inputs[:,3] - scaled_inputs = unscaled_inputs/input_scaling - problem_inputs=[] - - for value in unscaled_inputs: - problem_inputs.append(value) - file=open('results.txt' , 'ab') - file.write('iteration = ') - file.write(str(nexus.iteration_number)) - file.write('fuel weight = ') - file.write(str( summary.base_mission_fuelburn)) - - file.write(', inputs = ') - file.write(str(problem_inputs)) - - file.write('\n') - file.close() - ''' return nexus diff --git a/Regional_Jet_Optimization/Vehicles.py b/Regional_Jet_Optimization/Vehicles.py index 0edb837..e90c49f 100644 --- a/Regional_Jet_Optimization/Vehicles.py +++ b/Regional_Jet_Optimization/Vehicles.py @@ -44,8 +44,8 @@ def base_setup(): vehicle.mass_properties.max_payload = 13063. * Units.kg vehicle.mass_properties.max_fuel = 12971. * Units.kg - vehicle.mass_properties.center_of_gravity = [18. , 0, 0] - vehicle.mass_properties.moments_of_inertia.tensor = [[10 ** 5, 0, 0],[0, 10 ** 6, 0,],[0,0, 10 ** 7]] # Not Correct + vehicle.mass_properties.center_of_gravity = [18., 0, 0] + #vehicle.mass_properties.moments_of_inertia.tensor = [[10 ** 5, 0, 0],[0, 10 ** 6, 0,],[0,0, 10 ** 7]] # Not Correct # envelope properties vehicle.envelope.ultimate_load = 3.5 From a2614394ea02fe96f66e82c422b15c1724a4b899 Mon Sep 17 00:00:00 2001 From: Tim MacDonald Date: Mon, 14 Aug 2017 20:15:04 -0700 Subject: [PATCH 18/19] regional jet updates --- Regional_Jet_Optimization/Analyses.py | 2 ++ Regional_Jet_Optimization/Missions.py | 2 +- Regional_Jet_Optimization/Optimize.py | 10 ++++------ Regional_Jet_Optimization/Plot_Mission.py | 4 ++-- Regional_Jet_Optimization/Vehicles.py | 12 ++++++++++++ 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/Regional_Jet_Optimization/Analyses.py b/Regional_Jet_Optimization/Analyses.py index 9c5c510..87e3ac2 100644 --- a/Regional_Jet_Optimization/Analyses.py +++ b/Regional_Jet_Optimization/Analyses.py @@ -20,6 +20,8 @@ def setup(configs): # build a base analysis for each config for tag,config in configs.items(): analysis = base(config) + if tag == 'cruise_spoilers': + analysis.aerodynamics.settings.spoiler_drag_increment = 0.005 analyses[tag] = analysis return analyses diff --git a/Regional_Jet_Optimization/Missions.py b/Regional_Jet_Optimization/Missions.py index cf16070..c49e5c0 100644 --- a/Regional_Jet_Optimization/Missions.py +++ b/Regional_Jet_Optimization/Missions.py @@ -210,7 +210,7 @@ def base(analyses): segment.tag = "descent_2" # connect vehicle configuration - segment.analyses.extend( analyses.cruise ) + segment.analyses.extend( analyses.cruise_spoilers ) # segment attributes segment.atmosphere = atmosphere diff --git a/Regional_Jet_Optimization/Optimize.py b/Regional_Jet_Optimization/Optimize.py index db5d13a..84264fa 100644 --- a/Regional_Jet_Optimization/Optimize.py +++ b/Regional_Jet_Optimization/Optimize.py @@ -23,25 +23,23 @@ # ---------------------------------------------------------------------- def main(): problem = setup() - output = problem.objective() + #output = problem.objective() #uncomment these lines when you want to start an optimization problem from a different initial guess - ''' inputs = [1.28, 1.38] scaling = problem.optimization_problem.inputs[:,3] #have to rescale inputs to start problem from here scaled_inputs = np.multiply(inputs,scaling) problem.optimization_problem.inputs[:,1] = scaled_inputs - ''' #optimize - #output = scipy_setup.SciPy_Solve(problem,solver='SLSQP') - #print output + output = scipy_setup.SciPy_Solve(problem,solver='SLSQP') + print output #variable_sweep(problem) #uncomment this to view some contours of the problem print 'fuel burn = ', problem.summary.base_mission_fuelburn print 'fuel margin = ', problem.all_constraints() - #Plot_Mission.plot_mission(problem) + Plot_Mission.plot_mission(problem) return diff --git a/Regional_Jet_Optimization/Plot_Mission.py b/Regional_Jet_Optimization/Plot_Mission.py index 095d7f0..1bb8a91 100644 --- a/Regional_Jet_Optimization/Plot_Mission.py +++ b/Regional_Jet_Optimization/Plot_Mission.py @@ -17,7 +17,7 @@ # ---------------------------------------------------------------------- def plot_mission(nexus,line_style='bo-'): - results=nexus.results + results=nexus.results.base axis_font = {'fontname':'Arial', 'size':'14'} @@ -54,7 +54,7 @@ def plot_mission(nexus,line_style='bo-'): # ------------------------------------------------------------------ fig = plt.figure("Drag Components",figsize=(8,10)) axes = plt.gca() - for i, segment in enumerate(results.base.segments.values()): + for i, segment in enumerate(results.segments.values()): time = segment.conditions.frames.inertial.time[:,0] / Units.min drag_breakdown = segment.conditions.aerodynamics.drag_breakdown diff --git a/Regional_Jet_Optimization/Vehicles.py b/Regional_Jet_Optimization/Vehicles.py index 10f8118..e4dc5a4 100644 --- a/Regional_Jet_Optimization/Vehicles.py +++ b/Regional_Jet_Optimization/Vehicles.py @@ -367,6 +367,18 @@ def configs_setup(vehicle): configs.append(config) config.maximum_lift_coefficient = 1.2 + + + # ------------------------------------------------------------------ + # Cruise with Spoilers Configuration + # ------------------------------------------------------------------ + + config = SUAVE.Components.Configs.Config(base_config) + config.tag = 'cruise_spoilers' + + configs.append(config) + + config.maximum_lift_coefficient = 1.2 # ------------------------------------------------------------------ From e490bc67ce61043211fd458b9f786165a20b1091 Mon Sep 17 00:00:00 2001 From: Tim MacDonald Date: Mon, 14 Aug 2017 22:40:05 -0700 Subject: [PATCH 19/19] removed BWB --- BWB_CFD/BWB.py | 908 ------------------------------------------ BWB_CFD/base_data.txt | 13 - 2 files changed, 921 deletions(-) delete mode 100644 BWB_CFD/BWB.py delete mode 100644 BWB_CFD/base_data.txt diff --git a/BWB_CFD/BWB.py b/BWB_CFD/BWB.py deleted file mode 100644 index ca37dbb..0000000 --- a/BWB_CFD/BWB.py +++ /dev/null @@ -1,908 +0,0 @@ -# BWB.py -# -# Created: Jan 2017, E. Botero -# Modified: Aug 2017, E. Botero - -# ---------------------------------------------------------------------- -# Imports -# ---------------------------------------------------------------------- - -import SUAVE - -import numpy as np -import pylab as plt - -from SUAVE.Core import Data, Units - -from SUAVE.Input_Output.OpenVSP import write -from SUAVE.Input_Output.OpenVSP.get_vsp_areas import get_vsp_areas - -from SUAVE.Methods.Propulsion.turbofan_sizing import turbofan_sizing -from SUAVE.Methods.Geometry.Two_Dimensional.Cross_Section.Propulsion import compute_turbofan_geometry - -# ---------------------------------------------------------------------- -# Main -# ---------------------------------------------------------------------- - -def main(): - - configs, analyses = full_setup() - - simple_sizing(configs) - - configs.finalize() - analyses.finalize() - - # weight analysis - weights = analyses.configs.base.weights - - # mission analysis - mission = analyses.missions.base - results = mission.evaluate() - - # plt the old results - plot_mission(results) - - return - -# ---------------------------------------------------------------------- -# Analysis Setup -# ---------------------------------------------------------------------- - -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) - missions_analyses = missions_setup(mission) - - analyses = SUAVE.Analyses.Analysis.Container() - analyses.configs = configs_analyses - analyses.missions = missions_analyses - - return configs, analyses - -# ---------------------------------------------------------------------- -# Define the Vehicle Analyses -# ---------------------------------------------------------------------- - -def analyses_setup(configs): - - analyses = SUAVE.Analyses.Analysis.Container() - - # build a base analysis for each config - for tag,config in configs.items(): - analysis = base_analysis(config) - analyses[tag] = analysis - - return analyses - -def base_analysis(vehicle): - - # ------------------------------------------------------------------ - # Initialize the Analyses - # ------------------------------------------------------------------ - analyses = SUAVE.Analyses.Vehicle() - - # ------------------------------------------------------------------ - # Basic Geometry Relations - sizing = SUAVE.Analyses.Sizing.Sizing() - sizing.features.vehicle = vehicle - analyses.append(sizing) - - # ------------------------------------------------------------------ - # Weights - weights = SUAVE.Analyses.Weights.Weights_BWB() - weights.vehicle = vehicle - analyses.append(weights) - - # ------------------------------------------------------------------ - # Aerodynamics Analysis - aerodynamics = SUAVE.Analyses.Aerodynamics.SU2_Euler() - aerodynamics.geometry = vehicle - - #aerodynamics.process.compute.lift.inviscid.settings.parallel = True - #aerodynamics.process.compute.lift.inviscid.settings.processors = 12 - #aerodynamics.process.compute.lift.inviscid.training_file = 'base_data.txt' - aerodynamics.settings.drag_coefficient_increment = 0.0000 - - aerodynamics.process.compute.lift.inviscid.training.Mach = np.array([.3, .5, .7, .85]) - aerodynamics.process.compute.lift.inviscid.training.angle_of_attack = np.array([0.,3.,6.]) * Units.deg - - wing_segments = vehicle.wings.main_wing.Segments - wing_segments.section_1.vsp_mesh = Data() - wing_segments.section_1.vsp_mesh.inner_radius = 4. - wing_segments.section_1.vsp_mesh.outer_radius = 4. - wing_segments.section_1.vsp_mesh.inner_length = .14 - wing_segments.section_1.vsp_mesh.outer_length = .14 - - wing_segments.section_2.vsp_mesh = Data() - wing_segments.section_2.vsp_mesh.inner_radius = 4. - wing_segments.section_2.vsp_mesh.outer_radius = 4. - wing_segments.section_2.vsp_mesh.inner_length = .14 - wing_segments.section_2.vsp_mesh.outer_length = .14 - - wing_segments.section_3.vsp_mesh = Data() - wing_segments.section_3.vsp_mesh.inner_radius = 4. - wing_segments.section_3.vsp_mesh.outer_radius = 4. - wing_segments.section_3.vsp_mesh.inner_length = .14 - wing_segments.section_3.vsp_mesh.outer_length = .14 - - wing_segments.section_4.vsp_mesh = Data() - wing_segments.section_4.vsp_mesh.inner_radius = 4. - wing_segments.section_4.vsp_mesh.outer_radius = 2.8 - wing_segments.section_4.vsp_mesh.inner_length = .14 - wing_segments.section_4.vsp_mesh.outer_length = .14 - - analyses.append(aerodynamics) - - # ------------------------------------------------------------------ - # Energy - energy= SUAVE.Analyses.Energy.Energy() - energy.network = vehicle.propulsors - analyses.append(energy) - - # ------------------------------------------------------------------ - # Planet Analysis - planet = SUAVE.Analyses.Planets.Planet() - analyses.append(planet) - - # ------------------------------------------------------------------ - # Atmosphere Analysis - atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976() - atmosphere.features.planet = planet.features - analyses.append(atmosphere) - - # done! - return analyses - -# ---------------------------------------------------------------------- -# Define the Vehicle -# ---------------------------------------------------------------------- - -def vehicle_setup(): - - # ------------------------------------------------------------------ - # Initialize the Vehicle - # ------------------------------------------------------------------ - - vehicle = SUAVE.Vehicle() - vehicle.tag = 'Boeing_BWB_450' - - - # ------------------------------------------------------------------ - # Vehicle-level Properties - # ------------------------------------------------------------------ - - # mass properties - vehicle.mass_properties.max_takeoff = 823000. * Units.lb - vehicle.mass_properties.takeoff = 823000. * Units.lb - vehicle.mass_properties.max_zero_fuel = 0.9 * vehicle.mass_properties.max_takeoff - vehicle.mass_properties.cargo = 0. * Units.kilogram - - # envelope properties - vehicle.envelope.ultimate_load = 2.5 - vehicle.envelope.limit_load = 1.5 - - # basic parameters - vehicle.reference_area = 15680. * Units.feet**2 - vehicle.passengers = 450. - vehicle.systems.control = "fully powered" - vehicle.systems.accessories = "medium range" - - - # ------------------------------------------------------------------ - # Main Wing - # ------------------------------------------------------------------ - - wing = SUAVE.Components.Wings.Main_Wing() - wing.tag = 'main_wing' - - wing.aspect_ratio = 289.**2 / (7840. * 2) - wing.thickness_to_chord = 0.15 - wing.taper = 0.0138 - wing.span_efficiency = 0.95 - wing.spans.projected = 289.0 * Units.feet - wing.chords.root = 145.0 * Units.feet - wing.chords.tip = 3.5 * Units.feet - wing.chords.mean_aerodynamic = 86. * Units.feet - wing.areas.reference = 15680. * Units.feet**2 - wing.sweeps.quarter_chord = 33. * Units.degrees - wing.twists.root = 0.0 * Units.degrees - wing.twists.tip = 0.0 * Units.degrees - wing.dihedral = 2.5 * Units.degrees - wing.origin = [0.,0.,0] - wing.aerodynamic_center = [0,0,0] - wing.vertical = False - wing.symmetric = True - wing.high_lift = True - wing.dynamic_pressure_ratio = 1.0 - - segment = SUAVE.Components.Wings.Segment() - segment.tag = 'section_1' - segment.percent_span_location = 0.0 - segment.twist = 0. * Units.deg - segment.root_chord_percent = 1. - segment.dihedral_outboard = 0. * Units.degrees - segment.sweeps.quarter_chord = 30.0 * Units.degrees - segment.thickness_to_chord = 0.165 - wing.Segments.append(segment) - - segment = SUAVE.Components.Wings.Segment() - segment.tag = 'section_2' - segment.percent_span_location = 0.052 - segment.twist = 0. * Units.deg - segment.root_chord_percent = 0.921 - segment.dihedral_outboard = 0. * Units.degrees - segment.sweeps.quarter_chord = 52.5 * Units.degrees - segment.thickness_to_chord = 0.167 - wing.Segments.append(segment) - - segment = SUAVE.Components.Wings.Segment() - segment.tag = 'section_3' - segment.percent_span_location = 0.138 - segment.twist = 0. * Units.deg - segment.root_chord_percent = 0.76 - segment.dihedral_outboard = 1.85 * Units.degrees - segment.sweeps.quarter_chord = 36.9 * Units.degrees - segment.thickness_to_chord = 0.171 - wing.Segments.append(segment) - - segment = SUAVE.Components.Wings.Segment() - segment.tag = 'section_4' - segment.percent_span_location = 0.221 - segment.twist = 0. * Units.deg - segment.root_chord_percent = 0.624 - segment.dihedral_outboard = 1.85 * Units.degrees - segment.sweeps.quarter_chord = 30.4 * Units.degrees - segment.thickness_to_chord = 0.175 - wing.Segments.append(segment) - - segment = SUAVE.Components.Wings.Segment() - segment.tag = 'section_5' - segment.percent_span_location = 0.457 - segment.twist = 0. * Units.deg - segment.root_chord_percent = 0.313 - segment.dihedral_outboard = 1.85 * Units.degrees - segment.sweeps.quarter_chord = 30.85 * Units.degrees - segment.thickness_to_chord = 0.118 - wing.Segments.append(segment) - - segment = SUAVE.Components.Wings.Segment() - segment.tag = 'section_6' - segment.percent_span_location = 0.568 - segment.twist = 0. * Units.deg - segment.root_chord_percent = 0.197 - segment.dihedral_outboard = 1.85 * Units.degrees - segment.sweeps.quarter_chord = 34.3 * Units.degrees - segment.thickness_to_chord = 0.10 - wing.Segments.append(segment) - - #segment = SUAVE.Components.Wings.Segment() - #segment.tag = 'section_7' - #segment.percent_span_location = 0.97 - #segment.twist = 0. * Units.deg - #segment.root_chord_percent = 0.086 - #segment.dihedral_outboard = 73. * Units.degrees - #segment.sweeps.quarter_chord = 55. * Units.degrees - #segment.thickness_to_chord = 0.10 - #wing.Segments.append(segment) - - # add to vehicle - vehicle.append_component(wing) - - # ------------------------------------------------------------------ - # Turbofan Network - # ------------------------------------------------------------------ - - #instantiate the gas turbine network - - turbofan = SUAVE.Components.Energy.Networks.Turbofan() - turbofan.tag = 'turbofan1' - - # setup - turbofan.number_of_engines = 3.0 - turbofan.bypass_ratio = 8.1 - turbofan.engine_length = 289. * Units.inches - turbofan.nacelle_diameter = 3.96 * Units.meters - turbofan.origin = [[133.0 *Units.feet, 25.0*Units.feet, 6.5*Units.feet],[145.0 *Units.feet, 0.0*Units.feet, 6.5*Units.feet],[133.0 *Units.feet, -25.0*Units.feet, 6.5*Units.feet]] - - # working fluid - turbofan.working_fluid = SUAVE.Attributes.Gases.Air() - - # ------------------------------------------------------------------ - # Component 1 - Ram - - # to convert freestream static to stagnation quantities - - # instantiate - ram = SUAVE.Components.Energy.Converters.Ram() - ram.tag = 'ram' - - # add to the network - turbofan.append(ram) - - # ------------------------------------------------------------------ - # Component 2 - Inlet Nozzle - - # instantiate - inlet_nozzle = SUAVE.Components.Energy.Converters.Compression_Nozzle() - inlet_nozzle.tag = 'inlet_nozzle' - - # setup - inlet_nozzle.polytropic_efficiency = 1.0 - inlet_nozzle.pressure_ratio = 1.0 - - # add to network - turbofan.append(inlet_nozzle) - - # ------------------------------------------------------------------ - # Component 3 - Low Pressure Compressor - - # instantiate - compressor = SUAVE.Components.Energy.Converters.Compressor() - compressor.tag = 'low_pressure_compressor' - - # setup - compressor.polytropic_efficiency = 0.91 - compressor.pressure_ratio = 1.1 - - # add to network - turbofan.append(compressor) - - # ------------------------------------------------------------------ - # Component 4 - High Pressure Compressor - - # instantiate - compressor = SUAVE.Components.Energy.Converters.Compressor() - compressor.tag = 'high_pressure_compressor' - - # setup - compressor.polytropic_efficiency = 0.91 - compressor.pressure_ratio = 23.0 - #compressor.hub_to_tip_ratio = 0.325 - - # add to network - turbofan.append(compressor) - - # ------------------------------------------------------------------ - # Component 5 - Low Pressure Turbine - - # instantiate - turbine = SUAVE.Components.Energy.Converters.Turbine() - turbine.tag='low_pressure_turbine' - - # setup - turbine.mechanical_efficiency = 0.99 - turbine.polytropic_efficiency = 0.93 - - # add to network - turbofan.append(turbine) - - # ------------------------------------------------------------------ - # Component 6 - High Pressure Turbine - - # instantiate - turbine = SUAVE.Components.Energy.Converters.Turbine() - turbine.tag='high_pressure_turbine' - - # setup - turbine.mechanical_efficiency = 0.99 - turbine.polytropic_efficiency = 0.93 - - # add to network - turbofan.append(turbine) - - # ------------------------------------------------------------------ - # Component 7 - Combustor - - # instantiate - combustor = SUAVE.Components.Energy.Converters.Combustor() - combustor.tag = 'combustor' - - # setup - combustor.efficiency = 1.0 - combustor.alphac = 1.0 - combustor.turbine_inlet_temperature = 1592. * Units.kelvin - combustor.pressure_ratio = 0.95 - combustor.fuel_data = SUAVE.Attributes.Propellants.Jet_A() - - # add to network - turbofan.append(combustor) - - # ------------------------------------------------------------------ - # Component 8 - Core Nozzle - - # instantiate - nozzle = SUAVE.Components.Energy.Converters.Expansion_Nozzle() - nozzle.tag = 'core_nozzle' - - # setup - nozzle.polytropic_efficiency = 0.95 - nozzle.pressure_ratio = 0.99 - - # add to network - turbofan.append(nozzle) - - # ------------------------------------------------------------------ - # Component 9 - Fan Nozzle - - # instantiate - nozzle = SUAVE.Components.Energy.Converters.Expansion_Nozzle() - nozzle.tag = 'fan_nozzle' - - # setup - nozzle.polytropic_efficiency = 0.95 - nozzle.pressure_ratio = 0.99 - - # add to network - turbofan.append(nozzle) - - # ------------------------------------------------------------------ - # Component 10 - Fan - - # instantiate - fan = SUAVE.Components.Energy.Converters.Fan() - fan.tag = 'fan' - - # setup - fan.polytropic_efficiency = 0.93 - fan.pressure_ratio = 1.58 - #fan.hub_to_tip_ratio = 0.325 - - # add to network - turbofan.append(fan) - - # ------------------------------------------------------------------ - #Component 10 : thrust (to compute the thrust) - thrust = SUAVE.Components.Energy.Processes.Thrust() - thrust.tag ='compute_thrust' - - #total design thrust (includes all the engines) - thrust.total_design = 3.0*512000 * Units.N - thrust.bypass_ratio = 8.4 - - #design sizing conditions - altitude = 0. * Units.km - mach_number = 0.01 - isa_deviation = 0. - - # add to network - turbofan.thrust = thrust - - #size the turbofan - turbofan_sizing(turbofan,mach_number,altitude) - - #computing the engine length and diameter - compute_turbofan_geometry(turbofan,None) - - vehicle.append_component(turbofan) - - # ------------------------------------------------------------------ - # Vehicle Definition Complete - # ------------------------------------------------------------------ - - return vehicle - - -# ---------------------------------------------------------------------- -# Define the Configurations -# --------------------------------------------------------------------- - -def configs_setup(vehicle): - - # ------------------------------------------------------------------ - # Initialize Configurations - # ------------------------------------------------------------------ - - configs = SUAVE.Components.Configs.Config.Container() - - base_config = SUAVE.Components.Configs.Config(vehicle) - base_config.tag = 'base' - configs.append(base_config) - - write(vehicle,base_config.tag) - - return configs - -def simple_sizing(configs): - - base = configs.base - base.pull_base() - - # zero fuel weight - base.mass_properties.max_zero_fuel = 0.9 * base.mass_properties.max_takeoff - - # Areas - wetted_areas = get_vsp_areas(base.tag) - - for wing in base.wings: - wing.areas.wetted = wetted_areas[wing.tag] - wing.areas.exposed = wetted_areas[wing.tag] - wing.areas.affected = 0.6 * wing.areas.wetted - - # diff the new data - base.store_diff() - - return - -# ---------------------------------------------------------------------- -# Define the Mission -# ---------------------------------------------------------------------- - -def mission_setup(analyses): - - # ------------------------------------------------------------------ - # Initialize the Mission - # ------------------------------------------------------------------ - - mission = SUAVE.Analyses.Mission.Sequential_Segments() - mission.tag = 'the_mission' - - #airport - airport = SUAVE.Attributes.Airports.Airport() - airport.altitude = 0.0 * Units.ft - airport.delta_isa = 0.0 - airport.atmosphere = SUAVE.Attributes.Atmospheres.Earth.US_Standard_1976() - mission.airport = airport - - # unpack Segments module - Segments = SUAVE.Analyses.Mission.Segments - - # base segment - base_segment = Segments.Segment() - - # ------------------------------------------------------------------ - # First Climb Segment - # ------------------------------------------------------------------ - - segment = Segments.Climb.Constant_Speed_Constant_Rate(base_segment) - segment.tag = "climb_1" - - segment.analyses.extend( analyses.base ) - - ones_row = segment.state.ones_row - segment.state.unknowns.body_angle = ones_row(1) * 3. * Units.deg - - segment.altitude_start = 0.0 * Units.km - segment.altitude_end = 3.0 * Units.km - segment.air_speed = 125.0 * Units['m/s'] - segment.climb_rate = 6.0 * Units['m/s'] - - # add to misison - mission.append_segment(segment) - - - # ------------------------------------------------------------------ - # Second Climb Segment - # ------------------------------------------------------------------ - - segment = Segments.Climb.Constant_Speed_Constant_Rate(base_segment) - segment.tag = "climb_2" - - segment.analyses.extend( analyses.base ) - - segment.altitude_end = 8.0 * Units.km - segment.air_speed = 190.0 * Units['m/s'] - segment.climb_rate = 6.0 * Units['m/s'] - - # add to mission - mission.append_segment(segment) - - - # ------------------------------------------------------------------ - # Third Climb Segment: constant Mach, constant segment angle - # ------------------------------------------------------------------ - - segment = Segments.Climb.Constant_Speed_Constant_Rate(base_segment) - segment.tag = "climb_3" - - segment.analyses.extend( analyses.base ) - - segment.altitude_end = 35000 * Units.feet - segment.air_speed = 226.0 * Units['m/s'] - segment.climb_rate = 3.0 * Units['m/s'] - - # add to mission - mission.append_segment(segment) - - - # ------------------------------------------------------------------ - # Cruise Segment - # ------------------------------------------------------------------ - - segment = Segments.Cruise.Constant_Mach_Constant_Altitude(base_segment) - segment.tag = "cruise" - - segment.analyses.extend( analyses.base ) - - segment.mach = 0.78 - segment.distance = 6500 * Units.nautical_mile - - # add to mission - mission.append_segment(segment) - - -# ------------------------------------------------------------------ -# First Descent Segment -# ------------------------------------------------------------------ - - segment = Segments.Descent.Constant_Speed_Constant_Rate(base_segment) - segment.tag = "descent_1" - - segment.analyses.extend( analyses.base ) - - segment.altitude_end = 8.0 * Units.km - segment.air_speed = 220.0 * Units['m/s'] - segment.descent_rate = 4.5 * Units['m/s'] - - # add to mission - mission.append_segment(segment) - - - # ------------------------------------------------------------------ - # Second Descent Segment: consant speed, constant segment rate - # ------------------------------------------------------------------ - - segment = Segments.Descent.Constant_Speed_Constant_Rate(base_segment) - segment.tag = "descent_2" - - segment.analyses.extend( analyses.base ) - - segment.altitude_end = 6.0 * Units.km - segment.air_speed = 195.0 * Units['m/s'] - segment.descent_rate = 5.0 * Units['m/s'] - - # add to mission - mission.append_segment(segment) - - - # ------------------------------------------------------------------ - # Third Descent Segment - # ------------------------------------------------------------------ - - segment = Segments.Descent.Constant_Speed_Constant_Rate(base_segment) - segment.tag = "descent_3" - - segment.analyses.extend( analyses.base ) - - segment.altitude_end = 4.0 * Units.km - segment.air_speed = 170.0 * Units['m/s'] - segment.descent_rate = 5.0 * Units['m/s'] - - # add to mission - mission.append_segment(segment) - - - # ------------------------------------------------------------------ - # Fourth Descent Segment - # ------------------------------------------------------------------ - - segment = Segments.Descent.Constant_Speed_Constant_Rate(base_segment) - segment.tag = "descent_4" - - segment.analyses.extend( analyses.base ) - - segment.altitude_end = 2.0 * Units.km - segment.air_speed = 150.0 * Units['m/s'] - segment.descent_rate = 5.0 * Units['m/s'] - - - # add to mission - mission.append_segment(segment) - - # ------------------------------------------------------------------ - # Fifth Descent Segment - # ------------------------------------------------------------------ - - segment = Segments.Descent.Constant_Speed_Constant_Rate(base_segment) - segment.tag = "descent_5" - - segment.analyses.extend( analyses.base ) - - segment.altitude_end = 0.0 * Units.km - segment.air_speed = 145.0 * Units['m/s'] - segment.descent_rate = 3.0 * Units['m/s'] - - # append to mission - mission.append_segment(segment) - - # ------------------------------------------------------------------ - # Mission definition complete - # ------------------------------------------------------------------ - - return mission - -def missions_setup(base_mission): - - # the mission container - missions = SUAVE.Analyses.Mission.Mission.Container() - - # ------------------------------------------------------------------ - # Base Mission - # ------------------------------------------------------------------ - - missions.base = base_mission - - return missions - -# ---------------------------------------------------------------------- -# Plot Mission -# ---------------------------------------------------------------------- - -def plot_mission(results,line_style='bo-'): - - axis_font = {'fontname':'Arial', 'size':'14'} - - # ------------------------------------------------------------------ - # Aerodynamics - # ------------------------------------------------------------------ - - - fig = plt.figure("Aerodynamic Forces",figsize=(8,6)) - for segment in results.segments.values(): - - time = segment.conditions.frames.inertial.time[:,0] / Units.min - Thrust = segment.conditions.frames.body.thrust_force_vector[:,0] / Units.lbf - eta = segment.conditions.propulsion.throttle[:,0] - - axes = fig.add_subplot(2,1,1) - axes.plot( time , Thrust , line_style ) - axes.set_ylabel('Thrust (lbf)',axis_font) - axes.grid(True) - - axes = fig.add_subplot(2,1,2) - axes.plot( time , eta , line_style ) - axes.set_xlabel('Time (min)',axis_font) - axes.set_ylabel('Throttle',axis_font) - axes.grid(True) - - plt.savefig("B737_engine.pdf") - plt.savefig("B737_engine.png") - - # ------------------------------------------------------------------ - # Aerodynamics 2 - # ------------------------------------------------------------------ - fig = plt.figure("Aerodynamic Coefficients",figsize=(8,10)) - for segment in results.segments.values(): - - time = segment.conditions.frames.inertial.time[:,0] / Units.min - CLift = segment.conditions.aerodynamics.lift_coefficient[:,0] - CDrag = segment.conditions.aerodynamics.drag_coefficient[:,0] - aoa = segment.conditions.aerodynamics.angle_of_attack[:,0] / Units.deg - l_d = CLift/CDrag - - axes = fig.add_subplot(3,1,1) - axes.plot( time , CLift , line_style ) - axes.set_ylabel('Lift Coefficient',axis_font) - axes.grid(True) - - axes = fig.add_subplot(3,1,2) - axes.plot( time , l_d , line_style ) - axes.set_ylabel('L/D',axis_font) - axes.grid(True) - - axes = fig.add_subplot(3,1,3) - axes.plot( time , aoa , 'ro-' ) - axes.set_xlabel('Time (min)',axis_font) - axes.set_ylabel('AOA (deg)',axis_font) - axes.grid(True) - - plt.savefig("B737_aero.pdf") - plt.savefig("B737_aero.png") - - # ------------------------------------------------------------------ - # Aerodynamics 2 - # ------------------------------------------------------------------ - fig = plt.figure("Drag Components",figsize=(8,10)) - axes = plt.gca() - for i, segment in enumerate(results.segments.values()): - - time = segment.conditions.frames.inertial.time[:,0] / Units.min - drag_breakdown = segment.conditions.aerodynamics.drag_breakdown - cdp = drag_breakdown.parasite.total[:,0] - cdi = drag_breakdown.induced.total[:,0] - cdc = drag_breakdown.compressible.total[:,0] - cdm = drag_breakdown.miscellaneous.total[:,0] - cd = drag_breakdown.total[:,0] - - if line_style == 'bo-': - axes.plot( time , cdp , 'ko-', label='CD parasite' ) - axes.plot( time , cdi , 'bo-', label='CD induced' ) - axes.plot( time , cdc , 'go-', label='CD compressibility' ) - axes.plot( time , cdm , 'yo-', label='CD miscellaneous' ) - axes.plot( time , cd , 'ro-', label='CD total' ) - if i == 0: - axes.legend(loc='upper center') - else: - axes.plot( time , cdp , line_style ) - axes.plot( time , cdi , line_style ) - axes.plot( time , cdc , line_style ) - axes.plot( time , cdm , line_style ) - axes.plot( time , cd , line_style ) - - axes.set_xlabel('Time (min)') - axes.set_ylabel('CD') - axes.grid(True) - plt.savefig("B737_drag.pdf") - plt.savefig("B737_drag.png") - - # ------------------------------------------------------------------ - # Altitude, sfc, vehicle weight - # ------------------------------------------------------------------ - - fig = plt.figure("Altitude_sfc_weight",figsize=(8,10)) - for segment in results.segments.values(): - - time = segment.conditions.frames.inertial.time[:,0] / Units.min - aoa = segment.conditions.aerodynamics.angle_of_attack[:,0] / Units.deg - mass = segment.conditions.weights.total_mass[:,0] / Units.lb - altitude = segment.conditions.freestream.altitude[:,0] / Units.ft - mdot = segment.conditions.weights.vehicle_mass_rate[:,0] - thrust = segment.conditions.frames.body.thrust_force_vector[:,0] - sfc = (mdot / Units.lb) / (thrust /Units.lbf) * Units.hr - - axes = fig.add_subplot(3,1,1) - axes.plot( time , altitude , line_style ) - axes.set_ylabel('Altitude (ft)',axis_font) - axes.grid(True) - - axes = fig.add_subplot(3,1,3) - axes.plot( time , sfc , line_style ) - axes.set_xlabel('Time (min)',axis_font) - axes.set_ylabel('sfc (lb/lbf-hr)',axis_font) - axes.grid(True) - - axes = fig.add_subplot(3,1,2) - axes.plot( time , mass , 'ro-' ) - axes.set_ylabel('Weight (lb)',axis_font) - axes.grid(True) - - plt.savefig("B737_mission.pdf") - plt.savefig("B737_mission.png") - - # ------------------------------------------------------------------ - # Velocities - # ------------------------------------------------------------------ - fig = plt.figure("Velocities",figsize=(8,10)) - for segment in results.segments.values(): - - time = segment.conditions.frames.inertial.time[:,0] / Units.min - Lift = -segment.conditions.frames.wind.lift_force_vector[:,2] - Drag = -segment.conditions.frames.wind.drag_force_vector[:,0] / Units.lbf - Thrust = segment.conditions.frames.body.thrust_force_vector[:,0] / Units.lb - velocity = segment.conditions.freestream.velocity[:,0] - pressure = segment.conditions.freestream.pressure[:,0] - density = segment.conditions.freestream.density[:,0] - EAS = velocity * np.sqrt(density/1.225) - mach = segment.conditions.freestream.mach_number[:,0] - - axes = fig.add_subplot(3,1,1) - axes.plot( time , velocity / Units.kts, line_style ) - axes.set_ylabel('velocity (kts)',axis_font) - axes.grid(True) - - axes = fig.add_subplot(3,1,2) - axes.plot( time , EAS / Units.kts, line_style ) - axes.set_xlabel('Time (min)',axis_font) - axes.set_ylabel('Equivalent Airspeed',axis_font) - axes.grid(True) - - axes = fig.add_subplot(3,1,3) - axes.plot( time , mach , line_style ) - axes.set_xlabel('Time (min)',axis_font) - axes.set_ylabel('Mach',axis_font) - axes.grid(True) - - return - -if __name__ == '__main__': - main() - plt.show() - diff --git a/BWB_CFD/base_data.txt b/BWB_CFD/base_data.txt deleted file mode 100644 index 67fc169..0000000 --- a/BWB_CFD/base_data.txt +++ /dev/null @@ -1,13 +0,0 @@ -# AoA Mach CL CD -0.00000000 0.30000000 0.00357426 0.00198925 -0.00000000 0.50000000 0.00385438 0.00262971 -0.00000000 0.70000000 0.00471753 0.00444076 -0.00000000 0.85000000 0.00856885 0.01859320 -0.05235988 0.30000000 0.20620500 0.00821743 -0.05235988 0.50000000 0.21761550 0.01013710 -0.05235988 0.70000000 0.24444750 0.01578280 -0.05235988 0.85000000 0.29654400 0.05575920 -0.10471976 0.30000000 0.40600150 0.02727500 -0.10471976 0.50000000 0.42532150 0.03379330 -0.10471976 0.70000000 0.46278650 0.05568500 -0.10471976 0.85000000 0.51038000 0.13394200