]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/FGJSBBase.h
Fix for bug 1304 - crash loading XML route
[flightgear.git] / src / FDM / JSBSim / FGJSBBase.h
index 50735c3f7b9028ba56421008ee242fd819db9a66..3dd78df9d7bf228626fbd08154fca36f490e7975 100644 (file)
@@ -51,12 +51,13 @@ using std::max;
 #ifndef M_PI
 #  define M_PI 3.14159265358979323846
 #endif
+#define IDENT(a,b)      static const char* const (a)[] = {b,(a)[0]}
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_JSBBASE "$Id: FGJSBBase.h,v 1.33 2011/06/27 03:14:25 jberndt Exp $"
+#define ID_JSBBASE "$Id: FGJSBBase.h,v 1.39 2014/01/13 10:45:59 ehofman Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -72,7 +73,7 @@ CLASS DOCUMENTATION
 *   This class provides universal constants, utility functions, messaging
 *   functions, and enumerated constants to JSBSim.
     @author Jon S. Berndt
-    @version $Id: FGJSBBase.h,v 1.33 2011/06/27 03:14:25 jberndt Exp $
+    @version $Id: FGJSBBase.h,v 1.39 2014/01/13 10:45:59 ehofman Exp $
 */
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -256,6 +257,36 @@ public:
     return kelvin - 273.15;
   }
 
+  /** Converts from feet to meters
+  *   @param measure The length in feet.
+  *   @return The length in meters. */
+  static double FeetToMeters (double measure) {
+    return measure*0.3048;
+  }
+
+  /** Calculate the calibrated airspeed from the Mach number. It uses the
+  *   Rayleigh formula for supersonic speeds (See "Introduction to Aerodynamics
+  *   of a Compressible Fluid - H.W. Liepmann, A.E. Puckett - Wiley & sons
+  *   (1947)" ยง5.4 pp 75-80)
+  *   @param mach  The Mach number
+  *   @param p     Pressure in psf
+  *   @param psl   Pressure at sea level in psf
+  *   @param rhosl Density at sea level in slugs/ft^3
+  *   @return The calibrated airspeed (CAS) in ft/s
+  * */
+  static double VcalibratedFromMach(double mach, double p, double psl, double rhosl);
+
+  /** Calculate the Mach number from the calibrated airspeed. For subsonic
+  * speeds, the reversed formula has a closed form. For supersonic speeds, the
+  * Rayleigh formula is reversed by the Newton-Raphson algorithm.
+  *   @param vcas  The calibrated airspeed (CAS) in ft/s
+  *   @param p     Pressure in psf
+  *   @param psl   Pressure at sea level in psf
+  *   @param rhosl Density at sea level in slugs/ft^3
+  *   @return The Mach number
+  * */
+  static double MachFromVcalibrated(double vcas, double p, double psl, double rhosl);
+
   /** Finite precision comparison.
       @param a first value to compare
       @param b second value to compare