OpenAP Trajectory Optimizer
This repository contains the flight trajectory optimizer module based on the OpenAP package.
This tool uses non-linear optimal control direct collocation algorithms from the casadi library. It provides simple interfaces to generate different optimal trajectories. For example, this tool can generate any of the following trajectories (or combinations thereof):
- Complete flight trajectories or flight segments at different flight phase
- Fuel-optimal trajectories
- Wind-optimal trajectories
- Cost index optimized trajectories
- Trajectories optimized using customized 4D cost functions (contrails, weather)
- Flight trajectories with constraint altitude, constant mach number, etc.
What's more, you can also design your own objective functions and constraints to optimize the flight trajectory.
🕮 User Guide
A more detailed user guide is available in the OpenAP handbook: https://openap.dev/optimize.
Install
- Install from PyPI:
pip install --upgrade openap-top
- Install the development branch from GitHub (also ensures the development branch of
openap):
pip install --upgrade git+https://github.com/junzis/openap
pip install --upgrade git+https://github.com/junzis/openap-top
The top package is an extension of openap and will be placed in the openap namespace.
Quick Start
A simple optimal flight
The following is a piece of example code that generates a fuel-optimal flight between two airports, with a take-off mass of 85% of MTOW:
from openap import top
optimizer = top.CompleteFlight("A320", "EHAM", "LGAV", m0=0.85)
flight = optimizer.trajectory(objective="fuel")
Other predefined objective functions are available, for example:
# Cost index 30 (out of max 100)
flight = optimizer.trajectory(objective="ci:30")
# Global warming potential over 100 years
flight = optimizer.trajectory(objective="gwp100")
# Global temperature potential over 100 years
flight = optimizer.trajectory(objective="gtp100")
The final flight object is a Pandas DataFrame. Here is an example:
Using Wind Data
To include wind in our optimization, first download meteorological data in grib format from ECMWF, such as the ERA5 reanalysis data.
Once grid files are ready, we can read and enable wind for our optimizer with this example code:
from openap import top
fgrib = "path_to_the_wind_data.grib"
windfield = top.tools.read_grids(fgrib)
optimizer = top.CompleteFlight("A320", "EHAM", "LGAV", m0=0.85)
optimizer.enable_wind(windfield)
flight = optimizer.trajectory() # default objective is fuel
Next, we can visualize the trajectory with wind barbs:
top.vis.trajectory(flight, windfield=windfield, barb_steps=15)
Release files for openap-top 1.11.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| openap_top-1.11.0.tar.gz | 3.2 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| openap_top-1.11.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 3.2 MB
Release files / openap_top-1.11.0.tar.gz
| Download URL | openap_top-1.11.0.tar.gz |
|---|---|
| Size | 3.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c8948704ebdcbcd9854bdfdf5adb863afc7304d5b36149426418c7885323a034
|
|
BLAKE2b-256 checksum How to use checksums |
308640a3eb232f561e8f0fa7cebf875a7240f64e53c3a4c2e28519ce9b26ba0e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / openap_top-1.11.0-py3-none-any.whl
| Download URL | openap_top-1.11.0-py3-none-any.whl |
|---|---|
| Size | 29.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
66713b88e52083fd8f5282808cd7a651365bb3c5a37c037c2da65ba83154b730
|
|
BLAKE2b-256 checksum How to use checksums |
5af5d2029d398808beebd483dbf4fd510a2fe198dace2849ecc696d0a7a2dc36
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|