]> git.mxchange.org Git - flightgear.git/blob - src/FDM/UIUCModel/uiuc_coef_pitch.cpp
First commit of properties code. JSBSim now has a basic property tree all
[flightgear.git] / src / FDM / UIUCModel / uiuc_coef_pitch.cpp
1 /**********************************************************************
2
3  FILENAME:     uiuc_coef_pitch.cpp
4
5 ----------------------------------------------------------------------
6
7  DESCRIPTION:  computes aggregated aerodynamic pitch 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
23 ----------------------------------------------------------------------
24
25  AUTHOR(S):    Bipin Sehgal       <bsehgal@uiuc.edu>
26                Jeff Scott         <jscott@mail.com>
27
28 ----------------------------------------------------------------------
29
30  VARIABLES:
31
32 ----------------------------------------------------------------------
33
34  INPUTS:       -Alpha
35                -elevator
36                -pitch coefficient components
37                -icing parameters
38                -cbar_2U multiplier
39
40 ----------------------------------------------------------------------
41
42  OUTPUTS:      -Cm
43
44 ----------------------------------------------------------------------
45
46  CALLED BY:    uiuc_coefficients.cpp
47
48 ----------------------------------------------------------------------
49
50  CALLS TO:     uiuc_1Dinterpolation
51                uiuc_2Dinterpolation
52                uiuc_ice_filter
53
54 ----------------------------------------------------------------------
55
56  COPYRIGHT:    (C) 2000 by Michael Selig
57
58  This program is free software; you can redistribute it and/or
59  modify it under the terms of the GNU General Public License
60  as published by the Free Software Foundation.
61
62  This program is distributed in the hope that it will be useful,
63  but WITHOUT ANY WARRANTY; without even the implied warranty of
64  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
65  GNU General Public License for more details.
66
67  You should have received a copy of the GNU General Public License
68  along with this program; if not, write to the Free Software
69  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
70  USA or view http://www.gnu.org/copyleft/gpl.html.
71
72 **********************************************************************/
73
74 #include "uiuc_coef_pitch.h"
75
76
77 void uiuc_coef_pitch()
78 {
79   string linetoken1;
80   string linetoken2;
81   stack command_list;
82   
83   command_list = aeroPitchParts -> getCommands();
84   
85   for (LIST command_line = command_list.begin(); command_line!=command_list.end(); ++command_line)
86     {
87       linetoken1 = aeroPitchParts -> getToken(*command_line, 1);
88       linetoken2 = aeroPitchParts -> getToken(*command_line, 2);
89
90       switch(Cm_map[linetoken2])
91         {
92         case Cmo_flag:
93           {
94             if (ice_on)
95               {
96                 Cmo = uiuc_ice_filter(Cmo_clean,kCmo);
97               }
98             Cm += Cmo;
99             break;
100           }
101         case Cm_a_flag:
102           {
103             if (ice_on)
104               {
105                 Cm_a = uiuc_ice_filter(Cm_a_clean,kCm_a);
106               }
107             Cm += Cm_a * Alpha;
108             break;
109           }
110         case Cm_a2_flag:
111           {
112             if (ice_on)
113               {
114                 Cm_a2 = uiuc_ice_filter(Cm_a2_clean,kCm_a2);
115               }
116             Cm += Cm_a2 * Alpha * Alpha;
117             break;
118           }
119         case Cm_adot_flag:
120           {
121             if (ice_on)
122               {
123                 Cm_adot = uiuc_ice_filter(Cm_adot_clean,kCm_adot);
124               }
125             /* Cm_adot must be mulitplied by cbar/2U 
126                (see Roskam Control book, Part 1, pg. 147) */
127             Cm += Cm_adot * Alpha_dot * cbar_2U;
128             break;
129           }
130         case Cm_q_flag:
131           {
132             if (ice_on)
133               {
134                 Cm_q = uiuc_ice_filter(Cm_q_clean,kCm_q);
135               }
136             /* Cm_q must be mulitplied by cbar/2U 
137                (see Roskam Control book, Part 1, pg. 147) */
138             Cm += Cm_q * Q_body * cbar_2U;
139             break;
140           }
141         case Cm_ih_flag:
142           {
143             Cm += Cm_ih * ih;
144             break;
145           }
146         case Cm_de_flag:
147           {
148             if (ice_on)
149               {
150                 Cm_de = uiuc_ice_filter(Cm_de_clean,kCm_de);
151               }
152             Cm += Cm_de * elevator;
153             break;
154           }
155         case Cm_b2_flag:
156           {
157             if (ice_on)
158               {
159                 Cm_b2 = uiuc_ice_filter(Cm_b2_clean,kCm_b2);
160               }
161             Cm += Cm_b2 * Beta * Beta;
162             break;
163           }
164         case Cm_r_flag:
165           {
166             if (ice_on)
167               {
168                 Cm_r = uiuc_ice_filter(Cm_r_clean,kCm_r);
169               }
170             Cm += Cm_r * R_body * b_2U;
171             break;
172           }
173         case Cm_df_flag:
174           {
175             if (ice_on)
176               {
177                 Cm_df = uiuc_ice_filter(Cm_df_clean,kCm_df);
178               }
179             Cm += Cm_df * flap;
180             break;
181           }
182         case Cmfa_flag:
183           {
184             CmfaI = uiuc_1Dinterpolation(Cmfa_aArray,
185                                          Cmfa_CmArray,
186                                          Cmfa_nAlpha,
187                                          Alpha);
188             Cm += CmfaI;
189             break;
190           }
191         case Cmfade_flag:
192           {
193             CmfadeI = uiuc_2Dinterpolation(Cmfade_aArray,
194                                            Cmfade_deArray,
195                                            Cmfade_CmArray,
196                                            Cmfade_nAlphaArray,
197                                            Cmfade_nde,
198                                            Alpha,
199                                            elevator);
200             Cm += CmfadeI;
201             break;
202           }
203         case Cmfdf_flag:
204           {
205             CmfdfI = uiuc_1Dinterpolation(Cmfdf_dfArray,
206                                           Cmfdf_CmArray,
207                                           Cmfdf_ndf,
208                                           flap);
209             Cm += CmfdfI;
210             break;
211           }
212         case Cmfadf_flag:
213           {
214             CmfadfI = uiuc_2Dinterpolation(Cmfadf_aArray,
215                                            Cmfadf_dfArray,
216                                            Cmfadf_CmArray,
217                                            Cmfadf_nAlphaArray,
218                                            Cmfadf_ndf,
219                                            Alpha,
220                                            flap);
221             Cm += CmfadfI;
222             break;
223           }
224         };
225     } // end Cm map
226
227   return;
228 }
229
230 // end uiuc_coef_pitch.cpp