Skip to content

Commit

Permalink
fix(fmgc): string stars with non-runway-specific approaches (#7332)
Browse files Browse the repository at this point in the history
IRL behaviour is unclear on this... tried to get refs but the particular approaches in question aren't in the IRL database
  • Loading branch information
tracernz authored Jul 22, 2022
1 parent 44d2ace commit c949aad
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 16 deletions.
1 change: 1 addition & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
1. [PFD] Improve PFD barberpole rendering and behaviour - @lukecologne (luke)
1. [FMGC] Only emit decel point when an approach is selected - @tracernz (Mike)
1. [MCDU] Fix padding of arc radii on F-PLN - @tracernz (Mike)
1. [FMGC] Allow stringing of STARs with non-runway approaches - @tracernz (Mike)

## 0.8.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,22 +116,27 @@ class CDUAvailableArrivalsPage {
} else {
if (selectedApproach) {
const selectedRunway = selectedApproach.runway;
for (let i = 0; i < airportInfo.arrivals.length; i++) {
const arrival = airportInfo.arrivals[i];
if (arrival.runwayTransitions.length) {
for (let j = 0; j < arrival.runwayTransitions.length; j++) {
const runwayTransition = arrival.runwayTransitions[j];
if (runwayTransition) {
if (selectedRunway.length > 0) {
for (let i = 0; i < airportInfo.arrivals.length; i++) {
const arrival = airportInfo.arrivals[i];
if (arrival.runwayTransitions.length) {
for (let j = 0; j < arrival.runwayTransitions.length; j++) {
const runwayTransition = arrival.runwayTransitions[j];
if (runwayTransition) {
// Check if selectedRunway matches a transition on the approach (and also checks for Center runways)
if (runwayTransition.name.match("^RW" + selectedRunway + "C?$")) {
matchingArrivals.push({ arrival: arrival, arrivalIndex: i });
if (runwayTransition.name.match("^RW" + selectedRunway + "C?$")) {
matchingArrivals.push({ arrival: arrival, arrivalIndex: i });
}
}
}
} else {
//add the arrival even if it isn't runway specific
matchingArrivals.push({ arrival: arrival, arrivalIndex: i });
}
} else {
//add the arrival even if it isn't runway specific
matchingArrivals.push({ arrival: arrival, arrivalIndex: i });
}
} else {
// the approach is not runway specific so don't attempt to filter arrivals
matchingArrivals.push(...airportInfo.arrivals.map((arrival, arrivalIndex) => ({ arrival, arrivalIndex })));
}
} else {
for (let i = 0; i < airportInfo.arrivals.length; i++) {
Expand Down
14 changes: 9 additions & 5 deletions src/fmgc/src/flightplanning/ManagedFlightPlan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1029,20 +1029,24 @@ export class ManagedFlightPlan {
}

if (arrivalIndex !== -1) {
// string the common legs in the middle of the STAR
const arrival: RawArrival = destinationInfo.arrivals[arrivalIndex];
legs.push(...arrival.commonLegs);
legAnnotations.push(...arrival.commonLegs.map(_ => arrival.name));
// console.log('MFP: buildArrival - pushing STAR legs ->', legs);
}

if (arrivalIndex !== -1 && arrivalRunwayIndex !== -1) {
const arrival: RawArrival = destinationInfo.arrivals[arrivalIndex];
const runwayTransition: RawRunwayTransition = destinationInfo.arrivals[arrivalIndex].runwayTransitions[arrivalRunwayIndex];
// if no runway is selected at all (non-runway-specific approach)
// and the selected STAR only has runway transition legs... string them
// TODO research IRL behaviour
const starHasOneRunwayTrans = arrival.commonLegs.length === 0 && arrival.runwayTransitions.length === 1;
const approachIsRunwaySpecific = this.procedureDetails.destinationRunwayIndex >= 0;
const runwayTransIndex = arrivalRunwayIndex < 0 && starHasOneRunwayTrans && !approachIsRunwaySpecific ? 0 : arrivalRunwayIndex;

const runwayTransition = arrival.runwayTransitions[runwayTransIndex];
if (runwayTransition) {
legs.push(...runwayTransition.legs);
legAnnotations.push(...runwayTransition.legs.map(_ => arrival.name));
}
// console.log('MFP: buildArrival - pushing VIA legs ->', legs);
}

let { _startIndex, segment } = this.truncateSegment(SegmentType.Arrival);
Expand Down

0 comments on commit c949aad

Please sign in to comment.