pyBADA 0.1.3__py3-none-any.whl → 0.1.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
pyBADA/bada4.py CHANGED
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  pyBADA
4
3
  Generic BADA4 aircraft performance module
@@ -13,7 +12,7 @@ import os
13
12
  from datetime import date
14
13
  import xml.etree.ElementTree as ET
15
14
 
16
- from scipy.optimize import fmin, fminbound
15
+ from scipy.optimize import fminbound
17
16
  import pandas as pd
18
17
 
19
18
  from pyBADA import constants as const
@@ -38,25 +37,28 @@ def checkArgument(argument, **kwargs):
38
37
 
39
38
 
40
39
  class Parser:
41
- """This class implements the BADA4 parsing mechanism to parse xml and GPF(xml) BADA4 files."""
40
+ """This class implements the BADA4 parsing mechanism to parse xml and
41
+ GPF(xml) BADA4 files."""
42
42
 
43
43
  def __init__(self):
44
44
  pass
45
45
 
46
46
  @staticmethod
47
47
  def readMappingFile(filePath):
48
- """
49
- Parses the BADA4 mapping XML file and stores a dictionary of aircraft code names and their corresponding XML file paths.
48
+ """Parses the BADA4 mapping XML file and stores a dictionary of
49
+ aircraft code names and their corresponding XML file paths.
50
50
 
51
- This function processes the BADA4 aircraft model mapping XML file to create a dictionary that maps the aircraft code names
52
- to the XML file paths for their corresponding BADA models. The mapping file contains information about available models
53
- for the specified BADA version.
51
+ This function processes the BADA4 aircraft model mapping XML file to
52
+ create a dictionary that maps the aircraft code names to the XML file
53
+ paths for their corresponding BADA models. The mapping file contains
54
+ information about available models for the specified BADA version.
54
55
 
55
- :param filePath: The path to the directory containing the BADA4 mapping XML file.
56
+ :param filePath: The path to the directory containing the BADA4
57
+ mapping XML file.
56
58
  :type filePath: str
57
59
  :raises IOError: If the XML file cannot be found or parsed.
58
-
59
- :return: A dictionary with aircraft code names as keys and corresponding file names as values.
60
+ :return: A dictionary with aircraft code names as keys and
61
+ corresponding file names as values.
60
62
  :rtype: dict
61
63
  """
62
64
 
@@ -68,7 +70,7 @@ class Parser:
68
70
  try:
69
71
  tree = ET.parse(filename)
70
72
  root = tree.getroot()
71
- except:
73
+ except Exception:
72
74
  raise IOError(filename + " not found or in correct format")
73
75
 
74
76
  for child in root.iter("MAP"):
@@ -81,17 +83,21 @@ class Parser:
81
83
 
82
84
  @staticmethod
83
85
  def parseMappingFile(filePath, acName):
84
- """
85
- Retrieves the file name for a given aircraft name from the parsed BADA4 mapping file.
86
+ """Retrieves the file name for a given aircraft name from the parsed
87
+ BADA4 mapping file.
86
88
 
87
- This function uses the readMappingFile method to parse the BADA4 XML mapping file and returns the file name
88
- associated with the given aircraft name (acName).
89
+ This function uses the readMappingFile method to parse the BADA4 XML
90
+ mapping file and returns the file name associated with the given
91
+ aircraft name (acName).
89
92
 
90
- :param filePath: The path to the directory containing the BADA4 mapping XML file.
91
- :param acName: The aircraft code name for which the corresponding file is being requested.
93
+ :param filePath: The path to the directory containing the BADA4
94
+ mapping XML file.
95
+ :param acName: The aircraft code name for which the corresponding file
96
+ is being requested.
92
97
  :type filePath: str
93
98
  :type acName: str
94
- :return: The file name corresponding to the aircraft code, or None if the aircraft code is not found.
99
+ :return: The file name corresponding to the aircraft code, or None if
100
+ the aircraft code is not found.
95
101
  :rtype: str or None
96
102
  """
97
103
 
@@ -104,19 +110,22 @@ class Parser:
104
110
 
105
111
  @staticmethod
106
112
  def parseXML(filePath, acName):
107
- """
108
- Parses the BADA4 XML file for a specific aircraft model and extracts various parameters.
113
+ """Parses the BADA4 XML file for a specific aircraft model and
114
+ extracts various parameters.
109
115
 
110
- This function parses the BADA4 aircraft XML file for a given aircraft model (acName). It retrieves
111
- general information about the aircraft, engine type, aerodynamic configurations, performance parameters, and more.
116
+ This function parses the BADA4 aircraft XML file for a given aircraft
117
+ model (acName). It retrieves general information about the aircraft,
118
+ engine type, aerodynamic configurations, performance parameters, and
119
+ more.
112
120
 
113
121
  :param filePath: The path to the folder containing the BADA4 XML file.
114
- :param acName: The aircraft code name for which the XML file is being parsed.
122
+ :param acName: The aircraft code name for which the XML file is being
123
+ parsed.
115
124
  :type filePath: str
116
125
  :type acName: str
117
126
  :raises IOError: If the XML file cannot be found or parsed.
118
-
119
- :return: A pandas DataFrame containing the parsed data for the specified aircraft.
127
+ :return: A pandas DataFrame containing the parsed data for the
128
+ specified aircraft.
120
129
  :rtype: pd.DataFrame
121
130
  """
122
131
 
@@ -125,7 +134,7 @@ class Parser:
125
134
  try:
126
135
  tree = ET.parse(acXmlFile)
127
136
  root = tree.getroot()
128
- except:
137
+ except Exception:
129
138
  raise IOError(acXmlFile + " not found or in correct format")
130
139
 
131
140
  # Parse general aircraft data
@@ -537,16 +546,17 @@ class Parser:
537
546
 
538
547
  @staticmethod
539
548
  def parseGPF(filePath):
540
- """
541
- Parses the BADA4 GPF XML file and extracts key performance factors.
549
+ """Parses the BADA4 GPF XML file and extracts key performance factors.
542
550
 
543
- This function processes the BADA4 GPF XML file to extract data related to various flight performance factors, such as minimum
544
- climb/descent speeds, maximum altitude limits for different phases of flight, and speed schedules for climb and descent.
551
+ This function processes the BADA4 GPF XML file to extract data related
552
+ to various flight performance factors, such as minimum climb/descent
553
+ speeds, maximum altitude limits for different phases of flight, and
554
+ speed schedules for climb and descent.
545
555
 
546
- :param filePath: The path to the directory containing the BADA4 GPF XML file.
556
+ :param filePath: The path to the directory containing the BADA4 GPF
557
+ XML file.
547
558
  :type filePath: str
548
559
  :raises IOError: If the GPF XML file cannot be found or parsed.
549
-
550
560
  :return: A pandas DataFrame containing the parsed GPF data.
551
561
  :rtype: pd.DataFrame
552
562
  """
@@ -558,7 +568,7 @@ class Parser:
558
568
  try:
559
569
  tree = ET.parse(filename)
560
570
  root = tree.getroot()
561
- except:
571
+ except Exception:
562
572
  raise IOError(filename + " not found or in correct format")
563
573
 
564
574
  CVminTO = float(root.find("CVminTO").text) # CVminTO
@@ -599,18 +609,19 @@ class Parser:
599
609
 
600
610
  @staticmethod
601
611
  def combineXML_GPF(XMLDataFrame, GPFDataframe):
602
- """
603
- Combines the parsed aircraft XML DataFrame with the parsed GPF DataFrame.
612
+ """Combines the parsed aircraft XML DataFrame with the parsed GPF
613
+ DataFrame.
604
614
 
605
- This function merges two DataFrames, one containing the parsed aircraft-specific data (from the XML file)
606
- and the other containing the parsed GPF data. This combination provides a unified set of aircraft performance
607
- data along with general performance factors.
615
+ This function merges two DataFrames, one containing the parsed
616
+ aircraft-specific data (from the XML file) and the other containing
617
+ the parsed GPF data. This combination provides a unified set of
618
+ aircraft performance data along with general performance factors.
608
619
 
609
- :param XMLDataFrame: A DataFrame containing the parsed aircraft XML data.
620
+ :param XMLDataFrame: A DataFrame containing the parsed aircraft XML
621
+ data.
610
622
  :param GPFDataframe: A DataFrame containing the parsed GPF data.
611
623
  :type XMLDataFrame: pd.DataFrame
612
624
  :type GPFDataframe: pd.DataFrame
613
-
614
625
  :return: A combined DataFrame with both aircraft and GPF data.
615
626
  :rtype: pd.DataFrame
616
627
  """
@@ -628,25 +639,28 @@ class Parser:
628
639
 
629
640
  @staticmethod
630
641
  def parseAll(badaVersion, filePath=None):
631
- """
632
- Parses all BADA4 XML files and combines the data into a single DataFrame.
642
+ """Parses all BADA4 XML files and combines the data into a single
643
+ DataFrame.
633
644
 
634
- This function parses both the BADA4 aircraft XML files and the GPF (General Performance Factors) file.
635
- It combines the data from both sources and creates a unified DataFrame that contains all aircraft and
645
+ This function parses both the BADA4 aircraft XML files and the GPF
646
+ (General Performance Factors) file. It combines the data from both
647
+ sources and creates a unified DataFrame that contains all aircraft and
636
648
  performance-related data for the specified BADA version.
637
649
 
638
650
  :param badaVersion: The version of BADA (e.g., "4.3") to be parsed.
639
- :param filePath: The path to the folder containing the BADA4 XML files and GPF file.
640
- If None, the default path from the configuration will be used.
651
+ :param filePath: The path to the folder containing the BADA4 XML files
652
+ and GPF file. If None, the default path from the configuration
653
+ will be used.
641
654
  :type badaVersion: str
642
655
  :type filePath: str, optional
643
- :raises IOError: If any of the necessary XML files cannot be found or parsed.
644
-
645
- :return: A DataFrame containing the combined data from all parsed aircraft and GPF files.
656
+ :raises IOError: If any of the necessary XML files cannot be found or
657
+ parsed.
658
+ :return: A DataFrame containing the combined data from all parsed
659
+ aircraft and GPF files.
646
660
  :rtype: pd.DataFrame
647
661
  """
648
662
 
649
- if filePath == None:
663
+ if filePath is None:
650
664
  filePath = configuration.getBadaVersionPath(
651
665
  badaFamily="BADA4", badaVersion=badaVersion
652
666
  )
@@ -730,16 +744,16 @@ class Parser:
730
744
 
731
745
 
