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(a380x): Various fuel system fixes #9045

Merged
merged 82 commits into from
Oct 19, 2024

Conversation

donstim
Copy link
Contributor

@donstim donstim commented Oct 8, 2024

Fixes various fuel system issues. See summary of changes.

Summary of Changes

Fixes the following issues with the fuel system:

  1. Fixed issue with transfers into feed tanks 2 and 3 being lower than fuel flow during cruise and very unbalanced with transfers into feed tanks 1 and 2
  2. Fixed issues with trim and outer tanks not transferring fuel
  3. Added missing 2nd trim tank inlet tank valve

Screenshots (if necessary)

Visualisation of the MSFS Fuelsystem according to the flightmodel.cfg
Fuelsystem A380(7)

References

Additional context

ECAM fuel system page may need changing due to the addition of the 2nd trim tank inlet valve . If any overhead fuel system buttons are operational, these may also need to be checked.

Be aware that not all automatic transfers are modeled. Specifically, the load alleviation transfers are not included because MSFS does not have the necessary triggering conditions to accurately model these.

Valves, lines, and junctions are included to model fuel transfers beyond what is used by the automatic transfers that are modeled. These will need to be checked once the overhead push buttons for all the pumps, valves, etc. are all fully modeled.

Fuel transfer rates have not yet been tuned. This first implementation is just to ensure that the fuel transfer occur according to the logic detailed in the testing instructions and at sufficient rates such that the feed tanks will not empty before the transfer tanks.

Discord username (if different from GitHub): donbikes

Testing instructions

**Most immediate testing need is for a short test as follows:

  1. First change the values of the FBWA380X.ini file in the work file to:
    Screenshot 2024-10-18 101853

The work folder can be found using these instructions: https://docs.flybywiresim.com/fbw-a32nx/feature-guides/flypados3/throttle-calibration/?h=work+folder#work-folder

  1. Load in cold/dark. Start airplane, load 63,000 kg of fuel using the EFB. Take off, then using either the MSFS Weight and Balance UI or the ECAM Fuel page
    Screenshot 2024-10-18 101401
    , note if fuel is being transferred out of the inner tanks (fuel quantity decreasing). Report back (either here or on Discord)**

For testing of all transfers, here is the transfer logic:

The feed tanks feed the engines. A certain amount of fuel is kept in the feed tanks with that amount varying depending on the amount of fuel in the transfer tanks (inners, mids, outers, and trim). The trim tank is also used for cg control transfers.

Starting with fuel in each tank (including more than 4000 kg in the left mid tank), the normal transfer sequence should be: inners, then mids, then trim, then outers. In addition, trim tank fuel may be transferred at any time to keep the cg from going too far aft. (Normal loading is for an aft cg, so there is no transferring back to the trim tank to move the cg further aft.)

