]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/FGAtmosphere.h
JSBSim updates. This update changes the file format, so an update of the base
[flightgear.git] / src / FDM / JSBSim / FGAtmosphere.h
index 024969310c5d056fb9d6fa3e741ea854761fade3..43894a114122c70090237eda12320dcb1ab67928 100644 (file)
@@ -29,6 +29,7 @@ HISTORY
 11/24/98   JSB   Created
 07/23/99   TP   Added implementation of 1959 Standard Atmosphere
            Moved calculation of Mach number to FGTranslation
+                Updated to '76 model
  
  
 ********************************************************************************
@@ -71,6 +72,10 @@ CLASS DOCUMENTATION
 /** Models the standard atmosphere.
     @author Tony Peden, Jon Berndt
     @version $Id$
+    @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGAtmosphere.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
+         Header File </a>
+    @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGAtmosphere.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
+         Source File </a>
 */
 
 /******************************************************************************
@@ -88,75 +93,101 @@ public:
       @return false if no error */
   bool Run(void);
 
+  bool InitModel(void);
+
   /// Returns the temperature in degrees Rankine.
-  inline float GetTemperature(void) {return temperature;}
+  inline double GetTemperature(void) const {return *temperature;}
   /** Returns the density in slugs/ft^3.
       <i>This function may <b>only</b> be used if Run() is called first.</i> */
-  inline float GetDensity(void)    {return density;}
+  inline double GetDensity(void)  const {return *density;}
   /// Returns the pressure in psf.
-  inline float GetPressure(void)   {return pressure;}
+  inline double GetPressure(void)  const {return *pressure;}
   /// Returns the speed of sound in ft/sec.
-  inline float GetSoundSpeed(void) {return soundspeed;}
+  inline double GetSoundSpeed(void) const {return soundspeed;}
 
   /// Returns the sea level temperature in degrees Rankine.
-  inline float GetTemperatureSL(void) { return SLtemperature; }
+  inline double GetTemperatureSL(void) const { return SLtemperature; }
   /// Returns the sea level density in slugs/ft^3
-  inline float GetDensitySL(void)     { return SLdensity; }
+  inline double GetDensitySL(void)  const { return SLdensity; }
   /// Returns the sea level pressure in psf.
-  inline float GetPressureSL(void)    { return SLpressure; }
+  inline double GetPressureSL(void) const { return SLpressure; }
   /// Returns the sea level speed of sound in ft/sec.
-  inline float GetSoundSpeedSL(void)  { return SLsoundspeed; }
+  inline double GetSoundSpeedSL(void) const { return SLsoundspeed; }
 
   /// Returns the ratio of at-altitude temperature over the sea level value.
-  inline float GetTemperatureRatio(void)  { return temperature*rSLtemperature; }
+  inline double GetTemperatureRatio(void) const { return (*temperature)*rSLtemperature; }
   /// Returns the ratio of at-altitude density over the sea level value.
-  inline float GetDensityRatio(void)     { return density*rSLdensity; }
+  inline double GetDensityRatio(void) const { return (*density)*rSLdensity; }
   /// Returns the ratio of at-altitude pressure over the sea level value.
-  inline float GetPressureRatio(void)     { return pressure*rSLpressure; }
+  inline double GetPressureRatio(void) const { return (*pressure)*rSLpressure; }
   /// Returns the ratio of at-altitude sound speed over the sea level value.
-  inline float GetSoundSpeedRatio(void)   { return soundspeed*rSLsoundspeed; }
+  inline double GetSoundSpeedRatio(void) const { return soundspeed*rSLsoundspeed; }
 
   /// Tells the simulator to use an externally calculated atmosphere model.
-  inline void UseExternal(void)          { useExternal=true;  }
+  void UseExternal(void);
   /// Tells the simulator to use the internal atmosphere model.
-  inline void UseInternal(void)          { useExternal=false; } //this is the default
+  void UseInternal(void);  //this is the default
   /// Gets the boolean that tells if the external atmosphere model is being used.
   bool External(void) { return useExternal; }
 
   /// Provides the external atmosphere model with an interface to set the temperature.
-  inline void SetExTemperature(float t)  { exTemperature=t; }
+  inline void SetExTemperature(double t)  { exTemperature=t; }
   /// Provides the external atmosphere model with an interface to set the density.
-  inline void SetExDensity(float d)      { exDensity=d; }
+  inline void SetExDensity(double d)      { exDensity=d; }
   /// Provides the external atmosphere model with an interface to set the pressure.
-  inline void SetExPressure(float p)     { exPressure=p; }
+  inline void SetExPressure(double p)     { exPressure=p; }
 
   /// Sets the wind components in NED frame.
-  inline void SetWindNED(float wN, float wE, float wD) { vWindNED(1)=wN; vWindNED(2)=wE; vWindNED(3)=wD;}
+  inline void SetWindNED(double wN, double wE, double wD) { vWindNED(1)=wN; vWindNED(2)=wE; vWindNED(3)=wD;}
 
   /// Retrieves the wind components in NED frame.
   inline FGColumnVector3& GetWindNED(void) { return vWindNED; }
   
   /** Retrieves the wind direction. The direction is defined as north=0 and
       increases counterclockwise. The wind heading is returned in radians.*/
-  inline float GetWindPsi(void) { return psiw; }
+  inline double GetWindPsi(void) const { return psiw; }
+  
+  inline void SetTurbGain(double tt) {TurbGain = tt;}
+  
+  inline double GetTurbPQR(int idx) const {return vTurbPQR(idx);}
+  inline FGColumnVector3& GetTurbPQR(void) {return vTurbPQR;}
+  
+  void bind(void);
+  void unbind(void);
+
   
 private:
   double rho;
 
+  enum tType {ttBerndt, ttNone} turbType;
+
   int lastIndex;
   double h;
   double htab[8];
   double SLtemperature,SLdensity,SLpressure,SLsoundspeed;
   double rSLtemperature,rSLdensity,rSLpressure,rSLsoundspeed; //reciprocals
-  double temperature,density,pressure,soundspeed;
+  double *temperature,*density,*pressure;
+  double soundspeed;
   bool useExternal;
   double exTemperature,exDensity,exPressure;
+  double intTemperature, intDensity, intPressure;
   
+  double MagnitudedAccelDt, MagnitudeAccel, Magnitude;
+  double TurbGain;
+  FGColumnVector3 vDirectiondAccelDt;
+  FGColumnVector3 vDirectionAccel;
+  FGColumnVector3 vDirection;
+  FGColumnVector3 vTurbulence;
+  FGColumnVector3 vTurbulenceGrad;
+  FGColumnVector3 vBodyTurbGrad;
+  FGColumnVector3 vTurbPQR;
+
   FGColumnVector3 vWindNED;
   double psiw;
 
-  void Calculate(float altitude);
-  void Debug(void);
+  void Calculate(double altitude);
+  void Turbulence(void);
+  void Debug(int from);
 };
 
 /******************************************************************************/