pyBADA 0.1.2__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
 
@@ -2116,6 +2165,9 @@ class FlightEnvelope(BADA4):
2116
2165
  theta=theta, delta=delta, mass=mass, HLid=HLid, LG=LG, nz=1.0
2117
2166
  )
2118
2167
 
2168
+ if VminCertified is None or VmaxCertified is None:
2169
+ return None
2170
+
2119
2171
  maxCASList = []
2120
2172
  for CAS in np.linspace(
2121
2173
  VminCertified, VmaxCertified, num=200, endpoint=True
@@ -2148,13 +2200,13 @@ class FlightEnvelope(BADA4):
2148
2200
  return max(maxCASList)
2149
2201
 
2150
2202
  def maxMbuffet(self, HLid, LG, delta, mass, nz=1.0):
2151
- """
2152
- Computes the maximum allowable Mach number (M) under buffet limitations, where the lift
2153
- coefficient (CL) cannot exceed the maximum lift coefficient (CL_max) for the given Mach
2154
- 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.
2155
2206
 
2156
2207
  :param HLid: High-lift devices position [-].
2157
- :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) [-].
2158
2210
  :param delta: Normalized pressure [-].
2159
2211
  :param mass: Aircraft mass in kilograms [kg].
2160
2212
  :param nz: Load factor [-], default is 1.0.
@@ -2163,7 +2215,8 @@ class FlightEnvelope(BADA4):
2163
2215
  :type delta: float.
2164
2216
  :type mass: float.
2165
2217
  :type nz: float.
2166
- :return: Maximum allowable Mach number (M) limited by buffet conditions.
2218
+ :return: Maximum allowable Mach number (M) limited by buffet
2219
+ conditions.
2167
2220
  :rtype: float.
2168
2221
  """
2169
2222
 
@@ -2191,12 +2244,14 @@ class FlightEnvelope(BADA4):
2191
2244
  return self.AC.MMO
2192
2245
 
2193
2246
  def minMbuffet(self, HLid, LG, theta, delta, mass, nz=1.0):
2194
- """
2195
- Computes the minimum Mach number (M) applying buffet limitations, where the lift coefficient (CL)
2196
- 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.
2197
2251
 
2198
2252
  :param HLid: High-lift devices position [-].
2199
- :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) [-].
2200
2255
  :param delta: Normalized pressure [-].
2201
2256
  :param theta: Normalized temperature [-].
2202
2257
  :param mass: Aircraft mass in kilograms [kg].
@@ -2253,11 +2308,12 @@ class FlightEnvelope(BADA4):
2253
2308
  M = M_list[idx]
2254
2309
 
2255
2310
  def VMin(self, config, theta, delta, mass):
2256
- """
2257
- Computes the minimum speed (CAS) for the given aerodynamic configuration, accounting for
2258
- 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.
2259
2314
 
2260
- :param config: Aircraft configuration, options include "CR", "IC", "TO", "AP", "LD" [-].
2315
+ :param config: Aircraft configuration, options include "CR", "IC",
2316
+ "TO", "AP", "LD" [-].
2261
2317
  :param delta: Normalized pressure [-].
2262
2318
  :param theta: Normalized temperature [-].
2263
2319
  :param mass: Aircraft mass in kilograms [kg].
@@ -2265,7 +2321,8 @@ class FlightEnvelope(BADA4):
2265
2321
  :type delta: float.
2266
2322
  :type theta: float.
2267
2323
  :type mass: float.
2268
- :returns: Minimum calibrated airspeed (CAS) in meters per second [m/s].
2324
+ :returns: Minimum calibrated airspeed (CAS) in meters per second
2325
+ [m/s].
2269
2326
  :rtype: float.
2270
2327
  """
2271
2328
 
@@ -2300,12 +2357,13 @@ class FlightEnvelope(BADA4):
2300
2357
  return Vmin
2301
2358
 
2302
2359
  def VStall(self, mass, HLid, LG, nz=1.0, **kwargs):
2303
- """
2304
- Calculates the stall speed (CAS) for the given aerodynamic configuration and load factor,
2305
- 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.
2306
2363
 
2307
2364
  :param HLid: High-lift devices position [-].
2308
- :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) [-].
2309
2367
  :param delta: Normalized pressure [-].
