Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 32 additions & 8 deletions B737_AVL_Tutorial/tut_mission_B737_AVL.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@

# SUAVE Imports
import SUAVE
if not SUAVE.__version__=='2.5.0':
assert('These tutorials only work with the SUAVE 2.5.0 release')

from SUAVE.Core import Data, Units
from SUAVE.Plots.Mission_Plots import *
from SUAVE.Plots.Performance.Mission_Plots import *
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, \
Expand All @@ -22,6 +25,8 @@
import numpy as np
import pylab as plt

from copy import deepcopy

# ----------------------------------------------------------------------
# Main
# ----------------------------------------------------------------------
Expand Down Expand Up @@ -116,15 +121,15 @@ def base_analysis(vehicle):
# ------------------------------------------------------------------
# Stability Analysis
stability = SUAVE.Analyses.Stability.AVL()
stability.settings.filenames.avl_bin_name = 'CHANGE ME TO YOUR DIRECTORY'
stability.settings.filenames.avl_bin_name = 'CHANGE ME TO YOUR DIRECTORY'
#stability.settings.spanwise_vortex_density = 3
stability.geometry = vehicle
analyses.append(stability)

# ------------------------------------------------------------------
# Energy
energy= SUAVE.Analyses.Energy.Energy()
energy.network = vehicle.propulsors
energy.network = vehicle.networks
analyses.append(energy)

# ------------------------------------------------------------------
Expand Down Expand Up @@ -304,6 +309,30 @@ def vehicle_setup():

# add to vehicle
vehicle.append_component(fuselage)


# ------------------------------------------------------------------
# Nacelles
# ------------------------------------------------------------------
nacelle = SUAVE.Components.Nacelles.Nacelle()
nacelle.tag = 'nacelle_1'
nacelle.length = 2.71
nacelle.inlet_diameter = 1.90
nacelle.diameter = 2.05
nacelle.areas.wetted = 1.1*np.pi*nacelle.diameter*nacelle.length
nacelle.origin = [[13.72, -4.86,-1.9]]
nacelle.flow_through = True
nacelle_airfoil = SUAVE.Components.Airfoils.Airfoil()
nacelle_airfoil.naca_4_series_airfoil = '2410'
nacelle.append_airfoil(nacelle_airfoil)

nacelle_2 = deepcopy(nacelle)
nacelle_2.tag = 'nacelle_2'
nacelle_2.origin = [[13.72, 4.86,-1.9]]

vehicle.append_component(nacelle)
vehicle.append_component(nacelle_2)


# ------------------------------------------------------------------
# Turbofan Network
Expand All @@ -316,13 +345,8 @@ def vehicle_setup():
# setup
turbofan.number_of_engines = 2
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]]

#compute engine areas
turbofan.areas.wetted = 1.1*np.pi*turbofan.nacelle_diameter*turbofan.engine_length

# working fluid
turbofan.working_fluid = SUAVE.Attributes.Gases.Air()

Expand Down
45 changes: 37 additions & 8 deletions BWB_CFD/BWB.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
# ----------------------------------------------------------------------

import SUAVE
if not SUAVE.__version__=='2.5.0':
assert('These tutorials only work with the SUAVE 2.5.0 release')

import numpy as np
import pylab as plt
Expand All @@ -19,8 +21,12 @@

from SUAVE.Methods.Propulsion.turbofan_sizing import turbofan_sizing
from SUAVE.Methods.Geometry.Two_Dimensional.Cross_Section.Propulsion import compute_turbofan_geometry
from SUAVE.Methods.Geometry.Two_Dimensional.Planform import segment_properties

from SUAVE.Plots.Performance.Mission_Plots import *

from copy import deepcopy

from SUAVE.Plots.Mission_Plots import *

# ----------------------------------------------------------------------
# Main
Expand Down Expand Up @@ -151,7 +157,7 @@ def base_analysis(vehicle):
# ------------------------------------------------------------------
# Energy
energy= SUAVE.Analyses.Energy.Energy()
energy.network = vehicle.propulsors
energy.network = vehicle.networks
analyses.append(energy)

# ------------------------------------------------------------------
Expand Down Expand Up @@ -325,9 +331,23 @@ def vehicle_setup():
segment.sweeps.quarter_chord = 0. * Units.degrees
segment.thickness_to_chord = 0.10
wing.Segments.append(segment)

