]> git.mxchange.org Git - flightgear.git/blob - src/FDM/LaRCsim/navion_aero.c
Update VS2008 projects : use Boost 1.44.0 available in last 3rd Party archive
[flightgear.git] / src / FDM / 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 navion_aero( SCALAR dt, int Initialize ) {
116   static int init = 0;
117
118   SCALAR u, w;
119   static SCALAR elevator, aileron, rudder;
120   static SCALAR long_scale = 0.3;
121   static SCALAR lat_scale  = 0.1;
122   static SCALAR yaw_scale  = -0.1;
123   static SCALAR scale = 1.0;
124   
125   /* static SCALAR trim_inc = 0.0002; */
126   /* static SCALAR long_trim; */
127
128   static DATA U_0;
129   static DATA X_0;
130   static DATA M_0;
131   static DATA Z_0;
132   static DATA X_u;
133   static DATA X_w;
134   static DATA X_de;
135   static DATA Y_v;
136   static DATA Z_u;
137   static DATA Z_w;
138   static DATA Z_de;
139   static DATA L_beta;
140   static DATA L_p;
141   static DATA L_r;
142   static DATA L_da;
143   static DATA L_dr;
144   static DATA M_w;
145   static DATA M_q;
146   static DATA M_de;
147   static DATA N_beta;
148   static DATA N_p;    
149   static DATA N_r;
150   static DATA N_da;
151   static DATA N_dr;
152
153   if (!init)
154     {
155       init = -1;
156
157       /* Initialize aero coefficients */
158
159       U_0 = 176;
160       X_0 = -573.75;
161       M_0 = 0;
162       Z_0 = -2750;
163       X_u = -0.0451;        /* original value */
164       /* X_u = 0.0000; */   /* for MUCH better performance - EBJ */
165       X_w =  0.03607;
166       X_de = 0;
167       Y_v = -0.2543;
168       Z_u = -0.3697;        /* original value */
169       /* Z_u = -0.03697; */ /* for better performance - EBJ */
170       Z_w = -2.0244;
171       Z_de = -28.17;
172       L_beta = -15.982;
173       L_p = -8.402;
174       L_r = 2.193;
175       L_da = 28.984;
176       L_dr = 2.548;
177       M_w = -0.05;
178       M_q = -2.0767;
179       M_de = -11.1892;
180       N_beta = 4.495;
181       N_p = -0.3498;    
182       N_r = -0.7605;
183       N_da = -0.2218;
184       N_dr = -4.597;
185     }
186     
187   u = V_rel_wind - U_0;
188   w = W_body - TRIMMED_W;
189   
190   elevator = long_scale * Long_control;
191   aileron  = lat_scale  * Lat_control;
192   rudder   = yaw_scale  * Rudder_pedal;
193   
194   /* if(Aft_trim) long_trim = long_trim - trim_inc; */
195   /* if(Fwd_trim) long_trim = long_trim + trim_inc; */
196   
197   scale = V_rel_wind*V_rel_wind/(U_0*U_0); 
198   if (scale > 1.0) scale = 1.0; /* ebj */
199     
200   
201   F_X_aero = scale*(X_0 + Mass*(X_u*u + X_w*w + X_de*elevator));
202   F_Y_aero = scale*(Mass*Y_v*V_body);
203   F_Z_aero = scale*(Z_0 + Mass*(Z_u*u + Z_w*w + Z_de*elevator));
204   
205   M_l_aero = scale*(I_xx*(L_beta*Std_Beta + L_p*P_body + L_r*R_body
206                    + L_da*aileron + L_dr*rudder));
207   M_m_aero = scale*(M_0 + I_yy*(M_w*w + M_q*Q_body + M_de*(elevator + Long_trim)));
208   M_n_aero = scale*(I_zz*(N_beta*Std_Beta + N_p*P_body + N_r*R_body
209                    + N_da*aileron + N_dr*rudder));
210   
211 }
212
213