]> git.mxchange.org Git - flightgear.git/blob - JSBsim/FGAircraft.h
fc01f5023fa9cb5293c01a4a24b27f5c12a73d11
[flightgear.git] / JSBsim / 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 COMMENTS, REFERENCES,  and NOTES
39 ********************************************************************************
40 [1] Cooke, Zyda, Pratt, and McGhee, "NPSNET: Flight Simulation Dynamic Modeling
41          Using Quaternions", Presence, Vol. 1, No. 4, pp. 404-420  Naval Postgraduate
42          School, January 1994
43 [2] D. M. Henderson, "Euler Angles, Quaternions, and Transformation Matrices",
44          JSC 12960, July 1977
45 [3] Richard E. McFarland, "A Standard Kinematic Model for Flight Simulation at
46          NASA-Ames", NASA CR-2497, January 1975
47 [4] Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics",
48          Wiley & Sons, 1979 ISBN 0-471-03032-5
49 [5] Bernard Etkin, "Dynamics of Flight, Stability and Control", Wiley & Sons,
50          1982 ISBN 0-471-08936-2
51
52 The aerodynamic coefficients used in this model are:
53
54 Longitudinal
55   CL0 - Reference lift at zero alpha
56   CD0 - Reference drag at zero alpha
57   CDM - Drag due to Mach
58   CLa - Lift curve slope (w.r.t. alpha)
59   CDa - Drag curve slope (w.r.t. alpha)
60   CLq - Lift due to pitch rate
61   CLM - Lift due to Mach
62   CLadt - Lift due to alpha rate
63
64   Cmadt - Moment due to alpha rate
65   Cm0 - Reference moment at zero alpha
66   Cma - Pitching moment slope (w.r.t. alpha)
67   Cmq - Pitch damping (pitch moment due to pitch rate)
68   CmM - Moment due to Mach
69
70 Lateral
71   Cyb - Side force due to sideslip
72   Cyr - Side force due to yaw rate
73
74   Clb - Dihedral effect (roll moment due to sideslip)
75   Clp - Roll damping (roll moment due to roll rate)
76   Clr - Roll moment due to yaw rate
77   Cnb - Weathercocking stability (yaw moment due to sideslip)
78   Cnp - Rudder adverse yaw (yaw moment due to roll rate)
79   Cnr - Yaw damping (yaw moment due to yaw rate)
80
81 Control
82   ClDe - Lift due to elevator
83   CdDe - Drag due to elevator
84   CyDr - Side force due to rudder
85   CyDa - Side force due to aileron
86
87   CmDe - Pitch moment due to elevator
88   ClDa - Roll moment due to aileron
89   ClDr - Roll moment due to rudder
90   CnDr - Yaw moment due to rudder
91   CnDa - Yaw moment due to aileron
92
93 ********************************************************************************
94 INCLUDES
95 *******************************************************************************/
96
97 #include <stdio.h>
98 #include <fstream.h>
99
100 #include "FGModel.h"
101 #include "FGCoefficient.h"
102 #include "FGEngine.h"
103 #include "FGTank.h"
104
105 /*******************************************************************************
106 DEFINITIONS
107 *******************************************************************************/
108
109 /*******************************************************************************
110 CLASS DECLARATION
111 *******************************************************************************/
112
113
114 class FGAircraft : public FGModel
115 {
116 public:
117   FGAircraft(FGFDMExec*);
118   ~FGAircraft(void);
119
120   bool Run(void);
121
122   bool LoadAircraft(char*);
123   
124   inline char* GetAircraftName(void) {return AircraftName;}
125
126   inline void SetGearUp(bool tt) {GearUp = tt;}
127   inline bool GetGearUp(void) {return GearUp;}
128   inline float GetWingArea(void) {return WingArea;}
129   inline float GetWingSpan(void) {return WingSpan;}
130   inline float Getcbar(void) {return cbar;}
131   inline FGEngine* GetEngine(int tt) {return Engine[tt];}
132   inline FGTank* GetTank(int tt) {return Tank[tt];}
133   inline float GetWeight(void) {return Weight;}
134   inline float GetMass(void) {return Mass;}
135
136   inline float GetL(void) {return Moments[0];}
137   inline float GetM(void) {return Moments[1];}
138   inline float GetN(void) {return Moments[2];}
139
140   inline float GetFx(void) {return Forces[0];}
141   inline float GetFy(void) {return Forces[1];}
142   inline float GetFz(void) {return Forces[2];}
143
144   inline float GetIxx(void) {return Ixx;}
145   inline float GetIyy(void) {return Iyy;}
146   inline float GetIzz(void) {return Izz;}
147   inline float GetIxz(void) {return Ixz;}
148
149 private:
150   void GetState(void);
151   void PutState(void);
152
153   void FAero(void);
154   void FGear(void);
155   void FMass(void);
156   void FProp(void);
157
158   void MAero(void);
159   void MGear(void);
160   void MMass(void);
161   void MProp(void);
162
163   void MassChange(void);
164
165   float Moments[3];
166   float Forces[3];
167
168   char AircraftName[50];
169   float Ixx, Iyy, Izz, Ixz, EmptyMass, Mass;
170   float Xcg, Ycg, Zcg;
171   float Xep, Yep, Zep;
172   float rho, qbar, Vt;
173   float alpha, beta;
174   float WingArea, WingSpan, cbar;
175   float phi, tht, psi;
176   float Weight, EmptyWeight;
177   float dt;
178
179   int numTanks;
180   int numEngines;
181   int numSelectedOxiTanks;
182   int numSelectedFuelTanks;
183   FGTank* Tank[MAX_TANKS];
184   FGEngine *Engine[MAX_ENGINES];
185
186   FGCoefficient *Coeff[6][10];
187   int coeff_ctr[6];
188
189   bool GearUp;
190
191   enum Param {LiftCoeff,
192               DragCoeff,
193               SideCoeff,
194               RollCoeff,
195               PitchCoeff,
196               YawCoeff,
197               numCoeffs};
198
199   char* Axis[6];
200
201 protected:
202
203 };
204
205 /******************************************************************************/
206 #endif