2310
2368
  :param theta: Normalized temperature [-].
2311
2369
  :param mass: Aircraft mass in kilograms [kg].
@@ -2345,13 +2403,70 @@ class FlightEnvelope(BADA4):
2345
2403
 
2346
2404
  return minCAS
2347
2405
 
2348
- 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
2349
2423
  """
2350
- Computes the maximum altitude taking into account buffet limitations. The altitude is calculated
2351
- 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.
2352
2466
 
2353
2467
  :param HLid: High-lift devices position [-].
2354
- :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) [-].
2355
2470
  :param M: Mach airspeed [-].
2356
2471
  :param mass: Aircraft mass [kg].
2357
2472
  :param nz: Load factor [-], default is 1.0.
@@ -2394,22 +2509,25 @@ class FlightEnvelope(BADA4):
2394
2509
  return hMax
2395
2510
 
2396
2511
  def getConfig(self, phase, h, mass, v, DeltaTemp=0.0, hRWY=0.0):
2397
- """
2398
- 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.
2399
2514
 
2400
2515
  :param phase: Phase of flight [Climb, Cruise, Descent] [-].
2401
2516
  :param h: Altitude above mean sea level (AMSL) [m].
2402
2517
  :param mass: Aircraft mass [kg].
2403
2518
  :param v: Calibrated airspeed (CAS) [m/s].
2404
- :param DeltaTemp: Deviation from ISA temperature [K], default is 0.0.
2405
- :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.
2406
2523
  :type phase: str.
2407
2524
  :type h: float.
2408
2525
  :type mass: float.
2409
2526
  :type v: float.
2410
2527
  :type DeltaTemp: float.
2411
2528
  :type hRWY: float.
2412
- :returns: Aircraft aerodynamic configuration [TO/IC/CR/AP/LD] [-].
2529
+ :returns: Aircraft aerodynamic configuration [TO/IC/CR/AP/LD]
2530
+ [-].
2413
2531
  :rtype: str.
2414
2532
  :raises: TypeError if unable to determine the configuration.
2415
2533
  """
@@ -2486,10 +2604,10 @@ class FlightEnvelope(BADA4):
2486
2604
  return config
2487
2605
 
2488
2606
  def getAeroConfig(self, config):
2489
- """
2490
- Returns the aircraft aerodynamic configuration based on the provided configuration ID.
2491
- This includes the high-lift device (HLID) position and landing gear (LG) position.
2492
- 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.
2493
2611
 
2494
2612
  :param config: Aircraft configuration (TO/IC/CR/AP/LD).
2495
2613
  :type config: str
@@ -2502,13 +2620,14 @@ class FlightEnvelope(BADA4):
2502
2620
  return [configDict["HLid"], configDict["LG"]]
2503
2621
 
2504
2622
  def getSpeedSchedule(self, phase):
2505
- """
2506
- Returns the speed schedule based on the phase of flight (Climb, Cruise, Descent).
2507
- 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).
2508
2626
 
2509
2627
  :param phase: Aircraft phase of flight (Climb, Cruise, Descent).
2510
2628
  :type phase: str
2511
- :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).
2512
2631
  :rtype: [float, float, float]
2513
2632
  """
2514
2633
 
@@ -2523,10 +2642,10 @@ class FlightEnvelope(BADA4):
2523
2642
  def checkConfigurationContinuity(
2524
2643
  self, phase, previousConfig, currentConfig
2525
2644
  ):
2526
- """
2527
- Ensures the continuity of the aerodynamic configuration changes based on the phase of flight.
2528
- It prevents sudden or improper configuration transitions, ensuring the aerodynamic configuration
2529
- 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.
2530
2649
 
2531
2650
  :param phase: Aircraft phase of flight (Climb, Cruise, Descent).
2532
2651
  :param previousConfig: Previous aerodynamic configuration.
@@ -2573,8 +2692,8 @@ class FlightEnvelope(BADA4):
2573
2692
 
2574
2693
 
2575
2694
  class ARPM(BADA4):
2576
- """This class is a BADA4 aircraft subclass and implements the Airline Procedure Model (ARPM)
2577
- 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.
2578
2697
 
2579
2698
  :param AC: Aircraft object {BADA4}.
2580
2699
  :type AC: bada4Aircraft.
@@ -2599,8 +2718,8 @@ class ARPM(BADA4):
2599
2718
  NADP2_ALT=[1000, 3000],
2600
2719
  DeltaTemp=0.0,
2601
2720
  ):
2602
- """
2603
- 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.
2604
2723
 
2605
2724
  :param theta: Normalized air temperature [-].
2606
2725
  :param delta: Normalized air pressure [-].
@@ -2924,16 +3043,19 @@ class ARPM(BADA4):
2924
3043
  config=None,
2925
3044
  DeltaTemp=0.0,
2926
3045
  ):
2927
- """
2928
- 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.
2929
3048
 
2930
3049
  :param theta: Normalized air temperature [-].
2931
3050
  :param delta: Normalized air pressure [-].
2932
3051
  :param mass: Aircraft mass in kilograms [kg].
2933
3052
  :param h: Altitude in meters [m].
2934
3053
  :param hRWY: Runway elevation AMSL in meters [m].
2935
- :param speedSchedule_default: Optional, a default speed schedule that overrides the BADA schedule. It should be in the form [Vcr1, Vcr2, Mcr].
2936
- :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).
2937
3059
  :param DeltaTemp: Deviation from ISA temperature in Kelvin [K].
2938
3060
  :type theta: float
2939
3061
  :type delta: float
@@ -2943,18 +3065,22 @@ class ARPM(BADA4):
2943
3065
  :type speedSchedule_default: list[float], optional
2944
3066
  :type config: str, optional
2945
3067
  :type DeltaTemp: float, optional
2946
- :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 ('').
2947
- :rtype: tuple[float, str]
2948
-
2949
- This function computes the cruise speed schedule for different phases of flight and aircraft types. It uses either the default
2950
- speed schedule or the BADA speed schedule based on the aircraft model and altitude.
2951
-
2952
- The cruise speed schedule varies depending on the altitude and type of engine (JET, TURBOPROP, or PISTON).
2953
-
2954
- The function also applies speed limits based on the aircraft's flight envelope, ensuring the calculated cruise speed remains within
2955
- the aircraft's minimum and maximum allowable speeds.
2956
-
2957
- 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.
2958
3084
  """
2959
3085
 
2960
3086
  phase = "Cruise"
@@ -3050,16 +3176,19 @@ class ARPM(BADA4):
3050
3176
  config=None,
3051
3177
  DeltaTemp=0.0,
3052
3178
  ):
3053
- """
3054
- 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.
3055
3181
 
3056
3182
  :param theta: Normalized air temperature [-].
3057
3183
  :param delta: Normalized air pressure [-].
3058
3184
  :param mass: Aircraft mass in kilograms [kg].
3059
3185
  :param h: Altitude in meters [m].
3060
3186
  :param hRWY: Runway elevation AMSL in meters [m].
3061
- :param speedSchedule_default: Optional, a default speed schedule that overrides the BADA schedule. It should be in the form [Vdes1, Vdes2, Mdes].
3062
- :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).
3063
3192
  :param DeltaTemp: Deviation from ISA temperature in Kelvin [K].
3064
3193
  :type theta: float
3065
3194
  :type delta: float
@@ -3069,15 +3198,19 @@ class ARPM(BADA4):
3069
3198
  :type speedSchedule_default: list[float], optional
3070
3199
  :type config: str, optional
3071
3200
  :type DeltaTemp: float, optional
3072
- :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 ('').
3073
- :rtype: tuple[float, str]
3074
-
3075
- This function computes the descent speed schedule for different phases of flight and aircraft types.
3076
- It uses either the default speed schedule or the BADA speed schedule based on the aircraft model and altitude.
3077
-
3078
- The descent speed schedule varies depending on the altitude and type of engine (JET, TURBOPROP, or PISTON).
3079
-
3080
- 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.
3081
3214
  """
3082
3215
 
3083
3216
  # aircraft AGL altitude assuming being close to the RWY [m]
@@ -3223,7 +3356,8 @@ class ARPM(BADA4):
3223
3356
 
3224
3357
 
3225
3358
  class Optimization(BADA4):
3226
- """This class implements the BADA4 optimization following the BADA4 manual.
3359
+ """This class implements the BADA4 optimization following the BADA4
3360
+ manual.
3227
3361
 
3228
3362
  :param AC: Aircraft object {BADA4}.
3229
3363
  :type AC: bada4Aircraft.
@@ -3234,8 +3368,7 @@ class Optimization(BADA4):
3234
3368
  self.flightEnvelope = FlightEnvelope(AC)
3235
3369
 
3236
3370
  def CCI(self, theta, delta, cI):
3237
- """
3238
- Computes the cost index coefficient for given flight conditions.
3371
+ """Computes the cost index coefficient for given flight conditions.
3239
3372
 
3240
3373
  :param cI: Cost index in kilograms per minute [kg min^-1].
3241
3374
  :param delta: Normalized pressure [-].
@@ -3267,42 +3400,38 @@ class Optimization(BADA4):
3267
3400
  )
3268
3401
 
3269
3402
  def CW(self, mass, delta):
3270
- """
3271
- Computes the weight coefficient at a given mass and pressure.
3403
+ """Computes the weight coefficient at a given mass and pressure.
3272
3404
 
3273
3405
  :param mass: Aircraft mass in kilograms [kg].
3274
3406
  :param delta: Normalized pressure [-].
3275
3407
  :type mass: float
3276
3408
  :type delta: float
3277
3409
  :returns: Weight coefficient [-].
3278
- :rtype: float
3279
-
3280
- The weight coefficient is used to represent the aircraft's weight relative to its maximum takeoff weight (MTOW)
3281
- 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.
3282
3413
  """
3283
3414
 
3284
3415
  return mass * const.g / (self.AC.MTOW * delta * const.g)
3285
3416
 
3286
3417
  def SR(self, M, CF):
3287
- """
3288
- Computes the specific range (SR) for given flight conditions.
3418
+ """Computes the specific range (SR) for given flight conditions.
3289
3419
 
3290
3420
  :param M: Mach ground speed [-].
3291
3421
  :param CF: Fuel coefficient [-].
3292
3422
  :type M: float
3293
3423
  :type CF: float
3294
3424
  :returns: Specific range in nautical miles per kilogram [NM kg^-1].
3295
- :rtype: float
3296
-
3297
- Specific range is a measure of the distance that can be flown per unit of fuel mass.
3298
- 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.
3299
3428
  """
3300
3429
 
3301
3430
  return M / CF
3302
3431
 
3303
3432
  def econMach(self, theta, delta, mass, DeltaTemp, cI, wS):
3304
- """
3305
- 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.
3306
3435
 
3307
3436
  :param delta: Normalized pressure [-].
3308
3437
  :param theta: Normalized temperature [-].
@@ -3404,8 +3533,8 @@ class Optimization(BADA4):
3404
3533
  # return float(econ.x)
3405
3534
 
3406
3535
  def MRC(self, theta, delta, mass, DeltaTemp, wS):
3407
- """
3408
- 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.
3409
3538
 
3410
3539
  :param theta: Normalized air temperature [-].
3411
3540
  :param delta: Normalized air pressure [-].
@@ -3442,8 +3571,8 @@ class Optimization(BADA4):
3442
3571
  return mrcM
3443
3572
 
3444
3573
  def LRC(self, theta, delta, mass, DeltaTemp, wS):
3445
- """
3446
- 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.
3447
3576
 
3448
3577
  :param theta: Normalized air temperature [-].
3449
3578
  :param delta: Normalized air pressure [-].
@@ -3456,13 +3585,12 @@ class Optimization(BADA4):
3456
3585
  :type DeltaTemp: float
3457
3586
  :type wS: float
3458
3587
  :returns: Long Range Cruise (LRC) Mach number [-].
3459
- :rtype: float
3460
-
3461
- The Long Range Cruise (LRC) is defined as the speed where fuel efficiency is 99% of the Maximum Range Cruise (MRC).
3462
- This function calculates the LRC based on the MRC and iterates through possible Mach numbers to find the one that
3463
- minimizes the difference between the specific range (SR) at LRC and 99% of the SR at MRC.
3464
-
3465
- 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.
3466
3594
  """
3467
3595
 
3468
3596
  Mws = atm.tas2Mach(v=wS, theta=theta)
@@ -3557,8 +3685,8 @@ class Optimization(BADA4):
3557
3685
  # return minimum
3558
3686
 
3559
3687
  def MEC(self, theta, delta, mass, DeltaTemp, wS):
3560
- """
3561
- 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.
3562
3690
 
