Skip to content

Commit

Permalink
new temperature approximation
Browse files Browse the repository at this point in the history
  • Loading branch information
junzis committed Dec 10, 2024
1 parent 4986e7f commit 25a1885
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions openap/casadi/aero_override.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,11 @@ def atmos(h, dT=0):
Air pressure (Pa), density (kg/m3), and temperature (K).
"""
dT = np.maximum(-15, np.minimum(dT, 15))

# ISA model
# T0_shift = T0 + dT
# T = np.maximum(T0_shift + beta * h, 216.65 + dT)
# rhotrop = rho0 * (T / T0_shift) ** 4.256848030018761
# dhstrat = np.maximum(0.0, h - 11000.0)
# rho = rhotrop * np.exp(-dhstrat / 6341.552161)

# use exponential model to avoid discontinuity at tropopause
T = 85.46369268 * np.exp(-0.00017235 * h) + 213.31449979 + dT
rho = 1.31788377 * np.exp(-0.00011107 * h) - 0.03933069
assert -15 < dT < 15

T0_ = T0 + dT
T = 0.65 * np.log(1 + np.exp(-10 * (h / 1000 - 11))) + 216.65
rho = rho0 * ((T0_ + beta * h) / T0_) ** 4.2559
p = rho * R * T
return p, rho, T

Expand Down

0 comments on commit 25a1885

Please sign in to comment.