flight_mech.plane module#

Module to compute the plane performances.

class flight_mech.plane.Plane(plane_data_name: str | None = None, plane_database_folder: str = '/home/runner/work/flight-mech/flight-mech/flight_mech/plane_database', plane_parameters_dict: dict | None = None)[source]#

Bases: object

Model to define a plane and compute its characteristics.

C_D(alpha: float | None = None, C_L: float | None = None) float[source]#

Compute the drag coefficient for a given angle of incidence or lift coefficient.

Parameters:
  • alpha (float, optional) – Angle of incidence, by default None

  • C_L (float, optional) – Lift coefficient, by default None

Returns:

Drag coefficient.

Return type:

float

C_D_0: float | None = None#
C_L(alpha: float) float[source]#

Compute the lift coefficient for the given angle of incidence.

Parameters:

alpha (float) – Angle of incidence.

Returns:

Lift coefficient.

Return type:

float

C_L_alpha: float | None = None#
C_L_delta: float | None = None#
property C_L_f_max#

Lift coefficient at max gliding ratio.

C_L_max: float | None = None#
C_m_0: float | None = None#
C_m_alpha: float | None = None#
C_m_delta: float | None = None#
P: float | None = None#
S: float | None = None#
alpha_0: float | None = 0.0#
property alpha_f_max#

Angle of incidence at max gliding ratio.

alpha_stall: float = 0.2617993877991494#
atmosphere_model#

alias of StandardAtmosphere

b: float | None = None#
compute_alpha_and_delta_at_flight_point(z: float = 0, v: float | None = None)[source]#

Compute the angle of incidence and the angle of control surface of the tailplane at a given flight point.

Parameters:
  • z (float, optional) – Altitude in meters, by default 0

  • v (float | None, optional) – Velocity in m.s-1, by default None

Returns:

Tuple containing the angle of incidence and angle of control surface for the tail plane.

Return type:

tuple[float,float]

compute_ascension_slope(alpha: float, z: float) float[source]#

Compute the ascension slope at a given incidence.

Parameters:
  • alpha (float) – Angle of incidence in rad.

  • z (float) – Altitude in meters.

Returns:

Ascension slope in rad.

Return type:

float

compute_drag(v: float, z: float, alpha: float | None = None, C_L: float | None = None) float[source]#

Compute the drag at a given velocity, altitude and angle of incidence or lift coefficient.

Parameters:
  • v (float) – Velocity.

  • z (float) – Altitude.

  • alpha (float | None, optional) – Angle of incidence, by default None

  • C_L (float | None, optional) – Lift coefficient, by default None

Returns:

Drag force.

Return type:

float

compute_drag_with_ground_effect(v: float, z: float, alpha: float | None = None, C_L: float | None = None) float[source]#

Compute the total drag, taking the ground effect into account.

Parameters:
  • v (float) – Velocity in m.s-1

  • z (float) – Altitude in m

  • alpha (float | None, optional) – Angle of incidence in rad, by default None

  • C_L (float | None, optional) – Lift coefficient, by default None

Returns:

Drag with ground effect in N.

Return type:

float

compute_endurance(alpha: float | None = None, f: float | None = None)[source]#

Compute the amount of time that the plane can stay at the same altitude.

Parameters:
  • alpha (float | None, optional) – Angle of incidence in rad, if not specified the glide ratio will be used instead, by default None

  • f (float | None, optional) – Glide ratio, if not specified the angle of incidence will be used instead, by default None

Returns:

Amount of time the plane can stay at the same altitude in seconds.

Return type:

float

compute_gliding_speed(alpha: float, z: float) float[source]#

Compute the gliding speed at a given angle of incidence and altitude.

Parameters:
  • alpha (float) – Angle of incidence.

  • z (float) – Altitude.

Returns:

Gliding speed.

Return type:

float

compute_gliding_v_z_min(z: float) float[source]#

Compute the minimum gliding vertical speed at a given altitude.

Parameters:

z (float) – Altitude.

Returns:

Minimum gliding vertical speed.

Return type:

float

compute_ground_effect(alpha: float | None = None, C_L: float | None = None) float[source]#

Compute the additional drag due to the ground effect.

Parameters:
  • alpha (float | None, optional) – Angle of incidence in rad, by default None

  • C_L (float | None, optional) – Lift coefficient, by default None

Returns:

Ground effect drag force in N.

Return type:

float

compute_landing_distance(z: float, mu: float, reverse_thrust: float = 0.0, C_L: float = 0.0, C_L_max: float | None = None)[source]#

Compute the landing distance.

Parameters:
  • z (float) – Altitude in meters.

  • mu (float) – Friction coefficient of the landing way.

  • reverse_thrust (float, optional) – Reverse thrust force, by default 0.

  • C_L (float | None, optional) – Lift coefficient used to compute the drag and lift on the landing way, by default 0.

  • C_L_max (float | None, optional) – Max lift coefficient, by default None

Returns:

