]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/models/FGAircraft.h
Sync. w. JSBSim CVS.
[flightgear.git] / src / FDM / JSBSim / models / 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 <input_output/FGXMLElement.h>
57 #include <math/FGColumnVector3.h>
58
59 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
60 DEFINITIONS
61 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
62
63 #define ID_AIRCRAFT "$Id$"
64
65 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66 FORWARD DECLARATIONS
67 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
68
69 namespace JSBSim {
70
71 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72 CLASS DOCUMENTATION
73 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
74
75 /** Encapsulates an Aircraft and its systems.
76     Owns all the parts (other classes) which make up this aircraft. This includes
77     the Engines, Tanks, Propellers, Nozzles, Aerodynamic and Mass properties,
78     landing gear, etc. These constituent parts may actually run as separate
79     JSBSim models themselves, but the responsibility for initializing them and
80     for retrieving their force and moment contributions falls to FGAircraft.
81     @author Jon S. Berndt
82     @version $Id$
83     @see Cooke, Zyda, Pratt, and McGhee, "NPSNET: Flight Simulation Dynamic Modeling
84            Using Quaternions", Presence, Vol. 1, No. 4, pp. 404-420  Naval Postgraduate
85            School, January 1994
86     @see D. M. Henderson, "Euler Angles, Quaternions, and Transformation Matrices",
87      JSC 12960, July 1977
88     @see Richard E. McFarland, "A Standard Kinematic Model for Flight Simulation at
89      NASA-Ames", NASA CR-2497, January 1975
90     @see Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics",
91      Wiley & Sons, 1979 ISBN 0-471-03032-5
92     @see Bernard Etkin, "Dynamics of Flight, Stability and Control", Wiley & Sons,
93      1982 ISBN 0-471-08936-2
94 */
95
96 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
97 CLASS DECLARATION
98 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
99
100 class FGAircraft : public FGModel {
101 public:
102   /** Constructor
103       @param Executive a pointer to the parent executive object */
104   FGAircraft(FGFDMExec *Executive);
105   
106   /// Destructor
107   ~FGAircraft();
108
109   /** Runs the Aircraft model; called by the Executive
110       @see JSBSim.cpp documentation
111       @return false if no error */
112   bool Run(void);
113   
114   /** Loads the aircraft.
115       The executive calls this method to load the aircraft into JSBSim.
116       @param el a pointer to the element tree
117       @return true if successful */
118   bool Load(Element* el);
119   
120   /** Gets the aircraft name
121       @return the name of the aircraft as a string type */
122   inline string GetAircraftName(void) { return AircraftName; }
123   
124   /// Gets the wing area
125   double GetWingArea(void) const { return WingArea; }
126   /// Gets the wing span
127   double GetWingSpan(void) const { return WingSpan; }
128   /// Gets the average wing chord
129   double Getcbar(void) const { return cbar; }
130   inline double GetWingIncidence(void) const { return WingIncidence; }
131   inline double GetHTailArea(void) const { return HTailArea; }
132   inline double GetHTailArm(void)  const { return HTailArm; }
133   inline double GetVTailArea(void) const { return VTailArea; }
134   inline double GetVTailArm(void)  const { return VTailArm; }
135   inline double Getlbarh(void) const { return lbarh; } // HTailArm / cbar
136   inline double Getlbarv(void) const { return lbarv; } // VTailArm / cbar
137   inline double Getvbarh(void) const { return vbarh; } // H. Tail Volume
138   inline double Getvbarv(void) const { return vbarv; } // V. Tail Volume
139   inline FGColumnVector3& GetMoments(void) { return vMoments; }
140   inline double GetMoments(int idx) const { return vMoments(idx); }
141   inline FGColumnVector3& GetForces(void) { return vForces; }
142   inline double GetForces(int idx) const { return vForces(idx); }
143   inline FGColumnVector3& GetBodyAccel(void) { return vBodyAccel; }
144   inline double GetBodyAccel(int idx) { return vBodyAccel(idx); }
145   inline FGColumnVector3& GetNcg   (void)  { return vNcg; }
146   inline double GetNcg(int idx)  { return vNcg(idx); }
147   inline FGColumnVector3& GetXYZrp(void) { return vXYZrp; }
148   inline FGColumnVector3& GetXYZvrp(void) { return vXYZvrp; }
149   inline FGColumnVector3& GetXYZep(void) { return vXYZep; }
150   inline double GetXYZrp(int idx) const { return vXYZrp(idx); }
151   inline double GetXYZvrp(int idx) const { return vXYZvrp(idx); }
152   inline double GetXYZep(int idx) const { return vXYZep(idx); }
153   inline void SetAircraftName(string name) {AircraftName = name;}
154
155   double GetNlf(void);
156
157   inline FGColumnVector3& GetNwcg(void) { return vNwcg; }
158
159   void bind(void);
160   void unbind(void);
161
162 private:
163   FGColumnVector3 vMoments;
164   FGColumnVector3 vForces;
165   FGColumnVector3 vXYZrp;
166   FGColumnVector3 vXYZvrp;
167   FGColumnVector3 vXYZep;
168   FGColumnVector3 vDXYZcg;
169   FGColumnVector3 vBodyAccel;
170   FGColumnVector3 vNcg;
171   FGColumnVector3 vNwcg;
172
173   double WingArea, WingSpan, cbar, WingIncidence;
174   double HTailArea, VTailArea, HTailArm, VTailArm;
175   double lbarh,lbarv,vbarh,vbarv;
176   string AircraftName;
177
178   void Debug(int from);
179 };
180
181 } // namespace JSBSim
182 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
183 #endif
184