PDA

View Full Version : Runway Selection in FSX

Daniel
27 Dec 2007, 05:40
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

Daniel
27 Dec 2007, 06:03
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

jvile
27 Dec 2007, 06:43
Denial

1) When an airport is loaded, runways are grouped together per heading.

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.

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

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)

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)

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.

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.

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.

Daniel
27 Dec 2007, 07:06
I am not sure by what you mean if the runway end is closed.

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

jvile
27 Dec 2007, 07:14
The first substep is that the length of the longest 'base'runway is determined. (With baserunway I mean the parent of a group,

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.

jvile
27 Dec 2007, 07:17
Ok

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

The formula was on PAI years ago.

jvile
27 Dec 2007, 07:23
A group is scored by it's baserunway.

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

Daniel
27 Dec 2007, 07:46
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

Daniel
27 Dec 2007, 11:02
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.

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

Daniel
27 Dec 2007, 15:11
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.

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

Daniel
27 Dec 2007, 15:26

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

Daniel
27 Dec 2007, 18:28
Look at EGLL

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

jvile
28 Dec 2007, 04:02
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.

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.

jvile
28 Dec 2007, 04:07
So far I have looked only at take-offs and I've only been using default airports.

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.

Daniel
28 Dec 2007, 06:10

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

Daniel
28 Dec 2007, 07:36
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

jvile
28 Dec 2007, 08:26
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 :D 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.

Daniel
28 Dec 2007, 09:02
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

jvile
28 Dec 2007, 10:07
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.

Daniel
29 Dec 2007, 06:42
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

Daniel
29 Dec 2007, 07:42
Progress:

When assembling the array of available approach it checks a DWORD in the approach object for a value of '0b'. Since it did find 16 of them in my case, I did not look at what would happen if none were found.

I expect 0b is the type of approach, and it might be ILS with Loc and GS. According the Winfried Orthmann's doc on FSX File Structure 0b = LOCALIZER_BACKCOURSE, but this is for the compiled BGL files. They seem to match the memory structures pretty well, but the approaches I'm analyzing now are C++ objects and not structures so that could explain the difference.

There's a branch when 0 or 1 approaches are found (and I think the 0 case is already handled). If more than 1 is found, for each approach the distance between the plane and the runway centerline is computed. Then the 'primaryLanding' flag is checked (again, also when the intended landing runway is the secondary) and the requiered length (computed in the same way as for take-offs) is compared to the runway length. If the length is too short or primaryLanding==NO, the computed distance gets multiplied by 10 this time.

The approach with the lowest score... is returned.

So, that's the core I guess. I now have to follow what happens to the returned value (could be overriden?) and of course I have to see what happens if no 0b type approaches exist and then what happens in fog.

Daniel

Daniel
29 Dec 2007, 09:08
After assigning the approach, FSX will look for a transition to the approach. The array of transitions for an approach can contain (at least) two different classes of approaches.

If the approach type = 0, it will look for a type 3 transition.
In all other cases it will look for a type 0 transition.

So far I've seen only type 0 and type 1. Type 0 is one class, without a lot of data, I guess this is 'Vectors'. Type 1 is another class, and in the data for objects of this class I see fix names, like SUGOL.

No scoring is done here, the first transition matching the requested type is returned.

Daniel

Daniel
29 Dec 2007, 10:19
When assembling the array of available approach it checks a DWORD in the approach object for a value of '0b'. Since it did find 16 of them in my case, I did not look at what would happen if none were found.

I was wrong, it will try to find one 0B type approach, if not found, it will look for one 00 type approach for each runway in the active group.

So it seems that precedence is given to an ILS approach, but only per runway, not for the whole runway group. So if the closest runway in the group has an ILS approach, this one is selected, but if it has not while another in the group has... you'll still get the visual approach to the closest runway.

Now for some fog...

Daniel

Daniel
29 Dec 2007, 11:05
Here's the 'technical' story on the weather function:

On approach selection, a pointer in the airport object is checked, if not present, two calls to the weather DLL are made and the result is stored at the position previously checked. If this fails, the function returns 0.

The pointer is treated as a pointer to a structure, from which another pointer is read. The structure this pointer points to contains a float: 10000000000.00000000. This value is multiplied by 3.28083.... Which seems to indicate the big value was something in meters, and now it is in feet. The result will be multiplied by 0.0001893939.... which is equal to division by 5280. Resulting in... 6+ million miles. This value is compared to 3.0. If smaller, the function returns 1.

If larger... another function is called. And another pointer is examined. MAX_DOUBLE is loaded and returned if the pointer is null. If not, a value is read from the struct. If it's not 5, 6, 7 or 8 a next structure is loaded and from this structure the value is examined. This is repeated until a value of 5, 6, 7 or 8 is encountered.

A float from the struct is then loaded (11942.06). The airport altitude in meters is subtracted from the value, suggesting the 11942.06 is a value in meters as well. The result is converted to feet and returned.

The returned value is checked vs 1000ft. If the value is higher, the function returns 0, if it's smaller the returned value is 1.

What it does:

If no weather data for the airport is present, fetch it.

- Check visibility range. If this is smaller than 3 miles, return 1
- Else check the lowest cloud layer that has at least 5/8 clouds. If it's below 1000ft, return 1
- Else, or if anything fails, return 0

A return of 1 seems to indicate IFR, where 0 = VFR conditions.

Now while I traced this function, I had a surface-1000ft layer with 1/2 mile visibility. But this was not detected somehow.

I'll run some more tests.

Daniel

jvile
29 Dec 2007, 11:13
The weather engine does not like any airport that is below SL in FS. I have to set weather visibility below 3 miles and add a max broken Layer of stratus and bring it down to 0 ft to get ATC to start saying the airport is IMC. Even the Strobes are hard to get turned on because EHAM is 11 ft below SL.

Just make sure you are IMC with ATIS or FS will fool you at EHAM.

Daniel
29 Dec 2007, 11:53
This time I did not add a layer, but I just set overall visibility to 1/4 mile. I immediately noticed the runway lights were switched on now.

And indeed, the function now returns 1.

As a result, another path is taken in the approach filtering method. This one only accepts '0b' type approaches.

So, now we've got this covered for landing:

- Runway group selection
- IFR/VFR determination
- Approach selection
- Required length calculation
- Runway selection

What remains:

- The function that determines the takeoff runway is also called for incoming planes. But while analyzing the assignment based upon the approach, I did not encounter this function. I did check the userplane only. So maybe the other function is AI only. More likely, as I did my checking using EHAM-EHAM and EHLW-EHLW flightplans, the other function is called much earlier to get an initial landing runway.

- Not sure about some flags and pointers that are checked. The possible 10 point bonus for take-off runways for example.

- I think I will create a document based upon this thread.

- What happens with float planes?

- Haven't checked the effect of IFR/VFR on the chosen transition.

But tomorrow, I guess I will do some flying. That's something else I like about FS :)

Daniel

jvile
29 Dec 2007, 16:59
If you get a return of 1, at this point there should also be a branch that looks at the qualifiers of each type of approach.

A ILS meaning Localizer + Glideslope should return the highest score regardless of how many other approaches are witten in the approach database for that runway. DME asoociated with ILS+GS does not appear to make a difference but does make a difference further down the list.

If no ILS exsits for a runway then FS starts looking down through a list of approaches to see if one exsits. The list has a pecking order.

My list may be off a little bit because it has been a few years since I did the study but the priority looks something like this.

ILS
Localizer
Localizer_Backcoures (for a recip approach)
LDA
SDA
GPS
RNAV
VORDME
VOR
NDBDME (but the voice file for ATC only says NDB even if I write the added DME)
NDB

NDB gets the lowest score. Only if no other type approach is listed then ATC will instruct the User/AI to fly the NDB approach.

All appproaches by default are vectors to final outside the FAF including a NDB which at that point are straight in with no type outbound procedure turns. For the User Plane it is up to the Pilot flying to ask ATC for a Transition so the default vectors to final are disregarded.

scott967
30 Dec 2007, 01:09
- I think I will create a document based upon this thread.

Daniel

I hope you can. This stuff is great. Reminds me of the old days when I used "debug" in DOS!

scott s.
.

scruffyduck
30 Dec 2007, 06:56
I hope you can. This stuff is great. Reminds me of the old days when I used "debug" in DOS!

scott s.
.

I agree and we would be happy to host it on the ADE web site :D

Daniel
10 Jan 2008, 07:00
Short update: I started on the document, but then the flu caught up with me... and now the holidays are over :( So it will take some time now :)

Daniel

Daniel
25 Oct 2010, 08:34
Dug up this old cow from the ditch as we say in Holland...

Every now and then I still like to look under the hood of FSX and recently I came across something I can't quite figure out.

FSX groups runways together when they are parallel, or when they have been 'crosswind'ed'. When a runway is needed for something, FSX will first determine which of the created groups best matches the current wind conditions and then pick a runway from that group.

When determining the best group, FSX will first check a pointer inside the airport structure. If this pointer (which should be a pointer to a RunwayGroup) exists some additional tests are done, which appear to be:

- If there currently are any aircraft taxiing to a runway OR
- If any runway in the group has aircraft queued for take-off OR
- If any runway in the group has aircraft queued for landing OR
- If any runway in the group has aircraft on approach THEN:

-- Keep using the current group
- Else
-- Find a new best group

So this pointer appears to be some sort of cache for the best group (two entries actually: for normal group and water group), and new wind conditions will only take effect when no planes are in anyway assigned to the runways of the current group.

Yet... I can't find any place where FSX will write something to this pointer and in fact, after changing the winds by 180 degrees I immediately see aircraft being assigned to the other runway end.

But then again, I remember people complaining about how Flight Simulator would not respond to changes in weather.

I tested with FSX SP2, perhaps this is something that was removed somewhere.

Does this make sense to anyone?

Daniel

rfields
25 Oct 2010, 14:40
When determining the best group, FSX will first check a pointer inside the airport structure. If this pointer (which should be a pointer to a RunwayGroup) exists some additional tests are done, which appear to be:

- If there currently are any aircraft taxiing to a runway OR
- If any runway in the group has aircraft queued for take-off OR
- If any runway in the group has aircraft queued for landing OR
- If any runway in the group has aircraft on approach THEN:

-- Keep using the current group
- Else
-- Find a new best group

So this pointer appears to be some sort of cache for the best group (two entries actually: for normal group and water group), and new wind conditions will only take effect when no planes are in anyway assigned to the runways of the current group.

Yet... I can't find any place where FSX will write something to this pointer and in fact, after changing the winds by 180 degrees I immediately see aircraft being assigned to the other runway end.

But then again, I remember people complaining about how Flight Simulator would not respond to changes in weather.

I tested with FSX SP2, perhaps this is something that was removed somewhere.

Does this make sense to anyone?

We noticed immediately after FSX beta became widely available that the sequence about keeping the current runway configuration if aircraft were on or assigned to the runway and approach appeared to have been removed. Or basically that the weather change swapped ends ends immediately.

At some point in the beta for FSX SP1 / SP2, or on a public forum after FSX was released - I got an answer for the behavior change - which I will attempt to summarize.

"The scoring process to swap runway ends, or go to different runways was such that many busy airports would never change runway configuration in FS2004. Fixing that complaint was looked at in the development of FSX.

It was quickly determined that extensive recoding would be necessary to change an airport runway configuration, and divert all aircraft in a movement stage on the ground or in the air to the new runway configuration.

So the compromise was to cut out the 'runway hold' which stopped the new configuration from being used, but continue all in-movement aircraft to the old configuration runways.

This would present the simmer with some head to head meet situations, but those would be minimal."

Now the real answer was a lot more technical - but basically - Yes - they removed what I called a 'runway hold' from the runway change process, allowing the runways to be assigned in the new configuration without any checks to see if the old configuration was in use.

The reason for that shortcut was that rebuilding the code to work the way the real world works was expense and too much time would be necessary to recode.

I don't know exactly how they implemented the change, and you may be seeing some code which is still in place, but another tiny marker in a .dll says ignore the If Else Then statement.

Daniel
25 Oct 2010, 16:10
I don't know exactly how they implemented the change, and you may be seeing some code which is still in place, but another tiny marker in a .dll says ignore the If Else Then statement.

Thanks for the reply, it does actually explain it all. When I first analyzed the code my thought was: these conditions will never be met on a busy airport.

The reason why I could not find the assignment is obviously that that is the way the change was implemented. By removing the assignment of the active group, the code that checks the assignments to the active group is never executed.

Daniel

Daniel
25 Oct 2010, 16:17
Reading Jim's posts on the way FSX handles approaches helped a lot in analyzing the method below. I might have found some additional details though.

This is (my current knowledge of) how FSX handles approaches when it constructs the ATIS message:

There are two lists with approaches for each airport:

- A list of all approaches
- A list of available approaches

The procedure that performs the filtering starts out by looking at the total number of approaches. If it is zero, it will just return a pointer to the (also empty) list with available approaches.

It will then try to get the best group of runways, given the current weather conditions. If this fails, it will try again but this time it requests a group of water runways. So for an airport with both normal and water runways only the normal runways will be shown in the ATIS message.

Next there is a check to see if the existing list of available approaches was created using the current weather conditions (wind/visibility/50% cloud base). If the weather has not changed and the active list is not empty, the active list is returned.

If a new list must be created, the algorithm will split into two branches:

- An IMC scan
- An VMC scan

The VMC scan will be done if the weather conditions are VMC or the total number of approaches for the airport is exactly the same as the total number of runways. The last part only makes sense to me if FSX will actually add the hardcoded 'dll' approach to each runway, in which case this statement becomes: If IMC conditions exist and there is at least one not hardcoded approach... do the IMC only scan.

So let's look at that IMC only scan. It actually starts with another branch right away. If the 'best group' that was determined above is not marked as a group of ILS runways an 'all approaches' scan is performed. (I'm not sure if this means that all runways have to have an ILS approach or if only the main runway of the group should have one).

