JSBSim Flight Dynamics Model 1.0 (23 February 2013)
An Open Source Flight Dynamics and Control Software Library in C++

FGStandardAtmosphere Class Reference

Models the 1976 U.S. More...

#include <FGStandardAtmosphere.h>

Inheritance diagram for FGStandardAtmosphere:
Collaboration diagram for FGStandardAtmosphere:

List of all members.

Public Member Functions

 FGStandardAtmosphere (FGFDMExec *)
 Constructor.
virtual ~FGStandardAtmosphere ()
 Destructor.
bool InitModel (void)
virtual void PrintStandardAtmosphereTable ()
 Prints the U.S. Standard Atmosphere table.
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.

virtual double GetTemperature (double altitude) const
 Returns the actual modeled temperature in degrees Rankine at a specified altitude.
virtual double GetStdTemperature (double altitude) const
 Returns the standard temperature in degrees Rankine at a specified altitude.
virtual double GetStdTemperatureSL () const
 Returns the standard sea level temperature in degrees Rankine.
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.
virtual void SetTemperatureSL (double t, eTemperature unit=eFahrenheit)
 Sets the Sea Level temperature, if it is to be different than the standard.
virtual void SetTemperature (double t, double h, eTemperature unit=eFahrenheit)
 Sets the temperature at the supplied altitude, if it is to be different than the standard temperature.
virtual void SetTemperatureBias (eTemperature unit, double t)
 Sets the temperature bias to be added to the standard temperature at all altitudes.
virtual void SetSLTemperatureGradedDelta (eTemperature unit, double t)
 Sets a Sea Level temperature delta that is ramped out by 86 km.
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.
virtual void ResetSLTemperature ()
 This function resets the model to apply no bias or delta gradient to the temperature.
Pressure access functions.
virtual double GetPressure (double altitude) const
 Returns the pressure at a specified altitude in psf.
virtual double GetStdPressure100K (double altitude) const
 Returns the standard pressure at a specified altitude in psf.
virtual double GetStdPressure (double altitude) const
 Returns the standard pressure at the specified altitude.
virtual void SetPressureSL (ePressure unit, double pressure)
 Sets the sea level pressure for modeling an off-standard pressure profile.
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.

Protected Member Functions

virtual void bind (void)
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.
void CalculatePressureBreakpoints ()
 Calculate (or recalculate) the atmospheric pressure breakpoints at the altitudes in the standard temperature table.
void Debug (int from)

Protected Attributes

double GradientFadeoutAltitude
std::vector< double > LapseRateVector
std::vector< double > PressureBreakpointVector
FGTableStdAtmosTemperatureTable
double StdSLdensity
double StdSLpressure
double StdSLsoundspeed
double StdSLtemperature
double TemperatureBias
double TemperatureDeltaGradient

Detailed Description

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
Version:
Id:
FGStandardAtmosphere.h,v 1.17 2012/04/13 13:18:27 jberndt Exp

Definition at line 103 of file FGStandardAtmosphere.h.


Member Function Documentation

void CalculateLapseRates ( ) [protected]

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

Definition at line 360 of file FGStandardAtmosphere.cpp.

Referenced by FGStandardAtmosphere::ResetSLTemperature(), and FGStandardAtmosphere::SetTemperatureGradedDelta().

{
  for (unsigned int bh=0; bh<LapseRateVector.size(); bh++)
  {
    double t0 = (*StdAtmosTemperatureTable)(bh+1,1);
    double t1 = (*StdAtmosTemperatureTable)(bh+2,1);
    double h0 = (*StdAtmosTemperatureTable)(bh+1,0);
    double h1 = (*StdAtmosTemperatureTable)(bh+2,0);
    LapseRateVector[bh] = (t1 - t0) / (h1 - h0) + TemperatureDeltaGradient;
  }
}

Here is the caller graph for this function:

void CalculatePressureBreakpoints ( ) [protected]

