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/TCL.py +56 -49
- pyBADA/aircraft.py +39 -40
- pyBADA/atmosphere.py +79 -72
- pyBADA/bada3.py +272 -245
- pyBADA/bada4.py +460 -337
- pyBADA/badaH.py +338 -239
- pyBADA/configuration.py +31 -21
- pyBADA/constants.py +0 -1
- pyBADA/conversions.py +11 -23
- pyBADA/flightTrajectory.py +95 -63
- pyBADA/geodesic.py +119 -82
- pyBADA/magnetic.py +12 -7
- pyBADA/trajectoryPrediction.py +17 -13
- {pybada-0.1.3.dist-info → pybada-0.1.4.dist-info}/METADATA +14 -5
- {pybada-0.1.3.dist-info → pybada-0.1.4.dist-info}/RECORD +18 -18
- {pybada-0.1.3.dist-info → pybada-0.1.4.dist-info}/WHEEL +0 -0
- {pybada-0.1.3.dist-info → pybada-0.1.4.dist-info}/licenses/AUTHORS +0 -0
- {pybada-0.1.3.dist-info → pybada-0.1.4.dist-info}/licenses/LICENCE.txt +0 -0
pyBADA/badaH.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
1
|
"""
|
|
3
2
|
Generic BADAH aircraft performance module
|
|
4
3
|
"""
|
|
@@ -10,7 +9,6 @@ import numpy as np
|
|
|
10
9
|
from math import sqrt, pow, pi, cos, asin, radians, isnan
|
|
11
10
|
import pandas as pd
|
|
12
11
|
|
|
13
|
-
from scipy.optimize import minimize, Bounds
|
|
14
12
|
|
|
15
13
|
from pyBADA import constants as const
|
|
16
14
|
from pyBADA import conversions as conv
|
|
@@ -34,26 +32,30 @@ def checkArgument(argument, **kwargs):
|
|
|
34
32
|
|
|
35
33
|
|
|
36
34
|
class Parser:
|
|
37
|
-
"""This class implements the BADAH parsing mechanism to parse xml BADAH
|
|
35
|
+
"""This class implements the BADAH parsing mechanism to parse xml BADAH
|
|
36
|
+
files."""
|
|
38
37
|
|
|
39
38
|
def __init__(self):
|
|
40
39
|
pass
|
|
41
40
|
|
|
42
41
|
@staticmethod
|
|
43
42
|
def parseXML(filePath, acName):
|
|
44
|
-
"""
|
|
45
|
-
|
|
43
|
+
"""Parses the BADAH XML file for a specific aircraft model and
|
|
44
|
+
extracts various parameters.
|
|
46
45
|
|
|
47
|
-
This function parses the BADAH aircraft XML file for a given aircraft
|
|
48
|
-
general information about the aircraft,
|
|
46
|
+
This function parses the BADAH aircraft XML file for a given aircraft
|
|
47
|
+
model (acName). It retrieves general information about the aircraft,
|
|
48
|
+
engine type, aerodynamic configurations, performance parameters, and
|
|
49
|
+
more.
|
|
49
50
|
|
|
50
51
|
:param filePath: The path to the folder containing the BADAH XML file.
|
|
51
|
-
:param acName: The aircraft code name for which the XML file is being
|
|
52
|
+
:param acName: The aircraft code name for which the XML file is being
|
|
53
|
+
parsed.
|
|
52
54
|
:type filePath: str
|
|
53
55
|
:type acName: str
|
|
54
56
|
:raises IOError: If the XML file cannot be found or parsed.
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
:return: A pandas DataFrame containing the parsed data for the
|
|
58
|
+
specified aircraft.
|
|
57
59
|
:rtype: pd.DataFrame
|
|
58
60
|
"""
|
|
59
61
|
|
|
@@ -62,7 +64,7 @@ class Parser:
|
|
|
62
64
|
try:
|
|
63
65
|
tree = ET.parse(acXmlFile)
|
|
64
66
|
root = tree.getroot()
|
|
65
|
-
except:
|
|
67
|
+
except Exception:
|
|
66
68
|
raise IOError(acXmlFile + " not found or in correct format")
|
|
67
69
|
|
|
68
70
|
# Parse general aircraft data
|
|
@@ -157,19 +159,20 @@ class Parser:
|
|
|
157
159
|
|
|
158
160
|
@staticmethod
|
|
159
161
|
def readSynonym(filePath):
|
|
160
|
-
"""
|
|
161
|
-
|
|
162
|
-
to their respective model files.
|
|
162
|
+
"""Parses the BADAH Synonym XML file and returns a dictionary mapping
|
|
163
|
+
aircraft code names to their respective model files.
|
|
163
164
|
|
|
164
|
-
:param filePath: Path to the directory containing the BADA4 synonym
|
|
165
|
+
:param filePath: Path to the directory containing the BADA4 synonym
|
|
166
|
+
XML file.
|
|
165
167
|
:type filePath: str
|
|
166
|
-
:returns: A dictionary where the keys are aircraft codes and the
|
|
168
|
+
:returns: A dictionary where the keys are aircraft codes and the
|
|
169
|
+
values are associated file names.
|
|
167
170
|
:rtype: dict
|
|
168
171
|
:raises IOError: If the XML file is missing or has an invalid format.
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
172
|
+
This function attempts to read the synonym XML file, parse its
|
|
173
|
+
contents, and store the mappings in a dictionary. The file
|
|
174
|
+
contains aircraft code, manufacturer, ICAO designation, and file
|
|
175
|
+
name data for each aircraft in the synonym list.
|
|
173
176
|
"""
|
|
174
177
|
|
|
175
178
|
filename = os.path.join(filePath, "SYNONYM.xml")
|
|
@@ -181,7 +184,7 @@ class Parser:
|
|
|
181
184
|
try:
|
|
182
185
|
tree = ET.parse(filename)
|
|
183
186
|
root = tree.getroot()
|
|
184
|
-
except:
|
|
187
|
+
except Exception:
|
|
185
188
|
raise IOError(filename + " not found or in correct format")
|
|
186
189
|
|
|
187
190
|
for child in root.iter("SYN"):
|
|
@@ -196,8 +199,8 @@ class Parser:
|
|
|
196
199
|
|
|
197
200
|
@staticmethod
|
|
198
201
|
def parseSynonym(filePath, acName):
|
|
199
|
-
"""
|
|
200
|
-
|
|
202
|
+
"""Retrieves the file name associated with a given aircraft code from
|
|
203
|
+
the BADAH synonym file.
|
|
201
204
|
|
|
202
205
|
:param filePath: Path to the directory containing the BADAH synonym XML file.
|
|
203
206
|
:param acName: The ICAO aircraft code or name to search for in the synonym file.
|
|
@@ -219,26 +222,31 @@ class Parser:
|
|
|
219
222
|
|
|
220
223
|
@staticmethod
|
|
221
224
|
def parseAll(badaVersion, filePath=None):
|
|
222
|
-
"""
|
|
223
|
-
|
|
225
|
+
"""Parses all BADAH XML-formatted files and compiles the data into a
|
|
226
|
+
single DataFrame.
|
|
224
227
|
|
|
225
|
-
This function reads the BADAH aircraft performance model data by
|
|
226
|
-
|
|
227
|
-
|
|
228
|
+
This function reads the BADAH aircraft performance model data by
|
|
229
|
+
parsing the XML files for each aircraft model found in the specified
|
|
230
|
+
directory. If the synonym XML file is present, it maps synonyms
|
|
231
|
+
(alternative names for aircraft) to their respective model files and
|
|
232
|
+
includes them in the output DataFrame.
|
|
228
233
|
|
|
229
234
|
:param badaVersion: The version of BADAH being used (e.g., '1.1').
|
|
230
|
-
:param filePath: Optional path to the directory containing the BADAH
|
|
235
|
+
:param filePath: Optional path to the directory containing the BADAH
|
|
236
|
+
files. If not provided, it uses the default path.
|
|
231
237
|
:type badaVersion: str
|
|
232
238
|
:type filePath: str, optional
|
|
233
|
-
:returns: A pandas DataFrame containing all parsed BADAH model data,
|
|
239
|
+
:returns: A pandas DataFrame containing all parsed BADAH model data,
|
|
240
|
+
including any synonyms found.
|
|
234
241
|
:rtype: pd.DataFrame
|
|
235
|
-
:raises IOError: If an error occurs while reading or parsing the XML
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
242
|
+
:raises IOError: If an error occurs while reading or parsing the XML
|
|
243
|
+
files. This function first checks if a synonym XML file exists to
|
|
244
|
+
map synonyms to model files. Then, it parses all XML files in the
|
|
245
|
+
directory and its subfolders, merges the parsed data into a final
|
|
246
|
+
DataFrame, and returns it.
|
|
239
247
|
"""
|
|
240
248
|
|
|
241
|
-
if filePath
|
|
249
|
+
if filePath is None:
|
|
242
250
|
filePath = configuration.getBadaVersionPath(
|
|
243
251
|
badaFamily="BADAH", badaVersion=badaVersion
|
|
244
252
|
)
|
|
@@ -278,7 +286,8 @@ class Parser:
|
|
|
278
286
|
|
|
279
287
|
|
|
280
288
|
class BADAH(Helicopter, Bada):
|
|
281
|
-
"""This class implements the part of BADAH performance model that will be
|
|
289
|
+
"""This class implements the part of BADAH performance model that will be
|
|
290
|
+
used in other classes following the BADAH manual.
|
|
282
291
|
|
|
283
292
|
:param AC: Aircraft object {BADAH}.
|
|
284
293
|
:type AC: badaHAircraft.
|
|
@@ -289,11 +298,12 @@ class BADAH(Helicopter, Bada):
|
|
|
289
298
|
self.AC = AC
|
|
290
299
|
|
|
291
300
|
def mu(self, tas):
|
|
292
|
-
"""
|
|
293
|
-
|
|
301
|
+
"""Computes the advance ratio (mu) for the aircraft based on true
|
|
302
|
+
airspeed (TAS) and rotor speed.
|
|
294
303
|
|
|
295
|
-
The advance ratio is a non-dimensional parameter that relates the
|
|
296
|
-
to the rotational speed of its main
|
|
304
|
+
The advance ratio is a non-dimensional parameter that relates the
|
|
305
|
+
forward speed of the aircraft to the rotational speed of its main
|
|
306
|
+
rotor.
|
|
297
307
|
|
|
298
308
|
:param tas: True airspeed (TAS) in meters per second [m/s].
|
|
299
309
|
:type tas: float
|
|
@@ -307,11 +317,11 @@ class BADAH(Helicopter, Bada):
|
|
|
307
317
|
return mu
|
|
308
318
|
|
|
309
319
|
def CT(self, mass, rho, phi):
|
|
310
|
-
"""
|
|
311
|
-
Computes the thrust coefficient (CT) for the aircraft.
|
|
320
|
+
"""Computes the thrust coefficient (CT) for the aircraft.
|
|
312
321
|
|
|
313
|
-
The thrust coefficient is a dimensionless quantity that represents the
|
|
314
|
-
aircraft's rotor in relation to the air
|
|
322
|
+
The thrust coefficient is a dimensionless quantity that represents the
|
|
323
|
+
thrust produced by the aircraft's rotor in relation to the air
|
|
324
|
+
density, rotor radius, and rotor speed.
|
|
315
325
|
|
|
316
326
|
:param mass: Aircraft mass in kilograms [kg].
|
|
317
327
|
:param rho: Air density in kilograms per cubic meter [kg/m³].
|
|
@@ -334,11 +344,12 @@ class BADAH(Helicopter, Bada):
|
|
|
334
344
|
return CT
|
|
335
345
|
|
|
336
346
|
def CPreq(self, mu, CT):
|
|
337
|
-
"""
|
|
338
|
-
|
|
347
|
+
"""Computes the power required coefficient (CPreq) based on the
|
|
348
|
+
advance ratio (mu) and thrust coefficient (CT).
|
|
339
349
|
|
|
340
|
-
The power required coefficient relates to the total power required to
|
|
341
|
-
factoring in the aerodynamic performance of the rotor
|
|
350
|
+
The power required coefficient relates to the total power required to
|
|
351
|
+
maintain flight, factoring in the aerodynamic performance of the rotor
|
|
352
|
+
in different operating regimes.
|
|
342
353
|
|
|
343
354
|
:param mu: Advance ratio [-].
|
|
344
355
|
:param CT: Thrust coefficient [-].
|
|
@@ -361,14 +372,16 @@ class BADAH(Helicopter, Bada):
|
|
|
361
372
|
return CPreq
|
|
362
373
|
|
|
363
374
|
def Preq(self, sigma, tas, mass, phi=0.0):
|
|
364
|
-
"""
|
|
365
|
-
|
|
366
|
-
|
|
375
|
+
"""Computes the power required for the aircraft to maintain flight
|
|
376
|
+
based on various factors such as air density, true airspeed (TAS),
|
|
377
|
+
aircraft mass, and bank angle.
|
|
367
378
|
|
|
368
|
-
:param sigma: Normalized air density [-], which is the ratio of the
|
|
379
|
+
:param sigma: Normalized air density [-], which is the ratio of the
|
|
380
|
+
current air density to sea level air density.
|
|
369
381
|
:param tas: True airspeed (TAS) in meters per second [m/s].
|
|
370
382
|
:param mass: Aircraft mass in kilograms [kg].
|
|
371
|
-
:param phi: Bank angle in degrees [deg], default is 0 for straight
|
|
383
|
+
:param phi: Bank angle in degrees [deg], default is 0 for straight
|
|
384
|
+
flight.
|
|
372
385
|
:type sigma: float
|
|
373
386
|
:type tas: float
|
|
374
387
|
:type mass: float
|
|
@@ -396,15 +409,16 @@ class BADAH(Helicopter, Bada):
|
|
|
396
409
|
return Preq
|
|
397
410
|
|
|
398
411
|
def Peng_target(self, ROCD, mass, Preq, ESF, temp, DeltaTemp):
|
|
399
|
-
"""
|
|
400
|
-
|
|
412
|
+
"""Computes the target engine power required to achieve a specific
|
|
413
|
+
rate of climb or descent.
|
|
401
414
|
|
|
402
415
|
:param ROCD: Rate of climb or descent in meters per second [m/s].
|
|
403
416
|
:param mass: Aircraft mass in kilograms [kg].
|
|
404
417
|
:param Preq: Power required in watts [W].
|
|
405
418
|
:param ESF: Energy share factor, a dimensionless factor [-].
|
|
406
419
|
:param temp: Atmospheric temperature in kelvins [K].
|
|
407
|
-
:param DeltaTemp: Deviation from the International Standard Atmosphere
|
|
420
|
+
:param DeltaTemp: Deviation from the International Standard Atmosphere
|
|
421
|
+
(ISA) temperature in kelvins [K].
|
|
408
422
|
:type ROCD: float
|
|
409
423
|
:type mass: float
|
|
410
424
|
:type Preq: float
|
|
@@ -421,9 +435,9 @@ class BADAH(Helicopter, Bada):
|
|
|
421
435
|
return Peng_target
|
|
422
436
|
|
|
423
437
|
def CPav(self, rating, delta, theta):
|
|
424
|
-
"""
|
|
425
|
-
|
|
426
|
-
|
|
438
|
+
"""Computes the power available coefficient (CPav) based on engine
|
|
439
|
+
type, throttle rating, normalized air pressure (delta), and normalized
|
|
440
|
+
temperature (theta).
|
|
427
441
|
|
|
428
442
|
:param rating: Engine throttle setting, e.g., {MTKF, MCNT}.
|
|
429
443
|
:param delta: Normalized air pressure [-].
|
|
@@ -485,14 +499,15 @@ class BADAH(Helicopter, Bada):
|
|
|
485
499
|
return CPav
|
|
486
500
|
|
|
487
501
|
def Pmax(self, rating):
|
|
488
|
-
"""
|
|
489
|
-
|
|
502
|
+
"""Computes the maximum power available for all engines at a given
|
|
503
|
+
throttle setting.
|
|
490
504
|
|
|
491
505
|
:param rating: Throttle setting, e.g., {MTKF, MCNT}.
|
|
492
506
|
:type rating: str
|
|
493
507
|
:return: Maximum all-engine power in watts [W].
|
|
494
508
|
:rtype: float
|
|
495
|
-
:raises ValueError: If the specified throttle setting is not
|
|
509
|
+
:raises ValueError: If the specified throttle setting is not
|
|
510
|
+
recognized.
|
|
496
511
|
"""
|
|
497
512
|
|
|
498
513
|
if rating not in self.AC.Pmax_.keys():
|
|
@@ -500,19 +515,21 @@ class BADAH(Helicopter, Bada):
|
|
|
500
515
|
return self.AC.Pmax_[rating]
|
|
501
516
|
|
|
502
517
|
def Pav(self, rating, delta, theta):
|
|
503
|
-
"""
|
|
504
|
-
|
|
505
|
-
and temperature.
|
|
518
|
+
"""Computes the power available at the given throttle setting, based
|
|
519
|
+
on normalized pressure and temperature.
|
|
506
520
|
|
|
507
521
|
:param rating: Throttle setting, e.g., {MTKF, MCNT}.
|
|
508
|
-
:param delta: Normalized pressure [-], ratio of actual pressure to
|
|
509
|
-
|
|
522
|
+
:param delta: Normalized pressure [-], ratio of actual pressure to
|
|
523
|
+
standard sea level pressure.
|
|
524
|
+
:param theta: Normalized temperature [-], ratio of actual temperature
|
|
525
|
+
to standard sea level temperature.
|
|
510
526
|
:type rating: str
|
|
511
527
|
:type delta: float
|
|
512
528
|
:type theta: float
|
|
513
529
|
:return: Available power in watts [W].
|
|
514
530
|
:rtype: float
|
|
515
|
-
:raises ValueError: If the specified throttle setting is not
|
|
531
|
+
:raises ValueError: If the specified throttle setting is not
|
|
532
|
+
recognized.
|
|
516
533
|
"""
|
|
517
534
|
|
|
518
535
|
Pmax = self.Pmax(rating=rating)
|
|
@@ -531,8 +548,8 @@ class BADAH(Helicopter, Bada):
|
|
|
531
548
|
return Pav
|
|
532
549
|
|
|
533
550
|
def Q(self, Peng):
|
|
534
|
-
"""
|
|
535
|
-
|
|
551
|
+
"""Computes the torque value as a percentage of the reference torque
|
|
552
|
+
(P0).
|
|
536
553
|
|
|
537
554
|
:param Peng: All-engine power in watts [W].
|
|
538
555
|
:type Peng: float
|
|
@@ -545,8 +562,8 @@ class BADAH(Helicopter, Bada):
|
|
|
545
562
|
return Q
|
|
546
563
|
|
|
547
564
|
def CP(self, Peng):
|
|
548
|
-
"""
|
|
549
|
-
|
|
565
|
+
"""Computes the engine power coefficient (CP) based on the given all-
|
|
566
|
+
engine power.
|
|
550
567
|
|
|
551
568
|
:param Peng: All-engine power in watts [W].
|
|
552
569
|
:type Peng: float
|
|
@@ -564,11 +581,13 @@ class BADAH(Helicopter, Bada):
|
|
|
564
581
|
return CP
|
|
565
582
|
|
|
566
583
|
def ff(self, delta, CP):
|
|
567
|
-
"""
|
|
568
|
-
|
|
584
|
+
"""Computes the fuel flow rate based on normalized pressure and power
|
|
585
|
+
coefficient.
|
|
569
586
|
|
|
570
|
-
:param delta: Normalized pressure [-], which is the ratio of actual
|
|
571
|
-
|
|
587
|
+
:param delta: Normalized pressure [-], which is the ratio of actual
|
|
588
|
+
air pressure to standard sea-level pressure.
|
|
589
|
+
:param CP: Power coefficient [-], representing the power output in
|
|
590
|
+
relation to the engine's maximum power.
|
|
572
591
|
:type delta: float
|
|
573
592
|
:type CP: float
|
|
574
593
|
:return: Fuel flow rate in kilograms per second [kg/s].
|
|
@@ -602,15 +621,17 @@ class BADAH(Helicopter, Bada):
|
|
|
602
621
|
return ff / 3600
|
|
603
622
|
|
|
604
623
|
def ROCD(self, Peng, Preq, mass, ESF, theta, DeltaTemp):
|
|
605
|
-
"""
|
|
606
|
-
Computes the Rate of Climb or Descent (ROCD) for an aircraft.
|
|
624
|
+
"""Computes the Rate of Climb or Descent (ROCD) for an aircraft.
|
|
607
625
|
|
|
608
626
|
:param Peng: All-engine power available [W].
|
|
609
627
|
:param Preq: Power required for steady flight [W].
|
|
610
628
|
:param mass: Aircraft's current mass [kg].
|
|
611
|
-
:param ESF: Energy share factor [-], a multiplier used to adjust power
|
|
612
|
-
|
|
613
|
-
:param
|
|
629
|
+
:param ESF: Energy share factor [-], a multiplier used to adjust power
|
|
630
|
+
distribution in different flight phases.
|
|
631
|
+
:param theta: Normalized temperature [-], ratio of actual temperature
|
|
632
|
+
to standard sea-level temperature.
|
|
633
|
+
:param DeltaTemp: Deviation from the International Standard Atmosphere
|
|
634
|
+
(ISA) temperature [K].
|
|
614
635
|
:type Peng: float
|
|
615
636
|
:type Preq: float
|
|
616
637
|
:type mass: float
|
|
@@ -633,8 +654,8 @@ class BADAH(Helicopter, Bada):
|
|
|
633
654
|
|
|
634
655
|
|
|
635
656
|
class FlightEnvelope(BADAH):
|
|
636
|
-
"""This class is a BADAH aircraft subclass and implements the flight
|
|
637
|
-
following the BADAH manual.
|
|
657
|
+
"""This class is a BADAH aircraft subclass and implements the flight
|
|
658
|
+
envelope caclulations following the BADAH manual.
|
|
638
659
|
|
|
639
660
|
:param AC: Aircraft object {BADAH}.
|
|
640
661
|
:type AC: badaHAircraft.
|
|
@@ -644,8 +665,7 @@ class FlightEnvelope(BADAH):
|
|
|
644
665
|
super().__init__(AC)
|
|
645
666
|
|
|
646
667
|
def maxAltitude(self):
|
|
647
|
-
"""
|
|
648
|
-
Computes the maximum operational altitude for the aircraft.
|
|
668
|
+
"""Computes the maximum operational altitude for the aircraft.
|
|
649
669
|
|
|
650
670
|
:return: Maximum altitude in meters [m].
|
|
651
671
|
:rtype: float.
|
|
@@ -655,8 +675,8 @@ class FlightEnvelope(BADAH):
|
|
|
655
675
|
return hMax
|
|
656
676
|
|
|
657
677
|
def VMax(self):
|
|
658
|
-
"""
|
|
659
|
-
|
|
678
|
+
"""Computes the maximum speed in Calibrated Airspeed (CAS) as limited
|
|
679
|
+
by the flight envelope.
|
|
660
680
|
|
|
661
681
|
:return: Maximum CAS speed in meters per second [m/s].
|
|
662
682
|
:rtype: float.
|
|
@@ -668,23 +688,25 @@ class FlightEnvelope(BADAH):
|
|
|
668
688
|
def speedEnvelope_powerLimited(
|
|
669
689
|
self, h, mass, DeltaTemp, rating="MCNT", rateOfTurn=0
|
|
670
690
|
):
|
|
671
|
-
"""
|
|
672
|
-
|
|
673
|
-
taking into account engine thrust limitations.
|
|
691
|
+
"""Computes the maximum and minimum speeds (CAS) within the certified
|
|
692
|
+
flight envelope, taking into account engine thrust limitations.
|
|
674
693
|
|
|
675
694
|
:param h: Altitude in meters [m].
|
|
676
695
|
:param mass: Aircraft mass in kilograms [kg].
|
|
677
|
-
:param DeltaTemp: Deviation from the International Standard Atmosphere
|
|
678
|
-
|
|
679
|
-
:param
|
|
696
|
+
:param DeltaTemp: Deviation from the International Standard Atmosphere
|
|
697
|
+
(ISA) temperature [K].
|
|
698
|
+
:param rating: Engine rating (e.g., "MTKF", "MCNT") determining the
|
|
699
|
+
power output [-].
|
|
700
|
+
:param rateOfTurn: Rate of turn in degrees per second, which affects
|
|
701
|
+
bank angle [°/s].
|
|
680
702
|
:type h: float
|
|
681
703
|
:type mass: float
|
|
682
704
|
:type DeltaTemp: float
|
|
683
705
|
:type rating: str
|
|
684
706
|
:type rateOfTurn: float
|
|
685
|
-
:return: A tuple containing the minimum and maximum thrust-limited
|
|
707
|
+
:return: A tuple containing the minimum and maximum thrust- limited
|
|
708
|
+
CAS speeds [m/s].
|
|
686
709
|
:rtype: tuple(float, float)
|
|
687
|
-
:raises ValueError: If no valid CAS speeds are found within the power limits.
|
|
688
710
|
"""
|
|
689
711
|
|
|
690
712
|
[theta, delta, sigma] = atm.atmosphereProperties(
|
|
@@ -723,9 +745,70 @@ class FlightEnvelope(BADAH):
|
|
|
723
745
|
|
|
724
746
|
return (minCAS, maxCAS)
|
|
725
747
|
|
|
748
|
+
def Vx(self, h, mass, DeltaTemp, rating="MTKF", rateOfTurn=0):
|
|
749
|
+
"""Computes the best angle climb speed (TAS) by finding the speed that
|
|
750
|
+
maximizes the excess power per unit speed within the helicopter's
|
|
751
|
+
performance envelope.
|
|
752
|
+
|
|
753
|
+
:param h: Altitude in meters [m].
|
|
754
|
+
:param mass: Aircraft mass in kilograms [kg].
|
|
755
|
+
:param DeltaTemp: Deviation from the International Standard Atmosphere
|
|
756
|
+
(ISA) temperature [K].
|
|
757
|
+
:param rating: Engine rating (e.g., "MTKF", "MCNT") determining the
|
|
758
|
+
power output [-].
|
|
759
|
+
:param rateOfTurn: Rate of turn in degrees per second, which affects
|
|
760
|
+
the bank angle [°/s].
|
|
761
|
+
:type h: float
|
|
762
|
+
:type mass: float
|
|
763
|
+
:type DeltaTemp: float
|
|
764
|
+
:type rating: str
|
|
765
|
+
:type rateOfTurn: float
|
|
766
|
+
:return: The true airspeed (TAS) corresponding to the best angle climb
|
|
767
|
+
speed [m/s].
|
|
768
|
+
:rtype: float
|
|
769
|
+
"""
|
|
770
|
+
[theta, delta, sigma] = atm.atmosphereProperties(
|
|
771
|
+
h=h, DeltaTemp=DeltaTemp
|
|
772
|
+
)
|
|
773
|
+
|
|
774
|
+
VminCertified = 0 + 5 # putting some margin to not start at 0 speed
|
|
775
|
+
VmaxCertified = self.VMax()
|
|
776
|
+
|
|
777
|
+
excessPowerList = []
|
|
778
|
+
VxList = []
|
|
779
|
+
|
|
780
|
+
for CAS in np.linspace(
|
|
781
|
+
VminCertified, VmaxCertified, num=200, endpoint=True
|
|
782
|
+
):
|
|
783
|
+
TAS = atm.cas2Tas(cas=CAS, delta=delta, sigma=sigma)
|
|
784
|
+
bankAngle = self.bankAngle(rateOfTurn=rateOfTurn, v=TAS)
|
|
785
|
+
Preq = self.Preq(sigma=sigma, tas=TAS, mass=mass, phi=bankAngle)
|
|
786
|
+
Pav = self.Pav(rating=rating, theta=theta, delta=delta)
|
|
787
|
+
|
|
788
|
+
tempConst = (theta * const.temp_0 - DeltaTemp) / (
|
|
789
|
+
theta * const.temp_0
|
|
790
|
+
)
|
|
791
|
+
|
|
792
|
+
excessPowerList.append(
|
|
793
|
+
(Pav - Preq) * tempConst / TAS
|
|
794
|
+
) # including speed and impact of the temperature deviation from ISA conditions
|
|
795
|
+
VxList.append(CAS)
|
|
796
|
+
|
|
797
|
+
VxCAS = VxList[excessPowerList.index(max(excessPowerList))]
|
|
798
|
+
[VxM, VxCAS, VxTAS] = atm.convertSpeed(
|
|
799
|
+
v=conv.ms2kt(VxCAS),
|
|
800
|
+
speedType="CAS",
|
|
801
|
+
theta=theta,
|
|
802
|
+
delta=delta,
|
|
803
|
+
sigma=sigma,
|
|
804
|
+
)
|
|
805
|
+
|
|
806
|
+
return VxTAS
|
|
807
|
+
|
|
726
808
|
|
|
727
809
|
class Optimization(BADAH):
|
|
728
|
-
"""This class implements the BADAH optimization following the BADAH
|
|
810
|
+
"""This class implements the BADAH optimization following the BADAH
|
|
811
|
+
manual.
|
|
729
812
|
|
|
730
813
|
:param AC: Aircraft object {BADAH}.
|
|
731
814
|
:type AC: badaHAircraft.
|
|
@@ -737,24 +820,29 @@ class Optimization(BADAH):
|
|
|
737
820
|
self.flightEnvelope = FlightEnvelope(AC)
|
|
738
821
|
|
|
739
822
|
def MRC(self, h, mass, DeltaTemp, wS):
|
|
740
|
-
"""
|
|
741
|
-
|
|
823
|
+
"""Computes the True Airspeed (TAS) representing Maximum Range Cruise
|
|
824
|
+
(MRC) for given flight conditions.
|
|
742
825
|
|
|
743
|
-
The Maximum Range Cruise speed is the speed that maximizes the
|
|
744
|
-
|
|
745
|
-
|
|
826
|
+
The Maximum Range Cruise speed is the speed that maximizes the
|
|
827
|
+
aircraft's range per unit of fuel, which is determined by balancing
|
|
828
|
+
the fuel flow rate and airspeed. The algorithm ensures that the
|
|
829
|
+
computed TAS stays within the power available limitations of the
|
|
830
|
+
aircraft.
|
|
746
831
|
|
|
747
832
|
:param h: Altitude in meters [m].
|
|
748
833
|
:param mass: Aircraft mass in kilograms [kg].
|
|
749
|
-
:param DeltaTemp: Deviation from International Standard Atmosphere
|
|
834
|
+
:param DeltaTemp: Deviation from International Standard Atmosphere
|
|
835
|
+
(ISA) temperature in Kelvin [K].
|
|
750
836
|
:param wS: Longitudinal wind speed (TAS) in meters per second [m/s].
|
|
751
837
|
:type h: float
|
|
752
838
|
:type mass: float
|
|
753
839
|
:type DeltaTemp: float
|
|
754
840
|
:type wS: float
|
|
755
|
-
:return: Maximum Range Cruise (MRC) speed in True Airspeed (TAS)
|
|
841
|
+
:return: Maximum Range Cruise (MRC) speed in True Airspeed (TAS)
|
|
842
|
+
[m/s].
|
|
756
843
|
:rtype: float.
|
|
757
|
-
:raises ValueError: If no valid MRC speed is found, the function will
|
|
844
|
+
:raises ValueError: If no valid MRC speed is found, the function will
|
|
845
|
+
return NaN.
|
|
758
846
|
"""
|
|
759
847
|
|
|
760
848
|
# NOTE: check for precision of algorithm needed. Possible local minima, instead of global minima
|
|
@@ -816,16 +904,19 @@ class Optimization(BADAH):
|
|
|
816
904
|
return mrc
|
|
817
905
|
|
|
818
906
|
def LRC(self, h, mass, DeltaTemp, wS):
|
|
819
|
-
"""
|
|
820
|
-
|
|
907
|
+
"""Computes the True Airspeed (TAS) representing Long Range Cruise
|
|
908
|
+
(LRC) for the given flight conditions.
|
|
821
909
|
|
|
822
|
-
The Long Range Cruise speed is the speed that allows for 99% of the
|
|
823
|
-
|
|
824
|
-
|
|
910
|
+
The Long Range Cruise speed is the speed that allows for 99% of the
|
|
911
|
+
specific range (range per unit of fuel) of the Maximum Range Cruise
|
|
912
|
+
(MRC) speed while offering a higher cruise speed. This function
|
|
913
|
+
ensures that the computed TAS remains within the aircraft's power
|
|
914
|
+
limitations.
|
|
825
915
|
|
|
826
916
|
:param h: Altitude in meters [m].
|
|
827
917
|
:param mass: Aircraft mass in kilograms [kg].
|
|
828
|
-
:param DeltaTemp: Deviation from International Standard Atmosphere
|
|
918
|
+
:param DeltaTemp: Deviation from International Standard Atmosphere
|
|
919
|
+
(ISA) temperature in Kelvin [K].
|
|
829
920
|
:param wS: Longitudinal wind speed (TAS) in meters per second [m/s].
|
|
830
921
|
:type h: float
|
|
831
922
|
:type mass: float
|
|
@@ -833,11 +924,11 @@ class Optimization(BADAH):
|
|
|
833
924
|
:type wS: float
|
|
834
925
|
:return: Long Range Cruise (LRC) speed in True Airspeed (TAS) [m/s].
|
|
835
926
|
:rtype: float.
|
|
836
|
-
:raises ValueError: If no valid LRC speed is found, the function will
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
927
|
+
:raises ValueError: If no valid LRC speed is found, the function will
|
|
928
|
+
return NaN. The algorithm starts by computing the MRC speed. Using
|
|
929
|
+
the MRC as a reference, it then calculates the LRC by finding the
|
|
930
|
+
TAS that achieves 99% of the specific range of the MRC while
|
|
931
|
+
staying within the aircraft’s thrust limitations.
|
|
841
932
|
"""
|
|
842
933
|
|
|
843
934
|
# NOTE: check for precision of algorithm needed. Possible local minima, instead of global minima
|
|
@@ -911,27 +1002,30 @@ class Optimization(BADAH):
|
|
|
911
1002
|
return lrc
|
|
912
1003
|
|
|
913
1004
|
def MEC(self, h, mass, DeltaTemp, wS):
|
|
914
|
-
"""
|
|
915
|
-
|
|
1005
|
+
"""Computes the True Airspeed (TAS) representing Maximum Endurance
|
|
1006
|
+
Cruise (MEC) for the given flight conditions.
|
|
916
1007
|
|
|
917
|
-
The Maximum Endurance Cruise speed is the speed that maximizes the
|
|
918
|
-
|
|
919
|
-
|
|
1008
|
+
The Maximum Endurance Cruise speed is the speed that maximizes the
|
|
1009
|
+
time an aircraft can stay in the air for a given amount of fuel,
|
|
1010
|
+
making it ideal for loiter operations. This function minimizes fuel
|
|
1011
|
+
flow (ff) to determine the most fuel-efficient speed.
|
|
920
1012
|
|
|
921
1013
|
:param h: Altitude in meters [m].
|
|
922
1014
|
:param mass: Aircraft weight in kilograms [kg].
|
|
923
|
-
:param DeltaTemp: Deviation from the International Standard Atmosphere
|
|
1015
|
+
:param DeltaTemp: Deviation from the International Standard Atmosphere
|
|
1016
|
+
(ISA) temperature in Kelvin [K].
|
|
924
1017
|
:param wS: Longitudinal wind speed (TAS) in meters per second [m/s].
|
|
925
1018
|
:type h: float
|
|
926
1019
|
:type mass: float
|
|
927
1020
|
:type DeltaTemp: float
|
|
928
1021
|
:type wS: float
|
|
929
|
-
:return: Maximum Endurance Cruise (MEC) speed in True Airspeed (TAS)
|
|
1022
|
+
:return: Maximum Endurance Cruise (MEC) speed in True Airspeed (TAS)
|
|
1023
|
+
[m/s].
|
|
930
1024
|
:rtype: float
|
|
931
|
-
:raises: If no valid MEC speed is found, the function returns NaN.
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
1025
|
+
:raises: If no valid MEC speed is found, the function returns NaN. The
|
|
1026
|
+
algorithm iterates over possible True Airspeeds (TAS) and computes
|
|
1027
|
+
the fuel flow for each, aiming to minimize fuel consumption and
|
|
1028
|
+
return the TAS that achieves this.
|
|
935
1029
|
"""
|
|
936
1030
|
|
|
937
1031
|
[theta, delta, sigma] = atm.atmosphereProperties(
|
|
@@ -977,17 +1071,18 @@ class Optimization(BADAH):
|
|
|
977
1071
|
return mecTAS
|
|
978
1072
|
|
|
979
1073
|
def parseOPT(self, filename):
|
|
980
|
-
"""
|
|
981
|
-
|
|
1074
|
+
"""Parses BADAH OPT ASCII formatted files and stores data for each
|
|
1075
|
+
available delta temperature in the file.
|
|
982
1076
|
|
|
983
1077
|
:param filename: Path to the ___.OPT ASCII formatted file.
|
|
984
1078
|
:type filename: str
|
|
985
|
-
:return: Dictionary of delta temperature values and corresponding data
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
1079
|
+
:return: Dictionary of delta temperature values and corresponding data
|
|
1080
|
+
from the OPT file.
|
|
1081
|
+
:rtype: dict This function reads and processes a BADAH OPT file,
|
|
1082
|
+
extracting delta temperature values and the corresponding
|
|
1083
|
+
performance data. The data is stored in a dictionary where each
|
|
1084
|
+
delta temperature is mapped to its respective dataset of
|
|
1085
|
+
performance values.
|
|
991
1086
|
"""
|
|
992
1087
|
|
|
993
1088
|
file = open(filename, "r")
|
|
@@ -1046,21 +1141,21 @@ class Optimization(BADAH):
|
|
|
1046
1141
|
return DeltaTempDict
|
|
1047
1142
|
|
|
1048
1143
|
def findNearestIdx(self, value, array):
|
|
1049
|
-
"""
|
|
1050
|
-
|
|
1144
|
+
"""Finds the nearest index or indices for a given value in a sorted
|
|
1145
|
+
array.
|
|
1051
1146
|
|
|
1052
|
-
If the value is lower or higher than the array’s bounds, a single
|
|
1053
|
-
|
|
1147
|
+
If the value is lower or higher than the array’s bounds, a single
|
|
1148
|
+
index is returned. If the value lies between two elements, two closest
|
|
1149
|
+
indices (left and right) are returned.
|
|
1054
1150
|
|
|
1055
1151
|
:param value: The value to find the nearest match for.
|
|
1056
1152
|
:param array: The sorted array of values.
|
|
1057
1153
|
:type value: float
|
|
1058
1154
|
:type array: list[float]
|
|
1059
1155
|
:return: A list of nearest index or indices.
|
|
1060
|
-
:rtype: list[float]
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
when needed.
|
|
1156
|
+
:rtype: list[float] The function uses binary search to efficiently
|
|
1157
|
+
find the nearest value or values, ensuring precise interpolation
|
|
1158
|
+
when needed.
|
|
1064
1159
|
"""
|
|
1065
1160
|
|
|
1066
1161
|
nearestIdx = list()
|
|
@@ -1079,23 +1174,24 @@ class Optimization(BADAH):
|
|
|
1079
1174
|
return nearestIdx
|
|
1080
1175
|
|
|
1081
1176
|
def calculateOPTparam(self, var_1, var_2, detaTauList):
|
|
1082
|
-
"""
|
|
1083
|
-
|
|
1177
|
+
"""Calculates the interpolated value of an OPT parameter based on two
|
|
1178
|
+
optimizing factors.
|
|
1084
1179
|
|
|
1085
|
-
If the exact values of the factors exist in the data, the function
|
|
1086
|
-
|
|
1180
|
+
If the exact values of the factors exist in the data, the function
|
|
1181
|
+
returns the corresponding OPT value. Otherwise, it interpolates
|
|
1182
|
+
between the nearest two values to provide a more accurate result.
|
|
1087
1183
|
|
|
1088
1184
|
:param var_1: The first optimizing factor.
|
|
1089
1185
|
:param var_2: The second optimizing factor.
|
|
1090
|
-
:param detaTauList: List of values belonging to the specified delta
|
|
1186
|
+
:param detaTauList: List of values belonging to the specified delta
|
|
1187
|
+
temperature from the OPT file.
|
|
1091
1188
|
:type var_1: float
|
|
1092
1189
|
:type var_2: float
|
|
1093
1190
|
:type detaTauList: list[float]
|
|
1094
1191
|
:return: Interpolated or exact OPT value based on the input factors.
|
|
1095
|
-
:rtype: float
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
in the case of multiple values being found.
|
|
1192
|
+
:rtype: float This function handles both single-index and two- index
|
|
1193
|
+
cases for the nearest values, ensuring correct interpolation in
|
|
1194
|
+
the case of multiple values being found.
|
|
1099
1195
|
"""
|
|
1100
1196
|
|
|
1101
1197
|
var_1_list = detaTauList[0]
|
|
@@ -1185,9 +1281,9 @@ class Optimization(BADAH):
|
|
|
1185
1281
|
return interpVar_3
|
|
1186
1282
|
|
|
1187
1283
|
def getOPTParam(self, optParam, var_1, var_2, DeltaTemp):
|
|
1188
|
-
"""
|
|
1189
|
-
|
|
1190
|
-
|
|
1284
|
+
"""Retrieves the value of the specified optimization parameter (e.g.,
|
|
1285
|
+
LRC, MEC, MRC) from the BADA OPT file, either directly or through
|
|
1286
|
+
interpolation based on the given flight conditions.
|
|
1191
1287
|
|
|
1192
1288
|
The function searches for the requested optimization parameter value using two optimizing factors.
|
|
1193
1289
|
If the exact DeltaTemp exists in the OPT file, it retrieves the value. Otherwise, the function interpolates
|
|
@@ -1258,8 +1354,8 @@ class Optimization(BADAH):
|
|
|
1258
1354
|
|
|
1259
1355
|
|
|
1260
1356
|
class ARPM(BADAH):
|
|
1261
|
-
"""This class is a BADAH aircraft subclass and implements the Airline
|
|
1262
|
-
following the BADAH user manual.
|
|
1357
|
+
"""This class is a BADAH aircraft subclass and implements the Airline
|
|
1358
|
+
Procedure Model (ARPM) following the BADAH user manual.
|
|
1263
1359
|
|
|
1264
1360
|
:param AC: Aircraft object {BADAH}.
|
|
1265
1361
|
:type AC: badaHAircraft.
|
|
@@ -1280,8 +1376,8 @@ class ARPM(BADAH):
|
|
|
1280
1376
|
speedLimit=None,
|
|
1281
1377
|
ROCDDefault=None,
|
|
1282
1378
|
):
|
|
1283
|
-
"""
|
|
1284
|
-
|
|
1379
|
+
"""Computes various parameters for the aircraft takeoff phase using
|
|
1380
|
+
the ARPM model (or other specified engine ratings).
|
|
1285
1381
|
|
|
1286
1382
|
This function calculates key takeoff parameters, including the available and required power, true airspeed, rate of climb (ROCD), and other
|
|
1287
1383
|
performance metrics. It also checks for speed limitations based on the flight envelope and applies them as necessary.
|
|
@@ -1438,8 +1534,8 @@ class ARPM(BADAH):
|
|
|
1438
1534
|
ROCDDefault=None,
|
|
1439
1535
|
tasDefault=None,
|
|
1440
1536
|
):
|
|
1441
|
-
"""
|
|
1442
|
-
|
|
1537
|
+
"""Computes various parameters for the aircraft climb phase using the
|
|
1538
|
+
ARPM model or other engine ratings.
|
|
1443
1539
|
|
|
1444
1540
|
This function calculates key climb parameters, including available and required power, true airspeed (TAS),
|
|
1445
1541
|
rate of climb (ROCD), and performance limitations. It takes into account speed envelope constraints
|
|
@@ -1600,8 +1696,8 @@ class ARPM(BADAH):
|
|
|
1600
1696
|
pass
|
|
1601
1697
|
|
|
1602
1698
|
def cruise(self, h, mass, DeltaTemp, speedLimit=None, tasDefault=None):
|
|
1603
|
-
"""
|
|
1604
|
-
|
|
1699
|
+
"""Computes various parameters for the aircraft cruise phase using the
|
|
1700
|
+
ARPM model or default speed.
|
|
1605
1701
|
|
|
1606
1702
|
This function calculates key cruise parameters, including available and required power, true airspeed (TAS),
|
|
1607
1703
|
and potential limitations due to the flight envelope or engine power. The calculations take into account
|
|
@@ -1711,8 +1807,8 @@ class ARPM(BADAH):
|
|
|
1711
1807
|
ROCDDefault=None,
|
|
1712
1808
|
tasDefault=None,
|
|
1713
1809
|
):
|
|
1714
|
-
"""
|
|
1715
|
-
|
|
1810
|
+
"""Computes various parameters for the aircraft descent phase using
|
|
1811
|
+
the ARPM model or default speed.
|
|
1716
1812
|
|
|
1717
1813
|
This function calculates key descent parameters, including available and required power, true airspeed (TAS),
|
|
1718
1814
|
rate of descent (ROD), and potential performance limitations. The calculations take into account atmospheric
|
|
@@ -1841,8 +1937,8 @@ class ARPM(BADAH):
|
|
|
1841
1937
|
ROCDDefault=None,
|
|
1842
1938
|
tasDefault=None,
|
|
1843
1939
|
):
|
|
1844
|
-
"""
|
|
1845
|
-
|
|
1940
|
+
"""Computes various parameters for the aircraft approach phase using
|
|
1941
|
+
the ARPM model.
|
|
1846
1942
|
|
|
1847
1943
|
This function calculates key approach parameters, including available and required power, true airspeed (TAS),
|
|
1848
1944
|
rate of descent (ROCD), and potential performance limitations. The calculations take into account atmospheric
|
|
@@ -1965,8 +2061,8 @@ class ARPM(BADAH):
|
|
|
1965
2061
|
ROCDDefault=None,
|
|
1966
2062
|
tasDefault=None,
|
|
1967
2063
|
):
|
|
1968
|
-
"""
|
|
1969
|
-
|
|
2064
|
+
"""Computes various parameters for the final approach phase using the
|
|
2065
|
+
ARPM model.
|
|
1970
2066
|
|
|
1971
2067
|
This function calculates key final approach parameters, including available and required power, true airspeed (TAS),
|
|
1972
2068
|
rate of descent (ROCD), and potential performance limitations. The calculations take into account atmospheric
|
|
@@ -2078,8 +2174,8 @@ class ARPM(BADAH):
|
|
|
2078
2174
|
pass
|
|
2079
2175
|
|
|
2080
2176
|
def landing(self, h, mass, DeltaTemp, ROCDDefault=None):
|
|
2081
|
-
"""
|
|
2082
|
-
|
|
2177
|
+
"""Computes various parameters for the landing phase using the ARPM
|
|
2178
|
+
model.
|
|
2083
2179
|
|
|
2084
2180
|
This function calculates key landing parameters, including available and required power, true airspeed (TAS),
|
|
2085
2181
|
rate of descent (ROCD), and potential performance limitations. The calculations take into account atmospheric
|
|
@@ -2151,8 +2247,8 @@ class ARPM(BADAH):
|
|
|
2151
2247
|
return [Pav, Peng, Preq, tas, ROCD, ESF, limitation]
|
|
2152
2248
|
|
|
2153
2249
|
def hover(self, h, mass, DeltaTemp):
|
|
2154
|
-
"""
|
|
2155
|
-
|
|
2250
|
+
"""Computes various parameters for the hover phase using the ARPM
|
|
2251
|
+
model.
|
|
2156
2252
|
|
|
2157
2253
|
This function calculates key hover parameters, including available and required power, true airspeed (TAS),
|
|
2158
2254
|
and any potential performance limitations. The calculations take into account atmospheric conditions, altitude,
|
|
@@ -2216,8 +2312,8 @@ class ARPM(BADAH):
|
|
|
2216
2312
|
ROCDDefault=None,
|
|
2217
2313
|
tasDefault=None,
|
|
2218
2314
|
):
|
|
2219
|
-
"""
|
|
2220
|
-
|
|
2315
|
+
"""Computes various parameters for different flight phases using the
|
|
2316
|
+
ARPM model.
|
|
2221
2317
|
|
|
2222
2318
|
This function calculates the available power (Pav), engine power (Peng), required power (Preq),
|
|
2223
2319
|
true airspeed (TAS), rate of climb or descent (ROCD), energy share factor (ESF), and any limitations
|
|
@@ -2345,7 +2441,8 @@ class ARPM(BADAH):
|
|
|
2345
2441
|
|
|
2346
2442
|
|
|
2347
2443
|
class PTD(BADAH):
|
|
2348
|
-
"""This class implements the PTD file creator for BADAH aircraft following
|
|
2444
|
+
"""This class implements the PTD file creator for BADAH aircraft following
|
|
2445
|
+
BADAH manual.
|
|
2349
2446
|
|
|
2350
2447
|
:param AC: Aircraft object {BADAH}.
|
|
2351
2448
|
:type AC: badaHAircraft.
|
|
@@ -2358,9 +2455,8 @@ class PTD(BADAH):
|
|
|
2358
2455
|
self.ARPM = ARPM(AC)
|
|
2359
2456
|
|
|
2360
2457
|
def create(self, saveToPath, DeltaTemp):
|
|
2361
|
-
"""
|
|
2362
|
-
|
|
2363
|
-
mass levels, altitudes, and temperatures.
|
|
2458
|
+
"""Creates a BADAH PTD file based on aircraft performance data at
|
|
2459
|
+
different mass levels, altitudes, and temperatures.
|
|
2364
2460
|
|
|
2365
2461
|
This function calculates performance data for three different mass levels (low, medium, high), at various
|
|
2366
2462
|
altitudes, and for different temperature deviations from the International Standard Atmosphere (ISA).
|
|
@@ -2464,14 +2560,15 @@ class PTD(BADAH):
|
|
|
2464
2560
|
HOVERList,
|
|
2465
2561
|
DeltaTemp,
|
|
2466
2562
|
):
|
|
2467
|
-
"""
|
|
2468
|
-
Saves the computed performance data to a BADAH PTD file.
|
|
2563
|
+
"""Saves the computed performance data to a BADAH PTD file.
|
|
2469
2564
|
|
|
2470
|
-
This function saves the performance data generated during different
|
|
2471
|
-
|
|
2565
|
+
This function saves the performance data generated during different
|
|
2566
|
+
flight phases (climb, cruise, descent, hover) and for different engine
|
|
2567
|
+
ratings (ARPM, MTKF, MCNT) into a PTD file. The file is named based on
|
|
2472
2568
|
the aircraft name and ISA deviation.
|
|
2473
2569
|
|
|
2474
|
-
:param saveToPath: Path to the directory where the PTD file should be
|
|
2570
|
+
:param saveToPath: Path to the directory where the PTD file should be
|
|
2571
|
+
saved.
|
|
2475
2572
|
:param CLList_ARPM: List of climb data for the BADA ARPM rating.
|
|
2476
2573
|
:param CLList_MTKF: List of climb data for the BADA MTKF rating.
|
|
2477
2574
|
:param CLList_MCNT: List of climb data for the BADA MCNT rating.
|
|
@@ -3123,13 +3220,14 @@ class PTD(BADAH):
|
|
|
3123
3220
|
)
|
|
3124
3221
|
|
|
3125
3222
|
def PTD_climb(self, mass, altitudeList, DeltaTemp, rating):
|
|
3126
|
-
"""
|
|
3127
|
-
|
|
3223
|
+
"""Calculates the BADAH PTD (Performance Table Data) for the climb
|
|
3224
|
+
phase.
|
|
3128
3225
|
|
|
3129
|
-
This function computes the aircraft's performance parameters during
|
|
3130
|
-
altitude level in the given altitude list.
|
|
3131
|
-
|
|
3132
|
-
|
|
3226
|
+
This function computes the aircraft's performance parameters during
|
|
3227
|
+
the climb phase for each altitude level in the given altitude list.
|
|
3228
|
+
Parameters such as temperature, pressure, density, true airspeed
|
|
3229
|
+
(TAS), and rate of climb/descent (ROCD) are calculated and returned in
|
|
3230
|
+
a list format that can be used for generating PTD files.
|
|
3133
3231
|
|
|
3134
3232
|
:param mass: Aircraft mass [kg].
|
|
3135
3233
|
:param altitudeList: List of altitude values [ft].
|
|
@@ -3236,13 +3334,14 @@ class PTD(BADAH):
|
|
|
3236
3334
|
return CLList
|
|
3237
3335
|
|
|
3238
3336
|
def PTD_descent(self, mass, altitudeList, DeltaTemp):
|
|
3239
|
-
"""
|
|
3240
|
-
|
|
3337
|
+
"""Calculates the BADAH PTD (Performance Table Data) for the descent
|
|
3338
|
+
phase.
|
|
3241
3339
|
|
|
3242
|
-
This function computes the aircraft's performance parameters during
|
|
3243
|
-
altitude level in the given altitude list.
|
|
3244
|
-
|
|
3245
|
-
|
|
3340
|
+
This function computes the aircraft's performance parameters during
|
|
3341
|
+
the descent phase for each altitude level in the given altitude list.
|
|
3342
|
+
It calculates values such as temperature, pressure, density, true
|
|
3343
|
+
airspeed (TAS), and rate of descent (ROD), and returns the data in a
|
|
3344
|
+
structured list format for PTD file generation.
|
|
3246
3345
|
|
|
3247
3346
|
:param mass: Aircraft mass [kg].
|
|
3248
3347
|
:param altitudeList: List of altitude values [ft].
|
|
@@ -3340,13 +3439,14 @@ class PTD(BADAH):
|
|
|
3340
3439
|
return DESList
|
|
3341
3440
|
|
|
3342
3441
|
def PTD_cruise(self, mass, altitudeList, DeltaTemp):
|
|
3343
|
-
"""
|
|
3344
|
-
|
|
3442
|
+
"""Calculates the BADAH PTD (Performance Table Data) for the cruise
|
|
3443
|
+
phase.
|
|
3345
3444
|
|
|
3346
|
-
This function computes the aircraft's performance parameters during
|
|
3347
|
-
altitude level in the given altitude list.
|
|
3348
|
-
|
|
3349
|
-
|
|
3445
|
+
This function computes the aircraft's performance parameters during
|
|
3446
|
+
the cruise phase for each altitude level in the given altitude list.
|
|
3447
|
+
Key performance metrics like temperature, pressure, density, TAS, and
|
|
3448
|
+
fuel consumption are calculated and stored in a structured list for
|
|
3449
|
+
PTD file generation.
|
|
3350
3450
|
|
|
3351
3451
|
:param mass: Aircraft mass [kg].
|
|
3352
3452
|
:param altitudeList: List of altitude values [ft].
|
|
@@ -3439,13 +3539,14 @@ class PTD(BADAH):
|
|
|
3439
3539
|
return CRList
|
|
3440
3540
|
|
|
3441
3541
|
def PTD_hover(self, mass, altitudeList, DeltaTemp):
|
|
3442
|
-
"""
|
|
3443
|
-
|
|
3542
|
+
"""Calculates the BADAH PTD (Performance Table Data) for the hover
|
|
3543
|
+
phase.
|
|
3444
3544
|
|
|
3445
|
-
This function computes the aircraft's performance parameters during
|
|
3446
|
-
altitude level in the given altitude list. It
|
|
3447
|
-
|
|
3448
|
-
|
|
3545
|
+
This function computes the aircraft's performance parameters during
|
|
3546
|
+
the hover phase for each altitude level in the given altitude list. It
|
|
3547
|
+
calculates values like temperature, pressure, density, and fuel
|
|
3548
|
+
consumption during hover and returns the data in a structured list
|
|
3549
|
+
format for PTD generation.
|
|
3449
3550
|
|
|
3450
3551
|
:param mass: Aircraft mass [kg].
|
|
3451
3552
|
:param altitudeList: List of altitude values [ft].
|
|
@@ -3539,7 +3640,8 @@ class PTD(BADAH):
|
|
|
3539
3640
|
|
|
3540
3641
|
|
|
3541
3642
|
class PTF(BADAH):
|
|
3542
|
-
"""This class implements the PTF file creator for BADAH aircraft following
|
|
3643
|
+
"""This class implements the PTF file creator for BADAH aircraft following
|
|
3644
|
+
BADAH manual.
|
|
3543
3645
|
|
|
3544
3646
|
:param AC: Aircraft object {BADAH}.
|
|
3545
3647
|
:type AC: badaHAircraft.
|
|
@@ -3552,10 +3654,10 @@ class PTF(BADAH):
|
|
|
3552
3654
|
self.ARPM = ARPM(AC)
|
|
3553
3655
|
|
|
3554
3656
|
def create(self, saveToPath, DeltaTemp):
|
|
3555
|
-
"""
|
|
3556
|
-
Creates the BADAH PTF and saves it to the specified directory.
|
|
3657
|
+
"""Creates the BADAH PTF and saves it to the specified directory.
|
|
3557
3658
|
|
|
3558
|
-
:param saveToPath: Path to the directory where the PTF should be
|
|
3659
|
+
:param saveToPath: Path to the directory where the PTF should be
|
|
3660
|
+
stored.
|
|
3559
3661
|
:param DeltaTemp: Deviation from ISA temperature [K].
|
|
3560
3662
|
:type saveToPath: str
|
|
3561
3663
|
:type DeltaTemp: float
|
|
@@ -3609,10 +3711,10 @@ class PTF(BADAH):
|
|
|
3609
3711
|
DeltaTemp,
|
|
3610
3712
|
massList,
|
|
3611
3713
|
):
|
|
3612
|
-
"""
|
|
3613
|
-
Saves the BADAH performance data to a PTF format.
|
|
3714
|
+
"""Saves the BADAH performance data to a PTF format.
|
|
3614
3715
|
|
|
3615
|
-
:param saveToPath: Path to the directory where the PTF should be
|
|
3716
|
+
:param saveToPath: Path to the directory where the PTF should be
|
|
3717
|
+
stored.
|
|
3616
3718
|
:param CLList: List of PTD data for CLIMB.
|
|
3617
3719
|
:param CRList: List of PTD data for CRUISE.
|
|
3618
3720
|
:param DESList: List of PTD data for DESCENT.
|
|
@@ -3626,10 +3728,9 @@ class PTF(BADAH):
|
|
|
3626
3728
|
:type DeltaTemp: float
|
|
3627
3729
|
:type massList: list(float)
|
|
3628
3730
|
:returns: None
|
|
3629
|
-
:rtype: None
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
and altitudes into a .PTF file, adhering to the BADAH performance file format.
|
|
3731
|
+
:rtype: None This function formats and writes the climb, cruise, and
|
|
3732
|
+
descent data for different mass levels and altitudes into a .PTF
|
|
3733
|
+
file, adhering to the BADAH performance file format.
|
|
3633
3734
|
"""
|
|
3634
3735
|
|
|
3635
3736
|
newpath = saveToPath
|
|
@@ -3723,8 +3824,7 @@ class PTF(BADAH):
|
|
|
3723
3824
|
)
|
|
3724
3825
|
|
|
3725
3826
|
def PTF_cruise(self, massList, altitudeList, DeltaTemp):
|
|
3726
|
-
"""
|
|
3727
|
-
Calculates the BADAH PTF for the CRUISE phase of flight.
|
|
3827
|
+
"""Calculates the BADAH PTF for the CRUISE phase of flight.
|
|
3728
3828
|
|
|
3729
3829
|
:param massList: List of aircraft mass levels in kilograms [kg].
|
|
3730
3830
|
:param altitudeList: List of aircraft altitudes in feet [ft].
|
|
@@ -3799,8 +3899,7 @@ class PTF(BADAH):
|
|
|
3799
3899
|
return CRList
|
|
3800
3900
|
|
|
3801
3901
|
def PTF_climb(self, massList, altitudeList, DeltaTemp, rating):
|
|
3802
|
-
"""
|
|
3803
|
-
Calculates the BADAH PTF for the CLIMB phase of flight.
|
|
3902
|
+
"""Calculates the BADAH PTF for the CLIMB phase of flight.
|
|
3804
3903
|
|
|
3805
3904
|
:param massList: List of aircraft mass levels in kilograms [kg].
|
|
3806
3905
|
:param altitudeList: List of aircraft altitudes in feet [ft].
|
|
@@ -3810,8 +3909,8 @@ class PTF(BADAH):
|
|
|
3810
3909
|
:type altitudeList: list of int
|
|
3811
3910
|
:type DeltaTemp: float
|
|
3812
3911
|
:type rating: str
|
|
3813
|
-
:returns: List of PTF CLIMB data, including True Airspeed, Rates of
|
|
3814
|
-
|
|
3912
|
+
:returns: List of PTF CLIMB data, including True Airspeed, Rates of
|
|
3913
|
+
Climb, and Fuel Flow for each mass level.
|
|
3815
3914
|
:rtype: list
|
|
3816
3915
|
"""
|
|
3817
3916
|
|
|
@@ -3878,8 +3977,7 @@ class PTF(BADAH):
|
|
|
3878
3977
|
return CLList
|
|
3879
3978
|
|
|
3880
3979
|
def PTF_descent(self, massList, altitudeList, DeltaTemp):
|
|
3881
|
-
"""
|
|
3882
|
-
Calculates the BADAH PTF for the DESCENT phase of flight.
|
|
3980
|
+
"""Calculates the BADAH PTF for the DESCENT phase of flight.
|
|
3883
3981
|
|
|
3884
3982
|
:param massList: List of aircraft mass levels in kilograms [kg].
|
|
3885
3983
|
:param altitudeList: List of aircraft altitudes in feet [ft].
|
|
@@ -3948,26 +4046,27 @@ class PTF(BADAH):
|
|
|
3948
4046
|
|
|
3949
4047
|
|
|
3950
4048
|
class BadaHAircraft(BADAH):
|
|
3951
|
-
"""
|
|
3952
|
-
|
|
4049
|
+
"""This class encapsulates the BADAH performance model for an aircraft,
|
|
4050
|
+
extending the BADAH base class.
|
|
3953
4051
|
|
|
3954
4052
|
:param badaVersion: The version of the BADAH model being used.
|
|
3955
4053
|
:param acName: The ICAO designation or name of the aircraft.
|
|
3956
|
-
:param filePath: (Optional) Path to the BADAH XML file. If not provided, a
|
|
3957
|
-
|
|
3958
|
-
|
|
4054
|
+
:param filePath: (Optional) Path to the BADAH XML file. If not provided, a
|
|
4055
|
+
default path is used.
|
|
4056
|
+
:param allData: (Optional) Dataframe containing pre-loaded aircraft data,
|
|
4057
|
+
typically used to initialize the aircraft parameters without needing
|
|
4058
|
+
to parse XML files.
|
|
3959
4059
|
:type badaVersion: str
|
|
3960
4060
|
:type acName: str
|
|
3961
4061
|
:type filePath: str, optional
|
|
3962
|
-
:type allData: pd.DataFrame, optional
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
reading from XML files in the BADAH format.
|
|
4062
|
+
:type allData: pd.DataFrame, optional This class initializes the
|
|
4063
|
+
aircraft's performance model using data from a dataframe or by reading
|
|
4064
|
+
from XML files in the BADAH format.
|
|
3966
4065
|
"""
|
|
3967
4066
|
|
|
3968
4067
|
def __init__(self, badaVersion, acName, filePath=None, allData=None):
|
|
3969
|
-
"""
|
|
3970
|
-
|
|
4068
|
+
"""Initializes the BADAHAircraft class by loading aircraft-specific
|
|
4069
|
+
data.
|
|
3971
4070
|
|
|
3972
4071
|
- If `allData` is provided and contains the aircraft's information, it will be used to
|
|
3973
4072
|
initialize various parameters such as engine type, mass, thrust settings, and performance
|
|
@@ -3990,7 +4089,7 @@ class BadaHAircraft(BADAH):
|
|
|
3990
4089
|
self.BADAVersion = badaVersion
|
|
3991
4090
|
self.acName = acName
|
|
3992
4091
|
|
|
3993
|
-
if filePath
|
|
4092
|
+
if filePath is None:
|
|
3994
4093
|
self.filePath = configuration.getBadaVersionPath(
|
|
3995
4094
|
badaFamily="BADAH", badaVersion=badaVersion
|
|
3996
4095
|
)
|
|
@@ -4053,7 +4152,7 @@ class BadaHAircraft(BADAH):
|
|
|
4053
4152
|
)
|
|
4054
4153
|
|
|
4055
4154
|
# if cannot find - look for full name (in sub folder names) based on acName (may not be ICAO designator)
|
|
4056
|
-
if self.SearchedACName
|
|
4155
|
+
if self.SearchedACName is None:
|
|
4057
4156
|
self.SearchedACName = acName
|
|
4058
4157
|
else:
|
|
4059
4158
|
self.ACinSynonymFile = True
|