]> git.mxchange.org Git - flightgear.git/blob - src/Network/net_fdm.hxx
f619b0d962ac2b3dab1eb52324736f66d7501c84
[flightgear.git] / src / Network / net_fdm.hxx
1 // net_fdm.hxx -- defines a common net I/O interface to the flight
2 //                dynamics model
3 //
4 // Written by Curtis Olson - http://www.flightgear.org/~curt
5 // Started September 2001.
6 //
7 // This file is in the Public Domain, and comes with no warranty.
8 //
9 // $Id$
10
11
12 #ifndef _NET_FDM_HXX
13 #define _NET_FDM_HXX
14
15
16 #ifndef __cplusplus                                                          
17 # error This library requires C++
18 #endif                                   
19
20 #include <time.h> // time_t
21
22 const int FG_NET_FDM_VERSION = 20;
23
24
25 // Define a structure containing the top level flight dynamics model
26 // parameters
27
28 class FGNetFDM {
29
30 public:
31
32     int version;                // increment when data values change
33     int pad;                    // keep doubles 64-bit aligned for some
34                                 // hardware platforms, such as the Sun
35                                 // SPARC, which don't like misaligned
36                                 // data
37
38     enum {
39         FG_MAX_ENGINES = 4,
40         FG_MAX_WHEELS = 3,
41         FG_MAX_TANKS = 4
42     };
43
44     // Positions
45     double longitude;           // geodetic (radians)
46     double latitude;            // geodetic (radians)
47     double altitude;            // above sea level (meters)
48     float agl;                  // above ground level (meters)
49     float phi;                  // roll (radians)
50     float theta;                // pitch (radians)
51     float psi;                  // yaw or true heading (radians)
52     float alpha;                // angle of attack (radians)
53     float beta;                 // side slip angle (radians)
54
55     // Velocities
56     float phidot;               // roll rate (radians/sec)
57     float thetadot;             // pitch rate (radians/sec)
58     float psidot;               // yaw rate (radians/sec)
59     float vcas;                 // calibrated airspeed
60     float climb_rate;           // feet per second
61     float v_north;              // north velocity in local/body frame, fps
62     float v_east;               // east velocity in local/body frame, fps
63     float v_down;               // down/vertical velocity in local/body frame, fps
64     float v_wind_body_north;    // north velocity in local/body frame
65                                 // relative to local airmass, fps
66     float v_wind_body_east;     // east velocity in local/body frame
67                                 // relative to local airmass, fps
68     float v_wind_body_down;     // down/vertical velocity in local/body
69                                 // frame relative to local airmass, fps
70
71     // Accelerations
72     float A_X_pilot;            // X accel in body frame ft/sec^2
73     float A_Y_pilot;            // Y accel in body frame ft/sec^2
74     float A_Z_pilot;            // Z accel in body frame ft/sec^2
75
76     // Stall
77     float stall_warning;        // 0.0 - 1.0 indicating the amount of stall
78     float slip_deg;             // slip ball deflection
79
80     // Pressure
81     
82     // Engine status
83     int num_engines;                 // Number of valid engines
84     int eng_state[FG_MAX_ENGINES];   // Engine state (off, cranking, running)
85     float rpm[FG_MAX_ENGINES];       // Engine RPM rev/min
86     float fuel_flow[FG_MAX_ENGINES]; // Fuel flow gallons/hr
87     float egt[FG_MAX_ENGINES];       // Exhuast gas temp deg F
88     float cht[FG_MAX_ENGINES];       // Cylinder head temp deg F
89     float mp_osi[FG_MAX_ENGINES];    // Manifold pressure
90     float tit[FG_MAX_ENGINES];       // Turbine Inlet Temperature
91     float oil_temp[FG_MAX_ENGINES];  // Oil temp deg F
92     float oil_px[FG_MAX_ENGINES];    // Oil pressure psi
93
94     // Consumables
95     int num_tanks;              // Max number of fuel tanks
96     float fuel_quantity[FG_MAX_TANKS];
97
98     // Gear status
99     int num_wheels;
100     bool wow[FG_MAX_WHEELS];
101     float gear_pos[FG_MAX_WHEELS];
102     float gear_steer[FG_MAX_WHEELS];
103     float gear_compression[FG_MAX_WHEELS];
104
105     // Environment
106     time_t cur_time;            // current unix time
107     long int warp;              // offset in seconds to unix time
108     float visibility;           // visibility in meters (for env. effects)
109
110     // Control surface positions (normalized values)
111     float elevator;
112     float elevator_trim_tab;
113     float left_flap;
114     float right_flap;
115     float left_aileron;
116     float right_aileron;
117     float rudder;
118     float nose_wheel;
119     float speedbrake;
120     float spoilers;
121 };
122
123
124 #endif // _NET_FDM_HXX