JSBSim Flight Dynamics Model  1.1.11 (13 Feb 2022)
An Open Source Flight Dynamics and Control Software Library in C++
FGStandardAtmosphere Class Reference

Detailed Description

Models the 1976 U.S.

Standard Atmosphere, with the ability to modify the temperature and pressure. A base feature of the model is the temperature profile that is stored as an FGTable object with this data:

GeoMet Alt Temp GeoPot Alt GeoMet Alt
(ft) (deg R) (km) (km)
--------- -------- ---------- ----------
0.0 518.67 // 0.000 0.000
36151.6 390.0 // 11.000 11.019
65823.5 390.0 // 20.000 20.063
105518.4 411.6 // 32.000 32.162
155347.8 487.2 // 47.000 47.350
168677.8 487.2 // 51.000 51.413
235570.9 386.4 // 71.000 71.802
282152.2 336.5; // 84.852 86.000

The pressure is calculated at lower altitudes through the use of two equations that are presented in the U.S. Standard Atmosphere document (see references). Density, kinematic viscosity, speed of sound, etc., are all calculated based on various constants and temperature and pressure. At higher altitudes (above 86 km (282152 ft) a different and more complicated method of calculating pressure is used.

The temperature may be modified through the use of several methods. Ultimately, these access methods allow the user to modify the sea level standard temperature, and/or the sea level standard pressure, so that the entire profile will be consistently and accurately calculated.

Properties

  • atmosphere/delta-T
  • atmosphere/T-sl-dev-F
Author
Jon Berndt
See also
"U.S. Standard Atmosphere, 1976", NASA TM-X-74335

Definition at line 98 of file FGStandardAtmosphere.h.

#include <FGStandardAtmosphere.h>

+ Inheritance diagram for FGStandardAtmosphere:
+ Collaboration diagram for FGStandardAtmosphere:

Public Member Functions

 FGStandardAtmosphere (FGFDMExec *)
 Constructor.
 
virtual ~FGStandardAtmosphere ()
 Destructor.
 
bool InitModel (void) override
 
Temperature access functions.

There are several ways to get the temperature, and several modeled temperature values that can be retrieved.

The U.S. Standard Atmosphere temperature either at a specified altitude, or at sea level can be retrieved. These two temperatures do NOT include the effects of any bias or delta gradient that may have been supplied by the user. The modeled temperature and the modeled temperature at sea level can also be retrieved. These two temperatures DO include the effects of an optionally user-supplied bias or delta gradient.

double GetTemperature (double altitude) const override
 Returns the actual modeled temperature in degrees Rankine at a specified altitude. More...
 
virtual double GetStdTemperature (double altitude) const
 Returns the standard temperature in degrees Rankine at a specified altitude. More...
 
virtual double GetStdTemperatureSL () const
 Returns the standard sea level temperature in degrees Rankine. More...
 
virtual double GetStdTemperatureRatio (double h) const
 Returns the ratio of the standard temperature at the supplied altitude over the standard sea level temperature.
 
virtual double GetTemperatureBias (eTemperature to) const
 Returns the temperature bias over the sea level value in degrees Rankine.
 
virtual double GetTemperatureDeltaGradient (eTemperature to)
 Returns the temperature gradient to be applied on top of the standard temperature gradient.
 
void SetTemperatureSL (double t, eTemperature unit=eFahrenheit) override
 Sets the Sea Level temperature, if it is to be different than the standard. More...
 
void SetTemperature (double t, double h, eTemperature unit=eFahrenheit) override
 Sets the temperature at the supplied altitude, if it is to be different than the standard temperature. More...
 
virtual void SetTemperatureBias (eTemperature unit, double t)
 Sets the temperature bias to be added to the standard temperature at all altitudes. More...
 
virtual void SetSLTemperatureGradedDelta (eTemperature unit, double t)
 Sets a Sea Level temperature delta that is ramped out by 86 km. More...
 
virtual void SetTemperatureGradedDelta (double t, double h, eTemperature unit=eFahrenheit)
 Sets the temperature delta value at the supplied altitude/elevation above sea level, to be added to the standard temperature and ramped out by 86 km. More...
 
virtual void ResetSLTemperature ()
 This function resets the model to apply no bias or delta gradient to the temperature. More...
 
Pressure access functions.
double GetPressure (double altitude) const override
 Returns the pressure at a specified altitude in psf.
 
virtual double GetStdPressure (double altitude) const
 Returns the standard pressure at the specified altitude.
 
void SetPressureSL (ePressure unit, double pressure) override
 Sets the sea level pressure for modeling an off-standard pressure profile. More...
 
virtual void ResetSLPressure ()
 Resets the sea level to the Standard sea level pressure, and recalculates dependent parameters so that the pressure calculations are standard.
 
Density access functions.
virtual double GetStdDensity (double altitude) const
 Returns the standard density at a specified altitude.
 
- Public Member Functions inherited from FGAtmosphere
 FGAtmosphere (FGFDMExec *)
 Constructor.
 
virtual ~FGAtmosphere ()
 Destructor.
 
bool Run (bool Holding) override
 Runs the atmosphere forces model; called by the Executive. More...
 
virtual double GetTemperature () const
 Returns the actual, modeled temperature at the current altitude in degrees Rankine. More...
 
virtual double GetTemperatureSL () const
 Returns the actual, modeled sea level temperature in degrees Rankine. More...
 
virtual double GetTemperatureRatio () const
 Returns the ratio of the at-current-altitude temperature as modeled over the sea level value.
 
virtual double GetTemperatureRatio (double h) const
 Returns the ratio of the temperature as modeled at the supplied altitude over the sea level value.
 
virtual double GetPressure (void) const
 Returns the pressure in psf.
 
virtual double GetPressureSL (ePressure to=ePSF) const
 
virtual double GetPressureRatio (void) const
 Returns the ratio of at-altitude pressure over the sea level value.
 
virtual double GetDensity (void) const
 Returns the density in slugs/ft^3. More...
 
virtual double GetDensity (double altitude) const
 Returns the density in slugs/ft^3 at a given altitude in ft.
 
virtual double GetDensitySL (void) const
 Returns the sea level density in slugs/ft^3.
 
virtual double GetDensityRatio (void) const
 Returns the ratio of at-altitude density over the sea level value.
 
virtual double GetSoundSpeed (void) const
 Returns the speed of sound in ft/sec.
 
virtual double GetSoundSpeed (double altitude) const
 Returns the speed of sound in ft/sec at a given altitude in ft.
 
virtual double GetSoundSpeedSL (void) const
 Returns the sea level speed of sound in ft/sec.
 
virtual double GetSoundSpeedRatio (void) const
 Returns the ratio of at-altitude sound speed over the sea level value.
 
virtual double GetAbsoluteViscosity (void) const
 Returns the absolute viscosity.
 
virtual double GetKinematicViscosity (void) const
 Returns the kinematic viscosity.
 
virtual double GetDensityAltitude () const
 
virtual double GetPressureAltitude () const
 
- Public Member Functions inherited from FGModel
 FGModel (FGFDMExec *)
 Constructor.
 
 ~FGModel () override
 Destructor.
 
virtual SGPath FindFullPathName (const SGPath &path) const
 
FGFDMExecGetExec (void)
 
const std::string & GetName (void)
 
unsigned int GetRate (void)
 Get the output rate for the model in frames.
 
virtual bool Load (Element *el)
 
void SetPropertyManager (FGPropertyManager *fgpm)
 
void SetRate (unsigned int tt)
 Set the ouput rate for the model in frames.
 
- Public Member Functions inherited from FGModelFunctions
std::string GetFunctionStrings (const std::string &delimeter) const
 Gets the strings for the current set of functions. More...
 
std::string GetFunctionValues (const std::string &delimeter) const
 Gets the function values. More...
 
FGFunctionGetPreFunction (const std::string &name)
 Get one of the "pre" function. More...
 
bool Load (Element *el, FGFDMExec *fdmex, std::string prefix="")
 
void PostLoad (Element *el, FGFDMExec *fdmex, std::string prefix="")
 
void PreLoad (Element *el, FGFDMExec *fdmex, std::string prefix="")
 
void RunPostFunctions (void)
 
void RunPreFunctions (void)
 
- Public Member Functions inherited from FGJSBBase
 FGJSBBase ()
 Constructor for FGJSBBase.
 
virtual ~FGJSBBase ()
 Destructor for FGJSBBase.
 
void PutMessage (const Message &msg)
 Places a Message structure on the Message queue. More...
 
void PutMessage (const std::string &text)
 Creates a message with the given text and places it on the queue. More...
 
void PutMessage (const std::string &text, bool bVal)
 Creates a message with the given text and boolean value and places it on the queue. More...
 
void PutMessage (const std::string &text, int iVal)
 Creates a message with the given text and integer value and places it on the queue. More...
 
void PutMessage (const std::string &text, double dVal)
 Creates a message with the given text and double value and places it on the queue. More...
 
int SomeMessages (void) const
 Reads the message on the queue (but does not delete it). More...
 
void ProcessMessage (void)
 Reads the message on the queue and removes it from the queue. More...
 
MessageProcessNextMessage (void)
 Reads the next message on the queue and removes it from the queue. More...
 
void disableHighLighting (void)
 Disables highlighting in the console output.
 

Humidity access functions

double StdSLtemperature
 Standard sea level conditions.
 
double StdSLdensity
 
double StdSLpressure
 
double StdSLsoundspeed
 
double TemperatureBias
 
double TemperatureDeltaGradient
 
double GradientFadeoutAltitude
 
double VaporMassFraction
 
double SaturatedVaporPressure
 
FGTable StdAtmosTemperatureTable
 
FGTable MaxVaporMassFraction
 
std::vector< double > LapseRates
 
std::vector< double > PressureBreakpoints
 
std::vector< double > StdPressureBreakpoints
 
std::vector< double > StdDensityBreakpoints
 
std::vector< double > StdLapseRates
 
static constexpr double EarthRadius = 6356766.0 / fttom
 Earth radius in ft as defined for ISA 1976.
 
static constexpr double a = 611.2/psftopa
 Sonntag constants based on ref [2]. More...
 
static constexpr double b = 17.62
 
static constexpr double c = 243.12
 
static constexpr double Mwater = 18.016 * kgtoslug / 1000.0
 Mean molecular weight for water - slug/mol.
 
static constexpr double Rdry = Rstar / Mair
 
static constexpr double Rwater = Rstar / Mwater
 
void SetDewPoint (eTemperature unit, double dewpoint)
 Sets the dew point. More...
 
double GetDewPoint (eTemperature to) const
 Returns the dew point. More...
 
void SetVaporPressure (ePressure unit, double Pv)
 Sets the partial pressure of water vapor. More...
 
double GetVaporPressure (ePressure to) const
 Returns the partial pressure of water vapor. More...
 
double GetSaturatedVaporPressure (ePressure to) const
 Returns the saturated pressure of water vapor. More...
 
void SetRelativeHumidity (double RH)
 Sets the relative humidity. More...
 
double GetRelativeHumidity (void) const
 Returns the relative humidity in percent.
 
void SetVaporMassFractionPPM (double frac)
 Sets the vapor mass per million of dry air mass units. More...
 
double GetVaporMassFractionPPM (void) const
 Returns the vapor mass per million of dry air mass units (ppm).
 
virtual void PrintStandardAtmosphereTable ()
 Prints the U.S. Standard Atmosphere table.
 
void Calculate (double altitude) override
 Calculate the atmosphere for the given altitude.
 
void CalculateLapseRates ()
 Recalculate the lapse rate vectors when the temperature profile is altered in a way that would change the lapse rates, such as when a gradient is applied. More...
 
void CalculatePressureBreakpoints (double SLpress)
 Calculate (or recalculate) the atmospheric pressure breakpoints at the altitudes in the standard temperature table.
 
void CalculateStdDensityBreakpoints ()
 Calculate the atmospheric density breakpoints at the altitudes in the standard temperature table.
 
double GeopotentialAltitude (double geometalt) const
 Convert a geometric altitude to a geopotential altitude.
 
double GeometricAltitude (double geopotalt) const
 Convert a geopotential altitude to a geometric altitude.
 
double CalculateDensityAltitude (double density, double geometricAlt) override
 Calculates the density altitude given any temperature or pressure bias. More...
 
double CalculatePressureAltitude (double pressure, double geometricAlt) override
 Calculates the pressure altitude given any temperature or pressure bias. More...
 
double CalculateVaporPressure (double temperature)
 Calculate the pressure of water vapor with the Magnus formula.
 
void ValidateVaporMassFraction (double geometricAlt)
 Validate the value of the vapor mass fraction.
 
void CalculateSLDensity (void)
 Calculate the SL density.
 
void CalculateSLSoundSpeedAndDensity (void)
 Calculate the SL density and sound speed.
 
void bind (void) override
 
void Debug (int from) override
 

Additional Inherited Members

- Public Types inherited from FGAtmosphere
enum  ePressure {
  eNoPressUnit =0, ePSF, eMillibars, ePascals,
  eInchesHg
}
 Enums for specifying pressure units.
 
enum  eTemperature {
  eNoTempUnit =0, eFahrenheit, eCelsius, eRankine,
  eKelvin
}
 Enums for specifying temperature units.
 
- Public Types inherited from FGJSBBase
enum  { eL = 1, eM, eN }
 Moments L, M, N.
 
enum  { eP = 1, eQ, eR }
 Rates P, Q, R.
 
enum  { eU = 1, eV, eW }
 Velocities U, V, W.
 
enum  { eX = 1, eY, eZ }
 Positions X, Y, Z.
 
enum  { ePhi = 1, eTht, ePsi }
 Euler angles Phi, Theta, Psi.
 
enum  { eDrag = 1, eSide, eLift }
 Stability axis forces, Drag, Side force, Lift.
 
enum  { eRoll = 1, ePitch, eYaw }
 Local frame orientation Roll, Pitch, Yaw.
 
enum  { eNorth = 1, eEast, eDown }
 Local frame position North, East, Down.
 
enum  { eLat = 1, eLong, eRad }
 Locations Radius, Latitude, Longitude.
 
enum  {
  inNone = 0, inDegrees, inRadians, inMeters,
  inFeet
}
 Conversion specifiers.
 
- Static Public Member Functions inherited from FGJSBBase
static const std::string & GetVersion (void)
 Returns the version number of JSBSim. More...
 
static constexpr double KelvinToFahrenheit (double kelvin)
 Converts from degrees Kelvin to degrees Fahrenheit. More...
 
static constexpr double CelsiusToRankine (double celsius)
 Converts from degrees Celsius to degrees Rankine. More...
 
static constexpr double RankineToCelsius (double rankine)
 Converts from degrees Rankine to degrees Celsius. More...
 
static constexpr double KelvinToRankine (double kelvin)
 Converts from degrees Kelvin to degrees Rankine. More...
 
static constexpr double RankineToKelvin (double rankine)
 Converts from degrees Rankine to degrees Kelvin. More...
 
static constexpr double FahrenheitToCelsius (double fahrenheit)
 Converts from degrees Fahrenheit to degrees Celsius. More...
 
static constexpr double CelsiusToFahrenheit (double celsius)
 Converts from degrees Celsius to degrees Fahrenheit. More...
 
static constexpr double CelsiusToKelvin (double celsius)
 Converts from degrees Celsius to degrees Kelvin. More...
 
static constexpr double KelvinToCelsius (double kelvin)
 Converts from degrees Kelvin to degrees Celsius. More...
 
static constexpr double FeetToMeters (double measure)
 Converts from feet to meters. More...
 
static double PitotTotalPressure (double mach, double p)
 Compute the total pressure in front of the Pitot tube. More...
 
static double MachFromImpactPressure (double qc, double p)
 Compute the Mach number from the differential pressure (qc) and the static pressure. More...
 
static double VcalibratedFromMach (double mach, double p)
 Calculate the calibrated airspeed from the Mach number. More...
 
static double MachFromVcalibrated (double vcas, double p)
 Calculate the Mach number from the calibrated airspeed.Based on the formulas in the US Air Force Aircraft Performance Flight Testing Manual (AFFTC-TIH-99-01). More...
 
static bool EqualToRoundoff (double a, double b)
 Finite precision comparison. More...
 
static bool EqualToRoundoff (float a, float b)
 Finite precision comparison. More...
 
static bool EqualToRoundoff (float a, double b)
 Finite precision comparison. More...
 
static bool EqualToRoundoff (double a, float b)
 Finite precision comparison. More...
 
static constexpr double Constrain (double min, double value, double max)
 Constrain a value between a minimum and a maximum value.
 
static constexpr double sign (double num)
 
static double GaussianRandomNumber (void)
 
- Public Attributes inherited from FGAtmosphere
struct JSBSim::FGAtmosphere::Inputs in
 
- Static Public Attributes inherited from FGAtmosphere
static constexpr double StdDaySLtemperature = 518.67
 
static constexpr double StdDaySLpressure = 2116.228
 
static const double StdDaySLsoundspeed = sqrt(SHRatio*Reng*StdDaySLtemperature)
 
- Static Public Attributes inherited from FGJSBBase
static char highint [5] = {27, '[', '1', 'm', '\0' }
 highlights text
 
static char halfint [5] = {27, '[', '2', 'm', '\0' }
 low intensity text
 
static char normint [6] = {27, '[', '2', '2', 'm', '\0' }
 normal intensity text
 
static char reset [5] = {27, '[', '0', 'm', '\0' }
 resets text properties
 
static char underon [5] = {27, '[', '4', 'm', '\0' }
 underlines text
 
static char underoff [6] = {27, '[', '2', '4', 'm', '\0' }
 underline off
 
static char fgblue [6] = {27, '[', '3', '4', 'm', '\0' }
 blue text
 
static char fgcyan [6] = {27, '[', '3', '6', 'm', '\0' }
 cyan text
 
static char fgred [6] = {27, '[', '3', '1', 'm', '\0' }
 red text
 
static char fggreen [6] = {27, '[', '3', '2', 'm', '\0' }
 green text
 
static char fgdef [6] = {27, '[', '3', '9', 'm', '\0' }
 default text
 
static short debug_lvl = 1
 
- Protected Member Functions inherited from FGAtmosphere
double ConvertToRankine (double t, eTemperature unit) const
 Converts to Rankine from one of several unit systems.
 
double ConvertFromRankine (double t, eTemperature unit) const
 Converts from Rankine to one of several unit systems.
 
double ConvertToPSF (double t, ePressure unit=ePSF) const
 Converts to PSF (pounds per square foot) from one of several unit systems.
 
double ConvertFromPSF (double t, ePressure unit=ePSF) const
 Converts from PSF (pounds per square foot) to one of several unit systems.
 
- Protected Member Functions inherited from FGModel
bool Upload (Element *el, bool preLoad)
 Uploads this model in memory. More...
 
- Static Protected Member Functions inherited from FGJSBBase
static std::string CreateIndexedPropertyName (const std::string &Property, int index)
 
- Protected Attributes inherited from FGAtmosphere
double SLtemperature
 
double SLdensity
 
double SLpressure
 
double SLsoundspeed
 
double Temperature
 
double Density
 
double Pressure
 
double Soundspeed
 
double PressureAltitude
 
double DensityAltitude
 
double Viscosity
 
double KinematicViscosity
 
- Protected Attributes inherited from FGModel
unsigned int exe_ctr
 
FGFDMExecFDMExec
 
std::string Name
 
FGPropertyManagerPropertyManager
 
unsigned int rate
 
- Protected Attributes inherited from FGModelFunctions
FGPropertyReader LocalProperties
 
std::vector< FGFunction * > PostFunctions
 
std::vector< FGFunction * > PreFunctions
 
- Static Protected Attributes inherited from FGAtmosphere
static constexpr double SutherlandConstant = 198.72
 
static constexpr double Beta = 2.269690E-08
 
static constexpr double Rstar = 8.31432 * kgtoslug / KelvinToRankine(fttom * fttom)
 Universal gas constant - ft*lbf/R/mol.
 
static constexpr double Mair = 28.9645 * kgtoslug / 1000.0
 Mean molecular weight for air - slug/mol.
 
static constexpr double g0 = 9.80665 / fttom
 Sea-level acceleration of gravity - ft/s^2. More...
 
static double Reng = Rstar / Mair
 Specific gas constant for air - ft*lbf/slug/R.
 
static constexpr double SHRatio = 1.4
 
- Static Protected Attributes inherited from FGJSBBase
static Message localMsg
 
static std::queue< MessageMessages
 
static unsigned int messageId = 0
 
static constexpr double radtodeg = 180. / M_PI
 
static constexpr double degtorad = M_PI / 180.
 
static constexpr double hptoftlbssec = 550.0
 
static constexpr double psftoinhg = 0.014138
 
static constexpr double psftopa = 47.88
 
static constexpr double ktstofps = 1.68781
 
static constexpr double fpstokts = 1.0 / ktstofps
 
static constexpr double inchtoft = 1.0/12.0
 
static constexpr double fttom = 0.3048
 
static constexpr double m3toft3 = 1.0/(fttom*fttom*fttom)
 
static constexpr double in3tom3 = inchtoft*inchtoft*inchtoft/m3toft3
 
static constexpr double inhgtopa = 3386.38
 
static constexpr double slugtolb = 32.174049
 Note that definition of lbtoslug by the inverse of slugtolb and not to a different constant you can also get from some tables will make lbtoslug*slugtolb == 1 up to the magnitude of roundoff. More...
 
static constexpr double lbtoslug = 1.0/slugtolb
 
static constexpr double kgtolb = 2.20462
 
static constexpr double kgtoslug = 0.06852168
 
static const std::string needed_cfg_version = "2.0"
 
static const std::string JSBSim_version = JSBSIM_VERSION " " __DATE__ " " __TIME__
 
static int gaussian_random_number_phase = 0
 

Member Function Documentation

◆ CalculateDensityAltitude()

double CalculateDensityAltitude ( double  density,
double  geometricAlt 
)
overrideprotectedvirtual

Calculates the density altitude given any temperature or pressure bias.

Calculated density for the specified geometric altitude given any temperature or pressure biases is passed in.

Parameters
density
geometricAlt
See also
https://en.wikipedia.org/wiki/Density_altitude https://wahiduddin.net/calc/density_altitude.htm

Reimplemented from FGAtmosphere.

Definition at line 494 of file FGStandardAtmosphere.cpp.

495 {
496  // Work out which layer we're dealing with
497  unsigned int b = 0;
498  for (; b < StdDensityBreakpoints.size() - 2; b++) {
499  if (density >= StdDensityBreakpoints[b + 1])
500  break;
501  }
502 
503  // Get layer properties
504  double Tmb = StdAtmosTemperatureTable(b + 1, 1);
505  double Hb = StdAtmosTemperatureTable(b + 1, 0);
506  double Lmb = StdLapseRates[b];
507  double pb = StdDensityBreakpoints[b];
508 
509  double density_altitude = 0.0;
510 
511  // https://en.wikipedia.org/wiki/Barometric_formula for density solved for H
512  if (Lmb != 0.0) {
513  double Exp = -1.0 / (1.0 + g0/(Rdry*Lmb));
514  density_altitude = Hb + (Tmb / Lmb) * (pow(density / pb, Exp) - 1);
515  } else {
516  double Factor = -Rdry*Tmb / g0;
517  density_altitude = Hb + Factor * log(density / pb);
518  }
519 
520  return GeometricAltitude(density_altitude);
521 }
+ Here is the call graph for this function:

◆ CalculateLapseRates()

void CalculateLapseRates ( )
protected

Recalculate the lapse rate vectors when the temperature profile is altered in a way that would change the lapse rates, such as when a gradient is applied.

This function is also called to initialize the lapse rate vector.

Definition at line 422 of file FGStandardAtmosphere.cpp.

423 {
424  unsigned int numRows = StdAtmosTemperatureTable.GetNumRows();
425  LapseRates.clear();
426 
427  for (unsigned int bh=0; bh < numRows-1; bh++)
428  {
429  double t0 = StdAtmosTemperatureTable(bh+1,1);
430  double t1 = StdAtmosTemperatureTable(bh+2,1);
431  double h0 = StdAtmosTemperatureTable(bh+1,0);
432  double h1 = StdAtmosTemperatureTable(bh+2,0);
433  LapseRates.push_back((t1 - t0) / (h1 - h0) - TemperatureDeltaGradient);
434  }
435 }
+ Here is the caller graph for this function:

◆ CalculatePressureAltitude()

double CalculatePressureAltitude ( double  pressure,
double  geometricAlt 
)
overrideprotectedvirtual

Calculates the pressure altitude given any temperature or pressure bias.

Calculated density for the specified geometric altitude given any temperature or pressure biases is passed in.

Parameters
pressure
geometricAlt
See also
https://en.wikipedia.org/wiki/Pressure_altitude

Reimplemented from FGAtmosphere.

Definition at line 525 of file FGStandardAtmosphere.cpp.

526 {
527  // Work out which layer we're dealing with
528  unsigned int b = 0;
529  for (; b < StdPressureBreakpoints.size() - 2; b++) {
530  if (pressure >= StdPressureBreakpoints[b + 1])
531  break;
532  }
533 
534  // Get layer properties
535  double Tmb = StdAtmosTemperatureTable(b + 1, 1);
536  double Hb = StdAtmosTemperatureTable(b + 1, 0);
537  double Lmb = StdLapseRates[b];
538  double Pb = StdPressureBreakpoints[b];
539 
540  double pressure_altitude = 0.0;
541 
542  if (Lmb != 0.00) {
543  // Equation 33(a) from ISA document solved for H
544  double Exp = -Rdry*Lmb / g0;
545  pressure_altitude = Hb + (Tmb / Lmb) * (pow(pressure / Pb, Exp) - 1);
546  } else {
547  // Equation 33(b) from ISA document solved for H
548  double Factor = -Rdry*Tmb / g0;
549  pressure_altitude = Hb + Factor * log(pressure / Pb);
550  }
551 
552  return GeometricAltitude(pressure_altitude);
553 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetDewPoint()

double GetDewPoint ( eTemperature  to) const

Returns the dew point.

Parameters
toThe unit of measure that the dew point should be supplied in.

Definition at line 595 of file FGStandardAtmosphere.cpp.

596 {
597  double dewpoint_degC;
598  double VaporPressure = Pressure*VaporMassFraction / (VaporMassFraction+Rdry/Rwater);
599 
600  if (VaporPressure <= 0.0)
601  dewpoint_degC = -c;
602  else {
603  double x = log(VaporPressure/a);
604  dewpoint_degC = c*x / (b - x);
605  }
606 
607  return ConvertFromRankine(1.8*(dewpoint_degC + 273.15), to);
608 }
+ Here is the call graph for this function:

◆ GetSaturatedVaporPressure()

double GetSaturatedVaporPressure ( ePressure  to) const

Returns the saturated pressure of water vapor.

Parameters
toThe unit of measure that the water vapor should be supplied in.

Definition at line 630 of file FGStandardAtmosphere.cpp.

631 {
632  return ConvertFromPSF(SaturatedVaporPressure, to);
633 }
+ Here is the call graph for this function:

◆ GetStdTemperature()

double GetStdTemperature ( double  altitude) const
virtual

Returns the standard temperature in degrees Rankine at a specified altitude.

Parameters
altitudeThe altitude in feet above sea level (ASL) to get the temperature at.
Returns
The STANDARD temperature in degrees Rankine at the specified altitude.

Definition at line 273 of file FGStandardAtmosphere.cpp.

274 {
275  double GeoPotAlt = GeopotentialAltitude(altitude);
276 
277  if (GeoPotAlt >= 0.0)
278  return StdAtmosTemperatureTable.GetValue(GeoPotAlt);
279  else
280  return StdAtmosTemperatureTable.GetValue(0.0) + GeoPotAlt*LapseRates[0];
281 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetStdTemperatureSL()

virtual double GetStdTemperatureSL ( ) const
inlinevirtual

Returns the standard sea level temperature in degrees Rankine.

Returns
The STANDARD temperature at sea level in degrees Rankine.

Definition at line 135 of file FGStandardAtmosphere.h.

135 { return StdSLtemperature; }

◆ GetTemperature()

double GetTemperature ( double  altitude) const
overridevirtual

Returns the actual modeled temperature in degrees Rankine at a specified altitude.

Parameters
altitudeThe altitude above sea level (ASL) in feet.
Returns
Modeled temperature in degrees Rankine at the specified altitude.

Implements FGAtmosphere.

Definition at line 244 of file FGStandardAtmosphere.cpp.

245 {
246  double GeoPotAlt = GeopotentialAltitude(altitude);
247 
248  double T;
249 
250  if (GeoPotAlt >= 0.0) {
251  T = StdAtmosTemperatureTable.GetValue(GeoPotAlt);
252 
253  if (GeoPotAlt <= GradientFadeoutAltitude)
254  T -= TemperatureDeltaGradient * GeoPotAlt;
255  }
256  else {
257  // We don't need to add TemperatureDeltaGradient*GeoPotAlt here because
258  // the lapse rate vector already accounts for the temperature gradient.
259  T = StdAtmosTemperatureTable.GetValue(0.0) + GeoPotAlt*LapseRates[0];
260  }
261 
262  T += TemperatureBias;
263 
264  if (GeoPotAlt <= GradientFadeoutAltitude)
265  T += TemperatureDeltaGradient * GradientFadeoutAltitude;
266 
267  return T;
268 }
+ Here is the call graph for this function:

◆ GetVaporPressure()

double GetVaporPressure ( ePressure  to) const

Returns the partial pressure of water vapor.

Parameters
toThe unit of measure that the water vapor should be supplied in.

Definition at line 622 of file FGStandardAtmosphere.cpp.

623 {
624  double VaporPressure = Pressure*VaporMassFraction / (VaporMassFraction+Rdry/Rwater);
625  return ConvertFromPSF(VaporPressure, to);
626 }
+ Here is the call graph for this function:

◆ ResetSLTemperature()

void ResetSLTemperature ( )
virtual

This function resets the model to apply no bias or delta gradient to the temperature.

The delta gradient and bias values are reset to 0.0, and the standard temperature is used for the entire temperature profile at all altitudes.

Definition at line 464 of file FGStandardAtmosphere.cpp.

465 {
466  TemperatureBias = TemperatureDeltaGradient = 0.0;
468  CalculatePressureBreakpoints(SLpressure);
469 
470  SLtemperature = StdSLtemperature;
472 }
+ Here is the call graph for this function:

◆ SetDewPoint()

void SetDewPoint ( eTemperature  unit,
double  dewpoint 
)

Sets the dew point.

Parameters
dewpointThe dew point in the units specified
unitThe unit of measure that the specified dew point is supplied in.

Definition at line 585 of file FGStandardAtmosphere.cpp.

586 {
587  double altitude = CalculatePressureAltitude(Pressure, 0.0);
588  double VaporPressure = CalculateVaporPressure(ConvertToRankine(dewpoint, unit));
589  VaporMassFraction = Rdry * VaporPressure / (Rwater * (Pressure - VaporPressure));
590  ValidateVaporMassFraction(altitude);
591 }
+ Here is the call graph for this function:

◆ SetPressureSL()

void SetPressureSL ( ePressure  unit,
double  pressure 
)
overridevirtual

Sets the sea level pressure for modeling an off-standard pressure profile.

This could be useful in the case where the pressure at an airfield is known or set for a particular simulation run.

Parameters
pressureThe pressure in the units specified.
unitthe unit of measure that the specified pressure is supplied in.

Reimplemented from FGAtmosphere.

Definition at line 225 of file FGStandardAtmosphere.cpp.

226 {
227  SLpressure = ConvertToPSF(pressure, unit);
229  CalculatePressureBreakpoints(SLpressure);
230 }
+ Here is the call graph for this function:

◆ SetRelativeHumidity()

void SetRelativeHumidity ( double  RH)

Sets the relative humidity.

Parameters
RHThe relative humidity in percent.

Definition at line 645 of file FGStandardAtmosphere.cpp.

646 {
647  double altitude = CalculatePressureAltitude(Pressure, 0.0);
648  double VaporPressure = 0.01*RH*SaturatedVaporPressure;
649  VaporMassFraction = Rdry * VaporPressure / (Rwater * (Pressure - VaporPressure));
650  ValidateVaporMassFraction(altitude);
651 }
+ Here is the call graph for this function:

◆ SetSLTemperatureGradedDelta()

void SetSLTemperatureGradedDelta ( eTemperature  unit,
double  t 
)
virtual

Sets a Sea Level temperature delta that is ramped out by 86 km.

The value of the delta is used to calculate a delta gradient that is applied to the temperature at all altitudes below 86 km (282152 ft). For instance, if a temperature of 20 degrees F is supplied, the delta gradient would be 20/282152 - or, about 7.09E-5 degrees/ft. At sea level, the full 20 degrees would be added to the standard temperature, but that 20 degree delta would be reduced by 7.09E-5 degrees for every foot of altitude above sea level, so that by 86 km, there would be no further delta added to the standard temperature. The graded delta can be used along with the a bias to tailor the temperature profile as desired.

Parameters
tthe sea level temperature delta value in the unit provided.
unitthe unit of the temperature.

Definition at line 371 of file FGStandardAtmosphere.cpp.

372 {
373  SetTemperatureGradedDelta(deltemp, 0.0, unit);
374 }
+ Here is the call graph for this function:

◆ SetTemperature()

void SetTemperature ( double  t,
double  h,
eTemperature  unit = eFahrenheit 
)
overridevirtual

Sets the temperature at the supplied altitude, if it is to be different than the standard temperature.

This function will calculate a bias - a difference - from the standard atmosphere temperature at the supplied altitude and will apply that calculated bias to the entire temperature profile. If a graded delta is present, that will be included in the calculation - that is, regardless of any graded delta present, a temperature bias will be determined so that the temperature requested in this function call will be reached.

Parameters
tThe temperature value in the unit provided.
hThe altitude in feet above sea level.
unitThe unit of the temperature.

Implements FGAtmosphere.

Definition at line 327 of file FGStandardAtmosphere.cpp.

328 {
329  double targetTemp = ConvertToRankine(t, unit);
330  double GeoPotAlt = GeopotentialAltitude(h);
331 
332  TemperatureBias = targetTemp - GetStdTemperature(h);
333 
334  if (GeoPotAlt <= GradientFadeoutAltitude)
335  TemperatureBias -= TemperatureDeltaGradient * (GradientFadeoutAltitude - GeoPotAlt);
336 
337  CalculatePressureBreakpoints(SLpressure);
338 
339  SLtemperature = GetTemperature(0.0);
341 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetTemperatureBias()

void SetTemperatureBias ( eTemperature  unit,
double  t 
)
virtual

Sets the temperature bias to be added to the standard temperature at all altitudes.

This function sets the bias - the difference - from the standard atmosphere temperature. This bias applies to the entire temperature profile. Another way to set the temperature bias is to use the SetSLTemperature function, which replaces the value calculated by this function with a calculated bias.

Parameters
tthe temperature value in the unit provided.
unitthe unit of the temperature.

Definition at line 345 of file FGStandardAtmosphere.cpp.

346 {
347  if (unit == eCelsius || unit == eKelvin)
348  t *= 1.80; // If temp delta "t" is given in metric, scale up to English
349 
350  TemperatureBias = t;
351  CalculatePressureBreakpoints(SLpressure);
352 
353  SLtemperature = GetTemperature(0.0);
355 }
+ Here is the call graph for this function:

◆ SetTemperatureGradedDelta()

void SetTemperatureGradedDelta ( double  t,
double  h,
eTemperature  unit = eFahrenheit 
)
virtual

Sets the temperature delta value at the supplied altitude/elevation above sea level, to be added to the standard temperature and ramped out by 86 km.

This function computes the sea level delta from the standard atmosphere temperature at sea level.

Parameters
tthe temperature skew value in the unit provided.
unitthe unit of the temperature.

Definition at line 383 of file FGStandardAtmosphere.cpp.

384 {
385  if (unit == eCelsius || unit == eKelvin)
386  deltemp *= 1.80; // If temp delta "t" is given in metric, scale up to English
387 
388  TemperatureDeltaGradient = deltemp/(GradientFadeoutAltitude - GeopotentialAltitude(h));
390  CalculatePressureBreakpoints(SLpressure);
391 
392  SLtemperature = GetTemperature(0.0);
394 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetTemperatureSL()

void SetTemperatureSL ( double  t,
eTemperature  unit = eFahrenheit 
)
overridevirtual

Sets the Sea Level temperature, if it is to be different than the standard.

This function will calculate a bias - a difference - from the standard atmosphere temperature and will apply that bias to the entire temperature profile. This is one way to set the temperature bias. Using the SetTemperatureBias function will replace the value calculated by this function.

Parameters
tthe temperature value in the unit provided.
unitthe unit of the temperature.

Reimplemented from FGAtmosphere.

Definition at line 363 of file FGStandardAtmosphere.cpp.

364 {
365  SetTemperature(t, 0.0, unit);
366 }
+ Here is the call graph for this function:

◆ SetVaporMassFractionPPM()

void SetVaporMassFractionPPM ( double  frac)

Sets the vapor mass per million of dry air mass units.

Parameters
fracThe fraction of water in ppm of dry air.

Definition at line 662 of file FGStandardAtmosphere.cpp.

663 {
664  double altitude = CalculatePressureAltitude(Pressure, 0.0);
665  VaporMassFraction = frac*1E-6;
666  ValidateVaporMassFraction(altitude);
667 }
+ Here is the call graph for this function:

◆ SetVaporPressure()

void SetVaporPressure ( ePressure  unit,
double  Pv 
)

Sets the partial pressure of water vapor.

Parameters
PvThe vapor pressure in the units specified
unitThe unit of measure that the specified vapor pressure is supplied in.

Definition at line 612 of file FGStandardAtmosphere.cpp.

613 {
614  double altitude = CalculatePressureAltitude(Pressure, 0.0);
615  double VaporPressure = ConvertToPSF(Pa, unit);
616  VaporMassFraction = Rdry * VaporPressure / (Rwater * (Pressure - VaporPressure));
617  ValidateVaporMassFraction(altitude);
618 }
+ Here is the call graph for this function:

Member Data Documentation

◆ a

constexpr double a = 611.2/psftopa
staticconstexprprotected

Sonntag constants based on ref [2].

They are valid for temperatures between -45 degC (-49 degF) and 60 degC (140 degF) with a precision of +/-0.35 degC (+/-0.63 degF)

Definition at line 365 of file FGStandardAtmosphere.h.


The documentation for this class was generated from the following files:
JSBSim::FGStandardAtmosphere::CalculateVaporPressure
double CalculateVaporPressure(double temperature)
Calculate the pressure of water vapor with the Magnus formula.
Definition: FGStandardAtmosphere.cpp:557
JSBSim::FGStandardAtmosphere::CalculateSLSoundSpeedAndDensity
void CalculateSLSoundSpeedAndDensity(void)
Calculate the SL density and sound speed.
Definition: FGStandardAtmosphere.cpp:234
JSBSim::FGAtmosphere::ConvertToRankine
double ConvertToRankine(double t, eTemperature unit) const
Converts to Rankine from one of several unit systems.
Definition: FGAtmosphere.cpp:169
JSBSim::FGStandardAtmosphere::SetTemperatureGradedDelta
virtual void SetTemperatureGradedDelta(double t, double h, eTemperature unit=eFahrenheit)
Sets the temperature delta value at the supplied altitude/elevation above sea level,...
Definition: FGStandardAtmosphere.cpp:383
JSBSim::FGStandardAtmosphere::SetTemperature
void SetTemperature(double t, double h, eTemperature unit=eFahrenheit) override
Sets the temperature at the supplied altitude, if it is to be different than the standard temperature...
Definition: FGStandardAtmosphere.cpp:327
JSBSim::FGAtmosphere::ConvertToPSF
double ConvertToPSF(double t, ePressure unit=ePSF) const
Converts to PSF (pounds per square foot) from one of several unit systems.
Definition: FGAtmosphere.cpp:221
JSBSim::FGAtmosphere::g0
static constexpr double g0
Sea-level acceleration of gravity - ft/s^2.
Definition: FGAtmosphere.h:268
JSBSim::FGAtmosphere::ConvertFromPSF
double ConvertFromPSF(double t, ePressure unit=ePSF) const
Converts from PSF (pounds per square foot) to one of several unit systems.
Definition: FGAtmosphere.cpp:245
JSBSim::FGStandardAtmosphere::CalculatePressureAltitude
double CalculatePressureAltitude(double pressure, double geometricAlt) override
Calculates the pressure altitude given any temperature or pressure bias.
Definition: FGStandardAtmosphere.cpp:525
JSBSim::FGStandardAtmosphere::GeometricAltitude
double GeometricAltitude(double geopotalt) const
Convert a geopotential altitude to a geometric altitude.
Definition: FGStandardAtmosphere.h:322
JSBSim::FGStandardAtmosphere::StdSLtemperature
double StdSLtemperature
Standard sea level conditions.
Definition: FGStandardAtmosphere.h:286
JSBSim::FGStandardAtmosphere::CalculateSLDensity
void CalculateSLDensity(void)
Calculate the SL density.
Definition: FGStandardAtmosphere.h:352
JSBSim::FGStandardAtmosphere::GeopotentialAltitude
double GeopotentialAltitude(double geometalt) const
Convert a geometric altitude to a geopotential altitude.
Definition: FGStandardAtmosphere.h:319
JSBSim::FGAtmosphere::ConvertFromRankine
double ConvertFromRankine(double t, eTemperature unit) const
Converts from Rankine to one of several unit systems.
Definition: FGAtmosphere.cpp:195
JSBSim::FGStandardAtmosphere::GetStdTemperature
virtual double GetStdTemperature(double altitude) const
Returns the standard temperature in degrees Rankine at a specified altitude.
Definition: FGStandardAtmosphere.cpp:273
JSBSim::FGStandardAtmosphere::ValidateVaporMassFraction
void ValidateVaporMassFraction(double geometricAlt)
Validate the value of the vapor mass fraction.
Definition: FGStandardAtmosphere.cpp:565
JSBSim::FGAtmosphere::GetTemperature
virtual double GetTemperature() const
Returns the actual, modeled temperature at the current altitude in degrees Rankine.
Definition: FGAtmosphere.h:109
JSBSim::FGStandardAtmosphere::a
static constexpr double a
Sonntag constants based on ref [2].
Definition: FGStandardAtmosphere.h:365
JSBSim::FGStandardAtmosphere::CalculateLapseRates
void CalculateLapseRates()
Recalculate the lapse rate vectors when the temperature profile is altered in a way that would change...
Definition: FGStandardAtmosphere.cpp:422
JSBSim::FGStandardAtmosphere::CalculatePressureBreakpoints
void CalculatePressureBreakpoints(double SLpress)
Calculate (or recalculate) the atmospheric pressure breakpoints at the altitudes in the standard temp...
Definition: FGStandardAtmosphere.cpp:439