Repository navigation
fix(fuel): rescale BADA fuel flow from the BADA4 LHV (43.217 MJ/kg) - #80
Merged
Merged
Conversation
BADA gives the fuel flow of a fuel with a given lower calorific value; PyNEATS rescales it to the actual fuel: ff = ff_BADA x REFERENCE_Q_FUEL / q_fuel. REFERENCE_Q_FUEL was 43.13e6 J/kg, the pycontrails JetA value, which BADA does not use (audit A12). The docs said no correction applies without an AO q_fuel, but it always applies (audit A11). Verification: pyBADA computes BADA4 fuel flow as energy flow / AC.LHV; all 86 BADA4 models reachable through the PyNEATS mapping tables declare LHV = 43.217e6 J/kg (all jets, BADA 4.2, both BADA folders). Maintainer decision (Philippe Very, Ramon Dalmau, 2026-10-22): - keep the rescaling, always applied (default q_fuel 42.8e6: x1.0097); - REFERENCE_Q_FUEL = 43.217e6 J/kg (BADA4 LHV) for BADA4 and BADA3 (BADA3 declares no LHV); piston models (43.71e6) are not used; - document it. Effect (fleet before/after, 4,959 sample flights): fuel and CO2 +0.21 % (BADA4 and BADA3 alike), NOx +0.41 %; same failing flights. Test: tests/test_fuel_energy_reference.py checks the constant, the model default, and that every mapped BADA4 model declares this LHV (fails on the previous code). Docs: mrv-specification.md; docstrings; audit A11/A12. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
All golden outputs, and the inputs derived from the default run (operator mass, fuel flow, efficiency and take-off mass test cases), regenerated with scripts/create_golden_outputs.py on this branch, written in the committed key order. Per-flight totals change by at most +0.25 % (fuel, CO2), +0.44 % (NOx), +0.39 % (contrail energy forcing; min -0.11 %); nvPM by at most +0.25 %, except FDX5067__tc_hydrogen_out_of_range (nvPM number +0.57 %, nvPM mass +0.76 %). The remaining differences are environment noise in the CoCiP radiation columns (the committed files were made on another machine: per-flight fuel/CO2/NOx/nvPM totals already matched dev to 5e-14, contrail energy forcing to 1.5e-4). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…audit I12) The golden outputs come from FleetRunner (CoCiP on the whole fleet); the FlightRunner test runs one flight. With identical inputs, the contrails at FDX5067 waypoints 48-49 end a few minutes apart in the two runs, and the flight's contrails_ef_J and contrail EAGWP/CO2eq differ by 1.03e-3 (rtol 1e-3) once the A12 fuel change is applied (1.8e-6 on dev). Only contrails_ef_J and the "Contrails" climate metrics are compared at rtol 5e-3; everything else stays at 1e-3; FleetRunner tests unchanged. Audit: new open item I12; three stale A11/A12 passages updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…folder The CI BADA data repository may hold only some BADA4 models; a missing model made the test fail. Check every mapped model that is present, and skip with a message when none is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
BADA gives the fuel flow of a fuel with a given energy content (lower calorific value, LHV).
PyNEATS converts it to the fuel actually used:
q_fuel is the operator's calorific value, else the airport fuel file value, else the default
42.8 MJ/kg.
Before: REFERENCE_Q_FUEL = 43.13 MJ/kg, the Jet A value of the pycontrails library. BADA does
not use this value (audit A12). The documentation also said "no correction if the operator
gives no calorific value", but the code always corrects (audit A11).
After: REFERENCE_Q_FUEL = 43.217 MJ/kg, the value BADA4 itself uses.
Verification
LHV = 43.217 MJ/kg (all jets, BADA 4.2), in both BADA folders we use.
every time the suite runs with BADA, so a future BADA release with another value fails.
Decision (Philippe Very and Ramon Dalmau, 2026-10-22)
Effect
Fleet before/after on the 4,959 sample flights:
Test data
mass, fuel flow, efficiency, take-off mass cases) change too.
-0.11 % to +0.39 %; nvPM up to +0.25 %, except one test case (hydrogen out of range:
nvPM number +0.57 %, mass +0.76 %).
give contrail results 0.1 % apart with identical inputs (a contrail ends a few minutes
earlier). In the single-flight golden test only the contrail values now use a 0.5 %
tolerance; everything else stays at 0.1 %.
Checks
Full test suite 330 passed (the one contrail tolerance failure is fixed; the golden pipeline
tests rerun: 8 passed). Independent review: no code defects. Audit A11/A12 resolved.