From 804f27e855168da3868a0139314c01c81811e22f Mon Sep 17 00:00:00 2001 From: Taz5150 <70781153+Taz5150@users.noreply.github.com> Date: Fri, 15 Sep 2023 09:25:30 +0200 Subject: [PATCH 1/3] fix(apu): Added xfeed APU capabilities --- .github/CHANGELOG.md | 1 + .../src/wasm/fadec_a320/src/EngineControl.h | 27 ++++++++++++++----- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index b2ba570670c..37481ebcf1e 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -49,6 +49,7 @@ 1. [EFB] flyPad OS 3.2 - Cosmetic changes for throttle configuration settings and support for multiple airframes - @2hwk (2cas) 1. [SD] Connect SD BLEED page APU bleed pressure indication to correct ADRs - @BlueberryKing (BlueberryKing) 1. [FMS] Use station declination when appropriate for fix info and place/bearing radials - @tracernz (Mike) +1. [APU] Added xfeed APU fuel capabilities - @Taz5150 (TazX [Z+1]#0405) ## 0.10.0 diff --git a/fbw-a32nx/src/wasm/fadec_a320/src/EngineControl.h b/fbw-a32nx/src/wasm/fadec_a320/src/EngineControl.h index 4ffb2fb4d91..96d9b7b28b3 100644 --- a/fbw-a32nx/src/wasm/fadec_a320/src/EngineControl.h +++ b/fbw-a32nx/src/wasm/fadec_a320/src/EngineControl.h @@ -666,6 +666,8 @@ class EngineControl { double b = 0; double fuelBurn1 = 0; double fuelBurn2 = 0; + double apuBurn1 = 0; + double apuBurn2 = 0; double refuelRate = simVars->getRefuelRate(); double refuelStartedByUser = simVars->getRefuelStartedByUser(); @@ -864,6 +866,16 @@ class EngineControl { fuelRightPre = 0; } + /// apu fuel consumption for this frame in pounds + double apuFuelConsumption = simVars->getLineFlow(18) * fuelWeightGallon * deltaTime; + if (xFeedValve == 0.0) { + apuBurn1 = apuFuelConsumption; + apuBurn2 = 0; + } else { + apuBurn1 = apuFuelConsumption * 0.5; + apuBurn2 = apuBurn1; + } + //-------------------------------------------- // Fuel used accumulators fuelUsedLeft += fuelBurn1; @@ -877,14 +889,20 @@ class EngineControl { case 1: fuelBurn2 = fuelBurn1 + fuelBurn2; fuelBurn1 = 0; + apuBurn1 = 0; + apuBurn2 = apuFuelConsumption; break; case 2: fuelBurn1 = fuelBurn1 + fuelBurn2; fuelBurn2 = 0; + apuBurn1 = apuFuelConsumption; + apuBurn2 = 0; break; case 3: fuelBurn1 = 0; fuelBurn2 = 0; + apuBurn1 = 0; + apuBurn2 = 0; break; default: break; @@ -905,13 +923,10 @@ class EngineControl { else if (xfrValveCenterRightOpen) xfrCenterToRight = fuelCenterPre - centerQuantity; - /// apu fuel consumption for this frame in pounds - double apuFuelConsumption = simVars->getLineFlow(18) * fuelWeightGallon * deltaTime; - //-------------------------------------------- // Final Fuel levels for left and right inner tanks - fuelLeft = (fuelLeftPre - (fuelBurn1 * KGS_TO_LBS)) + xfrAuxLeft + xfrCenterToLeft - apuFuelConsumption; // LBS - fuelRight = (fuelRightPre - (fuelBurn2 * KGS_TO_LBS)) + xfrAuxRight + xfrCenterToRight; // LBS + fuelLeft = (fuelLeftPre - (fuelBurn1 * KGS_TO_LBS)) + xfrAuxLeft + xfrCenterToLeft - apuBurn1; // LBS + fuelRight = (fuelRightPre - (fuelBurn2 * KGS_TO_LBS)) + xfrAuxRight + xfrCenterToRight - apuBurn2; // LBS //-------------------------------------------- // Setting new pre-cycle conditions @@ -1292,4 +1307,4 @@ class EngineControl { } }; -EngineControl EngineControlInstance; +EngineControl EngineControlInstance; \ No newline at end of file From 62cb4f1d7e534ce6a7e3f16ac3af595ed3bded18 Mon Sep 17 00:00:00 2001 From: Taz5150 <70781153+Taz5150@users.noreply.github.com> Date: Tue, 19 Sep 2023 16:26:37 +0200 Subject: [PATCH 2/3] fix: Updated APU fuel burn for cross-feed --- .../src/wasm/fadec_a320/src/EngineControl.h | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/fbw-a32nx/src/wasm/fadec_a320/src/EngineControl.h b/fbw-a32nx/src/wasm/fadec_a320/src/EngineControl.h index 96d9b7b28b3..2ada802dea9 100644 --- a/fbw-a32nx/src/wasm/fadec_a320/src/EngineControl.h +++ b/fbw-a32nx/src/wasm/fadec_a320/src/EngineControl.h @@ -818,17 +818,20 @@ class EngineControl { } //----------------------------------------------------------- // Cross-feed Logic - // isTankClosed = 0, both tanks can supply fuel + // isTankClosed = 0, x-feed valve closed // isTankClosed = 1, left tank does not supply fuel // isTankClosed = 2, right tank does not supply fuel // isTankClosed = 3, left & right tanks do not supply fuel + // isTankClosed = 4, both tanks supply fuel if (xFeedValve > 0.0) { + isTankClosed = 4; if (leftPump1 == 0 && leftPump2 == 0) isTankClosed = 1; if (rightPump1 == 0 && rightPump2 == 0) isTankClosed = 2; if (leftPump1 == 0 && leftPump2 == 0 && rightPump1 == 0 && rightPump2 == 0) isTankClosed = 3; + } //-------------------------------------------- @@ -868,13 +871,8 @@ class EngineControl { /// apu fuel consumption for this frame in pounds double apuFuelConsumption = simVars->getLineFlow(18) * fuelWeightGallon * deltaTime; - if (xFeedValve == 0.0) { - apuBurn1 = apuFuelConsumption; - apuBurn2 = 0; - } else { - apuBurn1 = apuFuelConsumption * 0.5; - apuBurn2 = apuBurn1; - } + apuBurn1 = apuFuelConsumption; + apuBurn2 = 0; //-------------------------------------------- // Fuel used accumulators @@ -895,14 +893,14 @@ class EngineControl { case 2: fuelBurn1 = fuelBurn1 + fuelBurn2; fuelBurn2 = 0; - apuBurn1 = apuFuelConsumption; - apuBurn2 = 0; break; case 3: fuelBurn1 = 0; fuelBurn2 = 0; - apuBurn1 = 0; - apuBurn2 = 0; + break; + case 4: + apuBurn1 = apuFuelConsumption*0.5; + apuBurn2 = apuFuelConsumption*0.5; break; default: break; From b6d1aa5441e369cbd83ca5430731108b31421f37 Mon Sep 17 00:00:00 2001 From: Taz5150 <70781153+Taz5150@users.noreply.github.com> Date: Thu, 21 Sep 2023 18:35:41 +0200 Subject: [PATCH 3/3] Update EngineControl.h --- .../src/wasm/fadec_a320/src/EngineControl.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/fbw-a32nx/src/wasm/fadec_a320/src/EngineControl.h b/fbw-a32nx/src/wasm/fadec_a320/src/EngineControl.h index 2ada802dea9..e38be330ff8 100644 --- a/fbw-a32nx/src/wasm/fadec_a320/src/EngineControl.h +++ b/fbw-a32nx/src/wasm/fadec_a320/src/EngineControl.h @@ -824,14 +824,14 @@ class EngineControl { // isTankClosed = 3, left & right tanks do not supply fuel // isTankClosed = 4, both tanks supply fuel if (xFeedValve > 0.0) { - isTankClosed = 4; - if (leftPump1 == 0 && leftPump2 == 0) - isTankClosed = 1; - if (rightPump1 == 0 && rightPump2 == 0) - isTankClosed = 2; if (leftPump1 == 0 && leftPump2 == 0 && rightPump1 == 0 && rightPump2 == 0) isTankClosed = 3; - + else if (leftPump1 == 0 && leftPump2 == 0) + isTankClosed = 1; + else if (rightPump1 == 0 && rightPump2 == 0) + isTankClosed = 2; + else + isTankClosed = 4; } //-------------------------------------------- @@ -897,6 +897,8 @@ class EngineControl { case 3: fuelBurn1 = 0; fuelBurn2 = 0; + apuBurn1 = apuFuelConsumption * 0.5; + apuBurn2 = apuFuelConsumption * 0.5; break; case 4: apuBurn1 = apuFuelConsumption*0.5; @@ -1305,4 +1307,4 @@ class EngineControl { } }; -EngineControl EngineControlInstance; \ No newline at end of file +EngineControl EngineControlInstance;