Skip to content

Commit ef3e7ee

Browse files
Merge pull request #25 from suavecode/feature-2point4
small fixes for consistency
2 parents 501d74a + 3b06f09 commit ef3e7ee

File tree

5 files changed

+34
-184
lines changed

5 files changed

+34
-184
lines changed

B737_AVL_Tutorial/tut_mission_B737_AVL.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def vehicle_setup():
213213
wing.origin = [[13.61 * Units.meter, 0, -1.27 * Units.meter]]
214214
wing.vertical = False
215215
wing.symmetric = True
216-
wing.high_lift = True
216+
wing.high_lift = False
217217
wing.dynamic_pressure_ratio = 1.0
218218

219219
# add to vehicle

BWB_CFD/BWB.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from SUAVE.Core import Data, Units
1616

1717
from SUAVE.Input_Output.OpenVSP import write
18-
from SUAVE.Input_Output.OpenVSP.get_vsp_areas import get_vsp_areas
18+
from SUAVE.Input_Output.OpenVSP import get_vsp_measurements
1919

2020
from SUAVE.Methods.Propulsion.turbofan_sizing import turbofan_sizing
2121
from SUAVE.Methods.Geometry.Two_Dimensional.Cross_Section.Propulsion import compute_turbofan_geometry
@@ -555,7 +555,7 @@ def simple_sizing(configs):
555555
base.mass_properties.max_zero_fuel = 0.9 * base.mass_properties.max_takeoff
556556

557557
# Areas
558-
wetted_areas = get_vsp_areas(base.tag)
558+
wetted_areas = get_vsp_measurements(base.tag)
559559

560560
for wing in base.wings:
561561
wing.areas.wetted = wetted_areas[wing.tag]

Regional_Jet_Optimization/Optimize.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,29 +57,29 @@ def setup():
5757
# Inputs
5858
# -------------------------------------------------------------------
5959

60-
# [ tag , initial, (lb , ub) , scaling , units ]
60+
# [ tag , initial, lb , ub , scaling , units ]
6161
problem.inputs = np.array([
62-
[ 'wing_area' , 92 , ( 50. , 130. ) , 100. , Units.meter**2],
63-
[ 'cruise_altitude' , 8 , ( 6. , 12. ) , 10. , Units.km],
64-
])
62+
[ 'wing_area' , 92 , 50. , 130. , 100. , 1*Units.meter**2],
63+
[ 'cruise_altitude' , 8 , 6. , 12. , 10. , 1*Units.km],
64+
],dtype=object)
6565

6666
# -------------------------------------------------------------------
6767
# Objective
6868
# -------------------------------------------------------------------
6969

7070
# [ tag, scaling, units ]
7171
problem.objective = np.array([
72-
[ 'fuel_burn', 10000, Units.kg ]
73-
])
72+
[ 'fuel_burn', 10000, 1*Units.kg ]
73+
],dtype=object)
7474

7575
# -------------------------------------------------------------------
7676
# Constraints
7777
# -------------------------------------------------------------------
7878

7979
# [ tag, sense, edge, scaling, units ]
8080
problem.constraints = np.array([
81-
[ 'design_range_fuel_margin' , '>', 0., 1E-1, Units.less], #fuel margin defined here as fuel
82-
])
81+
[ 'design_range_fuel_margin' , '>', 0., 1E-1, 1*Units.less], #fuel margin defined here as fuel
82+
],dtype=object)
8383

8484
# -------------------------------------------------------------------
8585
# Aliases

Solar_UAV_Optimization/Optimize.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,34 +50,34 @@ def setup():
5050

5151
# [ tag , initial, [lb,ub], scaling, units ]
5252
problem.inputs = np.array([
53-
[ 'wing_area' , 0.5, ( 0.1, 1.5 ), 0.5, Units.meter ],
54-
[ 'aspect_ratio' , 10.0, ( 5.0, 20.0 ), 10.0, Units.less ],
55-
[ 'dynamic_pressure', 125.0, ( 1.0, 2000.0 ), 125.0, Units.pascals ],
56-
[ 'solar_ratio' , 0.0, ( 0.0, 0.97), 1.0, Units.less ],
57-
[ 'kv' , 800.0, ( 10.0, 10000.0 ), 800.0, Units['rpm/volt']],
58-
])
53+
[ 'wing_area' , 0.5, 0.1, 1.5 , 0.5, 1*Units.meter ],
54+
[ 'aspect_ratio' , 10.0, 5.0, 20.0 , 10.0, 1*Units.less ],
55+
[ 'dynamic_pressure', 125.0, 1.0, 2000.0 , 125.0, 1*Units.pascals ],
56+
[ 'solar_ratio' , 0.0, 0.0, 0.97, 1.0, 1*Units.less ],
57+
[ 'kv' , 800.0, 10.0, 10000.0 , 800.0, 1*Units['rpm/volt']],
58+
],dtype=object)
5959

6060
# -------------------------------------------------------------------
6161
# Objective
6262
# -------------------------------------------------------------------
6363

