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)
31 `FGState::get_Longitude ()'
32 `FGState::get_Latitude ()'
33 `FGState::get_Altitude ()'
35 `FGState::get_Theta ()'
37 `FGState::get_V_equiv_kts ()'
39 `FGState::get_Mass ()'
40 `FGState::get_I_xx ()'
41 `FGState::get_I_yy ()'
42 `FGState::get_I_zz ()'
43 `FGState::get_I_xz ()'
45 `FGState::get_V_north ()'
46 `FGState::get_V_east ()'
47 `FGState::get_V_down ()'
49 `FGState::get_P_Body ()'
50 `FGState::get_Q_Body ()'
51 `FGState::get_R_Body ()'
53 `FGState::get_Gamma_vert_rad ()'
54 `FGState::get_Climb_Rate ()'
55 `FGState::get_Beta ()'
57 `FGState::get_Runway_altitude ()'
59 `FGState::get_Lon_geocentric ()'
60 `FGState::get_Lat_geocentric ()'
61 `FGState::get_Sea_level_radius ()'
62 `FGState::get_Earth_position_angle ()'
64 `FGState::get_Dx_cg ()'
65 `FGState::get_Dy_cg ()'
66 `FGState::get_Dz_cg ()'
68 `FGState::get_T_local_to_body_11 ()' ... `FGState::get_T_local_to_body_33 ()'
70 `FGState::get_Radius_to_vehicle ()'
74 #include <Flight/Slew/slew.hxx>
78 # error This library requires C++
82 typedef double FG_VECTOR_3[3];
85 // This is based heavily on LaRCsim/ls_generic.h
90 // Define the various supported flight models (many not yet implemented)
92 // Slew (in MS terminology)
95 // The only "real" model that is currently implemented
105 // Driven externally via a serial port, net, file, etc.
109 /*================== Mass properties and geometry values ==================*/
112 double mass, i_xx, i_yy, i_zz, i_xz;
113 inline double get_Mass() const { return mass; }
114 inline double get_I_xx() const { return i_xx; }
115 inline double get_I_yy() const { return i_yy; }
116 inline double get_I_zz() const { return i_zz; }
117 inline double get_I_xz() const { return i_xz; }
118 inline void set_Inertias( double m, double xx, double yy,
119 double zz, double xz)
128 // Pilot location rel to ref pt
129 FG_VECTOR_3 d_pilot_rp_body_v;
130 // inline double * get_D_pilot_rp_body_v() {
131 // return d_pilot_rp_body_v;
133 // inline double get_Dx_pilot() const { return d_pilot_rp_body_v[0]; }
134 // inline double get_Dy_pilot() const { return d_pilot_rp_body_v[1]; }
135 // inline double get_Dz_pilot() const { return d_pilot_rp_body_v[2]; }
136 /* inline void set_Pilot_Location( double dx, double dy, double dz ) {
137 d_pilot_rp_body_v[0] = dx;
138 d_pilot_rp_body_v[1] = dy;
139 d_pilot_rp_body_v[2] = dz;
142 // CG position w.r.t. ref. point
143 FG_VECTOR_3 d_cg_rp_body_v;
144 // inline double * get_D_cg_rp_body_v() { return d_cg_rp_body_v; }
145 inline double get_Dx_cg() const { return d_cg_rp_body_v[0]; }
146 inline double get_Dy_cg() const { return d_cg_rp_body_v[1]; }
147 inline double get_Dz_cg() const { return d_cg_rp_body_v[2]; }
148 inline void set_CG_Position( double dx, double dy, double dz ) {
149 d_cg_rp_body_v[0] = dx;
150 d_cg_rp_body_v[1] = dy;
151 d_cg_rp_body_v[2] = dz;
154 /*================================ Forces =================================*/
156 FG_VECTOR_3 f_body_total_v;
157 // inline double * get_F_body_total_v() { return f_body_total_v; }
158 // inline double get_F_X() const { return f_body_total_v[0]; }
159 // inline double get_F_Y() const { return f_body_total_v[1]; }
160 // inline double get_F_Z() const { return f_body_total_v[2]; }
161 /* inline void set_Forces_Body_Total( double x, double y, double z ) {
162 f_body_total_v[0] = x;
163 f_body_total_v[1] = y;
164 f_body_total_v[2] = z;
167 FG_VECTOR_3 f_local_total_v;
168 // inline double * get_F_local_total_v() { return f_local_total_v; }
169 // inline double get_F_north() const { return f_local_total_v[0]; }
170 // inline double get_F_east() const { return f_local_total_v[1]; }
171 // inline double get_F_down() const { return f_local_total_v[2]; }
172 /* inline void set_Forces_Local_Total( double x, double y, double z ) {
173 f_local_total_v[0] = x;
174 f_local_total_v[1] = y;
175 f_local_total_v[2] = z;
178 FG_VECTOR_3 f_aero_v;
179 // inline double * get_F_aero_v() { return f_aero_v; }
180 // inline double get_F_X_aero() const { return f_aero_v[0]; }
181 // inline double get_F_Y_aero() const { return f_aero_v[1]; }
182 // inline double get_F_Z_aero() const { return f_aero_v[2]; }
183 /* inline void set_Forces_Aero( double x, double y, double z ) {
189 FG_VECTOR_3 f_engine_v;
190 // inline double * get_F_engine_v() { return f_engine_v; }
191 // inline double get_F_X_engine() const { return f_engine_v[0]; }
192 // inline double get_F_Y_engine() const { return f_engine_v[1]; }
193 // inline double get_F_Z_engine() const { return f_engine_v[2]; }
194 /* inline void set_Forces_Engine( double x, double y, double z ) {
200 FG_VECTOR_3 f_gear_v;
201 // inline double * get_F_gear_v() { return f_gear_v; }
202 // inline double get_F_X_gear() const { return f_gear_v[0]; }
203 // inline double get_F_Y_gear() const { return f_gear_v[1]; }
204 // inline double get_F_Z_gear() const { return f_gear_v[2]; }
205 /* inline void set_Forces_Gear( double x, double y, double z ) {
211 /*================================ Moments ================================*/
213 FG_VECTOR_3 m_total_rp_v;
214 // inline double * get_M_total_rp_v() { return m_total_rp_v; }
215 // inline double get_M_l_rp() const { return m_total_rp_v[0]; }
216 // inline double get_M_m_rp() const { return m_total_rp_v[1]; }
217 // inline double get_M_n_rp() const { return m_total_rp_v[2]; }
218 /* inline void set_Moments_Total_RP( double l, double m, double n ) {
224 FG_VECTOR_3 m_total_cg_v;
225 // inline double * get_M_total_cg_v() { return m_total_cg_v; }
226 // inline double get_M_l_cg() const { return m_total_cg_v[0]; }
227 // inline double get_M_m_cg() const { return m_total_cg_v[1]; }
228 // inline double get_M_n_cg() const { return m_total_cg_v[2]; }
229 /* inline void set_Moments_Total_CG( double l, double m, double n ) {
235 FG_VECTOR_3 m_aero_v;
236 // inline double * get_M_aero_v() { return m_aero_v; }
237 // inline double get_M_l_aero() const { return m_aero_v[0]; }
238 // inline double get_M_m_aero() const { return m_aero_v[1]; }
239 // inline double get_M_n_aero() const { return m_aero_v[2]; }
240 /* inline void set_Moments_Aero( double l, double m, double n ) {
246 FG_VECTOR_3 m_engine_v;
247 // inline double * get_M_engine_v() { return m_engine_v; }
248 // inline double get_M_l_engine() const { return m_engine_v[0]; }
249 // inline double get_M_m_engine() const { return m_engine_v[1]; }
250 // inline double get_M_n_engine() const { return m_engine_v[2]; }
251 /* inline void set_Moments_Engine( double l, double m, double n ) {
257 FG_VECTOR_3 m_gear_v;
258 // inline double * get_M_gear_v() { return m_gear_v; }
259 // inline double get_M_l_gear() const { return m_gear_v[0]; }
260 // inline double get_M_m_gear() const { return m_gear_v[1]; }
261 // inline double get_M_n_gear() const { return m_gear_v[2]; }
262 /* inline void set_Moments_Gear( double l, double m, double n ) {
268 /*============================== Accelerations ============================*/
270 FG_VECTOR_3 v_dot_local_v;
271 // inline double * get_V_dot_local_v() { return v_dot_local_v; }
272 // inline double get_V_dot_north() const { return v_dot_local_v[0]; }
273 // inline double get_V_dot_east() const { return v_dot_local_v[1]; }
274 // inline double get_V_dot_down() const { return v_dot_local_v[2]; }
275 /* inline void set_Accels_Local( double north, double east, double down ) {
276 v_dot_local_v[0] = north;
277 v_dot_local_v[1] = east;
278 v_dot_local_v[2] = down;
281 FG_VECTOR_3 v_dot_body_v;
282 // inline double * get_V_dot_body_v() { return v_dot_body_v; }
283 // inline double get_U_dot_body() const { return v_dot_body_v[0]; }
284 // inline double get_V_dot_body() const { return v_dot_body_v[1]; }
285 // inline double get_W_dot_body() const { return v_dot_body_v[2]; }
286 /* inline void set_Accels_Body( double u, double v, double w ) {
287 v_dot_local_v[0] = u;
288 v_dot_local_v[1] = v;
289 v_dot_local_v[2] = w;
292 FG_VECTOR_3 a_cg_body_v;
293 // inline double * get_A_cg_body_v() { return a_cg_body_v; }
294 // inline double get_A_X_cg() const { return a_cg_body_v[0]; }
295 // inline double get_A_Y_cg() const { return a_cg_body_v[1]; }
296 // inline double get_A_Z_cg() const { return a_cg_body_v[2]; }
297 /* inline void set_Accels_CG_Body( double x, double y, double z ) {
303 FG_VECTOR_3 a_pilot_body_v;
304 // inline double * get_A_pilot_body_v() { return a_pilot_body_v; }
305 // inline double get_A_X_pilot() const { return a_pilot_body_v[0]; }
306 // inline double get_A_Y_pilot() const { return a_pilot_body_v[1]; }
307 // inline double get_A_Z_pilot() const { return a_pilot_body_v[2]; }
308 /* inline void set_Accels_Pilot_Body( double x, double y, double z ) {
309 a_pilot_body_v[0] = x;
310 a_pilot_body_v[1] = y;
311 a_pilot_body_v[2] = z;
314 FG_VECTOR_3 n_cg_body_v;
315 // inline double * get_N_cg_body_v() { return n_cg_body_v; }
316 // inline double get_N_X_cg() const { return n_cg_body_v[0]; }
317 // inline double get_N_Y_cg() const { return n_cg_body_v[1]; }
318 // inline double get_N_Z_cg() const { return n_cg_body_v[2]; }
319 /* inline void set_Accels_CG_Body_N( double x, double y, double z ) {
325 FG_VECTOR_3 n_pilot_body_v;
326 // inline double * get_N_pilot_body_v() { return n_pilot_body_v; }
327 // inline double get_N_X_pilot() const { return n_pilot_body_v[0]; }
328 // inline double get_N_Y_pilot() const { return n_pilot_body_v[1]; }
329 // inline double get_N_Z_pilot() const { return n_pilot_body_v[2]; }
330 /* inline void set_Accels_Pilot_Body_N( double x, double y, double z ) {
331 n_pilot_body_v[0] = x;
332 n_pilot_body_v[1] = y;
333 n_pilot_body_v[2] = z;
336 FG_VECTOR_3 omega_dot_body_v;
337 // inline double * get_Omega_dot_body_v() { return omega_dot_body_v; }
338 // inline double get_P_dot_body() const { return omega_dot_body_v[0]; }
339 // inline double get_Q_dot_body() const { return omega_dot_body_v[1]; }
340 // inline double get_R_dot_body() const { return omega_dot_body_v[2]; }
341 /* inline void set_Accels_Omega( double p, double q, double r ) {
342 omega_dot_body_v[0] = p;
343 omega_dot_body_v[1] = q;
344 omega_dot_body_v[2] = r;
348 /*============================== Velocities ===============================*/
350 FG_VECTOR_3 v_local_v;
351 // inline double * get_V_local_v() { return v_local_v; }
352 inline double get_V_north() const { return v_local_v[0]; }
353 inline double get_V_east() const { return v_local_v[1]; }
354 inline double get_V_down() const { return v_local_v[2]; }
355 inline void set_Velocities_Local( double north, double east, double down ) {
356 v_local_v[0] = north;
361 FG_VECTOR_3 v_local_rel_ground_v; // V rel w.r.t. earth surface
362 // inline double * get_V_local_rel_ground_v() { return v_local_rel_ground_v; }
363 // inline double get_V_north_rel_ground() const {
364 // return v_local_rel_ground_v[0];
366 // inline double get_V_east_rel_ground() const {
367 // return v_local_rel_ground_v[1];
369 // inline double get_V_down_rel_ground() const {
370 // return v_local_rel_ground_v[2];
372 /* inline void set_Velocities_Ground(double north, double east, double down) {
373 v_local_rel_ground_v[0] = north;
374 v_local_rel_ground_v[1] = east;
375 v_local_rel_ground_v[2] = down;
378 FG_VECTOR_3 v_local_airmass_v; // velocity of airmass (steady winds)
379 // inline double * get_V_local_airmass_v() { return v_local_airmass_v; }
380 // inline double get_V_north_airmass() const { return v_local_airmass_v[0]; }
381 // inline double get_V_east_airmass() const { return v_local_airmass_v[1]; }
382 // inline double get_V_down_airmass() const { return v_local_airmass_v[2]; }
383 /* inline void set_Velocities_Local_Airmass( double north, double east,
386 v_local_airmass_v[0] = north;
387 v_local_airmass_v[1] = east;
388 v_local_airmass_v[2] = down;
391 FG_VECTOR_3 v_local_rel_airmass_v; // velocity of veh. relative to
393 // inline double * get_V_local_rel_airmass_v() {
394 //return v_local_rel_airmass_v;
396 // inline double get_V_north_rel_airmass() const {
397 //return v_local_rel_airmass_v[0];
399 // inline double get_V_east_rel_airmass() const {
400 //return v_local_rel_airmass_v[1];
402 // inline double get_V_down_rel_airmass() const {
403 //return v_local_rel_airmass_v[2];
405 /* inline void set_Velocities_Local_Rel_Airmass( double north, double east,
408 v_local_rel_airmass_v[0] = north;
409 v_local_rel_airmass_v[1] = east;
410 v_local_rel_airmass_v[2] = down;
413 FG_VECTOR_3 v_local_gust_v; // linear turbulence components, L frame
414 // inline double * get_V_local_gust_v() { return v_local_gust_v; }
415 // inline double get_U_gust() const { return v_local_gust_v[0]; }
416 // inline double get_V_gust() const { return v_local_gust_v[1]; }
417 // inline double get_W_gust() const { return v_local_gust_v[2]; }
418 /* inline void set_Velocities_Gust( double u, double v, double w)
420 v_local_gust_v[0] = u;
421 v_local_gust_v[1] = v;
422 v_local_gust_v[2] = w;
425 FG_VECTOR_3 v_wind_body_v; // Wind-relative velocities in body axis
426 // inline double * get_V_wind_body_v() { return v_wind_body_v; }
427 // inline double get_U_body() const { return v_wind_body_v[0]; }
428 // inline double get_V_body() const { return v_wind_body_v[1]; }
429 // inline double get_W_body() const { return v_wind_body_v[2]; }
430 /* inline void set_Velocities_Wind_Body( double u, double v, double w)
432 v_wind_body_v[0] = u;
433 v_wind_body_v[1] = v;
434 v_wind_body_v[2] = w;
437 double v_rel_wind, v_true_kts, v_rel_ground, v_inertial;
438 double v_ground_speed, v_equiv, v_equiv_kts;
439 double v_calibrated, v_calibrated_kts;
441 // inline double get_V_rel_wind() const { return v_rel_wind; }
442 // inline void set_V_rel_wind(double wind) { v_rel_wind = wind; }
444 // inline double get_V_true_kts() const { return v_true_kts; }
445 // inline void set_V_true_kts(double kts) { v_true_kts = kts; }
447 // inline double get_V_rel_ground() const { return v_rel_ground; }
448 // inline void set_V_rel_ground( double v ) { v_rel_ground = v; }
450 // inline double get_V_inertial() const { return v_inertial; }
451 // inline void set_V_inertial(double v) { v_inertial = v; }
453 // inline double get_V_ground_speed() const { return v_ground_speed; }
454 // inline void set_V_ground_speed( double v) { v_ground_speed = v; }
456 // inline double get_V_equiv() const { return v_equiv; }
457 // inline void set_V_equiv( double v ) { v_equiv = v; }
459 inline double get_V_equiv_kts() const { return v_equiv_kts; }
460 inline void set_V_equiv_kts( double kts ) { v_equiv_kts = kts; }
462 // inline double get_V_calibrated() const { return v_calibrated; }
463 // inline void set_V_calibrated( double v ) { v_calibrated = v; }
465 // inline double get_V_calibrated_kts() const { return v_calibrated_kts; }
466 // inline void set_V_calibrated_kts( double kts ) { v_calibrated_kts = kts; }
468 FG_VECTOR_3 omega_body_v; // Angular B rates
469 // inline double * get_Omega_body_v() { return omega_body_v; }
470 inline double get_P_body() const { return omega_body_v[0]; }
471 inline double get_Q_body() const { return omega_body_v[1]; }
472 inline double get_R_body() const { return omega_body_v[2]; }
473 inline void set_Omega_Body( double p, double q, double r ) {
479 FG_VECTOR_3 omega_local_v; // Angular L rates
480 // inline double * get_Omega_local_v() { return omega_local_v; }
481 // inline double get_P_local() const { return omega_local_v[0]; }
482 // inline double get_Q_local() const { return omega_local_v[1]; }
483 // inline double get_R_local() const { return omega_local_v[2]; }
484 /* inline void set_Omega_Local( double p, double q, double r ) {
485 omega_local_v[0] = p;
486 omega_local_v[1] = q;
487 omega_local_v[2] = r;
490 FG_VECTOR_3 omega_total_v; // Diff btw B & L
491 // inline double * get_Omega_total_v() { return omega_total_v; }
492 // inline double get_P_total() const { return omega_total_v[0]; }
493 // inline double get_Q_total() const { return omega_total_v[1]; }
494 // inline double get_R_total() const { return omega_total_v[2]; }
495 /* inline void set_Omega_Total( double p, double q, double r ) {
496 omega_total_v[0] = p;
497 omega_total_v[1] = q;
498 omega_total_v[2] = r;
501 FG_VECTOR_3 euler_rates_v;
502 // inline double * get_Euler_rates_v() { return euler_rates_v; }
503 // inline double get_Phi_dot() const { return euler_rates_v[0]; }
504 // inline double get_Theta_dot() const { return euler_rates_v[1]; }
505 // inline double get_Psi_dot() const { return euler_rates_v[2]; }
506 /* inline void set_Euler_Rates( double phi, double theta, double psi ) {
507 euler_rates_v[0] = phi;
508 euler_rates_v[1] = theta;
509 euler_rates_v[2] = psi;
512 FG_VECTOR_3 geocentric_rates_v; // Geocentric linear velocities
513 // inline double * get_Geocentric_rates_v() { return geocentric_rates_v; }
514 // inline double get_Latitude_dot() const { return geocentric_rates_v[0]; }
515 // inline double get_Longitude_dot() const { return geocentric_rates_v[1]; }
516 // inline double get_Radius_dot() const { return geocentric_rates_v[2]; }
517 /* inline void set_Geocentric_Rates( double lat, double lon, double rad ) {
518 geocentric_rates_v[0] = lat;
519 geocentric_rates_v[1] = lon;
520 geocentric_rates_v[2] = rad;
523 /*=============================== Positions ===============================*/
525 FG_VECTOR_3 geocentric_position_v;
526 // inline double * get_Geocentric_position_v() {
527 // return geocentric_position_v;
529 inline double get_Lat_geocentric() const {
530 return geocentric_position_v[0];
532 inline double get_Lon_geocentric() const {
533 return geocentric_position_v[1];
535 inline double get_Radius_to_vehicle() const {
536 return geocentric_position_v[2];
538 inline void set_Radius_to_vehicle(double radius) {
539 geocentric_position_v[2] = radius;
541 inline void set_Geocentric_Position( double lat, double lon, double rad ) {
542 geocentric_position_v[0] = lat;
543 geocentric_position_v[1] = lon;
544 geocentric_position_v[2] = rad;
547 FG_VECTOR_3 geodetic_position_v;
548 // inline double * get_Geodetic_position_v() { return geodetic_position_v; }
549 inline double get_Latitude() const { return geodetic_position_v[0]; }
550 inline void set_Latitude(double lat) { geodetic_position_v[0] = lat; }
551 inline double get_Longitude() const { return geodetic_position_v[1]; }
552 inline void set_Longitude(double lon) { geodetic_position_v[1] = lon; }
553 inline double get_Altitude() const { return geodetic_position_v[2]; }
554 inline void set_Altitude(double altitude) {
555 geodetic_position_v[2] = altitude;
557 inline void set_Geodetic_Position( double lat, double lon, double alt ) {
558 geodetic_position_v[0] = lat;
559 geodetic_position_v[1] = lon;
560 geodetic_position_v[2] = alt;
563 FG_VECTOR_3 euler_angles_v;
564 // inline double * get_Euler_angles_v() { return euler_angles_v; }
565 inline double get_Phi() const { return euler_angles_v[0]; }
566 inline double get_Theta() const { return euler_angles_v[1]; }
567 inline double get_Psi() const { return euler_angles_v[2]; }
568 inline void set_Euler_Angles( double phi, double theta, double psi ) {
569 euler_angles_v[0] = phi;
570 euler_angles_v[1] = theta;
571 euler_angles_v[2] = psi;
575 /*======================= Miscellaneous quantities ========================*/
577 double t_local_to_body_m[3][3]; // Transformation matrix L to B
578 // inline double * get_T_local_to_body_m() { return t_local_to_body_m; }
579 inline double get_T_local_to_body_11() const {
580 return t_local_to_body_m[0][0];
582 inline double get_T_local_to_body_12() const {
583 return t_local_to_body_m[0][1];
585 inline double get_T_local_to_body_13() const {
586 return t_local_to_body_m[0][2];
588 inline double get_T_local_to_body_21() const {
589 return t_local_to_body_m[1][0];
591 inline double get_T_local_to_body_22() const {
592 return t_local_to_body_m[1][1];
594 inline double get_T_local_to_body_23() const {
595 return t_local_to_body_m[1][2];
597 inline double get_T_local_to_body_31() const {
598 return t_local_to_body_m[2][0];
600 inline double get_T_local_to_body_32() const {
601 return t_local_to_body_m[2][1];
603 inline double get_T_local_to_body_33() const {
604 return t_local_to_body_m[2][2];
606 inline void set_T_Local_to_Body( double m[3][3] ) {
608 for ( i = 0; i < 3; i++ ) {
609 for ( j = 0; j < 3; j++ ) {
610 t_local_to_body_m[i][j] = m[i][j];
615 double gravity; // Local acceleration due to G
616 // inline double get_Gravity() const { return gravity; }
617 // inline void set_Gravity(double g) { gravity = g; }
619 double centrifugal_relief; // load factor reduction due to speed
620 // inline double get_Centrifugal_relief() const { return centrifugal_relief; }
621 // inline void set_Centrifugal_relief(double cr) { centrifugal_relief = cr; }
623 double alpha, beta, alpha_dot, beta_dot; // in radians
624 // inline double get_Alpha() const { return alpha; }
625 // inline void set_Alpha( double a ) { alpha = a; }
626 inline double get_Beta() const { return beta; }
627 inline void set_Beta( double b ) { beta = b; }
628 // inline double get_Alpha_dot() const { return alpha_dot; }
629 // inline void set_Alpha_dot( double ad ) { alpha_dot = ad; }
630 // inline double get_Beta_dot() const { return beta_dot; }
631 // inline void set_Beta_dot( double bd ) { beta_dot = bd; }
633 double cos_alpha, sin_alpha, cos_beta, sin_beta;
634 // inline double get_Cos_alpha() const { return cos_alpha; }
635 // inline void set_Cos_alpha( double ca ) { cos_alpha = ca; }
636 // inline double get_Sin_alpha() const { return sin_alpha; }
637 // inline void set_Sin_alpha( double sa ) { sin_alpha = sa; }
638 // inline double get_Cos_beta() const { return cos_beta; }
639 // inline void set_Cos_beta( double cb ) { cos_beta = cb; }
640 // inline double get_Sin_beta() const { return sin_beta; }
641 // inline void set_Sin_beta( double sb ) { sin_beta = sb; }
643 double cos_phi, sin_phi, cos_theta, sin_theta, cos_psi, sin_psi;
644 // inline double get_Cos_phi() const { return cos_phi; }
645 // inline void set_Cos_phi( double cp ) { cos_phi = cp; }
646 // inline double get_Sin_phi() const { return sin_phi; }
647 // inline void set_Sin_phi( double sp ) { sin_phi = sp; }
648 // inline double get_Cos_theta() const { return cos_theta; }
649 // inline void set_Cos_theta( double ct ) { cos_theta = ct; }
650 // inline double get_Sin_theta() const { return sin_theta; }
651 // inline void set_Sin_theta( double st ) { sin_theta = st; }
652 // inline double get_Cos_psi() const { return cos_psi; }
653 // inline void set_Cos_psi( double cp ) { cos_psi = cp; }
654 // inline double get_Sin_psi() const { return sin_psi; }
655 // inline void set_Sin_psi( double sp ) { sin_psi = sp; }
657 double gamma_vert_rad, gamma_horiz_rad; // Flight path angles
658 inline double get_Gamma_vert_rad() const { return gamma_vert_rad; }
659 inline void set_Gamma_vert_rad( double gv ) { gamma_vert_rad = gv; }
660 // inline double get_Gamma_horiz_rad() const { return gamma_horiz_rad; }
661 // inline void set_Gamma_horiz_rad( double gh ) { gamma_horiz_rad = gh; }
663 double sigma, density, v_sound, mach_number;
664 // inline double get_Sigma() const { return sigma; }
665 // inline void set_Sigma( double s ) { sigma = s; }
666 // inline double get_Density() const { return density; }
667 // inline void set_Density( double d ) { density = d; }
668 // inline double get_V_sound() const { return v_sound; }
669 // inline void set_V_sound( double v ) { v_sound = v; }
670 // inline double get_Mach_number() const { return mach_number; }
671 // inline void set_Mach_number( double m ) { mach_number = m; }
673 double static_pressure, total_pressure, impact_pressure;
674 double dynamic_pressure;
675 // inline double get_Static_pressure() const { return static_pressure; }
676 // inline void set_Static_pressure( double sp ) { static_pressure = sp; }
677 // inline double get_Total_pressure() const { return total_pressure; }
678 // inline void set_Total_pressure( double tp ) { total_pressure = tp; }
679 // inline double get_Impact_pressure() const { return impact_pressure; }
680 // inline void set_Impact_pressure( double ip ) { impact_pressure = ip; }
681 // inline double get_Dynamic_pressure() const { return dynamic_pressure; }
682 // inline void set_Dynamic_pressure( double dp ) { dynamic_pressure = dp; }
684 double static_temperature, total_temperature;
685 // inline double get_Static_temperature() const { return static_temperature; }
686 // inline void set_Static_temperature( double t ) { static_temperature = t; }
687 // inline double get_Total_temperature() const { return total_temperature; }
688 // inline void set_Total_temperature( double t ) { total_temperature = t; }
690 double sea_level_radius, earth_position_angle;
691 inline double get_Sea_level_radius() const { return sea_level_radius; }
692 inline void set_Sea_level_radius( double r ) { sea_level_radius = r; }
693 inline double get_Earth_position_angle() const {
694 return earth_position_angle;
696 inline void set_Earth_position_angle(double a) {
697 earth_position_angle = a;
700 double runway_altitude, runway_latitude, runway_longitude;
701 double runway_heading;
702 inline double get_Runway_altitude() const { return runway_altitude; }
703 inline void set_Runway_altitude( double alt ) { runway_altitude = alt; }
704 // inline double get_Runway_latitude() const { return runway_latitude; }
705 // inline void set_Runway_latitude( double lat ) { runway_latitude = lat; }
706 // inline double get_Runway_longitude() const { return runway_longitude; }
707 // inline void set_Runway_longitude( double lon ) { runway_longitude = lon; }
708 // inline double get_Runway_heading() const { return runway_heading; }
709 // inline void set_Runway_heading( double h ) { runway_heading = h; }
711 double radius_to_rwy;
712 // inline double get_Radius_to_rwy() const { return radius_to_rwy; }
713 // inline void set_Radius_to_rwy( double r ) { radius_to_rwy = r; }
715 FG_VECTOR_3 d_cg_rwy_local_v; // CG rel. to rwy in local coords
716 // inline double * get_D_cg_rwy_local_v() { return d_cg_rwy_local_v; }
717 // inline double get_D_cg_north_of_rwy() const { return d_cg_rwy_local_v[0]; }
718 // inline double get_D_cg_east_of_rwy() const { return d_cg_rwy_local_v[1]; }
719 // inline double get_D_cg_above_rwy() const { return d_cg_rwy_local_v[2]; }
720 /* inline void set_CG_Rwy_Local( double north, double east, double above )
722 d_cg_rwy_local_v[0] = north;
723 d_cg_rwy_local_v[1] = east;
724 d_cg_rwy_local_v[2] = above;
727 FG_VECTOR_3 d_cg_rwy_rwy_v; // CG relative to rwy, in rwy coordinates
728 // inline double * get_D_cg_rwy_rwy_v() { return d_cg_rwy_rwy_v; }
729 // inline double get_X_cg_rwy() const { return d_cg_rwy_rwy_v[0]; }
730 // inline double get_Y_cg_rwy() const { return d_cg_rwy_rwy_v[1]; }
731 // inline double get_H_cg_rwy() const { return d_cg_rwy_rwy_v[2]; }
732 /* inline void set_CG_Rwy_Rwy( double x, double y, double h )
734 d_cg_rwy_rwy_v[0] = x;
735 d_cg_rwy_rwy_v[1] = y;
736 d_cg_rwy_rwy_v[2] = h;
739 FG_VECTOR_3 d_pilot_rwy_local_v; // pilot rel. to rwy in local coords
740 // inline double * get_D_pilot_rwy_local_v() { return d_pilot_rwy_local_v; }
741 // inline double get_D_pilot_north_of_rwy() const {
742 //return d_pilot_rwy_local_v[0];
744 // inline double get_D_pilot_east_of_rwy() const {
745 // return d_pilot_rwy_local_v[1];
747 // inline double get_D_pilot_above_rwy() const {
748 //return d_pilot_rwy_local_v[2];
750 /* inline void set_Pilot_Rwy_Local( double north, double east, double above )
752 d_pilot_rwy_local_v[0] = north;
753 d_pilot_rwy_local_v[1] = east;
754 d_pilot_rwy_local_v[2] = above;
757 FG_VECTOR_3 d_pilot_rwy_rwy_v; // pilot rel. to rwy, in rwy coords.
758 // inline double * get_D_pilot_rwy_rwy_v() { return d_pilot_rwy_rwy_v; }
759 // inline double get_X_pilot_rwy() const { return d_pilot_rwy_rwy_v[0]; }
760 // inline double get_Y_pilot_rwy() const { return d_pilot_rwy_rwy_v[1]; }
761 // inline double get_H_pilot_rwy() const { return d_pilot_rwy_rwy_v[2]; }
762 /* inline void set_Pilot_Rwy_Rwy( double x, double y, double h )
764 d_pilot_rwy_rwy_v[0] = x;
765 d_pilot_rwy_rwy_v[1] = y;
766 d_pilot_rwy_rwy_v[2] = h;
769 double climb_rate; // in feet per second
770 inline double get_Climb_Rate() const { return climb_rate; }
771 inline void set_Climb_Rate(double rate) { climb_rate = rate; }
775 extern FGState cur_fdm_state;
778 // General interface to the flight model routines
780 // Initialize the flight model parameters
781 int fgFlightModelInit(int model, FGState& f, double dt);
783 // Run multiloop iterations of the flight model
784 int fgFlightModelUpdate(int model, FGState& f, int multiloop, int jitter);
786 // Set the altitude (force)
787 void fgFlightModelSetAltitude(int model, double alt_meters);
790 #endif // _FLIGHT_HXX
794 // Revision 1.8 1999/01/08 03:23:52 curt
795 // Beginning work on compensating for sim time vs. real world time "jitter".
797 // Revision 1.7 1998/12/18 23:37:09 curt
798 // Collapsed out the FGState variables not currently needed. They are just
799 // commented out and can be readded easily at any time. The point of this
800 // exersize is to determine which variables were or were not currently being
803 // Revision 1.6 1998/12/05 15:54:12 curt
804 // Renamed class fgFLIGHT to class FGState as per request by JSB.
806 // Revision 1.5 1998/12/04 01:29:40 curt
807 // Stubbed in a new flight model called "External" which is expected to be driven
808 // from some external source.
810 // Revision 1.4 1998/12/03 04:25:03 curt
811 // Working on fixing up new fgFLIGHT class.
813 // Revision 1.3 1998/12/03 01:16:41 curt
814 // Converted fgFLIGHT to a class.
816 // Revision 1.2 1998/10/16 23:27:41 curt
819 // Revision 1.1 1998/10/16 20:16:44 curt
820 // Renamed flight.[ch] to flight.[ch]xx
822 // Revision 1.20 1998/09/29 14:57:39 curt
823 // c++-ified comments.
825 // Revision 1.19 1998/09/29 02:02:41 curt
826 // Added a rate of climb calculation.
828 // Revision 1.18 1998/07/30 23:44:36 curt
829 // Beginning to add support for multiple flight models.
831 // Revision 1.17 1998/07/12 03:08:28 curt
832 // Added fgFlightModelSetAltitude() to force the altitude to something
833 // other than the current altitude. LaRCsim doesn't let you do this by just
834 // changing FG_Altitude.
836 // Revision 1.16 1998/04/22 13:26:20 curt
837 // C++ - ifing the code a bit.
839 // Revision 1.15 1998/04/21 16:59:33 curt
840 // Integrated autopilot.
841 // Prepairing for C++ integration.
843 // Revision 1.14 1998/02/07 15:29:37 curt
844 // Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
845 // <chotchkiss@namg.us.anritsu.com>
847 // Revision 1.13 1998/01/24 00:04:59 curt
850 // Revision 1.12 1998/01/22 02:59:32 curt
851 // Changed #ifdef FILE_H to #ifdef _FILE_H
853 // Revision 1.11 1998/01/19 19:27:03 curt
854 // Merged in make system changes from Bob Kuehne <rpk@sgi.com>
855 // This should simplify things tremendously.
857 // Revision 1.10 1997/12/10 22:37:43 curt
858 // Prepended "fg" on the name of all global structures that didn't have it yet.
859 // i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
861 // Revision 1.9 1997/09/04 02:17:33 curt
864 // Revision 1.8 1997/08/27 03:30:06 curt
865 // Changed naming scheme of basic shared structures.
867 // Revision 1.7 1997/07/23 21:52:19 curt
868 // Put comments around the text after an #endif for increased portability.
870 // Revision 1.6 1997/06/21 17:52:22 curt
871 // Continue directory shuffling ... everything should be compilable/runnable
874 // Revision 1.5 1997/06/21 17:12:49 curt
875 // Capitalized subdirectory names.
877 // Revision 1.4 1997/05/29 22:39:57 curt
878 // Working on incorporating the LaRCsim flight model.
880 // Revision 1.3 1997/05/29 02:32:25 curt
881 // Starting to build generic flight model interface.
883 // Revision 1.2 1997/05/23 15:40:37 curt
884 // Added GNU copyright headers.
886 // Revision 1.1 1997/05/16 16:04:45 curt