| 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 |
10/25/2001 (RD) Added new variables needed for the non- |
| 23 |
linear Twin Otter model at zero flaps |
| 24 |
(Cmfxxf0) |
| 25 |
11/12/2001 (RD) Added new variables needed for the non- |
| 26 |
linear Twin Otter model with flaps |
| 27 |
(Cmfxxf). 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 <[email protected]> |
| 37 |
Jeff Scott <[email protected]> |
| 38 |
Robert Deters <[email protected]> |
| 39 |
|
| 40 |
---------------------------------------------------------------------- |
| 41 |
|
| 42 |
VARIABLES: |
| 43 |
|
| 44 |
---------------------------------------------------------------------- |
| 45 |
|
| 46 |
INPUTS: -Alpha |
| 47 |
-elevator |
| 48 |
-pitch coefficient components |
| 49 |
-icing parameters |
| 50 |
-cbar_2U multiplier |
| 51 |
|
| 52 |
---------------------------------------------------------------------- |
| 53 |
|
| 54 |
OUTPUTS: -Cm |
| 55 |
|
| 56 |
---------------------------------------------------------------------- |
| 57 |
|
| 58 |
CALLED BY: uiuc_coefficients.cpp |
| 59 |
|
| 60 |
---------------------------------------------------------------------- |
| 61 |
|
| 62 |
CALLS TO: uiuc_1Dinterpolation |
| 63 |
uiuc_2Dinterpolation |
| 64 |
uiuc_ice_filter |
| 65 |
uiuc_3Dinterpolation |
| 66 |
uiuc_3Dinterp_quick |
| 67 |
|
| 68 |
---------------------------------------------------------------------- |
| 69 |
|
| 70 |
COPYRIGHT: (C) 2000 by Michael Selig |
| 71 |
|
| 72 |
This program is free software; you can redistribute it and/or |
| 73 |
modify it under the terms of the GNU General Public License |
| 74 |
as published by the Free Software Foundation. |
| 75 |
|
| 76 |
This program is distributed in the hope that it will be useful, |
| 77 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 78 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 79 |
GNU General Public License for more details. |
| 80 |
|
| 81 |
You should have received a copy of the GNU General Public License |
| 82 |
along with this program; if not, write to the Free Software |
| 83 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 84 |
|
| 85 |
**********************************************************************/ |
| 86 |
|
| 87 |
#include "uiuc_coef_pitch.h" |
| 88 |
|
| 89 |
|
| 90 |
void uiuc_coef_pitch() |
| 91 |
{ |
| 92 |
std::string linetoken1; |
| 93 |
std::string linetoken2; |
| 94 |
stack command_list; |
| 95 |
|
| 96 |
double q_nondim; |
| 97 |
|
| 98 |
command_list = aeroPitchParts -> getCommands(); |
| 99 |
|
| 100 |
for (LIST command_line = command_list.begin(); command_line!=command_list.end(); ++command_line) |
| 101 |
{ |
| 102 |
linetoken1 = aeroPitchParts -> getToken(*command_line, 1); |
| 103 |
linetoken2 = aeroPitchParts -> getToken(*command_line, 2); |
| 104 |
|
| 105 |
switch(Cm_map[linetoken2]) |
| 106 |
{ |
| 107 |
case Cmo_flag: |
| 108 |
{ |
| 109 |
if (ice_on) |
| 110 |
{ |
| 111 |
Cmo = uiuc_ice_filter(Cmo_clean,kCmo); |
| 112 |
} |
| 113 |
Cmo_save = Cmo; |
| 114 |
Cm += Cmo_save; |
| 115 |
break; |
| 116 |
} |
| 117 |
case Cm_a_flag: |
| 118 |
{ |
| 119 |
if (ice_on) |
| 120 |
{ |
| 121 |
Cm_a = uiuc_ice_filter(Cm_a_clean,kCm_a); |
| 122 |
} |
| 123 |
Cm_a_save = Cm_a * Std_Alpha; |
| 124 |
Cm += Cm_a_save; |
| 125 |
break; |
| 126 |
} |
| 127 |
case Cm_a2_flag: |
| 128 |
{ |
| 129 |
if (ice_on) |
| 130 |
{ |
| 131 |
Cm_a2 = uiuc_ice_filter(Cm_a2_clean,kCm_a2); |
| 132 |
} |
| 133 |
Cm_a2_save = Cm_a2 * Std_Alpha * Std_Alpha; |
| 134 |
Cm += Cm_a2_save; |
| 135 |
break; |
| 136 |
} |
| 137 |
case Cm_adot_flag: |
| 138 |
{ |
| 139 |
if (ice_on) |
| 140 |
{ |
| 141 |
Cm_adot = uiuc_ice_filter(Cm_adot_clean,kCm_adot); |
| 142 |
} |
| 143 |
/* Cm_adot must be mulitplied by cbar/2U |
| 144 |
(see Roskam Control book, Part 1, pg. 147) */ |
| 145 |
Cm_adot_save = Cm_adot * Std_Alpha_dot * cbar_2U; |
| 146 |
if (eta_q_Cm_adot_fac) |
| 147 |
{ |
| 148 |
Cm += Cm_adot_save * eta_q_Cm_adot_fac; |
| 149 |
} |
| 150 |
else |
| 151 |
{ |
| 152 |
Cm += Cm_adot_save; |
| 153 |
} |
| 154 |
break; |
| 155 |
} |
| 156 |
case Cm_q_flag: |
| 157 |
{ |
| 158 |
if (ice_on) |
| 159 |
{ |
| 160 |
Cm_q = uiuc_ice_filter(Cm_q_clean,kCm_q); |
| 161 |
} |
| 162 |
/* Cm_q must be mulitplied by cbar/2U |
| 163 |
(see Roskam Control book, Part 1, pg. 147) */ |
| 164 |
Cm_q_save = Cm_q * Q_body * cbar_2U; |
| 165 |
if (eta_q_Cm_q_fac) |
| 166 |
{ |
| 167 |
Cm += Cm_q_save * eta_q_Cm_q_fac; |
| 168 |
} |
| 169 |
else |
| 170 |
{ |
| 171 |
Cm += Cm_q_save; |
| 172 |
} |
| 173 |
break; |
| 174 |
} |
| 175 |
case Cm_ih_flag: |
| 176 |
{ |
| 177 |
Cm_ih_save = Cm_ih * ih; |
| 178 |
Cm += Cm_ih_save; |
| 179 |
break; |
| 180 |
} |
| 181 |
case Cm_de_flag: |
| 182 |
{ |
| 183 |
if (ice_on) |
| 184 |
{ |
| 185 |
Cm_de = uiuc_ice_filter(Cm_de_clean,kCm_de); |
| 186 |
} |
| 187 |
Cm_de_save = Cm_de * elevator; |
| 188 |
if (eta_q_Cm_de_fac) |
| 189 |
{ |
| 190 |
Cm += Cm_de_save * eta_q_Cm_de_fac; |
| 191 |
} |
| 192 |
else |
| 193 |
{ |
| 194 |
Cm += Cm_de_save; |
| 195 |
} |
| 196 |
break; |
| 197 |
} |
| 198 |
case Cm_b2_flag: |
| 199 |
{ |
| 200 |
if (ice_on) |
| 201 |
{ |
| 202 |
Cm_b2 = uiuc_ice_filter(Cm_b2_clean,kCm_b2); |
| 203 |
} |
| 204 |
Cm_b2_save = Cm_b2 * Std_Beta * Std_Beta; |
| 205 |
Cm += Cm_b2_save; |
| 206 |
break; |
| 207 |
} |
| 208 |
case Cm_r_flag: |
| 209 |
{ |
| 210 |
if (ice_on) |
| 211 |
{ |
| 212 |
Cm_r = uiuc_ice_filter(Cm_r_clean,kCm_r); |
| 213 |
} |
| 214 |
Cm_r_save = Cm_r * R_body * b_2U; |
| 215 |
Cm += Cm_r_save; |
| 216 |
break; |
| 217 |
} |
| 218 |
case Cm_df_flag: |
| 219 |
{ |
| 220 |
if (ice_on) |
| 221 |
{ |
| 222 |
Cm_df = uiuc_ice_filter(Cm_df_clean,kCm_df); |
| 223 |
} |
| 224 |
Cm_df_save = Cm_df * flap_pos; |
| 225 |
Cm += Cm_df_save; |
| 226 |
break; |
| 227 |
} |
| 228 |
case Cm_ds_flag: |
| 229 |
{ |
| 230 |
Cm_ds_save = Cm_ds * spoiler_pos; |
| 231 |
Cm += Cm_ds_save; |
| 232 |
break; |
| 233 |
} |
| 234 |
case Cm_dg_flag: |
| 235 |
{ |
| 236 |
Cm_dg_save = Cm_dg * gear_pos_norm; |
| 237 |
Cm += Cm_dg_save; |
| 238 |
break; |
| 239 |
} |
| 240 |
case Cmfa_flag: |
| 241 |
{ |
| 242 |
CmfaI = uiuc_1Dinterpolation(Cmfa_aArray, |
| 243 |
Cmfa_CmArray, |
| 244 |
Cmfa_nAlpha, |
| 245 |
Std_Alpha); |
| 246 |
Cm += CmfaI; |
| 247 |
break; |
| 248 |
} |
| 249 |
case Cmfade_flag: |
| 250 |
{ |
| 251 |
if(b_downwashMode) |
| 252 |
{ |
| 253 |
// compute the induced velocity on the tail to account for tail downwash |
| 254 |
switch(downwashMode) |
| 255 |
{ |
| 256 |
case 100: |
| 257 |
if (V_rel_wind < dyn_on_speed) |
| 258 |
{ |
| 259 |
alphaTail = Std_Alpha; |
| 260 |
} |
| 261 |
else |
| 262 |
{ |
| 263 |
gammaWing = V_rel_wind * Sw * CL / (2.0 * bw); |
| 264 |
// printf("gammaWing = %.4f\n", (gammaWing)); |
| 265 |
downwash = downwashCoef * gammaWing; |
| 266 |
downwashAngle = atan(downwash/V_rel_wind); |
| 267 |
alphaTail = Std_Alpha - downwashAngle; |
| 268 |
} |
| 269 |
CmfadeI = uiuc_2Dinterpolation(Cmfade_aArray, |
| 270 |
Cmfade_deArray, |
| 271 |
Cmfade_CmArray, |
| 272 |
Cmfade_nAlphaArray, |
| 273 |
Cmfade_nde, |
| 274 |
alphaTail, |
| 275 |
elevator); |
| 276 |
break; |
| 277 |
} |
| 278 |
} |
| 279 |
else |
| 280 |
{ |
| 281 |
CmfadeI = uiuc_2Dinterpolation(Cmfade_aArray, |
| 282 |
Cmfade_deArray, |
| 283 |
Cmfade_CmArray, |
| 284 |
Cmfade_nAlphaArray, |
| 285 |
Cmfade_nde, |
| 286 |
Std_Alpha, |
| 287 |
elevator); |
| 288 |
} |
| 289 |
if (eta_q_Cmfade_fac) |
| 290 |
{ |
| 291 |
Cm += CmfadeI * eta_q_Cmfade_fac; |
| 292 |
} |
| 293 |
else |
| 294 |
{ |
| 295 |
Cm += CmfadeI; |
| 296 |
} |
| 297 |
break; |
| 298 |
} |
| 299 |
case Cmfdf_flag: |
| 300 |
{ |
| 301 |
CmfdfI = uiuc_1Dinterpolation(Cmfdf_dfArray, |
| 302 |
Cmfdf_CmArray, |
| 303 |
Cmfdf_ndf, |
| 304 |
flap_pos); |
| 305 |
Cm += CmfdfI; |
| 306 |
break; |
| 307 |
} |
| 308 |
case Cmfadf_flag: |
| 309 |
{ |
| 310 |
CmfadfI = uiuc_2Dinterpolation(Cmfadf_aArray, |
| 311 |
Cmfadf_dfArray, |
| 312 |
Cmfadf_CmArray, |
| 313 |
Cmfadf_nAlphaArray, |
| 314 |
Cmfadf_ndf, |
| 315 |
Std_Alpha, |
| 316 |
flap_pos); |
| 317 |
Cm += CmfadfI; |
| 318 |
break; |
| 319 |
} |
| 320 |
case Cmfabetaf_flag: |
| 321 |
{ |
| 322 |
if (Cmfabetaf_nice == 1) |
| 323 |
CmfabetafI = uiuc_3Dinterp_quick(Cmfabetaf_fArray, |
| 324 |
Cmfabetaf_aArray_nice, |
| 325 |
Cmfabetaf_bArray_nice, |
| 326 |
Cmfabetaf_CmArray, |
| 327 |
Cmfabetaf_na_nice, |
| 328 |
Cmfabetaf_nb_nice, |
| 329 |
Cmfabetaf_nf, |
| 330 |
flap_pos, |
| 331 |
Std_Alpha, |
| 332 |
Std_Beta); |
| 333 |
else |
| 334 |
CmfabetafI = uiuc_3Dinterpolation(Cmfabetaf_fArray, |
| 335 |
Cmfabetaf_aArray, |
| 336 |
Cmfabetaf_betaArray, |
| 337 |
Cmfabetaf_CmArray, |
| 338 |
Cmfabetaf_nAlphaArray, |
| 339 |
Cmfabetaf_nbeta, |
| 340 |
Cmfabetaf_nf, |
| 341 |
flap_pos, |
| 342 |
Std_Alpha, |
| 343 |
Std_Beta); |
| 344 |
Cm += CmfabetafI; |
| 345 |
break; |
| 346 |
} |
| 347 |
case Cmfadef_flag: |
| 348 |
{ |
| 349 |
if (Cmfadef_nice == 1) |
| 350 |
CmfadefI = uiuc_3Dinterp_quick(Cmfadef_fArray, |
| 351 |
Cmfadef_aArray_nice, |
| 352 |
Cmfadef_deArray_nice, |
| 353 |
Cmfadef_CmArray, |
| 354 |
Cmfadef_na_nice, |
| 355 |
Cmfadef_nde_nice, |
| 356 |
Cmfadef_nf, |
| 357 |
flap_pos, |
| 358 |
Std_Alpha, |
| 359 |
elevator); |
| 360 |
else |
| 361 |
CmfadefI = uiuc_3Dinterpolation(Cmfadef_fArray, |
| 362 |
Cmfadef_aArray, |
| 363 |
Cmfadef_deArray, |
| 364 |
Cmfadef_CmArray, |
| 365 |
Cmfadef_nAlphaArray, |
| 366 |
Cmfadef_nde, |
| 367 |
Cmfadef_nf, |
| 368 |
flap_pos, |
| 369 |
Std_Alpha, |
| 370 |
elevator); |
| 371 |
Cm += CmfadefI; |
| 372 |
break; |
| 373 |
} |
| 374 |
case Cmfaqf_flag: |
| 375 |
{ |
| 376 |
q_nondim = Q_body * cbar_2U; |
| 377 |
if (Cmfaqf_nice == 1) |
| 378 |
CmfaqfI = uiuc_3Dinterp_quick(Cmfaqf_fArray, |
| 379 |
Cmfaqf_aArray_nice, |
| 380 |
Cmfaqf_qArray_nice, |
| 381 |
Cmfaqf_CmArray, |
| 382 |
Cmfaqf_na_nice, |
| 383 |
Cmfaqf_nq_nice, |
| 384 |
Cmfaqf_nf, |
| 385 |
flap_pos, |
| 386 |
Std_Alpha, |
| 387 |
q_nondim); |
| 388 |
else |
| 389 |
CmfaqfI = uiuc_3Dinterpolation(Cmfaqf_fArray, |
| 390 |
Cmfaqf_aArray, |
| 391 |
Cmfaqf_qArray, |
| 392 |
Cmfaqf_CmArray, |
| 393 |
Cmfaqf_nAlphaArray, |
| 394 |
Cmfaqf_nq, |
| 395 |
Cmfaqf_nf, |
| 396 |
flap_pos, |
| 397 |
Std_Alpha, |
| 398 |
q_nondim); |
| 399 |
Cm += CmfaqfI; |
| 400 |
break; |
| 401 |
} |
| 402 |
}; |
| 403 |
} // end Cm map |
| 404 |
|
| 405 |
return; |
| 406 |
} |
| 407 |
|
| 408 |
// end uiuc_coef_pitch.cpp |