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.
22 // (Log is kept at end of this file)
30 # error This library requires C++
36 `FGInterface::get_Longitude ()'
37 `FGInterface::get_Latitude ()'
38 `FGInterface::get_Altitude ()'
39 `FGInterface::get_Phi ()'
40 `FGInterface::get_Theta ()'
41 `FGInterface::get_Psi ()'
42 `FGInterface::get_V_equiv_kts ()'
44 `FGInterface::get_Mass ()'
45 `FGInterface::get_I_xx ()'
46 `FGInterface::get_I_yy ()'
47 `FGInterface::get_I_zz ()'
48 `FGInterface::get_I_xz ()'
50 `FGInterface::get_V_north ()'
51 `FGInterface::get_V_east ()'
52 `FGInterface::get_V_down ()'
54 `FGInterface::get_P_Body ()'
55 `FGInterface::get_Q_Body ()'
56 `FGInterface::get_R_Body ()'
58 `FGInterface::get_Gamma_vert_rad ()'
59 `FGInterface::get_Climb_Rate ()'
60 `FGInterface::get_Alpha ()'
61 `FGInterface::get_Beta ()'
63 `FGInterface::get_Runway_altitude ()'
65 `FGInterface::get_Lon_geocentric ()'
66 `FGInterface::get_Lat_geocentric ()'
67 `FGInterface::get_Sea_level_radius ()'
68 `FGInterface::get_Earth_position_angle ()'
70 `FGInterface::get_Latitude_dot()'
71 `FGInterface::get_Longitude_dot()'
72 `FGInterface::get_Radius_dot()'
74 `FGInterface::get_Dx_cg ()'
75 `FGInterface::get_Dy_cg ()'
76 `FGInterface::get_Dz_cg ()'
78 `FGInterface::get_T_local_to_body_11 ()' ... `FGInterface::get_T_local_to_body_33 ()'
80 `FGInterface::get_Radius_to_vehicle ()'
85 #include <Time/timestamp.hxx>
88 # error This library requires C++
92 typedef double FG_VECTOR_3[3];
95 // This is based heavily on LaRCsim/ls_generic.h
100 // Define the various supported flight models (many not yet implemented)
102 // Slew (in MS terminology)
105 // The NASA LaRCsim (Navion) flight model
108 // Jon S. Berndt's new FDM written from the ground up in C++
111 // The following aren't implemented but are here to spark
112 // thoughts and discussions, and maybe even action.
120 // Driven externally via a serial port, net, file, etc.
124 /*================== Mass properties and geometry values ==================*/
127 double mass, i_xx, i_yy, i_zz, i_xz;
128 inline double get_Mass() const { return mass; }
129 inline double get_I_xx() const { return i_xx; }
130 inline double get_I_yy() const { return i_yy; }
131 inline double get_I_zz() const { return i_zz; }
132 inline double get_I_xz() const { return i_xz; }
133 inline void set_Inertias( double m, double xx, double yy,
134 double zz, double xz)
143 // Pilot location rel to ref pt
144 FG_VECTOR_3 d_pilot_rp_body_v;
145 // inline double * get_D_pilot_rp_body_v() {
146 // return d_pilot_rp_body_v;
148 // inline double get_Dx_pilot() const { return d_pilot_rp_body_v[0]; }
149 // inline double get_Dy_pilot() const { return d_pilot_rp_body_v[1]; }
150 // inline double get_Dz_pilot() const { return d_pilot_rp_body_v[2]; }
151 /* inline void set_Pilot_Location( double dx, double dy, double dz ) {
152 d_pilot_rp_body_v[0] = dx;
153 d_pilot_rp_body_v[1] = dy;
154 d_pilot_rp_body_v[2] = dz;
157 // CG position w.r.t. ref. point
158 FG_VECTOR_3 d_cg_rp_body_v;
159 // inline double * get_D_cg_rp_body_v() { return d_cg_rp_body_v; }
160 inline double get_Dx_cg() const { return d_cg_rp_body_v[0]; }
161 inline double get_Dy_cg() const { return d_cg_rp_body_v[1]; }
162 inline double get_Dz_cg() const { return d_cg_rp_body_v[2]; }
163 inline void set_CG_Position( double dx, double dy, double dz ) {
164 d_cg_rp_body_v[0] = dx;
165 d_cg_rp_body_v[1] = dy;
166 d_cg_rp_body_v[2] = dz;
169 /*================================ Forces =================================*/
171 FG_VECTOR_3 f_body_total_v;
172 // inline double * get_F_body_total_v() { return f_body_total_v; }
173 // inline double get_F_X() const { return f_body_total_v[0]; }
174 // inline double get_F_Y() const { return f_body_total_v[1]; }
175 // inline double get_F_Z() const { return f_body_total_v[2]; }
176 /* inline void set_Forces_Body_Total( double x, double y, double z ) {
177 f_body_total_v[0] = x;
178 f_body_total_v[1] = y;
179 f_body_total_v[2] = z;
182 FG_VECTOR_3 f_local_total_v;
183 // inline double * get_F_local_total_v() { return f_local_total_v; }
184 // inline double get_F_north() const { return f_local_total_v[0]; }
185 // inline double get_F_east() const { return f_local_total_v[1]; }
186 // inline double get_F_down() const { return f_local_total_v[2]; }
187 /* inline void set_Forces_Local_Total( double x, double y, double z ) {
188 f_local_total_v[0] = x;
189 f_local_total_v[1] = y;
190 f_local_total_v[2] = z;
193 FG_VECTOR_3 f_aero_v;
194 // inline double * get_F_aero_v() { return f_aero_v; }
195 // inline double get_F_X_aero() const { return f_aero_v[0]; }
196 // inline double get_F_Y_aero() const { return f_aero_v[1]; }
197 // inline double get_F_Z_aero() const { return f_aero_v[2]; }
198 /* inline void set_Forces_Aero( double x, double y, double z ) {
204 FG_VECTOR_3 f_engine_v;
205 // inline double * get_F_engine_v() { return f_engine_v; }
206 // inline double get_F_X_engine() const { return f_engine_v[0]; }
207 // inline double get_F_Y_engine() const { return f_engine_v[1]; }
208 // inline double get_F_Z_engine() const { return f_engine_v[2]; }
209 /* inline void set_Forces_Engine( double x, double y, double z ) {
215 FG_VECTOR_3 f_gear_v;
216 // inline double * get_F_gear_v() { return f_gear_v; }
217 // inline double get_F_X_gear() const { return f_gear_v[0]; }
218 // inline double get_F_Y_gear() const { return f_gear_v[1]; }
219 // inline double get_F_Z_gear() const { return f_gear_v[2]; }
220 /* inline void set_Forces_Gear( double x, double y, double z ) {
226 /*================================ Moments ================================*/
228 FG_VECTOR_3 m_total_rp_v;
229 // inline double * get_M_total_rp_v() { return m_total_rp_v; }
230 // inline double get_M_l_rp() const { return m_total_rp_v[0]; }
231 // inline double get_M_m_rp() const { return m_total_rp_v[1]; }
232 // inline double get_M_n_rp() const { return m_total_rp_v[2]; }
233 /* inline void set_Moments_Total_RP( double l, double m, double n ) {
239 FG_VECTOR_3 m_total_cg_v;
240 // inline double * get_M_total_cg_v() { return m_total_cg_v; }
241 // inline double get_M_l_cg() const { return m_total_cg_v[0]; }
242 // inline double get_M_m_cg() const { return m_total_cg_v[1]; }
243 // inline double get_M_n_cg() const { return m_total_cg_v[2]; }
244 /* inline void set_Moments_Total_CG( double l, double m, double n ) {
250 FG_VECTOR_3 m_aero_v;
251 // inline double * get_M_aero_v() { return m_aero_v; }
252 // inline double get_M_l_aero() const { return m_aero_v[0]; }
253 // inline double get_M_m_aero() const { return m_aero_v[1]; }
254 // inline double get_M_n_aero() const { return m_aero_v[2]; }
255 /* inline void set_Moments_Aero( double l, double m, double n ) {
261 FG_VECTOR_3 m_engine_v;
262 // inline double * get_M_engine_v() { return m_engine_v; }
263 // inline double get_M_l_engine() const { return m_engine_v[0]; }
264 // inline double get_M_m_engine() const { return m_engine_v[1]; }
265 // inline double get_M_n_engine() const { return m_engine_v[2]; }
266 /* inline void set_Moments_Engine( double l, double m, double n ) {
272 FG_VECTOR_3 m_gear_v;
273 // inline double * get_M_gear_v() { return m_gear_v; }
274 // inline double get_M_l_gear() const { return m_gear_v[0]; }
275 // inline double get_M_m_gear() const { return m_gear_v[1]; }
276 // inline double get_M_n_gear() const { return m_gear_v[2]; }
277 /* inline void set_Moments_Gear( double l, double m, double n ) {
283 /*============================== Accelerations ============================*/
285 FG_VECTOR_3 v_dot_local_v;
286 // inline double * get_V_dot_local_v() { return v_dot_local_v; }
287 // inline double get_V_dot_north() const { return v_dot_local_v[0]; }
288 // inline double get_V_dot_east() const { return v_dot_local_v[1]; }
289 // inline double get_V_dot_down() const { return v_dot_local_v[2]; }
290 /* inline void set_Accels_Local( double north, double east, double down ) {
291 v_dot_local_v[0] = north;
292 v_dot_local_v[1] = east;
293 v_dot_local_v[2] = down;
296 FG_VECTOR_3 v_dot_body_v;
297 // inline double * get_V_dot_body_v() { return v_dot_body_v; }
298 // inline double get_U_dot_body() const { return v_dot_body_v[0]; }
299 // inline double get_V_dot_body() const { return v_dot_body_v[1]; }
300 // inline double get_W_dot_body() const { return v_dot_body_v[2]; }
301 /* inline void set_Accels_Body( double u, double v, double w ) {
302 v_dot_local_v[0] = u;
303 v_dot_local_v[1] = v;
304 v_dot_local_v[2] = w;
307 FG_VECTOR_3 a_cg_body_v;
308 // inline double * get_A_cg_body_v() { return a_cg_body_v; }
309 // inline double get_A_X_cg() const { return a_cg_body_v[0]; }
310 // inline double get_A_Y_cg() const { return a_cg_body_v[1]; }
311 // inline double get_A_Z_cg() const { return a_cg_body_v[2]; }
312 /* inline void set_Accels_CG_Body( double x, double y, double z ) {
318 FG_VECTOR_3 a_pilot_body_v;
319 // inline double * get_A_pilot_body_v() { return a_pilot_body_v; }
320 // inline double get_A_X_pilot() const { return a_pilot_body_v[0]; }
321 // inline double get_A_Y_pilot() const { return a_pilot_body_v[1]; }
322 // inline double get_A_Z_pilot() const { return a_pilot_body_v[2]; }
323 /* inline void set_Accels_Pilot_Body( double x, double y, double z ) {
324 a_pilot_body_v[0] = x;
325 a_pilot_body_v[1] = y;
326 a_pilot_body_v[2] = z;
329 FG_VECTOR_3 n_cg_body_v;
330 // inline double * get_N_cg_body_v() { return n_cg_body_v; }
331 // inline double get_N_X_cg() const { return n_cg_body_v[0]; }
332 // inline double get_N_Y_cg() const { return n_cg_body_v[1]; }
333 // inline double get_N_Z_cg() const { return n_cg_body_v[2]; }
334 /* inline void set_Accels_CG_Body_N( double x, double y, double z ) {
340 FG_VECTOR_3 n_pilot_body_v;
341 // inline double * get_N_pilot_body_v() { return n_pilot_body_v; }
342 // inline double get_N_X_pilot() const { return n_pilot_body_v[0]; }
343 // inline double get_N_Y_pilot() const { return n_pilot_body_v[1]; }
344 // inline double get_N_Z_pilot() const { return n_pilot_body_v[2]; }
345 /* inline void set_Accels_Pilot_Body_N( double x, double y, double z ) {
346 n_pilot_body_v[0] = x;
347 n_pilot_body_v[1] = y;
348 n_pilot_body_v[2] = z;
351 FG_VECTOR_3 omega_dot_body_v;
352 // inline double * get_Omega_dot_body_v() { return omega_dot_body_v; }
353 // inline double get_P_dot_body() const { return omega_dot_body_v[0]; }
354 // inline double get_Q_dot_body() const { return omega_dot_body_v[1]; }
355 // inline double get_R_dot_body() const { return omega_dot_body_v[2]; }
356 /* inline void set_Accels_Omega( double p, double q, double r ) {
357 omega_dot_body_v[0] = p;
358 omega_dot_body_v[1] = q;
359 omega_dot_body_v[2] = r;
363 /*============================== Velocities ===============================*/
365 FG_VECTOR_3 v_local_v;
366 // inline double * get_V_local_v() { return v_local_v; }
367 inline double get_V_north() const { return v_local_v[0]; }
368 inline double get_V_east() const { return v_local_v[1]; }
369 inline double get_V_down() const { return v_local_v[2]; }
370 inline void set_Velocities_Local( double north, double east, double down ) {
371 v_local_v[0] = north;
376 FG_VECTOR_3 v_local_rel_ground_v; // V rel w.r.t. earth surface
377 // inline double * get_V_local_rel_ground_v() { return v_local_rel_ground_v; }
378 // inline double get_V_north_rel_ground() const {
379 // return v_local_rel_ground_v[0];
381 // inline double get_V_east_rel_ground() const {
382 // return v_local_rel_ground_v[1];
384 // inline double get_V_down_rel_ground() const {
385 // return v_local_rel_ground_v[2];
387 /* inline void set_Velocities_Ground(double north, double east, double down) {
388 v_local_rel_ground_v[0] = north;
389 v_local_rel_ground_v[1] = east;
390 v_local_rel_ground_v[2] = down;
393 FG_VECTOR_3 v_local_airmass_v; // velocity of airmass (steady winds)
394 // inline double * get_V_local_airmass_v() { return v_local_airmass_v; }
395 // inline double get_V_north_airmass() const { return v_local_airmass_v[0]; }
396 // inline double get_V_east_airmass() const { return v_local_airmass_v[1]; }
397 // inline double get_V_down_airmass() const { return v_local_airmass_v[2]; }
398 /* inline void set_Velocities_Local_Airmass( double north, double east,
401 v_local_airmass_v[0] = north;
402 v_local_airmass_v[1] = east;
403 v_local_airmass_v[2] = down;
406 FG_VECTOR_3 v_local_rel_airmass_v; // velocity of veh. relative to
408 // inline double * get_V_local_rel_airmass_v() {
409 //return v_local_rel_airmass_v;
411 // inline double get_V_north_rel_airmass() const {
412 //return v_local_rel_airmass_v[0];
414 // inline double get_V_east_rel_airmass() const {
415 //return v_local_rel_airmass_v[1];
417 // inline double get_V_down_rel_airmass() const {
418 //return v_local_rel_airmass_v[2];
420 /* inline void set_Velocities_Local_Rel_Airmass( double north, double east,
423 v_local_rel_airmass_v[0] = north;
424 v_local_rel_airmass_v[1] = east;
425 v_local_rel_airmass_v[2] = down;
428 FG_VECTOR_3 v_local_gust_v; // linear turbulence components, L frame
429 // inline double * get_V_local_gust_v() { return v_local_gust_v; }
430 // inline double get_U_gust() const { return v_local_gust_v[0]; }
431 // inline double get_V_gust() const { return v_local_gust_v[1]; }
432 // inline double get_W_gust() const { return v_local_gust_v[2]; }
433 /* inline void set_Velocities_Gust( double u, double v, double w)
435 v_local_gust_v[0] = u;
436 v_local_gust_v[1] = v;
437 v_local_gust_v[2] = w;
440 FG_VECTOR_3 v_wind_body_v; // Wind-relative velocities in body axis
441 // inline double * get_V_wind_body_v() { return v_wind_body_v; }
442 // inline double get_U_body() const { return v_wind_body_v[0]; }
443 // inline double get_V_body() const { return v_wind_body_v[1]; }
444 // inline double get_W_body() const { return v_wind_body_v[2]; }
445 /* inline void set_Velocities_Wind_Body( double u, double v, double w)
447 v_wind_body_v[0] = u;
448 v_wind_body_v[1] = v;
449 v_wind_body_v[2] = w;
452 double v_rel_wind, v_true_kts, v_rel_ground, v_inertial;
453 double v_ground_speed, v_equiv, v_equiv_kts;
454 double v_calibrated, v_calibrated_kts;
456 // inline double get_V_rel_wind() const { return v_rel_wind; }
457 // inline void set_V_rel_wind(double wind) { v_rel_wind = wind; }
459 // inline double get_V_true_kts() const { return v_true_kts; }
460 // inline void set_V_true_kts(double kts) { v_true_kts = kts; }
462 // inline double get_V_rel_ground() const { return v_rel_ground; }
463 // inline void set_V_rel_ground( double v ) { v_rel_ground = v; }
465 // inline double get_V_inertial() const { return v_inertial; }
466 // inline void set_V_inertial(double v) { v_inertial = v; }
468 // inline double get_V_ground_speed() const { return v_ground_speed; }
469 // inline void set_V_ground_speed( double v) { v_ground_speed = v; }
471 // inline double get_V_equiv() const { return v_equiv; }
472 // inline void set_V_equiv( double v ) { v_equiv = v; }
474 inline double get_V_equiv_kts() const { return v_equiv_kts; }
475 inline void set_V_equiv_kts( double kts ) { v_equiv_kts = kts; }
477 // inline double get_V_calibrated() const { return v_calibrated; }
478 // inline void set_V_calibrated( double v ) { v_calibrated = v; }
480 // inline double get_V_calibrated_kts() const { return v_calibrated_kts; }
481 // inline void set_V_calibrated_kts( double kts ) { v_calibrated_kts = kts; }
483 FG_VECTOR_3 omega_body_v; // Angular B rates
484 // inline double * get_Omega_body_v() { return omega_body_v; }
485 inline double get_P_body() const { return omega_body_v[0]; }
486 inline double get_Q_body() const { return omega_body_v[1]; }
487 inline double get_R_body() const { return omega_body_v[2]; }
488 inline void set_Omega_Body( double p, double q, double r ) {
494 FG_VECTOR_3 omega_local_v; // Angular L rates
495 // inline double * get_Omega_local_v() { return omega_local_v; }
496 // inline double get_P_local() const { return omega_local_v[0]; }
497 // inline double get_Q_local() const { return omega_local_v[1]; }
498 // inline double get_R_local() const { return omega_local_v[2]; }
499 /* inline void set_Omega_Local( double p, double q, double r ) {
500 omega_local_v[0] = p;
501 omega_local_v[1] = q;
502 omega_local_v[2] = r;
505 FG_VECTOR_3 omega_total_v; // Diff btw B & L
506 // inline double * get_Omega_total_v() { return omega_total_v; }
507 // inline double get_P_total() const { return omega_total_v[0]; }
508 // inline double get_Q_total() const { return omega_total_v[1]; }
509 // inline double get_R_total() const { return omega_total_v[2]; }
510 /* inline void set_Omega_Total( double p, double q, double r ) {
511 omega_total_v[0] = p;
512 omega_total_v[1] = q;
513 omega_total_v[2] = r;
516 FG_VECTOR_3 euler_rates_v;
517 // inline double * get_Euler_rates_v() { return euler_rates_v; }
518 // inline double get_Phi_dot() const { return euler_rates_v[0]; }
519 // inline double get_Theta_dot() const { return euler_rates_v[1]; }
520 // inline double get_Psi_dot() const { return euler_rates_v[2]; }
521 /* inline void set_Euler_Rates( double phi, double theta, double psi ) {
522 euler_rates_v[0] = phi;
523 euler_rates_v[1] = theta;
524 euler_rates_v[2] = psi;
527 FG_VECTOR_3 geocentric_rates_v; // Geocentric linear velocities
528 // inline double * get_Geocentric_rates_v() { return geocentric_rates_v; }
529 inline double get_Latitude_dot() const { return geocentric_rates_v[0]; }
530 inline double get_Longitude_dot() const { return geocentric_rates_v[1]; }
531 inline double get_Radius_dot() const { return geocentric_rates_v[2]; }
532 inline void set_Geocentric_Rates( double lat, double lon, double rad ) {
533 geocentric_rates_v[0] = lat;
534 geocentric_rates_v[1] = lon;
535 geocentric_rates_v[2] = rad;
538 /*=============================== Positions ===============================*/
540 FG_VECTOR_3 geocentric_position_v;
541 // inline double * get_Geocentric_position_v() {
542 // return geocentric_position_v;
544 inline double get_Lat_geocentric() const {
545 return geocentric_position_v[0];
547 inline double get_Lon_geocentric() const {
548 return geocentric_position_v[1];
550 inline double get_Radius_to_vehicle() const {
551 return geocentric_position_v[2];
553 inline void set_Radius_to_vehicle(double radius) {
554 geocentric_position_v[2] = radius;
557 inline void set_Geocentric_Position( double lat, double lon, double rad ) {
558 geocentric_position_v[0] = lat;
559 geocentric_position_v[1] = lon;
560 geocentric_position_v[2] = rad;
563 FG_VECTOR_3 geodetic_position_v;
564 // inline double * get_Geodetic_position_v() { return geodetic_position_v; }
565 inline double get_Latitude() const { return geodetic_position_v[0]; }
566 inline void set_Latitude(double lat) { geodetic_position_v[0] = lat; }
567 inline double get_Longitude() const { return geodetic_position_v[1]; }
568 inline void set_Longitude(double lon) { geodetic_position_v[1] = lon; }
569 inline double get_Altitude() const { return geodetic_position_v[2]; }
570 inline void set_Altitude(double altitude) {
571 geodetic_position_v[2] = altitude;
573 inline void set_Geodetic_Position( double lat, double lon, double alt ) {
574 geodetic_position_v[0] = lat;
575 geodetic_position_v[1] = lon;
576 geodetic_position_v[2] = alt;
579 FG_VECTOR_3 euler_angles_v;
580 // inline double * get_Euler_angles_v() { return euler_angles_v; }
581 inline double get_Phi() const { return euler_angles_v[0]; }
582 inline double get_Theta() const { return euler_angles_v[1]; }
583 inline double get_Psi() const { return euler_angles_v[2]; }
584 inline void set_Euler_Angles( double phi, double theta, double psi ) {
585 euler_angles_v[0] = phi;
586 euler_angles_v[1] = theta;
587 euler_angles_v[2] = psi;
591 /*======================= Miscellaneous quantities ========================*/
593 double t_local_to_body_m[3][3]; // Transformation matrix L to B
594 // inline double * get_T_local_to_body_m() { return t_local_to_body_m; }
595 inline double get_T_local_to_body_11() const {
596 return t_local_to_body_m[0][0];
598 inline double get_T_local_to_body_12() const {
599 return t_local_to_body_m[0][1];
601 inline double get_T_local_to_body_13() const {
602 return t_local_to_body_m[0][2];
604 inline double get_T_local_to_body_21() const {
605 return t_local_to_body_m[1][0];
607 inline double get_T_local_to_body_22() const {
608 return t_local_to_body_m[1][1];
610 inline double get_T_local_to_body_23() const {
611 return t_local_to_body_m[1][2];
613 inline double get_T_local_to_body_31() const {
614 return t_local_to_body_m[2][0];
616 inline double get_T_local_to_body_32() const {
617 return t_local_to_body_m[2][1];
619 inline double get_T_local_to_body_33() const {
620 return t_local_to_body_m[2][2];
622 inline void set_T_Local_to_Body( double m[3][3] ) {
624 for ( i = 0; i < 3; i++ ) {
625 for ( j = 0; j < 3; j++ ) {
626 t_local_to_body_m[i][j] = m[i][j];
631 double gravity; // Local acceleration due to G
632 // inline double get_Gravity() const { return gravity; }
633 // inline void set_Gravity(double g) { gravity = g; }
635 double centrifugal_relief; // load factor reduction due to speed
636 // inline double get_Centrifugal_relief() const { return centrifugal_relief; }
637 // inline void set_Centrifugal_relief(double cr) { centrifugal_relief = cr; }
639 double alpha, beta, alpha_dot, beta_dot; // in radians
640 inline double get_Alpha() const { return alpha; }
641 inline void set_Alpha( double a ) { alpha = a; }
642 inline double get_Beta() const { return beta; }
643 inline void set_Beta( double b ) { beta = b; }
644 // inline double get_Alpha_dot() const { return alpha_dot; }
645 // inline void set_Alpha_dot( double ad ) { alpha_dot = ad; }
646 // inline double get_Beta_dot() const { return beta_dot; }
647 // inline void set_Beta_dot( double bd ) { beta_dot = bd; }
649 double cos_alpha, sin_alpha, cos_beta, sin_beta;
650 // inline double get_Cos_alpha() const { return cos_alpha; }
651 // inline void set_Cos_alpha( double ca ) { cos_alpha = ca; }
652 // inline double get_Sin_alpha() const { return sin_alpha; }
653 // inline void set_Sin_alpha( double sa ) { sin_alpha = sa; }
654 // inline double get_Cos_beta() const { return cos_beta; }
655 // inline void set_Cos_beta( double cb ) { cos_beta = cb; }
656 // inline double get_Sin_beta() const { return sin_beta; }
657 // inline void set_Sin_beta( double sb ) { sin_beta = sb; }
659 double cos_phi, sin_phi, cos_theta, sin_theta, cos_psi, sin_psi;
660 // inline double get_Cos_phi() const { return cos_phi; }
661 // inline void set_Cos_phi( double cp ) { cos_phi = cp; }
662 // inline double get_Sin_phi() const { return sin_phi; }
663 // inline void set_Sin_phi( double sp ) { sin_phi = sp; }
664 // inline double get_Cos_theta() const { return cos_theta; }
665 // inline void set_Cos_theta( double ct ) { cos_theta = ct; }
666 // inline double get_Sin_theta() const { return sin_theta; }
667 // inline void set_Sin_theta( double st ) { sin_theta = st; }
668 // inline double get_Cos_psi() const { return cos_psi; }
669 // inline void set_Cos_psi( double cp ) { cos_psi = cp; }
670 // inline double get_Sin_psi() const { return sin_psi; }
671 // inline void set_Sin_psi( double sp ) { sin_psi = sp; }
673 double gamma_vert_rad, gamma_horiz_rad; // Flight path angles
674 inline double get_Gamma_vert_rad() const { return gamma_vert_rad; }
675 inline void set_Gamma_vert_rad( double gv ) { gamma_vert_rad = gv; }
676 // inline double get_Gamma_horiz_rad() const { return gamma_horiz_rad; }
677 // inline void set_Gamma_horiz_rad( double gh ) { gamma_horiz_rad = gh; }
679 double sigma, density, v_sound, mach_number;
680 // inline double get_Sigma() const { return sigma; }
681 // inline void set_Sigma( double s ) { sigma = s; }
682 // inline double get_Density() const { return density; }
683 // inline void set_Density( double d ) { density = d; }
684 // inline double get_V_sound() const { return v_sound; }
685 // inline void set_V_sound( double v ) { v_sound = v; }
686 // inline double get_Mach_number() const { return mach_number; }
687 // inline void set_Mach_number( double m ) { mach_number = m; }
689 double static_pressure, total_pressure, impact_pressure;
690 double dynamic_pressure;
691 // inline double get_Static_pressure() const { return static_pressure; }
692 // inline void set_Static_pressure( double sp ) { static_pressure = sp; }
693 // inline double get_Total_pressure() const { return total_pressure; }
694 // inline void set_Total_pressure( double tp ) { total_pressure = tp; }
695 // inline double get_Impact_pressure() const { return impact_pressure; }
696 // inline void set_Impact_pressure( double ip ) { impact_pressure = ip; }
697 // inline double get_Dynamic_pressure() const { return dynamic_pressure; }
698 // inline void set_Dynamic_pressure( double dp ) { dynamic_pressure = dp; }
700 double static_temperature, total_temperature;
701 // inline double get_Static_temperature() const { return static_temperature; }
702 // inline void set_Static_temperature( double t ) { static_temperature = t; }
703 // inline double get_Total_temperature() const { return total_temperature; }
704 // inline void set_Total_temperature( double t ) { total_temperature = t; }
706 double sea_level_radius, earth_position_angle;
707 inline double get_Sea_level_radius() const { return sea_level_radius; }
708 inline void set_Sea_level_radius( double r ) { sea_level_radius = r; }
709 inline double get_Earth_position_angle() const {
710 return earth_position_angle;
712 inline void set_Earth_position_angle(double a) {
713 earth_position_angle = a;
716 double runway_altitude, runway_latitude, runway_longitude;
717 double runway_heading;
718 inline double get_Runway_altitude() const { return runway_altitude; }
719 inline void set_Runway_altitude( double alt ) { runway_altitude = alt; }
720 // inline double get_Runway_latitude() const { return runway_latitude; }
721 // inline void set_Runway_latitude( double lat ) { runway_latitude = lat; }
722 // inline double get_Runway_longitude() const { return runway_longitude; }
723 // inline void set_Runway_longitude( double lon ) { runway_longitude = lon; }
724 // inline double get_Runway_heading() const { return runway_heading; }
725 // inline void set_Runway_heading( double h ) { runway_heading = h; }
727 double radius_to_rwy;
728 // inline double get_Radius_to_rwy() const { return radius_to_rwy; }
729 // inline void set_Radius_to_rwy( double r ) { radius_to_rwy = r; }
731 FG_VECTOR_3 d_cg_rwy_local_v; // CG rel. to rwy in local coords
732 // inline double * get_D_cg_rwy_local_v() { return d_cg_rwy_local_v; }
733 // inline double get_D_cg_north_of_rwy() const { return d_cg_rwy_local_v[0]; }
734 // inline double get_D_cg_east_of_rwy() const { return d_cg_rwy_local_v[1]; }
735 // inline double get_D_cg_above_rwy() const { return d_cg_rwy_local_v[2]; }
736 /* inline void set_CG_Rwy_Local( double north, double east, double above )
738 d_cg_rwy_local_v[0] = north;
739 d_cg_rwy_local_v[1] = east;
740 d_cg_rwy_local_v[2] = above;
743 FG_VECTOR_3 d_cg_rwy_rwy_v; // CG relative to rwy, in rwy coordinates
744 // inline double * get_D_cg_rwy_rwy_v() { return d_cg_rwy_rwy_v; }
745 // inline double get_X_cg_rwy() const { return d_cg_rwy_rwy_v[0]; }
746 // inline double get_Y_cg_rwy() const { return d_cg_rwy_rwy_v[1]; }
747 // inline double get_H_cg_rwy() const { return d_cg_rwy_rwy_v[2]; }
748 /* inline void set_CG_Rwy_Rwy( double x, double y, double h )
750 d_cg_rwy_rwy_v[0] = x;
751 d_cg_rwy_rwy_v[1] = y;
752 d_cg_rwy_rwy_v[2] = h;
755 FG_VECTOR_3 d_pilot_rwy_local_v; // pilot rel. to rwy in local coords
756 // inline double * get_D_pilot_rwy_local_v() { return d_pilot_rwy_local_v; }
757 // inline double get_D_pilot_north_of_rwy() const {
758 //return d_pilot_rwy_local_v[0];
760 // inline double get_D_pilot_east_of_rwy() const {
761 // return d_pilot_rwy_local_v[1];
763 // inline double get_D_pilot_above_rwy() const {
764 //return d_pilot_rwy_local_v[2];
766 /* inline void set_Pilot_Rwy_Local( double north, double east, double above )
768 d_pilot_rwy_local_v[0] = north;
769 d_pilot_rwy_local_v[1] = east;
770 d_pilot_rwy_local_v[2] = above;
773 FG_VECTOR_3 d_pilot_rwy_rwy_v; // pilot rel. to rwy, in rwy coords.
774 // inline double * get_D_pilot_rwy_rwy_v() { return d_pilot_rwy_rwy_v; }
775 // inline double get_X_pilot_rwy() const { return d_pilot_rwy_rwy_v[0]; }
776 // inline double get_Y_pilot_rwy() const { return d_pilot_rwy_rwy_v[1]; }
777 // inline double get_H_pilot_rwy() const { return d_pilot_rwy_rwy_v[2]; }
778 /* inline void set_Pilot_Rwy_Rwy( double x, double y, double h )
780 d_pilot_rwy_rwy_v[0] = x;
781 d_pilot_rwy_rwy_v[1] = y;
782 d_pilot_rwy_rwy_v[2] = h;
785 double climb_rate; // in feet per second
786 inline double get_Climb_Rate() const { return climb_rate; }
787 inline void set_Climb_Rate(double rate) { climb_rate = rate; }
789 FGTimeStamp valid_stamp; // time this record is valid
790 FGTimeStamp next_stamp; // time this record is valid
791 inline FGTimeStamp get_time_stamp() const { return valid_stamp; }
792 inline void stamp_time() { valid_stamp = next_stamp; next_stamp.stamp(); }
794 // Extrapolate FDM based on time_offset (in usec)
795 void extrapolate( int time_offset );
797 // sin/cos lat_geocentric
798 double sin_lat_geocentric;
799 double cos_lat_geocentric;
800 inline void set_sin_lat_geocentric(double parm) {
801 sin_lat_geocentric = sin(parm);
803 inline void set_cos_lat_geocentric(double parm) {
804 cos_lat_geocentric = cos(parm);
806 inline double get_sin_lat_geocentric(void) const {
807 return sin_lat_geocentric;
809 inline double get_cos_lat_geocentric(void) const {
810 return cos_lat_geocentric;
813 double sin_longitude;
814 double cos_longitude;
815 inline void set_sin_cos_longitude(double parm) {
816 sin_longitude = sin(parm);
817 cos_longitude = cos(parm);
819 inline double get_sin_longitude(void) const {
820 return sin_longitude;
822 inline double get_cos_longitude(void) const {
823 return cos_longitude;
828 inline void set_sin_cos_latitude(double parm) {
829 sin_latitude = sin(parm);
830 cos_latitude = cos(parm);
832 inline double get_sin_latitude(void) const {
835 inline double get_cos_latitude(void) const {
841 extern FGInterface cur_fdm_state;
844 // General interface to the flight model routines
846 // Initialize the flight model parameters
847 int fgFDMInit(int model, FGInterface& f, double dt);
849 // Run multiloop iterations of the flight model
850 int fgFDMUpdate(int model, FGInterface& f, int multiloop, int jitter);
852 // Set the altitude (force)
853 void fgFDMForceAltitude(int model, double alt_meters);
855 // Set the local ground elevation
856 void fgFDMSetGroundElevation(int model, double alt_meters);
859 #endif // _FLIGHT_HXX
863 // Revision 1.14 1999/04/03 04:20:04 curt
864 // Optimizations (tm) by Norman Vine.
866 // Revision 1.13 1999/02/05 21:29:02 curt
867 // Modifications to incorporate Jon S. Berndts flight model code.
869 // Revision 1.12 1999/01/20 13:42:23 curt
870 // Tweaked FDM interface.
871 // Testing check sum support for NMEA serial output.
873 // Revision 1.11 1999/01/19 17:52:07 curt
874 // Working on being able to extrapolate a new position and orientation
875 // based on a position, orientation, and time offset.
877 // Revision 1.10 1999/01/09 13:37:33 curt
878 // Convert fgTIMESTAMP to FGTimeStamp which holds usec instead of ms.
880 // Revision 1.9 1999/01/08 19:27:38 curt
881 // Fixed AOA reading on HUD.
882 // Continued work on time jitter compensation.
884 // Revision 1.8 1999/01/08 03:23:52 curt
885 // Beginning work on compensating for sim time vs. real world time "jitter".
887 // Revision 1.7 1998/12/18 23:37:09 curt
888 // Collapsed out the FGState variables not currently needed. They are just
889 // commented out and can be readded easily at any time. The point of this
890 // exersize is to determine which variables were or were not currently being
893 // Revision 1.6 1998/12/05 15:54:12 curt
894 // Renamed class fgFLIGHT to class FGState as per request by JSB.
896 // Revision 1.5 1998/12/04 01:29:40 curt
897 // Stubbed in a new flight model called "External" which is expected to be driven
898 // from some external source.
900 // Revision 1.4 1998/12/03 04:25:03 curt
901 // Working on fixing up new fgFLIGHT class.
903 // Revision 1.3 1998/12/03 01:16:41 curt
904 // Converted fgFLIGHT to a class.
906 // Revision 1.2 1998/10/16 23:27:41 curt
909 // Revision 1.1 1998/10/16 20:16:44 curt
910 // Renamed flight.[ch] to flight.[ch]xx
912 // Revision 1.20 1998/09/29 14:57:39 curt
913 // c++-ified comments.
915 // Revision 1.19 1998/09/29 02:02:41 curt
916 // Added a rate of climb calculation.
918 // Revision 1.18 1998/07/30 23:44:36 curt
919 // Beginning to add support for multiple flight models.
921 // Revision 1.17 1998/07/12 03:08:28 curt
922 // Added fgFlightModelSetAltitude() to force the altitude to something
923 // other than the current altitude. LaRCsim doesn't let you do this by just
924 // changing FG_Altitude.
926 // Revision 1.16 1998/04/22 13:26:20 curt
927 // C++ - ifing the code a bit.
929 // Revision 1.15 1998/04/21 16:59:33 curt
930 // Integrated autopilot.
931 // Prepairing for C++ integration.
933 // Revision 1.14 1998/02/07 15:29:37 curt
934 // Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
935 // <chotchkiss@namg.us.anritsu.com>
937 // Revision 1.13 1998/01/24 00:04:59 curt
940 // Revision 1.12 1998/01/22 02:59:32 curt
941 // Changed #ifdef FILE_H to #ifdef _FILE_H
943 // Revision 1.11 1998/01/19 19:27:03 curt
944 // Merged in make system changes from Bob Kuehne <rpk@sgi.com>
945 // This should simplify things tremendously.
947 // Revision 1.10 1997/12/10 22:37:43 curt
948 // Prepended "fg" on the name of all global structures that didn't have it yet.
949 // i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
951 // Revision 1.9 1997/09/04 02:17:33 curt
954 // Revision 1.8 1997/08/27 03:30:06 curt
955 // Changed naming scheme of basic shared structures.
957 // Revision 1.7 1997/07/23 21:52:19 curt
958 // Put comments around the text after an #endif for increased portability.
960 // Revision 1.6 1997/06/21 17:52:22 curt
961 // Continue directory shuffling ... everything should be compilable/runnable
964 // Revision 1.5 1997/06/21 17:12:49 curt
965 // Capitalized subdirectory names.
967 // Revision 1.4 1997/05/29 22:39:57 curt
968 // Working on incorporating the LaRCsim flight model.
970 // Revision 1.3 1997/05/29 02:32:25 curt
971 // Starting to build generic flight model interface.
973 // Revision 1.2 1997/05/23 15:40:37 curt
974 // Added GNU copyright headers.
976 // Revision 1.1 1997/05/16 16:04:45 curt