732
746
  class BADA4(Airplane, Bada):
733
- """This class implements the part of BADA4 performance model that will be used in other classes following the BADA4 manual.
747
+ """This class implements the part of BADA4 performance model that will be
748
+ used in other classes following the BADA4 manual.
734
749
 
735
750
  :param AC: Aircraft object {BADA4}.
736
751
  :type AC: bada4Aircraft.
737
752
  """
738
753
 
739
754
  def __init__(self, AC):
740
- """
741
- Initializes the BADA4 class by inheriting from the parent Airplane class
742
- and assigns the parsed aircraft data to the class instance.
755
+ """Initializes the BADA4 class by inheriting from the parent Airplane
756
+ class and assigns the parsed aircraft data to the class instance.
743
757
 
744
758
  :param AC: Aircraft object {BADA4}.
745
759
  :type AC: bada4Aircraft.
@@ -749,19 +763,19 @@ class BADA4(Airplane, Bada):
749
763
  self.AC = AC
750
764
 
751
765
  def CL(self, delta, mass, M, nz=1.0):
752
- """
753
- Computes the aircraft's lift coefficient based on the current Mach number (M),
754
- normalized air pressure (delta), aircraft mass, and load factor (nz).
766
+ """Computes the aircraft's lift coefficient based on the current Mach
767
+ number (M), normalized air pressure (delta), aircraft mass, and load
768
+ factor (nz).
755
769
 
756
770
  :param M: Mach number [-].
757
771
  :param delta: Normalized air pressure [-].
758
772
  :param mass: Aircraft mass [kg].
759
- :param nz: Load factor [-]. Default is 1.0 (straight and level flight).
773
+ :param nz: Load factor [-]. Default is 1.0 (straight and level
774
+ flight).
760
775
  :type M: float
761
776
  :type delta: float
762
777
  :type mass: float
763
778
  :type nz: float
764
-
765
779
  :return: Lift coefficient (CL) [-].
766
780
  :rtype: float
767
781
  """
@@ -775,14 +789,14 @@ class BADA4(Airplane, Bada):
775
789
  )
776
790
 
777
791
  def CLPoly(self, M):
778
- """
779
- Computes the lift coefficient polynomial for the given Mach number (M).
792
+ """Computes the lift coefficient polynomial for the given Mach number
793
+ (M).
780
794
 
781
- This method uses a 5th-degree polynomial defined by the coefficients in the parsed aircraft data (self.AC.bf).
795
+ This method uses a 5th-degree polynomial defined by the coefficients
796
+ in the parsed aircraft data (self.AC.bf).
782
797
 
783
798
  :param M: Mach number [-].
784
799
  :type M: float
785
-
786
800
  :return: Lift coefficient (polynomial approximation) [-].
787
801
  :rtype: float
788
802
  """
@@ -794,12 +808,13 @@ class BADA4(Airplane, Bada):
794
808
  return CLpoly
795
809
 
796
810
  def CLmax(self, M, HLid, LG):
797
- """
798
- Computes the maximum lift coefficient (CLmax) for the given Mach number (M),
799
- high-lift device (HLid) position, and landing gear (LG) configuration.
811
+ """Computes the maximum lift coefficient (CLmax) for the given Mach
812
+ number (M), high-lift device (HLid) position, and landing gear (LG)
813
+ configuration.
800
814
 
801
- If the aircraft is in a clean configuration (HLid == 0 and LG == "LGUP"),
802
- the method interpolates or extrapolates the lift coefficient based on Mach number.
815
+ If the aircraft is in a clean configuration (HLid == 0 and LG ==
816
+ "LGUP"), the method interpolates or extrapolates the lift coefficient
817
+ based on Mach number.
803
818
 
804
819
  :param M: Mach number [-].
805
820
  :param HLid: High-lift device position [-].
@@ -807,7 +822,6 @@ class BADA4(Airplane, Bada):
807
822
  :type M: float
808
823
  :type HLid: float
809
824
  :type LG: str
810
-
811
825
  :return: Maximum lift coefficient (CLmax) [-].
812
826
  :rtype: float
813
827
  """
@@ -848,8 +862,8 @@ class BADA4(Airplane, Bada):
848
862
  return CLmax
849
863
 
850
864
  def CF_idle(self, delta, theta, M):
851
- """
852
- Computes the fuel flow coefficient at idle throttle for JET and TURBOPROP engines.
865
+ """Computes the fuel flow coefficient at idle throttle for JET and
866
+ TURBOPROP engines.
853
867
 
854
868
  :param delta: Normalized pressure [-].
855
869
  :param theta: Normalized temperature [-].
@@ -897,13 +911,14 @@ class BADA4(Airplane, Bada):
897
911
  return CF_idle
898
912
 
899
913
  def CF(self, delta, theta, DeltaTemp, **kwargs):
900
- """
901
- Computes the fuel flow coefficient (CF) for JET, TURBOPROP, and PISTON engines.
914
+ """Computes the fuel flow coefficient (CF) for JET, TURBOPROP, and
915
+ PISTON engines.
902
916
 
903
917
  :param delta: Normalized pressure [-].
904
918
  :param theta: Normalized temperature [-].
905
919
  :param DeltaTemp: Temperature deviation from ISA [K].
906
- :param kwargs: Optional parameters including 'rating', 'deltaT', 'CT', or 'M'.
920
+ :param kwargs: Optional parameters including 'rating', 'deltaT', 'CT',
921
+ or 'M'.
907
922
  :type delta: float
908
923
  :type theta: float
909
924
  :type DeltaTemp: float
@@ -1099,10 +1114,10 @@ class BADA4(Airplane, Bada):
1099
1114
  return CF
1100
1115
 
1101
1116
  def CT(self, delta, **kwargs):
1102
- """
1103
- Computes the thrust coefficient (CT) based on engine type, throttle setting,
1104
- or engine rating. The thrust coefficient is calculated differently for JET, TURBOPROP,
1105
- and PISTON engines based on normalized pressure, temperature, Mach number, and other inputs.
1117
+ """Computes the thrust coefficient (CT) based on engine type, throttle
1118
+ setting, or engine rating. The thrust coefficient is calculated
1119
+ differently for JET, TURBOPROP, and PISTON engines based on normalized
1120
+ pressure, temperature, Mach number, and other inputs.
1106
1121
 
1107
1122
  :param delta: Normalized pressure [-].
1108
1123
  :type delta: float
@@ -1260,8 +1275,7 @@ class BADA4(Airplane, Bada):
1260
1275
  return CT
1261
1276
 
1262
1277
  def CT_LIDL(self, **kwargs):
1263
- """
1264
- Computes the thrust coefficient (CT) for the LIDL (idle) rating.
1278
+ """Computes the thrust coefficient (CT) for the LIDL (idle) rating.
1265
1279
 
1266
1280
  :param delta: Normalized pressure [-].
1267
1281
  :param theta: Normalized temperature [-].
@@ -1336,8 +1350,8 @@ class BADA4(Airplane, Bada):
1336
1350
  return CT
1337
1351
 
1338
1352
  def CT_nonLIDL(self, theta, delta, M, **kwargs):
1339
- """
1340
- Computes the thrust coefficient (CT) for non-LIDL ratings {MCMB, MCRZ}.
1353
+ """Computes the thrust coefficient (CT) for non-LIDL ratings {MCMB,
1354
+ MCRZ}.
1341
1355
 
1342
1356
  :param delta: Normalized pressure [-].
1343
1357
  :param theta: Normalized temperature [-].
@@ -1411,8 +1425,8 @@ class BADA4(Airplane, Bada):
1411
1425
  return CT
1412
1426
 
1413
1427
  def CPmax(self, rating, delta, theta, M):
1414
- """
1415
- Computes the maximum engine power coefficient (CPmax) for TURBOPROP engines.
1428
+ """Computes the maximum engine power coefficient (CPmax) for TURBOPROP
1429
+ engines.
1416
1430
 
1417
1431
  :param rating: Throttle setting {MCMB, MCRZ}.
1418
1432
  :param delta: Normalized pressure [-].
@@ -1445,8 +1459,8 @@ class BADA4(Airplane, Bada):
1445
1459
  return CPmax
1446
1460
 
1447
1461
  def CP(self, **kwargs):
1448
- """
1449
- Computes the power coefficient (CP) for TURBOPROP and PISTON engines.
1462
+ """Computes the power coefficient (CP) for TURBOPROP and PISTON
1463
+ engines.
1450
1464
 
1451
1465
  :param rating: Throttle setting {MCMB, MCRZ, LIDL}.
1452
1466
  :param deltaT: Direct throttle parameter [-].
@@ -1573,8 +1587,8 @@ class BADA4(Airplane, Bada):
1573
1587
  return CP
1574
1588
 
1575
1589
  def CDClean(self, CL, M):
1576
- """
1577
- Computes the drag coefficient (CD) in a clean configuration based on the Mach number (M) and the lift coefficient (CL).
1590
+ """Computes the drag coefficient (CD) in a clean configuration based
1591
+ on the Mach number (M) and the lift coefficient (CL).
1578
1592
 
1579
1593
  :param M: Mach number [-].
1580
1594
  :param CL: Lift coefficient [-].
@@ -1618,23 +1632,28 @@ class BADA4(Airplane, Bada):
1618
1632
  LG,
1619
1633
  CL,
1620
1634
  M,
1635
+ expedite=False,
1621
1636
  speedBrakes={"deployed": False, "value": 0.03},
1622
1637
  **kwargs,
1623
1638
  ):
1624
- """
1625
- Computes the drag coefficient (CD) based on the Mach number (M), lift coefficient (CL), high lift devices (HLid),
1626
- landing gear position (LG), and speed brakes status. The drag coefficient is calculated for both clean and non-clean configurations.
1639
+ """Computes the drag coefficient (CD) based on the Mach number (M),
1640
+ lift coefficient (CL), high lift devices (HLid), landing gear position
1641
+ (LG), and speed brakes status. The drag coefficient is calculated for
1642
+ both clean and non-clean configurations.
1627
1643
 
1628
1644
  :param M: Mach number [-].
1629
1645
  :param CL: Lift coefficient [-].
1630
1646
  :param HLid: High lift devices position [-].
1631
1647
  :param LG: Landing gear position, [LGUP/LGDN] [-].
1632
- :param speedBrakes: Dictionary indicating if speed brakes are deployed and their value. Default: {"deployed": False, "value": 0.03}.
1648
+ :param speedBrakes: Dictionary indicating if speed brakes are deployed
1649
+ and their value. Default: {"deployed": False, "value": 0.03}.
1650
+ :param expedite: Flag indicating if expedite descent is used (default is False).
1633
1651
  :type M: float.
