]> git.mxchange.org Git - flightgear.git/blob - src/Network/net_fdm.hxx
Add David Culp's AI model manager code which is derived from David Luff's AI/ATC...
[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, started September 2001.
5 //
6 // Copyright (C) 2001  Curtis L. Olson  - curt@flightgear.com
7 //
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License as
10 // published by the Free Software Foundation; either version 2 of the
11 // License, or (at your option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful, but
14 // WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 // General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 //
22 // $Id$
23
24
25 #ifndef _NET_FDM_HXX
26 #define _NET_FDM_HXX
27
28
29 #ifndef __cplusplus                                                          
30 # error This library requires C++
31 #endif                                   
32
33 #include <time.h> // time_t
34
35 const int FG_NET_FDM_VERSION = 16;
36
37
38 // Define a structure containing the top level flight dynamics model
39 // parameters
40
41 class FGNetFDM {
42
43 public:
44
45     int version;                // increment when data values change
46     int pad;                    // keep doubles 64-bit aligned for some
47                                 // hardware platforms, such as the Sun
48                                 // SPARC, which don't like misaligned
49                                 // data
50
51     enum {
52         FG_MAX_ENGINES = 4,
53         FG_MAX_WHEELS = 3,
54         FG_MAX_TANKS = 4
55     };
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
66     float beta;                 // side slip angle
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     int num_engines;            // Number of valid engines
97     int 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 oil_temp[FG_MAX_ENGINES]; // Oil temp deg F
102     float oil_px[FG_MAX_ENGINES]; // Oil pressure psi
103
104     // Consumables
105     int num_tanks;              // Max number of fuel tanks
106     float fuel_quantity[FG_MAX_TANKS];
107
108     // Gear status
109     int num_wheels;
110     bool wow[FG_MAX_WHEELS];
111     float gear_pos[FG_MAX_WHEELS];
112     float gear_steer[FG_MAX_WHEELS];
113     float gear_compression[FG_MAX_WHEELS];
114
115     // Environment
116     time_t cur_time;            // current unix time
117     long int 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 flaps;
123     float left_aileron;
124     float right_aileron;
125     float rudder;
126     float nose_wheel;
127     float speedbrake;
128     float spoilers;
129 };
130
131
132 #endif // _NET_FDM_HXX