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