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

Discrepancy in Air Density and Atmospheric Pressure Calculation for Non-Standard Temperature #1196

Open
1 of 3 tasks
viniciusrottolo opened this issue Nov 22, 2024 · 0 comments

Comments

@viniciusrottolo
Copy link

viniciusrottolo commented Nov 22, 2024

I'm submitting a ...

  • bug report
  • feature request
  • support request

Describe the issue
There is a discrepancy in the calculation of air density and atmospheric pressure when using the temperature deviation from standard atmosphere (atmosphere/delta-T) parameter, especially at altitudes above sea level. Notably, the atmospheric pressure value should remain constant for a fixed altitude regardless of temperature deviations, but JSBSim produces different pressure values.

What is the expected behavior?
The air density and atmospheric pressure values computed by JSBSim should closely align with standard reference values for the given temperature and altitude conditions, such as those provided by the Atmospheric Calculator.

What is the motivation / use case for changing the behavior?
Correct air density values are critical for accurate aerodynamic and flight dynamics simulations, especially for scenarios where temperature deviations from the standard atmosphere are involved.

code

import jsbsim

# Global variables that must be modified to match your particular need
# The aircraft name
# Note - It should match the exact spelling of the model file
AIRCRAFT_NAME = "737"
# Path to JSBSim files, location of the folders "aircraft", "engines" and "systems"
PATH_TO_JSBSIM_FILES = "../.."

# Avoid flooding the console with log messages
jsbsim.FGJSBBase().debug_lvl = 0

fdm = jsbsim.FGFDMExec(PATH_TO_JSBSIM_FILES)

# Load the aircraft model

# Load the aircraft model
fdm.load_model(AIRCRAFT_NAME)

fdm['atmosphere/delta-T'] =  0*1.8 # dISA °C to dISA R
fdm['ic/h-sl-ft'] = 0
fdm.run_ic()

print(" STANDARD ATMOSPHERE \n",
      f"Altitude: {fdm['position/h-sl-ft']:.0f} ft \n",
      f"Temperature_JSBSIM: {(fdm['atmosphere/T-R']-491.67)*5/9:.0f} °C \n",
      f"Density_JSBSIM: {fdm['atmosphere/rho-slugs_ft3']:.7f} slug/ft3 \n",
      f"Pressure_JSBSIM: {fdm['atmosphere/P-psf']:.2f} \n",
      "Temperature_ref:  15 °C \n",
      "Density_ref: 0.0023772 slug/ft3 \n",
      "Pressure_ref: 2116.20 psf \n")

fdm['atmosphere/delta-T'] =  25*1.8 # dISA °C to dISA R
fdm['ic/h-sl-ft'] = 0

fdm.run_ic() # Initialize the aircraft with initial conditions  
print(f" Altitude: {fdm['position/h-sl-ft']:.0f} ft \n",
      f"Temperature_JSBSIM: {(fdm['atmosphere/T-R']-491.67)*5/9:.0f} °C \n",
      f"Density_JSBSIM: {fdm['atmosphere/rho-slugs_ft3']:.7f} slug/ft3 \n",
      f"Pressure_JSBSIM: {fdm['atmosphere/P-psf']:.2f} \n",
      "Temperature_ref:  40 °C \n",
      "Density_ref: 0.0021874 slug/ft3 \n",
      "Pressure_ref: 2116.2 psf \n")

fdm['ic/h-sl-ft'] = 10000
fdm.run_ic() # Initialize the aircraft with initial conditions  

print(f" Altitude: {fdm['position/h-sl-ft']:.0f} ft \n",
      f"Temperature_JSBSIM: {(fdm['atmosphere/T-R']-491.67)*5/9:.4f} °C \n",
      f"Density_JSBSIM: {fdm['atmosphere/rho-slugs_ft3']:.7f} slug/ft3 \n",
      f"Pressure_JSBSIM: {fdm['atmosphere/P-psf']:.2f} \n",
      "Temperature_ref:  20.1975 °C \n",
      "Density_ref: 0.0016061 slug/ft3 \n",
      "Pressure_ref: 1455.60 psf \n")

fdm['ic/h-sl-ft'] = 20000
fdm.run_ic() # Initialize the aircraft with initial conditions  

print(f" Altitude: {fdm['position/h-sl-ft']:.0f} ft \n",
      f"Temperature_JSBSIM: {(fdm['atmosphere/T-R']-491.67)*5/9:.4f} °C \n",
      f"Density_JSBSIM: {fdm['atmosphere/rho-slugs_ft3']:.7f} slug/ft3 \n",
      f"Pressure_JSBSIM: {fdm['atmosphere/P-psf']:.2f} \n",
      "Temperature_ref:  0.4140 °C \n",
      "Density_ref: 0.0011516 slug/ft3 \n",
      "Pressure_ref: 973.27 psf \n")

