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;
104 if (Alpha_init_true && Simtime==0)
107 if (Beta_init_true && Simtime==0)
110 // calculate rate derivative nondimensionalization factors
111 // check if speed is sufficient to compute dynamic pressure terms
112 if (nondim_rate_V_rel_wind) // c172_aero uses V_rel_wind
114 if (V_rel_wind > dyn_on_speed)
116 cbar_2U = cbar / (2.0 * V_rel_wind);
117 b_2U = bw / (2.0 * V_rel_wind);
118 ch_2U = ch / (2.0 * V_rel_wind);
127 else // use U_body which is probably more correct
129 if (U_body > dyn_on_speed)
131 cbar_2U = cbar / (2.0 * U_body);
132 b_2U = bw / (2.0 * U_body);
133 ch_2U = ch / (2.0 * U_body);
143 // check to see if icing model engaged
149 // check to see if data files are used for control deflections
150 pilot_elev_no = false;
151 pilot_ail_no = false;
152 pilot_rud_no = false;
153 if (elevator_step || elevator_singlet || elevator_doublet || elevator_input || aileron_input || rudder_input)
158 CD = CX = CL = CZ = Cm = CY = Cl = Cn = 0.0;
159 CLclean_wing = CLiced_wing = CLclean_tail = CLiced_tail = 0.0;
160 CZclean_wing = CZiced_wing = CZclean_tail = CZiced_tail = 0.0;
161 CXclean_wing = CXiced_wing = CXclean_tail = CXiced_tail = 0.0;
166 uiuc_coef_sideforce();
173 Lat_control = - aileron / damax * RAD_TO_DEG;
175 Lat_control = - aileron / damin * RAD_TO_DEG;
180 l_trim = elevator_tab;
181 l_defl = elevator - elevator_tab;
183 Long_trim = l_trim / demax * RAD_TO_DEG;
185 Long_trim = l_trim / demin * RAD_TO_DEG;
187 Long_control = l_defl / demax * RAD_TO_DEG;
189 Long_control = l_defl / demin * RAD_TO_DEG;
195 Rudder_pedal = - rudder / drmax * RAD_TO_DEG;
197 Rudder_pedal = - rudder / drmin * RAD_TO_DEG;
203 // end uiuc_coefficients.cpp