If the group does have the ILS flag set, the actual IMC only scan is done.

IMC scan

It just scans all runways in the best group and adds their ILS approaches to the list of active approaches.

VMC scan

If the best group has no runways (ehm, well, ok), stop scanning. Else, add the ILS approach of each runway in the best group. For runways that do not have an ILS approach, add the first approach in the list for that runway, whose type is not 0 (probably 0 = the hardcoded approach)

All approaches scan

Remember, this is what is done if the active group is not an ILS group, but the airport has IMC conditions. It will return a single approach. It will scan through the list with all approaches, skipping those with type==0. If the approach is for the main runway of the best group, score the approach with a number of points based upon the approach type times two. If it is for another runway, do not multiply by two.

Scores per type:

NDB = 1
NDBDME = 2
VOR = 3
VORDME = 4
BACKCOURSE = 5
SDF = 6
LDA = 7
LOCALIZER = 8
RNAV = 9
GPS = 10
ILS = 11

So actually the list would be: (* = approach for main runway)

NDB = 1
*NDB = 2
NDBDME = 2
VOR = 3
VORDME = 4
*NDBDME = 4
BACKCOURSE = 5
SDF = 6
*VOR = 6
LDA = 7
LOCALIZER = 8
*VORDME = 8
RNAV = 9
GPS = 10
*BACKCOURSE = 10
ILS = 11
*SDF = 12
*LDA = 14
*LOCALIZER = 16
*RNAV = 18
*GPS = 20
*ILS = 22