1634
1652
  :type CL: float.
1635
1653
  :type HLid: float.
1636
1654
  :type LG: string.
1637
1655
  :type speedBrakes: dict.
1656
+ :type expedite: bool
1638
1657
  :returns: Drag coefficient [-].
1639
1658
  :rtype: float.
1640
1659
  """
@@ -1668,6 +1687,11 @@ class BADA4(Airplane, Bada):
1668
1687
  CD = CD + 0.03
1669
1688
  return CD
1670
1689
 
1690
+ # implementation of expedite descent
1691
+ if expedite:
1692
+ CD = CD + 0.03
1693
+ return CD
1694
+
1671
1695
  # calculation of drag coefficient in transition for HLid assuming LG is not changing
1672
1696
  if "HLid_init" in kwargs and "HLid_final" in kwargs:
1673
1697
  HLid_init = checkArgument("HLid_init", **kwargs)
@@ -1731,8 +1755,8 @@ class BADA4(Airplane, Bada):
1731
1755
  return CD
1732
1756
 
1733
1757
  def L(self, delta, M, CL):
1734
- """
1735
- Computes the aerodynamic lift based on the Mach number (M), normalized air pressure (delta), and lift coefficient (CL).
1758
+ """Computes the aerodynamic lift based on the Mach number (M),
1759
+ normalized air pressure (delta), and lift coefficient (CL).
1736
1760
 
1737
1761
  :param M: Mach number [-].
1738
1762
  :param delta: Normalized air pressure [-].
@@ -1747,8 +1771,8 @@ class BADA4(Airplane, Bada):
1747
1771
  return 0.5 * delta * const.p_0 * const.Agamma * M * M * self.AC.S * CL
1748
1772
 
1749
1773
  def D(self, delta, M, CD):
1750
- """
1751
- Computes the thrust based on throttle settings, normalized air pressure (delta), and other flight parameters.
1774
+ """Computes the thrust based on throttle settings, normalized air
1775
+ pressure (delta), and other flight parameters.
1752
1776
 
1753
1777
  :param rating: Throttle setting {MCMB, MCRZ, LIDL}.
1754
1778
  :param deltaT: Direct throttle parameter [-].
@@ -1769,16 +1793,22 @@ class BADA4(Airplane, Bada):
1769
1793
  return 0.5 * delta * const.p_0 * const.Agamma * M * M * self.AC.S * CD
1770
1794
 
1771
1795
  def Thrust(self, delta, **kwargs):
1772
- """
1773
- Computes the maximum thrust produced by the aircraft based on throttle settings,
1774
- normalized air pressure (delta), and other flight parameters like Mach number and temperature deviation.
1775
-
1776
- :param rating: Throttle setting {MCMB (Max Climb), MCRZ (Max Cruise), LIDL (Idle)}.
1777
- :param deltaT: Direct throttle parameter for intermediate throttle levels [-].
1778
- :param delta: Normalized air pressure relative to sea-level pressure (ISA) [-].
1779
- :param theta: Normalized temperature relative to sea-level temperature (ISA) [-].
1780
- :param M: Mach number, the ratio of the aircraft's speed to the speed of sound [-].
1781
- :param DeltaTemp: Temperature deviation from the International Standard Atmosphere (ISA) [K].
1796
+ """Computes the maximum thrust produced by the aircraft based on
1797
+ throttle settings, normalized air pressure (delta), and other flight
1798
+ parameters like Mach number and temperature deviation.
1799
+
1800
+ :param rating: Throttle setting {MCMB (Max Climb), MCRZ (Max Cruise),
1801
+ LIDL (Idle)}.
1802
+ :param deltaT: Direct throttle parameter for intermediate throttle
1803
+ levels [-].
1804
+ :param delta: Normalized air pressure relative to sea-level pressure
1805
+ (ISA) [-].
1806
+ :param theta: Normalized temperature relative to sea-level temperature
1807
+ (ISA) [-].
1808
+ :param M: Mach number, the ratio of the aircraft's speed to the speed
1809
+ of sound [-].
1810
+ :param DeltaTemp: Temperature deviation from the International
1811
+ Standard Atmosphere (ISA) [K].
1782
1812
  :type rating: string (optional).
1783
1813
  :type deltaT: float (optional).
1784
1814
  :type delta: float.
@@ -1794,17 +1824,23 @@ class BADA4(Airplane, Bada):
1794
1824
  return delta * self.AC.WREF * CT
1795
1825
 
1796
1826
  def ff(self, delta, theta, DeltaTemp, **kwargs):
1797
- """
1798
- Computes the fuel flow (FF) of the aircraft based on engine throttle settings,
1799
- normalized air pressure (delta), normalized temperature (theta), and other relevant parameters.
1800
-
1801
- :param rating: Throttle setting {MCMB (Max Climb), MCRZ (Max Cruise), LIDL (Idle), TAXI}.
1802
- If 'TAXI' is selected, the taxi fuel allowance is used for ground operations.
1803
- :param deltaT: Direct throttle parameter for intermediate throttle levels [-].
1804
- :param delta: Normalized air pressure relative to sea-level pressure (ISA) [-].
1805
- :param theta: Normalized temperature relative to sea-level temperature (ISA) [-].
1806
- :param M: Mach number, the ratio of the aircraft's speed to the speed of sound [-].
1807
- :param DeltaTemp: Temperature deviation from the International Standard Atmosphere (ISA) [K].
1827
+ """Computes the fuel flow (FF) of the aircraft based on engine
1828
+ throttle settings, normalized air pressure (delta), normalized
1829
+ temperature (theta), and other relevant parameters.
1830
+
1831
+ :param rating: Throttle setting {MCMB (Max Climb), MCRZ (Max Cruise),
1832
+ LIDL (Idle), TAXI}. If 'TAXI' is selected, the taxi fuel allowance
1833
+ is used for ground operations.
1834
+ :param deltaT: Direct throttle parameter for intermediate throttle
1835
+ levels [-].
1836
+ :param delta: Normalized air pressure relative to sea-level pressure
1837
+ (ISA) [-].
1838
+ :param theta: Normalized temperature relative to sea-level temperature
1839
+ (ISA) [-].
1840
+ :param M: Mach number, the ratio of the aircraft's speed to the speed
1841
+ of sound [-].
1842
+ :param DeltaTemp: Temperature deviation from the International
1843
+ Standard Atmosphere (ISA) [K].
1808
1844
  :type rating: string (optional).
1809
1845
  :type deltaT: float (optional).
1810
1846
  :type delta: float.
@@ -1846,18 +1882,19 @@ class BADA4(Airplane, Bada):
1846
1882
  )
1847
1883
 
1848
1884
  def ROCD(self, T, D, v, mass, ESF, h, DeltaTemp):
1849
- """
1850
- Computes the Rate of Climb or Descent (ROCD) of the aircraft based on
1851
- the provided thrust, drag, true airspeed, mass, and Energy Share Factor (ESF).
1885
+ """Computes the Rate of Climb or Descent (ROCD) of the aircraft based
1886
+ on the provided thrust, drag, true airspeed, mass, and Energy Share
1887
+ Factor (ESF).
1852
1888
 
1853
1889
  :param T: Thrust produced by the engines [N].
1854
1890
  :param D: Drag acting on the aircraft [N].
1855
1891
  :param v: True airspeed (TAS) of the aircraft [m/s].
1856
1892
  :param mass: Current aircraft mass [kg].
1857
- :param ESF: Energy Share Factor, which controls the allocation of excess thrust
1858
- between climb/descent and acceleration [-].
1893
+ :param ESF: Energy Share Factor, which controls the allocation of
1894
+ excess thrust between climb/descent and acceleration [-].
1859
1895
  :param h: Altitude of the aircraft above sea level [m].
1860
- :param DeltaTemp: Temperature deviation from the International Standard Atmosphere (ISA) [K].
1896
+ :param DeltaTemp: Temperature deviation from the International
1897
+ Standard Atmosphere (ISA) [K].
1861
1898
  :type T: float.
1862
1899
  :type D: float.
1863
1900
  :type v: float.
@@ -1879,20 +1916,22 @@ class BADA4(Airplane, Bada):
1879
1916
  return ROCD
1880
1917
 
1881
1918
  def controlLawThrust(self, ROCD, D, v, mass, ESF, h, DeltaTemp):
1882
- """
1883
- Computes the required thrust based on the TEM (Thrust-Equilibrium Method) control law.
1884
- This calculation takes into account the aircraft's rate of climb/descent (ROCD),
1885
- drag (D), true airspeed (v), and energy share factor (ESF), along with altitude and
1886
- temperature deviations.
1919
+ """Computes the required thrust based on the TEM (Thrust-Equilibrium
1920
+ Method) control law. This calculation takes into account the
1921
+ aircraft's rate of climb/descent (ROCD), drag (D), true airspeed (v),
1922
+ and energy share factor (ESF), along with altitude and temperature
1923
+ deviations.
1887
1924
 
1888
1925
  :param h: Altitude of the aircraft above sea level [m].
1889
- :param ROCD: Rate of climb or descent of the aircraft [m/s].
1890
- Positive value for climb, negative for descent.
1926
+ :param ROCD: Rate of climb or descent of the aircraft [m/s]. Positive
1927
+ value for climb, negative for descent.
1891
1928
  :param D: Drag force acting on the aircraft [N].
1892
1929
  :param v: True airspeed (TAS) of the aircraft [m/s].
1893
1930
  :param mass: Current aircraft mass [kg].
1894
- :param ESF: Energy Share Factor, determining the fraction of excess thrust used for acceleration or climb/descent [-].
1895
- :param DeltaTemp: Temperature deviation from the International Standard Atmosphere (ISA) [K].
1931
+ :param ESF: Energy Share Factor, determining the fraction of excess
1932
+ thrust used for acceleration or climb/descent [-].
1933
+ :param DeltaTemp: Temperature deviation from the International
1934
+ Standard Atmosphere (ISA) [K].
1896
1935
  :type h: float.
1897
1936
  :type ROCD: float.
1898
1937
  :type D: float.
@@ -1900,7 +1939,8 @@ class BADA4(Airplane, Bada):
1900
1939
  :type mass: float.
1901
1940
  :type ESF: float.
1902
1941
  :type DeltaTemp: float.
1903
- :returns: Thrust required to maintain the specified rate of climb or descent [N].
1942
+ :returns: Thrust required to maintain the specified rate of climb or
1943
+ descent [N].
1904
1944
  :rtype: float.
1905
1945
  """
