Skip to content

Commit 835bbc5

Browse files
committed
many tutorials fixes
1 parent e60deee commit 835bbc5

File tree

9 files changed

+33
-30
lines changed

9 files changed

+33
-30
lines changed

B737_AVL_Tutorial/tut_mission_B737_AVL.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,18 +113,15 @@ def base_analysis(vehicle):
113113
# ------------------------------------------------------------------
114114
# Aerodynamics Analysis
115115
aerodynamics = SUAVE.Analyses.Aerodynamics.AVL()
116-
#aerodynamics.process.compute.lift.inviscid.settings.filenames.avl_bin_name = 'CHANGE ME TO YOUR DIRECTORY'
117-
aerodynamics.process.compute.lift.inviscid.settings.filenames.avl_bin_name = '/Users/emiliobotero/Research/avl3.35'
116+
aerodynamics.process.compute.lift.inviscid.settings.filenames.avl_bin_name = 'CHANGE ME TO YOUR DIRECTORY'
118117
#aerodynamics.process.compute.lift.inviscid.settings.spanwise_vortex_density = 3
119118
aerodynamics.geometry = vehicle
120119
analyses.append(aerodynamics)
121120

122121
# ------------------------------------------------------------------
123122
# Stability Analysis
124123
stability = SUAVE.Analyses.Stability.AVL()
125-
#stability.settings.filenames.avl_bin_name = 'CHANGE ME TO YOUR DIRECTORY'
126-
stability.settings.filenames.avl_bin_name = '/Users/emiliobotero/Research/avl3.35'
127-
124+
stability.settings.filenames.avl_bin_name = 'CHANGE ME TO YOUR DIRECTORY'
128125
#stability.settings.spanwise_vortex_density = 3
129126
stability.geometry = vehicle
130127
analyses.append(stability)

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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ def mission(analyses,vehicle):
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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ def setup():
9292
[ 'wing_area' ,['vehicle_configurations.*.wings.main_wing.areas.reference',
9393
'vehicle_configurations.base.reference_area'] ],
9494
[ 'aspect_ratio' , 'vehicle_configurations.*.wings.main_wing.aspect_ratio' ],
95-
[ 'kv' , 'vehicle_configurations.*.propulsors.solar_low_fidelity.motor.speed_constant' ],
96-
[ 'battery_mass' , 'vehicle_configurations.base.propulsors.solar_low_fidelity.battery.mass_properties.mass'],
97-
[ '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' ],
9898
[ 'dynamic_pressure' , 'missions.mission.segments.cruise.dynamic_pressure' ],
9999
[ 'Nothing' , 'summary.nothing' ],
100100
[ 'energy_constraint', 'summary.energy_constraint' ],

Solar_UAV_Optimization/Plot_Mission.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

Solar_UAV_Optimization/Procedure.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from SUAVE.Core import Units
1313
from SUAVE.Analyses.Process import Process
1414
from SUAVE.Methods.Power.Battery.Sizing import initialize_from_mass
15+
from SUAVE.Methods.Power.Battery import append_initial_battery_conditions
1516
from SUAVE.Methods.Propulsion.electric_motor_sizing import size_from_kv
1617

1718
# ----------------------------------------------------------------------
@@ -97,14 +98,14 @@ def simple_sizing(nexus):
9798

9899
# Size solar panel area
99100
wing_area = vec.reference_area
100-
spanel = vec.propulsors.solar_low_fidelity.solar_panel
101+
spanel = vec.networks.solar_low_fidelity.solar_panel
101102
sratio = spanel.ratio
102103
solar_area = wing_area*sratio
103104
spanel.area = solar_area
104105
spanel.mass_properties.mass = solar_area*(0.60 * Units.kg)
105106

106107
# Resize the motor
107-
motor = vec.propulsors.solar_low_fidelity.motor
108+
motor = vec.networks.solar_low_fidelity.motor
108109
motor = size_from_kv(motor)
109110

110111
# diff the new data
@@ -123,23 +124,21 @@ def weights_battery(nexus):
123124
config.weights.evaluate()
124125