3563
3691
  :param delta: Normalized pressure [-].
3564
3692
  :param theta: Normalized temperature [-].
@@ -3571,14 +3699,13 @@ class Optimization(BADA4):
3571
3699
  :type DeltaTemp: float
3572
3700
  :type wS: float
3573
3701
  :returns: Maximum Endurance Cruise (MEC) in Mach [-].
3574
- :rtype: float
3575
-
3576
- The Maximum Endurance Cruise (MEC) Mach is the Mach number that minimizes the fuel consumption rate,
3577
- maximizing the endurance of the flight. This function iterates over a range of possible Mach numbers
3578
- within the flight envelope and returns the Mach number with the lowest fuel coefficient (CF).
3579
-
3580
- The calculation is subject to thrust limitations, and the function ensures that the resulting Mach
3581
- 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.
3582
3709
  """
3583
3710
 
3584
3711
  # clean configuration during CR
@@ -3650,8 +3777,8 @@ class Optimization(BADA4):
3650
3777
  # return float(mecM.x)
3651
3778
 
3652
3779
  def optAltitude(self, M, mass, DeltaTemp):
3653
- """
3654
- 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.
3655
3782
 
3656
3783
  :param M: Mach number [-].
3657
3784
  :param mass: Aircraft mass in kilograms [kg].
@@ -3660,13 +3787,12 @@ class Optimization(BADA4):
3660
3787
  :type mass: float
3661
3788
  :type DeltaTemp: float
3662
3789
  :returns: Optimum altitude in feet [ft].
3663
- :rtype: float
3664
-
3665
- The optimum altitude is the altitude where the aircraft achieves the maximum efficiency for a given
3666
- Mach number and mass, subject to thrust and buffet limitations. The function iterates over a range
3667
- of altitudes and returns the one with the best fuel efficiency.
3668
-
3669
- 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.
3670
3796
  """
3671
3797
 
3672
3798
  # clean configuration during CR
@@ -3780,11 +3906,12 @@ class Optimization(BADA4):
3780
3906
  # return optAlt
3781
3907
 
3782
3908
  def getOPTParam(self, optParam, var_1, var_2=None):
3783
- """
3784
- Returns the value of an optimization (OPT) parameter from a BADA4 OPT file for various flight conditions.
3785
- The OPT file contains values for parameters like Long Range Cruise (LRC), Maximum Endurance Cruise (MEC),
3786
- Maximum Range Cruise (MRC), ECON speed, or OPTALT altitude, and this function interpolates the appropriate
3787
- 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.
3788
3915
 
3789
3916
  Note:
3790
3917
  The array used in this function is expected to be sorted, as per the design of OPT files.
@@ -3806,10 +3933,10 @@ class Optimization(BADA4):
3806
3933
  )
3807
3934
 
3808
3935
  def findNearest(value, array):
3809
- """
3810
- Returns the indices of the nearest value(s) in the array.
3811
- If the value is lower/higher than the lowest/highest value in the array, only one index is returned.
3812
- 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.
3813
3940
 
3814
3941
  Note:
3815
3942
  The array is expected to be sorted.
@@ -3838,8 +3965,8 @@ class Optimization(BADA4):
3838
3965
  return nearestIdx
3839
3966
 
3840
3967
  def parseOPT(filename):
3841
- """
3842
- Parses a BADA4 OPT file and populates variables for later interpolation.
3968
+ """Parses a BADA4 OPT file and populates variables for later
3969
+ interpolation.
3843
3970
 
3844
3971
  :param filename: Path to the OPT file.
3845
3972
  :type filename: str
@@ -4009,7 +4136,8 @@ class Optimization(BADA4):
4009
4136
 
4010
4137
 
4011
4138
  class PTD(BADA4):
4012
- """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.
4013
4141
 
4014
4142
  :param AC: Aircraft object {BADA4}.
4015
4143
  :type AC: bada4Aircraft.
@@ -4022,9 +4150,9 @@ class PTD(BADA4):
4022
4150
  self.ARPM = ARPM(AC)
4023
4151
 
4024
4152
  def create(self, DeltaTemp, saveToPath):
