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 <Time/timestamp.hxx>
87 # error This library requires C++
91 typedef double FG_VECTOR_3[3];
94 // This is based heavily on LaRCsim/ls_generic.h
99 // Define the various supported flight models (many not yet implemented)
101 // Slew (in MS terminology)
104 // The NASA LaRCsim (Navion) flight model
107 // Jon S. Berndt's new FDM written from the ground up in C++
110 // The following aren't implemented but are here to spark
111 // thoughts and discussions, and maybe even action.
119 // Driven externally via a serial port, net, file, etc.
123 /*================== Mass properties and geometry values ==================*/
126 double mass, i_xx, i_yy, i_zz, i_xz;
127 inline double get_Mass() const { return mass; }
128 inline double get_I_xx() const { return i_xx; }
129 inline double get_I_yy() const { return i_yy; }
130 inline double get_I_zz() const { return i_zz; }
131 inline double get_I_xz() const { return i_xz; }
132 inline void set_Inertias( double m, double xx, double yy,
133 double zz, double xz)
142 // Pilot location rel to ref pt
143 FG_VECTOR_3 d_pilot_rp_body_v;
144 // inline double * get_D_pilot_rp_body_v() {
145 // return d_pilot_rp_body_v;
147 // inline double get_Dx_pilot() const { return d_pilot_rp_body_v[0]; }
148 // inline double get_Dy_pilot() const { return d_pilot_rp_body_v[1]; }
149 // inline double get_Dz_pilot() const { return d_pilot_rp_body_v[2]; }
150 /* inline void set_Pilot_Location( double dx, double dy, double dz ) {
151 d_pilot_rp_body_v[0] = dx;
152 d_pilot_rp_body_v[1] = dy;
153 d_pilot_rp_body_v[2] = dz;
156 // CG position w.r.t. ref. point
157 FG_VECTOR_3 d_cg_rp_body_v;
158 // inline double * get_D_cg_rp_body_v() { return d_cg_rp_body_v; }
159 inline double get_Dx_cg() const { return d_cg_rp_body_v[0]; }
160 inline double get_Dy_cg() const { return d_cg_rp_body_v[1]; }
161 inline double get_Dz_cg() const { return d_cg_rp_body_v[2]; }
162 inline void set_CG_Position( double dx, double dy, double dz ) {
163 d_cg_rp_body_v[0] = dx;
164 d_cg_rp_body_v[1] = dy;
165 d_cg_rp_body_v[2] = dz;
168 /*================================ Forces =================================*/
170 FG_VECTOR_3 f_body_total_v;
171 // inline double * get_F_body_total_v() { return f_body_total_v; }
172 // inline double get_F_X() const { return f_body_total_v[0]; }
173 // inline double get_F_Y() const { return f_body_total_v[1]; }
174 // inline double get_F_Z() const { return f_body_total_v[2]; }
175 /* inline void set_Forces_Body_Total( double x, double y, double z ) {
176 f_body_total_v[0] = x;
177 f_body_total_v[1] = y;
178 f_body_total_v[2] = z;
181 FG_VECTOR_3 f_local_total_v;
182 // inline double * get_F_local_total_v() { return f_local_total_v; }
183 // inline double get_F_north() const { return f_local_total_v[0]; }
184 // inline double get_F_east() const { return f_local_total_v[1]; }
185 // inline double get_F_down() const { return f_local_total_v[2]; }
186 /* inline void set_Forces_Local_Total( double x, double y, double z ) {
187 f_local_total_v[0] = x;
188 f_local_total_v[1] = y;
189 f_local_total_v[2] = z;
192 FG_VECTOR_3 f_aero_v;
193 // inline double * get_F_aero_v() { return f_aero_v; }
194 // inline double get_F_X_aero() const { return f_aero_v[0]; }
195 // inline double get_F_Y_aero() const { return f_aero_v[1]; }
196 // inline double get_F_Z_aero() const { return f_aero_v[2]; }
197 /* inline void set_Forces_Aero( double x, double y, double z ) {
203 FG_VECTOR_3 f_engine_v;
204 // inline double * get_F_engine_v() { return f_engine_v; }
205 // inline double get_F_X_engine() const { return f_engine_v[0]; }
206 // inline double get_F_Y_engine() const { return f_engine_v[1]; }
207 // inline double get_F_Z_engine() const { return f_engine_v[2]; }
208 /* inline void set_Forces_Engine( double x, double y, double z ) {
214 FG_VECTOR_3 f_gear_v;
215 // inline double * get_F_gear_v() { return f_gear_v; }
216 // inline double get_F_X_gear() const { return f_gear_v[0]; }
217 // inline double get_F_Y_gear() const { return f_gear_v[1]; }
218 // inline double get_F_Z_gear() const { return f_gear_v[2]; }
219 /* inline void set_Forces_Gear( double x, double y, double z ) {
225 /*================================ Moments ================================*/
227 FG_VECTOR_3 m_total_rp_v;
228 // inline double * get_M_total_rp_v() { return m_total_rp_v; }
229 // inline double get_M_l_rp() const { return m_total_rp_v[0]; }
230 // inline double get_M_m_rp() const { return m_total_rp_v[1]; }
231 // inline double get_M_n_rp() const { return m_total_rp_v[2]; }
232 /* inline void set_Moments_Total_RP( double l, double m, double n ) {
238 FG_VECTOR_3 m_total_cg_v;
239 // inline double * get_M_total_cg_v() { return m_total_cg_v; }
240 // inline double get_M_l_cg() const { return m_total_cg_v[0]; }
241 // inline double get_M_m_cg() const { return m_total_cg_v[1]; }
242 // inline double get_M_n_cg() const { return m_total_cg_v[2]; }
243 /* inline void set_Moments_Total_CG( double l, double m, double n ) {
249 FG_VECTOR_3 m_aero_v;
250 // inline double * get_M_aero_v() { return m_aero_v; }
251 // inline double get_M_l_aero() const { return m_aero_v[0]; }
252 // inline double get_M_m_aero() const { return m_aero_v[1]; }
253 // inline double get_M_n_aero() const { return m_aero_v[2]; }
254 /* inline void set_Moments_Aero( double l, double m, double n ) {
260 FG_VECTOR_3 m_engine_v;
261 // inline double * get_M_engine_v() { return m_engine_v; }
262 // inline double get_M_l_engine() const { return m_engine_v[0]; }
263 // inline double get_M_m_engine() const { return m_engine_v[1]; }
264 // inline double get_M_n_engine() const { return m_engine_v[2]; }
265 /* inline void set_Moments_Engine( double l, double m, double n ) {
271 FG_VECTOR_3 m_gear_v;
272 // inline double * get_M_gear_v() { return m_gear_v; }
273 // inline double get_M_l_gear() const { return m_gear_v[0]; }
274 // inline double get_M_m_gear() const { return m_gear_v[1]; }
275 // inline double get_M_n_gear() const { return m_gear_v[2]; }
276 /* inline void set_Moments_Gear( double l, double m, double n ) {
282 /*============================== Accelerations ============================*/
284 FG_VECTOR_3 v_dot_local_v;
285 // inline double * get_V_dot_local_v() { return v_dot_local_v; }
286 // inline double get_V_dot_north() const { return v_dot_local_v[0]; }
287 // inline double get_V_dot_east() const { return v_dot_local_v[1]; }
288 // inline double get_V_dot_down() const { return v_dot_local_v[2]; }
289 /* inline void set_Accels_Local( double north, double east, double down ) {
290 v_dot_local_v[0] = north;
291 v_dot_local_v[1] = east;
292 v_dot_local_v[2] = down;
295 FG_VECTOR_3 v_dot_body_v;
296 // inline double * get_V_dot_body_v() { return v_dot_body_v; }
297 // inline double get_U_dot_body() const { return v_dot_body_v[0]; }
298 // inline double get_V_dot_body() const { return v_dot_body_v[1]; }
299 // inline double get_W_dot_body() const { return v_dot_body_v[2]; }
300 /* inline void set_Accels_Body( double u, double v, double w ) {
301 v_dot_local_v[0] = u;
302 v_dot_local_v[1] = v;
303 v_dot_local_v[2] = w;
306 FG_VECTOR_3 a_cg_body_v;
307 // inline double * get_A_cg_body_v() { return a_cg_body_v; }
308 // inline double get_A_X_cg() const { return a_cg_body_v[0]; }
309 // inline double get_A_Y_cg() const { return a_cg_body_v[1]; }
310 // inline double get_A_Z_cg() const { return a_cg_body_v[2]; }
311 /* inline void set_Accels_CG_Body( double x, double y, double z ) {
317 FG_VECTOR_3 a_pilot_body_v;
318 // inline double * get_A_pilot_body_v() { return a_pilot_body_v; }
319 // inline double get_A_X_pilot() const { return a_pilot_body_v[0]; }
320 // inline double get_A_Y_pilot() const { return a_pilot_body_v[1]; }
321 // inline double get_A_Z_pilot() const { return a_pilot_body_v[2]; }
322 /* inline void set_Accels_Pilot_Body( double x, double y, double z ) {
323 a_pilot_body_v[0] = x;
324 a_pilot_body_v[1] = y;
325 a_pilot_body_v[2] = z;
328 FG_VECTOR_3 n_cg_body_v;
329 // inline double * get_N_cg_body_v() { return n_cg_body_v; }
330 // inline double get_N_X_cg() const { return n_cg_body_v[0]; }
331 // inline double get_N_Y_cg() const { return n_cg_body_v[1]; }
332 // inline double get_N_Z_cg() const { return n_cg_body_v[2]; }
333 /* inline void set_Accels_CG_Body_N( double x, double y, double z ) {
339 FG_VECTOR_3 n_pilot_body_v;
340 // inline double * get_N_pilot_body_v() { return n_pilot_body_v; }
341 // inline double get_N_X_pilot() const { return n_pilot_body_v[0]; }
342 // inline double get_N_Y_pilot() const { return n_pilot_body_v[1]; }
343 // inline double get_N_Z_pilot() const { return n_pilot_body_v[2]; }
344 /* inline void set_Accels_Pilot_Body_N( double x, double y, double z ) {
345 n_pilot_body_v[0] = x;
346 n_pilot_body_v[1] = y;
347 n_pilot_body_v[2] = z;
350 FG_VECTOR_3 omega_dot_body_v;
351 // inline double * get_Omega_dot_body_v() { return omega_dot_body_v; }
352 // inline double get_P_dot_body() const { return omega_dot_body_v[0]; }
353 // inline double get_Q_dot_body() const { return omega_dot_body_v[1]; }
354 // inline double get_R_dot_body() const { return omega_dot_body_v[2]; }
355 /* inline void set_Accels_Omega( double p, double q, double r ) {
356 omega_dot_body_v[0] = p;
357 omega_dot_body_v[1] = q;
358 omega_dot_body_v[2] = r;
362 /*============================== Velocities ===============================*/
364 FG_VECTOR_3 v_local_v;
365 // inline double * get_V_local_v() { return v_local_v; }
366 inline double get_V_north() const { return v_local_v[0]; }
367 inline double get_V_east() const { return v_local_v[1]; }
368 inline double get_V_down() const { return v_local_v[2]; }
369 inline void set_Velocities_Local( double north, double east, double down ) {
370 v_local_v[0] = north;
375 FG_VECTOR_3 v_local_rel_ground_v; // V rel w.r.t. earth surface
376 // inline double * get_V_local_rel_ground_v() { return v_local_rel_ground_v; }
377 // inline double get_V_north_rel_ground() const {
378 // return v_local_rel_ground_v[0];
380 // inline double get_V_east_rel_ground() const {
381 // return v_local_rel_ground_v[1];
383 // inline double get_V_down_rel_ground() const {
384 // return v_local_rel_ground_v[2];
386 /* inline void set_Velocities_Ground(double north, double east, double down) {
387 v_local_rel_ground_v[0] = north;
388 v_local_rel_ground_v[1] = east;
389 v_local_rel_ground_v[2] = down;
392 FG_VECTOR_3 v_local_airmass_v; // velocity of airmass (steady winds)
393 // inline double * get_V_local_airmass_v() { return v_local_airmass_v; }
394 // inline double get_V_north_airmass() const { return v_local_airmass_v[0]; }
395 // inline double get_V_east_airmass() const { return v_local_airmass_v[1]; }
396 // inline double get_V_down_airmass() const { return v_local_airmass_v[2]; }
397 /* inline void set_Velocities_Local_Airmass( double north, double east,
400 v_local_airmass_v[0] = north;
401 v_local_airmass_v[1] = east;
402 v_local_airmass_v[2] = down;
405 FG_VECTOR_3 v_local_rel_airmass_v; // velocity of veh. relative to
407 // inline double * get_V_local_rel_airmass_v() {
408 //return v_local_rel_airmass_v;
410 // inline double get_V_north_rel_airmass() const {
411 //return v_local_rel_airmass_v[0];
413 // inline double get_V_east_rel_airmass() const {
414 //return v_local_rel_airmass_v[1];
416 // inline double get_V_down_rel_airmass() const {
417 //return v_local_rel_airmass_v[2];
419 /* inline void set_Velocities_Local_Rel_Airmass( double north, double east,
422 v_local_rel_airmass_v[0] = north;
423 v_local_rel_airmass_v[1] = east;
424 v_local_rel_airmass_v[2] = down;
427 FG_VECTOR_3 v_local_gust_v; // linear turbulence components, L frame
428 // inline double * get_V_local_gust_v() { return v_local_gust_v; }
429 // inline double get_U_gust() const { return v_local_gust_v[0]; }
430 // inline double get_V_gust() const { return v_local_gust_v[1]; }
431 // inline double get_W_gust() const { return v_local_gust_v[2]; }
432 /* inline void set_Velocities_Gust( double u, double v, double w)
434 v_local_gust_v[0] = u;
435 v_local_gust_v[1] = v;
436 v_local_gust_v[2] = w;
439 FG_VECTOR_3 v_wind_body_v; // Wind-relative velocities in body axis
440 // inline double * get_V_wind_body_v() { return v_wind_body_v; }
441 // inline double get_U_body() const { return v_wind_body_v[0]; }
442 // inline double get_V_body() const { return v_wind_body_v[1]; }
443 // inline double get_W_body() const { return v_wind_body_v[2]; }
444 /* inline void set_Velocities_Wind_Body( double u, double v, double w)
446 v_wind_body_v[0] = u;
447 v_wind_body_v[1] = v;
448 v_wind_body_v[2] = w;
451 double v_rel_wind, v_true_kts, v_rel_ground, v_inertial;
452 double v_ground_speed, v_equiv, v_equiv_kts;
453 double v_calibrated, v_calibrated_kts;
455 // inline double get_V_rel_wind() const { return v_rel_wind; }
456 // inline void set_V_rel_wind(double wind) { v_rel_wind = wind; }
458 // inline double get_V_true_kts() const { return v_true_kts; }
459 // inline void set_V_true_kts(double kts) { v_true_kts = kts; }
461 // inline double get_V_rel_ground() const { return v_rel_ground; }
462 // inline void set_V_rel_ground( double v ) { v_rel_ground = v; }
464 // inline double get_V_inertial() const { return v_inertial; }
465 // inline void set_V_inertial(double v) { v_inertial = v; }
467 // inline double get_V_ground_speed() const { return v_ground_speed; }
468 // inline void set_V_ground_speed( double v) { v_ground_speed = v; }
470 // inline double get_V_equiv() const { return v_equiv; }
471 // inline void set_V_equiv( double v ) { v_equiv = v; }
473 inline double get_V_equiv_kts() const { return v_equiv_kts; }
474 inline void set_V_equiv_kts( double kts ) { v_equiv_kts = kts; }
476 // inline double get_V_calibrated() const { return v_calibrated; }
477 // inline void set_V_calibrated( double v ) { v_calibrated = v; }
479 // inline double get_V_calibrated_kts() const { return v_calibrated_kts; }
480 // inline void set_V_calibrated_kts( double kts ) { v_calibrated_kts = kts; }
482 FG_VECTOR_3 omega_body_v; // Angular B rates
483 // inline double * get_Omega_body_v() { return omega_body_v; }
484 inline double get_P_body() const { return omega_body_v[0]; }
485 inline double get_Q_body() const { return omega_body_v[1]; }
486 inline double get_R_body() const { return omega_body_v[2]; }
487 inline void set_Omega_Body( double p, double q, double r ) {
493 FG_VECTOR_3 omega_local_v; // Angular L rates
494 // inline double * get_Omega_local_v() { return omega_local_v; }
495 // inline double get_P_local() const { return omega_local_v[0]; }
496 // inline double get_Q_local() const { return omega_local_v[1]; }
497 // inline double get_R_local() const { return omega_local_v[2]; }
498 /* inline void set_Omega_Local( double p, double q, double r ) {
499 omega_local_v[0] = p;
500 omega_local_v[1] = q;
501 omega_local_v[2] = r;
504 FG_VECTOR_3 omega_total_v; // Diff btw B & L
505 // inline double * get_Omega_total_v() { return omega_total_v; }
506 // inline double get_P_total() const { return omega_total_v[0]; }
507 // inline double get_Q_total() const { return omega_total_v[1]; }
508 // inline double get_R_total() const { return omega_total_v[2]; }
509 /* inline void set_Omega_Total( double p, double q, double r ) {
510 omega_total_v[0] = p;
511 omega_total_v[1] = q;
512 omega_total_v[2] = r;
515 FG_VECTOR_3 euler_rates_v;
516 // inline double * get_Euler_rates_v() { return euler_rates_v; }
517 // inline double get_Phi_dot() const { return euler_rates_v[0]; }
518 // inline double get_Theta_dot() const { return euler_rates_v[1]; }
519 // inline double get_Psi_dot() const { return euler_rates_v[2]; }
520 /* inline void set_Euler_Rates( double phi, double theta, double psi ) {
521 euler_rates_v[0] = phi;
522 euler_rates_v[1] = theta;
523 euler_rates_v[2] = psi;
526 FG_VECTOR_3 geocentric_rates_v; // Geocentric linear velocities
527 // inline double * get_Geocentric_rates_v() { return geocentric_rates_v; }
528 inline double get_Latitude_dot() const { return geocentric_rates_v[0]; }
529 inline double get_Longitude_dot() const { return geocentric_rates_v[1]; }
530 inline double get_Radius_dot() const { return geocentric_rates_v[2]; }
531 inline void set_Geocentric_Rates( double lat, double lon, double rad ) {
532 geocentric_rates_v[0] = lat;
533 geocentric_rates_v[1] = lon;
534 geocentric_rates_v[2] = rad;
537 /*=============================== Positions ===============================*/
539 FG_VECTOR_3 geocentric_position_v;
540 // inline double * get_Geocentric_position_v() {
541 // return geocentric_position_v;
543 inline double get_Lat_geocentric() const {
544 return geocentric_position_v[0];
546 inline double get_Lon_geocentric() const {
547 return geocentric_position_v[1];
549 inline double get_Radius_to_vehicle() const {
550 return geocentric_position_v[2];
552 inline void set_Radius_to_vehicle(double radius) {
553 geocentric_position_v[2] = radius;
556 inline void set_Geocentric_Position( double lat, double lon, double rad ) {
557 geocentric_position_v[0] = lat;
558 geocentric_position_v[1] = lon;
559 geocentric_position_v[2] = rad;
562 FG_VECTOR_3 geodetic_position_v;
563 // inline double * get_Geodetic_position_v() { return geodetic_position_v; }
564 inline double get_Latitude() const { return geodetic_position_v[0]; }
565 inline void set_Latitude(double lat) { geodetic_position_v[0] = lat; }
566 inline double get_Longitude() const { return geodetic_position_v[1]; }
567 inline void set_Longitude(double lon) { geodetic_position_v[1] = lon; }
568 inline double get_Altitude() const { return geodetic_position_v[2]; }
569 inline void set_Altitude(double altitude) {
570 geodetic_position_v[2] = altitude;
572 inline void set_Geodetic_Position( double lat, double lon, double alt ) {
573 geodetic_position_v[0] = lat;
574 geodetic_position_v[1] = lon;
575 geodetic_position_v[2] = alt;
578 FG_VECTOR_3 euler_angles_v;
579 // inline double * get_Euler_angles_v() { return euler_angles_v; }
580 inline double get_Phi() const { return euler_angles_v[0]; }
581 inline double get_Theta() const { return euler_angles_v[1]; }
582 inline double get_Psi() const { return euler_angles_v[2]; }
583 inline void set_Euler_Angles( double phi, double theta, double psi ) {
584 euler_angles_v[0] = phi;
585 euler_angles_v[1] = theta;
586 euler_angles_v[2] = psi;
590 /*======================= Miscellaneous quantities ========================*/
592 double t_local_to_body_m[3][3]; // Transformation matrix L to B
593 // inline double * get_T_local_to_body_m() { return t_local_to_body_m; }
594 inline double get_T_local_to_body_11() const {
595 return t_local_to_body_m[0][0];
597 inline double get_T_local_to_body_12() const {
598 return t_local_to_body_m[0][1];
600 inline double get_T_local_to_body_13() const {
601 return t_local_to_body_m[0][2];
603 inline double get_T_local_to_body_21() const {
604 return t_local_to_body_m[1][0];
606 inline double get_T_local_to_body_22() const {
607 return t_local_to_body_m[1][1];
609 inline double get_T_local_to_body_23() const {
610 return t_local_to_body_m[1][2];
612 inline double get_T_local_to_body_31() const {
613 return t_local_to_body_m[2][0];
615 inline double get_T_local_to_body_32() const {
616 return t_local_to_body_m[2][1];
618 inline double get_T_local_to_body_33() const {
619 return t_local_to_body_m[2][2];
621 inline void set_T_Local_to_Body( double m[3][3] ) {
623 for ( i = 0; i < 3; i++ ) {
624 for ( j = 0; j < 3; j++ ) {
625 t_local_to_body_m[i][j] = m[i][j];
630 double gravity; // Local acceleration due to G
631 // inline double get_Gravity() const { return gravity; }
632 // inline void set_Gravity(double g) { gravity = g; }
634 double centrifugal_relief; // load factor reduction due to speed
635 // inline double get_Centrifugal_relief() const { return centrifugal_relief; }
636 // inline void set_Centrifugal_relief(double cr) { centrifugal_relief = cr; }
638 double alpha, beta, alpha_dot, beta_dot; // in radians
639 inline double get_Alpha() const { return alpha; }
640 inline void set_Alpha( double a ) { alpha = a; }
641 inline double get_Beta() const { return beta; }
642 inline void set_Beta( double b ) { beta = b; }
643 // inline double get_Alpha_dot() const { return alpha_dot; }
644 // inline void set_Alpha_dot( double ad ) { alpha_dot = ad; }
645 // inline double get_Beta_dot() const { return beta_dot; }
646 // inline void set_Beta_dot( double bd ) { beta_dot = bd; }
648 double cos_alpha, sin_alpha, cos_beta, sin_beta;
649 // inline double get_Cos_alpha() const { return cos_alpha; }
650 // inline void set_Cos_alpha( double ca ) { cos_alpha = ca; }
651 // inline double get_Sin_alpha() const { return sin_alpha; }
652 // inline void set_Sin_alpha( double sa ) { sin_alpha = sa; }
653 // inline double get_Cos_beta() const { return cos_beta; }
654 // inline void set_Cos_beta( double cb ) { cos_beta = cb; }
655 // inline double get_Sin_beta() const { return sin_beta; }
656 // inline void set_Sin_beta( double sb ) { sin_beta = sb; }
658 double cos_phi, sin_phi, cos_theta, sin_theta, cos_psi, sin_psi;
659 // inline double get_Cos_phi() const { return cos_phi; }
660 // inline void set_Cos_phi( double cp ) { cos_phi = cp; }
661 // inline double get_Sin_phi() const { return sin_phi; }
662 // inline void set_Sin_phi( double sp ) { sin_phi = sp; }
663 // inline double get_Cos_theta() const { return cos_theta; }
664 // inline void set_Cos_theta( double ct ) { cos_theta = ct; }
665 // inline double get_Sin_theta() const { return sin_theta; }
666 // inline void set_Sin_theta( double st ) { sin_theta = st; }
667 // inline double get_Cos_psi() const { return cos_psi; }
668 // inline void set_Cos_psi( double cp ) { cos_psi = cp; }
669 // inline double get_Sin_psi() const { return sin_psi; }
670 // inline void set_Sin_psi( double sp ) { sin_psi = sp; }
672 double gamma_vert_rad, gamma_horiz_rad; // Flight path angles
673 inline double get_Gamma_vert_rad() const { return gamma_vert_rad; }
674 inline void set_Gamma_vert_rad( double gv ) { gamma_vert_rad = gv; }
675 // inline double get_Gamma_horiz_rad() const { return gamma_horiz_rad; }
676 // inline void set_Gamma_horiz_rad( double gh ) { gamma_horiz_rad = gh; }
678 double sigma, density, v_sound, mach_number;
679 // inline double get_Sigma() const { return sigma; }
680 // inline void set_Sigma( double s ) { sigma = s; }
681 // inline double get_Density() const { return density; }
682 // inline void set_Density( double d ) { density = d; }
683 // inline double get_V_sound() const { return v_sound; }
684 // inline void set_V_sound( double v ) { v_sound = v; }
685 // inline double get_Mach_number() const { return mach_number; }
686 // inline void set_Mach_number( double m ) { mach_number = m; }
688 double static_pressure, total_pressure, impact_pressure;
689 double dynamic_pressure;
690 // inline double get_Static_pressure() const { return static_pressure; }
691 // inline void set_Static_pressure( double sp ) { static_pressure = sp; }
692 // inline double get_Total_pressure() const { return total_pressure; }
693 // inline void set_Total_pressure( double tp ) { total_pressure = tp; }
694 // inline double get_Impact_pressure() const { return impact_pressure; }
695 // inline void set_Impact_pressure( double ip ) { impact_pressure = ip; }
696 // inline double get_Dynamic_pressure() const { return dynamic_pressure; }
697 // inline void set_Dynamic_pressure( double dp ) { dynamic_pressure = dp; }
699 double static_temperature, total_temperature;
700 // inline double get_Static_temperature() const { return static_temperature; }
701 // inline void set_Static_temperature( double t ) { static_temperature = t; }
702 // inline double get_Total_temperature() const { return total_temperature; }
703 // inline void set_Total_temperature( double t ) { total_temperature = t; }
705 double sea_level_radius, earth_position_angle;
706 inline double get_Sea_level_radius() const { return sea_level_radius; }
707 inline void set_Sea_level_radius( double r ) { sea_level_radius = r; }
708 inline double get_Earth_position_angle() const {
709 return earth_position_angle;
711 inline void set_Earth_position_angle(double a) {
712 earth_position_angle = a;
715 double runway_altitude, runway_latitude, runway_longitude;
716 double runway_heading;
717 inline double get_Runway_altitude() const { return runway_altitude; }
718 inline void set_Runway_altitude( double alt ) { runway_altitude = alt; }
719 // inline double get_Runway_latitude() const { return runway_latitude; }
720 // inline void set_Runway_latitude( double lat ) { runway_latitude = lat; }
721 // inline double get_Runway_longitude() const { return runway_longitude; }
722 // inline void set_Runway_longitude( double lon ) { runway_longitude = lon; }
723 // inline double get_Runway_heading() const { return runway_heading; }
724 // inline void set_Runway_heading( double h ) { runway_heading = h; }
726 double radius_to_rwy;
727 // inline double get_Radius_to_rwy() const { return radius_to_rwy; }
728 // inline void set_Radius_to_rwy( double r ) { radius_to_rwy = r; }
730 FG_VECTOR_3 d_cg_rwy_local_v; // CG rel. to rwy in local coords
731 // inline double * get_D_cg_rwy_local_v() { return d_cg_rwy_local_v; }
732 // inline double get_D_cg_north_of_rwy() const { return d_cg_rwy_local_v[0]; }
733 // inline double get_D_cg_east_of_rwy() const { return d_cg_rwy_local_v[1]; }
734 // inline double get_D_cg_above_rwy() const { return d_cg_rwy_local_v[2]; }
735 /* inline void set_CG_Rwy_Local( double north, double east, double above )
737 d_cg_rwy_local_v[0] = north;
738 d_cg_rwy_local_v[1] = east;
739 d_cg_rwy_local_v[2] = above;
742 FG_VECTOR_3 d_cg_rwy_rwy_v; // CG relative to rwy, in rwy coordinates
743 // inline double * get_D_cg_rwy_rwy_v() { return d_cg_rwy_rwy_v; }
744 // inline double get_X_cg_rwy() const { return d_cg_rwy_rwy_v[0]; }
745 // inline double get_Y_cg_rwy() const { return d_cg_rwy_rwy_v[1]; }
746 // inline double get_H_cg_rwy() const { return d_cg_rwy_rwy_v[2]; }
747 /* inline void set_CG_Rwy_Rwy( double x, double y, double h )
749 d_cg_rwy_rwy_v[0] = x;
750 d_cg_rwy_rwy_v[1] = y;
751 d_cg_rwy_rwy_v[2] = h;
754 FG_VECTOR_3 d_pilot_rwy_local_v; // pilot rel. to rwy in local coords
755 // inline double * get_D_pilot_rwy_local_v() { return d_pilot_rwy_local_v; }
756 // inline double get_D_pilot_north_of_rwy() const {
757 //return d_pilot_rwy_local_v[0];
759 // inline double get_D_pilot_east_of_rwy() const {
760 // return d_pilot_rwy_local_v[1];
762 // inline double get_D_pilot_above_rwy() const {
763 //return d_pilot_rwy_local_v[2];
765 /* inline void set_Pilot_Rwy_Local( double north, double east, double above )
767 d_pilot_rwy_local_v[0] = north;
768 d_pilot_rwy_local_v[1] = east;
769 d_pilot_rwy_local_v[2] = above;
772 FG_VECTOR_3 d_pilot_rwy_rwy_v; // pilot rel. to rwy, in rwy coords.
773 // inline double * get_D_pilot_rwy_rwy_v() { return d_pilot_rwy_rwy_v; }
774 // inline double get_X_pilot_rwy() const { return d_pilot_rwy_rwy_v[0]; }
775 // inline double get_Y_pilot_rwy() const { return d_pilot_rwy_rwy_v[1]; }
776 // inline double get_H_pilot_rwy() const { return d_pilot_rwy_rwy_v[2]; }
777 /* inline void set_Pilot_Rwy_Rwy( double x, double y, double h )
779 d_pilot_rwy_rwy_v[0] = x;
780 d_pilot_rwy_rwy_v[1] = y;
781 d_pilot_rwy_rwy_v[2] = h;
784 double climb_rate; // in feet per second
785 inline double get_Climb_Rate() const { return climb_rate; }
786 inline void set_Climb_Rate(double rate) { climb_rate = rate; }
788 FGTimeStamp valid_stamp; // time this record is valid
789 FGTimeStamp next_stamp; // time this record is valid
790 inline FGTimeStamp get_time_stamp() const { return valid_stamp; }
791 inline void stamp_time() { valid_stamp = next_stamp; next_stamp.stamp(); }
793 // Extrapolate FDM based on time_offset (in usec)
794 void extrapolate( int time_offset );
796 // sin/cos lat_geocentric
797 double sin_lat_geocentric;
798 double cos_lat_geocentric;
799 inline void set_sin_lat_geocentric(double parm) {
800 sin_lat_geocentric = sin(parm);
802 inline void set_cos_lat_geocentric(double parm) {
803 cos_lat_geocentric = cos(parm);
805 inline double get_sin_lat_geocentric(void) const {
806 return sin_lat_geocentric;
808 inline double get_cos_lat_geocentric(void) const {
809 return cos_lat_geocentric;
812 double sin_longitude;
813 double cos_longitude;
814 inline void set_sin_cos_longitude(double parm) {
815 sin_longitude = sin(parm);
816 cos_longitude = cos(parm);
818 inline double get_sin_longitude(void) const {
819 return sin_longitude;
821 inline double get_cos_longitude(void) const {
822 return cos_longitude;
827 inline void set_sin_cos_latitude(double parm) {
828 sin_latitude = sin(parm);
829 cos_latitude = cos(parm);
831 inline double get_sin_latitude(void) const {
834 inline double get_cos_latitude(void) const {
840 extern FGInterface cur_fdm_state;
843 // General interface to the flight model routines
845 // Initialize the flight model parameters
846 int fgFDMInit(int model, FGInterface& f, double dt);
848 // Run multiloop iterations of the flight model
849 int fgFDMUpdate(int model, FGInterface& f, int multiloop, int jitter);
851 // Set the altitude (force)
852 void fgFDMForceAltitude(int model, double alt_meters);
854 // Set the local ground elevation
855 void fgFDMSetGroundElevation(int model, double alt_meters);
858 #endif // _FLIGHT_HXX