]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/FGAtmosphere.h
Fix stall widths for the "auxilliary" (reverse flow) stalls so they
[flightgear.git] / src / FDM / JSBSim / FGAtmosphere.h
index 5b1e8648c677fcfab9ce3c1a4e76706670b4e313..711057f75742a846829eb3ca3df1c8f30f99a571 100644 (file)
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  
  Header:       FGAtmosphere.h
  Author:       Jon Berndt
 HISTORY
 --------------------------------------------------------------------------------
 11/24/98   JSB   Created
-07/23/99   TP   Added implementation of 1959 Standard Atmosphere
-           Moved calculation of Mach number to FGTranslation
+07/23/99   TP    Added implementation of 1959 Standard Atmosphere
+                 Moved calculation of Mach number to FGPropagate
+                 Updated to '76 model
  
-********************************************************************************
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 SENTRY
-*******************************************************************************/
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #ifndef FGAtmosphere_H
 #define FGAtmosphere_H
 
-/*******************************************************************************
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 INCLUDES
-*******************************************************************************/
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGModel.h"
-#include "FGMatrix33.h"
 #include "FGColumnVector3.h"
-#include "FGColumnVector4.h"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
@@ -57,25 +55,22 @@ DEFINITIONS
 FORWARD DECLARATIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-[1]   Anderson, John D. "Introduction to Flight, Third Edition", McGraw-Hill,
-      1989, ISBN 0-07-001641-0
+namespace JSBSim {
 
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DOCUMENTATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 /** Models the standard atmosphere.
     @author Tony Peden, Jon Berndt
     @version $Id$
+    @see Anderson, John D. "Introduction to Flight, Third Edition", McGraw-Hill,
+         1989, ISBN 0-07-001641-0
 */
 
-/******************************************************************************
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DECLARATION
-*******************************************************************************/
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 class FGAtmosphere : public FGModel {
 public:
@@ -91,37 +86,39 @@ public:
   bool InitModel(void);
 
   /// Returns the temperature in degrees Rankine.
-  inline double 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 double GetDensity(void)    {return density;}
+  inline double GetDensity(void)  const {return *density;}
   /// Returns the pressure in psf.
-  inline double GetPressure(void)   {return pressure;}
+  inline double GetPressure(void)  const {return *pressure;}
+  /// Returns the pressure at an arbitrary altitude in psf
+  double GetPressure(double alt);
   /// Returns the speed of sound in ft/sec.
-  inline double GetSoundSpeed(void) {return soundspeed;}
+  inline double GetSoundSpeed(void) const {return soundspeed;}
 
   /// Returns the sea level temperature in degrees Rankine.
-  inline double GetTemperatureSL(void) { return SLtemperature; }
+  inline double GetTemperatureSL(void) const { return SLtemperature; }
   /// Returns the sea level density in slugs/ft^3
-  inline double GetDensitySL(void)     { return SLdensity; }
+  inline double GetDensitySL(void)  const { return SLdensity; }
   /// Returns the sea level pressure in psf.
-  inline double GetPressureSL(void)    { return SLpressure; }
+  inline double GetPressureSL(void) const { return SLpressure; }
   /// Returns the sea level speed of sound in ft/sec.
-  inline double GetSoundSpeedSL(void)  { return SLsoundspeed; }
+  inline double GetSoundSpeedSL(void) const { return SLsoundspeed; }
 
   /// Returns the ratio of at-altitude temperature over the sea level value.
-  inline double 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 double 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 double 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 double 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; }
 
@@ -132,6 +129,19 @@ public:
   /// Provides the external atmosphere model with an interface to set the pressure.
   inline void SetExPressure(double p)     { exPressure=p; }
 
+  /// Sets the temperature deviation at sea-level in degrees Fahrenheit
+  inline void SetSLTempDev(double d)  { T_dev_sl = d; }
+  /// Gets the temperature deviation at sea-level in degrees Fahrenheit
+  inline double GetSLTempDev(void) const { return T_dev_sl; }
+  /// Sets the current delta-T in degrees Fahrenheit
+  inline void SetDeltaT(double d)  { delta_T = d; } 
+  /// Gets the current delta-T in degrees Fahrenheit
+  inline double GetDeltaT(void) const  { return delta_T; } 
+  /// Gets the at-altitude temperature deviation in degrees Fahrenheit
+  inline double GetTempDev(void) const { return T_dev; }
+  /// Gets the density altitude in feet
+  inline double GetDensityAltitude(void) const { return density_altitude; }
+
   /// Sets the wind components in NED frame.
   inline void SetWindNED(double wN, double wE, double wD) { vWindNED(1)=wN; vWindNED(2)=wE; vWindNED(3)=wD;}
 
@@ -140,29 +150,38 @@ public:
   
   /** Retrieves the wind direction. The direction is defined as north=0 and
       increases counterclockwise. The wind heading is returned in radians.*/
-  inline double GetWindPsi(void) { return psiw; }
+  inline double GetWindPsi(void) const { return psiw; }
   
   inline void SetTurbGain(double tt) {TurbGain = tt;}
+  inline void SetTurbRate(double tt) {TurbRate = tt;}
   
-  inline double GetTurbPQR(int idx) {return vTurbPQR(idx);}
+  inline double GetTurbPQR(int idx) const {return vTurbPQR(idx);}
   inline FGColumnVector3& GetTurbPQR(void) {return vTurbPQR;}
   
-private:
+  void bind(void);
+  void unbind(void);
+
+  
+protected:
   double rho;
 
-  enum tType {ttBerndt, ttNone} turbType;
+  enum tType {ttStandard, 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 T_dev_sl, T_dev, delta_T, density_altitude;
   
   double MagnitudedAccelDt, MagnitudeAccel, Magnitude;
   double TurbGain;
+  double TurbRate;
   FGColumnVector3 vDirectiondAccelDt;
   FGColumnVector3 vDirectionAccel;
   FGColumnVector3 vDirection;
@@ -176,9 +195,11 @@ private:
 
   void Calculate(double altitude);
   void Turbulence(void);
-  void Debug(void);
+  void Debug(int from);
 };
 
-/******************************************************************************/
+} // namespace JSBSim
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 #endif