]> git.mxchange.org Git - flightgear.git/blob - src/FDM/LaRCsim/cherokee_aero.c
Adds a basic FDM model for LaRCsim debugging purposes.
[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 #include "ls_constants.h"
65
66
67
68
69
70 void cherokee_aero()
71 /*float ** Cherokee (float t, VectorStanja &X, float *U)*/
72 {
73         static float
74                 Cza  = -19149.0/(146.69*146.69*157.5/2.0*0.00238), 
75                 Czat = -73.4*4*146.69/0.00238/157.5/5.25, 
76                 Czq  = -2.655*4*2400.0/32.2/0.00238/157.5/146.69/5.25, 
77                 Cma  = -21662.0 *2/146.69/0.00238/157.5/146.69/5.25, 
78                 Cmat = -892.4 *4/146.69/0.00238/157.5/146.69/5.25, 
79                 Cmq  = -2405.1 *4/0.00238/157.5/146.69/5.25/5.25, 
80                 Czde = -1050.49 *2/0.00238/157.5/146.69/146.69, 
81                 Cmde = -12771.9 *2/0.00238/157.5/146.69/146.69/5.25, 
82                 Clb  = -12891.0/(146.69*146.69*157.5/2.0*0.00238)/30.0, 
83                 Clp  = -0.4704, 
84                 Clr  = 0.1665, 
85                 Cyb  = -1169.8/(146.69*146.69*157.5/2.0*0.00238),
86                 Cyp  = -0.0342, 
87                 Cnb  = 11127.2/(146.69*146.69*157.5/2.0*0.00238)/30.0, 
88                 Cnp  = -0.0691, 
89                 Cnr  = -0.0930, 
90                 Cyf  = -14.072/(146.69*146.69*157.5/2.0*0.00238), 
91                 Cyps = 89.229/(146.69*146.69*157.5/2.0*0.00238), 
92                 Clf  = -5812.4/(146.69*146.69*157.5/2.0*0.00238)/30.0,  //%Clda ?  
93                 Cnf  = -853.93/(146.69*146.69*157.5/2.0*0.00238)/30.0,  //%Cnda ?  
94                 Cnps = -1149.0/(146.69*146.69*157.5/2.0*0.00238)/30.0,  //%Cndr ?  
95                 Cyr  = 1.923/(146.69*146.69*157.5/2.0*0.00238), 
96
97                 Cx0 = -0.4645/(157.5*0.3048*0.3048), 
98
99                 Cz0 = -0.11875, 
100                 Cm0 =  0.0959, 
101
102                 Clda = -5812.4/(146.69*146.69*157.5/2.0*0.00238)/30.0, // Clf
103                 Cnda = -853.93/(146.69*146.69*157.5/2.0*0.00238)/30.0, // Cnf
104                 Cndr = -1149.0/(146.69*146.69*157.5/2.0*0.00238)/30.0, // Cnps
105
106 /*
107         Possible problems: convention about positive control surfaces offset
108 */
109                 elevator = 0.0, // 20.0 * 180.0/57.3 * Long_control
110                 aileron  = 0.0, // 30.0 * 180.0/57.3 * Lat_control
111                 rudder   = 0.0, // 30.0 * 180.0/57.3 * Rudder_pedal,
112
113
114 //              m = 2400/32.2,          // mass 
115                 S = 157.5,                      // wing area
116                 b = 30.0,                       // wing span
117                 c = 5.25,                       // main aerodynamic chrod
118
119 //              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}, 
120 //              Fa[3], 
121 //              Ma[3], 
122 //              *RetVal[4] = {&m, Ixyz, Fa, Ma}; 
123
124
125 //      float
126                 V = 0.0, // V_rel_wind
127                 qd = 0.0, // Density*V*V/2.0,                   //dinamicki tlak  
128
129                 Cx,Cy,Cz,
130                 Cl,Cm,Cn,
131                 p,q,r;
132
133
134 /* derivatives are defined in "wind" axes so... */
135                 p =  P_body*Cos_alpha + R_body*Sin_alpha;
136                 q =  Q_body;
137                 r = -P_body*Sin_alpha + R_body*Cos_alpha;
138
139
140
141                 Cz = Cz0 + Cza*Std_Alpha + Czat*(Std_Alpha_dot*c/2.0/V) + Czq*(q*c/2.0/V) + Czde * elevator;
142                 Cm = Cm0 + Cma*Std_Alpha + Cmat*(Std_Alpha_dot*c/2.0/V) + Cmq*(q*c/2.0/V) + Cmde * elevator; 
143
144                 Cx = Cx0 - (Cza*Std_Alpha)*(Cza*Std_Alpha)/(LS_PI*5.71*0.6);
145                 Cl = Clb*Std_Beta + Clp*(p*b/2.0/V) + Clr*(r*b/2.0/V) + Clda * aileron;
146
147                 Cy = Cyb*Std_Beta + Cyr*(r*b/2.0/V); 
148                 Cn = Cnb*Std_Beta + Cnp*(p*b/2.0/V) + Cnr*(r*b/2.0/V) + Cndr * rudder; 
149
150 /* back to body axes */
151         {
152                 float
153                         CD = Cx,
154                         CL = Cz;
155
156                         Cx = CD - CL*Sin_alpha;
157                         Cz = CL;
158         }
159
160 /* AD forces and moments   */
161                 F_X_aero = Cx*qd*S;
162                 F_Y_aero = Cy*qd*S;
163                 F_Z_aero = Cz*qd*S;
164
165                 M_l_aero = (Cl*Cos_alpha - Cn*Sin_alpha)*b*qd*S; 
166                 M_m_aero = Cm*c*qd*S; 
167                 M_n_aero = (Cl*Sin_alpha + Cn*Cos_alpha)*b*qd*S; 
168 }
169
170
171