RCAIDE-GUI 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- common_widgets/__init__.py +6 -0
- common_widgets/animated_toggle.py +141 -0
- common_widgets/color.py +17 -0
- common_widgets/data_entry_widget.py +337 -0
- common_widgets/image_widget.py +21 -0
- common_widgets/unit_picker_widget.py +48 -0
- main.py +168 -0
- rcaide_gui-1.0.0.dist-info/METADATA +96 -0
- rcaide_gui-1.0.0.dist-info/RECORD +170 -0
- rcaide_gui-1.0.0.dist-info/WHEEL +5 -0
- rcaide_gui-1.0.0.dist-info/entry_points.txt +2 -0
- rcaide_gui-1.0.0.dist-info/top_level.txt +5 -0
- rcaide_io.py +818 -0
- tabs/__init__.py +10 -0
- tabs/aircraft_configs/__init__.py +3 -0
- tabs/aircraft_configs/aircraft_configs.py +301 -0
- tabs/analysis/__init__.py +4 -0
- tabs/analysis/analysis.py +92 -0
- tabs/analysis/widgets/__init__.py +13 -0
- tabs/analysis/widgets/aeroacoustics_widget.py +158 -0
- tabs/analysis/widgets/aerodynamics_widget.py +108 -0
- tabs/analysis/widgets/analysis_data_widget.py +29 -0
- tabs/analysis/widgets/atmosphere_widget.py +49 -0
- tabs/analysis/widgets/costs_widget.py +35 -0
- tabs/analysis/widgets/energy_widget.py +32 -0
- tabs/analysis/widgets/geometry_widget.py +55 -0
- tabs/analysis/widgets/planets_widget.py +34 -0
- tabs/analysis/widgets/propulsion_widget.py +53 -0
- tabs/analysis/widgets/stability_widget.py +34 -0
- tabs/analysis/widgets/weights_widget.py +94 -0
- tabs/geometry/__init__.py +6 -0
- tabs/geometry/aircraft_configs.py +232 -0
- tabs/geometry/frames/__init__.py +15 -0
- tabs/geometry/frames/booms/__init__.py +5 -0
- tabs/geometry/frames/booms/boom_frame.py +238 -0
- tabs/geometry/frames/cargo_bays/__init__.py +5 -0
- tabs/geometry/frames/cargo_bays/cargo_bay_frame.py +159 -0
- tabs/geometry/frames/default_frame.py +23 -0
- tabs/geometry/frames/energy_network/__init__.py +2 -0
- tabs/geometry/frames/energy_network/turbofan_network/__init__.py +3 -0
- tabs/geometry/frames/energy_network/turbofan_network/frames/__init__.py +1 -0
- tabs/geometry/frames/energy_network/turbofan_network/widgets/__init__.py +1 -0
- tabs/geometry/frames/fuselages/__init__.py +5 -0
- tabs/geometry/frames/fuselages/fuselage_frame.py +294 -0
- tabs/geometry/frames/geometry_frame.py +91 -0
- tabs/geometry/frames/landing_gears/__init__.py +5 -0
- tabs/geometry/frames/landing_gears/landing_gear_frame.py +189 -0
- tabs/geometry/frames/nacelles/__init__.py +1 -0
- tabs/geometry/frames/powertrain/__init__.py +6 -0
- tabs/geometry/frames/powertrain/converters/__init__.py +5 -0
- tabs/geometry/frames/powertrain/converters/converter_frame.py +137 -0
- tabs/geometry/frames/powertrain/distributors/__init__.py +5 -0
- tabs/geometry/frames/powertrain/distributors/distributor_frame.py +143 -0
- tabs/geometry/frames/powertrain/nacelles/__init__.py +5 -0
- tabs/geometry/frames/powertrain/nacelles/nacelle_frame.py +283 -0
- tabs/geometry/frames/powertrain/powertrain_frame.py +259 -0
- tabs/geometry/frames/powertrain/propulsors/__init__.py +5 -0
- tabs/geometry/frames/powertrain/propulsors/propulsor_frame.py +146 -0
- tabs/geometry/frames/powertrain/sources/__init__.py +6 -0
- tabs/geometry/frames/powertrain/sources/energy_source_frame.py +147 -0
- tabs/geometry/frames/vehicle_frame.py +171 -0
- tabs/geometry/frames/wings/__init__.py +5 -0
- tabs/geometry/frames/wings/wings_frame.py +457 -0
- tabs/geometry/geometry.py +513 -0
- tabs/geometry/widgets/__init__.py +12 -0
- tabs/geometry/widgets/booms/__init__.py +6 -0
- tabs/geometry/widgets/booms/boom_section_widget.py +109 -0
- tabs/geometry/widgets/cargo_bays/__init__.py +1 -0
- tabs/geometry/widgets/fuselages/__init__.py +8 -0
- tabs/geometry/widgets/fuselages/cabin_class_widget.py +188 -0
- tabs/geometry/widgets/fuselages/cabin_widget.py +217 -0
- tabs/geometry/widgets/fuselages/fuselage_section_widget.py +190 -0
- tabs/geometry/widgets/geometry_data_widget.py +25 -0
- tabs/geometry/widgets/landing_gears/__init__.py +6 -0
- tabs/geometry/widgets/nacelles/__init__.py +1 -0
- tabs/geometry/widgets/powertrain/__init__.py +9 -0
- tabs/geometry/widgets/powertrain/converters/__init__.py +5 -0
- tabs/geometry/widgets/powertrain/converters/turboelectric_generator_widget.py +74 -0
- tabs/geometry/widgets/powertrain/distributors/__init__.py +5 -0
- tabs/geometry/widgets/powertrain/distributors/fuel_line_widget.py +81 -0
- tabs/geometry/widgets/powertrain/modulators/__init__.py +5 -0
- tabs/geometry/widgets/powertrain/modulators/esc_widget.py +58 -0
- tabs/geometry/widgets/powertrain/nacelles/__init__.py +5 -0
- tabs/geometry/widgets/powertrain/nacelles/nacelle_section_widget.py +115 -0
- tabs/geometry/widgets/powertrain/powertrain_connector_widget.py +136 -0
- tabs/geometry/widgets/powertrain/powertrain_widget.py +206 -0
- tabs/geometry/widgets/powertrain/propulsors/__init__.py +5 -0
- tabs/geometry/widgets/powertrain/propulsors/turbofan_widget.py +462 -0
- tabs/geometry/widgets/powertrain/sources/__init__.py +6 -0
- tabs/geometry/widgets/powertrain/sources/fuel_tank_widget.py +103 -0
- tabs/geometry/widgets/powertrain/sources/source_selector_widget.py +35 -0
- tabs/geometry/widgets/wings/__init__.py +7 -0
- tabs/geometry/widgets/wings/wing_cs_widget.py +198 -0
- tabs/geometry/widgets/wings/wing_section_widget.py +298 -0
- tabs/home/__init__.py +3 -0
- tabs/home/home.py +585 -0
- tabs/mission/__init__.py +4 -0
- tabs/mission/mission.py +1124 -0
- tabs/mission/widgets/__init__.py +3 -0
- tabs/mission/widgets/flight_controls_widget.py +186 -0
- tabs/mission/widgets/mission_analysis_widget.py +166 -0
- tabs/mission/widgets/mission_segment_helper.py +358 -0
- tabs/mission/widgets/mission_segment_widget.py +358 -0
- tabs/solve/__init__.py +4 -0
- tabs/solve/plots/__init__.py +12 -0
- tabs/solve/plots/aeroacoustics/__init__.py +6 -0
- tabs/solve/plots/aeroacoustics/plot_2D_noise_contour.py +184 -0
- tabs/solve/plots/aeroacoustics/plot_3D_noise_contour.py +219 -0
- tabs/solve/plots/aeroacoustics/plot_noise_certification_contour.py +115 -0
- tabs/solve/plots/aeroacoustics/plot_noise_level.py +118 -0
- tabs/solve/plots/aerodynamics/__init__.py +10 -0
- tabs/solve/plots/aerodynamics/plot_aerodynamic_coefficients.py +156 -0
- tabs/solve/plots/aerodynamics/plot_aerodynamic_forces.py +155 -0
- tabs/solve/plots/aerodynamics/plot_aircraft_aerodynamics.py +136 -0
- tabs/solve/plots/aerodynamics/plot_drag_components.py +157 -0
- tabs/solve/plots/aerodynamics/plot_lift_distribution.py +107 -0
- tabs/solve/plots/aerodynamics/plot_rotor_conditions.py +255 -0
- tabs/solve/plots/aerodynamics/plot_rotor_disc_performance.py +144 -0
- tabs/solve/plots/aerodynamics/plot_rotor_performance.py +124 -0
- tabs/solve/plots/common/__init__.py +4 -0
- tabs/solve/plots/common/plot_style.py +71 -0
- tabs/solve/plots/common/set_axes.py +55 -0
- tabs/solve/plots/create_plot_widgets.py +34 -0
- tabs/solve/plots/emissions/__init__.py +3 -0
- tabs/solve/plots/emissions/plot_emissions.py +167 -0
- tabs/solve/plots/energy/__init__.py +12 -0
- tabs/solve/plots/energy/plot_altitude_sfc_weight.py +134 -0
- tabs/solve/plots/energy/plot_battery_cell_conditions.py +154 -0
- tabs/solve/plots/energy/plot_battery_degradation.py +157 -0
- tabs/solve/plots/energy/plot_battery_module_C_rates.py +139 -0
- tabs/solve/plots/energy/plot_battery_module_conditions.py +157 -0
- tabs/solve/plots/energy/plot_battery_pack_conditions.py +164 -0
- tabs/solve/plots/energy/plot_battery_ragone_diagram.py +97 -0
- tabs/solve/plots/energy/plot_battery_temperature.py +136 -0
- tabs/solve/plots/energy/plot_electric_propulsor_efficiencies.py +136 -0
- tabs/solve/plots/energy/plot_propulsor_throttles.py +119 -0
- tabs/solve/plots/mission/__init__.py +5 -0
- tabs/solve/plots/mission/plot_aircraft_velocities.py +145 -0
- tabs/solve/plots/mission/plot_flight_conditions.py +236 -0
- tabs/solve/plots/mission/plot_flight_trajectory.py +172 -0
- tabs/solve/plots/stability/__init__.py +5 -0
- tabs/solve/plots/stability/plot_flight_forces_and_moments.py +163 -0
- tabs/solve/plots/stability/plot_lateral_stability.py +151 -0
- tabs/solve/plots/stability/plot_longitudinal_stability.py +173 -0
- tabs/solve/plots/thermal_management/__init__.py +7 -0
- tabs/solve/plots/thermal_management/plot_air_cooled_conditions.py +152 -0
- tabs/solve/plots/thermal_management/plot_cross_flow_heat_exchanger_conditions.py +185 -0
- tabs/solve/plots/thermal_management/plot_reservoir_conditions.py +141 -0
- tabs/solve/plots/thermal_management/plot_thermal_management_performance.py +105 -0
- tabs/solve/plots/thermal_management/plot_wavy_channel_conditions.py +161 -0
- tabs/solve/plots/weights/__init__.py +4 -0
- tabs/solve/plots/weights/plot_load_diagram.py +163 -0
- tabs/solve/plots/weights/plot_weight_breakdown.py +164 -0
- tabs/solve/solve.py +1498 -0
- tabs/style_sheet.py +114 -0
- tabs/tab_widget.py +14 -0
- tabs/visualize_geometry/__init__.py +4 -0
- tabs/visualize_geometry/core_3d_viewer.py +253 -0
- tabs/visualize_geometry/features/__init__.py +10 -0
- tabs/visualize_geometry/features/axes_gizmo.py +173 -0
- tabs/visualize_geometry/features/background.py +161 -0
- tabs/visualize_geometry/features/blueprint.py +685 -0
- tabs/visualize_geometry/features/camera.py +364 -0
- tabs/visualize_geometry/features/drag_aircraft.py +219 -0
- tabs/visualize_geometry/features/grid.py +194 -0
- tabs/visualize_geometry/features/measurement.py +367 -0
- tabs/visualize_geometry/features/screenshot.py +91 -0
- tabs/visualize_geometry/geometry_helper_functions.py +3 -0
- tabs/visualize_geometry/visualize_geometry.py +731 -0
- utilities.py +257 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
# RCAIDE_GUI/tabs/solve/plots/aerodynamics/plot_aerodynamic_forces.py
|
|
2
|
+
|
|
3
|
+
# RCAIDE imports
|
|
4
|
+
from RCAIDE.Framework.Core import Units
|
|
5
|
+
from RCAIDE.Library.Plots.Common import set_axes, plot_style
|
|
6
|
+
|
|
7
|
+
# Python imports
|
|
8
|
+
import matplotlib.pyplot as plt
|
|
9
|
+
import matplotlib.cm as cm
|
|
10
|
+
import numpy as np
|
|
11
|
+
|
|
12
|
+
# ------------------------------------------------------------------------------
|
|
13
|
+
# Plot Aerodynamic Forces
|
|
14
|
+
# ------------------------------------------------------------------------------
|
|
15
|
+
def plot_aerodynamic_forces(results,
|
|
16
|
+
save_figure = False,
|
|
17
|
+
show_legend = True,
|
|
18
|
+
save_filename = "Aerodynamic_Forces",
|
|
19
|
+
file_type = ".png",
|
|
20
|
+
width = 11, height = 7):
|
|
21
|
+
"""
|
|
22
|
+
Creates a multi-panel visualization of aerodynamic forces throughout flight.
|
|
23
|
+
|
|
24
|
+
Parameters
|
|
25
|
+
----------
|
|
26
|
+
results : Results
|
|
27
|
+
RCAIDE results data structure containing:
|
|
28
|
+
- segments[i].conditions.frames
|
|
29
|
+
Frame data containing:
|
|
30
|
+
- body.thrust_force_vector[:,0]
|
|
31
|
+
Thrust force in body frame [N]
|
|
32
|
+
- wind.force_vector[:,0]
|
|
33
|
+
Drag force in wind frame [N]
|
|
34
|
+
- wind.force_vector[:,2]
|
|
35
|
+
Lift force in wind frame [N]
|
|
36
|
+
- segments[i].conditions.energy
|
|
37
|
+
Energy data containing:
|
|
38
|
+
- power[:,0]
|
|
39
|
+
Total power in watts
|
|
40
|
+
- segments[i].conditions.frames.inertial.time[:,0]
|
|
41
|
+
Time history for each segment
|
|
42
|
+
- segments[i].tag
|
|
43
|
+
Segment identifier string
|
|
44
|
+
|
|
45
|
+
save_figure : bool, optional
|
|
46
|
+
Flag for saving the figure (default: False)
|
|
47
|
+
|
|
48
|
+
show_legend : bool, optional
|
|
49
|
+
Flag to display segment legend (default: True)
|
|
50
|
+
|
|
51
|
+
save_filename : str, optional
|
|
52
|
+
Name of file for saved figure (default: "Aerodynamic_Forces")
|
|
53
|
+
|
|
54
|
+
file_type : str, optional
|
|
55
|
+
File extension for saved figure (default: ".png")
|
|
56
|
+
|
|
57
|
+
width : float, optional
|
|
58
|
+
Figure width in inches (default: 11)
|
|
59
|
+
|
|
60
|
+
height : float, optional
|
|
61
|
+
Figure height in inches (default: 7)
|
|
62
|
+
|
|
63
|
+
Returns
|
|
64
|
+
-------
|
|
65
|
+
fig : matplotlib.figure.Figure
|
|
66
|
+
|
|
67
|
+
Notes
|
|
68
|
+
-----
|
|
69
|
+
Creates visualization showing:
|
|
70
|
+
- Aerodynamic force magnitudes
|
|
71
|
+
- Power requirements
|
|
72
|
+
- Force balance evolution
|
|
73
|
+
- Time history of forces
|
|
74
|
+
|
|
75
|
+
**Definitions**
|
|
76
|
+
|
|
77
|
+
'Lift'
|
|
78
|
+
Force perpendicular to airflow
|
|
79
|
+
'Drag'
|
|
80
|
+
Force parallel to airflow
|
|
81
|
+
'Thrust'
|
|
82
|
+
Propulsive force
|
|
83
|
+
'Power'
|
|
84
|
+
Rate of energy use
|
|
85
|
+
|
|
86
|
+
See Also
|
|
87
|
+
--------
|
|
88
|
+
RCAIDE.Library.Plots.Aerodynamics.plot_aerodynamic_coefficients : Non-dimensional force plots
|
|
89
|
+
RCAIDE.Library.Plots.Aerodynamics.plot_drag_components : Drag breakdown analysis
|
|
90
|
+
"""
|
|
91
|
+
|
|
92
|
+
# get plotting style
|
|
93
|
+
ps = plot_style()
|
|
94
|
+
|
|
95
|
+
parameters = {'axes.labelsize': ps.axis_font_size,
|
|
96
|
+
'xtick.labelsize': ps.axis_font_size,
|
|
97
|
+
'ytick.labelsize': ps.axis_font_size,
|
|
98
|
+
'axes.titlesize': ps.title_font_size}
|
|
99
|
+
plt.rcParams.update(parameters)
|
|
100
|
+
|
|
101
|
+
# get line colors for plots
|
|
102
|
+
line_colors = cm.inferno(np.linspace(0,0.9,len(results.segments)))
|
|
103
|
+
|
|
104
|
+
fig = plt.figure(save_filename)
|
|
105
|
+
fig.set_size_inches(width,height)
|
|
106
|
+
|
|
107
|
+
for i in range(len(results.segments)):
|
|
108
|
+
time = results.segments[i].conditions.frames.inertial.time[:,0] / Units.min
|
|
109
|
+
Power = results.segments[i].conditions.energy.power[:,0]
|
|
110
|
+
Thrust = results.segments[i].conditions.frames.body.thrust_force_vector[:,0]
|
|
111
|
+
Lift = -results.segments[i].conditions.frames.wind.force_vector[:,2]
|
|
112
|
+
Drag = -results.segments[i].conditions.frames.wind.force_vector[:,0]
|
|
113
|
+
|
|
114
|
+
segment_tag = results.segments[i].tag
|
|
115
|
+
segment_name = segment_tag.replace('_', ' ')
|
|
116
|
+
|
|
117
|
+
# power
|
|
118
|
+
axis_1 = plt.subplot(2,2,1)
|
|
119
|
+
axis_1.set_ylabel(r'Power (MW)')
|
|
120
|
+
axis_1.plot(time,Power/1E6, color = line_colors[i], marker = ps.markers[0], linewidth = ps.line_width, label = segment_name)
|
|
121
|
+
set_axes(axis_1)
|
|
122
|
+
|
|
123
|
+
axis_2 = plt.subplot(2,2,2)
|
|
124
|
+
axis_2.plot(time, Thrust/1000, color = line_colors[i], marker = ps.markers[0], linewidth = ps.line_width)
|
|
125
|
+
axis_2.set_ylabel(r'Thrust (kN)')
|
|
126
|
+
set_axes(axis_2)
|
|
127
|
+
|
|
128
|
+
axis_3 = plt.subplot(2,2,3)
|
|
129
|
+
axis_3.plot(time, Lift/1000, color = line_colors[i], marker = ps.markers[0], linewidth = ps.line_width)
|
|
130
|
+
axis_3.set_xlabel('Time (mins)')
|
|
131
|
+
axis_3.set_ylabel(r'Lift (kN)')
|
|
132
|
+
set_axes(axis_3)
|
|
133
|
+
|
|
134
|
+
axis_4 = plt.subplot(2,2,4)
|
|
135
|
+
axis_4.plot(time,Drag/1000 , color = line_colors[i], marker = ps.markers[0], linewidth = ps.line_width)
|
|
136
|
+
axis_4.set_xlabel('Time (mins)')
|
|
137
|
+
axis_4.set_ylabel(r'Drag (kN)')
|
|
138
|
+
set_axes(axis_4)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
if show_legend:
|
|
142
|
+
leg = fig.legend(bbox_to_anchor=(0.5, 0.95), loc='upper center', ncol = 4)
|
|
143
|
+
leg.set_title('Flight Segment', prop={'size': ps.legend_font_size, 'weight': 'heavy'})
|
|
144
|
+
|
|
145
|
+
# Adjusting the sub-plots for legend
|
|
146
|
+
fig.tight_layout()
|
|
147
|
+
fig.subplots_adjust(top=0.8)
|
|
148
|
+
|
|
149
|
+
# set title of plot
|
|
150
|
+
title_text = 'Aerodynamic Forces'
|
|
151
|
+
fig.suptitle(title_text)
|
|
152
|
+
|
|
153
|
+
if save_figure:
|
|
154
|
+
plt.savefig(save_filename + file_type)
|
|
155
|
+
return fig
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# RCAIDE_GUI/tabs/solve/plots/aerodynamics/plot_aircraft_aerodynamics.py
|
|
2
|
+
|
|
3
|
+
# RCAIDE imports
|
|
4
|
+
from RCAIDE.Framework.Core import Units
|
|
5
|
+
from RCAIDE.Library.Plots.Common import set_axes, plot_style
|
|
6
|
+
|
|
7
|
+
# Python imports
|
|
8
|
+
import matplotlib.pyplot as plt
|
|
9
|
+
import matplotlib.cm as cm
|
|
10
|
+
import numpy as np
|
|
11
|
+
|
|
12
|
+
# ------------------------------------------------------------------------------
|
|
13
|
+
# Plot Aircraft Aerodynamics
|
|
14
|
+
# ------------------------------------------------------------------------------
|
|
15
|
+
def plot_aircraft_aerodynamics(results,
|
|
16
|
+
save_figure = False,
|
|
17
|
+
line_color = 'bo-',
|
|
18
|
+
line_color2 = 'rs--',
|
|
19
|
+
save_filename = "Aircraft_Aerodynamic_Analysis",
|
|
20
|
+
file_type = ".png",
|
|
21
|
+
width = 11, height = 7):
|
|
22
|
+
"""
|
|
23
|
+
Creates 3D surface plots of aircraft lift and drag coefficients as functions of
|
|
24
|
+
Mach number and angle of attack.
|
|
25
|
+
|
|
26
|
+
Parameters
|
|
27
|
+
----------
|
|
28
|
+
results : Results
|
|
29
|
+
RCAIDE results data structure containing:
|
|
30
|
+
- Mach : array
|
|
31
|
+
Array of Mach numbers
|
|
32
|
+
- alpha : array
|
|
33
|
+
Array of angles of attack in radians
|
|
34
|
+
- lift_coefficient : array
|
|
35
|
+
2D array of lift coefficients [Mach, alpha]
|
|
36
|
+
- drag_coefficient : array
|
|
37
|
+
2D array of drag coefficients [Mach, alpha]
|
|
38
|
+
|
|
39
|
+
save_figure : bool, optional
|
|
40
|
+
Flag for saving the figure (default: False)
|
|
41
|
+
|
|
42
|
+
line_color : str, optional
|
|
43
|
+
Color and style specification for lift plot (default: 'bo-')
|
|
44
|
+
|
|
45
|
+
line_color2 : str, optional
|
|
46
|
+
Color and style specification for drag plot (default: 'rs--')
|
|
47
|
+
|
|
48
|
+
save_filename : str, optional
|
|
49
|
+
Name of file for saved figure (default: "Aircraft_Aerodynamic_Analysis")
|
|
50
|
+
|
|
51
|
+
file_type : str, optional
|
|
52
|
+
File extension for saved figure (default: ".png")
|
|
53
|
+
|
|
54
|
+
width : float, optional
|
|
55
|
+
Figure width in inches (default: 11)
|
|
56
|
+
|
|
57
|
+
height : float, optional
|
|
58
|
+
Figure height in inches (default: 7)
|
|
59
|
+
|
|
60
|
+
Returns
|
|
61
|
+
-------
|
|
62
|
+
None
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
Notes
|
|
66
|
+
-----
|
|
67
|
+
Creates visualization showing:
|
|
68
|
+
- Aerodynamic coefficient variations
|
|
69
|
+
- Mach number effects
|
|
70
|
+
- Angle of attack sensitivity
|
|
71
|
+
- Nonlinear aerodynamic behavior
|
|
72
|
+
|
|
73
|
+
Function displays and optionally saves two 3D surface plots:
|
|
74
|
+
Left Panel:
|
|
75
|
+
- Lift coefficient surface
|
|
76
|
+
- Shows CL variation with Mach and alpha
|
|
77
|
+
- X-axis: Mach number
|
|
78
|
+
- Y-axis: Angle of attack [degrees]
|
|
79
|
+
- Z-axis: Lift coefficient
|
|
80
|
+
|
|
81
|
+
Right Panel:
|
|
82
|
+
- Drag coefficient surface
|
|
83
|
+
- Shows CD variation with Mach and alpha
|
|
84
|
+
- X-axis: Mach number
|
|
85
|
+
- Y-axis: Angle of attack [degrees]
|
|
86
|
+
- Z-axis: Drag coefficient
|
|
87
|
+
|
|
88
|
+
**Definitions**
|
|
89
|
+
|
|
90
|
+
'Mach Number'
|
|
91
|
+
Ratio of airspeed to speed of sound
|
|
92
|
+
'Angle of Attack'
|
|
93
|
+
Angle between airflow and reference line
|
|
94
|
+
'Lift Coefficient'
|
|
95
|
+
Non-dimensional lift force
|
|
96
|
+
'Drag Coefficient'
|
|
97
|
+
Non-dimensional drag force
|
|
98
|
+
|
|
99
|
+
See Also
|
|
100
|
+
--------
|
|
101
|
+
plot_aerodynamic_coefficients : Time history of coefficients
|
|
102
|
+
plot_drag_components : Drag breakdown analysis
|
|
103
|
+
"""
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
# get plotting style
|
|
107
|
+
ps = plot_style()
|
|
108
|
+
|
|
109
|
+
parameters = {'axes.labelsize': ps.axis_font_size,
|
|
110
|
+
'xtick.labelsize': ps.axis_font_size,
|
|
111
|
+
'ytick.labelsize': ps.axis_font_size,
|
|
112
|
+
'axes.titlesize': ps.title_font_size}
|
|
113
|
+
plt.rcParams.update(parameters)
|
|
114
|
+
|
|
115
|
+
#------------------------------------------------------------------------
|
|
116
|
+
# setup figures
|
|
117
|
+
#------------------------------------------------------------------------
|
|
118
|
+
fig = plt.figure()
|
|
119
|
+
fig.set_size_inches(12,6)
|
|
120
|
+
axis_1 = fig.add_subplot(1, 2, 1)
|
|
121
|
+
axis_2 = fig.add_subplot(1, 2, 2)
|
|
122
|
+
|
|
123
|
+
axis_1.plot( results.alpha/Units.degree, results.lift_coefficient)
|
|
124
|
+
axis_2.plot( results.alpha/Units.degree, results.drag_coefficient)
|
|
125
|
+
|
|
126
|
+
axis_1.set_xlabel('AoA')
|
|
127
|
+
axis_2.set_xlabel('AoA')
|
|
128
|
+
axis_1.set_ylabel('$C_L$')
|
|
129
|
+
axis_2.set_ylabel('$C_D$')
|
|
130
|
+
|
|
131
|
+
plt.tight_layout()
|
|
132
|
+
if save_figure:
|
|
133
|
+
fig.savefig(save_filename + file_type)
|
|
134
|
+
|
|
135
|
+
plt.tight_layout()
|
|
136
|
+
return
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# RCAIDE_GUI/tabs/solve/plots/aerodynamics/plot_drag_components.py
|
|
2
|
+
|
|
3
|
+
# RCAIDE imports
|
|
4
|
+
from RCAIDE.Framework.Core import Units
|
|
5
|
+
from RCAIDE.Library.Plots.Common import set_axes, plot_style
|
|
6
|
+
|
|
7
|
+
# Python imports
|
|
8
|
+
import matplotlib.pyplot as plt
|
|
9
|
+
import matplotlib.cm as cm
|
|
10
|
+
import numpy as np
|
|
11
|
+
|
|
12
|
+
# ------------------------------------------------------------------------------
|
|
13
|
+
# Plot Drag Components
|
|
14
|
+
# ------------------------------------------------------------------------------
|
|
15
|
+
def plot_drag_components(results,
|
|
16
|
+
save_figure=False,
|
|
17
|
+
show_legend= True,
|
|
18
|
+
save_filename="Drag_Components",
|
|
19
|
+
file_type=".png",
|
|
20
|
+
width = 11, height = 7):
|
|
21
|
+
"""
|
|
22
|
+
Generate plots showing the breakdown of aircraft drag components over time.
|
|
23
|
+
|
|
24
|
+
Parameters
|
|
25
|
+
----------
|
|
26
|
+
results : Data
|
|
27
|
+
Mission results data structure containing:
|
|
28
|
+
results.segments[i].conditions.aerodynamics.coefficients.drag with fields:
|
|
29
|
+
- parasite.total : array
|
|
30
|
+
Total parasite drag coefficient
|
|
31
|
+
- induced.total : array
|
|
32
|
+
Total induced drag coefficient
|
|
33
|
+
- compressible.total : array
|
|
34
|
+
Total compressibility drag coefficient
|
|
35
|
+
- miscellaneous.total : array
|
|
36
|
+
Other drag components coefficient
|
|
37
|
+
- total : array
|
|
38
|
+
Total aircraft drag coefficient
|
|
39
|
+
|
|
40
|
+
save_figure : bool, optional
|
|
41
|
+
Save figure to file if True, default False
|
|
42
|
+
|
|
43
|
+
show_legend : bool, optional
|
|
44
|
+
Display component legend if True, default True
|
|
45
|
+
|
|
46
|
+
save_filename : str, optional
|
|
47
|
+
Name for saved figure file, default "Drag_Components"
|
|
48
|
+
|
|
49
|
+
file_type : str, optional
|
|
50
|
+
File extension for saved figure, default ".png"
|
|
51
|
+
|
|
52
|
+
width : float, optional
|
|
53
|
+
Figure width in inches, default 11
|
|
54
|
+
|
|
55
|
+
height : float, optional
|
|
56
|
+
Figure height in inches, default 7
|
|
57
|
+
|
|
58
|
+
Returns
|
|
59
|
+
-------
|
|
60
|
+
fig : matplotlib.figure.Figure
|
|
61
|
+
|
|
62
|
+
Notes
|
|
63
|
+
-----
|
|
64
|
+
Creates a single plot showing:
|
|
65
|
+
- Parasite drag coefficient (CDp)
|
|
66
|
+
- Induced drag coefficient (CDi)
|
|
67
|
+
- Compressibility drag coefficient (CDc)
|
|
68
|
+
- Miscellaneous drag coefficient (CDm)
|
|
69
|
+
- Total drag coefficient (CD)
|
|
70
|
+
|
|
71
|
+
Each mission segment uses a different color from the inferno colormap.
|
|
72
|
+
Components are distinguished by different markers.
|
|
73
|
+
|
|
74
|
+
**Definitions**
|
|
75
|
+
|
|
76
|
+
'Parasite Drag'
|
|
77
|
+
Zero-lift drag due to viscous effects
|
|
78
|
+
|
|
79
|
+
'Induced Drag'
|
|
80
|
+
Drag due to lift production
|
|
81
|
+
|
|
82
|
+
'Compressibility Drag'
|
|
83
|
+
Additional drag due to shock waves
|
|
84
|
+
|
|
85
|
+
'Miscellaneous Drag'
|
|
86
|
+
Other sources including interference
|
|
87
|
+
|
|
88
|
+
See Also
|
|
89
|
+
--------
|
|
90
|
+
RCAIDE.Library.Plots.Common.set_axes : Standardized axis formatting
|
|
91
|
+
RCAIDE.Library.Plots.Common.plot_style : RCAIDE plot styling
|
|
92
|
+
"""
|
|
93
|
+
# get plotting style
|
|
94
|
+
ps = plot_style()
|
|
95
|
+
|
|
96
|
+
parameters = {'axes.labelsize': ps.axis_font_size,
|
|
97
|
+
'xtick.labelsize': ps.axis_font_size,
|
|
98
|
+
'ytick.labelsize': ps.axis_font_size,
|
|
99
|
+
'axes.titlesize': ps.title_font_size}
|
|
100
|
+
plt.rcParams.update(parameters)
|
|
101
|
+
|
|
102
|
+
# get line colors for plots
|
|
103
|
+
line_colors = cm.inferno(np.linspace(0,0.9,len(results.segments)))
|
|
104
|
+
|
|
105
|
+
fig = plt.figure(save_filename)
|
|
106
|
+
axis_1 = plt.subplot(1,1,1)
|
|
107
|
+
fig.set_size_inches(width,height)
|
|
108
|
+
|
|
109
|
+
for i in range(len(results.segments)):
|
|
110
|
+
time = results.segments[i].conditions.frames.inertial.time[:,0] / Units.min
|
|
111
|
+
drag = results.segments[i].conditions.aerodynamics.coefficients.drag
|
|
112
|
+
cdp = drag.parasite.total[:,0]
|
|
113
|
+
cdi = drag.induced.total[:,0]
|
|
114
|
+
cdc = drag.compressible.total[:,0]
|
|
115
|
+
cdm = drag.miscellaneous.total[:,0]
|
|
116
|
+
cdf = drag.form.total[:,0]
|
|
117
|
+
cdk = drag.cooling.total[:,0]
|
|
118
|
+
cd = drag.total[:,0]
|
|
119
|
+
|
|
120
|
+
if i == 0:
|
|
121
|
+
axis_1.plot(time, cdp, color = line_colors[i], marker = ps.markers[0], linewidth = ps.line_width, label = r'$C_{Dpar}$')
|
|
122
|
+
axis_1.plot(time,cdi, color = line_colors[i], marker = ps.markers[1], linewidth = ps.line_width, label = r'$C_{Dind}$')
|
|
123
|
+
axis_1.plot(time, cdc, color = line_colors[i], marker = ps.markers[2], linewidth = ps.line_width, label =r'$C_{Dcomp}$')
|
|
124
|
+
axis_1.plot(time, cdm, color = line_colors[i], marker = ps.markers[3], linewidth = ps.line_width, label =r'$C_{Dmisc}$')
|
|
125
|
+
axis_1.plot(time,cdw, color = line_colors[i], marker = ps.markers[4], linewidth = ps.line_width, label = r'$C_{Dwave}$')
|
|
126
|
+
axis_1.plot(time, cdk, color = line_colors[i], marker = ps.markers[5], linewidth = ps.line_width, label =r'$C_{Dcool}$')
|
|
127
|
+
axis_1.plot(time, cdf, color = line_colors[i], marker = ps.markers[6], linewidth = ps.line_width, label =r'$C_{Dform}$')
|
|
128
|
+
axis_1.plot(time, cd, color = line_colors[i], marker = ps.markers[7], linewidth = ps.line_width, label =r'$C_D$')
|
|
129
|
+
else:
|
|
130
|
+
axis_1.plot(time, cdp, color = line_colors[i], marker = ps.markers[0], linewidth = ps.line_width,)
|
|
131
|
+
axis_1.plot(time,cdi, color = line_colors[i], marker = ps.markers[1], linewidth = ps.line_width, )
|
|
132
|
+
axis_1.plot(time, cdc, color = line_colors[i], marker = ps.markers[2], linewidth = ps.line_width,)
|
|
133
|
+
axis_1.plot(time, cdm, color = line_colors[i], marker = ps.markers[3], linewidth = ps.line_width,)
|
|
134
|
+
axis_1.plot(time,cdw, color = line_colors[i], marker = ps.markers[4], linewidth = ps.line_width, )
|
|
135
|
+
axis_1.plot(time, cdk, color = line_colors[i], marker = ps.markers[5], linewidth = ps.line_width,)
|
|
136
|
+
axis_1.plot(time, cdf, color = line_colors[i], marker = ps.markers[6], linewidth = ps.line_width,)
|
|
137
|
+
axis_1.plot(time, cd, color = line_colors[i], marker = ps.markers[7], linewidth = ps.line_width, )
|
|
138
|
+
|
|
139
|
+
set_axes(axis_1)
|
|
140
|
+
axis_1.set_xlabel('Time (mins)')
|
|
141
|
+
axis_1.set_ylabel('Drag Components')
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
if show_legend:
|
|
145
|
+
leg = fig.legend(bbox_to_anchor=(0.5, 0.95), loc='upper center', ncol = 5)
|
|
146
|
+
|
|
147
|
+
# Adjusting the sub-plots for legend
|
|
148
|
+
fig.tight_layout()
|
|
149
|
+
fig.subplots_adjust(top=0.8)
|
|
150
|
+
|
|
151
|
+
# set title of plot
|
|
152
|
+
title_text = 'Drag Components'
|
|
153
|
+
fig.suptitle(title_text)
|
|
154
|
+
|
|
155
|
+
if save_figure:
|
|
156
|
+
plt.savefig(save_filename + file_type)
|
|
157
|
+
return fig
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# RCAIDE_GUI/tabs/solve/plots/aerodynamics/plot_lift_distribution.py
|
|
2
|
+
|
|
3
|
+
# RCAIDE imports
|
|
4
|
+
from RCAIDE.Library.Plots.Common import plot_style
|
|
5
|
+
|
|
6
|
+
# Python imports
|
|
7
|
+
import matplotlib.pyplot as plt
|
|
8
|
+
import numpy as np
|
|
9
|
+
|
|
10
|
+
# ------------------------------------------------------------------------------
|
|
11
|
+
# Plot Lift Distribution
|
|
12
|
+
# ------------------------------------------------------------------------------
|
|
13
|
+
|
|
14
|
+
def plot_lift_distribution(results,
|
|
15
|
+
save_figure = False,
|
|
16
|
+
save_filename = "Lift_Distribution",
|
|
17
|
+
file_type = ".png",
|
|
18
|
+
width = 11, height = 7):
|
|
19
|
+
"""
|
|
20
|
+
Generate plots of spanwise lift distribution for lifting surfaces.
|
|
21
|
+
|
|
22
|
+
Parameters
|
|
23
|
+
----------
|
|
24
|
+
results : Data
|
|
25
|
+
Mission results data structure containing:
|
|
26
|
+
- results.segments.conditions.aerodynamics.coefficients.lift with fields:
|
|
27
|
+
- inviscid_wings_sectional : array
|
|
28
|
+
Sectional lift coefficients at control points
|
|
29
|
+
|
|
30
|
+
save_figure : bool, optional
|
|
31
|
+
Save figure to file if True, default False
|
|
32
|
+
|
|
33
|
+
save_filename : str, optional
|
|
34
|
+
Base name for saved figure files, default "Lift_Distribution"
|
|
35
|
+
|
|
36
|
+
file_type : str, optional
|
|
37
|
+
File extension for saved figure, default ".png"
|
|
38
|
+
|
|
39
|
+
width : float, optional
|
|
40
|
+
Figure width in inches, default 11
|
|
41
|
+
|
|
42
|
+
height : float, optional
|
|
43
|
+
Figure height in inches, default 7
|
|
44
|
+
|
|
45
|
+
Returns
|
|
46
|
+
-------
|
|
47
|
+
fig : matplotlib.figure.Figure
|
|
48
|
+
Figure showing spanwise lift distribution
|
|
49
|
+
|
|
50
|
+
Notes
|
|
51
|
+
-----
|
|
52
|
+
Creates figures showing:
|
|
53
|
+
- Sectional lift coefficient (CLy) vs spanwise location
|
|
54
|
+
- Separate plot for each timestep in each segment
|
|
55
|
+
- Different wings distinguished by line colors:
|
|
56
|
+
- Blue: Main wings
|
|
57
|
+
- Red: Horizontal tails
|
|
58
|
+
- Black: Other surfaces
|
|
59
|
+
|
|
60
|
+
**Definitions**
|
|
61
|
+
|
|
62
|
+
'Sectional Lift Coefficient'
|
|
63
|
+
Non-dimensional lift force per unit span
|
|
64
|
+
|
|
65
|
+
'Control Points'
|
|
66
|
+
Points where circulation/lift is evaluated
|
|
67
|
+
|
|
68
|
+
See Also
|
|
69
|
+
--------
|
|
70
|
+
RCAIDE.Library.Plots.Common.set_axes : Standardized axis formatting
|
|
71
|
+
RCAIDE.Library.Plots.Common.plot_style : RCAIDE plot styling
|
|
72
|
+
"""
|
|
73
|
+
|
|
74
|
+
# get plotting style
|
|
75
|
+
ps = plot_style()
|
|
76
|
+
|
|
77
|
+
parameters = {'axes.labelsize': ps.axis_font_size,
|
|
78
|
+
'xtick.labelsize': ps.axis_font_size,
|
|
79
|
+
'ytick.labelsize': ps.axis_font_size,
|
|
80
|
+
'axes.titlesize': ps.title_font_size}
|
|
81
|
+
plt.rcParams.update(parameters)
|
|
82
|
+
|
|
83
|
+
VD = results.segments[0].analyses.aerodynamics.settings.vortex_distribution
|
|
84
|
+
img_idx = 1
|
|
85
|
+
seg_idx = 1
|
|
86
|
+
for segment in results.segments.values():
|
|
87
|
+
num_ctrl_pts = len(segment.conditions.frames.inertial.time)
|
|
88
|
+
for ti in range(num_ctrl_pts):
|
|
89
|
+
line = ['-b','-b','-r','-r','-k']
|
|
90
|
+
fig = plt.figure(save_filename + '_' + str(img_idx))
|
|
91
|
+
fig.set_size_inches(8,8)
|
|
92
|
+
fig.set_size_inches(width,height)
|
|
93
|
+
b_sw = np.concatenate(([0],np.cumsum(VD.n_sw[ti])))
|
|
94
|
+
axes = plt.subplot(1,1,1)
|
|
95
|
+
for i in range(int(VD.n_w[ti]) ):
|
|
96
|
+
y_pts = VD.Y_SW[ti,b_sw[i]:b_sw[i+1]]
|
|
97
|
+
z_pts = segment.conditions.aerodynamics.coefficients.lift.inviscid.spanwise[ti,b_sw[i]:b_sw[i+1]]
|
|
98
|
+
axes.plot(y_pts, z_pts, line[i] )
|
|
99
|
+
axes.set_xlabel("Spanwise Location (m)")
|
|
100
|
+
axes.set_ylabel('$C_{Ly}$')
|
|
101
|
+
|
|
102
|
+
if save_figure:
|
|
103
|
+
plt.savefig( save_filename + '_' + str(img_idx) + file_type)
|
|
104
|
+
img_idx += 1
|
|
105
|
+
seg_idx +=1
|
|
106
|
+
|
|
107
|
+
return fig
|