aerosandbox.geometry.airplane
#
Module Contents#
Classes#
Definition for an airplane. |
Functions#
|
- class aerosandbox.geometry.airplane.Airplane(name=None, xyz_ref=None, wings=None, fuselages=None, propulsors=None, s_ref=None, c_ref=None, b_ref=None, analysis_specific_options=None)[source]#
Bases:
aerosandbox.AeroSandboxObject
Definition for an airplane.
Anatomy of an Airplane:
An Airplane consists chiefly of a collection of wings and fuselages. These can be accessed with Airplane.wings and Airplane.fuselages, which gives a list of those respective components. Each wing is a Wing object, and each fuselage is a Fuselage object.
- Parameters:
name (Optional[str]) –
xyz_ref (Union[aerosandbox.geometry.common.np.ndarray, List]) –
wings (Optional[List[aerosandbox.geometry.wing.Wing]]) –
fuselages (Optional[List[aerosandbox.geometry.fuselage.Fuselage]]) –
propulsors (Optional[List[aerosandbox.geometry.propulsor.Propulsor]]) –
s_ref (Optional[float]) –
c_ref (Optional[float]) –
b_ref (Optional[float]) –
analysis_specific_options (Optional[Dict[type, Dict[str, Any]]]) –
- mesh_body(method='quad', thin_wings=False, stack_meshes=True)[source]#
Returns a surface mesh of the Airplane, in (points, faces) format. For reference on this format, see the documentation in aerosandbox.geometry.mesh_utilities.
- Parameters:
method –
thin_wings – Controls whether wings should be meshed as thin surfaces, rather than full 3D bodies.
stack_meshes –
Controls whether the meshes should be merged into a single mesh or not.
If True, returns a (points, faces) tuple in standard mesh format.
If False, returns a list of (points, faces) tuples in standard mesh format.
Returns:
- draw(backend='pyvista', thin_wings=False, ax=None, use_preset_view_angle=None, set_background_pane_color=None, set_background_pane_alpha=None, set_lims=True, set_equal=True, set_axis_visibility=None, show=True, show_kwargs=None)[source]#
Produces an interactive 3D visualization of the airplane.
- Parameters:
backend (str) –
The visualization backend to use. Options are:
”matplotlib” for a Matplotlib backend
”pyvista” for a PyVista backend
”plotly” for a Plot.ly backend
”trimesh” for a trimesh backend
thin_wings (bool) – A boolean that determines whether to draw the full airplane (i.e. thickened, 3D bodies), or to use a
objects. (thin-surface representation for any Wing) –
show (bool) – A boolean that determines whether to display the object after plotting it. If False, the object is
True (returned but not displayed. If) –
returned. (the object is displayed and) –
use_preset_view_angle (str) –
set_background_pane_color (Union[str, Tuple[float, float, float]]) –
set_background_pane_alpha (float) –
set_lims (bool) –
set_equal (bool) –
set_axis_visibility (bool) –
show_kwargs (Dict) –
Returns: The plotted object, in its associated backend format. Also displays the object if show is True.
- draw_wireframe(ax=None, color='k', thin_linewidth=0.2, thick_linewidth=0.5, fuselage_longeron_theta=None, use_preset_view_angle=None, set_background_pane_color=None, set_background_pane_alpha=None, set_lims=True, set_equal=True, set_axis_visibility=None, show=True)[source]#
Draws a wireframe of the airplane on a Matplotlib 3D axis.
- Parameters:
ax – The axis to draw on. Must be a 3D axis. If None, creates a new axis.
color – The color of the wireframe.
thin_linewidth – The linewidth of the thin lines.
use_preset_view_angle (str) –
set_background_pane_color (Union[str, Tuple[float, float, float]]) –
set_background_pane_alpha (float) –
set_lims (bool) –
set_equal (bool) –
set_axis_visibility (bool) –
show (bool) –
- draw_three_view(style='shaded', show=True)[source]#
Draws a standard 4-panel three-view diagram of the airplane using Matplotlib backend. Creates a new figure.
- Parameters:
style (str) –
Determines what drawing style to use for the three-view. A string, one of:
”shaded”
”wireframe”
show (bool) – A boolean of whether to show the figure after creating it, or to hold it so that the user can modify the figure further before showing.
Returns:
- is_entirely_symmetric()[source]#
Returns a boolean describing whether the airplane is geometrically entirely symmetric across the XZ-plane. :return: [boolean]
- aerodynamic_center(chord_fraction=0.25)[source]#
Computes the approximate location of the aerodynamic center of the wing. Uses the generalized methodology described here:
- Parameters:
chord_fraction (float) – The position of the aerodynamic center along the MAC, as a fraction of MAC length.
Typically (denoted h_0 in the literature) –
value (this) –
Cook (wing-fuselage interactions can cause a forward shift to a value more like 0.1 or less. Citing) –
:param : :param Michael V.: :param “Flight Dynamics Principles”: :param 3rd Ed.: :param Sect. 3.5.3 “Controls-fixed static stability”. PDF: :param https: //www.sciencedirect.com/science/article/pii/B9780080982427000031
Returns: The (x, y, z) coordinates of the aerodynamic center of the airplane.
- with_control_deflections(control_surface_deflection_mappings)[source]#
Returns a copy of the airplane with the specified control surface deflections applied.
- Parameters:
control_surface_deflection_mappings (Dict[str, float]) –
A dictionary mapping control surface names to deflections.
Keys: Control surface names.
Values: Deflections, in degrees. Downwards-positive, following typical convention.
- Return type:
Returns: A copy of the airplane with the specified control surface deflections applied.
- generate_cadquery_geometry(minimum_airfoil_TE_thickness=0.001, fuselage_tol=0.0001)[source]#
Uses the CADQuery library (OpenCASCADE backend) to generate a 3D CAD model of the airplane.
- Parameters:
minimum_airfoil_TE_thickness (float) – The minimum thickness of the trailing edge of the airfoils, as a fraction
if (of each airfoil's chord. This will be enforced by thickening the trailing edge of the airfoils) –
extremely (necessary. This is useful for avoiding numerical issues in CAD software that can arise from) –
thin (i.e., <1e-6 meters) –
tol – The geometric tolerance (meters) to use when generating the CAD geometry. This is passed directly to the CADQuery
fuselage_tol (float) –
- Return type:
Workplane
Returns: A CADQuery Workplane object containing the CAD geometry of the airplane.
- export_cadquery_geometry(filename, minimum_airfoil_TE_thickness=0.001)[source]#
Exports the airplane geometry to a STEP file.
- Parameters:
filename (Union[pathlib.Path, str]) – The filename to export to. Should include the “.step” extension.
minimum_airfoil_TE_thickness (float) – The minimum thickness of the trailing edge of the airfoils, as a fraction
if (of each airfoil's chord. This will be enforced by thickening the trailing edge of the airfoils) –
extremely (necessary. This is useful for avoiding numerical issues in CAD software that can arise from) –
thin (i.e., <1e-6 meters) –
- Return type:
None
Returns: None, but exports the airplane geometry to a STEP file.
- export_XFLR5_xml(filename, mass_props=None, include_fuselages=False, mainwing=None, elevator=None, fin=None)[source]#
Exports the airplane geometry to an XFLR5 .xml file. To import the .xml file into XFLR5, go to File -> Import -> Import from XML.
- Parameters:
filename (Union[pathlib.Path, str]) – The filename to export to. Should include the “.xml” extension.
mass_props (aerosandbox.weights.mass_properties.MassProperties) –
The MassProperties object to use when exporting the airplane. If not specified, will default to a 1 kg point mass at the origin.
Note: XFLR5 does not natively support user-defined inertia tensors, so we have to synthesize an equivalent
set of point masses to represent the inertia tensor.
include_fuselages (bool) – Whether to include fuselages in the export.
mainwing (aerosandbox.geometry.wing.Wing) – The main wing of the airplane. If not specified, will default to the first wing in the airplane.
elevator (aerosandbox.geometry.wing.Wing) – The elevator of the airplane. If not specified, will default to the second wing in the airplane.
fin (aerosandbox.geometry.wing.Wing) – The fin of the airplane. If not specified, will default to the third wing in the airplane.
- Return type:
str
Returns: None, but exports the airplane geometry to an XFLR5 .xml file.
To import the .xml file into XFLR5, go to File -> Import -> Import from XML.
- export_OpenVSP_vspscript(filename)[source]#
Exports the airplane geometry to a *.vspscript file compatible with OpenVSP. To import the .vspscript file into OpenVSP:
Open OpenVSP, then File -> Run Script -> Select the .vspscript file.
- Parameters:
filename (Union[pathlib.Path, str]) – The filename to export to, given as a string or Path. Should include the “.vspscript” extension.
- Return type:
str
Returns: A string of the file contents, and also saves the file to the specified filename