]> git.mxchange.org Git - flightgear.git/blob - src/FDM/LaRCsim/cherokee_aero.c
David Megginson made a few (mostly minor) mods to the LaRCsim files, and
[flightgear.git] / src / FDM / LaRCsim / cherokee_aero.c
1 /***************************************************************************
2
3   TITLE:        Cherokee_aero
4                 
5 ----------------------------------------------------------------------------
6
7   FUNCTION:     Linear aerodynamics model
8
9 ----------------------------------------------------------------------------
10
11   MODULE STATUS:        developmental
12
13 ----------------------------------------------------------------------------
14
15   GENEALOGY:
16
17 ----------------------------------------------------------------------------
18
19   MODIFICATION HISTORY:
20                 
21
22 ----------------------------------------------------------------------------
23
24   REFERENCES:
25
26                 Based upon book:
27                                 Barnes W. McCormick,
28                                 "Aerodynamics, Aeronautics and Flight Mechanics",
29                                 John Wiley & Sons,1995, ISBN 0-471-11087-6
30
31         any suggestions, corrections, aditional data, flames, everything to 
32         Gordan Sikic
33         gsikic@public.srce.hr
34
35 This source is not checked in this configuration in any way.
36
37
38 ----------------------------------------------------------------------------
39
40   CALLED BY:
41
42 ----------------------------------------------------------------------------
43
44   CALLS TO:
45
46 ----------------------------------------------------------------------------
47
48   INPUTS:
49
50 ----------------------------------------------------------------------------
51
52   OUTPUTS:
53
54 --------------------------------------------------------------------------*/
55
56
57
58
59 #include <float.h>
60 #include <math.h>
61 #include "ls_types.h"
62 #include "ls_generic.h"
63 #include "ls_cockpit.h"
64
65
66
67
68
69 void cherokee_aero()
70 /*float ** Cherokee (float t, VectorStanja &X, float *U)*/
71 {
72         static float
73                 Cza  = -19149.0/(146.69*146.69*157.5/2.0*0.00238), 
74                 Czat = -73.4*4*146.69/0.00238/157.5/5.25, 
75                 Czq  = -2.655*4*2400.0/32.2/0.00238/157.5/146.69/5.25, 
76                 Cma  = -21662.0 *2/146.69/0.00238/157.5/146.69/5.25, 
77                 Cmat = -892.4 *4/146.69/0.00238/157.5/146.69/5.25, 
78                 Cmq  = -2405.1 *4/0.00238/157.5/146.69/5.25/5.25, 
79                 Czde = -1050.49 *2/0.00238/157.5/146.69/146.69, 
80                 Cmde = -12771.9 *2/0.00238/157.5/146.69/146.69/5.25, 
81                 Clb  = -12891.0/(146.69*146.69*157.5/2.0*0.00238)/30.0, 
82                 Clp  = -0.4704, 
83                 Clr  = 0.1665, 
84                 Cyb  = -1169.8/(146.69*146.69*157.5/2.0*0.00238),
85                 Cyp  = -0.0342, 
86                 Cnb  = 11127.2/(146.69*146.69*157.5/2.0*0.00238)/30.0, 
87                 Cnp  = -0.0691, 
88                 Cnr  = -0.0930, 
89                 Cyf  = -14.072/(146.69*146.69*157.5/2.0*0.00238), 
90                 Cyps = 89.229/(146.69*146.69*157.5/2.0*0.00238), 
91                 Clf  = -5812.4/(146.69*146.69*157.5/2.0*0.00238)/30.0,  //%Clda ?  
92                 Cnf  = -853.93/(146.69*146.69*157.5/2.0*0.00238)/30.0,  //%Cnda ?  
93                 Cnps = -1149.0/(146.69*146.69*157.5/2.0*0.00238)/30.0,  //%Cndr ?  
94                 Cyr  = 1.923/(146.69*146.69*157.5/2.0*0.00238), 
95
96                 Cx0 = -0.4645/(157.5*0.3048*0.3048), 
97
98                 Cz0 = -0.11875, 
99                 Cm0 =  0.0959, 
100
101                 Clda = -5812.4/(146.69*146.69*157.5/2.0*0.00238)/30.0, // Clf
102                 Cnda = -853.93/(146.69*146.69*157.5/2.0*0.00238)/30.0, // Cnf
103                 Cndr = -1149.0/(146.69*146.69*157.5/2.0*0.00238)/30.0, // Cnps
104
105 /*
106         Possible problems: convention about positive control surfaces offset
107 */
108                 elevator = 0.0, // 20.0 * 180.0/57.3 * Long_control
109                 aileron  = 0.0, // 30.0 * 180.0/57.3 * Lat_control
110                 rudder   = 0.0, // 30.0 * 180.0/57.3 * Rudder_pedal,
111
112
113 //              m = 2400/32.2,          // mass 
114                 S = 157.5,                      // wing area
115                 b = 30.0,                       // wing span
116                 c = 5.25,                       // main aerodynamic chrod
117
118 //              Ixyz[3] = {1070.0*14.59*0.3048*0.3048, 1249.0*14.59*0.3048*0.3048, 2312.0*14.59*0.3048*0.3048}, 
119 //              Fa[3], 
120 //              Ma[3], 
121 //              *RetVal[4] = {&m, Ixyz, Fa, Ma}; 
122
123
124 //      float
125                 V = 0.0, // V_rel_wind
126                 qd = 0.0, // Density*V*V/2.0,                   //dinamicki tlak  
127
128                 Cx,Cy,Cz,
129                 Cl,Cm,Cn,
130                 p,q,r;
131
132
133 /* derivatives are defined in "wind" axes so... */
134                 p =  P_body*Cos_alpha + R_body*Sin_alpha;
135                 q =  Q_body;
136                 r = -P_body*Sin_alpha + R_body*Cos_alpha;
137
138
139
140                 Cz = Cz0 + Cza*Alpha + Czat*(Alpha_dot*c/2.0/V) + Czq*(q*c/2.0/V) + Czde * elevator;
141                 Cm = Cm0 + Cma*Alpha + Cmat*(Alpha_dot*c/2.0/V) + Cmq*(q*c/2.0/V) + Cmde * elevator; 
142
143                 Cx = Cx0 - (Cza*Alpha)*(Cza*Alpha)/(M_PI*5.71*0.6);
144                 Cl = Clb*Beta + Clp*(p*b/2.0/V) + Clr*(r*b/2.0/V) + Clda * aileron;
145
146                 Cy = Cyb*Beta + Cyr*(r*b/2.0/V); 
147                 Cn = Cnb*Beta + Cnp*(p*b/2.0/V) + Cnr*(r*b/2.0/V) + Cndr * rudder; 
148
149 /* back to body axes */
150         {
151                 float
152                         CD = Cx,
153                         CL = Cz;
154
155                         Cx = CD - CL*Sin_alpha;
156                         Cz = CL;
157         }
158
159 /* AD forces and moments   */
160                 F_X_aero = Cx*qd*S;
161                 F_Y_aero = Cy*qd*S;
162                 F_Z_aero = Cz*qd*S;
163
164                 M_l_aero = (Cl*Cos_alpha - Cn*Sin_alpha)*b*qd*S; 
165                 M_m_aero = Cm*c*qd*S; 
166                 M_n_aero = (Cl*Sin_alpha + Cn*Cos_alpha)*b*qd*S; 
167 }
168
169
170