1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

FSX BGL Airport Records

Discussion in 'Tools programming' started by scruffyduck, 29/10/06.

  1. scruffyduck

    scruffyduck Administrator Staff Member FSDevConf team Resource contributor

    Joined:
    17/9/05
    Messages:
    25,804
    Country:
    wales
    I've started a new thread with this question as the one related to BGLAnalyzeX is becoming very long.

    I think I was up too late last night and my brain is not working very well today :eek:

    In Winfried's document on BGL format he gives formulas for converting the lat/lon values:

    I seem to see missing brackets and also these do not produce any sensible numbers for me - could some kind soul take pity and give me the Math 101 on this please?

    Also I noted the dicussion on AirportTestRadius - am I correct in that this is used by the compiler but the information is not stored in the bgl? If not where is that information in the record? Second is TrafficScalar new and again where is it in the airport record please?

    thanks guys :)
  2. Javier

    Javier

    Joined:
    15/10/06
    Messages:
    31
    Country:
    spain
    Hi Jon,

    From the BGLXML code I use:

    Code:
            private double fsLat2Lat(UInt32 fsLat)
            {
                double f = (((double)fsLat) * 180) / 536870912; //MAXSOUTH;
                if (f > 90.0)
                    return -((f - 180) + 90);
                else
                    return 90 - f;
            }
            private double fsLon2Lon(UInt32 fsLon)
            {
                double f = (((double)fsLon) * 360) / 805306368; //MAXEAST;
                return f - 180;
            }
    
    It seems to work :)

    Regards,
    Javier.
  3. scruffyduck

    scruffyduck Administrator Staff Member FSDevConf team Resource contributor

    Joined:
    17/9/05
    Messages:
    25,804
    Country:
    wales
    Thanks Javier

    I will give that a try :)
  4. arno

    arno Administrator Staff Member FSDevConf team Resource contributor

    Joined:
    28/5/04
    Messages:
    21,304
    Country:
    netherlands
    Hi Jon,

    So combining that information it seems like the brackets should be like this (which looks familiar from the stuff I looked at before):

    Code:
    (double) Lon = (DWORD) Lon * (360.0 / (3 * 0x10000000)) – 180.0
    (double) Lat = 90.0 - (DWORD) Lat * (180.0 / (2 * 0x10000000))
    Yes, that is correct. The AirportTestRadius is only used by the compiler to generate warnings. That must also be why Winfried uses a default value for it in his decompiler (and big airports thus start giving such errors).

    I have not looked at the TrafficScalar though, I would imagine it is in the BGL file somewhere. Or else it looks like a parameter that is not really used.
  5. scruffyduck

    scruffyduck Administrator Staff Member FSDevConf team Resource contributor

    Joined:
    17/9/05
    Messages:
    25,804
    Country:
    wales
    Thanks Arno - It's not in the primary airport record as far as I can see but I'm not through everything in the other airport records yet so it might be there :)
  6. jvile

    jvile

    Joined:
    24/1/05
    Messages:
    8,025
    jon

    Both the traffic scaler and test radius is new for FSX.

    I have also noted that warnings are given for the test radius at small airports when compiling so I started using 5000M as a standard for all compiled airports. That number takes care of airports like Halifax which gave me warnings all the way up to Atlanta when I added the 5th runway way south of the ARP.

    Scaling is a AI Traffic scaler used when developing Flightplans with the TrafficDatabaseBuilder.

    It tells the compiler how heavily to schedule traffic at each airport. It has no effect at runtime. It's only used when the traffic database is created.

    It appears to do nothing in the header of a compiled airport because it is used when the Flightplan is compiled although the FP compiler needs that piece of data in the airport record to create the flight plans with the TDB.

    The end result is that 30 percent parking stays vacant on startup even though a compiled FP overloaded the parking for that airport.
  7. scruffyduck

    scruffyduck Administrator Staff Member FSDevConf team Resource contributor

    Joined:
    17/9/05
    Messages:
    25,804
    Country:
    wales
    Thanks Jim
  8. osman

    osman

    Joined:
    30/9/06
    Messages:
    73
    Country:
    germany
    Hi,
    in the description there are indeed some brackets missing (not in the program code :) ).
    The TrafficScaler is stored in the Airport record within the DWORD added in FS X at the end of the fixed part of that record. Apparently MS has used always the same value, but developpers might want to change that.
  9. scruffyduck

    scruffyduck Administrator Staff Member FSDevConf team Resource contributor

    Joined:
    17/9/05
    Messages:
    25,804
    Country:
    wales
    Ah is that the extra four bytes which seem to be in the FSX airport record compared to the FS9 record?
  10. DougMatthews

    DougMatthews

    Joined:
    23/10/06
    Messages:
    288
    Country:
    us-washington
    Up to FS9 we used a hardcoded ratio of parking spots to AI traffic. For FSX we exposed a scalar to allow throttling AI traffic at certain airports. There were some airports, in Russia notably, but also elsewhere, that the combination of many parking spots and a minimal taxiway infrastructure (or choke points) resulted in gridlock. The TrafficScalar allows us to help eliminate this problem.

    -Doug
  11. scruffyduck

    scruffyduck Administrator Staff Member FSDevConf team Resource contributor

    Joined:
    17/9/05
    Messages:
    25,804
    Country:
    wales
    Hi Doug

    So the Scalar is the extra DWORd in the Airport Record?

    Ah! - I should read the posts above more carefully - that is what Winfried is saying :eek:

    Am I right in thinking that the scalar value is the value in that DWORD /65536???

    Thanks
    Last edited: 23/11/06

Share This Page