JSBSim Flight Dynamics Model  1.0 (02 March 2017)
An Open Source Flight Dynamics and Control Software Library in C++
FGInertial.h
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 
3  Header: FGInertial.h
4  Author: Jon S. Berndt
5  Date started: 09/13/00
6 
7  ------------- Copyright (C) 1999 Jon S. Berndt (jon@jsbsim.org) -------------
8 
9  This program is free software; you can redistribute it and/or modify it under
10  the terms of the GNU Lesser General Public License as published by the Free Software
11  Foundation; either version 2 of the License, or (at your option) any later
12  version.
13 
14  This program is distributed in the hope that it will be useful, but WITHOUT
15  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
17  details.
18 
19  You should have received a copy of the GNU Lesser General Public License along with
20  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21  Place - Suite 330, Boston, MA 02111-1307, USA.
22 
23  Further information about the GNU Lesser General Public License can also be found on
24  the world wide web at http://www.gnu.org.
25 
26 HISTORY
27 --------------------------------------------------------------------------------
28 09/13/00 JSB Created
29 
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
31 SENTRY
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
33 
34 #ifndef FGINERTIAL_H
35 #define FGINERTIAL_H
36 
37 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38 INCLUDES
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
40 
41 #include <vector>
42 
43 #include "FGModel.h"
44 #include "math/FGColumnVector3.h"
45 
46 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
47 DEFINITIONS
48 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
49 
50 #define ID_INERTIAL "$Id: FGInertial.h,v 1.22 2013/11/30 21:22:08 jberndt Exp $"
51 
52 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
53 FORWARD DECLARATIONS
54 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
55 
56 namespace JSBSim {
57 
58 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
59 CLASS DOCUMENTATION
60 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
61 
66 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
67 CLASS DECLARATION
68 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
69 
70 class FGInertial : public FGModel {
71 
72 public:
74  ~FGInertial(void);
75 
76  bool InitModel(void);
77 
85  bool Run(bool Holding);
86  double SLgravity(void) const {return gAccelReference;}
87  double gravity(void) const {return gAccel;}
88  double omega(void) const {return RotationRate;}
89  const FGColumnVector3& GetOmegaPlanet() const {return vOmegaPlanet;}
90  void SetOmegaPlanet(double rate) {
91  RotationRate = rate;
92  vOmegaPlanet = FGColumnVector3( 0.0, 0.0, RotationRate );
93  }
94  double GetGAccel(double r) const;
95  FGColumnVector3 GetGravityJ2(const FGColumnVector3& position) const;
96  double GetRefRadius(void) const {return RadiusReference;}
97  double GetSemimajor(void) const {return a;}
98  double GetSemiminor(void) const {return b;}
99 
100  struct Inputs {
101  double Radius;
102  double Latitude;
103  } in;
104 
105 private:
106  FGColumnVector3 vOmegaPlanet;
107  double gAccel;
108  double gAccelReference;
109  double RadiusReference;
110  double RotationRate;
111  double GM;
112  double C2_0; // WGS84 value for the C2,0 coefficient
113  double J2; // WGS84 value for J2
114  double a; // WGS84 semimajor axis length in feet
115  double b; // WGS84 semiminor axis length in feet
116 
117  void bind(void);
118  void Debug(int from);
119 };
120 }
121 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
122 #endif
Models inertial forces (e.g.
Definition: FGInertial.h:70
bool Run(bool Holding)
Runs the Inertial model; called by the Executive Can pass in a value indicating if the executive is d...
Definition: FGInertial.cpp:105
Base class for all scheduled JSBSim models.
Definition: FGModel.h:74
This class implements a 3 element column vector.
Encapsulates the JSBSim simulation executive.
Definition: FGFDMExec.h:189