It will keep track of the highest scoring approach, both for runways that are in the best group and runways that are not in the best group. It will only replace a found approach if the current score is higher. So once a VORDME approach has been found for a runway, it will not be outscored by a NDBDME from the main runway.

If after scanning all approaches a best approach has been found for the best group, it will be the active one. If not, but a best approach was found for another group, this will be the active one.

If all scanning is done and the list of active approaches is still empty, an additional scan is performed that returns the last approach with type!=0 as the active approach.

Daniel

jvile
06 Nov 2010, 08:44
Dan

Disregard the order I showed. I have some more extracted code out of the .dll's pertaining to ATC and what is said.

jvile
20 Feb 2011, 12:10
We know the following

If no weather data for the airport is present, fetch it.

1. - Check visibility range. If this is smaller than 3 miles, return 1
2. - Else check the lowest cloud layer that has at least 5/8 clouds. If it's below 1000ft, return 1
3. - Else, or if anything fails, return 0

A return of 1 seems to indicate IFR, where 0 = VFR conditions.

A weather surface of 1000ft layer with 1/2 mile visibility is not always detected on the 1st or 2nd search. It is best to set weather and save as a flight then start FS and load that saved flight. Weather is slow to load in comparison to plane traffic and ATIS.

I agree with the 1= IMC and 0=VMC. Sometimes FS has a hard time changing from VMC to IMC because the weather is so slow to load on startup.