1906
1946
 
@@ -1919,12 +1959,13 @@ class BADA4(Airplane, Bada):
1919
1959
  return thrust
1920
1960
 
1921
1961
  def propEfficiency(self, Wp, sigma, tas):
1922
- """
1923
- Computes the propeller efficiency of a piston or turboprop engine using momentum theory.
1924
- The calculation estimates the efficiency based on power, air density, and true airspeed.
1962
+ """Computes the propeller efficiency of a piston or turboprop engine
1963
+ using momentum theory. The calculation estimates the efficiency based
1964
+ on power, air density, and true airspeed.
1925
1965
 
1926
1966
  :param Wp: Total engine power output for all engines [W].
1927
- :param sigma: Normalized air density relative to sea-level density [-].
1967
+ :param sigma: Normalized air density relative to sea-level density
1968
+ [-].
1928
1969
  :param tas: True airspeed (TAS) of the aircraft [m/s].
1929
1970
  :type Wp: float.
1930
1971
  :type sigma: float.
@@ -1963,8 +2004,8 @@ class BADA4(Airplane, Bada):
1963
2004
 
1964
2005
 
1965
2006
  class FlightEnvelope(BADA4):
1966
- """This class is a BADA4 aircraft subclass and implements the flight envelope caclulations
1967
- following the BADA4 manual.
2007
+ """This class is a BADA4 aircraft subclass and implements the flight
2008
+ envelope caclulations following the BADA4 manual.
1968
2009
 
1969
2010
  :param AC: Aircraft object {BADA4}.
1970
2011
  :type AC: bada4Aircraft.
@@ -1974,13 +2015,15 @@ class FlightEnvelope(BADA4):
1974
2015
  super().__init__(AC)
1975
2016
 
1976
2017
  def maxM(self, LG):
1977
- """
1978
- Computes the maximum allowable Mach speed (Mmax) based on the kinematic limitations
1979
- of the aircraft and the position of the landing gear (LG).
2018
+ """Computes the maximum allowable Mach speed (Mmax) based on the
2019
+ kinematic limitations of the aircraft and the position of the landing
2020
+ gear (LG).
1980
2021
 
1981
- :param LG: Landing gear position, either "LGUP" (gear up) or "LGDN" (gear down).
2022
+ :param LG: Landing gear position, either "LGUP" (gear up) or "LGDN"
2023
+ (gear down).
1982
2024
  :type LG: str
1983
- :return: The maximum allowable Mach number (Mmax) based on the aircraft's limitations.
2025
+ :return: The maximum allowable Mach number (Mmax) based on the
2026
+ aircraft's limitations.
1984
2027
  :rtype: float
1985
2028
  """
1986
2029
 
@@ -1995,16 +2038,18 @@ class FlightEnvelope(BADA4):
1995
2038
  return Mmax
1996
2039
 
1997
2040
  def maxCAS(self, HLid, LG):
1998
- """
1999
- Computes the maximum allowable Calibrated Airspeed (CASmax) based on the position of
2000
- the high-lift devices (HLid) and landing gear (LG), following the kinematic limitations
2001
- of the aircraft.
2041
+ """Computes the maximum allowable Calibrated Airspeed (CASmax) based
2042
+ on the position of the high-lift devices (HLid) and landing gear (LG),
2043
+ following the kinematic limitations of the aircraft.
2002
2044
 
2003
- :param HLid: Position of high-lift devices (0 for clean configuration, >0 for extended).
2045
+ :param HLid: Position of high-lift devices (0 for clean configuration,
2046
+ >0 for extended).
2004
2047
  :type HLid: float
2005
- :param LG: Landing gear position, either "LGUP" (gear up) or "LGDN" (gear down).
2048
+ :param LG: Landing gear position, either "LGUP" (gear up) or "LGDN"
2049
+ (gear down).
2006
2050
  :type LG: str
2007
- :return: The maximum allowable Calibrated Airspeed (CASmax) in meters per second [m/s].
2051
+ :return: The maximum allowable Calibrated Airspeed (CASmax) in meters
2052
+ per second [m/s].
2008
2053
  :rtype: float
2009
2054
  """
2010
2055
 
@@ -2032,12 +2077,12 @@ class FlightEnvelope(BADA4):
2032
2077
  return CASmax
2033
2078
 
2034
2079
  def VMax(self, h, HLid, LG, delta, theta, mass, nz=1.0):
2035
- """
2036
- Computes the maximum speed (CAS)
2080
+ """Computes the maximum speed (CAS)
2037
2081
 
2038
2082
  :param h: Altitude in meters [m].
2039
2083
  :param HLid: High-lift devices position [-].
2040
- :param LG: Landing gear position, either "LGUP" (gear up) or "LGDN" (gear down) [-].
2084
+ :param LG: Landing gear position, either "LGUP" (gear up) or "LGDN"
2085
+ (gear down) [-].
2041
2086
  :param theta: Normalized temperature [-].
2042
2087
  :param delta: Normalized pressure [-].
2043
2088
  :param mass: Aircraft mass in kilograms [kg].
@@ -2049,7 +2094,8 @@ class FlightEnvelope(BADA4):
2049
2094
  :type delta: float.
2050
2095
  :type mass: float.
2051
2096
  :type nz: float.
2052
- :return: Maximum allowable calibrated airspeed (CAS) in meters per second [m/s].
2097
+ :return: Maximum allowable calibrated airspeed (CAS) in meters per
2098
+ second [m/s].
2053
2099
  :rtype: float.
2054
2100
  """
2055
2101
 
@@ -2085,21 +2131,24 @@ class FlightEnvelope(BADA4):
2085
2131
  return VMax
2086
2132
 
2087
2133
  def Vmax_thrustLimited(self, h, mass, DeltaTemp, rating, config):
2088
- """
2089
- Computes the maximum speed (CAS) within the certified flight envelope while accounting
2090
- for thrust limitations at a given altitude, temperature deviation, and configuration.
2134
+ """Computes the maximum speed (CAS) within the certified flight
2135
+ envelope while accounting for thrust limitations at a given altitude,
2136
+ temperature deviation, and configuration.
2091
2137
 
2092
2138
  :param h: Altitude in meters [m].
2093
2139
  :param mass: Aircraft mass in kilograms [kg].
2094
2140
  :param DeltaTemp: Deviation from ISA temperature in Kelvin [K].
2095
- :param rating: Engine rating, options include "MTKF", "MCMB", "MCRZ" [-].
2096
- :param config: Aircraft aerodynamic configuration, such as "TO", "IC", "CR" [-].
2141
+ :param rating: Engine rating, options include "MTKF", "MCMB", "MCRZ"
2142
+ [-].
2143
+ :param config: Aircraft aerodynamic configuration, such as "TO", "IC",
2144
+ "CR" [-].
2097
2145
  :type h: float.
2098
2146
  :type mass: float.
2099
2147
  :type DeltaTemp: float.
2100
2148
  :type rating: str.
2101
2149
  :type config: str.
2102
- :return: Maximum thrust-limited calibrated airspeed (CAS) in meters per second [m/s].
2150
+ :return: Maximum thrust-limited calibrated airspeed (CAS) in meters
2151
+ per second [m/s].
2103
2152
  :rtype: float.
2104
2153
  """
2105
2154
 
@@ -2151,13 +2200,13 @@ class FlightEnvelope(BADA4):
2151
2200
  return max(maxCASList)
2152
2201
 
2153
2202
  def maxMbuffet(self, HLid, LG, delta, mass, nz=1.0):
2154
- """
2155
- Computes the maximum allowable Mach number (M) under buffet limitations, where the lift
2156
- coefficient (CL) cannot exceed the maximum lift coefficient (CL_max) for the given Mach
2157
- number and configuration.
2203
+ """Computes the maximum allowable Mach number (M) under buffet
2204
+ limitations, where the lift coefficient (CL) cannot exceed the maximum
2205
+ lift coefficient (CL_max) for the given Mach number and configuration.
2158
2206
 
2159
2207
  :param HLid: High-lift devices position [-].
2160
- :param LG: Landing gear position, either "LGUP" (gear up) or "LGDN" (gear down) [-].
2208
+ :param LG: Landing gear position, either "LGUP" (gear up) or "LGDN"
2209
+ (gear down) [-].
2161
2210
  :param delta: Normalized pressure [-].
2162
2211
  :param mass: Aircraft mass in kilograms [kg].
2163
2212
  :param nz: Load factor [-], default is 1.0.
@@ -2166,7 +2215,8 @@ class FlightEnvelope(BADA4):
2166
2215
  :type delta: float.
2167
2216
  :type mass: float.
2168
2217
  :type nz: float.
2169
- :return: Maximum allowable Mach number (M) limited by buffet conditions.
2218
+ :return: Maximum allowable Mach number (M) limited by buffet
2219
+ conditions.
2170
2220
  :rtype: float.
2171
2221
  """
2172
2222
 
@@ -2194,12 +2244,14 @@ class FlightEnvelope(BADA4):
2194
2244
  return self.AC.MMO
2195
2245
 
2196
2246
  def minMbuffet(self, HLid, LG, theta, delta, mass, nz=1.0):
2197
- """
2198
- Computes the minimum Mach number (M) applying buffet limitations, where the lift coefficient (CL)
2199
- must not exceed the maximum lift coefficient (CL_max) for the given Mach number and aerodynamic configuration.
2247
+ """Computes the minimum Mach number (M) applying buffet limitations,
2248
+ where the lift coefficient (CL) must not exceed the maximum lift
2249
+ coefficient (CL_max) for the given Mach number and aerodynamic
2250
+ configuration.
2200
2251
 
2201
2252
  :param HLid: High-lift devices position [-].
2202
- :param LG: Landing gear position, either "LGUP" (gear up) or "LGDN" (gear down) [-].
2253
+ :param LG: Landing gear position, either "LGUP" (gear up) or "LGDN"
2254
+ (gear down) [-].
2203
2255
  :param delta: Normalized pressure [-].
2204
2256
  :param theta: Normalized temperature [-].
2205
2257
  :param mass: Aircraft mass in kilograms [kg].
@@ -2256,11 +2308,12 @@ class FlightEnvelope(BADA4):
2256
2308
  M = M_list[idx]
2257
2309
 
2258
2310
  def VMin(self, config, theta, delta, mass):
2259
- """
2260
- Computes the minimum speed (CAS) for the given aerodynamic configuration, accounting for
2261
- stall speed and other configuration-based limitations.
2311
+ """Computes the minimum speed (CAS) for the given aerodynamic
2312
+ configuration, accounting for stall speed and other configuration-
2313
+ based limitations.
2262
2314
 
2263
- :param config: Aircraft configuration, options include "CR", "IC", "TO", "AP", "LD" [-].
2315
+ :param config: Aircraft configuration, options include "CR", "IC",
2316
+ "TO", "AP", "LD" [-].
2264
2317
  :param delta: Normalized pressure [-].
2265
2318
  :param theta: Normalized temperature [-].
2266
2319
  :param mass: Aircraft mass in kilograms [kg].
@@ -2268,7 +2321,8 @@ class FlightEnvelope(BADA4):
2268
2321
  :type delta: float.
2269
2322
  :type theta: float.
2270
2323
  :type mass: float.
2271
- :returns: Minimum calibrated airspeed (CAS) in meters per second [m/s].
2324
+ :returns: Minimum calibrated airspeed (CAS) in meters per second
2325
+ [m/s].
2272
2326
  :rtype: float.
2273
2327
  """
