]> git.mxchange.org Git - flightgear.git/blob - src/FDM/UIUCModel/uiuc_coef_sideforce.cpp
Make yasim accept the launchbar and hook properties. They are not tied to anything...
[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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
85  USA or view http://www.gnu.org/copyleft/gpl.html.
86
87 **********************************************************************/
88
89 #include "uiuc_coef_sideforce.h"
90
91
92 void uiuc_coef_sideforce()
93 {
94   string linetoken1;
95   string linetoken2;
96   stack command_list;
97
98   double p_nondim;
99   double r_nondim;
100
101   command_list = aeroSideforceParts -> getCommands();
102   
103   for (LIST command_line = command_list.begin(); command_line!=command_list.end(); ++command_line)
104     {
105       linetoken1 = aeroSideforceParts -> getToken(*command_line, 1);
106       linetoken2 = aeroSideforceParts -> getToken(*command_line, 2);
107
108       switch(CY_map[linetoken2])
109         {
110         case CYo_flag:
111           {
112             if (ice_on)
113               {
114                 CYo = uiuc_ice_filter(CYo_clean,kCYo);
115               }
116             CYo_save = CYo;
117             CY += CYo_save;
118             break;
119           }
120         case CY_beta_flag:
121           {
122             if (ice_on)
123               {
124                 CY_beta = uiuc_ice_filter(CY_beta_clean,kCY_beta);
125               }
126             CY_beta_save = CY_beta * Std_Beta;
127             if (eta_q_CY_beta_fac)
128               {
129                 CY += CY_beta_save * eta_q_CY_beta_fac;
130               }
131             else
132               {
133                 CY += CY_beta_save;
134               }
135             break;
136           }
137         case CY_p_flag:
138           {
139             if (ice_on)
140               {
141                 CY_p = uiuc_ice_filter(CY_p_clean,kCY_p);
142               }
143             /* CY_p must be mulitplied by b/2U 
144                (see Roskam Control book, Part 1, pg. 147) */
145             CY_p_save = CY_p * P_body * b_2U;
146             if (eta_q_CY_p_fac)
147               {
148                 CY += CY_p_save * eta_q_CY_p_fac;
149               }
150             else
151               {
152                 CY += CY_p_save;
153               }
154             break;
155           }
156         case CY_r_flag:
157           {
158             if (ice_on)
159               {
160                 CY_r = uiuc_ice_filter(CY_r_clean,kCY_r);
161               }
162             /* CY_r must be mulitplied by b/2U 
163                (see Roskam Control book, Part 1, pg. 147) */
164             CY_r_save = CY_r * R_body * b_2U;
165             if (eta_q_CY_r_fac)
166               {
167                 CY += CY_r_save * eta_q_CY_r_fac;
168               }
169             else
170               {
171                 CY += CY_r_save;
172               }
173             break;
174           }
175         case CY_da_flag:
176           {
177             if (ice_on)
178               {
179                 CY_da = uiuc_ice_filter(CY_da_clean,kCY_da);
180               }
181             CY_da_save = CY_da * aileron;
182             CY += CY_da_save;
183             break;
184           }
185         case CY_dr_flag:
186           {
187             if (ice_on)
188               {
189                 CY_dr = uiuc_ice_filter(CY_dr_clean,kCY_dr);
190               }
191             CY_dr_save = CY_dr * rudder;
192             if (eta_q_CY_dr_fac)
193               {
194                 CY += CY_dr_save * eta_q_CY_dr_fac;
195               }
196             else
197               {
198                 CY += CY_dr_save;
199               }
200             break;
201           }
202         case CY_dra_flag:
203           {
204             if (ice_on)
205               {
206                 CY_dra = uiuc_ice_filter(CY_dra_clean,kCY_dra);
207               }
208             CY_dra_save = CY_dra * rudder * Std_Alpha;
209             CY += CY_dra_save;
210             break;
211           }
212         case CY_bdot_flag:
213           {
214             if (ice_on)
215               {
216                 CY_bdot = uiuc_ice_filter(CY_bdot_clean,kCY_bdot);
217               }
218             CY_bdot_save = CY_bdot * Std_Beta_dot * b_2U;
219             CY += CY_bdot_save;
220             break;
221           }
222         case CYfada_flag:
223           {
224             CYfadaI = uiuc_2Dinterpolation(CYfada_aArray,
225                                            CYfada_daArray,
226                                            CYfada_CYArray,
227                                            CYfada_nAlphaArray,
228                                            CYfada_nda,
229                                            Std_Alpha,
230                                            aileron);
231             CY += CYfadaI;
232             break;
233           }
234         case CYfbetadr_flag:
235           {
236             CYfbetadrI = uiuc_2Dinterpolation(CYfbetadr_betaArray,
237                                               CYfbetadr_drArray,
238                                               CYfbetadr_CYArray,
239                                               CYfbetadr_nBetaArray,
240                                               CYfbetadr_ndr,
241                                               Std_Beta,
242                                               rudder);
243             CY += CYfbetadrI;
244             break;
245           }
246         case CYfabetaf_flag:
247           {
248             if (CYfabetaf_nice == 1)
249               CYfabetafI = uiuc_3Dinterp_quick(CYfabetaf_fArray,
250                                                CYfabetaf_aArray_nice,
251                                                CYfabetaf_bArray_nice,
252                                                CYfabetaf_CYArray,
253                                                CYfabetaf_na_nice,
254                                                CYfabetaf_nb_nice,
255                                                CYfabetaf_nf,
256                                                flap_pos,
257                                                Std_Alpha,
258                                                Std_Beta);
259             else
260               CYfabetafI = uiuc_3Dinterpolation(CYfabetaf_fArray,
261                                                 CYfabetaf_aArray,
262                                                 CYfabetaf_betaArray,
263                                                 CYfabetaf_CYArray,
264                                                 CYfabetaf_nAlphaArray,
265                                                 CYfabetaf_nbeta,
266                                                 CYfabetaf_nf,
267                                                 flap_pos,
268                                                 Std_Alpha,
269                                                 Std_Beta);
270             CY += CYfabetafI;
271             break;
272           }
273         case CYfadaf_flag:
274           {
275             if (CYfadaf_nice == 1)
276               CYfadafI = uiuc_3Dinterp_quick(CYfadaf_fArray,
277                                              CYfadaf_aArray_nice,
278                                              CYfadaf_daArray_nice,
279                                              CYfadaf_CYArray,
280                                              CYfadaf_na_nice,
281                                              CYfadaf_nda_nice,
282                                              CYfadaf_nf,
283                                              flap_pos,
284                                              Std_Alpha,
285                                              aileron);
286             else
287               CYfadafI = uiuc_3Dinterpolation(CYfadaf_fArray,
288                                               CYfadaf_aArray,
289                                               CYfadaf_daArray,
290                                               CYfadaf_CYArray,
291                                               CYfadaf_nAlphaArray,
292                                               CYfadaf_nda,
293                                               CYfadaf_nf,
294                                               flap_pos,
295                                               Std_Alpha,
296                                               aileron);
297             CY += CYfadafI;
298             break;
299           }
300         case CYfadrf_flag:
301           {
302             if (CYfadrf_nice == 1)
303               CYfadrfI = uiuc_3Dinterp_quick(CYfadrf_fArray,
304                                              CYfadrf_aArray_nice,
305                                              CYfadrf_drArray_nice,
306                                              CYfadrf_CYArray,
307                                              CYfadrf_na_nice,
308                                              CYfadrf_ndr_nice,
309                                              CYfadrf_nf,
310                                              flap_pos,
311                                              Std_Alpha,
312                                              rudder);
313             else
314               CYfadrfI = uiuc_3Dinterpolation(CYfadrf_fArray,
315                                               CYfadrf_aArray,
316                                               CYfadrf_drArray,
317                                               CYfadrf_CYArray,
318                                               CYfadrf_nAlphaArray,
319                                               CYfadrf_ndr,
320                                               CYfadrf_nf,
321                                               flap_pos,
322                                               Std_Alpha,
323                                               rudder);
324             CY += CYfadrfI;
325             break;
326           }
327         case CYfapf_flag:
328           {
329             p_nondim = P_body * b_2U;
330             if (CYfapf_nice == 1)
331               CYfapfI = uiuc_3Dinterp_quick(CYfapf_fArray,
332                                             CYfapf_aArray_nice,
333                                             CYfapf_pArray_nice,
334                                             CYfapf_CYArray,
335                                             CYfapf_na_nice,
336                                             CYfapf_np_nice,
337                                             CYfapf_nf,
338                                             flap_pos,
339                                             Std_Alpha,
340                                             p_nondim);
341             else
342               CYfapfI = uiuc_3Dinterpolation(CYfapf_fArray,
343                                              CYfapf_aArray,
344                                              CYfapf_pArray,
345                                              CYfapf_CYArray,
346                                              CYfapf_nAlphaArray,
347                                              CYfapf_np,
348                                              CYfapf_nf,
349                                              flap_pos,
350                                              Std_Alpha,
351                                              p_nondim);
352             CY += CYfapfI;
353             break;
354           }
355         case CYfarf_flag:
356           {
357             r_nondim = R_body * b_2U;
358             if (CYfarf_nice == 1)
359               CYfarfI = uiuc_3Dinterp_quick(CYfarf_fArray,
360                                             CYfarf_aArray_nice,
361                                             CYfarf_rArray_nice,
362                                             CYfarf_CYArray,
363                                             CYfarf_na_nice,
364                                             CYfarf_nr_nice,
365                                             CYfarf_nf,
366                                             flap_pos,
367                                             Std_Alpha,
368                                             r_nondim);
369             else
370               CYfarfI = uiuc_3Dinterpolation(CYfarf_fArray,
371                                              CYfarf_aArray,
372                                              CYfarf_rArray,
373                                              CYfarf_CYArray,
374                                              CYfarf_nAlphaArray,
375                                              CYfarf_nr,
376                                              CYfarf_nf,
377                                              flap_pos,
378                                              Std_Alpha,
379                                              r_nondim);
380             CY += CYfarfI;
381             break;
382           }
383        };
384     } // end CY map
385   
386   return;
387 }
388
389 // end uiuc_coef_sideforce.cpp