20  ✈️ FlightGenerator

Generate synthetic flight trajectories using the WRAP kinematic model.

20.0.1 FlightGenerator(ac, random_seed=42, use_synonym=False)

Initialize the trajectory generator for a specific aircraft type.

Parameter Type Unit Description
ac str - ICAO aircraft type (e.g. “A320”)
random_seed int - Random seed for noise generation. Default 42.
use_synonym bool - Use synonym if aircraft not found. Default False.

Example:

from openap import FlightGenerator

gen = FlightGenerator("A320")

20.0.2 enable_noise()

Enable noise in generated trajectories based on ADS-B Version 1&2, NACv=3 and NACp=10.

Parameters: None

Returns: None

Example:

from openap import FlightGenerator

gen = FlightGenerator("A320")
gen.enable_noise()

20.0.3 climb(**kwargs)

Generate climb trajectory from takeoff to cruise altitude.

Keyword Arguments:

Parameter Type Unit Description
dt int s Time step. Default 1.
cas_const_cl float kt Constant CAS for climb.
mach_const_cl float - Constant Mach for climb.
alt_cr float ft Target cruise altitude.
random bool - Use random parameters. Default False.

Returns: pd.DataFrame with columns: t, h, s, v, vs, seg, altitude, vertical_rate, groundspeed, etc.

Example:

from openap import FlightGenerator

gen = FlightGenerator("A320")
climb_traj = gen.climb(dt=10, cas_const_cl=280, mach_const_cl=0.78, alt_cr=35000)
climb_traj.head()
t h s v vs seg altitude vertical_rate groundspeed cas_const_cl mach_const_cl h_const_cas_start h_const_mach_start alt_cr
0 0 0.0 0.0 0.0 0.0 None 0 0 0 280 0.78 3700.0 9895.150102 35000
1 10 0.0 0.0 19.3 0.0 TO 0 0 37 280 0.78 3700.0 9895.150102 35000
2 20 0.0 193.0 38.6 0.0 TO 0 0 75 280 0.78 3700.0 9895.150102 35000
3 30 0.0 579.0 57.9 0.0 TO 0 0 112 280 0.78 3700.0 9895.150102 35000
4 40 0.0 1158.0 77.2 0.0 TO 0 0 150 280 0.78 3700.0 9895.150102 35000

20.0.4 descent(**kwargs)

Generate descent trajectory from cruise altitude to landing.

Keyword Arguments:

Parameter Type Unit Description
dt int s Time step. Default 1.
cas_const_de float kt Constant CAS for descent.
mach_const_de float - Constant Mach for descent.
alt_cr float ft Top of descent altitude.
random bool - Use random parameters. Default False.
withcr bool - Include short cruise segment (60s). Default True.

Returns: pd.DataFrame with columns: t, h, s, v, vs, seg, altitude, vertical_rate, groundspeed, etc.

Example:

from openap import FlightGenerator

gen = FlightGenerator("A320")
descent_traj = gen.descent(dt=10, cas_const_de=280, mach_const_de=0.78, alt_cr=35000)
descent_traj.head()
t h s v vs seg altitude vertical_rate groundspeed cas_const_de vcas_const_de mach_const_de va_app vs_constmach vs_constcas h_const_mach_end h_const_cas_end alt_cr
0 0 10668.0 0.000000 231.297621 0.0 None 35000 0 449 280 144.04432 0.78 72.0 -5.76 -10.03 9895.150102 5700.0 35000
1 10 10668.0 2312.976208 231.297621 0.0 CR 35000 0 449 280 144.04432 0.78 72.0 -5.76 -10.03 9895.150102 5700.0 35000
2 20 10668.0 4625.952416 231.297621 0.0 CR 35000 0 449 280 144.04432 0.78 72.0 -5.76 -10.03 9895.150102 5700.0 35000
3 30 10668.0 6938.928623 231.297621 0.0 CR 35000 0 449 280 144.04432 0.78 72.0 -5.76 -10.03 9895.150102 5700.0 35000
4 40 10668.0 9251.904831 231.297621 0.0 CR 35000 0 449 280 144.04432 0.78 72.0 -5.76 -10.03 9895.150102 5700.0 35000

20.0.5 cruise(**kwargs)

Generate cruise trajectory at constant altitude and Mach number.

Keyword Arguments:

Parameter Type Unit Description
dt int s Time step. Default 1.
range_cr float km Cruise range.
alt_cr float ft Cruise altitude.
mach_cr float - Cruise Mach number.
random bool - Use random parameters. Default False.

Returns: pd.DataFrame with columns: t, h, s, v, vs, altitude, vertical_rate, groundspeed, etc.

Example:

from openap import FlightGenerator

gen = FlightGenerator("A320")
cruise_traj = gen.cruise(dt=60, range_cr=2000, alt_cr=35000, mach_cr=0.78)
cruise_traj.head()
t h s v vs altitude vertical_rate groundspeed alt_cr mach_cr
0 0 10668.0 0 231.297621 0 35000 0 449 35000 0.78

20.0.6 complete(**kwargs)

Generate a complete flight trajectory (climb + cruise + descent).

Keyword Arguments:

Combines all keyword arguments from climb(), cruise(), and descent() methods:

Parameter Type Unit Description
dt int s Time step. Default 1.
cas_const_cl float kt Constant CAS for climb.
mach_const_cl float - Constant Mach for climb.
cas_const_de float kt Constant CAS for descent.
mach_const_de float - Constant Mach for descent.
range_cr float km Cruise range.
alt_cr float ft Cruise altitude.
mach_cr float - Cruise Mach number.
random bool - Use random parameters. Default False.

Returns: pd.DataFrame with columns: t, h, s, v, vs, altitude, vertical_rate, groundspeed.

Example:

from openap import FlightGenerator

gen = FlightGenerator("A320")
flight = gen.complete(random=False)
flight.head()
t h s v vs altitude vertical_rate groundspeed
0 0 0.0 0.00 0.00 0.0 0 0 0
1 1 0.0 0.00 1.93 0.0 0 0 3
2 2 0.0 1.93 3.86 0.0 0 0 7
3 3 0.0 5.79 5.79 0.0 0 0 11
4 4 0.0 11.58 7.72 0.0 0 0 15

Complete Workflow Example

Generate a complete flight with random parameters and visualize:

from openap import FlightGenerator

# Create generator for A320
gen = FlightGenerator("A320", random_seed=42)

# Enable noise to simulate realistic ADS-B data
gen.enable_noise()

# Generate complete flight with random parameters
flight = gen.complete(dt=10, random=True)

# Display summary
print(f"Flight duration: {flight.t.iloc[-1]:.0f} seconds")
print(f"Total distance: {flight.s.iloc[-1]/1000:.0f} km")
print(f"Max altitude: {flight.altitude.max():.0f} ft")
Flight duration: 18040 seconds
Total distance: 4003 km
Max altitude: 35578 ft