2274
2328
 
@@ -2303,12 +2357,13 @@ class FlightEnvelope(BADA4):
2303
2357
  return Vmin
2304
2358
 
2305
2359
  def VStall(self, mass, HLid, LG, nz=1.0, **kwargs):
2306
- """
2307
- Calculates the stall speed (CAS) for the given aerodynamic configuration and load factor,
2308
- taking into account altitude and temperature deviations from ISA.
2360
+ """Calculates the stall speed (CAS) for the given aerodynamic
2361
+ configuration and load factor, taking into account altitude and
2362
+ temperature deviations from ISA.
2309
2363
 
2310
2364
  :param HLid: High-lift devices position [-].
2311
- :param LG: Landing gear position, either "LGUP" (gear up) or "LGDN" (gear down) [-].
2365
+ :param LG: Landing gear position, either "LGUP" (gear up) or "LGDN"
2366
+ (gear down) [-].
2312
2367
  :param delta: Normalized pressure [-].
2313
2368
  :param theta: Normalized temperature [-].
2314
2369
  :param mass: Aircraft mass in kilograms [kg].
@@ -2348,13 +2403,70 @@ class FlightEnvelope(BADA4):
2348
2403
 
2349
2404
  return minCAS
2350
2405
 
2351
- def maxAltitude(self, HLid, LG, M, DeltaTemp, mass, nz=1.0):
2406
+ def Vx(self, h, mass, DeltaTemp, rating, HLid, LG):
2407
+ """Computes the best angle of climb (Vx) speed.
2408
+
2409
+ :param h: Altitude in meters [m].
2410
+ :param mass: Aircraft mass in kilograms [kg].
2411
+ :param DeltaTemp: Deviation from ISA temperature in Kelvin [K].
2412
+ :param rating: Aircraft engine rating (e.g., 'MTKF', 'MCMB', 'MCRZ').
2413
+ :param HLid: High-lift device configuration identifier.
2414
+ :param LG: Landing gear configuration identifier.
2415
+ :type h: float
2416
+ :type mass: float
2417
+ :type DeltaTemp: float
2418
+ :type rating: str
2419
+ :type HLid: str
2420
+ :type LG: str
2421
+ :returns: Best angle of climb speed (Vx) in meters per second [m/s].
2422
+ :rtype: float
2352
2423
  """
2353
- Computes the maximum altitude taking into account buffet limitations. The altitude is calculated
2354
- based on the aerodynamic configuration and the available buffet boundary conditions.
2424
+
2425
+ [theta, delta, sigma] = atm.atmosphereProperties(
2426
+ h=h, DeltaTemp=DeltaTemp
2427
+ )
2428
+
2429
+ VmaxCertified = self.VMax(
2430
+ h=h, delta=delta, theta=theta, HLid=HLid, LG=LG, mass=mass, nz=1.0
2431
+ )
2432
+ VminCertified = self.VStall(
2433
+ delta=delta, theta=theta, mass=mass, HLid=HLid, LG=LG, nz=1.0
2434
+ )
2435
+
2436
+ excessThrustList = []
2437
+ VxList = []
2438
+
2439
+ for CAS in np.linspace(
2440
+ VminCertified, VmaxCertified, num=200, endpoint=True
2441
+ ):
2442
+ M = atm.cas2Mach(cas=CAS, theta=theta, delta=delta, sigma=sigma)
2443
+
2444
+ maxThrust = self.Thrust(
2445
+ rating=rating,
2446
+ delta=delta,
2447
+ theta=theta,
2448
+ M=M,
2449
+ DeltaTemp=DeltaTemp,
2450
+ )
2451
+ CL = self.CL(M=M, delta=delta, mass=mass, nz=1.0)
2452
+ CD = self.CD(M=M, CL=CL, HLid=HLid, LG=LG)
2453
+ Drag = self.D(M=M, delta=delta, CD=CD)
2454
+
2455
+ excessThrustList.append(maxThrust - Drag)
2456
+ VxList.append(CAS)
2457
+
2458
+ idx = excessThrustList.index(max(excessThrustList))
2459
+
2460
+ return VxList[idx]
2461
+
2462
+ def maxAltitude(self, HLid, LG, M, DeltaTemp, mass, nz=1.0):
2463
+ """Computes the maximum altitude taking into account buffet
2464
+ limitations. The altitude is calculated based on the aerodynamic
2465
+ configuration and the available buffet boundary conditions.
2355
2466
 
2356
2467
  :param HLid: High-lift devices position [-].
2357
- :param LG: Landing gear position, either "LGUP" (gear up) or "LGDN" (gear down) [-].
2468
+ :param LG: Landing gear position, either "LGUP" (gear up) or "LGDN"
2469
+ (gear down) [-].
2358
2470
  :param M: Mach airspeed [-].
2359
2471
  :param mass: Aircraft mass [kg].
2360
2472
  :param nz: Load factor [-], default is 1.0.
@@ -2397,22 +2509,25 @@ class FlightEnvelope(BADA4):
2397
2509
  return hMax
2398
2510
 
2399
2511
  def getConfig(self, phase, h, mass, v, DeltaTemp=0.0, hRWY=0.0):
2400
- """
2401
- Returns the aircraft's aerodynamic configuration based on altitude, speed, and phase of flight.
2512
+ """Returns the aircraft's aerodynamic configuration based on altitude,
2513
+ speed, and phase of flight.
2402
2514
 
2403
2515
  :param phase: Phase of flight [Climb, Cruise, Descent] [-].
2404
2516
  :param h: Altitude above mean sea level (AMSL) [m].
2405
2517
  :param mass: Aircraft mass [kg].
2406
2518
  :param v: Calibrated airspeed (CAS) [m/s].
2407
- :param DeltaTemp: Deviation from ISA temperature [K], default is 0.0.
2408
- :param hRWY: Runway elevation above mean sea level (AMSL) [m], default is 0.0.
2519
+ :param DeltaTemp: Deviation from ISA temperature [K], default is
2520
+ 0.0.
2521
+ :param hRWY: Runway elevation above mean sea level (AMSL) [m],
2522
+ default is 0.0.
2409
2523
  :type phase: str.
2410
2524
  :type h: float.
2411
2525
  :type mass: float.
2412
2526
  :type v: float.
2413
2527
  :type DeltaTemp: float.
2414
2528
  :type hRWY: float.
2415
- :returns: Aircraft aerodynamic configuration [TO/IC/CR/AP/LD] [-].
2529
+ :returns: Aircraft aerodynamic configuration [TO/IC/CR/AP/LD]
2530
+ [-].
2416
2531
  :rtype: str.
2417
2532
  :raises: TypeError if unable to determine the configuration.
2418
2533
  """
@@ -2489,10 +2604,10 @@ class FlightEnvelope(BADA4):
2489
2604
  return config
2490
2605
 
2491
2606
  def getAeroConfig(self, config):
2492
- """
2493
- Returns the aircraft aerodynamic configuration based on the provided configuration ID.
2494
- This includes the high-lift device (HLID) position and landing gear (LG) position.
2495
- If the configuration is not found, it returns None.
2607
+ """Returns the aircraft aerodynamic configuration based on the
2608
+ provided configuration ID. This includes the high-lift device (HLID)
2609
+ position and landing gear (LG) position. If the configuration is not
2610
+ found, it returns None.
2496
2611
 
2497
2612
  :param config: Aircraft configuration (TO/IC/CR/AP/LD).
2498
2613
  :type config: str
@@ -2505,13 +2620,14 @@ class FlightEnvelope(BADA4):
2505
2620
  return [configDict["HLid"], configDict["LG"]]
2506
2621
 
2507
2622
  def getSpeedSchedule(self, phase):
2508
- """
2509
- Returns the speed schedule based on the phase of flight (Climb, Cruise, Descent).
2510
- The schedule includes two CAS values (CAS1, CAS2) and a Mach number (M).
2623
+ """Returns the speed schedule based on the phase of flight (Climb,
2624
+ Cruise, Descent). The schedule includes two CAS values (CAS1, CAS2)
2625
+ and a Mach number (M).
2511
2626
 
2512
2627
  :param phase: Aircraft phase of flight (Climb, Cruise, Descent).
2513
2628
  :type phase: str
2514
- :returns: Speed schedule as a combination of CAS1, CAS2 (in m/s) and Mach number (M).
2629
+ :returns: Speed schedule as a combination of CAS1, CAS2 (in m/s) and
2630
+ Mach number (M).
2515
2631
  :rtype: [float, float, float]