6464
# [ tag, scaling, units ]
6565
problem.objective = np.array([
66-
[ 'Nothing', 1. , Units.kg],
67-
])
66+
[ 'Nothing', 1. , 1*Units.kg],
67+
],dtype=object)
6868

6969
# -------------------------------------------------------------------
7070
# Constraints
7171
# -------------------------------------------------------------------
7272

7373
# [ tag, sense, edge, scaling, units ]
7474
problem.constraints = np.array([
75-
[ 'energy_constraint', '=', 0.0, 1.0, Units.less],
76-
[ 'battery_mass' , '>', 0.0, 1.0, Units.kg ],
77-
[ 'CL' , '>', 0.0, 1.0, Units.less],
78-
[ 'Throttle_min' , '>', 0.0, 1.0, Units.less],
79-
[ 'Throttle_max' , '>', 0.0, 1.0, Units.less],
80-
])
75+
[ 'energy_constraint', '=', 0.0, 1.0, 1*Units.less],
76+
[ 'battery_mass' , '>', 0.0, 1.0, 1*Units.kg ],
77+
[ 'CL' , '>', 0.0, 1.0, 1*Units.less],
78+
[ 'Throttle_min' , '>', 0.0, 1.0, 1*Units.less],
79+
[ 'Throttle_max' , '>', 0.0, 1.0, 1*Units.less],
80+
],dtype=object)
8181

8282
# -------------------------------------------------------------------
8383
# Aliases

tut_payload_range.py

Lines changed: 9 additions & 159 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from SUAVE.Methods.Propulsion.turbofan_sizing import turbofan_sizing
1414
from SUAVE.Methods.Performance import payload_range
1515
from SUAVE.Methods.Geometry.Two_Dimensional.Planform import wing_planform
16+
from SUAVE.Plots.Mission_Plots import *
1617

1718
import numpy as np
1819
import pylab as plt
@@ -720,166 +721,15 @@ def mission_setup(analyses):
720721

721722
def plot_mission(results,line_style='bo-'):
722723

723-
# ------------------------------------------------------------------
724-
# Throttle
725-
# ------------------------------------------------------------------
726-
plt.figure("Throttle History")
727-
axes = plt.gca()
728-
for i in range(len(results.segments)):
729-
time = results.segments[i].conditions.frames.inertial.time[:,0] / Units.min
730-
eta = results.segments[i].conditions.propulsion.throttle[:,0]
731-
axes.plot(time, eta, line_style)
732-
axes.set_xlabel('Time (mins)')
733-
axes.set_ylabel('Throttle')
734-
axes.grid(True)
735-
736-
# ------------------------------------------------------------------
737-
# Angle of Attack
738-
# ------------------------------------------------------------------
739-
740-
plt.figure("Angle of Attack History")
741-
axes = plt.gca()
742-
for i in range(len(results.segments)):
743-
time = results.segments[i].conditions.frames.inertial.time[:,0] / Units.min
744-
aoa = results.segments[i].conditions.aerodynamics.angle_of_attack[:,0] / Units.deg
745-
axes.plot(time, aoa, line_style)
746-
axes.set_xlabel('Time (mins)')
747-
axes.set_ylabel('Angle of Attack (deg)')
748-
axes.grid(True)
749-
750-
# ------------------------------------------------------------------
751-
# Fuel Burn Rate
752-
# ------------------------------------------------------------------
753-
plt.figure("Fuel Burn Rate")
754-
axes = plt.gca()
755-
for i in range(len(results.segments)):
756-
time = results.segments[i].conditions.frames.inertial.time[:,0] / Units.min
757-
mdot = results.segments[i].conditions.weights.vehicle_mass_rate[:,0]
758-
axes.plot(time, mdot, line_style)
759-
axes.set_xlabel('Time (mins)')
760-
axes.set_ylabel('Fuel Burn Rate (kg/s)')
761-
axes.grid(True)
724+
# Plot Flight Conditions
725+
plot_flight_conditions(results, line_style)
726+
727+
# Plot Aerodynamic Coefficients
728+
plot_aerodynamic_coefficients(results, line_style)
729+
730+
# Plot Altitude, sfc, vehicle weight
731+
plot_altitude_sfc_weight(results, line_style)
762732

