Skip to content

Commit cf8d501

Browse files
committed
Updated tutorial scripts
1 parent e1425b0 commit cf8d501

4 files changed

Lines changed: 17 additions & 17 deletions

File tree

Regional_Jet_Optimization/Optimize.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,22 @@
2323
# Run the whole thing
2424
# ----------------------------------------------------------------------
2525
def main():
26+
import time
27+
t = time.time()
28+
2629
problem = setup()
2730

2831
## Base Input Values
2932
#output = problem.objective()
30-
import time
31-
t = time.time()
3233

33-
# Uncomment to view contours of the design space
34-
variable_sweep(problem)
34+
## Uncomment to view contours of the design space
35+
#variable_sweep(problem)
3536

36-
t_elapsed = time.time() - t
37-
38-
## Uncomment for the first optimization
39-
#output = scipy_setup.SciPy_Solve(problem,solver='SLSQP')
40-
#print (output)
37+
# Uncomment for the first optimization
38+
output = scipy_setup.SciPy_Solve(problem,solver='SLSQP')
39+
print (output)
4140

41+
t_elapsed = time.time() - t
4242
## Uncomment these lines when you want to start an optimization problem from a different initial guess
4343
#inputs = [1.28, 1.38]
4444
#scaling = problem.optimization_problem.inputs[:,3] #have to rescale inputs to start problem from here
@@ -70,8 +70,8 @@ def setup():
7070

7171
# [ tag , initial, lb,ub) , scaling , units ]
7272
problem.inputs = np.array([
73-
[ 'wing_area' , 100 , ( 90. , 130. ) , 100. , Units.meter**2],
74-
[ 'cruise_altitude' , 11 , ( 9 , 14. ) , 10. , Units.km],
73+
[ 'wing_area' , 90 , ( 90. , 130. ) , 100. , Units.meter**2],
74+
[ 'cruise_altitude' , 10 , ( 9 , 14. ) , 10. , Units.km],
7575
])
7676

7777
# -------------------------------------------------------------------

Regional_Jet_Optimization/Procedure.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,11 @@ def post_process(nexus):
253253

254254
# Fuel margin and base fuel calculations
255255
operating_empty = vehicle.mass_properties.operating_empty
256-
payload = vehicle.mass_properties.breakdown.payload
256+
payload = vehicle.mass_properties.breakdown.payload_breakdown
257257
design_landing_weight = results.base.segments[-1].conditions.weights.total_mass[-1]
258258
design_takeoff_weight = vehicle.mass_properties.takeoff
259259
max_takeoff_weight = nexus.vehicle_configurations.takeoff.mass_properties.max_takeoff
260-
zero_fuel_weight = payload+operating_empty
260+
zero_fuel_weight = vehicle.mass_properties.breakdown.zero_fuel_weight
261261

262262
summary.max_zero_fuel_margin = (design_landing_weight - zero_fuel_weight)/zero_fuel_weight
263263
summary.base_mission_fuelburn = design_takeoff_weight - results.base.segments['descent_3'].conditions.weights.total_mass[-1]

Solar_UAV_Optimization/Vehicles.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,12 @@ def base_setup():
171171
esc.efficiency = 0.95 # Gundlach for brushless motors
172172
net.esc = esc
173173

174-
# Component 5 the Propeller
174+
# Component 4 the Propeller
175175
prop = SUAVE.Components.Energy.Converters.Propeller_Lo_Fid()
176176
prop.propulsive_efficiency = 0.825
177177
net.propeller = prop
178178

179-
# Component 4 the Motor
179+
# Component 5 the Motor
180180
motor = SUAVE.Components.Energy.Converters.Motor_Lo_Fid()
181181
motor.speed_constant = 800. * Units['rpm/volt'] # RPM/volt is standard
182182
motor = size_from_kv(motor)

tut_solar_uav.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ def vehicle_setup():
242242
motor.no_load_current = 4.5 * Units.ampere
243243
motor.speed_constant = 120. * Units['rpm'] # RPM/volt converted to (rad/s)/volt
244244
motor.propeller_radius = prop.tip_radius
245-
motor.propeller_Cp = prop.power_coefficient
245+
motor.propeller_Cp = prop.design_power_coefficient
246246
motor.gear_ratio = 12. # Gear ratio
247247
motor.gearbox_efficiency = .98 # Gear box efficiency
248248
motor.expected_current = 160. # Expected current
@@ -396,7 +396,7 @@ def mission_setup(analyses,vehicle):
396396
base_segment.process.iterate.unknowns.network = vehicle.propulsors.solar.unpack_unknowns
397397
base_segment.process.iterate.residuals.network = vehicle.propulsors.solar.residuals
398398
base_segment.process.iterate.initials.initialize_battery = SUAVE.Methods.Missions.Segments.Common.Energy.initialize_battery
399-
base_segment.state.unknowns.propeller_power_coefficient = vehicle.propulsors.solar.propeller.power_coefficient * ones_row(1)/15.
399+
base_segment.state.unknowns.propeller_power_coefficient = vehicle.propulsors.solar.propeller.design_power_coefficient * ones_row(1)/15.
400400
base_segment.state.residuals.network = 0. * ones_row(1)
401401

402402
# ------------------------------------------------------------------

0 commit comments

Comments
 (0)