|
13 | 13 |
|
14 | 14 | # SUAVE Imports |
15 | 15 | import SUAVE |
16 | | -from SUAVE.Core import Data, Units |
17 | | -from SUAVE.Plots.Mission_Plots import * |
| 16 | +from SUAVE.Core import Data, Units |
18 | 17 | from SUAVE.Methods.Propulsion.turbofan_sizing import turbofan_sizing |
19 | 18 | from SUAVE.Methods.Geometry.Two_Dimensional.Cross_Section.Propulsion import compute_turbofan_geometry |
20 | 19 | from SUAVE.Input_Output.Results import print_parasite_drag, \ |
@@ -823,25 +822,169 @@ def missions_setup(base_mission): |
823 | 822 | # Plot Mission |
824 | 823 | # ---------------------------------------------------------------------- |
825 | 824 |
|
826 | | -def plot_mission(results): |
| 825 | +def plot_mission(results,line_style='bo-'): |
827 | 826 |
|
828 | | - # Plot Flight Conditions |
829 | | - plot_flight_conditions(results) |
830 | | - |
831 | | - # Plot Aerodynamic Forces |
832 | | - plot_aerodynamic_forces(results) |
833 | | - |
834 | | - # Plot Aerodynamic Coefficients |
835 | | - plot_aerodynamic_coefficients(results) |
836 | | - |
837 | | - # Drag Components |
838 | | - plot_drag_components(results) |
839 | | - |
840 | | - # Plot Altitude, sfc, vehicle weight |
841 | | - plot_altitude_sfc_weight(results) |
842 | | - |
843 | | - # Plot Velocities |
844 | | - plot_aircraft_velocities(results) |
| 827 | + axis_font = {'fontname':'Arial', 'size':'14'} |
| 828 | + |
| 829 | + # ------------------------------------------------------------------ |
| 830 | + # Aerodynamics |
| 831 | + # ------------------------------------------------------------------ |
| 832 | + |
| 833 | + |
| 834 | + fig = plt.figure("Aerodynamic Forces",figsize=(8,6)) |
| 835 | + for segment in results.segments.values(): |
| 836 | + |
| 837 | + time = segment.conditions.frames.inertial.time[:,0] / Units.min |
| 838 | + Thrust = segment.conditions.frames.body.thrust_force_vector[:,0] / Units.lbf |
| 839 | + eta = segment.conditions.propulsion.throttle[:,0] |
| 840 | + |
| 841 | + axes = fig.add_subplot(2,1,1) |
| 842 | + axes.plot( time , Thrust , line_style ) |
| 843 | + axes.set_ylabel('Thrust (lbf)',axis_font) |
| 844 | + axes.grid(True) |
| 845 | + |
| 846 | + axes = fig.add_subplot(2,1,2) |
| 847 | + axes.plot( time , eta , line_style ) |
| 848 | + axes.set_xlabel('Time (min)',axis_font) |
| 849 | + axes.set_ylabel('Throttle',axis_font) |
| 850 | + axes.grid(True) |
| 851 | + |
| 852 | + plt.savefig("B737_engine.pdf") |
| 853 | + plt.savefig("B737_engine.png") |
| 854 | + |
| 855 | + # ------------------------------------------------------------------ |
| 856 | + # Aerodynamics 2 |
| 857 | + # ------------------------------------------------------------------ |
| 858 | + fig = plt.figure("Aerodynamic Coefficients",figsize=(8,10)) |
| 859 | + for segment in results.segments.values(): |
| 860 | + |
| 861 | + time = segment.conditions.frames.inertial.time[:,0] / Units.min |
| 862 | + CLift = segment.conditions.aerodynamics.lift_coefficient[:,0] |
| 863 | + CDrag = segment.conditions.aerodynamics.drag_coefficient[:,0] |
| 864 | + aoa = segment.conditions.aerodynamics.angle_of_attack[:,0] / Units.deg |
| 865 | + l_d = CLift/CDrag |
| 866 | + |
| 867 | + axes = fig.add_subplot(3,1,1) |
| 868 | + axes.plot( time , CLift , line_style ) |
| 869 | + axes.set_ylabel('Lift Coefficient',axis_font) |
| 870 | + axes.grid(True) |
| 871 | + |
| 872 | + axes = fig.add_subplot(3,1,2) |
| 873 | + axes.plot( time , l_d , line_style ) |
| 874 | + axes.set_ylabel('L/D',axis_font) |
| 875 | + axes.grid(True) |
| 876 | + |
| 877 | + axes = fig.add_subplot(3,1,3) |
| 878 | + axes.plot( time , aoa , 'ro-' ) |
| 879 | + axes.set_xlabel('Time (min)',axis_font) |
| 880 | + axes.set_ylabel('AOA (deg)',axis_font) |
| 881 | + axes.grid(True) |
| 882 | + |
| 883 | + plt.savefig("B737_aero.pdf") |
| 884 | + plt.savefig("B737_aero.png") |
| 885 | + |
| 886 | + # ------------------------------------------------------------------ |
| 887 | + # Aerodynamics 2 |
| 888 | + # ------------------------------------------------------------------ |
| 889 | + fig = plt.figure("Drag Components",figsize=(8,10)) |
| 890 | + axes = plt.gca() |
| 891 | + for i, segment in enumerate(results.segments.values()): |
| 892 | + |
| 893 | + time = segment.conditions.frames.inertial.time[:,0] / Units.min |
| 894 | + drag_breakdown = segment.conditions.aerodynamics.drag_breakdown |
| 895 | + cdp = drag_breakdown.parasite.total[:,0] |
| 896 | + cdi = drag_breakdown.induced.total[:,0] |
| 897 | + cdc = drag_breakdown.compressible.total[:,0] |
| 898 | + cdm = drag_breakdown.miscellaneous.total[:,0] |
| 899 | + cd = drag_breakdown.total[:,0] |
| 900 | + |
| 901 | + if line_style == 'bo-': |
| 902 | + axes.plot( time , cdp , 'ko-', label='CD parasite' ) |
| 903 | + axes.plot( time , cdi , 'bo-', label='CD induced' ) |
| 904 | + axes.plot( time , cdc , 'go-', label='CD compressibility' ) |
| 905 | + axes.plot( time , cdm , 'yo-', label='CD miscellaneous' ) |
| 906 | + axes.plot( time , cd , 'ro-', label='CD total' ) |
| 907 | + if i == 0: |
| 908 | + axes.legend(loc='upper center') |
| 909 | + else: |
| 910 | + axes.plot( time , cdp , line_style ) |
| 911 | + axes.plot( time , cdi , line_style ) |
| 912 | + axes.plot( time , cdc , line_style ) |
| 913 | + axes.plot( time , cdm , line_style ) |
| 914 | + axes.plot( time , cd , line_style ) |
| 915 | + |
| 916 | + axes.set_xlabel('Time (min)') |
| 917 | + axes.set_ylabel('CD') |
| 918 | + axes.grid(True) |
| 919 | + plt.savefig("B737_drag.pdf") |
| 920 | + plt.savefig("B737_drag.png") |
| 921 | + |
| 922 | + # ------------------------------------------------------------------ |
| 923 | + # Altitude, sfc, vehicle weight |
| 924 | + # ------------------------------------------------------------------ |
| 925 | + |
| 926 | + fig = plt.figure("Altitude_sfc_weight",figsize=(8,10)) |
| 927 | + for segment in results.segments.values(): |
| 928 | + |
| 929 | + time = segment.conditions.frames.inertial.time[:,0] / Units.min |
| 930 | + aoa = segment.conditions.aerodynamics.angle_of_attack[:,0] / Units.deg |
| 931 | + mass = segment.conditions.weights.total_mass[:,0] / Units.lb |
| 932 | + altitude = segment.conditions.freestream.altitude[:,0] / Units.ft |
| 933 | + mdot = segment.conditions.weights.vehicle_mass_rate[:,0] |
| 934 | + thrust = segment.conditions.frames.body.thrust_force_vector[:,0] |
| 935 | + sfc = (mdot / Units.lb) / (thrust /Units.lbf) * Units.hr |
| 936 | + |
| 937 | + axes = fig.add_subplot(3,1,1) |
| 938 | + axes.plot( time , altitude , line_style ) |
| 939 | + axes.set_ylabel('Altitude (ft)',axis_font) |
| 940 | + axes.grid(True) |
| 941 | + |
| 942 | + axes = fig.add_subplot(3,1,3) |
| 943 | + axes.plot( time , sfc , line_style ) |
| 944 | + axes.set_xlabel('Time (min)',axis_font) |
| 945 | + axes.set_ylabel('sfc (lb/lbf-hr)',axis_font) |
| 946 | + axes.grid(True) |
| 947 | + |
| 948 | + axes = fig.add_subplot(3,1,2) |
| 949 | + axes.plot( time , mass , 'ro-' ) |
| 950 | + axes.set_ylabel('Weight (lb)',axis_font) |
| 951 | + axes.grid(True) |
| 952 | + |
| 953 | + plt.savefig("B737_mission.pdf") |
| 954 | + plt.savefig("B737_mission.png") |
| 955 | + |
| 956 | + # ------------------------------------------------------------------ |
| 957 | + # Velocities |
| 958 | + # ------------------------------------------------------------------ |
| 959 | + fig = plt.figure("Velocities",figsize=(8,10)) |
| 960 | + for segment in results.segments.values(): |
| 961 | + |
| 962 | + time = segment.conditions.frames.inertial.time[:,0] / Units.min |
| 963 | + Lift = -segment.conditions.frames.wind.lift_force_vector[:,2] |
| 964 | + Drag = -segment.conditions.frames.wind.drag_force_vector[:,0] / Units.lbf |
| 965 | + Thrust = segment.conditions.frames.body.thrust_force_vector[:,0] / Units.lb |
| 966 | + velocity = segment.conditions.freestream.velocity[:,0] |
| 967 | + pressure = segment.conditions.freestream.pressure[:,0] |
| 968 | + density = segment.conditions.freestream.density[:,0] |
| 969 | + EAS = velocity * np.sqrt(density/1.225) |
| 970 | + mach = segment.conditions.freestream.mach_number[:,0] |
| 971 | + |
| 972 | + axes = fig.add_subplot(3,1,1) |
| 973 | + axes.plot( time , velocity / Units.kts, line_style ) |
| 974 | + axes.set_ylabel('velocity (kts)',axis_font) |
| 975 | + axes.grid(True) |
| 976 | + |
| 977 | + axes = fig.add_subplot(3,1,2) |
| 978 | + axes.plot( time , EAS / Units.kts, line_style ) |
| 979 | + axes.set_xlabel('Time (min)',axis_font) |
| 980 | + axes.set_ylabel('Equivalent Airspeed',axis_font) |
| 981 | + axes.grid(True) |
| 982 | + |
| 983 | + axes = fig.add_subplot(3,1,3) |
| 984 | + axes.plot( time , mach , line_style ) |
| 985 | + axes.set_xlabel('Time (min)',axis_font) |
| 986 | + axes.set_ylabel('Mach',axis_font) |
| 987 | + axes.grid(True) |
845 | 988 |
|
846 | 989 | return |
847 | 990 |
|
|
0 commit comments