Skip to content

Commit c6face4

Browse files
authored
Merge pull request #29 from suavecode/feature-2point5
Feature 2point5
2 parents d0d8497 + 562adf9 commit c6face4

File tree

15 files changed

+248
-115
lines changed

15 files changed

+248
-115
lines changed

B737_AVL_Tutorial/tut_mission_B737_AVL.py

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@
88

99
# SUAVE Imports
1010
import SUAVE
11+
if not SUAVE.__version__=='2.5.0':
12+
assert('These tutorials only work with the SUAVE 2.5.0 release')
13+
1114
from SUAVE.Core import Data, Units
12-
from SUAVE.Plots.Mission_Plots import *
15+
from SUAVE.Plots.Performance.Mission_Plots import *
1316
from SUAVE.Methods.Propulsion.turbofan_sizing import turbofan_sizing
1417
from SUAVE.Methods.Geometry.Two_Dimensional.Cross_Section.Propulsion import compute_turbofan_geometry
1518
from SUAVE.Input_Output.Results import print_parasite_drag, \
@@ -22,6 +25,8 @@
2225
import numpy as np
2326
import pylab as plt
2427

28+
from copy import deepcopy
29+
2530
# ----------------------------------------------------------------------
2631
# Main
2732
# ----------------------------------------------------------------------
@@ -116,15 +121,15 @@ def base_analysis(vehicle):
116121
# ------------------------------------------------------------------
117122
# Stability Analysis
118123
stability = SUAVE.Analyses.Stability.AVL()
119-
stability.settings.filenames.avl_bin_name = 'CHANGE ME TO YOUR DIRECTORY'
124+
stability.settings.filenames.avl_bin_name = 'CHANGE ME TO YOUR DIRECTORY'
120125
#stability.settings.spanwise_vortex_density = 3
121126
stability.geometry = vehicle
122127
analyses.append(stability)
123128

124129
# ------------------------------------------------------------------
125130
# Energy
126131
energy= SUAVE.Analyses.Energy.Energy()
127-
energy.network = vehicle.propulsors
132+
energy.network = vehicle.networks
128133
analyses.append(energy)
129134

130135
# ------------------------------------------------------------------
@@ -304,6 +309,30 @@ def vehicle_setup():
304309

305310
# add to vehicle
306311
vehicle.append_component(fuselage)
312+
313+
314+
# ------------------------------------------------------------------
315+
# Nacelles
316+
# ------------------------------------------------------------------
317+
nacelle = SUAVE.Components.Nacelles.Nacelle()
318+
nacelle.tag = 'nacelle_1'
319+
nacelle.length = 2.71
320+
nacelle.inlet_diameter = 1.90
321+
nacelle.diameter = 2.05
322+
nacelle.areas.wetted = 1.1*np.pi*nacelle.diameter*nacelle.length
323+
nacelle.origin = [[13.72, -4.86,-1.9]]
324+
nacelle.flow_through = True
325+
nacelle_airfoil = SUAVE.Components.Airfoils.Airfoil()
326+
nacelle_airfoil.naca_4_series_airfoil = '2410'
327+
nacelle.append_airfoil(nacelle_airfoil)
328+
329+
nacelle_2 = deepcopy(nacelle)
330+
nacelle_2.tag = 'nacelle_2'
331+
nacelle_2.origin = [[13.72, 4.86,-1.9]]
332+
333+
vehicle.append_component(nacelle)
334+
vehicle.append_component(nacelle_2)
335+
307336

308337
# ------------------------------------------------------------------
309338
# Turbofan Network
@@ -316,13 +345,8 @@ def vehicle_setup():
316345
# setup
317346
turbofan.number_of_engines = 2
318347
turbofan.bypass_ratio = 5.4
319-
turbofan.engine_length = 2.71 * Units.meter
320-
turbofan.nacelle_diameter = 2.05 * Units.meter
321348
turbofan.origin = [[13.72, 4.86,-1.9],[13.72, -4.86,-1.9]]
322349

323-
#compute engine areas
324-
turbofan.areas.wetted = 1.1*np.pi*turbofan.nacelle_diameter*turbofan.engine_length
325-
326350
# working fluid
327351
turbofan.working_fluid = SUAVE.Attributes.Gases.Air()
328352

BWB_CFD/BWB.py

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
# ----------------------------------------------------------------------
99

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

1214
import numpy as np
1315
import pylab as plt
@@ -19,8 +21,12 @@
1921

2022
from SUAVE.Methods.Propulsion.turbofan_sizing import turbofan_sizing
2123
from SUAVE.Methods.Geometry.Two_Dimensional.Cross_Section.Propulsion import compute_turbofan_geometry
24+
from SUAVE.Methods.Geometry.Two_Dimensional.Planform import segment_properties
25+
26+
from SUAVE.Plots.Performance.Mission_Plots import *
27+
28+
from copy import deepcopy
2229

23-
from SUAVE.Plots.Mission_Plots import *
2430