Reggie points out that MS did some quick programming and there is some other coding that I have extracted.

The 3 rules above (1-3) is very close to when airports change from VMC to IMC (both real world and FS world so that is working).

In my research back during the days of FS2004 I found the same as you when refering to the approach pecking order. My original post was dated May 16 2006 and FSX uses this same code.

The following is the pecking order that FS9 uses when the airport is IMC.

This is not based on any type approach in the AFCAD program. The Airport I used has a 16/34 runway and no Navaids are in the AFCAD airport.

This list is based on a process of elimination where every single type approach is listed in the database to begin with. The actual XML Approach Type listing was randomized so there would be no influence on the pecking order.

The pecking order is as follows where ILS gets the highest score and NDB gets the lowest score.

1. ILS ---- delete ILS and GPS is next
2. GPS --- delete GPS and RNAV is next and so on
3. RNAV
4. LOCALIZER
5. LDA (Localizer Type Directional Aid)
6. SDF (Simplified Directional Facility)
7. LBOC (LOCALIZER_BACKCOURSE)
8. VORDME
9. VOR
10. NDBDME
11. NDB

ATC does not speak the letters NDBDME, it only says cleared for runway 34 and the word visual is not spoken (IMC). ATC does say VOR, VORDME and NDB but not NDBDME. If you request the NDBDME from the ATC menu list the letters are spoken.

