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(apu): Added xfeed APU capabilities #8216

Merged
merged 7 commits into from
Oct 20, 2023
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 @@ -56,6 +56,7 @@
1. [COND] Fixed Temp-Indication on CRZ page showing cockpit temperature for fwd and aft cabin - @cptnuss-ops (Lukas)
1. [FMS] Show ILS ident and frequency on ARRIVAL page - @tracernz (Mike)
1. [EFB/ATSU] Use MSFS METAR data rather than FSX cloud data from FBW API - @tracernz (Mike)
1. [APU] Added xfeed APU fuel capabilities - @Taz5150 (TazX [Z+1]#0405)

## 0.10.0

Expand Down
35 changes: 25 additions & 10 deletions fbw-a32nx/src/wasm/fadec_a320/src/EngineControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -816,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) {
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;
}

//--------------------------------------------
Expand Down Expand Up @@ -864,6 +869,11 @@ class EngineControl {
fuelRightPre = 0;
}

/// apu fuel consumption for this frame in pounds
double apuFuelConsumption = simVars->getLineFlow(18) * fuelWeightGallon * deltaTime;
apuBurn1 = apuFuelConsumption;
apuBurn2 = 0;

//--------------------------------------------
// Fuel used accumulators
fuelUsedLeft += fuelBurn1;
Expand All @@ -877,6 +887,8 @@ class EngineControl {
case 1:
fuelBurn2 = fuelBurn1 + fuelBurn2;
fuelBurn1 = 0;
apuBurn1 = 0;
apuBurn2 = apuFuelConsumption;
break;
case 2:
fuelBurn1 = fuelBurn1 + fuelBurn2;
Expand All @@ -885,6 +897,12 @@ class EngineControl {
case 3:
fuelBurn1 = 0;
fuelBurn2 = 0;
apuBurn1 = apuFuelConsumption * 0.5;
apuBurn2 = apuFuelConsumption * 0.5;
break;
case 4:
apuBurn1 = apuFuelConsumption*0.5;
apuBurn2 = apuFuelConsumption*0.5;
break;
default:
break;
Expand All @@ -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
Expand Down
Loading