Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(fms): flight planning version 2 #7692

Merged
merged 570 commits into from
Jun 14, 2024
Merged

feat(fms): flight planning version 2 #7692

merged 570 commits into from
Jun 14, 2024

Conversation

Benjozork
Copy link
Member

@Benjozork Benjozork commented Jan 7, 2023

Fixes #1835
Fixes #2068
Fixes #2792
Fixes #5687
Fixes #6379
Fixes #6495
Fixes #6558
Fixes #7524

Summary of Changes

This PR is a complete rewrite of the entire flight planning system of the A32NX (and by extension A380X).

It entirely replaces the old system, a derivative of the CJ4 mod flight plan system, with a completely custom one, purpose-built for simulating Honeywell Airbus FMS software found on the A320/A330/A340/A350/A380.

Motivation

  • The current flight planning system possesses a segmenting system prone to breaking, causing potential bugs in may places.
  • The current flight planning system does not correctly manage origin and destination legs. Those are often added ad-hoc, without real proper representation at appropriate times in the flight plan. This also results in problem correctly handling approach missed approach points and therefore, makes missed approach segments impossible.
  • The current system operates on a flight plan data structure that does not suit the reality of an airliner flight planning system. Legs are represented as waypoints, with irrelevant data strewn around like predictions, and important data present in untyped free-for-all dictionaries. Discontinuities exist solely as a property of the leg they come after, not as an actual flight plan element.
  • The current system is not made in a way that can accommodate accurate stringing algorithms.
  • The current system does not support efficient flight plan synchronization across clients.

Major design differences

  • Flight plan data structure
    • The main type of a flight plan is a FlightPlanElement, which resolves to type FlightPlanLeg | Discontinuity. Only the leg type actually contains information. This API is typed in a way that mandates proper verification of the type by the consumer and allows for semantic narrowing by TypeScript.
    • Flight plans are divided into segments, which are finite in number and match the only possibilities in a Honeywell Airbus FMS. There is no support for out-of-order segments and operations on flight plans are limited to this layout, reducing the API surface.
    • FlightPlanManager is split into two classes:
      • FlightPlanService (for now a singleton - will likely change) - this exposes allowed and common operations on flight plans, accepting parameters to target a specific plan or sub-plan (alternate). It also encapsulates TMPY logic.
      • FlightPlanManager - this exposes operations on managing the storage of flight plans (create, delete, copy, swap, etc.)

Functionality introduced

  • Database selection (external vs. MSFS)
  • Waypoint collapsing (duplicate removal)
  • Missed approach support
    • Loading of legs, stringing
    • Sequencing logic
  • Secondary flight plan support
    • Creation, copy, swapping (thru FlightPlanManager core logic)
    • Editing
      • Origin/Dest airport revisions (DEPARTURE, ARRIVAL)
      • Element insertion/deletion on FPLN page
      • TBD - some missing
    • Predictions / sync with active logic
  • Alternate flight plan support
    • Editing
      • Origin/Dest airport revisions (DEPARTURE, ARRIVAL)
      • Element insertion/deletion on FPLN page
      • Hold revisions
      • Airway insertion
      • TBD - some missing
    • ENABLE ALTN (started, not done)

Issues fixed

  • Approaches are no longer forced to end at the runway threshold
  • Various lateral revisions now no longer wrongly remove discontinuities
  • Using the same airport as origin/destination is less problematic
  • STARs with multiple IAFs now string correctly

Work remaining

Refer to #7692 (comment) for a more detailed list.

  • BUG element insertion via LSK on FPLN page adds elements after leg, instead of before
  • BUG automatic airway matching does not work on MSFS backend
  • BUG MCDU needs reloading to work
  • TODO release msfs-navdata with Coherent airway loading
  • TODO correct NEXT WPT logic
  • TODO Finish ALTN logic
  • TODO Finish missed approach logic
  • TODO Finish plan sync (for split FMGC in the future, A380X)
  • TODO port vnav (blocked by VNAV being on dev)
    • TODO some things to fix, waiting for msfs-navdata to support fixTypeInfo
  • TODO delete old flight plan system source code
  • TODO port MSFS planner sync
  • TODO finish SimBrief uplink
  • TODO add CoRoute uplink
  • TODO port hold revisions
  • TODO port vertical revisions

Screenshots (if necessary)

References

Additional context

Discord username (if different from GitHub):

Testing instructions

How to download the PR for QA

Every new commit to this PR will cause a new A32NX artifact to be created, built, and uploaded.

  1. Make sure you are signed in to GitHub
  2. Click on the Checks tab on the PR
  3. On the left side, click on the bottom PR tab
  4. Click on the A32NX download link at the bottom of the page

ApproachType.Rnav,
ApproachType.VorDme,
ApproachType.Vor,
ApproachType.Vortac,
Copy link
Member

@tracernz tracernz Sep 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VORTAC should probably be with VOR/DME since they are basically equivalent for civilian aircraft.

A320 can't fly TACAN only approaches as it does not have a TACAN receiver (for line below). We should filter those out.

Do you know how runway-by-itself approaches are handled in fms-v2? They should be last after NDB.

@Benjozork Benjozork force-pushed the fms-v2 branch 2 times, most recently from 7427be0 to 784a7c8 Compare October 8, 2023 02:36
@alexr4339
Copy link

alexr4339 commented Nov 3, 2023

QA Tester
Discord name: Alex R
Last tested build: bcc1ffd
Date of last test: 22.02.2024

We have 4 categories of issues:

  1. Logical issues that need fixing
  2. Procedural issues - Issues that have not yet been verified as a result of logical issues and may be bound to one specific procedure and not a general issue
  3. Issues that can be fixed at a later time
  4. Secondary fplan (incomplete as of yet)

1. Logical issues:
That should be fixed before merging:

  • 1.1 Fix page/Prog page/pbd not taking 4 letter ICAO ID as references

  • 1.2 No airports are shown on ND with ARPT filter activated (note that dep/arr/altn are always shown regardless of filter setting (see 3.9)
    image

  • 1.3 Entered trans level in MCDU not considered

  • 1.4 Missing autotuning for VOR's, ILS does work sometimes but not always (applies to manual VOR tuning/insertion in fplan as well, not every station can be used

  • 1.5 Greying out secondary flight plan options for initial release (marked as fixed as SEC is planned)

  • 1.6 Alternate VNAV: Going around and then activating the alternate flight plan will cancel out VNAV. That means that for the (now acitve) alternative flight plan VNAV is not available. Changing the cruise altitude on INIT A has no effect. I only got VNAV to calculate a profil after having activated approach phase. Expected behaviour: After going around and activating alternate, VNAV should calculate a descent profil as usual. I dont know whether it will take the cruise altitude from INIT A as reference or the FCU selected level. Please contact me on Discord if further information/testing is required

  • 1.7 After go around TRK/FPA does not work anymore (Procedure to replicate: Load on runway of edds25, initiate weights, fplan EDDF/EDDS, load rwy 25c as departure of eddf, depart in edds, load any approach (I loaded ILS25 GEBNO1W), do direct to a fix near FAF, commit to approach, go around, (I think I now waited until I reduced thrust back to SPEED) and went into heading selected mode, now pressed hdg/trk button on fcu, now TRK/FPA shouldnt be working anymore

  • 1.8 Inserting a waypoint on first flight plan position (the same way you do a direct on Boeing aircraft) will result in the fplan messing up sequencing, especially when going around, the missed approach procedure for example wont be activated

  • 1.9 Coroute - Inserting by coroute name doesnt work and insert by to/from will not import the routing to the fplan. Respective .xml was sent im discord chat related to this PR at 16:43Z November 12th 2023

  • 1.10 PBD not working: PBD fix is not referenced at the position, for example entered EDDS/270/10 but PBD01 ended up somewhere around EDDM (inserted fplan was EDDM-LOWS)

  • 1.11 Can't dct to a waypoint that's not on your flight plan - Original route: YBBN/01R N0437F380 SANEG1 SANEG H91 IGDAM/N0434F390 H12 BOREE BORE3A YSSY/34L
    Somewhere a bit after SANEG, HDG MODE.
    After trying to direct YAKKA, while on HDG MODE, it did nothing.
    Then directed to BOREE, that worked.
    When on track to BOREE, tried directing to YAKKA again, still didn't work.
    Added YAKKA to the flight plan in the MCDU flight plan page, plane now flew correctly towards YAKKA.
    When on track to YAKKA, tried to direct to TOOKI and direct to VONNI, neither worked

  • 1.12 PBX not working, when entering PBX in fplan it simply disappears and doesnt create the PBX waypoint

  • 1.13 Entering waypoint in fplan kills FIX INFO entries

  • 1.14 VERT REF page crashing on waypoints with window constraint

  • 1.15 Fuel pred doesnt work (who needs that anyway, just send it)
    image

  • 1.16 ALTERNATE Changing dest (new dest) wont reset the "departure" airport of the altn fplan to the new dest

  • 1.17 Connection-Notification page crashes when selecting

  • 1.18 Runway only as approach currently not implemented

  • 1.19 ILS autotune by ID not working / Tuning freq manually will work but the correct ID will not appear on rad nav page (partially fiex - ISTE causes borked page / ISTW works normally)

  • 1.20 No DISCO for MANUAL legs (Proc to replicate: KIAH 15L BLTWY7

  • 1.21 Importing via Simbrief, then changing FROM/TO will give NaN under trans alt on perf page (TO and APPR perf page) - Same will happen if no flight is imported but TO/FROM manually entered - mostly fixed ==> Importing, then changing to/from will empty trans for to perf but appr perf remains trans value from import

  • 1.22 Giving DTO to a waypoint that appears two times will sequence to first appearance of wpt. Example: Fplan LBU DKB DISCO LBU DSXXX - DTO to second LBU Result TP LBU DKB DISCO LBU DSXXX, however it should sequence TP LBU DSXXX

  • 1.23 Suspected stringing issue. Had EDDS ABTAL4B and EDDM ILS08R, coinnected appr wpt (BEGEN) to ABTAL by clearing disco (ABTAL BEGEN). Now inserted ILS26L via ROK26 instead and fplan sequenced (ABTAL DISCO BEGEN DISCO ROKIL - already cleared discos in picture) - Can be manually fixed however
    image

  • 1.24 Port over VD leg

  • (1.25 FMS wont sequence along from off route waypoint - Went direct UNSER as offroute and had EDDS ILS25 no via no star after. Even though in fplan I had UNSER EDDS25 it did not sequence towards EDDS25 after passing UNSER - fixed as it wasnt reproduced)

  • 1.26 ALTN fplan not moving ND in plan mode accordingly

  • 1.27 Passing Waypoint which is followedby DISCO will set TO to PPOS, while it should actually be the wpt after the DISCO

  • 1.28 Issues with stringing of new approach after Go Around. FPLAN EDDM/EDDM DEP: GIVMI6S 26L - ARR: ILS26L via ROK26
    departed, DTO DM429, DTO NELBI, flew approach. Initiated go around before runway threshold, NAV engaged, all correct: FPLAN however was:
    MISSED APPR POC DISCO ROK26 DISCO NELBI DISCO D261B (first wpt of missed approach proc)
    After passing rwy threshold it now had:
    MISSED APPR PROC DISCO ROK26 (which ends with DM429 MAUNAL) NELBI (no DISCO between NELBI and MANUAL) NELBI FI26L EDDM26L
    image

  • 1.29 You know whats meant
    image

  • 1.30 Automatic airway insertion (inserting airway names without end fixes)

  • 1.31 Follow preocedure of 1.35, then delete the alt waypoint. Will result in only TO wpt in fplan, but deletion of From (alt waypoint) shouldnt be allowed

  • 1.32 EGCC-EHAM, did NEW DEST to EGGP on one of the SID points, inserted ILS09 with the POL1T arrival- resulted in blank HOLD page

  • 1.33 EDDL VOR23R via BAM - FMS sequences missed approach procedure twice, should be MD2/03 BOT DISCO BAM ....
    image

  • 1.34 MSFS fplan sync

  • 1.35 Having runway only departure, setting new dest from altitude wpt LAT REV and then let the aircraft pass the alt waypoint will result in DISCO DEST without FROM
    image

  • 1.36 Departed EDDL 23R COL SID for EDDL23R VOR approach via BAM. When editing the approach segement of the fplan no temp fplan was shown on ND
    image

  • 1.37 Same procedure as 1.36 - FMS didnt sequence BAM and BAM/06 took position of BAM. Only after inserting BAM manually all waypoints were at the right location
    image
    image

  • 1.38 Implement ARPT button logic

  • 1.39 Weird FMS state when: You have only ORIGIN DISCO DEST, then insert a waypoint ORIGIN WPT DISCO DEST, then delete the WPT

  • 1.40 FMS inserts waypoint at way too offroute position (Dist 9999 NM) - May break sequencing as well
    Route: EDDF 25C OBOKA3W OBOKA Z29 TORNU DCT ABNED L980 LOGAN LOGAN2H ILS 27L VIA LAM EGLL
    Additional info: BNN131 is the radial BNN 131 at 3500ft to then turn towards the ILS
    image

NOTE:
The alternate marked items can be disregarded if we decide to leave alternate out for an inital release. However my impression is that alternate does already work at a pretty solid level and it can be seriously considered to include altn for an initial release.


2. Procedural issues:
I am using current Navigraph Navdata

  • 2.1 The VOR STG (116,85 at around N48/49 W8/9) can't be inserted in fplan/fix info/prog as it cant be found, the plane only finds different STG stations. Reference video: https://drive.google.com/file/d/1aqvSsnYZ-qU1uhYu5RDGc0fC6cYd7Rid/view?usp=sharing
  • 2.2 GCXO - LPC6J - had one unknown leg (unkw vd) - working correctly on master
  • 2.3 ROKIL1B of EDDM not covered by the A32NX. This procedure is available in the stock G3000 for example, so likely not a navdata issue
  • 2.4 STARS for 26L EDDM beginning with NAPS NIRG RAST VATE and VESU are missing, although on eof the "N" beginning STARs is actually present - Misinterpretation by myself - verify all STARS present

3. Issues that can be fixed after release

  • 3.1 CA legs not taking VNAV prediction (results in CA legs that are way too long)

  • 3.2 T/D reached on message can't be cleared by deletiong that message on scratchpad

  • 3.3 EFB chocks/cones of ground service page missing (happened with 0.11.1 as well)

  • 3.4 Alternate: Activating alternate with an alternate route including a STAR (for example SPESA STAR EDDF) and sequencing past the first waypoint of this STAR (in that case SPESA) by a direct (in that case towards DF622) will result in the waypoint SPESA still being shown on the ND although its not in the flightplan catalogue anymore
    image

  • 3.5 Rather slow AP pitch up response during GA with AP engaged in comparison to reference videos on YT

  • 3.6 Two discos (Disco WPT Disco ==> Delete WPT betweem discos ==> Disco Disco) wont merge into one Disco

  • 3.7 Alternate: Once having scrolled to altn section, the route and waypoint appears on ND. After scrolling back to normal fplan the altn waypoints disappear but the dashed line remains on ND
    image

  • 3.8 Misaligned ND symols after DIR
    image

  • 3.9 dep/arr/altn airport shown in magenta with magenta star on ND regardless of EFIS filter setting (see 3.8) - as of e0c2076 it is now partially fixed. It is now in white but the labels and star are still present, just in white

  • 3.10 Remove Return button from fix info page

  • 3.11 Waypoints remain on ND after landing
    image

  • 3.12 Doing fplan changes (for example clearing a DISCO) after having done a DIR resets the turn predicition and the DIR is drawn as a straight line from T-P to waypoint without turn prediction

  • 3.13 Slope missing for tuned ILS

  • 3.14 Tuning predcitions. EDDS25 ABTAL4B, plane followed drawn line although it should turn left straight after DS046
    image

  • 3.15 -5.0° approach causes VNAV to sweat and not take the correctvert constraints for the fixes

  • 3.16 ND not targeting alt/pseudowaypoints in plan mode

  • 3.17 some procedures (for example EDDS ABTAL4B) have completely messed up drawings of the departure route, affects guidance as well (plane turns right instead of left) Reference video: https://drive.google.com/file/d/1i-xALezBAHREAJ8nWs2Z6PWBnvPzZ4B9/view?usp=sharing - likely logical issues as I have seen that on som DIR with tight angles between enbound and outbound leg as well

  • 3.18 FMS sequences missed approach when loading ILS - Steps to repro
    FPLAN EDDS/EDDH, OKI4B departure rwy 25
    Takeoff, go direct UNSER (Offroute)
    Insert new destination EDDS
    Insert ILS25, no via no star in vicinity of airfield
    FMS will now already sequence missed approach
    image

  • 3.19 Drawing issue for approaches, doesnt affect guidance
    image

  • 3.20 When pressing imm exit after having entered the hold the aircraft still completes the entry and doesnt leave the hold as direct as possible
    image


Secondary fplan (referred to as SEC)

  • 4.1 SEC always shown shown on ND regardles of wether SEC MCDU page is open or not
    image
  • 4.2 If there is no SEC (previously deleted or never initiated/copied) the the SEC fplan page will get borked when pressing on the fplan catalogue
  • 4.3 No init for SEC
  • 4.4 SEC doesnt sequence along with primary fplan
  • 4.5 T/D and T/C in green in fplan, they are white with Thales software, verify correct color for Honeywell
  • 4.6 No perf for SEC
  • 4.7 No activation/switching of SEC

async () => this.navigationDatabase.searchVor(ident).then((vors) => vors.filter((vor) => vor.type & 1 << 7 /* ILS */)),
ident,
(selectedVor) => {
const airportIdent = selectedVor.databaseId.slice(3, 7).trim()
Copy link
Member

@tracernz tracernz Dec 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not use databaseId like this. The format of it varies depending on the database backend! It can only be used to test uniqueness of records.

@@ -245,6 +245,7 @@ function geometryLegFromFlightPlanLeg(runningMagvar: Degrees, previousFlightPlan
return new CALeg(trueCourse, altitude, metadata, SegmentType.Departure);
}
case LegType.CD:
case LegType.VD: // TODO FA, VA legs in geometry
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
case LegType.VD: // TODO FA, VA legs in geometry
case LegType.VD:

@BlueberryKing BlueberryKing merged commit 20c8d71 into master Jun 14, 2024
8 checks passed
@tracernz tracernz deleted the fms-v2 branch August 30, 2024 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment