]> git.mxchange.org Git - flightgear.git/blob - src/FDM/UIUCModel/uiuc_coef_sideforce.cpp
Goodbye automake.
[flightgear.git] / src / FDM / UIUCModel / uiuc_coef_sideforce.cpp
1 /**********************************************************************
2
3  FILENAME:     uiuc_coef_sideforce.cpp
4
5 ----------------------------------------------------------------------
6
7  DESCRIPTION:  computes aggregated aerodynamic sideforce 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                10/25/2001   (RD) Added new variables needed for the non-
23                             linear Twin Otter model at zero flaps
24                             (CYfxxf0)
25                11/12/2001   (RD) Added new variables needed for the non-
26                             linear Twin Otter model with flaps
27                             (CYfxxf).  Zero flap vairables removed.
28                02/13/2002   (RD) Added variables so linear aero model
29                             values can be recorded
30                02/18/2002   (RD) Added uiuc_3Dinterp_quick() function
31                             for a quicker 3D interpolation.  Takes
32                             advantage of "nice" data.
33
34 ----------------------------------------------------------------------
35
36  AUTHOR(S):    Bipin Sehgal       <bsehgal@uiuc.edu>
37                Jeff Scott         <jscott@mail.com>
38                Robert Deters      <rdeters@uiuc.edu>
39
40 ----------------------------------------------------------------------
41
42  VARIABLES:
43
44 ----------------------------------------------------------------------
45
46  INPUTS:       -Alpha
47                -aileron
48                -rudder
49                -sideforce coefficient components
50                -icing parameters
51                -b_2U multiplier
52
53 ----------------------------------------------------------------------
54
55  OUTPUTS:      -CY
56
57 ----------------------------------------------------------------------
58
59  CALLED BY:    uiuc_coefficients.cpp
60
61 ----------------------------------------------------------------------
62
63  CALLS TO:     uiuc_1Dinterpolation
64                uiuc_2Dinterpolation
65                uiuc_ice_filter
66                uiuc_3Dinterpolation
67                uiuc_3Dinterp_quick
68
69 ----------------------------------------------------------------------
70
71  COPYRIGHT:    (C) 2000 by Michael Selig
72
73  This program is free software; you can redistribute it and/or
74  modify it under the terms of the GNU General Public License
75  as published by the Free Software Foundation.
76
77  This program is distributed in the hope that it will be useful,
78  but WITHOUT ANY WARRANTY; without even the implied warranty of
79  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
80  GNU General Public License for more details.
81
82  You should have received a copy of the GNU General Public License
83  along with this program; if not, write to the Free Software
84  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
85
86 **********************************************************************/
87
88 #include "uiuc_coef_sideforce.h"
89
90
91 void uiuc_coef_sideforce()
92 {
93   string linetoken1;
94   string linetoken2;
95   stack command_list;
96
97   double p_nondim;
98   double r_nondim;
99
100   command_list = aeroSideforceParts -> getCommands();
101   
102   for (LIST command_line = command_list.begin(); command_line!=command_list.end(); ++command_line)
103     {
104       linetoken1 = aeroSideforceParts -> getToken(*command_line, 1);
105       linetoken2 = aeroSideforceParts -> getToken(*command_line, 2);
106
107       switch(CY_map[linetoken2])
108         {
109         case CYo_flag:
110           {
111             if (ice_on)
112               {
113                 CYo = uiuc_ice_filter(CYo_clean,kCYo);
114               }
115             CYo_save = CYo;
116             CY += CYo_save;
117             break;
118           }
119         case CY_beta_flag:
120           {
121             if (ice_on)
122               {
123                 CY_beta = uiuc_ice_filter(CY_beta_clean,kCY_beta);
124               }
125             CY_beta_save = CY_beta * Std_Beta;
126             if (eta_q_CY_beta_fac)
127               {
128                 CY += CY_beta_save * eta_q_CY_beta_fac;
129               }
130             else
131               {
132                 CY += CY_beta_save;
133               }
134             break;
135           }
136         case CY_p_flag:
137           {
138             if (ice_on)
139               {
140                 CY_p = uiuc_ice_filter(CY_p_clean,kCY_p);
141               }
142             /* CY_p must be mulitplied by b/2U 
143                (see Roskam Control book, Part 1, pg. 147) */
144             CY_p_save = CY_p * P_body * b_2U;
145             if (eta_q_CY_p_fac)
146               {
147                 CY += CY_p_save * eta_q_CY_p_fac;
148               }
149             else
150               {
151                 CY += CY_p_save;
152               }
153             break;
154           }
155         case CY_r_flag:
156           {
157             if (ice_on)
158               {
159                 CY_r = uiuc_ice_filter(CY_r_clean,kCY_r);
160               }
161             /* CY_r must be mulitplied by b/2U 
162                (see Roskam Control book, Part 1, pg. 147) */
163             CY_r_save = CY_r * R_body * b_2U;
164             if (eta_q_CY_r_fac)
165               {
166                 CY += CY_r_save * eta_q_CY_r_fac;
167               }
168             else
169               {
170                 CY += CY_r_save;
171               }
172             break;
173           }
174         case CY_da_flag:
175           {
176             if (ice_on)
177               {
178                 CY_da = uiuc_ice_filter(CY_da_clean,kCY_da);
179               }
180             CY_da_save = CY_da * aileron;
181             CY += CY_da_save;
182             break;
183           }
184         case CY_dr_flag:
185           {
186             if (ice_on)
187               {
188                 CY_dr = uiuc_ice_filter(CY_dr_clean,kCY_dr);
189               }
190             CY_dr_save = CY_dr * rudder;
191             if (eta_q_CY_dr_fac)
192               {
193                 CY += CY_dr_save * eta_q_CY_dr_fac;
194               }
195             else
196               {
197                 CY += CY_dr_save;
198               }
199             break;
200           }
201         case CY_dra_flag:
202           {
203             if (ice_on)
204               {
205                 CY_dra = uiuc_ice_filter(CY_dra_clean,kCY_dra);
206               }
207             CY_dra_save = CY_dra * rudder * Std_Alpha;
208             CY += CY_dra_save;
209             break;
210           }
211         case CY_bdot_flag:
212           {
213             if (ice_on)
214               {
215                 CY_bdot = uiuc_ice_filter(CY_bdot_clean,kCY_bdot);
216               }
217             CY_bdot_save = CY_bdot * Std_Beta_dot * b_2U;
218             CY += CY_bdot_save;
219             break;
220           }
221         case CYfada_flag:
222           {
223             CYfadaI = uiuc_2Dinterpolation(CYfada_aArray,
224                                            CYfada_daArray,
225                                            CYfada_CYArray,
226                                            CYfada_nAlphaArray,
227                                            CYfada_nda,
228                                            Std_Alpha,
229                                            aileron);
230             CY += CYfadaI;
231             break;
232           }
233         case CYfbetadr_flag:
234           {
235             CYfbetadrI = uiuc_2Dinterpolation(CYfbetadr_betaArray,
236                                               CYfbetadr_drArray,
237                                               CYfbetadr_CYArray,
238                                               CYfbetadr_nBetaArray,
239                                               CYfbetadr_ndr,
240                                               Std_Beta,
241                                               rudder);
242             CY += CYfbetadrI;
243             break;
244           }
245         case CYfabetaf_flag:
246           {
247             if (CYfabetaf_nice == 1)
248               CYfabetafI = uiuc_3Dinterp_quick(CYfabetaf_fArray,
249                                                CYfabetaf_aArray_nice,
250                                                CYfabetaf_bArray_nice,
251                                                CYfabetaf_CYArray,
252                                                CYfabetaf_na_nice,
253                                                CYfabetaf_nb_nice,
254                                                CYfabetaf_nf,
255                                                flap_pos,
256                                                Std_Alpha,
257                                                Std_Beta);
258             else
259               CYfabetafI = uiuc_3Dinterpolation(CYfabetaf_fArray,
260                                                 CYfabetaf_aArray,
261                                                 CYfabetaf_betaArray,
262                                                 CYfabetaf_CYArray,
263                                                 CYfabetaf_nAlphaArray,
264                                                 CYfabetaf_nbeta,
265                                                 CYfabetaf_nf,
266                                                 flap_pos,
267                                                 Std_Alpha,
268                                                 Std_Beta);
269             CY += CYfabetafI;
270             break;
271           }
272         case CYfadaf_flag:
273           {
274             if (CYfadaf_nice == 1)
275               CYfadafI = uiuc_3Dinterp_quick(CYfadaf_fArray,
276                                              CYfadaf_aArray_nice,
277                                              CYfadaf_daArray_nice,
278                                              CYfadaf_CYArray,
279                                              CYfadaf_na_nice,
280                                              CYfadaf_nda_nice,
281                                              CYfadaf_nf,
282                                              flap_pos,
283                                              Std_Alpha,
284                                              aileron);
285             else
286               CYfadafI = uiuc_3Dinterpolation(CYfadaf_fArray,
287                                               CYfadaf_aArray,
288                                               CYfadaf_daArray,
289                                               CYfadaf_CYArray,
290                                               CYfadaf_nAlphaArray,
291                                               CYfadaf_nda,
292                                               CYfadaf_nf,
293                                               flap_pos,
294                                               Std_Alpha,
295                                               aileron);
296             CY += CYfadafI;
297             break;
298           }
299         case CYfadrf_flag:
300           {
301             if (CYfadrf_nice == 1)
302               CYfadrfI = uiuc_3Dinterp_quick(CYfadrf_fArray,
303                                              CYfadrf_aArray_nice,
304                                              CYfadrf_drArray_nice,
305                                              CYfadrf_CYArray,
306                                              CYfadrf_na_nice,
307                                              CYfadrf_ndr_nice,
308                                              CYfadrf_nf,
309                                              flap_pos,
310                                              Std_Alpha,
311                                              rudder);
312             else
313               CYfadrfI = uiuc_3Dinterpolation(CYfadrf_fArray,
314                                               CYfadrf_aArray,
315                                               CYfadrf_drArray,
316                                               CYfadrf_CYArray,
317                                               CYfadrf_nAlphaArray,
318                                               CYfadrf_ndr,
319                                               CYfadrf_nf,
320                                               flap_pos,
321                                               Std_Alpha,
322                                               rudder);
323             CY += CYfadrfI;
324             break;
325           }
326         case CYfapf_flag:
327           {
328             p_nondim = P_body * b_2U;
329             if (CYfapf_nice == 1)
330               CYfapfI = uiuc_3Dinterp_quick(CYfapf_fArray,
331                                             CYfapf_aArray_nice,
332                                             CYfapf_pArray_nice,
333                                             CYfapf_CYArray,
334                                             CYfapf_na_nice,
335                                             CYfapf_np_nice,
336                                             CYfapf_nf,
337                                             flap_pos,
338                                             Std_Alpha,
339                                             p_nondim);
340             else
341               CYfapfI = uiuc_3Dinterpolation(CYfapf_fArray,
342                                              CYfapf_aArray,
343                                              CYfapf_pArray,
344                                              CYfapf_CYArray,
345                                              CYfapf_nAlphaArray,
346                                              CYfapf_np,
347                                              CYfapf_nf,
348                                              flap_pos,
349                                              Std_Alpha,
350                                              p_nondim);
351             CY += CYfapfI;
352             break;
353           }
354         case CYfarf_flag:
355           {
356             r_nondim = R_body * b_2U;
357             if (CYfarf_nice == 1)
358               CYfarfI = uiuc_3Dinterp_quick(CYfarf_fArray,
359                                             CYfarf_aArray_nice,
360                                             CYfarf_rArray_nice,
361                                             CYfarf_CYArray,
362                                             CYfarf_na_nice,
363                                             CYfarf_nr_nice,
364                                             CYfarf_nf,
365                                             flap_pos,
366                                             Std_Alpha,
367                                             r_nondim);
368             else
369               CYfarfI = uiuc_3Dinterpolation(CYfarf_fArray,
370                                              CYfarf_aArray,
371                                              CYfarf_rArray,
372                                              CYfarf_CYArray,
373                                              CYfarf_nAlphaArray,
374                                              CYfarf_nr,
375                                              CYfarf_nf,
376                                              flap_pos,
377                                              Std_Alpha,
378                                              r_nondim);
379             CY += CYfarfI;
380             break;
381           }
382        };
383     } // end CY map
384   
385   return;
386 }
387
388 // end uiuc_coef_sideforce.cpp