1
0
Fork 0

Updates to the UIUCModel code. This includes some big compile time

speedups to uiuc_menu.cpp.

(Note these were originally submitted before the cutoff date for new
features, but something was corrupted in the transfer so I granted a bit
of leeway in the schedule.)
This commit is contained in:
curt 2002-09-02 23:26:28 +00:00
parent 401c0afcd9
commit 9a5ec79e11
25 changed files with 7117 additions and 6027 deletions

View file

@ -24,6 +24,9 @@ libUIUCModel_a_SOURCES = \
uiuc_fog.cpp uiuc_fog.h \
uiuc_gear.cpp uiuc_gear.h\
uiuc_ice.cpp uiuc_ice.h \
uiuc_iceboot.cpp uiuc_iceboot.h \
uiuc_ice_rates.cpp uiuc_ice_rates.h \
uiuc_iced_nonlin.cpp uiuc_iced_nonlin.h \
uiuc_initializemaps.cpp uiuc_initializemaps.h \
uiuc_map_CD.cpp uiuc_map_CD.h \
uiuc_map_CL.cpp uiuc_map_CL.h \
@ -46,6 +49,7 @@ libUIUCModel_a_SOURCES = \
uiuc_map_record3.cpp uiuc_map_record3.h \
uiuc_map_record4.cpp uiuc_map_record4.h \
uiuc_map_record5.cpp uiuc_map_record5.h \
uiuc_map_record6.cpp uiuc_map_record6.h \
uiuc_menu.cpp uiuc_menu.h \
uiuc_parsefile.cpp uiuc_parsefile.h \
uiuc_recorder.cpp uiuc_recorder.h \

View file

