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
36 01/11/2002 (AP) Added call to uiuc_bootTime()
38 ----------------------------------------------------------------------
40 AUTHOR(S): Bipin Sehgal <bsehgal@uiuc.edu>
41 Jeff Scott <jscott@mail.com>
42 Robert Deters <rdeters@uiuc.edu>
43 Ann Peedikayil <peedikay@uiuc.edu>
44 ----------------------------------------------------------------------
48 ----------------------------------------------------------------------
50 INPUTS: -V_rel_wind (or U_body)
55 ----------------------------------------------------------------------
64 ----------------------------------------------------------------------
66 CALLED BY: uiuc_wrapper
68 ----------------------------------------------------------------------
70 CALLS TO: uiuc_coef_lift
78 ----------------------------------------------------------------------
80 COPYRIGHT: (C) 2000 by Michael Selig
82 This program is free software; you can redistribute it and/or
83 modify it under the terms of the GNU General Public License
84 as published by the Free Software Foundation.
86 This program is distributed in the hope that it will be useful,
87 but WITHOUT ANY WARRANTY; without even the implied warranty of
88 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
89 GNU General Public License for more details.
91 You should have received a copy of the GNU General Public License
92 along with this program; if not, write to the Free Software
93 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
94 USA or view http://www.gnu.org/copyleft/gpl.html.
96 **********************************************************************/
98 #include "uiuc_coefficients.h"
101 void uiuc_coefficients(double dt)
103 double l_trim, l_defl;
104 double V_rel_wind_dum, U_body_dum;
106 if (Alpha_init_true && Simtime==0)
109 if (Beta_init_true && Simtime==0)
112 // calculate rate derivative nondimensionalization factors
113 // check if speed is sufficient to compute dynamic pressure terms
114 if (nondim_rate_V_rel_wind || use_V_rel_wind_2U) // c172_aero uses V_rel_wind
116 if (V_rel_wind > dyn_on_speed)
118 cbar_2U = cbar / (2.0 * V_rel_wind);
119 b_2U = bw / (2.0 * V_rel_wind);
120 // ch is the horizontal tail chord
121 ch_2U = ch / (2.0 * V_rel_wind);
123 else if (use_dyn_on_speed_curve1)
125 V_rel_wind_dum = dyn_on_speed_zero + V_rel_wind * (dyn_on_speed - dyn_on_speed_zero)/dyn_on_speed;
126 cbar_2U = cbar / (2.0 * V_rel_wind_dum);
127 b_2U = bw / (2.0 * V_rel_wind_dum);
128 ch_2U = ch / (2.0 * V_rel_wind_dum);
139 else if(use_abs_U_body_2U) // use absolute(U_body)
141 if (fabs(U_body) > dyn_on_speed)
143 cbar_2U = cbar / (2.0 * fabs(U_body));
144 b_2U = bw / (2.0 * fabs(U_body));
145 ch_2U = ch / (2.0 * fabs(U_body));
147 else if (use_dyn_on_speed_curve1)
149 U_body_dum = dyn_on_speed_zero + fabs(U_body) * (dyn_on_speed - dyn_on_speed_zero)/dyn_on_speed;
150 cbar_2U = cbar / (2.0 * U_body_dum);
151 b_2U = bw / (2.0 * U_body_dum);
152 ch_2U = ch / (2.0 * U_body_dum);
165 if (U_body > dyn_on_speed)
167 cbar_2U = cbar / (2.0 * U_body);
168 b_2U = bw / (2.0 * U_body);
169 ch_2U = ch / (2.0 * U_body);
171 else if (use_dyn_on_speed_curve1)
173 U_body_dum = dyn_on_speed_zero + U_body * (dyn_on_speed - dyn_on_speed_zero)/dyn_on_speed;
174 cbar_2U = cbar / (2.0 * U_body_dum);
175 b_2U = bw / (2.0 * U_body_dum);
176 ch_2U = ch / (2.0 * U_body_dum);
178 beta_flow_clean_tail = cbar_2U;
189 // check if speed is sufficient to "trust" Alpha_dot value
190 if (use_Alpha_dot_on_speed)
192 if (V_rel_wind < Alpha_dot_on_speed)
197 // check to see if icing model engaged
204 // check to see if data files are used for control deflections
205 pilot_elev_no = false;
206 pilot_ail_no = false;
207 pilot_rud_no = false;
208 if (elevator_step || elevator_singlet || elevator_doublet || elevator_input || aileron_input || rudder_input)
213 CD = CX = CL = CZ = Cm = CY = Cl = Cn = 0.0;
214 CLclean_wing = CLiced_wing = CLclean_tail = CLiced_tail = 0.0;
215 CZclean_wing = CZiced_wing = CZclean_tail = CZiced_tail = 0.0;
216 CXclean_wing = CXiced_wing = CXclean_tail = CXiced_tail = 0.0;
221 uiuc_coef_sideforce();
226 eta_tail = sublimation(OATemperature_F, eta_tail, dt);
227 eta_wing_left = sublimation(OATemperature_F, eta_wing_left, dt);
228 eta_wing_right = sublimation(OATemperature_F, eta_wing_right, dt);
229 //removed shed until new model is created
230 //eta_tail = shed(0.0, eta_tail, OATemperature_F, 0.0, dt);
231 //eta_wing_left = shed(0.0, eta_wing_left, OATemperature_F, 0.0, dt);
232 //eta_wing_right = shed(0.0, eta_wing_right, OATemperature_F, 0.0, dt);
241 Lat_control = - aileron / damax * RAD_TO_DEG;
243 Lat_control = - aileron / damin * RAD_TO_DEG;
248 l_trim = elevator_tab;
249 l_defl = elevator - elevator_tab;
251 Long_trim = l_trim / demax * RAD_TO_DEG;
253 Long_trim = l_trim / demin * RAD_TO_DEG;
255 Long_control = l_defl / demax * RAD_TO_DEG;
257 Long_control = l_defl / demin * RAD_TO_DEG;
263 Rudder_pedal = - rudder / drmax * RAD_TO_DEG;
265 Rudder_pedal = - rudder / drmin * RAD_TO_DEG;
271 // end uiuc_coefficients.cpp