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 ()'
86 #include <Time/timestamp.hxx>
89 # error This library requires C++
93 typedef double FG_VECTOR_3[3];
96 // This is based heavily on LaRCsim/ls_generic.h
101 // Define the various supported flight models (many not yet implemented)
103 // Slew (in MS terminology)
106 // The NASA LaRCsim (Navion) flight model
109 // Jon S. Berndt's new FDM written from the ground up in C++
112 // The following aren't implemented but are here to spark
113 // thoughts and discussions, and maybe even action.
121 // Driven externally via a serial port, net, file, etc.
125 /*================== Mass properties and geometry values ==================*/
128 double mass, i_xx, i_yy, i_zz, i_xz;
129 inline double get_Mass() const { return mass; }
130 inline double get_I_xx() const { return i_xx; }
131 inline double get_I_yy() const { return i_yy; }
132 inline double get_I_zz() const { return i_zz; }
133 inline double get_I_xz() const { return i_xz; }
134 inline void set_Inertias( double m, double xx, double yy,
135 double zz, double xz)
144 // Pilot location rel to ref pt
145 FG_VECTOR_3 d_pilot_rp_body_v;
146 // inline double * get_D_pilot_rp_body_v() {
147 // return d_pilot_rp_body_v;
149 // inline double get_Dx_pilot() const { return d_pilot_rp_body_v[0]; }
150 // inline double get_Dy_pilot() const { return d_pilot_rp_body_v[1]; }
151 // inline double get_Dz_pilot() const { return d_pilot_rp_body_v[2]; }
152 /* inline void set_Pilot_Location( double dx, double dy, double dz ) {
153 d_pilot_rp_body_v[0] = dx;
154 d_pilot_rp_body_v[1] = dy;
155 d_pilot_rp_body_v[2] = dz;
158 // CG position w.r.t. ref. point
159 FG_VECTOR_3 d_cg_rp_body_v;
160 // inline double * get_D_cg_rp_body_v() { return d_cg_rp_body_v; }
161 inline double get_Dx_cg() const { return d_cg_rp_body_v[0]; }
162 inline double get_Dy_cg() const { return d_cg_rp_body_v[1]; }
163 inline double get_Dz_cg() const { return d_cg_rp_body_v[2]; }
164 inline void set_CG_Position( double dx, double dy, double dz ) {
165 d_cg_rp_body_v[0] = dx;
166 d_cg_rp_body_v[1] = dy;
167 d_cg_rp_body_v[2] = dz;
170 /*================================ Forces =================================*/
172 FG_VECTOR_3 f_body_total_v;
173 // inline double * get_F_body_total_v() { return f_body_total_v; }
174 // inline double get_F_X() const { return f_body_total_v[0]; }
175 // inline double get_F_Y() const { return f_body_total_v[1]; }
176 // inline double get_F_Z() const { return f_body_total_v[2]; }
177 /* inline void set_Forces_Body_Total( double x, double y, double z ) {
178 f_body_total_v[0] = x;
179 f_body_total_v[1] = y;
180 f_body_total_v[2] = z;
183 FG_VECTOR_3 f_local_total_v;
184 // inline double * get_F_local_total_v() { return f_local_total_v; }
185 // inline double get_F_north() const { return f_local_total_v[0]; }
186 // inline double get_F_east() const { return f_local_total_v[1]; }
187 // inline double get_F_down() const { return f_local_total_v[2]; }
188 /* inline void set_Forces_Local_Total( double x, double y, double z ) {
189 f_local_total_v[0] = x;
190 f_local_total_v[1] = y;
191 f_local_total_v[2] = z;
194 FG_VECTOR_3 f_aero_v;
195 // inline double * get_F_aero_v() { return f_aero_v; }
196 // inline double get_F_X_aero() const { return f_aero_v[0]; }
197 // inline double get_F_Y_aero() const { return f_aero_v[1]; }
198 // inline double get_F_Z_aero() const { return f_aero_v[2]; }
199 /* inline void set_Forces_Aero( double x, double y, double z ) {
205 FG_VECTOR_3 f_engine_v;
206 // inline double * get_F_engine_v() { return f_engine_v; }
207 // inline double get_F_X_engine() const { return f_engine_v[0]; }
208 // inline double get_F_Y_engine() const { return f_engine_v[1]; }
209 // inline double get_F_Z_engine() const { return f_engine_v[2]; }
210 /* inline void set_Forces_Engine( double x, double y, double z ) {
216 FG_VECTOR_3 f_gear_v;
217 // inline double * get_F_gear_v() { return f_gear_v; }
218 // inline double get_F_X_gear() const { return f_gear_v[0]; }
219 // inline double get_F_Y_gear() const { return f_gear_v[1]; }
220 // inline double get_F_Z_gear() const { return f_gear_v[2]; }
221 /* inline void set_Forces_Gear( double x, double y, double z ) {
227 /*================================ Moments ================================*/
229 FG_VECTOR_3 m_total_rp_v;
230 // inline double * get_M_total_rp_v() { return m_total_rp_v; }
231 // inline double get_M_l_rp() const { return m_total_rp_v[0]; }
232 // inline double get_M_m_rp() const { return m_total_rp_v[1]; }
233 // inline double get_M_n_rp() const { return m_total_rp_v[2]; }
234 /* inline void set_Moments_Total_RP( double l, double m, double n ) {
240 FG_VECTOR_3 m_total_cg_v;
241 // inline double * get_M_total_cg_v() { return m_total_cg_v; }
242 // inline double get_M_l_cg() const { return m_total_cg_v[0]; }
243 // inline double get_M_m_cg() const { return m_total_cg_v[1]; }
244 // inline double get_M_n_cg() const { return m_total_cg_v[2]; }
245 /* inline void set_Moments_Total_CG( double l, double m, double n ) {
251 FG_VECTOR_3 m_aero_v;
252 // inline double * get_M_aero_v() { return m_aero_v; }
253 // inline double get_M_l_aero() const { return m_aero_v[0]; }
254 // inline double get_M_m_aero() const { return m_aero_v[1]; }
255 // inline double get_M_n_aero() const { return m_aero_v[2]; }
256 /* inline void set_Moments_Aero( double l, double m, double n ) {
262 FG_VECTOR_3 m_engine_v;
263 // inline double * get_M_engine_v() { return m_engine_v; }
264 // inline double get_M_l_engine() const { return m_engine_v[0]; }
265 // inline double get_M_m_engine() const { return m_engine_v[1]; }
266 // inline double get_M_n_engine() const { return m_engine_v[2]; }
267 /* inline void set_Moments_Engine( double l, double m, double n ) {
273 FG_VECTOR_3 m_gear_v;
274 // inline double * get_M_gear_v() { return m_gear_v; }
275 // inline double get_M_l_gear() const { return m_gear_v[0]; }
276 // inline double get_M_m_gear() const { return m_gear_v[1]; }
277 // inline double get_M_n_gear() const { return m_gear_v[2]; }
278 /* inline void set_Moments_Gear( double l, double m, double n ) {
284 /*============================== Accelerations ============================*/
286 FG_VECTOR_3 v_dot_local_v;
287 // inline double * get_V_dot_local_v() { return v_dot_local_v; }
288 // inline double get_V_dot_north() const { return v_dot_local_v[0]; }
289 // inline double get_V_dot_east() const { return v_dot_local_v[1]; }
290 // inline double get_V_dot_down() const { return v_dot_local_v[2]; }
291 /* inline void set_Accels_Local( double north, double east, double down ) {
292 v_dot_local_v[0] = north;
293 v_dot_local_v[1] = east;
294 v_dot_local_v[2] = down;
297 FG_VECTOR_3 v_dot_body_v;
298 // inline double * get_V_dot_body_v() { return v_dot_body_v; }
299 // inline double get_U_dot_body() const { return v_dot_body_v[0]; }
300 // inline double get_V_dot_body() const { return v_dot_body_v[1]; }
301 // inline double get_W_dot_body() const { return v_dot_body_v[2]; }
302 /* inline void set_Accels_Body( double u, double v, double w ) {
303 v_dot_local_v[0] = u;
304 v_dot_local_v[1] = v;
305 v_dot_local_v[2] = w;
308 FG_VECTOR_3 a_cg_body_v;
309 // inline double * get_A_cg_body_v() { return a_cg_body_v; }
310 // inline double get_A_X_cg() const { return a_cg_body_v[0]; }
311 // inline double get_A_Y_cg() const { return a_cg_body_v[1]; }
312 // inline double get_A_Z_cg() const { return a_cg_body_v[2]; }
313 /* inline void set_Accels_CG_Body( double x, double y, double z ) {
319 FG_VECTOR_3 a_pilot_body_v;
320 // inline double * get_A_pilot_body_v() { return a_pilot_body_v; }
321 // inline double get_A_X_pilot() const { return a_pilot_body_v[0]; }
322 // inline double get_A_Y_pilot() const { return a_pilot_body_v[1]; }
323 // inline double get_A_Z_pilot() const { return a_pilot_body_v[2]; }
324 /* inline void set_Accels_Pilot_Body( double x, double y, double z ) {
325 a_pilot_body_v[0] = x;
326 a_pilot_body_v[1] = y;
327 a_pilot_body_v[2] = z;
330 FG_VECTOR_3 n_cg_body_v;
331 // inline double * get_N_cg_body_v() { return n_cg_body_v; }
332 // inline double get_N_X_cg() const { return n_cg_body_v[0]; }
333 // inline double get_N_Y_cg() const { return n_cg_body_v[1]; }
334 // inline double get_N_Z_cg() const { return n_cg_body_v[2]; }
335 /* inline void set_Accels_CG_Body_N( double x, double y, double z ) {
341 FG_VECTOR_3 n_pilot_body_v;
342 // inline double * get_N_pilot_body_v() { return n_pilot_body_v; }
343 // inline double get_N_X_pilot() const { return n_pilot_body_v[0]; }
344 // inline double get_N_Y_pilot() const { return n_pilot_body_v[1]; }
345 // inline double get_N_Z_pilot() const { return n_pilot_body_v[2]; }
346 /* inline void set_Accels_Pilot_Body_N( double x, double y, double z ) {
347 n_pilot_body_v[0] = x;
348 n_pilot_body_v[1] = y;
349 n_pilot_body_v[2] = z;
352 FG_VECTOR_3 omega_dot_body_v;
353 // inline double * get_Omega_dot_body_v() { return omega_dot_body_v; }
354 // inline double get_P_dot_body() const { return omega_dot_body_v[0]; }
355 // inline double get_Q_dot_body() const { return omega_dot_body_v[1]; }
356 // inline double get_R_dot_body() const { return omega_dot_body_v[2]; }
357 /* inline void set_Accels_Omega( double p, double q, double r ) {
358 omega_dot_body_v[0] = p;
359 omega_dot_body_v[1] = q;
360 omega_dot_body_v[2] = r;
364 /*============================== Velocities ===============================*/
366 FG_VECTOR_3 v_local_v;
367 // inline double * get_V_local_v() { return v_local_v; }
368 inline double get_V_north() const { return v_local_v[0]; }
369 inline double get_V_east() const { return v_local_v[1]; }
370 inline double get_V_down() const { return v_local_v[2]; }
371 inline void set_Velocities_Local( double north, double east, double down ) {
372 v_local_v[0] = north;
377 FG_VECTOR_3 v_local_rel_ground_v; // V rel w.r.t. earth surface
378 // inline double * get_V_local_rel_ground_v() { return v_local_rel_ground_v; }
379 // inline double get_V_north_rel_ground() const {
380 // return v_local_rel_ground_v[0];
382 // inline double get_V_east_rel_ground() const {
383 // return v_local_rel_ground_v[1];
385 // inline double get_V_down_rel_ground() const {
386 // return v_local_rel_ground_v[2];
388 /* inline void set_Velocities_Ground(double north, double east, double down) {
389 v_local_rel_ground_v[0] = north;
390 v_local_rel_ground_v[1] = east;
391 v_local_rel_ground_v[2] = down;
394 FG_VECTOR_3 v_local_airmass_v; // velocity of airmass (steady winds)
395 // inline double * get_V_local_airmass_v() { return v_local_airmass_v; }
396 // inline double get_V_north_airmass() const { return v_local_airmass_v[0]; }
397 // inline double get_V_east_airmass() const { return v_local_airmass_v[1]; }
398 // inline double get_V_down_airmass() const { return v_local_airmass_v[2]; }
399 /* inline void set_Velocities_Local_Airmass( double north, double east,
402 v_local_airmass_v[0] = north;
403 v_local_airmass_v[1] = east;
404 v_local_airmass_v[2] = down;
407 FG_VECTOR_3 v_local_rel_airmass_v; // velocity of veh. relative to
409 // inline double * get_V_local_rel_airmass_v() {
410 //return v_local_rel_airmass_v;
412 // inline double get_V_north_rel_airmass() const {
413 //return v_local_rel_airmass_v[0];
415 // inline double get_V_east_rel_airmass() const {
416 //return v_local_rel_airmass_v[1];
418 // inline double get_V_down_rel_airmass() const {
419 //return v_local_rel_airmass_v[2];
421 /* inline void set_Velocities_Local_Rel_Airmass( double north, double east,
424 v_local_rel_airmass_v[0] = north;
425 v_local_rel_airmass_v[1] = east;
426 v_local_rel_airmass_v[2] = down;
429 FG_VECTOR_3 v_local_gust_v; // linear turbulence components, L frame
430 // inline double * get_V_local_gust_v() { return v_local_gust_v; }
431 // inline double get_U_gust() const { return v_local_gust_v[0]; }
432 // inline double get_V_gust() const { return v_local_gust_v[1]; }
433 // inline double get_W_gust() const { return v_local_gust_v[2]; }
434 /* inline void set_Velocities_Gust( double u, double v, double w)
436 v_local_gust_v[0] = u;
437 v_local_gust_v[1] = v;
438 v_local_gust_v[2] = w;
441 FG_VECTOR_3 v_wind_body_v; // Wind-relative velocities in body axis
442 // inline double * get_V_wind_body_v() { return v_wind_body_v; }
443 // inline double get_U_body() const { return v_wind_body_v[0]; }
444 // inline double get_V_body() const { return v_wind_body_v[1]; }
445 // inline double get_W_body() const { return v_wind_body_v[2]; }
446 /* inline void set_Velocities_Wind_Body( double u, double v, double w)
448 v_wind_body_v[0] = u;
449 v_wind_body_v[1] = v;
450 v_wind_body_v[2] = w;
453 double v_rel_wind, v_true_kts, v_rel_ground, v_inertial;
454 double v_ground_speed, v_equiv, v_equiv_kts;
455 double v_calibrated, v_calibrated_kts;
457 // inline double get_V_rel_wind() const { return v_rel_wind; }
458 // inline void set_V_rel_wind(double wind) { v_rel_wind = wind; }
460 // inline double get_V_true_kts() const { return v_true_kts; }
461 // inline void set_V_true_kts(double kts) { v_true_kts = kts; }
463 // inline double get_V_rel_ground() const { return v_rel_ground; }
464 // inline void set_V_rel_ground( double v ) { v_rel_ground = v; }
466 // inline double get_V_inertial() const { return v_inertial; }
467 // inline void set_V_inertial(double v) { v_inertial = v; }
469 // inline double get_V_ground_speed() const { return v_ground_speed; }
470 // inline void set_V_ground_speed( double v) { v_ground_speed = v; }
472 // inline double get_V_equiv() const { return v_equiv; }
473 // inline void set_V_equiv( double v ) { v_equiv = v; }
475 inline double get_V_equiv_kts() const { return v_equiv_kts; }
476 inline void set_V_equiv_kts( double kts ) { v_equiv_kts = kts; }
478 // inline double get_V_calibrated() const { return v_calibrated; }
479 // inline void set_V_calibrated( double v ) { v_calibrated = v; }
481 // inline double get_V_calibrated_kts() const { return v_calibrated_kts; }
482 // inline void set_V_calibrated_kts( double kts ) { v_calibrated_kts = kts; }
484 FG_VECTOR_3 omega_body_v; // Angular B rates
485 // inline double * get_Omega_body_v() { return omega_body_v; }
486 inline double get_P_body() const { return omega_body_v[0]; }
487 inline double get_Q_body() const { return omega_body_v[1]; }
488 inline double get_R_body() const { return omega_body_v[2]; }
489 inline void set_Omega_Body( double p, double q, double r ) {
495 FG_VECTOR_3 omega_local_v; // Angular L rates
496 // inline double * get_Omega_local_v() { return omega_local_v; }
497 // inline double get_P_local() const { return omega_local_v[0]; }
498 // inline double get_Q_local() const { return omega_local_v[1]; }
499 // inline double get_R_local() const { return omega_local_v[2]; }
500 /* inline void set_Omega_Local( double p, double q, double r ) {
501 omega_local_v[0] = p;
502 omega_local_v[1] = q;
503 omega_local_v[2] = r;
506 FG_VECTOR_3 omega_total_v; // Diff btw B & L
507 // inline double * get_Omega_total_v() { return omega_total_v; }
508 // inline double get_P_total() const { return omega_total_v[0]; }
509 // inline double get_Q_total() const { return omega_total_v[1]; }
510 // inline double get_R_total() const { return omega_total_v[2]; }
511 /* inline void set_Omega_Total( double p, double q, double r ) {
512 omega_total_v[0] = p;
513 omega_total_v[1] = q;
514 omega_total_v[2] = r;
517 FG_VECTOR_3 euler_rates_v;
518 // inline double * get_Euler_rates_v() { return euler_rates_v; }
519 // inline double get_Phi_dot() const { return euler_rates_v[0]; }
520 // inline double get_Theta_dot() const { return euler_rates_v[1]; }
521 // inline double get_Psi_dot() const { return euler_rates_v[2]; }
522 /* inline void set_Euler_Rates( double phi, double theta, double psi ) {
523 euler_rates_v[0] = phi;
524 euler_rates_v[1] = theta;
525 euler_rates_v[2] = psi;
528 FG_VECTOR_3 geocentric_rates_v; // Geocentric linear velocities
529 // inline double * get_Geocentric_rates_v() { return geocentric_rates_v; }
530 inline double get_Latitude_dot() const { return geocentric_rates_v[0]; }
531 inline double get_Longitude_dot() const { return geocentric_rates_v[1]; }
532 inline double get_Radius_dot() const { return geocentric_rates_v[2]; }
533 inline void set_Geocentric_Rates( double lat, double lon, double rad ) {
534 geocentric_rates_v[0] = lat;
535 geocentric_rates_v[1] = lon;
536 geocentric_rates_v[2] = rad;
539 /*=============================== Positions ===============================*/
541 FG_VECTOR_3 geocentric_position_v;
542 // inline double * get_Geocentric_position_v() {
543 // return geocentric_position_v;
545 inline double get_Lat_geocentric() const {
546 return geocentric_position_v[0];
548 inline double get_Lon_geocentric() const {
549 return geocentric_position_v[1];
551 inline double get_Radius_to_vehicle() const {
552 return geocentric_position_v[2];
554 inline void set_Radius_to_vehicle(double radius) {
555 geocentric_position_v[2] = radius;
558 inline void set_Geocentric_Position( double lat, double lon, double rad ) {
559 geocentric_position_v[0] = lat;
560 geocentric_position_v[1] = lon;
561 geocentric_position_v[2] = rad;
564 FG_VECTOR_3 geodetic_position_v;
565 // inline double * get_Geodetic_position_v() { return geodetic_position_v; }
566 inline double get_Latitude() const { return geodetic_position_v[0]; }
567 inline void set_Latitude(double lat) { geodetic_position_v[0] = lat; }
568 inline double get_Longitude() const { return geodetic_position_v[1]; }
569 inline void set_Longitude(double lon) { geodetic_position_v[1] = lon; }
570 inline double get_Altitude() const { return geodetic_position_v[2]; }
571 inline void set_Altitude(double altitude) {
572 geodetic_position_v[2] = altitude;
574 inline void set_Geodetic_Position( double lat, double lon, double alt ) {
575 geodetic_position_v[0] = lat;
576 geodetic_position_v[1] = lon;
577 geodetic_position_v[2] = alt;
580 FG_VECTOR_3 euler_angles_v;
581 // inline double * get_Euler_angles_v() { return euler_angles_v; }
582 inline double get_Phi() const { return euler_angles_v[0]; }
583 inline double get_Theta() const { return euler_angles_v[1]; }
584 inline double get_Psi() const { return euler_angles_v[2]; }
585 inline void set_Euler_Angles( double phi, double theta, double psi ) {
586 euler_angles_v[0] = phi;
587 euler_angles_v[1] = theta;
588 euler_angles_v[2] = psi;
592 /*======================= Miscellaneous quantities ========================*/
594 double t_local_to_body_m[3][3]; // Transformation matrix L to B
595 // inline double * get_T_local_to_body_m() { return t_local_to_body_m; }
596 inline double get_T_local_to_body_11() const {
597 return t_local_to_body_m[0][0];
599 inline double get_T_local_to_body_12() const {
600 return t_local_to_body_m[0][1];
602 inline double get_T_local_to_body_13() const {
603 return t_local_to_body_m[0][2];
605 inline double get_T_local_to_body_21() const {
606 return t_local_to_body_m[1][0];
608 inline double get_T_local_to_body_22() const {
609 return t_local_to_body_m[1][1];
611 inline double get_T_local_to_body_23() const {
612 return t_local_to_body_m[1][2];
614 inline double get_T_local_to_body_31() const {
615 return t_local_to_body_m[2][0];
617 inline double get_T_local_to_body_32() const {
618 return t_local_to_body_m[2][1];
620 inline double get_T_local_to_body_33() const {
621 return t_local_to_body_m[2][2];
623 inline void set_T_Local_to_Body( double m[3][3] ) {
625 for ( i = 0; i < 3; i++ ) {
626 for ( j = 0; j < 3; j++ ) {
627 t_local_to_body_m[i][j] = m[i][j];
632 double gravity; // Local acceleration due to G
633 // inline double get_Gravity() const { return gravity; }
634 // inline void set_Gravity(double g) { gravity = g; }
636 double centrifugal_relief; // load factor reduction due to speed
637 // inline double get_Centrifugal_relief() const { return centrifugal_relief; }
638 // inline void set_Centrifugal_relief(double cr) { centrifugal_relief = cr; }
640 double alpha, beta, alpha_dot, beta_dot; // in radians
641 inline double get_Alpha() const { return alpha; }
642 inline void set_Alpha( double a ) { alpha = a; }
643 inline double get_Beta() const { return beta; }
644 inline void set_Beta( double b ) { beta = b; }
645 // inline double get_Alpha_dot() const { return alpha_dot; }
646 // inline void set_Alpha_dot( double ad ) { alpha_dot = ad; }
647 // inline double get_Beta_dot() const { return beta_dot; }
648 // inline void set_Beta_dot( double bd ) { beta_dot = bd; }
650 double cos_alpha, sin_alpha, cos_beta, sin_beta;
651 // inline double get_Cos_alpha() const { return cos_alpha; }
652 // inline void set_Cos_alpha( double ca ) { cos_alpha = ca; }
653 // inline double get_Sin_alpha() const { return sin_alpha; }
654 // inline void set_Sin_alpha( double sa ) { sin_alpha = sa; }
655 // inline double get_Cos_beta() const { return cos_beta; }
656 // inline void set_Cos_beta( double cb ) { cos_beta = cb; }
657 // inline double get_Sin_beta() const { return sin_beta; }
658 // inline void set_Sin_beta( double sb ) { sin_beta = sb; }
660 double cos_phi, sin_phi, cos_theta, sin_theta, cos_psi, sin_psi;
661 // inline double get_Cos_phi() const { return cos_phi; }
662 // inline void set_Cos_phi( double cp ) { cos_phi = cp; }
663 // inline double get_Sin_phi() const { return sin_phi; }
664 // inline void set_Sin_phi( double sp ) { sin_phi = sp; }
665 // inline double get_Cos_theta() const { return cos_theta; }
666 // inline void set_Cos_theta( double ct ) { cos_theta = ct; }
667 // inline double get_Sin_theta() const { return sin_theta; }
668 // inline void set_Sin_theta( double st ) { sin_theta = st; }
669 // inline double get_Cos_psi() const { return cos_psi; }
670 // inline void set_Cos_psi( double cp ) { cos_psi = cp; }
671 // inline double get_Sin_psi() const { return sin_psi; }
672 // inline void set_Sin_psi( double sp ) { sin_psi = sp; }
674 double gamma_vert_rad, gamma_horiz_rad; // Flight path angles
675 inline double get_Gamma_vert_rad() const { return gamma_vert_rad; }
676 inline void set_Gamma_vert_rad( double gv ) { gamma_vert_rad = gv; }
677 // inline double get_Gamma_horiz_rad() const { return gamma_horiz_rad; }
678 // inline void set_Gamma_horiz_rad( double gh ) { gamma_horiz_rad = gh; }
680 double sigma, density, v_sound, mach_number;
681 // inline double get_Sigma() const { return sigma; }
682 // inline void set_Sigma( double s ) { sigma = s; }
683 // inline double get_Density() const { return density; }
684 // inline void set_Density( double d ) { density = d; }
685 // inline double get_V_sound() const { return v_sound; }
686 // inline void set_V_sound( double v ) { v_sound = v; }
687 // inline double get_Mach_number() const { return mach_number; }
688 // inline void set_Mach_number( double m ) { mach_number = m; }
690 double static_pressure, total_pressure, impact_pressure;
691 double dynamic_pressure;
692 // inline double get_Static_pressure() const { return static_pressure; }
693 // inline void set_Static_pressure( double sp ) { static_pressure = sp; }
694 // inline double get_Total_pressure() const { return total_pressure; }
695 // inline void set_Total_pressure( double tp ) { total_pressure = tp; }
696 // inline double get_Impact_pressure() const { return impact_pressure; }
697 // inline void set_Impact_pressure( double ip ) { impact_pressure = ip; }
698 // inline double get_Dynamic_pressure() const { return dynamic_pressure; }
699 // inline void set_Dynamic_pressure( double dp ) { dynamic_pressure = dp; }
701 double static_temperature, total_temperature;
702 // inline double get_Static_temperature() const { return static_temperature; }
703 // inline void set_Static_temperature( double t ) { static_temperature = t; }
704 // inline double get_Total_temperature() const { return total_temperature; }
705 // inline void set_Total_temperature( double t ) { total_temperature = t; }
707 double sea_level_radius, earth_position_angle;
708 inline double get_Sea_level_radius() const { return sea_level_radius; }
709 inline void set_Sea_level_radius( double r ) { sea_level_radius = r; }
710 inline double get_Earth_position_angle() const {
711 return earth_position_angle;
713 inline void set_Earth_position_angle(double a) {
714 earth_position_angle = a;
717 double runway_altitude, runway_latitude, runway_longitude;
718 double runway_heading;
719 inline double get_Runway_altitude() const { return runway_altitude; }
720 inline void set_Runway_altitude( double alt ) { runway_altitude = alt; }
721 // inline double get_Runway_latitude() const { return runway_latitude; }
722 // inline void set_Runway_latitude( double lat ) { runway_latitude = lat; }
723 // inline double get_Runway_longitude() const { return runway_longitude; }
724 // inline void set_Runway_longitude( double lon ) { runway_longitude = lon; }
725 // inline double get_Runway_heading() const { return runway_heading; }
726 // inline void set_Runway_heading( double h ) { runway_heading = h; }
728 double radius_to_rwy;
729 // inline double get_Radius_to_rwy() const { return radius_to_rwy; }
730 // inline void set_Radius_to_rwy( double r ) { radius_to_rwy = r; }
732 FG_VECTOR_3 d_cg_rwy_local_v; // CG rel. to rwy in local coords
733 // inline double * get_D_cg_rwy_local_v() { return d_cg_rwy_local_v; }
734 // inline double get_D_cg_north_of_rwy() const { return d_cg_rwy_local_v[0]; }
735 // inline double get_D_cg_east_of_rwy() const { return d_cg_rwy_local_v[1]; }
736 // inline double get_D_cg_above_rwy() const { return d_cg_rwy_local_v[2]; }
737 /* inline void set_CG_Rwy_Local( double north, double east, double above )
739 d_cg_rwy_local_v[0] = north;
740 d_cg_rwy_local_v[1] = east;
741 d_cg_rwy_local_v[2] = above;
744 FG_VECTOR_3 d_cg_rwy_rwy_v; // CG relative to rwy, in rwy coordinates
745 // inline double * get_D_cg_rwy_rwy_v() { return d_cg_rwy_rwy_v; }
746 // inline double get_X_cg_rwy() const { return d_cg_rwy_rwy_v[0]; }
747 // inline double get_Y_cg_rwy() const { return d_cg_rwy_rwy_v[1]; }
748 // inline double get_H_cg_rwy() const { return d_cg_rwy_rwy_v[2]; }
749 /* inline void set_CG_Rwy_Rwy( double x, double y, double h )
751 d_cg_rwy_rwy_v[0] = x;
752 d_cg_rwy_rwy_v[1] = y;
753 d_cg_rwy_rwy_v[2] = h;
756 FG_VECTOR_3 d_pilot_rwy_local_v; // pilot rel. to rwy in local coords
757 // inline double * get_D_pilot_rwy_local_v() { return d_pilot_rwy_local_v; }
758 // inline double get_D_pilot_north_of_rwy() const {
759 //return d_pilot_rwy_local_v[0];
761 // inline double get_D_pilot_east_of_rwy() const {
762 // return d_pilot_rwy_local_v[1];
764 // inline double get_D_pilot_above_rwy() const {
765 //return d_pilot_rwy_local_v[2];
767 /* inline void set_Pilot_Rwy_Local( double north, double east, double above )
769 d_pilot_rwy_local_v[0] = north;
770 d_pilot_rwy_local_v[1] = east;
771 d_pilot_rwy_local_v[2] = above;
774 FG_VECTOR_3 d_pilot_rwy_rwy_v; // pilot rel. to rwy, in rwy coords.
775 // inline double * get_D_pilot_rwy_rwy_v() { return d_pilot_rwy_rwy_v; }
776 // inline double get_X_pilot_rwy() const { return d_pilot_rwy_rwy_v[0]; }
777 // inline double get_Y_pilot_rwy() const { return d_pilot_rwy_rwy_v[1]; }
778 // inline double get_H_pilot_rwy() const { return d_pilot_rwy_rwy_v[2]; }
779 /* inline void set_Pilot_Rwy_Rwy( double x, double y, double h )
781 d_pilot_rwy_rwy_v[0] = x;
782 d_pilot_rwy_rwy_v[1] = y;
783 d_pilot_rwy_rwy_v[2] = h;
786 double climb_rate; // in feet per second
787 inline double get_Climb_Rate() const { return climb_rate; }
788 inline void set_Climb_Rate(double rate) { climb_rate = rate; }
790 FGTimeStamp valid_stamp; // time this record is valid
791 FGTimeStamp next_stamp; // time this record is valid
792 inline FGTimeStamp get_time_stamp() const { return valid_stamp; }
793 inline void stamp_time() { valid_stamp = next_stamp; next_stamp.stamp(); }
795 // Extrapolate FDM based on time_offset (in usec)
796 void extrapolate( int time_offset );
798 // sin/cos lat_geocentric
799 double sin_lat_geocentric;
800 double cos_lat_geocentric;
801 inline void set_sin_lat_geocentric(double parm) {
802 sin_lat_geocentric = sin(parm);
804 inline void set_cos_lat_geocentric(double parm) {
805 cos_lat_geocentric = cos(parm);
807 inline double get_sin_lat_geocentric(void) const {
808 return sin_lat_geocentric;
810 inline double get_cos_lat_geocentric(void) const {
811 return cos_lat_geocentric;
814 double sin_longitude;
815 double cos_longitude;
816 inline void set_sin_cos_longitude(double parm) {
817 sin_longitude = sin(parm);
818 cos_longitude = cos(parm);
820 inline double get_sin_longitude(void) const {
821 return sin_longitude;
823 inline double get_cos_longitude(void) const {
824 return cos_longitude;
829 inline void set_sin_cos_latitude(double parm) {
830 sin_latitude = sin(parm);
831 cos_latitude = cos(parm);
833 inline double get_sin_latitude(void) const {
836 inline double get_cos_latitude(void) const {
842 extern FGInterface cur_fdm_state;
845 // General interface to the flight model routines
847 // Initialize the flight model parameters
848 int fgFDMInit(int model, FGInterface& f, double dt);
850 // Run multiloop iterations of the flight model
851 int fgFDMUpdate(int model, FGInterface& f, int multiloop, int jitter);
853 // Set the altitude (force)
854 void fgFDMForceAltitude(int model, double alt_meters);
856 // Set the local ground elevation
857 void fgFDMSetGroundElevation(int model, double alt_meters);
860 #endif // _FLIGHT_HXX