Debian Codegraph @

src/FDM/JSBSim/models/FGAircraft.h

raw symbols SCIP
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 ([email protected]) -------------
8
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
11 Software Foundation; either version 2 of the License, or (at your option) any
12 later 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 Lesser General Public License for more
17 details.
18
19 You should have received a copy of the GNU Lesser General Public License along
20 with this program; if not, write to the Free Software Foundation, Inc., 59
21 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
23 Further information about the GNU Lesser General Public License can also be
24 found on 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 #include <string>
42
43 #include "FGModel.h"
44 #include "math/FGMatrix33.h"
45
46 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
47 FORWARD DECLARATIONS
48 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
49
50 namespace JSBSim {
51
52 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
53 CLASS DOCUMENTATION
54 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
55
56 /** Encapsulates an Aircraft and its systems.
57 <p> Owns all the parts (other classes) which make up this aircraft. This includes
58 the Engines, Tanks, Propellers, Nozzles, Aerodynamic and Mass properties,
59 landing gear, etc. These constituent parts may actually run as separate
60 JSBSim models themselves, but the responsibility for initializing them and
61 for retrieving their force and moment contributions falls to FGAircraft.
62 <p> The \<metrics> section of the aircraft configuration file is read here, and
63 the metrical information is held by this class.
64 <h3>Configuration File Format for \<metrics> Section:</h3>
65 @code{.xml}
66 <metrics>
67 <wingarea unit="{FT2 | M2}"> {number} </wingarea>
68 <wingspan unit="{FT | M}"> {number} </wingspan>
69 <chord unit="{FT | M}"> {number} </chord>
70 <htailarea unit="{FT2 | M2}"> {number} </htailarea>
71 <htailarm unit="{FT | M}"> {number} </htailarm>
72 <vtailarea unit="{FT2 | M}"> {number} </vtailarea>
73 <vtailarm unit="{FT | M}"> {number} </vtailarm>
74 <wing_incidence unit="{RAD | DEG}"> {number} </wing_incidence>
75 <location name="{AERORP | EYEPOINT | VRP}" unit="{IN | M}">
76 <x> {number} </x>
77 <y> {number} </y>
78 <z> {number} </z>
79 </location>
80 {other location blocks}
81 </metrics>
82 @endcode
83
84 @author Jon S. Berndt
85 @see Cooke, Zyda, Pratt, and McGhee, "NPSNET: Flight Simulation Dynamic Modeling
86 Using Quaternions", Presence, Vol. 1, No. 4, pp. 404-420 Naval Postgraduate
87 School, January 1994
88 @see D. M. Henderson, "Euler Angles, Quaternions, and Transformation Matrices",
89 JSC 12960, July 1977
90 @see Richard E. McFarland, "A Standard Kinematic Model for Flight Simulation at
91 NASA-Ames", NASA CR-2497, January 1975
92 @see Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics",
93 Wiley & Sons, 1979 ISBN 0-471-03032-5
94 @see Bernard Etkin, "Dynamics of Flight, Stability and Control", Wiley & Sons,
95 1982 ISBN 0-471-08936-2
96 */
97
98 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
99 CLASS DECLARATION
100 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
101
102 class JSBSIM_API FGAircraft : public FGModel {
103 public:
104 /** Constructor
105 @param Executive a pointer to the parent executive object */
106 FGAircraft(FGFDMExec *Executive);
107
108 /// Destructor
109 ~FGAircraft() override;
110
111 /** Runs the Aircraft model; called by the Executive
112 Can pass in a value indicating if the executive is directing the simulation to Hold.
113 @param Holding if true, the executive has been directed to hold the sim from
114 advancing time. Some models may ignore this flag, such as the Input
115 model, which may need to be active to listen on a socket for the
116 "Resume" command to be given.
117 @see JSBSim.cpp documentation
118 @return false if no error */
119 bool Run(bool Holding) override;
120
121 bool InitModel(void) override;
122
123 /** Loads the aircraft.
124 The executive calls this method to load the aircraft into JSBSim.
125 @param el a pointer to the element tree
126 @return true if successful */
127 bool Load(Element* el) override;
128
129 /** Gets the aircraft name
130 @return the name of the aircraft as a string type */
131 const std::string& GetAircraftName(void) const { return AircraftName; }
132
133 /// Gets the wing area
134 double GetWingArea(void) const { return WingArea; }
135 /// Gets the wing span
136 double GetWingSpan(void) const { return WingSpan; }
137 /// Gets the average wing chord
138 double Getcbar(void) const { return cbar; }
139 double GetWingIncidence(void) const { return WingIncidence; }
140 double GetWingIncidenceDeg(void) const { return WingIncidence*radtodeg; }
141 double GetHTailArea(void) const { return HTailArea; }
142 double GetHTailArm(void) const { return HTailArm; }
143 double GetVTailArea(void) const { return VTailArea; }
144 double GetVTailArm(void) const { return VTailArm; }
145 double Getlbarh(void) const { return lbarh; } // HTailArm / cbar
146 double Getlbarv(void) const { return lbarv; } // VTailArm / cbar
147 double Getvbarh(void) const { return vbarh; } // H. Tail Volume
148 double Getvbarv(void) const { return vbarv; } // V. Tail Volume
149 const FGColumnVector3& GetMoments(void) const { return vMoments; }
150 double GetMoments(int idx) const { return vMoments(idx); }
151 const FGColumnVector3& GetForces(void) const { return vForces; }
152 double GetForces(int idx) const { return vForces(idx); }
153 /** Gets the the aero reference point (RP) coordinates.
154 @return a vector containing the RP coordinates in the structural frame. */
155 const FGColumnVector3& GetXYZrp(void) const { return vXYZrp; }
156 const FGColumnVector3& GetXYZvrp(void) const { return vXYZvrp; }
157 const FGColumnVector3& GetXYZep(void) const { return vXYZep; }
158 double GetXYZrp(int idx) const { return vXYZrp(idx); }
159 double GetXYZvrp(int idx) const { return vXYZvrp(idx); }
160 double GetXYZep(int idx) const { return vXYZep(idx); }
161 void SetAircraftName(const std::string& name) {AircraftName = name;}
162
163 void SetXYZrp(int idx, double value) {vXYZrp(idx) = value;}
164
165 void SetWingArea(double S) {WingArea = S;}
166
167 struct Inputs {
168 FGColumnVector3 AeroForce;
169 FGColumnVector3 PropForce;
170 FGColumnVector3 GroundForce;
171 FGColumnVector3 ExternalForce;
172 FGColumnVector3 BuoyantForce;
173 FGColumnVector3 AeroMoment;
174 FGColumnVector3 PropMoment;
175 FGColumnVector3 GroundMoment;
176 FGColumnVector3 ExternalMoment;
177 FGColumnVector3 BuoyantMoment;
178 } in;
179
180 private:
181 FGColumnVector3 vMoments;
182 FGColumnVector3 vForces;
183 FGColumnVector3 vXYZrp;
184 FGColumnVector3 vXYZvrp;
185 FGColumnVector3 vXYZep;
186 FGColumnVector3 vDXYZcg;
187
188 double WingArea, WingSpan, cbar, WingIncidence;
189 double HTailArea, VTailArea, HTailArm, VTailArm;
190 double lbarh,lbarv,vbarh,vbarv;
191 std::string AircraftName;
192
193 void bind(void);
194 void unbind(void);
195 void Debug(int from) override;
196 };
197
198 } // namespace JSBSim
199 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
200 #endif