# Runway Selection in FSX

Discussion in 'Airport Design Editor' started by Daniel, 27 Dec 2007.

1. ### Daniel

Joined:
21 Dec 2006
Messages:
139
Country:
Not a question this time, but maybe something useful to someone.

This is what I've found out so far about runway selection in FSX:

1) When an airport is loaded, runways are grouped together per heading. For example EHAM: 8 groups are created, 6 of them containing 1 runway, 2 of them each containing 3. More specific: 18R, L and C and 36R, L and C are grouped together.

2) When a request for a runway is made, an active group is choosen based upon the current wind.

3) The request includes a value that is based upon the plane's empty weigth, this value is compared to the runway length in the next step.

4) For each runway inside a group it seems that the shortest distance from the plane to the runway centerline is computed. (I'm pretty sure the long/lat difference between the plane and the runway start position are computed and then there is some sin/cos stuff using the heading of the runway, I haven't worked this out to the detail but it seems like a computation for the distance between a point and a line)

5) If the runway end is closed (not entirely sure about this) or if the runway is shorter than requested, the computed distance is multiplied by 10000.

6) The runway producing the lowest value is assigned to the plane.

Daniel

Last edited: 27 Dec 2007
2. ### Daniel

Joined:
21 Dec 2006
Messages:
139
Country:
There's a bit more to step 2:

