Skip to content

Commit

Permalink
fix(fmgc): string stars with non-runway-specific approaches #7332 (@c…
Browse files Browse the repository at this point in the history
…8d5a171)
  • Loading branch information
2hwk committed Jul 16, 2022
1 parent e5b6abe commit 2f1ae3f
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 @@ -39,6 +39,7 @@
1. [ISIS] Added temporary ISIS font with arrows - @aweissoertel (Alexibexi#7550)
1. [EFB] Added pause at T/D function - @2hwk (2Cas#1022)
1. [FLIGHTMODEL] Improve flight handling characteristics, ground effect, and landing gear simulation - @donstim (donbikes#4084)
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 2f1ae3f

Please sign in to comment.