Source code for RCAIDE.Library.Components.Component
# RCAIDE/Library/Components/Component.py
#
# Created: Mar 2024, M. Clarke
# ----------------------------------------------------------------------------------------------------------------------
# IMPORT
# ----------------------------------------------------------------------------------------------------------------------
from RCAIDE.Framework.Core import Container as ContainerBase
from RCAIDE.Framework.Core import Data
from .Mass_Properties import Mass_Properties
from .Volume_Properties import Volume_Properties
# package imports
import numpy as np
# ----------------------------------------------------------------------------------------------------------------------
# Component
# ----------------------------------------------------------------------------------------------------------------------
[docs]
class Component(Data):
"""
Base class for all physical components in an aircraft configuration.
Attributes
----------
tag : str
Unique identifier for the component, defaults to 'Component'
mass_properties : Mass_Properties
Mass and inertia properties, initialized empty
volume_properties : Volume_Properties
Volume Properties, initialized empty
xz_plane_symmetric : bool
Flag indicating if wing is xz_plane_symmetric about x-z plane, defaults to True
yz_plane_symmetric : bool
Flag indicating if wing is yz_plane_symmetric about y-z plane, defaults to True
xy_plane_symmetric : bool
Flag indicating if wing is xy_plane_symmetric about x-y plane, defaults to True
origin : ndarray
3D coordinates [x, y, z] defining component's reference point,
defaults to [0.0, 0.0, 0.0]
orientation_euler_angles : list of float
Intrinsic X→Y→Z Euler angles ``[φ_x, φ_y, φ_z]`` in radians that map
the component frame to the vehicle body frame.
Applied via ``scipy.spatial.transform.Rotation.from_euler('xyz', ...)``:
first rotate φ_x about X, then φ_y about the new Y, then φ_z about the
new Z. ``[0.0, 0.0, 0.0]`` (default) means the component is aligned with
the vehicle body axes (e.g. thrust along vehicle +x).
Common example: ``[0, π/2, 0]`` rotates 90° about Y, pointing thrust in
the vehicle +z direction (used for lift rotors).
Notes
-----
The Component class serves as the foundation for all physical parts in RCAIDE.
It provides:
* Basic geometric positioning
* Mass properties tracking
* Container functionality for sub-components
See Also
--------
RCAIDE.Library.Components.Mass_Properties
Class containing mass and inertia data
RCAIDE.Framework.Core.Data
Parent class providing data structure functionality
"""
def __defaults__(self):
"""
Sets default values for the component attributes.
"""
self.tag = 'Component'
self.mass_properties = Mass_Properties()
self.volume_properties = Volume_Properties()
self.origin = np.array([[0.0,0.0,0.0]])
self.orientation_euler_angles = [0.0, 0.0, 0.0]
self.xz_plane_symmetric = False
self.xy_plane_symmetric = False
self.yz_plane_symmetric = False
[docs]
def compute_center_of_gravity(self, vehicle):
return
[docs]
def compute_moments_of_inertia(self,vehicle,center_of_gravity=[[0, 0, 0]]):
return
# ----------------------------------------------------------------------------------------------------------------------
# Component Container
# ----------------------------------------------------------------------------------------------------------------------
[docs]
class Container(ContainerBase):
"""
Container class for managing collections of components.
Notes
-----
The Container class provides organization and mass calculation functionality
for groups of components. Key features include:
* Recursive mass summation
* Moment calculation about reference points
* Component hierarchy management
See Also
--------
RCAIDE.Framework.Core.Container
Parent class providing base container functionality
"""
pass
# ------------------------------------------------------------
# Handle Linking
# ------------------------------------------------------------
Component.Container = Container