763-
# ------------------------------------------------------------------
764-
# Altitude
765-
# ------------------------------------------------------------------
766-
plt.figure("Altitude")
767-
axes = plt.gca()
768-
for i in range(len(results.segments)):
769-
time = results.segments[i].conditions.frames.inertial.time[:,0] / Units.min
770-
altitude = results.segments[i].conditions.freestream.altitude[:,0] / Units.km
771-
axes.plot(time, altitude, line_style)
772-
axes.set_xlabel('Time (mins)')
773-
axes.set_ylabel('Altitude (km)')
774-
axes.grid(True)
775-
776-
# ------------------------------------------------------------------
777-
# Vehicle Mass
778-
# ------------------------------------------------------------------
779-
plt.figure("Vehicle Mass")
780-
axes = plt.gca()
781-
for i in range(len(results.segments)):
782-
time = results.segments[i].conditions.frames.inertial.time[:,0] / Units.min
783-
mass = results.segments[i].conditions.weights.total_mass[:,0]
784-
axes.plot(time, mass, line_style)
785-
axes.set_xlabel('Time (mins)')
786-
axes.set_ylabel('Vehicle Mass (kg)')
787-
axes.grid(True)
788-
789-
# ------------------------------------------------------------------
790-
# Aerodynamics
791-
# ------------------------------------------------------------------
792-
fig = plt.figure("Aerodynamic Forces")
793-
for segment in results.segments.values():
794-
795-
time = segment.conditions.frames.inertial.time[:,0] / Units.min
796-
Lift = -segment.conditions.frames.wind.lift_force_vector[:,2]
797-
Drag = -segment.conditions.frames.wind.drag_force_vector[:,0]
798-
Thrust = segment.conditions.frames.body.thrust_force_vector[:,0]
799-
800-
axes = fig.add_subplot(3,1,1)
801-
axes.plot( time , Lift , line_style )
802-
axes.set_xlabel('Time (min)')
803-
axes.set_ylabel('Lift (N)')
804-
axes.grid(True)
805-
806-
axes = fig.add_subplot(3,1,2)
807-
axes.plot( time , Drag , line_style )
808-
axes.set_xlabel('Time (min)')
809-
axes.set_ylabel('Drag (N)')
810-
axes.grid(True)
811-
812-
axes = fig.add_subplot(3,1,3)
813-
axes.plot( time , Thrust , line_style )
814-
axes.set_xlabel('Time (min)')
815-
axes.set_ylabel('Thrust (N)')
816-
axes.grid(True)
817-
818-
# ------------------------------------------------------------------
819-
# Aerodynamics 1
820-
# ------------------------------------------------------------------
821-
fig = plt.figure("Aerodynamic Coefficients")
822-
for segment in results.segments.values():
823-
824-
time = segment.conditions.frames.inertial.time[:,0] / Units.min
825-
CLift = segment.conditions.aerodynamics.lift_coefficient[:,0]
826-
CDrag = segment.conditions.aerodynamics.drag_coefficient[:,0]
827-
Drag = -segment.conditions.frames.wind.drag_force_vector[:,0]
828-
Thrust = segment.conditions.frames.body.thrust_force_vector[:,0]
829-
830-
axes = fig.add_subplot(3,1,1)
831-
axes.plot( time , CLift , line_style )
832-
axes.set_xlabel('Time (min)')
833-
axes.set_ylabel('CL')
834-
axes.grid(True)
835-
836-
axes = fig.add_subplot(3,1,2)
837-
axes.plot( time , CDrag , line_style )
838-
axes.set_xlabel('Time (min)')
839-
axes.set_ylabel('CD')
840-
axes.grid(True)
841-
842-
axes = fig.add_subplot(3,1,3)
843-
axes.plot( time , Drag , line_style )
844-
axes.plot( time , Thrust , 'ro-' )
845-
axes.set_xlabel('Time (min)')
846-
axes.set_ylabel('Drag and Thrust (N)')
847-
axes.grid(True)
848-
849-
850-
# ------------------------------------------------------------------
851-
# Aerodynamics 2
852-
# ------------------------------------------------------------------
853-
fig = plt.figure("Drag Components")
854-
axes = plt.gca()
855-
for i, segment in enumerate(results.segments.values()):
856-
857-
time = segment.conditions.frames.inertial.time[:,0] / Units.min
858-
drag_breakdown = segment.conditions.aerodynamics.drag_breakdown
859-
cdp = drag_breakdown.parasite.total[:,0]
860-
cdi = drag_breakdown.induced.total[:,0]
861-
cdc = drag_breakdown.compressible.total[:,0]
862-
cdm = drag_breakdown.miscellaneous.total[:,0]
863-
cd = drag_breakdown.total[:,0]
864-
865-
if line_style == 'bo-':
866-
axes.plot( time , cdp , 'ko-', label='CD_P' )
867-
axes.plot( time , cdi , 'bo-', label='CD_I' )
868-
axes.plot( time , cdc , 'go-', label='CD_C' )
869-
axes.plot( time , cdm , 'yo-', label='CD_M' )
870-
axes.plot( time , cd , 'ro-', label='CD' )
871-
if i == 0:
872-
axes.legend(loc='upper center')
873-
else:
874-
axes.plot( time , cdp , line_style )
875-
axes.plot( time , cdi , line_style )
876-
axes.plot( time , cdc , line_style )
877-
axes.plot( time , cdm , line_style )
878-
axes.plot( time , cd , line_style )
879-
880-
axes.set_xlabel('Time (min)')
881-
axes.set_ylabel('CD')
882-
axes.grid(True)
883733

884734
return
885735

0 commit comments

Comments
 (0)