4025
- """
4026
- Creates the BADA4 Performance Table Data (PTD) file, calculating climb, cruise, and descent profiles
4027
- 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.
4028
4156
 
4029
4157
  :param saveToPath: Directory path where the PTD file should be stored.
4030
4158
  :param DeltaTemp: Deviation from the ISA (International Standard Atmosphere) temperature in Kelvin [K].
@@ -4095,14 +4223,15 @@ class PTD(BADA4):
4095
4223
  )
4096
4224
 
4097
4225
  def save2PTD(self, saveToPath, CLList, CRList, DESList, DeltaTemp):
4098
- """
4099
- 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.
4100
4228
 
4101
4229
  :param saveToPath: Directory path where the PTD file will be stored.
4102
4230
  :param CLList: List of climb performance data.
4103
4231
  :param CRList: List of cruise performance data.
4104
4232
  :param DESList: List of descent performance data.
4105
- :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].
4106
4235
  :type saveToPath: str
4107
4236
  :type CLList: list
4108
4237
  :type CRList: list
@@ -4462,8 +4591,8 @@ class PTD(BADA4):
4462
4591
  )
4463
4592
 
4464
4593
  def PTD_climb(self, mass, altitudeList, DeltaTemp):
4465
- """
4466
- 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.
4467
4596
 
4468
4597
  :param mass: Aircraft mass in kilograms [kg].
4469
4598
  :param altitudeList: List of aircraft altitudes in feet [ft].
@@ -4630,8 +4759,8 @@ class PTD(BADA4):
4630
4759
  return CLList
4631
4760
 
4632
4761
  def PTD_descent(self, mass, altitudeList, DeltaTemp):
4633
- """
4634
- 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.
4635
4764
 
4636
4765
  :param mass: Aircraft mass in kilograms [kg].
4637
4766
  :param altitudeList: List of aircraft altitudes in feet [ft].
@@ -4833,8 +4962,8 @@ class PTD(BADA4):
4833
4962
  return DESList
4834
4963
 
4835
4964
  def PTD_cruise(self, mass, altitudeList, DeltaTemp):
4836
- """
4837
- 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.
4838
4967
 
4839
4968
  :param mass: Aircraft mass in kilograms [kg].
4840
4969
  :param altitudeList: List of aircraft altitudes in feet [ft].
@@ -4963,7 +5092,8 @@ class PTD(BADA4):
4963
5092
 
4964
5093
 
4965
5094
  class PTF(BADA4):
4966
- """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.
4967
5097
 
4968
5098
  :param AC: Aircraft object {BADA4}.
4969
5099
  :type AC: bada4Aircraft.
@@ -4976,10 +5106,10 @@ class PTF(BADA4):
4976
5106
  self.ARPM = ARPM(AC)
4977
5107
 
4978
5108
  def create(self, DeltaTemp, saveToPath):
4979
- """
4980
- Creates the BADA4 PTF and saves it to the specified directory.
5109
+ """Creates the BADA4 PTF and saves it to the specified directory.
4981
5110
 
4982
- :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.
4983
5113
  :param DeltaTemp: Deviation from ISA temperature in Kelvin [K].
4984
5114
  :type saveToPath: str
4985
5115
  :type DeltaTemp: float
@@ -5040,10 +5170,10 @@ class PTF(BADA4):
5040
5170
  massList,
5041
5171
  altitudeList,
5042
5172
  ):
5043
- """
5044
- Saves the BADA4 performance data to a PTF format.
5173
+ """Saves the BADA4 performance data to a PTF format.
5045
5174
 
5046
- :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.
5047
5177
  :param CLList: List of PTD data for CLIMB.
5048
5178
  :param CRList: List of PTD data for CRUISE.
5049
5179
  :param DESList: List of PTD data for DESCENT.
@@ -5057,10 +5187,9 @@ class PTF(BADA4):
5057
5187
  :type DeltaTemp: float
5058
5188
  :type massList: list(float)
5059
5189
  :returns: None
