From ddca2f0bdf080338dd41b23af5224816ef91286b Mon Sep 17 00:00:00 2001 From: Emilio Botero Date: Fri, 15 Apr 2016 15:29:40 -0700 Subject: [PATCH 1/6] fix solar UAV tutorial --- tut_solar_uav.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tut_solar_uav.py b/tut_solar_uav.py index f0ac4eb..93c6df7 100644 --- a/tut_solar_uav.py +++ b/tut_solar_uav.py @@ -2,6 +2,7 @@ # # Created: Jul 2014, E. Botero # Modified: Jun 2015, E. Botero +# Apr 2015, E. Botero #---------------------------------------------------------------------- # Imports @@ -208,6 +209,8 @@ def vehicle_setup(): net.number_of_engines = 1. net.nacelle_diameter = 0.2 net.engine_length = 0.01 + net.areas = Data() + net.areas.wetted = 0.01*(2*np.pi*0.01/2) # Component 1 the Sun? sun = SUAVE.Components.Energy.Processes.Solar_Radiation() From 90890667c1dd339fdd6bf4ef4f2d192fb23b2d9d Mon Sep 17 00:00:00 2001 From: jmvegh Date: Mon, 18 Apr 2016 10:11:14 -0700 Subject: [PATCH 2/6] took out a comment --- tut_lithium_air_jet_sizing.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tut_lithium_air_jet_sizing.py b/tut_lithium_air_jet_sizing.py index 0f572e3..37272e6 100644 --- a/tut_lithium_air_jet_sizing.py +++ b/tut_lithium_air_jet_sizing.py @@ -20,8 +20,6 @@ import matplotlib import pylab as plt -#from SUAVE.Methods.Propulsion.turbofan_sizing import turbofan_sizing -#from SUAVE.Methods.Propulsion.engine_sizing_ductedfan import engine_sizing_ductedfan from SUAVE.Methods.Performance import estimate_take_off_field_length from SUAVE.Methods.Performance import estimate_landing_field_length From e29fe87ff7b6561a7ef7479602ff87c3d337c89f Mon Sep 17 00:00:00 2001 From: Emilio Botero Date: Mon, 18 Apr 2016 11:13:09 -0700 Subject: [PATCH 3/6] fixing readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index eca2617..3442040 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ # SUAVE Tutorials -See [suave.stanford.edu/guides](https://www.suave.stanford.edu/guides) for more information +See [suave.stanford.edu/guides](https://suave.stanford.edu/guides) for more information From c3c285d29e346c64bc56b62df3de83ffe82a83f5 Mon Sep 17 00:00:00 2001 From: jmvegh Date: Thu, 21 Apr 2016 14:25:23 -0700 Subject: [PATCH 4/6] some code cleanup for Regional_Jet_Optimization/ --- Regional_Jet_Optimization/Optimize.py | 6 ++-- Regional_Jet_Optimization/Procedure.py | 49 ++++++++++++++------------ 2 files changed, 29 insertions(+), 26 deletions(-) diff --git a/Regional_Jet_Optimization/Optimize.py b/Regional_Jet_Optimization/Optimize.py index 559f734..4a68c02 100644 --- a/Regional_Jet_Optimization/Optimize.py +++ b/Regional_Jet_Optimization/Optimize.py @@ -133,7 +133,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 @@ -153,7 +153,7 @@ def variable_sweep(problem): 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] @@ -168,7 +168,7 @@ def variable_sweep(problem): 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() diff --git a/Regional_Jet_Optimization/Procedure.py b/Regional_Jet_Optimization/Procedure.py index 4f3911e..da8b2c7 100644 --- a/Regional_Jet_Optimization/Procedure.py +++ b/Regional_Jet_Optimization/Procedure.py @@ -105,6 +105,31 @@ def simple_sizing(nexus): configs=nexus.vehicle_configurations base=configs.base + #find conditions + air_speed = nexus.missions.base.segments['cruise'].air_speed + altitude = nexus.missions.base.segments['climb_5'].altitude_end + atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976() + + 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 + + #now size engine + mach_number = air_speed/freestream.speed_of_sound + + #now add to freestream data object + freestream.velocity = air_speed + freestream.mach_number = mach_number + freestream.gravity = 9.81 + + 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 @@ -118,31 +143,9 @@ def simple_sizing(nexus): - air_speed = nexus.missions.base.segments['cruise'].air_speed - altitude = nexus.missions.base.segments['climb_5'].altitude_end - atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976() - - freestream = atmosphere.compute_values(altitude) - freestream0 = atmosphere.compute_values(6000.*Units.ft) #cabin altitude - - fuselage = base.fuselages['fuselage'] - diff_pressure = np.max(freestream0.pressure-freestream.pressure,0) - + fuselage = config.fuselages['fuselage'] fuselage.differential_pressure = diff_pressure - #now size engine - mach_number = air_speed/freestream.speed_of_sound - - #now add to freestream data object - freestream.velocity = air_speed - freestream.mach_number = mach_number - freestream.gravity = 9.81 - - conditions = SUAVE.Analyses.Mission.Segments.Conditions.Aerodynamics() #assign conditions in form for propulsor sizing - conditions.freestream = freestream - - - turbofan_sizing(config.propulsors['turbofan'], mach_number, altitude) compute_turbofan_geometry(config.propulsors['turbofan'], conditions) # diff the new data From 842f4f75abc495007b6f32ed0d09787175e15748 Mon Sep 17 00:00:00 2001 From: Emilio Botero Date: Wed, 27 Apr 2016 17:18:18 -0700 Subject: [PATCH 5/6] cleaning out tutorials --- Solar_UAV_Optimization/Optimize.py | 2 +- tut_mission_Embraer_E190_constThr.py | 955 --------------------------- 2 files changed, 1 insertion(+), 956 deletions(-) delete mode 100644 tut_mission_Embraer_E190_constThr.py diff --git a/Solar_UAV_Optimization/Optimize.py b/Solar_UAV_Optimization/Optimize.py index 29a83e7..aab7b1f 100644 --- a/Solar_UAV_Optimization/Optimize.py +++ b/Solar_UAV_Optimization/Optimize.py @@ -61,7 +61,7 @@ def setup(): # [ tag, scaling, units ] problem.objective = np.array([ - [ 'Nothing', 1. , Units.kg],####Optimize.py: + [ 'Nothing', 1. , Units.kg], ]) # ------------------------------------------------------------------- diff --git a/tut_mission_Embraer_E190_constThr.py b/tut_mission_Embraer_E190_constThr.py deleted file mode 100644 index 2711bcd..0000000 --- a/tut_mission_Embraer_E190_constThr.py +++ /dev/null @@ -1,955 +0,0 @@ -# tut_mission_Embraer_E190_constThr.py -# -# Created: Aug 2014, SUAVE Team -# Modified: Jun 2015, SUAVE Team - -""" setup file for a mission with a E190 -""" - - -# ---------------------------------------------------------------------- -# 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, Data_Exception, Data_Warning, -) - -from SUAVE.Methods.Propulsion.turbofan_sizing import turbofan_sizing -from SUAVE.Methods.Performance import payload_range - - -# ---------------------------------------------------------------------- -# Main -# ---------------------------------------------------------------------- - -def main(): - - # define the problem - configs, analyses = full_setup() - - configs.finalize() - analyses.finalize() - - # weight analysis - weights = analyses.configs.base.weights - breakdown = weights.evaluate() - - # mission analysis - mission = analyses.missions - results = mission.evaluate() - - # plot the 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) - - analyses = SUAVE.Analyses.Analysis.Container() - analyses.configs = configs_analyses - analyses.missions = mission - - 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 - - # adjust analyses for 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): - - # ------------------------------------------------------------------ - # 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() - 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.propulsors #what is called throughout the mission (at every time step)) - 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 = 'Embraer_E190' - - # ------------------------------------------------------------------ - # Vehicle-level Properties - # ------------------------------------------------------------------ - - # 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. - - # envelope properties - vehicle.envelope.ultimate_load = 3.5 - vehicle.envelope.limit_load = 1.5 - - # basic parameters - vehicle.reference_area = 92.00 - vehicle.passengers = 114 - vehicle.systems.control = "fully powered" - vehicle.systems.accessories = "medium range" - - # ------------------------------------------------------------------ - # Main Wing - # ------------------------------------------------------------------ - - wing = SUAVE.Components.Wings.Wing() - wing.tag = 'main_wing' - - wing.aspect_ratio = 8.4 - wing.sweep = 22.0 * Units.deg - 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.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.sweep = 34.5 * Units.deg - 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.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 - - # add to vehicle - vehicle.append_component(wing) - - # ------------------------------------------------------------------ - # Vertical Stabilizer - # ------------------------------------------------------------------ - - wing = SUAVE.Components.Wings.Wing() - wing.tag = 'vertical_stabilizer' - - wing.aspect_ratio = 1.7 # - wing.sweep = 25 * Units.deg - 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.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 - - # 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 = 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.differential_pressure = 10**5 * Units.pascal # Maximum differential pressure - - # add to vehicle - vehicle.append_component(fuselage) - - # ------------------------------------------------------------------ - # Turbofan Network - # ------------------------------------------------------------------ - - - #initialize the gas turbine network - gt_engine = SUAVE.Components.Energy.Networks.Turbofan() - gt_engine.tag = 'turbofan' - - gt_engine.number_of_engines = 2.0 - gt_engine.bypass_ratio = 5.4 - gt_engine.engine_length = 2.71 - 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 - - - #Component 1 : ram, to convert freestream static to stagnation quantities - ram = SUAVE.Components.Energy.Converters.Ram() - ram.tag = 'ram' - - #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.99 - - #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' - - low_pressure_compressor.polytropic_efficiency = 0.91 - low_pressure_compressor.pressure_ratio = 1.9 - - #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' - - high_pressure_compressor.polytropic_efficiency = 0.91 - high_pressure_compressor.pressure_ratio = 10.0 - - #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' - - low_pressure_turbine.mechanical_efficiency = 0.99 - low_pressure_turbine.polytropic_efficiency = 0.99 - - #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' - - high_pressure_turbine.mechanical_efficiency = 0.99 - high_pressure_turbine.polytropic_efficiency = 0.99 - - #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 - combustor.pressure_ratio = 0.95 - combustor.fuel_data = SUAVE.Attributes.Propellants.Jet_A() - - #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' - - core_nozzle.polytropic_efficiency = 0.95 - core_nozzle.pressure_ratio = 0.99 - - #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' - - fan_nozzle.polytropic_efficiency = 0.95 - fan_nozzle.pressure_ratio = 0.98 - - #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' - - fan.polytropic_efficiency = 0.93 - fan.pressure_ratio = 1.7 - - #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' - - #total design thrust (includes all the engines) - thrust.total_design = 37278.0* Units.N #Newtons - - #design sizing conditions - altitude = 35000.0*Units.ft - mach_number = 0.78 - isa_deviation = 0. - - # add thrust to the network - gt_engine.thrust = thrust - - #size the turbofan - turbofan_sizing(gt_engine,mach_number,altitude) - - # add gas turbine network gt_engine to the vehicle - vehicle.append_component(gt_engine) - - # ------------------------------------------------------------------ - # 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) - - # ------------------------------------------------------------------ - # 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 - - -# ---------------------------------------------------------------------- -# 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.Attributes.Atmospheres.Earth.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_Throttle_Constant_Speed() - segment.tag = "climb_250kcas" - - # 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 = 3.048 * Units.km - segment.air_speed = 250.0 * Units.knots - segment.throttle = 1.0 - - # add to misison - mission.append_segment(segment) - - # ------------------------------------------------------------------ - # Second Climb Segment: Constant Speed, Constant Throttle - # ------------------------------------------------------------------ - - segment = Segments.Climb.Constant_Throttle_Constant_Speed() - segment.tag = "climb_280kcas" - - # connect vehicle configuration - segment.analyses.extend( analyses.cruise ) - - # segment attributes - segment.atmosphere = atmosphere - segment.planet = planet - - segment.altitude_end = 32000. * Units.ft - segment.air_speed = 350.0 * Units.knots - segment.throttle = 1.0 - - # dummy for post process script - segment.climb_rate = 0.1 - - # add to mission - mission.append_segment(segment) - - # ------------------------------------------------------------------ - # Third Climb Segment: Constant Speed, Constant Climb Rate - # ------------------------------------------------------------------ - - segment = Segments.Climb.Constant_Throttle_Constant_Speed() - segment.tag = "climb_final" - - # connect vehicle configuration - segment.analyses.extend( analyses.cruise ) - - # segment attributes - segment.atmosphere = atmosphere - segment.planet = planet - - segment.altitude_end = 37000. * Units.ft - segment.air_speed = 390.0 * Units.knots - segment.throttle = 1.0 - - # 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 = 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.distance = 2100. * 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_m0_77" - - # connect vehicle configuration - segment.analyses.extend( analyses.cruise ) - - # segment attributes - segment.atmosphere = atmosphere - segment.planet = planet - - segment.altitude_end = 9.31 * Units.km - segment.air_speed = 440.0 * Units.knots - segment.descent_rate = 2600. * 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_290kcas" - - # connect vehicle configuration - segment.analyses.extend( analyses.cruise ) - - # segment attributes - segment.atmosphere = atmosphere - segment.planet = planet - - segment.altitude_end = 3.657 * Units.km - segment.air_speed = 365.0 * Units.knots - segment.descent_rate = 2300. * 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_250kcas" - - # 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() - - -# ---------------------------------------------------------------------- -# Plot Mission -# ---------------------------------------------------------------------- - -def plot_mission(results,line_style='bo-'): - - # ------------------------------------------------------------------ - # 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) - - - # ------------------------------------------------------------------ - # Fuel Burn Rate - # ------------------------------------------------------------------ - plt.figure("Fuel Burn 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('Fuel Burn 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(4,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(4,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(4,1,3) - axes.plot( time , Thrust , line_style ) - axes.set_xlabel('Time (min)') - axes.set_ylabel('Thrust (N)') - axes.grid(True) - - try: - Pitching_moment = segment.conditions.stability.static.cm_alpha[:,0] - axes = fig.add_subplot(4,1,4) - axes.plot( time , Pitching_moment , line_style ) - axes.set_xlabel('Time (min)') - axes.set_ylabel('Pitching_moment (~)') - axes.grid(True) - except: - pass - - # ------------------------------------------------------------------ - # Aerodynamics 1 - # ------------------------------------------------------------------ - 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 2 - # ------------------------------------------------------------------ - 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) - - return - - -if __name__ == '__main__': - main() - plt.show() \ No newline at end of file From b9bac817be429a998924fb885486790a625e3403 Mon Sep 17 00:00:00 2001 From: Emilio Botero Date: Sat, 30 Apr 2016 22:06:45 -0700 Subject: [PATCH 6/6] fixing year in solar --- tut_solar_uav.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tut_solar_uav.py b/tut_solar_uav.py index 93c6df7..5462ceb 100644 --- a/tut_solar_uav.py +++ b/tut_solar_uav.py @@ -2,7 +2,7 @@ # # Created: Jul 2014, E. Botero # Modified: Jun 2015, E. Botero -# Apr 2015, E. Botero +# Apr 2016, E. Botero #---------------------------------------------------------------------- # Imports