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 <Include/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 // Define the various supported flight models (many not yet implemented)
110 // Slew (in MS terminology)
113 // The NASA LaRCsim (Navion) flight model
116 // Jon S. Berndt's new FDM written from the ground up in C++
119 // The following aren't implemented but are here to spark
120 // thoughts and discussions, and maybe even action.
128 // Driven externally via a serial port, net, file, etc.
132 /*================== Mass properties and geometry values ==================*/
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)
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;
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;
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;
177 /*================================ Forces =================================*/
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;
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;
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 ) {
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 ) {
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 ) {
234 /*================================ Moments ================================*/
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 ) {
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 ) {
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 ) {
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 ) {
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 ) {
291 /*============================== Accelerations ============================*/
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;
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 ) {
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 ) {
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;
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 ) {
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;
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;
371 /*============================== Velocities ===============================*/
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;
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];
389 // inline double get_V_east_rel_ground() const {
390 // return v_local_rel_ground_v[1];
392 // inline double get_V_down_rel_ground() const {
393 // return v_local_rel_ground_v[2];
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;
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,
409 v_local_airmass_v[0] = north;
410 v_local_airmass_v[1] = east;
411 v_local_airmass_v[2] = down;
414 FG_VECTOR_3 v_local_rel_airmass_v; // velocity of veh. relative to
416 // inline double * get_V_local_rel_airmass_v() {
417 //return v_local_rel_airmass_v;
419 // inline double get_V_north_rel_airmass() const {
420 //return v_local_rel_airmass_v[0];
422 // inline double get_V_east_rel_airmass() const {
423 //return v_local_rel_airmass_v[1];
425 // inline double get_V_down_rel_airmass() const {
426 //return v_local_rel_airmass_v[2];
428 /* inline void set_Velocities_Local_Rel_Airmass( double north, double east,
431 v_local_rel_airmass_v[0] = north;
432 v_local_rel_airmass_v[1] = east;
433 v_local_rel_airmass_v[2] = down;
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)
443 v_local_gust_v[0] = u;
444 v_local_gust_v[1] = v;
445 v_local_gust_v[2] = w;
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)
455 v_wind_body_v[0] = u;
456 v_wind_body_v[1] = v;
457 v_wind_body_v[2] = w;
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;
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; }
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; }
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; }
473 // inline double get_V_inertial() const { return v_inertial; }
474 // inline void set_V_inertial(double v) { v_inertial = v; }
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; }
479 // inline double get_V_equiv() const { return v_equiv; }
480 // inline void set_V_equiv( double v ) { v_equiv = v; }
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; }
485 // inline double get_V_calibrated() const { return v_calibrated; }
486 // inline void set_V_calibrated( double v ) { v_calibrated = v; }
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; }
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 ) {
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;
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;
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;
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;
546 /*=============================== Positions ===============================*/
548 FG_VECTOR_3 geocentric_position_v;
549 // inline double * get_Geocentric_position_v() {
550 // return geocentric_position_v;
552 inline double get_Lat_geocentric() const {
553 return geocentric_position_v[0];
555 inline double get_Lon_geocentric() const {
556 return geocentric_position_v[1];
558 inline double get_Radius_to_vehicle() const {
559 return geocentric_position_v[2];
561 inline void set_Radius_to_vehicle(double radius) {
562 geocentric_position_v[2] = radius;
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;
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;
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;
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;
599 /*======================= Miscellaneous quantities ========================*/
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];
606 inline double get_T_local_to_body_12() const {
607 return t_local_to_body_m[0][1];
609 inline double get_T_local_to_body_13() const {
610 return t_local_to_body_m[0][2];
612 inline double get_T_local_to_body_21() const {
613 return t_local_to_body_m[1][0];
615 inline double get_T_local_to_body_22() const {
616 return t_local_to_body_m[1][1];
618 inline double get_T_local_to_body_23() const {
619 return t_local_to_body_m[1][2];
621 inline double get_T_local_to_body_31() const {
622 return t_local_to_body_m[2][0];
624 inline double get_T_local_to_body_32() const {
625 return t_local_to_body_m[2][1];
627 inline double get_T_local_to_body_33() const {
628 return t_local_to_body_m[2][2];
630 inline void set_T_Local_to_Body( double m[3][3] ) {
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];
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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;
720 inline void set_Earth_position_angle(double a) {
721 earth_position_angle = a;
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; }
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; }
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 )
746 d_cg_rwy_local_v[0] = north;
747 d_cg_rwy_local_v[1] = east;
748 d_cg_rwy_local_v[2] = above;
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 )
758 d_cg_rwy_rwy_v[0] = x;
759 d_cg_rwy_rwy_v[1] = y;
760 d_cg_rwy_rwy_v[2] = h;
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];
768 // inline double get_D_pilot_east_of_rwy() const {
769 // return d_pilot_rwy_local_v[1];
771 // inline double get_D_pilot_above_rwy() const {
772 //return d_pilot_rwy_local_v[2];
774 /* inline void set_Pilot_Rwy_Local( double north, double east, double above )
776 d_pilot_rwy_local_v[0] = north;
777 d_pilot_rwy_local_v[1] = east;
778 d_pilot_rwy_local_v[2] = above;
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 )
788 d_pilot_rwy_rwy_v[0] = x;
789 d_pilot_rwy_rwy_v[1] = y;
790 d_pilot_rwy_rwy_v[2] = h;
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; }
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(); }
802 // Extrapolate FDM based on time_offset (in usec)
803 void extrapolate( int time_offset );
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);
811 inline void set_cos_lat_geocentric(double parm) {
812 cos_lat_geocentric = cos(parm);
814 inline double get_sin_lat_geocentric(void) const {
815 return sin_lat_geocentric;
817 inline double get_cos_lat_geocentric(void) const {
818 return cos_lat_geocentric;
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);
827 inline double get_sin_longitude(void) const {
828 return sin_longitude;
830 inline double get_cos_longitude(void) const {
831 return cos_longitude;
836 inline void set_sin_cos_latitude(double parm) {
837 sin_latitude = sin(parm);
838 cos_latitude = cos(parm);
840 inline double get_sin_latitude(void) const {
843 inline double get_cos_latitude(void) const {
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;
854 extern FGInterface cur_fdm_state;
857 // General interface to the flight model routines
859 // Initialize the flight model parameters
860 int fgFDMInit(int model, FGInterface& f, double dt);
862 // Run multiloop iterations of the flight model
863 int fgFDMUpdate(int model, FGInterface& f, int multiloop, int jitter);
865 // Set the altitude (force)
866 void fgFDMForceAltitude(int model, double alt_meters);
868 // Set the local ground elevation
869 void fgFDMSetGroundElevation(int model, double alt_meters);
872 #endif // _FLIGHT_HXX