@ -82,6 +82,8 @@ void uiuc_aerodeflections( double dt )
double prevFlapHandle = 0.0f;
double flap_transit_rate;
bool flaps_in_transit = false;
double demax_remain;
double demin_remain;
if (zero_Long_trim)
{
@ -94,10 +96,31 @@ void uiuc_aerodeflections( double dt )
else
aileron = - Lat_control * damax * DEG_TO_RAD;
if ((Long_control+Long_trim) <= 0)
elevator = (Long_control + Long_trim) * demax * DEG_TO_RAD;
if (Long_trim <= 0)
{
elevator = Long_trim * demax * DEG_TO_RAD;
demax_remain = demax + Long_trim * demax;
demin_remain = -1*Long_trim * demax + demin;
if (Long_control <= 0)
elevator += Long_control * demax_remain * DEG_TO_RAD;
else
elevator += Long_control * demin_remain * DEG_TO_RAD;
}
else
elevator = (Long_control + Long_trim) * demin * DEG_TO_RAD;
{
elevator = Long_trim * demin * DEG_TO_RAD;
demin_remain = demin - Long_trim * demin;
demax_remain = Long_trim * demin + demax;
if (Long_control >=0)
elevator += Long_control * demin_remain * DEG_TO_RAD;
else
elevator += Long_control * demax_remain * DEG_TO_RAD;
}
//if ((Long_control+Long_trim) <= 0)
// elevator = (Long_control + Long_trim) * demax * DEG_TO_RAD;
//else
// elevator = (Long_control + Long_trim) * demin * DEG_TO_RAD;
if (Rudder_pedal <= 0)
rudder = - Rudder_pedal * drmin * DEG_TO_RAD;

View file

@ -59,6 +59,7 @@
11/12/2001 (RD) Added variables needed for Twin Otter
non-linear model with flaps (Cxfxxf).
Zero flap variables removed.
01/11/2002 (AP) Added keywords for bootTime
02/13/2002 (RD) Added variables so linear aero model
values can be recorded
02/18/2002 (RD) Added variables necessary to use the
@ -75,6 +76,7 @@
Jeff Scott <jscott@mail.com>
Robert Deters <rdeters@uiuc.edu>
David Megginson <david@megginson.com>
Ann Peedikayil <peedikay@uiuc.edu>
----------------------------------------------------------------------
@ -136,6 +138,7 @@
#include <math.h>
#include "uiuc_parsefile.h"
//#include "uiuc_flapdata.h"
SG_USING_STD(map);
#if !defined (SG_HAVE_NATIVE_SGI_COMPILERS)
@ -162,7 +165,7 @@ enum {Dx_pilot_flag = 2000, Dy_pilot_flag, Dz_pilot_flag,
use_abs_U_body_2U_flag,
dyn_on_speed_flag, dyn_on_speed_zero_flag,
use_dyn_on_speed_curve1_flag, Alpha_flag,
Beta_flag, U_body_flag, V_body_flag, W_body_flag};
Beta_flag, U_body_flag, V_body_flag, W_body_flag, ignore_unknown_flag};
// geometry === Aircraft-specific geometric quantities
enum {bw_flag = 3000, cbar_flag, Sw_flag, ih_flag, bh_flag, ch_flag, Sh_flag};
@ -188,7 +191,7 @@ enum {Weight_flag = 6000,
// engine ===== Propulsion data
enum {simpleSingle_flag = 7000, c172_flag, cherokee_flag,
Throttle_pct_input_flag};
Throttle_pct_input_flag, forcemom_flag, Xp_input_flag, Zp_input_flag, Mp_input_flag};
// CD ========= Aerodynamic x-force quantities (longitudinal)
enum {CDo_flag = 8000, CDK_flag, CD_a_flag, CD_adot_flag, CD_q_flag, CD_ih_flag, CD_de_flag,
@ -245,7 +248,7 @@ enum {iceTime_flag = 15000, transientTime_flag, eta_ice_final_flag,
kClo_flag, kCl_beta_flag, kCl_p_flag, kCl_r_flag, kCl_da_flag,
kCl_dr_flag, kCl_daa_flag,
kCno_flag, kCn_beta_flag, kCn_p_flag, kCn_r_flag, kCn_da_flag,
kCn_dr_flag, kCn_q_flag, kCn_b3_flag};
kCn_dr_flag, kCn_q_flag, kCn_b3_flag, bootTime_flag};
// record ===== Record desired quantites to file
enum {Simtime_record = 16000, dt_record,
@ -362,6 +365,11 @@ enum {Simtime_record = 16000, dt_record,
M_l_gear_record, M_m_gear_record, M_n_gear_record,
M_l_rp_record, M_m_rp_record, M_n_rp_record,
CL_clean_record, CL_iced_record,
CD_clean_record, CD_iced_record,
Cm_clean_record, Cm_iced_record,
Ch_clean_record, Ch_iced_record,
Cl_clean_record, Cl_iced_record,
CLclean_wing_record, CLiced_wing_record,
CLclean_tail_record, CLiced_tail_record,
Lift_clean_wing_record, Lift_iced_wing_record,
@ -378,10 +386,15 @@ enum {Simtime_record = 16000, dt_record,
beta_flow_iced_tail_record, beta_flow_iced_tail_deg_record,
Dbeta_flow_wing_record, Dbeta_flow_wing_deg_record,
Dbeta_flow_tail_record, Dbeta_flow_tail_deg_record,
pct_beta_flow_wing_record, pct_beta_flow_tail_record};
pct_beta_flow_wing_record, pct_beta_flow_tail_record, eta_ice_record,
flapper_freq_record, flapper_phi_record,
flapper_phi_deg_record, flapper_Lift_record, flapper_Thrust_record,
flapper_Inertia_record, flapper_Moment_record};
// misc ======= Miscellaneous inputs
enum {simpleHingeMomentCoef_flag = 17000, dfTimefdf_flag};
enum {simpleHingeMomentCoef_flag = 17000, dfTimefdf_flag/*, flapper_flag,
flapper_phi_init_flag*/};
//321654
// fog ======== Fog field quantities
@ -518,7 +531,6 @@ struct AIRCRAFT
#define W_body_init_true aircraft_->W_body_init_true
#define W_body_init aircraft_->W_body_init
/* Variables (token2) ===========================================*/
/* geometry ====== Aircraft-specific geometric quantities =======*/
@ -701,6 +713,42 @@ struct AIRCRAFT
#define Throttle_pct_input_dTArray aircraft_->Throttle_pct_input_dTArray
#define Throttle_pct_input_ntime aircraft_->Throttle_pct_input_ntime
#define Throttle_pct_input_startTime aircraft_->Throttle_pct_input_startTime
bool Xp_input;
string Xp_input_file;
double Xp_input_timeArray[5400];
double Xp_input_XpArray[5400];
int Xp_input_ntime;
double Xp_input_startTime;
#define Xp_input aircraft_->Xp_input
#define Xp_input_file aircraft_->Xp_input_file
#define Xp_input_timeArray aircraft_->Xp_input_timeArray
#define Xp_input_XpArray aircraft_->Xp_input_XpArray
#define Xp_input_ntime aircraft_->Xp_input_ntime
#define Xp_input_startTime aircraft_->Xp_input_startTime
bool Zp_input;
string Zp_input_file;
double Zp_input_timeArray[5400];
double Zp_input_ZpArray[5400];
int Zp_input_ntime;
double Zp_input_startTime;
#define Zp_input aircraft_->Zp_input
#define Zp_input_file aircraft_->Zp_input_file
#define Zp_input_timeArray aircraft_->Zp_input_timeArray
#define Zp_input_ZpArray aircraft_->Zp_input_ZpArray
#define Zp_input_ntime aircraft_->Zp_input_ntime
#define Zp_input_startTime aircraft_->Zp_input_startTime
bool Mp_input;
string Mp_input_file;
double Mp_input_timeArray[5400];
double Mp_input_MpArray[5400];
int Mp_input_ntime;
double Mp_input_startTime;
#define Mp_input aircraft_->Mp_input
#define Mp_input_file aircraft_->Mp_input_file
#define Mp_input_timeArray aircraft_->Mp_input_timeArray
#define Mp_input_MpArray aircraft_->Mp_input_MpArray
#define Mp_input_ntime aircraft_->Mp_input_ntime
#define Mp_input_startTime aircraft_->Mp_input_startTime
/* Variables (token2) ===========================================*/
@ -1932,7 +1980,12 @@ struct AIRCRAFT
#define Cn_dr_clean aircraft_->Cn_dr_clean
#define Cn_q_clean aircraft_->Cn_q_clean
#define Cn_b3_clean aircraft_->Cn_b3_clean
double bootTime[20];
int bootindex;
bool bootTrue[20];
#define bootTime aircraft_->bootTime
#define bootindex aircraft_->bootindex
#define bootTrue aircraft_->bootTrue
//321654
/* Variables (token2) ===========================================*/
@ -2069,8 +2122,27 @@ struct AIRCRAFT
#define dfTimefdf_dfArray aircraft_->dfTimefdf_dfArray
#define dfTimefdf_TimeArray aircraft_->dfTimefdf_TimeArray
#define dfTimefdf_ndf aircraft_->dfTimefdf_ndf
/*
FlapData *flapper_data;
#define flapper_data aircraft_->flapper_data
bool flapper_model;
#define flapper_model aircraft_->flapper_model
double flapper_phi_init;
#define flapper_phi_init aircraft_->flapper_phi_init
double flapper_freq, flapper_cycle_pct, flapper_phi;
double flapper_Lift, flapper_Thrust, flapper_Inertia;
double flapper_Moment;
#define flapper_freq aircraft_->flapper_freq
#define flapper_cycle_pct aircraft_->flapper_cycle_pct
#define flapper_phi aircraft_->flapper_phi
#define flapper_Lift aircraft_->flapper_Lift
#define flapper_Thrust aircraft_->flapper_Thrust
#define flapper_Inertia aircraft_->flapper_Inertia
#define flapper_Moment aircraft_->flapper_Moment
double F_X_aero_flapper, F_Z_aero_flapper;
#define F_X_aero_flapper aircraft_->F_X_aero_flapper
#define F_Z_aero_flapper aircraft_->F_Z_aero_flapper
*/
/* Other variables (not tokens) =================================*/
double convert_x, convert_y, convert_z;
@ -2096,11 +2168,47 @@ struct AIRCRAFT
#define flap_moving_rate aircraft_->flap_moving_rate
#define flap_pos aircraft_->flap_pos
double delta_CL, delta_CD, delta_Cm, delta_Ch, delta_Cl;
#define delta_CL aircraft_->delta_CL
#define delta_CD aircraft_->delta_CD
#define delta_Cm aircraft_->delta_Cm
#define delta_Ch aircraft_->delta_Ch
#define delta_Cl aircraft_->delta_Cl
int ice_case;
double eta_wing_left, eta_wing_right, eta_tail;
double OATemperature_F;
#define ice_case aircraft_->ice_case
#define eta_wing_left aircraft_->eta_wing_left
#define eta_wing_right aircraft_->eta_wing_right
#define eta_tail aircraft_->eta_tail
#define OATemperature_F aircraft_->OATemperature_F
double Ch;
#define Ch aircraft_->Ch;
double CL_clean, CL_iced;
double CD_clean, CD_iced;
double Cm_clean, Cm_iced;
double Cl_clean, Cl_iced;
double Ch_clean, Ch_iced;
#define CL_clean aircraft_->CL_clean
#define CD_clean aircraft_->CD_clean
#define Cm_clean aircraft_->Cm_clean
#define Cl_clean aircraft_->Cl_clean
#define Ch_clean aircraft_->Ch_clean
#define CL_iced aircraft_->CL_iced
#define CD_iced aircraft_->CD_iced
#define Cm_iced aircraft_->Cm_iced
#define Cl_iced aircraft_->Cl_iced
#define Ch_iced aircraft_->Ch_iced
ofstream fout;
#define fout aircraft_->fout
bool dont_ignore;
#define dont_ignore aircraft_->dont_ignore
};