2531
# ----------------------------------------------------------------------
2632
# Main
@@ -151,7 +157,7 @@ def base_analysis(vehicle):
151157
# ------------------------------------------------------------------
152158
# Energy
153159
energy= SUAVE.Analyses.Energy.Energy()
154-
energy.network = vehicle.propulsors
160+
energy.network = vehicle.networks
155161
analyses.append(energy)
156162

157163
# ------------------------------------------------------------------
@@ -325,9 +331,23 @@ def vehicle_setup():
325331
segment.sweeps.quarter_chord = 0. * Units.degrees
326332
segment.thickness_to_chord = 0.10
327333
wing.Segments.append(segment)
334+
335+
# Fill out more segment properties automatically
336+
wing = segment_properties(wing)
328337

329338
# add to vehicle
330339
vehicle.append_component(wing)
340+
341+
# ------------------------------------------------------------------
342+
# Nacelle
343+
# ------------------------------------------------------------------
344+
nacelle = SUAVE.Components.Nacelles.Nacelle()
345+
nacelle.diameter = 3.96 * Units.meters
346+
nacelle.length = 289. * Units.inches
347+
nacelle.tag = 'nacelle'
348+
nacelle.origin = [[123.0 *Units.feet, 25.0*Units.feet, 6.5*Units.feet]]
349+
nacelle.Airfoil.naca_4_series_airfoil = '0012'
350+
331351

332352
# ------------------------------------------------------------------
333353
# Turbofan Network
@@ -339,9 +359,6 @@ def vehicle_setup():
339359
# setup
340360
turbofan.number_of_engines = 3.0
341361
turbofan.bypass_ratio = 8.1
342-
turbofan.engine_length = 289. * Units.inches
343-
turbofan.nacelle_diameter = 3.96 * Units.meters
344-
#turbofan.cooling_ratio = 1.0
345362
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]]
346363

347364
# working fluid
@@ -481,19 +498,31 @@ def vehicle_setup():
481498
#design sizing conditions
482499
altitude = 0. * Units.km
483500
mach_number = 0.01
484-
isa_deviation = 0.
485501

486502
# add to network
487503
turbofan.thrust = thrust
488504

489505
#size the turbofan
490506
turbofan_sizing(turbofan,mach_number,altitude)
491-
#turbofan.size(mach_number,altitude)
492507

493508
#computing the engine length and diameter
494-
compute_turbofan_geometry(turbofan,None)
509+
compute_turbofan_geometry(turbofan,nacelle)
495510

496511
vehicle.append_component(turbofan)
512+
513+
# Finish adding all the nacelles
514+
515+
nacelle_2 = deepcopy(nacelle)
516+
nacelle_2.tag = 'nacelle_2'
517+
nacelle_2.origin = [[135.0 *Units.feet, 0.0*Units.feet, 6.5*Units.feet]]
518+
519+
nacelle_3 = deepcopy(nacelle)
520+
nacelle_3.tag = 'nacelle_3'
521+
nacelle_3.origin = [[123.0 *Units.feet, -25.0*Units.feet, 6.5*Units.feet]]
522+
523+
vehicle.append_component(nacelle)
524+
vehicle.append_component(nacelle_2)
525+
vehicle.append_component(nacelle_3)
497526

498527

499528
# ------------------------------------------------------------------

Regional_Jet_Optimization/Optimize.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
# ----------------------------------------------------------------------
99

1010
import SUAVE
11+
if not SUAVE.__version__=='2.5.0':
12+
assert('These tutorials only work with the SUAVE 2.5.0 release')
1113
from SUAVE.Core import Units, Data
1214
import numpy as np
1315
import Vehicles

Regional_Jet_Optimization/Plot_Mission.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import SUAVE
1111
from SUAVE.Core import Units
12-
from SUAVE.Plots.Mission_Plots import *
12+
from SUAVE.Plots.Performance.Mission_Plots import *
1313
import pylab as plt
1414

1515
# ----------------------------------------------------------------------

Regional_Jet_Optimization/Vehicles.py

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
from SUAVE.Methods.Propulsion.turbofan_sizing import turbofan_sizing
1515
from SUAVE.Methods.Geometry.Two_Dimensional.Planform import wing_planform
1616

17+
from copy import deepcopy
18+
1719
# ----------------------------------------------------------------------
1820
# Define the Vehicle
1921
# ----------------------------------------------------------------------
@@ -196,33 +198,45 @@ def base_setup():
196198

197199
# add to vehicle
198200
vehicle.append_component(fuselage)
201+
202+
203+
204+
# -----------------------------------------------------------------
205+
# Design the Nacelle
206+
# -----------------------------------------------------------------
207+
nacelle = SUAVE.Components.Nacelles.Nacelle()
208+
nacelle.diameter = 2.05
209+
nacelle.length = 2.71
210+
nacelle.tag = 'nacelle_1'
211+
nacelle.inlet_diameter = 2.0
212+
nacelle.origin = [[12.0,4.38,-2.1]]
213+
Awet = 1.1*np.pi*nacelle.diameter*nacelle.length # 1.1 is simple coefficient
214+
nacelle.areas.wetted = Awet
215+
nacelle_airfoil = SUAVE.Components.Airfoils.Airfoil()
216+
nacelle_airfoil.naca_4_series_airfoil = '2410'
217+
nacelle.append_airfoil(nacelle_airfoil)
218+
219+
nacelle_2 = deepcopy(nacelle)
220+
nacelle_2.tag = 'nacelle_2'
221+
nacelle_2.origin = [[12.0,-4.38,-2.1]]
222+
223+
vehicle.append_component(nacelle)
224+
vehicle.append_component(nacelle_2)
225+
199226