Definition at line 374 of file FGStandardAtmosphere.cpp.

Referenced by FGStandardAtmosphere::ResetSLPressure(), FGStandardAtmosphere::ResetSLTemperature(), FGStandardAtmosphere::SetPressureSL(), FGStandardAtmosphere::SetTemperature(), FGStandardAtmosphere::SetTemperatureBias(), and FGStandardAtmosphere::SetTemperatureGradedDelta().

{
  for (unsigned int b=0; b<PressureBreakpointVector.size()-1; b++) {
    double BaseTemp = (*StdAtmosTemperatureTable)(b+1,1);
    double BaseAlt = (*StdAtmosTemperatureTable)(b+1,0);
    double UpperAlt = (*StdAtmosTemperatureTable)(b+2,0);
    double deltaH = UpperAlt - BaseAlt;
    double Tmb = BaseTemp
                 + TemperatureBias 
                 + (GradientFadeoutAltitude - BaseAlt)*TemperatureDeltaGradient;
    if (LapseRateVector[b] != 0.00) {
      double Lmb = LapseRateVector[b];
      double Exp = Mair/(Rstar*Lmb);
      double factor = Tmb/(Tmb + Lmb*deltaH);
      PressureBreakpointVector[b+1] = PressureBreakpointVector[b]*pow(factor, Exp);
    } else {
      PressureBreakpointVector[b+1] = PressureBreakpointVector[b]*exp(-Mair*deltaH/(Rstar*Tmb));
    }
  }
}

Here is the caller graph for this function:

double GetStdTemperature ( double  altitude) const [virtual]
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 197 of file FGStandardAtmosphere.cpp.

Referenced by FGStandardAtmosphere::GetStdDensity(), FGStandardAtmosphere::GetStdTemperatureRatio(), and FGStandardAtmosphere::GetStdTemperatureSL().

{
  double Lk9 = 0.00658368; // deg R per foot
  double Tinf = 1800.0; // Same as 1000 Kelvin
  double temp = Tinf;

  if (altitude < 298556.4) {                // 91 km - station 8

    temp = StdAtmosTemperatureTable->GetValue(altitude);

  } else if (altitude < 360892.4) {        // 110 km - station 9

    temp = 473.7429 - 137.38176 * sqrt(1.0 - pow((altitude - 298556.4)/65429.462, 2.0));

  } else if (altitude < 393700.8) {        // 120 km - station 10

    temp = 432 + Lk9 * (altitude - 360892.4);

  } else if (altitude < 3280839.9) {        // 1000 km station 12

    double lambda = 0.00001870364;
    double eps = (altitude - 393700.8) * (20855531.5 + 393700.8) / (20855531.5 + altitude);
    temp = Tinf - (Tinf - 648.0) * exp(-lambda*eps);

  }

  return temp;
}

Here is the caller graph for this function:

virtual double GetStdTemperatureRatio ( double  h) const [inline, virtual]

Definition at line 139 of file FGStandardAtmosphere.h.

References FGStandardAtmosphere::GetStdTemperature().

{ return GetStdTemperature(h)*rSLtemperature; }

Here is the call graph for this function:

virtual double GetStdTemperatureSL ( ) const [inline, virtual]
Returns:
The STANDARD temperature at sea level in degrees Rankine.

Definition at line 135 of file FGStandardAtmosphere.h.

References FGStandardAtmosphere::GetStdTemperature().

{ return GetStdTemperature(0.0); }

Here is the call graph for this function:

double GetTemperature ( double  altitude) const [virtual]
Parameters:
altitudeThe altitude above sea level (ASL) in feet.
Returns:
Modeled temperature in degrees Rankine at the specified altitude.

Implements FGAtmosphere.

Definition at line 185 of file FGStandardAtmosphere.cpp.