2516
2632
  """
2517
2633
 
@@ -2526,10 +2642,10 @@ class FlightEnvelope(BADA4):
2526
2642
  def checkConfigurationContinuity(
2527
2643
  self, phase, previousConfig, currentConfig
2528
2644
  ):
2529
- """
2530
- Ensures the continuity of the aerodynamic configuration changes based on the phase of flight.
2531
- It prevents sudden or improper configuration transitions, ensuring the aerodynamic configuration
2532
- does not change in the wrong direction during Climb, Cruise, or Descent.
2645
+ """Ensures the continuity of the aerodynamic configuration changes
2646
+ based on the phase of flight. It prevents sudden or improper
2647
+ configuration transitions, ensuring the aerodynamic configuration does
2648
+ not change in the wrong direction during Climb, Cruise, or Descent.
2533
2649
 
2534
2650
  :param phase: Aircraft phase of flight (Climb, Cruise, Descent).
2535
2651
  :param previousConfig: Previous aerodynamic configuration.
@@ -2576,8 +2692,8 @@ class FlightEnvelope(BADA4):
2576
2692
 
2577
2693
 
2578
2694
  class ARPM(BADA4):
2579
- """This class is a BADA4 aircraft subclass and implements the Airline Procedure Model (ARPM)
2580
- following the BADA4 user manual.
2695
+ """This class is a BADA4 aircraft subclass and implements the Airline
2696
+ Procedure Model (ARPM) following the BADA4 user manual.
2581
2697
 
2582
2698
  :param AC: Aircraft object {BADA4}.
2583
2699
  :type AC: bada4Aircraft.
@@ -2602,8 +2718,8 @@ class ARPM(BADA4):
2602
2718
  NADP2_ALT=[1000, 3000],
2603
2719
  DeltaTemp=0.0,
2604
2720
  ):
2605
- """
2606
- Computes the climb speed schedule (CAS) for the given altitude based on various procedures and aircraft parameters.
2721
+ """Computes the climb speed schedule (CAS) for the given altitude
2722
+ based on various procedures and aircraft parameters.
2607
2723
 
2608
2724
  :param theta: Normalized air temperature [-].
2609
2725
  :param delta: Normalized air pressure [-].
@@ -2927,16 +3043,19 @@ class ARPM(BADA4):
2927
3043
  config=None,
2928
3044
  DeltaTemp=0.0,
2929
3045
  ):
2930
- """
2931
- Computes the cruise speed schedule (CAS) for the given altitude based on various aircraft parameters.
3046
+ """Computes the cruise speed schedule (CAS) for the given altitude
3047
+ based on various aircraft parameters.
2932
3048
 
2933
3049
  :param theta: Normalized air temperature [-].
2934
3050
  :param delta: Normalized air pressure [-].
2935
3051
  :param mass: Aircraft mass in kilograms [kg].
2936
3052
  :param h: Altitude in meters [m].
2937
3053
  :param hRWY: Runway elevation AMSL in meters [m].
2938
- :param speedSchedule_default: Optional, a default speed schedule that overrides the BADA schedule. It should be in the form [Vcr1, Vcr2, Mcr].
2939
- :param config: Optional, current aircraft aerodynamic configuration (TO/IC/CR/AP/LD).
3054
+ :param speedSchedule_default: Optional, a default speed schedule
3055
+ that overrides the BADA schedule. It should be in the form
3056
+ [Vcr1, Vcr2, Mcr].
3057
+ :param config: Optional, current aircraft aerodynamic
3058
+ configuration (TO/IC/CR/AP/LD).
2940
3059
  :param DeltaTemp: Deviation from ISA temperature in Kelvin [K].
2941
3060
  :type theta: float
2942
3061
  :type delta: float
@@ -2946,18 +3065,22 @@ class ARPM(BADA4):
2946
3065
  :type speedSchedule_default: list[float], optional
2947
3066
  :type config: str, optional
2948
3067
  :type DeltaTemp: float, optional
2949
- :returns: A tuple containing the cruise calibrated airspeed (CAS) in meters per second [m/s] and a status flag indicating whether the calculated CAS is constrained ('C'), unconstrained ('V' or 'v'), or not altered ('').
2950
- :rtype: tuple[float, str]
2951
-
2952
- This function computes the cruise speed schedule for different phases of flight and aircraft types. It uses either the default
2953
- speed schedule or the BADA speed schedule based on the aircraft model and altitude.
2954
-
2955
- The cruise speed schedule varies depending on the altitude and type of engine (JET, TURBOPROP, or PISTON).
2956
-
2957
- The function also applies speed limits based on the aircraft's flight envelope, ensuring the calculated cruise speed remains within
2958
- the aircraft's minimum and maximum allowable speeds.
2959
-
2960
- The function ensures the calculated CAS remains within the aircraft's operational speed limits, adjusting the speed if necessary.
3068
+ :returns: A tuple containing the cruise calibrated airspeed
3069
+ (CAS) in meters per second [m/s] and a status flag
3070
+ indicating whether the calculated CAS is constrained ('C'),
3071
+ unconstrained ('V' or 'v'), or not altered ('').
3072
+ :rtype: tuple[float, str] This function computes the cruise
3073
+ speed schedule for different phases of flight and aircraft
3074
+ types. It uses either the default speed schedule or the BADA
3075
+ speed schedule based on the aircraft model and altitude.
3076
+ The cruise speed schedule varies depending on the altitude
3077
+ and type of engine (JET, TURBOPROP, or PISTON). The
3078
+ function also applies speed limits based on the aircraft's
3079
+ flight envelope, ensuring the calculated cruise speed
3080
+ remains within the aircraft's minimum and maximum allowable
3081
+ speeds. The function ensures the calculated CAS remains
3082
+ within the aircraft's operational speed limits, adjusting
3083
+ the speed if necessary.
2961
3084
  """
2962
3085
 
2963
3086
  phase = "Cruise"
@@ -3053,16 +3176,19 @@ class ARPM(BADA4):
3053
3176
  config=None,
3054
3177
  DeltaTemp=0.0,
3055
3178
  ):
3056
- """
3057
- Computes the descent speed schedule (CAS) for the given altitude based on various aircraft parameters.
3179
+ """Computes the descent speed schedule (CAS) for the given altitude
3180
+ based on various aircraft parameters.
3058
3181
 
3059
3182
  :param theta: Normalized air temperature [-].
3060
3183
  :param delta: Normalized air pressure [-].
3061
3184
  :param mass: Aircraft mass in kilograms [kg].
3062
3185
  :param h: Altitude in meters [m].
3063
3186
  :param hRWY: Runway elevation AMSL in meters [m].
3064
- :param speedSchedule_default: Optional, a default speed schedule that overrides the BADA schedule. It should be in the form [Vdes1, Vdes2, Mdes].
3065
- :param config: Optional, current aircraft aerodynamic configuration (TO/IC/CR/AP/LD).
3187
+ :param speedSchedule_default: Optional, a default speed schedule
3188
+ that overrides the BADA schedule. It should be in the form
3189
+ [Vdes1, Vdes2, Mdes].
3190
+ :param config: Optional, current aircraft aerodynamic
3191
+ configuration (TO/IC/CR/AP/LD).
3066
3192
  :param DeltaTemp: Deviation from ISA temperature in Kelvin [K].
3067
3193
  :type theta: float
3068
3194
  :type delta: float
@@ -3072,15 +3198,19 @@ class ARPM(BADA4):
3072
3198
  :type speedSchedule_default: list[float], optional
3073
3199
  :type config: str, optional
3074
3200
  :type DeltaTemp: float, optional
3075
- :returns: A tuple containing the descent calibrated airspeed (CAS) in meters per second [m/s] and a status flag indicating whether the calculated CAS is constrained ('C'), unconstrained ('V' or 'v'), or not altered ('').
3076
- :rtype: tuple[float, str]
3077
-
3078
- This function computes the descent speed schedule for different phases of flight and aircraft types.
3079
- It uses either the default speed schedule or the BADA speed schedule based on the aircraft model and altitude.
3080
-
3081
- The descent speed schedule varies depending on the altitude and type of engine (JET, TURBOPROP, or PISTON).
3082
-
3083
- The function ensures the calculated CAS remains within the aircraft's operational speed limits, adjusting the speed if necessary.
3201
+ :returns: A tuple containing the descent calibrated airspeed
3202
+ (CAS) in meters per second [m/s] and a status flag
3203
+ indicating whether the calculated CAS is constrained ('C'),
3204
+ unconstrained ('V' or 'v'), or not altered ('').
3205
+ :rtype: tuple[float, str] This function computes the descent
3206
+ speed schedule for different phases of flight and aircraft
3207
+ types. It uses either the default speed schedule or the BADA
3208
+ speed schedule based on the aircraft model and altitude.
3209
+ The descent speed schedule varies depending on the altitude
3210
+ and type of engine (JET, TURBOPROP, or PISTON). The
3211
+ function ensures the calculated CAS remains within the
3212
+ aircraft's operational speed limits, adjusting the speed if
3213
+ necessary.
3084
3214
  """
3085
3215
 
3086
3216
  # aircraft AGL altitude assuming being close to the RWY [m]
@@ -3226,7 +3356,8 @@ class ARPM(BADA4):
3226
3356
 
3227
3357
 
3228
3358
  class Optimization(BADA4):
3229
- """This class implements the BADA4 optimization following the BADA4 manual.
3359
+ """This class implements the BADA4 optimization following the BADA4
3360
+ manual.
3230
3361
 
3231
3362
  :param AC: Aircraft object {BADA4}.
3232
3363
  :type AC: bada4Aircraft.
@@ -3237,8 +3368,7 @@ class Optimization(BADA4):
3237
3368
  self.flightEnvelope = FlightEnvelope(AC)
3238
3369
 
3239
3370
  def CCI(self, theta, delta, cI):
3240
- """
3241
- Computes the cost index coefficient for given flight conditions.
3371
+ """Computes the cost index coefficient for given flight conditions.
3242
3372
 
3243
3373
  :param cI: Cost index in kilograms per minute [kg min^-1].
3244
3374
  :param delta: Normalized pressure [-].
@@ -3270,42 +3400,38 @@ class Optimization(BADA4):
3270
3400
  )
3271
3401
 
3272
3402
  def CW(self, mass, delta):
3273
- """
3274
- Computes the weight coefficient at a given mass and pressure.
3403
+ """Computes the weight coefficient at a given mass and pressure.
3275
3404
 
3276
3405
  :param mass: Aircraft mass in kilograms [kg].
3277
3406
  :param delta: Normalized pressure [-].
3278
3407
  :type mass: float
3279
3408
  :type delta: float
3280
3409
  :returns: Weight coefficient [-].
3281
- :rtype: float
3282
-
3283
- The weight coefficient is used to represent the aircraft's weight relative to its maximum takeoff weight (MTOW)
3284
- under given atmospheric conditions.
3410
+ :rtype: float The weight coefficient is used to represent the
3411
+ aircraft's weight relative to its maximum takeoff weight (MTOW)
3412
+ under given atmospheric conditions.
3285
3413
  """
3286
3414
 
3287
3415
  return mass * const.g / (self.AC.MTOW * delta * const.g)
3288
3416
 
3289
3417
  def SR(self, M, CF):
3290
- """
3291
- Computes the specific range (SR) for given flight conditions.
3418
+ """Computes the specific range (SR) for given flight conditions.
3292
3419
 
3293
3420
  :param M: Mach ground speed [-].
3294
3421
  :param CF: Fuel coefficient [-].