View file

@ -420,7 +420,7 @@ void uiuc_coef_drag()
}
case CXfabetaf_flag:
{
if (CXfabetaf_nice == 1)
if (CXfabetaf_nice == 1) {
CXfabetafI = uiuc_3Dinterp_quick(CXfabetaf_fArray,
CXfabetaf_aArray_nice,
CXfabetaf_bArray_nice,
@ -431,7 +431,19 @@ void uiuc_coef_drag()
flap_pos,
Alpha,
Beta);
else
// temp until Jim's code works
//CXo = uiuc_3Dinterp_quick(CXfabetaf_fArray,
// CXfabetaf_aArray_nice,
// CXfabetaf_bArray_nice,
// CXfabetaf_CXArray,
// CXfabetaf_na_nice,
// CXfabetaf_nb_nice,
// CXfabetaf_nf,
// flap_pos,
// 0.0,
// Beta);
}
else {
CXfabetafI = uiuc_3Dinterpolation(CXfabetaf_fArray,
CXfabetaf_aArray,
CXfabetaf_betaArray,
@ -442,6 +454,18 @@ void uiuc_coef_drag()
flap_pos,
Alpha,
Beta);
// temp until Jim's code works
//CXo = uiuc_3Dinterpolation(CXfabetaf_fArray,
// CXfabetaf_aArray,
// CXfabetaf_betaArray,
// CXfabetaf_CXArray,
// CXfabetaf_nAlphaArray,
// CXfabetaf_nbeta,
// CXfabetaf_nf,
// flap_pos,
// 0.0,
// Beta);
}
CX += CXfabetafI;
break;
}

View file

@ -33,13 +33,14 @@
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()
----------------------------------------------------------------------
AUTHOR(S): Bipin Sehgal <bsehgal@uiuc.edu>
Jeff Scott <jscott@mail.com>
Robert Deters <rdeters@uiuc.edu>
Ann Peedikayil <peedikay@uiuc.edu>
----------------------------------------------------------------------
VARIABLES:
@ -97,7 +98,7 @@
#include "uiuc_coefficients.h"
void uiuc_coefficients()
void uiuc_coefficients(double dt)
{
double l_trim, l_defl;
double V_rel_wind_dum, U_body_dum;
@ -181,6 +182,7 @@ void uiuc_coefficients()
// check to see if icing model engaged
if (ice_model)
{
uiuc_iceboot(dt);
uiuc_ice_eta();
}
@ -204,6 +206,19 @@ void uiuc_coefficients()
uiuc_coef_sideforce();
uiuc_coef_roll();
uiuc_coef_yaw();
if (ice_case)
{
eta_tail = sublimation(OATemperature_F, eta_tail, dt);
eta_wing_left = sublimation(OATemperature_F, eta_wing_left, dt);
eta_wing_right = sublimation(OATemperature_F, eta_wing_right, dt);
//removed shed until new model is created
//eta_tail = shed(0.0, eta_tail, OATemperature_F, 0.0, dt);
//eta_wing_left = shed(0.0, eta_wing_left, OATemperature_F, 0.0, dt);
//eta_wing_right = shed(0.0, eta_wing_right, OATemperature_F, 0.0, dt);
Calc_Iced_Forces();
add_ice_effects();
}
if (pilot_ail_no)
{

View file

@ -9,11 +9,14 @@
#include "uiuc_coef_sideforce.h"
#include "uiuc_coef_roll.h"
#include "uiuc_coef_yaw.h"
#include "uiuc_iceboot.h"
#include "uiuc_iced_nonlin.h"
#include "uiuc_ice_rates.h"
#include <FDM/LaRCsim/ls_generic.h>
#include <FDM/LaRCsim/ls_cockpit.h> /*Long_control,Lat_control,Rudder_pedal */
#include <FDM/LaRCsim/ls_constants.h> /* RAD_TO_DEG, DEG_TO_RAD*/
void uiuc_coefficients();
void uiuc_coefficients(double dt);
#endif // _COEFFICIENTS_H_

View file

@ -172,6 +172,39 @@ void uiuc_engine()
F_Z_engine = 0.0;
break;
}
case forcemom_flag:
{
double Xp_input_endTime = Xp_input_timeArray[Xp_input_ntime];
if (Simtime >= Xp_input_startTime &&
Simtime <= (Xp_input_startTime + Xp_input_endTime))
{
double time = Simtime - Xp_input_startTime;
F_X_engine = uiuc_1Dinterpolation(Xp_input_timeArray,
Xp_input_XpArray,
Xp_input_ntime,
time);
}
double Zp_input_endTime = Zp_input_timeArray[Zp_input_ntime];
if (Simtime >= Zp_input_startTime &&
Simtime <= (Zp_input_startTime + Zp_input_endTime))
{
double time = Simtime - Zp_input_startTime;
F_Z_engine = uiuc_1Dinterpolation(Zp_input_timeArray,
Zp_input_ZpArray,
Zp_input_ntime,
time);
}
double Mp_input_endTime = Mp_input_timeArray[Mp_input_ntime];
if (Simtime >= Mp_input_startTime &&
Simtime <= (Mp_input_startTime + Mp_input_endTime))
{
double time = Simtime - Mp_input_startTime;
M_m_engine = uiuc_1Dinterpolation(Mp_input_timeArray,
Mp_input_MpArray,
Mp_input_ntime,
time);
}
}
};
}
return;

View file

