]> git.mxchange.org Git - flightgear.git/blob - FDM/flight.hxx
Working on fixing up new fgFLIGHT class.
[flightgear.git] / FDM / flight.hxx
1 // flight.hxx -- define shared flight model parameters
2 //
3 // Written by Curtis Olson, started May 1997.
4 //
5 // Copyright (C) 1997  Curtis L. Olson  - curt@infoplane.com
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 // General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 //
21 // $Id$
22 // (Log is kept at end of this file)
23
24
25 #ifndef _FLIGHT_HXX
26 #define _FLIGHT_HXX
27
28
29 #include <Flight/Slew/slew.hxx>
30
31
32 #ifndef __cplusplus                                                          
33 # error This library requires C++
34 #endif                                   
35
36
37 // Define the various supported flight models (most not yet implemented)
38
39 enum fgFlightModelKind {
40     // Slew (in MS terminology)
41     FG_SLEW = 0,
42
43     // The only "real" model that is currently implemented
44     FG_LARCSIM = 1,
45
46     FG_ACM = 2,
47     FG_SUPER_SONIC = 3,
48     FG_HELICOPTER = 4,
49     FG_AUTOGYRO = 5,
50     FG_BALLOON = 6,
51     FG_PARACHUTE = 7,
52
53     // Driven externally via a serial port, net, file, etc.
54     FG_EXTERN = 8
55 };
56
57
58 typedef double FG_VECTOR_3[3];
59
60
61 // This is based heavily on LaRCsim/ls_generic.h
62 class fgFLIGHT {
63
64 public:
65
66 /*================== Mass properties and geometry values ==================*/
67
68     // Inertias
69     double mass, i_xx, i_yy, i_zz, i_xz;
70     inline double get_Mass() const { return mass; }
71     inline double get_I_xx() const { return i_xx; }
72     inline double get_I_yy() const { return i_yy; }
73     inline double get_I_zz() const { return i_zz; }
74     inline double get_I_xz() const { return i_xz; }
75     inline void set_Inertias( double m, double xx, double yy, 
76                               double zz, double xz)
77     {
78         mass = m;
79         i_xx = xx;
80         i_yy = yy;
81         i_zz = zz;
82         i_xz = xz;
83     }
84     
85     // Pilot location rel to ref pt
86     FG_VECTOR_3 d_pilot_rp_body_v;
87     inline double * get_D_pilot_rp_body_v() { 
88         return d_pilot_rp_body_v; 
89     }
90     inline double get_Dx_pilot() const { return d_pilot_rp_body_v[0]; }
91     inline double get_Dy_pilot() const { return d_pilot_rp_body_v[1]; }
92     inline double get_Dz_pilot() const { return d_pilot_rp_body_v[2]; }
93     inline void set_Pilot_Location( double dx, double dy, double dz ) {
94         d_pilot_rp_body_v[0] = dx;
95         d_pilot_rp_body_v[1] = dy;
96         d_pilot_rp_body_v[2] = dz;
97     }
98
99     // CG position w.r.t. ref. point
100     FG_VECTOR_3 d_cg_rp_body_v;
101     inline double * get_D_cg_rp_body_v() { return d_cg_rp_body_v; }
102     inline double get_Dx_cg() const { return d_cg_rp_body_v[0]; }
103     inline double get_Dy_cg() const { return d_cg_rp_body_v[1]; }
104     inline double get_Dz_cg() const { return d_cg_rp_body_v[2]; }
105     inline void set_CG_Position( double dx, double dy, double dz ) {
106         d_cg_rp_body_v[0] = dx;
107         d_cg_rp_body_v[1] = dy;
108         d_cg_rp_body_v[2] = dz;
109     }
110
111 /*================================ Forces =================================*/
112
113     FG_VECTOR_3 f_body_total_v;
114     inline double * get_F_body_total_v() { return f_body_total_v; }
115     inline double get_F_X() const { return f_body_total_v[0]; }
116     inline double get_F_Y() const { return f_body_total_v[1]; }
117     inline double get_F_Z() const { return f_body_total_v[2]; }
118     inline void set_Forces_Body_Total( double x, double y, double z ) {
119         f_body_total_v[0] = x;
120         f_body_total_v[1] = y;
121         f_body_total_v[2] = z;
122     }
123
124     FG_VECTOR_3 f_local_total_v;
125     inline double * get_F_local_total_v() { return f_local_total_v; }
126     inline double get_F_north() const { return f_local_total_v[0]; }
127     inline double get_F_east() const { return f_local_total_v[1]; }
128     inline double get_F_down() const { return f_local_total_v[2]; }
129     inline void set_Forces_Local_Total( double x, double y, double z ) {
130         f_local_total_v[0] = x;
131         f_local_total_v[1] = y;
132         f_local_total_v[2] = z;
133     }
134
135     FG_VECTOR_3 f_aero_v;
136     inline double * get_F_aero_v() { return f_aero_v; }
137     inline double get_F_X_aero() const { return f_aero_v[0]; }
138     inline double get_F_Y_aero() const { return f_aero_v[1]; }
139     inline double get_F_Z_aero() const { return f_aero_v[2]; }
140     inline void set_Forces_Aero( double x, double y, double z ) {
141         f_aero_v[0] = x;
142         f_aero_v[1] = y;
143         f_aero_v[2] = z;
144     }
145     
146     FG_VECTOR_3 f_engine_v;
147     inline double * get_F_engine_v() { return f_engine_v; }
148     inline double get_F_X_engine() const { return f_engine_v[0]; }
149     inline double get_F_Y_engine() const { return f_engine_v[1]; }
150     inline double get_F_Z_engine() const { return f_engine_v[2]; }
151     inline void set_Forces_Engine( double x, double y, double z ) {
152         f_engine_v[0] = x;
153         f_engine_v[1] = y;
154         f_engine_v[2] = z;
155     }
156
157     FG_VECTOR_3 f_gear_v;
158     inline double * get_F_gear_v() { return f_gear_v; }
159     inline double get_F_X_gear() const { return f_gear_v[0]; }
160     inline double get_F_Y_gear() const { return f_gear_v[1]; }
161     inline double get_F_Z_gear() const { return f_gear_v[2]; }
162     inline void set_Forces_Gear( double x, double y, double z ) {
163         f_gear_v[0] = x;
164         f_gear_v[1] = y;
165         f_gear_v[2] = z;
166     }
167
168     /*================================ Moments ================================*/
169
170     FG_VECTOR_3 m_total_rp_v;
171     inline double * get_M_total_rp_v() { return m_total_rp_v; }
172     inline double get_M_l_rp() const { return m_total_rp_v[0]; }
173     inline double get_M_m_rp() const { return m_total_rp_v[1]; }
174     inline double get_M_n_rp() const { return m_total_rp_v[2]; }
175     inline void set_Moments_Total_RP( double l, double m, double n ) {
176         m_total_rp_v[0] = l;
177         m_total_rp_v[1] = m;
178         m_total_rp_v[2] = n;
179     }
180
181     FG_VECTOR_3 m_total_cg_v;
182     inline double * get_M_total_cg_v() { return m_total_cg_v; }
183     inline double get_M_l_cg() const { return m_total_cg_v[0]; }
184     inline double get_M_m_cg() const { return m_total_cg_v[1]; }
185     inline double get_M_n_cg() const { return m_total_cg_v[2]; }
186     inline void set_Moments_Total_CG( double l, double m, double n ) {
187         m_total_cg_v[0] = l;
188         m_total_cg_v[1] = m;
189         m_total_cg_v[2] = n;
190     }
191
192     FG_VECTOR_3 m_aero_v;
193     inline double * get_M_aero_v() { return m_aero_v; }
194     inline double get_M_l_aero() const { return m_aero_v[0]; }
195     inline double get_M_m_aero() const { return m_aero_v[1]; }
196     inline double get_M_n_aero() const { return m_aero_v[2]; }
197     inline void set_Moments_Aero( double l, double m, double n ) {
198         m_aero_v[0] = l;
199         m_aero_v[1] = m;
200         m_aero_v[2] = n;
201     }
202
203     FG_VECTOR_3    m_engine_v;
204     inline double * get_M_engine_v() { return m_engine_v; }
205     inline double get_M_l_engine() const { return m_engine_v[0]; }
206     inline double get_M_m_engine() const { return m_engine_v[1]; }
207     inline double get_M_n_engine() const { return m_engine_v[2]; }
208     inline void set_Moments_Engine( double l, double m, double n ) {
209         m_engine_v[0] = l;
210         m_engine_v[1] = m;
211         m_engine_v[2] = n;
212     }
213
214     FG_VECTOR_3    m_gear_v;
215     inline double * get_M_gear_v() { return m_gear_v; }
216     inline double get_M_l_gear() const { return m_gear_v[0]; }
217     inline double get_M_m_gear() const { return m_gear_v[1]; }
218     inline double get_M_n_gear() const { return m_gear_v[2]; }
219     inline void set_Moments_Gear( double l, double m, double n ) {
220         m_gear_v[0] = l;
221         m_gear_v[1] = m;
222         m_gear_v[2] = n;
223     }
224
225     /*============================== Accelerations ============================*/
226
227     FG_VECTOR_3    v_dot_local_v;
228     inline double * get_V_dot_local_v() { return v_dot_local_v; }
229     inline double get_V_dot_north() const { return v_dot_local_v[0]; }
230     inline double get_V_dot_east() const { return v_dot_local_v[1]; }
231     inline double get_V_dot_down() const { return v_dot_local_v[2]; }
232     inline void set_Accels_Local( double north, double east, double down ) {
233         v_dot_local_v[0] = north;
234         v_dot_local_v[1] = east;
235         v_dot_local_v[2] = down;
236     }
237
238     FG_VECTOR_3    v_dot_body_v;
239     inline double * get_V_dot_body_v() { return v_dot_body_v; }
240     inline double get_U_dot_body() const { return v_dot_body_v[0]; }
241     inline double get_V_dot_body() const { return v_dot_body_v[1]; }
242     inline double get_W_dot_body() const { return v_dot_body_v[2]; }
243     inline void set_Accels_Body( double u, double v, double w ) {
244         v_dot_local_v[0] = u;
245         v_dot_local_v[1] = v;
246         v_dot_local_v[2] = w;
247     }
248
249     FG_VECTOR_3    a_cg_body_v;
250     inline double * get_A_cg_body_v() { return a_cg_body_v; }
251     inline double get_A_X_cg() const { return a_cg_body_v[0]; }
252     inline double get_A_Y_cg() const { return a_cg_body_v[1]; }
253     inline double get_A_Z_cg() const { return a_cg_body_v[2]; }
254     inline void set_Accels_CG_Body( double x, double y, double z ) {
255         a_cg_body_v[0] = x;
256         a_cg_body_v[1] = y;
257         a_cg_body_v[2] = z;
258     }
259
260     FG_VECTOR_3    a_pilot_body_v;
261     inline double * get_A_pilot_body_v() { return a_pilot_body_v; }
262     inline double get_A_X_pilot() const { return a_pilot_body_v[0]; }
263     inline double get_A_Y_pilot() const { return a_pilot_body_v[1]; }
264     inline double get_A_Z_pilot() const { return a_pilot_body_v[2]; }
265     inline void set_Accels_Pilot_Body( double x, double y, double z ) {
266         a_pilot_body_v[0] = x;
267         a_pilot_body_v[1] = y;
268         a_pilot_body_v[2] = z;
269     }
270
271     FG_VECTOR_3    n_cg_body_v;
272     inline double * get_N_cg_body_v() { return n_cg_body_v; }
273     inline double get_N_X_cg() const { return n_cg_body_v[0]; }
274     inline double get_N_Y_cg() const { return n_cg_body_v[1]; }
275     inline double get_N_Z_cg() const { return n_cg_body_v[2]; }
276     inline void set_Accels_CG_Body_N( double x, double y, double z ) {
277         n_cg_body_v[0] = x;
278         n_cg_body_v[1] = y;
279         n_cg_body_v[2] = z;
280     }
281
282     FG_VECTOR_3    n_pilot_body_v;
283     inline double * get_N_pilot_body_v() { return n_pilot_body_v; }
284     inline double get_N_X_pilot() const { return n_pilot_body_v[0]; }
285     inline double get_N_Y_pilot() const { return n_pilot_body_v[1]; }
286     inline double get_N_Z_pilot() const { return n_pilot_body_v[2]; }
287     inline void set_Accels_Pilot_Body_N( double x, double y, double z ) {
288         n_pilot_body_v[0] = x;
289         n_pilot_body_v[1] = y;
290         n_pilot_body_v[2] = z;
291     }
292
293     FG_VECTOR_3    omega_dot_body_v;
294     inline double * get_Omega_dot_body_v() { return omega_dot_body_v; }
295     inline double get_P_dot_body() const { return omega_dot_body_v[0]; }
296     inline double get_Q_dot_body() const { return omega_dot_body_v[1]; }
297     inline double get_R_dot_body() const { return omega_dot_body_v[2]; }
298     inline void set_Accels_Omega( double p, double q, double r ) {
299         omega_dot_body_v[0] = p;
300         omega_dot_body_v[1] = q;
301         omega_dot_body_v[2] = r;
302     }
303
304
305     /*============================== Velocities ===============================*/
306
307     FG_VECTOR_3    v_local_v;
308     inline double * get_V_local_v() { return v_local_v; }
309     inline double get_V_north() const { return v_local_v[0]; }
310     inline double get_V_east() const { return v_local_v[1]; }
311     inline double get_V_down() const { return v_local_v[2]; }
312     inline void set_Velocities_Local( double north, double east, double down ) {
313         v_local_v[0] = north;
314         v_local_v[1] = east;
315         v_local_v[2] = down;
316     }
317
318     FG_VECTOR_3    v_local_rel_ground_v; /* V rel w.r.t. earth surface   */
319     inline double * get_V_local_rel_ground_v() { return v_local_rel_ground_v; }
320     inline double get_V_north_rel_ground() const {
321         return v_local_rel_ground_v[0];
322     }
323     inline double get_V_east_rel_ground() const {
324         return v_local_rel_ground_v[1];
325     }
326     inline double get_V_down_rel_ground() const {
327         return v_local_rel_ground_v[2];
328     }
329     inline void set_Velocities_Ground(double north, double east, double down) {
330         v_local_rel_ground_v[0] = north;
331         v_local_rel_ground_v[1] = east;
332         v_local_rel_ground_v[2] = down;
333     }
334
335     FG_VECTOR_3    v_local_airmass_v;   /* velocity of airmass (steady winds) */
336     inline double * get_V_local_airmass_v() { return v_local_airmass_v; }
337     inline double get_V_north_airmass() const { return v_local_airmass_v[0]; }
338     inline double get_V_east_airmass() const { return v_local_airmass_v[1]; }
339     inline double get_V_down_airmass() const { return v_local_airmass_v[2]; }
340     inline void set_Velocities_Local_Airmass( double north, double east, 
341                                               double down)
342     {
343         v_local_airmass_v[0] = north;
344         v_local_airmass_v[1] = east;
345         v_local_airmass_v[2] = down;
346     }
347
348     FG_VECTOR_3    v_local_rel_airmass_v;  /* velocity of veh. relative to */
349     /* airmass */
350     inline double * get_V_local_rel_airmass_v() {
351         return v_local_rel_airmass_v;
352     }
353     inline double get_V_north_rel_airmass() const {
354         return v_local_rel_airmass_v[0];
355     }
356     inline double get_V_east_rel_airmass() const {
357         return v_local_rel_airmass_v[1];
358     }
359     inline double get_V_down_rel_airmass() const {
360         return v_local_rel_airmass_v[2];
361     }
362     inline void set_Velocities_Local_Rel_Airmass( double north, double east, 
363                                                   double down)
364     {
365         v_local_rel_airmass_v[0] = north;
366         v_local_rel_airmass_v[1] = east;
367         v_local_rel_airmass_v[2] = down;
368     }
369
370     FG_VECTOR_3    v_local_gust_v; /* linear turbulence components, L frame */
371     inline double * get_V_local_gust_v() { return v_local_gust_v; }
372     inline double get_U_gust() const { return v_local_gust_v[0]; }
373     inline double get_V_gust() const { return v_local_gust_v[1]; }
374     inline double get_W_gust() const { return v_local_gust_v[2]; }
375     inline void set_Velocities_Gust( double u, double v, double w)
376     {
377         v_local_gust_v[0] = u;
378         v_local_gust_v[1] = v;
379         v_local_gust_v[2] = w;
380     }
381     
382     FG_VECTOR_3    v_wind_body_v;  /* Wind-relative velocities in body axis */
383     inline double * get_V_wind_body_v() { return v_wind_body_v; }
384     inline double get_U_body() const { return v_wind_body_v[0]; }
385     inline double get_V_body() const { return v_wind_body_v[1]; }
386     inline double get_W_body() const { return v_wind_body_v[2]; }
387     inline void set_Velocities_Wind_Body( double u, double v, double w)
388     {
389         v_wind_body_v[0] = u;
390         v_wind_body_v[1] = v;
391         v_wind_body_v[2] = w;
392     }
393
394     double    v_rel_wind, v_true_kts, v_rel_ground, v_inertial;
395     double    v_ground_speed, v_equiv, v_equiv_kts;
396     double    v_calibrated, v_calibrated_kts;
397
398     inline double get_V_rel_wind() const { return v_rel_wind; }
399     inline void set_V_rel_wind(double wind) { v_rel_wind = wind; }
400
401     inline double get_V_true_kts() const { return v_true_kts; }
402     inline void set_V_true_kts(double kts) { v_true_kts = kts; }
403
404     inline double get_V_rel_ground() const { return v_rel_ground; }
405     inline void set_V_rel_ground( double v ) { v_rel_ground = v; }
406
407     inline double get_V_inertial() const { return v_inertial; }
408     inline void set_V_inertial(double v) { v_inertial = v; }
409
410     inline double get_V_ground_speed() const { return v_ground_speed; }
411     inline void set_V_ground_speed( double v) { v_ground_speed = v; }
412
413     inline double get_V_equiv() const { return v_equiv; }
414     inline void set_V_equiv( double v ) { v_equiv = v; }
415
416     inline double get_V_equiv_kts() const { return v_equiv_kts; }
417     inline void set_V_equiv_kts( double kts ) { v_equiv_kts = kts; }
418
419     inline double get_V_calibrated() const { return v_calibrated; }
420     inline void set_V_calibrated( double v ) { v_calibrated = v; }
421
422     inline double get_V_calibrated_kts() const { return v_calibrated_kts; }
423     inline void set_V_calibrated_kts( double kts ) { v_calibrated_kts = kts; }
424
425     FG_VECTOR_3    omega_body_v;   /* Angular B rates      */
426     inline double * get_Omega_body_v() { return omega_body_v; }
427     inline double get_P_body() const { return omega_body_v[0]; }
428     inline double get_Q_body() const { return omega_body_v[1]; }
429     inline double get_R_body() const { return omega_body_v[2]; }
430     inline void set_Omega_Body( double p, double q, double r ) {
431         omega_body_v[0] = p;
432         omega_body_v[1] = q;
433         omega_body_v[2] = r;
434     }
435
436     FG_VECTOR_3    omega_local_v;  /* Angular L rates      */
437     inline double * get_Omega_local_v() { return omega_local_v; }
438     inline double get_P_local() const { return omega_local_v[0]; }
439     inline double get_Q_local() const { return omega_local_v[1]; }
440     inline double get_R_local() const { return omega_local_v[2]; }
441     inline void set_Omega_Local( double p, double q, double r ) {
442         omega_local_v[0] = p;
443         omega_local_v[1] = q;
444         omega_local_v[2] = r;
445     }
446
447     FG_VECTOR_3    omega_total_v;  /* Diff btw B & L       */
448     inline double * get_Omega_total_v() { return omega_total_v; }
449     inline double get_P_total() const { return omega_total_v[0]; }
450     inline double get_Q_total() const { return omega_total_v[1]; }
451     inline double get_R_total() const { return omega_total_v[2]; }
452     inline void set_Omega_Total( double p, double q, double r ) {
453         omega_total_v[0] = p;
454         omega_total_v[1] = q;
455         omega_total_v[2] = r;
456     }
457
458     FG_VECTOR_3    euler_rates_v;
459     inline double * get_Euler_rates_v() { return euler_rates_v; }
460     inline double get_Phi_dot() const { return euler_rates_v[0]; }
461     inline double get_Theta_dot() const { return euler_rates_v[1]; }
462     inline double get_Psi_dot() const { return euler_rates_v[2]; }
463     inline void set_Euler_Rates( double phi, double theta, double psi ) {
464         euler_rates_v[0] = phi;
465         euler_rates_v[1] = theta;
466         euler_rates_v[2] = psi;
467     }
468
469     FG_VECTOR_3    geocentric_rates_v;     /* Geocentric linear velocities */
470     inline double * get_Geocentric_rates_v() { return geocentric_rates_v; }
471     inline double get_Latitude_dot() const { return geocentric_rates_v[0]; }
472     inline double get_Longitude_dot() const { return geocentric_rates_v[1]; }
473     inline double get_Radius_dot() const { return geocentric_rates_v[2]; }
474     inline void set_Geocentric_Rates( double lat, double lon, double rad ) {
475         geocentric_rates_v[0] = lat;
476         geocentric_rates_v[1] = lon;
477         geocentric_rates_v[2] = rad;
478     }
479
480     /*=============================== Positions ===============================*/
481
482     FG_VECTOR_3    geocentric_position_v;
483     inline double * get_Geocentric_position_v() {
484         return geocentric_position_v;
485     }
486     inline double get_Lat_geocentric() const {
487         return geocentric_position_v[0];
488     }
489     inline double get_Lon_geocentric() const { 
490         return geocentric_position_v[1];
491     }
492     inline double get_Radius_to_vehicle() const {
493         return geocentric_position_v[2];
494     }
495     inline void set_Radius_to_vehicle(double radius) {
496         geocentric_position_v[2] = radius;
497     }
498     inline void set_Geocentric_Position( double lat, double lon, double rad ) {
499         geocentric_position_v[0] = lat;
500         geocentric_position_v[1] = lon;
501         geocentric_position_v[2] = rad;
502     }
503
504     FG_VECTOR_3    geodetic_position_v;
505     inline double * get_Geodetic_position_v() { return geodetic_position_v; }
506     inline double get_Latitude() const { return geodetic_position_v[0]; }
507     inline void set_Latitude(double lat) { geodetic_position_v[0] = lat; }
508     inline double get_Longitude() const { return geodetic_position_v[1]; }
509     inline void set_Longitude(double lon) { geodetic_position_v[1] = lon; }
510     inline double get_Altitude() const { return geodetic_position_v[2]; }
511     inline void set_Altitude(double altitude) {
512         geodetic_position_v[2] = altitude;
513     }
514     inline void set_Geodetic_Position( double lat, double lon, double alt ) {
515         geodetic_position_v[0] = lat;
516         geodetic_position_v[1] = lon;
517         geodetic_position_v[2] = alt;
518     }
519
520     FG_VECTOR_3 euler_angles_v;
521     inline double * get_Euler_angles_v() { return euler_angles_v; }
522     inline double get_Phi() const { return euler_angles_v[0]; }
523     inline double get_Theta() const { return euler_angles_v[1]; }
524     inline double get_Psi() const { return euler_angles_v[2]; }
525     inline void set_Euler_Angles( double phi, double theta, double psi ) {
526         euler_angles_v[0] = phi;
527         euler_angles_v[1] = theta;
528         euler_angles_v[2] = psi;
529     }
530
531
532     /*======================= Miscellaneous quantities ========================*/
533
534     double    t_local_to_body_m[3][3];    /* Transformation matrix L to B */
535     // inline double * get_T_local_to_body_m() { return t_local_to_body_m; }
536     inline double get_T_local_to_body_11() const {
537         return t_local_to_body_m[0][0];
538     }
539     inline double get_T_local_to_body_12() const {
540         return t_local_to_body_m[0][1];
541     }
542     inline double get_T_local_to_body_13() const {
543         return t_local_to_body_m[0][2];
544     }
545     inline double get_T_local_to_body_21() const {
546         return t_local_to_body_m[1][0];
547     }
548     inline double get_T_local_to_body_22() const {
549         return t_local_to_body_m[1][1];
550     }
551     inline double get_T_local_to_body_23() const {
552         return t_local_to_body_m[1][2];
553     }
554     inline double get_T_local_to_body_31() const {
555         return t_local_to_body_m[2][0];
556     }
557     inline double get_T_local_to_body_32() const {
558         return t_local_to_body_m[2][1];
559     }
560     inline double get_T_local_to_body_33() const {
561         return t_local_to_body_m[2][2];
562     }
563     inline void set_T_Local_to_Body( double m[3][3] ) {
564         int i, j;
565         for ( i = 0; i < 3; i++ ) {
566             for ( j = 0; j < 3; j++ ) {
567                 t_local_to_body_m[i][j] = m[i][j];
568             }
569         }
570     }
571
572     double    gravity;            /* Local acceleration due to G  */
573     inline double get_Gravity() const { return gravity; }
574     inline void set_Gravity(double g) { gravity = g; }
575     
576     double    centrifugal_relief; /* load factor reduction due to speed */
577     inline double get_Centrifugal_relief() const { return centrifugal_relief; }
578     inline void set_Centrifugal_relief(double cr) { centrifugal_relief = cr; }
579
580     double    alpha, beta, alpha_dot, beta_dot;   /* in radians   */
581     inline double get_Alpha() const { return alpha; }
582     inline void set_Alpha( double a ) { alpha = a; }
583     inline double get_Beta() const { return beta; }
584     inline void set_Beta( double b ) { beta = b; }
585     inline double get_Alpha_dot() const { return alpha_dot; }
586     inline void set_Alpha_dot( double ad ) { alpha_dot = ad; }
587     inline double get_Beta_dot() const { return beta_dot; }
588     inline void set_Beta_dot( double bd ) { beta_dot = bd; }
589
590     double    cos_alpha, sin_alpha, cos_beta, sin_beta;
591     inline double get_Cos_alpha() const { return cos_alpha; }
592     inline void set_Cos_alpha( double ca ) { cos_alpha = ca; }
593     inline double get_Sin_alpha() const { return sin_alpha; }
594     inline void set_Sin_alpha( double sa ) { sin_alpha = sa; }
595     inline double get_Cos_beta() const { return cos_beta; }
596     inline void set_Cos_beta( double cb ) { cos_beta = cb; }
597     inline double get_Sin_beta() const { return sin_beta; }
598     inline void set_Sin_beta( double sb ) { sin_beta = sb; }
599
600     double    cos_phi, sin_phi, cos_theta, sin_theta, cos_psi, sin_psi;
601     inline double get_Cos_phi() const { return cos_phi; }
602     inline void set_Cos_phi( double cp ) { cos_phi = cp; }
603     inline double get_Sin_phi() const { return sin_phi; }
604     inline void set_Sin_phi( double sp ) { sin_phi = sp; }
605     inline double get_Cos_theta() const { return cos_theta; }
606     inline void set_Cos_theta( double ct ) { cos_theta = ct; }
607     inline double get_Sin_theta() const { return sin_theta; }
608     inline void set_Sin_theta( double st ) { sin_theta = st; }
609     inline double get_Cos_psi() const { return cos_psi; }
610     inline void set_Cos_psi( double cp ) { cos_psi = cp; }
611     inline double get_Sin_psi() const { return sin_psi; }
612     inline void set_Sin_psi( double sp ) { sin_psi = sp; }
613
614     double    gamma_vert_rad, gamma_horiz_rad;    /* Flight path angles   */
615     inline double get_Gamma_vert_rad() const { return gamma_vert_rad; }
616     inline void set_Gamma_vert_rad( double gv ) { gamma_vert_rad = gv; }
617     inline double get_Gamma_horiz_rad() const { return gamma_horiz_rad; }
618     inline void set_Gamma_horiz_rad( double gh ) { gamma_horiz_rad = gh; }
619
620     double    sigma, density, v_sound, mach_number;
621     inline double get_Sigma() const { return sigma; }
622     inline void set_Sigma( double s ) { sigma = s; }
623     inline double get_Density() const { return density; }
624     inline void set_Density( double d ) { density = d; }
625     inline double get_V_sound() const { return v_sound; }
626     inline void set_V_sound( double v ) { v_sound = v; }
627     inline double get_Mach_number() const { return mach_number; }
628     inline void set_Mach_number( double m ) { mach_number = m; }
629
630     double    static_pressure, total_pressure, impact_pressure;
631     double    dynamic_pressure;
632     inline double get_Static_pressure() const { return static_pressure; }
633     inline void set_Static_pressure( double sp ) { static_pressure = sp; }
634     inline double get_Total_pressure() const { return total_pressure; }
635     inline void set_Total_pressure( double tp ) { total_pressure = tp; }
636     inline double get_Impact_pressure() const { return impact_pressure; }
637     inline void set_Impact_pressure( double ip ) { impact_pressure = ip; }
638     inline double get_Dynamic_pressure() const { return dynamic_pressure; }
639     inline void set_Dynamic_pressure( double dp ) { dynamic_pressure = dp; }
640
641     double    static_temperature, total_temperature;
642     inline double get_Static_temperature() const { return static_temperature; }
643     inline void set_Static_temperature( double t ) { static_temperature = t; }
644     inline double get_Total_temperature() const { return total_temperature; }
645     inline void set_Total_temperature( double t ) { total_temperature = t; }
646
647     double    sea_level_radius, earth_position_angle;
648     inline double get_Sea_level_radius() const { return sea_level_radius; }
649     inline void set_Sea_level_radius( double r ) { sea_level_radius = r; }
650     inline double get_Earth_position_angle() const {
651         return earth_position_angle;
652     }
653     inline void set_Earth_position_angle(double a) { 
654         earth_position_angle = a;
655     }
656
657     double    runway_altitude, runway_latitude, runway_longitude;
658     double    runway_heading;
659     inline double get_Runway_altitude() const { return runway_altitude; }
660     inline void set_Runway_altitude( double alt ) { runway_altitude = alt; }
661     inline double get_Runway_latitude() const { return runway_latitude; }
662     inline void set_Runway_latitude( double lat ) { runway_latitude = lat; }
663     inline double get_Runway_longitude() const { return runway_longitude; }
664     inline void set_Runway_longitude( double lon ) { runway_longitude = lon; }
665     inline double get_Runway_heading() const { return runway_heading; }
666     inline void set_Runway_heading( double h ) { runway_heading = h; }
667
668     double    radius_to_rwy;
669     inline double get_Radius_to_rwy() const { return radius_to_rwy; }
670     inline void set_Radius_to_rwy( double r ) { radius_to_rwy = r; }
671
672     FG_VECTOR_3    d_cg_rwy_local_v;       /* CG rel. to rwy in local coords */
673     inline double * get_D_cg_rwy_local_v() { return d_cg_rwy_local_v; }
674     inline double get_D_cg_north_of_rwy() const { return d_cg_rwy_local_v[0]; }
675     inline double get_D_cg_east_of_rwy() const { return d_cg_rwy_local_v[1]; }
676     inline double get_D_cg_above_rwy() const { return d_cg_rwy_local_v[2]; }
677     inline void set_CG_Rwy_Local( double north, double east, double above )
678     {
679         d_cg_rwy_local_v[0] = north;
680         d_cg_rwy_local_v[1] = east;
681         d_cg_rwy_local_v[2] = above;
682     }
683
684     FG_VECTOR_3    d_cg_rwy_rwy_v; /* CG relative to rwy, in rwy coordinates */
685     inline double * get_D_cg_rwy_rwy_v() { return d_cg_rwy_rwy_v; }
686     inline double get_X_cg_rwy() const { return d_cg_rwy_rwy_v[0]; }
687     inline double get_Y_cg_rwy() const { return d_cg_rwy_rwy_v[1]; }
688     inline double get_H_cg_rwy() const { return d_cg_rwy_rwy_v[2]; }
689     inline void set_CG_Rwy_Rwy( double x, double y, double h )
690     {
691         d_cg_rwy_rwy_v[0] = x;
692         d_cg_rwy_rwy_v[1] = y;
693         d_cg_rwy_rwy_v[2] = h;
694     }
695
696     FG_VECTOR_3    d_pilot_rwy_local_v;  /* pilot rel. to rwy in local coords */
697     inline double * get_D_pilot_rwy_local_v() { return d_pilot_rwy_local_v; }
698     inline double get_D_pilot_north_of_rwy() const {
699         return d_pilot_rwy_local_v[0];
700     }
701     inline double get_D_pilot_east_of_rwy() const {
702         return d_pilot_rwy_local_v[1];
703     }
704     inline double get_D_pilot_above_rwy() const {
705         return d_pilot_rwy_local_v[2];
706     }
707     inline void set_Pilot_Rwy_Local( double north, double east, double above )
708     {
709         d_pilot_rwy_local_v[0] = north;
710         d_pilot_rwy_local_v[1] = east;
711         d_pilot_rwy_local_v[2] = above;
712     }
713
714     FG_VECTOR_3   d_pilot_rwy_rwy_v;   /* pilot rel. to rwy, in rwy coords. */
715     inline double * get_D_pilot_rwy_rwy_v() { return d_pilot_rwy_rwy_v; }
716     inline double get_X_pilot_rwy() const { return d_pilot_rwy_rwy_v[0]; }
717     inline double get_Y_pilot_rwy() const { return d_pilot_rwy_rwy_v[1]; }
718     inline double get_H_pilot_rwy() const { return d_pilot_rwy_rwy_v[2]; }
719     inline void set_Pilot_Rwy_Rwy( double x, double y, double h )
720     {
721         d_pilot_rwy_rwy_v[0] = x;
722         d_pilot_rwy_rwy_v[1] = y;
723         d_pilot_rwy_rwy_v[2] = h;
724     }
725
726     double        climb_rate;           /* in feet per second */
727     inline double get_Climb_Rate() const { return climb_rate; }
728     inline void set_Climb_Rate(double rate) { climb_rate = rate; }
729 };
730
731
732 extern fgFLIGHT cur_flight_params;
733
734
735 /* General interface to the flight model routines */
736
737 /* Initialize the flight model parameters */
738 int fgFlightModelInit(int model, fgFLIGHT& f, double dt);
739
740 /* Run multiloop iterations of the flight model */
741 int fgFlightModelUpdate(int model, fgFLIGHT& f, int multiloop);
742
743 /* Set the altitude (force) */
744 void fgFlightModelSetAltitude(int model, fgFLIGHT& f, double alt_meters);
745
746
747 #endif // _FLIGHT_HXX
748
749
750 // $Log$
751 // Revision 1.4  1998/12/03 04:25:03  curt
752 // Working on fixing up new fgFLIGHT class.
753 //
754 // Revision 1.3  1998/12/03 01:16:41  curt
755 // Converted fgFLIGHT to a class.
756 //
757 // Revision 1.2  1998/10/16 23:27:41  curt
758 // C++-ifying.
759 //
760 // Revision 1.1  1998/10/16 20:16:44  curt
761 // Renamed flight.[ch] to flight.[ch]xx
762 //
763 // Revision 1.20  1998/09/29 14:57:39  curt
764 // c++-ified comments.
765 //
766 // Revision 1.19  1998/09/29 02:02:41  curt
767 // Added a rate of climb calculation.
768 //
769 // Revision 1.18  1998/07/30 23:44:36  curt
770 // Beginning to add support for multiple flight models.
771 //
772 // Revision 1.17  1998/07/12 03:08:28  curt
773 // Added fgFlightModelSetAltitude() to force the altitude to something
774 // other than the current altitude.  LaRCsim doesn't let you do this by just
775 // changing FG_Altitude.
776 //
777 // Revision 1.16  1998/04/22 13:26:20  curt
778 // C++ - ifing the code a bit.
779 //
780 // Revision 1.15  1998/04/21 16:59:33  curt
781 // Integrated autopilot.
782 // Prepairing for C++ integration.
783 //
784 // Revision 1.14  1998/02/07 15:29:37  curt
785 // Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
786 // <chotchkiss@namg.us.anritsu.com>
787 //
788 // Revision 1.13  1998/01/24 00:04:59  curt
789 // misc. tweaks.
790 //
791 // Revision 1.12  1998/01/22 02:59:32  curt
792 // Changed #ifdef FILE_H to #ifdef _FILE_H
793 //
794 // Revision 1.11  1998/01/19 19:27:03  curt
795 // Merged in make system changes from Bob Kuehne <rpk@sgi.com>
796 // This should simplify things tremendously.
797 //
798 // Revision 1.10  1997/12/10 22:37:43  curt
799 // Prepended "fg" on the name of all global structures that didn't have it yet.
800 // i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
801 //
802 // Revision 1.9  1997/09/04 02:17:33  curt
803 // Shufflin' stuff.
804 //
805 // Revision 1.8  1997/08/27 03:30:06  curt
806 // Changed naming scheme of basic shared structures.
807 //
808 // Revision 1.7  1997/07/23 21:52:19  curt
809 // Put comments around the text after an #endif for increased portability.
810 //
811 // Revision 1.6  1997/06/21 17:52:22  curt
812 // Continue directory shuffling ... everything should be compilable/runnable
813 // again.
814 //
815 // Revision 1.5  1997/06/21 17:12:49  curt
816 // Capitalized subdirectory names.
817 //
818 // Revision 1.4  1997/05/29 22:39:57  curt
819 // Working on incorporating the LaRCsim flight model.
820 //
821 // Revision 1.3  1997/05/29 02:32:25  curt
822 // Starting to build generic flight model interface.
823 //
824 // Revision 1.2  1997/05/23 15:40:37  curt
825 // Added GNU copyright headers.
826 //
827 // Revision 1.1  1997/05/16 16:04:45  curt
828 // Initial revision.
829 //