Plane Velocity Example#

This example demonstrates how to use flight-mech to compute the velocity of a plane in several conditions.

Imports#

[ ]:
# Python imports
import os
import sys
sys.path.append("..")

# Additional imports
import numpy as np
import matplotlib.pyplot as plt

# Flight-Mech imports
from flight_mech.plane import Plane

Plane definition#

You can define a plane simply by calling its name if it is already defined in the database. Once the plane instance is created, you can easily compute essential quantities such as glide ratio and lift coefficient at maximum glide ratio.

[2]:
# Load the plane
plane = Plane("cessna_172")

# Compute the fmax and CL at fmax
print("fmax", plane.f_max)
print("C_L_f_max", plane.C_L_f_max)
fmax 12.909944487358056
C_L_f_max 0.7745966692414834

It is also possible to change some plane characteristics directly. In this case, you might need to update the values of the variables.

[3]:
# Change the amount of fuel
plane.m_fuel = 136.26  # kg
plane.update_variables(True)

Velocity interval at 8000 meters#

You can compute some specific velocities deduced from the plane characteristics at a given altitude such as the reference altitude, the velocity interval (i.e. the interval of velocities that is available with the thrust of the plane) and the stall velocity.

[4]:
# Compute the speed interval at 8000 meters
print("reference speed at 8000m [m.s-1]", plane.compute_reference_speed(8000))
print("speed interval at 8000m [m.s-1]",
      plane.compute_velocity_interval_for_fixed_thrust(8000))
print("stall speed at 8000m [m.s-1]",
      plane.compute_stall_speed(8000, C_L_max=1.5))
reference speed at 8000m [m.s-1] 56.25034304495441
speed interval at 8000m [m.s-1] (22.573885291918142, 140.16643797724348)
stall speed at 8000m [m.s-1] 41.82955138380646

Ascension velocity and slope#

You can also compute the velocity in a non-horizontal flight conditions.

[ ]:
# Consider that the tank is almost empty
plane.m_fuel = 0  # kg
plane.update_variables(True)

# Compute the ascension speed and slope at sea level
print("max ascension speed [m.s-1]", plane.compute_max_ascension_speed(z=0))
print("reference speed at 0m [m.s-1]", plane.compute_reference_speed(z=0))
print("max slope at 0m [rad]", plane.compute_max_ascension_slope(z=0))
max ascension speed [m.s-1] 32.89702949399428
reference speed at 0m [m.s-1] 34.52424312519015
max slope at 0m [rad] 0.5695767110104357