Skip to content

Commit 35688c9

Browse files
committed
updates to regional jet opt script
1 parent b3be1a6 commit 35688c9

File tree

6 files changed

+42
-37
lines changed

6 files changed

+42
-37
lines changed

Regional_Jet_Optimization/Analyses.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,11 @@ def setup(configs):
2020
# build a base analysis for each config
2121
for tag,config in configs.items():
2222
analysis = base(config)
23+
if tag == 'cruise_spoilers':
24+
analysis.aerodynamics.settings.spoiler_drag_increment = 0.005
2325
analyses[tag] = analysis
2426

27+
2528
return analyses
2629

2730
# ----------------------------------------------------------------------

Regional_Jet_Optimization/Missions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def base(analyses):
210210
segment.tag = "descent_2"
211211

212212
# connect vehicle configuration
213-
segment.analyses.extend( analyses.cruise )
213+
segment.analyses.extend( analyses.cruise_spoilers )
214214

215215
# segment attributes
216216
segment.atmosphere = atmosphere

Regional_Jet_Optimization/Optimize.py

Lines changed: 25 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,27 @@
2323
# ----------------------------------------------------------------------
2424
def main():
2525
problem = setup()
26-
output = problem.objective()
27-
#uncomment these lines when you want to start an optimization problem from a different initial guess
28-
'''
29-
inputs = [1.28, 1.38]
30-
scaling = problem.optimization_problem.inputs[:,3] #have to rescale inputs to start problem from here
31-
scaled_inputs = np.multiply(inputs,scaling)
32-
problem.optimization_problem.inputs[:,1] = scaled_inputs
33-
'''
34-
35-
#optimize
26+
27+
## Base Input Values
28+
#output = problem.objective()
29+
30+
## Uncomment to view contours of the design space
31+
#variable_sweep(problem)
32+
33+
## Uncomment for the first optimization
3634
#output = scipy_setup.SciPy_Solve(problem,solver='SLSQP')
37-
#print output
38-
35+
#print output
3936

40-
#variable_sweep(problem) #uncomment this to view some contours of the problem
37+
## Uncomment these lines when you want to start an optimization problem from a different initial guess
38+
#inputs = [1.28, 1.38]
39+
#scaling = problem.optimization_problem.inputs[:,3] #have to rescale inputs to start problem from here
40+
#scaled_inputs = np.multiply(inputs,scaling)
41+
#problem.optimization_problem.inputs[:,1] = scaled_inputs
42+
4143
print 'fuel burn = ', problem.summary.base_mission_fuelburn
4244
print 'fuel margin = ', problem.all_constraints()
4345

44-
#Plot_Mission.plot_mission(problem)
46+
Plot_Mission.plot_mission(problem)
4547

4648
return
4749

@@ -126,34 +128,24 @@ def setup():
126128
return nexus
127129

128130
def variable_sweep(problem):
129-
number_of_points = 5
130-
outputs=carpet_plot(problem, number_of_points, 0, 0) #run carpet plot, suppressing default plots
131-
inputs =outputs.inputs
132-
objective=outputs.objective
133-
constraints=outputs.constraint_val
131+
number_of_points = 20
132+
outputs = carpet_plot(problem, number_of_points, 0, 0) #run carpet plot, suppressing default plots
133+
inputs = outputs.inputs
134+
objective = outputs.objective
135+
constraints = outputs.constraint_val
134136
plt.figure(0)
135-
CS = plt.contourf(inputs[0,:],inputs[1,:], objective, 20, linewidths=2)
137+
CS = plt.contourf(inputs[0,:],inputs[1,:], objective, 20, linewidths=2)
136138
cbar = plt.colorbar(CS)
137139

138140
cbar.ax.set_ylabel('fuel burn (kg)')
139-
CS_const=plt.contour(inputs[0,:],inputs[1,:], constraints[0,:,:])
141+
CS_const = plt.contour(inputs[0,:],inputs[1,:], constraints[0,:,:])
140142
plt.clabel(CS_const, inline=1, fontsize=10)
141143
cbar = plt.colorbar(CS_const)
142144
cbar.ax.set_ylabel('fuel margin')
143145

144-
plt.xlabel('wing area (m^2)')
145-
plt.ylabel('cruise_altitude (km)')
146-
147-
#now plot optimization path (note that these data points were post-processed into a plottable format)
148-
'''
149-
opt_1 = plt.plot(wing_1, alt_1, label='optimization path 1')
150-
init_1 = plt.plot(wing_1[0], alt_1[0], 'ko')
151-
final_1 = plt.plot(wing_1[-1], alt_1[-1], 'kx')
146+
plt.xlabel('Wing Area (m^2)')
147+
plt.ylabel('Cruise Altitude (km)')
152148

153-
opt_2 = plt.plot(wing_2, alt_2, 'k--', label='optimization path 2')
154-
init_2 = plt.plot(wing_2[0], alt_2[0], 'ko', label= 'initial points')
155-
final_2 = plt.plot(wing_2[-1], alt_2[-1], 'kx', label= 'final points')
156-
'''
157149
plt.legend(loc='upper left')
158150
plt.show(block=True)
159151

Regional_Jet_Optimization/Plot_Mission.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# ----------------------------------------------------------------------
1818

1919
def plot_mission(nexus,line_style='bo-'):
20-
results=nexus.results
20+
results = nexus.results.base
2121
axis_font = {'fontname':'Arial', 'size':'14'}
2222

2323

@@ -54,7 +54,7 @@ def plot_mission(nexus,line_style='bo-'):
5454
# ------------------------------------------------------------------
5555
fig = plt.figure("Drag Components",figsize=(8,10))
5656
axes = plt.gca()
57-
for i, segment in enumerate(results.base.segments.values()):
57+
for i, segment in enumerate(results.segments.values()):
5858

5959
time = segment.conditions.frames.inertial.time[:,0] / Units.min
6060
drag_breakdown = segment.conditions.aerodynamics.drag_breakdown

Regional_Jet_Optimization/Vehicles.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,17 @@ def configs_setup(vehicle):
367367
configs.append(config)
368368

369369
config.maximum_lift_coefficient = 1.2
370+
371+
# ------------------------------------------------------------------
372+
# Cruise with Spoilers Configuration
373+
# ------------------------------------------------------------------
374+
375+
config = SUAVE.Components.Configs.Config(base_config)
376+
config.tag = 'cruise_spoilers'
377+
378+
configs.append(config)
379+
380+
config.maximum_lift_coefficient = 1.2
370381

371382

372383
# ------------------------------------------------------------------

Solar_UAV_Optimization/Vehicles.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ def base_setup():
7171
wing.twists.tip = 0.0 * Units.degrees
7272
wing.highlift = False
7373
wing.vertical = False
74-
wing.eta = 1.0
7574
wing.number_ribs = 26.
7675
wing.number_end_ribs = 2.
7776
wing.transition_x_upper = 0.6

0 commit comments

Comments
 (0)