1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7 ------------- Copyright (C) 1999 Jon S. Berndt (jon@jsbsim.org) -------------
9 This program is free software; you can redistribute it and/or modify it under
10 the terms of the GNU Lesser 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 Lesser General Public License for more
19 You should have received a copy of the GNU Lesser 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 Lesser General Public License can also be found on
24 the world wide web at http://www.gnu.org.
27 --------------------------------------------------------------------------------
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
37 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
45 #include "input_output/FGXMLElement.h"
46 #include "math/FGColumnVector3.h"
48 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
50 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
52 #define ID_AIRCRAFT "$Id: FGAircraft.h,v 1.16 2010/11/18 12:38:06 jberndt Exp $"
54 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
56 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
60 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
62 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
64 /** Encapsulates an Aircraft and its systems.
65 <p> Owns all the parts (other classes) which make up this aircraft. This includes
66 the Engines, Tanks, Propellers, Nozzles, Aerodynamic and Mass properties,
67 landing gear, etc. These constituent parts may actually run as separate
68 JSBSim models themselves, but the responsibility for initializing them and
69 for retrieving their force and moment contributions falls to FGAircraft.
70 <p> The \<metrics> section of the aircraft configuration file is read here, and
71 the metrical information is held by this class.
72 <h3>Configuration File Format for \<metrics> Section:</h3>
75 <wingarea unit="{FT2 | M2}"> {number} </wingarea>
76 <wingspan unit="{FT | M}"> {number} </wingspan>
77 <chord unit="{FT | M}"> {number} </chord>
78 <htailarea unit="{FT2 | M2}"> {number} </htailarea>
79 <htailarm unit="{FT | M}"> {number} </htailarm>
80 <vtailarea unit="{FT2 | M}"> {number} </vtailarea>
81 <vtailarm unit="{FT | M}"> {number} </vtailarm>
82 <wing_incidence unit="{RAD | DEG}"> {number} </wing_incidence>
83 <location name="{AERORP | EYEPOINT | VRP}" unit="{IN | M}">
88 {other location blocks}
93 @version $Id: FGAircraft.h,v 1.16 2010/11/18 12:38:06 jberndt Exp $
94 @see Cooke, Zyda, Pratt, and McGhee, "NPSNET: Flight Simulation Dynamic Modeling
95 Using Quaternions", Presence, Vol. 1, No. 4, pp. 404-420 Naval Postgraduate
97 @see D. M. Henderson, "Euler Angles, Quaternions, and Transformation Matrices",
99 @see Richard E. McFarland, "A Standard Kinematic Model for Flight Simulation at
100 NASA-Ames", NASA CR-2497, January 1975
101 @see Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics",
102 Wiley & Sons, 1979 ISBN 0-471-03032-5
103 @see Bernard Etkin, "Dynamics of Flight, Stability and Control", Wiley & Sons,
104 1982 ISBN 0-471-08936-2
107 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
109 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
111 class FGAircraft : public FGModel {
114 @param Executive a pointer to the parent executive object */
115 FGAircraft(FGFDMExec *Executive);
120 /** Runs the Aircraft model; called by the Executive
121 @see JSBSim.cpp documentation
122 @return false if no error */
125 bool InitModel(void);
127 /** Loads the aircraft.
128 The executive calls this method to load the aircraft into JSBSim.
129 @param el a pointer to the element tree
130 @return true if successful */
131 bool Load(Element* el);
133 /** Gets the aircraft name
134 @return the name of the aircraft as a string type */
135 const std::string& GetAircraftName(void) const { return AircraftName; }
137 /// Gets the wing area
138 double GetWingArea(void) const { return WingArea; }
139 /// Gets the wing span
140 double GetWingSpan(void) const { return WingSpan; }
141 /// Gets the average wing chord
142 double Getcbar(void) const { return cbar; }
143 double GetWingIncidence(void) const { return WingIncidence; }
144 double GetWingIncidenceDeg(void) const { return WingIncidence*radtodeg; }
145 double GetHTailArea(void) const { return HTailArea; }
146 double GetHTailArm(void) const { return HTailArm; }
147 double GetVTailArea(void) const { return VTailArea; }
148 double GetVTailArm(void) const { return VTailArm; }
149 double Getlbarh(void) const { return lbarh; } // HTailArm / cbar
150 double Getlbarv(void) const { return lbarv; } // VTailArm / cbar
151 double Getvbarh(void) const { return vbarh; } // H. Tail Volume
152 double Getvbarv(void) const { return vbarv; } // V. Tail Volume
153 const FGColumnVector3& GetMoments(void) const { return vMoments; }
154 double GetMoments(int idx) const { return vMoments(idx); }
155 const FGColumnVector3& GetForces(void) const { return vForces; }
156 double GetForces(int idx) const { return vForces(idx); }
157 FGColumnVector3& GetBodyAccel(void) { return vBodyAccel; }
158 double GetBodyAccel(int idx) const { return vBodyAccel(idx); }
159 const FGColumnVector3& GetNcg(void) const { return vNcg; }
160 double GetNcg(int idx) const { return vNcg(idx); }
161 const FGColumnVector3& GetXYZrp(void) const { return vXYZrp; }
162 const FGColumnVector3& GetXYZvrp(void) const { return vXYZvrp; }
163 const FGColumnVector3& GetXYZep(void) const { return vXYZep; }
164 double GetXYZrp(int idx) const { return vXYZrp(idx); }
165 double GetXYZvrp(int idx) const { return vXYZvrp(idx); }
166 double GetXYZep(int idx) const { return vXYZep(idx); }
167 void SetAircraftName(const std::string& name) {AircraftName = name;}
168 void SetHoldDown(int hd) {HoldDown = hd;}
169 int GetHoldDown(void) const {return HoldDown;}
171 void SetXYZrp(int idx, double value) {vXYZrp(idx) = value;}
173 void SetWingArea(double S) {WingArea = S;}
175 double GetNlf(void) const;
177 FGColumnVector3& GetNwcg(void) { return vNwcg; }
183 FGColumnVector3 vMoments;
184 FGColumnVector3 vForces;
185 FGColumnVector3 vXYZrp;
186 FGColumnVector3 vXYZvrp;
187 FGColumnVector3 vXYZep;
188 FGColumnVector3 vDXYZcg;
189 FGColumnVector3 vBodyAccel;
190 FGColumnVector3 vNcg;
191 FGColumnVector3 vNwcg;
193 double WingArea, WingSpan, cbar, WingIncidence;
194 double HTailArea, VTailArea, HTailArm, VTailArm;
195 double lbarh,lbarv,vbarh,vbarv;
197 std::string AircraftName;
199 void Debug(int from);
202 } // namespace JSBSim
203 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%