Repository navigation
fix(performance): fuel flow derived from aircraft_mass is no longer one point late - #79
Merged
Merged
Conversation
…ne point late The fuel burned over segment i (t[i] -> t[i+1]) is mass[i] - mass[i+1]. The code used mass[i-1] - mass[i] over the forward duration: every value one point late, 0 at the first point, the last segment's fuel lost, and the wrong duration when steps are uneven (audit D3). Only flights with an AO aircraft_mass column and no fuel_flow are affected. Measured on the 5 golden aircraft_mass_col flights (BADA4, 60 s grid): total fuel was 0.03-0.67 % low; single points were off by up to 107-287 % in the descent (top of descent, level changes), which reaches the per-point NOx/CO/HC/nvPM indices and the CoCiP fuel per metre. Now the total burn equals mass[0] - mass[-1]. Golden outputs: only the 13 flight records with aircraft_mass and no fuel_flow are replaced (aircraft_mass_col 5/5, mixed_columns FDX5067, aggregated tc_mass_* and tc_perf_no_ff*); every other record is unchanged. Regenerated with scripts/create_golden_outputs.py on this branch; a run on dev showed the other records are unaffected. Tests: alignment with uneven steps, total = mass drop, no negative flow, provided fuel_flow kept. The first three fail on the previous code. 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.
Problem (audit D3)
When an operator sends the aircraft mass along the trajectory but no fuel flow, PyNEATS
derives the fuel flow from the mass decrease: fuel burned in a segment = mass at its start
minus mass at its end, divided by its duration.
The code subtracted the PREVIOUS mass instead of the NEXT one, so every value was one point
late. Example, flight EAF2143 (one point per minute):
Consequences:
5 test flights).
descent, level changes). NOx, CO, HC, nvPM and the contrail model work point by point, so
their results were affected too.
Only flights with an operator mass column and no fuel flow column are affected. Flights
computed from BADA alone, or with operator fuel flow, are unchanged.
Fix
fuel_flow[i] = (mass[i] - mass[i+1]) / duration of segment i. The total fuel burn now equals
exactly the mass lost during the flight.
Test data (golden outputs)
Only the 13 flight records that send mass without fuel flow are updated:
aircraft_mass_col (5 flights), mixed_columns (FDX5067), aggregated (tc_mass_* and
tc_perf_no_ff* cases). Every other record is byte-identical to before (checked by
regenerating all golden outputs on dev and on this branch: only these 13 differ).
Checks
Not in this PR: when the low-speed filter removes points, segment durations are not
recomputed (I9, part of the parked low-speed filter work).