1 /**********************************************************************
3 FILENAME: uiuc_coef_lift.cpp
5 ----------------------------------------------------------------------
7 DESCRIPTION: computes aggregated aerodynamic lift coefficient
9 ----------------------------------------------------------------------
13 ----------------------------------------------------------------------
15 REFERENCES: Roskam, Jan. Airplane Flight Dynamics and Automatic
16 Flight Controls, Part I. Lawrence, KS: DARcorporation,
19 ----------------------------------------------------------------------
21 HISTORY: 04/15/2000 initial release
22 06/18/2001 (RD) Added CZfa
23 10/25/2001 (RD) Added new variables needed for the non-
24 linear Twin Otter model at zero flaps
26 11/12/2001 (RD) Added new variables needed for the non-
27 linear Twin Otter model with flaps
28 (CZfxxf). Zero flap vairables removed.
29 02/13/2002 (RD) Added variables so linear aero model
30 values can be recorded
31 02/18/2002 (RD) Added uiuc_3Dinterp_quick() function
32 for a quicker 3D interpolation. Takes
33 advantage of "nice" data.
35 ----------------------------------------------------------------------
37 AUTHOR(S): Bipin Sehgal <bsehgal@uiuc.edu>
38 Jeff Scott <jscott@mail.com>
39 Robert Deters <rdeters@uiuc.edu>
41 ----------------------------------------------------------------------
45 ----------------------------------------------------------------------
49 -lift coefficient components
53 ----------------------------------------------------------------------
57 ----------------------------------------------------------------------
59 CALLED BY: uiuc_coefficients.cpp
61 ----------------------------------------------------------------------
63 CALLS TO: uiuc_1Dinterpolation
69 ----------------------------------------------------------------------
71 COPYRIGHT: (C) 2000 by Michael Selig
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.
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.
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.
87 **********************************************************************/
89 #include "uiuc_coef_lift.h"
99 command_list = aeroLiftParts -> getCommands();
101 for (LIST command_line = command_list.begin(); command_line!=command_list.end(); ++command_line)
103 linetoken1 = aeroLiftParts -> getToken(*command_line, 1);
104 linetoken2 = aeroLiftParts -> getToken(*command_line, 2);
106 switch (CL_map[linetoken2])
112 CLo = uiuc_ice_filter(CLo_clean,kCLo);
115 CLclean_wing += CLo_clean;
116 CLclean_tail += CLo_clean;
129 CL_a = uiuc_ice_filter(CL_a_clean,kCL_a);
132 CLclean_wing += CL_a_clean * Alpha;
133 CLclean_tail += CL_a_clean * Alpha;
134 CLiced_wing += CL_a * Alpha;
135 CLiced_tail += CL_a * Alpha;
138 CL_a_save = CL_a * Alpha;
146 CL_adot = uiuc_ice_filter(CL_adot_clean,kCL_adot);
149 CLclean_wing += CL_adot_clean * Alpha_dot * cbar_2U;
150 CLclean_tail += CL_adot_clean * Alpha_dot * ch_2U;
151 CLiced_wing += CL_adot * Alpha_dot * cbar_2U;
152 CLiced_tail += CL_adot * Alpha_dot * ch_2U;
155 /* CL_adot must be mulitplied by cbar/2U
156 (see Roskam Control book, Part 1, pg. 147) */
157 CL_adot_save = CL_adot * Alpha_dot * cbar_2U;
158 CL += CL_adot * Alpha_dot * cbar_2U;
165 CL_q = uiuc_ice_filter(CL_q_clean,kCL_q);
168 CLclean_wing += CL_q_clean * Theta_dot * cbar_2U;
169 CLclean_tail += CL_q_clean * Theta_dot * ch_2U;
170 CLiced_wing += CL_q * Theta_dot * cbar_2U;
171 CLiced_tail += CL_q * Theta_dot * ch_2U;
174 /* CL_q must be mulitplied by cbar/2U
175 (see Roskam Control book, Part 1, pg. 147) */
176 /* why multiply by Theta_dot instead of Q_body?
177 that is what is done in c172_aero.c; assume it
178 has something to do with axes systems */
179 CL_q_save = CL_q * Theta_dot * cbar_2U;
180 CL += CL_q * Theta_dot * cbar_2U;
185 CL_ih_save = CL_ih * ih;
193 CL_de = uiuc_ice_filter(CL_de_clean,kCL_de);
196 CLclean_wing += CL_de_clean * elevator;
197 CLclean_tail += CL_de_clean * elevator;
198 CLiced_wing += CL_de * elevator;
199 CLiced_tail += CL_de * elevator;
202 CL_de_save = CL_de * elevator;
203 CL += CL_de * elevator;
208 CLfaI = uiuc_1Dinterpolation(CLfa_aArray,
217 CLfadeI = uiuc_2Dinterpolation(CLfade_aArray,
229 CLfdfI = uiuc_1Dinterpolation(CLfdf_dfArray,
238 CLfadfI = uiuc_2Dinterpolation(CLfadf_aArray,
252 CZo = uiuc_ice_filter(CZo_clean,kCZo);
255 CZclean_wing += CZo_clean;
256 CZclean_tail += CZo_clean;
269 CZ_a = uiuc_ice_filter(CZ_a_clean,kCZ_a);
272 CZclean_wing += CZ_a_clean * Alpha;
273 CZclean_tail += CZ_a_clean * Alpha;
274 CZiced_wing += CZ_a * Alpha;
275 CZiced_tail += CZ_a * Alpha;
278 CZ_a_save = CZ_a * Alpha;
286 CZ_a2 = uiuc_ice_filter(CZ_a2_clean,kCZ_a2);
289 CZclean_wing += CZ_a2_clean * Alpha * Alpha;
290 CZclean_tail += CZ_a2_clean * Alpha * Alpha;
291 CZiced_wing += CZ_a2 * Alpha * Alpha;
292 CZiced_tail += CZ_a2 * Alpha * Alpha;
295 CZ_a2_save = CZ_a2 * Alpha * Alpha;
296 CZ += CZ_a2 * Alpha * Alpha;
303 CZ_a3 = uiuc_ice_filter(CZ_a3_clean,kCZ_a3);
306 CZclean_wing += CZ_a3_clean * Alpha * Alpha * Alpha;
307 CZclean_tail += CZ_a3_clean * Alpha * Alpha * Alpha;
308 CZiced_wing += CZ_a3 * Alpha * Alpha * Alpha;
309 CZiced_tail += CZ_a3 * Alpha * Alpha * Alpha;
312 CZ_a3_save = CZ_a3 * Alpha * Alpha * Alpha;
313 CZ += CZ_a3 * Alpha * Alpha * Alpha;
320 CZ_adot = uiuc_ice_filter(CZ_adot_clean,kCZ_adot);
323 CZclean_wing += CZ_adot_clean * Alpha_dot * cbar_2U;
324 CZclean_tail += CZ_adot_clean * Alpha_dot * ch_2U;
325 CZiced_wing += CZ_adot * Alpha_dot * cbar_2U;
326 CZiced_tail += CZ_adot * Alpha_dot * ch_2U;
329 /* CZ_adot must be mulitplied by cbar/2U
330 (see Roskam Control book, Part 1, pg. 147) */
331 CZ_adot_save = CZ_adot * Alpha_dot * cbar_2U;
332 CZ += CZ_adot * Alpha_dot * cbar_2U;
339 CZ_q = uiuc_ice_filter(CZ_q_clean,kCZ_q);
342 CZclean_wing += CZ_q_clean * Q_body * cbar_2U;
343 CZclean_tail += CZ_q_clean * Q_body * ch_2U;
344 CZiced_wing += CZ_q * Q_body * cbar_2U;
345 CZiced_tail += CZ_q * Q_body * ch_2U;
348 /* CZ_q must be mulitplied by cbar/2U
349 (see Roskam Control book, Part 1, pg. 147) */
350 CZ_q_save = CZ_q * Q_body * cbar_2U;
351 CZ += CZ_q * Q_body * cbar_2U;
358 CZ_de = uiuc_ice_filter(CZ_de_clean,kCZ_de);
361 CZclean_wing += CZ_de_clean * elevator;
362 CZclean_tail += CZ_de_clean * elevator;
363 CZiced_wing += CZ_de * elevator;
364 CZiced_tail += CZ_de * elevator;
367 CZ_de_save = CZ_de * elevator;
368 CZ += CZ_de * elevator;
375 CZ_deb2 = uiuc_ice_filter(CZ_deb2_clean,kCZ_deb2);
378 CZclean_wing += CZ_deb2_clean * elevator * Beta * Beta;
379 CZclean_tail += CZ_deb2_clean * elevator * Beta * Beta;
380 CZiced_wing += CZ_deb2 * elevator * Beta * Beta;
381 CZiced_tail += CZ_deb2 * elevator * Beta * Beta;
384 CZ_deb2_save = CZ_deb2 * elevator * Beta * Beta;
385 CZ += CZ_deb2 * elevator * Beta * Beta;
392 CZ_df = uiuc_ice_filter(CZ_df_clean,kCZ_df);
395 CZclean_wing += CZ_df_clean * flap;
396 CZclean_tail += CZ_df_clean * flap;
397 CZiced_wing += CZ_df * flap;
398 CZiced_tail += CZ_df * flap;
401 CZ_df_save = CZ_df * flap;
409 CZ_adf = uiuc_ice_filter(CZ_adf_clean,kCZ_adf);
412 CZclean_wing += CZ_adf_clean * Alpha * flap;
413 CZclean_tail += CZ_adf_clean * Alpha * flap;
414 CZiced_wing += CZ_adf * Alpha * flap;
415 CZiced_tail += CZ_adf * Alpha * flap;
418 CZ_adf_save = CZ_adf * Alpha * flap;
419 CZ += CZ_adf * Alpha * flap;
424 CZfaI = uiuc_1Dinterpolation(CZfa_aArray,
433 if (CZfabetaf_nice == 1)
434 CZfabetafI = uiuc_3Dinterp_quick(CZfabetaf_fArray,
435 CZfabetaf_aArray_nice,
436 CZfabetaf_bArray_nice,
445 CZfabetafI = uiuc_3Dinterpolation(CZfabetaf_fArray,
449 CZfabetaf_nAlphaArray,
460 if (CZfadef_nice == 1)
461 CZfadefI = uiuc_3Dinterp_quick(CZfadef_fArray,
463 CZfadef_deArray_nice,
472 CZfadefI = uiuc_3Dinterpolation(CZfadef_fArray,
487 q_nondim = Q_body * cbar_2U;
488 if (CZfaqf_nice == 1)
489 CZfaqfI = uiuc_3Dinterp_quick(CZfaqf_fArray,
500 CZfaqfI = uiuc_3Dinterpolation(CZfaqf_fArray,
519 // end uiuc_coef_lift.cpp