Skip to content

Commit

Permalink
Updated tutorial scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
rachealerhard committed Dec 24, 2020
1 parent e1425b0 commit cf8d501
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
22 changes: 11 additions & 11 deletions Regional_Jet_Optimization/Optimize.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,22 @@
# Run the whole thing
# ----------------------------------------------------------------------
def main():
import time
t = time.time()

problem = setup()

## Base Input Values
#output = problem.objective()
import time
t = time.time()

# Uncomment to view contours of the design space
variable_sweep(problem)
## Uncomment to view contours of the design space
#variable_sweep(problem)

t_elapsed = time.time() - t

## Uncomment for the first optimization
#output = scipy_setup.SciPy_Solve(problem,solver='SLSQP')
#print (output)
# Uncomment for the first optimization
output = scipy_setup.SciPy_Solve(problem,solver='SLSQP')
print (output)

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

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

# -------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions Regional_Jet_Optimization/Procedure.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,11 @@ def post_process(nexus):

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

summary.max_zero_fuel_margin = (design_landing_weight - zero_fuel_weight)/zero_fuel_weight
summary.base_mission_fuelburn = design_takeoff_weight - results.base.segments['descent_3'].conditions.weights.total_mass[-1]
Expand Down
4 changes: 2 additions & 2 deletions Solar_UAV_Optimization/Vehicles.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,12 @@ def base_setup():
esc.efficiency = 0.95 # Gundlach for brushless motors
net.esc = esc

# Component 5 the Propeller
# Component 4 the Propeller
prop = SUAVE.Components.Energy.Converters.Propeller_Lo_Fid()
prop.propulsive_efficiency = 0.825
net.propeller = prop

# Component 4 the Motor
# Component 5 the Motor
motor = SUAVE.Components.Energy.Converters.Motor_Lo_Fid()
motor.speed_constant = 800. * Units['rpm/volt'] # RPM/volt is standard
motor = size_from_kv(motor)
Expand Down
4 changes: 2 additions & 2 deletions tut_solar_uav.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def vehicle_setup():
motor.no_load_current = 4.5 * Units.ampere
motor.speed_constant = 120. * Units['rpm'] # RPM/volt converted to (rad/s)/volt
motor.propeller_radius = prop.tip_radius
motor.propeller_Cp = prop.power_coefficient
motor.propeller_Cp = prop.design_power_coefficient
motor.gear_ratio = 12. # Gear ratio
motor.gearbox_efficiency = .98 # Gear box efficiency
motor.expected_current = 160. # Expected current
Expand Down Expand Up @@ -396,7 +396,7 @@ def mission_setup(analyses,vehicle):
base_segment.process.iterate.unknowns.network = vehicle.propulsors.solar.unpack_unknowns
base_segment.process.iterate.residuals.network = vehicle.propulsors.solar.residuals
base_segment.process.iterate.initials.initialize_battery = SUAVE.Methods.Missions.Segments.Common.Energy.initialize_battery
base_segment.state.unknowns.propeller_power_coefficient = vehicle.propulsors.solar.propeller.power_coefficient * ones_row(1)/15.
base_segment.state.unknowns.propeller_power_coefficient = vehicle.propulsors.solar.propeller.design_power_coefficient * ones_row(1)/15.
base_segment.state.residuals.network = 0. * ones_row(1)

# ------------------------------------------------------------------
Expand Down

0 comments on commit cf8d501

Please sign in to comment.