Skip to content

Commit f4d2660

Browse files
committed
fixed sweep definition in the tutorial
1 parent 060e1eb commit f4d2660

File tree

3 files changed

+27
-24
lines changed

3 files changed

+27
-24
lines changed

Regional_Jet_Optimization/Optimize.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ def main():
3434
problem.optimization_problem.inputs[:,1] = scaled_inputs
3535
'''
3636

37-
37+
#optimize
3838
#output = scipy_setup.SciPy_Solve(problem,solver='SLSQP')
3939
#print output
40-
40+
4141

42-
variable_sweep(problem) #uncomment this to view some contours of the problem
42+
#variable_sweep(problem) #uncomment this to view some contours of the problem
4343
print 'fuel burn=', problem.summary.base_mission_fuelburn
4444
print 'fuel margin=', problem.all_constraints()
4545

@@ -150,7 +150,7 @@ def setup():
150150
return nexus
151151

152152
def variable_sweep(problem):
153-
number_of_points=20
153+
number_of_points = 5
154154
outputs=carpet_plot(problem, number_of_points, 0, 0) #run carpet plot, suppressing default plots
155155
inputs =outputs.inputs
156156
objective=outputs.objective

Regional_Jet_Optimization/Procedure.py

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def design_mission(nexus):
104104
def simple_sizing(nexus):
105105
configs=nexus.vehicle_configurations
106106
base=configs.base
107-
107+
108108
#find conditions
109109
air_speed = nexus.missions.base.segments['cruise'].air_speed
110110
altitude = nexus.missions.base.segments['climb_5'].altitude_end
@@ -163,10 +163,11 @@ def simple_sizing(nexus):
163163
# Landing CL_max
164164
altitude = nexus.missions.base.segments[-1].altitude_end
165165
atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976()
166-
p, T, rho, a, mu = atmosphere.compute_values(altitude)
166+
freestream_landing = atmosphere.compute_values(0.)
167+
#p, T, rho, a, mu = atmosphere.compute_values(0.)
167168
landing_conditions.freestream.velocity = nexus.missions.base.segments['descent_3'].air_speed
168-
landing_conditions.freestream.density = rho
169-
landing_conditions.freestream.dynamic_viscosity = mu/rho
169+
landing_conditions.freestream.density = freestream_landing.density
170+
landing_conditions.freestream.dynamic_viscosity = freestream_landing.dynamic_viscosity
170171
CL_max_landing,CDi = compute_max_lift_coeff(landing,landing_conditions)
171172
landing.maximum_lift_coefficient = CL_max_landing
172173
# diff the new data
@@ -178,11 +179,12 @@ def simple_sizing(nexus):
178179
takeoff_conditions = Data()
179180
takeoff_conditions.freestream = Data()
180181
altitude = nexus.missions.base.airport.altitude
181-
atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976()
182-
p, T, rho, a, mu = atmosphere.compute_values(altitude)
182+
freestream_takeoff = atmosphere.compute_values(altitude)
183+
184+
#p, T, rho, a, mu = atmosphere.compute_values(altitude)
183185
takeoff_conditions.freestream.velocity = nexus.missions.base.segments.climb_1.air_speed
184-
takeoff_conditions.freestream.density = rho
185-
takeoff_conditions.freestream.dynamic_viscosity = mu/rho
186+
takeoff_conditions.freestream.density = freestream_takeoff.density
187+
takeoff_conditions.freestream.dynamic_viscosity = freestream_takeoff.dynamic_viscosity
186188
max_CL_takeoff,CDi = compute_max_lift_coeff(takeoff,takeoff_conditions)
187189
takeoff.maximum_lift_coefficient = max_CL_takeoff
188190

@@ -193,13 +195,7 @@ def simple_sizing(nexus):
193195
#Base config CL_max
194196
base = nexus.vehicle_configurations.base
195197
base_conditions = Data()
196-
base_conditions.freestream = Data()
197-
altitude = nexus.missions.base.airport.altitude
198-
atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976()
199-
p, T, rho, a, mu = atmosphere.compute_values(altitude)
200-
base_conditions.freestream.velocity = nexus.missions.base.segments.climb_1.air_speed
201-
base_conditions.freestream.density = rho
202-
base_conditions.freestream.dynamic_viscosity = mu/rho
198+
base_conditions.freestream = takeoff_conditions.freestream
203199
max_CL_base,CDi = compute_max_lift_coeff(base,base_conditions)
204200
base.maximum_lift_coefficient = max_CL_base
205201
base.store_diff()
@@ -225,6 +221,7 @@ def weight(nexus):
225221

226222

227223
weights = nexus.analyses.cruise.weights.evaluate()
224+
vehicle.mass_properties.breakdown = weights
228225
weights = nexus.analyses.landing.weights.evaluate()
229226
weights = nexus.analyses.takeoff.weights.evaluate()
230227
weights = nexus.analyses.short_field_takeoff.weights.evaluate()
@@ -235,6 +232,7 @@ def weight(nexus):
235232
#config.mass_properties.max_zero_fuel = empty_weight+passenger_weight
236233
config.mass_properties.zero_fuel_center_of_gravity = vehicle.mass_properties.zero_fuel_center_of_gravity
237234
config.fuel = vehicle.fuel
235+
238236
return nexus
239237

240238

@@ -257,7 +255,13 @@ def finalize(nexus):
257255
def post_process(nexus):
258256

259257
# Unpack data
260-
vehicle = nexus.vehicle_configurations.base
258+
vehicle = nexus.vehicle_configurations.base
259+
260+
'''
261+
print 'base.mass_properties.takeoff = ', vehicle.mass_properties.takeoff
262+
print 'takeoff.mass_properties.takeoff = ', nexus.vehicle_configurations.takeoff.mass_properties.takeoff
263+
print 'vehicle.mass_properties.empty = ', vehicle.mass_properties.operating_empty
264+
'''
261265
results = nexus.results
262266
summary = nexus.summary
263267
missions = nexus.missions
@@ -284,7 +288,6 @@ def post_process(nexus):
284288
summary.max_throttle = max_throttle
285289

286290
# Fuel margin and base fuel calculations
287-
288291
operating_empty = vehicle.mass_properties.operating_empty
289292
payload = vehicle.passenger_weights.mass_properties.mass
290293
design_landing_weight = results.base.segments[-1].conditions.weights.total_mass[-1]

Regional_Jet_Optimization/Vehicles.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def base_setup():
6666
wing.tag = 'main_wing'
6767

6868
wing.aspect_ratio = 8.4
69-
wing.sweep = 23.0 * Units.deg
69+
wing.sweeps.quarter_chord = 23.0 * Units.deg
7070
wing.thickness_to_chord = 0.11
7171
wing.taper = 0.28
7272
wing.span_efficiency = 1.0
@@ -108,7 +108,7 @@ def base_setup():
108108
wing.tag = 'horizontal_stabilizer'
109109

110110
wing.aspect_ratio = 5.5
111-
wing.sweep = 34.5 * Units.deg
111+
wing.sweeps.quarter_chord = 34.5 * Units.deg
112112
wing.thickness_to_chord = 0.11
113113
wing.taper = 0.11
114114
wing.span_efficiency = 0.9
@@ -146,7 +146,7 @@ def base_setup():
146146
wing.tag = 'vertical_stabilizer'
147147

148148
wing.aspect_ratio = 1.7 #
149-
wing.sweep = 35 * Units.deg
149+
wing.sweeps.quarter_chord = 35 * Units.deg
150150
wing.thickness_to_chord = 0.11
151151
wing.taper = 0.31
152152
wing.span_efficiency = 0.9

0 commit comments

Comments
 (0)