Hello, In my FMC, I can select an approach to the destination airport. For
testing purpose, U used Charlotte (KCLT) and selected ILS Rwy 18C approach. I
can successfully read all the waypoints to create the flight plan accordingly,
but I can’t get the crossing altitudes for the approach waypoints. As you can
see on the approach plate image below, JEDKO should be flown at 8000 ft, LERDY
at 7000, FERSA at 6000, … In my case, I can read the approach waypoints but
legAltitudeDescription, legAltitude1 and legAltitude2 are always all 0
Hello @ericmarciano Can you confirm you’re using the FlightPlanManager to
retrieve that data? If so, try using the FacilityLoader instead. We have some
known issues about flight plan manager leg altitude data that we’re looking
into. Regards, Sylvain
Yes, I use the flight plan manager for this. In fact, I could successfully
read the altitudes for the selected approach transition waypoints (in my
example JEDKO, LERDY; FERSA, TOMME) but not for the selected approach
waypoints (HAGUL, OZEJI, CYLOW). Can you please tell me more about the way to
read this information using the FacilityLoader? Thanks, Eric
Check this piece of code from Working Title: [msfs-avionics-mirror/Fms.ts at
c55bb0125da7e4e193c42930baaa4de8ddde9a90 · microsoft/msfs-avionics-mirror ·
GitHub](https://github.com/microsoft/msfs-avionics-
mirror/blob/c55bb0125da7e4e193c42930baaa4de8ddde9a90/src/workingtitle-
instruments-g1000/html_ui/Pages/VCockpit/Instruments/NavSystems/WTG1000/Shared/FlightPlan/Fms.ts#L1400)
When an approach is inserted in the flight plan, the procedures/transitions
with correct altitude are retrieved from “AirportFacility”, itself being
loaded using the FacilityLoader.
Hi Eric, For the stock JS utilities, you will need to use FacilityLoader for
this. I believe FlightPlanManager has an instance of FacilityLoader available,
but you can also create an instance if you need to. Then, simply use the
getFacility(icao)
method on FacilityLoader to get the airport facility. You
will need to pass in the full 12 character ICAO of the airport to this method,
which will then return a Promise that resolves in the airport facility. Once
you have the airport facility, you will find the departures, arrivals, and
approaches as fields on the .infos
object. FlightPlanManager tracks the
indices of the selected procedure in the array; these indices will match the
departures, arrivals, and approaches arrays. You will find all the procedure
altitude data on the leg information contained within the objects in each
array entry for the procedure. -Matt
Thank you for the detailed answer. This is already what I do, I use the .infos
member of the airport instance to read the departure/arrival procedures,
approaches, transitions, … Something like:
let airportInfo = this.airportWpt.infos;
if (airportInfo instanceof AirportInfo) {
for (let i=0; i < airportInfo.departures.length; i++) {
[...]
}
}
This way, I read the approaches using airportInfo.approaches, and for the
selected approach, I read the approach transitions using
airportInfo.approaches[n].transitions. When an approach transition is
selected, I read the approach transition waypoints using
airportInfo.approaches[n].transitions[m].waypoints. This works perfectly, I
can read the waypoints and their altitude is correct. But when I read the
selected approach waypoints using airportInfo.approaches[n].wayPoints, it is
not perfect because I read the waypoints but their altitude is always 0
(altitudeinPF is 0, altitude1 and altitude2 are 0). I guess I did something
wrong here… Here are more details: I used this code to loop into the
approach waypoints:
instrument.facilityLoader.getFacility(this.airportWpt.icao).then((arpt) => {
if (arpt) {
console.log("Airport (" + arpt.icao + ") found.");
let airportInfo = arpt.infos;
if (airportInfo instanceof AirportInfo) {
for (let i=0; i < airportInfo.approaches.length; i++) {
console.log(" - Aprroach " + airportInfo.approaches[i].name);
for (let j=0; j < airportInfo.approaches[i].wayPoints.length; j++) {
let wpt = airportInfo.approaches[i].wayPoints[j];
console.log(" * Waypoint " + wpt.ident);
}
}
}
}
});
I have all the approach waypoints listed. For example, at KCLT, approach ILS
18C, I see this in the console: - Aprroach ILS 18C * Waypoint TOMME *
Waypoint HAGUL * Waypoint OZEJI * Waypoint CYLOW * Waypoint RW18C And when I
look in details using the debugger, for all waypoints I see altitudeinFP,
legAltitudeDescription, legAltitude1 and legAltitude2 all set to 0. This is
not the same for the JEDKO transition waypoints (JEDKO, LERDY, FERSA and TOMME
in my example), for which I have the correct altitude
Hi Eric, My mistake, looking at the code in the Waypoints class, it does
appear that the approach waypoints for AirportInfos do not have the altitudes
loaded for some reason. The relevant code is in
WayPointInfo.SetFromIFacilityAirport, where the data
parameter is the raw
data that comes back from the sim Facilities API. You may be able to work
around the issue there. Alternatively, you can use the experimental MSFS
Avionics Framework (https://github.com/microsoft/msfs-avionics-mirror) to
query the sim Facilities API. Specific documentation on that task can be found
here: <https://microsoft.github.io/msfs-avionics-mirror/docs/interacting-with-
msfs/querying-navdata>
Hi Matt, Thanks again for your answer. I looked into the
WayPointInfo.SetFromIFacilityAirport code and it appears there is no update of
the legAltitudes nor the leg>AltitudeDescription. Many things are updated, but
not the altitudes; Consequently, it still doesn’t work as expected. I will
look into the MSFS Avionics Framework, I am sure it will work better Thanks
again Matt !!