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