1 // flight.hxx -- define shared flight model parameters
3 // Written by Curtis Olson, started May 1997.
5 // Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
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.
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.
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.
29 # error This library requires C++
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 ()'
43 `FGInterface::get_Mass ()'
44 `FGInterface::get_I_xx ()'
45 `FGInterface::get_I_yy ()'
46 `FGInterface::get_I_zz ()'
47 `FGInterface::get_I_xz ()'
49 `FGInterface::get_V_north ()'
50 `FGInterface::get_V_east ()'
51 `FGInterface::get_V_down ()'
53 `FGInterface::get_P_Body ()'
54 `FGInterface::get_Q_Body ()'
55 `FGInterface::get_R_Body ()'
57 `FGInterface::get_Gamma_vert_rad ()'
58 `FGInterface::get_Climb_Rate ()'
59 `FGInterface::get_Alpha ()'
60 `FGInterface::get_Beta ()'
62 `FGInterface::get_Runway_altitude ()'
64 `FGInterface::get_Lon_geocentric ()'
65 `FGInterface::get_Lat_geocentric ()'
66 `FGInterface::get_Sea_level_radius ()'
67 `FGInterface::get_Earth_position_angle ()'
69 `FGInterface::get_Latitude_dot()'
70 `FGInterface::get_Longitude_dot()'
71 `FGInterface::get_Radius_dot()'
73 `FGInterface::get_Dx_cg ()'
74 `FGInterface::get_Dy_cg ()'
75 `FGInterface::get_Dz_cg ()'
77 `FGInterface::get_T_local_to_body_11 ()' ... `FGInterface::get_T_local_to_body_33 ()'
79 `FGInterface::get_Radius_to_vehicle ()'
84 #include <simgear/compiler.h>
90 #include <Time/timestamp.hxx>
96 # error This library requires C++
100 typedef double FG_VECTOR_3[3];
103 // This is based heavily on LaRCsim/ls_generic.h
108 virtual int init( double dt );
109 virtual int update( int multi_loop );
110 virtual ~FGInterface();
112 // Define the various supported flight models (many not yet implemented)
117 // The NASA LaRCsim (Navion) flight model
120 // Jon S. Berndt's new FDM written from the ground up in C++
123 // Christian's hot air balloon simulation
126 // The following aren't implemented but are here to spark
127 // thoughts and discussions, and maybe even action.
134 // Driven externally via a serial port, net, file, etc.
138 /*================== Mass properties and geometry values ==================*/
141 double mass, i_xx, i_yy, i_zz, i_xz;
142 inline double get_Mass() const { return mass; }
143 inline double get_I_xx() const { return i_xx; }
144 inline double get_I_yy() const { return i_yy; }
145 inline double get_I_zz() const { return i_zz; }
146 inline double get_I_xz() const { return i_xz; }
147 inline void set_Inertias( double m, double xx, double yy,
148 double zz, double xz)
157 // Pilot location rel to ref pt
158 FG_VECTOR_3 d_pilot_rp_body_v;
159 // inline double * get_D_pilot_rp_body_v() {
160 // return d_pilot_rp_body_v;
162 // inline double get_Dx_pilot() const { return d_pilot_rp_body_v[0]; }
163 // inline double get_Dy_pilot() const { return d_pilot_rp_body_v[1]; }
164 // inline double get_Dz_pilot() const { return d_pilot_rp_body_v[2]; }
165 /* inline void set_Pilot_Location( double dx, double dy, double dz ) {
166 d_pilot_rp_body_v[0] = dx;
167 d_pilot_rp_body_v[1] = dy;
168 d_pilot_rp_body_v[2] = dz;
171 // CG position w.r.t. ref. point
172 FG_VECTOR_3 d_cg_rp_body_v;
173 // inline double * get_D_cg_rp_body_v() { return d_cg_rp_body_v; }
174 inline double get_Dx_cg() const { return d_cg_rp_body_v[0]; }
175 inline double get_Dy_cg() const { return d_cg_rp_body_v[1]; }
176 inline double get_Dz_cg() const { return d_cg_rp_body_v[2]; }
177 inline void set_CG_Position( double dx, double dy, double dz ) {
178 d_cg_rp_body_v[0] = dx;
179 d_cg_rp_body_v[1] = dy;
180 d_cg_rp_body_v[2] = dz;
183 /*================================ Forces =================================*/
185 FG_VECTOR_3 f_body_total_v;
186 // inline double * get_F_body_total_v() { return f_body_total_v; }
187 // inline double get_F_X() const { return f_body_total_v[0]; }
188 // inline double get_F_Y() const { return f_body_total_v[1]; }
189 // inline double get_F_Z() const { return f_body_total_v[2]; }
190 /* inline void set_Forces_Body_Total( double x, double y, double z ) {
191 f_body_total_v[0] = x;
192 f_body_total_v[1] = y;
193 f_body_total_v[2] = z;
196 FG_VECTOR_3 f_local_total_v;
197 // inline double * get_F_local_total_v() { return f_local_total_v; }
198 // inline double get_F_north() const { return f_local_total_v[0]; }
199 // inline double get_F_east() const { return f_local_total_v[1]; }
200 // inline double get_F_down() const { return f_local_total_v[2]; }
201 /* inline void set_Forces_Local_Total( double x, double y, double z ) {
202 f_local_total_v[0] = x;
203 f_local_total_v[1] = y;
204 f_local_total_v[2] = z;
207 FG_VECTOR_3 f_aero_v;
208 // inline double * get_F_aero_v() { return f_aero_v; }
209 // inline double get_F_X_aero() const { return f_aero_v[0]; }
210 // inline double get_F_Y_aero() const { return f_aero_v[1]; }
211 // inline double get_F_Z_aero() const { return f_aero_v[2]; }
212 /* inline void set_Forces_Aero( double x, double y, double z ) {
218 FG_VECTOR_3 f_engine_v;
219 // inline double * get_F_engine_v() { return f_engine_v; }
220 // inline double get_F_X_engine() const { return f_engine_v[0]; }
221 // inline double get_F_Y_engine() const { return f_engine_v[1]; }
222 // inline double get_F_Z_engine() const { return f_engine_v[2]; }
223 /* inline void set_Forces_Engine( double x, double y, double z ) {
229 FG_VECTOR_3 f_gear_v;
230 // inline double * get_F_gear_v() { return f_gear_v; }
231 // inline double get_F_X_gear() const { return f_gear_v[0]; }
232 // inline double get_F_Y_gear() const { return f_gear_v[1]; }
233 // inline double get_F_Z_gear() const { return f_gear_v[2]; }
234 /* inline void set_Forces_Gear( double x, double y, double z ) {
240 /*================================ Moments ================================*/
242 FG_VECTOR_3 m_total_rp_v;
243 // inline double * get_M_total_rp_v() { return m_total_rp_v; }
244 // inline double get_M_l_rp() const { return m_total_rp_v[0]; }
245 // inline double get_M_m_rp() const { return m_total_rp_v[1]; }
246 // inline double get_M_n_rp() const { return m_total_rp_v[2]; }
247 /* inline void set_Moments_Total_RP( double l, double m, double n ) {
253 FG_VECTOR_3 m_total_cg_v;
254 // inline double * get_M_total_cg_v() { return m_total_cg_v; }
255 // inline double get_M_l_cg() const { return m_total_cg_v[0]; }
256 // inline double get_M_m_cg() const { return m_total_cg_v[1]; }
257 // inline double get_M_n_cg() const { return m_total_cg_v[2]; }
258 /* inline void set_Moments_Total_CG( double l, double m, double n ) {
264 FG_VECTOR_3 m_aero_v;
265 // inline double * get_M_aero_v() { return m_aero_v; }
266 // inline double get_M_l_aero() const { return m_aero_v[0]; }
267 // inline double get_M_m_aero() const { return m_aero_v[1]; }
268 // inline double get_M_n_aero() const { return m_aero_v[2]; }
269 /* inline void set_Moments_Aero( double l, double m, double n ) {
275 FG_VECTOR_3 m_engine_v;
276 // inline double * get_M_engine_v() { return m_engine_v; }
277 // inline double get_M_l_engine() const { return m_engine_v[0]; }
278 // inline double get_M_m_engine() const { return m_engine_v[1]; }
279 // inline double get_M_n_engine() const { return m_engine_v[2]; }
280 /* inline void set_Moments_Engine( double l, double m, double n ) {
286 FG_VECTOR_3 m_gear_v;
287 // inline double * get_M_gear_v() { return m_gear_v; }
288 // inline double get_M_l_gear() const { return m_gear_v[0]; }
289 // inline double get_M_m_gear() const { return m_gear_v[1]; }
290 // inline double get_M_n_gear() const { return m_gear_v[2]; }
291 /* inline void set_Moments_Gear( double l, double m, double n ) {
297 /*============================== Accelerations ============================*/
299 FG_VECTOR_3 v_dot_local_v;
300 // inline double * get_V_dot_local_v() { return v_dot_local_v; }
301 inline double get_V_dot_north() const { return v_dot_local_v[0]; }
302 inline double get_V_dot_east() const { return v_dot_local_v[1]; }
303 inline double get_V_dot_down() const { return v_dot_local_v[2]; }
304 inline void set_Accels_Local( double north, double east, double down ) {
305 v_dot_local_v[0] = north;
306 v_dot_local_v[1] = east;
307 v_dot_local_v[2] = down;
310 FG_VECTOR_3 v_dot_body_v;
311 // inline double * get_V_dot_body_v() { return v_dot_body_v; }
312 inline double get_U_dot_body() const { return v_dot_body_v[0]; }
313 inline double get_V_dot_body() const { return v_dot_body_v[1]; }
314 inline double get_W_dot_body() const { return v_dot_body_v[2]; }
315 inline void set_Accels_Body( double u, double v, double w ) {
321 FG_VECTOR_3 a_cg_body_v;
322 // inline double * get_A_cg_body_v() { return a_cg_body_v; }
323 inline double get_A_X_cg() const { return a_cg_body_v[0]; }
324 inline double get_A_Y_cg() const { return a_cg_body_v[1]; }
325 inline double get_A_Z_cg() const { return a_cg_body_v[2]; }
326 inline void set_Accels_CG_Body( double x, double y, double z ) {
332 FG_VECTOR_3 a_pilot_body_v;
333 // inline double * get_A_pilot_body_v() { return a_pilot_body_v; }
334 inline double get_A_X_pilot() const { return a_pilot_body_v[0]; }
335 inline double get_A_Y_pilot() const { return a_pilot_body_v[1]; }
336 inline double get_A_Z_pilot() const { return a_pilot_body_v[2]; }
337 inline void set_Accels_Pilot_Body( double x, double y, double z ) {
338 a_pilot_body_v[0] = x;
339 a_pilot_body_v[1] = y;
340 a_pilot_body_v[2] = z;
343 FG_VECTOR_3 n_cg_body_v;
344 // inline double * get_N_cg_body_v() { return n_cg_body_v; }
345 // inline double get_N_X_cg() const { return n_cg_body_v[0]; }
346 // inline double get_N_Y_cg() const { return n_cg_body_v[1]; }
347 // inline double get_N_Z_cg() const { return n_cg_body_v[2]; }
348 /* inline void set_Accels_CG_Body_N( double x, double y, double z ) {
354 FG_VECTOR_3 n_pilot_body_v;
355 // inline double * get_N_pilot_body_v() { return n_pilot_body_v; }
356 // inline double get_N_X_pilot() const { return n_pilot_body_v[0]; }
357 // inline double get_N_Y_pilot() const { return n_pilot_body_v[1]; }
358 // inline double get_N_Z_pilot() const { return n_pilot_body_v[2]; }
359 /* inline void set_Accels_Pilot_Body_N( double x, double y, double z ) {
360 n_pilot_body_v[0] = x;
361 n_pilot_body_v[1] = y;
362 n_pilot_body_v[2] = z;
365 FG_VECTOR_3 omega_dot_body_v;
366 // inline double * get_Omega_dot_body_v() { return omega_dot_body_v; }
367 // inline double get_P_dot_body() const { return omega_dot_body_v[0]; }
368 // inline double get_Q_dot_body() const { return omega_dot_body_v[1]; }
369 // inline double get_R_dot_body() const { return omega_dot_body_v[2]; }
370 /* inline void set_Accels_Omega( double p, double q, double r ) {
371 omega_dot_body_v[0] = p;
372 omega_dot_body_v[1] = q;
373 omega_dot_body_v[2] = r;
377 /*============================== Velocities ===============================*/
379 FG_VECTOR_3 v_local_v;
380 // inline double * get_V_local_v() { return v_local_v; }
381 inline double get_V_north() const { return v_local_v[0]; }
382 inline double get_V_east() const { return v_local_v[1]; }
383 inline double get_V_down() const { return v_local_v[2]; }
384 inline void set_Velocities_Local( double north, double east, double down ) {
385 v_local_v[0] = north;
390 FG_VECTOR_3 v_local_rel_ground_v; // V rel w.r.t. earth surface
391 // inline double * get_V_local_rel_ground_v() { return v_local_rel_ground_v; }
392 // inline double get_V_north_rel_ground() const {
393 // return v_local_rel_ground_v[0];
395 // inline double get_V_east_rel_ground() const {
396 // return v_local_rel_ground_v[1];
398 // inline double get_V_down_rel_ground() const {
399 // return v_local_rel_ground_v[2];
401 /* inline void set_Velocities_Ground(double north, double east, double down) {
402 v_local_rel_ground_v[0] = north;
403 v_local_rel_ground_v[1] = east;
404 v_local_rel_ground_v[2] = down;
407 FG_VECTOR_3 v_local_airmass_v; // velocity of airmass (steady winds)
408 // inline double * get_V_local_airmass_v() { return v_local_airmass_v; }
409 // inline double get_V_north_airmass() const { return v_local_airmass_v[0]; }
410 // inline double get_V_east_airmass() const { return v_local_airmass_v[1]; }
411 // inline double get_V_down_airmass() const { return v_local_airmass_v[2]; }
412 /* inline void set_Velocities_Local_Airmass( double north, double east,
415 v_local_airmass_v[0] = north;
416 v_local_airmass_v[1] = east;
417 v_local_airmass_v[2] = down;
420 FG_VECTOR_3 v_local_rel_airmass_v; // velocity of veh. relative to
422 // inline double * get_V_local_rel_airmass_v() {
423 //return v_local_rel_airmass_v;
425 // inline double get_V_north_rel_airmass() const {
426 //return v_local_rel_airmass_v[0];
428 // inline double get_V_east_rel_airmass() const {
429 //return v_local_rel_airmass_v[1];
431 // inline double get_V_down_rel_airmass() const {
432 //return v_local_rel_airmass_v[2];
434 /* inline void set_Velocities_Local_Rel_Airmass( double north, double east,
437 v_local_rel_airmass_v[0] = north;
438 v_local_rel_airmass_v[1] = east;
439 v_local_rel_airmass_v[2] = down;
442 FG_VECTOR_3 v_local_gust_v; // linear turbulence components, L frame
443 // inline double * get_V_local_gust_v() { return v_local_gust_v; }
444 // inline double get_U_gust() const { return v_local_gust_v[0]; }
445 // inline double get_V_gust() const { return v_local_gust_v[1]; }
446 // inline double get_W_gust() const { return v_local_gust_v[2]; }
447 /* inline void set_Velocities_Gust( double u, double v, double w)
449 v_local_gust_v[0] = u;
450 v_local_gust_v[1] = v;
451 v_local_gust_v[2] = w;
454 FG_VECTOR_3 v_wind_body_v; // Wind-relative velocities in body axis
455 // inline double * get_V_wind_body_v() { return v_wind_body_v; }
456 inline double get_U_body() const { return v_wind_body_v[0]; }
457 inline double get_V_body() const { return v_wind_body_v[1]; }
458 inline double get_W_body() const { return v_wind_body_v[2]; }
459 inline void set_Velocities_Wind_Body( double u, double v, double w)
461 v_wind_body_v[0] = u;
462 v_wind_body_v[1] = v;
463 v_wind_body_v[2] = w;
466 double v_rel_wind, v_true_kts, v_rel_ground, v_inertial;
467 double v_ground_speed, v_equiv, v_equiv_kts;
468 double v_calibrated, v_calibrated_kts;
470 // inline double get_V_rel_wind() const { return v_rel_wind; }
471 // inline void set_V_rel_wind(double wind) { v_rel_wind = wind; }
473 // inline double get_V_true_kts() const { return v_true_kts; }
474 // inline void set_V_true_kts(double kts) { v_true_kts = kts; }
476 // inline double get_V_rel_ground() const { return v_rel_ground; }
477 // inline void set_V_rel_ground( double v ) { v_rel_ground = v; }
479 // inline double get_V_inertial() const { return v_inertial; }
480 // inline void set_V_inertial(double v) { v_inertial = v; }
482 inline double get_V_ground_speed() const { return v_ground_speed; }
483 inline void set_V_ground_speed( double v) { v_ground_speed = v; }
485 // inline double get_V_equiv() const { return v_equiv; }
486 // inline void set_V_equiv( double v ) { v_equiv = v; }
488 inline double get_V_equiv_kts() const { return v_equiv_kts; }
489 inline void set_V_equiv_kts( double kts ) { v_equiv_kts = kts; }
491 //inline double get_V_calibrated() const { return v_calibrated; }
492 //inline void set_V_calibrated( double v ) { v_calibrated = v; }
494 inline double get_V_calibrated_kts() const { return v_calibrated_kts; }
495 inline void set_V_calibrated_kts( double kts ) { v_calibrated_kts = kts; }
497 FG_VECTOR_3 omega_body_v; // Angular B rates
498 // inline double * get_Omega_body_v() { return omega_body_v; }
499 inline double get_P_body() const { return omega_body_v[0]; }
500 inline double get_Q_body() const { return omega_body_v[1]; }
501 inline double get_R_body() const { return omega_body_v[2]; }
502 inline void set_Omega_Body( double p, double q, double r ) {
508 FG_VECTOR_3 omega_local_v; // Angular L rates
509 // inline double * get_Omega_local_v() { return omega_local_v; }
510 // inline double get_P_local() const { return omega_local_v[0]; }
511 // inline double get_Q_local() const { return omega_local_v[1]; }
512 // inline double get_R_local() const { return omega_local_v[2]; }
513 /* inline void set_Omega_Local( double p, double q, double r ) {
514 omega_local_v[0] = p;
515 omega_local_v[1] = q;
516 omega_local_v[2] = r;
519 FG_VECTOR_3 omega_total_v; // Diff btw B & L
520 // inline double * get_Omega_total_v() { return omega_total_v; }
521 // inline double get_P_total() const { return omega_total_v[0]; }
522 // inline double get_Q_total() const { return omega_total_v[1]; }
523 // inline double get_R_total() const { return omega_total_v[2]; }
524 /* inline void set_Omega_Total( double p, double q, double r ) {
525 omega_total_v[0] = p;
526 omega_total_v[1] = q;
527 omega_total_v[2] = r;
530 FG_VECTOR_3 euler_rates_v;
531 // inline double * get_Euler_rates_v() { return euler_rates_v; }
532 inline double get_Phi_dot() const { return euler_rates_v[0]; }
533 inline double get_Theta_dot() const { return euler_rates_v[1]; }
534 inline double get_Psi_dot() const { return euler_rates_v[2]; }
535 inline void set_Euler_Rates( double phi, double theta, double psi ) {
536 euler_rates_v[0] = phi;
537 euler_rates_v[1] = theta;
538 euler_rates_v[2] = psi;
541 FG_VECTOR_3 geocentric_rates_v; // Geocentric linear velocities
542 // inline double * get_Geocentric_rates_v() { return geocentric_rates_v; }
543 inline double get_Latitude_dot() const { return geocentric_rates_v[0]; }
544 inline double get_Longitude_dot() const { return geocentric_rates_v[1]; }
545 inline double get_Radius_dot() const { return geocentric_rates_v[2]; }
546 inline void set_Geocentric_Rates( double lat, double lon, double rad ) {
547 geocentric_rates_v[0] = lat;
548 geocentric_rates_v[1] = lon;
549 geocentric_rates_v[2] = rad;
552 /*=============================== Positions ===============================*/
554 FG_VECTOR_3 geocentric_position_v;
555 // inline double * get_Geocentric_position_v() {
556 // return geocentric_position_v;
558 inline double get_Lat_geocentric() const {
559 return geocentric_position_v[0];
561 inline double get_Lon_geocentric() const {
562 return geocentric_position_v[1];
564 inline double get_Radius_to_vehicle() const {
565 return geocentric_position_v[2];
567 inline void set_Radius_to_vehicle(double radius) {
568 geocentric_position_v[2] = radius;
571 inline void set_Geocentric_Position( double lat, double lon, double rad ) {
572 geocentric_position_v[0] = lat;
573 geocentric_position_v[1] = lon;
574 geocentric_position_v[2] = rad;
577 FG_VECTOR_3 geodetic_position_v;
578 // inline double * get_Geodetic_position_v() { return geodetic_position_v; }
579 inline double get_Latitude() const { return geodetic_position_v[0]; }
580 inline void set_Latitude(double lat) { geodetic_position_v[0] = lat; }
581 inline double get_Longitude() const { return geodetic_position_v[1]; }
582 inline void set_Longitude(double lon) { geodetic_position_v[1] = lon; }
583 inline double get_Altitude() const { return geodetic_position_v[2]; }
584 inline void set_Altitude(double altitude) {
585 geodetic_position_v[2] = altitude;
587 inline void set_Geodetic_Position( double lat, double lon, double alt ) {
588 geodetic_position_v[0] = lat;
589 geodetic_position_v[1] = lon;
590 geodetic_position_v[2] = alt;
593 FG_VECTOR_3 euler_angles_v;
594 // inline double * get_Euler_angles_v() { return euler_angles_v; }
595 inline double get_Phi() const { return euler_angles_v[0]; }
596 inline double get_Theta() const { return euler_angles_v[1]; }
597 inline double get_Psi() const { return euler_angles_v[2]; }
598 inline void set_Euler_Angles( double phi, double theta, double psi ) {
599 euler_angles_v[0] = phi;
600 euler_angles_v[1] = theta;
601 euler_angles_v[2] = psi;
605 /*======================= Miscellaneous quantities ========================*/
607 double t_local_to_body_m[3][3]; // Transformation matrix L to B
608 // inline double * get_T_local_to_body_m() { return t_local_to_body_m; }
609 inline double get_T_local_to_body_11() const {
610 return t_local_to_body_m[0][0];
612 inline double get_T_local_to_body_12() const {
613 return t_local_to_body_m[0][1];
615 inline double get_T_local_to_body_13() const {
616 return t_local_to_body_m[0][2];
618 inline double get_T_local_to_body_21() const {
619 return t_local_to_body_m[1][0];
621 inline double get_T_local_to_body_22() const {
622 return t_local_to_body_m[1][1];
624 inline double get_T_local_to_body_23() const {
625 return t_local_to_body_m[1][2];
627 inline double get_T_local_to_body_31() const {
628 return t_local_to_body_m[2][0];
630 inline double get_T_local_to_body_32() const {
631 return t_local_to_body_m[2][1];
633 inline double get_T_local_to_body_33() const {
634 return t_local_to_body_m[2][2];
636 inline void set_T_Local_to_Body( double m[3][3] ) {
638 for ( i = 0; i < 3; i++ ) {
639 for ( j = 0; j < 3; j++ ) {
640 t_local_to_body_m[i][j] = m[i][j];
645 double gravity; // Local acceleration due to G
646 // inline double get_Gravity() const { return gravity; }
647 // inline void set_Gravity(double g) { gravity = g; }
649 double centrifugal_relief; // load factor reduction due to speed
650 // inline double get_Centrifugal_relief() const { return centrifugal_relief; }
651 // inline void set_Centrifugal_relief(double cr) { centrifugal_relief = cr; }
653 double alpha, beta, alpha_dot, beta_dot; // in radians
654 inline double get_Alpha() const { return alpha; }
655 inline void set_Alpha( double a ) { alpha = a; }
656 inline double get_Beta() const { return beta; }
657 inline void set_Beta( double b ) { beta = b; }
658 // inline double get_Alpha_dot() const { return alpha_dot; }
659 // inline void set_Alpha_dot( double ad ) { alpha_dot = ad; }
660 // inline double get_Beta_dot() const { return beta_dot; }
661 // inline void set_Beta_dot( double bd ) { beta_dot = bd; }
663 double cos_alpha, sin_alpha, cos_beta, sin_beta;
664 // inline double get_Cos_alpha() const { return cos_alpha; }
665 // inline void set_Cos_alpha( double ca ) { cos_alpha = ca; }
666 // inline double get_Sin_alpha() const { return sin_alpha; }
667 // inline void set_Sin_alpha( double sa ) { sin_alpha = sa; }
668 // inline double get_Cos_beta() const { return cos_beta; }
669 // inline void set_Cos_beta( double cb ) { cos_beta = cb; }
670 // inline double get_Sin_beta() const { return sin_beta; }
671 // inline void set_Sin_beta( double sb ) { sin_beta = sb; }
673 double cos_phi, sin_phi, cos_theta, sin_theta, cos_psi, sin_psi;
674 inline double get_Cos_phi() const { return cos_phi; }
675 inline void set_Cos_phi( double cp ) { cos_phi = cp; }
676 // inline double get_Sin_phi() const { return sin_phi; }
677 // inline void set_Sin_phi( double sp ) { sin_phi = sp; }
678 inline double get_Cos_theta() const { return cos_theta; }
679 inline void set_Cos_theta( double ct ) { cos_theta = ct; }
680 // inline double get_Sin_theta() const { return sin_theta; }
681 // inline void set_Sin_theta( double st ) { sin_theta = st; }
682 // inline double get_Cos_psi() const { return cos_psi; }
683 // inline void set_Cos_psi( double cp ) { cos_psi = cp; }
684 // inline double get_Sin_psi() const { return sin_psi; }
685 // inline void set_Sin_psi( double sp ) { sin_psi = sp; }
687 double gamma_vert_rad, gamma_horiz_rad; // Flight path angles
688 inline double get_Gamma_vert_rad() const { return gamma_vert_rad; }
689 inline void set_Gamma_vert_rad( double gv ) { gamma_vert_rad = gv; }
690 // inline double get_Gamma_horiz_rad() const { return gamma_horiz_rad; }
691 // inline void set_Gamma_horiz_rad( double gh ) { gamma_horiz_rad = gh; }
693 double sigma, density, v_sound, mach_number;
694 // inline double get_Sigma() const { return sigma; }
695 // inline void set_Sigma( double s ) { sigma = s; }
696 // inline double get_Density() const { return density; }
697 // inline void set_Density( double d ) { density = d; }
698 // inline double get_V_sound() const { return v_sound; }
699 // inline void set_V_sound( double v ) { v_sound = v; }
700 inline double get_Mach_number() const { return mach_number; }
701 inline void set_Mach_number( double m ) { mach_number = m; }
703 double static_pressure, total_pressure, impact_pressure;
704 double dynamic_pressure;
705 // inline double get_Static_pressure() const { return static_pressure; }
706 // inline void set_Static_pressure( double sp ) { static_pressure = sp; }
707 // inline double get_Total_pressure() const { return total_pressure; }
708 // inline void set_Total_pressure( double tp ) { total_pressure = tp; }
709 // inline double get_Impact_pressure() const { return impact_pressure; }
710 // inline void set_Impact_pressure( double ip ) { impact_pressure = ip; }
711 // inline double get_Dynamic_pressure() const { return dynamic_pressure; }
712 // inline void set_Dynamic_pressure( double dp ) { dynamic_pressure = dp; }
714 double static_temperature, total_temperature;
715 // inline double get_Static_temperature() const { return static_temperature; }
716 // inline void set_Static_temperature( double t ) { static_temperature = t; }
717 // inline double get_Total_temperature() const { return total_temperature; }
718 // inline void set_Total_temperature( double t ) { total_temperature = t; }
720 double sea_level_radius, earth_position_angle;
721 inline double get_Sea_level_radius() const { return sea_level_radius; }
722 inline void set_Sea_level_radius( double r ) { sea_level_radius = r; }
723 inline double get_Earth_position_angle() const {
724 return earth_position_angle;
726 inline void set_Earth_position_angle(double a) {
727 earth_position_angle = a;
730 double runway_altitude, runway_latitude, runway_longitude;
731 double runway_heading;
732 inline double get_Runway_altitude() const { return runway_altitude; }
733 inline void set_Runway_altitude( double alt ) { runway_altitude = alt; }
734 // inline double get_Runway_latitude() const { return runway_latitude; }
735 // inline void set_Runway_latitude( double lat ) { runway_latitude = lat; }
736 // inline double get_Runway_longitude() const { return runway_longitude; }
737 // inline void set_Runway_longitude( double lon ) { runway_longitude = lon; }
738 // inline double get_Runway_heading() const { return runway_heading; }
739 // inline void set_Runway_heading( double h ) { runway_heading = h; }
741 double radius_to_rwy;
742 // inline double get_Radius_to_rwy() const { return radius_to_rwy; }
743 // inline void set_Radius_to_rwy( double r ) { radius_to_rwy = r; }
745 FG_VECTOR_3 d_cg_rwy_local_v; // CG rel. to rwy in local coords
746 // inline double * get_D_cg_rwy_local_v() { return d_cg_rwy_local_v; }
747 // inline double get_D_cg_north_of_rwy() const { return d_cg_rwy_local_v[0]; }
748 // inline double get_D_cg_east_of_rwy() const { return d_cg_rwy_local_v[1]; }
749 // inline double get_D_cg_above_rwy() const { return d_cg_rwy_local_v[2]; }
750 /* inline void set_CG_Rwy_Local( double north, double east, double above )
752 d_cg_rwy_local_v[0] = north;
753 d_cg_rwy_local_v[1] = east;
754 d_cg_rwy_local_v[2] = above;
757 FG_VECTOR_3 d_cg_rwy_rwy_v; // CG relative to rwy, in rwy coordinates
758 // inline double * get_D_cg_rwy_rwy_v() { return d_cg_rwy_rwy_v; }
759 // inline double get_X_cg_rwy() const { return d_cg_rwy_rwy_v[0]; }
760 // inline double get_Y_cg_rwy() const { return d_cg_rwy_rwy_v[1]; }
761 // inline double get_H_cg_rwy() const { return d_cg_rwy_rwy_v[2]; }
762 /* inline void set_CG_Rwy_Rwy( double x, double y, double h )
764 d_cg_rwy_rwy_v[0] = x;
765 d_cg_rwy_rwy_v[1] = y;
766 d_cg_rwy_rwy_v[2] = h;
769 FG_VECTOR_3 d_pilot_rwy_local_v; // pilot rel. to rwy in local coords
770 // inline double * get_D_pilot_rwy_local_v() { return d_pilot_rwy_local_v; }
771 // inline double get_D_pilot_north_of_rwy() const {
772 //return d_pilot_rwy_local_v[0];
774 // inline double get_D_pilot_east_of_rwy() const {
775 // return d_pilot_rwy_local_v[1];
777 // inline double get_D_pilot_above_rwy() const {
778 //return d_pilot_rwy_local_v[2];
780 /* inline void set_Pilot_Rwy_Local( double north, double east, double above )
782 d_pilot_rwy_local_v[0] = north;
783 d_pilot_rwy_local_v[1] = east;
784 d_pilot_rwy_local_v[2] = above;
787 FG_VECTOR_3 d_pilot_rwy_rwy_v; // pilot rel. to rwy, in rwy coords.
788 // inline double * get_D_pilot_rwy_rwy_v() { return d_pilot_rwy_rwy_v; }
789 // inline double get_X_pilot_rwy() const { return d_pilot_rwy_rwy_v[0]; }
790 // inline double get_Y_pilot_rwy() const { return d_pilot_rwy_rwy_v[1]; }
791 // inline double get_H_pilot_rwy() const { return d_pilot_rwy_rwy_v[2]; }
792 /* inline void set_Pilot_Rwy_Rwy( double x, double y, double h )
794 d_pilot_rwy_rwy_v[0] = x;
795 d_pilot_rwy_rwy_v[1] = y;
796 d_pilot_rwy_rwy_v[2] = h;
799 double climb_rate; // in feet per second
800 inline double get_Climb_Rate() const { return climb_rate; }
801 inline void set_Climb_Rate(double rate) { climb_rate = rate; }
803 FGTimeStamp valid_stamp; // time this record is valid
804 FGTimeStamp next_stamp; // time this record is valid
805 inline FGTimeStamp get_time_stamp() const { return valid_stamp; }
806 inline void stamp_time() { valid_stamp = next_stamp; next_stamp.stamp(); }
808 // Extrapolate FDM based on time_offset (in usec)
809 void extrapolate( int time_offset );
811 // sin/cos lat_geocentric
812 double sin_lat_geocentric;
813 double cos_lat_geocentric;
814 inline void set_sin_lat_geocentric(double parm) {
815 sin_lat_geocentric = sin(parm);
817 inline void set_cos_lat_geocentric(double parm) {
818 cos_lat_geocentric = cos(parm);
820 inline double get_sin_lat_geocentric(void) const {
821 return sin_lat_geocentric;
823 inline double get_cos_lat_geocentric(void) const {
824 return cos_lat_geocentric;
827 double sin_longitude;
828 double cos_longitude;
829 inline void set_sin_cos_longitude(double parm) {
830 sin_longitude = sin(parm);
831 cos_longitude = cos(parm);
833 inline double get_sin_longitude(void) const {
834 return sin_longitude;
836 inline double get_cos_longitude(void) const {
837 return cos_longitude;
842 inline void set_sin_cos_latitude(double parm) {
843 sin_latitude = sin(parm);
844 cos_latitude = cos(parm);
846 inline double get_sin_latitude(void) const {
849 inline double get_cos_latitude(void) const {
855 typedef list < FGInterface > fdm_state_list;
856 typedef fdm_state_list::iterator fdm_state_list_iterator;
857 typedef fdm_state_list::const_iterator const_fdm_state_list_iterator;
860 extern FGInterface * cur_fdm_state;
863 // General interface to the flight model routines
865 // Initialize the flight model parameters
866 int fgFDMInit(int model, FGInterface& f, double dt);
868 // Run multiloop iterations of the flight model
869 int fgFDMUpdate(int model, FGInterface& f, int multiloop, int jitter);
871 // Set the altitude (force)
872 void fgFDMForceAltitude(int model, double alt_meters);
874 // Set the local ground elevation
875 void fgFDMSetGroundElevation(int model, double alt_meters);
878 #endif // _FLIGHT_HXX