From 33c4a62f9e8074ad140848c399072f46dd880c69 Mon Sep 17 00:00:00 2001 From: floridude <63071941+flogross89@users.noreply.github.com> Date: Tue, 10 Dec 2024 03:26:13 +0200 Subject: [PATCH] fix(a380x/fms): Fix VLS computation for CONF 1 (#9643) * fix(a380x/fms): Fix VLS computation for CONF 1 * changelog * fix S/F speeds --- .github/CHANGELOG.md | 1 + .../src/MFD/FMC/FmcAircraftInterface.ts | 14 +++++--------- .../src/systems/instruments/src/MFD/FMC/fmgc.ts | 4 ++-- .../src/systems/shared/src/OperatingSpeeds.tsx | 10 ++++++---- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index c3e36e82dfd..affacd06b5f 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -86,6 +86,7 @@ 1. [A380X/FWS] Fix "NO ZFW OR ZFWCG DATA" ECAM alert after landing - @flogross89 (floridude) 1. [A380X/SD] Add brake temperature color change to amber when brakes are hot - @heclak (Heclak) 1. [A380X/FCU] Fix display of values on FCU during light test - @heclak (Heclak) +1. [A380X/FMS] Fix VLS computation error for CONF 1, might have lead to FMS crashes during climb out - @flogross89 (floridude) ## 0.12.0 diff --git a/fbw-a380x/src/systems/instruments/src/MFD/FMC/FmcAircraftInterface.ts b/fbw-a380x/src/systems/instruments/src/MFD/FMC/FmcAircraftInterface.ts index 77bbe6f40b8..e2d1092e4d3 100644 --- a/fbw-a380x/src/systems/instruments/src/MFD/FMC/FmcAircraftInterface.ts +++ b/fbw-a380x/src/systems/instruments/src/MFD/FMC/FmcAircraftInterface.ts @@ -1116,7 +1116,7 @@ export class FmcAircraftInterface { const altActive = false; const landingWeight = this.fmgc.data.zeroFuelWeight.get() ?? - NaN + (altActive ? this.fmgc.getAltEFOB(true) : this.fmgc.getDestEFOB(true)); + NaN + (altActive ? this.fmgc.getAltEFOB(true) : this.fmgc.getDestEFOB(true)) * 1_000; return Number.isFinite(landingWeight) ? landingWeight : NaN; } @@ -1128,7 +1128,7 @@ export class FmcAircraftInterface { /** in kg */ const estLdgWeight = this.tryEstimateLandingWeight(); let ldgWeight = estLdgWeight; - const grossWeight = this.fmc.fmgc.getGrossWeightKg() ?? maxZfw + this.fmc.fmgc.getFOB(); + const grossWeight = this.fmc.fmgc.getGrossWeightKg() ?? maxZfw + this.fmc.fmgc.getFOB() * 1_000; const vnavPrediction = this.fmc.guidanceController?.vnavDriver?.getDestinationPrediction(); // Actual weight is used during approach phase (FCOM bulletin 46/2), and we also assume during go-around if (this.flightPhase.get() >= FmgcFlightPhase.Approach || !Number.isFinite(estLdgWeight)) { @@ -1178,14 +1178,10 @@ export class FmcAircraftInterface { // Only update speeds if ADR data valid const flapLever = SimVar.GetSimVarValue('L:A32NX_FLAPS_HANDLE_INDEX', 'Enum'); - let flaps = flapLever; - if (flapLever === 1 && SimVar.GetSimVarValue('L:A32NX_FLAPS_CONF_INDEX', 'Enum') === 1) { - flaps = 5; // CONF 1 - } const speeds = new A380OperatingSpeeds( grossWeight, cas, - flaps, + flapLever, this.flightPhase.get(), this.fmgc.getV2Speed(), alt, @@ -1199,10 +1195,10 @@ export class FmcAircraftInterface { const f = Math.max(speeds.f2, Vmcl + 5); this.fmgc.data.flapRetractionSpeed.set(Math.ceil(f)); } else { - if (flaps === 2) { + if (flapLever === 2) { const f = Math.max(speeds.f2, Vmcl + 15); this.fmgc.data.flapRetractionSpeed.set(Math.ceil(f)); - } else if (flaps === 3) { + } else if (flapLever === 3) { const f = Math.max(speeds.f3, Vmcl + 10); this.fmgc.data.flapRetractionSpeed.set(Math.ceil(f)); } diff --git a/fbw-a380x/src/systems/instruments/src/MFD/FMC/fmgc.ts b/fbw-a380x/src/systems/instruments/src/MFD/FMC/fmgc.ts index 713250cdafe..9b7b741d070 100644 --- a/fbw-a380x/src/systems/instruments/src/MFD/FMC/fmgc.ts +++ b/fbw-a380x/src/systems/instruments/src/MFD/FMC/fmgc.ts @@ -564,7 +564,7 @@ export class FmgcDataService implements Fmgc { return this.data.approachTemperature.get() ?? 0; } - /** in kilograms */ + /** in tons */ getDestEFOB(useFob: boolean): number { // Metric tons const efob = this.guidanceController?.vnavDriver?.getDestinationPrediction()?.estimatedFuelOnBoard; // in Pounds @@ -574,7 +574,7 @@ export class FmgcDataService implements Fmgc { return 0; } - /** in kilograms */ + /** in tons */ getAltEFOB(useFOB = false): number { // TODO estimate alternate fuel if (this.getDestEFOB(useFOB) === 0) { diff --git a/fbw-a380x/src/systems/shared/src/OperatingSpeeds.tsx b/fbw-a380x/src/systems/shared/src/OperatingSpeeds.tsx index d5d9974aaf6..f5fcd90d7c3 100644 --- a/fbw-a380x/src/systems/shared/src/OperatingSpeeds.tsx +++ b/fbw-a380x/src/systems/shared/src/OperatingSpeeds.tsx @@ -119,6 +119,9 @@ export class SpeedsLookupTables { if (conf === 0) { return SpeedsLookupTables.VLS_CONF_0.get(0, weight); } else { + if (conf > 5) { + throw new Error('Invalid flap config for approach VLS computation'); + } return SpeedsLookupTables.VLS_APPR_CONF[conf].get(cg, weight); } } @@ -512,13 +515,12 @@ export class A380OperatingSpeeds { this.f2 = fmgcFlightPhase <= FmgcFlightPhase.Takeoff ? Math.max(1.18 * vs1gConf1F, Vmcl + 5) - : SpeedsLookupTables.F2_SPEED.get(altitude, m); + : SpeedsLookupTables.F2_SPEED.get(cg, m); this.f3 = fmgcFlightPhase <= FmgcFlightPhase.Takeoff ? Math.max(1.18 * vs1gConf1F, Vmcl + 5) - : SpeedsLookupTables.F3_SPEED.get(altitude, m); - this.s = - fmgcFlightPhase <= FmgcFlightPhase.Takeoff ? 1.21 * vs1gConf0 : SpeedsLookupTables.S_SPEED.get(altitude, m); + : SpeedsLookupTables.F3_SPEED.get(cg, m); + this.s = fmgcFlightPhase <= FmgcFlightPhase.Takeoff ? 1.21 * vs1gConf0 : SpeedsLookupTables.S_SPEED.get(m); } }