]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/models/FGAuxiliary.h
Merge branch 'jmt/units-fix' into maint
[flightgear.git] / src / FDM / JSBSim / models / FGAuxiliary.h
index 0428ff9eb60f51a9d938cafdc770f69b00e44fef..e3baa49117a8d1e64fe9741302d6b56009a1d370 100644 (file)
@@ -4,7 +4,7 @@
  Author:       Jon Berndt
  Date started: 01/26/99
 
- ------------- Copyright (C) 1999  Jon S. Berndt (jsb@hal-pc.org) -------------
+ ------------- Copyright (C) 1999  Jon S. Berndt (jon@jsbsim.org) -------------
 
  This program is free software; you can redistribute it and/or modify it under
  the terms of the GNU Lesser General Public License as published by the Free Software
@@ -40,8 +40,8 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGModel.h"
-#include <math/FGColumnVector3.h>
-#include <math/FGLocation.h>
+#include "math/FGColumnVector3.h"
+#include "math/FGLocation.h"
 #include "FGPropagate.h"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -116,6 +116,8 @@ public:
   /// Destructor
   ~FGAuxiliary();
 
+  bool InitModel(void);
+
   /** Runs the Auxiliary routines; called by the Executive
       @return false if no error */
   bool Run(void);
@@ -123,14 +125,28 @@ public:
 // GET functions
 
   // Atmospheric parameters GET functions
+  /** Returns Calibrated airspeed in feet/second.*/
   double GetVcalibratedFPS(void) const { return vcas; }
+  /** Returns Calibrated airspeed in knots.*/
   double GetVcalibratedKTS(void) const { return vcas*fpstokts; }
+  /** Returns equivalent airspeed in feet/second. */
   double GetVequivalentFPS(void) const { return veas; }
+  /** Returns equivalent airspeed in knots. */
   double GetVequivalentKTS(void) const { return veas*fpstokts; }
 
-  // total pressure above is freestream total pressure for subsonic only
-  // for supersonic it is the 1D total pressure behind a normal shock
+  /** Returns the total pressure.
+      Total pressure is freestream total pressure for
+      subsonic only. For supersonic it is the 1D total pressure
+      behind a normal shock. */
   double GetTotalPressure(void) const { return pt; }
+
+  /** Returns the total temperature.
+    The total temperature ("tat", isentropic flow) is calculated:
+    @code
+    tat = sat*(1 + 0.2*Mach*Mach)
+    @endcode
+    (where "sat" is standard temperature) */
+
   double GetTotalTemperature(void) const { return tat; }
   double GetTAT_C(void) const { return tatc; }
 
@@ -155,33 +171,47 @@ public:
   double GetMagBeta (void) const { return fabs(beta); }
 
   double Getalpha   (int unit) const { if (unit == inDegrees) return alpha*radtodeg;
-                                       else cerr << "Bad units" << endl; return 0.0;}
+                                       else return BadUnits(); }
   double Getbeta    (int unit) const { if (unit == inDegrees) return beta*radtodeg;
-                                       else cerr << "Bad units" << endl; return 0.0;}
+                                       else return BadUnits(); }
   double Getadot    (int unit) const { if (unit == inDegrees) return adot*radtodeg;
-                                       else cerr << "Bad units" << endl; return 0.0;}
+                                       else return BadUnits(); }
   double Getbdot    (int unit) const { if (unit == inDegrees) return bdot*radtodeg;
-                                       else cerr << "Bad units" << endl; return 0.0;}
+                                       else return BadUnits(); }
   double GetMagBeta (int unit) const { if (unit == inDegrees) return fabs(beta)*radtodeg;
-                                       else cerr << "Bad units" << endl; return 0.0;}
+                                       else return BadUnits(); }
+
+  double Getqbar          (void) const { return qbar;       }
+  double GetqbarUW        (void) const { return qbarUW;     }
+  double GetqbarUV        (void) const { return qbarUV;     }
+  double GetReynoldsNumber(void) const { return Re;         }
+
+  /** Gets the magnitude of total vehicle velocity including wind effects in feet per second. */
+  double GetVt            (void) const { return Vt;         }
+
+  /** Gets the ground speed in feet per second.
+      The magnitude is the square root of the sum of the squares (RSS) of the 
+      vehicle north and east velocity components.
+      @return The magnitude of the vehicle velocity in the horizontal plane. */
+  double GetVground       (void) const { return Vground;    }
+
+  /** Gets the Mach number. */
+  double GetMach          (void) const { return Mach;       }
 
