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