Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate atmospheric calculations #9

Open
dbookstaber opened this issue Jan 24, 2024 · 5 comments
Open

Validate atmospheric calculations #9

dbookstaber opened this issue Jan 24, 2024 · 5 comments

Comments

@dbookstaber
Copy link
Owner

dbookstaber commented Jan 24, 2024

During testing (the old test_danger_space unittest), with an absurdly dense atmosphere (1000 hPa) that led to a trajectory drop through 4000ft, the t in conditions.py::get_density_factor_and_mach_for_altitude() went negative. As best I can tell this is a temperature, so this shouldn't be possible no matter how extreme the variables. This function is probably supposed to do calculations in Kelvin, but it appears to be doing them in whatever Temperature units were set. So we need some test cases here.

Specific values found in this test case:

  • t = -.008055
  • _p0 = 1000
  • _t0 = 15
  • cP = -5.255876
  • ta = 57.82
  • tb = 72.8
  • altitude = -3878
  • x = 1038
  • y = -4208
@dbookstaber
Copy link
Owner Author

dbookstaber commented Feb 12, 2024

The cIcaoFreezingPointTemperatureR is wrong: °R = °F + 459.67. Freezing point in °F = 32, so freezing point in °R = 491.67. However, making this correction breaks test_computer.py::test_temp_atmo. Actually it looks like the variable is just misnamed: It appears that everywhere in the code it is used to convert units between Rankine and Fahrenheit.

References for validation of the remaining logic:

@dbookstaber
Copy link
Owner Author

dbookstaber commented Feb 13, 2024

C_d (drag coefficient) is a function of Mach number. Drag force is a function of air density * C_d.

drag = density_factor * velocity * self.drag_by_mach(velocity / mach)

where

density_factor, mach = atmo.get_density_factor_and_mach_for_altitude(alt0 + range_vector.y)

and

density_factor = density / cStandardDensity

Atmo.get_density_factor_and_mach_for_altitude() returns incorrect density. The adjusted pressure equation there is just wrong.

@dbookstaber
Copy link
Owner Author

Some problems found and addressed in o-murphy#157

@dbookstaber
Copy link
Owner Author

With the work I did for o-murphy#159 I'm now confident in the atmospheric calculations.

However, it may be worth probing edge and extreme scenarios, and adding those to the unit tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant