]> git.mxchange.org Git - flightgear.git/blob - src/FDM/UIUCModel/uiuc_coef_lift.cpp
First commit of properties code. JSBSim now has a basic property tree all
[flightgear.git] / src / FDM / UIUCModel / uiuc_coef_lift.cpp
1 /**********************************************************************
2
3  FILENAME:     uiuc_coef_lift.cpp
4
5 ----------------------------------------------------------------------
6
7  DESCRIPTION:  computes aggregated aerodynamic lift coefficient
8
9 ----------------------------------------------------------------------
10
11  STATUS:       alpha version
12
13 ----------------------------------------------------------------------
14
15  REFERENCES:   Roskam, Jan.  Airplane Flight Dynamics and Automatic
16                Flight Controls, Part I.  Lawrence, KS: DARcorporation,
17                1995.
18
19 ----------------------------------------------------------------------
20
21  HISTORY:      04/15/2000   initial release
22                06/18/2001   (RD) Added CZfa
23
24 ----------------------------------------------------------------------
25
26  AUTHOR(S):    Bipin Sehgal       <bsehgal@uiuc.edu>
27                Jeff Scott         <jscott@mail.com>
28                Robert Deters      <rdeters@uiuc.edu>
29
30 ----------------------------------------------------------------------
31
32  VARIABLES:
33
34 ----------------------------------------------------------------------
35
36  INPUTS:       -Alpha
37                -elevator
38                -lift coefficient components
39                -icing parameters
40                -cbar_2U multiplier
41
42 ----------------------------------------------------------------------
43
44  OUTPUTS:      -CL
45
46 ----------------------------------------------------------------------
47
48  CALLED BY:    uiuc_coefficients.cpp
49
50 ----------------------------------------------------------------------
51
52  CALLS TO:     uiuc_1Dinterpolation
53                uiuc_2Dinterpolation
54                uiuc_ice_filter
55
56 ----------------------------------------------------------------------
57
58  COPYRIGHT:    (C) 2000 by Michael Selig
59
60  This program is free software; you can redistribute it and/or
61  modify it under the terms of the GNU General Public License
62  as published by the Free Software Foundation.
63
64  This program is distributed in the hope that it will be useful,
65  but WITHOUT ANY WARRANTY; without even the implied warranty of
66  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
67  GNU General Public License for more details.
68
69  You should have received a copy of the GNU General Public License
70  along with this program; if not, write to the Free Software
71  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
72  USA or view http://www.gnu.org/copyleft/gpl.html.
73
74 **********************************************************************/
75
76 #include "uiuc_coef_lift.h"
77
78
79 void uiuc_coef_lift()
80 {
81   string linetoken1;
82   string linetoken2;
83   stack command_list;
84   
85   command_list = aeroLiftParts -> getCommands();
86   
87   for (LIST command_line = command_list.begin(); command_line!=command_list.end(); ++command_line)
88     {
89       linetoken1 = aeroLiftParts -> getToken(*command_line, 1);
90       linetoken2 = aeroLiftParts -> getToken(*command_line, 2);
91
92       switch (CL_map[linetoken2])
93         {
94         case CLo_flag:
95           {
96             if (ice_on)
97               {
98                 CLo = uiuc_ice_filter(CLo_clean,kCLo);
99                 if (beta_model)
100                   {
101                     CLclean_wing += CLo_clean;
102                     CLclean_tail += CLo_clean;
103                     CLiced_wing += CLo;
104                     CLiced_tail += CLo;
105                   }
106               }
107             CL += CLo;
108             break;
109           }
110         case CL_a_flag:
111           {
112             if (ice_on)
113               {
114                 CL_a = uiuc_ice_filter(CL_a_clean,kCL_a);
115                 if (beta_model)
116                   {
117                     CLclean_wing += CL_a_clean * Alpha;
118                     CLclean_tail += CL_a_clean * Alpha;
119                     CLiced_wing += CL_a * Alpha;
120                     CLiced_tail += CL_a * Alpha;
121                   }
122               }
123             CL += CL_a * Alpha;
124             break;
125           }
126         case CL_adot_flag:
127           {
128             if (ice_on)
129               {
130                 CL_adot = uiuc_ice_filter(CL_adot_clean,kCL_adot);
131                 if (beta_model)
132                   {
133                     CLclean_wing += CL_adot_clean * Alpha_dot * cbar_2U;
134                     CLclean_tail += CL_adot_clean * Alpha_dot * ch_2U;
135                     CLiced_wing += CL_adot * Alpha_dot * cbar_2U;
136                     CLiced_tail += CL_adot * Alpha_dot * ch_2U;
137                   }
138               }
139             /* CL_adot must be mulitplied by cbar/2U 
140                (see Roskam Control book, Part 1, pg. 147) */
141             CL += CL_adot * Alpha_dot * cbar_2U;
142             break;
143           }
144         case CL_q_flag:
145           {
146             if (ice_on)
147               {
148                 CL_q = uiuc_ice_filter(CL_q_clean,kCL_q);
149                 if (beta_model)
150                   {
151                     CLclean_wing += CL_q_clean * Theta_dot * cbar_2U;
152                     CLclean_tail += CL_q_clean * Theta_dot * ch_2U;
153                     CLiced_wing += CL_q * Theta_dot * cbar_2U;
154                     CLiced_tail += CL_q * Theta_dot * ch_2U;
155                   }
156               }
157             /* CL_q must be mulitplied by cbar/2U 
158                (see Roskam Control book, Part 1, pg. 147) */
159             /* why multiply by Theta_dot instead of Q_body?
160                that is what is done in c172_aero.c; assume it 
161                has something to do with axes systems */
162             CL += CL_q * Theta_dot * cbar_2U;
163             break;
164           }
165         case CL_ih_flag:
166           {
167             CL += CL_ih * ih;
168             break;
169           }
170         case CL_de_flag:
171           {
172             if (ice_on)
173               {
174                 CL_de = uiuc_ice_filter(CL_de_clean,kCL_de);
175                 if (beta_model)
176                   {
177                     CLclean_wing += CL_de_clean * elevator;
178                     CLclean_tail += CL_de_clean * elevator;
179                     CLiced_wing += CL_de * elevator;
180                     CLiced_tail += CL_de * elevator;
181                   }
182               }
183             CL += CL_de * elevator;
184             break;
185           }
186         case CLfa_flag:
187           {
188             CLfaI = uiuc_1Dinterpolation(CLfa_aArray,
189                                          CLfa_CLArray,
190                                          CLfa_nAlpha,
191                                          Alpha);
192             CL += CLfaI;
193             break;
194           }
195         case CLfade_flag:
196           {
197             CLfadeI = uiuc_2Dinterpolation(CLfade_aArray,
198                                            CLfade_deArray,
199                                            CLfade_CLArray,
200                                            CLfade_nAlphaArray,
201                                            CLfade_nde,
202                                            Alpha,
203                                            elevator);
204             CL += CLfadeI;
205             break;
206           }
207         case CLfdf_flag:
208           {
209             CLfdfI = uiuc_1Dinterpolation(CLfdf_dfArray,
210                                           CLfdf_CLArray,
211                                           CLfdf_ndf,
212                                           flap);
213             CL += CLfdfI;
214             break;
215           }
216         case CLfadf_flag:
217           {
218             CLfadfI = uiuc_2Dinterpolation(CLfadf_aArray,
219                                            CLfadf_dfArray,
220                                            CLfadf_CLArray,
221                                            CLfadf_nAlphaArray,
222                                            CLfadf_ndf,
223                                            Alpha,
224                                            flap);
225             CL += CLfadfI;
226             break;
227           }
228         case CZo_flag:
229           {
230             if (ice_on)
231               {
232                 CZo = uiuc_ice_filter(CZo_clean,kCZo);
233                 if (beta_model)
234                   {
235                     CZclean_wing += CZo_clean;
236                     CZclean_tail += CZo_clean;
237                     CZiced_wing += CZo;
238                     CZiced_tail += CZo;
239                   }
240               }
241             CZ += CZo;
242             break;
243           }
244         case CZ_a_flag:
245           {
246             if (ice_on)
247               {
248                 CZ_a = uiuc_ice_filter(CZ_a_clean,kCZ_a);
249                 if (beta_model)
250                   {
251                     CZclean_wing += CZ_a_clean * Alpha;
252                     CZclean_tail += CZ_a_clean * Alpha;
253                     CZiced_wing += CZ_a * Alpha;
254                     CZiced_tail += CZ_a * Alpha;
255                   }
256               }
257             CZ += CZ_a * Alpha;
258             break;
259           }
260         case CZ_a2_flag:
261           {
262             if (ice_on)
263               {
264                 CZ_a2 = uiuc_ice_filter(CZ_a2_clean,kCZ_a2);
265                 if (beta_model)
266                   {
267                     CZclean_wing += CZ_a2_clean * Alpha * Alpha;
268                     CZclean_tail += CZ_a2_clean * Alpha * Alpha;
269                     CZiced_wing += CZ_a2 * Alpha * Alpha;
270                     CZiced_tail += CZ_a2 * Alpha * Alpha;
271                   }
272               }
273             CZ += CZ_a2 * Alpha * Alpha;
274             break;
275           }
276         case CZ_a3_flag:
277           {
278             if (ice_on)
279               {
280                 CZ_a3 = uiuc_ice_filter(CZ_a3_clean,kCZ_a3);
281                 if (beta_model)
282                   {
283                     CZclean_wing += CZ_a3_clean * Alpha * Alpha * Alpha;
284                     CZclean_tail += CZ_a3_clean * Alpha * Alpha * Alpha;
285                     CZiced_wing += CZ_a3 * Alpha * Alpha * Alpha;
286                     CZiced_tail += CZ_a3 * Alpha * Alpha * Alpha;
287                   }
288               }
289             CZ += CZ_a3 * Alpha * Alpha * Alpha;
290             break;
291           }
292         case CZ_adot_flag:
293           {
294             if (ice_on)
295               {
296                 CZ_adot = uiuc_ice_filter(CZ_adot_clean,kCZ_adot);
297                 if (beta_model)
298                   {
299                     CZclean_wing += CZ_adot_clean * Alpha_dot * cbar_2U;
300                     CZclean_tail += CZ_adot_clean * Alpha_dot * ch_2U;
301                     CZiced_wing += CZ_adot * Alpha_dot * cbar_2U;
302                     CZiced_tail += CZ_adot * Alpha_dot * ch_2U;
303                   }
304               }
305             /* CZ_adot must be mulitplied by cbar/2U 
306                (see Roskam Control book, Part 1, pg. 147) */
307             CZ += CZ_adot * Alpha_dot * cbar_2U;
308             break;
309           }
310         case CZ_q_flag:
311           {
312             if (ice_on)
313               {
314                 CZ_q = uiuc_ice_filter(CZ_q_clean,kCZ_q);
315                 if (beta_model)
316                   {
317                     CZclean_wing += CZ_q_clean * Q_body * cbar_2U;
318                     CZclean_tail += CZ_q_clean * Q_body * ch_2U;
319                     CZiced_wing += CZ_q * Q_body * cbar_2U;
320                     CZiced_tail += CZ_q * Q_body * ch_2U;
321                   }
322               }
323             /* CZ_q must be mulitplied by cbar/2U 
324                (see Roskam Control book, Part 1, pg. 147) */
325             CZ += CZ_q * Q_body * cbar_2U;
326             break;
327           }
328         case CZ_de_flag:
329           {
330             if (ice_on)
331               {
332                 CZ_de = uiuc_ice_filter(CZ_de_clean,kCZ_de);
333                 if (beta_model)
334                   {
335                     CZclean_wing += CZ_de_clean * elevator;
336                     CZclean_tail += CZ_de_clean * elevator;
337                     CZiced_wing += CZ_de * elevator;
338                     CZiced_tail += CZ_de * elevator;
339                   }
340               }
341             CZ += CZ_de * elevator;
342             break;
343           }
344         case CZ_deb2_flag:
345           {
346             if (ice_on)
347               {
348                 CZ_deb2 = uiuc_ice_filter(CZ_deb2_clean,kCZ_deb2);
349                 if (beta_model)
350                   {
351                     CZclean_wing += CZ_deb2_clean * elevator * Beta * Beta;
352                     CZclean_tail += CZ_deb2_clean * elevator * Beta * Beta;
353                     CZiced_wing += CZ_deb2 * elevator * Beta * Beta;
354                     CZiced_tail += CZ_deb2 * elevator * Beta * Beta;
355                   }
356               }
357             CZ += CZ_deb2 * elevator * Beta * Beta;
358             break;
359           }
360         case CZ_df_flag:
361           {
362             if (ice_on)
363               {
364                 CZ_df = uiuc_ice_filter(CZ_df_clean,kCZ_df);
365                 if (beta_model)
366                   {
367                     CZclean_wing += CZ_df_clean * flap;
368                     CZclean_tail += CZ_df_clean * flap;
369                     CZiced_wing += CZ_df * flap;
370                     CZiced_tail += CZ_df * flap;
371                   }
372               }
373             CZ += CZ_df * flap;
374             break;
375           }
376         case CZ_adf_flag:
377           {
378             if (ice_on)
379               {
380                 CZ_adf = uiuc_ice_filter(CZ_adf_clean,kCZ_adf);
381                 if (beta_model)
382                   {
383                     CZclean_wing += CZ_adf_clean * Alpha * flap;
384                     CZclean_tail += CZ_adf_clean * Alpha * flap;
385                     CZiced_wing += CZ_adf * Alpha * flap;
386                     CZiced_tail += CZ_adf * Alpha * flap;
387                   }
388               }
389             CZ += CZ_adf * Alpha * flap;
390             break;
391           }
392         case CZfa_flag:
393           {
394             CZfaI = uiuc_1Dinterpolation(CZfa_aArray,
395                                          CZfa_CZArray,
396                                          CZfa_nAlpha,
397                                          Alpha);
398             CZ += CZfaI;
399             break;
400           }
401         };
402     } // end CL map
403
404   return;
405 }
406
407 // end uiuc_coef_lift.cpp