11# Optimize.py
22# Created: Feb 2016, M. Vegh
3- # Modified:
3+ # Modified: Aug 2017, E. Botero
44
55# ----------------------------------------------------------------------
66# Imports
1717import matplotlib .pyplot as plt
1818from SUAVE .Optimization import Nexus , carpet_plot
1919import SUAVE .Optimization .Package_Setups .scipy_setup as scipy_setup
20- #import VyPy
21- #import pyOpt
20+
2221# ----------------------------------------------------------------------
2322# Run the whole thing
2423# ----------------------------------------------------------------------
@@ -39,15 +38,13 @@ def main():
3938
4039
4140 #variable_sweep(problem) #uncomment this to view some contours of the problem
42- print 'fuel burn= ' , problem .summary .base_mission_fuelburn
43- print 'fuel margin= ' , problem .all_constraints ()
41+ print 'fuel burn = ' , problem .summary .base_mission_fuelburn
42+ print 'fuel margin = ' , problem .all_constraints ()
4443
4544 #Plot_Mission.plot_mission(problem)
4645
4746 return
4847
49-
50-
5148# ----------------------------------------------------------------------
5249# Inputs, Objective, & Constraints
5350# ----------------------------------------------------------------------
@@ -67,9 +64,7 @@ def setup():
6764 [ 'wing_area' , 95 , ( 90. , 130. ) , 100. , Units .meter ** 2 ],
6865 [ 'cruise_altitude' , 11 , ( 9 , 14. ) , 10. , Units .km ],
6966 ])
70-
71-
72-
67+
7368 # -------------------------------------------------------------------
7469 # Objective
7570 # -------------------------------------------------------------------
@@ -80,7 +75,6 @@ def setup():
8075 [ 'fuel_burn' , 10000 , Units .kg ]
8176 ])
8277
83-
8478 # -------------------------------------------------------------------
8579 # Constraints
8680 # -------------------------------------------------------------------
@@ -103,39 +97,22 @@ def setup():
10397 [ 'fuel_burn' , 'summary.base_mission_fuelburn' ],
10498 [ 'design_range_fuel_margin' , 'summary.max_zero_fuel_margin' ],
10599 ]
106- '''
107- #TASOPT imports
108- from mission_B737_TASOPT import full_setup, mission_setup
109-
110- configs, analyses = full_setup()
111- nexus.vehicle_configurations = configs
112- nexus.analyses = analyses
113- nexus.mission = analyses.mission
114- #nexus.mission = mission_setup(nexus.analyses)
115- '''
116-
117100
118101 # -------------------------------------------------------------------
119102 # Vehicles
120103 # -------------------------------------------------------------------
121-
122- #import Vehicle_TASOPT
123- #nexus.vehicle_configurations = Vehicle_TASOPT.setup()
124104 nexus .vehicle_configurations = Vehicles .setup ()
125105
126-
127106 # -------------------------------------------------------------------
128107 # Analyses
129108 # -------------------------------------------------------------------
130109 nexus .analyses = Analyses .setup (nexus .vehicle_configurations )
131110
132-
133111 # -------------------------------------------------------------------
134112 # Missions
135113 # -------------------------------------------------------------------
136114 nexus .missions = Missions .setup (nexus .analyses )
137115
138-
139116 # -------------------------------------------------------------------
140117 # Procedure
141118 # -------------------------------------------------------------------
@@ -164,27 +141,10 @@ def variable_sweep(problem):
164141 cbar = plt .colorbar (CS_const )
165142 cbar .ax .set_ylabel ('fuel margin' )
166143
167-
168-
169144 plt .xlabel ('wing area (m^2)' )
170145 plt .ylabel ('cruise_altitude (km)' )
171146
172-
173- wing_1 = np .array ([ 0.95 , 0.9500000149011611 , 0.95 , 0.95 , 0.9500000149011611 , 0.95 , 0.95 , 0.9500000149011611 , 0.95 , 1.0830895945429801 , 1.0830896094441413 , 1.0830895945429801 , 1.0830895945429801 , 1.0830896094441413 , 1.0830895945429801 , 1.0830895945429801 , 1.0830896094441413 , 1.0830895945429801 , 1.021757391325076 , 1.0217574062262371 , 1.021757391325076 , 1.021757391325076 , 1.0217574062262371 , 1.021757391325076 , 1.021757391325076 , 1.0217574062262371 , 1.021757391325076 , 0.923430766276824 , 0.9234307811779852 , 0.923430766276824 , 0.923430766276824 , 0.9234307811779852 , 0.923430766276824 , 0.923430766276824 , 0.9234307811779852 , 0.923430766276824 , 0.9458241453484385 , 0.9458241602495997 , 0.9458241453484385 , 0.9458241453484385 , 0.9458241602495997 , 0.9458241453484385 , 0.9458241453484385 , 0.9458241602495997 , 0.9458241453484385 , 0.943053052966747 , 0.9430530678679082 , 0.943053052966747 , 0.943053052966747 , 0.9430530678679082 , 0.943053052966747 , 0.943053052966747 , 0.9430530678679082 , 0.943053052966747 , 0.90000000000000002 , 0.90000000000000002 , 0.90000000000000002 , 0.90000000000000002 , 0.90000000000000002 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.1000000000000001 , 1.1000000000000001 , 1.1000000000000001 , 1.1000000000000001 , 1.1000000000000001 , 1.2 , 1.2 , 1.2 , 1.2 , 1.2 , 1.3 , 1.3 , 1.3 , 1.3 , 1.3 , 0.94305305 ])* 100.
174- alt_1 = [11. , 11. , 11.00000015 , 11. , 11. , 11.00000015 , 11. , 11. , 11.00000015 , 9. , 9. , 9.00000015 , 9. , 9. , 9.00000015 , 9. , 9. , 9.00000015 , 9. , 9. , 9.00000015 , 9. , 9. , 9.00000015 , 9. , 9. , 9.00000015 , 9. , 9. , 9.00000015 , 9. , 9. , 9.00000015 , 9. , 9. , 9.00000015 , 9. , 9. , 9.00000015 , 9. , 9. , 9.00000015 , 9. , 9. , 9.00000015 , 9. , 9. , 9.00000015 , 9. , 9. , 9.00000015 , 9. , 9. , 9.00000015 , 9. , 10.25 , 11.5 , 12.75 , 14. , 9. , 10.25 , 11.5 , 12.75 , 14. , 9. , 10.25 , 11.5 , 12.75 , 14. , 9. , 10.25 , 11.5 , 12.75 , 14. , 9. , 10.25 , 11.5 , 12.75 , 14. , 9. ]
175-
176- wing_2 = np .array ([1.28 , 1.2800000149011612 , 1.28 , 1.28 , 1.2800000149011612 , 1.28 , 1.28 , 1.2800000149011612 , 1.28 , 1.3 , 1.3000000149011612 , 1.3 , 1.3 , 1.3000000149011612 , 1.3 , 1.3 , 1.3000000149011612 , 1.3 , 1.2512983213829585 , 1.2512983362841197 , 1.2512983213829585 , 1.2512983213829585 , 1.2512983362841197 , 1.2512983213829585 , 1.2512983213829585 , 1.2512983362841197 , 1.2512983213829585 , 1.2027018036450188 , 1.20270181854618 , 1.2027018036450188 , 1.2027018036450188 , 1.20270181854618 , 1.2027018036450188 , 1.2027018036450188 , 1.20270181854618 , 1.2027018036450188 , 0.9696195074510734 , 0.9696195223522346 , 0.9696195074510734 , 0.9696195074510734 , 0.9696195223522346 , 0.9696195074510734 , 0.9696195074510734 , 0.9696195223522346 , 0.9696195074510734 , 0.9356100057984995 , 0.9356100206996607 , 0.9356100057984995 , 0.9356100057984995 , 0.9356100206996607 , 0.9356100057984995 , 0.9356100057984995 , 0.9356100206996607 , 0.9356100057984995 , 0.9442290521247874 , 0.9442290670259486 , 0.9442290521247874 , 0.9442290521247874 , 0.9442290670259486 , 0.9442290521247874 , 0.9442290521247874 , 0.9442290670259486 , 0.9442290521247874 , 0.90000000000000002 , 0.90000000000000002 , 0.90000000000000002 , 0.90000000000000002 , 0.90000000000000002 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.1000000000000001 , 1.1000000000000001 , 0.94422905 ])* 100.
177-
178- alt_2 = [ 13.8 , 13.8 , 13.80000015 , 13.8 , 13.8 , 13.80000015 , 13.8 , 13.8 , 13.80000015 , 10.86578142 , 10.86578142 , 10.86578157 , 10.86578142 , 10.86578142 , 10.86578157 , 10.86578142 , 10.86578142 , 10.86578157 , 9. , 9. , 9.00000015 , 9. , 9. , 9.00000015 , 9. , 9. , 9.00000015 , 9.26299784 , 9.26299784 , 9.26299799 , 9.26299784 , 9.26299784 , 9.26299799 , 9.26299784 , 9.26299784 , 9.26299799 , 9.21358943 , 9.21358943 , 9.21358957 , 9.21358943 , 9.21358943 , 9.21358957 , 9.21358943 , 9.21358943 , 9.21358957 , 9. , 9. , 9.00000015 , 9. , 9. , 9.00000015 , 9. , 9. , 9.00000015 , 9. , 9. , 9.00000015 , 9. , 9. , 9.00000015 , 9. , 9. , 9.00000015 , 9. , 10.25 , 11.5 , 12.75 , 14. , 9. ,10.25 , 11.5 , 12.75 , 14. , 9. , 10.25 , 9. ]
179-
180-
181-
182147 #now plot optimization path (note that these data points were post-processed into a plottable format)
183- #wing_1 = [95 , 95.00000149 , 95 , 95 , 95.00000149 , 95 , 95 , 95.00000149 , 95 , 106.674165 , 106.6741665 , 106.674165 , 106.674165 , 106.6741665 , 106.674165 , 106.674165 , 106.6741665 , 106.674165 , 105.6274294 , 105.6274309 , 105.6274294 , 105.6274294 , 105.6274309 , 105.6274294 , 105.6274294 , 105.6274309 , 105.6274294 , 106.9084316 , 106.9084331 , 106.9084316 , 106.9084316 , 106.9084331 , 106.9084316 , 106.9084316 , 106.9084331 , 106.9084316 , 110.520489 , 110.5204905 , 110.520489 , 110.520489 , 110.5204905 , 110.520489 , 110.520489 , 110.5204905 , 110.520489 , 113.2166831 , 113.2166845 , 113.2166831 , 113.2166831 , 113.2166845 , 113.2166831 , 113.2166831 , 113.2166845 , 113.2166831 , 114.1649262 , 114.1649277 , 114.1649262 , 114.1649262 , 114.1649277 , 114.1649262 , 114.1649262 , 114.1649277 , 114.1649262 , 114.2149828]
184- #alt_1 = [11.0 , 11.0 , 11.000000149011612, 11.0 , 11.0 , 11.000000149011612, 11.0 , 11.0 , 11.000000149011612, 9.540665954351425 , 9.540665954351425 , 9.540666103363037 , 9.540665954351425 , 9.540665954351425 , 9.540666103363037 , 9.540665954351425 , 9.540665954351425 , 9.540666103363037 , 10.023015652305284, 10.023015652305284, 10.023015801316896, 10.023015652305284, 10.023015652305284, 10.023015801316896, 10.023015652305284, 10.023015652305284, 10.023015801316896, 10.190994033521863, 10.190994033521863, 10.190994182533474, 10.190994033521863, 10.190994033521863, 10.190994182533474, 10.190994033521863, 10.190994033521863, 10.190994182533474, 10.440582829327589, 10.440582829327589, 10.4405829783392 , 10.440582829327589, 10.440582829327589, 10.4405829783392 , 10.440582829327589, 10.440582829327589, 10.4405829783392 , 10.536514606250261, 10.536514606250261, 10.536514755261873, 10.536514606250261, 10.536514606250261, 10.536514755261873, 10.536514606250261, 10.536514606250261, 10.536514755261873, 10.535957839878783, 10.535957839878783, 10.535957988890395, 10.535957839878783, 10.535957839878783, 10.535957988890395, 10.535957839878783, 10.535957839878783, 10.535957988890395, 10.52829047]
185- #wing_2 = [128 , 128.0000015, 128 , 128 , 128.0000015, 128 , 128 , 128.0000015, 128 , 130 , 130.0000015, 130 , 130 , 130.0000015, 130 , 130 , 130.0000015, 130 , 122.9564124, 122.9564139, 122.9564124, 122.9564124, 122.9564139, 122.9564124, 122.9564124, 122.9564139, 122.9564124, 116.5744347, 116.5744362, 116.5744347, 116.5744347, 116.5744362, 116.5744347, 116.5744347, 116.5744362, 116.5744347, 116.3530891, 116.3530906, 116.3530891, 116.3530891, 116.3530906, 116.3530891, 116.3530891, 116.3530906, 116.3530891]
186- #alt_2 = [13.8, 13.799999999999999, 13.80000014901161, 13.799999999999999, 13.799999999999999, 13.80000014901161, 13.799999999999999, 13.799999999999999, 13.80000014901161, 11.302562430674953, 11.302562430674953, 11.302562579686565, 11.302562430674953, 11.302562430674953, 11.302562579686565, 11.302562430674953, 11.302562430674953, 11.302562579686565, 11.158808932491421, 11.158808932491421, 11.158809081503033, 11.158808932491421, 11.158808932491421, 11.158809081503033, 11.158808932491421, 11.158808932491421, 11.158809081503033, 11.412913394878741, 11.412913394878741, 11.412913543890353, 11.412913394878741, 11.412913394878741, 11.412913543890353, 11.412913394878741, 11.412913394878741, 11.412913543890353, 11.402627869388722, 11.402627869388722, 11.402628018400334, 11.402627869388722, 11.402627869388722, 11.402628018400334, 11.402627869388722, 11.402627869388722, 11.402628018400334]
187-
188148 '''
189149 opt_1 = plt.plot(wing_1, alt_1, label='optimization path 1')
190150 init_1 = plt.plot(wing_1[0], alt_1[0], 'ko')
@@ -197,12 +157,7 @@ def variable_sweep(problem):
197157 plt .legend (loc = 'upper left' )
198158 plt .show (block = True )
199159
200-
201-
202160 return
203-
204-
161+
205162if __name__ == '__main__' :
206- main ()
207-
208-
163+ main ()
0 commit comments