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/atmosphere.py
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
"""
|
|
3
|
-
Atmosphere module
|
|
4
|
-
"""
|
|
1
|
+
"""Atmosphere module."""
|
|
5
2
|
|
|
6
|
-
from math import sqrt, pow
|
|
3
|
+
from math import sqrt, pow
|
|
4
|
+
import numpy as np
|
|
7
5
|
|
|
8
6
|
from pyBADA import constants as const
|
|
9
7
|
from pyBADA import conversions as conv
|
|
@@ -21,18 +19,17 @@ def proper_round(num, dec=0):
|
|
|
21
19
|
|
|
22
20
|
|
|
23
21
|
def theta(h, DeltaTemp):
|
|
24
|
-
"""
|
|
25
|
-
|
|
22
|
+
"""Calculates the normalized temperature according to the International
|
|
23
|
+
Standard Atmosphere (ISA) model.
|
|
26
24
|
|
|
27
25
|
:param h: Altitude in meters (m).
|
|
28
26
|
:param DeltaTemp: Deviation from ISA temperature in Kelvin (K).
|
|
29
27
|
:type h: float
|
|
30
28
|
:type DeltaTemp: float
|
|
31
|
-
:returns: Normalized temperature [-].
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
Above the tropopause, a constant temperature is assumed.
|
|
29
|
+
:returns: Normalized temperature [-]. The function accounts for whether
|
|
30
|
+
the altitude is below or above the tropopause (11,000 m). Below the
|
|
31
|
+
tropopause, it applies the temperature lapse rate. Above the
|
|
32
|
+
tropopause, a constant temperature is assumed.
|
|
36
33
|
"""
|
|
37
34
|
|
|
38
35
|
if h < const.h_11:
|
|
@@ -45,16 +42,14 @@ def theta(h, DeltaTemp):
|
|
|
45
42
|
|
|
46
43
|
|
|
47
44
|
def delta(h, DeltaTemp):
|
|
48
|
-
"""
|
|
49
|
-
Calculates the normalized pressure according to the ISA model.
|
|
45
|
+
"""Calculates the normalized pressure according to the ISA model.
|
|
50
46
|
|
|
51
47
|
:param h: Altitude in meters (m).
|
|
52
48
|
:param DeltaTemp: Deviation from ISA temperature in Kelvin (K).
|
|
53
49
|
:type h: float
|
|
54
50
|
:type DeltaTemp: float
|
|
55
|
-
:returns: Normalized pressure [-].
|
|
56
|
-
|
|
57
|
-
The function uses the barometric equation for pressure changes below and above the tropopause.
|
|
51
|
+
:returns: Normalized pressure [-]. The function uses the barometric
|
|
52
|
+
equation for pressure changes below and above the tropopause.
|
|
58
53
|
"""
|
|
59
54
|
|
|
60
55
|
p = pow(
|
|
@@ -65,22 +60,22 @@ def delta(h, DeltaTemp):
|
|
|
65
60
|
if h <= const.h_11:
|
|
66
61
|
delta = p
|
|
67
62
|
else:
|
|
68
|
-
delta = p * exp(
|
|
63
|
+
delta = p * np.exp(
|
|
64
|
+
-const.g / const.R / const.temp_11 * (h - const.h_11)
|
|
65
|
+
)
|
|
69
66
|
|
|
70
67
|
return proper_round(delta, 10)
|
|
71
68
|
|
|
72
69
|
|
|
73
70
|
def sigma(theta, delta):
|
|
74
|
-
"""
|
|
75
|
-
Calculates the normalized air density according to the ISA model.
|
|
71
|
+
"""Calculates the normalized air density according to the ISA model.
|
|
76
72
|
|
|
77
73
|
:param theta: Normalized temperature [-].
|
|
78
74
|
:param delta: Normalized pressure [-].
|
|
79
75
|
:type theta: float
|
|
80
76
|
:type delta: float
|
|
81
|
-
:returns: Normalized air density [-].
|
|
82
|
-
|
|
83
|
-
The function uses the ideal gas law to relate pressure, temperature, and density.
|
|
77
|
+
:returns: Normalized air density [-]. The function uses the ideal gas law
|
|
78
|
+
to relate pressure, temperature, and density.
|
|
84
79
|
"""
|
|
85
80
|
|
|
86
81
|
return proper_round(
|
|
@@ -90,14 +85,13 @@ def sigma(theta, delta):
|
|
|
90
85
|
|
|
91
86
|
|
|
92
87
|
def aSound(theta):
|
|
93
|
-
"""
|
|
94
|
-
Calculates the speed of sound based on the normalized air temperature.
|
|
88
|
+
"""Calculates the speed of sound based on the normalized air temperature.
|
|
95
89
|
|
|
96
90
|
:param theta: Normalized temperature [-].
|
|
97
91
|
:type theta: float
|
|
98
|
-
:returns: Speed of sound in meters per second (m/s).
|
|
99
|
-
|
|
100
|
-
|
|
92
|
+
:returns: Speed of sound in meters per second (m/s). The speed of sound
|
|
93
|
+
depends on air temperature and is calculated using the specific heat
|
|
94
|
+
ratio and the gas constant.
|
|
101
95
|
"""
|
|
102
96
|
|
|
103
97
|
a = sqrt(const.Agamma * const.R * theta * const.temp_0)
|
|
@@ -105,8 +99,7 @@ def aSound(theta):
|
|
|
105
99
|
|
|
106
100
|
|
|
107
101
|
def mach2Tas(Mach, theta):
|
|
108
|
-
"""
|
|
109
|
-
Converts Mach number to true airspeed (TAS).
|
|
102
|
+
"""Converts Mach number to true airspeed (TAS).
|
|
110
103
|
|
|
111
104
|
:param Mach: Mach number [-].
|
|
112
105
|
:param theta: Normalized air temperature [-].
|
|
@@ -126,8 +119,7 @@ def mach2Tas(Mach, theta):
|
|
|
126
119
|
|
|
127
120
|
|
|
128
121
|
def tas2Mach(v, theta):
|
|
129
|
-
"""
|
|
130
|
-
Converts true airspeed (TAS) to Mach number.
|
|
122
|
+
"""Converts true airspeed (TAS) to Mach number.
|
|
131
123
|
|
|
132
124
|
:param v: True airspeed in meters per second (m/s).
|
|
133
125
|
:param theta: Normalized air temperature [-].
|
|
@@ -140,8 +132,7 @@ def tas2Mach(v, theta):
|
|
|
140
132
|
|
|
141
133
|
|
|
142
134
|
def tas2Cas(tas, delta, sigma):
|
|
143
|
-
"""
|
|
144
|
-
Converts true airspeed (TAS) to calibrated airspeed (CAS).
|
|
135
|
+
"""Converts true airspeed (TAS) to calibrated airspeed (CAS).
|
|
145
136
|
|
|
146
137
|
:param tas: True airspeed in meters per second (m/s).
|
|
147
138
|
:param sigma: Normalized air density [-].
|
|
@@ -149,9 +140,9 @@ def tas2Cas(tas, delta, sigma):
|
|
|
149
140
|
:type tas: float
|
|
150
141
|
:type sigma: float
|
|
151
142
|
:type delta: float
|
|
152
|
-
:returns: Calibrated airspeed in meters per second (m/s).
|
|
153
|
-
|
|
154
|
-
|
|
143
|
+
:returns: Calibrated airspeed in meters per second (m/s). The function
|
|
144
|
+
uses a complex formula to account for air compressibility effects at
|
|
145
|
+
high speeds.
|
|
155
146
|
"""
|
|
156
147
|
|
|
157
148
|
if tas == float("inf"):
|
|
@@ -170,8 +161,7 @@ def tas2Cas(tas, delta, sigma):
|
|
|
170
161
|
|
|
171
162
|
|
|
172
163
|
def cas2Tas(cas, delta, sigma):
|
|
173
|
-
"""
|
|
174
|
-
Converts calibrated airspeed (CAS) to true airspeed (TAS).
|
|
164
|
+
"""Converts calibrated airspeed (CAS) to true airspeed (TAS).
|
|
175
165
|
|
|
176
166
|
:param cas: Calibrated airspeed in meters per second (m/s).
|
|
177
167
|
:param sigma: Normalized air density [-].
|
|
@@ -179,9 +169,8 @@ def cas2Tas(cas, delta, sigma):
|
|
|
179
169
|
:type cas: float
|
|
180
170
|
:type delta: float
|
|
181
171
|
:type sigma: float
|
|
182
|
-
:returns: True airspeed in meters per second (m/s).
|
|
183
|
-
|
|
184
|
-
This function inverts the compressibility adjustments to compute TAS from CAS.
|
|
172
|
+
:returns: True airspeed in meters per second (m/s). This function inverts
|
|
173
|
+
the compressibility adjustments to compute TAS from CAS.
|
|
185
174
|
"""
|
|
186
175
|
|
|
187
176
|
rho = sigma * const.rho_0
|
|
@@ -201,8 +190,7 @@ def cas2Tas(cas, delta, sigma):
|
|
|
201
190
|
|
|
202
191
|
|
|
203
192
|
def mach2Cas(Mach, theta, delta, sigma):
|
|
204
|
-
"""
|
|
205
|
-
Converts Mach number to calibrated airspeed (CAS).
|
|
193
|
+
"""Converts Mach number to calibrated airspeed (CAS).
|
|
206
194
|
|
|
207
195
|
:param Mach: Mach number [-].
|
|
208
196
|
:param theta: Normalized air temperature [-].
|
|
@@ -227,8 +215,7 @@ def mach2Cas(Mach, theta, delta, sigma):
|
|
|
227
215
|
|
|
228
216
|
|
|
229
217
|
def cas2Mach(cas, theta, delta, sigma):
|
|
230
|
-
"""
|
|
231
|
-
Converts calibrated airspeed (CAS) to Mach number.
|
|
218
|
+
"""Converts calibrated airspeed (CAS) to Mach number.
|
|
232
219
|
|
|
233
220
|
:param cas: Calibrated airspeed in meters per second (m/s).
|
|
234
221
|
:param theta: Normalized air temperature [-].
|
|
@@ -247,45 +234,63 @@ def cas2Mach(cas, theta, delta, sigma):
|
|
|
247
234
|
return proper_round(M, 10)
|
|
248
235
|
|
|
249
236
|
|
|
250
|
-
def
|
|
251
|
-
"""
|
|
252
|
-
|
|
237
|
+
def pressureAltitude(pressure, QNH=101325.0):
|
|
238
|
+
"""Calculates pressure altitude based on normalized pressure and reference
|
|
239
|
+
pressure (QNH).
|
|
253
240
|
|
|
254
|
-
:param QNH: Reference pressure in Pascals (Pa), default is standard sea
|
|
255
|
-
|
|
256
|
-
:
|
|
241
|
+
:param QNH: Reference pressure in Pascals (Pa), default is standard sea
|
|
242
|
+
level pressure (101325 Pa).
|
|
243
|
+
:param pressure: air pressure (Pa)
|
|
244
|
+
:type pressure: float
|
|
257
245
|
:type QNH: float
|
|
258
|
-
:returns: Pressure altitude in meters (m).
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
246
|
+
:returns: Pressure altitude in meters (m). The pressure altitude is
|
|
247
|
+
calculated by applying the barometric formula. Below the tropopause,
|
|
248
|
+
the altitude is computed using the standard temperature lapse rate.
|
|
249
|
+
Above the tropopause, it applies an exponential relationship for
|
|
250
|
+
altitude based on pressure ratio.
|
|
263
251
|
"""
|
|
264
252
|
|
|
265
|
-
if
|
|
253
|
+
if pressure > const.p_11:
|
|
266
254
|
hp = (const.temp_0 / const.temp_h) * (
|
|
267
|
-
1 - pow(
|
|
255
|
+
1 - pow(pressure / QNH, const.R * const.temp_h / const.g)
|
|
268
256
|
)
|
|
269
257
|
else:
|
|
270
|
-
hp = const.h_11
|
|
271
|
-
|
|
258
|
+
hp = const.h_11 + const.R * const.temp_11 / const.g * np.log(
|
|
259
|
+
const.p_11 / pressure
|
|
272
260
|
)
|
|
273
261
|
|
|
274
262
|
return hp
|
|
275
263
|
|
|
276
264
|
|
|
277
|
-
def
|
|
265
|
+
def ISATemperatureDeviation(temperature, pressureAltitude):
|
|
266
|
+
"""Calculates deviation from ISA temperature at a specific pressure
|
|
267
|
+
altitude.
|
|
268
|
+
|
|
269
|
+
:param temperature: air temperature (Kelvin)
|
|
270
|
+
:param pressureAltitude: pressure altitude (m)
|
|
271
|
+
:type temperature: float
|
|
272
|
+
:type pressureAltitude: float
|
|
273
|
+
:returns: ISA temperature deviation (Kelvin).
|
|
278
274
|
"""
|
|
279
|
-
|
|
275
|
+
|
|
276
|
+
stdTemperature = theta(h=pressureAltitude, DeltaTemp=0) * const.temp_0
|
|
277
|
+
deltaISATemp = temperature - stdTemperature
|
|
278
|
+
|
|
279
|
+
return deltaISATemp
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
def crossOver(cas, Mach):
|
|
283
|
+
"""Calculates the cross-over altitude where calibrated airspeed (CAS) and
|
|
284
|
+
Mach number intersect.
|
|
280
285
|
|
|
281
286
|
:param cas: Calibrated airspeed in meters per second (m/s).
|
|
282
287
|
:param Mach: Mach number [-].
|
|
283
288
|
:type cas: float
|
|
284
289
|
:type Mach: float
|
|
285
|
-
:returns: Cross-over altitude in meters (m).
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
290
|
+
:returns: Cross-over altitude in meters (m). The cross-over altitude is
|
|
291
|
+
where CAS and Mach produce the same true airspeed. The function
|
|
292
|
+
calculates pressure and temperature at this altitude based on the
|
|
293
|
+
given Mach number and CAS.
|
|
289
294
|
"""
|
|
290
295
|
|
|
291
296
|
p_trans = const.p_0 * (
|
|
@@ -308,7 +313,7 @@ def crossOver(cas, Mach):
|
|
|
308
313
|
theta_trans = pow(p_trans / const.p_0, (const.temp_h * const.R) / const.g)
|
|
309
314
|
|
|
310
315
|
if p_trans < const.p_11:
|
|
311
|
-
crossover = const.h_11 - (const.R * const.temp_11 / const.g) * log(
|
|
316
|
+
crossover = const.h_11 - (const.R * const.temp_11 / const.g) * np.log(
|
|
312
317
|
p_trans / const.p_11
|
|
313
318
|
)
|
|
314
319
|
else:
|
|
@@ -336,11 +341,13 @@ def atmosphereProperties(h, DeltaTemp):
|
|
|
336
341
|
|
|
337
342
|
|
|
338
343
|
def convertSpeed(v, speedType, theta, delta, sigma):
|
|
339
|
-
"""
|
|
340
|
-
|
|
344
|
+
"""Calculates Mach, true airspeed (TAS), and calibrated airspeed (CAS)
|
|
345
|
+
based on input speed and its type.
|
|
341
346
|
|
|
342
|
-
:param v: Airspeed value, depending on the type provided (M, CAS, TAS) [-,
|
|
343
|
-
|
|
347
|
+
:param v: Airspeed value, depending on the type provided (M, CAS, TAS) [-,
|
|
348
|
+
kt, kt].
|
|
349
|
+
:param speedType: Type of input speed, which can be one of "M" (Mach),
|
|
350
|
+
"CAS", or "TAS".
|
|
344
351
|
:param theta: Normalized air temperature [-].
|
|
345
352
|
:param delta: Normalized air pressure [-].
|
|
346
353
|
:param sigma: Normalized air density [-].
|