BadaH
pyBADA Generic BADAH aircraft performance module Developped @EUROCONTROL (EIH) 2024
- class pyBADA.badaH.ARPM(AC)[source]
Bases:
BADAH
This class is a BADAH aircraft subclass and implements the Airline Procedure Model (ARPM) following the BADAH user manual.
- Parameters:
AC (badaHAircraft.) – Aircraft object {BADAH}.
- ARPMProcedure(h, mass, phase, DeltaTemp, rating='ARPM', speedLimit=None, ROCDDefault=None, tasDefault=None)[source]
Computes various parameters for different flight phases using the ARPM model.
This function calculates the available power (Pav), engine power (Peng), required power (Preq), true airspeed (TAS), rate of climb or descent (ROCD), energy share factor (ESF), and any limitations encountered during the specified flight phase. The phases include climb, cruise, descent, and hover. The calculations take into account atmospheric conditions, altitude, and aircraft mass.
- Parameters:
h (float.) – Altitude above sea level [m].
mass (float.) – Aircraft weight [kg].
phase (str.) – The flight phase being calculated, one of {“Climb”, “Cruise”, “Descent”, “Hover”}.
DeltaTemp (float.) – Deviation from the International Standard Atmosphere (ISA) temperature [K].
rating (str, optional.) – Engine rating {MTKF, MCNT, ARPM}, default is ARPM [-].
speedLimit (str, optional.) – Optional parameter to apply speed limits. Use {“applyLimit”, None}.
ROCDDefault (float, optional.) – Default rate of climb or descent [m/s], optional.
tasDefault (float, optional.) – Optional true airspeed (TAS) [m/s].
- Returns:
A list of computed values: - Pav: Available power [W]. - Peng: Engine power [W]. - Preq: Required power [W]. - tas: True airspeed [m/s]. - ROCD: Rate of climb or descent [m/s]. - ESF: Energy share factor [-]. - limitation: Any performance limitations encountered (e.g., power, speed limits).
- Return type:
list[float]
The function determines the appropriate flight phase and computes the required and available power, TAS, and ROCD accordingly. It handles various flight phases, including:
Climb: For altitudes ≤ 5 meters, it uses the takeoff ARPM procedure. For altitudes > 5 meters, it uses the climb procedure.
Cruise: Computes cruise parameters.
Descent: Handles descent, approach, final approach, and landing depending on the altitude. - For h ≥ 500 feet, descent parameters are computed. - For 150 feet ≤ h < 500 feet, the approach procedure is used. - For 5 feet ≤ h < 150 feet, the final approach is computed. - For h < 5 feet, landing parameters are computed.
Hover: Computes hover parameters.
Note
Power limitations, speed envelope constraints, and other performance-related limitations are flagged and returned as part of the limitation output.
- approach(h, mass, DeltaTemp, speedLimit=None, ROCDDefault=None, tasDefault=None)[source]
Computes various parameters for the aircraft approach phase using the ARPM model.
This function calculates key approach parameters, including available and required power, true airspeed (TAS), rate of descent (ROCD), and potential performance limitations. The calculations take into account atmospheric conditions, altitude, and aircraft mass.
- Parameters:
h (float.) – Altitude above sea level [m].
mass (float.) – Aircraft weight [kg].
DeltaTemp (float.) – Deviation from the International Standard Atmosphere (ISA) temperature [K].
speedLimit (str, optional.) – Optional parameter to apply speed limits. Use {“applyLimit”, None}.
ROCDDefault (float, optional.) – Default rate of climb or descent [m/s], optional.
tasDefault (float, optional.) – Optional true airspeed (TAS) [m/s].
- Returns:
A list of computed values: - Pav: Available power [W]. - Peng: Engine power [W]. - Preq: Required power [W]. - tas: True airspeed [m/s]. - ROCD: Rate of descent [m/s]. - ESF: Energy share factor [-]. - limitation: Any performance limitations encountered during the approach (e.g., speed, power limits).
- Return type:
list[float]
The function determines the Maximum Endurance Cruise (MEC) TAS for the approach, applying the default values when necessary. It checks for speed envelope limitations and adjusts TAS accordingly. It calculates the power available, required power, and engine power needed for the approach.
Note
Power limitations are handled by adjusting TAS and calculating the rate of descent (ROCD).
- climb(h, mass, DeltaTemp, rating='ARPM', speedLimit=None, ROCDDefault=None, tasDefault=None)[source]
Computes various parameters for the aircraft climb phase using the ARPM model or other engine ratings.
This function calculates key climb parameters, including available and required power, true airspeed (TAS), rate of climb (ROCD), and performance limitations. It takes into account speed envelope constraints and engine power limits based on the flight altitude and aircraft mass.
- Parameters:
h (float.) – Altitude above sea level [m].
mass (float.) – Aircraft weight [kg].
DeltaTemp (float.) – Deviation from the International Standard Atmosphere (ISA) temperature [K].
rating (str.) – Engine rating mode, defaults to “ARPM”. Other options include {MTKF, MCNT}.
speedLimit (str.) – Optional parameter to apply speed limits. Use {“applyLimit”, None}.
ROCDDefault (float, optional.) – Default rate of climb or descent [m/s], optional.
tasDefault (float, optional.) – Default true airspeed (TAS) [m/s], optional.
- Returns:
A list of computed values: - Pav: Available power [W]. - Peng: Engine power [W]. - Preq: Required power [W]. - tas: True airspeed [m/s]. - ROCD: Rate of climb [m/s]. - ESF: Energy share factor [-]. - limitation: Performance limitations encountered during the climb (e.g., speed, power limits).
- Return type:
list[float]
The function calculates these values by: - Determining atmospheric conditions at the given altitude (using temperature, pressure, and density). - Calculating the maximum endurance cruise speed (MEC) for the given altitude and mass, and setting TAS accordingly. - Checking speed envelope limitations (minimum and maximum allowable speeds) and applying them if necessary. - Computing the required power (Preq) and available power (Pav) based on the engine rating (e.g., ARPM, MTKF, MCNT). - Adjusting the rate of climb (ROCD) if engine power is insufficient to reach the desired target climb rate.
If the engine rating is “ARPM”, the function attempts to reach the target climb rate by adjusting the power (Peng). If the rating is “MTKF” or “MCNT”, it uses the maximum available power for that setting.
Note
The function handles speed envelope limitations automatically by applying speed adjustments if necessary.
Warning
The output accuracy depends on the precision of the atmospheric model and the flight envelope data.
- cruise(h, mass, DeltaTemp, speedLimit=None, tasDefault=None)[source]
Computes various parameters for the aircraft cruise phase using the ARPM model or default speed.
This function calculates key cruise parameters, including available and required power, true airspeed (TAS), and potential limitations due to the flight envelope or engine power. The calculations take into account atmospheric conditions, altitude, and aircraft mass.
- Parameters:
h (float.) – Altitude above sea level [m].
mass (float.) – Aircraft weight [kg].
DeltaTemp (float.) – Deviation from the International Standard Atmosphere (ISA) temperature [K].
speedLimit (str, optional.) – Optional parameter to apply speed limits. Use {“applyLimit”, None}.
tasDefault (float, optional.) – Optional true airspeed (TAS) [m/s].
- Returns:
A list of computed values: - Pav: Available power [W]. - Peng: Engine power [W]. - Preq: Required power [W]. - tas: True airspeed [m/s]. - ROCD: Rate of climb or descent, set to 0 for cruise [m/s]. - ESF: Energy share factor [-], set to 0 for cruise. - limitation: Any performance limitations encountered during the cruise (e.g., speed, power limits).
- Return type:
list[float]
The function determines the Long Range Cruise (LRC) speed or a default speed if provided. It checks for any speed envelope limitations and calculates power requirements for the given conditions. If the available power is less than the required power, performance limitations are recorded.
Note
ESF (Energy Share Factor) is not applicable in cruise mode and is therefore set to 0.
- descent(h, mass, DeltaTemp, speedLimit=None, ROCDDefault=None, tasDefault=None)[source]
Computes various parameters for the aircraft descent phase using the ARPM model or default speed.
This function calculates key descent parameters, including available and required power, true airspeed (TAS), rate of descent (ROD), and potential performance limitations. The calculations take into account atmospheric conditions, altitude, and aircraft mass.
- Parameters:
h (float.) – Altitude above sea level [m].
mass (float.) – Aircraft weight [kg].
DeltaTemp (float.) – Deviation from the International Standard Atmosphere (ISA) temperature [K].
speedLimit (str, optional.) – Optional parameter to apply speed limits. Use {“applyLimit”, None}.
ROCDDefault (float, optional.) – Default rate of climb or descent [m/s], optional.
tasDefault (float, optional.) – Optional true airspeed (TAS) [m/s].
- Returns:
A list of computed values: - Pav: Available power [W]. - Peng: Engine power [W]. - Preq: Required power [W]. - tas: True airspeed [m/s]. - ROCD: Rate of descent [m/s]. - ESF: Energy share factor [-]. - limitation: Any performance limitations encountered during the descent (e.g., speed, power limits).
- Return type:
list[float]
The function determines the Long Range Cruise (LRC) or Maximum Endurance Cruise (MEC) TAS for descent, applying the default values when necessary. It checks for speed envelope limitations and adjusts TAS accordingly. It calculates the power available, required power, and engine power needed for the descent.
Note
Power limitations are handled by adjusting TAS and calculating the rate of descent (ROCD).
- finalApproach(h, mass, DeltaTemp, speedLimit=None, ROCDDefault=None, tasDefault=None)[source]
Computes various parameters for the final approach phase using the ARPM model.
This function calculates key final approach parameters, including available and required power, true airspeed (TAS), rate of descent (ROCD), and potential performance limitations. The calculations take into account atmospheric conditions, altitude, and aircraft mass.
- Parameters:
h (float.) – Altitude above sea level [m].
mass (float.) – Aircraft weight [kg].
DeltaTemp (float.) – Deviation from the International Standard Atmosphere (ISA) temperature [K].
speedLimit (str, optional.) – Optional parameter to apply speed limits. Use {“applyLimit”, None}.
ROCDDefault (float, optional.) – Default rate of climb or descent [m/s], optional.
tasDefault (float, optional.) – Optional true airspeed (TAS) [m/s].
- Returns:
A list of computed values: - Pav: Available power [W]. - Peng: Engine power [W]. - Preq: Required power [W]. - tas: True airspeed [m/s]. - ROCD: Rate of descent [m/s]. - ESF: Energy share factor [-]. - limitation: Any performance limitations encountered during the final approach (e.g., speed, power limits).
- Return type:
list[float]
The function sets the default true airspeed (TAS) for the final approach to 30 knots (converted to meters per second), or uses a specified value if provided. It also sets a default rate of descent (ROCD) to -200 feet per minute, or takes an optional value if available. The function checks the speed envelope for limitations, adjusts TAS if necessary, and calculates the required and available power. If there are power limitations, they are flagged in the output.
Note
This function uses the constant TAS evolution for the final approach and computes engine power and rate of descent based on available power and atmospheric conditions.
- hover(h, mass, DeltaTemp)[source]
Computes various parameters for the hover phase using the ARPM model.
This function calculates key hover parameters, including available and required power, true airspeed (TAS), and any potential performance limitations. The calculations take into account atmospheric conditions, altitude, and aircraft mass.
- Parameters:
h (float.) – Altitude above sea level [m].
mass (float.) – Aircraft weight [kg].
DeltaTemp (float.) – Deviation from the International Standard Atmosphere (ISA) temperature [K].
- Returns:
A list of computed values: - Pav: Available power [W]. - Peng: Engine power [W]. - Preq: Required power [W]. - tas: True airspeed (set to 0 for hover) [m/s]. - ROCD: Rate of climb or descent (set to 0 for hover) [m/s]. - ESF: Energy share factor [-], set to 0 for hover. - limitation: Any performance limitations encountered during the hover (e.g., power limits).
- Return type:
list[float]
This function calculates the hover parameters where both true airspeed (TAS) and rate of climb or descent (ROCD) are set to 0. The available and required power are computed, and performance limitations such as power limitations are flagged if applicable.
Note
The energy share factor (ESF) is not applicable during hover, and is therefore set to 0.
- landing(h, mass, DeltaTemp, ROCDDefault=None)[source]
Computes various parameters for the landing phase using the ARPM model.
This function calculates key landing parameters, including available and required power, true airspeed (TAS), rate of descent (ROCD), and potential performance limitations. The calculations take into account atmospheric conditions, altitude, and aircraft mass.
- Parameters:
h (float.) – Altitude above sea level [m].
mass (float.) – Aircraft weight [kg].
DeltaTemp (float.) – Deviation from the International Standard Atmosphere (ISA) temperature [K].
ROCDDefault (float, optional.) – Default rate of descent [m/s], optional.
- Returns:
A list of computed values: - Pav: Available power [W]. - Peng: Engine power [W]. - Preq: Required power [W]. - tas: True airspeed (set to 0 for landing) [m/s]. - ROCD: Rate of descent [m/s]. - ESF: Energy share factor [-]. - limitation: Any performance limitations encountered during the landing (e.g., power limits).
- Return type:
list[float]
This function sets the rate of descent (ROCD) to a default value of -100 feet per minute or an optional value if provided. The true airspeed (TAS) is set to 0 for landing calculations. The function checks if available power meets the required power and flags any limitations in performance, such as power limitations.
Note
The ESF (Energy Share Factor) is calculated for constant TAS during landing, and engine power is computed accordingly.
- takeoff(h, mass, DeltaTemp, rating='ARPM', speedLimit=None, ROCDDefault=None)[source]
Computes various parameters for the aircraft takeoff phase using the ARPM model (or other specified engine ratings).
This function calculates key takeoff parameters, including the available and required power, true airspeed, rate of climb (ROCD), and other performance metrics. It also checks for speed limitations based on the flight envelope and applies them as necessary.
- Parameters:
h (float.) – Altitude above sea level [m].
mass (float.) – Aircraft weight [kg].
DeltaTemp (float.) – Deviation from the International Standard Atmosphere (ISA) temperature [K].
rating (str.) – Engine rating mode, defaults to “ARPM”. Other options include {MTKF, MCNT}.
speedLimit (str.) – Optional parameter to specify if speed limits should be applied {“applyLimit”, None}.
ROCDDefault (float, optional.) – Default rate of climb or descent [m/s], optional.
- Returns:
A list of computed values for: - Pav: Available power [W]. - Peng: Engine power [W]. - Preq: Required power [W]. - tas: True airspeed [m/s]. - ROCD: Rate of Climb or Descent [m/s]. - ESF: Energy share factor [-]. - limitation: Speed and power limitations encountered during takeoff.
- Return type:
list[float]
The function calculates these values by: - Determining atmosphere conditions at the given altitude (using temperature, pressure, and density). - Computing power requirements and available engine power based on the engine rating (e.g., ARPM, MTKF, MCNT). - Applying optional speed limitations from the flight envelope and checking if engine power or speed limits constrain performance.
If the engine rating is “ARPM”, the function tries to reach a target power for the rate of climb (ROCD), and adjusts it based on the available power (Pav). If the rating is “MTKF” or “MCNT”, it simply uses the maximum available power for that setting.
Note
The function automatically handles speed envelope limitations by applying adjustments to the true airspeed (tas) if required.
Warning
The accuracy of the output depends on the precision of the flight envelope model and other internal aircraft parameters.
- class pyBADA.badaH.BADAH(AC)[source]
Bases:
Helicopter
,Bada
This class implements the part of BADAH performance model that will be used in other classes following the BADAH manual.
- Parameters:
AC (badaHAircraft.) – Aircraft object {BADAH}.
- CP(Peng)[source]
Computes the engine power coefficient (CP) based on the given all-engine power.
- Parameters:
Peng (float) – All-engine power in watts [W].
- Returns:
Engine power coefficient [-].
- Return type:
float
- CPav(rating, delta, theta)[source]
Computes the power available coefficient (CPav) based on engine type, throttle rating, normalized air pressure (delta), and normalized temperature (theta).
- Parameters:
rating (str) – Engine throttle setting, e.g., {MTKF, MCNT}.
delta (float) – Normalized air pressure [-].
theta (float) – Normalized air temperature [-].
- Returns:
Power available coefficient [-].
- Return type:
float
- Raises:
ValueError – If the engine rating or type is unknown.
- CPreq(mu, CT)[source]
Computes the power required coefficient (CPreq) based on the advance ratio (mu) and thrust coefficient (CT).
The power required coefficient relates to the total power required to maintain flight, factoring in the aerodynamic performance of the rotor in different operating regimes.
- Parameters:
mu (float) – Advance ratio [-].
CT (float) – Thrust coefficient [-].
- Returns:
Power required coefficient (CPreq) [-].
- Return type:
float
- CT(mass, rho, phi)[source]
Computes the thrust coefficient (CT) for the aircraft.
The thrust coefficient is a dimensionless quantity that represents the thrust produced by the aircraft’s rotor in relation to the air density, rotor radius, and rotor speed.
- Parameters:
mass (float) – Aircraft mass in kilograms [kg].
rho (float) – Air density in kilograms per cubic meter [kg/m³].
phi (float) – Bank angle in degrees [deg].
- Returns:
Thrust coefficient (CT) [-].
- Return type:
float
- Pav(rating, delta, theta)[source]
Computes the power available at the given throttle setting, based on normalized pressure and temperature.
- Parameters:
rating (str) – Throttle setting, e.g., {MTKF, MCNT}.
delta (float) – Normalized pressure [-], ratio of actual pressure to standard sea level pressure.
theta (float) – Normalized temperature [-], ratio of actual temperature to standard sea level temperature.
- Returns:
Available power in watts [W].
- Return type:
float
- Raises:
ValueError – If the specified throttle setting is not recognized.
- Peng_target(ROCD, mass, Preq, ESF, temp, DeltaTemp)[source]
Computes the target engine power required to achieve a specific rate of climb or descent.
- Parameters:
ROCD (float) – Rate of climb or descent in meters per second [m/s].
mass (float) – Aircraft mass in kilograms [kg].
Preq (float) – Power required in watts [W].
ESF (float) – Energy share factor, a dimensionless factor [-].
temp (float) – Atmospheric temperature in kelvins [K].
DeltaTemp (float) – Deviation from the International Standard Atmosphere (ISA) temperature in kelvins [K].
- Returns:
Target engine power in watts [W].
- Return type:
float
- Pmax(rating)[source]
Computes the maximum power available for all engines at a given throttle setting.
- Parameters:
rating (str) – Throttle setting, e.g., {MTKF, MCNT}.
- Returns:
Maximum all-engine power in watts [W].
- Return type:
float
- Raises:
ValueError – If the specified throttle setting is not recognized.
- Preq(sigma, tas, mass, phi=0.0)[source]
Computes the power required for the aircraft to maintain flight based on various factors such as air density, true airspeed (TAS), aircraft mass, and bank angle.
- Parameters:
sigma (float) – Normalized air density [-], which is the ratio of the current air density to sea level air density.
tas (float) – True airspeed (TAS) in meters per second [m/s].
mass (float) – Aircraft mass in kilograms [kg].
phi (float) – Bank angle in degrees [deg], default is 0 for straight flight.
- Returns:
Power required for the aircraft in watts [W].
- Return type:
float
- Q(Peng)[source]
Computes the torque value as a percentage of the reference torque (P0).
- Parameters:
Peng (float) – All-engine power in watts [W].
- Returns:
Torque value as a percentage [%] of the reference torque.
- Return type:
float
- ROCD(Peng, Preq, mass, ESF, theta, DeltaTemp)[source]
Computes the Rate of Climb or Descent (ROCD) for an aircraft.
- Parameters:
Peng (float) – All-engine power available [W].
Preq (float) – Power required for steady flight [W].
mass (float) – Aircraft’s current mass [kg].
ESF (float) – Energy share factor [-], a multiplier used to adjust power distribution in different flight phases.
theta (float) – Normalized temperature [-], ratio of actual temperature to standard sea-level temperature.
DeltaTemp (float) – Deviation from the International Standard Atmosphere (ISA) temperature [K].
- Returns:
Rate of Climb or Descent (ROCD) in meters per second [m/s].
- Return type:
float
- ff(delta, CP)[source]
Computes the fuel flow rate based on normalized pressure and power coefficient.
- Parameters:
delta (float) – Normalized pressure [-], which is the ratio of actual air pressure to standard sea-level pressure.
CP (float) – Power coefficient [-], representing the power output in relation to the engine’s maximum power.
- Returns:
Fuel flow rate in kilograms per second [kg/s].
- Return type:
float
- Raises:
ValueError – If the engine type is unknown.
- mu(tas)[source]
Computes the advance ratio (mu) for the aircraft based on true airspeed (TAS) and rotor speed.
The advance ratio is a non-dimensional parameter that relates the forward speed of the aircraft to the rotational speed of its main rotor.
- Parameters:
tas (float) – True airspeed (TAS) in meters per second [m/s].
- Returns:
Advance ratio (mu) [-].
- Return type:
float
- class pyBADA.badaH.BadaHAircraft(badaVersion, acName, filePath=None, allData=None)[source]
Bases:
BADAH
This class encapsulates the BADAH performance model for an aircraft, extending the BADAH base class.
- Parameters:
badaVersion (str) – The version of the BADAH model being used.
acName (str) – The ICAO designation or name of the aircraft.
filePath (str, optional) – (Optional) Path to the BADAH XML file. If not provided, a default path is used.
allData (pd.DataFrame, optional) – (Optional) Dataframe containing pre-loaded aircraft data, typically used to initialize the aircraft parameters without needing to parse XML files.
This class initializes the aircraft’s performance model using data from a dataframe or by reading from XML files in the BADAH format.
- class pyBADA.badaH.FlightEnvelope(AC)[source]
Bases:
BADAH
This class is a BADAH aircraft subclass and implements the flight envelope caclulations following the BADAH manual.
- Parameters:
AC (badaHAircraft.) – Aircraft object {BADAH}.
- VMax()[source]
Computes the maximum speed in Calibrated Airspeed (CAS) as limited by the flight envelope.
- Returns:
Maximum CAS speed in meters per second [m/s].
- Return type:
float.
- maxAltitude()[source]
Computes the maximum operational altitude for the aircraft.
- Returns:
Maximum altitude in meters [m].
- Return type:
float.
- speedEnvelope_powerLimited(h, mass, DeltaTemp, rating='MCNT', rateOfTurn=0)[source]
Computes the maximum and minimum speeds (CAS) within the certified flight envelope, taking into account engine thrust limitations.
- Parameters:
h (float) – Altitude in meters [m].
mass (float) – Aircraft mass in kilograms [kg].
DeltaTemp (float) – Deviation from the International Standard Atmosphere (ISA) temperature [K].
rating (str) – Engine rating (e.g., “MTKF”, “MCNT”) determining the power output [-].
rateOfTurn (float) – Rate of turn in degrees per second, which affects bank angle [°/s].
- Returns:
A tuple containing the minimum and maximum thrust-limited CAS speeds [m/s].
- Return type:
tuple(float, float)
- Raises:
ValueError – If no valid CAS speeds are found within the power limits.
- class pyBADA.badaH.Optimization(AC)[source]
Bases:
BADAH
This class implements the BADAH optimization following the BADAH manual.
- Parameters:
AC (badaHAircraft.) – Aircraft object {BADAH}.
- LRC(h, mass, DeltaTemp, wS)[source]
Computes the True Airspeed (TAS) representing Long Range Cruise (LRC) for the given flight conditions.
The Long Range Cruise speed is the speed that allows for 99% of the specific range (range per unit of fuel) of the Maximum Range Cruise (MRC) speed while offering a higher cruise speed. This function ensures that the computed TAS remains within the aircraft’s power limitations.
- Parameters:
h (float) – Altitude in meters [m].
mass (float) – Aircraft mass in kilograms [kg].
DeltaTemp (float) – Deviation from International Standard Atmosphere (ISA) temperature in Kelvin [K].
wS (float) – Longitudinal wind speed (TAS) in meters per second [m/s].
- Returns:
Long Range Cruise (LRC) speed in True Airspeed (TAS) [m/s].
- Return type:
float.
- Raises:
ValueError – If no valid LRC speed is found, the function will return NaN.
The algorithm starts by computing the MRC speed. Using the MRC as a reference, it then calculates the LRC by finding the TAS that achieves 99% of the specific range of the MRC while staying within the aircraft’s thrust limitations.
- MEC(h, mass, DeltaTemp, wS)[source]
Computes the True Airspeed (TAS) representing Maximum Endurance Cruise (MEC) for the given flight conditions.
The Maximum Endurance Cruise speed is the speed that maximizes the time an aircraft can stay in the air for a given amount of fuel, making it ideal for loiter operations. This function minimizes fuel flow (ff) to determine the most fuel-efficient speed.
- Parameters:
h (float) – Altitude in meters [m].
mass (float) – Aircraft weight in kilograms [kg].
DeltaTemp (float) – Deviation from the International Standard Atmosphere (ISA) temperature in Kelvin [K].
wS (float) – Longitudinal wind speed (TAS) in meters per second [m/s].
- Returns:
Maximum Endurance Cruise (MEC) speed in True Airspeed (TAS) [m/s].
- Return type:
float
- Raises:
If no valid MEC speed is found, the function returns NaN.
The algorithm iterates over possible True Airspeeds (TAS) and computes the fuel flow for each, aiming to minimize fuel consumption and return the TAS that achieves this.
- MRC(h, mass, DeltaTemp, wS)[source]
Computes the True Airspeed (TAS) representing Maximum Range Cruise (MRC) for given flight conditions.
The Maximum Range Cruise speed is the speed that maximizes the aircraft’s range per unit of fuel, which is determined by balancing the fuel flow rate and airspeed. The algorithm ensures that the computed TAS stays within the power available limitations of the aircraft.
- Parameters:
h (float) – Altitude in meters [m].
mass (float) – Aircraft mass in kilograms [kg].
DeltaTemp (float) – Deviation from International Standard Atmosphere (ISA) temperature in Kelvin [K].
wS (float) – Longitudinal wind speed (TAS) in meters per second [m/s].
- Returns:
Maximum Range Cruise (MRC) speed in True Airspeed (TAS) [m/s].
- Return type:
float.
- Raises:
ValueError – If no valid MRC speed is found, the function will return NaN.
- calculateOPTparam(var_1, var_2, detaTauList)[source]
Calculates the interpolated value of an OPT parameter based on two optimizing factors.
If the exact values of the factors exist in the data, the function returns the corresponding OPT value. Otherwise, it interpolates between the nearest two values to provide a more accurate result.
- Parameters:
var_1 (float) – The first optimizing factor.
var_2 (float) – The second optimizing factor.
detaTauList (list[float]) – List of values belonging to the specified delta temperature from the OPT file.
- Returns:
Interpolated or exact OPT value based on the input factors.
- Return type:
float
This function handles both single-index and two-index cases for the nearest values, ensuring correct interpolation in the case of multiple values being found.
- findNearestIdx(value, array)[source]
Finds the nearest index or indices for a given value in a sorted array.
If the value is lower or higher than the array’s bounds, a single index is returned. If the value lies between two elements, two closest indices (left and right) are returned.
- Parameters:
value (float) – The value to find the nearest match for.
array (list[float]) – The sorted array of values.
- Returns:
A list of nearest index or indices.
- Return type:
list[float]
The function uses binary search to efficiently find the nearest value or values, ensuring precise interpolation when needed.
- getOPTParam(optParam, var_1, var_2, DeltaTemp)[source]
Retrieves the value of the specified optimization parameter (e.g., LRC, MEC, MRC) from the BADA OPT file, either directly or through interpolation based on the given flight conditions.
The function searches for the requested optimization parameter value using two optimizing factors. If the exact DeltaTemp exists in the OPT file, it retrieves the value. Otherwise, the function interpolates between the closest available DeltaTemp values.
- Parameters:
optParam (str) – Name of the optimization parameter file to query. Possible values include {LRC, MEC, MRC}.
var_1 (float) – First optimizing factor (e.g., speed, altitude) used to retrieve the value from the OPT file.
var_2 (float) – Second optimizing factor used to retrieve the value from the OPT file.
DeltaTemp (float) – Deviation from the International Standard Atmosphere (ISA) temperature [K], used to retrieve or interpolate the value.
- Returns:
The optimization parameter value, either directly from the file or interpolated.
- Return type:
float
Note
The function assumes that the arrays in the OPT file are sorted (as per the design of BADA OPT files). If the exact DeltaTemp value is not present in the file, the function interpolates between the nearest DeltaTemp values within the range of [-20, 20] degrees.
- parseOPT(filename)[source]
Parses BADAH OPT ASCII formatted files and stores data for each available delta temperature in the file.
- Parameters:
filename (str) – Path to the ___.OPT ASCII formatted file.
- Returns:
Dictionary of delta temperature values and corresponding data from the OPT file.
- Return type:
dict
This function reads and processes a BADAH OPT file, extracting delta temperature values and the corresponding performance data. The data is stored in a dictionary where each delta temperature is mapped to its respective dataset of performance values.
- class pyBADA.badaH.PTD(AC)[source]
Bases:
BADAH
This class implements the PTD file creator for BADAH aircraft following BADAH manual.
- Parameters:
AC (badaHAircraft.) – Aircraft object {BADAH}.
- PTD_climb(mass, altitudeList, DeltaTemp, rating)[source]
Calculates the BADAH PTD (Performance Table Data) for the climb phase.
This function computes the aircraft’s performance parameters during the climb phase for each altitude level in the given altitude list. Parameters such as temperature, pressure, density, true airspeed (TAS), and rate of climb/descent (ROCD) are calculated and returned in a list format that can be used for generating PTD files.
- Parameters:
mass (float.) – Aircraft mass [kg].
altitudeList (list of int.) – List of altitude values [ft].
DeltaTemp (float.) – Deviation from ISA temperature [K].
rating (str.) – Engine rating, e.g., {MTKF, MCNT, ARPM}.
- Returns:
List of PTD climb data.
- Return type:
list
- PTD_cruise(mass, altitudeList, DeltaTemp)[source]
Calculates the BADAH PTD (Performance Table Data) for the cruise phase.
This function computes the aircraft’s performance parameters during the cruise phase for each altitude level in the given altitude list. Key performance metrics like temperature, pressure, density, TAS, and fuel consumption are calculated and stored in a structured list for PTD file generation.
- Parameters:
mass (float.) – Aircraft mass [kg].
altitudeList (list of int.) – List of altitude values [ft].
DeltaTemp (float.) – Deviation from ISA temperature [K].
- Returns:
List of PTD cruise data.
- Return type:
list
- PTD_descent(mass, altitudeList, DeltaTemp)[source]
Calculates the BADAH PTD (Performance Table Data) for the descent phase.
This function computes the aircraft’s performance parameters during the descent phase for each altitude level in the given altitude list. It calculates values such as temperature, pressure, density, true airspeed (TAS), and rate of descent (ROD), and returns the data in a structured list format for PTD file generation.
- Parameters:
mass (float.) – Aircraft mass [kg].
altitudeList (list of int.) – List of altitude values [ft].
DeltaTemp (float.) – Deviation from ISA temperature [K].
- Returns:
List of PTD descent data.
- Return type:
list
- PTD_hover(mass, altitudeList, DeltaTemp)[source]
Calculates the BADAH PTD (Performance Table Data) for the hover phase.
This function computes the aircraft’s performance parameters during the hover phase for each altitude level in the given altitude list. It calculates values like temperature, pressure, density, and fuel consumption during hover and returns the data in a structured list format for PTD generation.
- Parameters:
mass (float.) – Aircraft mass [kg].
altitudeList (list of int.) – List of altitude values [ft].
DeltaTemp (float.) – Deviation from ISA temperature [K].
- Returns:
List of PTD hover data.
- Return type:
list
- create(saveToPath, DeltaTemp)[source]
Creates a BADAH PTD file based on aircraft performance data at different mass levels, altitudes, and temperatures.
This function calculates performance data for three different mass levels (low, medium, high), at various altitudes, and for different temperature deviations from the International Standard Atmosphere (ISA). It computes climb, cruise, descent, and hover performance data, then saves this information into a PTD file.
- Parameters:
saveToPath (str.) – Path to the directory where the PTD file should be saved.
DeltaTemp (float.) – Deviation from the ISA temperature [K].
- Returns:
None
- Return type:
None
The function generates data for different flight phases (climb, cruise, descent, and hover) for the BADA engine ratings (ARPM, MTKF, MCNT). It stores the computed data in lists and then calls the save2PTD method to save the data into a PTD file.
- save2PTD(saveToPath, CLList_ARPM, CLList_MTKF, CLList_MCNT, CRList, DESList, HOVERList, DeltaTemp)[source]
Saves the computed performance data to a BADAH PTD file.
This function saves the performance data generated during different flight phases (climb, cruise, descent, hover) and for different engine ratings (ARPM, MTKF, MCNT) into a PTD file. The file is named based on the aircraft name and ISA deviation.
- Parameters:
saveToPath (str.) – Path to the directory where the PTD file should be saved.
CLList_ARPM (list.) – List of climb data for the BADA ARPM rating.
CLList_MTKF (list.) – List of climb data for the BADA MTKF rating.
CLList_MCNT (list.) – List of climb data for the BADA MCNT rating.
CRList (list.) – List of cruise data.
DESList (list.) – List of descent data.
HOVERList (list.) – List of hover data.
DeltaTemp (float.) – Deviation from ISA temperature [K].
- Returns:
None
- Return type:
None
- class pyBADA.badaH.PTF(AC)[source]
Bases:
BADAH
This class implements the PTF file creator for BADAH aircraft following BADAH manual.
- Parameters:
AC (badaHAircraft.) – Aircraft object {BADAH}.
- PTF_climb(massList, altitudeList, DeltaTemp, rating)[source]
Calculates the BADAH PTF for the CLIMB phase of flight.
- Parameters:
massList (list) – List of aircraft mass levels in kilograms [kg].
altitudeList (list of int) – List of aircraft altitudes in feet [ft].
DeltaTemp (float) – Deviation from ISA temperature in Kelvin [K].
rating (str) – Engine rating {MTKF, MCNT, ARPM} [-].
- Returns:
List of PTF CLIMB data, including True Airspeed, Rates of Climb, and Fuel Flow for each mass level.
- Return type:
list
- PTF_cruise(massList, altitudeList, DeltaTemp)[source]
Calculates the BADAH PTF for the CRUISE phase of flight.
- Parameters:
massList (list) – List of aircraft mass levels in kilograms [kg].
altitudeList (list of int) – List of aircraft altitudes in feet [ft].
DeltaTemp (float) – Deviation from ISA temperature in Kelvin [K].
- Returns:
List of PTF CRUISE data.
- Return type:
list
- PTF_descent(massList, altitudeList, DeltaTemp)[source]
Calculates the BADAH PTF for the DESCENT phase of flight.
- Parameters:
massList (list) – List of aircraft mass levels in kilograms [kg].
altitudeList (list of int) – List of aircraft altitudes in feet [ft].
DeltaTemp (float) – Deviation from ISA temperature in Kelvin [K].
- Returns:
List of PTF DESCENT data.
- Return type:
list
- create(saveToPath, DeltaTemp)[source]
Creates the BADAH PTF and saves it to the specified directory.
- Parameters:
saveToPath (str) – Path to the directory where the PTF should be stored.
DeltaTemp (float) – Deviation from ISA temperature [K].
- Returns:
None
- save2PTF(saveToPath, altitudeList, CLList, CRList, DESList, DeltaTemp, massList)[source]
Saves the BADAH performance data to a PTF format.
- Parameters:
saveToPath (str) – Path to the directory where the PTF should be stored.
CLList (list) – List of PTD data for CLIMB.
CRList (list) – List of PTD data for CRUISE.
DESList (list) – List of PTD data for DESCENT.
DeltaTemp (float) – Deviation from ISA temperature in Kelvin [K].
massList (list(float)) – List of aircraft mass levels [kg].
altitudeList – List of altitudes [ft].
- Returns:
None
- Return type:
None
This function formats and writes the climb, cruise, and descent data for different mass levels and altitudes into a .PTF file, adhering to the BADAH performance file format.
- class pyBADA.badaH.Parser[source]
Bases:
object
This class implements the BADAH parsing mechanism to parse xml BADAH files.
- static parseAll(badaVersion, filePath=None)[source]
Parses all BADAH XML-formatted files and compiles the data into a single DataFrame.
This function reads the BADAH aircraft performance model data by parsing the XML files for each aircraft model found in the specified directory. If the synonym XML file is present, it maps synonyms (alternative names for aircraft) to their respective model files and includes them in the output DataFrame.
- Parameters:
badaVersion (str) – The version of BADAH being used (e.g., ‘1.1’).
filePath (str, optional) – Optional path to the directory containing the BADAH files. If not provided, it uses the default path.
- Returns:
A pandas DataFrame containing all parsed BADAH model data, including any synonyms found.
- Return type:
pd.DataFrame
- Raises:
IOError – If an error occurs while reading or parsing the XML files.
This function first checks if a synonym XML file exists to map synonyms to model files. Then, it parses all XML files in the directory and its subfolders, merges the parsed data into a final DataFrame, and returns it.
- static parseSynonym(filePath, acName)[source]
Retrieves the file name associated with a given aircraft code from the BADAH synonym file.
- Parameters:
filePath (str) – Path to the directory containing the BADAH synonym XML file.
acName (str) – The ICAO aircraft code or name to search for in the synonym file.
- Returns:
The associated file name if found, otherwise None.
- Return type:
str
This function uses the readSynonym function to load the synonym dictionary and looks up the given aircraft code (acName) to return the associated file name. If no match is found, it returns None.
- static parseXML(filePath, acName)[source]
Parses the BADAH XML file for a specific aircraft model and extracts various parameters.
This function parses the BADAH aircraft XML file for a given aircraft model (acName). It retrieves general information about the aircraft, engine type, aerodynamic configurations, performance parameters, and more.
- Parameters:
filePath (str) – The path to the folder containing the BADAH XML file.
acName (str) – The aircraft code name for which the XML file is being parsed.
- Raises:
IOError – If the XML file cannot be found or parsed.
- Returns:
A pandas DataFrame containing the parsed data for the specified aircraft.
- Return type:
pd.DataFrame
- static readSynonym(filePath)[source]
Parses the BADAH Synonym XML file and returns a dictionary mapping aircraft code names to their respective model files.
- Parameters:
filePath (str) – Path to the directory containing the BADA4 synonym XML file.
- Returns:
A dictionary where the keys are aircraft codes and the values are associated file names.
- Return type:
dict
- Raises:
IOError – If the XML file is missing or has an invalid format.
This function attempts to read the synonym XML file, parse its contents, and store the mappings in a dictionary. The file contains aircraft code, manufacturer, ICAO designation, and file name data for each aircraft in the synonym list.