@@ -53,30 +53,30 @@ def setup():
53
53
54
54
def find_target_range (nexus ,mission ):
55
55
56
- segments = mission .segments
57
- cruise_altitude = mission .segments ['climb_5' ].altitude_end
58
- climb_1 = segments ['climb_1' ]
59
- climb_2 = segments ['climb_2' ]
60
- climb_3 = segments ['climb_3' ]
61
- climb_4 = segments ['climb_4' ]
62
- climb_5 = segments ['climb_5' ]
56
+ segments = mission .segments
57
+ cruise_altitude = mission .segments ['climb_5' ].altitude_end
58
+ climb_1 = segments ['climb_1' ]
59
+ climb_2 = segments ['climb_2' ]
60
+ climb_3 = segments ['climb_3' ]
61
+ climb_4 = segments ['climb_4' ]
62
+ climb_5 = segments ['climb_5' ]
63
63
64
- descent_1 = segments ['descent_1' ]
65
- descent_2 = segments ['descent_2' ]
66
- descent_3 = segments ['descent_3' ]
64
+ descent_1 = segments ['descent_1' ]
65
+ descent_2 = segments ['descent_2' ]
66
+ descent_3 = segments ['descent_3' ]
67
67
68
- x_climb_1 = climb_1 .altitude_end / np .tan (np .arcsin (climb_1 .climb_rate / climb_1 .air_speed ))
69
- x_climb_2 = (climb_2 .altitude_end - climb_1 .altitude_end )/ np .tan (np .arcsin (climb_2 .climb_rate / climb_2 .air_speed ))
70
- x_climb_3 = (climb_3 .altitude_end - climb_2 .altitude_end )/ np .tan (np .arcsin (climb_3 .climb_rate / climb_3 .air_speed ))
71
- x_climb_4 = (climb_4 .altitude_end - climb_3 .altitude_end )/ np .tan (np .arcsin (climb_4 .climb_rate / climb_4 .air_speed ))
72
- x_climb_5 = (climb_5 .altitude_end - climb_4 .altitude_end )/ np .tan (np .arcsin (climb_5 .climb_rate / climb_5 .air_speed ))
73
- x_descent_1 = (climb_5 .altitude_end - descent_1 .altitude_end )/ np .tan (np .arcsin (descent_1 .descent_rate / descent_1 .air_speed ))
74
- x_descent_2 = (descent_1 .altitude_end - descent_2 .altitude_end )/ np .tan (np .arcsin (descent_2 .descent_rate / descent_2 .air_speed ))
75
- x_descent_3 = (descent_2 .altitude_end - descent_3 .altitude_end )/ np .tan (np .arcsin (descent_3 .descent_rate / descent_3 .air_speed ))
76
-
77
- cruise_range = mission .design_range - (x_climb_1 + x_climb_2 + x_climb_3 + x_climb_4 + x_climb_5 + x_descent_1 + x_descent_2 + x_descent_3 )
68
+ x_climb_1 = climb_1 .altitude_end / np .tan (np .arcsin (climb_1 .climb_rate / climb_1 .air_speed ))
69
+ x_climb_2 = (climb_2 .altitude_end - climb_1 .altitude_end )/ np .tan (np .arcsin (climb_2 .climb_rate / climb_2 .air_speed ))
70
+ x_climb_3 = (climb_3 .altitude_end - climb_2 .altitude_end )/ np .tan (np .arcsin (climb_3 .climb_rate / climb_3 .air_speed ))
71
+ x_climb_4 = (climb_4 .altitude_end - climb_3 .altitude_end )/ np .tan (np .arcsin (climb_4 .climb_rate / climb_4 .air_speed ))
72
+ x_climb_5 = (climb_5 .altitude_end - climb_4 .altitude_end )/ np .tan (np .arcsin (climb_5 .climb_rate / climb_5 .air_speed ))
73
+ x_descent_1 = (climb_5 .altitude_end - descent_1 .altitude_end )/ np .tan (np .arcsin (descent_1 .descent_rate / descent_1 .air_speed ))
74
+ x_descent_2 = (descent_1 .altitude_end - descent_2 .altitude_end )/ np .tan (np .arcsin (descent_2 .descent_rate / descent_2 .air_speed ))
75
+ x_descent_3 = (descent_2 .altitude_end - descent_3 .altitude_end )/ np .tan (np .arcsin (descent_3 .descent_rate / descent_3 .air_speed ))
76
+
77
+ cruise_range = mission .design_range - (x_climb_1 + x_climb_2 + x_climb_3 + x_climb_4 + x_climb_5 + x_descent_1 + x_descent_2 + x_descent_3 )
78
78
79
- segments ['cruise' ].distance = cruise_range
79
+ segments ['cruise' ].distance = cruise_range
80
80
81
81
return nexus
82
82
@@ -151,9 +151,9 @@ def simple_sizing(nexus):
151
151
landing .mass_properties .landing = 0.85 * config .mass_properties .takeoff
152
152
153
153
# Landing CL_max
154
- altitude = nexus .missions .base .segments [- 1 ].altitude_end
154
+ altitude = nexus .missions .base .segments [- 1 ].altitude_end
155
155
atmosphere = SUAVE .Analyses .Atmospheric .US_Standard_1976 ()
156
- freestream_landing = atmosphere .compute_values (0. )
156
+ freestream_landing = atmosphere .compute_values (0. )
157
157
landing_conditions .freestream .velocity = nexus .missions .base .segments ['descent_3' ].air_speed
158
158
landing_conditions .freestream .density = freestream_landing .density
159
159
landing_conditions .freestream .dynamic_viscosity = freestream_landing .dynamic_viscosity
@@ -165,19 +165,19 @@ def simple_sizing(nexus):
165
165
takeoff_conditions = Data ()
166
166
takeoff_conditions .freestream = Data ()
167
167
altitude = nexus .missions .base .airport .altitude
168
- freestream_takeoff = atmosphere .compute_values (altitude )
168
+ freestream_takeoff = atmosphere .compute_values (altitude )
169
169
170
170
takeoff_conditions .freestream .velocity = nexus .missions .base .segments .climb_1 .air_speed
171
171
takeoff_conditions .freestream .density = freestream_takeoff .density
172
172
takeoff_conditions .freestream .dynamic_viscosity = freestream_takeoff .dynamic_viscosity
173
- max_CL_takeoff ,CDi = compute_max_lift_coeff (takeoff ,takeoff_conditions )
173
+ max_CL_takeoff , CDi = compute_max_lift_coeff (takeoff ,takeoff_conditions )
174
174
takeoff .maximum_lift_coefficient = max_CL_takeoff
175
175
176
176
#Base config CL_max
177
177
base = nexus .vehicle_configurations .base
178
178
base_conditions = Data ()
179
179
base_conditions .freestream = takeoff_conditions .freestream
180
- max_CL_base ,CDi = compute_max_lift_coeff (base ,base_conditions )
180
+ max_CL_base , CDi = compute_max_lift_coeff (base ,base_conditions )
181
181
base .maximum_lift_coefficient = max_CL_base
182
182
183
183
return nexus
@@ -191,21 +191,14 @@ def weight(nexus):
191
191
192
192
# weight analysis
193
193
weights = nexus .analyses .base .weights .evaluate ()
194
-
195
- '''
196
- compute_component_centers_of_gravity(vehicle)
197
- nose_load_fraction=.06
198
- compute_aircraft_center_of_gravity(vehicle,nose_load_fraction)
199
- '''
200
-
201
194
weights = nexus .analyses .cruise .weights .evaluate ()
202
195
vehicle .mass_properties .breakdown = weights
203
196
weights = nexus .analyses .landing .weights .evaluate ()
204
197
weights = nexus .analyses .takeoff .weights .evaluate ()
205
198
weights = nexus .analyses .short_field_takeoff .weights .evaluate ()
206
199
207
- empty_weight = vehicle .mass_properties .operating_empty
208
- passenger_weight = vehicle .passenger_weights .mass_properties .mass
200
+ empty_weight = vehicle .mass_properties .operating_empty
201
+ passenger_weight = vehicle .passenger_weights .mass_properties .mass
209
202
for config in nexus .vehicle_configurations :
210
203
config .mass_properties .zero_fuel_center_of_gravity = vehicle .mass_properties .zero_fuel_center_of_gravity
211
204
config .fuel = vehicle .fuel
@@ -230,27 +223,21 @@ def post_process(nexus):
230
223
231
224
# Unpack data
232
225
vehicle = nexus .vehicle_configurations .base
233
-
234
- '''
235
- print 'base.mass_properties.takeoff = ', vehicle.mass_properties.takeoff
236
- print 'takeoff.mass_properties.takeoff = ', nexus.vehicle_configurations.takeoff.mass_properties.takeoff
237
- print 'vehicle.mass_properties.empty = ', vehicle.mass_properties.operating_empty
238
- '''
239
226
results = nexus .results
240
227
summary = nexus .summary
241
228
missions = nexus .missions
242
229
nexus .total_number_of_iterations += 1
243
230
# Static stability calculations
244
231
CMA = - 10.
245
232
for segment in results .base .segments .values ():
246
- max_CMA = np .max (segment .conditions .stability .static .cm_alpha [:,0 ])
247
- if max_CMA > CMA :
248
- CMA = max_CMA
233
+ max_CMA = np .max (segment .conditions .stability .static .cm_alpha [:,0 ])
234
+ if max_CMA > CMA :
235
+ CMA = max_CMA
249
236
250
237
summary .static_stability = CMA
251
238
252
239
#throttle in design mission
253
- max_throttle = 0
240
+ max_throttle = 0
254
241
for segment in results .base .segments .values ():
255
242
max_segment_throttle = np .max (segment .conditions .propulsion .throttle [:,0 ])
256
243
if max_segment_throttle > max_throttle :
@@ -272,25 +259,5 @@ def post_process(nexus):
272
259
#when you run want to output results to a file
273
260
filename = 'results.txt'
274
261
write_optimization_outputs (nexus , filename )
275
- '''
276
- unscaled_inputs = nexus.optimization_problem.inputs[:,1] #use optimization problem inputs here
277
- input_scaling = nexus.optimization_problem.inputs[:,3]
278
- scaled_inputs = unscaled_inputs/input_scaling
279
- problem_inputs=[]
280
-
281
- for value in unscaled_inputs:
282
- problem_inputs.append(value)
283
- file=open('results.txt' , 'ab')
284
- file.write('iteration = ')
285
- file.write(str(nexus.iteration_number))
286
- file.write('fuel weight = ')
287
- file.write(str( summary.base_mission_fuelburn))
288
-
289
- file.write(', inputs = ')
290
- file.write(str(problem_inputs))
291
-
292
- file.write('\n ')
293
- file.close()
294
- '''
295
262
296
263
return nexus
0 commit comments