The "aviation" project regroups a set of formulas and general principles for aviation for Python.
To start using the module, you can start by creating a aircraft model from one of the base aircraft manufacturers.
from pyaviation.aircraft import Cessna
airplane = Cessna()
This creates a blank airplane model on which you can call a variety of functions.
Python aviation comes however with a set of built in aircraft models that you can use.
from pyaviation.models import A320
aircraft = A320()
The flight mixin regroups all the main definitions for calculating items related to flight.
Provided you've constructed an airplane like above, you can do the following.
airplane.calculate_speed(50, 2)
>>
airplane.calculate_distance( , )
>>
airplane.calculate_duration( , )
>>
airplane.calculate_arrival_time( , )
>>
airplane.ground_speed( , )
>>
airplane.true_air_speed( , )
>>
airplane.density_altitude( , )
>>
Calculates the fuel consumed during a flight of x hours and minutes and eventually the remaining minutes left to fly with the fuel left.
airplane.fuel( , )
>>
airplane.fuel_consumption_rate( , )
>>
airplane.ground_gradient( , )
>>
airplane.calculate_obstacle_clearance( , )
>>
airplane.distance_to_horizon( , )
>>
airplane.needed_fuel( , )
>>
Considering that each new class you create using the BaseAircraft
class (exactly like we did in the above examples), each newly created class will provide additional definitions that will take into consideration the specific characteristics of each aircraft.
airplane.safety_factor( , )
>>
airplane.net_performance( , )
>>
airplane.gross_performance( , )
>>
airplane.gradient_of_climb( , )
>>
airplane.ground_gradient( , )
>>
airplane.maximum_payload( , )
>>
Creating a new model is very simple. Just subclass the Airplane
class in order to create a new manufacturer for example.
from pyaviation.aircraft import Aircraft
class CustomManufacturer(Aircraft):
manufacturer = "Custom"
class MyAircraft(CustomManufacturer):
version = "eco-xxx"
speed = {
"cruise": 456,
"max": 567
}
max_rang = 5678
weight = {
"taxi": 73900,
"takeoff": 73500,
"landing": 64500
}
fuel = {
"max": 23859
}
passengers = 150
ceiling = {
"range": [39100, 41000]
}
aircraft = MyAircraft()