1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7 ------------- Copyright (C) 1999 Jon S. Berndt (jsb@hal-pc.org) -------------
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
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
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.
23 Further information about the GNU General Public License can also be found on
24 the world wide web at http://www.gnu.org.
27 --------------------------------------------------------------------------------
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
37 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
42 #include "FGMatrix33.h"
43 #include "FGColumnVector3.h"
44 #include "FGColumnVector4.h"
46 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
48 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
50 #define ID_POSITION "$Id$"
52 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
54 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
56 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57 COMMENTS, REFERENCES, and NOTES
58 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
60 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
62 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
64 /** Models the lateral and longitudinal translational EOM.
67 @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGPosition.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
69 @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGPosition.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
73 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
75 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
79 class FGPosition : public FGModel {
82 @param Executive a pointer to the parent executive object */
83 FGPosition(FGFDMExec*);
90 /** Runs the Position model; called by the Executive
91 @see JSBSim.cpp documentation
92 @return false if no error */
95 inline FGColumnVector3& GetVel(void) { return vVel; }
96 inline FGColumnVector3& GetVelDot(void) { return vVelDot; }
97 inline double GetVn(void) const { return vVel(eX); }
98 inline double GetVe(void) const { return vVel(eY); }
99 inline double GetVd(void) const { return vVel(eZ); }
100 inline double GetVground(void) const { return Vground; }
101 inline double GetGroundTrack(void) const { return psigt; }
102 inline double Geth(void) const { return h; }
103 inline double Gethdot(void) const { return RadiusDot; }
104 inline double GetLatitude(void) const { return Latitude; }
105 inline double GetLatitudeDot(void) const { return LatitudeDot; }
106 inline double GetLongitude(void) const { return Longitude; }
107 inline double GetLongitudeDot(void) const { return LongitudeDot; }
108 inline double GetRunwayRadius(void) const { return RunwayRadius; }
109 inline double GetDistanceAGL(void) const { return DistanceAGL; }
110 inline double GetRadius(void) const { return Radius; }
111 inline FGColumnVector3& GetRunwayNormal(void) { return vRunwayNormal; }
113 inline double GetGamma(void) const { return gamma; }
114 inline void SetGamma(double tt) { gamma = tt; }
115 inline double GetHOverBCG(void) const { return hoverbcg; }
116 inline double GetHOverBMAC(void) const { return hoverbmac; }
117 void SetvVel(const FGColumnVector3& v) { vVel = v; }
118 void SetLatitude(double tt) { Latitude = tt; }
119 void SetLongitude(double tt) { Longitude = tt; }
120 void Seth(double tt);
121 void SetRunwayRadius(double tt) { RunwayRadius = tt; }
122 void SetSeaLevelRadius(double tt) { SeaLevelRadius = tt;}
123 void SetDistanceAGL(double tt);
124 inline void SetRunwayNormal(double fgx, double fgy, double fgz ) {
125 vRunwayNormal << fgx << fgy << fgz;
132 FGColumnVector3 vVel;
133 FGColumnVector3 vVelDot;
134 FGColumnVector3 vRunwayNormal;
137 double LatitudeDot, LongitudeDot, RadiusDot;
138 double LatitudeDot_prev[3], LongitudeDot_prev[3], RadiusDot_prev[3];
139 double Longitude, Latitude;
143 double SeaLevelRadius;
146 double hoverbcg,hoverbmac,b;
151 void Debug(int from);
154 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%