Robert Deters:
Latest revisions of the UIUC code.
This commit is contained in:
parent
49a8c070f3
commit
4a2c47d9d7
36 changed files with 2195 additions and 420 deletions
|
@ -571,7 +571,7 @@ bool FGLaRCsim::copy_from_LaRCsim() {
|
|||
globals->get_controls()->set_rudder(Rudder_pedal);
|
||||
// controls.set_rudder(Rudder_pedal);
|
||||
}
|
||||
if (Throttle_pct_input) {
|
||||
if (pilot_throttle_no) {
|
||||
globals->get_controls()->set_throttle(0,Throttle_pct);
|
||||
// controls.set_throttle(0,Throttle_pct);
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ libLaRCsim_a_SOURCES = \
|
|||
ls_step.c ls_step.h \
|
||||
ls_sym.h ls_types.h \
|
||||
$(AIRCRAFT_MODEL) \
|
||||
ls_interface.c ls_interface.h
|
||||
ls_interface.c ls_interface.h \
|
||||
uiuc_getwind.c
|
||||
|
||||
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src
|
||||
|
|
|
@ -47,8 +47,13 @@
|
|||
|
||||
$Header$
|
||||
$Log$
|
||||
Revision 1.1 2002/09/10 01:14:01 curt
|
||||
Initial revision
|
||||
Revision 1.2 2002/11/08 17:03:50 curt
|
||||
Robert Deters:
|
||||
|
||||
Latest revisions of the UIUC code.
|
||||
|
||||
Revision 1.1.1.1 2002/09/10 01:14:01 curt
|
||||
Initial revision of FlightGear-0.9.0
|
||||
|
||||
Revision 1.3 2001/03/24 05:03:12 curt
|
||||
SG-ified logstream.
|
||||
|
@ -294,9 +299,12 @@ Initial Flight Gear revision.
|
|||
|
||||
#include <math.h>
|
||||
|
||||
#include "uiuc_getwind.h" //For wind gradient functions
|
||||
|
||||
void ls_aux( void ) {
|
||||
|
||||
static double uiuc_wind[3] = {0, 0, 0}; //The UIUC wind vector (initialized to zero)
|
||||
|
||||
SCALAR dx_pilot_from_cg, dy_pilot_from_cg, dz_pilot_from_cg;
|
||||
/* SCALAR inv_Mass; */
|
||||
SCALAR v_XZ_plane_2, signU, v_tangential;
|
||||
|
@ -319,10 +327,17 @@ void ls_aux( void ) {
|
|||
V_east_rel_ground = V_east
|
||||
- OMEGA_EARTH*Sea_level_radius*cos( Lat_geocentric );
|
||||
V_down_rel_ground = V_down;
|
||||
|
||||
//BEGIN Modified UIUC arbitrary wind calculations:
|
||||
uiuc_getwind(uiuc_wind); //Update the UIUC wind vector
|
||||
V_north_rel_airmass = V_north_rel_ground - uiuc_wind[0] - V_north_airmass;
|
||||
V_east_rel_airmass = V_east_rel_ground - uiuc_wind[1] - V_east_airmass;
|
||||
V_down_rel_airmass = V_down_rel_ground - uiuc_wind[2] - V_down_airmass;
|
||||
//END UIUC wind code
|
||||
|
||||
V_north_rel_airmass = V_north_rel_ground - V_north_airmass;
|
||||
V_east_rel_airmass = V_east_rel_ground - V_east_airmass;
|
||||
V_down_rel_airmass = V_down_rel_ground - V_down_airmass;
|
||||
// V_north_rel_airmass = V_north_rel_ground - V_north_airmass;
|
||||
// V_east_rel_airmass = V_east_rel_ground - V_east_airmass;
|
||||
// V_down_rel_airmass = V_down_rel_ground - V_down_airmass;
|
||||
|
||||
U_body = T_local_to_body_11*V_north_rel_airmass
|
||||
+ T_local_to_body_12*V_east_rel_airmass
|
||||
|
|
|
@ -37,8 +37,13 @@
|
|||
CURRENT RCS HEADER INFO:
|
||||
$Header$
|
||||
$Log$
|
||||
Revision 1.1 2002/09/10 01:14:02 curt
|
||||
Initial revision
|
||||
Revision 1.2 2002/11/08 17:03:50 curt
|
||||
Robert Deters:
|
||||
|
||||
Latest revisions of the UIUC code.
|
||||
|
||||
Revision 1.1.1.1 2002/09/10 01:14:02 curt
|
||||
Initial revision of FlightGear-0.9.0
|
||||
|
||||
Revision 1.5 2002/04/01 19:37:34 curt
|
||||
I have attached revisions to the UIUC code. The revisions include the
|
||||
|
@ -161,8 +166,8 @@ void ls_model( SCALAR dt, int Initialize ) {
|
|||
case UIUC:
|
||||
inertias( dt, Initialize );
|
||||
subsystems( dt, Initialize );
|
||||
uiuc_aero_2_wrapper( dt, Initialize );
|
||||
uiuc_engine_2_wrapper( dt, Initialize );
|
||||
uiuc_aero_2_wrapper( dt, Initialize );
|
||||
uiuc_gear_2_wrapper( dt, Initialize );
|
||||
//uiuc_network_2_wrapper();
|
||||
uiuc_record_2_wrapper(dt);
|
||||
|
|
|
@ -61,6 +61,12 @@
|
|||
|
||||
|
||||
void uiuc_aero_2_wrapper( SCALAR dt, int Initialize )
|
||||
{
|
||||
uiuc_force_moment(dt);
|
||||
}
|
||||
|
||||
|
||||
void uiuc_engine_2_wrapper( SCALAR dt, int Initialize )
|
||||
{
|
||||
static int init = 0;
|
||||
|
||||
|
@ -71,12 +77,6 @@ void uiuc_aero_2_wrapper( SCALAR dt, int Initialize )
|
|||
// uiuc_init_aeromodel();
|
||||
}
|
||||
|
||||
uiuc_force_moment(dt);
|
||||
}
|
||||
|
||||
|
||||
void uiuc_engine_2_wrapper( SCALAR dt, int Initialize )
|
||||
{
|
||||
uiuc_engine_routine();
|
||||
}
|
||||
|
||||
|
|
39
src/FDM/LaRCsim/uiuc_getwind.c
Normal file
39
src/FDM/LaRCsim/uiuc_getwind.c
Normal file
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
UIUC wind gradient test code v0.1
|
||||
|
||||
Returns wind vector as a function of altitude for a simple
|
||||
parabolic gradient profile
|
||||
|
||||
Glen Dimock
|
||||
Last update: 020227
|
||||
*/
|
||||
|
||||
#include "uiuc_getwind.h"
|
||||
|
||||
void uiuc_getwind(double wind[3])
|
||||
{
|
||||
/* Wind parameters */
|
||||
double zref = 300.; //Reference height (ft)
|
||||
double uref = 0.; //Horizontal wind velocity at ref. height (ft/sec)
|
||||
double ordref = 0.; //Horizontal wind ordinal from north (degrees)
|
||||
double zoff = 15.; //Z offset (ft) - wind is zero at and below this point
|
||||
double zcomp = 0.; //Vertical component (down is positive)
|
||||
|
||||
|
||||
/* Get wind vector */
|
||||
double windmag = 0; //Wind magnitude
|
||||
double a = 0; //Parabola: Altitude = a*windmag^2 + zoff
|
||||
|
||||
a = zref/pow(uref,2.);
|
||||
if (Altitude >= zoff)
|
||||
windmag = sqrt(Altitude/a);
|
||||
else
|
||||
windmag = 0.;
|
||||
|
||||
wind[0] = windmag * cos(ordref*3.14159/180.); //North component
|
||||
wind[1] = windmag * sin(ordref*3.14159/180.); //East component
|
||||
wind[2] = zcomp;
|
||||
|
||||
return;
|
||||
}
|
||||
|
4
src/FDM/LaRCsim/uiuc_getwind.h
Normal file
4
src/FDM/LaRCsim/uiuc_getwind.h
Normal file
|
@ -0,0 +1,4 @@
|
|||
#include <math.h>
|
||||
#include "ls_generic.h" //For global state variables
|
||||
|
||||
void uiuc_getwind(double wind[3]);
|
|
@ -23,9 +23,8 @@ libUIUCModel_a_SOURCES = \
|
|||
uiuc_engine.cpp uiuc_engine.h \
|
||||
uiuc_fog.cpp uiuc_fog.h \
|
||||
uiuc_gear.cpp uiuc_gear.h\
|
||||
uiuc_ice.cpp uiuc_ice.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 \
|
||||
|
@ -51,6 +50,7 @@ libUIUCModel_a_SOURCES = \
|
|||
uiuc_map_record5.cpp uiuc_map_record5.h \
|
||||
uiuc_map_record6.cpp uiuc_map_record6.h \
|
||||
uiuc_menu.cpp uiuc_menu.h \
|
||||
uiuc_pah_ap.cpp uiuc_pah_ap.h \
|
||||
uiuc_parsefile.cpp uiuc_parsefile.h \
|
||||
uiuc_recorder.cpp uiuc_recorder.h \
|
||||
uiuc_warnings_errors.cpp uiuc_warnings_errors.h \
|
||||
|
|
|
@ -106,4 +106,43 @@ uiuc_1DdataFileReader( string file_name,
|
|||
return data;
|
||||
}
|
||||
|
||||
//can't have conversions in this version since the numbers are
|
||||
//to stay as integers
|
||||
int
|
||||
uiuc_1DdataFileReader( string file_name,
|
||||
double x[], int y[], int &xmax )
|
||||
{
|
||||
|
||||
ParseFile *matrix;
|
||||
int token_value1;
|
||||
int token_value2;
|
||||
int counter = 1, data = 0;
|
||||
string linetoken1;
|
||||
string linetoken2;
|
||||
stack command_list;
|
||||
|
||||
/* Read the file and get the list of commands */
|
||||
matrix = new ParseFile(file_name);
|
||||
command_list = matrix -> getCommands();
|
||||
|
||||
for (LIST command_line = command_list.begin(); command_line!=command_list.end(); ++command_line)
|
||||
{
|
||||
linetoken1 = matrix -> getToken(*command_line, 1); // gettoken(string,tokenNo);
|
||||
linetoken2 = matrix -> getToken(*command_line, 2); // 2 represents token No 2
|
||||
|
||||
istrstream token1(linetoken1.c_str());
|
||||
istrstream token2(linetoken2.c_str());
|
||||
|
||||
token1 >> token_value1;
|
||||
token2 >> token_value2;
|
||||
|
||||
x[counter] = token_value1;
|
||||
y[counter] = token_value2;
|
||||
xmax = counter;
|
||||
counter++;
|
||||
data = 1;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
// end uiuc_1DdataFileReader.cpp
|
||||
|
|
|
@ -16,5 +16,9 @@ int uiuc_1DdataFileReader( string file_name,
|
|||
double x[100],
|
||||
double y[100],
|
||||
int &xmax );
|
||||
int uiuc_1DdataFileReader( string file_name,
|
||||
double x[],
|
||||
int y[],
|
||||
int &xmax );
|
||||
|
||||
#endif // _1D_DATA_FILE_READER_H_
|
||||
|
|
|
@ -117,4 +117,48 @@ double uiuc_1Dinterpolation( double xData[100], double yData[100], int xmax, dou
|
|||
return yfx;
|
||||
}
|
||||
|
||||
|
||||
int uiuc_1Dinterpolation( double xData[], int yData[], int xmax, double x )
|
||||
{
|
||||
double x1=0, x2=0, xdiff=0;
|
||||
int y1=0, y2=0;
|
||||
int i=2;
|
||||
int yfx=0;
|
||||
|
||||
//check bounds on x to see if data range encloses it
|
||||
// NOTE: [1] is first element of all arrays, [0] not used
|
||||
if (x <= xData[1]) //if x less than lowest x
|
||||
{
|
||||
yfx = yData[1]; //let y equal lowest y
|
||||
}
|
||||
else if (x >= xData[xmax]) //if x greater than greatest x
|
||||
{
|
||||
yfx = yData[xmax]; //let y equal greatest y
|
||||
}
|
||||
else //x between xmax and x min
|
||||
{
|
||||
/*loop increases i until x is less than a known x,
|
||||
e.g. Alpha from LaRCsim less than Alpha given in
|
||||
tabulated data; once this value is found, i becomes
|
||||
the upper bound and i-1 the lower bound*/
|
||||
while (xData[i] <= x) //bracket upper bound
|
||||
{
|
||||
i++;
|
||||
}
|
||||
x2 = xData[i]; //set upper bounds
|
||||
y2 = yData[i];
|
||||
x1 = xData[i-1]; //set lower bounds
|
||||
y1 = yData[i-1];
|
||||
|
||||
xdiff = x2 - x1;
|
||||
if (y1 == y2)
|
||||
yfx = y1;
|
||||
else if (x < x1+xdiff/2)
|
||||
yfx = y1;
|
||||
else
|
||||
yfx = y2;
|
||||
}
|
||||
return yfx;
|
||||
}
|
||||
|
||||
// end uiuc_1Dinterpolation.cpp
|
||||
|
|
|
@ -5,5 +5,9 @@ double uiuc_1Dinterpolation( double xData[100],
|
|||
double yData[100],
|
||||
int xmax,
|
||||
double x );
|
||||
int uiuc_1Dinterpolation( double xData[],
|
||||
int yData[],
|
||||
int xmax,
|
||||
double x );
|
||||
|
||||
#endif // _1D_INTERPOLATION_H_
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
|
||||
**********************************************************************/
|
||||
|
||||
#include <math.h>
|
||||
//#include <math.h>
|
||||
|
||||
#include "uiuc_aerodeflections.h"
|
||||
|
||||
|
@ -84,6 +84,29 @@ void uiuc_aerodeflections( double dt )
|
|||
bool flaps_in_transit = false;
|
||||
double demax_remain;
|
||||
double demin_remain;
|
||||
static double elev_trim;
|
||||
|
||||
//if (use_uiuc_network)
|
||||
// {
|
||||
// receive data
|
||||
// uiuc_network(1);
|
||||
// if (pitch_trim_up)
|
||||
//elev_trim += 0.001;
|
||||
// if (pitch_trim_down)
|
||||
//elev_trim -= 0.001;
|
||||
// if (elev_trim > 1.0)
|
||||
//elev_trim = 1;
|
||||
// if (elev_trim < -1.0)
|
||||
//elev_trim = -1;
|
||||
// if (outside_control)
|
||||
//{
|
||||
// pilot_elev_no = true;
|
||||
// pilot_ail_no = true;
|
||||
// pilot_rud_no = true;
|
||||
// pilot_throttle_no = true;
|
||||
// Long_trim = elev_trim;
|
||||
//}
|
||||
// }
|
||||
|
||||
if (zero_Long_trim)
|
||||
{
|
||||
|
@ -96,116 +119,128 @@ void uiuc_aerodeflections( double dt )
|
|||
else
|
||||
aileron = - Lat_control * damax * DEG_TO_RAD;
|
||||
|
||||
if (Long_trim <= 0)
|
||||
if (trim_case_2)
|
||||
{
|
||||
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;
|
||||
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 * demin_remain * 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;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
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;
|
||||
if ((Long_control+Long_trim) <= 0)
|
||||
elevator = (Long_control + Long_trim) * demax * DEG_TO_RAD;
|
||||
else
|
||||
elevator += Long_control * demax_remain * DEG_TO_RAD;
|
||||
elevator = (Long_control + Long_trim) * demin * 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;
|
||||
else
|
||||
rudder = - Rudder_pedal * drmax * DEG_TO_RAD;
|
||||
|
||||
|
||||
// new flap routine
|
||||
// designed for the twin otter non-linear model
|
||||
flap_percent = Flap_handle / 30.0; // percent of flaps desired
|
||||
if (flap_percent>=0.31 && flap_percent<=0.35)
|
||||
flap_percent = 1.0 / 3.0;
|
||||
if (flap_percent>=0.65 && flap_percent<=0.69)
|
||||
flap_percent = 2.0 / 3.0;
|
||||
flap_goal = flap_percent * flap_max; // angle of flaps desired
|
||||
flap_moving_rate = flap_rate * dt; // amount flaps move per time step
|
||||
|
||||
// determine flap position with respect to the flap goal
|
||||
if (flap_pos < flap_goal)
|
||||
if (old_flap_routine)
|
||||
{
|
||||
flap_pos += flap_moving_rate;
|
||||
if (flap_pos > flap_goal)
|
||||
flap_pos = flap_goal;
|
||||
}
|
||||
else if (flap_pos > flap_goal)
|
||||
{
|
||||
flap_pos -= flap_moving_rate;
|
||||
if (flap_pos < flap_goal)
|
||||
flap_pos = flap_goal;
|
||||
}
|
||||
|
||||
|
||||
// old flap routine
|
||||
// check for lowest flap setting
|
||||
if (Flap_handle < dfArray[1])
|
||||
{
|
||||
Flap_handle = dfArray[1];
|
||||
// old flap routine
|
||||
// check for lowest flap setting
|
||||
if (Flap_handle < dfArray[1])
|
||||
{
|
||||
Flap_handle = dfArray[1];
|
||||
prevFlapHandle = Flap_handle;
|
||||
flap = Flap_handle;
|
||||
}
|
||||
// check for highest flap setting
|
||||
else if (Flap_handle > dfArray[ndf])
|
||||
{
|
||||
Flap_handle = dfArray[ndf];
|
||||
prevFlapHandle = Flap_handle;
|
||||
flap = Flap_handle;
|
||||
}
|
||||
// otherwise in between
|
||||
else
|
||||
{
|
||||
if(Flap_handle != prevFlapHandle)
|
||||
{
|
||||
flaps_in_transit = true;
|
||||
}
|
||||
if(flaps_in_transit)
|
||||
{
|
||||
int iflap = 0;
|
||||
while (dfArray[iflap] < Flap_handle)
|
||||
{
|
||||
iflap++;
|
||||
}
|
||||
if (flap < Flap_handle)
|
||||
{
|
||||
if (TimeArray[iflap] > 0)
|
||||
flap_transit_rate = (dfArray[iflap] - dfArray[iflap-1]) / TimeArray[iflap+1];
|
||||
else
|
||||
flap_transit_rate = (dfArray[iflap] - dfArray[iflap-1]) / 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (TimeArray[iflap+1] > 0)
|
||||
flap_transit_rate = (dfArray[iflap] - dfArray[iflap+1]) / TimeArray[iflap+1];
|
||||
else
|
||||
flap_transit_rate = (dfArray[iflap] - dfArray[iflap+1]) / 5;
|
||||
}
|
||||
if(fabs (flap - Flap_handle) > dt * flap_transit_rate)
|
||||
flap += flap_transit_rate * dt;
|
||||
else
|
||||
{
|
||||
flaps_in_transit = false;
|
||||
flap = Flap_handle;
|
||||
}
|
||||
}
|
||||
}
|
||||
prevFlapHandle = Flap_handle;
|
||||
flap = Flap_handle;
|
||||
}
|
||||
// check for highest flap setting
|
||||
else if (Flap_handle > dfArray[ndf])
|
||||
else
|
||||
{
|
||||
Flap_handle = dfArray[ndf];
|
||||
prevFlapHandle = Flap_handle;
|
||||
flap = Flap_handle;
|
||||
// new flap routine
|
||||
// designed for the twin otter non-linear model
|
||||
if (outside_control == false)
|
||||
{
|
||||
flap_percent = Flap_handle / 30.0; // percent of flaps desired
|
||||
if (flap_percent>=0.31 && flap_percent<=0.35)
|
||||
flap_percent = 1.0 / 3.0;
|
||||
if (flap_percent>=0.65 && flap_percent<=0.69)
|
||||
flap_percent = 2.0 / 3.0;
|
||||
}
|
||||
flap_goal = flap_percent * flap_max; // angle of flaps desired
|
||||
flap_moving_rate = flap_rate * dt; // amount flaps move per time step
|
||||
|
||||
// determine flap position with respect to the flap goal
|
||||
if (flap_pos < flap_goal)
|
||||
{
|
||||
flap_pos += flap_moving_rate;
|
||||
if (flap_pos > flap_goal)
|
||||
flap_pos = flap_goal;
|
||||
}
|
||||
else if (flap_pos > flap_goal)
|
||||
{
|
||||
flap_pos -= flap_moving_rate;
|
||||
if (flap_pos < flap_goal)
|
||||
flap_pos = flap_goal;
|
||||
}
|
||||
}
|
||||
// otherwise in between
|
||||
else
|
||||
{
|
||||
if(Flap_handle != prevFlapHandle)
|
||||
{
|
||||
flaps_in_transit = true;
|
||||
}
|
||||
if(flaps_in_transit)
|
||||
{
|
||||
int iflap = 0;
|
||||
while (dfArray[iflap] < Flap_handle)
|
||||
{
|
||||
iflap++;
|
||||
}
|
||||
if (flap < Flap_handle)
|
||||
{
|
||||
if (TimeArray[iflap] > 0)
|
||||
flap_transit_rate = (dfArray[iflap] - dfArray[iflap-1]) / TimeArray[iflap+1];
|
||||
else
|
||||
flap_transit_rate = (dfArray[iflap] - dfArray[iflap-1]) / 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (TimeArray[iflap+1] > 0)
|
||||
flap_transit_rate = (dfArray[iflap] - dfArray[iflap+1]) / TimeArray[iflap+1];
|
||||
else
|
||||
flap_transit_rate = (dfArray[iflap] - dfArray[iflap+1]) / 5;
|
||||
}
|
||||
if(fabs (flap - Flap_handle) > dt * flap_transit_rate)
|
||||
flap += flap_transit_rate * dt;
|
||||
else
|
||||
{
|
||||
flaps_in_transit = false;
|
||||
flap = Flap_handle;
|
||||
}
|
||||
}
|
||||
}
|
||||
prevFlapHandle = Flap_handle;
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define _AERODEFLECTIONS_H_
|
||||
|
||||
#include "uiuc_aircraft.h" /* aileron, elevator, rudder */
|
||||
//#include "uiuc_network.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 */
|
||||
|
||||
|
|
|
@ -70,6 +70,7 @@
|
|||
and options for computing *_2U coefficient
|
||||
scale factors.
|
||||
08/29/2002 (MSS) Added simpleSingleModel
|
||||
09/18/2002 (MSS) Added downwash options
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
|
@ -139,7 +140,7 @@
|
|||
#include <math.h>
|
||||
|
||||
#include "uiuc_parsefile.h"
|
||||
// #include "uiuc_flapdata.h"
|
||||
//#include "uiuc_flapdata.h"
|
||||
|
||||
SG_USING_STD(map);
|
||||
#if !defined (SG_HAVE_NATIVE_SGI_COMPILERS)
|
||||
|
@ -156,17 +157,45 @@ enum {init_flag = 1000, geometry_flag, controlSurface_flag, controlsMixer_flag,
|
|||
Cn_flag, gear_flag, ice_flag, record_flag, misc_flag, fog_flag};
|
||||
|
||||
// init ======= Initial values for equation of motion
|
||||
enum {Dx_pilot_flag = 2000, Dy_pilot_flag, Dz_pilot_flag,
|
||||
Dx_cg_flag, Dy_cg_flag, Dz_cg_flag, Altitude_flag,
|
||||
V_north_flag, V_east_flag, V_down_flag,
|
||||
P_body_flag, Q_body_flag, R_body_flag,
|
||||
Phi_flag, Theta_flag, Psi_flag,
|
||||
Long_trim_flag, recordRate_flag, recordStartTime_flag,
|
||||
use_V_rel_wind_2U_flag, nondim_rate_V_rel_wind_flag,
|
||||
enum {Dx_pilot_flag = 2000,
|
||||
Dy_pilot_flag,
|
||||
Dz_pilot_flag,
|
||||
Dx_cg_flag,
|
||||
Dy_cg_flag,
|
||||
Dz_cg_flag,
|
||||
Altitude_flag,
|
||||
V_north_flag,
|
||||
V_east_flag,
|
||||
V_down_flag,
|
||||
P_body_flag,
|
||||
Q_body_flag,
|
||||
R_body_flag,
|
||||
Phi_flag,
|
||||
Theta_flag,
|
||||
Psi_flag,
|
||||
Long_trim_flag,
|
||||
recordRate_flag,
|
||||
recordStartTime_flag,
|
||||
use_V_rel_wind_2U_flag,
|
||||
nondim_rate_V_rel_wind_flag,
|
||||
use_abs_U_body_2U_flag,
|
||||
dyn_on_speed_flag, dyn_on_speed_zero_flag,
|
||||
use_dyn_on_speed_curve1_flag, use_Alpha_dot_on_speed_flag, Alpha_flag,
|
||||
Beta_flag, U_body_flag, V_body_flag, W_body_flag, ignore_unknown_flag};
|
||||
dyn_on_speed_flag,
|
||||
dyn_on_speed_zero_flag,
|
||||
use_dyn_on_speed_curve1_flag,
|
||||
use_Alpha_dot_on_speed_flag,
|
||||
downwashMode_flag,
|
||||
downwashCoef_flag,
|
||||
Alpha_flag,
|
||||
Beta_flag,
|
||||
U_body_flag,
|
||||
V_body_flag,
|
||||
W_body_flag,
|
||||
ignore_unknown_flag,
|
||||
trim_case_2_flag,
|
||||
use_uiuc_network_flag,
|
||||
old_flap_routine_flag,
|
||||
icing_demo_flag,
|
||||
outside_control_flag};
|
||||
|
||||
// geometry === Aircraft-specific geometric quantities
|
||||
enum {bw_flag = 3000, cbar_flag, Sw_flag, ih_flag, bh_flag, ch_flag, Sh_flag};
|
||||
|
@ -175,9 +204,9 @@ enum {bw_flag = 3000, cbar_flag, Sw_flag, ih_flag, bh_flag, ch_flag, Sh_flag};
|
|||
enum {de_flag = 4000, da_flag, dr_flag,
|
||||
set_Long_trim_flag, set_Long_trim_deg_flag, zero_Long_trim_flag,
|
||||
elevator_step_flag, elevator_singlet_flag, elevator_doublet_flag,
|
||||
elevator_input_flag, aileron_input_flag, rudder_input_flag,
|
||||
pilot_elev_no_flag, pilot_ail_no_flag, pilot_rud_no_flag, flap_max_flag,
|
||||
flap_rate_flag};
|
||||
elevator_input_flag, aileron_input_flag, rudder_input_flag,
|
||||
flap_pos_input_flag, pilot_elev_no_flag, pilot_ail_no_flag,
|
||||
pilot_rud_no_flag, flap_max_flag, flap_rate_flag};
|
||||
|
||||
// controlsMixer == Controls mixer
|
||||
enum {nomix_flag = 5000};
|
||||
|
@ -267,7 +296,21 @@ 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, bootTime_flag};
|
||||
kCn_dr_flag, kCn_q_flag, kCn_b3_flag, bootTime_flag,
|
||||
|
||||
eta_wing_left_input_flag, eta_wing_right_input_flag,
|
||||
eta_tail_input_flag, nonlin_ice_case_flag, eta_tail_flag,
|
||||
eta_wing_left_flag, eta_wing_right_flag,
|
||||
|
||||
demo_eps_alpha_max_flag, demo_eps_pitch_max_flag,
|
||||
demo_eps_pitch_min_flag, demo_eps_roll_max_flag,
|
||||
demo_eps_thrust_min_flag, demo_eps_flap_max_flag,
|
||||
demo_eps_airspeed_max_flag, demo_eps_airspeed_min_flag,
|
||||
demo_boot_cycle_tail_flag, demo_boot_cycle_wing_left_flag,
|
||||
demo_boot_cycle_wing_right_flag, demo_eps_pitch_input_flag,
|
||||
tactilefadef_flag, tactile_pitch_flag, demo_ap_Theta_ref_deg_flag,
|
||||
demo_ap_pah_on_flag, demo_tactile_flag, demo_ice_tail_flag,
|
||||
demo_ice_left_flag, demo_ice_right_flag};
|
||||
|
||||
// record ===== Record desired quantites to file
|
||||
enum {Simtime_record = 16000, dt_record,
|
||||
|
@ -389,6 +432,7 @@ enum {Simtime_record = 16000, dt_record,
|
|||
Cm_clean_record, Cm_iced_record,
|
||||
Ch_clean_record, Ch_iced_record,
|
||||
Cl_clean_record, Cl_iced_record,
|
||||
Cn_clean_record, Cn_iced_record,
|
||||
CLclean_wing_record, CLiced_wing_record,
|
||||
CLclean_tail_record, CLiced_tail_record,
|
||||
Lift_clean_wing_record, Lift_iced_wing_record,
|
||||
|
@ -406,11 +450,24 @@ enum {Simtime_record = 16000, dt_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, eta_ice_record,
|
||||
eta_wing_right_record, eta_wing_left_record, eta_tail_record,
|
||||
delta_CL_record, delta_CD_record, delta_Cm_record, delta_Cl_record,
|
||||
delta_Cn_record,
|
||||
|
||||
flapper_freq_record, flapper_phi_record,
|
||||
flapper_phi_deg_record, flapper_Lift_record, flapper_Thrust_record,
|
||||
flapper_Inertia_record, flapper_Moment_record,
|
||||
|
||||
boot_cycle_tail_record, boot_cycle_wing_left_record,
|
||||
boot_cycle_wing_right_record, autoIPS_tail_record,
|
||||
autoIPS_wing_left_record, autoIPS_wing_right_record,
|
||||
eps_pitch_input_record, eps_alpha_max_record, eps_pitch_max_record,
|
||||
eps_pitch_min_record, eps_roll_max_record, eps_thrust_min_record,
|
||||
eps_flap_max_record, eps_airspeed_max_record, eps_airspeed_min_record,
|
||||
tactilefadefI_record,
|
||||
|
||||
ap_Theta_ref_deg_record, ap_pah_on_record,
|
||||
|
||||
debug1_record, debug2_record, debug3_record};
|
||||
|
||||
// misc ======= Miscellaneous inputs
|
||||
|
@ -507,14 +564,29 @@ struct AIRCRAFT
|
|||
#define dyn_on_speed_zero aircraft_->dyn_on_speed_zero
|
||||
bool use_dyn_on_speed_curve1;
|
||||
#define use_dyn_on_speed_curve1 aircraft_->use_dyn_on_speed_curve1
|
||||
bool P_body_init_true;
|
||||
|
||||
bool use_Alpha_dot_on_speed;
|
||||
#define use_Alpha_dot_on_speed aircraft_->use_Alpha_dot_on_speed
|
||||
double Alpha_dot_on_speed;
|
||||
#define Alpha_dot_on_speed aircraft_->Alpha_dot_on_speed
|
||||
|
||||
bool b_downwashMode;
|
||||
#define b_downwashMode aircraft_->b_downwashMode
|
||||
int downwashMode;
|
||||
#define downwashMode aircraft_->downwashMode
|
||||
double downwashCoef;
|
||||
#define downwashCoef aircraft_->downwashCoef
|
||||
double gammaWing;
|
||||
#define gammaWing aircraft_->gammaWing
|
||||
double downwash;
|
||||
#define downwash aircraft_->downwash
|
||||
double downwashAngle;
|
||||
#define downwashAngle aircraft_->downwashAngle
|
||||
double alphaTail;
|
||||
#define alphaTail aircraft_->alphaTail
|
||||
|
||||
|
||||
bool P_body_init_true;
|
||||
double P_body_init;
|
||||
#define P_body_init_true aircraft_->P_body_init_true
|
||||
#define P_body_init aircraft_->P_body_init
|
||||
|
@ -558,6 +630,20 @@ struct AIRCRAFT
|
|||
double W_body_init;
|
||||
#define W_body_init_true aircraft_->W_body_init_true
|
||||
#define W_body_init aircraft_->W_body_init
|
||||
bool trim_case_2;
|
||||
#define trim_case_2 aircraft_->trim_case_2
|
||||
bool use_uiuc_network;
|
||||
string server_IP;
|
||||
int port_num;
|
||||
#define use_uiuc_network aircraft_->use_uiuc_network
|
||||
#define server_IP aircraft_->server_IP
|
||||
#define port_num aircraft_->port_num
|
||||
bool old_flap_routine;
|
||||
#define old_flap_routine aircraft_->old_flap_routine
|
||||
bool icing_demo;
|
||||
#define icing_demo aircraft_->icing_demo
|
||||
bool outside_control;
|
||||
#define outside_control aircraft_->outside_control
|
||||
|
||||
/* Variables (token2) ===========================================*/
|
||||
/* geometry ====== Aircraft-specific geometric quantities =======*/
|
||||
|
@ -628,8 +714,8 @@ struct AIRCRAFT
|
|||
|
||||
bool elevator_input;
|
||||
string elevator_input_file;
|
||||
double elevator_input_timeArray[1500];
|
||||
double elevator_input_deArray[1500];
|
||||
double elevator_input_timeArray[7500];
|
||||
double elevator_input_deArray[7500];
|
||||
int elevator_input_ntime;
|
||||
double elevator_input_startTime;
|
||||
#define elevator_input aircraft_->elevator_input
|
||||
|
@ -654,8 +740,8 @@ struct AIRCRAFT
|
|||
|
||||
bool rudder_input;
|
||||
string rudder_input_file;
|
||||
double rudder_input_timeArray[1500];
|
||||
double rudder_input_drArray[1500];
|
||||
double rudder_input_timeArray[500];
|
||||
double rudder_input_drArray[500];
|
||||
int rudder_input_ntime;
|
||||
double rudder_input_startTime;
|
||||
#define rudder_input aircraft_->rudder_input
|
||||
|
@ -684,6 +770,20 @@ struct AIRCRAFT
|
|||
#define flap_max aircraft_->flap_max
|
||||
#define flap_rate aircraft_->flap_rate
|
||||
|
||||
bool flap_pos_input;
|
||||
string flap_pos_input_file;
|
||||
double flap_pos_input_timeArray[500];
|
||||
double flap_pos_input_dfArray[500];
|
||||
int flap_pos_input_ntime;
|
||||
double flap_pos_input_startTime;
|
||||
#define flap_pos_input aircraft_->flap_pos_input
|
||||
#define flap_pos_input_file aircraft_->flap_pos_input_file
|
||||
#define flap_pos_input_timeArray aircraft_->flap_pos_input_timeArray
|
||||
#define flap_pos_input_dfArray aircraft_->flap_pos_input_dfArray
|
||||
#define flap_pos_input_ntime aircraft_->flap_pos_input_ntime
|
||||
#define flap_pos_input_startTime aircraft_->flap_pos_input_startTime
|
||||
|
||||
|
||||
/* Variables (token2) ===========================================*/
|
||||
/* controlsMixer = Control mixer ================================*/
|
||||
|
||||
|
@ -769,7 +869,7 @@ struct AIRCRAFT
|
|||
#define polarInertia aircraft_->polarInertia
|
||||
|
||||
// propeller slipstream effects
|
||||
bool slipstream_effects;
|
||||
bool b_slipstreamEffects;
|
||||
double propDia;
|
||||
double eta_q_Cm_q, eta_q_Cm_q_fac;
|
||||
double eta_q_Cm_adot, eta_q_Cm_adot_fac;
|
||||
|
@ -787,7 +887,7 @@ struct AIRCRAFT
|
|||
double eta_q_Cn_r, eta_q_Cn_r_fac;
|
||||
double eta_q_Cn_dr, eta_q_Cn_dr_fac;
|
||||
|
||||
#define slipstream_effects aircraft_->slipstream_effects
|
||||
#define b_slipstreamEffects aircraft_->b_slipstreamEffects
|
||||
#define propDia aircraft_->propDia
|
||||
#define eta_q_Cm_q aircraft_->eta_q_Cm_q
|
||||
#define eta_q_Cm_q_fac aircraft_->eta_q_Cm_q_fac
|
||||
|
@ -1261,14 +1361,12 @@ struct AIRCRAFT
|
|||
#define Cmfade_nAlphaArray aircraft_->Cmfade_nAlphaArray
|
||||
#define Cmfade_nde aircraft_->Cmfade_nde
|
||||
#define CmfadeI aircraft_->CmfadeI
|
||||
|
||||
double gamma_wing, w_induced, w_coef, downwash_angle, AlphaTail;
|
||||
#define gamma_wing aircraft_->gamma_wing
|
||||
|
||||
// induced flow in slipstream impinging on tail
|
||||
double w_induced;
|
||||
#define w_induced aircraft_->w_induced
|
||||
#define w_coef aircraft_->w_coef
|
||||
#define downwash_angle aircraft_->downwash_angle
|
||||
#define AlphaTail aircraft_->AlphaTail
|
||||
|
||||
|
||||
|
||||
string Cmfdf;
|
||||
double Cmfdf_dfArray[100];
|
||||
double Cmfdf_CmArray[100];
|
||||
|
@ -2102,6 +2200,288 @@ struct AIRCRAFT
|
|||
#define bootTime aircraft_->bootTime
|
||||
#define bootindex aircraft_->bootindex
|
||||
#define bootTrue aircraft_->bootTrue
|
||||
bool eta_from_file;
|
||||
#define eta_from_file aircraft_->eta_from_file
|
||||
bool eta_wing_left_input;
|
||||
string eta_wing_left_input_file;
|
||||
double eta_wing_left_input_timeArray[100];
|
||||
double eta_wing_left_input_daArray[100];
|
||||
int eta_wing_left_input_ntime;
|
||||
double eta_wing_left_input_startTime;
|
||||
#define eta_wing_left_input aircraft_->eta_wing_left_input
|
||||
#define eta_wing_left_input_file aircraft_->eta_wing_left_input_file
|
||||
#define eta_wing_left_input_timeArray aircraft_->eta_wing_left_input_timeArray
|
||||
#define eta_wing_left_input_daArray aircraft_->eta_wing_left_input_daArray
|
||||
#define eta_wing_left_input_ntime aircraft_->eta_wing_left_input_ntime
|
||||
#define eta_wing_left_input_startTime aircraft_->eta_wing_left_input_startTime
|
||||
bool eta_wing_right_input;
|
||||
string eta_wing_right_input_file;
|
||||
double eta_wing_right_input_timeArray[100];
|
||||
double eta_wing_right_input_daArray[100];
|
||||
int eta_wing_right_input_ntime;
|
||||
double eta_wing_right_input_startTime;
|
||||
#define eta_wing_right_input aircraft_->eta_wing_right_input
|
||||
#define eta_wing_right_input_file aircraft_->eta_wing_right_input_file
|
||||
#define eta_wing_right_input_timeArray aircraft_->eta_wing_right_input_timeArray
|
||||
#define eta_wing_right_input_daArray aircraft_->eta_wing_right_input_daArray
|
||||
#define eta_wing_right_input_ntime aircraft_->eta_wing_right_input_ntime
|
||||
#define eta_wing_right_input_startTime aircraft_->eta_wing_right_input_startTime
|
||||
bool eta_tail_input;
|
||||
string eta_tail_input_file;
|
||||
double eta_tail_input_timeArray[100];
|
||||
double eta_tail_input_daArray[100];
|
||||
int eta_tail_input_ntime;
|
||||
double eta_tail_input_startTime;
|
||||
#define eta_tail_input aircraft_->eta_tail_input
|
||||
#define eta_tail_input_file aircraft_->eta_tail_input_file
|
||||
#define eta_tail_input_timeArray aircraft_->eta_tail_input_timeArray
|
||||
#define eta_tail_input_daArray aircraft_->eta_tail_input_daArray
|
||||
#define eta_tail_input_ntime aircraft_->eta_tail_input_ntime
|
||||
#define eta_tail_input_startTime aircraft_->eta_tail_input_startTime
|
||||
bool demo_eps_alpha_max;
|
||||
string demo_eps_alpha_max_file;
|
||||
double demo_eps_alpha_max_timeArray[100];
|
||||
double demo_eps_alpha_max_daArray[100];
|
||||
int demo_eps_alpha_max_ntime;
|
||||
double demo_eps_alpha_max_startTime;
|
||||
#define demo_eps_alpha_max aircraft_->demo_eps_alpha_max
|
||||
#define demo_eps_alpha_max_file aircraft_->demo_eps_alpha_max_file
|
||||
#define demo_eps_alpha_max_timeArray aircraft_->demo_eps_alpha_max_timeArray
|
||||
#define demo_eps_alpha_max_daArray aircraft_->demo_eps_alpha_max_daArray
|
||||
#define demo_eps_alpha_max_ntime aircraft_->demo_eps_alpha_max_ntime
|
||||
#define demo_eps_alpha_max_startTime aircraft_->demo_eps_alpha_max_startTime
|
||||
bool demo_eps_pitch_max;
|
||||
string demo_eps_pitch_max_file;
|
||||
double demo_eps_pitch_max_timeArray[100];
|
||||
double demo_eps_pitch_max_daArray[100];
|
||||
int demo_eps_pitch_max_ntime;
|
||||
double demo_eps_pitch_max_startTime;
|
||||
#define demo_eps_pitch_max aircraft_->demo_eps_pitch_max
|
||||
#define demo_eps_pitch_max_file aircraft_->demo_eps_pitch_max_file
|
||||
#define demo_eps_pitch_max_timeArray aircraft_->demo_eps_pitch_max_timeArray
|
||||
#define demo_eps_pitch_max_daArray aircraft_->demo_eps_pitch_max_daArray
|
||||
#define demo_eps_pitch_max_ntime aircraft_->demo_eps_pitch_max_ntime
|
||||
#define demo_eps_pitch_max_startTime aircraft_->demo_eps_pitch_max_startTime
|
||||
bool demo_eps_pitch_min;
|
||||
string demo_eps_pitch_min_file;
|
||||
double demo_eps_pitch_min_timeArray[100];
|
||||
double demo_eps_pitch_min_daArray[100];
|
||||
int demo_eps_pitch_min_ntime;
|
||||
double demo_eps_pitch_min_startTime;
|
||||
#define demo_eps_pitch_min aircraft_->demo_eps_pitch_min
|
||||
#define demo_eps_pitch_min_file aircraft_->demo_eps_pitch_min_file
|
||||
#define demo_eps_pitch_min_timeArray aircraft_->demo_eps_pitch_min_timeArray
|
||||
#define demo_eps_pitch_min_daArray aircraft_->demo_eps_pitch_min_daArray
|
||||
#define demo_eps_pitch_min_ntime aircraft_->demo_eps_pitch_min_ntime
|
||||
#define demo_eps_pitch_min_startTime aircraft_->demo_eps_pitch_min_startTime
|
||||
bool demo_eps_roll_max;
|
||||
string demo_eps_roll_max_file;
|
||||
double demo_eps_roll_max_timeArray[10];
|
||||
double demo_eps_roll_max_daArray[10];
|
||||
int demo_eps_roll_max_ntime;
|
||||
double demo_eps_roll_max_startTime;
|
||||
#define demo_eps_roll_max aircraft_->demo_eps_roll_max
|
||||
#define demo_eps_roll_max_file aircraft_->demo_eps_roll_max_file
|
||||
#define demo_eps_roll_max_timeArray aircraft_->demo_eps_roll_max_timeArray
|
||||
#define demo_eps_roll_max_daArray aircraft_->demo_eps_roll_max_daArray
|
||||
#define demo_eps_roll_max_ntime aircraft_->demo_eps_roll_max_ntime
|
||||
#define demo_eps_roll_max_startTime aircraft_->demo_eps_roll_max_startTime
|
||||
bool demo_eps_thrust_min;
|
||||
string demo_eps_thrust_min_file;
|
||||
double demo_eps_thrust_min_timeArray[100];
|
||||
double demo_eps_thrust_min_daArray[100];
|
||||
int demo_eps_thrust_min_ntime;
|
||||
double demo_eps_thrust_min_startTime;
|
||||
#define demo_eps_thrust_min aircraft_->demo_eps_thrust_min
|
||||
#define demo_eps_thrust_min_file aircraft_->demo_eps_thrust_min_file
|
||||
#define demo_eps_thrust_min_timeArray aircraft_->demo_eps_thrust_min_timeArray
|
||||
#define demo_eps_thrust_min_daArray aircraft_->demo_eps_thrust_min_daArray
|
||||
#define demo_eps_thrust_min_ntime aircraft_->demo_eps_thrust_min_ntime
|
||||
#define demo_eps_thrust_min_startTime aircraft_->demo_eps_thrust_min_startTime
|
||||
bool demo_eps_airspeed_max;
|
||||
string demo_eps_airspeed_max_file;
|
||||
double demo_eps_airspeed_max_timeArray[10];
|
||||
double demo_eps_airspeed_max_daArray[10];
|
||||
int demo_eps_airspeed_max_ntime;
|
||||
double demo_eps_airspeed_max_startTime;
|
||||
#define demo_eps_airspeed_max aircraft_->demo_eps_airspeed_max
|
||||
#define demo_eps_airspeed_max_file aircraft_->demo_eps_airspeed_max_file
|
||||
#define demo_eps_airspeed_max_timeArray aircraft_->demo_eps_airspeed_max_timeArray
|
||||
#define demo_eps_airspeed_max_daArray aircraft_->demo_eps_airspeed_max_daArray
|
||||
#define demo_eps_airspeed_max_ntime aircraft_->demo_eps_airspeed_max_ntime
|
||||
#define demo_eps_airspeed_max_startTime aircraft_->demo_eps_airspeed_max_startTime
|
||||
bool demo_eps_airspeed_min;
|
||||
string demo_eps_airspeed_min_file;
|
||||
double demo_eps_airspeed_min_timeArray[100];
|
||||
double demo_eps_airspeed_min_daArray[100];
|
||||
int demo_eps_airspeed_min_ntime;
|
||||
double demo_eps_airspeed_min_startTime;
|
||||
#define demo_eps_airspeed_min aircraft_->demo_eps_airspeed_min
|
||||
#define demo_eps_airspeed_min_file aircraft_->demo_eps_airspeed_min_file
|
||||
#define demo_eps_airspeed_min_timeArray aircraft_->demo_eps_airspeed_min_timeArray
|
||||
#define demo_eps_airspeed_min_daArray aircraft_->demo_eps_airspeed_min_daArray
|
||||
#define demo_eps_airspeed_min_ntime aircraft_->demo_eps_airspeed_min_ntime
|
||||
#define demo_eps_airspeed_min_startTime aircraft_->demo_eps_airspeed_min_startTime
|
||||
bool demo_eps_flap_max;
|
||||
string demo_eps_flap_max_file;
|
||||
double demo_eps_flap_max_timeArray[10];
|
||||
double demo_eps_flap_max_daArray[10];
|
||||
int demo_eps_flap_max_ntime;
|
||||
double demo_eps_flap_max_startTime;
|
||||
#define demo_eps_flap_max aircraft_->demo_eps_flap_max
|
||||
#define demo_eps_flap_max_file aircraft_->demo_eps_flap_max_file
|
||||
#define demo_eps_flap_max_timeArray aircraft_->demo_eps_flap_max_timeArray
|
||||
#define demo_eps_flap_max_daArray aircraft_->demo_eps_flap_max_daArray
|
||||
#define demo_eps_flap_max_ntime aircraft_->demo_eps_flap_max_ntime
|
||||
#define demo_eps_flap_max_startTime aircraft_->demo_eps_flap_max_startTime
|
||||
bool demo_boot_cycle_tail;
|
||||
string demo_boot_cycle_tail_file;
|
||||
double demo_boot_cycle_tail_timeArray[100];
|
||||
int demo_boot_cycle_tail_daArray[100];
|
||||
int demo_boot_cycle_tail_ntime;
|
||||
double demo_boot_cycle_tail_startTime;
|
||||
#define demo_boot_cycle_tail aircraft_->demo_boot_cycle_tail
|
||||
#define demo_boot_cycle_tail_file aircraft_->demo_boot_cycle_tail_file
|
||||
#define demo_boot_cycle_tail_timeArray aircraft_->demo_boot_cycle_tail_timeArray
|
||||
#define demo_boot_cycle_tail_daArray aircraft_->demo_boot_cycle_tail_daArray
|
||||
#define demo_boot_cycle_tail_ntime aircraft_->demo_boot_cycle_tail_ntime
|
||||
#define demo_boot_cycle_tail_startTime aircraft_->demo_boot_cycle_tail_startTime
|
||||
bool demo_boot_cycle_wing_left;
|
||||
string demo_boot_cycle_wing_left_file;
|
||||
double demo_boot_cycle_wing_left_timeArray[100];
|
||||
int demo_boot_cycle_wing_left_daArray[100];
|
||||
int demo_boot_cycle_wing_left_ntime;
|
||||
double demo_boot_cycle_wing_left_startTime;
|
||||
#define demo_boot_cycle_wing_left aircraft_->demo_boot_cycle_wing_left
|
||||
#define demo_boot_cycle_wing_left_file aircraft_->demo_boot_cycle_wing_left_file
|
||||
#define demo_boot_cycle_wing_left_timeArray aircraft_->demo_boot_cycle_wing_left_timeArray
|
||||
#define demo_boot_cycle_wing_left_daArray aircraft_->demo_boot_cycle_wing_left_daArray
|
||||
#define demo_boot_cycle_wing_left_ntime aircraft_->demo_boot_cycle_wing_left_ntime
|
||||
#define demo_boot_cycle_wing_left_startTime aircraft_->demo_boot_cycle_wing_left_startTime
|
||||
bool demo_boot_cycle_wing_right;
|
||||
string demo_boot_cycle_wing_right_file;
|
||||
double demo_boot_cycle_wing_right_timeArray[100];
|
||||
int demo_boot_cycle_wing_right_daArray[100];
|
||||
int demo_boot_cycle_wing_right_ntime;
|
||||
double demo_boot_cycle_wing_right_startTime;
|
||||
#define demo_boot_cycle_wing_right aircraft_->demo_boot_cycle_wing_right
|
||||
#define demo_boot_cycle_wing_right_file aircraft_->demo_boot_cycle_wing_right_file
|
||||
#define demo_boot_cycle_wing_right_timeArray aircraft_->demo_boot_cycle_wing_right_timeArray
|
||||
#define demo_boot_cycle_wing_right_daArray aircraft_->demo_boot_cycle_wing_right_daArray
|
||||
#define demo_boot_cycle_wing_right_ntime aircraft_->demo_boot_cycle_wing_right_ntime
|
||||
#define demo_boot_cycle_wing_right_startTime aircraft_->demo_boot_cycle_wing_right_startTime
|
||||
bool demo_eps_pitch_input;
|
||||
string demo_eps_pitch_input_file;
|
||||
double demo_eps_pitch_input_timeArray[100];
|
||||
int demo_eps_pitch_input_daArray[100];
|
||||
int demo_eps_pitch_input_ntime;
|
||||
double demo_eps_pitch_input_startTime;
|
||||
#define demo_eps_pitch_input aircraft_->demo_eps_pitch_input
|
||||
#define demo_eps_pitch_input_file aircraft_->demo_eps_pitch_input_file
|
||||
#define demo_eps_pitch_input_timeArray aircraft_->demo_eps_pitch_input_timeArray
|
||||
#define demo_eps_pitch_input_daArray aircraft_->demo_eps_pitch_input_daArray
|
||||
#define demo_eps_pitch_input_ntime aircraft_->demo_eps_pitch_input_ntime
|
||||
#define demo_eps_pitch_input_startTime aircraft_->demo_eps_pitch_input_startTime
|
||||
bool tactilefadef;
|
||||
double tactilefadef_aArray[30][100][100];
|
||||
double tactilefadef_deArray[30][100];
|
||||
double tactilefadef_tactileArray[30][100][100];
|
||||
int tactilefadef_nAlphaArray[30][100];
|
||||
int tactilefadef_nde[30];
|
||||
double tactilefadef_fArray[30];
|
||||
int tactilefadef_nf;
|
||||
double tactilefadefI;
|
||||
int tactilefadef_nice, tactilefadef_na_nice, tactilefadef_nde_nice;
|
||||
double tactilefadef_deArray_nice[100];
|
||||
double tactilefadef_aArray_nice[100];
|
||||
#define tactilefadef aircraft_->tactilefadef
|
||||
#define tactilefadef_aArray aircraft_->tactilefadef_aArray
|
||||
#define tactilefadef_deArray aircraft_->tactilefadef_deArray
|
||||
#define tactilefadef_tactileArray aircraft_->tactilefadef_tactileArray
|
||||
#define tactilefadef_nAlphaArray aircraft_->tactilefadef_nAlphaArray
|
||||
#define tactilefadef_nde aircraft_->tactilefadef_nde
|
||||
#define tactilefadef_fArray aircraft_->tactilefadef_fArray
|
||||
#define tactilefadef_nf aircraft_->tactilefadef_nf
|
||||
#define tactilefadefI aircraft_->tactilefadefI
|
||||
#define tactilefadef_nice aircraft_->tactilefadef_nice
|
||||
#define tactilefadef_na_nice aircraft_->tactilefadef_na_nice
|
||||
#define tactilefadef_nde_nice aircraft_->tactilefadef_nde_nice
|
||||
#define tactilefadef_deArray_nice aircraft_->tactilefadef_deArray_nice
|
||||
#define tactilefadef_aArray_nice aircraft_->tactilefadef_aArray_nice
|
||||
int tactile_pitch;
|
||||
#define tactile_pitch aircraft_->tactile_pitch
|
||||
bool demo_ap_pah_on;
|
||||
string demo_ap_pah_on_file;
|
||||
double demo_ap_pah_on_timeArray[10];
|
||||
int demo_ap_pah_on_daArray[10];
|
||||
int demo_ap_pah_on_ntime;
|
||||
double demo_ap_pah_on_startTime;
|
||||
#define demo_ap_pah_on aircraft_->demo_ap_pah_on
|
||||
#define demo_ap_pah_on_file aircraft_->demo_ap_pah_on_file
|
||||
#define demo_ap_pah_on_timeArray aircraft_->demo_ap_pah_on_timeArray
|
||||
#define demo_ap_pah_on_daArray aircraft_->demo_ap_pah_on_daArray
|
||||
#define demo_ap_pah_on_ntime aircraft_->demo_ap_pah_on_ntime
|
||||
#define demo_ap_pah_on_startTime aircraft_->demo_ap_pah_on_startTime
|
||||
bool demo_ap_Theta_ref_deg;
|
||||
string demo_ap_Theta_ref_deg_file;
|
||||
double demo_ap_Theta_ref_deg_timeArray[10];
|
||||
double demo_ap_Theta_ref_deg_daArray[10];
|
||||
int demo_ap_Theta_ref_deg_ntime;
|
||||
double demo_ap_Theta_ref_deg_startTime;
|
||||
#define demo_ap_Theta_ref_deg aircraft_->demo_ap_Theta_ref_deg
|
||||
#define demo_ap_Theta_ref_deg_file aircraft_->demo_ap_Theta_ref_deg_file
|
||||
#define demo_ap_Theta_ref_deg_timeArray aircraft_->demo_ap_Theta_ref_deg_timeArray
|
||||
#define demo_ap_Theta_ref_deg_daArray aircraft_->demo_ap_Theta_ref_deg_daArray
|
||||
#define demo_ap_Theta_ref_deg_ntime aircraft_->demo_ap_Theta_ref_deg_ntime
|
||||
#define demo_ap_Theta_ref_deg_startTime aircraft_->demo_ap_Theta_ref_deg_startTime
|
||||
bool demo_tactile;
|
||||
string demo_tactile_file;
|
||||
double demo_tactile_timeArray[1500];
|
||||
double demo_tactile_daArray[1500];
|
||||
int demo_tactile_ntime;
|
||||
double demo_tactile_startTime;
|
||||
#define demo_tactile aircraft_->demo_tactile
|
||||
#define demo_tactile_file aircraft_->demo_tactile_file
|
||||
#define demo_tactile_timeArray aircraft_->demo_tactile_timeArray
|
||||
#define demo_tactile_daArray aircraft_->demo_tactile_daArray
|
||||
#define demo_tactile_ntime aircraft_->demo_tactile_ntime
|
||||
#define demo_tactile_startTime aircraft_->demo_tactile_startTime
|
||||
bool demo_ice_tail;
|
||||
string demo_ice_tail_file;
|
||||
double demo_ice_tail_timeArray[10];
|
||||
int demo_ice_tail_daArray[10];
|
||||
int demo_ice_tail_ntime;
|
||||
double demo_ice_tail_startTime;
|
||||
#define demo_ice_tail aircraft_->demo_ice_tail
|
||||
#define demo_ice_tail_file aircraft_->demo_ice_tail_file
|
||||
#define demo_ice_tail_timeArray aircraft_->demo_ice_tail_timeArray
|
||||
#define demo_ice_tail_daArray aircraft_->demo_ice_tail_daArray
|
||||
#define demo_ice_tail_ntime aircraft_->demo_ice_tail_ntime
|
||||
#define demo_ice_tail_startTime aircraft_->demo_ice_tail_startTime
|
||||
bool demo_ice_left;
|
||||
string demo_ice_left_file;
|
||||
double demo_ice_left_timeArray[10];
|
||||
int demo_ice_left_daArray[10];
|
||||
int demo_ice_left_ntime;
|
||||
double demo_ice_left_startTime;
|
||||
#define demo_ice_left aircraft_->demo_ice_left
|
||||
#define demo_ice_left_file aircraft_->demo_ice_left_file
|
||||
#define demo_ice_left_timeArray aircraft_->demo_ice_left_timeArray
|
||||
#define demo_ice_left_daArray aircraft_->demo_ice_left_daArray
|
||||
#define demo_ice_left_ntime aircraft_->demo_ice_left_ntime
|
||||
#define demo_ice_left_startTime aircraft_->demo_ice_left_startTime
|
||||
bool demo_ice_right;
|
||||
string demo_ice_right_file;
|
||||
double demo_ice_right_timeArray[10];
|
||||
int demo_ice_right_daArray[10];
|
||||
int demo_ice_right_ntime;
|
||||
double demo_ice_right_startTime;
|
||||
#define demo_ice_right aircraft_->demo_ice_right
|
||||
#define demo_ice_right_file aircraft_->demo_ice_right_file
|
||||
#define demo_ice_right_timeArray aircraft_->demo_ice_right_timeArray
|
||||
#define demo_ice_right_daArray aircraft_->demo_ice_right_daArray
|
||||
#define demo_ice_right_ntime aircraft_->demo_ice_right_ntime
|
||||
#define demo_ice_right_startTime aircraft_->demo_ice_right_startTime
|
||||
|
||||
//321654
|
||||
/* Variables (token2) ===========================================*/
|
||||
|
@ -2239,22 +2619,22 @@ struct AIRCRAFT
|
|||
#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
|
||||
// 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
|
||||
|
@ -2284,39 +2664,67 @@ 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;
|
||||
double delta_CL, delta_CD, delta_Cm, delta_Ch, delta_Cl, delta_Cn;
|
||||
#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
|
||||
#define delta_Cn aircraft_->delta_Cn
|
||||
|
||||
int ice_case;
|
||||
int nonlin_ice_case;
|
||||
double eta_wing_left, eta_wing_right, eta_tail;
|
||||
double OATemperature_F;
|
||||
#define ice_case aircraft_->ice_case
|
||||
#define nonlin_ice_case aircraft_->nonlin_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
|
||||
int boot_cycle_tail, boot_cycle_wing_left, boot_cycle_wing_right;
|
||||
int autoIPS_tail, autoIPS_wing_left, autoIPS_wing_right;
|
||||
int eps_pitch_input;
|
||||
double eps_alpha_max, eps_pitch_max, eps_pitch_min;
|
||||
double eps_roll_max, eps_thrust_min, eps_flap_max;
|
||||
double eps_airspeed_max, eps_airspeed_min;
|
||||
#define boot_cycle_tail aircraft_->boot_cycle_tail
|
||||
#define boot_cycle_wing_left aircraft_->boot_cycle_wing_left
|
||||
#define boot_cycle_wing_right aircraft_->boot_cycle_wing_right
|
||||
#define autoIPS_tail aircraft_->autoIPS_tail
|
||||
#define autoIPS_wing_left aircraft_->autoIPS_wing_left
|
||||
#define autoIPS_wing_right aircraft_->autoIPS_wing_right
|
||||
#define eps_pitch_input aircraft_->eps_pitch_input
|
||||
#define eps_alpha_max aircraft_->eps_alpha_max
|
||||
#define eps_pitch_max aircraft_->eps_pitch_max
|
||||
#define eps_pitch_min aircraft_->eps_pitch_min
|
||||
#define eps_roll_max aircraft_->eps_roll_max
|
||||
#define eps_thrust_min aircraft_->eps_thrust_min
|
||||
#define eps_flap_max aircraft_->eps_flap_max
|
||||
#define eps_airspeed_max aircraft_->eps_airspeed_max
|
||||
#define eps_airspeed_min aircraft_->eps_airspeed_min
|
||||
|
||||
double Ch;
|
||||
#define Ch aircraft_->Ch;
|
||||
|
||||
double CL_clean, CL_iced;
|
||||
double CY_clean, CY_iced;
|
||||
double CD_clean, CD_iced;
|
||||
double Cm_clean, Cm_iced;
|
||||
double Cl_clean, Cl_iced;
|
||||
double Cn_clean, Cn_iced;
|
||||
double Ch_clean, Ch_iced;
|
||||
#define CL_clean aircraft_->CL_clean
|
||||
#define CY_clean aircraft_->CY_clean
|
||||
#define CD_clean aircraft_->CD_clean
|
||||
#define Cm_clean aircraft_->Cm_clean
|
||||
#define Cl_clean aircraft_->Cl_clean
|
||||
#define Cn_clean aircraft_->Cn_clean
|
||||
#define Ch_clean aircraft_->Ch_clean
|
||||
#define CL_iced aircraft_->CL_iced
|
||||
#define CY_iced aircraft_->CY_iced
|
||||
#define CD_iced aircraft_->CD_iced
|
||||
#define Cm_iced aircraft_->Cm_iced
|
||||
#define Cl_iced aircraft_->Cl_iced
|
||||
#define Cn_iced aircraft_->Cn_iced
|
||||
#define Ch_iced aircraft_->Ch_iced
|
||||
|
||||
ofstream fout;
|
||||
|
@ -2326,6 +2734,24 @@ struct AIRCRAFT
|
|||
bool dont_ignore;
|
||||
#define dont_ignore aircraft_->dont_ignore
|
||||
|
||||
int ap_pah_on;
|
||||
#define ap_pah_on aircraft_->ap_pah_on
|
||||
double ap_Theta_ref_deg, ap_Theta_ref_rad;
|
||||
#define ap_Theta_ref_deg aircraft_->ap_Theta_ref_deg
|
||||
#define ap_Theta_ref_rad aircraft_->ap_Theta_ref_rad
|
||||
|
||||
int pitch_trim_up, pitch_trim_down;
|
||||
#define pitch_trim_up aircraft_->pitch_trim_up
|
||||
#define pitch_trim_down aircraft_->pitch_trim_down
|
||||
|
||||
bool pilot_throttle_no;
|
||||
#define pilot_throttle_no aircraft_->pilot_throttle_no
|
||||
|
||||
int ice_tail, ice_left, ice_right;
|
||||
#define ice_tail aircraft_->ice_tail
|
||||
#define ice_left aircraft_->ice_left
|
||||
#define ice_right aircraft_->ice_right
|
||||
|
||||
};
|
||||
|
||||
extern AIRCRAFT *aircraft_; // usually defined in the first program that includes uiuc_aircraft.h
|
||||
|
|
|
@ -232,27 +232,44 @@ void uiuc_coef_pitch()
|
|||
}
|
||||
case Cmfade_flag:
|
||||
{
|
||||
// compute the induced velocity on the tail to account for tail downwash
|
||||
/* gamma_wing = V_rel_wind * Sw * CL / (2.0 * bw);
|
||||
w_coef = 0.036;
|
||||
w_induced = w_coef * gamma_wing;
|
||||
downwash_angle = atan(w_induced/V_rel_wind);
|
||||
AlphaTail = Alpha - downwash_angle;
|
||||
CmfadeI = uiuc_2Dinterpolation(Cmfade_aArray,
|
||||
Cmfade_deArray,
|
||||
Cmfade_CmArray,
|
||||
Cmfade_nAlphaArray,
|
||||
Cmfade_nde,
|
||||
AlphaTail,
|
||||
elevator); */
|
||||
CmfadeI = uiuc_2Dinterpolation(Cmfade_aArray,
|
||||
Cmfade_deArray,
|
||||
Cmfade_CmArray,
|
||||
Cmfade_nAlphaArray,
|
||||
Cmfade_nde,
|
||||
Alpha,
|
||||
elevator);
|
||||
// Cm += CmfadeI;
|
||||
if(b_downwashMode)
|
||||
{
|
||||
// compute the induced velocity on the tail to account for tail downwash
|
||||
switch(downwashMode)
|
||||
{
|
||||
case 100:
|
||||
if (V_rel_wind < dyn_on_speed)
|
||||
{
|
||||
alphaTail = Alpha;
|
||||
}
|
||||
else
|
||||
{
|
||||
gammaWing = V_rel_wind * Sw * CL / (2.0 * bw);
|
||||
// printf("gammaWing = %.4f\n", (gammaWing));
|
||||
downwash = downwashCoef * gammaWing;
|
||||
downwashAngle = atan(downwash/V_rel_wind);
|
||||
alphaTail = Alpha - downwashAngle;
|
||||
}
|
||||
CmfadeI = uiuc_2Dinterpolation(Cmfade_aArray,
|
||||
Cmfade_deArray,
|
||||
Cmfade_CmArray,
|
||||
Cmfade_nAlphaArray,
|
||||
Cmfade_nde,
|
||||
alphaTail,
|
||||
elevator);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CmfadeI = uiuc_2Dinterpolation(Cmfade_aArray,
|
||||
Cmfade_deArray,
|
||||
Cmfade_CmArray,
|
||||
Cmfade_nAlphaArray,
|
||||
Cmfade_nde,
|
||||
Alpha,
|
||||
elevator);
|
||||
}
|
||||
if (eta_q_Cmfade_fac)
|
||||
{
|
||||
Cm += CmfadeI * eta_q_Cmfade_fac;
|
||||
|
|
|
@ -96,10 +96,13 @@
|
|||
**********************************************************************/
|
||||
|
||||
#include "uiuc_coefficients.h"
|
||||
#include "uiuc_warnings_errors.h"
|
||||
#include <string.h>
|
||||
|
||||
|
||||
void uiuc_coefficients(double dt)
|
||||
{
|
||||
static string uiuc_coefficients_error = " (from uiuc_coefficients.cpp) ";
|
||||
double l_trim, l_defl;
|
||||
double V_rel_wind_dum, U_body_dum;
|
||||
|
||||
|
@ -111,6 +114,10 @@ void uiuc_coefficients(double dt)
|
|||
|
||||
// calculate rate derivative nondimensionalization factors
|
||||
// check if speed is sufficient to compute dynamic pressure terms
|
||||
if (dyn_on_speed==0)
|
||||
{
|
||||
uiuc_warnings_errors(5, uiuc_coefficients_error);
|
||||
}
|
||||
if (nondim_rate_V_rel_wind || use_V_rel_wind_2U) // c172_aero uses V_rel_wind
|
||||
{
|
||||
if (V_rel_wind > dyn_on_speed)
|
||||
|
@ -202,18 +209,57 @@ void uiuc_coefficients(double dt)
|
|||
}
|
||||
|
||||
// check to see if data files are used for control deflections
|
||||
pilot_elev_no = false;
|
||||
pilot_ail_no = false;
|
||||
pilot_rud_no = false;
|
||||
if (elevator_step || elevator_singlet || elevator_doublet || elevator_input || aileron_input || rudder_input)
|
||||
if (outside_control == false)
|
||||
{
|
||||
pilot_elev_no = false;
|
||||
pilot_ail_no = false;
|
||||
pilot_rud_no = false;
|
||||
}
|
||||
if (elevator_step || elevator_singlet || elevator_doublet || elevator_input || aileron_input || rudder_input || flap_pos_input)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
CD = CX = CL = CZ = Cm = CY = Cl = Cn = 0.0;
|
||||
CLclean_wing = CLiced_wing = CLclean_tail = CLiced_tail = 0.0;
|
||||
CZclean_wing = CZiced_wing = CZclean_tail = CZiced_tail = 0.0;
|
||||
CXclean_wing = CXiced_wing = CXclean_tail = CXiced_tail = 0.0;
|
||||
CL_clean = CL_iced = 0.0;
|
||||
CY_clean = CY_iced = 0.0;
|
||||
CD_clean = CD_iced = 0.0;
|
||||
Cm_iced = Cm_clean = 0.0;
|
||||
Cl_iced = Cl_clean = 0.0;
|
||||
Cn_iced = Cn_clean = 0.0;
|
||||
|
||||
uiuc_coef_lift();
|
||||
uiuc_coef_drag();
|
||||
|
@ -221,18 +267,182 @@ void uiuc_coefficients(double dt)
|
|||
uiuc_coef_sideforce();
|
||||
uiuc_coef_roll();
|
||||
uiuc_coef_yaw();
|
||||
if (ice_case)
|
||||
|
||||
//uncomment next line to always run icing functions
|
||||
//nonlin_ice_case = 1;
|
||||
|
||||
if (nonlin_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);
|
||||
|
||||
if (eta_from_file)
|
||||
{
|
||||
if (eta_tail_input) {
|
||||
double time = Simtime - eta_tail_input_startTime;
|
||||
eta_tail = uiuc_1Dinterpolation(eta_tail_input_timeArray,
|
||||
eta_tail_input_daArray,
|
||||
eta_tail_input_ntime,
|
||||
time);
|
||||
}
|
||||
if (eta_wing_left_input) {
|
||||
double time = Simtime - eta_wing_left_input_startTime;
|
||||
eta_wing_left = uiuc_1Dinterpolation(eta_wing_left_input_timeArray,
|
||||
eta_wing_left_input_daArray,
|
||||
eta_wing_left_input_ntime,
|
||||
time);
|
||||
}
|
||||
if (eta_wing_right_input) {
|
||||
double time = Simtime - eta_wing_right_input_startTime;
|
||||
eta_wing_right = uiuc_1Dinterpolation(eta_wing_right_input_timeArray,
|
||||
eta_wing_right_input_daArray,
|
||||
eta_wing_right_input_ntime,
|
||||
time);
|
||||
}
|
||||
}
|
||||
|
||||
delta_CL = delta_CD = delta_Cm = delta_Cl = delta_Cn = 0.0;
|
||||
Calc_Iced_Forces();
|
||||
add_ice_effects();
|
||||
tactilefadefI = 0.0;
|
||||
if (eta_tail == 0.2 && tactile_pitch && tactilefadef)
|
||||
{
|
||||
if (tactilefadef_nice == 1)
|
||||
tactilefadefI = uiuc_3Dinterp_quick(tactilefadef_fArray,
|
||||
tactilefadef_aArray_nice,
|
||||
tactilefadef_deArray_nice,
|
||||
tactilefadef_tactileArray,
|
||||
tactilefadef_na_nice,
|
||||
tactilefadef_nde_nice,
|
||||
tactilefadef_nf,
|
||||
flap_pos,
|
||||
Alpha,
|
||||
elevator);
|
||||
else
|
||||
tactilefadefI = uiuc_3Dinterpolation(tactilefadef_fArray,
|
||||
tactilefadef_aArray,
|
||||
tactilefadef_deArray,
|
||||
tactilefadef_tactileArray,
|
||||
tactilefadef_nAlphaArray,
|
||||
tactilefadef_nde,
|
||||
tactilefadef_nf,
|
||||
flap_pos,
|
||||
Alpha,
|
||||
elevator);
|
||||
}
|
||||
else if (demo_tactile)
|
||||
{
|
||||
double time = Simtime - demo_tactile_startTime;
|
||||
tactilefadefI = uiuc_1Dinterpolation(demo_tactile_timeArray,
|
||||
demo_tactile_daArray,
|
||||
demo_tactile_ntime,
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pilot_ail_no)
|
||||
|
@ -243,18 +453,23 @@ void uiuc_coefficients(double dt)
|
|||
Lat_control = - aileron / damin * RAD_TO_DEG;
|
||||
}
|
||||
|
||||
// can go past real limits
|
||||
// add flag to behave like trim_case2 later
|
||||
if (pilot_elev_no)
|
||||
{
|
||||
l_trim = elevator_tab;
|
||||
l_defl = elevator - elevator_tab;
|
||||
if (l_trim <=0 )
|
||||
Long_trim = l_trim / demax * RAD_TO_DEG;
|
||||
else
|
||||
Long_trim = l_trim / demin * RAD_TO_DEG;
|
||||
if (l_defl <= 0)
|
||||
Long_control = l_defl / demax * RAD_TO_DEG;
|
||||
else
|
||||
Long_control = l_defl / demin * RAD_TO_DEG;
|
||||
if (outside_control == false)
|
||||
{
|
||||
l_trim = elevator_tab;
|
||||
l_defl = elevator - elevator_tab;
|
||||
if (l_trim <=0 )
|
||||
Long_trim = l_trim / demax * RAD_TO_DEG;
|
||||
else
|
||||
Long_trim = l_trim / demin * RAD_TO_DEG;
|
||||
if (l_defl <= 0)
|
||||
Long_control = l_defl / demax * RAD_TO_DEG;
|
||||
else
|
||||
Long_control = l_defl / demin * RAD_TO_DEG;
|
||||
}
|
||||
}
|
||||
|
||||
if (pilot_rud_no)
|
||||
|
|
|
@ -9,13 +9,16 @@
|
|||
#include "uiuc_coef_sideforce.h"
|
||||
#include "uiuc_coef_roll.h"
|
||||
#include "uiuc_coef_yaw.h"
|
||||
#include "uiuc_iceboot.h"
|
||||
#include "uiuc_iceboot.h" //Anne's code
|
||||
#include "uiuc_iced_nonlin.h"
|
||||
#include "uiuc_ice_rates.h"
|
||||
#include "uiuc_pah_ap.h"
|
||||
#include "uiuc_1Dinterpolation.h"
|
||||
#include "uiuc_3Dinterpolation.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*/
|
||||
|
||||
extern double Simtime;
|
||||
|
||||
void uiuc_coefficients(double dt);
|
||||
|
||||
|
|
|
@ -177,6 +177,21 @@ void uiuc_controlInput()
|
|||
time);
|
||||
}
|
||||
}
|
||||
|
||||
if (flap_pos_input)
|
||||
{
|
||||
double flap_pos_input_endTime = flap_pos_input_timeArray[flap_pos_input_ntime];
|
||||
if (Simtime >= flap_pos_input_startTime &&
|
||||
Simtime <= (flap_pos_input_startTime + flap_pos_input_endTime))
|
||||
{
|
||||
double time = Simtime - flap_pos_input_startTime;
|
||||
flap_pos = uiuc_1Dinterpolation(flap_pos_input_timeArray,
|
||||
flap_pos_input_dfArray,
|
||||
flap_pos_input_ntime,
|
||||
time);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -83,6 +83,8 @@ void uiuc_engine()
|
|||
string linetoken1;
|
||||
string linetoken2;
|
||||
|
||||
if (outside_control == false)
|
||||
pilot_throttle_no = false;
|
||||
if (Throttle_pct_input)
|
||||
{
|
||||
double Throttle_pct_input_endTime = Throttle_pct_input_timeArray[Throttle_pct_input_ntime];
|
||||
|
@ -94,6 +96,7 @@ void uiuc_engine()
|
|||
Throttle_pct_input_dTArray,
|
||||
Throttle_pct_input_ntime,
|
||||
time);
|
||||
pilot_throttle_no = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -128,7 +131,7 @@ void uiuc_engine()
|
|||
/* simple model based on Hepperle's equation
|
||||
* exponent dtdvvt was computed in uiuc_menu.cpp */
|
||||
F_X_engine = Throttle[3] * t_v0 * (1 - pow((V_rel_wind/v_t0),dtdvvt));
|
||||
if (slipstream_effects) {
|
||||
if (b_slipstreamEffects) {
|
||||
tc = F_X_engine/(Dynamic_pressure * LS_PI * propDia * propDia / 4);
|
||||
w_induced = 0.5 * V_rel_wind * (-1 + pow((1+tc),.5));
|
||||
eta_q = (2* w_induced + V_rel_wind)*(2* w_induced + V_rel_wind)/(V_rel_wind * V_rel_wind);
|
||||
|
|
|
@ -1,93 +0,0 @@
|
|||
//#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);
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
#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_
|
|
@ -1,6 +1,6 @@
|
|||
// SIS Twin Otter Iced aircraft Nonlinear model
|
||||
// Version 020409
|
||||
// read readme_020212.doc for information
|
||||
// SIS Twin Otter Iced aircraft Nonlinear model
|
||||
// Version 020409
|
||||
// read readme_020212.doc for information
|
||||
|
||||
#include "uiuc_iced_nonlin.h"
|
||||
|
||||
|
@ -10,7 +10,7 @@ void Calc_Iced_Forces()
|
|||
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_ref_tail = 0.20; //changed from 0.12 10-23-2002
|
||||
double eta_wing;
|
||||
//double delta_CL; // CL_clean - CL_iced;
|
||||
//double delta_CD; // CD_clean - CD_iced;
|
||||
|
@ -25,6 +25,7 @@ void Calc_Iced_Forces()
|
|||
double KCm_de;
|
||||
double KCh;
|
||||
double CL_diff;
|
||||
double CD_diff;
|
||||
|
||||
|
||||
|
||||
|
@ -34,7 +35,7 @@ void Calc_Iced_Forces()
|
|||
if (alpha < 16)
|
||||
{
|
||||
delta_CL = (0.088449 + 0.004836*alpha - 0.0005459*alpha*alpha +
|
||||
4.0859e-5*pow(alpha,3));
|
||||
4.0859e-5*pow(alpha,3));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -48,7 +49,7 @@ void Calc_Iced_Forces()
|
|||
|
||||
// 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));
|
||||
-4.7511e-5*pow(alpha,3) + 2.3384e-6*pow(alpha,4));
|
||||
KCD = -delta_CD/eta_ref_wing;
|
||||
delta_CD = eta_wing*KCD;
|
||||
|
||||
|
@ -57,7 +58,7 @@ void Calc_Iced_Forces()
|
|||
- 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));
|
||||
- 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;
|
||||
|
@ -66,14 +67,14 @@ void Calc_Iced_Forces()
|
|||
|
||||
// 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));
|
||||
}
|
||||
{
|
||||
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_a = 0;
|
||||
}
|
||||
delta_Ch_e = -0.0011851 - 0.00049924*de;
|
||||
delta_Ch = -(delta_Ch_a + delta_Ch_e);
|
||||
KCh = -delta_Ch/eta_ref_tail;
|
||||
|
@ -81,31 +82,42 @@ void Calc_Iced_Forces()
|
|||
|
||||
// rolling moment
|
||||
CL_diff = (eta_wing_left - eta_wing_right)*KCL;
|
||||
delta_Cl = CL_diff/4;
|
||||
delta_Cl = CL_diff/8.; // 10-23-02 Previously 4
|
||||
|
||||
//yawing moment
|
||||
CD_diff = (eta_wing_left - eta_wing_right)*KCD;
|
||||
delta_Cn = CD_diff/8.;
|
||||
|
||||
}
|
||||
|
||||
void add_ice_effects()
|
||||
{
|
||||
CL_clean = -1*CZ*cos(Alpha) + CX*sin(Alpha); //Check later
|
||||
CD_clean = -1*CZ*sin(Alpha) - CX*cos(Alpha);
|
||||
CD_clean = -1*CX*Cos_alpha*Cos_beta - CY*Sin_beta - CZ*Sin_alpha*Cos_beta;
|
||||
CY_clean = -1*CX*Cos_alpha*Sin_beta + CY*Cos_beta - CZ*Sin_alpha*Sin_beta;
|
||||
CL_clean = CX*Sin_alpha - CZ*Cos_alpha;
|
||||
Cm_clean = Cm;
|
||||
Cl_clean = Cl;
|
||||
Cn_clean = Cn;
|
||||
Ch_clean = Ch;
|
||||
|
||||
CL_iced = CL_clean + delta_CL;
|
||||
CD_iced = CD_clean + delta_CD;
|
||||
CY_iced = CY_clean;
|
||||
CL_iced = CL_clean + delta_CL;
|
||||
Cm_iced = Cm_clean + delta_Cm;
|
||||
Cl_iced = Cl_clean + delta_Cl;
|
||||
Cn_iced = Cn_clean + delta_Cn;
|
||||
//Ch_iced = Ch_clean + delta_Ch;
|
||||
|
||||
CL = CL_iced;
|
||||
CD = CD_iced;
|
||||
CY = CY_iced;
|
||||
CL = CL_iced;
|
||||
Cm = Cm_iced;
|
||||
Cl = Cl_iced;
|
||||
Cn = Cn_iced;
|
||||
//Ch = Ch_iced;
|
||||
|
||||
CZ = -1*CL*cos(Alpha) - CD*sin(Alpha);
|
||||
CX = CL*sin(Alpha) - CD*cos(Alpha);
|
||||
CX = -1*CD*Cos_alpha*Cos_beta - CY*Cos_alpha*Sin_beta + CL*Sin_alpha;
|
||||
CY = -1*CD*Sin_beta + CY*Cos_beta;
|
||||
CZ = -1*CD*Sin_alpha*Cos_beta - CY*Sin_alpha*Sin_beta - CL*Cos_alpha;
|
||||
|
||||
}
|
||||
|
|
|
@ -85,6 +85,7 @@ void uiuc_map_controlSurface()
|
|||
controlSurface_map["elevator_input"] = elevator_input_flag ;
|
||||
controlSurface_map["aileron_input"] = aileron_input_flag ;
|
||||
controlSurface_map["rudder_input"] = rudder_input_flag ;
|
||||
controlSurface_map["flap_pos_input"] = flap_pos_input_flag ;
|
||||
controlSurface_map["pilot_elev_no"] = pilot_elev_no_flag ;
|
||||
controlSurface_map["pilot_ail_no"] = pilot_ail_no_flag ;
|
||||
controlSurface_map["pilot_rud_no"] = pilot_rud_no_flag ;
|
||||
|
|
|
@ -138,6 +138,32 @@ void uiuc_map_ice()
|
|||
ice_map["beta_probe_wing"] = beta_probe_wing_flag ;
|
||||
ice_map["beta_probe_tail"] = beta_probe_tail_flag ;
|
||||
ice_map["bootTime"] = bootTime_flag ;
|
||||
ice_map["eta_wing_left_input"] = eta_wing_left_input_flag ;
|
||||
ice_map["eta_wing_right_input"] = eta_wing_right_input_flag ;
|
||||
ice_map["eta_tail_input"] = eta_tail_input_flag ;
|
||||
ice_map["nonlin_ice_case"] = nonlin_ice_case_flag ;
|
||||
ice_map["eta_tail"] = eta_tail_flag ;
|
||||
ice_map["eta_wing_left"] = eta_wing_left_flag ;
|
||||
ice_map["eta_wing_right"] = eta_wing_right_flag ;
|
||||
ice_map["demo_eps_alpha_max"] = demo_eps_alpha_max_flag ;
|
||||
ice_map["demo_eps_pitch_max"] = demo_eps_pitch_max_flag ;
|
||||
ice_map["demo_eps_pitch_min"] = demo_eps_pitch_min_flag ;
|
||||
ice_map["demo_eps_roll_max"] = demo_eps_roll_max_flag ;
|
||||
ice_map["demo_eps_thrust_min"] = demo_eps_thrust_min_flag ;
|
||||
ice_map["demo_eps_flap_max"] = demo_eps_flap_max_flag ;
|
||||
ice_map["demo_eps_airspeed_max"]= demo_eps_airspeed_max_flag ;
|
||||
ice_map["demo_eps_airspeed_min"]= demo_eps_airspeed_min_flag ;
|
||||
ice_map["demo_boot_cycle_tail"] = demo_boot_cycle_tail_flag ;
|
||||
ice_map["demo_boot_cycle_wing_left"]= demo_boot_cycle_wing_left_flag;
|
||||
ice_map["demo_boot_cycle_wing_right"]= demo_boot_cycle_wing_right_flag;
|
||||
ice_map["demo_eps_pitch_input"] = demo_eps_pitch_input_flag ;
|
||||
ice_map["tactilefadef"] = tactilefadef_flag ;
|
||||
ice_map["tactile_pitch"] = tactile_pitch_flag ;
|
||||
ice_map["demo_ap_Theta_ref_deg"]= demo_ap_Theta_ref_deg_flag ;
|
||||
ice_map["demo_ap_pah_on"] = demo_ap_pah_on_flag ;
|
||||
ice_map["demo_tactile"] = demo_tactile_flag ;
|
||||
ice_map["demo_ice_tail"] = demo_ice_tail_flag ;
|
||||
ice_map["demo_ice_left"] = demo_ice_left_flag ;
|
||||
ice_map["demo_ice_right"] = demo_ice_right_flag ;
|
||||
}
|
||||
|
||||
// end uiuc_map_ice.cpp
|
||||
|
|
|
@ -97,12 +97,19 @@ void uiuc_map_init()
|
|||
init_map["dyn_on_speed_zero"] = dyn_on_speed_zero_flag ;
|
||||
init_map["use_dyn_on_speed_curve1"] = use_dyn_on_speed_curve1_flag;
|
||||
init_map["use_Alpha_dot_on_speed"] = use_Alpha_dot_on_speed_flag;
|
||||
init_map["downwashMode"] = downwashMode_flag ;
|
||||
init_map["downwashCoef"] = downwashCoef_flag ;
|
||||
init_map["Alpha"] = Alpha_flag ;
|
||||
init_map["Beta"] = Beta_flag ;
|
||||
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 ;
|
||||
init_map["ignore_unknown"] = ignore_unknown_flag ;
|
||||
init_map["trim_case_2"] = trim_case_2_flag ;
|
||||
init_map["use_uiuc_network"] = use_uiuc_network_flag ;
|
||||
init_map["old_flap_routine"] = old_flap_routine_flag ;
|
||||
init_map["icing_demo"] = icing_demo_flag ;
|
||||
init_map["outside_control"] = outside_control_flag ;
|
||||
}
|
||||
|
||||
// end uiuc_map_init.cpp
|
||||
|
|
|
@ -70,8 +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 ;
|
||||
misc_map["flapper"] = flapper_flag ;
|
||||
misc_map["flapper_phi_init"] = flapper_phi_init_flag ;
|
||||
}
|
||||
|
||||
// end uiuc_map_misc.cpp
|
||||
|
|
|
@ -9,11 +9,13 @@ void uiuc_map_record6()
|
|||
record_map["Cm_clean"] = Cm_clean_record ;
|
||||
record_map["Ch_clean"] = Ch_clean_record ;
|
||||
record_map["Cl_clean"] = Cl_clean_record ;
|
||||
record_map["Cn_clean"] = Cn_clean_record ;
|
||||
record_map["CL_iced"] = CL_iced_record ;
|
||||
record_map["CD_iced"] = CD_iced_record ;
|
||||
record_map["Cm_iced"] = Cm_iced_record ;
|
||||
record_map["Ch_iced"] = Ch_iced_record ;
|
||||
record_map["Cl_iced"] = Cl_iced_record ;
|
||||
record_map["Cn_iced"] = Cn_iced_record ;
|
||||
record_map["CLclean_wing"] = CLclean_wing_record ;
|
||||
record_map["CLiced_wing"] = CLiced_wing_record ;
|
||||
record_map["CLclean_tail"] = CLclean_tail_record ;
|
||||
|
@ -48,6 +50,34 @@ void uiuc_map_record6()
|
|||
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 ;
|
||||
record_map["eta_ice"] = eta_ice_record ;
|
||||
record_map["eta_wing_left"] = eta_wing_left_record ;
|
||||
record_map["eta_wing_right"] = eta_wing_right_record ;
|
||||
record_map["eta_tail"] = eta_tail_record ;
|
||||
record_map["delta_CL"] = delta_CL_record ;
|
||||
record_map["delta_CD"] = delta_CD_record ;
|
||||
record_map["delta_Cm"] = delta_Cm_record ;
|
||||
record_map["delta_Cl"] = delta_Cl_record ;
|
||||
record_map["delta_Cn"] = delta_Cn_record ;
|
||||
record_map["boot_cycle_tail"] = boot_cycle_tail_record ;
|
||||
record_map["boot_cycle_wing_left"] = boot_cycle_wing_left_record ;
|
||||
record_map["boot_cycle_wing_right"] = boot_cycle_wing_right_record ;
|
||||
record_map["autoIPS_tail"] = autoIPS_tail_record ;
|
||||
record_map["autoIPS_wing_left"] = autoIPS_wing_left_record ;
|
||||
record_map["autoIPS_wing_right"] = autoIPS_wing_right_record ;
|
||||
record_map["eps_pitch_input"] = eps_pitch_input_record ;
|
||||
record_map["eps_alpha_max"] = eps_alpha_max_record ;
|
||||
record_map["eps_pitch_max"] = eps_pitch_max_record ;
|
||||
record_map["eps_pitch_min"] = eps_pitch_min_record ;
|
||||
record_map["eps_roll_max"] = eps_roll_max_record ;
|
||||
record_map["eps_thrust_min"] = eps_thrust_min_record ;
|
||||
record_map["eps_flap_max"] = eps_flap_max_record ;
|
||||
record_map["eps_airspeed_max"] = eps_airspeed_max_record ;
|
||||
record_map["eps_airspeed_min"] = eps_airspeed_min_record ;
|
||||
record_map["tactilefadefI"] = tactilefadefI_record ;
|
||||
/******************************autopilot****************************/
|
||||
record_map["ap_Theta_ref_deg"] = ap_Theta_ref_deg_record ;
|
||||
record_map["ap_pah_on"] = ap_pah_on_record ;
|
||||
}
|
||||
|
||||
// end uiuc_map_record6.cpp
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
own function to speed up compile time
|
||||
08/29/2002 (RD w/ help from CO) Made changes to shorten
|
||||
compile time. [] RD to add more comments here.
|
||||
08/29/3003 (MSS) Adding new keywords for new engine model
|
||||
08/29/2003 (MSS) Adding new keywords for new engine model
|
||||
and slipstream effects on tail.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
@ -200,9 +200,10 @@ void i_1_to_2( int array1D[100], int array2D[][100], int index2D)
|
|||
}
|
||||
|
||||
void parse_init( const string& linetoken2, const string& linetoken3,
|
||||
LIST command_line ) {
|
||||
const string& linetoken4, LIST command_line ) {
|
||||
double token_value;
|
||||
istrstream token3(linetoken3.c_str());
|
||||
istrstream token4(linetoken4.c_str());
|
||||
int token_value_recordRate;
|
||||
|
||||
switch(init_map[linetoken2])
|
||||
|
@ -467,6 +468,26 @@ void parse_init( const string& linetoken2, const string& linetoken3,
|
|||
Alpha_dot_on_speed = token_value;
|
||||
break;
|
||||
}
|
||||
case downwashMode_flag:
|
||||
{
|
||||
b_downwashMode = true;
|
||||
token3 >> downwashMode;
|
||||
if (downwashMode==100)
|
||||
;
|
||||
// compute downwash using downwashCoef, do nothing here
|
||||
else
|
||||
uiuc_warnings_errors(4, *command_line);
|
||||
break;
|
||||
}
|
||||
case downwashCoef_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
downwashCoef = token_value;
|
||||
break;
|
||||
}
|
||||
case Alpha_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
|
@ -527,6 +548,33 @@ void parse_init( const string& linetoken2, const string& linetoken3,
|
|||
dont_ignore=false;
|
||||
break;
|
||||
}
|
||||
case trim_case_2_flag:
|
||||
{
|
||||
trim_case_2 = true;
|
||||
break;
|
||||
}
|
||||
case use_uiuc_network_flag:
|
||||
{
|
||||
use_uiuc_network = true;
|
||||
server_IP = linetoken3;
|
||||
token4 >> port_num;
|
||||
break;
|
||||
}
|
||||
case old_flap_routine_flag:
|
||||
{
|
||||
old_flap_routine = true;
|
||||
break;
|
||||
}
|
||||
case icing_demo_flag:
|
||||
{
|
||||
icing_demo = true;
|
||||
break;
|
||||
}
|
||||
case outside_control_flag:
|
||||
{
|
||||
outside_control = true;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
if (dont_ignore)
|
||||
|
@ -851,6 +899,22 @@ void parse_controlSurface( const string& linetoken2, const string& linetoken3,
|
|||
rudder_input_startTime = token_value;
|
||||
break;
|
||||
}
|
||||
case flap_pos_input_flag:
|
||||
{
|
||||
flap_pos_input = true;
|
||||
flap_pos_input_file = aircraft_directory + linetoken3;
|
||||
token4 >> token_value_convert1;
|
||||
token5 >> token_value_convert2;
|
||||
convert_y = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
uiuc_1DdataFileReader(flap_pos_input_file,
|
||||
flap_pos_input_timeArray,
|
||||
flap_pos_input_dfArray,
|
||||
flap_pos_input_ntime);
|
||||
token6 >> token_value;
|
||||
flap_pos_input_startTime = token_value;
|
||||
break;
|
||||
}
|
||||
case pilot_elev_no_flag:
|
||||
{
|
||||
pilot_elev_no_check = true;
|
||||
|
@ -1157,7 +1221,7 @@ void parse_engine( const string& linetoken2, const string& linetoken3,
|
|||
case slipstream_effects_flag:
|
||||
{
|
||||
// include slipstream effects
|
||||
slipstream_effects = true;
|
||||
b_slipstreamEffects = true;
|
||||
if (!simpleSingleModel)
|
||||
uiuc_warnings_errors(3, *command_line);
|
||||
break;
|
||||
|
@ -4212,10 +4276,23 @@ void parse_gear( const string& linetoken2, const string& linetoken3,
|
|||
|
||||
|
||||
void parse_ice( const string& linetoken2, const string& linetoken3,
|
||||
const string& linetoken4, LIST command_line ) {
|
||||
const string& linetoken4, const string& linetoken5,
|
||||
const string& linetoken6, const string& linetoken7,
|
||||
const string& linetoken8, const string& linetoken9,
|
||||
const string& aircraft_directory,
|
||||
bool &tactilefadef_first, LIST command_line ) {
|
||||
double token_value;
|
||||
int token_value_convert1, token_value_convert2, token_value_convert3;
|
||||
double datafile_xArray[100][100], datafile_yArray[100];
|
||||
double datafile_zArray[100][100];
|
||||
int datafile_nxArray[100], datafile_ny;
|
||||
istrstream token3(linetoken3.c_str());
|
||||
istrstream token4(linetoken4.c_str());
|
||||
istrstream token5(linetoken5.c_str());
|
||||
istrstream token6(linetoken6.c_str());
|
||||
istrstream token7(linetoken7.c_str());
|
||||
istrstream token8(linetoken8.c_str());
|
||||
istrstream token9(linetoken9.c_str());
|
||||
|
||||
switch(ice_map[linetoken2])
|
||||
{
|
||||
|
@ -4927,6 +5004,437 @@ void parse_ice( const string& linetoken2, const string& linetoken3,
|
|||
bootTrue[index] = true;
|
||||
break;
|
||||
}
|
||||
case eta_wing_left_input_flag:
|
||||
{
|
||||
eta_from_file = true;
|
||||
eta_wing_left_input = true;
|
||||
eta_wing_left_input_file = aircraft_directory + linetoken3;
|
||||
token4 >> token_value_convert1;
|
||||
token5 >> token_value_convert2;
|
||||
convert_y = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
uiuc_1DdataFileReader(eta_wing_left_input_file,
|
||||
eta_wing_left_input_timeArray,
|
||||
eta_wing_left_input_daArray,
|
||||
eta_wing_left_input_ntime);
|
||||
token6 >> token_value;
|
||||
eta_wing_left_input_startTime = token_value;
|
||||
break;
|
||||
}
|
||||
case eta_wing_right_input_flag:
|
||||
{
|
||||
eta_from_file = true;
|
||||
eta_wing_right_input = true;
|
||||
eta_wing_right_input_file = aircraft_directory + linetoken3;
|
||||
token4 >> token_value_convert1;
|
||||
token5 >> token_value_convert2;
|
||||
convert_y = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
uiuc_1DdataFileReader(eta_wing_right_input_file,
|
||||
eta_wing_right_input_timeArray,
|
||||
eta_wing_right_input_daArray,
|
||||
eta_wing_right_input_ntime);
|
||||
token6 >> token_value;
|
||||
eta_wing_right_input_startTime = token_value;
|
||||
break;
|
||||
}
|
||||
case eta_tail_input_flag:
|
||||
{
|
||||
eta_from_file = true;
|
||||
eta_tail_input = true;
|
||||
eta_tail_input_file = aircraft_directory + linetoken3;
|
||||
token4 >> token_value_convert1;
|
||||
token5 >> token_value_convert2;
|
||||
convert_y = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
uiuc_1DdataFileReader(eta_tail_input_file,
|
||||
eta_tail_input_timeArray,
|
||||
eta_tail_input_daArray,
|
||||
eta_tail_input_ntime);
|
||||
token6 >> token_value;
|
||||
eta_tail_input_startTime = token_value;
|
||||
break;
|
||||
}
|
||||
case nonlin_ice_case_flag:
|
||||
{
|
||||
token3 >> nonlin_ice_case;
|
||||
break;
|
||||
}
|
||||
case eta_tail_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
eta_tail = token_value;
|
||||
break;
|
||||
}
|
||||
case eta_wing_left_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
eta_wing_left = token_value;
|
||||
break;
|
||||
}
|
||||
case eta_wing_right_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
eta_wing_right = token_value;
|
||||
break;
|
||||
}
|
||||
case demo_eps_alpha_max_flag:
|
||||
{
|
||||
demo_eps_alpha_max = true;
|
||||
demo_eps_alpha_max_file = aircraft_directory + linetoken3;
|
||||
token4 >> token_value_convert1;
|
||||
token5 >> token_value_convert2;
|
||||
convert_y = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
uiuc_1DdataFileReader(demo_eps_alpha_max_file,
|
||||
demo_eps_alpha_max_timeArray,
|
||||
demo_eps_alpha_max_daArray,
|
||||
demo_eps_alpha_max_ntime);
|
||||
token6 >> token_value;
|
||||
demo_eps_alpha_max_startTime = token_value;
|
||||
break;
|
||||
}
|
||||
case demo_eps_pitch_max_flag:
|
||||
{
|
||||
demo_eps_pitch_max = true;
|
||||
demo_eps_pitch_max_file = aircraft_directory + linetoken3;
|
||||
token4 >> token_value_convert1;
|
||||
token5 >> token_value_convert2;
|
||||
convert_y = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
uiuc_1DdataFileReader(demo_eps_pitch_max_file,
|
||||
demo_eps_pitch_max_timeArray,
|
||||
demo_eps_pitch_max_daArray,
|
||||
demo_eps_pitch_max_ntime);
|
||||
token6 >> token_value;
|
||||
demo_eps_pitch_max_startTime = token_value;
|
||||
break;
|
||||
}
|
||||
case demo_eps_pitch_min_flag:
|
||||
{
|
||||
demo_eps_pitch_min = true;
|
||||
demo_eps_pitch_min_file = aircraft_directory + linetoken3;
|
||||
token4 >> token_value_convert1;
|
||||
token5 >> token_value_convert2;
|
||||
convert_y = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
uiuc_1DdataFileReader(demo_eps_pitch_min_file,
|
||||
demo_eps_pitch_min_timeArray,
|
||||
demo_eps_pitch_min_daArray,
|
||||
demo_eps_pitch_min_ntime);
|
||||
token6 >> token_value;
|
||||
demo_eps_pitch_min_startTime = token_value;
|
||||
break;
|
||||
}
|
||||
case demo_eps_roll_max_flag:
|
||||
{
|
||||
demo_eps_roll_max = true;
|
||||
demo_eps_roll_max_file = aircraft_directory + linetoken3;
|
||||
token4 >> token_value_convert1;
|
||||
token5 >> token_value_convert2;
|
||||
convert_y = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
uiuc_1DdataFileReader(demo_eps_roll_max_file,
|
||||
demo_eps_roll_max_timeArray,
|
||||
demo_eps_roll_max_daArray,
|
||||
demo_eps_roll_max_ntime);
|
||||
token6 >> token_value;
|
||||
demo_eps_roll_max_startTime = token_value;
|
||||
break;
|
||||
}
|
||||
case demo_eps_thrust_min_flag:
|
||||
{
|
||||
demo_eps_thrust_min = true;
|
||||
demo_eps_thrust_min_file = aircraft_directory + linetoken3;
|
||||
token4 >> token_value_convert1;
|
||||
token5 >> token_value_convert2;
|
||||
convert_y = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
uiuc_1DdataFileReader(demo_eps_thrust_min_file,
|
||||
demo_eps_thrust_min_timeArray,
|
||||
demo_eps_thrust_min_daArray,
|
||||
demo_eps_thrust_min_ntime);
|
||||
token6 >> token_value;
|
||||
demo_eps_thrust_min_startTime = token_value;
|
||||
break;
|
||||
}
|
||||
case demo_eps_airspeed_max_flag:
|
||||
{
|
||||
demo_eps_airspeed_max = true;
|
||||
demo_eps_airspeed_max_file = aircraft_directory + linetoken3;
|
||||
token4 >> token_value_convert1;
|
||||
token5 >> token_value_convert2;
|
||||
convert_y = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
uiuc_1DdataFileReader(demo_eps_airspeed_max_file,
|
||||
demo_eps_airspeed_max_timeArray,
|
||||
demo_eps_airspeed_max_daArray,
|
||||
demo_eps_airspeed_max_ntime);
|
||||
token6 >> token_value;
|
||||
demo_eps_airspeed_max_startTime = token_value;
|
||||
break;
|
||||
}
|
||||
case demo_eps_airspeed_min_flag:
|
||||
{
|
||||
demo_eps_airspeed_min = true;
|
||||
demo_eps_airspeed_min_file = aircraft_directory + linetoken3;
|
||||
token4 >> token_value_convert1;
|
||||
token5 >> token_value_convert2;
|
||||
convert_y = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
uiuc_1DdataFileReader(demo_eps_airspeed_min_file,
|
||||
demo_eps_airspeed_min_timeArray,
|
||||
demo_eps_airspeed_min_daArray,
|
||||
demo_eps_airspeed_min_ntime);
|
||||
token6 >> token_value;
|
||||
demo_eps_airspeed_min_startTime = token_value;
|
||||
break;
|
||||
}
|
||||
case demo_eps_flap_max_flag:
|
||||
{
|
||||
demo_eps_flap_max = true;
|
||||
demo_eps_flap_max_file = aircraft_directory + linetoken3;
|
||||
token4 >> token_value_convert1;
|
||||
token5 >> token_value_convert2;
|
||||
convert_y = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
uiuc_1DdataFileReader(demo_eps_flap_max_file,
|
||||
demo_eps_flap_max_timeArray,
|
||||
demo_eps_flap_max_daArray,
|
||||
demo_eps_flap_max_ntime);
|
||||
token6 >> token_value;
|
||||
demo_eps_flap_max_startTime = token_value;
|
||||
break;
|
||||
}
|
||||
case demo_boot_cycle_tail_flag:
|
||||
{
|
||||
demo_boot_cycle_tail = true;
|
||||
demo_boot_cycle_tail_file = aircraft_directory + linetoken3;
|
||||
token4 >> token_value_convert1;
|
||||
token5 >> token_value_convert2;
|
||||
convert_y = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
uiuc_1DdataFileReader(demo_boot_cycle_tail_file,
|
||||
demo_boot_cycle_tail_timeArray,
|
||||
demo_boot_cycle_tail_daArray,
|
||||
demo_boot_cycle_tail_ntime);
|
||||
token6 >> token_value;
|
||||
demo_boot_cycle_tail_startTime = token_value;
|
||||
break;
|
||||
}
|
||||
case demo_boot_cycle_wing_left_flag:
|
||||
{
|
||||
demo_boot_cycle_wing_left = true;
|
||||
demo_boot_cycle_wing_left_file = aircraft_directory + linetoken3;
|
||||
token4 >> token_value_convert1;
|
||||
token5 >> token_value_convert2;
|
||||
convert_y = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
uiuc_1DdataFileReader(demo_boot_cycle_wing_left_file,
|
||||
demo_boot_cycle_wing_left_timeArray,
|
||||
demo_boot_cycle_wing_left_daArray,
|
||||
demo_boot_cycle_wing_left_ntime);
|
||||
token6 >> token_value;
|
||||
demo_boot_cycle_wing_left_startTime = token_value;
|
||||
break;
|
||||
}
|
||||
case demo_boot_cycle_wing_right_flag:
|
||||
{
|
||||
demo_boot_cycle_wing_right = true;
|
||||
demo_boot_cycle_wing_right_file = aircraft_directory + linetoken3;
|
||||
token4 >> token_value_convert1;
|
||||
token5 >> token_value_convert2;
|
||||
convert_y = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
uiuc_1DdataFileReader(demo_boot_cycle_wing_right_file,
|
||||
demo_boot_cycle_wing_right_timeArray,
|
||||
demo_boot_cycle_wing_right_daArray,
|
||||
demo_boot_cycle_wing_right_ntime);
|
||||
token6 >> token_value;
|
||||
demo_boot_cycle_wing_right_startTime = token_value;
|
||||
break;
|
||||
}
|
||||
case demo_eps_pitch_input_flag:
|
||||
{
|
||||
demo_eps_pitch_input = true;
|
||||
demo_eps_pitch_input_file = aircraft_directory + linetoken3;
|
||||
token4 >> token_value_convert1;
|
||||
token5 >> token_value_convert2;
|
||||
convert_y = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
uiuc_1DdataFileReader(demo_eps_pitch_input_file,
|
||||
demo_eps_pitch_input_timeArray,
|
||||
demo_eps_pitch_input_daArray,
|
||||
demo_eps_pitch_input_ntime);
|
||||
token6 >> token_value;
|
||||
demo_eps_pitch_input_startTime = token_value;
|
||||
break;
|
||||
}
|
||||
case demo_ap_Theta_ref_deg_flag:
|
||||
{
|
||||
demo_ap_Theta_ref_deg = true;
|
||||
demo_ap_Theta_ref_deg_file = aircraft_directory + linetoken3;
|
||||
token4 >> token_value_convert1;
|
||||
token5 >> token_value_convert2;
|
||||
convert_y = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
uiuc_1DdataFileReader(demo_ap_Theta_ref_deg_file,
|
||||
demo_ap_Theta_ref_deg_timeArray,
|
||||
demo_ap_Theta_ref_deg_daArray,
|
||||
demo_ap_Theta_ref_deg_ntime);
|
||||
token6 >> token_value;
|
||||
demo_ap_Theta_ref_deg_startTime = token_value;
|
||||
break;
|
||||
}
|
||||
case demo_ap_pah_on_flag:
|
||||
{
|
||||
demo_ap_pah_on = true;
|
||||
demo_ap_pah_on_file = aircraft_directory + linetoken3;
|
||||
token4 >> token_value_convert1;
|
||||
token5 >> token_value_convert2;
|
||||
convert_y = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
uiuc_1DdataFileReader(demo_ap_pah_on_file,
|
||||
demo_ap_pah_on_timeArray,
|
||||
demo_ap_pah_on_daArray,
|
||||
demo_ap_pah_on_ntime);
|
||||
token6 >> token_value;
|
||||
demo_ap_pah_on_startTime = token_value;
|
||||
break;
|
||||
}
|
||||
case tactilefadef_flag:
|
||||
{
|
||||
int tactilefadef_index, i;
|
||||
string tactilefadef_file;
|
||||
double flap_value;
|
||||
tactilefadef = true;
|
||||
tactilefadef_file = aircraft_directory + linetoken3;
|
||||
token4 >> tactilefadef_index;
|
||||
if (tactilefadef_index < 0 || tactilefadef_index >= 30)
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
if (tactilefadef_index > tactilefadef_nf)
|
||||
tactilefadef_nf = tactilefadef_index;
|
||||
token5 >> flap_value;
|
||||
tactilefadef_fArray[tactilefadef_index] = flap_value;
|
||||
token6 >> token_value_convert1;
|
||||
token7 >> token_value_convert2;
|
||||
token8 >> token_value_convert3;
|
||||
token9 >> tactilefadef_nice;
|
||||
convert_z = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
convert_y = uiuc_convert(token_value_convert3);
|
||||
/* call 2D File Reader with file name (tactilefadef_file) and
|
||||
conversion factors; function returns array of
|
||||
elevator deflections (deArray) and corresponding
|
||||
alpha (aArray) and delta CZ (CZArray) values and
|
||||
max number of terms in alpha arrays (nAlphaArray)
|
||||
and delfection array (nde) */
|
||||
uiuc_2DdataFileReader(tactilefadef_file,
|
||||
datafile_xArray,
|
||||
datafile_yArray,
|
||||
datafile_zArray,
|
||||
datafile_nxArray,
|
||||
datafile_ny);
|
||||
d_2_to_3(datafile_xArray, tactilefadef_aArray, tactilefadef_index);
|
||||
d_1_to_2(datafile_yArray, tactilefadef_deArray, tactilefadef_index);
|
||||
d_2_to_3(datafile_zArray, tactilefadef_tactileArray, tactilefadef_index);
|
||||
i_1_to_2(datafile_nxArray, tactilefadef_nAlphaArray, tactilefadef_index);
|
||||
tactilefadef_nde[tactilefadef_index] = datafile_ny;
|
||||
if (tactilefadef_first==true)
|
||||
{
|
||||
if (tactilefadef_nice == 1)
|
||||
{
|
||||
tactilefadef_na_nice = datafile_nxArray[1];
|
||||
tactilefadef_nde_nice = datafile_ny;
|
||||
d_1_to_1(datafile_yArray, tactilefadef_deArray_nice);
|
||||
for (i=1; i<=tactilefadef_na_nice; i++)
|
||||
tactilefadef_aArray_nice[i] = datafile_xArray[1][i];
|
||||
}
|
||||
tactilefadef_first=false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case tactile_pitch_flag:
|
||||
{
|
||||
tactile_pitch = 1;
|
||||
break;
|
||||
}
|
||||
case demo_tactile_flag:
|
||||
{
|
||||
demo_tactile = true;
|
||||
demo_tactile_file = aircraft_directory + linetoken3;
|
||||
token4 >> token_value_convert1;
|
||||
token5 >> token_value_convert2;
|
||||
convert_y = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
uiuc_1DdataFileReader(demo_tactile_file,
|
||||
demo_tactile_timeArray,
|
||||
demo_tactile_daArray,
|
||||
demo_tactile_ntime);
|
||||
token6 >> token_value;
|
||||
demo_tactile_startTime = token_value;
|
||||
break;
|
||||
}
|
||||
case demo_ice_tail_flag:
|
||||
{
|
||||
demo_ice_tail = true;
|
||||
demo_ice_tail_file = aircraft_directory + linetoken3;
|
||||
token4 >> token_value_convert1;
|
||||
token5 >> token_value_convert2;
|
||||
convert_y = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
uiuc_1DdataFileReader(demo_ice_tail_file,
|
||||
demo_ice_tail_timeArray,
|
||||
demo_ice_tail_daArray,
|
||||
demo_ice_tail_ntime);
|
||||
token6 >> token_value;
|
||||
demo_ice_tail_startTime = token_value;
|
||||
break;
|
||||
}
|
||||
case demo_ice_left_flag:
|
||||
{
|
||||
demo_ice_left = true;
|
||||
demo_ice_left_file = aircraft_directory + linetoken3;
|
||||
token4 >> token_value_convert1;
|
||||
token5 >> token_value_convert2;
|
||||
convert_y = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
uiuc_1DdataFileReader(demo_ice_left_file,
|
||||
demo_ice_left_timeArray,
|
||||
demo_ice_left_daArray,
|
||||
demo_ice_left_ntime);
|
||||
token6 >> token_value;
|
||||
demo_ice_left_startTime = token_value;
|
||||
break;
|
||||
}
|
||||
case demo_ice_right_flag:
|
||||
{
|
||||
demo_ice_right = true;
|
||||
demo_ice_right_file = aircraft_directory + linetoken3;
|
||||
token4 >> token_value_convert1;
|
||||
token5 >> token_value_convert2;
|
||||
convert_y = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
uiuc_1DdataFileReader(demo_ice_right_file,
|
||||
demo_ice_right_timeArray,
|
||||
demo_ice_right_daArray,
|
||||
demo_ice_right_ntime);
|
||||
token6 >> token_value;
|
||||
demo_ice_right_startTime = token_value;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
if (dont_ignore)
|
||||
|
@ -6574,7 +7082,129 @@ void parse_record( const string& linetoken2, LIST command_line ) {
|
|||
recordParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
|
||||
case eta_wing_left_record:
|
||||
{
|
||||
recordParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case eta_wing_right_record:
|
||||
{
|
||||
recordParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case eta_tail_record:
|
||||
{
|
||||
recordParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case delta_CL_record:
|
||||
{
|
||||
recordParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case delta_CD_record:
|
||||
{
|
||||
recordParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case delta_Cm_record:
|
||||
{
|
||||
recordParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case delta_Cl_record:
|
||||
{
|
||||
recordParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case boot_cycle_tail_record:
|
||||
{
|
||||
recordParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case boot_cycle_wing_left_record:
|
||||
{
|
||||
recordParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case boot_cycle_wing_right_record:
|
||||
{
|
||||
recordParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case autoIPS_tail_record:
|
||||
{
|
||||
recordParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case autoIPS_wing_left_record:
|
||||
{
|
||||
recordParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case autoIPS_wing_right_record:
|
||||
{
|
||||
recordParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case eps_pitch_input_record:
|
||||
{
|
||||
recordParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case eps_alpha_max_record:
|
||||
{
|
||||
recordParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case eps_pitch_max_record:
|
||||
{
|
||||
recordParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case eps_pitch_min_record:
|
||||
{
|
||||
recordParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case eps_roll_max_record:
|
||||
{
|
||||
recordParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case eps_thrust_min_record:
|
||||
{
|
||||
recordParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case eps_flap_max_record:
|
||||
{
|
||||
recordParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case eps_airspeed_max_record:
|
||||
{
|
||||
recordParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case eps_airspeed_min_record:
|
||||
{
|
||||
recordParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
|
||||
/*********************Auto Pilot************************/
|
||||
case ap_Theta_ref_deg_record:
|
||||
{
|
||||
recordParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case ap_pah_on_record:
|
||||
{
|
||||
recordParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
|
||||
/************************ Forces ***********************/
|
||||
case F_X_wind_record:
|
||||
{
|
||||
|
@ -6729,7 +7359,7 @@ void parse_record( const string& linetoken2, LIST command_line ) {
|
|||
break;
|
||||
}
|
||||
/****************** Flapper Data ***********************/
|
||||
/* case flapper_freq_record:
|
||||
case flapper_freq_record:
|
||||
{
|
||||
recordParts -> storeCommands (*command_line);
|
||||
break;
|
||||
|
@ -6763,7 +7393,7 @@ void parse_record( const string& linetoken2, LIST command_line ) {
|
|||
{
|
||||
recordParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}*/
|
||||
}
|
||||
/****************** Flapper Data ***********************/
|
||||
case debug1_record:
|
||||
{
|
||||
|
@ -6780,6 +7410,11 @@ void parse_record( const string& linetoken2, LIST command_line ) {
|
|||
recordParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case tactilefadefI_record:
|
||||
{
|
||||
recordParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
if (dont_ignore)
|
||||
|
@ -6820,25 +7455,25 @@ void parse_misc( const string& linetoken2, const string& linetoken3,
|
|||
dfTimefdf_ndf);
|
||||
break;
|
||||
}
|
||||
/*case flapper_flag:
|
||||
{
|
||||
string flap_file;
|
||||
|
||||
flap_file = aircraft_directory + "flap.dat";
|
||||
flapper_model = true;
|
||||
flapper_data = new FlapData(flap_file.c_str());
|
||||
break;
|
||||
}
|
||||
case flapper_phi_init_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
flapper_phi_init = token_value*DEG_TO_RAD;
|
||||
break;
|
||||
}*/
|
||||
//case flapper_flag:
|
||||
// {
|
||||
//string flap_file;
|
||||
//
|
||||
//flap_file = aircraft_directory + "flap.dat";
|
||||
//flapper_model = true;
|
||||
//flapper_data = new FlapData(flap_file.c_str());
|
||||
//break;
|
||||
// }
|
||||
//case flapper_phi_init_flag:
|
||||
// {
|
||||
//if (check_float(linetoken3))
|
||||
// token3 >> token_value;
|
||||
//else
|
||||
// uiuc_warnings_errors(1, *command_line);
|
||||
//
|
||||
//flapper_phi_init = token_value*DEG_TO_RAD;
|
||||
//break;
|
||||
// }
|
||||
default:
|
||||
{
|
||||
if (dont_ignore)
|
||||
|
@ -6896,6 +7531,8 @@ void uiuc_menu( string aircraft_name )
|
|||
bool Cnfapf_first = true;
|
||||
bool Cnfarf_first = true;
|
||||
|
||||
bool tactilefadef_first = true;
|
||||
|
||||
/* the following default setting should eventually be moved to a default or uiuc_init routine */
|
||||
|
||||
recordRate = 1; /* record every time step, default */
|
||||
|
@ -6963,7 +7600,7 @@ void uiuc_menu( string aircraft_name )
|
|||
{
|
||||
case init_flag:
|
||||
{
|
||||
parse_init( linetoken2, linetoken3, command_line );
|
||||
parse_init( linetoken2, linetoken3, linetoken4, command_line );
|
||||
break;
|
||||
} // end init map
|
||||
|
||||
|
@ -7084,7 +7721,9 @@ void uiuc_menu( string aircraft_name )
|
|||
case ice_flag:
|
||||
{
|
||||
parse_ice( linetoken2, linetoken3, linetoken4,
|
||||
command_line );
|
||||
linetoken5, linetoken6, linetoken7,
|
||||
linetoken8, linetoken9, aircraft_directory,
|
||||
tactilefadef_first, command_line );
|
||||
break;
|
||||
} // end ice map
|
||||
|
||||
|
|
98
src/FDM/UIUCModel/uiuc_pah_ap.cpp
Normal file
98
src/FDM/UIUCModel/uiuc_pah_ap.cpp
Normal file
|
@ -0,0 +1,98 @@
|
|||
// * *
|
||||
// * pah_ap.C *
|
||||
// * *
|
||||
// * Pah autopilot function. takes in the state *
|
||||
// * variables and reference angle as arguments *
|
||||
// * (there are other variable too as arguments *
|
||||
// * as listed below) *
|
||||
// * and returns the elevator deflection angle at *
|
||||
// * every time step. *
|
||||
// * *
|
||||
// * Written 2/11/02 by Vikrant Sharma *
|
||||
// * *
|
||||
// *****************************************************
|
||||
|
||||
//#include <iostream.h>
|
||||
//#include <stddef.h>
|
||||
|
||||
// define u2prev,x1prev,x2prev and x3prev in the main function
|
||||
// that uses this autopilot function. give them initial values at origin.
|
||||
// Pass these values to the A/P function as an argument and pass by
|
||||
// reference
|
||||
// Parameters passed as arguments to the function:
|
||||
// pitch - Current pitch angle
|
||||
// pitchrate - current rate of change of pitch angle
|
||||
// pitch_ref - reference pitch angle to be tracked
|
||||
// sample_t - sampling time
|
||||
// V - aircraft's current velocity
|
||||
// u2prev - u2 value at the previous time step.
|
||||
// x1prev - x1 ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
// x2prev - x2 ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
// x3prev - x3 ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
// the autpilot function (pah_ap) changes these values at every time step.
|
||||
// so the simulator guys don't have to do it. Since these values are
|
||||
// passed by reference to the function.
|
||||
|
||||
// (RD) Units for the variables
|
||||
// pitch = radians
|
||||
// pitchrate = rad/s
|
||||
// pitch_ref = rad
|
||||
// sample_t = seconds
|
||||
// V = m/s
|
||||
|
||||
// (RD) changed from float to double
|
||||
|
||||
#include "uiuc_pah_ap.h"
|
||||
|
||||
double pah_ap(double pitch, double pitchrate, double pitch_ref, double V,
|
||||
double sample_t)
|
||||
{
|
||||
// changes by RD so function keeps previous values
|
||||
static double u2prev;
|
||||
static double x1prev;
|
||||
static double x2prev;
|
||||
static double x3prev;
|
||||
static int init = 0;
|
||||
|
||||
if (init==0)
|
||||
{
|
||||
init = -1;
|
||||
u2prev = 0;
|
||||
x1prev = 0;
|
||||
x2prev = 0;
|
||||
x3prev = 0;
|
||||
}
|
||||
// end changes
|
||||
|
||||
double Ki;
|
||||
double Ktheta;
|
||||
double Kq;
|
||||
double deltae;
|
||||
double x1, x2, x3;
|
||||
Ktheta = -0.0004*V*V + 0.0479*V - 2.409;
|
||||
Kq = -0.0005*V*V + 0.054*V - 1.5931;
|
||||
Ki = 0.5;
|
||||
double u1,u2,u3;
|
||||
u1 = Ktheta*(pitch_ref-pitch);
|
||||
u2 = u2prev + Ki*Ktheta*(pitch_ref-pitch)*sample_t;
|
||||
u3 = Kq*pitchrate;
|
||||
double totalU;
|
||||
totalU = u1 + u2 - u3;
|
||||
u2prev = u2;
|
||||
// the following is using the actuator dynamics given in Beaver.
|
||||
// the actuator dynamics for Twin Otter are still unavailable.
|
||||
x1 = x1prev +(-10.951*x1prev + 7.2721*x2prev + 20.7985*x3prev +
|
||||
25.1568*totalU)*sample_t;
|
||||
x2 = x2prev + x3prev*sample_t;
|
||||
x3 = x3prev + (7.3446*x1prev - 668.6713*x2prev - 16.8697*x3prev +
|
||||
5.8694*totalU)*sample_t;
|
||||
deltae = 57.2958*x2;
|
||||
x1prev = x1;
|
||||
x2prev = x2;
|
||||
x3prev = x3;
|
||||
return deltae;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
8
src/FDM/UIUCModel/uiuc_pah_ap.h
Normal file
8
src/FDM/UIUCModel/uiuc_pah_ap.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
|
||||
#ifndef _PAH_AP_H_
|
||||
#define _PAH_AP_H_
|
||||
|
||||
double pah_ap(double pitch, double pitchrate, double pitch_ref, double V,
|
||||
double sample_t);
|
||||
|
||||
#endif //_PAH_AP_H_
|
|
@ -17,11 +17,13 @@
|
|||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
HISTORY: 01/30/2000 initial release
|
||||
HISTORY: 01/30/2000 (BS) initial release
|
||||
09/19/2002 (MSS) appended zeros to lines w/ comments
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
AUTHOR(S): Bipin Sehgal <bsehgal@uiuc.edu>
|
||||
Michael Selig
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
|
@ -85,9 +87,16 @@ void ParseFile :: removeComments(string& inputLine)
|
|||
if (pos != inputLine.npos) // a "#" exists in the line
|
||||
{
|
||||
if (inputLine.find_first_not_of(DELIMITERS) == pos)
|
||||
inputLine = ""; // Complete line a comment
|
||||
{
|
||||
inputLine = ""; // Complete line a comment
|
||||
}
|
||||
else
|
||||
inputLine = inputLine.substr(0,pos); //Truncate the comment from the line
|
||||
{
|
||||
inputLine = inputLine.substr(0,pos); //Truncate the comment from the line
|
||||
// append zeros to the input line after stripping off the comments
|
||||
// mss added from Bipin email of 9/3/02
|
||||
// inputLine += " 0 0 0 0 0 0";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -139,18 +148,37 @@ void ParseFile :: storeCommands(string inputLine)
|
|||
commands.push_back(line);
|
||||
}
|
||||
|
||||
// void ParseFile :: readFile()
|
||||
// {
|
||||
// string line;
|
||||
|
||||
// while (getline(file , line))
|
||||
// {
|
||||
// removeComments(line);
|
||||
// if (line.find_first_not_of(DELIMITERS) != line.npos) // strip off blank lines
|
||||
// {
|
||||
// line += " 0 0 0 0 0";
|
||||
// storeCommands(line);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
void ParseFile :: readFile()
|
||||
{
|
||||
string line;
|
||||
|
||||
while (getline(file , line))
|
||||
{
|
||||
removeComments(line);
|
||||
if (line.find_first_not_of(DELIMITERS) != line.npos) // strip off blank lines
|
||||
storeCommands(line);
|
||||
}
|
||||
{
|
||||
removeComments(line);
|
||||
if (line.find_first_not_of(DELIMITERS) != line.npos) // strip off blank lines
|
||||
{
|
||||
line += " ";
|
||||
// append some zeros, but this is doing something strange!
|
||||
// line += " 0 0 0 0 0 ";
|
||||
storeCommands(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stack ParseFile :: getCommands()
|
||||
{
|
||||
return commands;
|
||||
|
|
|
@ -17,7 +17,7 @@ SG_USING_STD(ifstream);
|
|||
#define DELIMITERS " \t"
|
||||
#define COMMENT "#"
|
||||
|
||||
#define MAXLINE 200 // Max size of the line of the input file
|
||||
#define MAXLINE 400 // Max size of the line of the input file
|
||||
|
||||
typedef list<string> stack; //list to contain the input file "command_lines"
|
||||
|
||||
|
|
|
@ -1683,7 +1683,139 @@ void uiuc_recorder( double dt )
|
|||
{
|
||||
fout << eta_ice << " ";
|
||||
break;
|
||||
}
|
||||
}
|
||||
case eta_wing_left_record:
|
||||
{
|
||||
fout << eta_wing_left << " ";
|
||||
break;
|
||||
}
|
||||
case eta_wing_right_record:
|
||||
{
|
||||
fout << eta_wing_right << " ";
|
||||
break;
|
||||
}
|
||||
case eta_tail_record:
|
||||
{
|
||||
fout << eta_tail << " ";
|
||||
break;
|
||||
}
|
||||
case delta_CL_record:
|
||||
{
|
||||
fout << delta_CL << " ";
|
||||
break;
|
||||
}
|
||||
case delta_CD_record:
|
||||
{
|
||||
fout << delta_CD << " ";
|
||||
break;
|
||||
}
|
||||
case delta_Cm_record:
|
||||
{
|
||||
fout << delta_Cm << " ";
|
||||
break;
|
||||
}
|
||||
case delta_Cl_record:
|
||||
{
|
||||
fout << delta_Cl << " ";
|
||||
break;
|
||||
}
|
||||
case delta_Cn_record:
|
||||
{
|
||||
fout << delta_Cn << " ";
|
||||
break;
|
||||
}
|
||||
case boot_cycle_tail_record:
|
||||
{
|
||||
fout << boot_cycle_tail << " ";
|
||||
break;
|
||||
}
|
||||
case boot_cycle_wing_left_record:
|
||||
{
|
||||
fout << boot_cycle_wing_left << " ";
|
||||
break;
|
||||
}
|
||||
case boot_cycle_wing_right_record:
|
||||
{
|
||||
fout << boot_cycle_wing_right << " ";
|
||||
break;
|
||||
}
|
||||
case autoIPS_tail_record:
|
||||
{
|
||||
fout << autoIPS_tail << " ";
|
||||
break;
|
||||
}
|
||||
case autoIPS_wing_left_record:
|
||||
{
|
||||
fout << autoIPS_wing_left << " ";
|
||||
break;
|
||||
}
|
||||
case autoIPS_wing_right_record:
|
||||
{
|
||||
fout << autoIPS_wing_right << " ";
|
||||
break;
|
||||
}
|
||||
case eps_pitch_input_record:
|
||||
{
|
||||
fout << eps_pitch_input << " ";
|
||||
break;
|
||||
}
|
||||
case eps_alpha_max_record:
|
||||
{
|
||||
fout << eps_alpha_max << " ";
|
||||
break;
|
||||
}
|
||||
case eps_pitch_max_record:
|
||||
{
|
||||
fout << eps_pitch_max << " ";
|
||||
break;
|
||||
}
|
||||
case eps_pitch_min_record:
|
||||
{
|
||||
fout << eps_pitch_min << " ";
|
||||
break;
|
||||
}
|
||||
case eps_roll_max_record:
|
||||
{
|
||||
fout << eps_roll_max << " ";
|
||||
break;
|
||||
}
|
||||
case eps_thrust_min_record:
|
||||
{
|
||||
fout << eps_thrust_min << " ";
|
||||
break;
|
||||
}
|
||||
case eps_flap_max_record:
|
||||
{
|
||||
fout << eps_flap_max << " ";
|
||||
break;
|
||||
}
|
||||
case eps_airspeed_max_record:
|
||||
{
|
||||
fout << eps_airspeed_max << " ";
|
||||
break;
|
||||
}
|
||||
case eps_airspeed_min_record:
|
||||
{
|
||||
fout << eps_airspeed_min << " ";
|
||||
break;
|
||||
}
|
||||
case tactilefadefI_record:
|
||||
{
|
||||
fout << tactilefadefI << " ";
|
||||
break;
|
||||
}
|
||||
|
||||
/*******************Autopilot***************************/
|
||||
case ap_Theta_ref_deg_record:
|
||||
{
|
||||
fout << ap_Theta_ref_deg << " ";
|
||||
break;
|
||||
}
|
||||
case ap_pah_on_record:
|
||||
{
|
||||
fout << ap_pah_on << " ";
|
||||
break;
|
||||
}
|
||||
|
||||
/************************ Forces ***********************/
|
||||
case F_X_wind_record:
|
||||
|
@ -1840,55 +1972,62 @@ void uiuc_recorder( double dt )
|
|||
}
|
||||
|
||||
/*********************** 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;
|
||||
}*/
|
||||
//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;
|
||||
// }
|
||||
/*********************** debug ***********************/
|
||||
/* debug variables for use in probing data */
|
||||
/* comment out old lines, and add new */
|
||||
/* only remove code that you have written */
|
||||
case debug1_record:
|
||||
{
|
||||
// eta_q term check
|
||||
// fout << eta_q_Cm_q_fac << " ";
|
||||
// fout << eta_q_Cm_adot_fac << " ";
|
||||
// fout << eta_q_Cmfade_fac << " ";
|
||||
// fout << eta_q_Cl_dr_fac << " ";
|
||||
// eta on tail
|
||||
// fout << eta_q << " ";
|
||||
// fout << tc << " ";
|
||||
// engine RPM
|
||||
// fout << engineOmega * 60 / (2 * LS_PI)<< " ";
|
||||
// climb rate in fpm
|
||||
//fout << V_down * 60 << " ";
|
||||
// vertical climb rate in fpm
|
||||
// fout << V_down * 60 << " ";
|
||||
// w_induced downwash at tail due to wing
|
||||
fout << w_induced << " ";
|
||||
//fout << w_induced << " ";
|
||||
// w_induced downwash at tail due to wing
|
||||
fout << gammaWing << " ";
|
||||
break;
|
||||
}
|
||||
case debug2_record:
|
||||
|
@ -1899,9 +2038,10 @@ void uiuc_recorder( double dt )
|
|||
// fout << (-A_Z_cg/32.174) << " ";
|
||||
// gyroscopic moment (see uiuc_wrapper.cpp)
|
||||
// fout << (polarInertia * engineOmega * Q_body) << " ";
|
||||
// downwash_angle at tail
|
||||
fout << downwash_angle * 57.29 << " ";
|
||||
|
||||
// downwashAngle at tail
|
||||
fout << downwashAngle * 57.29 << " ";
|
||||
// w_induced from engine
|
||||
// fout << w_i << " ";
|
||||
break;
|
||||
}
|
||||
case debug3_record:
|
||||
|
@ -1911,8 +2051,10 @@ void uiuc_recorder( double dt )
|
|||
// gyroscopic moment (see uiuc_wrapper.cpp)
|
||||
// fout << (-polarInertia * engineOmega * R_body) << " ";
|
||||
// AlphaTail
|
||||
fout << AlphaTail * 57.29 << " ";
|
||||
fout << Alpha * 57.29 << " ";
|
||||
// fout << AlphaTail * 57.29 << " ";
|
||||
// fout << Alpha * 57.29 << " ";
|
||||
// eta on tail
|
||||
fout << eta_q << " ";
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -75,6 +75,7 @@ for information.
|
|||
|
||||
**********************************************************************/
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "uiuc_warnings_errors.h"
|
||||
|
||||
|
@ -92,13 +93,25 @@ void uiuc_warnings_errors(int errorCode, string line)
|
|||
switch (errorCode)
|
||||
{
|
||||
case 1:
|
||||
cerr << "UIUC ERROR: The value of the coefficient in \"" << line << "\" should be of type float" << endl;
|
||||
exit(-1);
|
||||
break;
|
||||
cerr << "UIUC ERROR 1: The value of the coefficient in \"" << line << "\" should be of type float" << endl;
|
||||
exit(-1);
|
||||
break;
|
||||
case 2:
|
||||
cerr << "UIUC ERROR: Unknown identifier in \"" << line << "\"" << endl;
|
||||
exit(-1);
|
||||
break;
|
||||
cerr << "UIUC ERROR 2: Unknown identifier in \"" << line << "\" (check uiuc_maps_*.cpp)" << endl;
|
||||
exit(-1);
|
||||
break;
|
||||
case 3:
|
||||
cerr << "UIUC ERROR 3: Slipstream effects only work w/ the engine simpleSingleModel line: \"" << line << endl;
|
||||
exit(-1);
|
||||
break;
|
||||
case 4:
|
||||
cerr << "UIUC ERROR 4: Downwash mode does not exist: \"" << line << endl;
|
||||
exit(-1);
|
||||
break;
|
||||
case 5:
|
||||
cerr << "UIUC ERROR 5: Must use dyn_on_speed not equal to zero: \"" << line << endl;
|
||||
exit(-1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -309,6 +309,7 @@ void uiuc_record_routine(double dt)
|
|||
|
||||
//void uiuc_network_routine()
|
||||
//{
|
||||
// uiuc_network();
|
||||
// if (use_uiuc_network)
|
||||
// uiuc_network(2); //send data
|
||||
//}
|
||||
//end uiuc_wrapper.cpp
|
||||
|
|
Loading…
Add table
Reference in a new issue