]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/models/FGInertial.h
Andreas Gaeb: fix #222 (JSBSIm reset problems)
[flightgear.git] / src / FDM / JSBSim / models / FGInertial.h
index 72c7864c17dfb45b96b29552b0d449b6d2b349d7..f4db378a2dc24da6060f7a18a416450a2ba3032e 100644 (file)
@@ -4,7 +4,7 @@
  Author:       Jon S. Berndt
  Date started: 09/13/00
 
- ------------- 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
@@ -38,25 +38,16 @@ SENTRY
 INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#ifdef FGFS
-#  include <simgear/compiler.h>
-#  ifdef SG_HAVE_STD_INCLUDES
-#    include <vector>
-#  else
-#    include <vector.h>
-#  endif
-#else
-#  include <vector>
-#endif
+#include <vector>
 
 #include "FGModel.h"
-#include <math/FGColumnVector3.h>
+#include "math/FGColumnVector3.h"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_INERTIAL "$Id$"
+#define ID_INERTIAL "$Id: FGInertial.h,v 1.15 2010/01/27 04:01:09 jberndt Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -68,7 +59,8 @@ namespace JSBSim {
 CLASS DOCUMENTATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-/** Models inertial forces (e.g. centripetal and coriolis accelerations).
+/** Models inertial forces (e.g. centripetal and coriolis accelerations). Starting
+    conversion to WGS84.
   */
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -81,19 +73,35 @@ public:
   FGInertial(FGFDMExec*);
   ~FGInertial(void);
 
+  bool InitModel(void);
+
   bool Run(void);
   double SLgravity(void) const {return gAccelReference;}
   double gravity(void) const {return gAccel;}
   double omega(void) const {return RotationRate;}
-  double GetGAccel(double r) const { return GM/(r*r); }
-  double RefRadius(void) const {return RadiusReference;}
+  double GetEarthPositionAngle(void) const { return earthPosAngle; }
+  double GetEarthPositionAngleDeg(void) const { return earthPosAngle*radtodeg;}
+  double GetGAccel(double r) const;
+  FGColumnVector3 GetGravityJ2(FGColumnVector3 position) const;
+  double GetRefRadius(void) const {return RadiusReference;}
+  double GetSemimajor(void) const {return a;}
+  double GetSemiminor(void) const {return b;}
+
+  void SetEarthPositionAngle(double epa) {earthPosAngle = epa;}
 
 private:
   double gAccel;
   double gAccelReference;
   double RadiusReference;
   double RotationRate;
+  double earthPosAngle;
   double GM;
+  double C2_0; // WGS84 value for the C2,0 coefficient
+  double J2;   // WGS84 value for J2
+  double a;    // WGS84 semimajor axis length in feet 
+  double b;    // WGS84 semiminor axis length in feet
+
+  void bind(void);
   void Debug(int from);
 };
 }