flybywiresim / aircraft

The A32NX & A380X Project are community driven open source projects to create free Airbus aircraft in Microsoft Flight Simulator that are as close to reality as possible.
https://flybywiresim.com
GNU General Public License v3.0
5.16k stars 1.12k forks source link

[BUG] SimBrief flight plan not correctly entered: AWY/WPT MISMATCH #2923

Closed JLD95 closed 3 years ago

JLD95 commented 3 years ago

Mod Version

2021-01-07T01:08:05+00:00

Describe the bug

The SimBrief flight plan between FAOR to FYWH with route VASU3A VASUR UQ24 ETOSA G653 GBV UN182 AXODO AXOD1B

Is not correctly entered

To Reproduce

  1. On SimBrief, define a flight plan between FAOR to FYWH with route VASU3A VASUR UQ24 ETOSA G653 GBV UN182 AXODO AXOD1B
  2. On MCDU when init request, WY/WPT MISMATCH appears and the FP has no intermediate waypoints

Expected behavior

FP entered shall be similar to SimBrief definition

Actual behavior

Intermediate waypoints of SimBrief Flight Plan are not entered

References

Additional context

Was this working before/when did the issue start occurring?

Is this a problem in the vanilla unmodded game? Not tested I used also Navigraph data cycle 2014 rev2

Discord username (if different from GitHub):

tareksabet commented 3 years ago

If you meant about SID points and Stars point they shouldn't be loaded.

JLD95 commented 3 years ago

I made many flights with A320Nx and SimBrief without problems. In this flight, i have only SID and STAR points

derl30n commented 3 years ago

It can occur that routes from simbrief have waypoints or waypoints the flight plan manager cant find, therefore a message NOT IN DATABASE or AWY/WPT MISMATCH is displayed on the scratchpad.

JLD95 commented 3 years ago

I retry this flight plan and AWY/WPT MISMATCH is displayed on the scratchpad. I try in manual mode and I can create without problem the route defined by SimBrief: all waypoints (VASUR, ETOSA, GBV, AXODO) and all airways (Q24, G653, UN182) are defined

In manual mode: 2021-01-07 (4)

derl30n commented 3 years ago

The reason why this works when entering manual may be because await lastWaypoint.infos.UpdateAirway(name) is being used to ensure the needed data is loaded.

The mentioned part is being skipped by REQUEST INIT (SimBrief).

This is a possible solution to the problem.

await (mcdu.flightPlanManager.getWaypoints()[wpIndex]).infos.UpdateAirway(via);

A32NX/html_ui/Pages/A32NX_Core/A32NX_ATSU.js

const addWaypointAsync = (fix, mcdu, routeIdent, via) => {
    const wpIndex = mcdu.flightPlanManager.getWaypointsCount() - 1;
    if (via) {
        return new Promise(async (res, rej) => {
            await (mcdu.flightPlanManager.getWaypoints()[wpIndex]).infos.UpdateAirway(via);
            mcdu.insertWaypointsAlongAirway(routeIdent, wpIndex, via, (result) => {
                if (result) {
                    console.log("Inserted waypoint: " + routeIdent + " via " + via);
                    res(true);
                } else {
                    console.log('AWY/WPT MISMATCH ' + routeIdent + " via " + via);
                    mcdu.addNewMessage(NXSystemMessages.awyWptMismatch);
                    res(false);
                }
            });
        });
    } else {
        return new Promise((res, rej) => {
            const coords = {
                lat: fix.pos_lat,
                long: fix.pos_long
            };
            getWaypointByIdentAndCoords(mcdu, routeIdent, coords, (waypoint) => {
                if (waypoint) {
                    mcdu.flightPlanManager.addWaypoint(waypoint.icao, wpIndex, () => {
                        console.log("Inserted waypoint: " + routeIdent);
                        res(true);
                    });
                } else {
                    console.log('NOT IN DATABASE ' + routeIdent);
                    mcdu.addNewMessage(NXSystemMessages.notInDatabase);
                    res(false);
                }
            });
        });
    }
};
AdamNZ commented 3 years ago

I tried a flight with the revised code (thanks) ... but got the same WY/WPT MISMATCH error - and only the LIMES waypoint to my NZAA-NZWN flight plan (see #2947).

derl30n commented 3 years ago

@AdamNZ the proposed solution/code is actually only for documentation, once you modify the codes you need to run our build script.