Cnfada, and Cnfbetadr switches
04/15/2000 (JS) broke up into multiple
uiuc_coef_xxx functions
- 06/18/2001 (RD) Added initialization of Alpha and
- Beta. Added aileron_input and rudder_input.
+ 06/18/2001 (RD) Added initialization of Std_Alpha and
+ Std_Beta. Added aileron_input and rudder_input.
Added pilot_elev_no, pilot_ail_no, and
pilot_rud_no.
07/05/2001 (RD) Added pilot_(elev,ail,rud)_no=false
- 01/11/2002 (AP) Added call to uiuc_bootTime()
+ 01/11/2002 (AP) Added call to uiuc_iceboot()
+ 12/02/2002 (RD) Moved icing demo interpolations to its
+ own function
----------------------------------------------------------------------
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- USA or view http://www.gnu.org/copyleft/gpl.html.
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**********************************************************************/
#include "uiuc_coefficients.h"
-#include "uiuc_warnings_errors.h"
-#include <string.h>
-
void uiuc_coefficients(double dt)
{
double V_rel_wind_dum, U_body_dum;
if (Alpha_init_true && Simtime==0)
- Alpha = Alpha_init;
+ Std_Alpha = Alpha_init;
if (Beta_init_true && Simtime==0)
- Beta = Beta_init;
+ Std_Beta = Beta_init;
// calculate rate derivative nondimensionalization factors
// check if speed is sufficient to compute dynamic pressure terms
{
cbar_2U = cbar / (2.0 * V_rel_wind);
b_2U = bw / (2.0 * V_rel_wind);
- // ch is the horizontal tail chord
- ch_2U = ch / (2.0 * V_rel_wind);
+ // chord_h is the horizontal tail chord
+ ch_2U = chord_h / (2.0 * V_rel_wind);
}
else if (use_dyn_on_speed_curve1)
{
V_rel_wind_dum = dyn_on_speed_zero + V_rel_wind * (dyn_on_speed - dyn_on_speed_zero)/dyn_on_speed;
cbar_2U = cbar / (2.0 * V_rel_wind_dum);
b_2U = bw / (2.0 * V_rel_wind_dum);
- ch_2U = ch / (2.0 * V_rel_wind_dum);
- Alpha_dot = 0.0;
+ ch_2U = chord_h / (2.0 * V_rel_wind_dum);
+ Std_Alpha_dot = 0.0;
}
else
{
cbar_2U = 0.0;
b_2U = 0.0;
ch_2U = 0.0;
- Alpha_dot = 0.0;
+ Std_Alpha_dot = 0.0;
}
}
else if(use_abs_U_body_2U) // use absolute(U_body)
{
cbar_2U = cbar / (2.0 * fabs(U_body));
b_2U = bw / (2.0 * fabs(U_body));
- ch_2U = ch / (2.0 * fabs(U_body));
+ ch_2U = chord_h / (2.0 * fabs(U_body));
}
else if (use_dyn_on_speed_curve1)
{
U_body_dum = dyn_on_speed_zero + fabs(U_body) * (dyn_on_speed - dyn_on_speed_zero)/dyn_on_speed;
cbar_2U = cbar / (2.0 * U_body_dum);
b_2U = bw / (2.0 * U_body_dum);
- ch_2U = ch / (2.0 * U_body_dum);
- Alpha_dot = 0.0;
+ ch_2U = chord_h / (2.0 * U_body_dum);
+ Std_Alpha_dot = 0.0;
}
else
{
cbar_2U = 0.0;
b_2U = 0.0;
ch_2U = 0.0;
- Alpha_dot = 0.0;
+ Std_Alpha_dot = 0.0;
}
}
else // use U_body
{
cbar_2U = cbar / (2.0 * U_body);
b_2U = bw / (2.0 * U_body);
- ch_2U = ch / (2.0 * U_body);
+ ch_2U = chord_h / (2.0 * U_body);
}
else if (use_dyn_on_speed_curve1)
{
U_body_dum = dyn_on_speed_zero + U_body * (dyn_on_speed - dyn_on_speed_zero)/dyn_on_speed;
cbar_2U = cbar / (2.0 * U_body_dum);
b_2U = bw / (2.0 * U_body_dum);
- ch_2U = ch / (2.0 * U_body_dum);
- Alpha_dot = 0.0;
+ ch_2U = chord_h / (2.0 * U_body_dum);
+ Std_Alpha_dot = 0.0;
beta_flow_clean_tail = cbar_2U;
}
else
cbar_2U = 0.0;
b_2U = 0.0;
ch_2U = 0.0;
- Alpha_dot = 0.0;
+ Std_Alpha_dot = 0.0;
}
}
- // check if speed is sufficient to "trust" Alpha_dot value
+ // check if speed is sufficient to "trust" Std_Alpha_dot value
if (use_Alpha_dot_on_speed)
{
if (V_rel_wind < Alpha_dot_on_speed)
- Alpha_dot = 0.0;
+ Std_Alpha_dot = 0.0;
}
uiuc_controlInput();
}
- if (icing_demo)
- {
- if (demo_ap_pah_on){
- double time = Simtime - demo_ap_pah_on_startTime;
- ap_pah_on = uiuc_1Dinterpolation(demo_ap_pah_on_timeArray,
- demo_ap_pah_on_daArray,
- demo_ap_pah_on_ntime,
- time);
- }
- if (demo_ap_Theta_ref_deg){
- double time = Simtime - demo_ap_Theta_ref_deg_startTime;
- ap_Theta_ref_deg = uiuc_1Dinterpolation(demo_ap_Theta_ref_deg_timeArray,
- demo_ap_Theta_ref_deg_daArray,
- demo_ap_Theta_ref_deg_ntime,
- time);
- }
- }
- if (ap_pah_on)
+ //if (Simtime >=10.0)
+ // {
+ // ap_hh_on = 1;
+ // ap_Psi_ref_rad = 0*DEG_TO_RAD;
+ // }
+
+ if (ap_pah_on || ap_alh_on || ap_rah_on || ap_hh_on)
{
- double V_rel_wind_ms;
- V_rel_wind_ms = V_rel_wind * 0.3048;
- ap_Theta_ref_rad = ap_Theta_ref_deg * DEG_TO_RAD;
- elevator = pah_ap(Theta, Theta_dot, ap_Theta_ref_rad, V_rel_wind_ms, dt);
- if (elevator*RAD_TO_DEG <= -1*demax)
- elevator = -1*demax * DEG_TO_RAD;
- if (elevator*RAD_TO_DEG >= demin)
- elevator = demin * DEG_TO_RAD;
- pilot_elev_no=true;
+ uiuc_auto_pilot(dt);
}
CD = CX = CL = CZ = Cm = CY = Cl = Cn = 0.0;
tactilefadef_nde_nice,
tactilefadef_nf,
flap_pos,
- Alpha,
+ Std_Alpha,
elevator);
else
tactilefadefI = uiuc_3Dinterpolation(tactilefadef_fArray,
tactilefadef_nde,
tactilefadef_nf,
flap_pos,
- Alpha,
+ Std_Alpha,
elevator);
}
else if (demo_tactile)
time);
}
if (icing_demo)
- {
- if (demo_eps_alpha_max) {
- double time = Simtime - demo_eps_alpha_max_startTime;
- eps_alpha_max = uiuc_1Dinterpolation(demo_eps_alpha_max_timeArray,
- demo_eps_alpha_max_daArray,
- demo_eps_alpha_max_ntime,
- time);
- }
- if (demo_eps_pitch_max) {
- double time = Simtime - demo_eps_pitch_max_startTime;
- eps_pitch_max = uiuc_1Dinterpolation(demo_eps_pitch_max_timeArray,
- demo_eps_pitch_max_daArray,
- demo_eps_pitch_max_ntime,
- time);
- }
- if (demo_eps_pitch_min) {
- double time = Simtime - demo_eps_pitch_min_startTime;
- eps_pitch_min = uiuc_1Dinterpolation(demo_eps_pitch_min_timeArray,
- demo_eps_pitch_min_daArray,
- demo_eps_pitch_min_ntime,
- time);
- }
- if (demo_eps_roll_max) {
- double time = Simtime - demo_eps_roll_max_startTime;
- eps_roll_max = uiuc_1Dinterpolation(demo_eps_roll_max_timeArray,
- demo_eps_roll_max_daArray,
- demo_eps_roll_max_ntime,
- time);
- }
- if (demo_eps_thrust_min) {
- double time = Simtime - demo_eps_thrust_min_startTime;
- eps_thrust_min = uiuc_1Dinterpolation(demo_eps_thrust_min_timeArray,
- demo_eps_thrust_min_daArray,
- demo_eps_thrust_min_ntime,
- time);
- }
- if (demo_eps_airspeed_max) {
- double time = Simtime - demo_eps_airspeed_max_startTime;
- eps_airspeed_max = uiuc_1Dinterpolation(demo_eps_airspeed_max_timeArray,
- demo_eps_airspeed_max_daArray,
- demo_eps_airspeed_max_ntime,
- time);
- }
- if (demo_eps_airspeed_min) {
- double time = Simtime - demo_eps_airspeed_min_startTime;
- eps_airspeed_min = uiuc_1Dinterpolation(demo_eps_airspeed_min_timeArray,
- demo_eps_airspeed_min_daArray,
- demo_eps_airspeed_min_ntime,
- time);
- }
- if (demo_eps_flap_max) {
- double time = Simtime - demo_eps_flap_max_startTime;
- eps_flap_max = uiuc_1Dinterpolation(demo_eps_flap_max_timeArray,
- demo_eps_flap_max_daArray,
- demo_eps_flap_max_ntime,
- time);
- }
- if (demo_boot_cycle_tail) {
- double time = Simtime - demo_boot_cycle_tail_startTime;
- boot_cycle_tail = uiuc_1Dinterpolation(demo_boot_cycle_tail_timeArray,
- demo_boot_cycle_tail_daArray,
- demo_boot_cycle_tail_ntime,
- time);
- }
- if (demo_boot_cycle_wing_left) {
- double time = Simtime - demo_boot_cycle_wing_left_startTime;
- boot_cycle_wing_left = uiuc_1Dinterpolation(demo_boot_cycle_wing_left_timeArray,
- demo_boot_cycle_wing_left_daArray,
- demo_boot_cycle_wing_left_ntime,
- time);
- }
- if (demo_boot_cycle_wing_right) {
- double time = Simtime - demo_boot_cycle_wing_right_startTime;
- boot_cycle_wing_right = uiuc_1Dinterpolation(demo_boot_cycle_wing_right_timeArray,
- demo_boot_cycle_wing_right_daArray,
- demo_boot_cycle_wing_right_ntime,
- time);
- }
- if (demo_eps_pitch_input) {
- double time = Simtime - demo_eps_pitch_input_startTime;
- eps_pitch_input = uiuc_1Dinterpolation(demo_eps_pitch_input_timeArray,
- demo_eps_pitch_input_daArray,
- demo_eps_pitch_input_ntime,
- time);
- }
- if (demo_ice_tail) {
- double time = Simtime - demo_ice_tail_startTime;
- ice_tail = uiuc_1Dinterpolation(demo_ice_tail_timeArray,
- demo_ice_tail_daArray,
- demo_ice_tail_ntime,
- time);
- }
- if (demo_ice_left) {
- double time = Simtime - demo_ice_left_startTime;
- ice_left = uiuc_1Dinterpolation(demo_ice_left_timeArray,
- demo_ice_left_daArray,
- demo_ice_left_ntime,
- time);
- }
- if (demo_ice_right) {
- double time = Simtime - demo_ice_right_startTime;
- ice_right = uiuc_1Dinterpolation(demo_ice_right_timeArray,
- demo_ice_right_daArray,
- demo_ice_right_ntime,
- time);
- }
- }
+ uiuc_icing_demo();
}
if (pilot_ail_no)