]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/models/atmosphere/FGMars.h
Don't declare functions that are not implemented
[flightgear.git] / src / FDM / JSBSim / models / atmosphere / FGMars.h
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2  
3  Header:       FGMars.h
4  Author:       Jon Berndt
5  Date started: 01/05/2004
6  
7  ------------- Copyright (C) 2004  Jon S. Berndt (jsb@hal-pc.org) -------------
8  
9  This program is free software; you can redistribute it and/or modify it under
10  the terms of the GNU 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 General Public License for more
17  details.
18  
19  You should have received a copy of the GNU 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 General Public License can also be found on
24  the world wide web at http://www.gnu.org.
25  
26 HISTORY
27 --------------------------------------------------------------------------------
28 01/05/2004   JSB   Created
29  
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
31 SENTRY
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
33
34 #ifndef FGMars_H
35 #define FGMars_H
36
37 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38 INCLUDES
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
40
41 #include <models/FGAtmosphere.h>
42
43 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
44 DEFINITIONS
45 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
46
47 #define ID_MARS "$Id$"
48
49 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
50 FORWARD DECLARATIONS
51 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
52
53 namespace JSBSim {
54
55 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
56 CLASS DOCUMENTATION
57 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
58
59 /** Models the Martian atmosphere.
60     @author Jon Berndt
61     @version $Id$
62 */
63
64 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
65 CLASS DECLARATION
66 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
67
68 class FGMars : public FGAtmosphere {
69 public:
70
71   /// Constructor
72   FGMars(FGFDMExec*);
73   /// Destructor
74   //~FGMars();
75   /** Runs the Martian atmosphere model; called by the Executive
76       @return false if no error */
77   bool Run(void);
78
79   bool InitModel(void);
80
81   /// Returns the temperature in degrees Rankine.
82   inline double GetTemperature(void) const {return *temperature;}
83   /** Returns the density in slugs/ft^3.
84       <i>This function may <b>only</b> be used if Run() is called first.</i> */
85   inline double GetDensity(void)  const {return *density;}
86   /// Returns the pressure in psf.
87   inline double GetPressure(void)  const {return *pressure;}
88   /// Returns the speed of sound in ft/sec.
89   inline double GetSoundSpeed(void) const {return soundspeed;}
90
91   /// Returns the sea level temperature in degrees Rankine.
92   inline double GetTemperatureSL(void) const { return SLtemperature; }
93   /// Returns the sea level density in slugs/ft^3
94   inline double GetDensitySL(void)  const { return SLdensity; }
95   /// Returns the sea level pressure in psf.
96   inline double GetPressureSL(void) const { return SLpressure; }
97   /// Returns the sea level speed of sound in ft/sec.
98   inline double GetSoundSpeedSL(void) const { return SLsoundspeed; }
99
100   /// Returns the ratio of at-altitude temperature over the sea level value.
101   inline double GetTemperatureRatio(void) const { return (*temperature)*rSLtemperature; }
102   /// Returns the ratio of at-altitude density over the sea level value.
103   inline double GetDensityRatio(void) const { return (*density)*rSLdensity; }
104   /// Returns the ratio of at-altitude pressure over the sea level value.
105   inline double GetPressureRatio(void) const { return (*pressure)*rSLpressure; }
106   /// Returns the ratio of at-altitude sound speed over the sea level value.
107   inline double GetSoundSpeedRatio(void) const { return soundspeed*rSLsoundspeed; }
108
109   /// Tells the simulator to use an externally calculated atmosphere model.
110   void UseExternal(void);
111   /// Tells the simulator to use the internal atmosphere model.
112   void UseInternal(void);  //this is the default
113   /// Gets the boolean that tells if the external atmosphere model is being used.
114   bool External(void) { return useExternal; }
115
116   /// Provides the external atmosphere model with an interface to set the temperature.
117   inline void SetExTemperature(double t)  { exTemperature=t; }
118   /// Provides the external atmosphere model with an interface to set the density.
119   inline void SetExDensity(double d)      { exDensity=d; }
120   /// Provides the external atmosphere model with an interface to set the pressure.
121   inline void SetExPressure(double p)     { exPressure=p; }
122
123   /// Sets the wind components in NED frame.
124   inline void SetWindNED(double wN, double wE, double wD) { vWindNED(1)=wN; vWindNED(2)=wE; vWindNED(3)=wD;}
125
126   /// Retrieves the wind components in NED frame.
127   inline FGColumnVector3& GetWindNED(void) { return vWindNED; }
128   
129   /** Retrieves the wind direction. The direction is defined as north=0 and
130       increases counterclockwise. The wind heading is returned in radians.*/
131   inline double GetWindPsi(void) const { return psiw; }
132   
133   inline void SetTurbGain(double tt) {TurbGain = tt;}
134   inline void SetTurbRate(double tt) {TurbRate = tt;}
135   
136   inline double GetTurbPQR(int idx) const {return vTurbPQR(idx);}
137   inline FGColumnVector3& GetTurbPQR(void) {return vTurbPQR;}
138   
139   //void bind(void);
140   void unbind(void);
141
142   
143 private:
144   double rho;
145
146   enum tType {ttStandard, ttBerndt, ttNone} turbType;
147
148   int lastIndex;
149   double h;
150   double htab[8];
151   double SLtemperature,SLdensity,SLpressure,SLsoundspeed;
152   double rSLtemperature,rSLdensity,rSLpressure,rSLsoundspeed; //reciprocals
153   double *temperature,*density,*pressure;
154   double soundspeed;
155   bool useExternal;
156   double exTemperature,exDensity,exPressure;
157   double intTemperature, intDensity, intPressure;
158   
159   double MagnitudedAccelDt, MagnitudeAccel, Magnitude;
160   double TurbGain;
161   double TurbRate;
162   FGColumnVector3 vDirectiondAccelDt;
163   FGColumnVector3 vDirectionAccel;
164   FGColumnVector3 vDirection;
165   FGColumnVector3 vTurbulence;
166   FGColumnVector3 vTurbulenceGrad;
167   FGColumnVector3 vBodyTurbGrad;
168   FGColumnVector3 vTurbPQR;
169
170   FGColumnVector3 vWindNED;
171   double psiw;
172
173   void Calculate(double altitude);
174   void Turbulence(void);
175   void Debug(int from);
176 };
177
178 } // namespace JSBSim
179
180 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
181 #endif
182