@ -0,0 +1,93 @@
//#include <ansi_c.h>
//#include <math.h>
//#include <stdio.h>
//#include <stdlib.h>
#include "uiuc_ice_rates.h"
///////////////////////////////////////////////////////////////////////
// Calculates shed rate depending on current aero loads, eta, temp, and freezing fraction
// Code by Leia Blumenthal
//
// 13 Feb 02 - Created basic program with dummy variables and a constant shed rate (no dependency)
//
// Inputs:
// aero_load - aerodynamic load
// eta
// T - Temperature in Farenheit
// ff - freezing fraction
//
// Output:
// rate - %eta shed/time
//
// Right now this is just a constant shed rate until we learn more...
double shed(double aero_load, double eta, double T, double ff, double time_step)
{
double rate, eta_new;
if (eta <= 0.0)
rate = 0.0;
else
rate = 0.2;
eta_new = eta-rate*eta*time_step;
if (eta_new <= 0.0)
eta_new = 0.0;
return(eta_new);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
// Currently a simple linear approximation based on temperature and eta, but for next version,
// should have so that it calculates sublimation rate depending on current temp,pressure,
// dewpoint, radiation, and eta
//
// Code by Leia Blumenthal
// 12 Feb 02 - Created basic program with linear rate for values when sublimation will occur
// 16 May 02 - Modified so that outputs new eta as opposed to rate
// Inputs:
// T - temperature and must be input in Farenheit
// P - pressure
// Tdew - Dew point Temperature
// rad - radiation
// time_step- increment since last run
//
// Intermediate:
// rate - sublimation rate (% eta change/time)
//
// Output:
// eta_new- eta after sublimation has occurred
//
// This takes a simple approximation that the rate of sublimation will decrease
// linearly with temperature increase.
//
// This code should be run every time step to every couple time steps
//
// If eta is less than zero, than there should be no sublimation
double sublimation(double T, double eta, double time_step)
{
double rate, eta_new;
if (eta <= 0.0) rate = 0;
else{
// According to the Smithsonian Meteorological tables sublimation occurs
// between -40 deg F < T < 32 deg F and between pressures of 0 atm < P < 0.00592 atm
if (T < -40) rate = 0;
else if (T >= -40 && T < 32)
{
// For a simple linear approximation, assume largest value is a rate of .2% per sec
rate = 0.0028 * T + 0.0889;
}
else if (T >= 32) rate = 0;
}
eta_new = eta-rate*eta*time_step;
if (eta_new <= 0.0)
eta_new = 0.0;
return(eta_new);
}

View file

@ -0,0 +1,7 @@
#ifndef _ICE_RATES_H_
#define _ICE_RATES_H_
double shed(double aero_load, double eta, double T, double ff, double time_step);
double sublimation(double T, double eta, double time_step);
#endif //_ICE_RATES_H_

View file

@ -0,0 +1,89 @@
/**********************************************************************
FILENAME: uiuc_iceboot.cpp
----------------------------------------------------------------------
DESCRIPTION: checks if the iceboot is on, if so then eta ice will equal
zero
----------------------------------------------------------------------
STATUS: alpha version
----------------------------------------------------------------------
REFERENCES:
----------------------------------------------------------------------
HISTORY: 01/11/2002 initial release
----------------------------------------------------------------------
AUTHOR(S): Robert Deters <rdeters@uiuc.edu>
Ann Peedikayil <peedikay@uiuc.edu>
----------------------------------------------------------------------
VARIABLES:
----------------------------------------------------------------------
INPUTS: -Simtime
-icing times
-dt
-bootTime
----------------------------------------------------------------------
OUTPUTS: -icing severity (eta_ice)
----------------------------------------------------------------------
CALLED BY: uiuc_coefficients
----------------------------------------------------------------------
CALLS TO: none
----------------------------------------------------------------------
COPYRIGHT: (C) 2002 by Michael Selig
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
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.
**********************************************************************/
#include "uiuc_iceboot.h"
void uiuc_iceboot(double dt)
{
if (bootTrue[bootindex])
{
if (bootTime[bootindex]- dt <Simtime && bootTime[bootindex]+ dt >Simtime)
// checks if the boot is on
{
eta_ice = 0;
// drops the eta ice to zero
if (bootTime [bootindex] > iceTime)
iceTime = bootTime[bootindex];
bootindex++;
}
}
}

View file

@ -0,0 +1,19 @@
#ifndef _ICEBOOT_H_
#define _ICEBOOT_H_
#include "uiuc_aircraft.h"
#ifdef __cplusplus
extern "C" {
#endif
extern double Simtime;
#ifdef __cplusplus
}
#endif
void uiuc_iceboot( double dt);
#endif // _ICEBOOT_H_

View file

@ -0,0 +1,111 @@
// SIS Twin Otter Iced aircraft Nonlinear model
// Version 020409
// read readme_020212.doc for information
#include "uiuc_iced_nonlin.h"
void Calc_Iced_Forces()
{
// alpha in deg
double alpha;
double de;
double eta_ref_wing = 0.08; // eta of iced data used for curve fit
double eta_ref_tail = 0.12;
double eta_wing;
//double delta_CL; // CL_clean - CL_iced;
//double delta_CD; // CD_clean - CD_iced;
//double delta_Cm; // CM_clean - CM_iced;
double delta_Cm_a; // (Cm_clean - Cm_iced) as a function of AoA;
double delta_Cm_de; // (Cm_clean - Cm_iced) as a function of de;
double delta_Ch_a;
double delta_Ch_e;
double KCL;
double KCD;
double KCm_alpha;
double KCm_de;
double KCh;
double CL_diff;
alpha = Alpha*RAD_TO_DEG;
de = elevator*RAD_TO_DEG;
// lift fits
if (alpha < 16)
{
delta_CL = (0.088449 + 0.004836*alpha - 0.0005459*alpha*alpha +
4.0859e-5*pow(alpha,3));
}
else
{
delta_CL = (-11.838 + 1.6861*alpha - 0.076707*alpha*alpha +
0.001142*pow(alpha,3));
}
KCL = -delta_CL/eta_ref_wing;
eta_wing = 0.5*(eta_wing_left + eta_wing_right);
delta_CL = eta_wing*KCL;
// drag fit
delta_CD = (-0.0089 + 0.001578*alpha - 0.00046253*pow(alpha,2) +
-4.7511e-5*pow(alpha,3) + 2.3384e-6*pow(alpha,4));
KCD = -delta_CD/eta_ref_wing;
delta_CD = eta_wing*KCD;
// pitching moment fit
delta_Cm_a = (-0.01892 - 0.0056476*alpha + 1.0205e-5*pow(alpha,2)
- 4.0692e-5*pow(alpha,3) + 1.7594e-6*pow(alpha,4));
delta_Cm_de = (-0.014928 - 0.0037783*alpha + 0.00039086*pow(de,2)
- 1.1304e-5*pow(de,3) - 1.8439e-6*pow(de,4));
delta_Cm = delta_Cm_a + delta_Cm_de;
KCm_alpha = delta_Cm_a/eta_ref_wing;
KCm_de = delta_Cm_de/eta_ref_tail;
delta_Cm = (0.75*eta_wing + 0.25*eta_tail)*KCm_alpha + (eta_tail)*KCm_de;
// hinge moment
if (alpha < 13)
{
delta_Ch_a = (-0.0012862 - 0.00022705*alpha + 1.5911e-5*pow(alpha,2)
+ 5.4536e-7*pow(alpha,3));
}
else
{
delta_Ch_a = 0;
}
delta_Ch_e = -0.0011851 - 0.00049924*de;
delta_Ch = -(delta_Ch_a + delta_Ch_e);
KCh = -delta_Ch/eta_ref_tail;
delta_Ch = eta_tail*KCh;
// rolling moment
CL_diff = (eta_wing_left - eta_wing_right)*KCL;
delta_Cl = CL_diff/4;
}
void add_ice_effects()
{
CL_clean = -1*CZ*cos(Alpha) + CX*sin(Alpha); //Check later
CD_clean = -1*CZ*sin(Alpha) - CX*cos(Alpha);
Cm_clean = Cm;
Cl_clean = Cl;
Ch_clean = Ch;
CL_iced = CL_clean + delta_CL;
CD_iced = CD_clean + delta_CD;
Cm_iced = Cm_clean + delta_Cm;
Cl_iced = Cl_clean + delta_Cl;
//Ch_iced = Ch_clean + delta_Ch;
CL = CL_iced;
CD = CD_iced;
Cm = Cm_iced;
Cl = Cl_iced;
//Ch = Ch_iced;
CZ = -1*CL*cos(Alpha) - CD*sin(Alpha);
CX = CL*sin(Alpha) - CD*cos(Alpha);
}

View file

@ -0,0 +1,11 @@
#ifndef _ICED_NONLIN_H_
#define _ICED_NONLIN_H_
#include "uiuc_aircraft.h"
#include <FDM/LaRCsim/ls_generic.h>
#include <FDM/LaRCsim/ls_constants.h> /* RAD_TO_DEG, DEG_TO_RAD*/
void Calc_Iced_Forces();
void add_ice_effects();
#endif // _ICED_NONLIN_H_

View file

@ -91,6 +91,7 @@ void uiuc_initializemaps()
uiuc_map_record3();
uiuc_map_record4();
uiuc_map_record5();
uiuc_map_record6();
uiuc_map_misc();
}