Landing distance.

Return type:

float

compute_landing_speed(z: float)[source]#

Compute the plane landing speed.

Parameters:

z (float) – Altitude in meters.

Returns:

Landing speed.

Return type:

float

compute_lift(v: float, z: float, alpha: float | None = None, C_L: float | None = None) float[source]#

Compute the lift at a given velocity, altitude and angle of incidence or lift coefficient.

Parameters:
  • v (float) – Velocity.

  • z (float) – Altitude.

  • alpha (float | None, optional) – Angle of incidence, by default None

  • C_L (float | None, optional) – Lift coefficient, by default None

Returns:

Lift force.

Return type:

float

compute_load_factor_from_roll_angle(phi: float)[source]#

Compute the load angle for a roll at the given angle.

Parameters:

phi (float) – Angle of roll.

Returns:

Load factor.

Return type:

float

compute_max_altitude() float[source]#

Compute the max altitude that the plane can reach.

Returns:

Max altitude.

Return type:

float

compute_max_ascension_slope(z: float)[source]#

Compute the maximum ascension slope.

Parameters:

z (float) – Altitude in meters.

Returns:

Maximum ascension slope in rad.

Return type:

float

compute_max_ascension_speed(z: float) float[source]#

Compute the maximum ascension speed.

Parameters:

z (float) – Altitude in meters.

Returns:

Maximum ascension speed.

Return type:

float

compute_max_gliding_range(z: float)[source]#

Compute the max gliding range at a given altitude.

Parameters:

z (float) – Altitude.

Returns:

Max gliding range.

Return type:

float

compute_max_gliding_time(z: float) float[source]#

Compute the maximum gliding time at a given altitude.

Parameters:

z (float) – Altitude.

Returns:

Maximum gliding time.

Return type:

float

compute_max_range_at_fixed_altitude(z: float)[source]#

Compute the maximum range at a fixed altitude.

Parameters:

z (float) – Altitude in meters.

Returns:

Maximum range in meters.

Return type:

float

compute_min_descent_gliding_slope() float[source]#

Compute the minimum descent slope when gliding.

Returns:

Minimum descent gliding slope.

Return type:

float

compute_min_thrust_needed()[source]#

Compute the minimal thrust needed to fly.

Returns:

Minimal thrust in N.

Return type:

float

compute_normalized_thrust(z: float) float[source]#

Compute the normalized thrust at a given altitude.

Parameters:

z (float) – Altitude.

Returns:

Normalized thrust.

Return type:

float

compute_range_at_fixed_speed(v: float, alpha: float | None = None, f: float | None = None)[source]#

Compute the maximum range at a fixed speed.

Parameters:
  • v (float) – Speed in m.s-1.

  • alpha (float | None, optional) – Angle of incidence, by default None

  • f (float | None, optional) – Glide ratio, by default None

Returns:

Maximum range in meters.

Return type:

float

compute_reference_speed(z: float) float[source]#

Corresponds to the gliding velocity at f_max.

Parameters:

z (float) – Altitude of the plane.

Returns:

Reference velocity.

Return type:

float

compute_speed_for_max_ascension_speed(z: float) float[source]#

Compute the velocity that gives the maximum ascension speed.

Parameters:

z (float) – Altitude in meters.

Returns:

Velocity giving the maximum ascension speed.

Return type:

float

compute_speed_for_min_power_needed(z: float) float[source]#

Compute the speed at the minimum power.

Parameters:

z (float) – Altitude.

Returns:

Speed at the minimum power.

Return type:

float

compute_speed_for_min_thrust_needed(z: float) float[source]#

Compute the speed at the minimum thrust.

Parameters:

z (float) – Altitude.

Returns:

Speed at the minimum thrust.

Return type:

float

compute_stall_speed(z: float = 0.0, alpha_stall: float | None = None, C_L_max: float | None = None) float[source]#

Compute the stall speed at a given altitude.

Parameters:
  • z (float, optional) – Altitude, by default 0.

  • alpha_stall (float | None, optional) – Stall angle, by default None

  • C_L_max (float | None, optional) – Max lift coefficient, by default None

Returns:

Stall speed.

Return type:

float

compute_take_off_distance_no_friction(z: float) float[source]#

Compute the take off distance of the plane without taking the ground friction in account.

Parameters:

z (float) – Altitude in meters.

Returns:

Take off distance in meters.

Return type:

float

compute_take_off_distance_with_friction(z: float, mu: float, C_L_max: float | None = None)[source]#

Compute the take off distance, taking into account the friction.

Parameters:
  • z (float) – Altitude in meters

  • mu (float) – Friction coefficient of the landing way.

  • C_L_max (float | None, optional) – Max lift coefficient, by default None

Returns:

Take off distance.

Return type:

float

compute_take_off_speed(z: float)[source]#

Compute the plane take off speed.

Parameters:

z (float) – Altitude in meters.

Returns:

Take off speed.

Return type:

float

compute_thrust(z: float) float[source]#