200227
# ------------------------------------------------------------------
201228
# Turbofan Network
202229
# ------------------------------------------------------------------
203230

204-
205231
#initialize the gas turbine network
206232
gt_engine = SUAVE.Components.Energy.Networks.Turbofan()
207233
gt_engine.tag = 'turbofan'
208234
gt_engine.origin = [[12.0,4.38,-2.1],[12.0,-4.38,-2.1]]
209235
gt_engine.number_of_engines = 2.0
210236
gt_engine.bypass_ratio = 5.4
211-
gt_engine.engine_length = 2.71
212-
gt_engine.nacelle_diameter = 2.05
213-
gt_engine.inlet_diameter = 2.0
214-
215-
#compute engine areas)
216-
Awet = 1.1*np.pi*gt_engine.nacelle_diameter*gt_engine.engine_length # 1.1 is simple coefficient
217-
218-
#Assign engine area
219-
gt_engine.areas.wetted = Awet
220-
221-
#set the working fluid for the network
222-
working_fluid = SUAVE.Attributes.Gases.Air()
223237

224238
#add working fluid to the network
225-
gt_engine.working_fluid = working_fluid
239+
gt_engine.working_fluid = SUAVE.Attributes.Gases.Air()
226240

227241

228242
#Component 1 : ram, to convert freestream static to stagnation quantities
@@ -332,6 +346,7 @@ def base_setup():
332346
fuel.mass_properties.mass = vehicle.mass_properties.max_takeoff-vehicle.mass_properties.max_fuel
333347
fuel.origin = vehicle.wings.main_wing.mass_properties.center_of_gravity
334348
fuel.mass_properties.center_of_gravity= vehicle.wings.main_wing.aerodynamic_center
349+
335350
# ------------------------------------------------------------------
336351
# Vehicle Definition Complete
337352
# ------------------------------------------------------------------

Solar_UAV_Optimization/Analyses.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def base(vehicle):
6666
# Energy
6767
# ------------------------------------------------------------------
6868
energy = SUAVE.Analyses.Energy.Energy()
69-
energy.network = vehicle.propulsors
69+
energy.network = vehicle.networks
7070
analyses.append(energy)
7171

7272
# ------------------------------------------------------------------

Solar_UAV_Optimization/Missions.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,15 @@ def mission(analyses,vehicle):
5555
segment.analyses.extend(analyses.base)
5656

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

6869
mission.append_segment(segment)

Solar_UAV_Optimization/Optimize.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
# Imports
88
# ----------------------------------------------------------------------
99

10+
import SUAVE
11+
if not SUAVE.__version__=='2.5.0':
12+
assert('These tutorials only work with the SUAVE 2.5.0 release')
13+
1014
from SUAVE.Core import Units, Data
1115
import numpy as np
1216
import Vehicles
@@ -88,9 +92,9 @@ def setup():
8892
[ 'wing_area' ,['vehicle_configurations.*.wings.main_wing.areas.reference',
8993
'vehicle_configurations.base.reference_area'] ],
9094
[ 'aspect_ratio' , 'vehicle_configurations.*.wings.main_wing.aspect_ratio' ],
91-
[ 'kv' , 'vehicle_configurations.*.propulsors.solar_low_fidelity.motor.speed_constant' ],
92-
[ 'battery_mass' , 'vehicle_configurations.base.propulsors.solar_low_fidelity.battery.mass_properties.mass'],
93-
[ 'solar_ratio' , 'vehicle_configurations.*.propulsors.solar_low_fidelity.solar_panel.ratio' ],
95+
[ 'kv' , 'vehicle_configurations.*.networks.solar_low_fidelity.motor.speed_constant' ],
96+
[ 'battery_mass' , 'vehicle_configurations.base.networks.solar_low_fidelity.battery.mass_properties.mass'],
97+
[ 'solar_ratio' , 'vehicle_configurations.*.networks.solar_low_fidelity.solar_panel.ratio' ],
9498
[ 'dynamic_pressure' , 'missions.mission.segments.cruise.dynamic_pressure' ],
9599
[ 'Nothing' , 'summary.nothing' ],
96100
[ 'energy_constraint', 'summary.energy_constraint' ],

Solar_UAV_Optimization/Plot_Mission.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# Imports
88
# ----------------------------------------------------------------------
99

10-
from SUAVE.Plots.Mission_Plots import *
10+
from SUAVE.Plots.Performance.Mission_Plots import *
1111
from SUAVE.Core import Units
1212
import pylab as plt
1313

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

2222
# Plot Aircraft Electronics
23-
plot_electronic_conditions(results)
23+
plot_battery_pack_conditions(results)
2424

2525
return
2626

0 commit comments

Comments
 (0)