]> git.mxchange.org Git - flightgear.git/blob - LaRCsim/navion_aero.c
18e1f3393c2fbfc829d03f2f3408b70932d869a7
[flightgear.git] / LaRCsim / navion_aero.c
1 /***************************************************************************
2
3   TITLE:        Navion_aero
4                 
5 ----------------------------------------------------------------------------
6
7   FUNCTION:     Linear aerodynamics model
8
9 ----------------------------------------------------------------------------
10
11   MODULE STATUS:        developmental
12
13 ----------------------------------------------------------------------------
14
15   GENEALOGY:    Based upon class notes from AA271, Stanford University,
16                 Spring 1988.  Dr. Robert Cannon, instructor.  
17
18 ----------------------------------------------------------------------------
19
20   DESIGNED BY:  Bruce Jackson
21                 
22   CODED BY:             Bruce Jackson
23                 
24   MAINTAINED BY:        Bruce Jackson
25
26 ----------------------------------------------------------------------------
27
28   MODIFICATION HISTORY:
29                 
30   DATE          PURPOSE                                                                                         BY
31   921229     Changed Alpha, Beta into radians; added Alpha bias.
32                                                  EBJ
33   930105     Modified to support linear airframe simulation by
34                            adding shared memory initialization routine. EBJ
35   931013     Added scaling by airspeed,  to allow for low-airspeed
36                             ground operations.                          EBJ
37   940216    Scaled long, lat stick and rudder to more appropriate values 
38             of elevator and aileron. EBJ
39
40 ----------------------------------------------------------------------------
41
42   REFERENCES:
43
44 The Navion "aero" routine is a simple representation of the North
45 American Navion airplane, a 1950-s vintage single-engine, low-wing
46 mono-lane built by NAA (who built the famous P-51 Mustang) supposedly
47 as a plane for returning WW-II fighter jocks to carry the family
48 around the country in. Unfortunately underpowered, it can still be
49 found in small airports across the United States. From behind, it sort
50 of looks like a Volkswagen driving a Piper by virtue of its nicely
51 rounded cabin roof and small rear window.
52
53 The aero routine is only valid around 100 knots; it is referred to as
54 a "linear model" of the navion; the data having been extracted by
55 someone unknown from a more complete model, or more likely, from
56 in-flight measurements and manuever time histories.  It probably came
57 from someone at Princeton U; they owned a couple modified Navions that
58 had a variable-stability system installed, and were highly
59 instrumented (and well calibrated, I assume).
60
61 In any event, a linearized model, such as this one, contains various
62 "stability derivatives", or estimates of how aerodynamic forces and
63 moments vary with changes in angle of attack, angular body rates, and
64 control surface deflections. For example, L_beta is an estimate of how
65 much roll moment varies per degree of sideslip increase.  A decoding
66 ring is given below:
67
68         X       Aerodynamic force, lbs, in X-axis (+ forward)
69         Y       Aerodynamic force, lbs, in Y-axis (+ right)
70         Z       Aerodynamic force, lbs, in Z-axis (+ down)
71         L       Aero. moment about X-axis (+ roll right), ft-lbs
72         M       Aero. moment about Y-axis (+ pitch up), ft-lbs
73         N       Aero. moment about Z-axis (+ nose right), ft-lbs
74
75         0       Subscript implying initial, or nominal, value
76         u       X-axis component of airspeed (ft/sec) (+ forward)
77         v       Y-axis component of airspeed (ft/sec) (+ right) 
78         w       Z-axis component of airspeed (ft/sec) (+ down)
79         p       X-axis ang. rate (rad/sec) (+ roll right), rad/sec
80         q       Y-axis ang. rate (rad/sec) (+ pitch up), rad/sec
81         r       Z-axis ang. rate (rad/sec) (+ yaw right), rad/sec
82         beta    Angle of sideslip, degrees (+ wind in RIGHT ear)
83         da      Aileron deflection, degrees (+ left ail. TE down)
84         de      Elevator deflection, degrees (+ trailing edge down)
85         dr      Rudder deflection, degrees (+ trailing edge LEFT)
86
87 ----------------------------------------------------------------------------
88
89   CALLED BY:
90
91 ----------------------------------------------------------------------------
92
93   CALLS TO:
94
95 ----------------------------------------------------------------------------
96
97   INPUTS:
98
99 ----------------------------------------------------------------------------
100
101   OUTPUTS:
102
103 --------------------------------------------------------------------------*/
104
105 #include "ls_types.h"
106 #include "ls_generic.h"
107 #include "ls_cockpit.h"
108
109 /* define trimmed w_body to correspond with alpha_trim = 5 */
110 #define TRIMMED_W  15.34
111
112 extern COCKPIT cockpit_;
113
114
115 void aero()
116 {
117   static int init = 0;
118
119   SCALAR u, w;
120   static SCALAR elevator, aileron, rudder;
121   static SCALAR long_scale = 0.3;
122   static SCALAR lat_scale  = 0.1;
123   static SCALAR yaw_scale  = -0.1;
124   static SCALAR scale = 1.0;
125   
126   static SCALAR trim_inc = 0.0002;
127   /* static SCALAR long_trim; */
128
129   static DATA U_0;
130   static DATA X_0;
131   static DATA M_0;
132   static DATA Z_0;
133   static DATA X_u;
134   static DATA X_w;
135   static DATA X_de;
136   static DATA Y_v;
137   static DATA Z_u;
138   static DATA Z_w;
139   static DATA Z_de;
140   static DATA L_beta;
141   static DATA L_p;
142   static DATA L_r;
143   static DATA L_da;
144   static DATA L_dr;
145   static DATA M_w;
146   static DATA M_q;
147   static DATA M_de;
148   static DATA N_beta;
149   static DATA N_p;    
150   static DATA N_r;
151   static DATA N_da;
152   static DATA N_dr;
153
154   if (!init)
155     {
156       init = -1;
157
158       /* Initialize aero coefficients */
159
160       U_0 = 176;
161       X_0 = -573.75;
162       M_0 = 0;
163       Z_0 = -2750;
164       X_u = -0.0451;        /* original value */
165       /* X_u = 0.0000; */   /* for MUCH better performance - EBJ */
166       X_w =  0.03607;
167       X_de = 0;
168       Y_v = -0.2543;
169       Z_u = -0.3697;        /* original value */
170       /* Z_u = -0.03697; */ /* for better performance - EBJ */
171       Z_w = -2.0244;
172       Z_de = -28.17;
173       L_beta = -15.982;
174       L_p = -8.402;
175       L_r = 2.193;
176       L_da = 28.984;
177       L_dr = 2.548;
178       M_w = -0.05;
179       M_q = -2.0767;
180       M_de = -11.1892;
181       N_beta = 4.495;
182       N_p = -0.3498;    
183       N_r = -0.7605;
184       N_da = -0.2218;
185       N_dr = -4.597;
186     }
187     
188   u = V_rel_wind - U_0;
189   w = W_body - TRIMMED_W;
190   
191   elevator = long_scale * Long_control;
192   aileron  = lat_scale  * Lat_control;
193   rudder   = yaw_scale  * Rudder_pedal;
194   
195   /* if(Aft_trim) long_trim = long_trim - trim_inc; */
196   /* if(Fwd_trim) long_trim = long_trim + trim_inc; */
197   
198   scale = V_rel_wind*V_rel_wind/(U_0*U_0); 
199   if (scale > 1.0) scale = 1.0; /* ebj */
200     
201   
202   F_X_aero = scale*(X_0 + Mass*(X_u*u + X_w*w + X_de*elevator));
203   F_Y_aero = scale*(Mass*Y_v*V_body);
204   F_Z_aero = scale*(Z_0 + Mass*(Z_u*u + Z_w*w + Z_de*elevator));
205   
206   M_l_aero = scale*(I_xx*(L_beta*Beta + L_p*P_body + L_r*R_body
207                    + L_da*aileron + L_dr*rudder));
208   M_m_aero = scale*(M_0 + I_yy*(M_w*w + M_q*Q_body + M_de*(elevator + Long_trim)));
209   M_n_aero = scale*(I_zz*(N_beta*Beta + N_p*P_body + N_r*R_body
210                    + N_da*aileron + N_dr*rudder));
211   
212 }
213
214