{
  double T = StdAtmosTemperatureTable->GetValue(altitude) + TemperatureBias;
  if (altitude <= GradientFadeoutAltitude)
    T += TemperatureDeltaGradient * (GradientFadeoutAltitude - altitude);

  return T;
}
virtual double GetTemperatureDeltaGradient ( eTemperature  to) [inline, virtual]

Definition at line 147 of file FGStandardAtmosphere.h.

  { if (to == eCelsius || to == eKelvin) return TemperatureDeltaGradient/1.80; else return TemperatureDeltaGradient; }
void ResetSLPressure ( ) [virtual]

Definition at line 406 of file FGStandardAtmosphere.cpp.

References FGStandardAtmosphere::CalculatePressureBreakpoints().

{
  PressureBreakpointVector[0] = StdSLpressure; // psf
  CalculatePressureBreakpoints();
}

Here is the call graph for this function:

void ResetSLTemperature ( ) [virtual]

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 397 of file FGStandardAtmosphere.cpp.

References FGStandardAtmosphere::CalculateLapseRates(), and FGStandardAtmosphere::CalculatePressureBreakpoints().

{
  TemperatureBias = TemperatureDeltaGradient = 0.0;
  CalculateLapseRates();
  CalculatePressureBreakpoints();
}

Here is the call graph for this function:

void SetPressureSL ( ePressure  unit,
double  pressure 
) [virtual]

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 173 of file FGStandardAtmosphere.cpp.

References FGStandardAtmosphere::CalculatePressureBreakpoints().

{
  double press = ConvertToPSF(pressure, unit);

  PressureBreakpointVector[0] = press;
  CalculatePressureBreakpoints();
}

Here is the call graph for this function:

void SetSLTemperatureGradedDelta ( eTemperature  unit,
double  t 
) [virtual]

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 312 of file FGStandardAtmosphere.cpp.

References FGStandardAtmosphere::SetTemperatureGradedDelta().

{
  SetTemperatureGradedDelta(deltemp, 0.0, unit);
}

Here is the call graph for this function:

void SetTemperature ( double  t,
double  h,
eTemperature  unit = eFahrenheit 
) [virtual]

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 278 of file FGStandardAtmosphere.cpp.

References FGStandardAtmosphere::CalculatePressureBreakpoints(), and FGAtmosphere::GetTemperature().

Referenced by FGStandardAtmosphere::SetTemperatureSL().

{
  double targetSLtemp = ConvertToRankine(t, unit);

  TemperatureBias = 0.0;
  TemperatureBias = targetSLtemp - GetTemperature(h);
  CalculatePressureBreakpoints();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SetTemperatureBias ( eTemperature  unit,
double  t 
) [virtual]

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 289 of file FGStandardAtmosphere.cpp.

References FGStandardAtmosphere::CalculatePressureBreakpoints().

{
  if (unit == eCelsius || unit == eKelvin)
    t *= 1.80; // If temp delta "t" is given in metric, scale up to English

  TemperatureBias = t;
  CalculatePressureBreakpoints();
}

Here is the call graph for this function:

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

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 324 of file FGStandardAtmosphere.cpp.

References FGStandardAtmosphere::CalculateLapseRates(), and FGStandardAtmosphere::CalculatePressureBreakpoints().

Referenced by FGStandardAtmosphere::SetSLTemperatureGradedDelta().

{
  if (unit == eCelsius || unit == eKelvin)
    deltemp *= 1.80; // If temp delta "t" is given in metric, scale up to English

  TemperatureDeltaGradient = deltemp/(GradientFadeoutAltitude - h);
  CalculateLapseRates();
  CalculatePressureBreakpoints();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SetTemperatureSL ( double  t,
eTemperature  unit = eFahrenheit 
) [virtual]

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 304 of file FGStandardAtmosphere.cpp.

References FGStandardAtmosphere::SetTemperature().

{
  SetTemperature(t, 0.0, unit);
}

Here is the call graph for this function:


The documentation for this class was generated from the following files: