Repository navigation
fix(performance): treat a non-finite BADA fuel flow as a point failure (audit I13) - #82
Merged
Merged
Conversation
…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>
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.
Problem. In
_single_pass_performancea point is a BADA failure when BADA raises or its fuelflow is above
ff_outlier_thresholdor negative: it takes the previous point's values, and morethan 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,
dev5aba2f9):VLG1254 (A320) loses everything below 2,530 m (2,726.8 kg on
dev). IBS15XJ: raw points at08:09:51 and 08:18:33 have the same position while the level goes from FL219 to FL156.
Change.
bada_model.py:976-985:not np.isfinite(ff_corrected)joins the outlier test, sothe 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):last-point thrust changes, see below).
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 ondev. Fullsuite: 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.