pyBADA 0.1.5__py3-none-any.whl → 0.1.6__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 +10 -17
- pyBADA/aircraft.py +2 -2
- pyBADA/atmosphere.py +403 -269
- pyBADA/bada3.py +58 -71
- pyBADA/bada4.py +116 -130
- pyBADA/badaH.py +20 -33
- pyBADA/configuration.py +2 -1
- pyBADA/conversions.py +113 -140
- pyBADA/flightTrajectory.py +2 -1
- pyBADA/geodesic.py +116 -10
- pyBADA/magnetic.py +2 -1
- pyBADA/trajectoryPrediction.py +13 -12
- pyBADA/utils.py +204 -0
- {pybada-0.1.5.dist-info → pybada-0.1.6.dist-info}/METADATA +14 -12
- {pybada-0.1.5.dist-info → pybada-0.1.6.dist-info}/RECORD +18 -17
- {pybada-0.1.5.dist-info → pybada-0.1.6.dist-info}/WHEEL +0 -0
- {pybada-0.1.5.dist-info → pybada-0.1.6.dist-info}/licenses/AUTHORS +0 -0
- {pybada-0.1.5.dist-info → pybada-0.1.6.dist-info}/licenses/LICENCE.txt +0 -0
pyBADA/bada4.py
CHANGED
|
@@ -5,35 +5,21 @@ Developed @EUROCONTROL (EIH)
|
|
|
5
5
|
2024
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
|
-
from math import sqrt, pow, pi, isnan, sin, asin
|
|
9
|
-
|
|
10
|
-
import numpy as np
|
|
11
8
|
import os
|
|
12
|
-
from datetime import date
|
|
13
9
|
import xml.etree.ElementTree as ET
|
|
10
|
+
from datetime import date
|
|
11
|
+
from math import asin, isnan, pi, pow, sin, sqrt
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
import numpy as np
|
|
16
14
|
import pandas as pd
|
|
15
|
+
from scipy.optimize import fminbound
|
|
17
16
|
|
|
18
|
-
from pyBADA import
|
|
19
|
-
from pyBADA import conversions as conv
|
|
17
|
+
from pyBADA import utils
|
|
20
18
|
from pyBADA import atmosphere as atm
|
|
21
19
|
from pyBADA import configuration as configuration
|
|
22
|
-
from pyBADA
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
def proper_round(num, dec=0):
|
|
26
|
-
num = str(num)[: str(num).index(".") + dec + 2]
|
|
27
|
-
if num[-1] >= "5":
|
|
28
|
-
return float(num[: -2 - (not dec)] + str(int(num[-2 - (not dec)]) + 1))
|
|
29
|
-
return float(num[:-1])
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
def checkArgument(argument, **kwargs):
|
|
33
|
-
if kwargs.get(argument) is not None:
|
|
34
|
-
return kwargs.get(argument)
|
|
35
|
-
else:
|
|
36
|
-
raise TypeError("Missing " + argument + " argument")
|
|
20
|
+
from pyBADA import constants as const
|
|
21
|
+
from pyBADA import conversions as conv
|
|
22
|
+
from pyBADA.aircraft import Airplane, Bada, BadaFamily
|
|
37
23
|
|
|
38
24
|
|
|
39
25
|
class Parser:
|
|
@@ -927,7 +913,7 @@ class BADA4(Airplane, Bada):
|
|
|
927
913
|
"""
|
|
928
914
|
|
|
929
915
|
if self.AC.engineType == "JET":
|
|
930
|
-
M = checkArgument("M", **kwargs)
|
|
916
|
+
M = utils.checkArgument("M", **kwargs)
|
|
931
917
|
|
|
932
918
|
# when idle rating is used
|
|
933
919
|
CF_idle = self.CF_idle(delta=delta, theta=theta, M=M)
|
|
@@ -947,7 +933,7 @@ class BADA4(Airplane, Bada):
|
|
|
947
933
|
|
|
948
934
|
# rating as input parameter
|
|
949
935
|
elif "rating" in kwargs:
|
|
950
|
-
rating = checkArgument("rating", **kwargs)
|
|
936
|
+
rating = utils.checkArgument("rating", **kwargs)
|
|
951
937
|
|
|
952
938
|
# in case MCRZ rating is not defined, we switch to MCMB
|
|
953
939
|
if rating == "MCRZ" and rating not in self.AC.kink.keys():
|
|
@@ -997,7 +983,7 @@ class BADA4(Airplane, Bada):
|
|
|
997
983
|
CF = max(CF_gen_deltaT, CF_idle)
|
|
998
984
|
|
|
999
985
|
elif self.AC.engineType == "TURBOPROP":
|
|
1000
|
-
M = checkArgument("M", **kwargs)
|
|
986
|
+
M = utils.checkArgument("M", **kwargs)
|
|
1001
987
|
|
|
1002
988
|
# when idle rating is used
|
|
1003
989
|
CF_idle = self.CF_idle(delta=delta, theta=theta, M=M)
|
|
@@ -1018,7 +1004,7 @@ class BADA4(Airplane, Bada):
|
|
|
1018
1004
|
|
|
1019
1005
|
# rating as input parameter
|
|
1020
1006
|
elif "rating" in kwargs:
|
|
1021
|
-
rating = checkArgument("rating", **kwargs)
|
|
1007
|
+
rating = utils.checkArgument("rating", **kwargs)
|
|
1022
1008
|
|
|
1023
1009
|
# in case MCRZ rating is not defined, we switch to MCMB
|
|
1024
1010
|
if rating == "MCRZ" and rating not in self.AC.max_power.keys():
|
|
@@ -1071,7 +1057,7 @@ class BADA4(Airplane, Bada):
|
|
|
1071
1057
|
# for adaptive thrust calcualation if CT is an input
|
|
1072
1058
|
if "CT" in kwargs:
|
|
1073
1059
|
CT = kwargs.get("CT")
|
|
1074
|
-
M = checkArgument("M", **kwargs)
|
|
1060
|
+
M = utils.checkArgument("M", **kwargs)
|
|
1075
1061
|
|
|
1076
1062
|
deltaT_vec = np.arange(0.01, 1.01, 0.01)
|
|
1077
1063
|
|
|
@@ -1099,7 +1085,7 @@ class BADA4(Airplane, Bada):
|
|
|
1099
1085
|
|
|
1100
1086
|
# rating as input parameter
|
|
1101
1087
|
elif "rating" in kwargs:
|
|
1102
|
-
rating = checkArgument("rating", **kwargs)
|
|
1088
|
+
rating = utils.checkArgument("rating", **kwargs)
|
|
1103
1089
|
|
|
1104
1090
|
CP = self.CP(
|
|
1105
1091
|
rating=rating,
|
|
@@ -1140,14 +1126,14 @@ class BADA4(Airplane, Bada):
|
|
|
1140
1126
|
return CT
|
|
1141
1127
|
|
|
1142
1128
|
else:
|
|
1143
|
-
theta = checkArgument("theta", **kwargs)
|
|
1144
|
-
DeltaTemp = checkArgument("DeltaTemp", **kwargs)
|
|
1145
|
-
M = checkArgument("M", **kwargs)
|
|
1129
|
+
theta = utils.checkArgument("theta", **kwargs)
|
|
1130
|
+
DeltaTemp = utils.checkArgument("DeltaTemp", **kwargs)
|
|
1131
|
+
M = utils.checkArgument("M", **kwargs)
|
|
1146
1132
|
|
|
1147
1133
|
if self.AC.engineType == "JET":
|
|
1148
1134
|
# rating as input parameter
|
|
1149
1135
|
if "rating" in kwargs:
|
|
1150
|
-
rating = checkArgument("rating", **kwargs)
|
|
1136
|
+
rating = utils.checkArgument("rating", **kwargs)
|
|
1151
1137
|
|
|
1152
1138
|
# in case MCRZ rating is not defined, we switch to MCMB
|
|
1153
1139
|
if rating == "MCRZ" and rating not in self.AC.kink.keys():
|
|
@@ -1173,7 +1159,7 @@ class BADA4(Airplane, Bada):
|
|
|
1173
1159
|
|
|
1174
1160
|
# deltaT - direct throttle as input parameter
|
|
1175
1161
|
elif "deltaT" in kwargs:
|
|
1176
|
-
deltaT = checkArgument("deltaT", **kwargs)
|
|
1162
|
+
deltaT = utils.checkArgument("deltaT", **kwargs)
|
|
1177
1163
|
|
|
1178
1164
|
CT = 0.0
|
|
1179
1165
|
for i in range(0, 6):
|
|
@@ -1201,7 +1187,7 @@ class BADA4(Airplane, Bada):
|
|
|
1201
1187
|
elif self.AC.engineType == "TURBOPROP":
|
|
1202
1188
|
# rating as input parameter
|
|
1203
1189
|
if "rating" in kwargs:
|
|
1204
|
-
rating = checkArgument("rating", **kwargs)
|
|
1190
|
+
rating = utils.checkArgument("rating", **kwargs)
|
|
1205
1191
|
|
|
1206
1192
|
# in case MCRZ rating is not defined, we switch to MCMB
|
|
1207
1193
|
if rating == "MCRZ" and rating not in self.AC.max_power.keys():
|
|
@@ -1223,7 +1209,7 @@ class BADA4(Airplane, Bada):
|
|
|
1223
1209
|
|
|
1224
1210
|
# deltaT - direct throttle as input parameter
|
|
1225
1211
|
elif "deltaT" in kwargs:
|
|
1226
|
-
deltaT = checkArgument("deltaT", **kwargs)
|
|
1212
|
+
deltaT = utils.checkArgument("deltaT", **kwargs)
|
|
1227
1213
|
|
|
1228
1214
|
CP = self.CP(deltaT=deltaT, M=M)
|
|
1229
1215
|
CT = CP / M
|
|
@@ -1246,7 +1232,7 @@ class BADA4(Airplane, Bada):
|
|
|
1246
1232
|
|
|
1247
1233
|
# rating as input parameter
|
|
1248
1234
|
if "rating" in kwargs:
|
|
1249
|
-
rating = checkArgument("rating", **kwargs)
|
|
1235
|
+
rating = utils.checkArgument("rating", **kwargs)
|
|
1250
1236
|
if rating not in ["MCMB", "MCRZ"] and rating != "LIDL":
|
|
1251
1237
|
raise ValueError("Unknown engine rating " + rating)
|
|
1252
1238
|
|
|
@@ -1260,7 +1246,7 @@ class BADA4(Airplane, Bada):
|
|
|
1260
1246
|
|
|
1261
1247
|
# deltaT - direct throttle as input parameter
|
|
1262
1248
|
elif "deltaT" in kwargs:
|
|
1263
|
-
deltaT = checkArgument("deltaT", **kwargs)
|
|
1249
|
+
deltaT = utils.checkArgument("deltaT", **kwargs)
|
|
1264
1250
|
|
|
1265
1251
|
CP = self.CP(
|
|
1266
1252
|
theta=theta,
|
|
@@ -1290,8 +1276,8 @@ class BADA4(Airplane, Bada):
|
|
|
1290
1276
|
"""
|
|
1291
1277
|
|
|
1292
1278
|
if self.AC.engineType == "JET":
|
|
1293
|
-
delta = checkArgument("delta", **kwargs)
|
|
1294
|
-
M = checkArgument("M", **kwargs)
|
|
1279
|
+
delta = utils.checkArgument("delta", **kwargs)
|
|
1280
|
+
M = utils.checkArgument("M", **kwargs)
|
|
1295
1281
|
|
|
1296
1282
|
CT = 0.0
|
|
1297
1283
|
for i in range(0, 3):
|
|
@@ -1299,9 +1285,9 @@ class BADA4(Airplane, Bada):
|
|
|
1299
1285
|
CT += self.AC.ti[i * 4 + j] * pow(delta, j - 1) * (M**i)
|
|
1300
1286
|
|
|
1301
1287
|
elif self.AC.engineType == "TURBOPROP":
|
|
1302
|
-
theta = checkArgument("theta", **kwargs)
|
|
1303
|
-
delta = checkArgument("delta", **kwargs)
|
|
1304
|
-
M = checkArgument("M", **kwargs)
|
|
1288
|
+
theta = utils.checkArgument("theta", **kwargs)
|
|
1289
|
+
delta = utils.checkArgument("delta", **kwargs)
|
|
1290
|
+
M = utils.checkArgument("M", **kwargs)
|
|
1305
1291
|
|
|
1306
1292
|
CT = 0.0
|
|
1307
1293
|
for i in range(0, 3):
|
|
@@ -1340,10 +1326,10 @@ class BADA4(Airplane, Bada):
|
|
|
1340
1326
|
)
|
|
1341
1327
|
|
|
1342
1328
|
elif self.AC.engineType == "PISTON":
|
|
1343
|
-
theta = checkArgument("theta", **kwargs)
|
|
1344
|
-
delta = checkArgument("delta", **kwargs)
|
|
1345
|
-
CP = checkArgument("CP", **kwargs)
|
|
1346
|
-
M = checkArgument("M", **kwargs)
|
|
1329
|
+
theta = utils.checkArgument("theta", **kwargs)
|
|
1330
|
+
delta = utils.checkArgument("delta", **kwargs)
|
|
1331
|
+
CP = utils.checkArgument("CP", **kwargs)
|
|
1332
|
+
M = utils.checkArgument("M", **kwargs)
|
|
1347
1333
|
|
|
1348
1334
|
CT = self.CT_nonLIDL(theta=theta, delta=delta, M=M, CP=CP)
|
|
1349
1335
|
|
|
@@ -1366,8 +1352,8 @@ class BADA4(Airplane, Bada):
|
|
|
1366
1352
|
"""
|
|
1367
1353
|
|
|
1368
1354
|
if self.AC.engineType == "JET":
|
|
1369
|
-
rating = checkArgument("rating", **kwargs)
|
|
1370
|
-
DeltaTemp = checkArgument("DeltaTemp", **kwargs)
|
|
1355
|
+
rating = utils.checkArgument("rating", **kwargs)
|
|
1356
|
+
DeltaTemp = utils.checkArgument("DeltaTemp", **kwargs)
|
|
1371
1357
|
|
|
1372
1358
|
# deltaT below kink point -> flat-rated area
|
|
1373
1359
|
deltaTFlat = 0.0
|
|
@@ -1406,13 +1392,13 @@ class BADA4(Airplane, Bada):
|
|
|
1406
1392
|
CT += self.AC.a[i * 6 + j] * (M**j) * (deltaT**i)
|
|
1407
1393
|
|
|
1408
1394
|
elif self.AC.engineType == "TURBOPROP":
|
|
1409
|
-
rating = checkArgument("rating", **kwargs)
|
|
1395
|
+
rating = utils.checkArgument("rating", **kwargs)
|
|
1410
1396
|
|
|
1411
1397
|
CP = self.CP(rating=rating, theta=theta, delta=delta, M=M)
|
|
1412
1398
|
CT = CP / M
|
|
1413
1399
|
|
|
1414
1400
|
elif self.AC.engineType == "PISTON":
|
|
1415
|
-
CP = checkArgument("CP", **kwargs)
|
|
1401
|
+
CP = utils.checkArgument("CP", **kwargs)
|
|
1416
1402
|
|
|
1417
1403
|
sigma = atm.sigma(theta=theta, delta=delta)
|
|
1418
1404
|
Wp = self.AC.WREF * const.a_0 * CP
|
|
@@ -1480,7 +1466,7 @@ class BADA4(Airplane, Bada):
|
|
|
1480
1466
|
"""
|
|
1481
1467
|
|
|
1482
1468
|
if self.AC.engineType == "TURBOPROP":
|
|
1483
|
-
M = checkArgument("M", **kwargs)
|
|
1469
|
+
M = utils.checkArgument("M", **kwargs)
|
|
1484
1470
|
|
|
1485
1471
|
# CT as input parameter
|
|
1486
1472
|
# computes the power coefficient from thrust coefficient assuming efficiency of 1
|
|
@@ -1491,14 +1477,14 @@ class BADA4(Airplane, Bada):
|
|
|
1491
1477
|
|
|
1492
1478
|
# rating as input parameter
|
|
1493
1479
|
elif "rating" in kwargs:
|
|
1494
|
-
rating = checkArgument("rating", **kwargs)
|
|
1480
|
+
rating = utils.checkArgument("rating", **kwargs)
|
|
1495
1481
|
|
|
1496
1482
|
# in case MCRZ rating is not defined, we switch to MCMB
|
|
1497
1483
|
if rating == "MCRZ" and rating not in self.AC.max_power.keys():
|
|
1498
1484
|
rating = "MCMB"
|
|
1499
1485
|
|
|
1500
|
-
delta = checkArgument("delta", **kwargs)
|
|
1501
|
-
theta = checkArgument("theta", **kwargs)
|
|
1486
|
+
delta = utils.checkArgument("delta", **kwargs)
|
|
1487
|
+
theta = utils.checkArgument("theta", **kwargs)
|
|
1502
1488
|
|
|
1503
1489
|
deltaT = 0.0
|
|
1504
1490
|
for i in range(0, 6):
|
|
@@ -1519,7 +1505,7 @@ class BADA4(Airplane, Bada):
|
|
|
1519
1505
|
|
|
1520
1506
|
# deltaT - direct throttle as input parameter
|
|
1521
1507
|
elif "deltaT" in kwargs:
|
|
1522
|
-
deltaT = checkArgument("deltaT", **kwargs)
|
|
1508
|
+
deltaT = utils.checkArgument("deltaT", **kwargs)
|
|
1523
1509
|
|
|
1524
1510
|
CP = 0.0
|
|
1525
1511
|
for i in range(0, 6):
|
|
@@ -1527,10 +1513,10 @@ class BADA4(Airplane, Bada):
|
|
|
1527
1513
|
CP += self.AC.a[i * 6 + j] * (M**j) * (deltaT**i)
|
|
1528
1514
|
|
|
1529
1515
|
elif self.AC.engineType == "PISTON":
|
|
1530
|
-
delta = checkArgument("delta", **kwargs)
|
|
1531
|
-
theta = checkArgument("theta", **kwargs)
|
|
1532
|
-
sigma = checkArgument("sigma", **kwargs)
|
|
1533
|
-
DeltaTemp = checkArgument("DeltaTemp", **kwargs)
|
|
1516
|
+
delta = utils.checkArgument("delta", **kwargs)
|
|
1517
|
+
theta = utils.checkArgument("theta", **kwargs)
|
|
1518
|
+
sigma = utils.checkArgument("sigma", **kwargs)
|
|
1519
|
+
DeltaTemp = utils.checkArgument("DeltaTemp", **kwargs)
|
|
1534
1520
|
|
|
1535
1521
|
if self.AC.Hd_turbo <= 0:
|
|
1536
1522
|
theta_turbo = atm.theta(
|
|
@@ -1554,11 +1540,11 @@ class BADA4(Airplane, Bada):
|
|
|
1554
1540
|
|
|
1555
1541
|
# deltaT - direct throttle as input parameter
|
|
1556
1542
|
if "deltaT" in kwargs:
|
|
1557
|
-
deltaT = checkArgument("deltaT", **kwargs)
|
|
1543
|
+
deltaT = utils.checkArgument("deltaT", **kwargs)
|
|
1558
1544
|
|
|
1559
1545
|
# rating as input parameter
|
|
1560
1546
|
elif "rating" in kwargs:
|
|
1561
|
-
rating = checkArgument("rating", **kwargs)
|
|
1547
|
+
rating = utils.checkArgument("rating", **kwargs)
|
|
1562
1548
|
|
|
1563
1549
|
if rating == "LIDL":
|
|
1564
1550
|
if self.AC.BADAVersion == "4.2":
|
|
@@ -1694,8 +1680,8 @@ class BADA4(Airplane, Bada):
|
|
|
1694
1680
|
|
|
1695
1681
|
# calculation of drag coefficient in transition for HLid assuming LG is not changing
|
|
1696
1682
|
if "HLid_init" in kwargs and "HLid_final" in kwargs:
|
|
1697
|
-
HLid_init = checkArgument("HLid_init", **kwargs)
|
|
1698
|
-
HLid_final = checkArgument("HLid_final", **kwargs)
|
|
1683
|
+
HLid_init = utils.checkArgument("HLid_init", **kwargs)
|
|
1684
|
+
HLid_final = utils.checkArgument("HLid_final", **kwargs)
|
|
1699
1685
|
LG_init = LG
|
|
1700
1686
|
LG_final = LG
|
|
1701
1687
|
|
|
@@ -1724,8 +1710,8 @@ class BADA4(Airplane, Bada):
|
|
|
1724
1710
|
|
|
1725
1711
|
# calculation of drag coefficient in transition for LG assuming HLid is not changing
|
|
1726
1712
|
if "LG_init" in kwargs and "LG_final" in kwargs:
|
|
1727
|
-
LG_init = checkArgument("LG_init", **kwargs)
|
|
1728
|
-
LG_final = checkArgument("LG_final", **kwargs)
|
|
1713
|
+
LG_init = utils.checkArgument("LG_init", **kwargs)
|
|
1714
|
+
LG_final = utils.checkArgument("LG_final", **kwargs)
|
|
1729
1715
|
HLid_init = HLid
|
|
1730
1716
|
HLid_final = HLid
|
|
1731
1717
|
|
|
@@ -1852,7 +1838,7 @@ class BADA4(Airplane, Bada):
|
|
|
1852
1838
|
"""
|
|
1853
1839
|
|
|
1854
1840
|
if "rating" in kwargs:
|
|
1855
|
-
rating = checkArgument("rating", **kwargs)
|
|
1841
|
+
rating = utils.checkArgument("rating", **kwargs)
|
|
1856
1842
|
if rating == "TAXI":
|
|
1857
1843
|
if self.AC.TFA is not None:
|
|
1858
1844
|
return self.AC.TFA / 60
|
|
@@ -2384,12 +2370,12 @@ class FlightEnvelope(BADA4):
|
|
|
2384
2370
|
|
|
2385
2371
|
if "h" in kwargs:
|
|
2386
2372
|
h = kwargs.get("h")
|
|
2387
|
-
DeltaTemp = checkArgument("DeltaTemp", **kwargs)
|
|
2373
|
+
DeltaTemp = utils.checkArgument("DeltaTemp", **kwargs)
|
|
2388
2374
|
delta = atm.delta(h, DeltaTemp)
|
|
2389
2375
|
theta = atm.theta(h, DeltaTemp)
|
|
2390
2376
|
else:
|
|
2391
|
-
theta = checkArgument("theta", **kwargs)
|
|
2392
|
-
delta = checkArgument("delta", **kwargs)
|
|
2377
|
+
theta = utils.checkArgument("theta", **kwargs)
|
|
2378
|
+
delta = utils.checkArgument("delta", **kwargs)
|
|
2393
2379
|
|
|
2394
2380
|
sigma = atm.sigma(theta=theta, delta=delta)
|
|
2395
2381
|
minM = self.minMbuffet(
|
|
@@ -3511,7 +3497,7 @@ class Optimization(BADA4):
|
|
|
3511
3497
|
|
|
3512
3498
|
econM = M_econ[cost_econ.index(max(cost_econ))]
|
|
3513
3499
|
|
|
3514
|
-
return proper_round(econM, 10)
|
|
3500
|
+
return utils.proper_round(econM, 10)
|
|
3515
3501
|
|
|
3516
3502
|
# def f(M):
|
|
3517
3503
|
# CL = self.CL(M=M[0], delta=delta, mass=mass)
|
|
@@ -3758,7 +3744,7 @@ class Optimization(BADA4):
|
|
|
3758
3744
|
|
|
3759
3745
|
mecM = M_mec[CF_mec.index(min(CF_mec))]
|
|
3760
3746
|
|
|
3761
|
-
return proper_round(mecM, 10)
|
|
3747
|
+
return utils.proper_round(mecM, 10)
|
|
3762
3748
|
|
|
3763
3749
|
# def f(M):
|
|
3764
3750
|
# CL = self.CL(M=M[0], delta=delta, mass=mass)
|
|
@@ -3864,7 +3850,7 @@ class Optimization(BADA4):
|
|
|
3864
3850
|
if optH < 2000.0:
|
|
3865
3851
|
return 2000.0
|
|
3866
3852
|
|
|
3867
|
-
return proper_round(optH, 10)
|
|
3853
|
+
return utils.proper_round(optH, 10)
|
|
3868
3854
|
|
|
3869
3855
|
# def f(H):
|
|
3870
3856
|
# theta = atm.theta(h=H[0],DeltaTemp=DeltaTemp)
|
|
@@ -4718,21 +4704,21 @@ class PTD(BADA4):
|
|
|
4718
4704
|
dhdt = (conv.ft2m(ROCD / 60)) * temp_const
|
|
4719
4705
|
gamma = conv.rad2deg(asin(dhdt / tas))
|
|
4720
4706
|
|
|
4721
|
-
FL_complet.append(proper_round(FL))
|
|
4722
|
-
T_complet.append(theta * const.temp_0)
|
|
4723
|
-
p_complet.append(delta * const.p_0)
|
|
4724
|
-
rho_complet.append(sigma * const.rho_0)
|
|
4725
|
-
a_complet.append(a)
|
|
4726
|
-
TAS_complet.append(conv.ms2kt(tas))
|
|
4727
|
-
CAS_complet.append(conv.ms2kt(cas))
|
|
4728
|
-
M_complet.append(M)
|
|
4729
|
-
mass_complet.append(mass)
|
|
4730
|
-
Thrust_complet.append(Thrust)
|
|
4731
|
-
Drag_complet.append(Drag)
|
|
4732
|
-
ff_comlet.append(ff)
|
|
4733
|
-
ESF_complet.append(ESF)
|
|
4734
|
-
ROCD_complet.append(ROCD)
|
|
4735
|
-
gamma_complet.append(gamma)
|
|
4707
|
+
FL_complet.append(utils.proper_round(FL))
|
|
4708
|
+
T_complet.append(utils.proper_round(theta * const.temp_0,2))
|
|
4709
|
+
p_complet.append(utils.proper_round(delta * const.p_0))
|
|
4710
|
+
rho_complet.append(utils.proper_round(sigma * const.rho_0,3))
|
|
4711
|
+
a_complet.append(utils.proper_round(a,1))
|
|
4712
|
+
TAS_complet.append(utils.proper_round(conv.ms2kt(tas),2))
|
|
4713
|
+
CAS_complet.append(utils.proper_round(conv.ms2kt(cas),2))
|
|
4714
|
+
M_complet.append(utils.proper_round(M,3))
|
|
4715
|
+
mass_complet.append(utils.proper_round(mass))
|
|
4716
|
+
Thrust_complet.append(utils.proper_round(Thrust))
|
|
4717
|
+
Drag_complet.append(utils.proper_round(Drag))
|
|
4718
|
+
ff_comlet.append(utils.proper_round(ff,2))
|
|
4719
|
+
ESF_complet.append(utils.proper_round(ESF,3))
|
|
4720
|
+
ROCD_complet.append(utils.proper_round(ROCD))
|
|
4721
|
+
gamma_complet.append(utils.proper_round(gamma,2))
|
|
4736
4722
|
conf_complet.append(config)
|
|
4737
4723
|
Lim_complet.append(limitation)
|
|
4738
4724
|
|
|
@@ -4921,21 +4907,21 @@ class PTD(BADA4):
|
|
|
4921
4907
|
* 60
|
|
4922
4908
|
)
|
|
4923
4909
|
|
|
4924
|
-
FL_complet = [proper_round(FL)] + FL_complet
|
|
4925
|
-
T_complet = [theta * const.temp_0] + T_complet
|
|
4926
|
-
p_complet = [delta * const.p_0] + p_complet
|
|
4927
|
-
rho_complet = [sigma * const.rho_0] + rho_complet
|
|
4928
|
-
a_complet = [a] + a_complet
|
|
4929
|
-
TAS_complet = [conv.ms2kt(tas)] + TAS_complet
|
|
4930
|
-
CAS_complet = [conv.ms2kt(cas)] + CAS_complet
|
|
4931
|
-
M_complet = [M] + M_complet
|
|
4932
|
-
mass_complet = [mass] + mass_complet
|
|
4933
|
-
Thrust_complet = [Thrust] + Thrust_complet
|
|
4934
|
-
Drag_complet = [Drag] + Drag_complet
|
|
4935
|
-
ff_complet = [ff] + ff_complet
|
|
4936
|
-
ESF_complet = [ESF] + ESF_complet
|
|
4937
|
-
ROCD_complet = [-1 * ROCD] + ROCD_complet
|
|
4938
|
-
gamma_complet = [gamma] + gamma_complet
|
|
4910
|
+
FL_complet = [utils.proper_round(FL)] + FL_complet
|
|
4911
|
+
T_complet = [utils.proper_round(theta * const.temp_0,2)] + T_complet
|
|
4912
|
+
p_complet = [utils.proper_round(delta * const.p_0)] + p_complet
|
|
4913
|
+
rho_complet = [utils.proper_round(sigma * const.rho_0,3)] + rho_complet
|
|
4914
|
+
a_complet = [utils.proper_round(a,1)] + a_complet
|
|
4915
|
+
TAS_complet = [utils.proper_round(conv.ms2kt(tas),2)] + TAS_complet
|
|
4916
|
+
CAS_complet = [utils.proper_round(conv.ms2kt(cas),2)] + CAS_complet
|
|
4917
|
+
M_complet = [utils.proper_round(M,3)] + M_complet
|
|
4918
|
+
mass_complet = [utils.proper_round(mass)] + mass_complet
|
|
4919
|
+
Thrust_complet = [utils.proper_round(Thrust)] + Thrust_complet
|
|
4920
|
+
Drag_complet = [utils.proper_round(Drag)] + Drag_complet
|
|
4921
|
+
ff_complet = [utils.proper_round(ff,2)] + ff_complet
|
|
4922
|
+
ESF_complet = [utils.proper_round(ESF,3)] + ESF_complet
|
|
4923
|
+
ROCD_complet = [utils.proper_round(-1 * ROCD)] + ROCD_complet
|
|
4924
|
+
gamma_complet = [utils.proper_round(gamma,2)] + gamma_complet
|
|
4939
4925
|
conf_complet = [config] + conf_complet
|
|
4940
4926
|
Lim_complet = [limitation] + Lim_complet
|
|
4941
4927
|
|
|
@@ -5050,21 +5036,21 @@ class PTD(BADA4):
|
|
|
5050
5036
|
ROCD = 0.0
|
|
5051
5037
|
gamma = 0.0
|
|
5052
5038
|
|
|
5053
|
-
FL_complet.append(proper_round(FL))
|
|
5054
|
-
T_complet.append(theta * const.temp_0)
|
|
5055
|
-
p_complet.append(delta * const.p_0)
|
|
5056
|
-
rho_complet.append(sigma * const.rho_0)
|
|
5057
|
-
a_complet.append(a)
|
|
5058
|
-
TAS_complet.append(conv.ms2kt(tas))
|
|
5059
|
-
CAS_complet.append(conv.ms2kt(cas))
|
|
5060
|
-
M_complet.append(M)
|
|
5061
|
-
mass_complet.append(mass)
|
|
5062
|
-
Thrust_complet.append(Thrust)
|
|
5063
|
-
Drag_complet.append(Drag)
|
|
5064
|
-
ff_comlet.append(ff)
|
|
5065
|
-
ESF_complet.append(ESF)
|
|
5066
|
-
ROCD_complet.append(ROCD)
|
|
5067
|
-
gamma_complet.append(gamma)
|
|
5039
|
+
FL_complet.append(utils.proper_round(FL))
|
|
5040
|
+
T_complet.append(utils.proper_round(theta * const.temp_0,2))
|
|
5041
|
+
p_complet.append(utils.proper_round(delta * const.p_0))
|
|
5042
|
+
rho_complet.append(utils.proper_round(sigma * const.rho_0,3))
|
|
5043
|
+
a_complet.append(utils.proper_round(a,1))
|
|
5044
|
+
TAS_complet.append(utils.proper_round(conv.ms2kt(tas),2))
|
|
5045
|
+
CAS_complet.append(utils.proper_round(conv.ms2kt(cas),2))
|
|
5046
|
+
M_complet.append(utils.proper_round(M,3))
|
|
5047
|
+
mass_complet.append(utils.proper_round(mass))
|
|
5048
|
+
Thrust_complet.append(utils.proper_round(Thrust))
|
|
5049
|
+
Drag_complet.append(utils.proper_round(Drag))
|
|
5050
|
+
ff_comlet.append(utils.proper_round(ff,2))
|
|
5051
|
+
ESF_complet.append(utils.proper_round(ESF,3))
|
|
5052
|
+
ROCD_complet.append(utils.proper_round(ROCD))
|
|
5053
|
+
gamma_complet.append(utils.proper_round(gamma,2))
|
|
5068
5054
|
conf_complet.append(config)
|
|
5069
5055
|
Lim_complet.append(limitation)
|
|
5070
5056
|
|
|
@@ -5281,7 +5267,7 @@ class PTF(BADA4):
|
|
|
5281
5267
|
DESList = Nan2Zero(DESList)
|
|
5282
5268
|
|
|
5283
5269
|
for k in range(0, len(altitudeList)):
|
|
5284
|
-
FL = proper_round(altitudeList[k] / 100)
|
|
5270
|
+
FL = utils.proper_round(altitudeList[k] / 100)
|
|
5285
5271
|
file.write(
|
|
5286
5272
|
"%3.0f | %s %s %s %s | %3.0f %5.0f %5.0f %5.0f %5.1f | %3.0f %5.0f %5.0f %5.0f %5.1f\n"
|
|
5287
5273
|
% (
|
|
@@ -5409,15 +5395,15 @@ class PTF(BADA4):
|
|
|
5409
5395
|
if isinstance(ff[0], str):
|
|
5410
5396
|
FF_CR_LO_complet.append(" " + ff[0] + " ")
|
|
5411
5397
|
else:
|
|
5412
|
-
FF_CR_LO_complet.append(f"{ff[0]:5.1f}")
|
|
5398
|
+
FF_CR_LO_complet.append(f"{utils.proper_round(ff[0],1):5.1f}")
|
|
5413
5399
|
if isinstance(ff[1], str):
|
|
5414
5400
|
FF_CR_NOM_complet.append(" " + ff[1] + " ")
|
|
5415
5401
|
else:
|
|
5416
|
-
FF_CR_NOM_complet.append(f"{ff[1]:5.1f}")
|
|
5402
|
+
FF_CR_NOM_complet.append(f"{utils.proper_round(ff[1],1):5.1f}")
|
|
5417
5403
|
if isinstance(ff[2], str):
|
|
5418
5404
|
FF_CR_HI_complet.append(" " + ff[2] + " ")
|
|
5419
5405
|
else:
|
|
5420
|
-
FF_CR_HI_complet.append(f"{ff[2]:5.1f}")
|
|
5406
|
+
FF_CR_HI_complet.append(f"{utils.proper_round(ff[2],1):5.1f}")
|
|
5421
5407
|
|
|
5422
5408
|
CRList = [
|
|
5423
5409
|
TAS_CR_complet,
|
|
@@ -5569,10 +5555,10 @@ class PTF(BADA4):
|
|
|
5569
5555
|
conf_complet[str(mass)].append(config)
|
|
5570
5556
|
|
|
5571
5557
|
TAS_CL_complet.append(conv.ms2kt(tas_nominal))
|
|
5572
|
-
ROCD_CL_LO_complet.append(ROC[0])
|
|
5573
|
-
ROCD_CL_NOM_complet.append(ROC[1])
|
|
5574
|
-
ROCD_CL_HI_complet.append(ROC[2])
|
|
5575
|
-
FF_CL_NOM_complet.append(ff_nominal)
|
|
5558
|
+
ROCD_CL_LO_complet.append(utils.proper_round(ROC[0]))
|
|
5559
|
+
ROCD_CL_NOM_complet.append(utils.proper_round(ROC[1]))
|
|
5560
|
+
ROCD_CL_HI_complet.append(utils.proper_round(ROC[2]))
|
|
5561
|
+
FF_CL_NOM_complet.append(utils.proper_round(ff_nominal,1))
|
|
5576
5562
|
|
|
5577
5563
|
CLList = [
|
|
5578
5564
|
TAS_CL_complet,
|
|
@@ -5759,11 +5745,11 @@ class PTF(BADA4):
|
|
|
5759
5745
|
if not isnan(ff_gamma_list[1]):
|
|
5760
5746
|
ff_nominal = ff_gamma_list[1]
|
|
5761
5747
|
|
|
5762
|
-
TAS_DES_complet = [conv.ms2kt(tas_nominal)] + TAS_DES_complet
|
|
5763
|
-
ROCD_DES_LO_complet = [-1 * ROD[0]] + ROCD_DES_LO_complet
|
|
5764
|
-
ROCD_DES_NOM_complet = [-1 * ROD[1]] + ROCD_DES_NOM_complet
|
|
5765
|
-
ROCD_DES_HI_complet = [-1 * ROD[2]] + ROCD_DES_HI_complet
|
|
5766
|
-
FF_DES_NOM_complet = [ff_nominal] + FF_DES_NOM_complet
|
|
5748
|
+
TAS_DES_complet = [utils.proper_round(conv.ms2kt(tas_nominal))] + TAS_DES_complet
|
|
5749
|
+
ROCD_DES_LO_complet = [utils.proper_round(-1 * ROD[0])] + ROCD_DES_LO_complet
|
|
5750
|
+
ROCD_DES_NOM_complet = [utils.proper_round(-1 * ROD[1])] + ROCD_DES_NOM_complet
|
|
5751
|
+
ROCD_DES_HI_complet = [utils.proper_round(-1 * ROD[2])] + ROCD_DES_HI_complet
|
|
5752
|
+
FF_DES_NOM_complet = [utils.proper_round(ff_nominal,1)] + FF_DES_NOM_complet
|
|
5767
5753
|
|
|
5768
5754
|
DESList = [
|
|
5769
5755
|
TAS_DES_complet,
|
pyBADA/badaH.py
CHANGED
|
@@ -2,33 +2,20 @@
|
|
|
2
2
|
Generic BADAH aircraft performance module
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
+
import os
|
|
5
6
|
import xml.etree.ElementTree as ET
|
|
6
7
|
from datetime import date
|
|
7
|
-
import
|
|
8
|
+
from math import asin, cos, isnan, pi, pow, radians, sqrt
|
|
9
|
+
|
|
8
10
|
import numpy as np
|
|
9
|
-
from math import sqrt, pow, pi, cos, asin, radians, isnan
|
|
10
11
|
import pandas as pd
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
from pyBADA import constants as const
|
|
14
|
-
from pyBADA import conversions as conv
|
|
13
|
+
from pyBADA import utils
|
|
15
14
|
from pyBADA import atmosphere as atm
|
|
16
15
|
from pyBADA import configuration as configuration
|
|
17
|
-
from pyBADA
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
def proper_round(num, dec=0):
|
|
21
|
-
num = str(num)[: str(num).index(".") + dec + 2]
|
|
22
|
-
if num[-1] >= "5":
|
|
23
|
-
return float(num[: -2 - (not dec)] + str(int(num[-2 - (not dec)]) + 1))
|
|
24
|
-
return float(num[:-1])
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def checkArgument(argument, **kwargs):
|
|
28
|
-
if kwargs.get(argument) is not None:
|
|
29
|
-
return kwargs.get(argument)
|
|
30
|
-
else:
|
|
31
|
-
raise TypeError("Missing " + argument + " argument")
|
|
16
|
+
from pyBADA import constants as const
|
|
17
|
+
from pyBADA import conversions as conv
|
|
18
|
+
from pyBADA.aircraft import Bada, BadaFamily, Helicopter
|
|
32
19
|
|
|
33
20
|
|
|
34
21
|
class Parser:
|
|
@@ -390,7 +377,7 @@ class BADAH(Helicopter, Bada):
|
|
|
390
377
|
:rtype: float
|
|
391
378
|
"""
|
|
392
379
|
|
|
393
|
-
# gamma = checkArgument('gamma', **kwargs)
|
|
380
|
+
# gamma = utils.checkArgument('gamma', **kwargs)
|
|
394
381
|
|
|
395
382
|
rho = sigma * const.rho_0
|
|
396
383
|
|
|
@@ -3295,7 +3282,7 @@ class PTD(BADAH):
|
|
|
3295
3282
|
else:
|
|
3296
3283
|
gamma = conv.rad2deg(asin(dhdt / tas))
|
|
3297
3284
|
|
|
3298
|
-
FL_complet.append(proper_round(FL))
|
|
3285
|
+
FL_complet.append(utils.proper_round(FL))
|
|
3299
3286
|
T_complet.append(temp)
|
|
3300
3287
|
p_complet.append(delta * const.p_0)
|
|
3301
3288
|
rho_complet.append(sigma * const.rho_0)
|
|
@@ -3303,7 +3290,7 @@ class PTD(BADAH):
|
|
|
3303
3290
|
TAS_complet.append(conv.ms2kt(tas))
|
|
3304
3291
|
CAS_complet.append(conv.ms2kt(cas))
|
|
3305
3292
|
M_complet.append(M)
|
|
3306
|
-
mass_complet.append(proper_round(mass))
|
|
3293
|
+
mass_complet.append(utils.proper_round(mass))
|
|
3307
3294
|
Peng_complet.append(Peng)
|
|
3308
3295
|
Preq_complet.append(Preq)
|
|
3309
3296
|
ff_complet.append(ff)
|
|
@@ -3400,7 +3387,7 @@ class PTD(BADAH):
|
|
|
3400
3387
|
else:
|
|
3401
3388
|
gamma = conv.rad2deg(asin(dhdt / tas))
|
|
3402
3389
|
|
|
3403
|
-
FL_complet.append(proper_round(FL))
|
|
3390
|
+
FL_complet.append(utils.proper_round(FL))
|
|
3404
3391
|
T_complet.append(temp)
|
|
3405
3392
|
p_complet.append(delta * const.p_0)
|
|
3406
3393
|
rho_complet.append(sigma * const.rho_0)
|
|
@@ -3408,7 +3395,7 @@ class PTD(BADAH):
|
|
|
3408
3395
|
TAS_complet.append(conv.ms2kt(tas))
|
|
3409
3396
|
CAS_complet.append(conv.ms2kt(cas))
|
|
3410
3397
|
M_complet.append(M)
|
|
3411
|
-
mass_complet.append(proper_round(mass))
|
|
3398
|
+
mass_complet.append(utils.proper_round(mass))
|
|
3412
3399
|
Peng_complet.append(Peng)
|
|
3413
3400
|
Preq_complet.append(Preq)
|
|
3414
3401
|
ff_comlet.append(ff)
|
|
@@ -3500,7 +3487,7 @@ class PTD(BADAH):
|
|
|
3500
3487
|
temp = theta * const.temp_0
|
|
3501
3488
|
gamma = 0
|
|
3502
3489
|
|
|
3503
|
-
FL_complet.append(proper_round(FL))
|
|
3490
|
+
FL_complet.append(utils.proper_round(FL))
|
|
3504
3491
|
T_complet.append(temp)
|
|
3505
3492
|
p_complet.append(delta * const.p_0)
|
|
3506
3493
|
rho_complet.append(sigma * const.rho_0)
|
|
@@ -3508,7 +3495,7 @@ class PTD(BADAH):
|
|
|
3508
3495
|
TAS_complet.append(conv.ms2kt(tas))
|
|
3509
3496
|
CAS_complet.append(conv.ms2kt(cas))
|
|
3510
3497
|
M_complet.append(M)
|
|
3511
|
-
mass_complet.append(proper_round(mass))
|
|
3498
|
+
mass_complet.append(utils.proper_round(mass))
|
|
3512
3499
|
Peng_complet.append(Peng)
|
|
3513
3500
|
Preq_complet.append(Preq)
|
|
3514
3501
|
ff_complet.append(ff)
|
|
@@ -3600,7 +3587,7 @@ class PTD(BADAH):
|
|
|
3600
3587
|
temp = theta * const.temp_0
|
|
3601
3588
|
gamma = 0
|
|
3602
3589
|
|
|
3603
|
-
FL_complet.append(proper_round(FL))
|
|
3590
|
+
FL_complet.append(utils.proper_round(FL))
|
|
3604
3591
|
T_complet.append(temp)
|
|
3605
3592
|
p_complet.append(delta * const.p_0)
|
|
3606
3593
|
rho_complet.append(sigma * const.rho_0)
|
|
@@ -3608,7 +3595,7 @@ class PTD(BADAH):
|
|
|
3608
3595
|
TAS_complet.append(conv.ms2kt(tas))
|
|
3609
3596
|
CAS_complet.append(conv.ms2kt(cas))
|
|
3610
3597
|
M_complet.append(M)
|
|
3611
|
-
mass_complet.append(proper_round(mass))
|
|
3598
|
+
mass_complet.append(utils.proper_round(mass))
|
|
3612
3599
|
Peng_complet.append(Peng)
|
|
3613
3600
|
Preq_complet.append(Preq)
|
|
3614
3601
|
ff_comlet.append(ff)
|
|
@@ -3764,15 +3751,15 @@ class PTF(BADAH):
|
|
|
3764
3751
|
)
|
|
3765
3752
|
file.write(
|
|
3766
3753
|
" climb - MEC low - %.0f\n"
|
|
3767
|
-
% (proper_round(massList[0]))
|
|
3754
|
+
% (utils.proper_round(massList[0]))
|
|
3768
3755
|
)
|
|
3769
3756
|
file.write(
|
|
3770
3757
|
" cruise - LRC nominal - %-4.0f Max Alt. [ft]:%7d\n"
|
|
3771
|
-
% (proper_round(massList[1]), altitudeList[-1])
|
|
3758
|
+
% (utils.proper_round(massList[1]), altitudeList[-1])
|
|
3772
3759
|
)
|
|
3773
3760
|
file.write(
|
|
3774
3761
|
" descent - LRC high - %0.f\n"
|
|
3775
|
-
% (proper_round(massList[2]))
|
|
3762
|
+
% (utils.proper_round(massList[2]))
|
|
3776
3763
|
)
|
|
3777
3764
|
file.write(
|
|
3778
3765
|
"======================================================================================================\n"
|
|
@@ -3794,7 +3781,7 @@ class PTF(BADAH):
|
|
|
3794
3781
|
)
|
|
3795
3782
|
|
|
3796
3783
|
for k in range(0, len(altitudeList)):
|
|
3797
|
-
FL = proper_round(altitudeList[k] / 100)
|
|
3784
|
+
FL = utils.proper_round(altitudeList[k] / 100)
|
|
3798
3785
|
file.write(
|
|
3799
3786
|
"%3.0f | %s %s %s %s | %3.0f %5.0f %5.0f %5.0f %5.1f | %3.0f %5.0f %5.0f %5.0f %5.1f\n"
|
|
3800
3787
|
% (
|