3295
3422
  :type M: float
3296
3423
  :type CF: float
3297
3424
  :returns: Specific range in nautical miles per kilogram [NM kg^-1].
3298
- :rtype: float
3299
-
3300
- Specific range is a measure of the distance that can be flown per unit of fuel mass.
3301
- It is calculated as the ratio of Mach number to fuel flow coefficient.
3425
+ :rtype: float Specific range is a measure of the distance that can be
3426
+ flown per unit of fuel mass. It is calculated as the ratio of Mach
3427
+ number to fuel flow coefficient.
3302
3428
  """
3303
3429
 
3304
3430
  return M / CF
3305
3431
 
3306
3432
  def econMach(self, theta, delta, mass, DeltaTemp, cI, wS):
3307
- """
3308
- Computes the economic Mach number for a given flight condition and cost index.
3433
+ """Computes the economic Mach number for a given flight condition and
3434
+ cost index.
3309
3435
 
3310
3436
  :param delta: Normalized pressure [-].
3311
3437
  :param theta: Normalized temperature [-].
@@ -3407,8 +3533,8 @@ class Optimization(BADA4):
3407
3533
  # return float(econ.x)
3408
3534
 
3409
3535
  def MRC(self, theta, delta, mass, DeltaTemp, wS):
3410
- """
3411
- Computes the Mach number representing Maximum Range Cruise (MRC) for the given flight conditions.
3536
+ """Computes the Mach number representing Maximum Range Cruise (MRC)
3537
+ for the given flight conditions.
3412
3538
 
3413
3539
  :param theta: Normalized air temperature [-].
3414
3540
  :param delta: Normalized air pressure [-].
@@ -3445,8 +3571,8 @@ class Optimization(BADA4):
3445
3571
  return mrcM
3446
3572
 
3447
3573
  def LRC(self, theta, delta, mass, DeltaTemp, wS):
3448
- """
3449
- Computes the Mach number representing Long Range Cruise (LRC) for the given flight conditions.
3574
+ """Computes the Mach number representing Long Range Cruise (LRC) for
3575
+ the given flight conditions.
3450
3576
 
3451
3577
  :param theta: Normalized air temperature [-].
3452
3578
  :param delta: Normalized air pressure [-].
@@ -3459,13 +3585,12 @@ class Optimization(BADA4):
3459
3585
  :type DeltaTemp: float
3460
3586
  :type wS: float
3461
3587
  :returns: Long Range Cruise (LRC) Mach number [-].
3462
- :rtype: float
3463
-
3464
- The Long Range Cruise (LRC) is defined as the speed where fuel efficiency is 99% of the Maximum Range Cruise (MRC).
3465
- This function calculates the LRC based on the MRC and iterates through possible Mach numbers to find the one that
3466
- minimizes the difference between the specific range (SR) at LRC and 99% of the SR at MRC.
3467
-
3468
- If no valid LRC is found, it returns NaN.
3588
+ :rtype: float The Long Range Cruise (LRC) is defined as the speed
3589
+ where fuel efficiency is 99% of the Maximum Range Cruise (MRC).
3590
+ This function calculates the LRC based on the MRC and iterates
3591
+ through possible Mach numbers to find the one that minimizes the
3592
+ difference between the specific range (SR) at LRC and 99% of the
3593
+ SR at MRC. If no valid LRC is found, it returns NaN.
3469
3594
  """
3470
3595
 
3471
3596
  Mws = atm.tas2Mach(v=wS, theta=theta)
@@ -3560,8 +3685,8 @@ class Optimization(BADA4):
3560
3685
  # return minimum
3561
3686
 
3562
3687
  def MEC(self, theta, delta, mass, DeltaTemp, wS):
3563
- """
3564
- Computes the Mach number representing Maximum Endurance Cruise (MEC) for given flight conditions.
3688
+ """Computes the Mach number representing Maximum Endurance Cruise
3689
+ (MEC) for given flight conditions.
3565
3690
 
3566
3691
  :param delta: Normalized pressure [-].
3567
3692
  :param theta: Normalized temperature [-].
@@ -3574,14 +3699,13 @@ class Optimization(BADA4):
3574
3699
  :type DeltaTemp: float
3575
3700
  :type wS: float
3576
3701
  :returns: Maximum Endurance Cruise (MEC) in Mach [-].
3577
- :rtype: float
3578
-
3579
- The Maximum Endurance Cruise (MEC) Mach is the Mach number that minimizes the fuel consumption rate,
3580
- maximizing the endurance of the flight. This function iterates over a range of possible Mach numbers
3581
- within the flight envelope and returns the Mach number with the lowest fuel coefficient (CF).
3582
-
3583
- The calculation is subject to thrust limitations, and the function ensures that the resulting Mach
3584
- does not exceed the maximum thrust available.
3702
+ :rtype: float The Maximum Endurance Cruise (MEC) Mach is the Mach
3703
+ number that minimizes the fuel consumption rate, maximizing the
3704
+ endurance of the flight. This function iterates over a range of
3705
+ possible Mach numbers within the flight envelope and returns the
3706
+ Mach number with the lowest fuel coefficient (CF). The calculation
3707
+ is subject to thrust limitations, and the function ensures that
3708
+ the resulting Mach does not exceed the maximum thrust available.
3585
3709
  """
3586
3710
 
3587
3711
  # clean configuration during CR
@@ -3653,8 +3777,8 @@ class Optimization(BADA4):
3653
3777
  # return float(mecM.x)
3654
3778
 
3655
3779
  def optAltitude(self, M, mass, DeltaTemp):
3656
- """
3657
- Computes the optimum altitude for a given flight condition and Mach number.
3780
+ """Computes the optimum altitude for a given flight condition and Mach
3781
+ number.
3658
3782
 
3659
3783
  :param M: Mach number [-].
3660
3784
  :param mass: Aircraft mass in kilograms [kg].
@@ -3663,13 +3787,12 @@ class Optimization(BADA4):
3663
3787
  :type mass: float
3664
3788
  :type DeltaTemp: float
3665
3789
  :returns: Optimum altitude in feet [ft].
3666
- :rtype: float
3667
-
3668
- The optimum altitude is the altitude where the aircraft achieves the maximum efficiency for a given
3669
- Mach number and mass, subject to thrust and buffet limitations. The function iterates over a range
3670
- of altitudes and returns the one with the best fuel efficiency.
3671
-
3672
- The function also ensures that the optimum altitude is bounded by a minimum of 2000 feet.
3790
+ :rtype: float The optimum altitude is the altitude where the aircraft
3791
+ achieves the maximum efficiency for a given Mach number and mass,
3792
+ subject to thrust and buffet limitations. The function iterates
3793
+ over a range of altitudes and returns the one with the best fuel
3794
+ efficiency. The function also ensures that the optimum altitude is
3795
+ bounded by a minimum of 2000 feet.
3673
3796
  """
3674
3797
 
3675
3798
  # clean configuration during CR
@@ -3783,11 +3906,12 @@ class Optimization(BADA4):
3783
3906
  # return optAlt
3784
3907
 
3785
3908
  def getOPTParam(self, optParam, var_1, var_2=None):
3786
- """
3787
- Returns the value of an optimization (OPT) parameter from a BADA4 OPT file for various flight conditions.
3788
- The OPT file contains values for parameters like Long Range Cruise (LRC), Maximum Endurance Cruise (MEC),
3789
- Maximum Range Cruise (MRC), ECON speed, or OPTALT altitude, and this function interpolates the appropriate
3790
- value based on input variables.
3909
+ """Returns the value of an optimization (OPT) parameter from a BADA4
3910
+ OPT file for various flight conditions. The OPT file contains values
3911
+ for parameters like Long Range Cruise (LRC), Maximum Endurance Cruise
3912
+ (MEC), Maximum Range Cruise (MRC), ECON speed, or OPTALT altitude, and
3913
+ this function interpolates the appropriate value based on input
3914
+ variables.
3791
3915
 
3792
3916
  Note:
3793
3917
  The array used in this function is expected to be sorted, as per the design of OPT files.
@@ -3809,10 +3933,10 @@ class Optimization(BADA4):
3809
3933
  )
3810
3934
 
3811
3935
  def findNearest(value, array):
3812
- """
3813
- Returns the indices of the nearest value(s) in the array.
3814
- If the value is lower/higher than the lowest/highest value in the array, only one index is returned.
3815
- If the value is between two values, two closest indices (left and right) are returned.
3936
+ """Returns the indices of the nearest value(s) in the array. If
3937
+ the value is lower/higher than the lowest/highest value in the
3938
+ array, only one index is returned. If the value is between two
3939
+ values, two closest indices (left and right) are returned.
3816
3940
 
3817
3941
  Note:
3818
3942
  The array is expected to be sorted.
@@ -3841,8 +3965,8 @@ class Optimization(BADA4):
3841
3965
  return nearestIdx
3842
3966
 
3843
3967
  def parseOPT(filename):
3844
- """
3845
- Parses a BADA4 OPT file and populates variables for later interpolation.
3968
+ """Parses a BADA4 OPT file and populates variables for later
3969
+ interpolation.
3846
3970
 
3847
3971
  :param filename: Path to the OPT file.
3848
3972
  :type filename: str
@@ -4012,7 +4136,8 @@ class Optimization(BADA4):
4012
4136
 
4013
4137
 
4014
4138
  class PTD(BADA4):
4015
- """This class implements the PTD file creator for BADA4 aircraft following BADA4 manual.
4139
+ """This class implements the PTD file creator for BADA4 aircraft following
4140
+ BADA4 manual.
4016
4141
 
4017
4142
  :param AC: Aircraft object {BADA4}.
4018
4143
  :type AC: bada4Aircraft.
@@ -4025,9 +4150,9 @@ class PTD(BADA4):
4025
4150
  self.ARPM = ARPM(AC)
4026
4151
 
4027
4152
  def create(self, DeltaTemp, saveToPath):
4028
- """
4029
- Creates the BADA4 Performance Table Data (PTD) file, calculating climb, cruise, and descent profiles
4030
- for different mass levels and altitudes, and saves the output to the specified path.
4153
+ """Creates the BADA4 Performance Table Data (PTD) file, calculating
4154
+ climb, cruise, and descent profiles for different mass levels and
4155
+ altitudes, and saves the output to the specified path.
4031
4156
 
4032
4157
  :param saveToPath: Directory path where the PTD file should be stored.
4033
4158
  :param DeltaTemp: Deviation from the ISA (International Standard Atmosphere) temperature in Kelvin [K].
