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 <simgear/compiler.h>
91 #include <Time/timestamp.hxx>
97 typedef double FG_VECTOR_3[3];
100 class FGEngInterface {
111 double Manifold_Pressure;
113 double Percentage_Power;
119 inline double get_Throttle() const { return Throttle; }
120 inline double get_Mixture() const { return Mixture; }
121 inline double get_Prop_Advance() const { return Prop_Advance; }
122 inline double get_RPM() const { return RPM; }
123 inline double get_Manifold_Pressure() const { return Manifold_Pressure; }
124 inline double get_MaxHP() const { return MaxHP; }
125 inline double get_Percentage_Power() const { return Percentage_Power; }
126 inline double get_EGT() const { return EGT; }
127 inline double get_prop_thrust() const { return prop_thrust; }
129 inline void set_Throttle( double t ) { Throttle = t; }
130 inline void set_Mixture( double m ) { Mixture = m; }
131 inline void set_Prop_Advance( double p ) { Prop_Advance = p; }
132 inline void set_RPM( double r ) { RPM = r; }
133 inline void set_Manifold_Pressure( double mp ) { Manifold_Pressure = mp; }
134 inline void set_MaxHP( double hp ) { MaxHP = hp; }
135 inline void set_Percentage_Power( double p ) { Percentage_Power = p; }
136 inline void set_EGT( double e ) { EGT = e; }
137 inline void set_prop_thrust( double t ) { prop_thrust = t; }
141 typedef vector < FGEngInterface > engine_list;
144 // This is based heavily on LaRCsim/ls_generic.h
149 // Pilot location rel to ref pt
150 FG_VECTOR_3 d_pilot_rp_body_v;
152 // CG position w.r.t. ref. point
153 FG_VECTOR_3 d_cg_rp_body_v;
156 FG_VECTOR_3 f_body_total_v;
157 FG_VECTOR_3 f_local_total_v;
158 FG_VECTOR_3 f_aero_v;
159 FG_VECTOR_3 f_engine_v;
160 FG_VECTOR_3 f_gear_v;
163 FG_VECTOR_3 m_total_rp_v;
164 FG_VECTOR_3 m_total_cg_v;
165 FG_VECTOR_3 m_aero_v;
166 FG_VECTOR_3 m_engine_v;
167 FG_VECTOR_3 m_gear_v;
170 FG_VECTOR_3 v_dot_local_v;
171 FG_VECTOR_3 v_dot_body_v;
172 FG_VECTOR_3 a_cg_body_v;
173 FG_VECTOR_3 a_pilot_body_v;
174 FG_VECTOR_3 n_cg_body_v;
175 FG_VECTOR_3 n_pilot_body_v;
176 FG_VECTOR_3 omega_dot_body_v;
179 FG_VECTOR_3 v_local_v;
180 FG_VECTOR_3 v_local_rel_ground_v; // V rel w.r.t. earth surface
181 FG_VECTOR_3 v_local_airmass_v; // velocity of airmass (steady winds)
182 FG_VECTOR_3 v_local_rel_airmass_v; // velocity of veh. relative to airmass
183 FG_VECTOR_3 v_local_gust_v; // linear turbulence components, L frame
184 FG_VECTOR_3 v_wind_body_v; // Wind-relative velocities in body axis
186 FG_VECTOR_3 omega_body_v; // Angular B rates
187 FG_VECTOR_3 omega_local_v; // Angular L rates
188 FG_VECTOR_3 omega_total_v; // Diff btw B & L
189 FG_VECTOR_3 euler_rates_v;
190 FG_VECTOR_3 geocentric_rates_v; // Geocentric linear velocities
193 FG_VECTOR_3 geocentric_position_v;
194 FG_VECTOR_3 geodetic_position_v;
195 FG_VECTOR_3 euler_angles_v;
197 // Miscellaneous Quantities
198 FG_VECTOR_3 d_cg_rwy_local_v; // CG rel. to rwy in local coords
199 FG_VECTOR_3 d_cg_rwy_rwy_v; // CG relative to rwy, in rwy coordinates
200 FG_VECTOR_3 d_pilot_rwy_local_v; // pilot rel. to rwy in local coords
201 FG_VECTOR_3 d_pilot_rwy_rwy_v; // pilot rel. to rwy, in rwy coords.
204 double mass, i_xx, i_yy, i_zz, i_xz;
206 // Normal Load Factor
210 double v_rel_wind, v_true_kts, v_rel_ground, v_inertial;
211 double v_ground_speed, v_equiv, v_equiv_kts;
212 double v_calibrated, v_calibrated_kts;
214 // Miscellaneious Quantities
215 double t_local_to_body_m[3][3]; // Transformation matrix L to B
216 double gravity; // Local acceleration due to G
217 double centrifugal_relief; // load factor reduction due to speed
218 double alpha, beta, alpha_dot, beta_dot; // in radians
219 double cos_alpha, sin_alpha, cos_beta, sin_beta;
220 double cos_phi, sin_phi, cos_theta, sin_theta, cos_psi, sin_psi;
221 double gamma_vert_rad, gamma_horiz_rad; // Flight path angles
222 double sigma, density, v_sound, mach_number;
223 double static_pressure, total_pressure, impact_pressure;
224 double dynamic_pressure;
225 double static_temperature, total_temperature;
226 double sea_level_radius, earth_position_angle;
227 double runway_altitude, runway_latitude, runway_longitude;
228 double runway_heading;
229 double radius_to_rwy;
230 double climb_rate; // in feet per second
231 double sin_lat_geocentric, cos_lat_geocentric;
232 double sin_longitude, cos_longitude;
233 double sin_latitude, cos_latitude;
238 FGTimeStamp valid_stamp; // time this record is valid
239 FGTimeStamp next_stamp; // time this record is valid
244 virtual ~FGInterface();
246 virtual int init( double dt );
247 virtual int update( int multi_loop );
249 // Define the various supported flight models (many not yet implemented)
254 // The NASA LaRCsim (Navion) flight model
257 // Jon S. Berndt's new FDM written from the ground up in C++
260 // Christian's hot air balloon simulation
263 // The following aren't implemented but are here to spark
264 // thoughts and discussions, and maybe even action.
271 // Driven externally via a serial port, net, file, etc.
275 // ========== Mass properties and geometry values ==========
278 inline double get_Mass() const { return mass; }
279 inline double get_I_xx() const { return i_xx; }
280 inline double get_I_yy() const { return i_yy; }
281 inline double get_I_zz() const { return i_zz; }
282 inline double get_I_xz() const { return i_xz; }
283 inline void set_Inertias( double m, double xx, double yy,
284 double zz, double xz)
293 // Pilot location rel to ref pt
294 // inline double * get_D_pilot_rp_body_v() {
295 // return d_pilot_rp_body_v;
297 // inline double get_Dx_pilot() const { return d_pilot_rp_body_v[0]; }
298 // inline double get_Dy_pilot() const { return d_pilot_rp_body_v[1]; }
299 // inline double get_Dz_pilot() const { return d_pilot_rp_body_v[2]; }
300 /* inline void set_Pilot_Location( double dx, double dy, double dz ) {
301 d_pilot_rp_body_v[0] = dx;
302 d_pilot_rp_body_v[1] = dy;
303 d_pilot_rp_body_v[2] = dz;
306 // CG position w.r.t. ref. point
307 // inline double * get_D_cg_rp_body_v() { return d_cg_rp_body_v; }
308 inline double get_Dx_cg() const { return d_cg_rp_body_v[0]; }
309 inline double get_Dy_cg() const { return d_cg_rp_body_v[1]; }
310 inline double get_Dz_cg() const { return d_cg_rp_body_v[2]; }
311 inline void set_CG_Position( double dx, double dy, double dz ) {
312 d_cg_rp_body_v[0] = dx;
313 d_cg_rp_body_v[1] = dy;
314 d_cg_rp_body_v[2] = dz;
317 // ========== Forces ==========
319 // inline double * get_F_body_total_v() { return f_body_total_v; }
320 // inline double get_F_X() const { return f_body_total_v[0]; }
321 // inline double get_F_Y() const { return f_body_total_v[1]; }
322 // inline double get_F_Z() const { return f_body_total_v[2]; }
323 /* inline void set_Forces_Body_Total( double x, double y, double z ) {
324 f_body_total_v[0] = x;
325 f_body_total_v[1] = y;
326 f_body_total_v[2] = z;
329 // inline double * get_F_local_total_v() { return f_local_total_v; }
330 // inline double get_F_north() const { return f_local_total_v[0]; }
331 // inline double get_F_east() const { return f_local_total_v[1]; }
332 // inline double get_F_down() const { return f_local_total_v[2]; }
333 /* inline void set_Forces_Local_Total( double x, double y, double z ) {
334 f_local_total_v[0] = x;
335 f_local_total_v[1] = y;
336 f_local_total_v[2] = z;
339 // inline double * get_F_aero_v() { return f_aero_v; }
340 // inline double get_F_X_aero() const { return f_aero_v[0]; }
341 // inline double get_F_Y_aero() const { return f_aero_v[1]; }
342 // inline double get_F_Z_aero() const { return f_aero_v[2]; }
343 /* inline void set_Forces_Aero( double x, double y, double z ) {
349 // inline double * get_F_engine_v() { return f_engine_v; }
350 // inline double get_F_X_engine() const { return f_engine_v[0]; }
351 // inline double get_F_Y_engine() const { return f_engine_v[1]; }
352 // inline double get_F_Z_engine() const { return f_engine_v[2]; }
353 /* inline void set_Forces_Engine( double x, double y, double z ) {
359 // inline double * get_F_gear_v() { return f_gear_v; }
360 // inline double get_F_X_gear() const { return f_gear_v[0]; }
361 // inline double get_F_Y_gear() const { return f_gear_v[1]; }
362 // inline double get_F_Z_gear() const { return f_gear_v[2]; }
363 /* inline void set_Forces_Gear( double x, double y, double z ) {
369 // ========== Moments ==========
371 // inline double * get_M_total_rp_v() { return m_total_rp_v; }
372 // inline double get_M_l_rp() const { return m_total_rp_v[0]; }
373 // inline double get_M_m_rp() const { return m_total_rp_v[1]; }
374 // inline double get_M_n_rp() const { return m_total_rp_v[2]; }
375 /* inline void set_Moments_Total_RP( double l, double m, double n ) {
381 // inline double * get_M_total_cg_v() { return m_total_cg_v; }
382 // inline double get_M_l_cg() const { return m_total_cg_v[0]; }
383 // inline double get_M_m_cg() const { return m_total_cg_v[1]; }
384 // inline double get_M_n_cg() const { return m_total_cg_v[2]; }
385 /* inline void set_Moments_Total_CG( double l, double m, double n ) {
391 // inline double * get_M_aero_v() { return m_aero_v; }
392 // inline double get_M_l_aero() const { return m_aero_v[0]; }
393 // inline double get_M_m_aero() const { return m_aero_v[1]; }
394 // inline double get_M_n_aero() const { return m_aero_v[2]; }
395 /* inline void set_Moments_Aero( double l, double m, double n ) {
401 // inline double * get_M_engine_v() { return m_engine_v; }
402 // inline double get_M_l_engine() const { return m_engine_v[0]; }
403 // inline double get_M_m_engine() const { return m_engine_v[1]; }
404 // inline double get_M_n_engine() const { return m_engine_v[2]; }
405 /* inline void set_Moments_Engine( double l, double m, double n ) {
411 // inline double * get_M_gear_v() { return m_gear_v; }
412 // inline double get_M_l_gear() const { return m_gear_v[0]; }
413 // inline double get_M_m_gear() const { return m_gear_v[1]; }
414 // inline double get_M_n_gear() const { return m_gear_v[2]; }
415 /* inline void set_Moments_Gear( double l, double m, double n ) {
421 // ========== Accelerations ==========
423 // inline double * get_V_dot_local_v() { return v_dot_local_v; }
424 inline double get_V_dot_north() const { return v_dot_local_v[0]; }
425 inline double get_V_dot_east() const { return v_dot_local_v[1]; }
426 inline double get_V_dot_down() const { return v_dot_local_v[2]; }
427 inline void set_Accels_Local( double north, double east, double down ) {
428 v_dot_local_v[0] = north;
429 v_dot_local_v[1] = east;
430 v_dot_local_v[2] = down;
433 // inline double * get_V_dot_body_v() { return v_dot_body_v; }
434 inline double get_U_dot_body() const { return v_dot_body_v[0]; }
435 inline double get_V_dot_body() const { return v_dot_body_v[1]; }
436 inline double get_W_dot_body() const { return v_dot_body_v[2]; }
437 inline void set_Accels_Body( double u, double v, double w ) {
443 // inline double * get_A_cg_body_v() { return a_cg_body_v; }
444 inline double get_A_X_cg() const { return a_cg_body_v[0]; }
445 inline double get_A_Y_cg() const { return a_cg_body_v[1]; }
446 inline double get_A_Z_cg() const { return a_cg_body_v[2]; }
447 inline void set_Accels_CG_Body( double x, double y, double z ) {
453 // inline double * get_A_pilot_body_v() { return a_pilot_body_v; }
454 inline double get_A_X_pilot() const { return a_pilot_body_v[0]; }
455 inline double get_A_Y_pilot() const { return a_pilot_body_v[1]; }
456 inline double get_A_Z_pilot() const { return a_pilot_body_v[2]; }
457 inline void set_Accels_Pilot_Body( double x, double y, double z ) {
458 a_pilot_body_v[0] = x;
459 a_pilot_body_v[1] = y;
460 a_pilot_body_v[2] = z;
463 // inline double * get_N_cg_body_v() { return n_cg_body_v; }
464 // inline double get_N_X_cg() const { return n_cg_body_v[0]; }
465 // inline double get_N_Y_cg() const { return n_cg_body_v[1]; }
466 // inline double get_N_Z_cg() const { return n_cg_body_v[2]; }
467 // inline void set_Accels_CG_Body_N( double x, double y, double z ) {
468 // n_cg_body_v[0] = x;
469 // n_cg_body_v[1] = y;
470 // n_cg_body_v[2] = z;
473 // inline double * get_N_pilot_body_v() { return n_pilot_body_v; }
474 // inline double get_N_X_pilot() const { return n_pilot_body_v[0]; }
475 // inline double get_N_Y_pilot() const { return n_pilot_body_v[1]; }
476 // inline double get_N_Z_pilot() const { return n_pilot_body_v[2]; }
477 // inline void set_Accels_Pilot_Body_N( double x, double y, double z ) {
478 // n_pilot_body_v[0] = x;
479 // n_pilot_body_v[1] = y;
480 // n_pilot_body_v[2] = z;
483 double get_Nlf(void) { return nlf; }
484 void set_Nlf(double n) { nlf=n; }
486 // inline double * get_Omega_dot_body_v() { return omega_dot_body_v; }
487 // inline double get_P_dot_body() const { return omega_dot_body_v[0]; }
488 // inline double get_Q_dot_body() const { return omega_dot_body_v[1]; }
489 // inline double get_R_dot_body() const { return omega_dot_body_v[2]; }
490 /* inline void set_Accels_Omega( double p, double q, double r ) {
491 omega_dot_body_v[0] = p;
492 omega_dot_body_v[1] = q;
493 omega_dot_body_v[2] = r;
497 // ========== Velocities ==========
499 // inline double * get_V_local_v() { return v_local_v; }
500 inline double get_V_north() const { return v_local_v[0]; }
501 inline double get_V_east() const { return v_local_v[1]; }
502 inline double get_V_down() const { return v_local_v[2]; }
503 inline void set_Velocities_Local( double north, double east, double down ) {
504 v_local_v[0] = north;
509 // inline double * get_V_local_rel_ground_v() {
510 // return v_local_rel_ground_v;
512 // inline double get_V_north_rel_ground() const {
513 // return v_local_rel_ground_v[0];
515 // inline double get_V_east_rel_ground() const {
516 // return v_local_rel_ground_v[1];
518 // inline double get_V_down_rel_ground() const {
519 // return v_local_rel_ground_v[2];
521 // inline void set_Velocities_Ground(double north, double east, double down)
523 // v_local_rel_ground_v[0] = north;
524 // v_local_rel_ground_v[1] = east;
525 // v_local_rel_ground_v[2] = down;
528 // inline double * get_V_local_airmass_v() { return v_local_airmass_v; }
529 inline double get_V_north_airmass() const { return v_local_airmass_v[0]; }
530 inline double get_V_east_airmass() const { return v_local_airmass_v[1]; }
531 inline double get_V_down_airmass() const { return v_local_airmass_v[2]; }
532 inline void set_Velocities_Local_Airmass( double north, double east,
535 v_local_airmass_v[0] = north;
536 v_local_airmass_v[1] = east;
537 v_local_airmass_v[2] = down;
541 // inline double * get_V_local_rel_airmass_v() {
542 // return v_local_rel_airmass_v;
544 // inline double get_V_north_rel_airmass() const {
545 // return v_local_rel_airmass_v[0];
547 // inline double get_V_east_rel_airmass() const {
548 // return v_local_rel_airmass_v[1];
550 // inline double get_V_down_rel_airmass() const {
551 // return v_local_rel_airmass_v[2];
553 /* inline void set_Velocities_Local_Rel_Airmass( double north, double east,
556 v_local_rel_airmass_v[0] = north;
557 v_local_rel_airmass_v[1] = east;
558 v_local_rel_airmass_v[2] = down;
561 // inline double * get_V_local_gust_v() { return v_local_gust_v; }
562 // inline double get_U_gust() const { return v_local_gust_v[0]; }
563 // inline double get_V_gust() const { return v_local_gust_v[1]; }
564 // inline double get_W_gust() const { return v_local_gust_v[2]; }
565 /* inline void set_Velocities_Gust( double u, double v, double w)
567 v_local_gust_v[0] = u;
568 v_local_gust_v[1] = v;
569 v_local_gust_v[2] = w;
572 // inline double * get_V_wind_body_v() { return v_wind_body_v; }
573 inline double get_U_body() const { return v_wind_body_v[0]; }
574 inline double get_V_body() const { return v_wind_body_v[1]; }
575 inline double get_W_body() const { return v_wind_body_v[2]; }
576 inline void set_Velocities_Wind_Body( double u, double v, double w) {
577 v_wind_body_v[0] = u;
578 v_wind_body_v[1] = v;
579 v_wind_body_v[2] = w;
582 // inline double get_V_rel_wind() const { return v_rel_wind; }
583 // inline void set_V_rel_wind(double wind) { v_rel_wind = wind; }
585 // inline double get_V_true_kts() const { return v_true_kts; }
586 // inline void set_V_true_kts(double kts) { v_true_kts = kts; }
588 // inline double get_V_rel_ground() const { return v_rel_ground; }
589 // inline void set_V_rel_ground( double v ) { v_rel_ground = v; }
591 // inline double get_V_inertial() const { return v_inertial; }
592 // inline void set_V_inertial(double v) { v_inertial = v; }
594 inline double get_V_ground_speed() const { return v_ground_speed; }
595 inline void set_V_ground_speed( double v) { v_ground_speed = v; }
597 // inline double get_V_equiv() const { return v_equiv; }
598 // inline void set_V_equiv( double v ) { v_equiv = v; }
600 inline double get_V_equiv_kts() const { return v_equiv_kts; }
601 inline void set_V_equiv_kts( double kts ) { v_equiv_kts = kts; }
603 //inline double get_V_calibrated() const { return v_calibrated; }
604 //inline void set_V_calibrated( double v ) { v_calibrated = v; }
606 inline double get_V_calibrated_kts() const { return v_calibrated_kts; }
607 inline void set_V_calibrated_kts( double kts ) { v_calibrated_kts = kts; }
609 // inline double * get_Omega_body_v() { return omega_body_v; }
610 inline double get_P_body() const { return omega_body_v[0]; }
611 inline double get_Q_body() const { return omega_body_v[1]; }
612 inline double get_R_body() const { return omega_body_v[2]; }
613 inline void set_Omega_Body( double p, double q, double r ) {
619 // inline double * get_Omega_local_v() { return omega_local_v; }
620 // inline double get_P_local() const { return omega_local_v[0]; }
621 // inline double get_Q_local() const { return omega_local_v[1]; }
622 // inline double get_R_local() const { return omega_local_v[2]; }
623 /* inline void set_Omega_Local( double p, double q, double r ) {
624 omega_local_v[0] = p;
625 omega_local_v[1] = q;
626 omega_local_v[2] = r;
629 // inline double * get_Omega_total_v() { return omega_total_v; }
630 // inline double get_P_total() const { return omega_total_v[0]; }
631 // inline double get_Q_total() const { return omega_total_v[1]; }
632 // inline double get_R_total() const { return omega_total_v[2]; }
633 /* inline void set_Omega_Total( double p, double q, double r ) {
634 omega_total_v[0] = p;
635 omega_total_v[1] = q;
636 omega_total_v[2] = r;
639 // inline double * get_Euler_rates_v() { return euler_rates_v; }
640 inline double get_Phi_dot() const { return euler_rates_v[0]; }
641 inline double get_Theta_dot() const { return euler_rates_v[1]; }
642 inline double get_Psi_dot() const { return euler_rates_v[2]; }
643 inline void set_Euler_Rates( double phi, double theta, double psi ) {
644 euler_rates_v[0] = phi;
645 euler_rates_v[1] = theta;
646 euler_rates_v[2] = psi;
649 // inline double * get_Geocentric_rates_v() { return geocentric_rates_v; }
650 inline double get_Latitude_dot() const { return geocentric_rates_v[0]; }
651 inline double get_Longitude_dot() const { return geocentric_rates_v[1]; }
652 inline double get_Radius_dot() const { return geocentric_rates_v[2]; }
653 inline void set_Geocentric_Rates( double lat, double lon, double rad ) {
654 geocentric_rates_v[0] = lat;
655 geocentric_rates_v[1] = lon;
656 geocentric_rates_v[2] = rad;
659 // ========== Positions ==========
661 // inline double * get_Geocentric_position_v() {
662 // return geocentric_position_v;
664 inline double get_Lat_geocentric() const {
665 return geocentric_position_v[0];
667 inline double get_Lon_geocentric() const {
668 return geocentric_position_v[1];
670 inline double get_Radius_to_vehicle() const {
671 return geocentric_position_v[2];
673 inline void set_Radius_to_vehicle(double radius) {
674 geocentric_position_v[2] = radius;
677 inline void set_Geocentric_Position( double lat, double lon, double rad ) {
678 geocentric_position_v[0] = lat;
679 geocentric_position_v[1] = lon;
680 geocentric_position_v[2] = rad;
683 // inline double * get_Geodetic_position_v() { return geodetic_position_v; }
684 inline double get_Latitude() const { return geodetic_position_v[0]; }
685 inline void set_Latitude(double lat) { geodetic_position_v[0] = lat; }
686 inline double get_Longitude() const { return geodetic_position_v[1]; }
687 inline void set_Longitude(double lon) { geodetic_position_v[1] = lon; }
688 inline double get_Altitude() const { return geodetic_position_v[2]; }
689 inline void set_Altitude(double altitude) {
690 geodetic_position_v[2] = altitude;
692 inline void set_Geodetic_Position( double lat, double lon, double alt ) {
693 geodetic_position_v[0] = lat;
694 geodetic_position_v[1] = lon;
695 geodetic_position_v[2] = alt;
698 // inline double * get_Euler_angles_v() { return euler_angles_v; }
699 inline double get_Phi() const { return euler_angles_v[0]; }
700 inline double get_Theta() const { return euler_angles_v[1]; }
701 inline double get_Psi() const { return euler_angles_v[2]; }
702 inline void set_Euler_Angles( double phi, double theta, double psi ) {
703 euler_angles_v[0] = phi;
704 euler_angles_v[1] = theta;
705 euler_angles_v[2] = psi;
709 // ========== Miscellaneous quantities ==========
711 // inline double * get_T_local_to_body_m() { return t_local_to_body_m; }
712 inline double get_T_local_to_body_11() const {
713 return t_local_to_body_m[0][0];
715 inline double get_T_local_to_body_12() const {
716 return t_local_to_body_m[0][1];
718 inline double get_T_local_to_body_13() const {
719 return t_local_to_body_m[0][2];
721 inline double get_T_local_to_body_21() const {
722 return t_local_to_body_m[1][0];
724 inline double get_T_local_to_body_22() const {
725 return t_local_to_body_m[1][1];
727 inline double get_T_local_to_body_23() const {
728 return t_local_to_body_m[1][2];
730 inline double get_T_local_to_body_31() const {
731 return t_local_to_body_m[2][0];
733 inline double get_T_local_to_body_32() const {
734 return t_local_to_body_m[2][1];
736 inline double get_T_local_to_body_33() const {
737 return t_local_to_body_m[2][2];
739 inline void set_T_Local_to_Body( int i, int j, double value) {
740 t_local_to_body_m[i-1][j-1] = value;
742 inline void set_T_Local_to_Body( double m[3][3] ) {
744 for ( i = 0; i < 3; i++ ) {
745 for ( j = 0; j < 3; j++ ) {
746 t_local_to_body_m[i][j] = m[i][j];
751 // inline double get_Gravity() const { return gravity; }
752 // inline void set_Gravity(double g) { gravity = g; }
754 // inline double get_Centrifugal_relief() const {
755 // return centrifugal_relief;
757 // inline void set_Centrifugal_relief(double cr) {
758 // centrifugal_relief = cr;
761 inline double get_Alpha() const { return alpha; }
762 inline void set_Alpha( double a ) { alpha = a; }
763 inline double get_Beta() const { return beta; }
764 inline void set_Beta( double b ) { beta = b; }
765 // inline double get_Alpha_dot() const { return alpha_dot; }
766 // inline void set_Alpha_dot( double ad ) { alpha_dot = ad; }
767 // inline double get_Beta_dot() const { return beta_dot; }
768 // inline void set_Beta_dot( double bd ) { beta_dot = bd; }
770 // inline double get_Cos_alpha() const { return cos_alpha; }
771 // inline void set_Cos_alpha( double ca ) { cos_alpha = ca; }
772 // inline double get_Sin_alpha() const { return sin_alpha; }
773 // inline void set_Sin_alpha( double sa ) { sin_alpha = sa; }
774 // inline double get_Cos_beta() const { return cos_beta; }
775 // inline void set_Cos_beta( double cb ) { cos_beta = cb; }
776 // inline double get_Sin_beta() const { return sin_beta; }
777 // inline void set_Sin_beta( double sb ) { sin_beta = sb; }
779 inline double get_Cos_phi() const { return cos_phi; }
780 inline void set_Cos_phi( double cp ) { cos_phi = cp; }
781 // inline double get_Sin_phi() const { return sin_phi; }
782 // inline void set_Sin_phi( double sp ) { sin_phi = sp; }
783 inline double get_Cos_theta() const { return cos_theta; }
784 inline void set_Cos_theta( double ct ) { cos_theta = ct; }
785 // inline double get_Sin_theta() const { return sin_theta; }
786 // inline void set_Sin_theta( double st ) { sin_theta = st; }
787 // inline double get_Cos_psi() const { return cos_psi; }
788 // inline void set_Cos_psi( double cp ) { cos_psi = cp; }
789 // inline double get_Sin_psi() const { return sin_psi; }
790 // inline void set_Sin_psi( double sp ) { sin_psi = sp; }
792 inline double get_Gamma_vert_rad() const { return gamma_vert_rad; }
793 inline void set_Gamma_vert_rad( double gv ) { gamma_vert_rad = gv; }
794 // inline double get_Gamma_horiz_rad() const { return gamma_horiz_rad; }
795 // inline void set_Gamma_horiz_rad( double gh ) { gamma_horiz_rad = gh; }
797 // inline double get_Sigma() const { return sigma; }
798 // inline void set_Sigma( double s ) { sigma = s; }
799 inline double get_Density() const { return density; }
800 inline void set_Density( double d ) { density = d; }
801 // inline double get_V_sound() const { return v_sound; }
802 // inline void set_V_sound( double v ) { v_sound = v; }
803 inline double get_Mach_number() const { return mach_number; }
804 inline void set_Mach_number( double m ) { mach_number = m; }
806 inline double get_Static_pressure() const { return static_pressure; }
807 inline void set_Static_pressure( double sp ) { static_pressure = sp; }
808 // inline double get_Total_pressure() const { return total_pressure; }
809 // inline void set_Total_pressure( double tp ) { total_pressure = tp; }
810 // inline double get_Impact_pressure() const { return impact_pressure; }
811 // inline void set_Impact_pressure( double ip ) { impact_pressure = ip; }
812 // inline double get_Dynamic_pressure() const { return dynamic_pressure; }
813 // inline void set_Dynamic_pressure( double dp ) { dynamic_pressure = dp; }
815 inline double get_Static_temperature() const { return static_temperature; }
816 inline void set_Static_temperature( double t ) { static_temperature = t; }
817 // inline double get_Total_temperature() const { return total_temperature; }
818 // inline void set_Total_temperature( double t ) { total_temperature = t; }
820 inline double get_Sea_level_radius() const { return sea_level_radius; }
821 inline void set_Sea_level_radius( double r ) { sea_level_radius = r; }
822 inline double get_Earth_position_angle() const {
823 return earth_position_angle;
825 inline void set_Earth_position_angle(double a) {
826 earth_position_angle = a;
829 inline double get_Runway_altitude() const { return runway_altitude; }
830 inline void set_Runway_altitude( double alt ) { runway_altitude = alt; }
831 // inline double get_Runway_latitude() const { return runway_latitude; }
832 // inline void set_Runway_latitude( double lat ) { runway_latitude = lat; }
833 // inline double get_Runway_longitude() const { return runway_longitude; }
834 // inline void set_Runway_longitude( double lon ) {
835 // runway_longitude = lon;
837 // inline double get_Runway_heading() const { return runway_heading; }
838 // inline void set_Runway_heading( double h ) { runway_heading = h; }
840 // inline double get_Radius_to_rwy() const { return radius_to_rwy; }
841 // inline void set_Radius_to_rwy( double r ) { radius_to_rwy = r; }
843 // inline double * get_D_cg_rwy_local_v() { return d_cg_rwy_local_v; }
844 // inline double get_D_cg_north_of_rwy() const {
845 // return d_cg_rwy_local_v[0];
847 // inline double get_D_cg_east_of_rwy() const {
848 // return d_cg_rwy_local_v[1];
850 // inline double get_D_cg_above_rwy() const { return d_cg_rwy_local_v[2]; }
851 /* inline void set_CG_Rwy_Local( double north, double east, double above )
853 d_cg_rwy_local_v[0] = north;
854 d_cg_rwy_local_v[1] = east;
855 d_cg_rwy_local_v[2] = above;
858 // inline double * get_D_cg_rwy_rwy_v() { return d_cg_rwy_rwy_v; }
859 // inline double get_X_cg_rwy() const { return d_cg_rwy_rwy_v[0]; }
860 // inline double get_Y_cg_rwy() const { return d_cg_rwy_rwy_v[1]; }
861 // inline double get_H_cg_rwy() const { return d_cg_rwy_rwy_v[2]; }
862 /* inline void set_CG_Rwy_Rwy( double x, double y, double h )
864 d_cg_rwy_rwy_v[0] = x;
865 d_cg_rwy_rwy_v[1] = y;
866 d_cg_rwy_rwy_v[2] = h;
869 // inline double * get_D_pilot_rwy_local_v() { return d_pilot_rwy_local_v; }
870 // inline double get_D_pilot_north_of_rwy() const {
871 // return d_pilot_rwy_local_v[0];
873 // inline double get_D_pilot_east_of_rwy() const {
874 // return d_pilot_rwy_local_v[1];
876 // inline double get_D_pilot_above_rwy() const {
877 // return d_pilot_rwy_local_v[2];
879 /* inline void set_Pilot_Rwy_Local( double north, double east, double above )
881 d_pilot_rwy_local_v[0] = north;
882 d_pilot_rwy_local_v[1] = east;
883 d_pilot_rwy_local_v[2] = above;
886 // inline double * get_D_pilot_rwy_rwy_v() { return d_pilot_rwy_rwy_v; }
887 // inline double get_X_pilot_rwy() const { return d_pilot_rwy_rwy_v[0]; }
888 // inline double get_Y_pilot_rwy() const { return d_pilot_rwy_rwy_v[1]; }
889 // inline double get_H_pilot_rwy() const { return d_pilot_rwy_rwy_v[2]; }
890 /* inline void set_Pilot_Rwy_Rwy( double x, double y, double h )
892 d_pilot_rwy_rwy_v[0] = x;
893 d_pilot_rwy_rwy_v[1] = y;
894 d_pilot_rwy_rwy_v[2] = h;
897 inline double get_Climb_Rate() const { return climb_rate; }
898 inline void set_Climb_Rate(double rate) { climb_rate = rate; }
900 inline FGTimeStamp get_time_stamp() const { return valid_stamp; }
901 inline void stamp_time() { valid_stamp = next_stamp; next_stamp.stamp(); }
903 // Extrapolate FDM based on time_offset (in usec)
904 void extrapolate( int time_offset );
906 // sin/cos lat_geocentric
907 inline void set_sin_lat_geocentric(double parm) {
908 sin_lat_geocentric = sin(parm);
910 inline void set_cos_lat_geocentric(double parm) {
911 cos_lat_geocentric = cos(parm);
913 inline double get_sin_lat_geocentric(void) const {
914 return sin_lat_geocentric;
916 inline double get_cos_lat_geocentric(void) const {
917 return cos_lat_geocentric;
920 inline void set_sin_cos_longitude(double parm) {
921 sin_longitude = sin(parm);
922 cos_longitude = cos(parm);
924 inline double get_sin_longitude(void) const {
925 return sin_longitude;
927 inline double get_cos_longitude(void) const {
928 return cos_longitude;
931 inline void set_sin_cos_latitude(double parm) {
932 sin_latitude = sin(parm);
933 cos_latitude = cos(parm);
935 inline double get_sin_latitude(void) const {
938 inline double get_cos_latitude(void) const {
943 inline double get_num_engines() const {
944 return engines.size();
947 inline FGEngInterface* get_engine( int i ) {
951 inline void add_engine( FGEngInterface e ) {
952 return engines.push_back( e );
957 typedef list < FGInterface > fdm_state_list;
958 typedef fdm_state_list::iterator fdm_state_list_iterator;
959 typedef fdm_state_list::const_iterator const_fdm_state_list_iterator;
962 extern FGInterface * cur_fdm_state;
965 // General interface to the flight model routines
967 // Initialize the flight model parameters
968 int fgFDMInit(int model, FGInterface& f, double dt);
970 // Run multiloop iterations of the flight model
971 int fgFDMUpdate(int model, FGInterface& f, int multiloop, int jitter);
973 // Set the altitude (force)
974 void fgFDMForceAltitude(int model, double alt_meters);
976 // Set the local ground elevation
977 void fgFDMSetGroundElevation(int model, double alt_meters);
980 #endif // _FLIGHT_HXX