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 <simgear/compiler.h>
43 # ifdef SG_HAVE_STD_INCLUDES
48 # include <iterator.h>
56 #include "FGPropulsion.h"
57 #include "FGConfigFile.h"
58 #include "FGMatrix33.h"
59 #include "FGColumnVector3.h"
60 #include "FGColumnVector4.h"
63 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
65 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
67 #define ID_AIRCRAFT "$Id$"
69 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
71 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
75 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
77 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
79 /** Encapsulates an Aircraft and its systems.
80 Owns all the parts (other classes) which make up this aircraft. This includes
81 the Engines, Tanks, Propellers, Nozzles, Aerodynamic and Mass properties,
82 landing gear, etc. These constituent parts may actually run as separate
83 JSBSim models themselves, but the responsibility for initializing them and
84 for retrieving their force and moment contributions falls to FGAircraft.
87 @see Cooke, Zyda, Pratt, and McGhee, "NPSNET: Flight Simulation Dynamic Modeling
88 Using Quaternions", Presence, Vol. 1, No. 4, pp. 404-420 Naval Postgraduate
90 @see D. M. Henderson, "Euler Angles, Quaternions, and Transformation Matrices",
92 @see Richard E. McFarland, "A Standard Kinematic Model for Flight Simulation at
93 NASA-Ames", NASA CR-2497, January 1975
94 @see Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics",
95 Wiley & Sons, 1979 ISBN 0-471-03032-5
96 @see Bernard Etkin, "Dynamics of Flight, Stability and Control", Wiley & Sons,
97 1982 ISBN 0-471-08936-2
100 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
102 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
104 class FGAircraft : public FGModel {
107 @param Executive a pointer to the parent executive object */
108 FGAircraft(FGFDMExec *Executive);
113 /** Runs the Aircraft model; called by the Executive
114 @see JSBSim.cpp documentation
115 @return false if no error */
118 /** Loads the aircraft.
119 The executive calls this method to load the aircraft into JSBSim.
120 @param AC_cfg a pointer to the config file instance
121 @return true if successful */
122 bool Load(FGConfigFile* AC_cfg);
124 /** Gets the aircraft name
125 @return the name of the aircraft as a string type */
126 inline string GetAircraftName(void) { return AircraftName; }
128 /// Gets the wing area
129 double GetWingArea(void) const { return WingArea; }
130 /// Gets the wing span
131 double GetWingSpan(void) const { return WingSpan; }
132 /// Gets the average wing chord
133 double Getcbar(void) const { return cbar; }
134 inline double GetWingIncidence(void) const { return WingIncidence; }
135 inline double GetHTailArea(void) const { return HTailArea; }
136 inline double GetHTailArm(void) const { return HTailArm; }
137 inline double GetVTailArea(void) const { return VTailArea; }
138 inline double GetVTailArm(void) const { return VTailArm; }
139 inline double Getlbarh(void) const { return lbarh; } // HTailArm / cbar
140 inline double Getlbarv(void) const { return lbarv; } // VTailArm / cbar
141 inline double Getvbarh(void) const { return vbarh; } // H. Tail Volume
142 inline double Getvbarv(void) const { return vbarv; } // V. Tail Volume
143 inline FGColumnVector3& GetMoments(void) { return vMoments; }
144 inline double GetMoments(int idx) const { return vMoments(idx); }
145 inline FGColumnVector3& GetForces(void) { return vForces; }
146 inline double GetForces(int idx) const { return vForces(idx); }
147 inline FGColumnVector3& GetBodyAccel(void) { return vBodyAccel; }
148 inline double GetBodyAccel(int idx) { return vBodyAccel(idx); }
149 inline FGColumnVector3& GetNcg (void) { return vNcg; }
150 inline double GetNcg(int idx) { return vNcg(idx); }
151 inline FGColumnVector3& GetXYZrp(void) { return vXYZrp; }
152 inline FGColumnVector3& GetXYZvrp(void) { return vXYZvrp; }
153 inline FGColumnVector3& GetXYZep(void) { return vXYZep; }
154 inline double GetXYZrp(int idx) const { return vXYZrp(idx); }
155 inline double GetXYZvrp(int idx) const { return vXYZvrp(idx); }
156 inline double GetXYZep(int idx) const { return vXYZep(idx); }
157 inline void SetAircraftName(string name) {AircraftName = name;}
161 inline FGColumnVector3& GetNwcg(void) { return vNwcg; }
167 FGColumnVector3 vMoments;
168 FGColumnVector3 vForces;
169 FGColumnVector3 vXYZrp;
170 FGColumnVector3 vXYZvrp;
171 FGColumnVector3 vXYZep;
172 FGColumnVector3 vEuler;
173 FGColumnVector3 vDXYZcg;
174 FGColumnVector3 vBodyAccel;
175 FGColumnVector3 vNcg;
176 FGColumnVector3 vNwcg;
178 double WingArea, WingSpan, cbar, WingIncidence;
179 double HTailArea, VTailArea, HTailArm, VTailArm;
180 double lbarh,lbarv,vbarh,vbarv;
183 void Debug(int from);
186 } // namespace JSBSim
187 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%