Until the left mid tank has less than 4000 kg of fuel, the inner and mid tank transfers should work like this:

  1. Transfers to feed 1 and feed 4 should begin when the one with the lowest fuel amount (in the A380X they will usually be the same since we haven't yet incorporated fuel burn differences between the engines) reaches 19560 kg, the inner tanks (and mids once the inners are empty) will start transferring fuel to it. When the fuel levels of feed 1 and 4 become equal (if they were unequal at the start of the transfer), fuel will begin transferring to the other feed (the one that was not the lowest of feed 1 and 4). Since the feed tanks will normally be equal, the transfers to both feed 1 and feed 4 should start pretty much simultaneously. The transfers to feed 1 and feed 4 will each end when each tank reaches 20560 kg. A balancing technique is used to try to keep the fuel level in the pairs of fuel tanks 1/4 and 2/3 balanced. If there is fuel left in the inner tanks, it will start to transfer again when the level in the feed tanks reach the 19650 kg activation threshold again. (Note: These thresholds change when the remaining time to the destination is less than 90 minutes, but a trigger for this is not available in the MSFS fuel system.)

2 The transfers to feed tanks 2 and 3 work the same way, except they begin when the lower one reaches 20840 kg and end when they each reach 21840 kg. Note that feed tanks 2 and 3 are higher capacity than 1 and 4, are normally fueled initially to a higher level, and retain a higher level until made symmetrical by the transfer process detailed below.

  1. When there is less than 8000 kg in the mid tanks (the MSFS trigger actually uses <4000 kg in the left mid), the begin and end transfer levels for feed tanks 2 and 3 are changed to be the same as those used for feed tanks 1 and 4. The following transfer process is then used to balance the amount of fuel in the tanks: When the tank with the least amount of fuel reaches the transfer activation threshold, fuel begins transferring in. (This will be both feed tanks 1 and 4 since they will be approximately equal, and they start at a lower level than 2 and 3.) As the level in feed tanks 1 and 4 increase, and 2 and 3 decrease, when they become equal, fuel will start transferring into 2 and 3. (Although this approximately equalizes the fuel level in all the feed tanks, it will differ by a bit since the transfers don't start immediately and the transfer rates into 1 and 4 are just a tiny bit different than 2 and 3.)

  2. When the mid tanks are empty, fuel will be transferred from the trim tank to the feed tanks when the fuel level in any feed tank is less than 6000 kg. The same balancing process is used as described above. Once started, the trim tank will transfer fuel until it is empty.

  3. When the trim tank is empty, fuel wil be transferred from the outer tanks to the feed tanks when the fuel level in any feed tank is less than 4000 kg. The transfer process uses a similar balancing technique, but only between the pairs or symmetric fuel tanks (1/4 and 2/3). The transfer stops when the fuel level in each pair of feed tanks is greater than 4500 kg and starts again when the fuel level in any feed tank is less than 4000 kg.

  4. CG fuel transfers: These may happen independently and simultaneously with the main transfers described above. The transfer begins when the CG is higher (more aft) than the schedule vs gross weight shown below and ends when the CG is 1% lower (more forward) than than target. (Note: the CG shown in the CRUISE page of the ECAM is rounded off, so the transfer will start a little while after the ECAM shows a CG equal to the target CG.) The fuel will be transferred to the inner tanks, or to the mid tanks if the inner tanks are empty, or to the feed tanks if both the inner and mid tanks are empty.
    Screenshot 2024-10-17 095923

For the testing, please observe whether the fuel transfers are following the description given above. You can use the MSFS fuel and payload UI to see the transfer activation/deactivation points without the round off used in the cockpit display. There should not be any fuel transfers taking place while the airplane is on the ground.

Additional notes:
It would be helpful to have flights done starting with different initial fuel loads: 18 T, 26 T, 36 T, 47 T, 103 T, and >158 T. The test can be terminated whenever one of the following occur: fuel transfer not occurring per above schedule

Note if there are any discrepancies and describe the circumstances as much as possible.

How to download the PR for QA

Every new commit to this PR will cause new A32NX and A380X artifacts to be created, built, and uploaded.

  1. Make sure you are signed in to GitHub
  2. Click on the Checks tab on the PR
  3. On the left side, find and click on the PR Build tab
  4. Click on either flybywire-aircraft-a320-neo or flybywire-aircraft-a380-842 download link at the bottom of the page

@donstim
Copy link
Contributor Author

donstim commented Oct 8, 2024

Looks like some changes were made post the master code I used for this PR. I will need to back these out.

@donstim donstim changed the title fix: Various fuel system fixes for the A380X fix: Various fuel system fixes Oct 8, 2024
Copy link
Contributor

@flogross89 flogross89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One inadvertent change still, you already saw the other ones :)

@flogross89 flogross89 changed the title fix: Various fuel system fixes fix(a380x): Various fuel system fixes Oct 8, 2024
Copy link
Contributor

@flogross89 flogross89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me syntax-wise. However I can't verify the fuel system changes, need @Maximilian-Reuter or someone else for that

flogross89 added a commit that referenced this pull request Oct 8, 2024
@becas22 becas22 linked an issue Oct 8, 2024 that may be closed by this pull request
fbw-a380x/src/systems/systems-host/systems/LegacyFuel.ts Outdated Show resolved Hide resolved
}

public onUpdate(): void {
const onGround = SimVar.GetSimVarValue('SIM ON GROUND', 'bool');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 Questions:

  1. Do we not need to wait for GameStart here?
  2. You mentioned you wanted to throttle the update rate here, is that still something that's missing or did you decide against it?

Copy link
Member

@Maximilian-Reuter Maximilian-Reuter Oct 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my experience, onUpdate is already not called before gamestart. As for throttling, the actions are throttled already ,in that they only activate once a change is necessary. I also didnt see any real performance impact as the real work is getting all the updated simvar values.

Copy link
Member

@tracernz tracernz Oct 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onUpdate is definitely called before the gamestate is ingame, usually a lot of times. The reason some things wait for ingame is because .flt files etc. will have finished loading by then.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fair enough, though the code in on update doesnt really execute anyways until off the ground. So I wager the only situation where you might get issues is during an airspawn, probably why I havent seen any yet

}

public onUpdate(): void {
const onGround = SimVar.GetSimVarValue('SIM ON GROUND', 'bool');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might consider moving this to a publisher as well(SIM_ON_GROUND is also used elsewhere on systems-host), but maybe not for this PR

Copy link
Member

@tracernz tracernz Oct 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even more nitpick/something to think about, anything using SIM ON GROUND should really be in extras-host because it's not an aircraft system (they use other aircraft systems to determine on ground/in-flight status).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was kinda going back and forth on that and ended up just using the existing file. In the end this code isnt designed to stay around for long (hopefully) and be replaced by our own fqms.

aguther added a commit that referenced this pull request Oct 17, 2024
@2hwk
Copy link
Member

2hwk commented Oct 17, 2024

Other than cleaning up the review comments as above, these changes seem to have a positive impact on ensuring fuel is not imbalanced and doesn't get "stuck" anywhere.

aguther added a commit that referenced this pull request Oct 17, 2024
aguther added a commit that referenced this pull request Oct 18, 2024
aguther added a commit that referenced this pull request Oct 18, 2024
@aguther aguther removed the Exp Available on experimental branch (for testing) label Oct 18, 2024
@2hwk 2hwk merged commit e6aaaf8 into flybywiresim:master Oct 19, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A380X Related to the A380X aircraft QA Ready to Test QA Tier 2 Showstopper this issue is blocking the next stable release
Projects
Status: ✔️ Done
Development

Successfully merging this pull request may close these issues.

[A380X] Trim tank not emptying
9 participants