Compute the thrust at a given altitude.

Parameters:

z (float) – Altitude.

Returns:

Thrust force.

Return type:

float

Raises:

NotImplementedError – The engines types other than turbo-reactor are currently not supported.

compute_thrust_needed(alpha: float, z: float)[source]#

Compute the thrust needed for the plane at a given angle of incidence and altitude.

This does not take into account the stall effect.

Parameters:
  • alpha (float) – Angle of incidence.

  • z (float) – Altitude.

Returns:

Thrust needed.

Return type:

float

compute_v_at_gliding_v_z_min(z: float) float[source]#

Compute the velocity associated to the minimum gliding vertical speed at a given altitude.

Parameters:

z (float) – Altitude.

Returns:

Velocity associated to the minimum gliding vertical speed.

Return type:

float

compute_velocity_interval_for_fixed_thrust(z: float) tuple[float, float][source]#

Compute the velocity interval that is available with the thrust of the plane at a given altitude.

Parameters:

z (float) – Altitude in meters.

Warning

This velocity interval does not take into account the stall velocity. The minimum velocity can therefore be inferior to the stall velocity.

Returns:

Tuple containing the min and max velocity.

Return type:

tuple[float,float]

engine_type: Literal['moto-propeller', 'turbo-reactor'] = 'turbo-reactor'#
environment_model#

alias of EarthEnvironment

property extension: float#

Extension coefficient of the wings.

f(alpha: float) float[source]#

Compute the gliding ratio at a given angle of incidence.

Parameters:

alpha (float) – Angle of incidence.

Returns:

Gliding ratio.

Return type:

float

property f_max: float#

Max gliding ratio.

fuel_specific_conso: float | None = None#
property fuel_specific_conso_SI#

Fuel specific consumption in International unit system.

ground_effect_coefficient: float | None = None#
k: float | None = None#
load_plane_data(plane_data_name: str, plane_data_folder: str = '/home/runner/work/flight-mech/flight-mech/flight_mech/plane_database')[source]#

Load the data from a plane stored in the given database folder.

Parameters:
  • plane_data_name (str) – Name of the plane.

  • plane_data_folder (str, optional) – Path to the database folder, by default default_plane_database

property m: float#

Total mass of the plane.

m_empty: float | None = None#
m_fuel: float = 0.0#
m_payload: float = 0.0#
n(v: float, z: float, alpha: float) float[source]#

Compute the loading factor at a given velocity, altitude and angle of incidence.

Parameters:
  • v (float) – Velocity.

  • z (float) – Altitude.

  • alpha (float) – Angle of incidence.

Returns:

Loading factor.

Return type:

float

nb_engines: int = 1#
plot_gliding_TV_graph(z: float | list | tuple = 0.0, nb_points: int = 100)[source]#

Plot the thrust / speed graph of the plane at a given altitude.

Parameters:
  • z (float | list | tuple, optional) – Altitude, by default 0.

  • nb_points (int, optional) – Number of points for the plot, by default 100

plot_gliding_WV_graph(z: float | list | tuple = 0.0, nb_points: int = 100)[source]#

Plot the power / speed graph of the plane at a given altitude.

Parameters:
  • z (float | list | tuple, optional) – Altitude, by default 0.

  • nb_points (int, optional) – Number of points for the plot, by default 100

plot_polar_graph(nb_points: int = 100)[source]#

Plot the polar graph of the plane i.e. lift varying with drag.

Parameters:

nb_points (int, optional) – Number of points for the plot, by default 100

set_plane_parameters(plane_data_dict: dict)[source]#

Set the parameters of the plane.

Parameters:

plane_data_dict (dict) – Dictionary containing the plane parameters.

thrust_per_engine: float | None = None#
update_C_L_max(force: bool = False)[source]#

Update the value of the CL max.

Parameters:

force (bool, optional) – Force the computation of the CL max even if it already exists, by default False

update_P(force: bool = False)[source]#

Update the value of the weight.

Parameters:

force (bool, optional) – Force the computation of the weight even if it already exists, by default False

update_ground_effect_coefficient(force: bool = False)[source]#

Update the value of the ground effect coefficient.

Parameters:

force (bool, optional) – Force the computation of the ground effect coefficient even if it already exists, by default False

update_k(force: bool = False)[source]#

Update the value of k.

Parameters:

force (bool, optional) – Force the computation of k even if it already exists, by default False

update_variables(force: bool = False)[source]#

Update the value of the variables k, P, ground effect and CL max.

Parameters:

force (bool, optional) – Force the computation of the variables even if they already exist, by default False

v(alpha: float, z: float = 0.0) float[source]#

Compute the velocity at a given angle of incidence and altitude.

Parameters:
  • alpha (float) – Angle of incidence.

  • z (float, optional) – Altitude, by default 0.

Returns:

Velocity.

Return type:

float

wing_shape_coefficient: float = 1.0#
wing_to_ground_height: float | None = None#