Skip to content

fix(performance): treat a non-finite BADA fuel flow as a point failure (audit I13) - #82

Merged
ramondalmau merged 1 commit into
devfrom
fix/bada-nonfinite-fuel-flow
Oct 24, 2026
Merged

ramondalmau merged 1 commit into
devfrom
fix/bada-nonfinite-fuel-flow

Conversation

@ramondalmau

Copy link
Copy Markdown
Collaborator

Problem. In _single_pass_performance a point is a BADA failure when BADA raises or its fuel
flow is above ff_outlier_threshold or negative: it takes the previous point's values, and more
than 5 failures in a row (or one at the first point) fail the attempt. A NaN fuel flow passes both
comparisons. It was stored as the "previous" value, and with a take-off mass the integrated mass
was NaN for the rest of the flight, so all later fuel dropped out of the sums. BADA4 returns NaN
without raising wherever the TAS is NaN: at a frozen raw position, and at the last point of the
computed-TAS path.

Evidence (NM sample 2025-07-09, 4,959 flights, dev 5aba2f9):

  • VLG1254, IBE09LA and IBS15XJ (BADA4) have NaN fuel on their last 21 rows each, 63 rows in all.
    VLG1254 (A320) loses everything below 2,530 m (2,726.8 kg on dev). IBS15XJ: raw points at
    08:09:51 and 08:18:33 have the same position while the level goes from FL219 to FL156.
  • 4 flights are forced to BADA3 by exceptions on the NaN mass: RYR4WR, RYR6EF, EZY87KM, VLG90AB.

Change. bada_model.py:976-985: not np.isfinite(ff_corrected) joins the outlier test, so
the existing point-failure rule applies unchanged. Docs: the docstring, input-prioritization.md,
and audit I13 with its status-table row.

Effect (fleet run, this branch against dev):

  • The same 4,303 flights are computed and the 656 failures are unchanged. NaN-fuel rows: 63 -> 0.
  • Fleet fuel: 49,591.5 t -> 49,594.1 t (+0.005 %). CO2 +0.005 %.
  • 5 flights change; every other flight has bit-identical fuel, mass, CO2 and emissions (only the
    last-point thrust changes, see below).
    • VLG1254 +36.8 % (3,729.8 kg) and IBE09LA +10.1 %.
    • RYR4WR +16.5 % and VLG90AB +7.5 %, both now on BADA4.
    • IBS15XJ -2.1 %, now on BADA3: its 8 NaN-TAS rows in a row exceed the 5-failure limit.
  • RYR6EF and EZY87KM stay on BADA3 because of other BADA4 failures.
  • The last point of a BADA4 flight now carries the previous point's fuel flow and thrust, not NaN.
    Its fuel burn stays empty, so the totals do not change.

Tests. tests/test_bada_nonfinite_fuel_flow.py: 6 tests, and all 6 fail on dev. Full
suite: 343 passed, 4 skipped, 23 xfailed. The golden files are unchanged and pass. ruff and mypy
are clean.

Merge. Together with, or just before, the airspeed-trust PR, which is based on this branch.
On its own, this PR moves IBS15XJ to BADA3. That PR moves it back to BADA4.

…e (audit I13)

In _single_pass_performance a point is a BADA failure when BADA raises or
its fuel flow is above ff_outlier_threshold or negative; the point then
takes the previous point's values, and more than max_consecutive_failures
in a row (or a failure at the first point) fail the attempt. A NaN fuel
flow passed both comparisons, so it was accepted: it became the
"previous" value and, with a take-off mass, the integrated mass was NaN
for the rest of the flight, so all later fuel dropped out of the sums.
BADA4 gives NaN without raising wherever the TAS is NaN (frozen raw
position; last point of the computed-TAS path).

Fix: a fuel flow that is not finite is a BADA failure at that point, like
an outlier; the existing rule applies unchanged.

Effect (NM sample 2025-07-09, 4,959 flights, dev 5aba2f9, measured with
this rule): same 4,303 flights computed; NaN-fuel rows 63 -> 0; fleet
fuel +0.005 %, CO2 +0.005 %; 5 flights change: VLG1254 +36.8 %,
IBE09LA +10.1 %, RYR4WR +16.5 % and VLG90AB +7.5 % (both BADA3 -> BADA4),
IBS15XJ -2.1 % (BADA4 -> BADA3: 8 NaN-TAS rows in a row exceed the
5-failure limit). The last point of a BADA4 flight now carries the
previous point's fuel flow instead of NaN; its fuel burn stays empty.
Golden tests unchanged: test_fleet_pipeline (11 cases), test_pipeline and
test_cases_pipeline pass.

Tests: tests/test_bada_nonfinite_fuel_flow.py (6 tests, all fail on the
previous code). Docs: input-prioritization.md (point failure rule),
audit I13 and status table.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@ramondalmau
ramondalmau merged commit 778c43a into dev Oct 24, 2026
6 checks passed
@ramondalmau
ramondalmau deleted the fix/bada-nonfinite-fuel-flow branch October 24, 2026 05:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant