1
0
Fork 0

/FDM/UIUCModel/uiuc_aircraft.h

Added variables necessary for new abilities.
/FDM/UIUCModel/uiuc_coefficients.cpp
/FDM/UIUCModel/uiuc_coefficients.h
/FDM/UIUCModel/uiuc_coef_lift.cpp
	Added CZfa.
/FDM/UIUCModel/uiuc_controlInput.cpp
	Added aileron and rudder inputs.
/FDM/UIUCModel/uiuc_engine.cpp
	Added throttle input.
/FDM/UIUCModel/uiuc_engine.h
/FDM/UIUCModel/uiuc_map_CL.cpp
/FDM/UIUCModel/uiuc_map_engine.cpp
/FDM/UIUCModel/uiuc_map_init.cpp
/FDM/UIUCModel/uiuc_menu.cpp
/FDM/UIUCModel/uiuc_wrapper.cpp
	Added a few new functions.
/FDM/UIUCModel/uiuc_wrapper.h
/FDM/UIUCModel/uiuc_map_controlSurface.cpp
/FDM/UIUCModel/uiuc_initializemaps.cpp
/FDM/UIUCModel/uiuc_initializemaps.h
/FDM/UIUCModel/uiuc_map_keyword.cpp
/FDM/UIUCModel/Makefile.am
/Main/Makefile.am

added files
/FDM/UIUCModel/uiuc_map_fog.cpp
	For the visibility ability.
/FDM/UIUCModel/uiuc_map_fog.h
/FDM/UIUCModel/uiuc_fog.cpp
/FDM/UIUCModel/uiuc_fog.h
This commit is contained in:
curt 2001-09-14 20:36:34 +00:00
parent 9385f607bc
commit 19e7e93787
22 changed files with 938 additions and 22 deletions

View file

@ -20,7 +20,8 @@ libUIUCModel_a_SOURCES = \
uiuc_controlInput.cpp uiuc_controlInput.h \
uiuc_convert.cpp uiuc_convert.h \
uiuc_engine.cpp uiuc_engine.h \
uiuc_gear.cpp uiuc_gear.h \
uiuc_fog.cpp uiuc_fog.h \
uiuc_gear.cpp uiuc_gear.h\
uiuc_ice.cpp uiuc_ice.h \
uiuc_initializemaps.cpp uiuc_initializemaps.h \
uiuc_map_CD.cpp uiuc_map_CD.h \
@ -31,6 +32,7 @@ libUIUCModel_a_SOURCES = \
uiuc_map_Croll.cpp uiuc_map_Croll.h \
uiuc_map_controlSurface.cpp uiuc_map_controlSurface.h \
uiuc_map_engine.cpp uiuc_map_engine.h \
uiuc_map_fog.cpp uiuc_map_fog.h \
uiuc_map_geometry.cpp uiuc_map_geometry.h \
uiuc_map_ice.cpp uiuc_map_ice.h \
uiuc_map_gear.cpp uiuc_map_gear.h \

View file

@ -37,11 +37,27 @@
04/01/2000 (JS) added throttle, longitudinal, lateral,
and rudder inputs to record map
03/09/2001 (DPM) added support for gear
06/18/2001 (RD) added variables needed for aileron,
rudder, and throttle_pct input files.
Added Alpha, Beta, U_body, V_body, and
W_body to init map. Added variables
needed to ignore elevator, aileron, and
rudder pilot inputs. Added CZ as a function
of alpha, CZfa. Added twinotter to engine
group.
07/05/2001 (RD) added pilot_elev_no_check, pilot_ail_no
_check, and pilot_rud_no_check variables.
This allows pilot to fly aircraft after the
input files have been used.
08/27/2001 (RD) Added xxx_init_true and xxx_init for
P_body, Q_body, R_body, Phi, Theta, Psi,
U_body, V_body, and W_body to help in
starting the A/C at an initial condition.
----------------------------------------------------------------------
AUTHOR(S): Bipin Sehgal <bsehgal@uiuc.edu>
Jeff Scott <jscott@mail.com>
Robert Deters <rdeters@uiuc.edu>
David Megginson <david@megginson.com>
----------------------------------------------------------------------
@ -119,7 +135,7 @@ typedef stack :: iterator LIST;
/* Add more keywords here if required*/
enum {init_flag = 1000, geometry_flag, controlSurface_flag, controlsMixer_flag,
mass_flag, engine_flag, CD_flag, CL_flag, Cm_flag, CY_flag, Cl_flag,
Cn_flag, gear_flag, ice_flag, record_flag, misc_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,
@ -128,7 +144,8 @@ enum {Dx_pilot_flag = 2000, Dy_pilot_flag, Dz_pilot_flag,
P_body_flag, Q_body_flag, R_body_flag,
Phi_flag, Theta_flag, Psi_flag,
Long_trim_flag, recordRate_flag, recordStartTime_flag,
nondim_rate_V_rel_wind_flag, dyn_on_speed_flag};
nondim_rate_V_rel_wind_flag, dyn_on_speed_flag, Alpha_flag,
Beta_flag, U_body_flag, V_body_flag, W_body_flag};
// geometry === Aircraft-specific geometric quantities
enum {bw_flag = 3000, cbar_flag, Sw_flag, ih_flag, bh_flag, ch_flag, Sh_flag};
@ -136,7 +153,7 @@ enum {bw_flag = 3000, cbar_flag, Sw_flag, ih_flag, bh_flag, ch_flag, Sh_flag};
// controlSurface = Control surface deflections and properties
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};
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};
// controlsMixer == Controls mixer
enum {nomix_flag = 5000};
@ -145,7 +162,7 @@ enum {nomix_flag = 5000};
enum {Weight_flag = 6000, Mass_flag, I_xx_flag, I_yy_flag, I_zz_flag, I_xz_flag};
// engine ===== Propulsion data
enum {simpleSingle_flag = 7000, c172_flag, cherokee_flag};
enum {simpleSingle_flag = 7000, c172_flag, cherokee_flag, Throttle_pct_input_flag};
// CD ========= Aerodynamic x-force quantities (longitudinal)
enum {CDo_flag = 8000, CDK_flag, CD_a_flag, CD_adot_flag, CD_q_flag, CD_ih_flag, CD_de_flag,
@ -157,7 +174,7 @@ enum {CDo_flag = 8000, CDK_flag, CD_a_flag, CD_adot_flag, CD_q_flag, CD_ih_flag,
enum {CLo_flag = 9000, CL_a_flag, CL_adot_flag, CL_q_flag, CL_ih_flag, CL_de_flag,
CLfa_flag, CLfade_flag, CLfdf_flag, CLfadf_flag,
CZo_flag, CZ_a_flag, CZ_a2_flag, CZ_a3_flag, CZ_adot_flag,
CZ_q_flag, CZ_de_flag, CZ_deb2_flag, CZ_df_flag, CZ_adf_flag};
CZ_q_flag, CZ_de_flag, CZ_deb2_flag, CZ_df_flag, CZ_adf_flag, CZfa_flag};
// Cm ========= Aerodynamic m-moment quantities (longitudinal)
enum {Cmo_flag = 10000, Cm_a_flag, Cm_a2_flag, Cm_adot_flag, Cm_q_flag,
@ -297,8 +314,12 @@ enum {Simtime_record = 16000, dt_record,
// misc ======= Miscellaneous inputs
enum {simpleHingeMomentCoef_flag = 17000, dfTimefdf_flag};
//321654
// fog ======== Fog field quantities
enum {fog_segments_flag = 18000, fog_point_flag};
typedef struct
//321654
struct AIRCRAFT
{
// ParseFile stuff [] Bipin to add more comments
ParseFile *airplane;
@ -375,6 +396,50 @@ typedef struct
#define nondim_rate_V_rel_wind aircraft_->nondim_rate_V_rel_wind
double dyn_on_speed;
#define dyn_on_speed aircraft_->dyn_on_speed
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
bool Q_body_init_true;
double Q_body_init;
#define Q_body_init_true aircraft_->Q_body_init_true
#define Q_body_init aircraft_->Q_body_init
bool R_body_init_true;
double R_body_init;
#define R_body_init_true aircraft_->R_body_init_true
#define R_body_init aircraft_->R_body_init
bool Phi_init_true;
double Phi_init;
#define Phi_init_true aircraft_->Phi_init_true
#define Phi_init aircraft_->Phi_init
bool Theta_init_true;
double Theta_init;
#define Theta_init_true aircraft_->Theta_init_true
#define Theta_init aircraft_->Theta_init
bool Psi_init_true;
double Psi_init;
#define Psi_init_true aircraft_->Psi_init_true
#define Psi_init aircraft_->Psi_init
bool Alpha_init_true;
double Alpha_init;
#define Alpha_init_true aircraft_->Alpha_init_true
#define Alpha_init aircraft_->Alpha_init
bool Beta_init_true;
double Beta_init;
#define Beta_init_true aircraft_->Beta_init_true
#define Beta_init aircraft_->Beta_init
bool U_body_init_true;
double U_body_init;
#define U_body_init_true aircraft_->U_body_init_true
#define U_body_init aircraft_->U_body_init
bool V_body_init_true;
double V_body_init;
#define V_body_init_true aircraft_->V_body_init_true
#define V_body_init aircraft_->V_body_init
bool W_body_init_true;
double W_body_init;
#define W_body_init_true aircraft_->W_body_init_true
#define W_body_init aircraft_->W_body_init
/* Variables (token2) ===========================================*/
@ -457,6 +522,47 @@ typedef struct
#define elevator_input_ntime aircraft_->elevator_input_ntime
#define elevator_input_startTime aircraft_->elevator_input_startTime
bool aileron_input;
string aileron_input_file;
double aileron_input_timeArray[1000];
double aileron_input_daArray[1000];
int aileron_input_ntime;
double aileron_input_startTime;
#define aileron_input aircraft_->aileron_input
#define aileron_input_file aircraft_->aileron_input_file
#define aileron_input_timeArray aircraft_->aileron_input_timeArray
#define aileron_input_daArray aircraft_->aileron_input_daArray
#define aileron_input_ntime aircraft_->aileron_input_ntime
#define aileron_input_startTime aircraft_->aileron_input_startTime
bool rudder_input;
string rudder_input_file;
double rudder_input_timeArray[1000];
double rudder_input_drArray[1000];
int rudder_input_ntime;
double rudder_input_startTime;
#define rudder_input aircraft_->rudder_input
#define rudder_input_file aircraft_->rudder_input_file
#define rudder_input_timeArray aircraft_->rudder_input_timeArray
#define rudder_input_drArray aircraft_->rudder_input_drArray
#define rudder_input_ntime aircraft_->rudder_input_ntime
#define rudder_input_startTime aircraft_->rudder_input_startTime
bool pilot_elev_no;
#define pilot_elev_no aircraft_->pilot_elev_no
bool pilot_elev_no_check;
#define pilot_elev_no_check aircraft_->pilot_elev_no_check
bool pilot_ail_no;
#define pilot_ail_no aircraft_->pilot_ail_no
bool pilot_ail_no_check;
#define pilot_ail_no_check aircraft_->pilot_ail_no_check
bool pilot_rud_no;
#define pilot_rud_no aircraft_->pilot_rud_no
bool pilot_rud_no_check;
#define pilot_rud_no_check aircraft_->pilot_rud_no_check
/* Variables (token2) ===========================================*/
/* controlsMixer = Control mixer ================================*/
@ -487,6 +593,19 @@ typedef struct
double simpleSingleMaxThrust;
#define simpleSingleMaxThrust aircraft_->simpleSingleMaxThrust
bool Throttle_pct_input;
string Throttle_pct_input_file;
double Throttle_pct_input_timeArray[1000];
double Throttle_pct_input_dTArray[1000];
int Throttle_pct_input_ntime;
double Throttle_pct_input_startTime;
#define Throttle_pct_input aircraft_->Throttle_pct_input
#define Throttle_pct_input_file aircraft_->Throttle_pct_input_file
#define Throttle_pct_input_timeArray aircraft_->Throttle_pct_input_timeArray
#define Throttle_pct_input_dTArray aircraft_->Throttle_pct_input_dTArray
#define Throttle_pct_input_ntime aircraft_->Throttle_pct_input_ntime
#define Throttle_pct_input_startTime aircraft_->Throttle_pct_input_startTime
/* Variables (token2) ===========================================*/
/* CD ============ Aerodynamic x-force quantities (longitudinal) */
@ -648,6 +767,16 @@ typedef struct
#define CZ_deb2 aircraft_->CZ_deb2
#define CZ_df aircraft_->CZ_df
#define CZ_adf aircraft_->CZ_adf
string CZfa;
double CZfa_aArray[100];
double CZfa_CZArray[100];
int CZfa_nAlpha;
double CZfaI;
#define CZfa aircraft_->CZfa
#define CZfa_aArray aircraft_->CZfa_aArray
#define CZfa_CZArray aircraft_->CZfa_CZArray
#define CZfa_nAlpha aircraft_->CZfa_nAlpha
#define CZfaI aircraft_->CZfaI
/* Variables (token2) ===========================================*/
@ -1048,6 +1177,47 @@ typedef struct
#define Cn_b3_clean aircraft_->Cn_b3_clean
//321654
/* Variables (token2) ===========================================*/
/* fog =========== Fog field quantities ======================== */
map <string,int> fog_map;
#define fog_map aircraft_->fog_map
bool fog_field;
int fog_segments;
int fog_point_index;
double *fog_time;
int *fog_value;
double fog_next_time;
int fog_current_segment;
int Fog;
AIRCRAFT()
{
fog_field = false;
fog_segments = 0;
fog_point_index = -1;
fog_time = NULL;
fog_value = NULL;
fog_next_time = 0.0;
fog_current_segment = 0;
Fog = 0;
};
#define fog_field aircraft_->fog_field
#define fog_segments aircraft_->fog_segments
#define fog_point_index aircraft_->fog_point_index
#define fog_time aircraft_->fog_time
#define fog_value aircraft_->fog_value
#define fog_next_time aircraft_->fog_next_time
#define fog_current_segment aircraft_->fog_current_segment
#define Fog aircraft_->Fog
/* Variables (token2) ===========================================*/
/* record ======== Record desired quantites to file =============*/
@ -1169,7 +1339,7 @@ typedef struct
#define fout aircraft_->fout
} AIRCRAFT;
};
extern AIRCRAFT *aircraft_; // usually defined in the first program that includes uiuc_aircraft.h

View file

@ -19,11 +19,13 @@
----------------------------------------------------------------------
HISTORY: 04/15/2000 initial release
06/18/2001 (RD) Added CZfa
----------------------------------------------------------------------
AUTHOR(S): Bipin Sehgal <bsehgal@uiuc.edu>
Jeff Scott <jscott@mail.com>
Robert Deters <rdeters@uiuc.edu>
----------------------------------------------------------------------
@ -387,6 +389,15 @@ void uiuc_coef_lift()
CZ += CZ_adf * Alpha * flap;
break;
}
case CZfa_flag:
{
CZfaI = uiuc_1Dinterpolation(CZfa_aArray,
CZfa_CZArray,
CZfa_nAlpha,
Alpha);
CZ += CZfaI;
break;
}
};
} // end CL map

View file

@ -28,11 +28,17 @@
Cnfada, and Cnfbetadr switches
04/15/2000 (JS) broke up into multiple
uiuc_coef_xxx functions
06/18/2001 (RD) Added initialization of Alpha and
Beta. Added aileron_input and rudder_input.
Added pilot_elev_no, pilot_ail_no, and
pilot_rud_no.
07/05/2001 (RD) Added pilot_(elev,ail,rud)_no=false
----------------------------------------------------------------------
AUTHOR(S): Bipin Sehgal <bsehgal@uiuc.edu>
Jeff Scott <jscott@mail.com>
Robert Deters <rdeters@uiuc.edu>
----------------------------------------------------------------------
@ -93,6 +99,14 @@
void uiuc_coefficients()
{
double l_trim, l_defl;
if (Alpha_init_true && Simtime==0)
Alpha = Alpha_init;
if (Beta_init_true && Simtime==0)
Beta = Beta_init;
// calculate rate derivative nondimensionalization factors
// check if speed is sufficient to compute dynamic pressure terms
if (nondim_rate_V_rel_wind) // c172_aero uses V_rel_wind
@ -132,8 +146,11 @@ void uiuc_coefficients()
uiuc_ice_eta();
}
// check to see if phugoid mode engaged
if (elevator_step || elevator_singlet || elevator_doublet || elevator_input)
// 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)
{
uiuc_controlInput();
}
@ -150,6 +167,36 @@ void uiuc_coefficients()
uiuc_coef_roll();
uiuc_coef_yaw();
if (pilot_ail_no)
{
if (aileron <=0)
Lat_control = - aileron / damax * RAD_TO_DEG;
else
Lat_control = - aileron / damin * RAD_TO_DEG;
}
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 (pilot_rud_no)
{
if (rudder <=0)
Rudder_pedal = - rudder / drmax * RAD_TO_DEG;
else
Rudder_pedal = - rudder / drmin * RAD_TO_DEG;
}
return;
}

View file

@ -10,6 +10,8 @@
#include "uiuc_coef_roll.h"
#include "uiuc_coef_yaw.h"
#include <FDM/LaRCsim/ls_generic.h>
#include <FDM/LaRCsim/ls_cockpit.h> /*Long_control,Lat_control,Rudder_pedal */
#include <FDM/LaRCsim/ls_constants.h> /* RAD_TO_DEG, DEG_TO_RAD*/
void uiuc_coefficients();

View file

@ -18,10 +18,15 @@
----------------------------------------------------------------------
HISTORY: 04/08/2000 initial release
06/18/2001 (RD) Added aileron_input and rudder_input
07/05/2001 (RD) Code added to allow the pilot to fly
aircraft after the control surface input
files have been used.
----------------------------------------------------------------------
AUTHOR(S): Jeff Scott <jscott@mail.com>
Robert Deters <rdeters@uiuc.edu>
----------------------------------------------------------------------
@ -115,6 +120,11 @@ void uiuc_controlInput()
Simtime <= (elevator_input_startTime + elevator_input_endTime))
{
double time = Simtime - elevator_input_startTime;
if (pilot_elev_no_check)
{
elevator = 0 + elevator_tab;
pilot_elev_no = true;
}
elevator = elevator +
uiuc_1Dinterpolation(elevator_input_timeArray,
elevator_input_deArray,
@ -122,6 +132,51 @@ void uiuc_controlInput()
time);
}
}
// aileron input
if (aileron_input)
{
double aileron_input_endTime = aileron_input_timeArray[aileron_input_ntime];
if (Simtime >= aileron_input_startTime &&
Simtime <= (aileron_input_startTime + aileron_input_endTime))
{
double time = Simtime - aileron_input_startTime;
if (pilot_ail_no_check)
{
aileron = 0;
if (Simtime==0) //7-25-01 (RD) Added because
pilot_ail_no = false; //segmentation fault is given
else //with FG 0.7.8
pilot_ail_no = true;
}
aileron = aileron +
uiuc_1Dinterpolation(aileron_input_timeArray,
aileron_input_daArray,
aileron_input_ntime,
time);
}
}
// rudder input
if (rudder_input)
{
double rudder_input_endTime = rudder_input_timeArray[rudder_input_ntime];
if (Simtime >= rudder_input_startTime &&
Simtime <= (rudder_input_startTime + rudder_input_endTime))
{
double time = Simtime - rudder_input_startTime;
if (pilot_rud_no_check)
{
rudder = 0;
pilot_rud_no = true;
}
rudder = rudder +
uiuc_1Dinterpolation(rudder_input_timeArray,
rudder_input_drArray,
rudder_input_ntime,
time);
}
}
return;
}

View file

@ -19,11 +19,13 @@
----------------------------------------------------------------------
HISTORY: 01/30/2000 initial release
06/18/2001 (RD) Added Throttle_pct_input.
----------------------------------------------------------------------
AUTHOR(S): Bipin Sehgal <bsehgal@uiuc.edu>
Jeff Scott <jscott@mail.com>
Robert Deters <rdeters@uiuc.edu>
Michael Selig <m-selig@uiuc.edu>
----------------------------------------------------------------------
@ -80,6 +82,20 @@ void uiuc_engine()
stack command_list;
string linetoken1;
string linetoken2;
if (Throttle_pct_input)
{
double Throttle_pct_input_endTime = Throttle_pct_input_timeArray[Throttle_pct_input_ntime];
if (Simtime >= Throttle_pct_input_startTime &&
Simtime <= (Throttle_pct_input_startTime + Throttle_pct_input_endTime))
{
double time = Simtime - Throttle_pct_input_startTime;
Throttle_pct = uiuc_1Dinterpolation(Throttle_pct_input_timeArray,
Throttle_pct_input_dTArray,
Throttle_pct_input_ntime,
time);
}
}
Throttle[3] = Throttle_pct;

View file

@ -2,8 +2,19 @@
#define _ENGINE_H_
#include "uiuc_aircraft.h"
#include "uiuc_1Dinterpolation.h"
#include <FDM/LaRCsim/ls_generic.h>
#include <FDM/LaRCsim/ls_cockpit.h>
#ifdef __cplusplus
extern "C" {
#endif
extern double Simtime;
#ifdef __cplusplus
}
#endif
void uiuc_engine();
#endif // _ENGINE_H_

View file

@ -0,0 +1,114 @@
/**********************************************************************
FILENAME: uiuc_fog.cpp
----------------------------------------------------------------------
DESCRIPTION: changes Fog variable to +/-1 or 0 using fog
parameters and Simtime
----------------------------------------------------------------------
STATUS: alpha version
----------------------------------------------------------------------
REFERENCES:
----------------------------------------------------------------------
HISTORY: 05/20/2001 initial release
----------------------------------------------------------------------
AUTHOR(S): Michael Savchenko <savchenk@uiuc.edu>
----------------------------------------------------------------------
VARIABLES:
----------------------------------------------------------------------
INPUTS: -Simtime
-Fog
-fog_field
-fog_next_time
-fog_current_segment
-fog_value
-fog_time
----------------------------------------------------------------------
OUTPUTS: -Fog
-fog_field
-fog_next_time
-fog_current_segment
----------------------------------------------------------------------
CALLED BY: uiuc_wrapper
----------------------------------------------------------------------
CALLS TO: none
----------------------------------------------------------------------
COPYRIGHT: (C) 2000 by Michael Selig
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA or view http://www.gnu.org/copyleft/gpl.html.
**********************************************************************/
#include "uiuc_fog.h"
void uiuc_fog()
{
if (Simtime >= fog_next_time)
{
if (fog_current_segment != 0)
{
if (fog_value[fog_current_segment] > fog_value[fog_current_segment-1])
Fog = 1;
else if (fog_value[fog_current_segment] < fog_value[fog_current_segment-1])
Fog = -1;
else
Fog = 0;
}
else
Fog = 0;
if (Simtime > fog_time[fog_current_segment]) {
if (fog_current_segment == fog_segments)
{
fog_field = false;
Fog = 0;
return;
}
else
fog_current_segment++; }
if (fog_value[fog_current_segment] == fog_value[fog_current_segment-1])
fog_next_time = fog_time[fog_current_segment];
else
fog_next_time += (fog_time[fog_current_segment]-fog_time[fog_current_segment-1]) / abs(fog_value[fog_current_segment]-fog_value[fog_current_segment-1]);
}
else
Fog = 0;
return;
}

View file

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

View file

@ -84,6 +84,7 @@ void uiuc_initializemaps()
uiuc_map_Croll();
uiuc_map_Cn();
uiuc_map_gear();
uiuc_map_fog();
uiuc_map_ice();
uiuc_map_record1();
uiuc_map_record2();

View file

@ -16,6 +16,7 @@
#include "uiuc_map_Cn.h"
#include "uiuc_map_ice.h"
#include "uiuc_map_gear.h"
#include "uiuc_map_fog.h"
#include "uiuc_map_record1.h"
#include "uiuc_map_record2.h"
#include "uiuc_map_record3.h"

View file

@ -17,11 +17,13 @@
----------------------------------------------------------------------
HISTORY: 04/08/2000 initial release
06/18/2001 Added CZfa
----------------------------------------------------------------------
AUTHOR(S): Bipin Sehgal <bsehgal@uiuc.edu>
Jeff Scott <jscott@mail.com>
Robert Deters <rdeters@uiuc.edu>
----------------------------------------------------------------------
@ -88,6 +90,7 @@ void uiuc_map_CL()
CL_map["CZ_deb2"] = CZ_deb2_flag ;
CL_map["CZ_df"] = CZ_df_flag ;
CL_map["CZ_adf"] = CZ_adf_flag ;
CL_map["CZfa"] = CZfa_flag ;
}
// end uiuc_map_CL.cpp

View file

@ -17,11 +17,15 @@
----------------------------------------------------------------------
HISTORY: 04/08/2000 initial release
06/18/2001 Added aileron_input, rudder_input,
pilot_elev_no, pilot_ail_no, and
pilot_rud_no
----------------------------------------------------------------------
AUTHOR(S): Bipin Sehgal <bsehgal@uiuc.edu>
Jeff Scott <jscott@mail.com>
Robert Deters <rdeters@uiuc.edu>
----------------------------------------------------------------------
@ -78,6 +82,11 @@ void uiuc_map_controlSurface()
controlSurface_map["elevator_singlet"] = elevator_singlet_flag ;
controlSurface_map["elevator_doublet"] = elevator_doublet_flag ;
controlSurface_map["elevator_input"] = elevator_input_flag ;
controlSurface_map["aileron_input"] = aileron_input_flag ;
controlSurface_map["rudder_input"] = rudder_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 ;
}
// end uiuc_map_controlSurface.cpp

View file

@ -17,11 +17,13 @@
----------------------------------------------------------------------
HISTORY: 04/08/2000 initial release
06/18/2001 (RD) Added Throttle_pct_input
----------------------------------------------------------------------
AUTHOR(S): Bipin Sehgal <bsehgal@uiuc.edu>
Jeff Scott <jscott@mail.com>
Robert Deters <rdeters@uiuc.edu>
----------------------------------------------------------------------
@ -71,6 +73,7 @@ void uiuc_map_engine()
engine_map["simpleSingle"] = simpleSingle_flag ;
engine_map["c172"] = c172_flag ;
engine_map["cherokee"] = cherokee_flag ;
engine_map["Throttle_pct_input"]= Throttle_pct_input_flag ;
}
// end uiuc_map_engine.cpp

View file

@ -0,0 +1,76 @@
/**********************************************************************
FILENAME: uiuc_map_fog.cpp
----------------------------------------------------------------------
DESCRIPTION: initializes the fog map
----------------------------------------------------------------------
STATUS: alpha version
----------------------------------------------------------------------
REFERENCES:
----------------------------------------------------------------------
HISTORY: 05/20/2001 initial release
----------------------------------------------------------------------
AUTHOR(S): Michael Savchenko <savchenk@uiuc.edu>
----------------------------------------------------------------------
VARIABLES:
----------------------------------------------------------------------
INPUTS: none
----------------------------------------------------------------------
OUTPUTS: none
----------------------------------------------------------------------
CALLED BY: uiuc_initializemaps.cpp
----------------------------------------------------------------------
CALLS TO: none
----------------------------------------------------------------------
COPYRIGHT: (C) 2000 by Michael Selig
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA or view http://www.gnu.org/copyleft/gpl.html.
**********************************************************************/
#include "uiuc_map_fog.h"
void uiuc_map_fog()
{
fog_map["fog_segments"] = fog_segments_flag ;
fog_map["fog_point"] = fog_point_flag ;
}
// end uiuc_map_fog.cpp

View file

@ -0,0 +1,10 @@
//321654
#ifndef _MAP_FOG_H_
#define _MAP_FOG_H_
#include "uiuc_aircraft.h"
void uiuc_map_fog();
#endif // _MAP_FOG_H_

View file

@ -17,11 +17,14 @@
----------------------------------------------------------------------
HISTORY: 04/08/2000 initial release
06/18/2001 (RD) Added Alpha, Beta, U_body
V_body, and W_body.
----------------------------------------------------------------------
AUTHOR(S): Bipin Sehgal <bsehgal@uiuc.edu>
Jeff Scott <jscott@mail.com>
Robert Deters <rdeters@uiuc.edu>
----------------------------------------------------------------------
@ -89,6 +92,11 @@ void uiuc_map_init()
init_map["recordStartTime"] = recordStartTime_flag ;
init_map["nondim_rate_V_rel_wind"]= nondim_rate_V_rel_wind_flag;
init_map["dyn_on_speed"] = dyn_on_speed_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 ;
}
// end uiuc_map_init.cpp

View file

@ -83,6 +83,7 @@ void uiuc_map_keyword()
Keyword_map["ice"] = ice_flag ;
Keyword_map["record"] = record_flag ;
Keyword_map["misc"] = misc_flag ;
Keyword_map["fog"] = fog_flag ;
}
// end uiuc_map_keyword.cpp

View file

@ -42,11 +42,26 @@
maps; added zero_Long_trim to
controlSurface map
03/09/2001 (DPM) added support for gear.
06/18/2001 (RD) Added Alpha, Beta, U_body,
V_body, and W_body to init map. Added
aileron_input, rudder_input, pilot_elev_no,
pilot_ail_no, and pilot_rud_no to
controlSurface map. Added Throttle_pct_input
to engine map. Added CZfa to CL map.
07/05/2001 (RD) Changed pilot_elev_no = true to pilot_
elev_no_check=false. This is to allow pilot
to fly aircraft after input files have been
used.
08/27/2001 (RD) Added xxx_init_true and xxx_init for
P_body, Q_body, R_body, Phi, Theta, Psi,
U_body, V_body, and W_body to help in
starting the A/C at an initial condition.
----------------------------------------------------------------------
AUTHOR(S): Bipin Sehgal <bsehgal@uiuc.edu>
Jeff Scott <jscott@mail.com>
Robert Deters <rdeters@uiuc.edu>
Michael Selig <m-selig@uiuc.edu>
David Megginson <david@megginson.com>
@ -309,8 +324,9 @@ void uiuc_menu( string aircraft_name )
token3 >> token_value;
else
uiuc_warnings_errors(1, *command_line);
P_body = token_value;
P_body_init_true = true;
P_body_init = token_value;
initParts -> storeCommands (*command_line);
break;
}
@ -321,7 +337,8 @@ void uiuc_menu( string aircraft_name )
else
uiuc_warnings_errors(1, *command_line);
Q_body = token_value;
Q_body_init_true = true;
Q_body_init = token_value;
initParts -> storeCommands (*command_line);
break;
}
@ -332,7 +349,8 @@ void uiuc_menu( string aircraft_name )
else
uiuc_warnings_errors(1, *command_line);
R_body = token_value;
R_body_init_true = true;
R_body_init = token_value;
initParts -> storeCommands (*command_line);
break;
}
@ -343,7 +361,8 @@ void uiuc_menu( string aircraft_name )
else
uiuc_warnings_errors(1, *command_line);
Phi = token_value;
Phi_init_true = true;
Phi_init = token_value;
initParts -> storeCommands (*command_line);
break;
}
@ -354,7 +373,8 @@ void uiuc_menu( string aircraft_name )
else
uiuc_warnings_errors(1, *command_line);
Theta = token_value;
Theta_init_true = true;
Theta_init = token_value;
initParts -> storeCommands (*command_line);
break;
}
@ -365,7 +385,8 @@ void uiuc_menu( string aircraft_name )
else
uiuc_warnings_errors(1, *command_line);
Psi = token_value;
Psi_init_true = true;
Psi_init = token_value;
initParts -> storeCommands (*command_line);
break;
}
@ -412,6 +433,61 @@ void uiuc_menu( string aircraft_name )
dyn_on_speed = token_value;
break;
}
case Alpha_flag:
{
if (check_float(linetoken3))
token3 >> token_value;
else
uiuc_warnings_errors(1, *command_line);
Alpha_init_true = true;
Alpha_init = token_value * DEG_TO_RAD;
break;
}
case Beta_flag:
{
if (check_float(linetoken3))
token3 >> token_value;
else
uiuc_warnings_errors(1, *command_line);
Beta_init_true = true;
Beta_init = token_value * DEG_TO_RAD;
break;
}
case U_body_flag:
{
if (check_float(linetoken3))
token3 >> token_value;
else
uiuc_warnings_errors(1, *command_line);
U_body_init_true = true;
U_body_init = token_value;
break;
}
case V_body_flag:
{
if (check_float(linetoken3))
token3 >> token_value;
else
uiuc_warnings_errors(1, *command_line);
V_body_init_true = true;
V_body_init = token_value;
break;
}
case W_body_flag:
{
if (check_float(linetoken3))
token3 >> token_value;
else
uiuc_warnings_errors(1, *command_line);
W_body_init_true = true;
W_body_init = token_value;
break;
}
default:
{
uiuc_warnings_errors(2, *command_line);
@ -693,6 +769,53 @@ void uiuc_menu( string aircraft_name )
elevator_input_startTime = token_value;
break;
}
case aileron_input_flag:
{
aileron_input = true;
aileron_input_file = 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(aileron_input_file,
aileron_input_timeArray,
aileron_input_daArray,
aileron_input_ntime);
token6 >> token_value;
aileron_input_startTime = token_value;
break;
}
case rudder_input_flag:
{
rudder_input = true;
rudder_input_file = 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(rudder_input_file,
rudder_input_timeArray,
rudder_input_drArray,
rudder_input_ntime);
token6 >> token_value;
rudder_input_startTime = token_value;
break;
}
case pilot_elev_no_flag:
{
pilot_elev_no_check = true;
break;
}
case pilot_ail_no_flag:
{
pilot_ail_no_check = true;
break;
}
case pilot_rud_no_flag:
{
pilot_rud_no_check = true;
break;
}
default:
{
uiuc_warnings_errors(2, *command_line);
@ -809,6 +932,22 @@ void uiuc_menu( string aircraft_name )
engineParts -> storeCommands (*command_line);
break;
}
case Throttle_pct_input_flag:
{
Throttle_pct_input = true;
Throttle_pct_input_file = 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(Throttle_pct_input_file,
Throttle_pct_input_timeArray,
Throttle_pct_input_dTArray,
Throttle_pct_input_ntime);
token6 >> token_value;
Throttle_pct_input_startTime = token_value;
break;
}
default:
{
uiuc_warnings_errors(2, *command_line);
@ -1439,6 +1578,24 @@ void uiuc_menu( string aircraft_name )
aeroLiftParts -> storeCommands (*command_line);
break;
}
case CZfa_flag:
{
CZfa = linetoken3;
token4 >> token_value_convert1;
token5 >> token_value_convert2;
convert_y = uiuc_convert(token_value_convert1);
convert_x = uiuc_convert(token_value_convert2);
/* call 1D File Reader with file name (CZfa) and conversion
factors; function returns array of alphas (aArray) and
corresponding CZ values (CZArray) and max number of
terms in arrays (nAlpha) */
uiuc_1DdataFileReader(CZfa,
CZfa_aArray,
CZfa_CZArray,
CZfa_nAlpha);
aeroLiftParts -> storeCommands (*command_line);
break;
}
default:
{
uiuc_warnings_errors(2, *command_line);
@ -2922,7 +3079,74 @@ void uiuc_menu( string aircraft_name )
};
break;
} // end ice map
case fog_flag:
{
switch(fog_map[linetoken2])
{
case fog_segments_flag:
{
if (check_float(linetoken3))
token3 >> token_value_convert1;
else
uiuc_warnings_errors(1, *command_line);
if (token_value_convert1 < 1 || token_value_convert1 > 100)
uiuc_warnings_errors(1, *command_line);
fog_field = true;
fog_point_index = 0;
delete[] fog_time;
delete[] fog_value;
fog_segments = token_value_convert1;
fog_time = new double[fog_segments+1];
fog_time[0] = 0.0;
fog_value = new int[fog_segments+1];
fog_value[0] = 0;
break;
}
case fog_point_flag:
{
if (check_float(linetoken3))
token3 >> token_value;
else
uiuc_warnings_errors(1, *command_line);
if (token_value < 0.1)
uiuc_warnings_errors(1, *command_line);
if (check_float(linetoken4))
token4 >> token_value_convert1;
else
uiuc_warnings_errors(1, *command_line);
if (token_value_convert1 < -1000 || token_value_convert1 > 1000)
uiuc_warnings_errors(1, *command_line);
if (fog_point_index == fog_segments || fog_point_index == -1)
uiuc_warnings_errors(1, *command_line);
fog_point_index++;
fog_time[fog_point_index] = token_value;
fog_value[fog_point_index] = token_value_convert1;
break;
}
default:
{
uiuc_warnings_errors(2, *command_line);
break;
}
};
break;
} // end fog map
case record_flag:
{

View file

@ -19,10 +19,16 @@
HISTORY: 01/26/2000 initial release
03/09/2001 (DPM) added support for gear
06/18/2001 (RD) Made uiuc_recorder its own routine.
07/19/2001 (RD) Added uiuc_vel_init() to initialize
the velocities.
08/27/2001 (RD) Added uiuc_initial_init() to help
in starting an A/C at an initial condition
----------------------------------------------------------------------
AUTHOR(S): Bipin Sehgal <bsehgal@uiuc.edu>
Robert Deters <rdeters@uiuc.edu>
David Megginson <david@megginson.com>
----------------------------------------------------------------------
@ -66,6 +72,13 @@
**********************************************************************/
#include <simgear/compiler.h>
#include <Aircraft/aircraft.hxx>
#ifndef FG_OLD_WEATHER
#include <WeatherCM/FGLocalWeatherDatabase.h>
#else
#include <Weather/weather.hxx>
#endif
#include "uiuc_aircraft.h"
#include "uiuc_aircraftdir.h"
@ -77,6 +90,8 @@
#include "uiuc_menu.h"
#include "uiuc_betaprobe.h"
#include <FDM/LaRCsim/ls_generic.h>
#include "Main/simple_udp.h"
#include "uiuc_fog.h" //321654
#if !defined (SG_HAVE_NATIVE_SGI_COMPILERS)
SG_USING_STD(cout);
@ -87,10 +102,73 @@ extern "C" void uiuc_init_aeromodel ();
extern "C" void uiuc_force_moment(double dt);
extern "C" void uiuc_engine_routine();
extern "C" void uiuc_gear_routine();
extern "C" void uiuc_record_routine(double dt);
extern "C" void uiuc_vel_init ();
extern "C" void uiuc_initial_init ();
AIRCRAFT *aircraft_ = new AIRCRAFT;
AIRCRAFTDIR *aircraftdir_ = new AIRCRAFTDIR;
SendArray testarray(4950);
/* Convert float to string */
string ftoa(double in)
{
static char temp[20];
sprintf(temp,"%g",in);
return (string)temp;
}
void uiuc_initial_init ()
{
if (P_body_init_true)
P_body = P_body_init;
if (Q_body_init_true)
Q_body = Q_body_init;
if (R_body_init_true)
R_body = R_body_init;
if (Phi_init_true)
Phi = Phi_init;
if (Theta_init_true)
Theta = Theta_init;
if (Psi_init_true)
Psi = Psi_init;
if (U_body_init_true)
U_body = U_body_init;
if (V_body_init_true)
V_body = V_body_init;
if (W_body_init_true)
W_body = W_body_init;
}
void uiuc_vel_init ()
{
if (U_body_init_true && V_body_init_true && W_body_init_true)
{
double det_T_l_to_b, cof11, cof12, cof13, cof21, cof22, cof23, cof31, cof32, cof33;
det_T_l_to_b = T_local_to_body_11*(T_local_to_body_22*T_local_to_body_33-T_local_to_body_23*T_local_to_body_32) - T_local_to_body_12*(T_local_to_body_21*T_local_to_body_33-T_local_to_body_23*T_local_to_body_31) + T_local_to_body_13*(T_local_to_body_21*T_local_to_body_32-T_local_to_body_22*T_local_to_body_31);
cof11 = T_local_to_body_22 * T_local_to_body_33 - T_local_to_body_23 * T_local_to_body_32;
cof12 = T_local_to_body_23 * T_local_to_body_31 - T_local_to_body_21 * T_local_to_body_33;
cof13 = T_local_to_body_21 * T_local_to_body_32 - T_local_to_body_22 * T_local_to_body_31;
cof21 = T_local_to_body_13 * T_local_to_body_32 - T_local_to_body_12 * T_local_to_body_33;
cof22 = T_local_to_body_11 * T_local_to_body_33 - T_local_to_body_13 * T_local_to_body_31;
cof23 = T_local_to_body_12 * T_local_to_body_31 - T_local_to_body_11 * T_local_to_body_32;
cof31 = T_local_to_body_12 * T_local_to_body_23 - T_local_to_body_13 * T_local_to_body_22;
cof32 = T_local_to_body_13 * T_local_to_body_21 - T_local_to_body_11 * T_local_to_body_23;
cof33 = T_local_to_body_11 * T_local_to_body_22 - T_local_to_body_12 * T_local_to_body_21;
V_north = (cof11*U_body+cof21*V_body+cof31*W_body)/det_T_l_to_b;
V_east_rel_ground = (cof12*U_body+cof22*V_body+cof32*W_body)/det_T_l_to_b;
V_down = (cof13*U_body+cof23*V_body+cof33*W_body)/det_T_l_to_b;
V_east = V_east_rel_ground + OMEGA_EARTH*Sea_level_radius*cos(Lat_geocentric);
}
}
void uiuc_init_aeromodel ()
{
string aircraft;
@ -133,9 +211,57 @@ void uiuc_force_moment(double dt)
M_m_aero = Cm * qScbar;
M_n_aero = Cn * qSb;
/* Call fligt data recorder */
if (Simtime >= recordStartTime)
uiuc_recorder(dt);
/* Call flight data recorder */
// if (Simtime >= recordStartTime)
// uiuc_recorder(dt);
// fog field update
Fog = 0;
if (fog_field)
uiuc_fog();
double vis;
if (Fog != 0)
{
#ifndef FG_OLD_WEATHER
vis = WeatherDatabase->getWeatherVisibility();
if (Fog > 0)
vis /= 1.01;
else
vis *= 1.01;
WeatherDatabase->setWeatherVisibility( vis );
#else
vis = current_weather->get_visibility();
if (Fog > 0)
vis /= 1.01;
else
vis *= 1.01;
current_weather->set_visibility( vis );
#endif
}
/* Send data on the network to the Glass Cockpit */
string input="";
input += " stick_right " + ftoa(Lat_control);
input += " rudder_left " + ftoa(-Rudder_pedal);
input += " stick_forward " + ftoa(Long_control);
input += " stick_trim_forward " + ftoa(Long_trim);
input += " vehicle_pitch " + ftoa(Theta * 180.0 / 3.14);
input += " vehicle_roll " + ftoa(Phi * 180.0 / 3.14);
input += " vehicle_speed " + ftoa(V_rel_wind);
input += " throttle_forward " + ftoa(Throttle_pct);
input += " altitude " + ftoa(Altitude);
input += " climb_rate " + ftoa(-1.0*V_down_rel_ground);
testarray.getHello();
testarray.sendData(input);
/* End of Networking */
}
void uiuc_engine_routine()
@ -148,4 +274,9 @@ void uiuc_gear_routine ()
uiuc_gear();
}
void uiuc_record_routine(double dt)
{
if (Simtime >= recordStartTime)
uiuc_recorder(dt);
}
//end uiuc_wrapper.cpp

View file

@ -3,3 +3,6 @@ void uiuc_init_aeromodel ();
void uiuc_force_moment(double dt);
void uiuc_engine_routine();
void uiuc_gear_routine();
void uiuc_record_routine(double dt);
void uiuc_vel_init ();
void uiuc_initial_init ();