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 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
73 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
74 COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
75 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
77 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
79 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
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>
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">
104 @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGAircraft.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
108 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
110 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
112 class FGAircraft : public FGModel {
115 @param Executive a pointer to the parent executive object */
116 FGAircraft(FGFDMExec *Executive);
121 /** Runs the Aircraft model; called by the Executive
122 @see JSBSim.cpp documentation
123 @return false if no error */
126 /** Loads the aircraft.
127 The executive calls this method to load the aircraft into JSBSim.
128 @param AC_cfg a pointer to the config file instance
129 @return true if successful */
130 bool Load(FGConfigFile* AC_cfg);
132 /** Gets the aircraft name
133 @return the name of the aircraft as a string type */
134 inline string GetAircraftName(void) { return AircraftName; }
136 /// Gets the wing area
137 double GetWingArea(void) const { return WingArea; }
138 /// Gets the wing span
139 double GetWingSpan(void) const { return WingSpan; }
140 /// Gets the average wing chord
141 double Getcbar(void) const { return cbar; }
142 inline double GetWingIncidence(void) const { return WingIncidence; }
143 inline double GetHTailArea(void) const { return HTailArea; }
144 inline double GetHTailArm(void) const { return HTailArm; }
145 inline double GetVTailArea(void) const { return VTailArea; }
146 inline double GetVTailArm(void) const { return VTailArm; }
147 inline double Getlbarh(void) const { return lbarh; } // HTailArm / cbar
148 inline double Getlbarv(void) const { return lbarv; } // VTailArm / cbar
149 inline double Getvbarh(void) const { return vbarh; } // H. Tail Volume
150 inline double Getvbarv(void) const { return vbarv; } // V. Tail Volume
151 inline FGColumnVector3& GetMoments(void) { return vMoments; }
152 inline double GetMoments(int idx) const { return vMoments(idx); }
153 inline FGColumnVector3& GetForces(void) { return vForces; }
154 inline double GetForces(int idx) const { return vForces(idx); }
155 inline FGColumnVector3& GetBodyAccel(void) { return vBodyAccel; }
156 inline FGColumnVector3& GetNcg (void) { return vNcg; }
157 inline FGColumnVector3& GetXYZrp(void) { return vXYZrp; }
158 inline FGColumnVector3& GetXYZep(void) { return vXYZep; }
159 inline double GetXYZrp(int idx) const { return vXYZrp(idx); }
160 inline double GetXYZep(int idx) const { return vXYZep(idx); }
161 inline double GetAlphaCLMax(void) const { return alphaclmax; }
162 inline double GetAlphaCLMin(void) const { return alphaclmin; }
164 inline double GetAlphaHystMax(void) const { return alphahystmax; }
165 inline double GetAlphaHystMin(void) const { return alphahystmin; }
166 inline double GetHysteresisParm(void) const { return stall_hyst; }
169 inline void SetAlphaCLMax(double tt) { alphaclmax=tt; }
170 inline void SetAlphaCLMin(double tt) { alphaclmin=tt; }
171 inline void SetAircraftName(string name) {AircraftName = name;}
173 inline double GetStallWarn(void) const { return impending_stall; }
175 double GetBI2Vel(void) const { return bi2vel; }
176 double GetCI2Vel(void) const { return ci2vel; }
177 double GetAlphaW(void) const { return alphaw; }
181 inline FGColumnVector3& GetNwcg(void) { return vNwcg; }
187 FGColumnVector3 vMoments;
188 FGColumnVector3 vForces;
189 FGColumnVector3 vXYZrp;
190 FGColumnVector3 vXYZep;
191 FGColumnVector3 vEuler;
192 FGColumnVector3 vDXYZcg;
193 FGColumnVector3 vBodyAccel;
194 FGColumnVector3 vNcg;
195 FGColumnVector3 vNwcg;
197 double WingArea, WingSpan, cbar, WingIncidence;
198 double HTailArea, VTailArea, HTailArm, VTailArm;
199 double lbarh,lbarv,vbarh,vbarv;
200 double alphaclmax,alphaclmin;
201 double alphahystmax, alphahystmin;
202 double impending_stall, stall_hyst;
203 double bi2vel, ci2vel,alphaw;
206 void Debug(int from);
209 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%