FS2004 A "Poor Man's FMC" - Automating Altitude and Vertical Speed


I am losing sleep at night because my mind won't rest on the question of how to automate Altitude and Vertical Speed in FS9 (starting simple). In examining a short flight from KSEA-KPDX *.pln I see the following...

title=KSEA to KPDX
description=KSEA, KPDX
departure_id=KSEA, N47* 25.89', W122* 18.48', +000429.00
destination_id=KPDX, N45* 34.84', W122* 35.07', +000030.00
departure_name=Seattle-Tacoma Intl
destination_name=Portland Intl
waypoint.0=, KSEA, , KSEA, A, N47* 25.89', W122* 18.48', +000429.00,
waypoint.1=K1, SEA, , SEA, V, N47* 26.11', W122* 18.58', +000000.00,
waypoint.2=K1, ALDER, , ALDER, I, N46* 49.29', W122* 24.85', +000000.00, J189
waypoint.3=K1, BTG, , BTG, V, N45* 44.87', W122* 35.49', +000000.00, J189
waypoint.4=, KPDX, , KPDX, A, N45* 34.84', W122* 35.07', +000030.00,
Aha! The "+000000.00" parameter in each "waypoint" line must be altitudes, right? I don't know, but it would make sense given the two in front are latitude and longitude of the waypoint. So, I tested this out by manually inserting altitudes like this...
waypoint.0=, KSEA, , KSEA, A, N47* 25.89', W122* 18.48', +000429.00,
waypoint.1=K1, SEA, , SEA, V, N47* 26.11', W122* 18.58', +003000.00,
waypoint.2=K1, ALDER, , ALDER, I, N46* 49.29', W122* 24.85', +020000.00, J189
waypoint.3=K1, BTG, , BTG, V, N45* 44.87', W122* 35.49', +002000.00, J189
waypoint.4=, KPDX, , KPDX, A, N45* 34.84', W122* 35.07', +000030.00,
Well, it didn't work. "Why?" I thought. My guess is there is not an existing mechanism in FS9 which will read the altitudes entered. Can someone clarify this, please?
The above seems to show the altitude as the 7th parameter of each waypoint line, but the comma after it indicates there is the 8th parameter. I verified this by looking at other *.pln files.

Unfortunately, I still can't sleep because I am thinking FS9 reads the altitudes manually entered into the A/P, so now I am wondering if a gauge could read the altitudes in the *.pln and enter them in the A/P? If so, then using this yet-to-be-made gauge in conjunction with the existing FS9 GPS would yield a kind of "poor man's" FMC.

I am thinking to make the above work would require the following two things (if I am guessing right?)...

THING1 (Preparing the *.pln)
01. Parse the *.pln for the waypoint number "waypoint.X", the lat and lon, etc.
02. Decide on flight's altitude profile.
03. Compute distances between each waypoint.
04. Calculate/read(?) the distance between each waypoint.
05. Calculate VS required to reach the next waypoint at the desired altitude and store.
06. Test the VS for the credibility of the aircraft to perform as needed and error out if not.
07. Calculate and add interim waypoints if necessary to reach the desired altitude (not sure this is needed?).
08. Parse the *.pln text and write the altitudes, interim waypoints and VS as the 9th parameter.
09. Enter the revised *.pln in FS9.
(NOTE: I tested adding the 9th parameter (VS) to the waypoint lines manually. No problems were encountered, AFAICT.

THING2 (using the gauge)
A. Gauge reads the waypoints and is triggered at each one.
B. When triggered, the gauge reads...
--- the altitudes in the revised *.pln and enters them in the A/P's "Altitude"
--- the VS in the revised *.pln and enters the VS in the A/P/'s "VSI."

I think I would be capable of parsing the file, reading the values, calculating distance and VS and rewriting. What I don't know yet is how to write the gauge. I don't know where to find the A/P values in FS9 for altitude and vertical speed. Where can I find this information?

Lastly, if I can get this to work as I envision, then I will try to see iif I can duplicate the functionality in FSX and maybe later, P3D. Here's hoping!

Thanks for reading,
Thanks for the comment. The altitudes other than the DEP/ARV airports are usually always +000000.00, (AFAIK?) like in the first code example. I manually edited the second sample.
That's what I get for looking at an FSX format flight plan.

You are correct, in the FS2004 plan format, other than the DEP/ARV airports show +000000.00 for altitude.

Good luck with what you're trying to do. I think that it will turn out to be a pretty complicated project. :)
Thanks anyway. I didn't know that about the FSX format. Win-Win!

Complicated? Yes, but I like learning new things. Besides, as I try different things I will have more precise questions which will allow the FSDev gurus to make precise responses. The first thing I need to know is if there are hooks in the FS9 programming which I can access and write to as needed. Without this ability, none of my efforts will ever net anything except some learning. Time will tell.

Right now I am focusing on parsing the *.pln, doing the calculations and rewriting a useful file. In the meantime, I can always manually edit any *.pln for gauge testing purposes if I get that far? I used to be pretty good with using VB6 for parsing/reading/writing variables (three decades ago), but I'm open to suggestions. The good news is if I get this working on the FS9 *.plnfiles, it should be a simple trick to apply the process to the XML files for FSX/P3D.

@ Anyone - Does anyone know if Python would be good for this application? Is there a better (read: easier) option?
Oops! I just found this in my research...
"There is no such thing as "best language for text file parsing". There are a number of languages which could be suitable."

Hmm... well, my best bang for the buck would be to learn/use what other programmers here use for coding? So folks, what would that be? :)
If you want to edit the .pln file to change waypoint altitudes to desired flight alts, that's fine, but beyond that, don't waste your time writing something to parse and read the .pln file. Instead, learn the gps module which can read and manipulate flight plans and the stock autopilot commands (events) which can control altitude and vertical speed.