The first substep is that the length of the longest 'base'runway is determined. (With baserunway I mean the parent of a group, I haven't looked at how the groups are formed yet, I expect the longest runway of the group will be the parent, so what happens here is that the longest runway at the airport is determined)

Then while examining the wind conditions at each runwaygroup, the maximum length of the current group is compared to 70% of the maximum length of all runways.

Not sure what is done with a runway < 70%

Edit:

Now I do.

For each group the following is computed using the longest runway of the group:

Score = 0
If runway length > 70% of longest runway at airport -> Score += 50
Score += tailwind or headwind (tailwind < 0 and headwind > 0)
If (unknown 'runway group' flag) Score += 10
Score -= crosswind
If (runway landing==yes) -> Score += 100
If (runway takeoff==yes) -> Score += 100

The group with the highest score gets selected.

Daniel

Last edited: 27 Dec 2007
3. ### jvile

Joined:
24 Jan 2005
Messages:
8,894
Denial

That is true if the runways are all within 7.9000 degrees of True heading. This is the FS9/FSX foundation for a set of multiple parallel runways.

Only for departure and not arrival but there are also qualifiers that must be met. The wind also at some airports must be greater then 32 kts in order to activate the croswind runway or group of runways if parallels exsit (KLAS)

Not entirely true. For many years now we have studied runway selection based on a parking spot.

There is an invisible bounding rectangle box around each runway. You can have planes parked right next to a center line of a runway but always taxi to a another runway. This is clearly seen at such airports as KDEN and KIAH just to name two.

If parking spots are positioned at the end of a Runway (KDEN GA/CARGO RWY25) but also are parallel to a closer runway such as RWY 35L the bounding box of 07/25 gets the departure and not 17R/35L.

You see the same thing at KIAH with runway 09/27 vs runway 15L/33R. Even though planes park very close to RWY 15L/33R those same parking spots are on an extended center line of RWY 9/27. The bounding box of a runway vary's from airport to airport but we use a value of 4000ft for the extended center line bounding box.

I am not sure by what you mean if the runway end is closed. There is a strict order of qualifiers that says if a runway can be closed or not. There are Utilities that are available for FSX that closes different runway ends independently. These FSX Utilities are based on FS2002 and not FS9/FSX.

That is not to say we can't close a runway end but the highest qualifer is the approach code for a runway.

A start location on a runway is a "Go To" for all practical purposes. However, its importance is related more to the arrival airplane rather then a departing airplane.

We use to have a formula (lost on a deleted post elsewhere) that showed what EW would go to what length runway. This applies to both arrival and departures if Runways are within 7.9000 degree True Heading.

What we need is someone to recalculate that formula. Right now if you look at my EHAM you see that 04/22 is set at precisely 6500 ft long. That is the length value for any Plane (AI/User)less then 74,000lb EW. Even though B747's park at KLM Maintenance their EW does not allow usage of RWY04/22 landing or departing. I also made RWY 04/22 think it is within 7.9000 degrees of runway 18C/36C so it is part of a parallel set.

Last edited: 27 Dec 2007
4. ### Daniel

Joined:
21 Dec 2006
Messages:
139
Country:
I'm referring to the 'primaryTakeOff' flag (I have indeed so far only been looking at the assignments for take-offs).

I did some more digging.

A group is scored by it's baserunway. Now if that runway is the 'primary end' of a runway, the group will get 100 extra points if 'primaryTakeOff' is true and it will also get 100 extra points if 'primaryLanding' is true.

Yet, when the base runway is the 'secondary' end, the group will get 100 extra points if 'secondaryTakeOff' is true but it will also get 100 extra points if 'primaryLanding' is true, I would expect 'secondaryLanding' here.

The call that checks the 'landing' flag does have a branch for primary and secondary, but unlike the 'takeoff' variant, both branches look at the same flag. Seems like a copy/paste bug.

I will check my notes for the EW formula, I did come across it somewhere.

Daniel

5. ### jvile

Joined:
24 Jan 2005
Messages:
8,894
This is not considering the hardcoded overlay groups of parallel runways FS9/FSX introduced that we had to manually design in FS2002. The only thing the hardcoded overlays at such airports like KLAX, KATL, EHAM, KMCO, KBNA, etc. have in common is the ground instruction so a plane can now transition across a overlay boundary.

The overlay FS2002 parallel group was controlled by a 1 foot difference in runway length where as in FS9/FSX the EW is now the deciding factor.

I am not disagreeing with your findings but it appears there are many qualifiers being left out of the mix on how a runway is selected. For every rule found another airport somewhere breaks the rules.

Selection of runways for departure does not even resemble in FS selection of runways for arrival. Some qualifiers are the same and some are not.

FS is not going to leave a Plane on a IFR FP stranded. Even if a runway is real short and no approach code, ATC will still clear a B747 to land on a 2700 ft runway if that is the only arrival runway available at the airport. Common sense also plays a part in FS where I should not be trying to land a B747 on a IFR FP at my local little backyard GA severe clear airport when it is IMC. ATC will do the same for all AI on a IFR FP.

At that point we throw all the rules away for departure and arrvial.

6. ### jvile

Joined:
24 Jan 2005
Messages:
8,894
Ok

We will stick with departure only until you have the points scored.

The formula was on PAI years ago.

7. ### jvile

Joined:
24 Jan 2005
Messages:
8,894
Daniel

Some of the scoring makes sense. When FS by default closes one end of a runway they always make sure they set the closed end to Secondary. This includes flipping the base recip so if 05 is closed FS sets the base as 23. Runway list now says 23/05 (base/recip). Look at EGLL

Last edited: 27 Dec 2007
8. ### Daniel

Joined:
21 Dec 2006
Messages:
139
Country:
Hmm, okay, so it could be intentionally.

The formula... it seems there are 6 flavours, based upon engine type. So far I've seen 4 in action (all default planes):

Case 0: Piston (Cup)

if at least one proper engine.# block defined -> 2500ft
else 4000ft

For the Cup, this returns 2500ft
--------------------------------------------------

Case 1: Jet (747, 737)

If no weights specified: returns 5000ft

Else:

value = ((empty_weight pounds - 10000) * 2000 / 90000 ) + 5000

if ( value > 7000 ) return 7000
if ( value < 5000 ) return 5000
else return value
--------------------------------------------------

Case 2: No Engine (808)

Only called for landing, for takeoff the message 'Call Towplane' is displayed. For landing returns 1000ft.

--------------------------------------------------

Case 3: Helo-Turbine

Method not called for the Bell 208 for landing/take-off. If it would be called, it would return 4000ft.

--------------------------------------------------

Case 4: Rocket

Returns 4000ft
--------------------------------------------------

Case 5: Turboprop (Cessna Grand Caravan, Dash 8)

Just returns 4000ft
--------------------------------------------------

Daniel

Last edited: 27 Dec 2007
9. ### Daniel

Joined:
21 Dec 2006
Messages:
139
Country:
Indeed, this is where the score for the runway gets multiplied by 10000, but if in the end this score is the lowest... it will be selected.

Daniel

10. ### Daniel

Joined:
21 Dec 2006
Messages:
139
Country:
I will check my finding at those airports, but for EHAM:

The coordinates of the plane in FS Units is copied onto the stack and a pointer to this section is passed along with a pointer to the runway center in FS Units. (Not sure if it's the runway center, but both runway ends have the same values in their structures)

(See the latitude, longitude and altitude in this doc: http://www.projectmagenta.com/resources/FSUIPCOffsets.html for what I mean by FS Units)

First, the difference in longitude (in radians) between the plane (not the parking) and the runway is computed. Then using a cosine the latitude of the runway is used to compute the circumfence of the earth at that latitude. This value is used in combination with the difference in radians to obtain the plane/runway distance in meters east/west.

Then the difference in altitude between the runway and the plane is computed, but this is not used after computing it.

The difference in longitude is next, also computed in meters.

The computed values are used along with the heading of the current runway to obtain this value:

sin(runwayheading) * difference in latitude -

Which results in the shortest distance to the runway centerline (extended beyond the actual runway length).

And the runway which has the lowest score on this value inside the currently active group.... is the one assigned to the plane.

(As said, I will now check KIAH)

Daniel

11. ### Daniel

Joined:
21 Dec 2006
Messages:
139
Country:

I get the idea that it's time to forget about bounding boxes. The plane is assigned to the runway whose centerline (extended all around the world) passes closest to it.

Now this works perfectly if the multiple runways are parallel as they are at default FSX airports.

But once you activate non parallel runways simultaneously using the crosswinds runways technique... there goes the neighborhood.

For KIAH:

Ramp Cargo Parking number 5 is almost exactly on the extended centerline for runway 09/27. For default airports, not a problem since there's no way both 15L/33R and 09/27 will be opened at the same time.

Daniel

Last edited: 27 Dec 2007
12. ### Daniel

Joined:
21 Dec 2006
Messages:
139
Country:
I did... setting a 13 knots wind so that 05 would be the runway of choice, makes the 09 group win by a score of 266 to 112.

05 does not get the 70% length bonus nor the SecondaryTakeOff bonus. It does get 100 points due to the checking of PrimaryLanding as mentioned above instead of SecondaryLanding.

So far I have looked only at take-offs and I've only been using default airports. I will now look at landings and a crosswind BGL.

Daniel

13. ### jvile

Joined:
24 Jan 2005
Messages:
8,894
Thanks Daniel

When I introduced the Crosswind Technique (April 2004) my intentions was not to destroy the neighborhood but your explanation when a runway is crosswind to another makes perfect sense with the extended center line.

Over the years I don't recall anyone working out the score process of runway selection and that is why I am posting in response to your research.

I had to go do a search to find where we had crossed paths before in the past (EHAM 2 Control Tower issues).

I have a full reworked version of EHAM on AVSIM which may help in scoring the arrivals. I crosswinded all the runways and set 04/22 with weight restrictions. The score for 18R fell completely to zero for some reason and all the approach code I wrote is selectable through ATC but ATC does not see 18R as a group runway so a sidestep to 18C must be requested after the approach phase. I also rewrote the Tower Code and placed eyeview at the correct Lat/Lon/alt=height and not out at the Polderban Tower.

We also have now uncovered the 0x66 embedded hex that Winfried found and in some cases certain airports have coded 5 and 6 Towers to different Airport scenery objects and visual models. That is another post here referencing KDTW.

Last edited: 28 Dec 2007
14. ### jvile

Joined:
24 Jan 2005
Messages:
8,894
So what determines the score with 0 winds at all default airports (non-parallel) where ATC assigns a runway for take-off. Example, a airport like KJAX RWY 07/25 and 13/31. No winds and ATC chooses RWY 07.

It appears that FS looks in a clockwise direction (base runway heading from low to high) for the first available precision runway which may be giving the highest score.

Last edited: 28 Dec 2007
15. ### Daniel

Joined:
21 Dec 2006
Messages:
139
Country:

So far it seems the required length computation is equal for landing and take-off. And eventhough there are several branches based upon landing/takeoff they all seem to have similar code.

Group selection is also equal and then the runway in the group is also selected by looking at the shortest distance to the centerline. Now I can imagine that this could produce rather confusing results with crosswind runways, since the planes are at a larger distance from the airport when they request a runway.

I will examine this further (especially how identical they really are).

When the group is selected, initially there is a check for a value inside the Airport structure. A different address is checked for landing and take-off, but so far this value has always been 0. If it's zero... the wind based selection is engaged.

When the wind is 0, FSX uses a windspeed of 0.001 knots to score the groups.

The tower swap for EHAM, that was indeed my first exploration into FSX. I stepped from FS2002 to FSX, but never did any development for FS2002. Right now I have three FSX downloads on AVSIM and I'm selling a small add-on. My freeware releases are over here: http://www.supercell.nl/disposition/

This runway investigation started when I wanted to see something I needed for a new add-on, but along the way I got curious to find out the details.

I will now look further at the landing selection, maybe it's time to focus on the assignment of the approach indeed. So far it seems that an approach is chosen after a runway.

I know that there are at least 4 places from where the runway assignment method is called: 1 for take-off during a taxi request, 2 for landing (not investigated further yet) and 1 that is called for AI planes shortly after their 'Clearance' phase (I think as a part of the 'Push Back 1' phase). This is when AI planes get their take-off runway assigned initially. Yet after completing the 'Push Back 2' phase, they request taxi and then the assignment is done again.

Daniel

16. ### Daniel

Joined:
21 Dec 2006
Messages:
139
Country:
A quick initial check on your EHAM:

I see 32 runways in the airport structure and 2 Runway groups.

Each group contains 16 runways, the first group has the secondary of 36L/18R as base, the other group has the primary.

So the group selection is based upon the wind conditions at these two runways.

I still don't understand the flags for the runwaygroup. If bit 0 == 1, then the group is excluded from the selection process. So far I have not seen this. If bit 1 == 1, then the group gets 10 points extra.

Daniel

17. ### jvile

Joined:
24 Jan 2005
Messages:
8,894
I have a update worked out for EHAM runway selection but have not uploaded yet. I was making sure that 36L never got a high score for landing but 18R does.

I do have your Logbook Utility but did not relaize you wrote that until I saw it on your web site.

Give me a USA follow me Car color option rather then a Europe model color. I need that for DX10 preview mode since the progressive taxi lines disappear.

Keep digging if you have the time. The score values will be very important (for information) when Jon starts releasing the ADE Pro version.

18. ### Daniel

Joined:
21 Dec 2006
Messages:
139
Country:
Testing the landing part now. The approach and 'expected' runway are selected without a call to the method I've been working on so far.

Daniel

19. ### jvile

Joined:
24 Jan 2005
Messages:
8,894
File a FP with FSX. When FSX shows the great circle route in the map mode (red line) before saving the FP use the mouse and slide the Map until you can see the Termination point at the arrival airport of the FP.

FS always chooses the closest runway Start Location based on the heading for the FP. If you delete a start location or crosswind then the termination point will be the next closest start location that FS can find at the arrival airport.

This is not to say that runway will be used or not used because ATC intervenes when the User or AI enters the outer Visual Sector (normally 108NM in USA). Winds and approach ILS code become a score for arrival (that is another set of arrival rules).

However if the default winds on startup do not get changed from one airport to the other then FS already knows what arrival runway will be used before the plane even leaves the departure airport.

FP's are from departure parking spot (or plane position) to runway Start Location at the destination.

It would appear the scoring starts when the plane enters (materializes) at the Visual Sector. Weather visibilty is also a scoring if visiblity is below 3 miles. FS has 2 sets of rules based on weather and a set of rules based on the runway having a ILS in the approach code vs any other type non-precision approach. ILS type approach code takes precedence in using the XML written instructions for IAF/FAF/Altitude and all other type approaches are only honored if weather is below 3 mile visibility.

Bottom line is if the AI Plane is landing on any Runway that is less then a full ILS (Localizer plus GS) it is using a dll hard coded visual approach same as a VFR type approach but instructed by ATC for the 30 degree offset to final. Only when weather fall below 3 miles and a full ILS is not available then the AI plane will fly the non-precision approach code in the XML.

Confusing, I know but traffictoolbox helps confirm arrival paths and seperation points when flying a Full ILS for both types of weather or flying a non-precision runway approach in both types of weather.

This is some of the foundation I use for all my curved approaches that I write (FSX LOWI, VHHX IGS 13, EHAM, FS9 PHNL, KLAS, etc.) when weather is above 3 miles vs less then 3 miles. The trick is to fool ATC into thinking weather is below 3 mile visiblity at all times when it is not.

Watch runway 24 landings at my EHAM. The AI are instructed to fly the PAM VOR approach (fake ILS code) and then at the last moment make the left turn to align with RWY 24 regardless of visibility settings. User plane if ATC assigns that runway based on arrival heading are also vectored to the 30 degree offset of center line to the PAM VOR (not the runway) and must fly the same approach.

Departure runway selection scoring based on your findings looks real good but arrival selection runway scoring has many many variables that must be look at (and/if/or) to work out. You have to do the and, if, or's seperately.

I can lay out the and/if/or rules when you get to that point to help with the scoring you see.

Last edited: 28 Dec 2007
20. ### Daniel

Joined:
21 Dec 2006
Messages:
139
Country:
Thanks for this explanation Jim. It will be a great help to match this to what I find.

Analyzing this part is a bit harder. For a takeoff request, all I had to do to be able to re-request a runway was selecting a new parking spot.

Currently I'm flying an IFR plan from EHAM to EHAM. Just some small things I've found so far:

- The assigned runway for take-off is cleared once you are handed over to 'Departure'
- The code for determining the active runway group is the same
- From the airport array containing all approaches, a second array of approaches belonging to the runways in the active group is created.

Somewhere in the code that determines the available approaches I found some calls to the weather dll. In that same area I saw the value 12001.67, to which the airport altitude in meters was added (-4). So it seems the 12001.67 is 'meters above sea level' and then converted to 'meters above ground level'.

This value got multiplied by 3.28.... (meter to feet I guess) and this got compared to 3, if I recall correctly. Since the result was higher, nothing was done.

In memory the value next to 12001.67 was 12251.67 and then 30.48. (30.48 is about 20 miles)

So, it seems this is the check for surface-level visibility. I try it again with some fog.

Daniel