When the Airport is VMC the only type approach that ATC says is ILS. If you remove the approach type ILS, meaning the runway does not have a XML written ILS but does have the other 10 type approaches ATC says Visual Runway.

So what suppresses visual approach with vis over 3 miles? "ILS" in the first line of XML in the Approach data.

Where does ATC get the phases from

<Approach type="ILS"
<Approach type="GPS"
<Approach type="LOCALIZER_BACKCOURSE"
<Approach type="VORDME"
etc

In my example above, if there is both a LBOC and a VORDME for the same runway then the LBOC takes precedence when vis is less than 3 miles and cloud layer exceeds 5/8 broken. If above these values the words spoken are "visual runway" unless you ask ATC for a particular Approach Type.

Everything that ATC does for a default Vectors To Final comes from the following section of the XML only

<Approach type="ILS" runway="34" suffix="0"
gpsOverlay="FALSE" designator="NONE" fixType="TERMINAL_WAYPOINT"
fixRegion="K7" fixIdent="DUCUT" altitude="2499.970F"
<ApproachLegs>

Nothing else is used or needed however, the BGLCOMP compiler will not compile the Approach Type= heading by itself. The additional lines of XML (<Leg type=) are for drawing the lines for the User Aircraft's GPS receiver.

There is one other piece of data that ATC uses for which way the User/AI Plane turns after a missed approach (IFR). That is embedded in the

<MissedApproachLegs>
magneticCourse="319.00"

ADE already handles the correct turn for the missed approach in the Approach Editor.

I found another flag in the IFR Scan branch that I never deciphered.

In the Approach code if a GPS overlay is flag as YES then ATC will no longer use the correct type approach. Example: If I code a Localizer type approach and set GPS overlay ATC will say the approach is a GPS and not a Localizer. This occurs for all approaches except the ILS type.

If you are working toward the Wiki like you did for parking I am working on a Tutorial for the Approach Mode Editor. My material will be based more on the logic of approaches and not the code in the .dll's. In some cases I will have to refer to both our notes (including Scott and Reggie's) but will stay primarily with a User type document that follows the ADE Manual that Bob and Helli wrote.

Helli is working on ADE Version 2.0 and the ADE Approach Editor 2.0 will be able to do more as Jon goes through my notes.