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 ) {
349 // n_cg_body_v[0] = x;
350 // n_cg_body_v[1] = y;
351 // n_cg_body_v[2] = 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 double nlf; //Normal Load Factor
366 double get_Nlf(void) { return nlf; }
367 void set_Nlf(double n) { nlf=n; }
369 FG_VECTOR_3 omega_dot_body_v;
370 // inline double * get_Omega_dot_body_v() { return omega_dot_body_v; }
371 // inline double get_P_dot_body() const { return omega_dot_body_v[0]; }
372 // inline double get_Q_dot_body() const { return omega_dot_body_v[1]; }
373 // inline double get_R_dot_body() const { return omega_dot_body_v[2]; }
374 /* inline void set_Accels_Omega( double p, double q, double r ) {
375 omega_dot_body_v[0] = p;
376 omega_dot_body_v[1] = q;
377 omega_dot_body_v[2] = r;
381 /*============================== Velocities ===============================*/
383 FG_VECTOR_3 v_local_v;
384 // inline double * get_V_local_v() { return v_local_v; }
385 inline double get_V_north() const { return v_local_v[0]; }
386 inline double get_V_east() const { return v_local_v[1]; }
387 inline double get_V_down() const { return v_local_v[2]; }
388 inline void set_Velocities_Local( double north, double east, double down ) {
389 v_local_v[0] = north;
394 FG_VECTOR_3 v_local_rel_ground_v; // V rel w.r.t. earth surface
395 // inline double * get_V_local_rel_ground_v() { return v_local_rel_ground_v; }
396 // inline double get_V_north_rel_ground() const {
397 // return v_local_rel_ground_v[0];
399 // inline double get_V_east_rel_ground() const {
400 // return v_local_rel_ground_v[1];
402 // inline double get_V_down_rel_ground() const {
403 // return v_local_rel_ground_v[2];
405 /* inline void set_Velocities_Ground(double north, double east, double down) {
406 v_local_rel_ground_v[0] = north;
407 v_local_rel_ground_v[1] = east;
408 v_local_rel_ground_v[2] = down;
411 FG_VECTOR_3 v_local_airmass_v; // velocity of airmass (steady winds)
412 // inline double * get_V_local_airmass_v() { return v_local_airmass_v; }
413 inline double get_V_north_airmass() const { return v_local_airmass_v[0]; }
414 inline double get_V_east_airmass() const { return v_local_airmass_v[1]; }
415 inline double get_V_down_airmass() const { return v_local_airmass_v[2]; }
416 inline void set_Velocities_Local_Airmass( double north, double east,
419 v_local_airmass_v[0] = north;
420 v_local_airmass_v[1] = east;
421 v_local_airmass_v[2] = down;
424 FG_VECTOR_3 v_local_rel_airmass_v; // velocity of veh. relative to
426 // inline double * get_V_local_rel_airmass_v() {
427 //return v_local_rel_airmass_v;
429 // inline double get_V_north_rel_airmass() const {
430 //return v_local_rel_airmass_v[0];
432 // inline double get_V_east_rel_airmass() const {
433 //return v_local_rel_airmass_v[1];
435 // inline double get_V_down_rel_airmass() const {
436 //return v_local_rel_airmass_v[2];
438 /* inline void set_Velocities_Local_Rel_Airmass( double north, double east,
441 v_local_rel_airmass_v[0] = north;
442 v_local_rel_airmass_v[1] = east;
443 v_local_rel_airmass_v[2] = down;
446 FG_VECTOR_3 v_local_gust_v; // linear turbulence components, L frame
447 // inline double * get_V_local_gust_v() { return v_local_gust_v; }
448 // inline double get_U_gust() const { return v_local_gust_v[0]; }
449 // inline double get_V_gust() const { return v_local_gust_v[1]; }
450 // inline double get_W_gust() const { return v_local_gust_v[2]; }
451 /* inline void set_Velocities_Gust( double u, double v, double w)
453 v_local_gust_v[0] = u;
454 v_local_gust_v[1] = v;
455 v_local_gust_v[2] = w;
458 FG_VECTOR_3 v_wind_body_v; // Wind-relative velocities in body axis
459 // inline double * get_V_wind_body_v() { return v_wind_body_v; }
460 inline double get_U_body() const { return v_wind_body_v[0]; }
461 inline double get_V_body() const { return v_wind_body_v[1]; }
462 inline double get_W_body() const { return v_wind_body_v[2]; }
463 inline void set_Velocities_Wind_Body( double u, double v, double w)
465 v_wind_body_v[0] = u;
466 v_wind_body_v[1] = v;
467 v_wind_body_v[2] = w;
470 double v_rel_wind, v_true_kts, v_rel_ground, v_inertial;
471 double v_ground_speed, v_equiv, v_equiv_kts;
472 double v_calibrated, v_calibrated_kts;
474 // inline double get_V_rel_wind() const { return v_rel_wind; }
475 // inline void set_V_rel_wind(double wind) { v_rel_wind = wind; }
477 // inline double get_V_true_kts() const { return v_true_kts; }
478 // inline void set_V_true_kts(double kts) { v_true_kts = kts; }
480 // inline double get_V_rel_ground() const { return v_rel_ground; }
481 // inline void set_V_rel_ground( double v ) { v_rel_ground = v; }
483 // inline double get_V_inertial() const { return v_inertial; }
484 // inline void set_V_inertial(double v) { v_inertial = v; }
486 inline double get_V_ground_speed() const { return v_ground_speed; }
487 inline void set_V_ground_speed( double v) { v_ground_speed = v; }
489 // inline double get_V_equiv() const { return v_equiv; }
490 // inline void set_V_equiv( double v ) { v_equiv = v; }
492 inline double get_V_equiv_kts() const { return v_equiv_kts; }
493 inline void set_V_equiv_kts( double kts ) { v_equiv_kts = kts; }
495 //inline double get_V_calibrated() const { return v_calibrated; }
496 //inline void set_V_calibrated( double v ) { v_calibrated = v; }
498 inline double get_V_calibrated_kts() const { return v_calibrated_kts; }
499 inline void set_V_calibrated_kts( double kts ) { v_calibrated_kts = kts; }
501 FG_VECTOR_3 omega_body_v; // Angular B rates
502 // inline double * get_Omega_body_v() { return omega_body_v; }
503 inline double get_P_body() const { return omega_body_v[0]; }
504 inline double get_Q_body() const { return omega_body_v[1]; }
505 inline double get_R_body() const { return omega_body_v[2]; }
506 inline void set_Omega_Body( double p, double q, double r ) {
512 FG_VECTOR_3 omega_local_v; // Angular L rates
513 // inline double * get_Omega_local_v() { return omega_local_v; }
514 // inline double get_P_local() const { return omega_local_v[0]; }
515 // inline double get_Q_local() const { return omega_local_v[1]; }
516 // inline double get_R_local() const { return omega_local_v[2]; }
517 /* inline void set_Omega_Local( double p, double q, double r ) {
518 omega_local_v[0] = p;
519 omega_local_v[1] = q;
520 omega_local_v[2] = r;
523 FG_VECTOR_3 omega_total_v; // Diff btw B & L
524 // inline double * get_Omega_total_v() { return omega_total_v; }
525 // inline double get_P_total() const { return omega_total_v[0]; }
526 // inline double get_Q_total() const { return omega_total_v[1]; }
527 // inline double get_R_total() const { return omega_total_v[2]; }
528 /* inline void set_Omega_Total( double p, double q, double r ) {
529 omega_total_v[0] = p;
530 omega_total_v[1] = q;
531 omega_total_v[2] = r;
534 FG_VECTOR_3 euler_rates_v;
535 // inline double * get_Euler_rates_v() { return euler_rates_v; }
536 inline double get_Phi_dot() const { return euler_rates_v[0]; }
537 inline double get_Theta_dot() const { return euler_rates_v[1]; }
538 inline double get_Psi_dot() const { return euler_rates_v[2]; }
539 inline void set_Euler_Rates( double phi, double theta, double psi ) {
540 euler_rates_v[0] = phi;
541 euler_rates_v[1] = theta;
542 euler_rates_v[2] = psi;
545 FG_VECTOR_3 geocentric_rates_v; // Geocentric linear velocities
546 // inline double * get_Geocentric_rates_v() { return geocentric_rates_v; }
547 inline double get_Latitude_dot() const { return geocentric_rates_v[0]; }
548 inline double get_Longitude_dot() const { return geocentric_rates_v[1]; }
549 inline double get_Radius_dot() const { return geocentric_rates_v[2]; }
550 inline void set_Geocentric_Rates( double lat, double lon, double rad ) {
551 geocentric_rates_v[0] = lat;
552 geocentric_rates_v[1] = lon;
553 geocentric_rates_v[2] = rad;
556 /*=============================== Positions ===============================*/
558 FG_VECTOR_3 geocentric_position_v;
559 // inline double * get_Geocentric_position_v() {
560 // return geocentric_position_v;
562 inline double get_Lat_geocentric() const {
563 return geocentric_position_v[0];
565 inline double get_Lon_geocentric() const {
566 return geocentric_position_v[1];
568 inline double get_Radius_to_vehicle() const {
569 return geocentric_position_v[2];
571 inline void set_Radius_to_vehicle(double radius) {
572 geocentric_position_v[2] = radius;
575 inline void set_Geocentric_Position( double lat, double lon, double rad ) {
576 geocentric_position_v[0] = lat;
577 geocentric_position_v[1] = lon;
578 geocentric_position_v[2] = rad;
581 FG_VECTOR_3 geodetic_position_v;
582 // inline double * get_Geodetic_position_v() { return geodetic_position_v; }
583 inline double get_Latitude() const { return geodetic_position_v[0]; }
584 inline void set_Latitude(double lat) { geodetic_position_v[0] = lat; }
585 inline double get_Longitude() const { return geodetic_position_v[1]; }
586 inline void set_Longitude(double lon) { geodetic_position_v[1] = lon; }
587 inline double get_Altitude() const { return geodetic_position_v[2]; }
588 inline void set_Altitude(double altitude) {
589 geodetic_position_v[2] = altitude;
591 inline void set_Geodetic_Position( double lat, double lon, double alt ) {
592 geodetic_position_v[0] = lat;
593 geodetic_position_v[1] = lon;
594 geodetic_position_v[2] = alt;
597 FG_VECTOR_3 euler_angles_v;
598 // inline double * get_Euler_angles_v() { return euler_angles_v; }
599 inline double get_Phi() const { return euler_angles_v[0]; }
600 inline double get_Theta() const { return euler_angles_v[1]; }
601 inline double get_Psi() const { return euler_angles_v[2]; }
602 inline void set_Euler_Angles( double phi, double theta, double psi ) {
603 euler_angles_v[0] = phi;
604 euler_angles_v[1] = theta;
605 euler_angles_v[2] = psi;
609 /*======================= Miscellaneous quantities ========================*/
611 double t_local_to_body_m[3][3]; // Transformation matrix L to B
612 // inline double * get_T_local_to_body_m() { return t_local_to_body_m; }
613 inline double get_T_local_to_body_11() const {
614 return t_local_to_body_m[0][0];
616 inline double get_T_local_to_body_12() const {
617 return t_local_to_body_m[0][1];
619 inline double get_T_local_to_body_13() const {
620 return t_local_to_body_m[0][2];
622 inline double get_T_local_to_body_21() const {
623 return t_local_to_body_m[1][0];
625 inline double get_T_local_to_body_22() const {
626 return t_local_to_body_m[1][1];
628 inline double get_T_local_to_body_23() const {
629 return t_local_to_body_m[1][2];
631 inline double get_T_local_to_body_31() const {
632 return t_local_to_body_m[2][0];
634 inline double get_T_local_to_body_32() const {
635 return t_local_to_body_m[2][1];
637 inline double get_T_local_to_body_33() const {
638 return t_local_to_body_m[2][2];
640 inline void set_T_Local_to_Body( int i, int j, double value) {
641 t_local_to_body_m[i-1][j-1] = value;
643 inline void set_T_Local_to_Body( double m[3][3] ) {
645 for ( i = 0; i < 3; i++ ) {
646 for ( j = 0; j < 3; j++ ) {
647 t_local_to_body_m[i][j] = m[i][j];
652 double gravity; // Local acceleration due to G
653 // inline double get_Gravity() const { return gravity; }
654 // inline void set_Gravity(double g) { gravity = g; }
656 double centrifugal_relief; // load factor reduction due to speed
657 // inline double get_Centrifugal_relief() const { return centrifugal_relief; }
658 // inline void set_Centrifugal_relief(double cr) { centrifugal_relief = cr; }
660 double alpha, beta, alpha_dot, beta_dot; // in radians
661 inline double get_Alpha() const { return alpha; }
662 inline void set_Alpha( double a ) { alpha = a; }
663 inline double get_Beta() const { return beta; }
664 inline void set_Beta( double b ) { beta = b; }
665 // inline double get_Alpha_dot() const { return alpha_dot; }
666 // inline void set_Alpha_dot( double ad ) { alpha_dot = ad; }
667 // inline double get_Beta_dot() const { return beta_dot; }
668 // inline void set_Beta_dot( double bd ) { beta_dot = bd; }
670 double cos_alpha, sin_alpha, cos_beta, sin_beta;
671 // inline double get_Cos_alpha() const { return cos_alpha; }
672 // inline void set_Cos_alpha( double ca ) { cos_alpha = ca; }
673 // inline double get_Sin_alpha() const { return sin_alpha; }
674 // inline void set_Sin_alpha( double sa ) { sin_alpha = sa; }
675 // inline double get_Cos_beta() const { return cos_beta; }
676 // inline void set_Cos_beta( double cb ) { cos_beta = cb; }
677 // inline double get_Sin_beta() const { return sin_beta; }
678 // inline void set_Sin_beta( double sb ) { sin_beta = sb; }
680 double cos_phi, sin_phi, cos_theta, sin_theta, cos_psi, sin_psi;
681 inline double get_Cos_phi() const { return cos_phi; }
682 inline void set_Cos_phi( double cp ) { cos_phi = cp; }
683 // inline double get_Sin_phi() const { return sin_phi; }
684 // inline void set_Sin_phi( double sp ) { sin_phi = sp; }
685 inline double get_Cos_theta() const { return cos_theta; }
686 inline void set_Cos_theta( double ct ) { cos_theta = ct; }
687 // inline double get_Sin_theta() const { return sin_theta; }
688 // inline void set_Sin_theta( double st ) { sin_theta = st; }
689 // inline double get_Cos_psi() const { return cos_psi; }
690 // inline void set_Cos_psi( double cp ) { cos_psi = cp; }
691 // inline double get_Sin_psi() const { return sin_psi; }
692 // inline void set_Sin_psi( double sp ) { sin_psi = sp; }
694 double gamma_vert_rad, gamma_horiz_rad; // Flight path angles
695 inline double get_Gamma_vert_rad() const { return gamma_vert_rad; }
696 inline void set_Gamma_vert_rad( double gv ) { gamma_vert_rad = gv; }
697 // inline double get_Gamma_horiz_rad() const { return gamma_horiz_rad; }
698 // inline void set_Gamma_horiz_rad( double gh ) { gamma_horiz_rad = gh; }
700 double sigma, density, v_sound, mach_number;
701 // inline double get_Sigma() const { return sigma; }
702 // inline void set_Sigma( double s ) { sigma = s; }
703 inline double get_Density() const { return density; }
704 inline void set_Density( double d ) { density = d; }
705 // inline double get_V_sound() const { return v_sound; }
706 // inline void set_V_sound( double v ) { v_sound = v; }
707 inline double get_Mach_number() const { return mach_number; }
708 inline void set_Mach_number( double m ) { mach_number = m; }
710 double static_pressure, total_pressure, impact_pressure;
711 double dynamic_pressure;
712 inline double get_Static_pressure() const { return static_pressure; }
713 inline void set_Static_pressure( double sp ) { static_pressure = sp; }
714 // inline double get_Total_pressure() const { return total_pressure; }
715 // inline void set_Total_pressure( double tp ) { total_pressure = tp; }
716 // inline double get_Impact_pressure() const { return impact_pressure; }
717 // inline void set_Impact_pressure( double ip ) { impact_pressure = ip; }
718 // inline double get_Dynamic_pressure() const { return dynamic_pressure; }
719 // inline void set_Dynamic_pressure( double dp ) { dynamic_pressure = dp; }
721 double static_temperature, total_temperature;
722 inline double get_Static_temperature() const { return static_temperature; }
723 inline void set_Static_temperature( double t ) { static_temperature = t; }
724 // inline double get_Total_temperature() const { return total_temperature; }
725 // inline void set_Total_temperature( double t ) { total_temperature = t; }
727 double sea_level_radius, earth_position_angle;
728 inline double get_Sea_level_radius() const { return sea_level_radius; }
729 inline void set_Sea_level_radius( double r ) { sea_level_radius = r; }
730 inline double get_Earth_position_angle() const {
731 return earth_position_angle;
733 inline void set_Earth_position_angle(double a) {
734 earth_position_angle = a;
737 double runway_altitude, runway_latitude, runway_longitude;
738 double runway_heading;
739 inline double get_Runway_altitude() const { return runway_altitude; }
740 inline void set_Runway_altitude( double alt ) { runway_altitude = alt; }
741 // inline double get_Runway_latitude() const { return runway_latitude; }
742 // inline void set_Runway_latitude( double lat ) { runway_latitude = lat; }
743 // inline double get_Runway_longitude() const { return runway_longitude; }
744 // inline void set_Runway_longitude( double lon ) { runway_longitude = lon; }
745 // inline double get_Runway_heading() const { return runway_heading; }
746 // inline void set_Runway_heading( double h ) { runway_heading = h; }
748 double radius_to_rwy;
749 // inline double get_Radius_to_rwy() const { return radius_to_rwy; }
750 // inline void set_Radius_to_rwy( double r ) { radius_to_rwy = r; }
752 FG_VECTOR_3 d_cg_rwy_local_v; // CG rel. to rwy in local coords
753 // inline double * get_D_cg_rwy_local_v() { return d_cg_rwy_local_v; }
754 // inline double get_D_cg_north_of_rwy() const { return d_cg_rwy_local_v[0]; }
755 // inline double get_D_cg_east_of_rwy() const { return d_cg_rwy_local_v[1]; }
756 // inline double get_D_cg_above_rwy() const { return d_cg_rwy_local_v[2]; }
757 /* inline void set_CG_Rwy_Local( double north, double east, double above )
759 d_cg_rwy_local_v[0] = north;
760 d_cg_rwy_local_v[1] = east;
761 d_cg_rwy_local_v[2] = above;
764 FG_VECTOR_3 d_cg_rwy_rwy_v; // CG relative to rwy, in rwy coordinates
765 // inline double * get_D_cg_rwy_rwy_v() { return d_cg_rwy_rwy_v; }
766 // inline double get_X_cg_rwy() const { return d_cg_rwy_rwy_v[0]; }
767 // inline double get_Y_cg_rwy() const { return d_cg_rwy_rwy_v[1]; }
768 // inline double get_H_cg_rwy() const { return d_cg_rwy_rwy_v[2]; }
769 /* inline void set_CG_Rwy_Rwy( double x, double y, double h )
771 d_cg_rwy_rwy_v[0] = x;
772 d_cg_rwy_rwy_v[1] = y;
773 d_cg_rwy_rwy_v[2] = h;
776 FG_VECTOR_3 d_pilot_rwy_local_v; // pilot rel. to rwy in local coords
777 // inline double * get_D_pilot_rwy_local_v() { return d_pilot_rwy_local_v; }
778 // inline double get_D_pilot_north_of_rwy() const {
779 //return d_pilot_rwy_local_v[0];
781 // inline double get_D_pilot_east_of_rwy() const {
782 // return d_pilot_rwy_local_v[1];
784 // inline double get_D_pilot_above_rwy() const {
785 //return d_pilot_rwy_local_v[2];
787 /* inline void set_Pilot_Rwy_Local( double north, double east, double above )
789 d_pilot_rwy_local_v[0] = north;
790 d_pilot_rwy_local_v[1] = east;
791 d_pilot_rwy_local_v[2] = above;
794 FG_VECTOR_3 d_pilot_rwy_rwy_v; // pilot rel. to rwy, in rwy coords.
795 // inline double * get_D_pilot_rwy_rwy_v() { return d_pilot_rwy_rwy_v; }
796 // inline double get_X_pilot_rwy() const { return d_pilot_rwy_rwy_v[0]; }
797 // inline double get_Y_pilot_rwy() const { return d_pilot_rwy_rwy_v[1]; }
798 // inline double get_H_pilot_rwy() const { return d_pilot_rwy_rwy_v[2]; }
799 /* inline void set_Pilot_Rwy_Rwy( double x, double y, double h )
801 d_pilot_rwy_rwy_v[0] = x;
802 d_pilot_rwy_rwy_v[1] = y;
803 d_pilot_rwy_rwy_v[2] = h;
806 double climb_rate; // in feet per second
807 inline double get_Climb_Rate() const { return climb_rate; }
808 inline void set_Climb_Rate(double rate) { climb_rate = rate; }
810 FGTimeStamp valid_stamp; // time this record is valid
811 FGTimeStamp next_stamp; // time this record is valid
812 inline FGTimeStamp get_time_stamp() const { return valid_stamp; }
813 inline void stamp_time() { valid_stamp = next_stamp; next_stamp.stamp(); }
815 // Extrapolate FDM based on time_offset (in usec)
816 void extrapolate( int time_offset );
818 // sin/cos lat_geocentric
819 double sin_lat_geocentric;
820 double cos_lat_geocentric;
821 inline void set_sin_lat_geocentric(double parm) {
822 sin_lat_geocentric = sin(parm);
824 inline void set_cos_lat_geocentric(double parm) {
825 cos_lat_geocentric = cos(parm);
827 inline double get_sin_lat_geocentric(void) const {
828 return sin_lat_geocentric;
830 inline double get_cos_lat_geocentric(void) const {
831 return cos_lat_geocentric;
834 double sin_longitude;
835 double cos_longitude;
836 inline void set_sin_cos_longitude(double parm) {
837 sin_longitude = sin(parm);
838 cos_longitude = cos(parm);
840 inline double get_sin_longitude(void) const {
841 return sin_longitude;
843 inline double get_cos_longitude(void) const {
844 return cos_longitude;
849 inline void set_sin_cos_latitude(double parm) {
850 sin_latitude = sin(parm);
851 cos_latitude = cos(parm);
853 inline double get_sin_latitude(void) const {
856 inline double get_cos_latitude(void) const {
862 typedef list < FGInterface > fdm_state_list;
863 typedef fdm_state_list::iterator fdm_state_list_iterator;
864 typedef fdm_state_list::const_iterator const_fdm_state_list_iterator;
867 extern FGInterface * cur_fdm_state;
870 // General interface to the flight model routines
872 // Initialize the flight model parameters
873 int fgFDMInit(int model, FGInterface& f, double dt);
875 // Run multiloop iterations of the flight model
876 int fgFDMUpdate(int model, FGInterface& f, int multiloop, int jitter);
878 // Set the altitude (force)
879 void fgFDMForceAltitude(int model, double alt_meters);
881 // Set the local ground elevation
882 void fgFDMSetGroundElevation(int model, double alt_meters);
885 #endif // _FLIGHT_HXX