Dave_W is correct with his caution that this will be a complicated project. Unless one is already fluent with flightsim XML, the fs9gps module, and autopilot commands, there will be months of learning ahead. If you're serious about this and have patience and perserverance, you'll get there. Could take a year, so don't give up. Do a lot of searches in this forum for pertinent posts.

Hi Bob,

Thank you for your candor and your encouragement to persevere and sobriety. This sounds like I am planning on climbing a mountain that is presently veiled in fog. I guess I'll head for the mountain base with a focus on appropriate climbing gear and take one step at a time "up" the mountain. :)

You said, "Do a lot of searches in this forum for pertinent posts." Ha! I don't really have an idea what to search for except what you posted, i.e., "the gps module." Would that be the right direction to search on? I'll start with that here and the Internet and see what happens.

Hi Tom,

Thanks for the clarification. Fortunately, "gps module" eventually led me to Mr. McElrath's guide book with the 321 variables. I have to admit my eyes glazed over around variable #120-ish as I was reading the list. I also read some of the beginning.

The fog has begun to clear and I am beginning to see just how BIG the mountain really is. I am definitely going to need more than a sack lunch to scale this ascent. I am looking forward to it, but my gimpy noodle functions inversely proportional to the new information I feed it. Still, I'm only 60 and I would like to be 61 and "know" how to program MSFS than being 61 and "not know" how to program MSFS. Time will tell.

A note about Mr. McElrath's work. Wow, what a kindness to invest that much work to make things easier for the developer community (and wannabees like me) without a requirement for monetary compensation. I'm probably shooting for the moon, but I hope I can give back as much in some way to this wonderful community.

Take care,
...without a requirement for monetary compensation

Those Guidebooks and the other apps on the BB website are happily offered free of charge. So, too, is Dai Griffith's C gauge guide. Same for the apps provided by Doug Dawson. Same for Tom Aguilo's XMLTools. That's a quick list of things you will find just for gauge development and if you look through other forums in FSDeveloper, you will find many important development tools and applications that are also free.

The common tie is the FSDeveloper website. We all benefit from it. As you get into your project, if you are able, please consider making a donation to FSDeveloper. Arno (the site Admin) and all members of community will appreciate it.


Regarding your project, I suggest you develop it using XML rather than C. You could go either way, but you'll get more help from people in here on the XML side.

A few tips:

- There are two different formats of XML - FS9 XML schema, and FSX XML schema. The FS9 schema works in FS9 through all current versions of P3D. FSX schema works in FSX thru P3D. Working with FSX schema is more tedious. Bill Leaming described it as "verbose" and that's being kind. To be fair, there is more functionality with FSX schema such as more drawing and mouse functions. The stock gps_500.xml gauge and all of the XML examples you find on the BlackBox website are written with FS9 schema format. The stock g1000_pfd.xml gauge and the radar gauges shipped with FSX are written using FSX schema format. So, be aware that you will encounter both FS9 and FSX XML snippets in this forum. You cannot mix both schemas in a single gauge.

