]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/FGPosition.h
Added FGTurbine.[ch]*
[flightgear.git] / src / FDM / JSBSim / FGPosition.h
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3  Header:       FGPosition.h
4  Author:       Jon S. Berndt
5  Date started: 1/5/99
6  
7  ------------- Copyright (C) 1999  Jon S. Berndt (jsb@hal-pc.org) -------------
8  
9  This program is free software; you can redistribute it and/or modify it under
10  the terms of the GNU 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 General Public License for more
17  details.
18  
19  You should have received a copy of the GNU 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 General Public License can also be found on
24  the world wide web at http://www.gnu.org.
25  
26 HISTORY
27 --------------------------------------------------------------------------------
28 01/05/99   JSB   Created
29  
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
31 SENTRY
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
33
34 #ifndef FGPOSITION_H
35 #define FGPOSITION_H
36
37 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38 INCLUDES
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
40
41 #include "FGModel.h"
42 #include "FGMatrix33.h"
43 #include "FGColumnVector3.h"
44 #include "FGColumnVector4.h"
45
46 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
47 DEFINITIONS
48 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
49
50 #define ID_POSITION "$Id$"
51
52 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
53 FORWARD DECLARATIONS
54 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
55
56 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57 COMMENTS, REFERENCES,  and NOTES
58 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
59
60 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
61 DOCUMENTATION
62 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
63
64 /** Models the lateral and longitudinal translational EOM.
65     @author Jon S. Berndt
66     @version $Id$
67     @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGPosition.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
68          Header File </a>
69     @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGPosition.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
70          Source File </a>
71   */
72
73 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
74 CLASS DECLARATION
75 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
76
77 class FGPosition : public FGModel {
78 public:
79   /** Constructor
80       @param Executive a pointer to the parent executive object */
81   FGPosition(FGFDMExec*);
82
83   /// Destructor
84   ~FGPosition();
85
86   bool InitModel(void);
87
88   /** Runs the Position model; called by the Executive
89       @see JSBSim.cpp documentation
90       @return false if no error */
91   bool Run(void);
92   
93   inline FGColumnVector3& GetVel(void) { return vVel; }
94   inline FGColumnVector3& GetVelDot(void) { return vVelDot; }
95   inline double GetVn(void)  const { return vVel(eX); }
96   inline double GetVe(void)  const { return vVel(eY); }
97   inline double GetVd(void)  const { return vVel(eZ); }
98   inline double GetVground(void) const { return Vground; }
99   inline double GetGroundTrack(void) const { return psigt; }
100   inline double Geth(void)  const { return h; }
101   inline double Gethdot(void) const { return RadiusDot; }
102   inline double GetLatitude(void) const { return Latitude; }
103   inline double GetLatitudeDot(void) const { return LatitudeDot; }
104   inline double GetLongitude(void) const { return Longitude; }
105   inline double GetLongitudeDot(void) const { return LongitudeDot; }
106   inline double GetRunwayRadius(void) const { return RunwayRadius; }
107   inline double GetDistanceAGL(void)  const { return DistanceAGL; }
108   inline double GetRadius(void) const { return Radius; }
109   inline FGColumnVector3& GetRunwayNormal(void) { return vRunwayNormal; }
110   
111   inline double GetGamma(void) const { return gamma; }
112   inline void SetGamma(double tt) { gamma = tt; }
113   inline double GetHOverBCG(void) const { return hoverbcg; }
114   inline double GetHOverBMAC(void) const { return hoverbmac; }
115   void SetvVel(const FGColumnVector3& v) { vVel = v; }
116   void SetLatitude(double tt) { Latitude = tt; }
117   void SetLongitude(double tt) { Longitude = tt; }
118   void Seth(double tt);
119   void SetRunwayRadius(double tt) { RunwayRadius = tt; }
120   void SetSeaLevelRadius(double tt) { SeaLevelRadius = tt;}
121   void SetDistanceAGL(double tt);
122   inline void SetRunwayNormal(double fgx, double fgy, double fgz ) {
123       vRunwayNormal << fgx << fgy << fgz;
124   }
125   
126   void bind(void);
127   void unbind(void);
128   
129 private:  
130   FGColumnVector3 vVel;
131   FGColumnVector3 vVelDot;
132   FGColumnVector3 vRunwayNormal;
133   
134   double Radius, h;
135   double LatitudeDot, LongitudeDot, RadiusDot;
136   double LatitudeDot_prev[3], LongitudeDot_prev[3], RadiusDot_prev[3];
137   double Longitude, Latitude;
138   double dt;
139   double RunwayRadius;
140   double DistanceAGL;
141   double SeaLevelRadius;
142   double gamma;
143   double Vt, Vground;
144   double hoverbcg,hoverbmac,b;
145
146   double psigt;
147
148   void GetState(void);
149   void Debug(int from);
150 };
151
152 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
153 #endif
154