项目作者: LukeDeWaal

项目描述 :
Basic ISA Calculator for Python projects
高级语言: Python
项目地址: git://github.com/LukeDeWaal/ISA_Calculator.git
创建时间: 2019-04-10T12:50:58Z
项目社区:https://github.com/LukeDeWaal/ISA_Calculator

开源协议:GNU General Public License v3.0

下载


ISACALC : A Basic ISA Calculator for Python projects

  • Accurate Atmospheric Model up to 110km
  • Accurate Calculations for Temperature, Pressure and Density
  • Option for user-defined atmospheric conditions:
    • Change the temperature gradients
    • Change the base pressure or density
    • Change physical constants such as gravity or universal gas constant for air
    • Make your custom atmosphere and save it to a JSON file to be loaded
  • Tabulate your data to save future computation time
    • Start, Stop and Step in meters
    • Save tabulated data in .csv or .xlsx files

With this module, it is possible to calculate, using the 1976 standard atmosphere model, the Temperature,
Density and Pressure at any point in the atmosphere from 0 up to 110,000 [m].

This package is useful for Aerospace and Aeronautical Engineers who wish to run simulations using atmospheric data.

To install this package, simply pip install isacalc

And thats it! An simple example script:

  1. import isacalc as isa
  2. # Default atmosphere
  3. std_atm = isa.Atmosphere()
  4. print(std_atm)
  5. """
  6. Standard Atmosphere (10 layers):
  7. * g0 = 9.806650 [m/s^2]
  8. * R = 287.000000 [J/(kg*K)]
  9. * y = 1.400000 [-]
  10. * p0 = 101325.000 [Pa]
  11. * d0 = 1.225000 [kg/m^3]
  12. Troposphere | 0.000 - 11000.000 [m] | 0.00 - 11000.00 [K]
  13. Tropopause | 11000.000 - 20000.000 [m] | 11000.00 - 20000.00 [K]
  14. Stratosphere | 20000.000 - 32000.000 [m] | 20000.00 - 32000.00 [K]
  15. Stratosphere | 32000.000 - 47000.000 [m] | 32000.00 - 47000.00 [K]
  16. Stratopause | 47000.000 - 51000.000 [m] | 47000.00 - 51000.00 [K]
  17. Mesosphere | 51000.000 - 71000.000 [m] | 51000.00 - 71000.00 [K]
  18. Mesosphere | 71000.000 - 84852.000 [m] | 71000.00 - 84852.00 [K]
  19. Mesopause | 84852.000 - 90000.000 [m] | 84852.00 - 90000.00 [K]
  20. Thermosphere | 90000.000 - 100000.000 [m] | 90000.00 - 100000.00 [K]
  21. Thermosphere | 100000.000 - 110000.000 [m] | 100000.00 - 110000.00 [K]
  22. """
  23. # Tweak parameters in the constructor
  24. custom_atm = isa.Atmosphere(p0=100000.0, g0=9.81, gamma=1.42)
  25. print(custom_atm)
  26. """
  27. Custom Atmosphere (10 layers):
  28. * g0 = 9.810000 [m/s^2]
  29. * R = 287.000000 [J/(kg*K)]
  30. * y = 1.420000 [-]
  31. * p0 = 100000.000 [Pa]
  32. * d0 = 1.225000 [kg/m^3]
  33. Troposphere | 0.000 - 11000.000 [m] | 0.00 - 11000.00 [K]
  34. Tropopause | 11000.000 - 20000.000 [m] | 11000.00 - 20000.00 [K]
  35. Stratosphere | 20000.000 - 32000.000 [m] | 20000.00 - 32000.00 [K]
  36. Stratosphere | 32000.000 - 47000.000 [m] | 32000.00 - 47000.00 [K]
  37. Stratopause | 47000.000 - 51000.000 [m] | 47000.00 - 51000.00 [K]
  38. Mesosphere | 51000.000 - 71000.000 [m] | 51000.00 - 71000.00 [K]
  39. Mesosphere | 71000.000 - 84852.000 [m] | 71000.00 - 84852.00 [K]
  40. Mesopause | 84852.000 - 90000.000 [m] | 84852.00 - 90000.00 [K]
  41. Thermosphere | 90000.000 - 100000.000 [m] | 90000.00 - 100000.00 [K]
  42. Thermosphere | 100000.000 - 110000.000 [m] | 100000.00 - 110000.00 [K]
  43. """
  44. # Export your custom atmosphere model to JSON for easy import later
  45. custom_atm.export_json('my_atm.json')
  46. # Load an atmosphere model from a JSON file
  47. custom_atm = isa.Atmosphere(infile='my_atm.json')
  48. # Generate a pandas dataframe table and optionally export is as a csv or xlsx file
  49. table = custom_atm.tabulate(
  50. start=0, stop=25000, step=100, export_as='my_atm.csv'
  51. )
  52. # Do simple calculations
  53. # NOTE: if the given values are outside the atmosphere model, will raise ValueError
  54. params = custom_atm.calculate(h=660.0) # Get params at height
  55. params = custom_atm.altimeter(press=26000.0) # Get params at pressure
  56. params = custom_atm.densaltimeter(density=0.85) # Get params at density
  57. ceiling_params = custom_atm.ceiling_values # Get the params at max altitude
  58. floor_params = custom_atm.floor_values # Get the params at lowest altitude
  59. # Make a plot of your atmospheric parameters
  60. std_atm.plot_atmosphere()
  61. # Do calculations within a specific layer
  62. # NOTE: if the given values are outside the layer, will raise ValueError
  63. layer = custom_atm[0] # Take the first layer (Troposphere)
  64. params = layer.get_values_at(300) # Get params at height within layer
  65. height = layer.get_height_from_pressure(100000) # Get height at pressure within layer
  66. height = layer.get_height_from_density(1.2) # Get height at density within layer
  67. ceiling_params = layer.ceiling_values # Get params at layer's max altitude
  68. floor_params = layer.floor_values # Get params at layer's min altitude

plot

To define a custom atmosphere in JSON format, create a file with the structure shown below.
Any missing parameters will be taken from the standard atmosphere.
The JSON file defining the standard atmosphere is as follows:

  1. {
  2. "g0": 9.80665,
  3. "R": 287.0,
  4. "gamma": 1.4,
  5. "p0": 101325.0,
  6. "d0": 1.225,
  7. "Hn": [
  8. 0,
  9. 11000.0,
  10. 20000.0,
  11. 32000.0,
  12. 47000.0,
  13. 51000.0,
  14. 71000.0,
  15. 84852.0,
  16. 90000.0,
  17. 100000.0,
  18. 110000.0
  19. ],
  20. "Tn": [
  21. 288.15,
  22. 216.65,
  23. 216.65,
  24. 228.65,
  25. 270.65,
  26. 270.65,
  27. 214.65,
  28. 186.95,
  29. 186.95,
  30. 201.95,
  31. 251.95
  32. ],
  33. "Nn": [
  34. "Troposphere",
  35. "Tropopause",
  36. "Stratosphere",
  37. "Stratosphere",
  38. "Stratopause",
  39. "Mesosphere",
  40. "Mesosphere",
  41. "Mesopause",
  42. "Thermosphere",
  43. "Thermosphere",
  44. "Thermosphere"
  45. ]
  46. }