]> git.mxchange.org Git - flightgear.git/blob - src/Network/net_fdm.hxx
2164cc8d8c72223e98aeaaabe7bd5c7d19ec2c8d
[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 #include <time.h> // time_t
17
18 // NOTE: this file defines an external interface structure.  Due to
19 // variability between platforms and architectures, we only used fixed
20 // length types here.  Specifically, integer types can vary in length.
21 // I am not aware of any platforms that don't use 4 bytes for float
22 // and 8 bytes for double.
23
24 #ifdef HAVE_STDINT_H
25 # include <stdint.h>
26 #elif defined( _MSC_VER ) || defined(__MINGW32__) || defined(sun)
27 typedef signed short     int16_t;
28 typedef signed int       int32_t;
29 typedef unsigned short   uint16_t;
30 typedef unsigned int     uint32_t;
31 #else
32 # error "Port me! Platforms that don't have <stdint.h> need to define int8_t, et. al."
33 #endif
34
35 const uint32_t FG_NET_FDM_VERSION = 22;
36
37
38 // Define a structure containing the top level flight dynamics model
39 // parameters
40
41 class FGNetFDM {
42
43 public:
44
45     enum {
46         FG_MAX_ENGINES = 4,
47         FG_MAX_WHEELS = 3,
48         FG_MAX_TANKS = 4
49     };
50
51     uint32_t version;           // increment when data values change
52
53     // Positions
54     double longitude;           // geodetic (radians)
55     double latitude;            // geodetic (radians)
56     double altitude;            // above sea level (meters)
57     float agl;                  // above ground level (meters)
58     float phi;                  // roll (radians)
59     float theta;                // pitch (radians)
60     float psi;                  // yaw or true heading (radians)
61     float alpha;                // angle of attack (radians)
62     float beta;                 // side slip angle (radians)
63
64     // Velocities
65     float phidot;               // roll rate (radians/sec)
66     float thetadot;             // pitch rate (radians/sec)
67     float psidot;               // yaw rate (radians/sec)
68     float vcas;                 // calibrated airspeed
69     float climb_rate;           // feet per second
70     float v_north;              // north velocity in local/body frame, fps
71     float v_east;               // east velocity in local/body frame, fps
72     float v_down;               // down/vertical velocity in local/body frame, fps
73     float v_wind_body_north;    // north velocity in local/body frame
74                                 // relative to local airmass, fps
75     float v_wind_body_east;     // east velocity in local/body frame
76                                 // relative to local airmass, fps
77     float v_wind_body_down;     // down/vertical velocity in local/body
78                                 // frame relative to local airmass, fps
79
80     // Accelerations
81     float A_X_pilot;            // X accel in body frame ft/sec^2
82     float A_Y_pilot;            // Y accel in body frame ft/sec^2
83     float A_Z_pilot;            // Z accel in body frame ft/sec^2
84
85     // Stall
86     float stall_warning;        // 0.0 - 1.0 indicating the amount of stall
87     float slip_deg;             // slip ball deflection
88
89     // Pressure
90     
91     // Engine status
92     uint32_t num_engines;            // Number of valid engines
93     uint32_t eng_state[FG_MAX_ENGINES];// Engine state (off, cranking, running)
94     float rpm[FG_MAX_ENGINES];       // Engine RPM rev/min
95     float fuel_flow[FG_MAX_ENGINES]; // Fuel flow gallons/hr
96     float egt[FG_MAX_ENGINES];       // Exhuast gas temp deg F
97     float cht[FG_MAX_ENGINES];       // Cylinder head temp deg F
98     float mp_osi[FG_MAX_ENGINES];    // Manifold pressure
99     float tit[FG_MAX_ENGINES];       // Turbine Inlet Temperature
100     float oil_temp[FG_MAX_ENGINES];  // Oil temp deg F
101     float oil_px[FG_MAX_ENGINES];    // Oil pressure psi
102
103     // Consumables
104     uint32_t num_tanks;         // Max number of fuel tanks
105     float fuel_quantity[FG_MAX_TANKS];
106
107     // Gear status
108     uint32_t num_wheels;
109     uint32_t wow[FG_MAX_WHEELS];
110     float gear_pos[FG_MAX_WHEELS];
111     float gear_steer[FG_MAX_WHEELS];
112     float gear_compression[FG_MAX_WHEELS];
113
114     // Environment
115     uint32_t cur_time;           // current unix time
116                                  // FIXME: make this uint64_t before 2038
117     int32_t warp;                // offset in seconds to unix time
118     float visibility;            // visibility in meters (for env. effects)
119
120     // Control surface positions (normalized values)
121     float elevator;
122     float elevator_trim_tab;
123     float left_flap;
124     float right_flap;
125     float left_aileron;
126     float right_aileron;
127     float rudder;
128     float nose_wheel;
129     float speedbrake;
130     float spoilers;
131 };
132
133
134 #endif // _NET_FDM_HXX