125126
vec = nexus.vehicle_configurations.base
126-
payload = vec.propulsors.solar_low_fidelity.payload.mass_properties.mass
127-
msolar = vec.propulsors.solar_low_fidelity.solar_panel.mass_properties.mass
127+
payload = vec.networks.solar_low_fidelity.payload.mass_properties.mass
128+
msolar = vec.networks.solar_low_fidelity.solar_panel.mass_properties.mass
128129
MTOW = vec.mass_properties.max_takeoff
129130
empty = vec.weight_breakdown.empty
130-
mmotor = vec.propulsors.solar_low_fidelity.motor.mass_properties.mass
131+
mmotor = vec.networks.solar_low_fidelity.motor.mass_properties.mass
132+
segment = nexus.missions.mission.segments.cruise
131133

132134
# Calculate battery mass
133135
batmass = MTOW - empty - payload - msolar -mmotor
134-
bat = vec.propulsors.solar_low_fidelity.battery
136+
bat = vec.networks.solar_low_fidelity.battery
135137
initialize_from_mass(bat,batmass)
136-
vec.propulsors.solar_low_fidelity.battery.mass_properties.mass = batmass
138+
vec.networks.solar_low_fidelity.battery.mass_properties.mass = batmass
137139

138140
# Set Battery Charge
139-
maxcharge = nexus.vehicle_configurations.base.propulsors.solar_low_fidelity.battery.max_energy
140-
charge = maxcharge
141-
142-
nexus.missions.mission.segments.cruise.battery_energy = charge
141+
append_initial_battery_conditions(segment, bat)
143142

144143
return nexus
145144

@@ -165,7 +164,7 @@ def post_process(nexus):
165164
res = nexus.results.mission.segments.cruise.conditions
166165

167166
# Final Energy
168-
maxcharge = vec.propulsors.solar_low_fidelity.battery.max_energy
167+
maxcharge = vec.networks.solar_low_fidelity.battery.max_energy
169168

170169
# Energy constraints, the battery doesn't go to zero anywhere, using a P norm
171170
p = 8.

Solar_UAV_Optimization/Vehicles.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,16 @@ def base_setup():
141141

142142
# add to vehicle
143143
vehicle.append_component(wing)
144+
145+
# ------------------------------------------------------------------
146+
# Nacelle
147+
# ------------------------------------------------------------------
148+
nacelle = SUAVE.Components.Nacelles.Nacelle()
149+
nacelle.diameter = 0.05 * Units.meters
150+
nacelle.length = 0.01 * Units.meters
151+
nacelle.tag = 'nacelle'
152+
nacelle.areas.wetted = nacelle.length *(2*np.pi*nacelle.diameter/2.)
153+
vehicle.append_component(nacelle)
144154

145155
#------------------------------------------------------------------
146156
# Propulsor
@@ -149,10 +159,6 @@ def base_setup():
149159
# build network
150160
net = Solar_Low_Fidelity()
151161
net.number_of_engines = 1.
152-
net.nacelle_diameter = 0.05
153-
net.areas = Data()
154-
net.areas.wetted = 0.01*(2*np.pi*0.01/2)
155-
net.engine_length = 0.01
156162

157163
# Component 1 the Sun
158164
sun = SUAVE.Components.Energy.Processes.Solar_Radiation()

tut_payload_range.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
# ----------------------------------------------------------------------
1010

1111
import SUAVE
12-
#if not SUAVE.__version__=='2.5.0':
13-
#assert('These tutorials only work with the SUAVE 2.5.0 release')
12+
if not SUAVE.__version__=='2.5.0':
13+
assert('These tutorials only work with the SUAVE 2.5.0 release')
1414
from SUAVE.Core import Units, Data
1515
from SUAVE.Methods.Propulsion.turbofan_sizing import turbofan_sizing
1616
from SUAVE.Methods.Performance import payload_range

tut_solar_uav.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
# Imports
88
# ----------------------------------------------------------------------
99
import SUAVE
10-
#if not SUAVE.__version__=='2.5.0':
11-
#assert('These tutorials only work with the SUAVE 2.5.0 release')
10+
if not SUAVE.__version__=='2.5.0':
11+
assert('These tutorials only work with the SUAVE 2.5.0 release')
1212
from SUAVE.Core import Units
1313

1414
import numpy as np

0 commit comments

Comments
 (0)