- Use a gauge debug app such as BlackBox, or xml vars from Doug Dawson, or LOCALVARS which is part of Tom Aguilo's XMLTOOLS. They are indispensable for debugging logic errors.

- Use a good source code editor. Like many, I prefer Notepad++, but there are other good ones out there.

- Use a Panel Reload gauge to speed up the editing process. Here's an example:
<Gauge Name="RELOAD" Version="1.0">
    <Size X="20" Y="20" />
    <Element Name="BUTTON RELOAD"><Position X="0" Y="0"/><Rectangle Width="20" Height="20" FillColor="darkred" Color="white" LineWidth="0.5" Bright="Yes"/></Element>
    <Element Name="R"><Position X="3" Y="1.5"/><FormattedText X="12" Y="16" Font="verdana bold" FontSize="17" LineSpacing="18" Color="white" BackgroundColor="darkred" Bright="Yes" ><String>R</String></FormattedText></Element>     
        <Area Name="RELOAD BUTTON" Left="0" Top="0" Width="20" Height="20">
        <Cursor Type="Hand"/> 
                (A:Fuel weight per gallon, pounds per gallon) 0 ==
                if{ (>K:RELOAD_USER_AIRCRAFT) }  // FSX
                els{ (>K:RELOAD_PANELS) }        // FS9

- There isn't a wealth of basic FS XML programming tutorials, but one written by Nick Pike can be helpful. Primarily, you learn by studying XML gauges written by others and applying things you find to your own gauge.

- Check out the Wiki page in FSDeveloper for many XML tips

- Test, test, and re-test - advice given to me by Tom Aguilo when I was starting out. Putting it another way, work a problem, say, a dozen times before posting a question in this forum. That's loose advice but you'll progress much faster if you test. A lot.

Last edited:
Hi Bob, et.al.,

I read the above post(s) several hours ago but was so overwhelmed with such incredible generosity of collegiate level material I was unable to pen any congruent thoughts and am struggling with getting this missive into text. I suspect it will be some days before I can get my wits aligned with the needed understanding. I just wanted to acknowledge your offerings and say thank you.

Take care,

PS - I am aware I have a number of other projects I started with the studious assistance here. I have had to overcome some health interruptions. Life goes on and takes us in ways we cannot anticipate. I can't promise I will be able to bring the varied initiatives to fruition in any near term, but I do intend to keep trying.
Last edited:
I have been familiarizing myself with the "fs9gps module" variables in the Guidebook. I have not been able to find the variables I thought would have been included specifically,
  • Autopilot Altitude - the variable I thought would have been available to insert an altitude value into the Autopilot Altitude entry box.
  • Autopilot Vertical Speed - Same as the above, except for the VSI entry box.
So, my question is are these variables available and if so, what are their names?

You are going to have a very difficult time getting anywhere with this. To get where you want to be... you will need to understand the content of the sim's SDK as well as the GPS module. A GPS is not an autopilot, thus autopilot variables would not be found there.
Thanks. I agree with you that my ignorance will present a challenge. Now, couple that with Short-Term Memory Loss (STML) and the challenge becomes significant because I have to keep rereading the thread to keep up. C'est la vie!

I agree the GPS is not an AP, but I thought the GPS would have to know the lat/lon/alt and that those variables could be read. Your comment indicates this is not the case. I will dig into the SDK and see what I can find.
Although I have been around here awhile, I am not confident I know all the accepted etiquette expected. So, please let me know (via PM if you like) if my following request is acceptable. Thanks.

Hmm... I have been examining the information and thinking a lot about the VNAV project. The truth is I am 60 years old and my health is often an issue. Frankly, I would like to enjoy my ideas ASAP. So, I respectfully request help.

So, could someone please create a simple VNAV gauge for me? One that would only populate the AUTOPILOT from my *.pln files. Once it is operational, I think I could use it as a model to add VSI altitude parameters too. I know I can do the math to make all the calculations.

I have other ideas for improvements which I "think" I can implement myself as I learn the things that y'all have already offered. I just need something to start with and enjoy.