• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

P3D v5 Reading airport altitude from sim

Messages
52
Country
germany
Hi, need again your help. How can I read the airport altitude used by sim for a specific airport inside a xml gauge?
 
Last edited:
Messages
1,564
Country
thailand
There are several different categories of airport altitude found in the gps module - center of the airport complex, center of a runway, flight plan departure and destination altitudes. You might want to get familiar with the gps module and how to use it with XML. Hundreds of XML variables and so many things you can create with it.

Bob
 
Messages
52
Country
germany
I need the altitude of the airport that is defined in the afcad.
My intention is to set an icao and get then the result. Will look into the module.
 
Messages
52
Country
germany
Ok, is this correct for the example of Las Vegas Airport?

XML:
<!-- SET the Airport -->
'A      KLAS' (>C:fs9gps:WaypointAirportICAO, string)
<!-- GET the Data -->
(L:WaypointAirportElevation, feet) (>L:Destination_Airport_Elevation, feet)

I also understand that the ICAO String is 12 characters long, but the trailing spaces are not required.

My next problem is now....how to SET the data.
I have a Lvar providing the example 'KLAS' string, but how to add the A followed by 6 spaces?

Can this work?
XML:
'A      (L:Airport, string)' (>C:fs9gps:WaypointAirportICAO, string)
 
Last edited:
Messages
1,564
Country
thailand
(L:WaypointAirportElevation, feet) is incorrect because you want the gps variable for airport elevation. Therefore, it must be (C:fs9gps:WaypointAirportElevation, feet)

'A______(L:Airport, string)' (>C:fs9gps:WaypointAirportICAO, string) is incorrect. L:Vars cannot store strings, and even if they could, you would still be missing the scat operator.

'A______' (C:fs9gps:WaypointAirportIdent) scat (>C:fs9gps:WaypointAirportICAO, string) would work
'A______KLAS' (>C:fs9gps:WaypointAirportICAO, string) would work

If you're new to XML and also to the gps module there will be a learning curve but you'll get it quickly enough. There's a brief section on Working with Strings that you might want to take a look at.

Bob

underscores are spaces
 
Messages
52
Country
germany
Hi @rpmc ,
I think I have now the solution after reading Robert McElrath Guide.

XML:
<Macro Name="ToString1">
(@1, number) 21 >> 0x7F &amp; chr
(@1, number) 14 >> 0x7F &amp; chr scat
(@1, number)  7 >> 0x7F &amp; chr scat
(@1, number)       0x7F &amp; chr scat
</Macro>

<Macro Name="ToString4">
@ToString1(@1_4) @ToString1(@1_3) @ToString1(@1_2) @ToString1(@1_1) scat scat scat
</Macro>

<Macro Name="ToString">
@ToString4(@1_4) @ToString4(@1_3) @ToString4(@1_2) @ToString4(@1_1) scat scat scat
</Macro>

<!-- SET the Airport -->
'A      ' @ToString(L:Airport_ASCII_ICAO, enum) scat (>C:fs9gps:WaypointAirportICAO, string)
<!-- GET the Data -->
(C:fs9gps:WaypointAirportElevation, feet) (>L:Destination_Airport_Elevation, feet)

I just have to deliver the ICAO code of the aiport in ASCII format. (L:Airport_ASCII_ICAO, enum)

That macros are now to much, as I need only 4 sring characters, but thats from the guide.
 
Last edited:
Messages
1,564
Country
thailand
Right - those bit shift macros are overkill to store the ascii of an airport Ident in an L:Var.

Bob

[Edit] Obtaining ground elevations --

Some ways to retrieve airport elevation from the fs9gps database. I’m sure other contributors in here will point out different ways , too:

1. Specify a fs9gps Ident, construct the fs9gps airport ICAO using the Ident, and then enter the fp9gps database using the fs9gps ICAO (C:fs9gpsWaypointAirportICAO) to extract airport altitude using gps variable (C:fs9gps:WaypointAirportElevation, feet). The fs9gps Ident is a 3 to 4 character airport identifier often referred to in the real world as the airport ICAO, but in flight sim fs9gps terms, it is called the Ident.

2. Specify the latitude and longitude values of the airport you are interested in, then do a fs9gps NearestAirport search using that lat/lon. The NearestAirport search will return a list of airports near the lat/lon you specified and your airport of interest will be at the top of the list, meaning the list index will be 0 (counting in the gps module usually starts with 0, e.g., 0,1,2,3,4,5,...). Get airport elevation using 0 (>C:fs9gps:NearestAirportSelected) then (C:f9gps:NearestAirportSelectedAirportElevation, feet)

3. If you have a loaded flight plan and you want the elevation of an airport in that flight plan, then specify the Index of the flight plan waypoint number of the departure or destination airport, (C:fs9gps:FlightPlanWaypointIndex) and then use (C:fs9gps:FlightPlanWaypointAltitude, feet) to get the airport altitude.


Some ways to retrieve ground elevation from an arbitrary lat/lon:

1. Create a dummy AI object, place it at a lat/lon and obtain the ground elevation at its location using (A:GROUND ALTITUDE, feet).

2. If you are using P3D v4 or 5, another method is to retrieve the ground altitude of an arbitrary lat, lon using SIMCONNECT_RECV_GROUND_INFO and SIMCONNECT_DATA_GROUND_INFO. This way requires one to write a C++ module that interfaces with XML. This method works at least with P3D v4 and v5, and possibly versions before that, I don't know for sure. Doug Dawson had written one a few years ago that works with 64 bit P3D.

3. Fly your aircraft to an arbitrary point then get ground elevation under it using (A:GROUND ALTITUDE, feet)
 
Last edited:
Messages
52
Country
germany
1. Specify a fs9gps Ident, construct the fs9gps airport ICAO using the Ident, and then enter the fp9gps database using the fs9gps ICAO (C:fs9gpsWaypointAirportICAO) to extract airport altitude using gps variable (C:fs9gps:WaypointAirportElevation, feet). The fs9gps Ident is a 3 to 4 character airport identifier often referred to in the real world as the airport ICAO, but in flight sim fs9gps terms, it is called the Ident.
That's what I try to do....
But SIMCONNECT does also look promising.
Thank's a lot!
 
Top