Skip to main content

Trajectory OPtimizer based on OpenAP model

Project description

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

  1. Install from PyPI:
pip install --upgrade openap-top
  1. 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:

example_optimal_flight

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)

example_optimal_flight

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openap_top-1.10.1.tar.gz (3.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openap_top-1.10.1-py3-none-any.whl (28.9 kB view details)

Uploaded Python 3

File details

Details for the file openap_top-1.10.1.tar.gz.

File metadata

  • Download URL: openap_top-1.10.1.tar.gz
  • Upload date:
  • Size: 3.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for openap_top-1.10.1.tar.gz
Algorithm Hash digest
SHA256 9893cde4d08b0f605fffea5fd4e0b2dcd6ef95ed21ce1e45bdd9426fbac8ff26
MD5 53e34221a6c3c8d7a12c7bce0defeacc
BLAKE2b-256 844128bd9ffb929d9387d57163027d7d54ad0428500f8895ccd9c3e8b937e47f

See more details on using hashes here.

File details

Details for the file openap_top-1.10.1-py3-none-any.whl.

File metadata

  • Download URL: openap_top-1.10.1-py3-none-any.whl
  • Upload date:
  • Size: 28.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for openap_top-1.10.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6d9d19f210166258d4ac245463f3d1744539c334e53942682e4ed7b13f73029c
MD5 1c52a1f77e6fcdec42e1c09caebbcfa7
BLAKE2b-256 c6a77d61760c55cd295676d143c4e22bd7bfe0b2fd47762dd15019d726376427

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page