1 /**********************************************************************
3 FILENAME: uiuc_coefficients.cpp
5 ----------------------------------------------------------------------
7 DESCRIPTION: computes aggregated aerodynamic coefficients
9 ----------------------------------------------------------------------
13 ----------------------------------------------------------------------
17 ----------------------------------------------------------------------
19 HISTORY: 01/29/2000 initial release
20 02/01/2000 (JS) changed map name from aeroData to
22 02/18/2000 (JS) added calls to 1Dinterpolation
23 function from CLfa and CDfa switches
24 02/24/2000 added icing model functions
25 02/29/2000 (JS) added calls to 2Dinterpolation
26 function from CLfade, CDfade, Cmfade,
27 CYfada, CYfbetadr, Clfada, Clfbetadr,
28 Cnfada, and Cnfbetadr switches
29 04/15/2000 (JS) broke up into multiple
30 uiuc_coef_xxx functions
31 06/18/2001 (RD) Added initialization of Alpha and
32 Beta. Added aileron_input and rudder_input.
33 Added pilot_elev_no, pilot_ail_no, and
35 07/05/2001 (RD) Added pilot_(elev,ail,rud)_no=false
37 ----------------------------------------------------------------------
39 AUTHOR(S): Bipin Sehgal <bsehgal@uiuc.edu>
40 Jeff Scott <jscott@mail.com>
41 Robert Deters <rdeters@uiuc.edu>
43 ----------------------------------------------------------------------
47 ----------------------------------------------------------------------
49 INPUTS: -V_rel_wind (or U_body)
54 ----------------------------------------------------------------------
63 ----------------------------------------------------------------------
65 CALLED BY: uiuc_wrapper
67 ----------------------------------------------------------------------
69 CALLS TO: uiuc_coef_lift
77 ----------------------------------------------------------------------
79 COPYRIGHT: (C) 2000 by Michael Selig
81 This program is free software; you can redistribute it and/or
82 modify it under the terms of the GNU General Public License
83 as published by the Free Software Foundation.
85 This program is distributed in the hope that it will be useful,
86 but WITHOUT ANY WARRANTY; without even the implied warranty of
87 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
88 GNU General Public License for more details.
90 You should have received a copy of the GNU General Public License
91 along with this program; if not, write to the Free Software
92 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
93 USA or view http://www.gnu.org/copyleft/gpl.html.
95 **********************************************************************/
97 #include "uiuc_coefficients.h"
100 void uiuc_coefficients()
102 double l_trim, l_defl;
103 double V_rel_wind_dum, U_body_dum;
105 if (Alpha_init_true && Simtime==0)
108 if (Beta_init_true && Simtime==0)
111 // calculate rate derivative nondimensionalization factors
112 // check if speed is sufficient to compute dynamic pressure terms
113 if (nondim_rate_V_rel_wind || use_V_rel_wind_2U) // c172_aero uses V_rel_wind
115 if (V_rel_wind > dyn_on_speed)
117 cbar_2U = cbar / (2.0 * V_rel_wind);
118 b_2U = bw / (2.0 * V_rel_wind);
119 ch_2U = ch / (2.0 * V_rel_wind);
121 else if (use_dyn_on_speed_curve1)
123 V_rel_wind_dum = dyn_on_speed_zero + V_rel_wind * (dyn_on_speed - dyn_on_speed_zero)/dyn_on_speed;
124 cbar_2U = cbar / (2.0 * V_rel_wind_dum);
125 b_2U = bw / (2.0 * V_rel_wind_dum);
126 ch_2U = ch / (2.0 * V_rel_wind_dum);
135 else if(use_abs_U_body_2U) // use absolute(U_body)
137 if (fabs(U_body) > dyn_on_speed)
139 cbar_2U = cbar / (2.0 * fabs(U_body));
140 b_2U = bw / (2.0 * fabs(U_body));
141 ch_2U = ch / (2.0 * fabs(U_body));
143 else if (use_dyn_on_speed_curve1)
145 U_body_dum = dyn_on_speed_zero + fabs(U_body) * (dyn_on_speed - dyn_on_speed_zero)/dyn_on_speed;
146 cbar_2U = cbar / (2.0 * U_body_dum);
147 b_2U = bw / (2.0 * U_body_dum);
148 ch_2U = ch / (2.0 * U_body_dum);
159 if (U_body > dyn_on_speed)
161 cbar_2U = cbar / (2.0 * U_body);
162 b_2U = bw / (2.0 * U_body);
163 ch_2U = ch / (2.0 * U_body);
165 else if (use_dyn_on_speed_curve1)
167 U_body_dum = dyn_on_speed_zero + U_body * (dyn_on_speed - dyn_on_speed_zero)/dyn_on_speed;
168 cbar_2U = cbar / (2.0 * U_body_dum);
169 b_2U = bw / (2.0 * U_body_dum);
170 ch_2U = ch / (2.0 * U_body_dum);
171 beta_flow_clean_tail = cbar_2U;
181 // check to see if icing model engaged
187 // check to see if data files are used for control deflections
188 pilot_elev_no = false;
189 pilot_ail_no = false;
190 pilot_rud_no = false;
191 if (elevator_step || elevator_singlet || elevator_doublet || elevator_input || aileron_input || rudder_input)
196 CD = CX = CL = CZ = Cm = CY = Cl = Cn = 0.0;
197 CLclean_wing = CLiced_wing = CLclean_tail = CLiced_tail = 0.0;
198 CZclean_wing = CZiced_wing = CZclean_tail = CZiced_tail = 0.0;
199 CXclean_wing = CXiced_wing = CXclean_tail = CXiced_tail = 0.0;
204 uiuc_coef_sideforce();
211 Lat_control = - aileron / damax * RAD_TO_DEG;
213 Lat_control = - aileron / damin * RAD_TO_DEG;
218 l_trim = elevator_tab;
219 l_defl = elevator - elevator_tab;
221 Long_trim = l_trim / demax * RAD_TO_DEG;
223 Long_trim = l_trim / demin * RAD_TO_DEG;
225 Long_control = l_defl / demax * RAD_TO_DEG;
227 Long_control = l_defl / demin * RAD_TO_DEG;
233 Rudder_pedal = - rudder / drmax * RAD_TO_DEG;
235 Rudder_pedal = - rudder / drmin * RAD_TO_DEG;
241 // end uiuc_coefficients.cpp