@@ -53,30 +53,30 @@ def setup():
5353
5454def find_target_range (nexus ,mission ):
5555
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' ]
6363
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' ]
6767
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 )
7878
79- segments ['cruise' ].distance = cruise_range
79+ segments ['cruise' ].distance = cruise_range
8080
8181 return nexus
8282
@@ -151,9 +151,9 @@ def simple_sizing(nexus):
151151 landing .mass_properties .landing = 0.85 * config .mass_properties .takeoff
152152
153153 # Landing CL_max
154- altitude = nexus .missions .base .segments [- 1 ].altitude_end
154+ altitude = nexus .missions .base .segments [- 1 ].altitude_end
155155 atmosphere = SUAVE .Analyses .Atmospheric .US_Standard_1976 ()
156- freestream_landing = atmosphere .compute_values (0. )
156+ freestream_landing = atmosphere .compute_values (0. )
157157 landing_conditions .freestream .velocity = nexus .missions .base .segments ['descent_3' ].air_speed
158158 landing_conditions .freestream .density = freestream_landing .density
159159 landing_conditions .freestream .dynamic_viscosity = freestream_landing .dynamic_viscosity
@@ -165,19 +165,19 @@ def simple_sizing(nexus):
165165 takeoff_conditions = Data ()
166166 takeoff_conditions .freestream = Data ()
167167 altitude = nexus .missions .base .airport .altitude
168- freestream_takeoff = atmosphere .compute_values (altitude )
168+ freestream_takeoff = atmosphere .compute_values (altitude )
169169
170170 takeoff_conditions .freestream .velocity = nexus .missions .base .segments .climb_1 .air_speed
171171 takeoff_conditions .freestream .density = freestream_takeoff .density
172172 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 )
174174 takeoff .maximum_lift_coefficient = max_CL_takeoff
175175
176176 #Base config CL_max
177177 base = nexus .vehicle_configurations .base
178178 base_conditions = Data ()
179179 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 )
181181 base .maximum_lift_coefficient = max_CL_base
182182
183183 return nexus
@@ -191,21 +191,14 @@ def weight(nexus):
191191
192192 # weight analysis
193193 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-
201194 weights = nexus .analyses .cruise .weights .evaluate ()
202195 vehicle .mass_properties .breakdown = weights
203196 weights = nexus .analyses .landing .weights .evaluate ()
204197 weights = nexus .analyses .takeoff .weights .evaluate ()
205198 weights = nexus .analyses .short_field_takeoff .weights .evaluate ()
206199
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
209202 for config in nexus .vehicle_configurations :
210203 config .mass_properties .zero_fuel_center_of_gravity = vehicle .mass_properties .zero_fuel_center_of_gravity
211204 config .fuel = vehicle .fuel
@@ -230,27 +223,21 @@ def post_process(nexus):
230223
231224 # Unpack data
232225 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- '''
239226 results = nexus .results
240227 summary = nexus .summary
241228 missions = nexus .missions
242229 nexus .total_number_of_iterations += 1
243230 # Static stability calculations
244231 CMA = - 10.
245232 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
249236
250237 summary .static_stability = CMA
251238
252239 #throttle in design mission
253- max_throttle = 0
240+ max_throttle = 0
254241 for segment in results .base .segments .values ():
255242 max_segment_throttle = np .max (segment .conditions .propulsion .throttle [:,0 ])
256243 if max_segment_throttle > max_throttle :
@@ -272,25 +259,5 @@ def post_process(nexus):
272259 #when you run want to output results to a file
273260 filename = 'results.txt'
274261 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- '''
295262
296263 return nexus
0 commit comments