JSBSim Flight Dynamics Model  1.0 (02 March 2017)
An Open Source Flight Dynamics and Control Software Library in C++
FGStandardAtmosphere.h
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 
3  Header: FGStandardAtmosphere.h
4  Author: Jon Berndt
5  Date started: 5/2011
6 
7  ------------- Copyright (C) 2011 Jon S. Berndt (jon@jsbsim.org) -------------
8 
9  This program is free software; you can redistribute it and/or modify it under
10  the terms of the GNU Lesser General Public License as published by the Free Software
11  Foundation; either version 2 of the License, or (at your option) any later
12  version.
13 
14  This program is distributed in the hope that it will be useful, but WITHOUT
15  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
17  details.
18 
19  You should have received a copy of the GNU Lesser General Public License along with
20  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21  Place - Suite 330, Boston, MA 02111-1307, USA.
22 
23  Further information about the GNU Lesser General Public License can also be found on
24  the world wide web at http://www.gnu.org.
25 
26 HISTORY
27 --------------------------------------------------------------------------------
28 5/2011 JSB Created
29 
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
31 SENTRY
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
33 
34 #ifndef FGSTANDARDATMOSPHERE_H
35 #define FGSTANDARDATMOSPHERE_H
36 
37 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38 INCLUDES
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
40 
41 #include <vector>
42 #include "math/FGTable.h"
43 #include "models/FGAtmosphere.h"
44 
45 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
46 DEFINITIONS
47 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
48 
49 #define ID_STANDARDATMOSPHERE "$Id: FGStandardAtmosphere.h,v 1.17 2012/04/13 13:18:27 jberndt Exp $"
50 
51 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
52 FORWARD DECLARATIONS
53 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
54 
55 namespace JSBSim {
56 
57 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
58 CLASS DOCUMENTATION
59 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
60 
99 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
100 CLASS DECLARATION
101 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
102 
104 public:
107 
109  virtual ~FGStandardAtmosphere();
110 
111  bool InitModel(void);
112 
113  // *************************************************************************
122  // @{
126  virtual double GetTemperature(double altitude) const;
127 
131  virtual double GetStdTemperature(double altitude) const;
132 
135  virtual double GetStdTemperatureSL() const { return GetStdTemperature(0.0); }
136 
139  virtual double GetStdTemperatureRatio(double h) const { return GetStdTemperature(h)*rSLtemperature; }
140 
142  virtual double GetTemperatureBias(eTemperature to) const
143  { if (to == eCelsius || to == eKelvin) return TemperatureBias/1.80; else return TemperatureBias; }
144 
148  { if (to == eCelsius || to == eKelvin) return TemperatureDeltaGradient/1.80; else return TemperatureDeltaGradient; }
149 
158  virtual void SetTemperatureSL(double t, eTemperature unit=eFahrenheit);
159 
171  virtual void SetTemperature(double t, double h, eTemperature unit=eFahrenheit);
172 
181  virtual void SetTemperatureBias(eTemperature unit, double t);
182 
196  virtual void SetSLTemperatureGradedDelta(eTemperature unit, double t);
197 
205  virtual void SetTemperatureGradedDelta(double t, double h, eTemperature unit=eFahrenheit);
206 
211  virtual void ResetSLTemperature();
213 
214  // *************************************************************************
216 
217  virtual double GetPressure(double altitude) const;
219 
221  virtual double GetStdPressure100K(double altitude) const;
222 
224  virtual double GetStdPressure(double altitude) const;
225 
232  virtual void SetPressureSL(ePressure unit, double pressure);
233 
236  virtual void ResetSLPressure();
238 
239  // *************************************************************************
241 
242  virtual double GetStdDensity(double altitude) const;
245 
247  virtual void PrintStandardAtmosphereTable();
248 
249 protected:
250  double StdSLtemperature, StdSLdensity, StdSLpressure, StdSLsoundspeed; // Standard sea level conditions
251 
252  double TemperatureBias;
253  double TemperatureDeltaGradient;
254  double GradientFadeoutAltitude;
255 
256  FGTable* StdAtmosTemperatureTable;
257  std::vector<double> LapseRateVector;
258  std::vector<double> PressureBreakpointVector;
259 
263  void CalculateLapseRates();
264 
268 
269  virtual void bind(void);
270  void Debug(int from);
271 };
272 
273 } // namespace JSBSim
274 
275 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
276 #endif
277 
virtual double GetStdDensity(double altitude) const
Returns the standard density at a specified altitude.
virtual double GetTemperatureBias(eTemperature to) const
Returns the temperature bias over the sea level value in degrees Rankine.
void CalculateLapseRates()
Recalculate the lapse rate vectors when the temperature profile is altered in a way that would change...
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...
ePressure
Enums for specifying pressure units.
Definition: FGAtmosphere.h:91
virtual double GetPressure(void) const
Returns the pressure in psf.
Definition: FGAtmosphere.h:152
virtual void PrintStandardAtmosphereTable()
Prints the U.S. Standard Atmosphere table.
FGStandardAtmosphere(FGFDMExec *)
Constructor.
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 double GetStdTemperatureSL() const
Returns the standard sea level temperature in degrees Rankine.
virtual double GetStdPressure(double altitude) const
Returns the standard pressure at the specified altitude.
void CalculatePressureBreakpoints()
Calculate (or recalculate) the atmospheric pressure breakpoints at the altitudes in the standard temp...
Models an empty, abstract base atmosphere class.
Definition: FGAtmosphere.h:84
virtual void SetPressureSL(ePressure unit, double pressure)
Sets the sea level pressure for modeling an off-standard pressure profile.
virtual void SetTemperatureBias(eTemperature unit, double t)
Sets the temperature bias to be added to the standard temperature at all altitudes.
virtual void ResetSLTemperature()
This function resets the model to apply no bias or delta gradient to the temperature.
virtual double GetTemperatureDeltaGradient(eTemperature to)
Returns the temperature gradient to be applied on top of the standard temperature gradient...
virtual ~FGStandardAtmosphere()
Destructor.
eTemperature
Enums for specifying temperature units.
Definition: FGAtmosphere.h:88
virtual double GetStdTemperatureRatio(double h) const
Returns the ratio of the standard temperature at the supplied altitude over the standard sea level te...
virtual void ResetSLPressure()
Resets the sea level to the Standard sea level pressure, and recalculates dependent parameters so tha...
virtual double GetStdTemperature(double altitude) const
Returns the standard temperature in degrees Rankine at a specified altitude.
Encapsulates the JSBSim simulation executive.
Definition: FGFDMExec.h:189
Lookup table class.
Definition: FGTable.h:243
virtual double GetTemperature() const
Returns the actual, modeled temperature at the current altitude in degrees Rankine.
Definition: FGAtmosphere.h:117
virtual void SetSLTemperatureGradedDelta(eTemperature unit, double t)
Sets a Sea Level temperature delta that is ramped out by 86 km.
virtual double GetStdPressure100K(double altitude) const
Returns the standard pressure at a specified altitude in psf.