# Fill out more segment properties automatically
wing = segment_properties(wing)

# add to vehicle
vehicle.append_component(wing)

# ------------------------------------------------------------------
# Nacelle
# ------------------------------------------------------------------
nacelle = SUAVE.Components.Nacelles.Nacelle()
nacelle.diameter = 3.96 * Units.meters
nacelle.length = 289. * Units.inches
nacelle.tag = 'nacelle'
nacelle.origin = [[123.0 *Units.feet, 25.0*Units.feet, 6.5*Units.feet]]
nacelle.Airfoil.naca_4_series_airfoil = '0012'


# ------------------------------------------------------------------
# Turbofan Network
Expand All @@ -339,9 +359,6 @@ def vehicle_setup():
# 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.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
Expand Down Expand Up @@ -481,19 +498,31 @@ def vehicle_setup():
#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)
#turbofan.size(mach_number,altitude)

#computing the engine length and diameter
compute_turbofan_geometry(turbofan,None)
compute_turbofan_geometry(turbofan,nacelle)

vehicle.append_component(turbofan)

# Finish adding all the nacelles

nacelle_2 = deepcopy(nacelle)
nacelle_2.tag = 'nacelle_2'
nacelle_2.origin = [[135.0 *Units.feet, 0.0*Units.feet, 6.5*Units.feet]]

nacelle_3 = deepcopy(nacelle)
nacelle_3.tag = 'nacelle_3'
nacelle_3.origin = [[123.0 *Units.feet, -25.0*Units.feet, 6.5*Units.feet]]

vehicle.append_component(nacelle)
vehicle.append_component(nacelle_2)
vehicle.append_component(nacelle_3)


# ------------------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions Regional_Jet_Optimization/Optimize.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
# ----------------------------------------------------------------------

import SUAVE
if not SUAVE.__version__=='2.5.0':
assert('These tutorials only work with the SUAVE 2.5.0 release')
from SUAVE.Core import Units, Data
import numpy as np
import Vehicles
Expand Down
2 changes: 1 addition & 1 deletion Regional_Jet_Optimization/Plot_Mission.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import SUAVE
from SUAVE.Core import Units
from SUAVE.Plots.Mission_Plots import *
from SUAVE.Plots.Performance.Mission_Plots import *
import pylab as plt

# ----------------------------------------------------------------------
Expand Down
43 changes: 29 additions & 14 deletions Regional_Jet_Optimization/Vehicles.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
from SUAVE.Methods.Propulsion.turbofan_sizing import turbofan_sizing
from SUAVE.Methods.Geometry.Two_Dimensional.Planform import wing_planform

from copy import deepcopy

# ----------------------------------------------------------------------
# Define the Vehicle
# ----------------------------------------------------------------------
Expand Down Expand Up @@ -196,33 +198,45 @@ def base_setup():

# add to vehicle
vehicle.append_component(fuselage)



# -----------------------------------------------------------------
# Design the Nacelle
# -----------------------------------------------------------------
nacelle = SUAVE.Components.Nacelles.Nacelle()
nacelle.diameter = 2.05
nacelle.length = 2.71
nacelle.tag = 'nacelle_1'
nacelle.inlet_diameter = 2.0
nacelle.origin = [[12.0,4.38,-2.1]]
Awet = 1.1*np.pi*nacelle.diameter*nacelle.length # 1.1 is simple coefficient
nacelle.areas.wetted = Awet
nacelle_airfoil = SUAVE.Components.Airfoils.Airfoil()
nacelle_airfoil.naca_4_series_airfoil = '2410'
nacelle.append_airfoil(nacelle_airfoil)

nacelle_2 = deepcopy(nacelle)
nacelle_2.tag = 'nacelle_2'
nacelle_2.origin = [[12.0,-4.38,-2.1]]

vehicle.append_component(nacelle)
vehicle.append_component(nacelle_2)


# ------------------------------------------------------------------
# Turbofan Network
# ------------------------------------------------------------------


#initialize the gas turbine network
gt_engine = SUAVE.Components.Energy.Networks.Turbofan()
gt_engine.tag = 'turbofan'
gt_engine.origin = [[12.0,4.38,-2.1],[12.0,-4.38,-2.1]]
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
gt_engine.inlet_diameter = 2.0

