This set of notes describes the process of building a very simple flight planning tool for X-Plane 11 using Python.
From time to time I like to fire up X-Plane 11 to cruise around in the default Boeing 737 model it comes with. I like flying instrument approaches and visiting interesting airports around the world. A limitation of the out-of-box product is that for the 737, the only way to plan a flight is to either use the simple load sheets that come in the documentation, or use the FMS. Neither of these options accounts for wind, and neither can accurately tell me when I will reach top of climb and top of descent. So there is a lot of guesswork, which is a bit annoying. Being a lazy individual, I am not inclined to go through the trouble of purchasing and managing addon content which can address these needs. Therefore, I decided to build a simple planning tool.
The topic of flight planning is vast and draws from several different disciplines, including:
Computer science
Navigation
Aircraft Performance
Weather
It is interesting because it requires the creative combination of these disciplines, and challenging because it is so open-ended. The tool I built barely scratches the surface of the topic, but the notes may nevertheless be interesting to certain groups of people:
pilots who would like to follow a thought experiment that shows how some aspects of their flight planning systems work under the hood
aerospace engineering students who would like to see simple Python programming examples applied to their field of study
For information about flight planning in the real world, I have included a short extra chapter at the end.
The first thing to do is to describe as clearly as possible what problem we are trying to solve. We do this by listing out requirements and anti-requirements.
(1) Use Python to create a simple flight planning tool for use with the default 737-800 model that comes with X-Plane 11.
(2) The tool should ask the user for the following mandatory inputs:
the origin airport
the destination airport
a departure waypoint and altitude, where the altitude is between 5,000 ft to 10,000 ft MSL
an arrival waypoint and altitude, where the altitude is between 5,000 ft to 10,000 ft MSL
the desired payload (lb)
the desired reserve fuel (lb) at arrival waypoint
(3) The tool should ask the user to pick one of the following options for wind:
no wind
user-defined fixed wind (direction in degrees true, magnitude in knots)
real-world conditions (i.e. tool will lookup an upper winds forecast)
(4) The tool should compute:
a horizontal route connecting the departure and arrival waypoints
the expected vertical profile
the time and fuel required
(5) The tool should output:
a navigation log for the pilot ("navlog")
a flight plan file in the X-Plane 11 FMS format. This file should be output directly into the X-Plane directory so that the flight plan can be loaded into the 737-800 FMS as soon as the flight is started
(6) Navigation data
all navigation data should come from the X-Plane 11 navigation datasets as-is
(7) Details for the route:
The route should be composed of enroute waypoints taken from X-Plane's navigation database
Each route leg should take about 5 to 15 minutes of flight time
(8) Navigation log details:
It should indicate time and fuel required for each leg
It should indicate where TOC and TOD are, i.e. where the top of climb will be reached, and when the descent should start
It should include fuel estimates for takeoff, landing and taxiing
(9) Flight Profiles
from departure waypoint to arrival waypoint, the pilot will always fly these simple, fixed profiles:
Climb: fixed power setting 98% N1; 240 KIAS below 10,000 ft MSL, 280 KIAS above 10,000 ft MSL
Cruise: 30,000 ft MSL, 300 KIAS (not Mach)
Descent: fixed power setting 35% N1; 280 KIAS above 10,000 ft MSL, 240 KIAS below 10,000 ft
(10) Terrain
Terrain should be checked along the route from departure waypoint to arrival waypoint. Checked means: compare the terrain height to the expected altitude
(11) Airport and Runway Information
The tool should generate, for a given airport ICAO code, a short summary containing information about the airport, its runways, available landing aids, available navaids, and nearby waypoints
(12) Computation Speed
The tool should be able to generate a flight plan in a reasonable amount of time. What's reasonable? On my computer, it takes about one minute for X-Plane 11 to load a new flight. So let's just say, a reasonable time is 15 seconds or faster.
Here I deliberately list things I want to exclude from the project. This is done to keep things simple and protect against the temptation to overcomplicate things.
(1) Traffic: traffic and ATC will be kept off in X-Plane
(2) Weather hazards: the tool should check upper winds forecasts if the user asks it to, but checking for hazards enroute and at the arrival and destination airports isn't needed
(3) Alternates: the tool should just ask the user for the amount of reserve fuel (in lb) desired at the arrival airport; a list of nearby alternates can be looked up in the FMS in flight if needed
(4) Waypoints only: the route will be composed of waypoints, but will not make use of the airways, airspace, SID and STARs even though these are in the X-Plane navigation database
(5) Optimization: the tool just needs to produce a route and an accurate fuel and time prediction. It doesn't need to optimize for speed, fuel or anything else.