pterasoftware.movements.free_flight_airplane_movement¶
Contains the FreeFlightAirplaneMovement class.
Classes¶
A class used to contain an Airplane’s movement in a free flight simulation. |
Module Contents¶
- class pterasoftware.movements.free_flight_airplane_movement.FreeFlightAirplaneMovement(base_airplane: pterasoftware.geometry.airplane.Airplane, wing_movements: list[pterasoftware.movements.free_flight_wing_movement.FreeFlightWingMovement], ampCg_GP1_CgP1: numpy.ndarray | collections.abc.Sequence[float | int] = (0.0, 0.0, 0.0), periodCg_GP1_CgP1: numpy.ndarray | collections.abc.Sequence[float | int] = (0.0, 0.0, 0.0), spacingCg_GP1_CgP1: numpy.ndarray | collections.abc.Sequence[str | collections.abc.Callable[[float], float]] = ('sine', 'sine', 'sine'), phaseCg_GP1_CgP1: numpy.ndarray | collections.abc.Sequence[float | int] = (0.0, 0.0, 0.0))[source]¶
A class used to contain an Airplane’s movement in a free flight simulation.
In free flight, airplane geometry is prescribed (the same oscillation based generation as AirplaneMovement). This class exists so that a FreeFlightMovement always accepts FreeFlightAirplaneMovements, keeping the free flight movement hierarchy consistently named.
Contains the following methods:
__deepcopy__: Creates a deep copy of this FreeFlightAirplaneMovement.
all_periods: All unique non zero periods from this FreeFlightAirplaneMovement, its FreeFlightWingMovement(s), and their FreeFlightWingCrossSectionMovements.
max_period: The longest period of FreeFlightAirplaneMovement’s own motion, the motion(s) of its sub movement object(s), and the motions of its sub sub movement objects.
generate_airplane_at_time_step: Creates the Airplane at a single time step.
generate_airplanes: Creates the Airplane at each time step, and returns them in a list.
- Parameters:
base_airplane – The base Airplane from which the Airplane at each time step will be created.
wing_movements – A list of the FreeFlightWingMovements associated with each of the base Airplane’s Wings. It must have the same length as the base Airplane’s list of Wings.
ampCg_GP1_CgP1 – An array-like object of non negative numbers (int or float) with shape (3,) representing the amplitudes of the FreeFlightAirplaneMovement’s changes in its Airplanes’ Cg_GP1_CgP1 parameters. Can be a tuple, list, or ndarray. Values are converted to floats internally. Each amplitude must be low enough that it doesn’t drive its base value out of the range of valid values. Otherwise, this FreeFlightAirplaneMovement will try to create Airplanes with invalid parameter values. Because the first Airplane’s Cg_GP1_CgP1 parameter must be all zeros, this means that the first Airplane’s ampCg_GP1_CgP1 parameter must also be all zeros. The units are in meters. The default is (0.0, 0.0, 0.0).
periodCg_GP1_CgP1 – An array-like object of non negative numbers (int or float) with shape (3,) representing the periods of the FreeFlightAirplaneMovement’s changes in its Airplanes’ Cg_GP1_CgP1 parameters. Can be a tuple, list, or ndarray. Values are converted to floats internally. Each element must be 0.0 if the corresponding element in ampCg_GP1_CgP1 is 0.0 and non zero if not. The units are in seconds. The default is (0.0, 0.0, 0.0).
spacingCg_GP1_CgP1 – An array-like object of strs or callables with shape (3,) representing the spacing of the FreeFlightAirplaneMovement’s changes in its Airplanes’ Cg_GP1_CgP1 parameters. Can be a tuple, list, or ndarray. Each element can be the str “sine”, the str “uniform”, or a callable custom spacing function. Custom spacing functions are for advanced users and must start at 0.0, return to 0.0 after one period of 2.0 * pi radians, have amplitude of 1.0, be periodic, return finite values only, and accept a float as input and return a float. Custom functions are scaled by ampCg_GP1_CgP1, shifted horizontally and vertically by phaseCg_GP1_CgP1 and the base value, and have a period set by periodCg_GP1_CgP1. The default is (“sine”, “sine”, “sine”).
phaseCg_GP1_CgP1 – An array-like object of numbers (int or float) with shape (3,) representing the phase offsets of the elements in the first time step’s Airplane’s Cg_GP1_CgP1 parameter relative to the base Airplane’s Cg_GP1_CgP1 parameter. Can be a tuple, list, or ndarray. Elements must lie in the range (-180.0, 180.0]. Each element must be 0.0 if the corresponding element in ampCg_GP1_CgP1 is 0.0 and non zero if not. Values are converted to floats internally. The units are in degrees. The default is (0.0, 0.0, 0.0).
- Returns:
None
- property all_periods: tuple[float, Ellipsis]¶
All unique non zero periods of motion from this Airplane, each Wing’s movement class, and each WingCrossSection’s movement class.
- Returns:
A tuple of all unique non zero periods in seconds. If all motion is static, this will be an empty tuple.
- property max_period: float¶
The longest period of motion across this Airplane, each Wing’s movement class, and each WingCrossSection’s movement class.
- Returns:
The longest period in seconds. If all the motion is static, this will be 0.0.
- generate_airplane_at_time_step(step: int, delta_time: float | int) pterasoftware.geometry.airplane.Airplane¶
Creates the Airplane at a single time step.
- Parameters:
step – The time step index. Must be a non negative int.
delta_time – The time between each time step in seconds. Must be a positive number (int or float).
- Returns:
The Airplane at this time step.
- generate_airplanes(num_steps: int, delta_time: float | int) list[pterasoftware.geometry.airplane.Airplane]¶
Creates the Airplane at each time step, and returns them in a list.
For static geometry (no periodic motion), this method optimizes performance by creating the first Airplane with full mesh generation, then using deepcopy for subsequent time steps. This avoids redundant mesh generation when the geometry is identical across all steps.
- Parameters:
num_steps – The number of time steps in this movement. It must be a positive int.
delta_time – The time between each time step. It must be a positive number (float or int), and will be converted internally to a float. The units are in seconds.
- Returns:
The list of Airplanes associated with this CoreAirplaneMovement.