#compute engine areas)
Awet = 1.1*np.pi*gt_engine.nacelle_diameter*gt_engine.engine_length # 1.1 is simple coefficient

#Assign engine area
gt_engine.areas.wetted = Awet

#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
Expand Down Expand Up @@ -332,6 +346,7 @@ def base_setup():
fuel.mass_properties.mass = vehicle.mass_properties.max_takeoff-vehicle.mass_properties.max_fuel
fuel.origin = vehicle.wings.main_wing.mass_properties.center_of_gravity
fuel.mass_properties.center_of_gravity= vehicle.wings.main_wing.aerodynamic_center

# ------------------------------------------------------------------
# Vehicle Definition Complete
# ------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion Solar_UAV_Optimization/Analyses.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def base(vehicle):
# Energy
# ------------------------------------------------------------------
energy = SUAVE.Analyses.Energy.Energy()
energy.network = vehicle.propulsors
energy.network = vehicle.networks
analyses.append(energy)

# ------------------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion Solar_UAV_Optimization/Missions.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,15 @@ def mission(analyses,vehicle):
segment.analyses.extend(analyses.base)

# segment attributes
segment.state.numerics.number_control_points = 50
segment.state.numerics.number_control_points = 32
segment.dynamic_pressure = 115.0 * Units.pascals
segment.start_time = time.strptime("Tue, Jun 21 11:00:00 2020", "%a, %b %d %H:%M:%S %Y",)
segment.altitude = 1000.0 * Units.feet
segment.distance = 1000.0 * Units.km
segment.charge_ratio = 1.0
segment.latitude = 37.4
segment.longitude = -122.15
segment.battery_energy = vehicle.base.networks.solar_low_fidelity.battery.max_energy
segment.state.conditions.frames.wind.body_rotations[:,2] = 125.* Units.degrees

mission.append_segment(segment)
Expand Down
10 changes: 7 additions & 3 deletions Solar_UAV_Optimization/Optimize.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
# Imports
# ----------------------------------------------------------------------

import SUAVE
if not SUAVE.__version__=='2.5.0':
assert('These tutorials only work with the SUAVE 2.5.0 release')

from SUAVE.Core import Units, Data
import numpy as np
import Vehicles
Expand Down Expand Up @@ -88,9 +92,9 @@ def setup():
[ 'wing_area' ,['vehicle_configurations.*.wings.main_wing.areas.reference',
'vehicle_configurations.base.reference_area'] ],
[ 'aspect_ratio' , 'vehicle_configurations.*.wings.main_wing.aspect_ratio' ],
[ 'kv' , 'vehicle_configurations.*.propulsors.solar_low_fidelity.motor.speed_constant' ],
[ 'battery_mass' , 'vehicle_configurations.base.propulsors.solar_low_fidelity.battery.mass_properties.mass'],
[ 'solar_ratio' , 'vehicle_configurations.*.propulsors.solar_low_fidelity.solar_panel.ratio' ],
[ 'kv' , 'vehicle_configurations.*.networks.solar_low_fidelity.motor.speed_constant' ],
[ 'battery_mass' , 'vehicle_configurations.base.networks.solar_low_fidelity.battery.mass_properties.mass'],
[ 'solar_ratio' , 'vehicle_configurations.*.networks.solar_low_fidelity.solar_panel.ratio' ],
[ 'dynamic_pressure' , 'missions.mission.segments.cruise.dynamic_pressure' ],
[ 'Nothing' , 'summary.nothing' ],
[ 'energy_constraint', 'summary.energy_constraint' ],
Expand Down
4 changes: 2 additions & 2 deletions Solar_UAV_Optimization/Plot_Mission.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Imports
# ----------------------------------------------------------------------

from SUAVE.Plots.Mission_Plots import *
from SUAVE.Plots.Performance.Mission_Plots import *
from SUAVE.Core import Units
import pylab as plt

Expand All @@ -20,7 +20,7 @@ def plot_mission(results,line_style='bo-'):
plot_solar_flux(results)

# Plot Aircraft Electronics
plot_electronic_conditions(results)
plot_battery_pack_conditions(results)

return

Expand Down
Loading