pyBADA 0.1.0__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 +8731 -0
- pyBADA/__init__.py +0 -0
- pyBADA/aircraft/BADA3/DUMMY/BADA.GPF +113 -0
- pyBADA/aircraft/BADA3/DUMMY/BZJT__.APF +25 -0
- pyBADA/aircraft/BADA3/DUMMY/BZJT__.OPF +61 -0
- pyBADA/aircraft/BADA3/DUMMY/BZJT__.PTD +139 -0
- pyBADA/aircraft/BADA3/DUMMY/BZJT__.PTF +73 -0
- pyBADA/aircraft/BADA3/DUMMY/GA____.APF +25 -0
- pyBADA/aircraft/BADA3/DUMMY/GA____.OPF +61 -0
- pyBADA/aircraft/BADA3/DUMMY/GA____.PTD +71 -0
- pyBADA/aircraft/BADA3/DUMMY/GA____.PTF +39 -0
- pyBADA/aircraft/BADA3/DUMMY/J2H___.APF +25 -0
- pyBADA/aircraft/BADA3/DUMMY/J2H___.OPF +61 -0
- pyBADA/aircraft/BADA3/DUMMY/J2H___.PTD +131 -0
- pyBADA/aircraft/BADA3/DUMMY/J2H___.PTF +69 -0
- pyBADA/aircraft/BADA3/DUMMY/J2M___.APF +25 -0
- pyBADA/aircraft/BADA3/DUMMY/J2M___.OPF +61 -0
- pyBADA/aircraft/BADA3/DUMMY/J2M___.PTD +123 -0
- pyBADA/aircraft/BADA3/DUMMY/J2M___.PTF +65 -0
- pyBADA/aircraft/BADA3/DUMMY/J4H___.APF +25 -0
- pyBADA/aircraft/BADA3/DUMMY/J4H___.OPF +61 -0
- pyBADA/aircraft/BADA3/DUMMY/J4H___.PTD +139 -0
- pyBADA/aircraft/BADA3/DUMMY/J4H___.PTF +73 -0
- pyBADA/aircraft/BADA3/DUMMY/ReleaseSummary +35 -0
- pyBADA/aircraft/BADA3/DUMMY/SYNONYM.NEW +155 -0
- pyBADA/aircraft/BADA3/DUMMY/TP2M__.APF +25 -0
- pyBADA/aircraft/BADA3/DUMMY/TP2M__.OPF +61 -0
- pyBADA/aircraft/BADA3/DUMMY/TP2M__.PTD +99 -0
- pyBADA/aircraft/BADA3/DUMMY/TP2M__.PTF +53 -0
- pyBADA/aircraft/BADA4/DUMMY/ACM_BADA4.xsd +556 -0
- pyBADA/aircraft/BADA4/DUMMY/Dummy-PST/Dummy-PST.ATF +106 -0
- pyBADA/aircraft/BADA4/DUMMY/Dummy-PST/Dummy-PST.xml +244 -0
- pyBADA/aircraft/BADA4/DUMMY/Dummy-PST/Dummy-PST_ISA+20.PTD +182 -0
- pyBADA/aircraft/BADA4/DUMMY/Dummy-PST/Dummy-PST_ISA+20.PTF +41 -0
- pyBADA/aircraft/BADA4/DUMMY/Dummy-PST/Dummy-PST_ISA.PTD +182 -0
- pyBADA/aircraft/BADA4/DUMMY/Dummy-PST/Dummy-PST_ISA.PTF +41 -0
- pyBADA/aircraft/BADA4/DUMMY/Dummy-TBP/Dummy-TBP.ATF +191 -0
- pyBADA/aircraft/BADA4/DUMMY/Dummy-TBP/Dummy-TBP.xml +540 -0
- pyBADA/aircraft/BADA4/DUMMY/Dummy-TBP/Dummy-TBP_ISA+20.PTD +218 -0
- pyBADA/aircraft/BADA4/DUMMY/Dummy-TBP/Dummy-TBP_ISA+20.PTF +49 -0
- pyBADA/aircraft/BADA4/DUMMY/Dummy-TBP/Dummy-TBP_ISA.PTD +218 -0
- pyBADA/aircraft/BADA4/DUMMY/Dummy-TBP/Dummy-TBP_ISA.PTF +49 -0
- pyBADA/aircraft/BADA4/DUMMY/Dummy-TBP/LRC.dat +38 -0
- pyBADA/aircraft/BADA4/DUMMY/Dummy-TBP/MEC.dat +58 -0
- pyBADA/aircraft/BADA4/DUMMY/Dummy-TBP/MRC.dat +38 -0
- pyBADA/aircraft/BADA4/DUMMY/Dummy-TBP/OPTALT.dat +37 -0
- pyBADA/aircraft/BADA4/DUMMY/Dummy-TWIN/Dummy-TWIN.ATF +204 -0
- pyBADA/aircraft/BADA4/DUMMY/Dummy-TWIN/Dummy-TWIN.xml +648 -0
- pyBADA/aircraft/BADA4/DUMMY/Dummy-TWIN/Dummy-TWIN_ISA+20.PTD +281 -0
- pyBADA/aircraft/BADA4/DUMMY/Dummy-TWIN/Dummy-TWIN_ISA+20.PTF +63 -0
- pyBADA/aircraft/BADA4/DUMMY/Dummy-TWIN/Dummy-TWIN_ISA.PTD +281 -0
- pyBADA/aircraft/BADA4/DUMMY/Dummy-TWIN/Dummy-TWIN_ISA.PTF +63 -0
- pyBADA/aircraft/BADA4/DUMMY/Dummy-TWIN/ECON.OPT +37 -0
- pyBADA/aircraft/BADA4/DUMMY/Dummy-TWIN/LRC.OPT +38 -0
- pyBADA/aircraft/BADA4/DUMMY/Dummy-TWIN/MEC.OPT +58 -0
- pyBADA/aircraft/BADA4/DUMMY/Dummy-TWIN/MRC.OPT +38 -0
- pyBADA/aircraft/BADA4/DUMMY/Dummy-TWIN/OPTALT.OPT +37 -0
- pyBADA/aircraft/BADA4/DUMMY/Dummy-TWIN-plus/Dummy-TWIN-plus.ATF +238 -0
- pyBADA/aircraft/BADA4/DUMMY/Dummy-TWIN-plus/Dummy-TWIN-plus.xml +737 -0
- pyBADA/aircraft/BADA4/DUMMY/Dummy-TWIN-plus/Dummy-TWIN-plus_ISA+20.PTD +281 -0
- pyBADA/aircraft/BADA4/DUMMY/Dummy-TWIN-plus/Dummy-TWIN-plus_ISA+20.PTF +63 -0
- pyBADA/aircraft/BADA4/DUMMY/Dummy-TWIN-plus/Dummy-TWIN-plus_ISA.PTD +281 -0
- pyBADA/aircraft/BADA4/DUMMY/Dummy-TWIN-plus/Dummy-TWIN-plus_ISA.PTF +63 -0
- pyBADA/aircraft/BADA4/DUMMY/Dummy-TWIN-plus/ECON.OPT +37 -0
- pyBADA/aircraft/BADA4/DUMMY/Dummy-TWIN-plus/LRC.OPT +36 -0
- pyBADA/aircraft/BADA4/DUMMY/Dummy-TWIN-plus/MEC.OPT +56 -0
- pyBADA/aircraft/BADA4/DUMMY/Dummy-TWIN-plus/MRC.OPT +36 -0
- pyBADA/aircraft/BADA4/DUMMY/Dummy-TWIN-plus/OPTALT.OPT +37 -0
- pyBADA/aircraft/BADA4/DUMMY/GPF.xml +130 -0
- pyBADA/aircraft/BADA4/DUMMY/GPF_BADA4.xsd +75 -0
- pyBADA/aircraft/BADA4/DUMMY/aircraft_model_default.xml +311 -0
- pyBADA/aircraft/BADAH/DUMMY/DUMH/DUMH.ATF +97 -0
- pyBADA/aircraft/BADAH/DUMMY/DUMH/DUMH.xml +82 -0
- pyBADA/aircraft/BADAH/DUMMY/DUMH/DUMH_ISA+20.PTD +632 -0
- pyBADA/aircraft/BADAH/DUMMY/DUMH/DUMH_ISA+20.PTF +71 -0
- pyBADA/aircraft/BADAH/DUMMY/DUMH/DUMH_ISA.PTD +632 -0
- pyBADA/aircraft/BADAH/DUMMY/DUMH/DUMH_ISA.PTF +71 -0
- pyBADA/aircraft/BADAH/DUMMY/DUMH/LRC.OPT +142 -0
- pyBADA/aircraft/BADAH/DUMMY/DUMH/MEC.OPT +142 -0
- pyBADA/aircraft/BADAH/DUMMY/DUMH/MRC.OPT +142 -0
- pyBADA/aircraft.py +414 -0
- pyBADA/atmosphere.py +345 -0
- pyBADA/bada3.py +4566 -0
- pyBADA/bada4.py +5327 -0
- pyBADA/badaE.py +3317 -0
- pyBADA/badaH.py +3632 -0
- pyBADA/configuration.py +98 -0
- pyBADA/constants.py +64 -0
- pyBADA/conversions.py +197 -0
- pyBADA/data/magneticDeclinationGridData.json +247067 -0
- pyBADA/flightTrajectory.py +929 -0
- pyBADA/geodesic.py +760 -0
- pyBADA/magnetic.py +119 -0
- pyBADA/trajectoryPrediction.py +175 -0
- pybada-0.1.0.dist-info/METADATA +57 -0
- pybada-0.1.0.dist-info/RECORD +99 -0
- pybada-0.1.0.dist-info/WHEEL +4 -0
- pybada-0.1.0.dist-info/licenses/AUTHORS +2 -0
- pybada-0.1.0.dist-info/licenses/LICENCE.txt +287 -0
pyBADA/atmosphere.py
ADDED
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
pyBADA
|
|
4
|
+
Atmosphere module
|
|
5
|
+
Developped @EUROCONTROL (EIH)
|
|
6
|
+
2024
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
__author__ = "Henrich Glaser-Opitz"
|
|
10
|
+
__copyright__ = "Copyright 2024, EUROCONTROL (EIH)"
|
|
11
|
+
__license__ = "BADA Eurocontrol"
|
|
12
|
+
__version__ = "1.0.0"
|
|
13
|
+
__maintainer__ = "Henrich Glaser-Opitz"
|
|
14
|
+
__email__ = "henrich.glaser-opitz@eurocontrol.int"
|
|
15
|
+
__status__ = "Development"
|
|
16
|
+
__docformat__ = "reStructuredText"
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
from math import sqrt, pow, exp, log
|
|
20
|
+
|
|
21
|
+
from pyBADA import constants as const
|
|
22
|
+
from pyBADA import conversions as conv
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def proper_round(num, dec=0):
|
|
26
|
+
# First, round the number to the specified number of decimal places
|
|
27
|
+
rounded_num = round(num, dec)
|
|
28
|
+
|
|
29
|
+
# Check if the result is an integer (no decimal part)
|
|
30
|
+
if rounded_num.is_integer():
|
|
31
|
+
return int(rounded_num) # Return as an integer
|
|
32
|
+
|
|
33
|
+
return rounded_num # Return as a float if there is a decimal part
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def theta(h, DeltaTemp):
|
|
37
|
+
"""This function returns normalised temperature according to the ISA model
|
|
38
|
+
|
|
39
|
+
:param h: altitude [m]
|
|
40
|
+
:param DeltaTemp: deviation with respect to ISA [K]
|
|
41
|
+
:type h: float
|
|
42
|
+
:type DeltaTemp: float
|
|
43
|
+
:returns: normalised temperature [-]
|
|
44
|
+
|
|
45
|
+
"""
|
|
46
|
+
if h < const.h_11:
|
|
47
|
+
theta = 1 - const.temp_h * h / const.temp_0 + DeltaTemp / const.temp_0
|
|
48
|
+
|
|
49
|
+
else:
|
|
50
|
+
theta = (const.temp_11 + DeltaTemp) / const.temp_0
|
|
51
|
+
|
|
52
|
+
return proper_round(theta, 10)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def delta(h, DeltaTemp):
|
|
56
|
+
"""This function returns normalised pressure according to the ISA model
|
|
57
|
+
|
|
58
|
+
:param h: altitude [m]
|
|
59
|
+
:param DeltaTemp: deviation with respect to ISA [K]
|
|
60
|
+
:type h: float
|
|
61
|
+
:type DeltaTemp: float
|
|
62
|
+
:returns: normalised pressure [-]
|
|
63
|
+
|
|
64
|
+
"""
|
|
65
|
+
p = pow(
|
|
66
|
+
(theta(h, DeltaTemp) - DeltaTemp / const.temp_0),
|
|
67
|
+
const.g / (const.temp_h * const.R),
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
if h <= const.h_11:
|
|
71
|
+
delta = p
|
|
72
|
+
else:
|
|
73
|
+
delta = p * exp(-const.g / const.R / const.temp_11 * (h - const.h_11))
|
|
74
|
+
|
|
75
|
+
return proper_round(delta, 10)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def sigma(theta, delta):
|
|
79
|
+
"""This function returns normalised air denstity according to the ISA model
|
|
80
|
+
|
|
81
|
+
:param theta: normalised temperature according to the ISA model [-]
|
|
82
|
+
:param delta: normalised pressure according to the ISA model [-]
|
|
83
|
+
:type theta: float
|
|
84
|
+
:type delta: float
|
|
85
|
+
:returns: normalised air density [-]
|
|
86
|
+
|
|
87
|
+
"""
|
|
88
|
+
|
|
89
|
+
return proper_round(
|
|
90
|
+
((delta * const.p_0) / (theta * const.temp_0 * const.R)) / const.rho_0, 10
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def aSound(theta):
|
|
95
|
+
"""This function calculates the speed of sound
|
|
96
|
+
|
|
97
|
+
:param theta: normalised air temperature [-]
|
|
98
|
+
:type theta: float
|
|
99
|
+
:returns: speed of sound [m s^-1]
|
|
100
|
+
|
|
101
|
+
"""
|
|
102
|
+
|
|
103
|
+
a = sqrt(const.Agamma * const.R * theta * const.temp_0)
|
|
104
|
+
return proper_round(a, 10)
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def mach2Tas(Mach, theta):
|
|
108
|
+
"""This function converts Mach number to true airspeed
|
|
109
|
+
|
|
110
|
+
:param Mach: Mach number [-]
|
|
111
|
+
:param theta: normalised air temperature [-]
|
|
112
|
+
:type theta: float
|
|
113
|
+
:type Mach: float
|
|
114
|
+
:returns: true airspeed [m s^-1]
|
|
115
|
+
|
|
116
|
+
"""
|
|
117
|
+
if Mach == float("inf"):
|
|
118
|
+
tas = float("inf")
|
|
119
|
+
elif Mach == float("-inf"):
|
|
120
|
+
tas = float("-inf")
|
|
121
|
+
else:
|
|
122
|
+
tas = Mach * aSound(theta)
|
|
123
|
+
|
|
124
|
+
return tas
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def tas2Mach(v, theta):
|
|
128
|
+
"""This function converts true airspeed to Mach
|
|
129
|
+
|
|
130
|
+
:param v: true airspeed [m s^-1]
|
|
131
|
+
:param theta: normalised air temperature [-]
|
|
132
|
+
:type v: float
|
|
133
|
+
:type theta: float
|
|
134
|
+
:returns: Mach number [-]
|
|
135
|
+
|
|
136
|
+
"""
|
|
137
|
+
return v / aSound(theta)
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def tas2Cas(tas, delta, sigma):
|
|
141
|
+
"""This function converts true airspeed to callibrated airspeed
|
|
142
|
+
|
|
143
|
+
:param tas: callibrated airspeed [m s^-1]
|
|
144
|
+
:param sigma: normalised air density [-]
|
|
145
|
+
:param delta: normalised air pressure [-]
|
|
146
|
+
:type sigma: float
|
|
147
|
+
:type delta: float
|
|
148
|
+
:type tas: float
|
|
149
|
+
:returns: callibrated airspeed [m s^-1]
|
|
150
|
+
|
|
151
|
+
"""
|
|
152
|
+
if tas == float("inf"):
|
|
153
|
+
cas = float("inf")
|
|
154
|
+
elif tas == float("-inf"):
|
|
155
|
+
cas = float("-inf")
|
|
156
|
+
else:
|
|
157
|
+
rho = sigma * const.rho_0
|
|
158
|
+
p = delta * const.p_0
|
|
159
|
+
|
|
160
|
+
A = pow(1 + const.Amu * rho * tas * tas / (2 * p), 1 / const.Amu) - 1
|
|
161
|
+
B = pow(1 + delta * A, const.Amu) - 1
|
|
162
|
+
cas = sqrt(2 * const.p_0 * B / (const.Amu * const.rho_0))
|
|
163
|
+
|
|
164
|
+
return cas
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
def cas2Tas(cas, delta, sigma):
|
|
168
|
+
"""This function converts callibrated airspeed to true airspeed
|
|
169
|
+
|
|
170
|
+
:param cas: callibrated airspeed [m s^-1]
|
|
171
|
+
:param sigma: normalised air density [-]
|
|
172
|
+
:param delta: normalised air pressure [-]
|
|
173
|
+
:type delta: float
|
|
174
|
+
:type sigma: float
|
|
175
|
+
:type cas: float
|
|
176
|
+
:returns: true airspeed [m s^-1]
|
|
177
|
+
|
|
178
|
+
"""
|
|
179
|
+
rho = sigma * const.rho_0
|
|
180
|
+
p = delta * const.p_0
|
|
181
|
+
|
|
182
|
+
A = (
|
|
183
|
+
pow(1 + const.Amu * const.rho_0 * cas * cas / (2 * const.p_0), 1 / const.Amu)
|
|
184
|
+
- 1
|
|
185
|
+
)
|
|
186
|
+
B = pow(1 + (1 / delta) * A, const.Amu) - 1
|
|
187
|
+
tas = sqrt(2 * p * B / (const.Amu * rho))
|
|
188
|
+
|
|
189
|
+
return proper_round(tas, 10)
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def mach2Cas(Mach, theta, delta, sigma):
|
|
193
|
+
"""This function converts Mach to callibrated airspeed
|
|
194
|
+
|
|
195
|
+
:param Mach: Mach number [-]
|
|
196
|
+
:param theta: normalised air temperature [-]
|
|
197
|
+
:param delta: normalised air pressure [-]
|
|
198
|
+
:param sigma: normalised air density [-]
|
|
199
|
+
:type Mach: float
|
|
200
|
+
:type theta: float
|
|
201
|
+
:type delta: float
|
|
202
|
+
:type sigma: float
|
|
203
|
+
:type h: float
|
|
204
|
+
:type DeltaTemp: float
|
|
205
|
+
:returns: true airspeed [m s^-1]
|
|
206
|
+
|
|
207
|
+
"""
|
|
208
|
+
if Mach == float("inf"):
|
|
209
|
+
cas = float("inf")
|
|
210
|
+
elif Mach == float("-inf"):
|
|
211
|
+
cas = float("-inf")
|
|
212
|
+
else:
|
|
213
|
+
tas = mach2Tas(Mach=Mach, theta=theta)
|
|
214
|
+
cas = tas2Cas(tas=tas, delta=delta, sigma=sigma)
|
|
215
|
+
|
|
216
|
+
return cas
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
def cas2Mach(cas, theta, delta, sigma):
|
|
220
|
+
"""This function converts callibrated airspeed to Mach
|
|
221
|
+
|
|
222
|
+
:param cas: callibrated airspeed [m s^-1]
|
|
223
|
+
:param theta: normalised air temperature [-]
|
|
224
|
+
:param delta: normalised air pressure [-]
|
|
225
|
+
:param sigma: normalised air density [-]
|
|
226
|
+
:type cas: float
|
|
227
|
+
:type theta: float
|
|
228
|
+
:type delta: float
|
|
229
|
+
:type sigma: float
|
|
230
|
+
:returns: true airspeed [m s^-1]
|
|
231
|
+
|
|
232
|
+
"""
|
|
233
|
+
tas = cas2Tas(cas, delta, sigma)
|
|
234
|
+
M = tas2Mach(tas, theta)
|
|
235
|
+
|
|
236
|
+
return proper_round(M, 10)
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
def hp(delta, QNH=101325.0):
|
|
240
|
+
"""This function calculates pressure altitude
|
|
241
|
+
|
|
242
|
+
:param QNH: reference pressure [Pa]
|
|
243
|
+
:param delta: normalised air pressure [-]
|
|
244
|
+
:type delta: float
|
|
245
|
+
:type QNH: float
|
|
246
|
+
:returns: pressure altitude [m]
|
|
247
|
+
|
|
248
|
+
"""
|
|
249
|
+
if delta * const.p_0 > const.p_11:
|
|
250
|
+
hp = (const.temp_0 / const.temp_h) * (
|
|
251
|
+
1 - pow(delta * const.p_0 / QNH, const.R * const.temp_h / const.g)
|
|
252
|
+
)
|
|
253
|
+
else:
|
|
254
|
+
hp = const.h_11 - const.R * const.temp_11 / const.g * log(
|
|
255
|
+
delta * const.p_0 / const.p_11
|
|
256
|
+
)
|
|
257
|
+
|
|
258
|
+
return hp
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
def crossOver(cas, Mach):
|
|
262
|
+
"""This function calculates cross-over altitude
|
|
263
|
+
|
|
264
|
+
:param cas: callibrated airspeed [m s^-1]
|
|
265
|
+
:param Mach: Mach number [-]
|
|
266
|
+
:type cas: float
|
|
267
|
+
:type Mach: float
|
|
268
|
+
:returns: cross-over altitude [m]
|
|
269
|
+
|
|
270
|
+
"""
|
|
271
|
+
p_trans = const.p_0 * (
|
|
272
|
+
(
|
|
273
|
+
pow(
|
|
274
|
+
1 + ((const.Agamma - 1.0) / 2.0) * ((cas / const.a_0) ** 2),
|
|
275
|
+
pow(const.Amu, -1),
|
|
276
|
+
)
|
|
277
|
+
- 1.0
|
|
278
|
+
)
|
|
279
|
+
/ (pow(1 + ((const.Agamma - 1.0) / 2.0) * (Mach**2), pow(const.Amu, -1)) - 1.0)
|
|
280
|
+
)
|
|
281
|
+
|
|
282
|
+
theta_trans = pow(p_trans / const.p_0, (const.temp_h * const.R) / const.g)
|
|
283
|
+
|
|
284
|
+
if p_trans < const.p_11:
|
|
285
|
+
crossover = const.h_11 - (const.R * const.temp_11 / const.g) * log(
|
|
286
|
+
p_trans / const.p_11
|
|
287
|
+
)
|
|
288
|
+
else:
|
|
289
|
+
crossover = (const.temp_0 / -const.temp_h) * (theta_trans - 1)
|
|
290
|
+
|
|
291
|
+
return crossover
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
def atmosphereProperties(h, DeltaTemp):
|
|
295
|
+
"""This function calculates the atmosphere properties in form of a density, temperature and pressure ratio
|
|
296
|
+
based on altitude and deviation from ISA temperature
|
|
297
|
+
|
|
298
|
+
:param h: altitude [m]
|
|
299
|
+
:param DeltaTemp: deviation with respect to ISA [K]
|
|
300
|
+
:type h: float
|
|
301
|
+
:type DeltaTemp: float
|
|
302
|
+
:returns: normalised temperature, pressure and density [-]
|
|
303
|
+
"""
|
|
304
|
+
|
|
305
|
+
theta_norm = theta(h=h, DeltaTemp=DeltaTemp)
|
|
306
|
+
delta_norm = delta(h=h, DeltaTemp=DeltaTemp)
|
|
307
|
+
sigma_norm = sigma(theta=theta_norm, delta=delta_norm)
|
|
308
|
+
|
|
309
|
+
return [theta_norm, delta_norm, sigma_norm]
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
def convertSpeed(v, speedType, theta, delta, sigma):
|
|
313
|
+
"""This function calculates the M, TAS and CAS speed based on imput speed and its type
|
|
314
|
+
|
|
315
|
+
:param v: airspeed {M,CAS,TAS}[-,kt,kt]
|
|
316
|
+
:param speedType: type of speed as input {M,CAS,TAS}
|
|
317
|
+
:param theta: normalised air temperature [-]
|
|
318
|
+
:param delta: normalised air pressure [-]
|
|
319
|
+
:param sigma: normalised air density [-]
|
|
320
|
+
:type v: float
|
|
321
|
+
:type speedType: string
|
|
322
|
+
:type theta: float
|
|
323
|
+
:type delta: float
|
|
324
|
+
:type sigma: float
|
|
325
|
+
:returns: [M, CAS, TAS] [-, m/s, m/s]
|
|
326
|
+
"""
|
|
327
|
+
|
|
328
|
+
if speedType == "TAS":
|
|
329
|
+
TAS = conv.kt2ms(v)
|
|
330
|
+
CAS = tas2Cas(tas=TAS, delta=delta, sigma=sigma)
|
|
331
|
+
M = tas2Mach(v=TAS, theta=theta)
|
|
332
|
+
|
|
333
|
+
elif speedType == "CAS":
|
|
334
|
+
CAS = conv.kt2ms(v)
|
|
335
|
+
TAS = cas2Tas(cas=CAS, delta=delta, sigma=sigma)
|
|
336
|
+
M = tas2Mach(v=TAS, theta=theta)
|
|
337
|
+
|
|
338
|
+
elif speedType == "M":
|
|
339
|
+
M = v
|
|
340
|
+
CAS = mach2Cas(Mach=M, theta=theta, delta=delta, sigma=sigma)
|
|
341
|
+
TAS = cas2Tas(cas=CAS, delta=delta, sigma=sigma)
|
|
342
|
+
else:
|
|
343
|
+
raise Exception("Expected TAS, CAS or M, received: " + speedType)
|
|
344
|
+
|
|
345
|
+
return [M, CAS, TAS]
|