View file

@ -22,6 +22,7 @@
#include "uiuc_map_record3.h"
#include "uiuc_map_record4.h"
#include "uiuc_map_record5.h"
#include "uiuc_map_record6.h"
#include "uiuc_map_misc.h"
void uiuc_initializemaps();

View file

@ -74,6 +74,10 @@ void uiuc_map_engine()
engine_map["c172"] = c172_flag ;
engine_map["cherokee"] = cherokee_flag ;
engine_map["Throttle_pct_input"]= Throttle_pct_input_flag ;
engine_map["forcemom"] = forcemom_flag ;
engine_map["Xp_input"] = Xp_input_flag ;
engine_map["Zp_input"] = Zp_input_flag ;
engine_map["Mp_input"] = Mp_input_flag ;
}
// end uiuc_map_engine.cpp

View file

@ -137,6 +137,7 @@ void uiuc_map_ice()
ice_map["kCn_b3"] = kCn_b3_flag ;
ice_map["beta_probe_wing"] = beta_probe_wing_flag ;
ice_map["beta_probe_tail"] = beta_probe_tail_flag ;
ice_map["bootTime"] = bootTime_flag ;
}
// end uiuc_map_ice.cpp

View file

@ -101,6 +101,7 @@ void uiuc_map_init()
init_map["U_body"] = U_body_flag ;
init_map["V_body"] = V_body_flag ;
init_map["W_body"] = W_body_flag ;
init_map["ignore_unknown"] = ignore_unknown_flag ;
}
// end uiuc_map_init.cpp

