]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/FGAircraft.h
Updates from JSBSim, including new turbine engine model from David Culp
[flightgear.git] / src / FDM / JSBSim / FGAircraft.h
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2  
3  Header:       FGAircraft.h
4  Author:       Jon S. Berndt
5  Date started: 12/12/98
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 12/12/98   JSB   Created
29  
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
31 SENTRY
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
33
34 #ifndef FGAIRCRAFT_H
35 #define FGAIRCRAFT_H
36
37 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38 INCLUDES
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
40
41 #ifdef FGFS
42 #  include <simgear/compiler.h>
43 #  ifdef SG_HAVE_STD_INCLUDES
44 #    include <vector>
45 #    include <iterator>
46 #  else
47 #    include <vector.h>
48 #    include <iterator.h>
49 #  endif
50 #else
51 #  include <vector>
52 #  include <iterator>
53 #endif
54
55 #include "FGModel.h"
56 #include "FGPropulsion.h"
57 #include "FGConfigFile.h"
58 #include "FGMatrix33.h"
59 #include "FGColumnVector3.h"
60 #include "FGColumnVector4.h"
61 #include "FGLGear.h"
62
63 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
64 DEFINITIONS
65 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
66
67 #define ID_AIRCRAFT "$Id$"
68
69 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
70 FORWARD DECLARATIONS
71 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
72
73 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
74 COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
75 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
76
77 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
78 CLASS DOCUMENTATION
79 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
80
81 /** Encapsulates an Aircraft and its systems.
82     Owns all the parts (other classes) which make up this aircraft. This includes
83     the Engines, Tanks, Propellers, Nozzles, Aerodynamic and Mass properties,
84     landing gear, etc. These constituent parts may actually run as separate
85     JSBSim models themselves, but the responsibility for initializing them and
86     for retrieving their force and moment contributions falls to FGAircraft.<br>
87     
88     @author Jon S. Berndt
89     @version $Id$
90     @see
91      <ol><li>Cooke, Zyda, Pratt, and McGhee, "NPSNET: Flight Simulation Dynamic Modeling
92            Using Quaternions", Presence, Vol. 1, No. 4, pp. 404-420  Naval Postgraduate
93            School, January 1994</li>
94      <li>D. M. Henderson, "Euler Angles, Quaternions, and Transformation Matrices",
95      JSC 12960, July 1977</li>
96      <li>Richard E. McFarland, "A Standard Kinematic Model for Flight Simulation at
97      NASA-Ames", NASA CR-2497, January 1975</li>
98      <li>Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics",
99      Wiley & Sons, 1979 ISBN 0-471-03032-5</li>
100      <li>Bernard Etkin, "Dynamics of Flight, Stability and Control", Wiley & Sons,
101      1982 ISBN 0-471-08936-2</li></ol>
102     @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGAircraft.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
103          Header File </a>
104     @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGAircraft.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
105          Source File </a>
106 */
107
108 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
109 CLASS DECLARATION
110 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
111
112 namespace JSBSim {
113
114 class FGAircraft : public FGModel {
115 public:
116   /** Constructor
117       @param Executive a pointer to the parent executive object */
118   FGAircraft(FGFDMExec *Executive);
119   
120   /// Destructor
121   ~FGAircraft();
122
123   /** Runs the Aircraft model; called by the Executive
124       @see JSBSim.cpp documentation
125       @return false if no error */
126   bool Run(void);
127   
128   /** Loads the aircraft.
129       The executive calls this method to load the aircraft into JSBSim.
130       @param AC_cfg a pointer to the config file instance
131       @return true if successful */
132   bool Load(FGConfigFile* AC_cfg);
133   
134   /** Gets the aircraft name
135       @return the name of the aircraft as a string type */
136   inline string GetAircraftName(void) { return AircraftName; }
137   
138   /// Gets the wing area
139   double GetWingArea(void) const { return WingArea; }
140   /// Gets the wing span
141   double GetWingSpan(void) const { return WingSpan; }
142   /// Gets the average wing chord
143   double Getcbar(void) const { return cbar; }
144   inline double GetWingIncidence(void) const { return WingIncidence; }
145   inline double GetHTailArea(void) const { return HTailArea; }
146   inline double GetHTailArm(void)  const { return HTailArm; }
147   inline double GetVTailArea(void) const { return VTailArea; }
148   inline double GetVTailArm(void)  const { return VTailArm; }
149   inline double Getlbarh(void) const { return lbarh; } // HTailArm / cbar
150   inline double Getlbarv(void) const { return lbarv; } // VTailArm / cbar
151   inline double Getvbarh(void) const { return vbarh; } // H. Tail Volume
152   inline double Getvbarv(void) const { return vbarv; } // V. Tail Volume
153   inline FGColumnVector3& GetMoments(void) { return vMoments; }
154   inline double GetMoments(int idx) const { return vMoments(idx); }
155   inline FGColumnVector3& GetForces(void) { return vForces; }
156   inline double GetForces(int idx) const { return vForces(idx); }
157   inline FGColumnVector3& GetBodyAccel(void) { return vBodyAccel; }
158   inline FGColumnVector3& GetNcg   (void)  { return vNcg; }
159   inline FGColumnVector3& GetXYZrp(void) { return vXYZrp; }
160   inline FGColumnVector3& GetXYZep(void) { return vXYZep; }
161   inline double GetXYZrp(int idx) const { return vXYZrp(idx); }
162   inline double GetXYZep(int idx) const { return vXYZep(idx); }
163   inline void SetAircraftName(string name) {AircraftName = name;}
164
165   float GetNlf(void);
166
167   inline FGColumnVector3& GetNwcg(void) { return vNwcg; }
168
169   void bind(void);
170   void unbind(void);
171
172 private:
173   FGColumnVector3 vMoments;
174   FGColumnVector3 vForces;
175   FGColumnVector3 vXYZrp;
176   FGColumnVector3 vXYZep;
177   FGColumnVector3 vEuler;
178   FGColumnVector3 vDXYZcg;
179   FGColumnVector3 vBodyAccel;
180   FGColumnVector3 vNcg;
181   FGColumnVector3 vNwcg;
182
183   double WingArea, WingSpan, cbar, WingIncidence;
184   double HTailArea, VTailArea, HTailArm, VTailArm;
185   double lbarh,lbarv,vbarh,vbarv;
186   string AircraftName;
187
188   void Debug(int from);
189 };
190
191 } // namespace JSBSim
192 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
193 #endif
194