5060
- :rtype: None
5061
-
5062
- This function formats and writes the climb, cruise, and descent data for different mass levels
5063
- 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.
5064
5193
  """
5065
5194
 
5066
5195
  def Nan2Zero(list):
@@ -5182,8 +5311,7 @@ class PTF(BADA4):
5182
5311
  )
5183
5312
 
5184
5313
  def PTF_cruise(self, massList, altitudeList, DeltaTemp):
5185
- """
5186
- Calculates the BADA4 PTF for the CRUISE phase of flight.
5314
+ """Calculates the BADA4 PTF for the CRUISE phase of flight.
5187
5315
 
5188
5316
  :param massList: List of aircraft mass levels in kilograms [kg].
5189
5317
  :param altitudeList: List of aircraft altitudes in feet [ft].
@@ -5301,8 +5429,7 @@ class PTF(BADA4):
5301
5429
  return CRList
5302
5430
 
5303
5431
  def PTF_climb(self, massList, altitudeList, DeltaTemp):
5304
- """
5305
- Calculates the BADA4 PTF for the CLIMB phase of flight.
5432
+ """Calculates the BADA4 PTF for the CLIMB phase of flight.
5306
5433
 
5307
5434
  :param massList: List of aircraft mass levels in kilograms [kg].
5308
5435
  :param altitudeList: List of aircraft altitudes in feet [ft].
@@ -5458,8 +5585,7 @@ class PTF(BADA4):
5458
5585
  return CLList
5459
5586
 
5460
5587
  def PTF_descent(self, massList, altitudeList, DeltaTemp):
5461
- """
5462
- Calculates the BADA4 PTF for the DESCENT phase of flight.
5588
+ """Calculates the BADA4 PTF for the DESCENT phase of flight.
5463
5589
 
5464
5590
  :param massList: List of aircraft mass levels in kilograms [kg].
5465
5591
  :param altitudeList: List of aircraft altitudes in feet [ft].
@@ -5651,26 +5777,27 @@ class PTF(BADA4):
5651
5777
 
5652
5778
 
5653
5779
  class Bada4Aircraft(BADA4):
5654
- """
5655
- 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.
5656
5782
 
5657
5783
  :param badaVersion: The version of the BADA4 model being used.
5658
5784
  :param acName: The ICAO designation or name of the aircraft.
5659
- :param filePath: (Optional) Path to the BADA4 XML file. If not provided, a default path is used.
5660
- :param allData: (Optional) Dataframe containing pre-loaded aircraft data, typically used to
5661
- 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.
5662
5790
  :type badaVersion: str
5663
5791
  :type acName: str
5664
5792
  :type filePath: str, optional
5665
- :type allData: pd.DataFrame, optional
5666
-
5667
- This class initializes the aircraft's performance model using data from a dataframe or by
5668
- 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.
5669
5796
  """
5670
5797
 
5671
5798
  def __init__(self, badaVersion, acName, filePath=None, allData=None):
5672
- """
5673
- Initializes the BADA4Aircraft class by loading aircraft-specific data.
5799
+ """Initializes the BADA4Aircraft class by loading aircraft-specific
5800
+ data.
5674
5801
 
5675
5802
  - If `allData` is provided and contains the aircraft's information, it will be used to
5676
5803
  initialize various parameters such as engine type, mass, thrust settings, and performance
@@ -5694,7 +5821,7 @@ class Bada4Aircraft(BADA4):
5694
5821
  self.BADAVersion = badaVersion
5695
5822
  self.acName = acName
5696
5823
 
5697
- if filePath == None:
5824
+ if filePath is None:
5698
5825
  self.filePath = configuration.getBadaVersionPath(
5699
5826
  badaFamily="BADA4", badaVersion=badaVersion
5700
5827
  )
@@ -5823,7 +5950,7 @@ class Bada4Aircraft(BADA4):
5823
5950
  )
5824
5951
 
5825
5952
  # if cannot find - look for full name (in sub folder names) based on acName (may not be ICAO designator)
5826
- if self.SearchedACName == None:
5953
+ if self.SearchedACName is None:
5827
5954
  self.SearchedACName = acName
5828
5955
  else:
5829
5956
  self.ACinSynonymFile = True
@@ -5844,7 +5971,6 @@ class Bada4Aircraft(BADA4):
5844
5971
  # look for either found synonym or original full BADA4 model name designator
5845
5972
  if self.SearchedACName is not None:
5846
5973
  if os.path.isfile(acXmlFile):
5847
-
5848
5974
  self.ACModelAvailable = True
5849
5975
 
5850
5976
  XMLDataFrame = Parser.parseXML(