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