View file

@ -70,6 +70,8 @@ void uiuc_map_misc()
{
misc_map["simpleHingeMomentCoef"] = simpleHingeMomentCoef_flag ;
misc_map["dfTimefdf"] = dfTimefdf_flag ;
//misc_map["flapper"] = flapper_flag ;
//misc_map["flapper_phi_init"] = flapper_phi_init_flag ;
}
// end uiuc_map_misc.cpp

View file

@ -198,43 +198,6 @@ void uiuc_map_record4()
record_map["Cn_dr_save"] = Cn_dr_save_record ;
record_map["Cn_q_save"] = Cn_q_save_record ;
record_map["Cn_b3_save"] = Cn_b3_save_record ;
/******************** Ice Detection ********************/
record_map["CLclean_wing"] = CLclean_wing_record ;
record_map["CLiced_wing"] = CLiced_wing_record ;
record_map["CLclean_tail"] = CLclean_tail_record ;
record_map["CLiced_tail"] = CLiced_tail_record ;
record_map["Lift_clean_wing"] = Lift_clean_wing_record ;
record_map["Lift_iced_wing"] = Lift_iced_wing_record ;
record_map["Lift_clean_tail"] = Lift_clean_tail_record ;
record_map["Lift_iced_tail"] = Lift_iced_tail_record ;
record_map["Gamma_clean_wing"] = Gamma_clean_wing_record ;
record_map["Gamma_iced_wing"] = Gamma_iced_wing_record ;
record_map["Gamma_clean_tail"] = Gamma_clean_tail_record ;
record_map["Gamma_iced_tail"] = Gamma_iced_tail_record ;
record_map["w_clean_wing"] = w_clean_wing_record ;
record_map["w_iced_wing"] = w_iced_wing_record ;
record_map["w_clean_tail"] = w_clean_tail_record ;
record_map["w_iced_tail"] = w_iced_tail_record ;
record_map["V_total_clean_wing"] = V_total_clean_wing_record ;
record_map["V_total_iced_wing"] = V_total_iced_wing_record ;
record_map["V_total_clean_tail"] = V_total_clean_tail_record ;
record_map["V_total_iced_tail"] = V_total_iced_tail_record ;
record_map["beta_flow_clean_wing"] = beta_flow_clean_wing_record ;
record_map["beta_flow_clean_wing_deg"]= beta_flow_clean_wing_deg_record;
record_map["beta_flow_iced_wing"] = beta_flow_iced_wing_record ;
record_map["beta_flow_iced_wing_deg"] = beta_flow_iced_wing_deg_record ;
record_map["beta_flow_clean_tail"] = beta_flow_clean_tail_record ;
record_map["beta_flow_clean_tail_deg"]= beta_flow_clean_tail_deg_record;
record_map["beta_flow_iced_tail"] = beta_flow_iced_tail_record ;
record_map["beta_flow_iced_tail_deg"] = beta_flow_iced_tail_deg_record ;
record_map["Dbeta_flow_wing"] = Dbeta_flow_wing_record ;
record_map["Dbeta_flow_wing_deg"] = Dbeta_flow_wing_deg_record ;
record_map["Dbeta_flow_tail"] = Dbeta_flow_tail_record ;
record_map["Dbeta_flow_tail_deg"] = Dbeta_flow_tail_deg_record ;
record_map["pct_beta_flow_wing"] = pct_beta_flow_wing_record ;
record_map["pct_beta_flow_tail"] = pct_beta_flow_tail_record ;
}
// end uiuc_map_record4.cpp

View file