@@ -4098,14 +4223,15 @@ class PTD(BADA4):
4098
4223
  )
4099
4224
 
4100
4225
  def save2PTD(self, saveToPath, CLList, CRList, DESList, DeltaTemp):
4101
- """
4102
- Saves climb, cruise, and descent performance data into a PTD (Performance Table Data) file.
4226
+ """Saves climb, cruise, and descent performance data into a PTD
4227
+ (Performance Table Data) file.
4103
4228
 
4104
4229
  :param saveToPath: Directory path where the PTD file will be stored.
4105
4230
  :param CLList: List of climb performance data.
4106
4231
  :param CRList: List of cruise performance data.
4107
4232
  :param DESList: List of descent performance data.
4108
- :param DeltaTemp: Deviation from ISA (International Standard Atmosphere) temperature in Kelvin [K].
4233
+ :param DeltaTemp: Deviation from ISA (International Standard
4234
+ Atmosphere) temperature in Kelvin [K].
4109
4235
  :type saveToPath: str
4110
4236
  :type CLList: list
4111
4237
  :type CRList: list
@@ -4465,8 +4591,8 @@ class PTD(BADA4):
4465
4591
  )
4466
4592
 
4467
4593
  def PTD_climb(self, mass, altitudeList, DeltaTemp):
4468
- """
4469
- Calculates the BADA4 PTD (Performance Table Data) for the CLIMB phase of flight.
4594
+ """Calculates the BADA4 PTD (Performance Table Data) for the CLIMB
4595
+ phase of flight.
4470
4596
 
4471
4597
  :param mass: Aircraft mass in kilograms [kg].
4472
4598
  :param altitudeList: List of aircraft altitudes in feet [ft].
@@ -4633,8 +4759,8 @@ class PTD(BADA4):
4633
4759
  return CLList
4634
4760
 
4635
4761
  def PTD_descent(self, mass, altitudeList, DeltaTemp):
4636
- """
4637
- Calculates the BADA4 PTD (Performance Table Data) for the DESCENT phase of flight.
4762
+ """Calculates the BADA4 PTD (Performance Table Data) for the DESCENT
4763
+ phase of flight.
4638
4764
 
4639
4765
  :param mass: Aircraft mass in kilograms [kg].
4640
4766
  :param altitudeList: List of aircraft altitudes in feet [ft].
@@ -4836,8 +4962,8 @@ class PTD(BADA4):
4836
4962
  return DESList
4837
4963
 
4838
4964
  def PTD_cruise(self, mass, altitudeList, DeltaTemp):
4839
- """
4840
- Calculates the BADA4 PTD (Performance Table Data) for the CRUISE phase of flight.
4965
+ """Calculates the BADA4 PTD (Performance Table Data) for the CRUISE
4966
+ phase of flight.
4841
4967
 
4842
4968
  :param mass: Aircraft mass in kilograms [kg].
4843
4969
  :param altitudeList: List of aircraft altitudes in feet [ft].
@@ -4966,7 +5092,8 @@ class PTD(BADA4):
4966
5092
 
4967
5093
 
4968
5094
  class PTF(BADA4):
4969
- """This class implements the PTF file creator for BADA4 aircraft following BADA4 manual.
5095
+ """This class implements the PTF file creator for BADA4 aircraft following
5096
+ BADA4 manual.
4970
5097
 
4971
5098
  :param AC: Aircraft object {BADA4}.
4972
5099
  :type AC: bada4Aircraft.
@@ -4979,10 +5106,10 @@ class PTF(BADA4):
4979
5106
  self.ARPM = ARPM(AC)
4980
5107
 
4981
5108
  def create(self, DeltaTemp, saveToPath):
4982
- """
4983
- Creates the BADA4 PTF and saves it to the specified directory.
5109
+ """Creates the BADA4 PTF and saves it to the specified directory.
4984
5110
 
4985
- :param saveToPath: Path to the directory where the PTF should be stored.
5111
+ :param saveToPath: Path to the directory where the PTF should be
5112
+ stored.
4986
5113
  :param DeltaTemp: Deviation from ISA temperature in Kelvin [K].
4987
5114
  :type saveToPath: str
4988
5115
  :type DeltaTemp: float
@@ -5043,10 +5170,10 @@ class PTF(BADA4):
5043
5170
  massList,
5044
5171
  altitudeList,
5045
5172
  ):
5046
- """
5047
- Saves the BADA4 performance data to a PTF format.
5173
+ """Saves the BADA4 performance data to a PTF format.
5048
5174
 
5049
- :param saveToPath: Path to the directory where the PTF should be stored.
5175
+ :param saveToPath: Path to the directory where the PTF should be
5176
+ stored.
5050
5177
  :param CLList: List of PTD data for CLIMB.
5051
5178
  :param CRList: List of PTD data for CRUISE.
5052
5179
  :param DESList: List of PTD data for DESCENT.
@@ -5060,10 +5187,9 @@ class PTF(BADA4):
5060
5187
  :type DeltaTemp: float
5061
5188
  :type massList: list(float)
5062
5189
  :returns: None
5063
- :rtype: None
5064
-
5065
- This function formats and writes the climb, cruise, and descent data for different mass levels
5066
- and altitudes into a .PTF file, adhering to the BADA4 performance file format.
5190
+ :rtype: None This function formats and writes the climb, cruise, and
5191
+ descent data for different mass levels and altitudes into a .PTF
5192
+ file, adhering to the BADA4 performance file format.
5067
5193
  """
5068
5194
 
5069
5195
  def Nan2Zero(list):
@@ -5185,8 +5311,7 @@ class PTF(BADA4):
5185
5311
  )
5186
5312
 
5187
5313
  def PTF_cruise(self, massList, altitudeList, DeltaTemp):
5188
- """
5189
- Calculates the BADA4 PTF for the CRUISE phase of flight.
5314
+ """Calculates the BADA4 PTF for the CRUISE phase of flight.
5190
5315
 
5191
5316
  :param massList: List of aircraft mass levels in kilograms [kg].
5192
5317
  :param altitudeList: List of aircraft altitudes in feet [ft].
@@ -5304,8 +5429,7 @@ class PTF(BADA4):
5304
5429
  return CRList
5305
5430
 
5306
5431
  def PTF_climb(self, massList, altitudeList, DeltaTemp):
5307
- """
5308
- Calculates the BADA4 PTF for the CLIMB phase of flight.
5432
+ """Calculates the BADA4 PTF for the CLIMB phase of flight.
5309
5433
 
5310
5434
  :param massList: List of aircraft mass levels in kilograms [kg].
5311
5435
  :param altitudeList: List of aircraft altitudes in feet [ft].
@@ -5461,8 +5585,7 @@ class PTF(BADA4):
5461
5585
  return CLList
5462
5586
 
5463
5587
  def PTF_descent(self, massList, altitudeList, DeltaTemp):
5464
- """
5465
- Calculates the BADA4 PTF for the DESCENT phase of flight.
5588
+ """Calculates the BADA4 PTF for the DESCENT phase of flight.
5466
5589
 
5467
5590
  :param massList: List of aircraft mass levels in kilograms [kg].
5468
5591
  :param altitudeList: List of aircraft altitudes in feet [ft].
@@ -5654,26 +5777,27 @@ class PTF(BADA4):
5654
5777
 
5655
5778
 
5656
5779
  class Bada4Aircraft(BADA4):
5657
- """
5658
- This class encapsulates the BADA4 performance model for an aircraft, extending the BADA4 base class.
5780
+ """This class encapsulates the BADA4 performance model for an aircraft,
5781
+ extending the BADA4 base class.
5659
5782
 
5660
5783
  :param badaVersion: The version of the BADA4 model being used.
5661
5784
  :param acName: The ICAO designation or name of the aircraft.
5662
- :param filePath: (Optional) Path to the BADA4 XML file. If not provided, a default path is used.
5663
- :param allData: (Optional) Dataframe containing pre-loaded aircraft data, typically used to
5664
- initialize the aircraft parameters without needing to parse XML files.
5785
+ :param filePath: (Optional) Path to the BADA4 XML file. If not provided, a
5786
+ default path is used.
5787
+ :param allData: (Optional) Dataframe containing pre-loaded aircraft data,
5788
+ typically used to initialize the aircraft parameters without needing
5789
+ to parse XML files.
5665
5790
  :type badaVersion: str
5666
5791
  :type acName: str
5667
5792
  :type filePath: str, optional
5668
- :type allData: pd.DataFrame, optional
5669
-
5670
- This class initializes the aircraft's performance model using data from a dataframe or by
5671
- reading from XML files in the BADA4 format.
5793
+ :type allData: pd.DataFrame, optional This class initializes the
5794
+ aircraft's performance model using data from a dataframe or by reading
5795
+ from XML files in the BADA4 format.
5672
5796
  """
5673
5797
 
5674
5798
  def __init__(self, badaVersion, acName, filePath=None, allData=None):
5675
- """
5676
- Initializes the BADA4Aircraft class by loading aircraft-specific data.
5799
+ """Initializes the BADA4Aircraft class by loading aircraft-specific
5800
+ data.
5677
5801
 
5678
5802
  - If `allData` is provided and contains the aircraft's information, it will be used to
5679
5803
  initialize various parameters such as engine type, mass, thrust settings, and performance
@@ -5697,7 +5821,7 @@ class Bada4Aircraft(BADA4):
5697
5821
  self.BADAVersion = badaVersion
5698
5822
  self.acName = acName
5699
5823
 
5700
- if filePath == None:
5824
+ if filePath is None:
5701
5825
  self.filePath = configuration.getBadaVersionPath(
5702
5826
  badaFamily="BADA4", badaVersion=badaVersion
5703
5827
  )
@@ -5826,7 +5950,7 @@ class Bada4Aircraft(BADA4):
5826
5950
  )
5827
5951
 
5828
5952
  # if cannot find - look for full name (in sub folder names) based on acName (may not be ICAO designator)
5829
- if self.SearchedACName == None:
5953
+ if self.SearchedACName is None:
5830
5954
  self.SearchedACName = acName
5831
5955
  else:
5832
5956
  self.ACinSynonymFile = True
@@ -5847,7 +5971,6 @@ class Bada4Aircraft(BADA4):
5847
5971
  # look for either found synonym or original full BADA4 model name designator
5848
5972
  if self.SearchedACName is not None:
5849
5973
  if os.path.isfile(acXmlFile):
5850
-
5851
5974
  self.ACModelAvailable = True
5852
5975
 
5853
5976
  XMLDataFrame = Parser.parseXML(