|
13 | 13 | from SUAVE.Methods.Propulsion.turbofan_sizing import turbofan_sizing |
14 | 14 | from SUAVE.Methods.Performance import payload_range |
15 | 15 | from SUAVE.Methods.Geometry.Two_Dimensional.Planform import wing_planform |
| 16 | +from SUAVE.Plots.Mission_Plots import * |
16 | 17 |
|
17 | 18 | import numpy as np |
18 | 19 | import pylab as plt |
@@ -720,166 +721,15 @@ def mission_setup(analyses): |
720 | 721 |
|
721 | 722 | def plot_mission(results,line_style='bo-'): |
722 | 723 |
|
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) |
762 | 732 |
|
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) |
883 | 733 |
|
884 | 734 | return |
885 | 735 |
|
|
0 commit comments