@ -120,6 +120,15 @@ void uiuc_map_record5()
record_map["M_l_rp"] = M_l_rp_record ;
record_map["M_m_rp"] = M_m_rp_record ;
record_map["M_n_rp"] = M_n_rp_record ;
/***********************Flapper Data********************/
/* record_map["flapper_freq"] = flapper_freq_record ;
record_map["flapper_phi"] = flapper_phi_record ;
record_map["flapper_phi_deg"] = flapper_phi_deg_record ;
record_map["flapper_Lift"] = flapper_Lift_record ;
record_map["flapper_Thrust"] = flapper_Thrust_record ;
record_map["flapper_Inertia"] = flapper_Inertia_record ;
record_map["flapper_Moment"] = flapper_Moment_record ;*/
}
// end uiuc_map_record5.cpp

File diff suppressed because it is too large Load diff

View file

@ -12,8 +12,9 @@
#include <FDM/LaRCsim/ls_generic.h>
#include <FDM/LaRCsim/ls_cockpit.h> /* Long_trim defined */
#include <FDM/LaRCsim/ls_constants.h> /* INVG defined */
//#include "uiuc_flapdata.h"
bool check_float(string &token); // To check whether the token is a float or not
bool check_float(const string &token); // To check whether the token is a float or not
void uiuc_menu (string aircraft);
#endif //_MENU_H_

View file

@ -1459,6 +1459,56 @@ void uiuc_recorder( double dt )
}
/******************** Ice Detection ********************/
case CL_clean_record:
{
fout << CL_clean << " ";
break;
}
case CL_iced_record:
{
fout << CL_iced << " ";
break;
}
case CD_clean_record:
{
fout << CD_clean << " ";
break;
}
case CD_iced_record:
{
fout << CD_iced << " ";
break;
}
case Cm_clean_record:
{
fout << Cm_clean << " ";
break;
}
case Cm_iced_record:
{
fout << Cm_iced << " ";
break;
}
case Ch_clean_record:
{
fout << Ch_clean << " ";
break;
}
case Ch_iced_record:
{
fout << Ch_iced << " ";
break;
}
case Cl_clean_record:
{
fout << Cl_clean << " ";
break;
}
case Cl_iced_record:
{
fout << Cl_iced << " ";
break;
}
case CLclean_wing_record:
{
fout << CLclean_wing << " ";
@ -1629,6 +1679,11 @@ void uiuc_recorder( double dt )
fout << pct_beta_flow_tail << " ";
break;
}
case eta_ice_record:
{
fout << eta_ice << " ";
break;
}
/************************ Forces ***********************/
case F_X_wind_record:
@ -1783,6 +1838,43 @@ void uiuc_recorder( double dt )
fout << M_n_rp << " ";
break;
}
/*********************** Moments ***********************/
/* case flapper_freq_record:
{
fout << flapper_freq << " ";
break;
}
case flapper_phi_record:
{
fout << flapper_phi << " ";
break;
}
case flapper_phi_deg_record:
{
fout << flapper_phi*RAD_TO_DEG << " ";
break;
}
case flapper_Lift_record:
{
fout << flapper_Lift << " ";
break;
}
case flapper_Thrust_record:
{
fout << flapper_Thrust << " ";
break;
}
case flapper_Inertia_record:
{
fout << flapper_Inertia << " ";
break;
}
case flapper_Moment_record:
{
fout << flapper_Moment << " ";
break;
} */
};
} // end record map
}

View file

@ -93,6 +93,7 @@
//#include "Main/simple_udp.h"
#include "uiuc_fog.h" //321654
//#include "uiuc_network.h"
//#include "uiuc_get_flapper.h"
#if !defined (SG_HAVE_NATIVE_SGI_COMPILERS)
SG_USING_STD(cout);
@ -104,7 +105,7 @@ extern "C" void uiuc_force_moment(double dt);
extern "C" void uiuc_engine_routine();
extern "C" void uiuc_gear_routine();
extern "C" void uiuc_record_routine(double dt);
//extern "C" void uiuc_network_routine();
extern "C" void uiuc_network_routine();
extern "C" void uiuc_vel_init ();
extern "C" void uiuc_initial_init ();
@ -188,7 +189,11 @@ void uiuc_force_moment(double dt)
double qSb = qS * bw;
uiuc_aerodeflections(dt);
uiuc_coefficients();
uiuc_coefficients(dt);
//if (flapper_model)
// {
// uiuc_get_flapper(dt);
// }
/* Calculate the forces */
if (CX && CZ)
@ -233,6 +238,13 @@ void uiuc_force_moment(double dt)
if (I_zz_appMass)
M_m_aero += -I_zz_appMass * R_dot_body;
//if (flapper_model)
// {
// F_X_aero += F_X_aero_flapper;
// F_Z_aero += F_Z_aero_flapper;
// M_m_aero += flapper_Moment;
// }
// fog field update
Fog = 0;
if (fog_field)
@ -288,7 +300,7 @@ void uiuc_record_routine(double dt)
uiuc_recorder(dt);
}
//void uiuc_network_routine ()
//void uiuc_network_routine()
//{
// uiuc_network();
//}