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

fix(fmgc): string stars with non-runway-specific approaches #7332

Merged
merged 4 commits into from
Jul 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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