fdm['ic/h-sl-ft'] = 30000
fdm.run_ic() # Initialize the aircraft with initial conditions  

print(f" Altitude: {fdm['position/h-sl-ft']:.0f} ft \n",
      f"Temperature_JSBSIM: {(fdm['atmosphere/T-R']-491.67)*5/9:.4f} °C \n",
      f"Density_JSBSIM: {fdm['atmosphere/rho-slugs_ft3']:.7f} slug/ft3 \n",
      f"Pressure_JSBSIM: {fdm['atmosphere/P-psf']:.2f} \n",
      "Temperature_ref: -19.3506 °C \n",
      "Density_ref: 0.00080305 slug/ft3 \n",
      "Pressure_ref: 629.67 psf \n")

fdm['ic/h-sl-ft'] = 40000
fdm.run_ic() # Initialize the aircraft with initial conditions  

print(f" Altitude: {fdm['position/h-sl-ft']:.0f} ft \n",
      f"Temperature_JSBSIM: {(fdm['atmosphere/T-R']-491.67)*5/9:.4f} °C \n",
      f"Density_JSBSIM: {fdm['atmosphere/rho-slugs_ft3']:.7f} slug/ft3 \n",
      f"Pressure_JSBSIM: {fdm['atmosphere/P-psf']:.2f} \n",
      "Temperature_ref:  -31.5 °C \n",
      "Density_ref: 0.00052659 slug/ft3 \n",
      "Pressure_ref: 393.13 psf \n")

fdm['atmosphere/delta-T'] =  35*1.8 # dISA °C to dISA R
fdm.run_ic() # Initialize the aircraft with initial conditions  

print(f" Altitude: {fdm['position/h-sl-ft']:.0f} ft \n",
      f"Temperature_JSBSIM: {(fdm['atmosphere/T-R']-491.67)*5/9:.4f} °C \n",
      f"Density_JSBSIM: {fdm['atmosphere/rho-slugs_ft3']:.7f} slug/ft3 \n",
      f"Pressure_JSBSIM: {fdm['atmosphere/P-psf']:.2f} \n",
      "Temperature_ref:  -21.5 °C \n",
      "Density_ref: 0.00050566 slug/ft3 \n",
      "Pressure_ref: 393.13 psf \n")

output

 STANDARD ATMOSPHERE 
 Altitude: 0 ft 
 Temperature_JSBSIM: 15 °C 
 Density_JSBSIM: 0.0023769 slug/ft3 
 Pressure_JSBIM: 2116.23 
 Temperature_ref:  15 °C 
 Density_ref: 0.0023772 slug/ft3 
 Pressure_ref: 2116.20 psf 

 Altitude: 0 ft 
 Temperature_JSBSIM: 40 °C 
 Density_JSBSIM: 0.0021872 slug/ft3 
 Pressure_JSBSIM: 2116.23 
 Temperature_ref:  40 °C 
 Density_ref: 0.0021874 slug/ft3 
 Pressure_ref: 2116.2 psf 

 Altitude: 10000 ft 
 Temperature_JSBSIM: 20.1975 °C 
 Density_JSBSIM: 0.0016563 slug/ft3 
 Pressure_JSBSIM: 1501.25 
 Temperature_ref:  20.1975 °C 
 Density_ref: 0.0016061 slug/ft3 
 Pressure_ref: 1455.60 psf 

 Altitude: 20000 ft 
 Temperature_JSBSIM: 0.4140 °C 
 Density_JSBSIM: 0.0012305 slug/ft3 
 Pressure_JSBSIM: 1040.10 
 Temperature_ref:  0.4140 °C 
 Density_ref: 0.0011516 slug/ft3 
 Pressure_ref: 973.27 psf 

 Altitude: 30000 ft 
 Temperature_JSBSIM: -19.3506 °C 
 Density_JSBSIM: 0.0008943 slug/ft3 
 Pressure_JSBSIM: 701.29 
 Temperature_ref: -19.3506 °C 
 Density_ref: 0.00080305 slug/ft3 
 Pressure_ref: 629.67 psf 

 Altitude: 40000 ft 
 Temperature_JSBSIM: -31.5000 °C 
 Density_JSBSIM: 0.0006153 slug/ft3 
 Pressure_JSBSIM: 459.38 
 Temperature_ref:  -31.5 °C 
 Density_ref: 0.00052659 slug/ft3 
 Pressure_ref: 393.13 psf 

 Altitude: 40000 ft 
 Temperature_JSBSIM: -21.5000 °C 
 Density_JSBSIM: 0.0006239 slug/ft3 
 Pressure_JSBSIM: 485.10 
 Temperature_ref:  -21.5 °C 
 Density_ref: 0.00050566 slug/ft3 
 Pressure_ref: 393.13 psf 
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