Legacy performance model
Currently, the only type of performance model that we have implemented is a
table-based model intended to replicate the behavior of the performance model
in the AEIC v2 Matlab code. This is represented by the
LegacyPerformanceModel class.
Input file format
The model-specific part of the TOML file defining a legacy performance model
lives in the flight_performance section, which has the following fields:
colsdefines the columns in the performance table - these will normally befuel_flow(fuel flow rate [kg/s]),fl(altitude as flight level),tas(true airspeed [m/s]),rocd(rate of climb/descent [m/s]) andmass(aircraft mass [kg]);dataprovides the performance table data, as a list of table rows, each row being a list of column values in the order given in thecolsfield.
The contents of this section of the input file is represented internally by a
value of the PerformanceTableInput class.
Question
Should we make this format better? For a TOML file, this setup might be the best that we can do.
Performance table
Within the LegacyPerformanceModel class, the performance data
is stored in a private _performance_table attribute of type
PerformanceTable. This is created from the
input data using the from_input class method:
this provides the link between the TOML input data and the interpolation
machinery used within the performance model.
The legacy performance model imposes certain limitations on the structure of the performance table data:
The table is divided into three separate segments, one each for climb (\(\mathrm{ROCD} > 0\)), cruise (\(\mathrm{ROCD} \approx 0\)) and descent (\(\mathrm{ROCD} < 0\)).
Within each table segment, the performance table data is dense in flight level and aircraft mass, in the sense that there is exactly one table for for each (flight level, aircraft mass) combination. The data thus defines a complete table for bilinear interpolation in flight level and mass.
This structure ensures that, for each relevant flight phase (climb, cruise or descent), fuel flow, achievable true airspeed and achievable rate of climb/descent are dependent only on altitude and aircraft mass.
Performance evaluation
The evaluate_impl method
that calculates performance data for a given aircraft state simply selects the
relevant segment of the performance table data and does bilinear interpolation
in flight level and aircraft mass. The interpolation is performed by an
Interpolator helper
class, instances of which are created lazily for each flight phas as needed
(once only for any performance model instance).
API reference
- class AEIC.performance.models.LegacyPerformanceModel(*, aircraft_name, aircraft_class, maximum_altitude_ft, maximum_payload_kg, number_of_engines, apu_name=None, speeds, lto_performance, model_type, flight_performance)
Legacy table-based performance model.
- Parameters:
aircraft_name (str)
aircraft_class (AircraftClass)
maximum_altitude_ft (Annotated[int, Gt(gt=0)])
maximum_payload_kg (Annotated[int, Gt(gt=0)])
number_of_engines (Annotated[int, Gt(gt=0)])
apu_name (str | None)
speeds (Speeds | None)
lto_performance (LTOPerformanceInput | None)
model_type (Literal['legacy'])
flight_performance (PerformanceTableInput)
- property empty_mass: float
Empty aircraft mass.
Empty mass per BADA-3 is lowest mass in performance table / 1.2.
- evaluate_impl(state, rules)
Implementation of performance evaluation for legacy table-based performance model.
The performance table is separated into climb, cruise and descent segments. The performance evaluation implementation uses bilinear interpolation in flight level and aircraft mass in the relevant segment of the performance table (selected by the flight rule) to get performance values.
- Parameters:
state (AircraftState)
rules (SimpleFlightRules)
- Return type:
- flight_performance: PerformanceTableInput
Input data for flight performance table.
- property maximum_mass: float
Maximum aircraft mass from performance table.
- model_post_init(context, /)
This function is meant to behave like a BaseModel method to initialise private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self (BaseModel) – The BaseModel instance.
context (Any) – The context.
- Return type:
None
- property performance_table: PerformanceTable
Performance table accessor.
- class AEIC.performance.models.legacy.PerformanceTable(df, fl, tas, rocd, mass, _interpolators=<factory>)
Aircraft performance data table for legacy table-driven performance model.
This class implements performance data interpolation as done in the legacy AEIC code. The data in these performance tables is identical to the data provided in BADA PTF performance table files. This means that:
The table is divided into three sections, for climb (ROCD>0), cruise (ROCD≈0) and descent (ROCD<0).
There are three distinct mass values: low, nominal and high. Only the nominal mass value is used in the descent section of the table.
In all sections of the table, TAS depends only on FL.
In the climb section of the table, ROCD depends on FL and mass, and fuel flow depends only on FL.
In the cruise section of the table, fuel flow depends on FL and mass.
In the descent section of the table, both ROCD and fuel flow depend only on FL.
On construction, the class checks that the input data satisfies these requirements, ensuring that subsequent interpolation in the table data will work correctly.
- Parameters:
df (DataFrame)
fl (list[float])
tas (list[float])
rocd (list[float])
mass (list[float])
_interpolators (dict[ROCDFilter, Interpolator])
- ZERO_ROCD_TOL: ClassVar[float] = 1e-06
Tolerance for zero rate of climb/descent comparisons.
- _interpolators: dict[ROCDFilter, Interpolator]
Interpolators for each flight phase table segment.
- df: DataFrame
Performance table data.
- fl: list[float]
Sorted list of unique flight levels in the table.
- classmethod from_input(ptin)
Convert performance table data from input format.
This class holds performance table data in the form needed for trajectory and emissions calculations. The constructor converts from the input format from the performance model TOML file.
- Parameters:
ptin (PerformanceTableInput)
- Return type:
Self
- interpolate(state, rocd)
Perform bilinear interpolation in flight level and aircraft mass.
The interpolation is done in the subset of the performance table corresponding to the given rate of climb/descent filter.
- Parameters:
state (AircraftState)
rocd (ROCDFilter)
- Return type:
- mass: list[float]
Sorted list of unique mass values in the table.
- rocd: list[float]
Sorted list of unique ROCD values in the table.
- subset(rocd)
Extract subset of performance table for given rate of climb/descent filter.
- Parameters:
rocd (ROCDFilter)
- Return type:
- tas: list[float]
Sorted list of unique airspeed values in the table.
- enum AEIC.performance.models.legacy.ROCDFilter(value)
Rate of climb/descent filter for performance table subsetting.
Valid values are as follows:
- NEGATIVE = <ROCDFilter.NEGATIVE: 1>
- ZERO = <ROCDFilter.ZERO: 2>
- POSITIVE = <ROCDFilter.POSITIVE: 3>
- class AEIC.performance.models.legacy.Interpolator(df)
Grid-based interpolator for performance model data.
- Parameters:
df (pd.DataFrame)
- __call__(fl, mass)
Perform bilinear interpolation to get performance values at given flight level and aircraft mass.
- Parameters:
fl (float)
mass (float)
- Return type:
- class AEIC.performance.models.legacy.PerformanceTableInput(*, cols, data)
Performance table data from TOML file.
- Parameters:
cols (list[str])
data (list[list[float]])
- cols: list[str]
Performance table column labels.
- data: list[list[float]]
Performance table data.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- validate_names_and_sizes()
Normalize and check input column names and array sizes.
- Return type:
Self