]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/FGAtmosphere.h
678c1761e8b3e3052aeee47ef9879436f8f4dcae
[flightgear.git] / src / FDM / JSBSim / FGAtmosphere.h
1 /*******************************************************************************
2  
3  Header:       FGAtmosphere.h
4  Author:       Jon Berndt
5                Implementation of 1959 Standard Atmosphere added by Tony Peden
6  Date started: 11/24/98
7  
8  ------------- Copyright (C) 1999  Jon S. Berndt (jsb@hal-pc.org) -------------
9  
10  This program is free software; you can redistribute it and/or modify it under
11  the terms of the GNU General Public License as published by the Free Software
12  Foundation; either version 2 of the License, or (at your option) any later
13  version.
14  
15  This program is distributed in the hope that it will be useful, but WITHOUT
16  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
18  details.
19  
20  You should have received a copy of the GNU General Public License along with
21  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
22  Place - Suite 330, Boston, MA  02111-1307, USA.
23  
24  Further information about the GNU General Public License can also be found on
25  the world wide web at http://www.gnu.org.
26  
27 HISTORY
28 --------------------------------------------------------------------------------
29 11/24/98   JSB   Created
30 07/23/99   TP   Added implementation of 1959 Standard Atmosphere
31            Moved calculation of Mach number to FGTranslation
32  
33  
34 ********************************************************************************
35 SENTRY
36 *******************************************************************************/
37
38 #ifndef FGAtmosphere_H
39 #define FGAtmosphere_H
40
41 /*******************************************************************************
42 INCLUDES
43 *******************************************************************************/
44
45 #include "FGModel.h"
46 #include "FGMatrix.h"
47
48 #define ID_ATMOSPHERE "$Header$"
49
50 /*******************************************************************************
51 COMMENTS, REFERENCES,  and NOTES
52 ********************************************************************************
53  
54 [1]    Anderson, John D. "Introduction to Flight, Third Edition", McGraw-Hill,
55       1989, ISBN 0-07-001641-0
56  
57 *******************************************************************************
58 CLASS DECLARATION
59 *******************************************************************************/
60
61 class FGAtmosphere : public FGModel {
62 public:
63
64   FGAtmosphere(FGFDMExec*);
65   ~FGAtmosphere(void);
66   bool Run(void);
67
68   inline float GetTemperature(void) {return temperature;}
69   inline float GetDensity(void)    {return density;}     // use only after Run() has been called
70   inline float GetPressure(void)   {return pressure;}
71   inline float GetSoundSpeed(void) {return soundspeed;}
72
73   inline float GetTemperatureSL(void) { return SLtemperature; }  //Rankine, altitude in feet
74   inline float GetDensitySL(void)     { return SLdensity; }      //slugs/ft^3
75   inline float GetPressureSL(void)    { return SLpressure; }     //lbs/ft^2
76   inline float GetSoundSpeedSL(void)  { return SLsoundspeed; }   //ft/s
77
78   inline float GetTemperatureRatio(void)  { return temperature/SLtemperature; }
79   inline float GetDensityRatio(void)      { return density/SLdensity; }
80   inline float GetPressureRatio(void)     { return pressure/SLpressure; }
81   inline float GetSoundSpeedRatio(void)   { return soundspeed/SLsoundspeed; }
82
83   inline void UseExternal(void)          { useExternal=true;  }
84   inline void UseInternal(void)          { useExternal=false; } //this is the default
85
86   inline void SetExTemperature(float t)  { exTemperature=t; }
87   inline void SetExDensity(float d)      { exDensity=d; }
88   inline void SetExPressure(float p)     { exPressure=p; }
89
90   inline void SetWindNED(float wN, float wE, float wD) { vWindNED(1)=wN; vWindNED(2)=wE; vWindNED(3)=wD;}
91
92   inline float GetWindN(void) { return vWindNED(1); }
93   inline float GetWindE(void) { return vWindNED(2); }
94   inline float GetWindD(void) { return vWindNED(3); }
95
96   inline FGColumnVector GetWindUVW(void) { return vWindUVW; }
97
98 protected:
99
100 private:
101   float rho;
102
103   float h;
104   float SLtemperature,SLdensity,SLpressure,SLsoundspeed;
105   float temperature,density,pressure,soundspeed;
106   bool useExternal;
107   float exTemperature,exDensity,exPressure;
108   FGColumnVector vWindNED,vWindUVW;
109
110   void Calculate(float altitude);
111
112 };
113
114
115
116 /******************************************************************************/
117 #endif