-  double Getqbar    (void) const { return qbar;       }
-  double GetqbarUW  (void) const { return qbarUW;     }
-  double GetqbarUV  (void) const { return qbarUV;     }
-  double GetVt      (void) const { return Vt;         }
-  double GetVground (void) const { return Vground;    }
-  double GetMach    (void) const { return Mach;       }
-  double GetMachU   (void) const { return MachU;      }
+  /** The mach number calculated using the vehicle X axis velocity. */
+  double GetMachU         (void) const { return MachU;      }
+
+  /** The vertical acceleration in g's of the aircraft center of gravity. */
+  double GetNz            (void) const { return Nz;         }
 
   double GetHOverBCG(void) const { return hoverbcg; }
   double GetHOverBMAC(void) const { return hoverbmac; }
 
   double GetGamma(void)              const { return gamma;         }
   double GetGroundTrack(void)        const { return psigt;         }
-  double GetEarthPositionAngle(void) const { return earthPosAngle; }
 
-  double GetHeadWind(void);
-  double GetCrossWind(void);
+  double GetHeadWind(void) const;
+  double GetCrossWind(void) const;
 
 // SET functions
 
@@ -200,7 +230,7 @@ public:
   void SetAB    (double t1, double t2) { alpha=t1; beta=t2; }
   void SetGamma (double tt)            { gamma = tt;        }
 
-// Time routines, SET and GET functions
+// Time routines, SET and GET functions, used by FGMSIS atmosphere
 
   void SetDayOfYear    (int doy)    { day_of_year = doy;    }
   void SetSecondsInDay (double sid) { seconds_in_day = sid; }
@@ -208,8 +238,11 @@ public:
   int    GetDayOfYear    (void) const { return day_of_year;    }
   double GetSecondsInDay (void) const { return seconds_in_day; }
 
-  void bind(void);
-  void unbind(void);
+  double GetLongitudeRelativePosition (void) const { return lon_relative_position; }
+  double GetLatitudeRelativePosition  (void) const { return lat_relative_position; }
+  double GetDistanceRelativePosition  (void) const { return relative_position; }
+
+  void SetAeroPQR(FGColumnVector3 tt) { vAeroPQR = tt; }
 
 private:
   double vcas, veas;
@@ -223,19 +256,31 @@ private:
   FGColumnVector3 vEuler;
   FGColumnVector3 vEulerRates;
   FGColumnVector3 vMachUVW;
+  FGColumnVector3 vAircraftAccel;
   FGLocation vLocationVRP;
 
   double Vt, Vground, Mach, MachU;
   double qbar, qbarUW, qbarUV;
+  double Re; // Reynolds Number = V*c/mu
   double alpha, beta;
   double adot,bdot;
   double psigt, gamma;
+  double Nz;
   double seconds_in_day;  // seconds since current GMT day began
   int    day_of_year;     // GMT day, 1 .. 366
 
-  double earthPosAngle;
   double hoverbcg, hoverbmac;
 
+  // helper data, calculation of distance from initial position
+
+  double lon_relative_position;
+  double lat_relative_position;
+  double relative_position;
+
+  void CalculateRelativePosition(void);
+
+  void bind(void);
+  double BadUnits(void) const;
   void Debug(int from);
 };