Robert Deters:
I have attached some revisions for the UIUCModel and some LaRCsim. The only thing you should need to check is LaRCsim.cxx. The file I attached is a revised version of 1.5 and the latest is 1.7. Also, uiuc_getwind.c and uiuc_getwind.h are no longer in the LaRCsim directory. They have been moved over to UIUCModel.
This commit is contained in:
parent
d403c2e568
commit
7289eaa8ba
92 changed files with 12773 additions and 8291 deletions
|
@ -20,6 +20,7 @@
|
|||
//
|
||||
// $Id$
|
||||
|
||||
#include <math.h>
|
||||
#include <string.h> // strcmp()
|
||||
|
||||
#include <simgear/constants.h>
|
||||
|
@ -33,6 +34,7 @@
|
|||
#include <FDM/LaRCsim/ls_cockpit.h>
|
||||
#include <FDM/LaRCsim/ls_generic.h>
|
||||
#include <FDM/LaRCsim/ls_interface.h>
|
||||
#include <FDM/LaRCsim/ls_constants.h>
|
||||
#include <FDM/LaRCsimIC.hxx>
|
||||
#include <FDM/UIUCModel/uiuc_aircraft.h>
|
||||
#include <Main/fg_props.hxx>
|
||||
|
@ -47,6 +49,7 @@ FGLaRCsim::FGLaRCsim( double dt ) {
|
|||
|
||||
speed_up = fgGetNode("/sim/speed-up", true);
|
||||
aero = fgGetNode("/sim/aero", true);
|
||||
uiuc_type = fgGetNode("/sim/uiuc-type", true);
|
||||
|
||||
ls_toplevel_init( 0.0, (char *)(aero->getStringValue()) );
|
||||
|
||||
|
@ -63,8 +66,8 @@ FGLaRCsim::FGLaRCsim( double dt ) {
|
|||
}
|
||||
|
||||
ls_set_model_dt(dt);
|
||||
|
||||
// Initialize our little engine that hopefully might
|
||||
|
||||
// Initialize our little engine that hopefully might
|
||||
eng.init(dt);
|
||||
// dcl - in passing dt to init rather than update I am assuming
|
||||
// that the LaRCsim dt is fixed at one value (yes it is 120hz CLO)
|
||||
|
@ -93,9 +96,10 @@ void FGLaRCsim::update( double dt ) {
|
|||
|
||||
int multiloop = _calc_multiloop(dt);
|
||||
|
||||
// if flying c172-larcsim, do the following
|
||||
if ( !strcmp(aero->getStringValue(), "c172") ) {
|
||||
// set control inputs
|
||||
// cout << "V_calibrated_kts = " << V_calibrated_kts << '\n';
|
||||
// set control inputs
|
||||
// cout << "V_calibrated_kts = " << V_calibrated_kts << '\n';
|
||||
eng.set_IAS( V_calibrated_kts );
|
||||
eng.set_Throttle_Lever_Pos( globals->get_controls()->get_throttle( 0 )
|
||||
* 100.0 );
|
||||
|
@ -156,9 +160,13 @@ void FGLaRCsim::update( double dt ) {
|
|||
* dt);
|
||||
}
|
||||
|
||||
F_X_engine = eng.get_prop_thrust_lbs();
|
||||
F_X_engine = eng.get_prop_thrust_lbs();
|
||||
// cout << "F_X_engine = " << F_X_engine << '\n';
|
||||
// end c172 if block
|
||||
|
||||
Flap_handle = 30.0 * globals->get_controls()->get_flaps();
|
||||
}
|
||||
// done with c172-larcsim if-block
|
||||
|
||||
double save_alt = 0.0;
|
||||
|
||||
|
@ -169,18 +177,15 @@ void FGLaRCsim::update( double dt ) {
|
|||
}
|
||||
|
||||
// copy control positions into the LaRCsim structure
|
||||
Lat_control = globals->get_controls()->get_aileron() /
|
||||
speed_up->getIntValue();
|
||||
Lat_control = globals->get_controls()->get_aileron() / speed_up->getIntValue();
|
||||
Long_control = globals->get_controls()->get_elevator();
|
||||
Long_trim = globals->get_controls()->get_elevator_trim();
|
||||
Rudder_pedal = globals->get_controls()->get_rudder() /
|
||||
speed_up->getIntValue();
|
||||
Flap_handle = 30.0 * globals->get_controls()->get_flaps();
|
||||
Rudder_pedal = globals->get_controls()->get_rudder() / speed_up->getIntValue();
|
||||
|
||||
if ( !strcmp(aero->getStringValue(), "c172") ) {
|
||||
Use_External_Engine = 1;
|
||||
} else {
|
||||
Use_External_Engine = 0;
|
||||
Use_External_Engine = 0;
|
||||
}
|
||||
|
||||
Throttle_pct = globals->get_controls()->get_throttle( 0 ) * 1.0;
|
||||
|
@ -213,6 +218,110 @@ void FGLaRCsim::update( double dt ) {
|
|||
fgSetDouble("/engines/engine/cranking", 1);
|
||||
fgSetDouble("/engines/engine/running", 1);
|
||||
|
||||
// if flying uiuc, set some properties and over-ride some previous ones
|
||||
if ( !strcmp(aero->getStringValue(), "uiuc")) {
|
||||
|
||||
// surface positions
|
||||
fgSetDouble("/surface-positions/rudder-pos-norm", fgGetDouble("/controls/flight/rudder"));
|
||||
fgSetDouble("/surface-positions/elevator-pos-norm", fgGetDouble("/controls/flight/elevator")); // FIXME: ignoring trim
|
||||
fgSetDouble("/surface-positions/right-aileron-pos-norm", -1 * fgGetDouble("/controls/flight/aileron")); // FIXME: ignoring trim
|
||||
fgSetDouble("/surface-positions/left-aileron-pos-norm", fgGetDouble("/controls/flight/aileron")); // FIXME: ignoring trim
|
||||
|
||||
Flap_handle = flap_max * globals->get_controls()->get_flaps();
|
||||
|
||||
// flaps with transition occuring in uiuc_aerodeflections.cpp
|
||||
if (use_flaps) {
|
||||
fgSetDouble("/surface-positions/flight/flap-pos-norm", flap_pos_pct);
|
||||
}
|
||||
|
||||
// spoilers with transition occurring in uiuc_aerodeflections.cpp
|
||||
if(use_spoilers) {
|
||||
Spoiler_handle = spoiler_max * fgGetDouble("/controls/spoilers");
|
||||
}
|
||||
// gear with transition occurring here in LaRCsim.cxx
|
||||
if (use_gear) {
|
||||
if(fgGetBool("/controls/gear-down")) {
|
||||
Gear_handle = 1.0;
|
||||
}
|
||||
else {
|
||||
Gear_handle = 0.;
|
||||
}
|
||||
// commanded gear is 0 or 1
|
||||
gear_cmd_norm = Gear_handle;
|
||||
// amount gear moves per time step [relative to 1]
|
||||
gear_increment_per_timestep = gear_rate * dt;
|
||||
// determine gear position with respect to gear command
|
||||
if (gear_pos_norm < gear_cmd_norm) {
|
||||
gear_pos_norm += gear_increment_per_timestep;
|
||||
if (gear_pos_norm > gear_cmd_norm)
|
||||
gear_pos_norm = gear_cmd_norm;
|
||||
} else if (gear_pos_norm > gear_cmd_norm) {
|
||||
gear_pos_norm -= gear_increment_per_timestep;
|
||||
if (gear_pos_norm < gear_cmd_norm)
|
||||
gear_pos_norm = gear_cmd_norm;
|
||||
}
|
||||
// set the gear position
|
||||
fgSetDouble("/gear/gear[0]/position-norm", gear_pos_norm);
|
||||
fgSetDouble("/gear/gear[1]/position-norm", gear_pos_norm);
|
||||
fgSetDouble("/gear/gear[2]/position-norm", gear_pos_norm);
|
||||
}
|
||||
|
||||
|
||||
// engine functions (sounds and instruments)
|
||||
// drive the rpm gauge
|
||||
fgSetDouble("/engines/engine/rpm", (globals->get_controls()->get_throttle( 0 ) * 100.0 * 25 ));
|
||||
// manifold air pressure
|
||||
fgSetDouble("/engines/engine/mp-osi", (globals->get_controls()->get_throttle( 0 ) * 100.0 ));
|
||||
// make the engine cranking and running sounds when fgfs starts up
|
||||
fgSetDouble("/engines/engine/cranking", 1);
|
||||
fgSetDouble("/engines/engine/running", 1);
|
||||
if ( !strcmp(uiuc_type->getStringValue(), "uiuc-prop")) {
|
||||
// uiuc prop driven airplane, e.g. Wright Flyer
|
||||
}
|
||||
else if ( !strcmp(uiuc_type->getStringValue(), "uiuc-jet")) {
|
||||
// uiuc jet aircraft, e.g. a4d
|
||||
fgSetDouble("/engines/engine/n1", (75 + (globals->get_controls()->get_throttle( 0 ) * 100.0 )/400));
|
||||
fgSetDouble("/engines/engine/prop-thrust", (4000 + F_X_engine/2));
|
||||
}
|
||||
else if ( !strcmp(uiuc_type->getStringValue(), "uiuc-sailplane")) {
|
||||
// uiuc sailplane, e.g. asw20
|
||||
fgSetDouble("/engines/engine/cranking", 0);
|
||||
// set the wind speed for use in setting wind sound level
|
||||
fgSetDouble("/velocities/V_rel_wind_kts", (V_rel_wind * 1.274));
|
||||
}
|
||||
else if ( !strcmp(uiuc_type->getStringValue(), "uiuc-hangglider")) {
|
||||
// uiuc sailplane, e.g. asw20
|
||||
fgSetDouble("/engines/engine/cranking", 0);
|
||||
}
|
||||
else if ( !strcmp(uiuc_type->getStringValue(), "uiuc-ornithopter")) {
|
||||
// mechanical flapping wings
|
||||
// flapping wings (using seahawk for now)
|
||||
fgSetDouble("/canopy/position-norm", 0);
|
||||
fgSetDouble("/wing-phase/position-norm", sin(flapper_phi - 3 * LS_PI / 2));
|
||||
// fgSetDouble("/wing-phase/position-norm", fgGetDouble("/controls/rudder"));
|
||||
fgSetDouble("/wing-phase/position-deg", flapper_phi*RAD_TO_DEG);
|
||||
fgSetDouble("/wing-phase/position-one", 1);
|
||||
fgSetDouble("/thorax/volume", 0);
|
||||
fgSetDouble("/thorax/rpm", 0);
|
||||
// fgSetDouble("/wing-phase/position-norm", ((1+cos(flapper_phi - LS_PI/2))/2 -.36 ));
|
||||
// fgSetDouble("/thorax/volume", ((1+sin(2*(flapper_phi+LS_PI)))/2));
|
||||
// fgSetDouble("/thorax/rpm", ((1+sin(2*(flapper_phi+LS_PI)))/2));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// add Gamma_horiz_deg to properties, mss 021213
|
||||
if (use_gamma_horiz_on_speed) {
|
||||
if (V_rel_wind > gamma_horiz_on_speed) {
|
||||
fgSetDouble("/orientation/Gamma_horiz_deg", (Gamma_horiz_rad * RAD_TO_DEG));
|
||||
}
|
||||
else {
|
||||
fgSetDouble("/orientation/Gamma_horiz_deg", fgGetDouble("/orientation/heading-deg"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
fgSetDouble("/orientation/Gamma_horiz_deg", fgGetDouble("/orientation/heading-deg"));
|
||||
}
|
||||
ls_update(multiloop);
|
||||
|
||||
// printf("%d FG_Altitude = %.2f\n", i, FG_Altitude * 0.3048);
|
||||
|
@ -433,7 +542,7 @@ bool FGLaRCsim::copy_from_LaRCsim() {
|
|||
_set_Accels_Body( U_dot_body, V_dot_body, W_dot_body );
|
||||
_set_Accels_CG_Body( A_X_cg, A_Y_cg, A_Z_cg );
|
||||
_set_Accels_Pilot_Body( A_X_pilot, A_Y_pilot, A_Z_pilot );
|
||||
// set_Accels_CG_Body_N( N_X_cg, N_Y_cg, N_Z_cg );
|
||||
_set_Accels_CG_Body_N( N_X_cg, N_Y_cg, -N_Z_cg );
|
||||
// set_Accels_Pilot_Body_N( N_X_pilot, N_Y_pilot, N_Z_pilot );
|
||||
// set_Accels_Omega( P_dot_body, Q_dot_body, R_dot_body );
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ private:
|
|||
double time_step;
|
||||
SGPropertyNode *speed_up;
|
||||
SGPropertyNode *aero;
|
||||
SGPropertyNode *uiuc_type;
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@ libLaRCsim_a_SOURCES = \
|
|||
ls_step.c ls_step.h \
|
||||
ls_sym.h ls_types.h \
|
||||
$(AIRCRAFT_MODEL) \
|
||||
ls_interface.c ls_interface.h \
|
||||
uiuc_getwind.c uiuc_getwind.h
|
||||
ls_interface.c ls_interface.h
|
||||
|
||||
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src
|
||||
|
|
|
@ -47,13 +47,26 @@
|
|||
|
||||
$Header$
|
||||
$Log$
|
||||
Revision 1.2 2002/11/08 17:03:50 curt
|
||||
Revision 1.3 2003/05/13 18:45:06 curt
|
||||
Robert Deters:
|
||||
|
||||
Latest revisions of the UIUC code.
|
||||
I have attached some revisions for the UIUCModel and some LaRCsim.
|
||||
The only thing you should need to check is LaRCsim.cxx. The file
|
||||
I attached is a revised version of 1.5 and the latest is 1.7. Also,
|
||||
uiuc_getwind.c and uiuc_getwind.h are no longer in the LaRCsim
|
||||
directory. They have been moved over to UIUCModel.
|
||||
|
||||
Revision 1.1.1.1 2002/09/10 01:14:01 curt
|
||||
Initial revision of FlightGear-0.9.0
|
||||
Revision 1.2 2003/03/31 03:05:39 m-selig
|
||||
uiuc wind changes, MSS
|
||||
|
||||
Revision 1.1.1.1 2003/02/28 01:33:39 rob
|
||||
uiuc version of FlightGear v0.9.0
|
||||
|
||||
Revision 1.2 2002/10/22 21:06:49 rob
|
||||
*** empty log message ***
|
||||
|
||||
Revision 1.1.1.1 2002/04/24 17:08:23 rob
|
||||
UIUC version of FlightGear-0.7.pre11
|
||||
|
||||
Revision 1.3 2001/03/24 05:03:12 curt
|
||||
SG-ified logstream.
|
||||
|
@ -299,12 +312,8 @@ 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;
|
||||
|
@ -328,16 +337,9 @@ void ls_aux( void ) {
|
|||
- 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,13 +37,32 @@
|
|||
CURRENT RCS HEADER INFO:
|
||||
$Header$
|
||||
$Log$
|
||||
Revision 1.2 2002/11/08 17:03:50 curt
|
||||
Revision 1.3 2003/05/13 18:45:06 curt
|
||||
Robert Deters:
|
||||
|
||||
Latest revisions of the UIUC code.
|
||||
I have attached some revisions for the UIUCModel and some LaRCsim.
|
||||
The only thing you should need to check is LaRCsim.cxx. The file
|
||||
I attached is a revised version of 1.5 and the latest is 1.7. Also,
|
||||
uiuc_getwind.c and uiuc_getwind.h are no longer in the LaRCsim
|
||||
directory. They have been moved over to UIUCModel.
|
||||
|
||||
Revision 1.1.1.1 2002/09/10 01:14:02 curt
|
||||
Initial revision of FlightGear-0.9.0
|
||||
Revision 1.2 2003/03/31 03:05:41 m-selig
|
||||
uiuc wind changes, MSS
|
||||
|
||||
Revision 1.1.1.1 2003/02/28 01:33:39 rob
|
||||
uiuc version of FlightGear v0.9.0
|
||||
|
||||
Revision 1.3 2002/12/12 00:01:04 rob
|
||||
*** empty log message ***
|
||||
|
||||
Revision 1.2 2002/10/22 21:06:49 rob
|
||||
*** empty log message ***
|
||||
|
||||
Revision 1.2 2002/08/29 18:56:37 rob
|
||||
*** empty log message ***
|
||||
|
||||
Revision 1.1.1.1 2002/04/24 17:08:23 rob
|
||||
UIUC version of FlightGear-0.7.pre11
|
||||
|
||||
Revision 1.5 2002/04/01 19:37:34 curt
|
||||
I have attached revisions to the UIUC code. The revisions include the
|
||||
|
@ -166,10 +185,13 @@ void ls_model( SCALAR dt, int Initialize ) {
|
|||
case UIUC:
|
||||
inertias( dt, Initialize );
|
||||
subsystems( dt, Initialize );
|
||||
uiuc_init_2_wrapper();
|
||||
uiuc_network_recv_2_wrapper();
|
||||
uiuc_engine_2_wrapper( dt, Initialize );
|
||||
uiuc_wind_2_wrapper( dt, Initialize );
|
||||
uiuc_aero_2_wrapper( dt, Initialize );
|
||||
uiuc_gear_2_wrapper( dt, Initialize );
|
||||
//uiuc_network_2_wrapper();
|
||||
uiuc_network_send_2_wrapper();
|
||||
uiuc_record_2_wrapper(dt);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
6/18/01 Added call out to UIUC record routine (RD)
|
||||
11/12/01 Changed from uiuc_init_aeromodel() to uiuc_initial_init(). (RD)
|
||||
2/24/02 Added uiuc_network_routine() (GD)
|
||||
12/11/02 Divided uiuc_network_routine into uiuc_network_recv_routine and
|
||||
uiuc_network_send_routine (RD)
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
|
@ -60,13 +62,7 @@
|
|||
#include <FDM/UIUCModel/uiuc_wrapper.h>
|
||||
|
||||
|
||||
void uiuc_aero_2_wrapper( SCALAR dt, int Initialize )
|
||||
{
|
||||
uiuc_force_moment(dt);
|
||||
}
|
||||
|
||||
|
||||
void uiuc_engine_2_wrapper( SCALAR dt, int Initialize )
|
||||
void uiuc_init_2_wrapper()
|
||||
{
|
||||
static int init = 0;
|
||||
|
||||
|
@ -76,6 +72,21 @@ void uiuc_engine_2_wrapper( SCALAR dt, int Initialize )
|
|||
uiuc_initial_init();
|
||||
// uiuc_init_aeromodel();
|
||||
}
|
||||
}
|
||||
|
||||
void uiuc_aero_2_wrapper( SCALAR dt, int Initialize )
|
||||
{
|
||||
uiuc_force_moment(dt);
|
||||
}
|
||||
|
||||
|
||||
void uiuc_wind_2_wrapper( SCALAR dt, int Initialize )
|
||||
{
|
||||
uiuc_wind_routine(dt);
|
||||
}
|
||||
|
||||
void uiuc_engine_2_wrapper( SCALAR dt, int Initialize )
|
||||
{
|
||||
|
||||
uiuc_engine_routine();
|
||||
}
|
||||
|
@ -91,7 +102,12 @@ void uiuc_record_2_wrapper(SCALAR dt)
|
|||
uiuc_record_routine(dt);
|
||||
}
|
||||
|
||||
//void uiuc_network_2_wrapper()
|
||||
//{
|
||||
// uiuc_network_routine();
|
||||
//}
|
||||
void uiuc_network_recv_2_wrapper()
|
||||
{
|
||||
uiuc_network_recv_routine();
|
||||
}
|
||||
|
||||
void uiuc_network_send_2_wrapper()
|
||||
{
|
||||
uiuc_network_send_routine();
|
||||
}
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
/*
|
||||
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;
|
||||
}
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
#include <math.h>
|
||||
#include "ls_generic.h" //For global state variables
|
||||
|
||||
void uiuc_getwind(double wind[3]);
|
|
@ -10,6 +10,7 @@ libUIUCModel_a_SOURCES = \
|
|||
uiuc_3Dinterpolation.cpp uiuc_3Dinterpolation.h \
|
||||
uiuc_aerodeflections.cpp uiuc_aerodeflections.h \
|
||||
uiuc_aircraftdir.h uiuc_aircraft.h \
|
||||
uiuc_alh_ap.cpp uiuc_alh_ap.h \
|
||||
uiuc_betaprobe.cpp uiuc_betaprobe.h \
|
||||
uiuc_coef_drag.cpp uiuc_coef_drag.h \
|
||||
uiuc_coef_lift.cpp uiuc_coef_lift.h \
|
||||
|
@ -21,11 +22,16 @@ libUIUCModel_a_SOURCES = \
|
|||
uiuc_controlInput.cpp uiuc_controlInput.h \
|
||||
uiuc_convert.cpp uiuc_convert.h \
|
||||
uiuc_engine.cpp uiuc_engine.h \
|
||||
uiuc_flapdata.cpp uiuc_flapdata.h \
|
||||
uiuc_find_position.cpp uiuc_find_position.h \
|
||||
uiuc_fog.cpp uiuc_fog.h \
|
||||
uiuc_gear.cpp uiuc_gear.h\
|
||||
uiuc_ice.cpp uiuc_ice.h \
|
||||
uiuc_get_flapper.cpp uiuc_get_flapper.h \
|
||||
uiuc_getwind.cpp uiuc_getwind.h \
|
||||
uiuc_ice.cpp uiuc_ice.h \
|
||||
uiuc_iceboot.cpp uiuc_iceboot.h \
|
||||
uiuc_iced_nonlin.cpp uiuc_iced_nonlin.h \
|
||||
uiuc_icing_demo.cpp uiuc_icing_demo.h \
|
||||
uiuc_initializemaps.cpp uiuc_initializemaps.h \
|
||||
uiuc_map_CD.cpp uiuc_map_CD.h \
|
||||
uiuc_map_CL.cpp uiuc_map_CL.h \
|
||||
|
@ -50,7 +56,24 @@ 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_menu_init.cpp uiuc_menu_init.h \
|
||||
uiuc_menu_geometry.cpp uiuc_menu_geometry.h \
|
||||
uiuc_menu_controlSurface.cpp uiuc_menu_controlSurface.h \
|
||||
uiuc_menu_mass.cpp uiuc_menu_mass.h \
|
||||
uiuc_menu_engine.cpp uiuc_menu_engine.h \
|
||||
uiuc_menu_CD.cpp uiuc_menu_CD.h \
|
||||
uiuc_menu_CL.cpp uiuc_menu_CL.h \
|
||||
uiuc_menu_Cm.cpp uiuc_menu_Cm.h \
|
||||
uiuc_menu_CY.cpp uiuc_menu_CY.h \
|
||||
uiuc_menu_Croll.cpp uiuc_menu_Croll.h \
|
||||
uiuc_menu_Cn.cpp uiuc_menu_Cn.h \
|
||||
uiuc_menu_gear.cpp uiuc_menu_gear.h \
|
||||
uiuc_menu_ice.cpp uiuc_menu_ice.h \
|
||||
uiuc_menu_fog.cpp uiuc_menu_fog.h \
|
||||
uiuc_menu_record.cpp uiuc_menu_record.h \
|
||||
uiuc_menu_misc.cpp uiuc_menu_misc.h \
|
||||
uiuc_menu_functions.cpp uiuc_menu_functions.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 \
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
|
||||
int
|
||||
uiuc_1DdataFileReader( string file_name,
|
||||
double x[100], double y[100], int &xmax )
|
||||
double x[], double y[], int &xmax )
|
||||
{
|
||||
|
||||
ParseFile *matrix;
|
||||
|
@ -81,6 +81,7 @@ uiuc_1DdataFileReader( string file_name,
|
|||
string linetoken1;
|
||||
string linetoken2;
|
||||
stack command_list;
|
||||
static string uiuc_1DdataFileReader_error = " (from uiuc_1DdataFileReader.cpp) ";
|
||||
|
||||
/* Read the file and get the list of commands */
|
||||
matrix = new ParseFile(file_name);
|
||||
|
@ -101,6 +102,11 @@ uiuc_1DdataFileReader( string file_name,
|
|||
y[counter] = token_value2 * convert_y;
|
||||
xmax = counter;
|
||||
counter++;
|
||||
//(RD) will create error check later, we can have more than 100
|
||||
//if (counter > 100)
|
||||
//{
|
||||
// uiuc_warnings_errors(6, uiuc_1DdataFileReader_error);
|
||||
//};
|
||||
data = 1;
|
||||
}
|
||||
return data;
|
||||
|
|
|
@ -7,12 +7,13 @@
|
|||
|
||||
#include "uiuc_parsefile.h"
|
||||
#include "uiuc_aircraft.h"
|
||||
#include "uiuc_warnings_errors.h"
|
||||
|
||||
SG_USING_STD(istrstream);
|
||||
|
||||
int uiuc_1DdataFileReader( string file_name,
|
||||
double x[100],
|
||||
double y[100],
|
||||
double x[],
|
||||
double y[],
|
||||
int &xmax );
|
||||
int uiuc_1DdataFileReader( string file_name,
|
||||
double x[],
|
||||
|
|
|
@ -22,14 +22,18 @@
|
|||
|
||||
HISTORY: 01/30/2000 initial release
|
||||
04/05/2000 (JS) added zero_Long_trim command
|
||||
07/05/2001 (RD) removed elevator_tab addidtion to
|
||||
07/05/2001 (RD) removed elevator_tab addition to
|
||||
elevator calculation
|
||||
11/12/2001 (RD) added new flap routine. Needed for
|
||||
Twin Otter non-linear model
|
||||
12/28/2002 (MSS) added simple SAS capability
|
||||
03/03/2003 (RD) changed flap code to call
|
||||
uiuc_find_position to determine
|
||||
flap position
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
AUTHOR(S): Jeff Scott <jscott@mail.com>
|
||||
AUTHOR(S): Jeff Scott http://www.jeffscott.net/
|
||||
Robert Deters <rdeters@uiuc.edu>
|
||||
Michael Selig <m-selig@uiuc.edu>
|
||||
|
||||
|
@ -73,174 +77,250 @@
|
|||
|
||||
**********************************************************************/
|
||||
|
||||
//#include <math.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "uiuc_aerodeflections.h"
|
||||
|
||||
void uiuc_aerodeflections( double dt )
|
||||
{
|
||||
double prevFlapHandle = 0.0f;
|
||||
double flap_transit_rate;
|
||||
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)
|
||||
{
|
||||
Long_trim = 0;
|
||||
//elevator_tab = 0;
|
||||
}
|
||||
|
||||
if (use_uiuc_network) {
|
||||
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;
|
||||
Flap_handle = flap_percent * flap_max;
|
||||
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) {
|
||||
Long_trim = 0;
|
||||
//elevator_tab = 0;
|
||||
}
|
||||
|
||||
if (Lat_control <= 0)
|
||||
aileron = - Lat_control * damin * DEG_TO_RAD;
|
||||
else
|
||||
aileron = - Lat_control * damax * DEG_TO_RAD;
|
||||
|
||||
if (trim_case_2)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
if (trim_case_2) {
|
||||
if (Long_trim <= 0) {
|
||||
elevator = Long_trim * demax * DEG_TO_RAD;
|
||||
demax_remain = demax + Long_trim * demax;
|
||||
demin_remain = -Long_trim * demax + demin;
|
||||
if (Long_control <= 0)
|
||||
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;
|
||||
else
|
||||
elevator += Long_control * demax_remain * DEG_TO_RAD;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((Long_control+Long_trim) <= 0)
|
||||
elevator = (Long_control + Long_trim) * demax * DEG_TO_RAD;
|
||||
elevator += Long_control * demin_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;
|
||||
else
|
||||
elevator = (Long_control + Long_trim) * demin * DEG_TO_RAD;
|
||||
elevator += Long_control * demax_remain * DEG_TO_RAD;
|
||||
}
|
||||
|
||||
} else {
|
||||
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;
|
||||
rudder = -Rudder_pedal * drmin * DEG_TO_RAD;
|
||||
else
|
||||
rudder = - Rudder_pedal * drmax * DEG_TO_RAD;
|
||||
rudder = -Rudder_pedal * drmax * DEG_TO_RAD;
|
||||
|
||||
/* at this point aileron, elevator, and rudder commands are known (in radians)
|
||||
* add in SAS and any other mixing control laws
|
||||
*/
|
||||
|
||||
// SAS for pitch, positive elevator is TED
|
||||
if (use_elevator_stick_gain)
|
||||
elevator *= elevator_stick_gain;
|
||||
if (use_elevator_sas_type1) {
|
||||
elevator_sas = elevator_sas_KQ * Q_body;
|
||||
if (use_elevator_sas_max && (elevator_sas > (elevator_sas_max * DEG_TO_RAD))) {
|
||||
elevator += elevator_sas_max * DEG_TO_RAD;
|
||||
//elevator_sas = elevator_sas_max;
|
||||
} else if (use_elevator_sas_min && (elevator_sas < (elevator_sas_min * DEG_TO_RAD))) {
|
||||
elevator += elevator_sas_min * DEG_TO_RAD;
|
||||
//elevator_sas = elevator_sas_min;
|
||||
}
|
||||
else
|
||||
elevator += elevator_sas;
|
||||
// don't exceed the elevator deflection limits
|
||||
if (elevator > demax * DEG_TO_RAD)
|
||||
elevator = demax * DEG_TO_RAD;
|
||||
else if (elevator < (-demin * DEG_TO_RAD))
|
||||
elevator = -demin * DEG_TO_RAD;
|
||||
}
|
||||
|
||||
// SAS for roll, positive aileron is right aileron TED
|
||||
if (use_aileron_stick_gain)
|
||||
aileron *= aileron_stick_gain;
|
||||
if (use_aileron_sas_type1) {
|
||||
aileron_sas = aileron_sas_KP * P_body;
|
||||
if (use_aileron_sas_max && (fabs(aileron_sas) > (aileron_sas_max * DEG_TO_RAD)))
|
||||
if (aileron_sas >= 0) {
|
||||
aileron += aileron_sas_max * DEG_TO_RAD;
|
||||
//aileron_sas = aileron_sas_max;
|
||||
} else {
|
||||
aileron += -aileron_sas_max * DEG_TO_RAD;
|
||||
//aileron_sas = -aileron_sas;
|
||||
}
|
||||
else
|
||||
aileron += aileron_sas;
|
||||
// don't exceed aileron deflection limits
|
||||
if (fabs(aileron) > (damax * DEG_TO_RAD))
|
||||
if (aileron > 0)
|
||||
aileron = damax * DEG_TO_RAD;
|
||||
else
|
||||
aileron = -damax * DEG_TO_RAD;
|
||||
}
|
||||
|
||||
// SAS for yaw, positive rudder deflection is TEL
|
||||
if (use_rudder_stick_gain)
|
||||
rudder *= rudder_stick_gain;
|
||||
if (use_rudder_sas_type1) {
|
||||
rudder_sas = rudder_sas_KR * R_body;
|
||||
if (use_rudder_sas_max && (fabs(rudder_sas) > (rudder_sas_max*DEG_TO_RAD)))
|
||||
if (rudder_sas >= 0) {
|
||||
rudder -= rudder_sas_max * DEG_TO_RAD;
|
||||
//rudder_sas = rudder_sas_max;
|
||||
} else {
|
||||
rudder -= -rudder_sas_max * DEG_TO_RAD;
|
||||
//rudder_sas = rudder_sas_max;
|
||||
}
|
||||
else
|
||||
rudder -= rudder_sas;
|
||||
// don't exceed rudder deflection limits, assumes drmax = drmin,
|
||||
// i.e. equal rudder throws left and right
|
||||
if (fabs(rudder) > drmax)
|
||||
if (rudder > 0)
|
||||
rudder = drmax * DEG_TO_RAD;
|
||||
else
|
||||
rudder = -drmax * DEG_TO_RAD;
|
||||
}
|
||||
|
||||
/* This old code in the first part of the if-block needs to get removed from FGFS. 030222 MSS
|
||||
The second part of the if-block is rewritten below.
|
||||
double prevFlapHandle = 0.0f;
|
||||
double flap_transit_rate;
|
||||
bool flaps_in_transit = false;
|
||||
|
||||
if (old_flap_routine)
|
||||
{
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (old_flap_routine) {
|
||||
// old flap routine
|
||||
// check for lowest flap setting
|
||||
if (Flap_handle < dfArray[1]) {
|
||||
Flap_handle = dfArray[1];
|
||||
prevFlapHandle = Flap_handle;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 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 = Flap_handle;
|
||||
} else if (Flap_handle > dfArray[ndf]) {
|
||||
// check for highest flap setting
|
||||
Flap_handle = dfArray[ndf];
|
||||
prevFlapHandle = Flap_handle;
|
||||
flap = Flap_handle;
|
||||
} else {
|
||||
// otherwise in between
|
||||
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;
|
||||
}
|
||||
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;
|
||||
if(fabs (flap - Flap_handle) > dt * flap_transit_rate)
|
||||
flap += flap_transit_rate * dt;
|
||||
else {
|
||||
flaps_in_transit = false;
|
||||
flap = Flap_handle;
|
||||
}
|
||||
else if (flap_pos > flap_goal)
|
||||
{
|
||||
flap_pos -= flap_moving_rate;
|
||||
if (flap_pos < flap_goal)
|
||||
flap_pos = flap_goal;
|
||||
}
|
||||
}
|
||||
}
|
||||
prevFlapHandle = Flap_handle;
|
||||
} else {
|
||||
// new flap routine
|
||||
// designed for the twin otter non-linear model
|
||||
if (!outside_control) {
|
||||
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_cmd_deg = 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_cmd_deg) {
|
||||
flap_pos += flap_moving_rate;
|
||||
if (flap_pos > flap_cmd_deg)
|
||||
flap_pos = flap_cmd_deg;
|
||||
} else if (flap_pos > flap_cmd_deg) {
|
||||
flap_pos -= flap_moving_rate;
|
||||
if (flap_pos < flap_cmd_deg)
|
||||
flap_pos = flap_cmd_deg;
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
if (!outside_control && use_flaps) {
|
||||
// angle of flaps desired [rad]
|
||||
flap_cmd = Flap_handle * DEG_TO_RAD;
|
||||
// amount flaps move per time step [rad/sec]
|
||||
flap_increment_per_timestep = flap_rate * dt * DEG_TO_RAD;
|
||||
// determine flap position [rad] with respect to flap command
|
||||
flap_pos = uiuc_find_position(flap_cmd,flap_increment_per_timestep,flap_pos);
|
||||
// get the normalized position
|
||||
flap_pos_pct = flap_pos/(flap_max * DEG_TO_RAD);
|
||||
}
|
||||
|
||||
|
||||
if(use_spoilers) {
|
||||
// angle of spoilers desired [deg]
|
||||
spoiler_cmd_deg = Spoiler_handle;
|
||||
// amount spoilers move per time step [deg]
|
||||
spoiler_increment_per_timestep = spoiler_rate * dt;
|
||||
// determine spoiler position with respect to spoiler command
|
||||
if (spoiler_pos_deg < spoiler_cmd_deg) {
|
||||
spoiler_pos_deg += spoiler_increment_per_timestep;
|
||||
if (spoiler_pos_deg > spoiler_cmd_deg)
|
||||
spoiler_pos_deg = spoiler_cmd_deg;
|
||||
} else if (spoiler_pos_deg > spoiler_cmd_deg) {
|
||||
spoiler_pos_deg -= spoiler_increment_per_timestep;
|
||||
if (spoiler_pos_deg < spoiler_cmd_deg)
|
||||
spoiler_pos_deg = spoiler_cmd_deg;
|
||||
}
|
||||
spoiler_pos = spoiler_pos_deg * DEG_TO_RAD;
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
#define _AERODEFLECTIONS_H_
|
||||
|
||||
#include "uiuc_aircraft.h" /* aileron, elevator, rudder */
|
||||
//#include "uiuc_network.h"
|
||||
#include "uiuc_find_position.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 */
|
||||
|
||||
#include <FDM/LaRCsim/ls_generic.h> //For global LaRCsim variables
|
||||
|
||||
void uiuc_aerodeflections( double dt );
|
||||
|
||||
|
|
|
@ -71,6 +71,8 @@
|
|||
scale factors.
|
||||
08/29/2002 (MSS) Added simpleSingleModel
|
||||
09/18/2002 (MSS) Added downwash options
|
||||
03/03/2003 (RD) Changed flap_cmd_deg to flap_cmd (rad)
|
||||
03/16/2003 (RD) Added trigger variables
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
|
@ -137,10 +139,10 @@
|
|||
|
||||
#include <map>
|
||||
#include STL_IOSTREAM
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
|
||||
#include "uiuc_parsefile.h"
|
||||
//#include "uiuc_flapdata.h"
|
||||
#include "uiuc_flapdata.h"
|
||||
|
||||
SG_USING_STD(map);
|
||||
SG_USING_STD(iostream);
|
||||
|
@ -155,6 +157,7 @@ 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
|
||||
// added to uiuc_map_init.cpp
|
||||
enum {Dx_pilot_flag = 2000,
|
||||
Dy_pilot_flag,
|
||||
Dz_pilot_flag,
|
||||
|
@ -181,6 +184,8 @@ enum {Dx_pilot_flag = 2000,
|
|||
dyn_on_speed_zero_flag,
|
||||
use_dyn_on_speed_curve1_flag,
|
||||
use_Alpha_dot_on_speed_flag,
|
||||
use_gamma_horiz_on_speed_flag,
|
||||
gamma_horiz_on_speed,
|
||||
downwashMode_flag,
|
||||
downwashCoef_flag,
|
||||
Alpha_flag,
|
||||
|
@ -188,7 +193,7 @@ enum {Dx_pilot_flag = 2000,
|
|||
U_body_flag,
|
||||
V_body_flag,
|
||||
W_body_flag,
|
||||
ignore_unknown_flag,
|
||||
ignore_unknown_keywords_flag,
|
||||
trim_case_2_flag,
|
||||
use_uiuc_network_flag,
|
||||
old_flap_routine_flag,
|
||||
|
@ -196,20 +201,37 @@ enum {Dx_pilot_flag = 2000,
|
|||
outside_control_flag};
|
||||
|
||||
// geometry === Aircraft-specific geometric quantities
|
||||
// added to uiuc_map_geometry.cpp
|
||||
enum {bw_flag = 3000, cbar_flag, Sw_flag, ih_flag, bh_flag, ch_flag, Sh_flag};
|
||||
|
||||
// controlSurface = Control surface deflections and properties
|
||||
// added to uiuc_map_controlSurface.cpp
|
||||
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,
|
||||
flap_pos_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, use_flaps_flag,
|
||||
spoiler_max_flag, spoiler_rate_flag, use_spoilers_flag,
|
||||
aileron_sas_KP_flag,
|
||||
aileron_sas_max_flag,
|
||||
aileron_stick_gain_flag,
|
||||
elevator_sas_KQ_flag,
|
||||
elevator_sas_max_flag,
|
||||
elevator_sas_min_flag,
|
||||
elevator_stick_gain_flag,
|
||||
rudder_sas_KR_flag,
|
||||
rudder_sas_max_flag,
|
||||
rudder_stick_gain_flag,
|
||||
use_elevator_sas_type1_flag,
|
||||
use_aileron_sas_type1_flag,
|
||||
use_rudder_sas_type1_flag};
|
||||
|
||||
// controlsMixer == Controls mixer
|
||||
enum {nomix_flag = 5000};
|
||||
|
||||
//mass ======== Aircraft-specific mass properties
|
||||
// added to uiuc_map_mass.cpp
|
||||
enum {Weight_flag = 6000,
|
||||
Mass_flag, I_xx_flag, I_yy_flag, I_zz_flag, I_xz_flag,
|
||||
Mass_appMass_ratio_flag, I_xx_appMass_ratio_flag,
|
||||
|
@ -218,6 +240,7 @@ enum {Weight_flag = 6000,
|
|||
I_yy_appMass_flag, I_zz_appMass_flag};
|
||||
|
||||
// engine ===== Propulsion data
|
||||
// added to uiuc_map_engine.cpp
|
||||
enum {simpleSingle_flag = 7000, simpleSingleModel_flag,
|
||||
c172_flag, cherokee_flag, gyroForce_Q_body_flag, gyroForce_R_body_flag,
|
||||
omega_flag, omegaRPM_flag, polarInertia_flag,
|
||||
|
@ -225,6 +248,7 @@ enum {simpleSingle_flag = 7000, simpleSingleModel_flag,
|
|||
eta_q_Cm_q_flag,
|
||||
eta_q_Cm_adot_flag,
|
||||
eta_q_Cmfade_flag,
|
||||
eta_q_Cm_de_flag,
|
||||
eta_q_Cl_beta_flag,
|
||||
eta_q_Cl_p_flag,
|
||||
eta_q_Cl_r_flag,
|
||||
|
@ -240,45 +264,64 @@ enum {simpleSingle_flag = 7000, simpleSingleModel_flag,
|
|||
Throttle_pct_input_flag, forcemom_flag, Xp_input_flag, Zp_input_flag, Mp_input_flag};
|
||||
|
||||
// CD ========= Aerodynamic x-force quantities (longitudinal)
|
||||
enum {CDo_flag = 8000, CDK_flag, CD_a_flag, CD_adot_flag, CD_q_flag, CD_ih_flag, CD_de_flag,
|
||||
// added to uiuc_map_CD.cpp
|
||||
enum {CDo_flag = 8000, CDK_flag, CLK_flag, CD_a_flag, CD_adot_flag, CD_q_flag, CD_ih_flag,
|
||||
CD_de_flag, CD_dr_flag, CD_da_flag, CD_beta_flag,
|
||||
CD_df_flag,
|
||||
CD_ds_flag,
|
||||
CD_dg_flag,
|
||||
CDfa_flag, CDfCL_flag, CDfade_flag, CDfdf_flag, CDfadf_flag,
|
||||
CXo_flag, CXK_flag, CX_a_flag, CX_a2_flag, CX_a3_flag, CX_adot_flag,
|
||||
CX_q_flag, CX_de_flag, CX_dr_flag, CX_df_flag, CX_adf_flag,
|
||||
CXfabetaf_flag, CXfadef_flag, CXfaqf_flag};
|
||||
|
||||
// CL ========= Aerodynamic z-force quantities (longitudinal)
|
||||
// added to uiuc_map_CL.cpp
|
||||
enum {CLo_flag = 9000, CL_a_flag, CL_adot_flag, CL_q_flag, CL_ih_flag, CL_de_flag,
|
||||
CL_df_flag,
|
||||
CL_ds_flag,
|
||||
CL_dg_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,
|
||||
CZfa_flag, CZfabetaf_flag, CZfadef_flag, CZfaqf_flag};
|
||||
|
||||
// Cm ========= Aerodynamic m-moment quantities (longitudinal)
|
||||
// added to uiuc_map_Cm.cpp
|
||||
enum {Cmo_flag = 10000, Cm_a_flag, Cm_a2_flag, Cm_adot_flag, Cm_q_flag,
|
||||
Cm_ih_flag, Cm_de_flag, Cm_b2_flag, Cm_r_flag, Cm_df_flag,
|
||||
Cm_ih_flag, Cm_de_flag, Cm_b2_flag, Cm_r_flag,
|
||||
Cm_df_flag,
|
||||
Cm_ds_flag,
|
||||
Cm_dg_flag,
|
||||
Cmfa_flag, Cmfade_flag, Cmfdf_flag, Cmfadf_flag,
|
||||
Cmfabetaf_flag, Cmfadef_flag, Cmfaqf_flag};
|
||||
|
||||
// CY ========= Aerodynamic y-force quantities (lateral)
|
||||
// added to uiuc_map_CY.cpp
|
||||
enum {CYo_flag = 11000, CY_beta_flag, CY_p_flag, CY_r_flag, CY_da_flag,
|
||||
CY_dr_flag, CY_dra_flag, CY_bdot_flag, CYfada_flag, CYfbetadr_flag,
|
||||
CYfabetaf_flag, CYfadaf_flag, CYfadrf_flag, CYfapf_flag, CYfarf_flag};
|
||||
|
||||
// Cl ========= Aerodynamic l-moment quantities (lateral)
|
||||
// added to uiuc_map_Cl.cpp
|
||||
enum {Clo_flag = 12000, Cl_beta_flag, Cl_p_flag, Cl_r_flag, Cl_da_flag,
|
||||
Cl_dr_flag, Cl_daa_flag, Clfada_flag, Clfbetadr_flag, Clfabetaf_flag,
|
||||
Clfadaf_flag, Clfadrf_flag, Clfapf_flag, Clfarf_flag};
|
||||
|
||||
// Cn ========= Aerodynamic n-moment quantities (lateral)
|
||||
// added to uiuc_map_Cn.cpp
|
||||
enum {Cno_flag = 13000, Cn_beta_flag, Cn_p_flag, Cn_r_flag, Cn_da_flag,
|
||||
Cn_dr_flag, Cn_q_flag, Cn_b3_flag, Cnfada_flag, Cnfbetadr_flag,
|
||||
Cnfabetaf_flag, Cnfadaf_flag, Cnfadrf_flag, Cnfapf_flag, Cnfarf_flag};
|
||||
|
||||
// gear ======= Landing gear model quantities
|
||||
// added to uiuc_map_gear.cpp
|
||||
enum {Dx_gear_flag = 14000, Dy_gear_flag, Dz_gear_flag, cgear_flag,
|
||||
kgear_flag, muGear_flag, strutLength_flag};
|
||||
kgear_flag, muGear_flag, strutLength_flag,
|
||||
gear_max_flag, gear_rate_flag, use_gear_flag};
|
||||
|
||||
// ice ======== Ice model quantities
|
||||
// added to uiuc_map_ice.cpp
|
||||
enum {iceTime_flag = 15000, transientTime_flag, eta_ice_final_flag,
|
||||
beta_probe_wing_flag, beta_probe_tail_flag,
|
||||
kCDo_flag, kCDK_flag, kCD_a_flag, kCD_adot_flag, kCD_q_flag, kCD_de_flag,
|
||||
|
@ -315,18 +358,21 @@ enum {Simtime_record = 16000, dt_record,
|
|||
|
||||
cbar_2U_record, b_2U_record, ch_2U_record,
|
||||
|
||||
// added to uiuc_map_record1.cpp
|
||||
Weight_record, Mass_record, I_xx_record, I_yy_record, I_zz_record, I_xz_record,
|
||||
Mass_appMass_ratio_record, I_xx_appMass_ratio_record,
|
||||
I_yy_appMass_ratio_record, I_zz_appMass_ratio_record,
|
||||
Mass_appMass_record, I_xx_appMass_record,
|
||||
I_yy_appMass_record, I_zz_appMass_record,
|
||||
|
||||
// added to uiuc_map_record1.cpp
|
||||
Dx_pilot_record, Dy_pilot_record, Dz_pilot_record,
|
||||
Dx_cg_record, Dy_cg_record, Dz_cg_record,
|
||||
Lat_geocentric_record, Lon_geocentric_record, Radius_to_vehicle_record,
|
||||
Latitude_record, Longitude_record, Altitude_record,
|
||||
Phi_record, Theta_record, Psi_record,
|
||||
|
||||
// added to uiuc_map_record1.cpp
|
||||
V_dot_north_record, V_dot_east_record, V_dot_down_record,
|
||||
U_dot_body_record, V_dot_body_record, W_dot_body_record,
|
||||
A_X_pilot_record, A_Y_pilot_record, A_Z_pilot_record,
|
||||
|
@ -335,6 +381,7 @@ enum {Simtime_record = 16000, dt_record,
|
|||
N_X_cg_record, N_Y_cg_record, N_Z_cg_record,
|
||||
P_dot_body_record, Q_dot_body_record, R_dot_body_record,
|
||||
|
||||
// added to uiuc_map_record2.cpp
|
||||
V_north_record, V_east_record, V_down_record,
|
||||
V_north_rel_ground_record, V_east_rel_ground_record, V_down_rel_ground_record,
|
||||
V_north_airmass_record, V_east_airmass_record, V_down_airmass_record,
|
||||
|
@ -350,15 +397,18 @@ enum {Simtime_record = 16000, dt_record,
|
|||
Phi_dot_record, Theta_dot_record, Psi_dot_record,
|
||||
Latitude_dot_record, Longitude_dot_record, Radius_dot_record,
|
||||
|
||||
// added to uiuc_map_record2.cpp
|
||||
Alpha_record, Alpha_deg_record, Alpha_dot_record, Alpha_dot_deg_record,
|
||||
Beta_record, Beta_deg_record, Beta_dot_record, Beta_dot_deg_record,
|
||||
Gamma_vert_record, Gamma_vert_deg_record, Gamma_horiz_record, Gamma_horiz_deg_record,
|
||||
|
||||
// added to uiuc_map_record3.cpp
|
||||
Density_record, V_sound_record, Mach_number_record,
|
||||
Static_pressure_record, Total_pressure_record, Impact_pressure_record,
|
||||
Dynamic_pressure_record,
|
||||
Static_temperature_record, Total_temperature_record,
|
||||
|
||||
// added to uiuc_map_record3.cpp
|
||||
Gravity_record, Sea_level_radius_record, Earth_position_angle_record,
|
||||
Runway_altitude_record, Runway_latitude_record, Runway_longitude_record,
|
||||
Runway_heading_record, Radius_to_rwy_record,
|
||||
|
@ -367,20 +417,30 @@ enum {Simtime_record = 16000, dt_record,
|
|||
D_cg_north_of_rwy_record, D_cg_east_of_rwy_record, D_cg_above_rwy_record,
|
||||
X_cg_rwy_record, Y_cg_rwy_record, H_cg_rwy_record,
|
||||
|
||||
// added to uiuc_map_record3.cpp
|
||||
Throttle_3_record, Throttle_pct_record,
|
||||
|
||||
// added to uiuc_map_record3.cpp
|
||||
Long_control_record, Long_trim_record, Long_trim_deg_record,
|
||||
elevator_record, elevator_deg_record,
|
||||
Lat_control_record, aileron_record, aileron_deg_record,
|
||||
Rudder_pedal_record, rudder_record, rudder_deg_record,
|
||||
Flap_handle_record, flap_record, flap_deg_record, flap_goal_record,
|
||||
flap_pos_record,
|
||||
Flap_handle_record, flap_record, flap_cmd_record, flap_cmd_deg_record,
|
||||
flap_pos_record, flap_pos_deg_record,
|
||||
Spoiler_handle_record, spoiler_cmd_deg_record,
|
||||
spoiler_pos_deg_record, spoiler_pos_norm_record, spoiler_pos_record,
|
||||
|
||||
// added to uiuc_map_record4.cpp
|
||||
CD_record, CDfaI_record, CDfCLI_record, CDfadeI_record, CDfdfI_record,
|
||||
CDfadfI_record, CX_record, CXfabetafI_record, CXfadefI_record,
|
||||
CXfaqfI_record,
|
||||
CDo_save_record, CDK_save_record, CD_a_save_record, CD_adot_save_record,
|
||||
CD_q_save_record, CD_ih_save_record, CD_de_save_record, CXo_save_record,
|
||||
CDo_save_record, CDK_save_record, CLK_save_record, CD_a_save_record, CD_adot_save_record,
|
||||
CD_q_save_record, CD_ih_save_record,
|
||||
CD_de_save_record, CD_dr_save_record, CD_da_save_record, CD_beta_save_record,
|
||||
CD_df_save_record,
|
||||
CD_ds_save_record,
|
||||
CD_dg_save_record,
|
||||
CXo_save_record,
|
||||
CXK_save_record, CX_a_save_record, CX_a2_save_record, CX_a3_save_record,
|
||||
CX_adot_save_record, CX_q_save_record, CX_de_save_record,
|
||||
CX_dr_save_record, CX_df_save_record, CX_adf_save_record,
|
||||
|
@ -388,7 +448,11 @@ enum {Simtime_record = 16000, dt_record,
|
|||
CZ_record, CZfaI_record, CZfabetafI_record, CZfadefI_record,
|
||||
CZfaqfI_record,
|
||||
CLo_save_record, CL_a_save_record, CL_adot_save_record, CL_q_save_record,
|
||||
CL_ih_save_record, CL_de_save_record, CZo_save_record, CZ_a_save_record,
|
||||
CL_ih_save_record, CL_de_save_record,
|
||||
CL_df_save_record,
|
||||
CL_ds_save_record,
|
||||
CL_dg_save_record,
|
||||
CZo_save_record, CZ_a_save_record,
|
||||
CZ_a2_save_record, CZ_a3_save_record, CZ_adot_save_record,
|
||||
CZ_q_save_record, CZ_de_save_record, CZ_deb2_save_record,
|
||||
CZ_df_save_record, CZ_adf_save_record,
|
||||
|
@ -398,6 +462,8 @@ enum {Simtime_record = 16000, dt_record,
|
|||
Cm_adot_save_record, Cm_q_save_record, Cm_ih_save_record,
|
||||
Cm_de_save_record, Cm_b2_save_record, Cm_r_save_record,
|
||||
Cm_df_save_record,
|
||||
Cm_ds_save_record,
|
||||
Cm_dg_save_record,
|
||||
CY_record, CYfadaI_record, CYfbetadrI_record, CYfabetafI_record,
|
||||
CYfadafI_record, CYfadrfI_record, CYfapfI_record, CYfarfI_record,
|
||||
CYo_save_record, CY_beta_save_record, CY_p_save_record,
|
||||
|
@ -413,18 +479,53 @@ enum {Simtime_record = 16000, dt_record,
|
|||
Cn_da_save_record, Cn_dr_save_record, Cn_q_save_record,
|
||||
Cn_b3_save_record,
|
||||
|
||||
// added to uiuc_map_record5.cpp
|
||||
F_X_wind_record, F_Y_wind_record, F_Z_wind_record,
|
||||
F_X_aero_record, F_Y_aero_record, F_Z_aero_record,
|
||||
F_X_engine_record, F_Y_engine_record, F_Z_engine_record,
|
||||
F_X_gear_record, F_Y_gear_record, F_Z_gear_record,
|
||||
F_X_record, F_Y_record, F_Z_record,
|
||||
F_north_record, F_east_record, F_down_record,
|
||||
|
||||
|
||||
// added to uiuc_map_record5.cpp
|
||||
M_l_aero_record, M_m_aero_record, M_n_aero_record,
|
||||
M_l_engine_record, M_m_engine_record, M_n_engine_record,
|
||||
M_l_gear_record, M_m_gear_record, M_n_gear_record,
|
||||
M_l_rp_record, M_m_rp_record, M_n_rp_record,
|
||||
|
||||
// added to uiuc_map_record5.cpp
|
||||
flapper_freq_record, flapper_phi_record,
|
||||
flapper_phi_deg_record, flapper_Lift_record, flapper_Thrust_record,
|
||||
flapper_Inertia_record, flapper_Moment_record,
|
||||
|
||||
// added to uiuc_map_record5.cpp
|
||||
debug1_record,
|
||||
debug2_record,
|
||||
debug3_record,
|
||||
V_down_fpm_record,
|
||||
eta_q_record,
|
||||
rpm_record,
|
||||
elevator_sas_deg_record,
|
||||
aileron_sas_deg_record,
|
||||
rudder_sas_deg_record,
|
||||
w_induced_record,
|
||||
downwashAngle_deg_record,
|
||||
alphaTail_deg_record,
|
||||
gammaWing_record,
|
||||
LD_record,
|
||||
gload_record,
|
||||
gyroMomentQ_record,
|
||||
gyroMomentR_record,
|
||||
|
||||
// added to uiuc_map_record5.cpp
|
||||
Gear_handle_record, gear_cmd_norm_record, gear_pos_norm_record,
|
||||
|
||||
// added to uiuc_map_record5.cpp
|
||||
debug4_record,
|
||||
debug5_record,
|
||||
debug6_record,
|
||||
|
||||
// added to uiuc_map_record6.cpp
|
||||
CL_clean_record, CL_iced_record,
|
||||
CD_clean_record, CD_iced_record,
|
||||
Cm_clean_record, Cm_iced_record,
|
||||
|
@ -452,10 +553,7 @@ enum {Simtime_record = 16000, dt_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,
|
||||
|
||||
// added to uiuc_map_record6.cpp
|
||||
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,
|
||||
|
@ -464,11 +562,13 @@ enum {Simtime_record = 16000, dt_record,
|
|||
eps_flap_max_record, eps_airspeed_max_record, eps_airspeed_min_record,
|
||||
tactilefadefI_record,
|
||||
|
||||
ap_Theta_ref_deg_record, ap_pah_on_record,
|
||||
// added to uiuc_map_record6.cpp
|
||||
ap_Theta_ref_deg_record, ap_pah_on_record, trigger_on_record,
|
||||
trigger_num_record, trigger_toggle_record, trigger_counter_record};
|
||||
|
||||
debug1_record, debug2_record, debug3_record};
|
||||
|
||||
// misc ======= Miscellaneous inputs
|
||||
// added to uiuc_map_misc.cpp
|
||||
enum {simpleHingeMomentCoef_flag = 17000, dfTimefdf_flag, flapper_flag,
|
||||
flapper_phi_init_flag};
|
||||
|
||||
|
@ -568,6 +668,12 @@ struct AIRCRAFT
|
|||
double Alpha_dot_on_speed;
|
||||
#define Alpha_dot_on_speed aircraft_->Alpha_dot_on_speed
|
||||
|
||||
bool use_gamma_horiz_on_speed;
|
||||
#define use_gamma_horiz_on_speed aircraft_->use_gamma_horiz_on_speed
|
||||
double gamma_horiz_on_speed;
|
||||
#define gamma_horiz_on_speed aircraft_->gamma_horiz_on_speed
|
||||
|
||||
|
||||
bool b_downwashMode;
|
||||
#define b_downwashMode aircraft_->b_downwashMode
|
||||
int downwashMode;
|
||||
|
@ -767,6 +873,15 @@ struct AIRCRAFT
|
|||
double flap_max, flap_rate;
|
||||
#define flap_max aircraft_->flap_max
|
||||
#define flap_rate aircraft_->flap_rate
|
||||
bool use_flaps;
|
||||
#define use_flaps aircraft_->use_flaps
|
||||
|
||||
double spoiler_max, spoiler_rate;
|
||||
#define spoiler_max aircraft_->spoiler_max
|
||||
#define spoiler_rate aircraft_->spoiler_rate
|
||||
bool use_spoilers;
|
||||
#define use_spoilers aircraft_->use_spoilers
|
||||
|
||||
|
||||
bool flap_pos_input;
|
||||
string flap_pos_input_file;
|
||||
|
@ -782,6 +897,61 @@ struct AIRCRAFT
|
|||
#define flap_pos_input_startTime aircraft_->flap_pos_input_startTime
|
||||
|
||||
|
||||
// SAS system: pitch, roll and yaw damping MSS
|
||||
double elevator_sas_KQ;
|
||||
double elevator_sas_max;
|
||||
double elevator_sas_min;
|
||||
double elevator_stick_gain;
|
||||
double aileron_sas_KP;
|
||||
double aileron_sas_max;
|
||||
double aileron_stick_gain;
|
||||
double rudder_sas_KR;
|
||||
double rudder_sas_max;
|
||||
double rudder_stick_gain;
|
||||
|
||||
|
||||
|
||||
#define elevator_sas_KQ aircraft_->elevator_sas_KQ
|
||||
#define elevator_sas_max aircraft_->elevator_sas_max
|
||||
#define elevator_sas_min aircraft_->elevator_sas_min
|
||||
#define elevator_stick_gain aircraft_->elevator_stick_gain
|
||||
#define aileron_sas_KP aircraft_->aileron_sas_KP
|
||||
#define aileron_sas_max aircraft_->aileron_sas_max
|
||||
#define aileron_stick_gain aircraft_->aileron_stick_gain
|
||||
#define rudder_sas_KR aircraft_->rudder_sas_KR
|
||||
#define rudder_sas_max aircraft_->rudder_sas_max
|
||||
#define rudder_stick_gain aircraft_->rudder_stick_gain
|
||||
|
||||
double elevator_sas;
|
||||
#define elevator_sas aircraft_->elevator_sas
|
||||
double aileron_sas;
|
||||
#define aileron_sas aircraft_->aileron_sas
|
||||
double rudder_sas;
|
||||
#define rudder_sas aircraft_->rudder_sas
|
||||
|
||||
bool use_elevator_sas_type1;
|
||||
#define use_elevator_sas_type1 aircraft_->use_elevator_sas_type1
|
||||
bool use_elevator_sas_max;
|
||||
#define use_elevator_sas_max aircraft_->use_elevator_sas_max
|
||||
bool use_elevator_sas_min;
|
||||
#define use_elevator_sas_min aircraft_->use_elevator_sas_min
|
||||
bool use_elevator_stick_gain;
|
||||
#define use_elevator_stick_gain aircraft_->use_elevator_stick_gain
|
||||
bool use_aileron_sas_type1;
|
||||
#define use_aileron_sas_type1 aircraft_->use_aileron_sas_type1
|
||||
bool use_aileron_sas_max;
|
||||
#define use_aileron_sas_max aircraft_->use_aileron_sas_max
|
||||
bool use_aileron_stick_gain;
|
||||
#define use_aileron_stick_gain aircraft_->use_aileron_stick_gain
|
||||
bool use_rudder_sas_type1;
|
||||
#define use_rudder_sas_type1 aircraft_->use_rudder_sas_type1
|
||||
bool use_rudder_sas_max;
|
||||
#define use_rudder_sas_max aircraft_->use_rudder_sas_max
|
||||
bool use_rudder_stick_gain;
|
||||
#define use_rudder_stick_gain aircraft_->use_rudder_stick_gain
|
||||
|
||||
|
||||
|
||||
/* Variables (token2) ===========================================*/
|
||||
/* controlsMixer = Control mixer ================================*/
|
||||
|
||||
|
@ -872,6 +1042,7 @@ struct AIRCRAFT
|
|||
double eta_q_Cm_q, eta_q_Cm_q_fac;
|
||||
double eta_q_Cm_adot, eta_q_Cm_adot_fac;
|
||||
double eta_q_Cmfade, eta_q_Cmfade_fac;
|
||||
double eta_q_Cm_de, eta_q_Cm_de_fac;
|
||||
double eta_q_Cl_beta, eta_q_Cl_beta_fac;
|
||||
double eta_q_Cl_p, eta_q_Cl_p_fac;
|
||||
double eta_q_Cl_r, eta_q_Cl_r_fac;
|
||||
|
@ -893,6 +1064,8 @@ struct AIRCRAFT
|
|||
#define eta_q_Cm_adot_fac aircraft_->eta_q_Cm_adot_fac
|
||||
#define eta_q_Cmfade aircraft_->eta_q_Cmfade
|
||||
#define eta_q_Cmfade_fac aircraft_->eta_q_Cmfade_fac
|
||||
#define eta_q_Cm_de aircraft_->eta_q_Cm_de
|
||||
#define eta_q_Cm_de_fac aircraft_->eta_q_Cm_de_fac
|
||||
#define eta_q_Cl_beta aircraft_->eta_q_Cl_beta
|
||||
#define eta_q_Cl_beta_fac aircraft_->eta_q_Cl_beta_fac
|
||||
#define eta_q_Cl_p aircraft_->eta_q_Cl_p
|
||||
|
@ -963,14 +1136,24 @@ struct AIRCRAFT
|
|||
map <string,int> CD_map;
|
||||
#define CD_map aircraft_->CD_map
|
||||
|
||||
double CDo, CDK, CD_a, CD_adot, CD_q, CD_ih, CD_de;
|
||||
double CDo, CDK, CLK, CD_a, CD_adot, CD_q, CD_ih, CD_de, CD_dr, CD_da, CD_beta;
|
||||
double CD_df, CD_ds, CD_dg;
|
||||
#define CDo aircraft_->CDo
|
||||
#define CDK aircraft_->CDK
|
||||
#define CLK aircraft_->CLK
|
||||
#define CD_a aircraft_->CD_a
|
||||
#define CD_adot aircraft_->CD_adot
|
||||
#define CD_q aircraft_->CD_q
|
||||
#define CD_ih aircraft_->CD_ih
|
||||
#define CD_de aircraft_->CD_de
|
||||
#define CD_dr aircraft_->CD_dr
|
||||
#define CD_da aircraft_->CD_da
|
||||
#define CD_beta aircraft_->CD_beta
|
||||
#define CD_df aircraft_->CD_df
|
||||
#define CD_ds aircraft_->CD_ds
|
||||
#define CD_dg aircraft_->CD_dg
|
||||
bool b_CLK;
|
||||
#define b_CLK aircraft_->b_CLK
|
||||
string CDfa;
|
||||
double CDfa_aArray[100];
|
||||
double CDfa_CDArray[100];
|
||||
|
@ -1114,17 +1297,26 @@ struct AIRCRAFT
|
|||
#define CXfaqf_nq_nice aircraft_->CXfaqf_nq_nice
|
||||
#define CXfaqf_qArray_nice aircraft_->CXfaqf_qArray_nice
|
||||
#define CXfaqf_aArray_nice aircraft_->CXfaqf_aArray_nice
|
||||
double CDo_save, CDK_save, CD_a_save, CD_adot_save, CD_q_save, CD_ih_save;
|
||||
double CD_de_save, CXo_save, CXK_save, CX_a_save, CX_a2_save, CX_a3_save;
|
||||
double CDo_save, CDK_save, CLK_save, CD_a_save, CD_adot_save, CD_q_save, CD_ih_save;
|
||||
double CD_de_save, CD_dr_save, CD_da_save, CD_beta_save;
|
||||
double CD_df_save, CD_ds_save, CD_dg_save;
|
||||
double CXo_save, CXK_save, CX_a_save, CX_a2_save, CX_a3_save;
|
||||
double CX_adot_save, CX_q_save, CX_de_save;
|
||||
double CX_dr_save, CX_df_save, CX_adf_save;
|
||||
#define CDo_save aircraft_->CDo_save
|
||||
#define CDK_save aircraft_->CDK_save
|
||||
#define CLK_save aircraft_->CLK_save
|
||||
#define CD_a_save aircraft_->CD_a_save
|
||||
#define CD_adot_save aircraft_->CD_adot_save
|
||||
#define CD_q_save aircraft_->CD_q_save
|
||||
#define CD_ih_save aircraft_->CD_ih_save
|
||||
#define CD_de_save aircraft_->CD_de_save
|
||||
#define CD_dr_save aircraft_->CD_dr_save
|
||||
#define CD_da_save aircraft_->CD_da_save
|
||||
#define CD_beta_save aircraft_->CD_beta_save
|
||||
#define CD_df_save aircraft_->CD_df_save
|
||||
#define CD_ds_save aircraft_->CD_ds_save
|
||||
#define CD_dg_save aircraft_->CD_dg_save
|
||||
#define CXo_save aircraft_->CXo_save
|
||||
#define CXK_save aircraft_->CXK_save
|
||||
#define CX_a_save aircraft_->CX_a_save
|
||||
|
@ -1145,12 +1337,16 @@ struct AIRCRAFT
|
|||
#define CL_map aircraft_->CL_map
|
||||
|
||||
double CLo, CL_a, CL_adot, CL_q, CL_ih, CL_de;
|
||||
double CL_df, CL_ds, CL_dg;
|
||||
#define CLo aircraft_->CLo
|
||||
#define CL_a aircraft_->CL_a
|
||||
#define CL_adot aircraft_->CL_adot
|
||||
#define CL_q aircraft_->CL_q
|
||||
#define CL_ih aircraft_->CL_ih
|
||||
#define CL_de aircraft_->CL_de
|
||||
#define CL_df aircraft_->CL_df
|
||||
#define CL_ds aircraft_->CL_ds
|
||||
#define CL_dg aircraft_->CL_dg
|
||||
string CLfa;
|
||||
double CLfa_aArray[100];
|
||||
double CLfa_CLArray[100];
|
||||
|
@ -1295,6 +1491,7 @@ struct AIRCRAFT
|
|||
#define CZfaqf_aArray_nice aircraft_->CZfaqf_aArray_nice
|
||||
double CLo_save, CL_a_save, CL_adot_save;
|
||||
double CL_q_save, CL_ih_save, CL_de_save;
|
||||
double CL_df_save, CL_ds_save, CL_dg_save;
|
||||
double CZo_save, CZ_a_save, CZ_a2_save;
|
||||
double CZ_a3_save, CZ_adot_save, CZ_q_save;
|
||||
double CZ_de_save, CZ_deb2_save, CZ_df_save;
|
||||
|
@ -1305,6 +1502,9 @@ struct AIRCRAFT
|
|||
#define CL_q_save aircraft_->CL_q_save
|
||||
#define CL_ih_save aircraft_->CL_ih_save
|
||||
#define CL_de_save aircraft_->CL_de_save
|
||||
#define CL_df_save aircraft_->CL_df_save
|
||||
#define CL_ds_save aircraft_->CL_ds_save
|
||||
#define CL_dg_save aircraft_->CL_dg_save
|
||||
#define CZo_save aircraft_->CZo_save
|
||||
#define CZ_a_save aircraft_->CZ_a_save
|
||||
#define CZ_a2_save aircraft_->CZ_a2_save
|
||||
|
@ -1324,7 +1524,8 @@ struct AIRCRAFT
|
|||
#define Cm_map aircraft_->Cm_map
|
||||
|
||||
double Cmo, Cm_a, Cm_a2, Cm_adot, Cm_q;
|
||||
double Cm_ih, Cm_de, Cm_b2, Cm_r, Cm_df;
|
||||
double Cm_ih, Cm_de, Cm_b2, Cm_r;
|
||||
double Cm_df, Cm_ds, Cm_dg;
|
||||
#define Cmo aircraft_->Cmo
|
||||
#define Cm_a aircraft_->Cm_a
|
||||
#define Cm_a2 aircraft_->Cm_a2
|
||||
|
@ -1335,6 +1536,8 @@ struct AIRCRAFT
|
|||
#define Cm_b2 aircraft_->Cm_b2
|
||||
#define Cm_r aircraft_->Cm_r
|
||||
#define Cm_df aircraft_->Cm_df
|
||||
#define Cm_ds aircraft_->Cm_ds
|
||||
#define Cm_dg aircraft_->Cm_dg
|
||||
string Cmfa;
|
||||
double Cmfa_aArray[100];
|
||||
double Cmfa_CmArray[100];
|
||||
|
@ -1462,7 +1665,8 @@ struct AIRCRAFT
|
|||
#define Cmfaqf_qArray_nice aircraft_->Cmfaqf_qArray_nice
|
||||
#define Cmfaqf_aArray_nice aircraft_->Cmfaqf_aArray_nice
|
||||
double Cmo_save, Cm_a_save, Cm_a2_save, Cm_adot_save, Cm_q_save, Cm_ih_save;
|
||||
double Cm_de_save, Cm_b2_save, Cm_r_save, Cm_df_save;
|
||||
double Cm_de_save, Cm_b2_save, Cm_r_save;
|
||||
double Cm_df_save, Cm_ds_save, Cm_dg_save;
|
||||
#define Cmo_save aircraft_->Cmo_save
|
||||
#define Cm_a_save aircraft_->Cm_a_save
|
||||
#define Cm_a2_save aircraft_->Cm_a2_save
|
||||
|
@ -1473,6 +1677,8 @@ struct AIRCRAFT
|
|||
#define Cm_b2_save aircraft_->Cm_b2_save
|
||||
#define Cm_r_save aircraft_->Cm_r_save
|
||||
#define Cm_df_save aircraft_->Cm_df_save
|
||||
#define Cm_ds_save aircraft_->Cm_ds_save
|
||||
#define Cm_dg_save aircraft_->Cm_dg_save
|
||||
|
||||
|
||||
/* Variables (token2) ===========================================*/
|
||||
|
@ -2017,6 +2223,11 @@ struct AIRCRAFT
|
|||
#define kgear aircraft_->kgear
|
||||
#define muGear aircraft_->muGear
|
||||
#define strutLength aircraft_->strutLength
|
||||
double gear_max, gear_rate;
|
||||
#define gear_max aircraft_->gear_max
|
||||
#define gear_rate aircraft_->gear_rate
|
||||
bool use_gear;
|
||||
#define use_gear aircraft_->use_gear
|
||||
|
||||
|
||||
/* Variables (token2) ===========================================*/
|
||||
|
@ -2500,7 +2711,7 @@ struct AIRCRAFT
|
|||
|
||||
AIRCRAFT()
|
||||
{
|
||||
fog_field = false;
|
||||
fog_field;
|
||||
fog_segments = 0;
|
||||
fog_point_index = -1;
|
||||
fog_time = NULL;
|
||||
|
@ -2545,8 +2756,8 @@ struct AIRCRAFT
|
|||
#define elevator_deg aircraft_->elevator_deg
|
||||
#define aileron_deg aircraft_->aileron_deg
|
||||
#define rudder_deg aircraft_->rudder_deg
|
||||
double flap_deg;
|
||||
#define flap_deg aircraft_->flap_deg
|
||||
// double flap_pos_deg;
|
||||
//#define flap_pos_deg aircraft_->flap_pos_deg
|
||||
|
||||
/***** Forces ******/
|
||||
double F_X_wind, F_Y_wind, F_Z_wind;
|
||||
|
@ -2617,22 +2828,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
|
||||
|
@ -2656,11 +2867,29 @@ struct AIRCRAFT
|
|||
#define dfArray aircraft_->dfArray
|
||||
#define TimeArray aircraft_->TimeArray
|
||||
|
||||
double flap_percent, flap_goal, flap_moving_rate, flap_pos;
|
||||
#define flap_percent aircraft_->flap_percent
|
||||
#define flap_goal aircraft_->flap_goal
|
||||
#define flap_moving_rate aircraft_->flap_moving_rate
|
||||
#define flap_pos aircraft_->flap_pos
|
||||
double flap_percent, flap_increment_per_timestep, flap_cmd, flap_pos, flap_pos_pct;
|
||||
#define flap_percent aircraft_->flap_percent
|
||||
#define flap_increment_per_timestep aircraft_->flap_increment_per_timestep
|
||||
#define flap_cmd aircraft_->flap_cmd
|
||||
//#define flap_cmd_deg aircraft_->flap_cmd_deg
|
||||
#define flap_pos aircraft_->flap_pos
|
||||
//#define flap_pos_deg aircraft_->flap_pos_deg
|
||||
#define flap_pos_pct aircraft_->flap_pos_pct
|
||||
|
||||
double Spoiler_handle, spoiler_increment_per_timestep, spoiler_cmd_deg;
|
||||
double spoiler_pos_norm, spoiler_pos_deg, spoiler_pos;
|
||||
#define Spoiler_handle aircraft_->Spoiler_handle
|
||||
#define spoiler_increment_per_timestep aircraft_->spoiler_increment_per_timestep
|
||||
#define spoiler_cmd_deg aircraft_->spoiler_cmd_deg
|
||||
#define spoiler_pos_deg aircraft_->spoiler_pos_deg
|
||||
#define spoiler_pos_norm aircraft_->spoiler_pos_norm
|
||||
#define spoiler_pos aircraft_->spoiler_pos
|
||||
|
||||
double Gear_handle, gear_increment_per_timestep, gear_cmd_norm, gear_pos_norm;
|
||||
#define Gear_handle aircraft_->Gear_handle
|
||||
#define gear_increment_per_timestep aircraft_->gear_increment_per_timestep
|
||||
#define gear_cmd_norm aircraft_->gear_cmd_norm
|
||||
#define gear_pos_norm aircraft_->gear_pos_norm
|
||||
|
||||
double delta_CL, delta_CD, delta_Cm, delta_Ch, delta_Cl, delta_Cn;
|
||||
#define delta_CL aircraft_->delta_CL
|
||||
|
@ -2729,8 +2958,8 @@ struct AIRCRAFT
|
|||
|
||||
#define fout aircraft_->fout
|
||||
|
||||
bool dont_ignore;
|
||||
#define dont_ignore aircraft_->dont_ignore
|
||||
bool ignore_unknown_keywords;
|
||||
#define ignore_unknown_keywords aircraft_->ignore_unknown_keywords
|
||||
|
||||
int ap_pah_on;
|
||||
#define ap_pah_on aircraft_->ap_pah_on
|
||||
|
@ -2738,6 +2967,12 @@ struct AIRCRAFT
|
|||
#define ap_Theta_ref_deg aircraft_->ap_Theta_ref_deg
|
||||
#define ap_Theta_ref_rad aircraft_->ap_Theta_ref_rad
|
||||
|
||||
int ap_alh_on;
|
||||
#define ap_alh_on aircraft_->ap_alh_on
|
||||
double ap_alt_ref_ft, ap_alt_ref_m;
|
||||
#define ap_alt_ref_ft aircraft_->ap_alt_ref_ft
|
||||
#define ap_alt_ref_m aircraft_->ap_alt_ref_m
|
||||
|
||||
int pitch_trim_up, pitch_trim_down;
|
||||
#define pitch_trim_up aircraft_->pitch_trim_up
|
||||
#define pitch_trim_down aircraft_->pitch_trim_down
|
||||
|
@ -2750,6 +2985,14 @@ struct AIRCRAFT
|
|||
#define ice_left aircraft_->ice_left
|
||||
#define ice_right aircraft_->ice_right
|
||||
|
||||
// Variables for the trigger command
|
||||
int trigger_on, trigger_last_time_step, trigger_num;
|
||||
int trigger_toggle, trigger_counter;
|
||||
#define trigger_on aircraft_->trigger_on
|
||||
#define trigger_last_time_step aircraft_->trigger_last_time_step
|
||||
#define trigger_num aircraft_->trigger_num
|
||||
#define trigger_toggle aircraft_->trigger_toggle
|
||||
#define trigger_counter aircraft_->trigger_counter
|
||||
};
|
||||
|
||||
extern AIRCRAFT *aircraft_; // usually defined in the first program that includes uiuc_aircraft.h
|
||||
|
|
95
src/FDM/UIUCModel/uiuc_alh_ap.cpp
Normal file
95
src/FDM/UIUCModel/uiuc_alh_ap.cpp
Normal file
|
@ -0,0 +1,95 @@
|
|||
// * *
|
||||
// * alh_ap.C *
|
||||
// * *
|
||||
// * ALH autopilot function. takes in the state *
|
||||
// * variables and reference height as arguments *
|
||||
// * (there are other variable too as arguments *
|
||||
// * as listed below) *
|
||||
// * and returns the elevator deflection angle at *
|
||||
// * every time step. *
|
||||
// * *
|
||||
// * Written 7/8/02 by Vikrant Sharma *
|
||||
// * *
|
||||
// *****************************************************
|
||||
|
||||
//#include <iostream.h>
|
||||
//#include <stddef.h>
|
||||
|
||||
// define u2prev,ubarprev,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:
|
||||
// H - Current Height of the a/c at the current simulation time.
|
||||
// pitch - Current pitch angle ,,,,,,,,,,,,
|
||||
// pitchrate - current rate of change of pitch angle
|
||||
// H_ref - reference Height differential wanted
|
||||
// sample_t - sampling time
|
||||
// V - aircraft's current velocity
|
||||
// u2prev - u2 value at the previous time step.
|
||||
// ubar prev - ubar ,,,,,,,,,,,,,,,,,,,,,,,
|
||||
// x1prev - x1 ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
// x2prev - x2 ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
// x3prev - x3 ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
// the autpilot function (alh_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 changed float to double
|
||||
|
||||
#include "uiuc_alh_ap.h"
|
||||
|
||||
double alh_ap(double pitch, double pitchrate, double H_ref, double H,
|
||||
double V, double sample_t, int init)
|
||||
{
|
||||
// changes by RD so function keeps previous values
|
||||
static double u2prev;
|
||||
static double x1prev;
|
||||
static double x2prev;
|
||||
static double x3prev;
|
||||
static double ubarprev;
|
||||
|
||||
double pi = 3.14159;
|
||||
|
||||
if (init == 0)
|
||||
{
|
||||
u2prev = 0;
|
||||
x1prev = 0;
|
||||
x2prev = 0;
|
||||
x3prev = 0;
|
||||
ubarprev = 0;
|
||||
}
|
||||
|
||||
double Ki;
|
||||
double Ktheta;
|
||||
double Kq;
|
||||
double deltae;
|
||||
double Kh,Kd;
|
||||
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;
|
||||
Kh = -0.25*pi/180 + (((-0.15 + 0.25)*pi/180)/(20))*(V-60);
|
||||
Kd = -0.0025*V + 0.2875;
|
||||
double u1,u2,u3,ubar;
|
||||
ubar = (1-Kd*sample_t)*ubarprev + Ktheta*pitchrate*sample_t;
|
||||
u1 = Kh*(H_ref-H) - ubar;
|
||||
u2 = u2prev + Ki*(Kh*(H_ref-H)-ubar)*sample_t;
|
||||
u3 = Kq*pitchrate;
|
||||
double totalU;
|
||||
totalU = u1 + u2 - u3;
|
||||
u2prev = u2;
|
||||
ubarprev = ubar;
|
||||
// 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_alh_ap.h
Normal file
8
src/FDM/UIUCModel/uiuc_alh_ap.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
|
||||
#ifndef _ALH_AP_H_
|
||||
#define _ALH_AP_H_
|
||||
|
||||
double alh_ap(double pitch, double pitchrate, double H_ref, double H,
|
||||
double V, double sample_t, int init);
|
||||
|
||||
#endif //_ALH_AP_H_
|
|
@ -34,7 +34,7 @@
|
|||
----------------------------------------------------------------------
|
||||
|
||||
AUTHOR(S): Bipin Sehgal <bsehgal@uiuc.edu>
|
||||
Jeff Scott <jscott@mail.com>
|
||||
Jeff Scott http://www.jeffscott.net/
|
||||
Robert Deters <rdeters@uiuc.edu>
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
@ -111,7 +111,7 @@ void uiuc_coef_drag()
|
|||
CDo = uiuc_ice_filter(CDo_clean,kCDo);
|
||||
}
|
||||
CDo_save = CDo;
|
||||
CD += CDo;
|
||||
CD += CDo_save;
|
||||
break;
|
||||
}
|
||||
case CDK_flag:
|
||||
|
@ -120,8 +120,15 @@ void uiuc_coef_drag()
|
|||
{
|
||||
CDK = uiuc_ice_filter(CDK_clean,kCDK);
|
||||
}
|
||||
CDK_save = CDK * CL * CL;
|
||||
CD += CDK * CL * CL;
|
||||
if (b_CLK)
|
||||
{
|
||||
CDK_save = CDK * (CL - CLK) * (CL - CLK);
|
||||
}
|
||||
else
|
||||
{
|
||||
CDK_save = CDK * CL * CL;
|
||||
}
|
||||
CD += CDK_save;
|
||||
break;
|
||||
}
|
||||
case CD_a_flag:
|
||||
|
@ -131,7 +138,7 @@ void uiuc_coef_drag()
|
|||
CD_a = uiuc_ice_filter(CD_a_clean,kCD_a);
|
||||
}
|
||||
CD_a_save = CD_a * Alpha;
|
||||
CD += CD_a * Alpha;
|
||||
CD += CD_a_save;
|
||||
break;
|
||||
}
|
||||
case CD_adot_flag:
|
||||
|
@ -143,7 +150,7 @@ void uiuc_coef_drag()
|
|||
/* CD_adot must be mulitplied by cbar/2U
|
||||
(see Roskam Control book, Part 1, pg. 147) */
|
||||
CD_adot_save = CD_adot * Alpha_dot * cbar_2U;
|
||||
CD += CD_adot * Alpha_dot * cbar_2U;
|
||||
CD += CD_adot_save;
|
||||
break;
|
||||
}
|
||||
case CD_q_flag:
|
||||
|
@ -157,13 +164,13 @@ void uiuc_coef_drag()
|
|||
/* why multiply by Theta_dot instead of Q_body?
|
||||
see note in coef_lift.cpp */
|
||||
CD_q_save = CD_q * Theta_dot * cbar_2U;
|
||||
CD += CD_q * Theta_dot * cbar_2U;
|
||||
CD += CD_q_save;
|
||||
break;
|
||||
}
|
||||
case CD_ih_flag:
|
||||
{
|
||||
CD_ih_save = fabs(CD_ih * ih);
|
||||
CD += fabs(CD_ih * ih);
|
||||
CD += CD_ih_save;
|
||||
break;
|
||||
}
|
||||
case CD_de_flag:
|
||||
|
@ -173,7 +180,43 @@ void uiuc_coef_drag()
|
|||
CD_de = uiuc_ice_filter(CD_de_clean,kCD_de);
|
||||
}
|
||||
CD_de_save = fabs(CD_de * elevator);
|
||||
CD += fabs(CD_de * elevator);
|
||||
CD += CD_de_save;
|
||||
break;
|
||||
}
|
||||
case CD_dr_flag:
|
||||
{
|
||||
CD_dr_save = fabs(CD_dr * rudder);
|
||||
CD += CD_dr_save;
|
||||
break;
|
||||
}
|
||||
case CD_da_flag:
|
||||
{
|
||||
CD_da_save = fabs(CD_da * aileron);
|
||||
CD += CD_da_save;
|
||||
break;
|
||||
}
|
||||
case CD_beta_flag:
|
||||
{
|
||||
CD_beta_save = fabs(CD_beta * Beta);
|
||||
CD += CD_beta_save;
|
||||
break;
|
||||
}
|
||||
case CD_df_flag:
|
||||
{
|
||||
CD_df_save = fabs(CD_df * flap_pos);
|
||||
CD += CD_df_save;
|
||||
break;
|
||||
}
|
||||
case CD_ds_flag:
|
||||
{
|
||||
CD_ds_save = fabs(CD_ds * spoiler_pos);
|
||||
CD += CD_ds_save;
|
||||
break;
|
||||
}
|
||||
case CD_dg_flag:
|
||||
{
|
||||
CD_dg_save = fabs(CD_dg * gear_pos_norm);
|
||||
CD += CD_dg_save;
|
||||
break;
|
||||
}
|
||||
case CDfa_flag:
|
||||
|
@ -199,7 +242,7 @@ void uiuc_coef_drag()
|
|||
CDfdfI = uiuc_1Dinterpolation(CDfdf_dfArray,
|
||||
CDfdf_CDArray,
|
||||
CDfdf_ndf,
|
||||
flap);
|
||||
flap_pos);
|
||||
CD += CDfdfI;
|
||||
break;
|
||||
}
|
||||
|
@ -223,7 +266,7 @@ void uiuc_coef_drag()
|
|||
CDfadf_nAlphaArray,
|
||||
CDfadf_ndf,
|
||||
Alpha,
|
||||
flap);
|
||||
flap_pos);
|
||||
CD += CDfadfI;
|
||||
break;
|
||||
}
|
||||
|
@ -241,7 +284,7 @@ void uiuc_coef_drag()
|
|||
}
|
||||
}
|
||||
CXo_save = CXo;
|
||||
CX += CXo;
|
||||
CX += CXo_save;
|
||||
break;
|
||||
}
|
||||
case CXK_flag:
|
||||
|
@ -258,7 +301,7 @@ void uiuc_coef_drag()
|
|||
}
|
||||
}
|
||||
CXK_save = CXK * CZ * CZ;
|
||||
CX += CXK * CZ * CZ;
|
||||
CX += CXK_save;
|
||||
break;
|
||||
}
|
||||
case CX_a_flag:
|
||||
|
@ -275,7 +318,7 @@ void uiuc_coef_drag()
|
|||
}
|
||||
}
|
||||
CX_a_save = CX_a * Alpha;
|
||||
CX += CX_a * Alpha;
|
||||
CX += CX_a_save;
|
||||
break;
|
||||
}
|
||||
case CX_a2_flag:
|
||||
|
@ -292,7 +335,7 @@ void uiuc_coef_drag()
|
|||
}
|
||||
}
|
||||
CX_a2_save = CX_a2 * Alpha * Alpha;
|
||||
CX += CX_a2 * Alpha * Alpha;
|
||||
CX += CX_a2_save;
|
||||
break;
|
||||
}
|
||||
case CX_a3_flag:
|
||||
|
@ -309,7 +352,7 @@ void uiuc_coef_drag()
|
|||
}
|
||||
}
|
||||
CX_a3_save = CX_a3 * Alpha * Alpha * Alpha;
|
||||
CX += CX_a3 * Alpha * Alpha * Alpha;
|
||||
CX += CX_a3_save;
|
||||
break;
|
||||
}
|
||||
case CX_adot_flag:
|
||||
|
@ -328,7 +371,7 @@ void uiuc_coef_drag()
|
|||
/* CX_adot must be mulitplied by cbar/2U
|
||||
(see Roskam Control book, Part 1, pg. 147) */
|
||||
CX_adot_save = CX_adot * Alpha_dot * cbar_2U;
|
||||
CX += CX_adot * Alpha_dot * cbar_2U;
|
||||
CX += CX_adot_save;
|
||||
break;
|
||||
}
|
||||
case CX_q_flag:
|
||||
|
@ -347,7 +390,7 @@ void uiuc_coef_drag()
|
|||
/* CX_q must be mulitplied by cbar/2U
|
||||
(see Roskam Control book, Part 1, pg. 147) */
|
||||
CX_q_save = CX_q * Q_body * cbar_2U;
|
||||
CX += CX_q * Q_body * cbar_2U;
|
||||
CX += CX_q_save;
|
||||
break;
|
||||
}
|
||||
case CX_de_flag:
|
||||
|
@ -364,7 +407,7 @@ void uiuc_coef_drag()
|
|||
}
|
||||
}
|
||||
CX_de_save = CX_de * elevator;
|
||||
CX += CX_de * elevator;
|
||||
CX += CX_de_save;
|
||||
break;
|
||||
}
|
||||
case CX_dr_flag:
|
||||
|
@ -381,7 +424,7 @@ void uiuc_coef_drag()
|
|||
}
|
||||
}
|
||||
CX_dr_save = CX_dr * rudder;
|
||||
CX += CX_dr * rudder;
|
||||
CX += CX_dr_save;
|
||||
break;
|
||||
}
|
||||
case CX_df_flag:
|
||||
|
@ -391,14 +434,14 @@ void uiuc_coef_drag()
|
|||
CX_df = uiuc_ice_filter(CX_df_clean,kCX_df);
|
||||
if (beta_model)
|
||||
{
|
||||
CXclean_wing += CX_df_clean * flap;
|
||||
CXclean_tail += CX_df_clean * flap;
|
||||
CXiced_wing += CX * flap;
|
||||
CXiced_tail += CX * flap;
|
||||
CXclean_wing += CX_df_clean * flap_pos;
|
||||
CXclean_tail += CX_df_clean * flap_pos;
|
||||
CXiced_wing += CX * flap_pos;
|
||||
CXiced_tail += CX * flap_pos;
|
||||
}
|
||||
}
|
||||
CX_df_save = CX_df * flap;
|
||||
CX += CX_df * flap;
|
||||
CX_df_save = CX_df * flap_pos;
|
||||
CX += CX_df_save;
|
||||
break;
|
||||
}
|
||||
case CX_adf_flag:
|
||||
|
@ -408,14 +451,14 @@ void uiuc_coef_drag()
|
|||
CX_adf = uiuc_ice_filter(CX_adf_clean,kCX_adf);
|
||||
if (beta_model)
|
||||
{
|
||||
CXclean_wing += CX_adf_clean * Alpha * flap;
|
||||
CXclean_tail += CX_adf_clean * Alpha * flap;
|
||||
CXiced_wing += CX_adf * Alpha * flap;
|
||||
CXiced_tail += CX_adf * Alpha * flap;
|
||||
CXclean_wing += CX_adf_clean * Alpha * flap_pos;
|
||||
CXclean_tail += CX_adf_clean * Alpha * flap_pos;
|
||||
CXiced_wing += CX_adf * Alpha * flap_pos;
|
||||
CXiced_tail += CX_adf * Alpha * flap_pos;
|
||||
}
|
||||
}
|
||||
CX_adf_save = CX_adf * Alpha * flap;
|
||||
CX += CX_adf * Alpha * flap;
|
||||
CX_adf_save = CX_adf * Alpha * flap_pos;
|
||||
CX += CX_adf_save;
|
||||
break;
|
||||
}
|
||||
case CXfabetaf_flag:
|
||||
|
|
|
@ -119,7 +119,7 @@ void uiuc_coef_lift()
|
|||
}
|
||||
}
|
||||
CLo_save = CLo;
|
||||
CL += CLo;
|
||||
CL += CLo_save;
|
||||
break;
|
||||
}
|
||||
case CL_a_flag:
|
||||
|
@ -136,7 +136,7 @@ void uiuc_coef_lift()
|
|||
}
|
||||
}
|
||||
CL_a_save = CL_a * Alpha;
|
||||
CL += CL_a * Alpha;
|
||||
CL += CL_a_save;
|
||||
break;
|
||||
}
|
||||
case CL_adot_flag:
|
||||
|
@ -155,7 +155,7 @@ void uiuc_coef_lift()
|
|||
/* CL_adot must be mulitplied by cbar/2U
|
||||
(see Roskam Control book, Part 1, pg. 147) */
|
||||
CL_adot_save = CL_adot * Alpha_dot * cbar_2U;
|
||||
CL += CL_adot * Alpha_dot * cbar_2U;
|
||||
CL += CL_adot_save;
|
||||
break;
|
||||
}
|
||||
case CL_q_flag:
|
||||
|
@ -177,13 +177,13 @@ void uiuc_coef_lift()
|
|||
that is what is done in c172_aero.c; assume it
|
||||
has something to do with axes systems */
|
||||
CL_q_save = CL_q * Theta_dot * cbar_2U;
|
||||
CL += CL_q * Theta_dot * cbar_2U;
|
||||
CL += CL_q_save;
|
||||
break;
|
||||
}
|
||||
case CL_ih_flag:
|
||||
{
|
||||
CL_ih_save = CL_ih * ih;
|
||||
CL += CL_ih * ih;
|
||||
CL += CL_ih_save;
|
||||
break;
|
||||
}
|
||||
case CL_de_flag:
|
||||
|
@ -200,7 +200,25 @@ void uiuc_coef_lift()
|
|||
}
|
||||
}
|
||||
CL_de_save = CL_de * elevator;
|
||||
CL += CL_de * elevator;
|
||||
CL += CL_de_save;
|
||||
break;
|
||||
}
|
||||
case CL_df_flag:
|
||||
{
|
||||
CL_df_save = CL_df * flap_pos;
|
||||
CL += CL_df_save;
|
||||
break;
|
||||
}
|
||||
case CL_ds_flag:
|
||||
{
|
||||
CL_ds_save = CL_ds * spoiler_pos;
|
||||
CL += CL_ds_save;
|
||||
break;
|
||||
}
|
||||
case CL_dg_flag:
|
||||
{
|
||||
CL_dg_save = CL_dg * gear_pos_norm;
|
||||
CL += CL_dg_save;
|
||||
break;
|
||||
}
|
||||
case CLfa_flag:
|
||||
|
@ -259,7 +277,7 @@ void uiuc_coef_lift()
|
|||
}
|
||||
}
|
||||
CZo_save = CZo;
|
||||
CZ += CZo;
|
||||
CZ += CZo_save;
|
||||
break;
|
||||
}
|
||||
case CZ_a_flag:
|
||||
|
@ -276,7 +294,7 @@ void uiuc_coef_lift()
|
|||
}
|
||||
}
|
||||
CZ_a_save = CZ_a * Alpha;
|
||||
CZ += CZ_a * Alpha;
|
||||
CZ += CZ_a_save;
|
||||
break;
|
||||
}
|
||||
case CZ_a2_flag:
|
||||
|
@ -293,7 +311,7 @@ void uiuc_coef_lift()
|
|||
}
|
||||
}
|
||||
CZ_a2_save = CZ_a2 * Alpha * Alpha;
|
||||
CZ += CZ_a2 * Alpha * Alpha;
|
||||
CZ += CZ_a2_save;
|
||||
break;
|
||||
}
|
||||
case CZ_a3_flag:
|
||||
|
@ -310,7 +328,7 @@ void uiuc_coef_lift()
|
|||
}
|
||||
}
|
||||
CZ_a3_save = CZ_a3 * Alpha * Alpha * Alpha;
|
||||
CZ += CZ_a3 * Alpha * Alpha * Alpha;
|
||||
CZ += CZ_a3_save;
|
||||
break;
|
||||
}
|
||||
case CZ_adot_flag:
|
||||
|
@ -329,7 +347,7 @@ void uiuc_coef_lift()
|
|||
/* CZ_adot must be mulitplied by cbar/2U
|
||||
(see Roskam Control book, Part 1, pg. 147) */
|
||||
CZ_adot_save = CZ_adot * Alpha_dot * cbar_2U;
|
||||
CZ += CZ_adot * Alpha_dot * cbar_2U;
|
||||
CZ += CZ_adot_save;
|
||||
break;
|
||||
}
|
||||
case CZ_q_flag:
|
||||
|
@ -348,7 +366,7 @@ void uiuc_coef_lift()
|
|||
/* CZ_q must be mulitplied by cbar/2U
|
||||
(see Roskam Control book, Part 1, pg. 147) */
|
||||
CZ_q_save = CZ_q * Q_body * cbar_2U;
|
||||
CZ += CZ_q * Q_body * cbar_2U;
|
||||
CZ += CZ_q_save;
|
||||
break;
|
||||
}
|
||||
case CZ_de_flag:
|
||||
|
@ -365,7 +383,7 @@ void uiuc_coef_lift()
|
|||
}
|
||||
}
|
||||
CZ_de_save = CZ_de * elevator;
|
||||
CZ += CZ_de * elevator;
|
||||
CZ += CZ_de_save;
|
||||
break;
|
||||
}
|
||||
case CZ_deb2_flag:
|
||||
|
@ -382,7 +400,7 @@ void uiuc_coef_lift()
|
|||
}
|
||||
}
|
||||
CZ_deb2_save = CZ_deb2 * elevator * Beta * Beta;
|
||||
CZ += CZ_deb2 * elevator * Beta * Beta;
|
||||
CZ += CZ_deb2_save;
|
||||
break;
|
||||
}
|
||||
case CZ_df_flag:
|
||||
|
@ -392,14 +410,14 @@ void uiuc_coef_lift()
|
|||
CZ_df = uiuc_ice_filter(CZ_df_clean,kCZ_df);
|
||||
if (beta_model)
|
||||
{
|
||||
CZclean_wing += CZ_df_clean * flap;
|
||||
CZclean_tail += CZ_df_clean * flap;
|
||||
CZiced_wing += CZ_df * flap;
|
||||
CZiced_tail += CZ_df * flap;
|
||||
CZclean_wing += CZ_df_clean * flap_pos;
|
||||
CZclean_tail += CZ_df_clean * flap_pos;
|
||||
CZiced_wing += CZ_df * flap_pos;
|
||||
CZiced_tail += CZ_df * flap_pos;
|
||||
}
|
||||
}
|
||||
CZ_df_save = CZ_df * flap;
|
||||
CZ += CZ_df * flap;
|
||||
CZ_df_save = CZ_df * flap_pos;
|
||||
CZ += CZ_df_save;
|
||||
break;
|
||||
}
|
||||
case CZ_adf_flag:
|
||||
|
@ -409,14 +427,14 @@ void uiuc_coef_lift()
|
|||
CZ_adf = uiuc_ice_filter(CZ_adf_clean,kCZ_adf);
|
||||
if (beta_model)
|
||||
{
|
||||
CZclean_wing += CZ_adf_clean * Alpha * flap;
|
||||
CZclean_tail += CZ_adf_clean * Alpha * flap;
|
||||
CZiced_wing += CZ_adf * Alpha * flap;
|
||||
CZiced_tail += CZ_adf * Alpha * flap;
|
||||
CZclean_wing += CZ_adf_clean * Alpha * flap_pos;
|
||||
CZclean_tail += CZ_adf_clean * Alpha * flap_pos;
|
||||
CZiced_wing += CZ_adf * Alpha * flap_pos;
|
||||
CZiced_tail += CZ_adf * Alpha * flap_pos;
|
||||
}
|
||||
}
|
||||
CZ_adf_save = CZ_adf * Alpha * flap;
|
||||
CZ += CZ_adf * Alpha * flap;
|
||||
CZ_adf_save = CZ_adf * Alpha * flap_pos;
|
||||
CZ += CZ_adf_save;
|
||||
break;
|
||||
}
|
||||
case CZfa_flag:
|
||||
|
|
|
@ -112,7 +112,7 @@ void uiuc_coef_pitch()
|
|||
Cmo = uiuc_ice_filter(Cmo_clean,kCmo);
|
||||
}
|
||||
Cmo_save = Cmo;
|
||||
Cm += Cmo;
|
||||
Cm += Cmo_save;
|
||||
break;
|
||||
}
|
||||
case Cm_a_flag:
|
||||
|
@ -122,7 +122,7 @@ void uiuc_coef_pitch()
|
|||
Cm_a = uiuc_ice_filter(Cm_a_clean,kCm_a);
|
||||
}
|
||||
Cm_a_save = Cm_a * Alpha;
|
||||
Cm += Cm_a * Alpha;
|
||||
Cm += Cm_a_save;
|
||||
break;
|
||||
}
|
||||
case Cm_a2_flag:
|
||||
|
@ -132,7 +132,7 @@ void uiuc_coef_pitch()
|
|||
Cm_a2 = uiuc_ice_filter(Cm_a2_clean,kCm_a2);
|
||||
}
|
||||
Cm_a2_save = Cm_a2 * Alpha * Alpha;
|
||||
Cm += Cm_a2 * Alpha * Alpha;
|
||||
Cm += Cm_a2_save;
|
||||
break;
|
||||
}
|
||||
case Cm_adot_flag:
|
||||
|
@ -144,7 +144,6 @@ void uiuc_coef_pitch()
|
|||
/* Cm_adot must be mulitplied by cbar/2U
|
||||
(see Roskam Control book, Part 1, pg. 147) */
|
||||
Cm_adot_save = Cm_adot * Alpha_dot * cbar_2U;
|
||||
//Cm += Cm_adot * Alpha_dot * cbar_2U;
|
||||
if (eta_q_Cm_adot_fac)
|
||||
{
|
||||
Cm += Cm_adot_save * eta_q_Cm_adot_fac;
|
||||
|
@ -164,7 +163,6 @@ void uiuc_coef_pitch()
|
|||
/* Cm_q must be mulitplied by cbar/2U
|
||||
(see Roskam Control book, Part 1, pg. 147) */
|
||||
Cm_q_save = Cm_q * Q_body * cbar_2U;
|
||||
// Cm += Cm_q * Q_body * cbar_2U;
|
||||
if (eta_q_Cm_q_fac)
|
||||
{
|
||||
Cm += Cm_q_save * eta_q_Cm_q_fac;
|
||||
|
@ -178,7 +176,7 @@ void uiuc_coef_pitch()
|
|||
case Cm_ih_flag:
|
||||
{
|
||||
Cm_ih_save = Cm_ih * ih;
|
||||
Cm += Cm_ih * ih;
|
||||
Cm += Cm_ih_save;
|
||||
break;
|
||||
}
|
||||
case Cm_de_flag:
|
||||
|
@ -188,7 +186,14 @@ void uiuc_coef_pitch()
|
|||
Cm_de = uiuc_ice_filter(Cm_de_clean,kCm_de);
|
||||
}
|
||||
Cm_de_save = Cm_de * elevator;
|
||||
Cm += Cm_de * elevator;
|
||||
if (eta_q_Cm_de_fac)
|
||||
{
|
||||
Cm += Cm_de_save * eta_q_Cm_de_fac;
|
||||
}
|
||||
else
|
||||
{
|
||||
Cm += Cm_de_save;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Cm_b2_flag:
|
||||
|
@ -198,7 +203,7 @@ void uiuc_coef_pitch()
|
|||
Cm_b2 = uiuc_ice_filter(Cm_b2_clean,kCm_b2);
|
||||
}
|
||||
Cm_b2_save = Cm_b2 * Beta * Beta;
|
||||
Cm += Cm_b2 * Beta * Beta;
|
||||
Cm += Cm_b2_save;
|
||||
break;
|
||||
}
|
||||
case Cm_r_flag:
|
||||
|
@ -208,7 +213,7 @@ void uiuc_coef_pitch()
|
|||
Cm_r = uiuc_ice_filter(Cm_r_clean,kCm_r);
|
||||
}
|
||||
Cm_r_save = Cm_r * R_body * b_2U;
|
||||
Cm += Cm_r * R_body * b_2U;
|
||||
Cm += Cm_r_save;
|
||||
break;
|
||||
}
|
||||
case Cm_df_flag:
|
||||
|
@ -217,8 +222,20 @@ void uiuc_coef_pitch()
|
|||
{
|
||||
Cm_df = uiuc_ice_filter(Cm_df_clean,kCm_df);
|
||||
}
|
||||
Cm_df_save = Cm_df * flap;
|
||||
Cm += Cm_df * flap;
|
||||
Cm_df_save = Cm_df * flap_pos;
|
||||
Cm += Cm_df_save;
|
||||
break;
|
||||
}
|
||||
case Cm_ds_flag:
|
||||
{
|
||||
Cm_ds_save = Cm_ds * spoiler_pos;
|
||||
Cm += Cm_ds_save;
|
||||
break;
|
||||
}
|
||||
case Cm_dg_flag:
|
||||
{
|
||||
Cm_dg_save = Cm_dg * gear_pos_norm;
|
||||
Cm += Cm_dg_save;
|
||||
break;
|
||||
}
|
||||
case Cmfa_flag:
|
||||
|
@ -285,7 +302,7 @@ void uiuc_coef_pitch()
|
|||
CmfdfI = uiuc_1Dinterpolation(Cmfdf_dfArray,
|
||||
Cmfdf_CmArray,
|
||||
Cmfdf_ndf,
|
||||
flap);
|
||||
flap_pos);
|
||||
Cm += CmfdfI;
|
||||
break;
|
||||
}
|
||||
|
@ -297,7 +314,7 @@ void uiuc_coef_pitch()
|
|||
Cmfadf_nAlphaArray,
|
||||
Cmfadf_ndf,
|
||||
Alpha,
|
||||
flap);
|
||||
flap_pos);
|
||||
Cm += CmfadfI;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ void uiuc_coef_roll()
|
|||
Clo = uiuc_ice_filter(Clo_clean,kClo);
|
||||
}
|
||||
Clo_save = Clo;
|
||||
Cl += Clo;
|
||||
Cl += Clo_save;
|
||||
break;
|
||||
}
|
||||
case Cl_beta_flag:
|
||||
|
@ -124,7 +124,6 @@ void uiuc_coef_roll()
|
|||
Cl_beta = uiuc_ice_filter(Cl_beta_clean,kCl_beta);
|
||||
}
|
||||
Cl_beta_save = Cl_beta * Beta;
|
||||
// Cl += Cl_beta * Beta;
|
||||
if (eta_q_Cl_beta_fac)
|
||||
{
|
||||
Cl += Cl_beta_save * eta_q_Cl_beta_fac;
|
||||
|
@ -144,7 +143,6 @@ void uiuc_coef_roll()
|
|||
/* Cl_p must be mulitplied by b/2U
|
||||
(see Roskam Control book, Part 1, pg. 147) */
|
||||
Cl_p_save = Cl_p * P_body * b_2U;
|
||||
// Cl += Cl_p * P_body * b_2U;
|
||||
if (eta_q_Cl_p_fac)
|
||||
{
|
||||
Cl += Cl_p_save * eta_q_Cl_p_fac;
|
||||
|
@ -164,7 +162,6 @@ void uiuc_coef_roll()
|
|||
/* Cl_r must be mulitplied by b/2U
|
||||
(see Roskam Control book, Part 1, pg. 147) */
|
||||
Cl_r_save = Cl_r * R_body * b_2U;
|
||||
// Cl += Cl_r * R_body * b_2U;
|
||||
if (eta_q_Cl_r_fac)
|
||||
{
|
||||
Cl += Cl_r_save * eta_q_Cl_r_fac;
|
||||
|
@ -182,7 +179,7 @@ void uiuc_coef_roll()
|
|||
Cl_da = uiuc_ice_filter(Cl_da_clean,kCl_da);
|
||||
}
|
||||
Cl_da_save = Cl_da * aileron;
|
||||
Cl += Cl_da * aileron;
|
||||
Cl += Cl_da_save;
|
||||
break;
|
||||
}
|
||||
case Cl_dr_flag:
|
||||
|
@ -192,7 +189,6 @@ void uiuc_coef_roll()
|
|||
Cl_dr = uiuc_ice_filter(Cl_dr_clean,kCl_dr);
|
||||
}
|
||||
Cl_dr_save = Cl_dr * rudder;
|
||||
// Cl += Cl_dr * rudder;
|
||||
if (eta_q_Cl_dr_fac)
|
||||
{
|
||||
Cl += Cl_dr_save * eta_q_Cl_dr_fac;
|
||||
|
@ -210,7 +206,7 @@ void uiuc_coef_roll()
|
|||
Cl_daa = uiuc_ice_filter(Cl_daa_clean,kCl_daa);
|
||||
}
|
||||
Cl_daa_save = Cl_daa * aileron * Alpha;
|
||||
Cl += Cl_daa * aileron * Alpha;
|
||||
Cl += Cl_daa_save;
|
||||
break;
|
||||
}
|
||||
case Clfada_flag:
|
||||
|
|
|
@ -114,7 +114,7 @@ void uiuc_coef_sideforce()
|
|||
CYo = uiuc_ice_filter(CYo_clean,kCYo);
|
||||
}
|
||||
CYo_save = CYo;
|
||||
CY += CYo;
|
||||
CY += CYo_save;
|
||||
break;
|
||||
}
|
||||
case CY_beta_flag:
|
||||
|
@ -124,7 +124,6 @@ void uiuc_coef_sideforce()
|
|||
CY_beta = uiuc_ice_filter(CY_beta_clean,kCY_beta);
|
||||
}
|
||||
CY_beta_save = CY_beta * Beta;
|
||||
// CY += CY_beta * Beta;
|
||||
if (eta_q_CY_beta_fac)
|
||||
{
|
||||
CY += CY_beta_save * eta_q_CY_beta_fac;
|
||||
|
@ -144,7 +143,6 @@ void uiuc_coef_sideforce()
|
|||
/* CY_p must be mulitplied by b/2U
|
||||
(see Roskam Control book, Part 1, pg. 147) */
|
||||
CY_p_save = CY_p * P_body * b_2U;
|
||||
// CY += CY_p * P_body * b_2U;
|
||||
if (eta_q_CY_p_fac)
|
||||
{
|
||||
CY += CY_p_save * eta_q_CY_p_fac;
|
||||
|
@ -164,7 +162,6 @@ void uiuc_coef_sideforce()
|
|||
/* CY_r must be mulitplied by b/2U
|
||||
(see Roskam Control book, Part 1, pg. 147) */
|
||||
CY_r_save = CY_r * R_body * b_2U;
|
||||
// CY += CY_r * R_body * b_2U;
|
||||
if (eta_q_CY_r_fac)
|
||||
{
|
||||
CY += CY_r_save * eta_q_CY_r_fac;
|
||||
|
@ -182,7 +179,7 @@ void uiuc_coef_sideforce()
|
|||
CY_da = uiuc_ice_filter(CY_da_clean,kCY_da);
|
||||
}
|
||||
CY_da_save = CY_da * aileron;
|
||||
CY += CY_da * aileron;
|
||||
CY += CY_da_save;
|
||||
break;
|
||||
}
|
||||
case CY_dr_flag:
|
||||
|
@ -192,7 +189,6 @@ void uiuc_coef_sideforce()
|
|||
CY_dr = uiuc_ice_filter(CY_dr_clean,kCY_dr);
|
||||
}
|
||||
CY_dr_save = CY_dr * rudder;
|
||||
// CY += CY_dr * rudder;
|
||||
if (eta_q_CY_dr_fac)
|
||||
{
|
||||
CY += CY_dr_save * eta_q_CY_dr_fac;
|
||||
|
@ -210,7 +206,7 @@ void uiuc_coef_sideforce()
|
|||
CY_dra = uiuc_ice_filter(CY_dra_clean,kCY_dra);
|
||||
}
|
||||
CY_dra_save = CY_dra * rudder * Alpha;
|
||||
CY += CY_dra * rudder * Alpha;
|
||||
CY += CY_dra_save;
|
||||
break;
|
||||
}
|
||||
case CY_bdot_flag:
|
||||
|
@ -220,7 +216,7 @@ void uiuc_coef_sideforce()
|
|||
CY_bdot = uiuc_ice_filter(CY_bdot_clean,kCY_bdot);
|
||||
}
|
||||
CY_bdot_save = CY_bdot * Beta_dot * b_2U;
|
||||
CY += CY_bdot * Beta_dot * b_2U;
|
||||
CY += CY_bdot_save;
|
||||
break;
|
||||
}
|
||||
case CYfada_flag:
|
||||
|
|
|
@ -114,7 +114,7 @@ void uiuc_coef_yaw()
|
|||
Cno = uiuc_ice_filter(Cno_clean,kCno);
|
||||
}
|
||||
Cno_save = Cno;
|
||||
Cn += Cno;
|
||||
Cn += Cno_save;
|
||||
break;
|
||||
}
|
||||
case Cn_beta_flag:
|
||||
|
@ -124,7 +124,6 @@ void uiuc_coef_yaw()
|
|||
Cn_beta = uiuc_ice_filter(Cn_beta_clean,kCn_beta);
|
||||
}
|
||||
Cn_beta_save = Cn_beta * Beta;
|
||||
// Cn += Cn_beta * Beta;
|
||||
if (eta_q_Cn_beta_fac)
|
||||
{
|
||||
Cn += Cn_beta_save * eta_q_Cn_beta_fac;
|
||||
|
@ -144,7 +143,6 @@ void uiuc_coef_yaw()
|
|||
/* Cn_p must be mulitplied by b/2U
|
||||
(see Roskam Control book, Part 1, pg. 147) */
|
||||
Cn_p_save = Cn_p * P_body * b_2U;
|
||||
// Cn += Cn_p * P_body * b_2U;
|
||||
if (eta_q_Cn_p_fac)
|
||||
{
|
||||
Cn += Cn_p_save * eta_q_Cn_p_fac;
|
||||
|
@ -164,7 +162,6 @@ void uiuc_coef_yaw()
|
|||
/* Cn_r must be mulitplied by b/2U
|
||||
(see Roskam Control book, Part 1, pg. 147) */
|
||||
Cn_r_save = Cn_r * R_body * b_2U;
|
||||
// Cn += Cn_r * R_body * b_2U;
|
||||
if (eta_q_Cn_r_fac)
|
||||
{
|
||||
Cn += Cn_r_save * eta_q_Cn_r_fac;
|
||||
|
@ -182,7 +179,7 @@ void uiuc_coef_yaw()
|
|||
Cn_da = uiuc_ice_filter(Cn_da_clean,kCn_da);
|
||||
}
|
||||
Cn_da_save = Cn_da * aileron;
|
||||
Cn += Cn_da * aileron;
|
||||
Cn += Cn_da_save;
|
||||
break;
|
||||
}
|
||||
case Cn_dr_flag:
|
||||
|
@ -192,7 +189,6 @@ void uiuc_coef_yaw()
|
|||
Cn_dr = uiuc_ice_filter(Cn_dr_clean,kCn_dr);
|
||||
}
|
||||
Cn_dr_save = Cn_dr * rudder;
|
||||
// Cn += Cn_dr * rudder;
|
||||
if (eta_q_Cn_dr_fac)
|
||||
{
|
||||
Cn += Cn_dr_save * eta_q_Cn_dr_fac;
|
||||
|
@ -210,7 +206,7 @@ void uiuc_coef_yaw()
|
|||
Cn_q = uiuc_ice_filter(Cn_q_clean,kCn_q);
|
||||
}
|
||||
Cn_q_save = Cn_q * Q_body * cbar_2U;
|
||||
Cn += Cn_q * Q_body * cbar_2U;
|
||||
Cn += Cn_q_save;
|
||||
break;
|
||||
}
|
||||
case Cn_b3_flag:
|
||||
|
@ -220,7 +216,7 @@ void uiuc_coef_yaw()
|
|||
Cn_b3 = uiuc_ice_filter(Cn_b3_clean,kCn_b3);
|
||||
}
|
||||
Cn_b3_save = Cn_b3 * Beta * Beta * Beta;
|
||||
Cn += Cn_b3 * Beta * Beta * Beta;
|
||||
Cn += Cn_b3_save;
|
||||
break;
|
||||
}
|
||||
case Cnfada_flag:
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
pilot_rud_no.
|
||||
07/05/2001 (RD) Added pilot_(elev,ail,rud)_no=false
|
||||
01/11/2002 (AP) Added call to uiuc_bootTime()
|
||||
12/02/2002 (RD) Moved icing demo interpolations to its
|
||||
own function
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
|
@ -96,15 +98,16 @@
|
|||
**********************************************************************/
|
||||
|
||||
#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;
|
||||
static bool ap_pah_on_prev = false;
|
||||
int ap_pah_init = 1;
|
||||
static bool ap_alh_on_prev = false;
|
||||
int ap_alh_init = 1;
|
||||
|
||||
if (Alpha_init_true && Simtime==0)
|
||||
Alpha = Alpha_init;
|
||||
|
@ -220,29 +223,33 @@ void uiuc_coefficients(double dt)
|
|||
uiuc_controlInput();
|
||||
}
|
||||
|
||||
if (icing_demo)
|
||||
{
|
||||
if (demo_ap_pah_on){
|
||||
double time = Simtime - demo_ap_pah_on_startTime;
|
||||
ap_pah_on = uiuc_1Dinterpolation(demo_ap_pah_on_timeArray,
|
||||
demo_ap_pah_on_daArray,
|
||||
demo_ap_pah_on_ntime,
|
||||
time);
|
||||
}
|
||||
if (demo_ap_Theta_ref_deg){
|
||||
double time = Simtime - demo_ap_Theta_ref_deg_startTime;
|
||||
ap_Theta_ref_deg = uiuc_1Dinterpolation(demo_ap_Theta_ref_deg_timeArray,
|
||||
demo_ap_Theta_ref_deg_daArray,
|
||||
demo_ap_Theta_ref_deg_ntime,
|
||||
time);
|
||||
}
|
||||
}
|
||||
if (ap_pah_on)
|
||||
if (ap_pah_on && icing_demo==false)
|
||||
{
|
||||
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 (ap_pah_on_prev == false)
|
||||
ap_pah_init = 0;
|
||||
elevator = pah_ap(Theta, Theta_dot, ap_Theta_ref_rad, V_rel_wind_ms, dt,
|
||||
ap_pah_init);
|
||||
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;
|
||||
}
|
||||
|
||||
if (ap_alh_on && icing_demo==false)
|
||||
{
|
||||
double V_rel_wind_ms;
|
||||
double Altitude_m;
|
||||
V_rel_wind_ms = V_rel_wind * 0.3048;
|
||||
ap_alt_ref_m = ap_alt_ref_ft * 0.3048;
|
||||
Altitude_m = Altitude * 0.3048;
|
||||
if (ap_alh_on_prev == false)
|
||||
ap_alh_init = 0;
|
||||
elevator = alh_ap(Theta, Theta_dot, ap_alt_ref_m, Altitude_m,
|
||||
V_rel_wind_ms, dt, ap_alh_init);
|
||||
if (elevator*RAD_TO_DEG <= -1*demax)
|
||||
elevator = -1*demax * DEG_TO_RAD;
|
||||
if (elevator*RAD_TO_DEG >= demin)
|
||||
|
@ -336,113 +343,7 @@ void uiuc_coefficients(double dt)
|
|||
time);
|
||||
}
|
||||
if (icing_demo)
|
||||
{
|
||||
if (demo_eps_alpha_max) {
|
||||
double time = Simtime - demo_eps_alpha_max_startTime;
|
||||
eps_alpha_max = uiuc_1Dinterpolation(demo_eps_alpha_max_timeArray,
|
||||
demo_eps_alpha_max_daArray,
|
||||
demo_eps_alpha_max_ntime,
|
||||
time);
|
||||
}
|
||||
if (demo_eps_pitch_max) {
|
||||
double time = Simtime - demo_eps_pitch_max_startTime;
|
||||
eps_pitch_max = uiuc_1Dinterpolation(demo_eps_pitch_max_timeArray,
|
||||
demo_eps_pitch_max_daArray,
|
||||
demo_eps_pitch_max_ntime,
|
||||
time);
|
||||
}
|
||||
if (demo_eps_pitch_min) {
|
||||
double time = Simtime - demo_eps_pitch_min_startTime;
|
||||
eps_pitch_min = uiuc_1Dinterpolation(demo_eps_pitch_min_timeArray,
|
||||
demo_eps_pitch_min_daArray,
|
||||
demo_eps_pitch_min_ntime,
|
||||
time);
|
||||
}
|
||||
if (demo_eps_roll_max) {
|
||||
double time = Simtime - demo_eps_roll_max_startTime;
|
||||
eps_roll_max = uiuc_1Dinterpolation(demo_eps_roll_max_timeArray,
|
||||
demo_eps_roll_max_daArray,
|
||||
demo_eps_roll_max_ntime,
|
||||
time);
|
||||
}
|
||||
if (demo_eps_thrust_min) {
|
||||
double time = Simtime - demo_eps_thrust_min_startTime;
|
||||
eps_thrust_min = uiuc_1Dinterpolation(demo_eps_thrust_min_timeArray,
|
||||
demo_eps_thrust_min_daArray,
|
||||
demo_eps_thrust_min_ntime,
|
||||
time);
|
||||
}
|
||||
if (demo_eps_airspeed_max) {
|
||||
double time = Simtime - demo_eps_airspeed_max_startTime;
|
||||
eps_airspeed_max = uiuc_1Dinterpolation(demo_eps_airspeed_max_timeArray,
|
||||
demo_eps_airspeed_max_daArray,
|
||||
demo_eps_airspeed_max_ntime,
|
||||
time);
|
||||
}
|
||||
if (demo_eps_airspeed_min) {
|
||||
double time = Simtime - demo_eps_airspeed_min_startTime;
|
||||
eps_airspeed_min = uiuc_1Dinterpolation(demo_eps_airspeed_min_timeArray,
|
||||
demo_eps_airspeed_min_daArray,
|
||||
demo_eps_airspeed_min_ntime,
|
||||
time);
|
||||
}
|
||||
if (demo_eps_flap_max) {
|
||||
double time = Simtime - demo_eps_flap_max_startTime;
|
||||
eps_flap_max = uiuc_1Dinterpolation(demo_eps_flap_max_timeArray,
|
||||
demo_eps_flap_max_daArray,
|
||||
demo_eps_flap_max_ntime,
|
||||
time);
|
||||
}
|
||||
if (demo_boot_cycle_tail) {
|
||||
double time = Simtime - demo_boot_cycle_tail_startTime;
|
||||
boot_cycle_tail = uiuc_1Dinterpolation(demo_boot_cycle_tail_timeArray,
|
||||
demo_boot_cycle_tail_daArray,
|
||||
demo_boot_cycle_tail_ntime,
|
||||
time);
|
||||
}
|
||||
if (demo_boot_cycle_wing_left) {
|
||||
double time = Simtime - demo_boot_cycle_wing_left_startTime;
|
||||
boot_cycle_wing_left = uiuc_1Dinterpolation(demo_boot_cycle_wing_left_timeArray,
|
||||
demo_boot_cycle_wing_left_daArray,
|
||||
demo_boot_cycle_wing_left_ntime,
|
||||
time);
|
||||
}
|
||||
if (demo_boot_cycle_wing_right) {
|
||||
double time = Simtime - demo_boot_cycle_wing_right_startTime;
|
||||
boot_cycle_wing_right = uiuc_1Dinterpolation(demo_boot_cycle_wing_right_timeArray,
|
||||
demo_boot_cycle_wing_right_daArray,
|
||||
demo_boot_cycle_wing_right_ntime,
|
||||
time);
|
||||
}
|
||||
if (demo_eps_pitch_input) {
|
||||
double time = Simtime - demo_eps_pitch_input_startTime;
|
||||
eps_pitch_input = uiuc_1Dinterpolation(demo_eps_pitch_input_timeArray,
|
||||
demo_eps_pitch_input_daArray,
|
||||
demo_eps_pitch_input_ntime,
|
||||
time);
|
||||
}
|
||||
if (demo_ice_tail) {
|
||||
double time = Simtime - demo_ice_tail_startTime;
|
||||
ice_tail = uiuc_1Dinterpolation(demo_ice_tail_timeArray,
|
||||
demo_ice_tail_daArray,
|
||||
demo_ice_tail_ntime,
|
||||
time);
|
||||
}
|
||||
if (demo_ice_left) {
|
||||
double time = Simtime - demo_ice_left_startTime;
|
||||
ice_left = uiuc_1Dinterpolation(demo_ice_left_timeArray,
|
||||
demo_ice_left_daArray,
|
||||
demo_ice_left_ntime,
|
||||
time);
|
||||
}
|
||||
if (demo_ice_right) {
|
||||
double time = Simtime - demo_ice_right_startTime;
|
||||
ice_right = uiuc_1Dinterpolation(demo_ice_right_timeArray,
|
||||
demo_ice_right_daArray,
|
||||
demo_ice_right_ntime,
|
||||
time);
|
||||
}
|
||||
}
|
||||
uiuc_icing_demo();
|
||||
}
|
||||
|
||||
if (pilot_ail_no)
|
||||
|
|
|
@ -11,12 +11,16 @@
|
|||
#include "uiuc_coef_yaw.h"
|
||||
#include "uiuc_iceboot.h" //Anne's code
|
||||
#include "uiuc_iced_nonlin.h"
|
||||
#include "uiuc_icing_demo.h"
|
||||
#include "uiuc_pah_ap.h"
|
||||
#include "uiuc_alh_ap.h"
|
||||
#include "uiuc_1Dinterpolation.h"
|
||||
#include "uiuc_3Dinterpolation.h"
|
||||
#include "uiuc_warnings_errors.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*/
|
||||
#include <string>
|
||||
|
||||
extern double Simtime;
|
||||
|
||||
|
|
|
@ -139,6 +139,7 @@ void uiuc_engine()
|
|||
if (eta_q_Cm_q_fac) {eta_q_Cm_q *= eta_q * eta_q_Cm_q_fac;}
|
||||
if (eta_q_Cm_adot_fac) {eta_q_Cm_adot *= eta_q * eta_q_Cm_adot_fac;}
|
||||
if (eta_q_Cmfade_fac) {eta_q_Cmfade *= eta_q * eta_q_Cmfade_fac;}
|
||||
if (eta_q_Cm_de_fac) {eta_q_Cm_de *= eta_q * eta_q_Cm_de_fac;}
|
||||
if (eta_q_Cl_beta_fac) {eta_q_Cl_beta *= eta_q * eta_q_Cl_beta_fac;}
|
||||
if (eta_q_Cl_p_fac) {eta_q_Cl_p *= eta_q * eta_q_Cl_p_fac;}
|
||||
if (eta_q_Cl_r_fac) {eta_q_Cl_r *= eta_q * eta_q_Cl_r_fac;}
|
||||
|
|
84
src/FDM/UIUCModel/uiuc_find_position.cpp
Normal file
84
src/FDM/UIUCModel/uiuc_find_position.cpp
Normal file
|
@ -0,0 +1,84 @@
|
|||
/**********************************************************************
|
||||
|
||||
FILENAME: uiuc_find_positon.cpp
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
DESCRIPTION: Determine the position of a surface/object given the
|
||||
command, increment rate, and current position. Outputs
|
||||
new position
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
STATUS: alpha version
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
REFERENCES:
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
HISTORY: 03/03/2003 initial release
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
AUTHOR(S): Robert Deters <rdeters@uiuc.edu>
|
||||
Michael Selig <m-selig@uiuc.edu>
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
VARIABLES:
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
INPUTS: command, increment rate, position
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
OUTPUTS: position
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
CALLED BY: uiuc_aerodeflections()
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
CALLS TO: *
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
COPYRIGHT: (C) 2003 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_find_position.h"
|
||||
|
||||
double uiuc_find_position(double command, double increment_per_timestep,
|
||||
double position)
|
||||
{
|
||||
if (position < command) {
|
||||
position += increment_per_timestep;
|
||||
if (position > command)
|
||||
position = command;
|
||||
}
|
||||
else if (position > command) {
|
||||
position -= increment_per_timestep;
|
||||
if (position < command)
|
||||
position = command;
|
||||
}
|
||||
|
||||
return position;
|
||||
}
|
8
src/FDM/UIUCModel/uiuc_find_position.h
Normal file
8
src/FDM/UIUCModel/uiuc_find_position.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
#ifndef _FIND_POSITION_H_
|
||||
#define _FIND_POSITION_H_
|
||||
|
||||
double uiuc_find_position(double command, double increment_per_timestep,
|
||||
double position);
|
||||
|
||||
|
||||
#endif // _FIND_POSITION_H_
|
323
src/FDM/UIUCModel/uiuc_flapdata.cpp
Normal file
323
src/FDM/UIUCModel/uiuc_flapdata.cpp
Normal file
|
@ -0,0 +1,323 @@
|
|||
/*flapdata.cpp
|
||||
Implements the flapping data class
|
||||
Written by Theresa Robinson
|
||||
robinst@ecf.toronto.edu
|
||||
*/
|
||||
|
||||
//#ifndef flapdata_cpp
|
||||
//#define flapdata_cpp
|
||||
#include "uiuc_flapdata.h"
|
||||
//#include <fstream>
|
||||
#include <cassert>
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
//Implementation of FlapStruct public methods
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
flapStruct::flapStruct(){
|
||||
Lift=0;
|
||||
Thrust=0;
|
||||
Inertia=0;
|
||||
Moment=0;
|
||||
}
|
||||
|
||||
flapStruct::flapStruct(const flapStruct &rhs){
|
||||
Lift=rhs.getLift();
|
||||
Thrust=rhs.getThrust();
|
||||
Inertia=rhs.getInertia();
|
||||
Moment=rhs.getMoment();
|
||||
}
|
||||
|
||||
flapStruct::flapStruct(double newLift, double newThrust, double newMoment, double newInertia){
|
||||
Lift=newLift;
|
||||
Thrust=newThrust;
|
||||
Inertia=newInertia;
|
||||
Moment=newMoment;
|
||||
}
|
||||
|
||||
double flapStruct::getLift() const{
|
||||
return Lift;
|
||||
}
|
||||
|
||||
double flapStruct::getThrust() const{
|
||||
return Thrust;
|
||||
}
|
||||
|
||||
double flapStruct::getInertia() const{
|
||||
return Inertia;
|
||||
}
|
||||
|
||||
double flapStruct::getMoment() const{
|
||||
return Moment;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
//Implementation of FlapData public methods
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
FlapData::FlapData(){
|
||||
liftTable=NULL;
|
||||
thrustTable=NULL;
|
||||
momentTable=NULL;
|
||||
inertiaTable=NULL;
|
||||
|
||||
alphaArray=NULL;
|
||||
speedArray=NULL;
|
||||
freqArray=NULL;
|
||||
phiArray=NULL;
|
||||
|
||||
lastAlphaIndex=0;
|
||||
lastSpeedIndex=0;
|
||||
lastPhiIndex=0;
|
||||
lastFreqIndex=0;
|
||||
}
|
||||
|
||||
//A constructor that takes a file name:
|
||||
//Opens that file and fills all the arrays from it
|
||||
//sets the guesses to zero for the speed and halfway
|
||||
//along the array for the alpha and frequency
|
||||
//All it does is call init
|
||||
|
||||
FlapData::FlapData(const char* filename){
|
||||
// printf("init flapdata\n");
|
||||
init(filename);
|
||||
lastAlphaIndex=0;
|
||||
lastSpeedIndex=0;
|
||||
lastPhiIndex=0;
|
||||
lastFreqIndex=0;
|
||||
}
|
||||
|
||||
//The destructor:
|
||||
//Frees all memory associated with this object
|
||||
FlapData::~FlapData(){
|
||||
// printf("deleting flapdata\n");
|
||||
delete liftTable;
|
||||
delete thrustTable;
|
||||
delete momentTable;
|
||||
delete inertiaTable;
|
||||
delete alphaArray;
|
||||
delete speedArray;
|
||||
delete freqArray;
|
||||
delete phiArray;
|
||||
}
|
||||
|
||||
//An initialization function that does the same thing
|
||||
//as the second constructor
|
||||
//returns zero if it was successful
|
||||
int FlapData::init(const char* filename){
|
||||
|
||||
ifstream* f=new ifstream(filename); //open file for reading in text (ascii) mode
|
||||
if (f==NULL) { //file open error
|
||||
return(1);
|
||||
}
|
||||
if(readIn(f)){ //read the file, if there's a problem
|
||||
return(2);
|
||||
}
|
||||
delete f;
|
||||
return 0;
|
||||
//close the file, return the success of the file close
|
||||
}
|
||||
|
||||
//A function that returns the interpolated values
|
||||
//for all four associated numbers
|
||||
//given the angle of attack, speed, and flapping frequency
|
||||
flapStruct FlapData::flapper(double alpha, double speed, double freq, double phi){
|
||||
|
||||
flapStruct results;
|
||||
int i,j,k,l;
|
||||
double lift,thrust,moment,inertia;
|
||||
if(speed<speedArray[0]){
|
||||
speed=speedArray[0];
|
||||
}
|
||||
if(speed>speedArray[speedLength-1]){
|
||||
speed=speedArray[speedLength-1];
|
||||
}
|
||||
if(alpha<alphaArray[0]){
|
||||
alpha=alphaArray[0];
|
||||
}
|
||||
if(alpha>alphaArray[alphaLength-1]){
|
||||
alpha=alphaArray[alphaLength-1];
|
||||
}
|
||||
i=findIndex(alphaArray,alphaLength,alpha,lastAlphaIndex);
|
||||
j=findIndex(speedArray,speedLength,speed,lastSpeedIndex);
|
||||
k=findIndex(freqArray,freqLength,freq,lastFreqIndex);
|
||||
l=findIndex(phiArray,phiLength,phi,lastPhiIndex);
|
||||
|
||||
lift=interpolate(liftTable, i, j, k, l, alpha, speed, freq, phi);
|
||||
thrust=interpolate(thrustTable, i, j, k, l, alpha, speed, freq, phi);
|
||||
moment=interpolate(momentTable, i, j, k, l, alpha, speed, freq, phi);
|
||||
inertia=interpolate(inertiaTable, i, j, k, l, alpha, speed, freq, phi);
|
||||
results=flapStruct(lift,thrust,moment,inertia);
|
||||
return results;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
//Implementation of private FlapData methods
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
//A function that returns an index i such that
|
||||
// array[i] < value < array[i+1]
|
||||
//The function returns -1 if
|
||||
// (value < array[0]) OR (value > array[n-1])
|
||||
//(i.e. the value is not within the bounds of the array)
|
||||
//It performs a linear search starting at guess
|
||||
int FlapData::findIndex(double array[], double n, double value, int i){
|
||||
|
||||
while(value<array[i]){ //less than the lower end of interval i
|
||||
if(i==0){ //if we're at the start of the array
|
||||
return(-1); //there's a problem
|
||||
}
|
||||
i--; //otherwise move to the next lower interval
|
||||
}
|
||||
while(value>array[i+1]){ //more than the higher end of interval i
|
||||
if(i==n-1){ //if we're at the end of the array
|
||||
return(-1); //there's a problem
|
||||
}
|
||||
i++; //otherwise move to the next higher interval
|
||||
}
|
||||
// errmsg("In findIndex: array[" << i << "]= " << array[i] << "<=" << value << "<= array[" << (i+1) << "]=" << array[i+1]);
|
||||
return(i);
|
||||
}
|
||||
|
||||
//A function that performs a linear interpolation based on the
|
||||
//eight points surrounding the value required
|
||||
double FlapData::interpolate(double**** table, int i, int j, int k, int l, double alpha, double speed, double freq, double phi){
|
||||
// errmsg("\t\t\t\t\t\t\t\tGetting Values");
|
||||
double f0000=table[i][j][k][l];
|
||||
double f0001=table[i][j][k][l+1];
|
||||
double f0010=table[i][j][k+1][l];
|
||||
double f0011=table[i][j][k+1][l+1];
|
||||
double f0100=table[i][j+1][k][l];
|
||||
double f0101=table[i][j+1][k][l+1];
|
||||
double f0110=table[i][j+1][k+1][l];
|
||||
double f0111=table[i][j+1][k+1][l+1];
|
||||
double f1000=table[i+1][j][k][l];
|
||||
double f1001=table[i+1][j][k][l+1];
|
||||
double f1010=table[i+1][j][k+1][l];
|
||||
double f1011=table[i+1][j][k+1][l+1];
|
||||
double f1100=table[i+1][j+1][k][l];
|
||||
double f1101=table[i+1][j+1][k][l+1];
|
||||
double f1110=table[i+1][j+1][k+1][l];
|
||||
double f1111=table[i+1][j+1][k+1][l+1];
|
||||
|
||||
// errmsg("\t\t\t\t\t\t\t\t1st pass (3)");
|
||||
// errmsg("phi[" << l << "]=" << phiArray[l] << "; phi[" << (l+1) <<"]=" << phiArray[l+1]);
|
||||
// errmsg("Finding " << phi <<endl;
|
||||
double f000=interpolate(phiArray[l],f0000,phiArray[l+1],f0001,phi);
|
||||
double f001=interpolate(phiArray[l],f0010,phiArray[l+1],f0011,phi);
|
||||
double f010=interpolate(phiArray[l],f0100,phiArray[l+1],f0101,phi);
|
||||
double f011=interpolate(phiArray[l],f0110,phiArray[l+1],f0111,phi);
|
||||
double f100=interpolate(phiArray[l],f1000,phiArray[l+1],f1001,phi);
|
||||
double f101=interpolate(phiArray[l],f1010,phiArray[l+1],f1011,phi);
|
||||
double f110=interpolate(phiArray[l],f1100,phiArray[l+1],f1101,phi);
|
||||
double f111=interpolate(phiArray[l],f1110,phiArray[l+1],f1111,phi);
|
||||
|
||||
// errmsg("\t\t\t\t\t\t\t\t2nd pass (2)");
|
||||
double f00=interpolate(freqArray[k],f000,freqArray[k+1],f001,freq);
|
||||
double f01=interpolate(freqArray[k],f010,freqArray[k+1],f011,freq);
|
||||
double f10=interpolate(freqArray[k],f100,freqArray[k+1],f101,freq);
|
||||
double f11=interpolate(freqArray[k],f110,freqArray[k+1],f111,freq);
|
||||
|
||||
// errmsg("\t\t\t\t\t\t\t\t3rd pass (1)");
|
||||
double f0=interpolate(speedArray[j],f00,speedArray[j+1],f01,speed);
|
||||
double f1=interpolate(speedArray[j],f10,speedArray[j+1],f11,speed);
|
||||
|
||||
// errmsg("\t\t\t\t\t\t\t\t4th pass (0)");
|
||||
double f=interpolate(alphaArray[i],f0,alphaArray[i+1],f1,alpha);
|
||||
return(f);
|
||||
}
|
||||
|
||||
//A function that performs a linear interpolation based
|
||||
//on the two nearest points
|
||||
double FlapData::interpolate(double x0, double y0, double x1, double y1, double x){
|
||||
double slope,y;
|
||||
assert(x1!=x0);
|
||||
slope=(y1-y0)/(x1-x0);
|
||||
y=y0+slope*(x-x0);
|
||||
return y;
|
||||
}
|
||||
|
||||
//A function called by init that reads in the file
|
||||
//of the correct format and stores it in the arrays and tables
|
||||
int FlapData::readIn (ifstream* f){
|
||||
|
||||
int i,j,k,l;
|
||||
int count=0;
|
||||
char numstr[200];
|
||||
|
||||
f->getline(numstr,200);
|
||||
sscanf(numstr,"%d,%d,%d,%d",&alphaLength,&speedLength,&freqLength,&phiLength);
|
||||
|
||||
//Check to see if the first line is 0 0 0 0
|
||||
//If so, tell user to download data file
|
||||
//Quits FlightGear
|
||||
if (alphaLength==0 && speedLength==0 && freqLength==0 && phiLength==0)
|
||||
uiuc_warnings_errors(7,"");
|
||||
|
||||
alphaArray=new double[alphaLength];
|
||||
speedArray=new double[speedLength];
|
||||
freqArray=new double[freqLength];
|
||||
phiArray=new double[phiLength];
|
||||
|
||||
for(i=0;i<alphaLength;i++){
|
||||
f->get(numstr,20,',');
|
||||
sscanf(numstr,"%lf",&alphaArray[i]);
|
||||
f->get();
|
||||
}
|
||||
f->get();
|
||||
for(i=0;i<speedLength;i++){
|
||||
f->get(numstr,20,',');
|
||||
sscanf(numstr,"%lf",&speedArray[i]);
|
||||
f->get();
|
||||
}
|
||||
f->get();
|
||||
for(i=0;i<freqLength;i++){
|
||||
f->get(numstr,20,',');
|
||||
sscanf(numstr,"%lf",&freqArray[i]);
|
||||
f->get();
|
||||
}
|
||||
f->get();
|
||||
for(i=0;i<phiLength;i++){
|
||||
f->get(numstr,20,',');
|
||||
sscanf(numstr,"%lf",&phiArray[i]);
|
||||
f->get();
|
||||
}
|
||||
f->get();
|
||||
liftTable=new double***[alphaLength];
|
||||
thrustTable=new double***[alphaLength];
|
||||
momentTable=new double***[alphaLength];
|
||||
inertiaTable=new double***[alphaLength];
|
||||
for(i=0;i<alphaLength;i++){
|
||||
liftTable[i]=new double**[speedLength];
|
||||
thrustTable[i]=new double**[speedLength];
|
||||
momentTable[i]=new double**[speedLength];
|
||||
inertiaTable[i]=new double**[speedLength];
|
||||
for(j=0;j<speedLength;j++){
|
||||
liftTable[i][j]=new double*[freqLength];
|
||||
thrustTable[i][j]=new double*[freqLength];
|
||||
momentTable[i][j]=new double*[freqLength];
|
||||
inertiaTable[i][j]=new double*[freqLength];
|
||||
for(k=0;k<freqLength;k++){
|
||||
assert((liftTable[i][j][k]=new double[phiLength])!=NULL);
|
||||
assert((thrustTable[i][j][k]=new double[phiLength])!=NULL);
|
||||
assert((momentTable[i][j][k]=new double[phiLength])!=NULL);
|
||||
assert((inertiaTable[i][j][k]=new double[phiLength])!=NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(i=0;i<alphaLength;i++){
|
||||
for(j=0;j<speedLength;j++){
|
||||
for(k=0;k<freqLength;k++){
|
||||
for(l=0;l<phiLength;l++){
|
||||
f->getline(numstr,200);
|
||||
sscanf(numstr,"%lf %lf %lf %lf",&liftTable[i][j][k][l],&thrustTable[i][j][k][l],&momentTable[i][j][k][l],&inertiaTable[i][j][k][l]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
//#endif
|
102
src/FDM/UIUCModel/uiuc_flapdata.h
Normal file
102
src/FDM/UIUCModel/uiuc_flapdata.h
Normal file
|
@ -0,0 +1,102 @@
|
|||
/*flapdata.h
|
||||
This is the interface definition file for the structure that
|
||||
holds the flapping data.
|
||||
Written by Theresa Robinson
|
||||
robinst@ecf.toronto.edu
|
||||
*/
|
||||
|
||||
#ifndef _FLAPDATA_H
|
||||
#define _FLAPDATA_H
|
||||
#include <cstdio>
|
||||
#include <fstream>
|
||||
#include <simgear/compiler.h>
|
||||
#include "uiuc_warnings_errors.h"
|
||||
using namespace std;
|
||||
//#include "uiuc_aircraft.h"
|
||||
|
||||
class flapStruct {
|
||||
private:
|
||||
double Lift,Thrust,Inertia,Moment;
|
||||
public:
|
||||
flapStruct();
|
||||
flapStruct(const flapStruct &rhs);
|
||||
flapStruct(double newLift, double newThrust, double newMoment, double newInertia);
|
||||
double getLift() const;
|
||||
double getThrust() const;
|
||||
double getInertia() const;
|
||||
double getMoment() const;
|
||||
};
|
||||
|
||||
|
||||
class FlapData {
|
||||
|
||||
//class variables
|
||||
private:
|
||||
|
||||
//the following are the arrays of increasing
|
||||
//data values that were used to generate the lift, thrust
|
||||
//pitch and inertial values
|
||||
double* alphaArray; //angle of attack
|
||||
double* speedArray; //airspeed at the wing
|
||||
double* freqArray; //flapping frequency
|
||||
double* phiArray;
|
||||
//the following four tables are generated (e.g. by FullWing)
|
||||
//using the data in the previous three arrays
|
||||
double**** liftTable; //4D array: holds the lift data
|
||||
double**** thrustTable; //4D array: holds the thrust data
|
||||
double**** momentTable; //4D array: holds the pitching moment data
|
||||
double**** inertiaTable; //4D array: holds the inertia data
|
||||
|
||||
//The values in the tables and arrays are directly related through
|
||||
//their indices, in the following way:
|
||||
//For alpha=alphaArray[i], speed=speedArray[j] and freq=freqArray[k]
|
||||
//phi=phiArray[l]
|
||||
//the lift is equal to liftTable[i][j][k][l]
|
||||
int alphaLength, speedLength, freqLength, phiLength;
|
||||
int lastAlphaIndex, lastSpeedIndex, lastFreqIndex, lastPhiIndex;
|
||||
//since we're assuming the angle of attack, velocity, and frequency
|
||||
//don't change much between calls to flap, we keep the last indices
|
||||
//as a good guess of where to start searching next time
|
||||
|
||||
//public methods
|
||||
public:
|
||||
//Constructors:
|
||||
//The default constructor:
|
||||
//Just sets the arrays to null and the guesses to zero
|
||||
FlapData();
|
||||
//A constructor that takes a file name:
|
||||
//Opens that file and fills all the arrays from it
|
||||
//sets the guesses to zero for the speed and halfway
|
||||
//along the array for the alpha and frequency
|
||||
FlapData(const char* filename);
|
||||
//The destructor:
|
||||
//Frees all memory associated with this object
|
||||
~FlapData();
|
||||
//An initialization function that does the same thing
|
||||
//as the second constructor
|
||||
//returns zero if it was successful
|
||||
int init(const char* filename);
|
||||
//A function that returns the interpolated values
|
||||
//for all four associated numbers
|
||||
//given the angle of attack, speed, and flapping frequency
|
||||
flapStruct flapper(double alpha, double speed, double frequency, double phi);
|
||||
//private methods
|
||||
private:
|
||||
//A function that returns an index i such that
|
||||
// array[i] < value < array[i+1]
|
||||
//The function returns -1 if
|
||||
// (value < array[0]) OR (value > array[n-1])
|
||||
//(i.e. the value is not within the bounds of the array)
|
||||
//It performs a linear search starting at LastIndex
|
||||
int findIndex(double array[], double n, double value, int LastIndex);
|
||||
//A function that performs a linear interpolation based on the
|
||||
//eight points surrounding the value required
|
||||
double interpolate(double**** table, int alphaIndex, int speedIndex, int freqIndex, int phiIndex, double alpha, double speed, double freq, double phi2);
|
||||
//A function that performs a linear interpolation based on the two nearest points
|
||||
double interpolate(double x1, double y1, double x2, double y2, double x);
|
||||
//A function called by init that reads in the file
|
||||
//of the correct format and stores it in the arrays and tables
|
||||
int readIn(ifstream* f);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,5 +1,5 @@
|
|||
/**********************************************************************
|
||||
|
||||
|
||||
FILENAME: uiuc_gear.cpp
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
@ -74,297 +74,297 @@ SG_USING_STD(cerr);
|
|||
|
||||
static void sub3( DATA v1[], DATA v2[], DATA result[] )
|
||||
{
|
||||
result[0] = v1[0] - v2[0];
|
||||
result[1] = v1[1] - v2[1];
|
||||
result[2] = v1[2] - v2[2];
|
||||
result[0] = v1[0] - v2[0];
|
||||
result[1] = v1[1] - v2[1];
|
||||
result[2] = v1[2] - v2[2];
|
||||
}
|
||||
|
||||
static void add3( DATA v1[], DATA v2[], DATA result[] )
|
||||
{
|
||||
result[0] = v1[0] + v2[0];
|
||||
result[1] = v1[1] + v2[1];
|
||||
result[2] = v1[2] + v2[2];
|
||||
result[0] = v1[0] + v2[0];
|
||||
result[1] = v1[1] + v2[1];
|
||||
result[2] = v1[2] + v2[2];
|
||||
}
|
||||
|
||||
static void cross3( DATA v1[], DATA v2[], DATA result[] )
|
||||
{
|
||||
result[0] = v1[1]*v2[2] - v1[2]*v2[1];
|
||||
result[1] = v1[2]*v2[0] - v1[0]*v2[2];
|
||||
result[2] = v1[0]*v2[1] - v1[1]*v2[0];
|
||||
result[0] = v1[1]*v2[2] - v1[2]*v2[1];
|
||||
result[1] = v1[2]*v2[0] - v1[0]*v2[2];
|
||||
result[2] = v1[0]*v2[1] - v1[1]*v2[0];
|
||||
}
|
||||
|
||||
static void multtrans3x3by3( DATA m[][3], DATA v[], DATA result[] )
|
||||
{
|
||||
result[0] = m[0][0]*v[0] + m[1][0]*v[1] + m[2][0]*v[2];
|
||||
result[1] = m[0][1]*v[0] + m[1][1]*v[1] + m[2][1]*v[2];
|
||||
result[2] = m[0][2]*v[0] + m[1][2]*v[1] + m[2][2]*v[2];
|
||||
result[0] = m[0][0]*v[0] + m[1][0]*v[1] + m[2][0]*v[2];
|
||||
result[1] = m[0][1]*v[0] + m[1][1]*v[1] + m[2][1]*v[2];
|
||||
result[2] = m[0][2]*v[0] + m[1][2]*v[1] + m[2][2]*v[2];
|
||||
}
|
||||
|
||||
static void mult3x3by3( DATA m[][3], DATA v[], DATA result[] )
|
||||
{
|
||||
result[0] = m[0][0]*v[0] + m[0][1]*v[1] + m[0][2]*v[2];
|
||||
result[1] = m[1][0]*v[0] + m[1][1]*v[1] + m[1][2]*v[2];
|
||||
result[2] = m[2][0]*v[0] + m[2][1]*v[1] + m[2][2]*v[2];
|
||||
result[0] = m[0][0]*v[0] + m[0][1]*v[1] + m[0][2]*v[2];
|
||||
result[1] = m[1][0]*v[0] + m[1][1]*v[1] + m[1][2]*v[2];
|
||||
result[2] = m[2][0]*v[0] + m[2][1]*v[1] + m[2][2]*v[2];
|
||||
}
|
||||
|
||||
static void clear3( DATA v[] )
|
||||
{
|
||||
v[0] = 0.; v[1] = 0.; v[2] = 0.;
|
||||
v[0] = 0.; v[1] = 0.; v[2] = 0.;
|
||||
}
|
||||
|
||||
void uiuc_gear()
|
||||
{
|
||||
|
||||
|
||||
/*
|
||||
* Aircraft specific initializations and data goes here
|
||||
*/
|
||||
|
||||
static DATA percent_brake[MAX_GEAR] = /* percent applied braking */
|
||||
{ 0., 0., 0., 0.,
|
||||
0., 0., 0., 0.,
|
||||
0., 0., 0., 0.,
|
||||
0., 0., 0., 0. }; /* 0 = none, 1 = full */
|
||||
static DATA caster_angle_rad[MAX_GEAR] = /* steerable tires - in */
|
||||
{ 0., 0., 0., 0.,
|
||||
0., 0., 0., 0.,
|
||||
0., 0., 0., 0.,
|
||||
0., 0., 0., 0. }; /* radians, +CW */
|
||||
|
||||
static DATA percent_brake[MAX_GEAR] = /* percent applied braking */
|
||||
{ 0., 0., 0., 0.,
|
||||
0., 0., 0., 0.,
|
||||
0., 0., 0., 0.,
|
||||
0., 0., 0., 0. }; /* 0 = none, 1 = full */
|
||||
static DATA caster_angle_rad[MAX_GEAR] = /* steerable tires - in */
|
||||
{ 0., 0., 0., 0.,
|
||||
0., 0., 0., 0.,
|
||||
0., 0., 0., 0.,
|
||||
0., 0., 0., 0. }; /* radians, +CW */
|
||||
/*
|
||||
* End of aircraft specific code
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Constants & coefficients for tyres on tarmac - ref [1]
|
||||
*/
|
||||
|
||||
/* skid function looks like:
|
||||
*
|
||||
* mu ^
|
||||
* |
|
||||
* max_mu | +
|
||||
* | /|
|
||||
* sliding_mu | / +------
|
||||
* | /
|
||||
* | /
|
||||
* +--+------------------------>
|
||||
* | | | sideward V
|
||||
* 0 bkout skid
|
||||
* V V
|
||||
*/
|
||||
|
||||
/* skid function looks like:
|
||||
*
|
||||
* mu ^
|
||||
* |
|
||||
* max_mu | +
|
||||
* | /|
|
||||
* sliding_mu | / +------
|
||||
* | /
|
||||
* | /
|
||||
* +--+------------------------>
|
||||
* | | | sideward V
|
||||
* 0 bkout skid
|
||||
* V V
|
||||
*/
|
||||
|
||||
|
||||
static int it_rolls[MAX_GEAR] =
|
||||
{ 1, 1, 1, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0 };
|
||||
static DATA sliding_mu[MAX_GEAR] =
|
||||
{ 0.5, 0.5, 0.5, 0.3,
|
||||
0.3, 0.3, 0.3, 0.3,
|
||||
0.3, 0.3, 0.3, 0.3,
|
||||
0.3, 0.3, 0.3, 0.3 };
|
||||
static DATA max_brake_mu[MAX_GEAR] =
|
||||
{ 0.0, 0.6, 0.6, 0.0,
|
||||
0.0, 0.0, 0.0, 0.0,
|
||||
0.0, 0.0, 0.0, 0.0,
|
||||
0.0, 0.0, 0.0, 0.0 };
|
||||
static DATA max_mu = 0.8;
|
||||
static DATA bkout_v = 0.1;
|
||||
static DATA skid_v = 1.0;
|
||||
static int it_rolls[MAX_GEAR] =
|
||||
{ 1, 1, 1, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0 };
|
||||
static DATA sliding_mu[MAX_GEAR] =
|
||||
{ 0.5, 0.5, 0.5, 0.3,
|
||||
0.3, 0.3, 0.3, 0.3,
|
||||
0.3, 0.3, 0.3, 0.3,
|
||||
0.3, 0.3, 0.3, 0.3 };
|
||||
static DATA max_brake_mu[MAX_GEAR] =
|
||||
{ 0.0, 0.6, 0.6, 0.0,
|
||||
0.0, 0.0, 0.0, 0.0,
|
||||
0.0, 0.0, 0.0, 0.0,
|
||||
0.0, 0.0, 0.0, 0.0 };
|
||||
static DATA max_mu = 0.8;
|
||||
static DATA bkout_v = 0.1;
|
||||
static DATA skid_v = 1.0;
|
||||
/*
|
||||
* Local data variables
|
||||
*/
|
||||
|
||||
DATA d_wheel_cg_body_v[3]; /* wheel offset from cg, X-Y-Z */
|
||||
DATA d_wheel_cg_local_v[3]; /* wheel offset from cg, N-E-D */
|
||||
DATA d_wheel_rwy_local_v[3]; /* wheel offset from rwy, N-E-U */
|
||||
DATA v_wheel_cg_local_v[3]; /*wheel velocity rel to cg N-E-D*/
|
||||
// DATA v_wheel_body_v[3]; /* wheel velocity, X-Y-Z */
|
||||
DATA v_wheel_local_v[3]; /* wheel velocity, N-E-D */
|
||||
DATA f_wheel_local_v[3]; /* wheel reaction force, N-E-D */
|
||||
// DATA altitude_local_v[3]; /*altitude vector in local (N-E-D) i.e. (0,0,h)*/
|
||||
// DATA altitude_body_v[3]; /*altitude vector in body (X,Y,Z)*/
|
||||
DATA temp3a[3];
|
||||
// DATA temp3b[3];
|
||||
DATA tempF[3];
|
||||
DATA tempM[3];
|
||||
DATA reaction_normal_force; /* wheel normal (to rwy) force */
|
||||
DATA cos_wheel_hdg_angle, sin_wheel_hdg_angle; /* temp storage */
|
||||
DATA v_wheel_forward, v_wheel_sideward, abs_v_wheel_sideward;
|
||||
DATA forward_mu, sideward_mu; /* friction coefficients */
|
||||
DATA beta_mu; /* breakout friction slope */
|
||||
DATA forward_wheel_force, sideward_wheel_force;
|
||||
|
||||
int i; /* per wheel loop counter */
|
||||
|
||||
|
||||
DATA d_wheel_cg_body_v[3]; /* wheel offset from cg, X-Y-Z */
|
||||
DATA d_wheel_cg_local_v[3]; /* wheel offset from cg, N-E-D */
|
||||
DATA d_wheel_rwy_local_v[3]; /* wheel offset from rwy, N-E-U */
|
||||
DATA v_wheel_cg_local_v[3]; /*wheel velocity rel to cg N-E-D*/
|
||||
// DATA v_wheel_body_v[3]; /* wheel velocity, X-Y-Z */
|
||||
DATA v_wheel_local_v[3]; /* wheel velocity, N-E-D */
|
||||
DATA f_wheel_local_v[3]; /* wheel reaction force, N-E-D */
|
||||
// DATA altitude_local_v[3]; /*altitude vector in local (N-E-D) i.e. (0,0,h)*/
|
||||
// DATA altitude_body_v[3]; /*altitude vector in body (X,Y,Z)*/
|
||||
DATA temp3a[3];
|
||||
// DATA temp3b[3];
|
||||
DATA tempF[3];
|
||||
DATA tempM[3];
|
||||
DATA reaction_normal_force; /* wheel normal (to rwy) force */
|
||||
DATA cos_wheel_hdg_angle, sin_wheel_hdg_angle; /* temp storage */
|
||||
DATA v_wheel_forward, v_wheel_sideward, abs_v_wheel_sideward;
|
||||
DATA forward_mu, sideward_mu; /* friction coefficients */
|
||||
DATA beta_mu; /* breakout friction slope */
|
||||
DATA forward_wheel_force, sideward_wheel_force;
|
||||
|
||||
int i; /* per wheel loop counter */
|
||||
|
||||
/*
|
||||
* Execution starts here
|
||||
*/
|
||||
|
||||
beta_mu = max_mu/(skid_v-bkout_v);
|
||||
clear3( F_gear_v ); /* Initialize sum of forces... */
|
||||
clear3( M_gear_v ); /* ...and moments */
|
||||
|
||||
|
||||
beta_mu = max_mu/(skid_v-bkout_v);
|
||||
clear3( F_gear_v ); /* Initialize sum of forces... */
|
||||
clear3( M_gear_v ); /* ...and moments */
|
||||
|
||||
/*
|
||||
* Put aircraft specific executable code here
|
||||
*/
|
||||
|
||||
percent_brake[1] = Brake_pct[0];
|
||||
percent_brake[2] = Brake_pct[1];
|
||||
|
||||
caster_angle_rad[0] =
|
||||
(0.01 + 0.04 * (1 - V_calibrated_kts / 130)) * Rudder_pedal;
|
||||
|
||||
|
||||
for (i=0;i<MAX_GEAR;i++) /* Loop for each wheel */
|
||||
|
||||
percent_brake[1] = Brake_pct[0];
|
||||
percent_brake[2] = Brake_pct[1];
|
||||
|
||||
caster_angle_rad[0] =
|
||||
(0.01 + 0.04 * (1 - V_calibrated_kts / 130)) * Rudder_pedal;
|
||||
|
||||
|
||||
for (i=0;i<MAX_GEAR;i++) /* Loop for each wheel */
|
||||
{
|
||||
// Execute only if the gear has been defined
|
||||
if (!gear_model[i])
|
||||
continue;
|
||||
|
||||
/* printf("%s:\n",gear_strings[i]); */
|
||||
|
||||
|
||||
|
||||
/*========================================*/
|
||||
/* Calculate wheel position w.r.t. runway */
|
||||
/*========================================*/
|
||||
|
||||
|
||||
/* printf("\thgcg: %g, theta: %g,phi: %g\n",D_cg_above_rwy,Theta*RAD_TO_DEG,Phi*RAD_TO_DEG); */
|
||||
|
||||
|
||||
/* First calculate wheel location w.r.t. cg in body (X-Y-Z) axes... */
|
||||
|
||||
sub3( D_gear_v[i], D_cg_rp_body_v, d_wheel_cg_body_v );
|
||||
|
||||
/* then converting to local (North-East-Down) axes... */
|
||||
|
||||
multtrans3x3by3( T_local_to_body_m, d_wheel_cg_body_v, d_wheel_cg_local_v );
|
||||
|
||||
|
||||
/* Runway axes correction - third element is Altitude, not (-)Z... */
|
||||
|
||||
d_wheel_cg_local_v[2] = -d_wheel_cg_local_v[2]; /* since altitude = -Z */
|
||||
|
||||
/* Add wheel offset to cg location in local axes */
|
||||
|
||||
add3( d_wheel_cg_local_v, D_cg_rwy_local_v, d_wheel_rwy_local_v );
|
||||
|
||||
/* remove Runway axes correction so right hand rule applies */
|
||||
|
||||
d_wheel_cg_local_v[2] = -d_wheel_cg_local_v[2]; /* now Z positive down */
|
||||
|
||||
/*============================*/
|
||||
/* Calculate wheel velocities */
|
||||
/*============================*/
|
||||
|
||||
/* contribution due to angular rates */
|
||||
|
||||
cross3( Omega_body_v, d_wheel_cg_body_v, temp3a );
|
||||
|
||||
/* transform into local axes */
|
||||
|
||||
multtrans3x3by3( T_local_to_body_m, temp3a,v_wheel_cg_local_v );
|
||||
|
||||
/* plus contribution due to cg velocities */
|
||||
|
||||
add3( v_wheel_cg_local_v, V_local_rel_ground_v, v_wheel_local_v );
|
||||
|
||||
clear3(f_wheel_local_v);
|
||||
reaction_normal_force=0;
|
||||
if( HEIGHT_AGL_WHEEL < 0. )
|
||||
/*the wheel is underground -- which implies ground contact
|
||||
so calculate reaction forces */
|
||||
{
|
||||
/*===========================================*/
|
||||
/* Calculate forces & moments for this wheel */
|
||||
/*===========================================*/
|
||||
|
||||
/* Add any anticipation, or frame lead/prediction, here... */
|
||||
|
||||
|
||||
/* printf("%s:\n",gear_strings[i]); */
|
||||
|
||||
|
||||
|
||||
/*========================================*/
|
||||
/* Calculate wheel position w.r.t. runway */
|
||||
/*========================================*/
|
||||
|
||||
|
||||
/* printf("\thgcg: %g, theta: %g,phi: %g\n",D_cg_above_rwy,Theta*RAD_TO_DEG,Phi*RAD_TO_DEG); */
|
||||
|
||||
|
||||
/* First calculate wheel location w.r.t. cg in body (X-Y-Z) axes... */
|
||||
|
||||
sub3( D_gear_v[i], D_cg_rp_body_v, d_wheel_cg_body_v );
|
||||
|
||||
/* then converting to local (North-East-Down) axes... */
|
||||
|
||||
multtrans3x3by3( T_local_to_body_m, d_wheel_cg_body_v, d_wheel_cg_local_v );
|
||||
|
||||
|
||||
/* Runway axes correction - third element is Altitude, not (-)Z... */
|
||||
|
||||
d_wheel_cg_local_v[2] = -d_wheel_cg_local_v[2]; /* since altitude = -Z */
|
||||
|
||||
/* Add wheel offset to cg location in local axes */
|
||||
|
||||
add3( d_wheel_cg_local_v, D_cg_rwy_local_v, d_wheel_rwy_local_v );
|
||||
|
||||
/* remove Runway axes correction so right hand rule applies */
|
||||
|
||||
d_wheel_cg_local_v[2] = -d_wheel_cg_local_v[2]; /* now Z positive down */
|
||||
|
||||
/*============================*/
|
||||
/* Calculate wheel velocities */
|
||||
/*============================*/
|
||||
|
||||
/* contribution due to angular rates */
|
||||
|
||||
cross3( Omega_body_v, d_wheel_cg_body_v, temp3a );
|
||||
|
||||
/* transform into local axes */
|
||||
|
||||
multtrans3x3by3( T_local_to_body_m, temp3a,v_wheel_cg_local_v );
|
||||
|
||||
/* plus contribution due to cg velocities */
|
||||
|
||||
add3( v_wheel_cg_local_v, V_local_rel_ground_v, v_wheel_local_v );
|
||||
|
||||
clear3(f_wheel_local_v);
|
||||
reaction_normal_force=0;
|
||||
if( HEIGHT_AGL_WHEEL < 0. )
|
||||
/*the wheel is underground -- which implies ground contact
|
||||
so calculate reaction forces */
|
||||
{
|
||||
/*===========================================*/
|
||||
/* Calculate forces & moments for this wheel */
|
||||
/*===========================================*/
|
||||
|
||||
/* Add any anticipation, or frame lead/prediction, here... */
|
||||
|
||||
/* no lead used at present */
|
||||
|
||||
/* Calculate sideward and forward velocities of the wheel
|
||||
in the runway plane */
|
||||
|
||||
cos_wheel_hdg_angle = cos(caster_angle_rad[i] + Psi);
|
||||
sin_wheel_hdg_angle = sin(caster_angle_rad[i] + Psi);
|
||||
|
||||
v_wheel_forward = v_wheel_local_v[0]*cos_wheel_hdg_angle
|
||||
+ v_wheel_local_v[1]*sin_wheel_hdg_angle;
|
||||
v_wheel_sideward = v_wheel_local_v[1]*cos_wheel_hdg_angle
|
||||
- v_wheel_local_v[0]*sin_wheel_hdg_angle;
|
||||
|
||||
|
||||
/* Calculate normal load force (simple spring constant) */
|
||||
|
||||
reaction_normal_force = 0.;
|
||||
|
||||
reaction_normal_force = kgear[i]*d_wheel_rwy_local_v[2]
|
||||
- v_wheel_local_v[2]*cgear[i];
|
||||
/* printf("\treaction_normal_force: %g\n",reaction_normal_force); */
|
||||
|
||||
if (reaction_normal_force > 0.) reaction_normal_force = 0.;
|
||||
/* to prevent damping component from swamping spring component */
|
||||
|
||||
|
||||
/* Calculate friction coefficients */
|
||||
|
||||
if(it_rolls[i])
|
||||
{
|
||||
forward_mu = (max_brake_mu[i] - muGear[i])*percent_brake[i] + muGear[i];
|
||||
abs_v_wheel_sideward = sqrt(v_wheel_sideward*v_wheel_sideward);
|
||||
sideward_mu = sliding_mu[i];
|
||||
if (abs_v_wheel_sideward < skid_v)
|
||||
sideward_mu = (abs_v_wheel_sideward - bkout_v)*beta_mu;
|
||||
if (abs_v_wheel_sideward < bkout_v) sideward_mu = 0.;
|
||||
}
|
||||
else
|
||||
{
|
||||
forward_mu=sliding_mu[i];
|
||||
sideward_mu=sliding_mu[i];
|
||||
}
|
||||
|
||||
/* Calculate foreward and sideward reaction forces */
|
||||
|
||||
forward_wheel_force = forward_mu*reaction_normal_force;
|
||||
sideward_wheel_force = sideward_mu*reaction_normal_force;
|
||||
if(v_wheel_forward < 0.) forward_wheel_force = -forward_wheel_force;
|
||||
if(v_wheel_sideward < 0.) sideward_wheel_force = -sideward_wheel_force;
|
||||
/* printf("\tFfwdgear: %g Fsidegear: %g\n",forward_wheel_force,sideward_wheel_force);
|
||||
*/
|
||||
/* Rotate into local (N-E-D) axes */
|
||||
|
||||
f_wheel_local_v[0] = forward_wheel_force*cos_wheel_hdg_angle
|
||||
- sideward_wheel_force*sin_wheel_hdg_angle;
|
||||
f_wheel_local_v[1] = forward_wheel_force*sin_wheel_hdg_angle
|
||||
+ sideward_wheel_force*cos_wheel_hdg_angle;
|
||||
f_wheel_local_v[2] = reaction_normal_force;
|
||||
|
||||
/* Convert reaction force from local (N-E-D) axes to body (X-Y-Z) */
|
||||
mult3x3by3( T_local_to_body_m, f_wheel_local_v, tempF );
|
||||
|
||||
/* Calculate moments from force and offsets in body axes */
|
||||
|
||||
cross3( d_wheel_cg_body_v, tempF, tempM );
|
||||
|
||||
/* Sum forces and moments across all wheels */
|
||||
|
||||
add3( tempF, F_gear_v, F_gear_v );
|
||||
add3( tempM, M_gear_v, M_gear_v );
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* printf("\tN: %g,dZrwy: %g dZdotrwy: %g\n",reaction_normal_force,HEIGHT_AGL_WHEEL,v_wheel_cg_local_v[2]); */
|
||||
|
||||
/*printf("\tFxgear: %g Fygear: %g, Fzgear: %g\n",F_X_gear,F_Y_gear,F_Z_gear);
|
||||
printf("\tMgear: %g, Lgear: %g, Ngear: %g\n\n",M_m_gear,M_l_gear,M_n_gear); */
|
||||
|
||||
|
||||
|
||||
/* Calculate sideward and forward velocities of the wheel
|
||||
in the runway plane */
|
||||
|
||||
cos_wheel_hdg_angle = cos(caster_angle_rad[i] + Psi);
|
||||
sin_wheel_hdg_angle = sin(caster_angle_rad[i] + Psi);
|
||||
|
||||
v_wheel_forward = v_wheel_local_v[0]*cos_wheel_hdg_angle
|
||||
+ v_wheel_local_v[1]*sin_wheel_hdg_angle;
|
||||
v_wheel_sideward = v_wheel_local_v[1]*cos_wheel_hdg_angle
|
||||
- v_wheel_local_v[0]*sin_wheel_hdg_angle;
|
||||
|
||||
|
||||
/* Calculate normal load force (simple spring constant) */
|
||||
|
||||
reaction_normal_force = 0.;
|
||||
|
||||
reaction_normal_force = kgear[i]*d_wheel_rwy_local_v[2]
|
||||
- v_wheel_local_v[2]*cgear[i];
|
||||
/* printf("\treaction_normal_force: %g\n",reaction_normal_force); */
|
||||
|
||||
if (reaction_normal_force > 0.) reaction_normal_force = 0.;
|
||||
/* to prevent damping component from swamping spring component */
|
||||
|
||||
|
||||
/* Calculate friction coefficients */
|
||||
|
||||
if(it_rolls[i])
|
||||
{
|
||||
forward_mu = (max_brake_mu[i] - muGear[i])*percent_brake[i] + muGear[i];
|
||||
abs_v_wheel_sideward = sqrt(v_wheel_sideward*v_wheel_sideward);
|
||||
sideward_mu = sliding_mu[i];
|
||||
if (abs_v_wheel_sideward < skid_v)
|
||||
sideward_mu = (abs_v_wheel_sideward - bkout_v)*beta_mu;
|
||||
if (abs_v_wheel_sideward < bkout_v) sideward_mu = 0.;
|
||||
}
|
||||
else
|
||||
{
|
||||
forward_mu=sliding_mu[i];
|
||||
sideward_mu=sliding_mu[i];
|
||||
}
|
||||
|
||||
/* Calculate foreward and sideward reaction forces */
|
||||
|
||||
forward_wheel_force = forward_mu*reaction_normal_force;
|
||||
sideward_wheel_force = sideward_mu*reaction_normal_force;
|
||||
if(v_wheel_forward < 0.) forward_wheel_force = -forward_wheel_force;
|
||||
if(v_wheel_sideward < 0.) sideward_wheel_force = -sideward_wheel_force;
|
||||
/* printf("\tFfwdgear: %g Fsidegear: %g\n",forward_wheel_force,sideward_wheel_force);
|
||||
*/
|
||||
/* Rotate into local (N-E-D) axes */
|
||||
|
||||
f_wheel_local_v[0] = forward_wheel_force*cos_wheel_hdg_angle
|
||||
- sideward_wheel_force*sin_wheel_hdg_angle;
|
||||
f_wheel_local_v[1] = forward_wheel_force*sin_wheel_hdg_angle
|
||||
+ sideward_wheel_force*cos_wheel_hdg_angle;
|
||||
f_wheel_local_v[2] = reaction_normal_force;
|
||||
|
||||
/* Convert reaction force from local (N-E-D) axes to body (X-Y-Z) */
|
||||
mult3x3by3( T_local_to_body_m, f_wheel_local_v, tempF );
|
||||
|
||||
/* Calculate moments from force and offsets in body axes */
|
||||
|
||||
cross3( d_wheel_cg_body_v, tempF, tempM );
|
||||
|
||||
/* Sum forces and moments across all wheels */
|
||||
|
||||
add3( tempF, F_gear_v, F_gear_v );
|
||||
add3( tempM, M_gear_v, M_gear_v );
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* printf("\tN: %g,dZrwy: %g dZdotrwy: %g\n",reaction_normal_force,HEIGHT_AGL_WHEEL,v_wheel_cg_local_v[2]); */
|
||||
|
||||
/*printf("\tFxgear: %g Fygear: %g, Fzgear: %g\n",F_X_gear,F_Y_gear,F_Z_gear);
|
||||
printf("\tMgear: %g, Lgear: %g, Ngear: %g\n\n",M_m_gear,M_l_gear,M_n_gear); */
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
56
src/FDM/UIUCModel/uiuc_get_flapper.cpp
Normal file
56
src/FDM/UIUCModel/uiuc_get_flapper.cpp
Normal file
|
@ -0,0 +1,56 @@
|
|||
#include "uiuc_get_flapper.h"
|
||||
|
||||
void uiuc_get_flapper(double dt)
|
||||
{
|
||||
double flapper_alpha;
|
||||
double flapper_V;
|
||||
//double cycle_incr;
|
||||
flapStruct flapper_struct;
|
||||
//FlapStruct flapper_struct;
|
||||
|
||||
flapper_alpha = Alpha*180/LS_PI;
|
||||
flapper_V = V_rel_wind;
|
||||
|
||||
flapper_freq = 0.8 + 0.45*Throttle_pct;
|
||||
|
||||
//if (Simtime == 0)
|
||||
// flapper_cycle_pct = flapper_cycle_pct_init;
|
||||
//else
|
||||
// {
|
||||
// cycle_incr = flapper_freq*dt - static_cast<int>(flapper_freq*dt);
|
||||
// if (cycle_incr < 1)
|
||||
// flapper_cycle_pct += cycle_incr;
|
||||
// else //need because problem when flapper_freq*dt is same as int
|
||||
// flapper_cycle_pct += cycle_incr - 1;
|
||||
// }
|
||||
//if (flapper_cycle_pct >= 1)
|
||||
// flapper_cycle_pct -= 1;
|
||||
|
||||
//if (flapper_cycle_pct >= 0 && flapper_cycle_pct < 0.25)
|
||||
// flapper_phi = LS_PI/2 * (sin(2*LS_PI*flapper_cycle_pct+3*LS_PI/2)+1);
|
||||
//if (flapper_cycle_pct >= 0.25 && flapper_cycle_pct < 0.5)
|
||||
// flapper_phi = LS_PI/2 * sin(2*LS_PI*(flapper_cycle_pct-0.25))+LS_PI/2;
|
||||
//if (flapper_cycle_pct >= 0.5 && flapper_cycle_pct < 0.75)
|
||||
// flapper_phi = LS_PI/2 * (sin(2*LS_PI*(flapper_cycle_pct-0.5)+3*LS_PI/2)+1)+LS_PI;
|
||||
//if (flapper_cycle_pct >= 0.75 && flapper_cycle_pct < 1)
|
||||
// flapper_phi = LS_PI/2 * sin(2*LS_PI*(flapper_cycle_pct-0.75))+3*LS_PI/2;
|
||||
|
||||
if (Simtime == 0)
|
||||
flapper_phi = flapper_phi_init;
|
||||
else
|
||||
flapper_phi += 2* LS_PI * flapper_freq * dt;
|
||||
|
||||
if (flapper_phi >= 2*LS_PI)
|
||||
flapper_phi -= 2*LS_PI;
|
||||
|
||||
flapper_struct=flapper_data->flapper(flapper_alpha,flapper_V,flapper_freq,flapper_phi);
|
||||
flapper_Lift=flapper_struct.getLift();
|
||||
flapper_Thrust=flapper_struct.getThrust();
|
||||
flapper_Inertia=flapper_struct.getInertia();
|
||||
flapper_Moment=flapper_struct.getMoment();
|
||||
|
||||
F_Z_aero_flapper = -1*flapper_Lift*cos(Alpha) - flapper_Thrust*sin(Alpha);
|
||||
F_Z_aero_flapper -= flapper_Inertia;
|
||||
F_X_aero_flapper = -1*flapper_Lift*sin(Alpha) + flapper_Thrust*cos(Alpha);
|
||||
|
||||
}
|
14
src/FDM/UIUCModel/uiuc_get_flapper.h
Normal file
14
src/FDM/UIUCModel/uiuc_get_flapper.h
Normal file
|
@ -0,0 +1,14 @@
|
|||
#ifndef _GET_FLAPPER_H_
|
||||
#define _GET_FLAPPER_H_
|
||||
|
||||
#include "uiuc_flapdata.h"
|
||||
#include "uiuc_aircraft.h"
|
||||
#include <FDM/LaRCsim/ls_constants.h>
|
||||
#include <FDM/LaRCsim/ls_generic.h>
|
||||
#include <FDM/LaRCsim/ls_cockpit.h>
|
||||
#include <math.h>
|
||||
extern double Simtime;
|
||||
|
||||
void uiuc_get_flapper(double dt);
|
||||
|
||||
#endif //_GET_FLAPPER_H_
|
117
src/FDM/UIUCModel/uiuc_getwind.cpp
Normal file
117
src/FDM/UIUCModel/uiuc_getwind.cpp
Normal file
|
@ -0,0 +1,117 @@
|
|||
/**********************************************************************
|
||||
|
||||
FILENAME: uiuc_getwind.cpp
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
DESCRIPTION: sets V_airmass_north, _east, _down for use in LaRCsim
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
STATUS: alpha version
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
REFERENCES:
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
HISTORY: 03/26/2003 initial release
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
AUTHOR(S): Glen Dimock <dimock@uiuc.edu>
|
||||
Michael Selig <m-selig@uiuc.edu>
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
VARIABLES:
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
INPUTS:
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
OUTPUTS:
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
CALLED BY: uiuc_wrapper
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
CALLS TO: none
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
COPYRIGHT: (C) 2003 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.
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
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"
|
||||
#include "uiuc_aircraft.h"
|
||||
|
||||
void uiuc_getwind()
|
||||
{
|
||||
/* Wind parameters */
|
||||
double zref = 300.; //Reference height (ft)
|
||||
double uref = 0; //Horizontal wind velocity at ref. height (ft/sec)
|
||||
// double uref = 11; //Horizontal wind velocity at ref. height (ft/sec)
|
||||
// double uref = 13; //Horizontal wind velocity at ref. height (ft/sec)
|
||||
// double uref = 20; //Horizontal wind velocity at ref. height (ft/sec), 13.63 mph
|
||||
// double uref = 22.5; //Horizontal wind velocity at ref. height (ft/sec), 15 mph
|
||||
// double uref = 60.; //Horizontal wind velocity at ref. height (ft/sec), 40 mph
|
||||
double ordref =-64.; //Horizontal wind ordinal from north (degrees)
|
||||
double zoff = 300.; //Z offset (ft) - wind is zero at and below this point
|
||||
double zcomp = 0.; //Vertical component (down is positive)
|
||||
|
||||
/* 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.;
|
||||
|
||||
V_north_airmass = windmag * cos(ordref*3.14159/180.); //North component
|
||||
V_east_airmass = windmag * sin(ordref*3.14159/180.); //East component
|
||||
V_down_airmass = zcomp;
|
||||
|
||||
return;
|
||||
}
|
||||
|
20
src/FDM/UIUCModel/uiuc_getwind.h
Normal file
20
src/FDM/UIUCModel/uiuc_getwind.h
Normal file
|
@ -0,0 +1,20 @@
|
|||
#ifndef _GETWIND_H_
|
||||
#define _GETWIND_H_
|
||||
|
||||
#include <math.h>
|
||||
#include "uiuc_aircraft.h"
|
||||
#include <FDM/LaRCsim/ls_generic.h> //For global state variables
|
||||
#include <FDM/LaRCsim/ls_constants.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern double Simtime;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
void uiuc_getwind();
|
||||
#endif // _GETWIND_H_
|
|
@ -2,6 +2,9 @@
|
|||
// Version 020409
|
||||
// read readme_020212.doc for information
|
||||
|
||||
// 11-21-2002 (RD) Added e code from Kishwar to fix negative lift problem at
|
||||
// high etas
|
||||
|
||||
#include "uiuc_iced_nonlin.h"
|
||||
|
||||
void Calc_Iced_Forces()
|
||||
|
@ -12,6 +15,7 @@ void Calc_Iced_Forces()
|
|||
double eta_ref_wing = 0.08; // eta of iced data used for curve fit
|
||||
double eta_ref_tail = 0.20; //changed from 0.12 10-23-2002
|
||||
double eta_wing;
|
||||
double e;
|
||||
//double delta_CL; // CL_clean - CL_iced;
|
||||
//double delta_CD; // CD_clean - CD_iced;
|
||||
//double delta_Cm; // CM_clean - CM_iced;
|
||||
|
@ -44,7 +48,15 @@ void Calc_Iced_Forces()
|
|||
}
|
||||
KCL = -delta_CL/eta_ref_wing;
|
||||
eta_wing = 0.5*(eta_wing_left + eta_wing_right);
|
||||
delta_CL = eta_wing*KCL;
|
||||
if (eta_wing <= 0.1)
|
||||
{
|
||||
e = eta_wing;
|
||||
}
|
||||
else
|
||||
{
|
||||
e = -0.3297*exp(-5*eta_wing)+0.3;
|
||||
}
|
||||
delta_CL = e*KCL;
|
||||
|
||||
|
||||
// drag fit
|
||||
|
|
198
src/FDM/UIUCModel/uiuc_icing_demo.cpp
Normal file
198
src/FDM/UIUCModel/uiuc_icing_demo.cpp
Normal file
|
@ -0,0 +1,198 @@
|
|||
/**********************************************************************
|
||||
|
||||
FILENAME: uiuc_icing_demo.cpp
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
DESCRIPTION:
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
STATUS: alpha version
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
REFERENCES:
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
HISTORY: 12/02/2002 initial release - originally in
|
||||
uiuc_coefficients()
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
AUTHOR(S): Robert Deters <rdeters@uiuc.edu>
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
VARIABLES:
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
INPUTS:
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
OUTPUTS:
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
CALLED BY: uiuc_coefficients
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
CALLS TO:
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
COPYRIGHT: (C) 2002 by Michael Selig
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA or view http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#include "uiuc_icing_demo.h"
|
||||
|
||||
void uiuc_icing_demo()
|
||||
{
|
||||
// Envelope protection values
|
||||
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_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);
|
||||
}
|
||||
|
||||
// Boot cycle values
|
||||
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);
|
||||
}
|
||||
|
||||
// Ice values
|
||||
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);
|
||||
}
|
||||
|
||||
// Autopilot
|
||||
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);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
11
src/FDM/UIUCModel/uiuc_icing_demo.h
Normal file
11
src/FDM/UIUCModel/uiuc_icing_demo.h
Normal file
|
@ -0,0 +1,11 @@
|
|||
#ifndef _ICING_DEMO_H_
|
||||
#define _ICING_DEMO_H_
|
||||
|
||||
#include "uiuc_aircraft.h"
|
||||
#include "uiuc_1Dinterpolation.h"
|
||||
|
||||
extern double Simtime;
|
||||
|
||||
void uiuc_icing_demo();
|
||||
|
||||
#endif // _ICING_DEMO_H_
|
|
@ -77,11 +77,18 @@ void uiuc_map_CD()
|
|||
{
|
||||
CD_map["CDo"] = CDo_flag ;
|
||||
CD_map["CDK"] = CDK_flag ;
|
||||
CD_map["CLK"] = CLK_flag ;
|
||||
CD_map["CD_a"] = CD_a_flag ;
|
||||
CD_map["CD_adot"] = CD_adot_flag ;
|
||||
CD_map["CD_q"] = CD_q_flag ;
|
||||
CD_map["CD_ih"] = CD_ih_flag ;
|
||||
CD_map["CD_de"] = CD_de_flag ;
|
||||
CD_map["CD_dr"] = CD_dr_flag ;
|
||||
CD_map["CD_da"] = CD_da_flag ;
|
||||
CD_map["CD_beta"] = CD_beta_flag ;
|
||||
CD_map["CD_df"] = CD_df_flag ;
|
||||
CD_map["CD_ds"] = CD_ds_flag ;
|
||||
CD_map["CD_dg"] = CD_dg_flag ;
|
||||
CD_map["CDfa"] = CDfa_flag ;
|
||||
CD_map["CDfCL"] = CDfCL_flag ;
|
||||
CD_map["CDfade"] = CDfade_flag ;
|
||||
|
|
|
@ -82,6 +82,9 @@ void uiuc_map_CL()
|
|||
CL_map["CL_q"] = CL_q_flag ;
|
||||
CL_map["CL_ih"] = CL_ih_flag ;
|
||||
CL_map["CL_de"] = CL_de_flag ;
|
||||
CL_map["CL_df"] = CL_df_flag ;
|
||||
CL_map["CL_ds"] = CL_ds_flag ;
|
||||
CL_map["CL_dg"] = CL_dg_flag ;
|
||||
CL_map["CLfa"] = CLfa_flag ;
|
||||
CL_map["CLfade"] = CLfade_flag ;
|
||||
CL_map["CLfdf"] = CLfdf_flag ;
|
||||
|
|
|
@ -85,6 +85,8 @@ void uiuc_map_Cm()
|
|||
Cm_map["Cm_b2"] = Cm_b2_flag ;
|
||||
Cm_map["Cm_r"] = Cm_r_flag ;
|
||||
Cm_map["Cm_df"] = Cm_df_flag ;
|
||||
Cm_map["Cm_ds"] = Cm_ds_flag ;
|
||||
Cm_map["Cm_dg"] = Cm_dg_flag ;
|
||||
Cm_map["Cmfa"] = Cmfa_flag ;
|
||||
Cm_map["Cmfade"] = Cmfade_flag ;
|
||||
Cm_map["Cmfdf"] = Cmfdf_flag ;
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
----------------------------------------------------------------------
|
||||
|
||||
AUTHOR(S): Bipin Sehgal <bsehgal@uiuc.edu>
|
||||
Jeff Scott <jscott@mail.com>
|
||||
Jeff Scott http://www.jeffscott.net/
|
||||
Robert Deters <rdeters@uiuc.edu>
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
@ -89,8 +89,32 @@ void uiuc_map_controlSurface()
|
|||
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 ;
|
||||
|
||||
controlSurface_map["flap_max"] = flap_max_flag ;
|
||||
controlSurface_map["flap_rate"] = flap_rate_flag ;
|
||||
controlSurface_map["use_flaps"] = use_flaps_flag ;
|
||||
|
||||
controlSurface_map["spoiler_max"] = spoiler_max_flag ;
|
||||
controlSurface_map["spoiler_rate"] = spoiler_rate_flag ;
|
||||
controlSurface_map["use_spoilers"] = use_spoilers_flag ;
|
||||
|
||||
controlSurface_map["gear_max"] = gear_max_flag ;
|
||||
controlSurface_map["gear_rate"] = gear_rate_flag ;
|
||||
controlSurface_map["use_gears"] = use_gear_flag ;
|
||||
|
||||
controlSurface_map["aileron_sas_KP"] = aileron_sas_KP_flag ;
|
||||
controlSurface_map["aileron_sas_max"] = aileron_sas_max_flag ;
|
||||
controlSurface_map["aileron_stick_gain"] = aileron_stick_gain_flag ;
|
||||
controlSurface_map["elevator_sas_KQ"] = elevator_sas_KQ_flag ;
|
||||
controlSurface_map["elevator_sas_max"] = elevator_sas_max_flag ;
|
||||
controlSurface_map["elevator_sas_min"] = elevator_sas_min_flag ;
|
||||
controlSurface_map["elevator_stick_gain"] = elevator_stick_gain_flag ;
|
||||
controlSurface_map["rudder_sas_KR"] = rudder_sas_KR_flag ;
|
||||
controlSurface_map["rudder_sas_max"] = rudder_sas_max_flag ;
|
||||
controlSurface_map["rudder_stick_gain"] = rudder_stick_gain_flag ;
|
||||
controlSurface_map["use_aileron_sas_type1"] = use_aileron_sas_type1_flag ;
|
||||
controlSurface_map["use_elevator_sas_type1"] = use_elevator_sas_type1_flag ;
|
||||
controlSurface_map["use_rudder_sas_type1"] = use_rudder_sas_type1_flag ;
|
||||
}
|
||||
|
||||
// end uiuc_map_controlSurface.cpp
|
||||
|
|
|
@ -86,6 +86,7 @@ void uiuc_map_engine()
|
|||
engine_map["eta_q_Cm_q"] = eta_q_Cm_q_flag ;
|
||||
engine_map["eta_q_Cm_adot"] = eta_q_Cm_adot_flag ;
|
||||
engine_map["eta_q_Cmfade"] = eta_q_Cmfade_flag ;
|
||||
engine_map["eta_q_Cm_de"] = eta_q_Cm_de_flag ;
|
||||
engine_map["eta_q_Cl_beta"] = eta_q_Cl_beta_flag ;
|
||||
engine_map["eta_q_Cl_p"] = eta_q_Cl_p_flag ;
|
||||
engine_map["eta_q_Cl_r"] = eta_q_Cl_r_flag ;
|
||||
|
|
|
@ -75,6 +75,9 @@ void uiuc_map_gear()
|
|||
gear_map["kgear"] = kgear_flag ;
|
||||
gear_map["muGear"] = muGear_flag ;
|
||||
gear_map["strutLength"] = strutLength_flag ;
|
||||
gear_map["gear_max"] = gear_max_flag ;
|
||||
gear_map["gear_rate"] = gear_rate_flag ;
|
||||
gear_map["use_gear"] = use_gear_flag ;
|
||||
}
|
||||
|
||||
// end uiuc_map_gear.cpp
|
||||
|
|
|
@ -97,6 +97,7 @@ 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["use_gamma_horiz_on_speed"] = use_gamma_horiz_on_speed_flag;
|
||||
init_map["downwashMode"] = downwashMode_flag ;
|
||||
init_map["downwashCoef"] = downwashCoef_flag ;
|
||||
init_map["Alpha"] = Alpha_flag ;
|
||||
|
@ -104,7 +105,7 @@ void uiuc_map_init()
|
|||
init_map["U_body"] = U_body_flag ;
|
||||
init_map["V_body"] = V_body_flag ;
|
||||
init_map["W_body"] = W_body_flag ;
|
||||
init_map["ignore_unknown"] = ignore_unknown_flag ;
|
||||
init_map["ignore_unknown_keywords"] = ignore_unknown_keywords_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 ;
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
----------------------------------------------------------------------
|
||||
|
||||
HISTORY: 06/03/2000 file creation
|
||||
11/12/2001 (RD) Added flap_goal and flap_pos
|
||||
11/12/2001 (RD) Added flap_cmd_deg and flap_pos
|
||||
03/03/2003 (RD) Added flap_cmd
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
|
@ -139,9 +140,16 @@ void uiuc_map_record3()
|
|||
record_map["rudder_deg"] = rudder_deg_record ;
|
||||
record_map["Flap_handle"] = Flap_handle_record ;
|
||||
record_map["flap"] = flap_record ;
|
||||
record_map["flap_deg" ] = flap_deg_record ;
|
||||
record_map["flap_goal"] = flap_goal_record ;
|
||||
record_map["flap_cmd"] = flap_cmd_record ;
|
||||
record_map["flap_cmd_deg"] = flap_cmd_deg_record ;
|
||||
record_map["flap_pos"] = flap_pos_record ;
|
||||
record_map["flap_pos_deg"] = flap_pos_deg_record ;
|
||||
record_map["Spoiler_handle"] = Spoiler_handle_record ;
|
||||
record_map["spoiler_cmd_deg"] = spoiler_cmd_deg_record ;
|
||||
record_map["spoiler_pos_deg"] = spoiler_pos_deg_record ;
|
||||
record_map["spoiler_pos_norm"] = spoiler_pos_norm_record ;
|
||||
record_map["spoiler_pos"] = spoiler_pos_record ;
|
||||
|
||||
}
|
||||
|
||||
// end uiuc_map_record3.cpp
|
||||
|
|
|
@ -91,11 +91,18 @@ void uiuc_map_record4()
|
|||
record_map["CXfaqfI"] = CXfaqfI_record ;
|
||||
record_map["CDo_save"] = CDo_save_record ;
|
||||
record_map["CDK_save"] = CDK_save_record ;
|
||||
record_map["CLK_save"] = CLK_save_record ;
|
||||
record_map["CD_a_save"] = CD_a_save_record ;
|
||||
record_map["CD_adot_save"] = CD_adot_save_record ;
|
||||
record_map["CD_q_save"] = CD_q_save_record ;
|
||||
record_map["CD_ih_save"] = CD_ih_save_record ;
|
||||
record_map["CD_de_save"] = CD_de_save_record ;
|
||||
record_map["CD_dr_save"] = CD_dr_save_record ;
|
||||
record_map["CD_da_save"] = CD_da_save_record ;
|
||||
record_map["CD_beta_save"] = CD_beta_save_record ;
|
||||
record_map["CD_df_save"] = CD_df_save_record ;
|
||||
record_map["CD_ds_save"] = CD_ds_save_record ;
|
||||
record_map["CD_dg_save"] = CD_dg_save_record ;
|
||||
record_map["CXo_save"] = CXo_save_record ;
|
||||
record_map["CXK_save"] = CXK_save_record ;
|
||||
record_map["CX_a_save"] = CX_a_save_record ;
|
||||
|
@ -123,6 +130,9 @@ void uiuc_map_record4()
|
|||
record_map["CL_q_save"] = CL_q_save_record ;
|
||||
record_map["CL_ih_save"] = CL_ih_save_record ;
|
||||
record_map["CL_de_save"] = CL_de_save_record ;
|
||||
record_map["CL_df_save"] = CL_df_save_record ;
|
||||
record_map["CL_ds_save"] = CL_ds_save_record ;
|
||||
record_map["CL_dg_save"] = CL_dg_save_record ;
|
||||
record_map["CZo_save"] = CZo_save_record ;
|
||||
record_map["CZ_a_save"] = CZ_a_save_record ;
|
||||
record_map["CZ_a2_save"] = CZ_a2_save_record ;
|
||||
|
@ -151,6 +161,8 @@ void uiuc_map_record4()
|
|||
record_map["Cm_b2_save"] = Cm_b2_save_record ;
|
||||
record_map["Cm_r_save"] = Cm_r_save_record ;
|
||||
record_map["Cm_df_save"] = Cm_df_save_record ;
|
||||
record_map["Cm_ds_save"] = Cm_ds_save_record ;
|
||||
record_map["Cm_dg_save"] = Cm_dg_save_record ;
|
||||
record_map["CY"] = CY_record ;
|
||||
record_map["CYfadaI"] = CYfadaI_record ;
|
||||
record_map["CYfbetadrI"] = CYfbetadrI_record ;
|
||||
|
|
|
@ -73,7 +73,7 @@ void uiuc_map_record5()
|
|||
record_map["F_X_wind"] = F_X_wind_record ;
|
||||
record_map["F_Y_wind"] = F_Y_wind_record ;
|
||||
record_map["F_Z_wind"] = F_Z_wind_record ;
|
||||
|
||||
|
||||
// aero forces in body axis
|
||||
record_map["F_X_aero"] = F_X_aero_record ;
|
||||
record_map["F_Y_aero"] = F_Y_aero_record ;
|
||||
|
@ -120,21 +120,47 @@ void uiuc_map_record5()
|
|||
record_map["M_l_rp"] = M_l_rp_record ;
|
||||
record_map["M_m_rp"] = M_m_rp_record ;
|
||||
record_map["M_n_rp"] = M_n_rp_record ;
|
||||
|
||||
|
||||
/***********************Flapper Data********************/
|
||||
record_map["flapper_freq"] = flapper_freq_record ;
|
||||
record_map["flapper_phi"] = flapper_phi_record ;
|
||||
record_map["flapper_phi_deg"] = flapper_phi_deg_record ;
|
||||
record_map["flapper_Lift"] = flapper_Lift_record ;
|
||||
record_map["flapper_Thrust"] = flapper_Thrust_record ;
|
||||
record_map["flapper_Inertia"] = flapper_Inertia_record ;
|
||||
record_map["flapper_Moment"] = flapper_Moment_record ;
|
||||
record_map["flapper_freq"] = flapper_freq_record ;
|
||||
record_map["flapper_phi"] = flapper_phi_record ;
|
||||
record_map["flapper_phi_deg"] = flapper_phi_deg_record ;
|
||||
record_map["flapper_Lift"] = flapper_Lift_record ;
|
||||
record_map["flapper_Thrust"] = flapper_Thrust_record ;
|
||||
record_map["flapper_Inertia"] = flapper_Inertia_record ;
|
||||
record_map["flapper_Moment"] = flapper_Moment_record ;
|
||||
|
||||
|
||||
/******************** MSS debug **********************************/
|
||||
record_map["debug1"] = debug1_record ;
|
||||
record_map["debug2"] = debug2_record ;
|
||||
record_map["debug3"] = debug3_record ;
|
||||
/******************** RD debug ***********************************/
|
||||
record_map["debug4"] = debug4_record ;
|
||||
record_map["debug5"] = debug5_record ;
|
||||
record_map["debug6"] = debug6_record ;
|
||||
|
||||
/**************************Debug************************/
|
||||
record_map["debug1"] = debug1_record ;
|
||||
record_map["debug2"] = debug2_record ;
|
||||
record_map["debug3"] = debug3_record ;
|
||||
/******************** Misc data **********************************/
|
||||
record_map["V_down_fpm"] = V_down_fpm_record ;
|
||||
record_map["eta_q"] = eta_q_record ;
|
||||
record_map["rpm"] = rpm_record ;
|
||||
record_map["elevator_sas_deg"] = elevator_sas_deg_record ;
|
||||
record_map["aileron_sas_deg"] = aileron_sas_deg_record ;
|
||||
record_map["rudder_sas_deg"] = rudder_sas_deg_record ;
|
||||
record_map["w_induced"] = w_induced_record ;
|
||||
record_map["downwashAngle_deg"] = downwashAngle_deg_record ;
|
||||
record_map["alphaTail_deg"] = alphaTail_deg_record ;
|
||||
record_map["gammaWing"] = gammaWing_record ;
|
||||
record_map["LD"] = LD_record ;
|
||||
record_map["gload"] = gload_record ;
|
||||
record_map["gyroMomentQ"] = gyroMomentQ_record ;
|
||||
record_map["gyroMomentR"] = gyroMomentR_record ;
|
||||
|
||||
/******************** Gear ************************************/
|
||||
record_map["Gear_handle"] = Gear_handle_record ;
|
||||
record_map["gear_cmd_norm"] = gear_cmd_norm_record ;
|
||||
record_map["gear_pos_norm"] = gear_pos_norm_record ;
|
||||
|
||||
}
|
||||
|
||||
// end uiuc_map_record5.cpp
|
||||
|
|
|
@ -78,6 +78,11 @@ void uiuc_map_record6()
|
|||
/******************************autopilot****************************/
|
||||
record_map["ap_Theta_ref_deg"] = ap_Theta_ref_deg_record ;
|
||||
record_map["ap_pah_on"] = ap_pah_on_record ;
|
||||
/***********************trigger variables**************************/
|
||||
record_map["trigger_on"] = trigger_on_record ;
|
||||
record_map["trigger_num"] = trigger_num_record ;
|
||||
record_map["trigger_toggle"] = trigger_toggle_record ;
|
||||
record_map["trigger_counter"] = trigger_counter_record ;
|
||||
}
|
||||
|
||||
// end uiuc_map_record6.cpp
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -12,9 +12,25 @@
|
|||
#include <FDM/LaRCsim/ls_generic.h>
|
||||
#include <FDM/LaRCsim/ls_cockpit.h> /* Long_trim defined */
|
||||
#include <FDM/LaRCsim/ls_constants.h> /* INVG defined */
|
||||
//#include "uiuc_flapdata.h"
|
||||
#include "uiuc_flapdata.h"
|
||||
#include "uiuc_menu_init.h"
|
||||
#include "uiuc_menu_geometry.h"
|
||||
#include "uiuc_menu_controlSurface.h"
|
||||
#include "uiuc_menu_mass.h"
|
||||
#include "uiuc_menu_engine.h"
|
||||
#include "uiuc_menu_CD.h"
|
||||
#include "uiuc_menu_CL.h"
|
||||
#include "uiuc_menu_Cm.h"
|
||||
#include "uiuc_menu_CY.h"
|
||||
#include "uiuc_menu_Croll.h"
|
||||
#include "uiuc_menu_Cn.h"
|
||||
#include "uiuc_menu_gear.h"
|
||||
#include "uiuc_menu_ice.h"
|
||||
#include "uiuc_menu_fog.h"
|
||||
#include "uiuc_menu_record.h"
|
||||
#include "uiuc_menu_misc.h"
|
||||
|
||||
bool check_float(const string &token); // To check whether the token is a float or not
|
||||
//bool check_float(const string &token); // To check whether the token is a float or not
|
||||
void uiuc_menu (string aircraft);
|
||||
|
||||
#endif //_MENU_H_
|
||||
|
|
687
src/FDM/UIUCModel/uiuc_menu_CD.cpp
Normal file
687
src/FDM/UIUCModel/uiuc_menu_CD.cpp
Normal file
|
@ -0,0 +1,687 @@
|
|||
/**********************************************************************
|
||||
|
||||
FILENAME: uiuc_menu_CD.cpp
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
DESCRIPTION: reads input data for specified aircraft and creates
|
||||
approporiate data storage space
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
STATUS: alpha version
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
REFERENCES: based on "menu reader" format of Michael Selig
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
HISTORY: 04/04/2003 initial release
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
AUTHOR(S): Robert Deters <rdeters@uiuc.edu>
|
||||
Michael Selig <m-selig@uiuc.edu>
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
VARIABLES:
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
INPUTS: n/a
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
OUTPUTS: n/a
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
CALLED BY: uiuc_menu()
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
CALLS TO: check_float() if needed
|
||||
d_2_to_3() if needed
|
||||
d_1_to_2() if needed
|
||||
i_1_to_2() if needed
|
||||
d_1_to_1() if needed
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
COPYRIGHT: (C) 2003 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 <simgear/compiler.h>
|
||||
|
||||
#if defined( __MWERKS__ )
|
||||
// -dw- optimizer chokes (big-time) trying to optimize humongous
|
||||
// loop/switch statements
|
||||
#pragma optimization_level 0
|
||||
#endif
|
||||
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include STL_IOSTREAM
|
||||
|
||||
#include "uiuc_menu_CD.h"
|
||||
|
||||
SG_USING_STD(cerr);
|
||||
SG_USING_STD(cout);
|
||||
SG_USING_STD(endl);
|
||||
|
||||
#ifndef _MSC_VER
|
||||
SG_USING_STD(exit);
|
||||
#endif
|
||||
|
||||
void parse_CD( const string& linetoken2, const string& linetoken3,
|
||||
const string& linetoken4, const string& linetoken5,
|
||||
const string& linetoken6, const string& linetoken7,
|
||||
const string& linetoken8, const string& linetoken9,
|
||||
const string& linetoken10, const string& aircraft_directory,
|
||||
LIST command_line ) {
|
||||
double token_value;
|
||||
int token_value_convert1, token_value_convert2, token_value_convert3;
|
||||
int token_value_convert4;
|
||||
double datafile_xArray[100][100], datafile_yArray[100];
|
||||
double datafile_zArray[100][100];
|
||||
double convert_f;
|
||||
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());
|
||||
istrstream token10(linetoken10.c_str());
|
||||
|
||||
static bool CXfabetaf_first = true;
|
||||
static bool CXfadef_first = true;
|
||||
static bool CXfaqf_first = true;
|
||||
|
||||
switch(CD_map[linetoken2])
|
||||
{
|
||||
case CDo_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CDo = token_value;
|
||||
CDo_clean = CDo;
|
||||
aeroDragParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CDK_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CDK = token_value;
|
||||
CDK_clean = CDK;
|
||||
aeroDragParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CLK_flag:
|
||||
{
|
||||
b_CLK = true;
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
CLK = token_value;
|
||||
break;
|
||||
}
|
||||
case CD_a_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CD_a = token_value;
|
||||
CD_a_clean = CD_a;
|
||||
aeroDragParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CD_adot_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CD_adot = token_value;
|
||||
CD_adot_clean = CD_adot;
|
||||
aeroDragParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CD_q_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CD_q = token_value;
|
||||
CD_q_clean = CD_q;
|
||||
aeroDragParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CD_ih_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CD_ih = token_value;
|
||||
aeroDragParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CD_de_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CD_de = token_value;
|
||||
CD_de_clean = CD_de;
|
||||
aeroDragParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CD_dr_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CD_dr = token_value;
|
||||
aeroDragParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CD_da_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CD_da = token_value;
|
||||
aeroDragParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CD_beta_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CD_beta = token_value;
|
||||
aeroDragParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CD_df_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CD_df = token_value;
|
||||
aeroDragParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CD_ds_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CD_ds = token_value;
|
||||
aeroDragParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CD_dg_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CD_dg = token_value;
|
||||
aeroDragParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CDfa_flag:
|
||||
{
|
||||
CDfa = 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);
|
||||
/* call 1D File Reader with file name (CDfa) and conversion
|
||||
factors; function returns array of alphas (aArray) and
|
||||
corresponding CD values (CDArray) and max number of
|
||||
terms in arrays (nAlpha) */
|
||||
uiuc_1DdataFileReader(CDfa,
|
||||
CDfa_aArray,
|
||||
CDfa_CDArray,
|
||||
CDfa_nAlpha);
|
||||
aeroDragParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CDfCL_flag:
|
||||
{
|
||||
CDfCL = 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);
|
||||
/* call 1D File Reader with file name (CDfCL) and conversion
|
||||
factors; function returns array of CLs (CLArray) and
|
||||
corresponding CD values (CDArray) and max number of
|
||||
terms in arrays (nCL) */
|
||||
uiuc_1DdataFileReader(CDfCL,
|
||||
CDfCL_CLArray,
|
||||
CDfCL_CDArray,
|
||||
CDfCL_nCL);
|
||||
aeroDragParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CDfade_flag:
|
||||
{
|
||||
CDfade = aircraft_directory + linetoken3;
|
||||
token4 >> token_value_convert1;
|
||||
token5 >> token_value_convert2;
|
||||
token6 >> token_value_convert3;
|
||||
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 (CDfade) and
|
||||
conversion factors; function returns array of
|
||||
elevator deflections (deArray) and corresponding
|
||||
alpha (aArray) and delta CD (CDArray) values and
|
||||
max number of terms in alpha arrays (nAlphaArray)
|
||||
and deflection array (nde) */
|
||||
uiuc_2DdataFileReader(CDfade,
|
||||
CDfade_aArray,
|
||||
CDfade_deArray,
|
||||
CDfade_CDArray,
|
||||
CDfade_nAlphaArray,
|
||||
CDfade_nde);
|
||||
aeroDragParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CDfdf_flag:
|
||||
{
|
||||
CDfdf = 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);
|
||||
/* call 1D File Reader with file name (CDfdf) and conversion
|
||||
factors; function returns array of dfs (dfArray) and
|
||||
corresponding CD values (CDArray) and max number of
|
||||
terms in arrays (ndf) */
|
||||
uiuc_1DdataFileReader(CDfdf,
|
||||
CDfdf_dfArray,
|
||||
CDfdf_CDArray,
|
||||
CDfdf_ndf);
|
||||
aeroDragParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CDfadf_flag:
|
||||
{
|
||||
CDfadf = aircraft_directory + linetoken3;
|
||||
token4 >> token_value_convert1;
|
||||
token5 >> token_value_convert2;
|
||||
token6 >> token_value_convert3;
|
||||
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 (CDfadf) and
|
||||
conversion factors; function returns array of
|
||||
flap deflections (dfArray) and corresponding
|
||||
alpha (aArray) and delta CD (CDArray) values and
|
||||
max number of terms in alpha arrays (nAlphaArray)
|
||||
and deflection array (ndf) */
|
||||
uiuc_2DdataFileReader(CDfadf,
|
||||
CDfadf_aArray,
|
||||
CDfadf_dfArray,
|
||||
CDfadf_CDArray,
|
||||
CDfadf_nAlphaArray,
|
||||
CDfadf_ndf);
|
||||
aeroDragParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CXo_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CXo = token_value;
|
||||
CXo_clean = CXo;
|
||||
aeroDragParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CXK_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CXK = token_value;
|
||||
CXK_clean = CXK;
|
||||
aeroDragParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CX_a_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CX_a = token_value;
|
||||
CX_a_clean = CX_a;
|
||||
aeroDragParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CX_a2_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CX_a2 = token_value;
|
||||
CX_a2_clean = CX_a2;
|
||||
aeroDragParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CX_a3_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CX_a3 = token_value;
|
||||
CX_a3_clean = CX_a3;
|
||||
aeroDragParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CX_adot_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CX_adot = token_value;
|
||||
CX_adot_clean = CX_adot;
|
||||
aeroDragParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CX_q_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CX_q = token_value;
|
||||
CX_q_clean = CX_q;
|
||||
aeroDragParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CX_de_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CX_de = token_value;
|
||||
CX_de_clean = CX_de;
|
||||
aeroDragParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CX_dr_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CX_dr = token_value;
|
||||
CX_dr_clean = CX_dr;
|
||||
aeroDragParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CX_df_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CX_df = token_value;
|
||||
CX_df_clean = CX_df;
|
||||
aeroDragParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CX_adf_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CX_adf = token_value;
|
||||
CX_adf_clean = CX_adf;
|
||||
aeroDragParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CXfabetaf_flag:
|
||||
{
|
||||
int CXfabetaf_index, i;
|
||||
string CXfabetaf_file;
|
||||
double flap_value;
|
||||
CXfabetaf_file = aircraft_directory + linetoken3;
|
||||
token4 >> CXfabetaf_index;
|
||||
if (CXfabetaf_index < 1 || CXfabetaf_index >= 30)
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
if (CXfabetaf_index > CXfabetaf_nf)
|
||||
CXfabetaf_nf = CXfabetaf_index;
|
||||
token5 >> flap_value;
|
||||
token6 >> token_value_convert1;
|
||||
token7 >> token_value_convert2;
|
||||
token8 >> token_value_convert3;
|
||||
token9 >> token_value_convert4;
|
||||
token10 >> CXfabetaf_nice;
|
||||
convert_z = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
convert_y = uiuc_convert(token_value_convert3);
|
||||
convert_f = uiuc_convert(token_value_convert4);
|
||||
CXfabetaf_fArray[CXfabetaf_index] = flap_value * convert_f;
|
||||
/* call 2D File Reader with file name (CXfabetaf_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(CXfabetaf_file,
|
||||
datafile_xArray,
|
||||
datafile_yArray,
|
||||
datafile_zArray,
|
||||
datafile_nxArray,
|
||||
datafile_ny);
|
||||
d_2_to_3(datafile_xArray, CXfabetaf_aArray, CXfabetaf_index);
|
||||
d_1_to_2(datafile_yArray, CXfabetaf_betaArray, CXfabetaf_index);
|
||||
d_2_to_3(datafile_zArray, CXfabetaf_CXArray, CXfabetaf_index);
|
||||
i_1_to_2(datafile_nxArray, CXfabetaf_nAlphaArray, CXfabetaf_index);
|
||||
CXfabetaf_nbeta[CXfabetaf_index] = datafile_ny;
|
||||
if (CXfabetaf_first==true)
|
||||
{
|
||||
if (CXfabetaf_nice == 1)
|
||||
{
|
||||
CXfabetaf_na_nice = datafile_nxArray[1];
|
||||
CXfabetaf_nb_nice = datafile_ny;
|
||||
d_1_to_1(datafile_yArray, CXfabetaf_bArray_nice);
|
||||
for (i=1; i<=CXfabetaf_na_nice; i++)
|
||||
CXfabetaf_aArray_nice[i] = datafile_xArray[1][i];
|
||||
}
|
||||
aeroDragParts -> storeCommands (*command_line);
|
||||
CXfabetaf_first=false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CXfadef_flag:
|
||||
{
|
||||
int CXfadef_index, i;
|
||||
string CXfadef_file;
|
||||
double flap_value;
|
||||
CXfadef_file = aircraft_directory + linetoken3;
|
||||
token4 >> CXfadef_index;
|
||||
if (CXfadef_index < 0 || CXfadef_index >= 30)
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
if (CXfadef_index > CXfadef_nf)
|
||||
CXfadef_nf = CXfadef_index;
|
||||
token5 >> flap_value;
|
||||
token6 >> token_value_convert1;
|
||||
token7 >> token_value_convert2;
|
||||
token8 >> token_value_convert3;
|
||||
token9 >> token_value_convert4;
|
||||
token10 >> CXfadef_nice;
|
||||
convert_z = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
convert_y = uiuc_convert(token_value_convert3);
|
||||
convert_f = uiuc_convert(token_value_convert4);
|
||||
CXfadef_fArray[CXfadef_index] = flap_value * convert_f;
|
||||
/* call 2D File Reader with file name (CXfadef_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(CXfadef_file,
|
||||
datafile_xArray,
|
||||
datafile_yArray,
|
||||
datafile_zArray,
|
||||
datafile_nxArray,
|
||||
datafile_ny);
|
||||
d_2_to_3(datafile_xArray, CXfadef_aArray, CXfadef_index);
|
||||
d_1_to_2(datafile_yArray, CXfadef_deArray, CXfadef_index);
|
||||
d_2_to_3(datafile_zArray, CXfadef_CXArray, CXfadef_index);
|
||||
i_1_to_2(datafile_nxArray, CXfadef_nAlphaArray, CXfadef_index);
|
||||
CXfadef_nde[CXfadef_index] = datafile_ny;
|
||||
if (CXfadef_first==true)
|
||||
{
|
||||
if (CXfadef_nice == 1)
|
||||
{
|
||||
CXfadef_na_nice = datafile_nxArray[1];
|
||||
CXfadef_nde_nice = datafile_ny;
|
||||
d_1_to_1(datafile_yArray, CXfadef_deArray_nice);
|
||||
for (i=1; i<=CXfadef_na_nice; i++)
|
||||
CXfadef_aArray_nice[i] = datafile_xArray[1][i];
|
||||
}
|
||||
aeroDragParts -> storeCommands (*command_line);
|
||||
CXfadef_first=false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CXfaqf_flag:
|
||||
{
|
||||
int CXfaqf_index, i;
|
||||
string CXfaqf_file;
|
||||
double flap_value;
|
||||
CXfaqf_file = aircraft_directory + linetoken3;
|
||||
token4 >> CXfaqf_index;
|
||||
if (CXfaqf_index < 0 || CXfaqf_index >= 30)
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
if (CXfaqf_index > CXfaqf_nf)
|
||||
CXfaqf_nf = CXfaqf_index;
|
||||
token5 >> flap_value;
|
||||
token6 >> token_value_convert1;
|
||||
token7 >> token_value_convert2;
|
||||
token8 >> token_value_convert3;
|
||||
token9 >> token_value_convert4;
|
||||
token10 >> CXfaqf_nice;
|
||||
convert_z = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
convert_y = uiuc_convert(token_value_convert3);
|
||||
convert_f = uiuc_convert(token_value_convert4);
|
||||
CXfaqf_fArray[CXfaqf_index] = flap_value * convert_f;
|
||||
/* call 2D File Reader with file name (CXfaqf_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(CXfaqf_file,
|
||||
datafile_xArray,
|
||||
datafile_yArray,
|
||||
datafile_zArray,
|
||||
datafile_nxArray,
|
||||
datafile_ny);
|
||||
d_2_to_3(datafile_xArray, CXfaqf_aArray, CXfaqf_index);
|
||||
d_1_to_2(datafile_yArray, CXfaqf_qArray, CXfaqf_index);
|
||||
d_2_to_3(datafile_zArray, CXfaqf_CXArray, CXfaqf_index);
|
||||
i_1_to_2(datafile_nxArray, CXfaqf_nAlphaArray, CXfaqf_index);
|
||||
CXfaqf_nq[CXfaqf_index] = datafile_ny;
|
||||
if (CXfaqf_first==true)
|
||||
{
|
||||
if (CXfaqf_nice == 1)
|
||||
{
|
||||
CXfaqf_na_nice = datafile_nxArray[1];
|
||||
CXfaqf_nq_nice = datafile_ny;
|
||||
d_1_to_1(datafile_yArray, CXfaqf_qArray_nice);
|
||||
for (i=1; i<=CXfaqf_na_nice; i++)
|
||||
CXfaqf_aArray_nice[i] = datafile_xArray[1][i];
|
||||
}
|
||||
aeroDragParts -> storeCommands (*command_line);
|
||||
CXfaqf_first=false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
if (ignore_unknown_keywords) {
|
||||
// do nothing
|
||||
} else {
|
||||
// print error message
|
||||
uiuc_warnings_errors(2, *command_line);
|
||||
}
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
21
src/FDM/UIUCModel/uiuc_menu_CD.h
Normal file
21
src/FDM/UIUCModel/uiuc_menu_CD.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
|
||||
#ifndef _MENU_CD_H_
|
||||
#define _MENU_CD_H_
|
||||
|
||||
#include "uiuc_aircraft.h"
|
||||
#include "uiuc_convert.h"
|
||||
#include "uiuc_1DdataFileReader.h"
|
||||
#include "uiuc_2DdataFileReader.h"
|
||||
#include "uiuc_menu_functions.h"
|
||||
#include <FDM/LaRCsim/ls_generic.h>
|
||||
#include <FDM/LaRCsim/ls_cockpit.h> /* Long_trim defined */
|
||||
#include <FDM/LaRCsim/ls_constants.h> /* INVG defined */
|
||||
|
||||
void parse_CD( const string& linetoken2, const string& linetoken3,
|
||||
const string& linetoken4, const string& linetoken5,
|
||||
const string& linetoken6, const string& linetoken7,
|
||||
const string& linetoken8, const string& linetoken9,
|
||||
const string& linetoken10, const string& aircraft_directory,
|
||||
LIST command_line );
|
||||
|
||||
#endif //_MENU_CD_H_
|
630
src/FDM/UIUCModel/uiuc_menu_CL.cpp
Normal file
630
src/FDM/UIUCModel/uiuc_menu_CL.cpp
Normal file
|
@ -0,0 +1,630 @@
|
|||
/**********************************************************************
|
||||
|
||||
FILENAME: uiuc_menu_CL.cpp
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
DESCRIPTION: reads input data for specified aircraft and creates
|
||||
approporiate data storage space
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
STATUS: alpha version
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
REFERENCES: based on "menu reader" format of Michael Selig
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
HISTORY: 04/04/2003 initial release
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
AUTHOR(S): Robert Deters <rdeters@uiuc.edu>
|
||||
Michael Selig <m-selig@uiuc.edu>
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
VARIABLES:
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
INPUTS: n/a
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
OUTPUTS: n/a
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
CALLED BY: uiuc_menu()
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
CALLS TO: check_float() if needed
|
||||
d_2_to_3() if needed
|
||||
d_1_to_2() if needed
|
||||
i_1_to_2() if needed
|
||||
d_1_to_1() if needed
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
COPYRIGHT: (C) 2003 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 <simgear/compiler.h>
|
||||
|
||||
#if defined( __MWERKS__ )
|
||||
// -dw- optimizer chokes (big-time) trying to optimize humongous
|
||||
// loop/switch statements
|
||||
#pragma optimization_level 0
|
||||
#endif
|
||||
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include STL_IOSTREAM
|
||||
|
||||
#include "uiuc_menu_CL.h"
|
||||
|
||||
SG_USING_STD(cerr);
|
||||
SG_USING_STD(cout);
|
||||
SG_USING_STD(endl);
|
||||
|
||||
#ifndef _MSC_VER
|
||||
SG_USING_STD(exit);
|
||||
#endif
|
||||
|
||||
void parse_CL( const string& linetoken2, const string& linetoken3,
|
||||
const string& linetoken4, const string& linetoken5,
|
||||
const string& linetoken6, const string& linetoken7,
|
||||
const string& linetoken8, const string& linetoken9,
|
||||
const string& linetoken10, const string& aircraft_directory,
|
||||
LIST command_line ) {
|
||||
double token_value;
|
||||
int token_value_convert1, token_value_convert2, token_value_convert3;
|
||||
int token_value_convert4;
|
||||
double datafile_xArray[100][100], datafile_yArray[100];
|
||||
double datafile_zArray[100][100];
|
||||
double convert_f;
|
||||
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());
|
||||
istrstream token10(linetoken10.c_str());
|
||||
|
||||
static bool CZfabetaf_first = true;
|
||||
static bool CZfadef_first = true;
|
||||
static bool CZfaqf_first = true;
|
||||
|
||||
switch(CL_map[linetoken2])
|
||||
{
|
||||
case CLo_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CLo = token_value;
|
||||
CLo_clean = CLo;
|
||||
aeroLiftParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CL_a_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CL_a = token_value;
|
||||
CL_a_clean = CL_a;
|
||||
aeroLiftParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CL_adot_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CL_adot = token_value;
|
||||
CL_adot_clean = CL_adot;
|
||||
aeroLiftParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CL_q_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CL_q = token_value;
|
||||
CL_q_clean = CL_q;
|
||||
aeroLiftParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CL_ih_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CL_ih = token_value;
|
||||
aeroLiftParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CL_de_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CL_de = token_value;
|
||||
CL_de_clean = CL_de;
|
||||
aeroLiftParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CL_df_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CL_df = token_value;
|
||||
aeroLiftParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CL_ds_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CL_ds = token_value;
|
||||
aeroLiftParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CL_dg_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CL_dg = token_value;
|
||||
aeroLiftParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CLfa_flag:
|
||||
{
|
||||
CLfa = 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);
|
||||
/* call 1D File Reader with file name (CLfa) and conversion
|
||||
factors; function returns array of alphas (aArray) and
|
||||
corresponding CL values (CLArray) and max number of
|
||||
terms in arrays (nAlpha) */
|
||||
uiuc_1DdataFileReader(CLfa,
|
||||
CLfa_aArray,
|
||||
CLfa_CLArray,
|
||||
CLfa_nAlpha);
|
||||
aeroLiftParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CLfade_flag:
|
||||
{
|
||||
CLfade = aircraft_directory + linetoken3;
|
||||
token4 >> token_value_convert1;
|
||||
token5 >> token_value_convert2;
|
||||
token6 >> token_value_convert3;
|
||||
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 (CLfade) and
|
||||
conversion factors; function returns array of
|
||||
elevator deflections (deArray) and corresponding
|
||||
alpha (aArray) and delta CL (CLArray) values and
|
||||
max number of terms in alpha arrays (nAlphaArray)
|
||||
and deflection array (nde) */
|
||||
uiuc_2DdataFileReader(CLfade,
|
||||
CLfade_aArray,
|
||||
CLfade_deArray,
|
||||
CLfade_CLArray,
|
||||
CLfade_nAlphaArray,
|
||||
CLfade_nde);
|
||||
aeroLiftParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CLfdf_flag:
|
||||
{
|
||||
CLfdf = 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);
|
||||
/* call 1D File Reader with file name (CLfdf) and conversion
|
||||
factors; function returns array of dfs (dfArray) and
|
||||
corresponding CL values (CLArray) and max number of
|
||||
terms in arrays (ndf) */
|
||||
uiuc_1DdataFileReader(CLfdf,
|
||||
CLfdf_dfArray,
|
||||
CLfdf_CLArray,
|
||||
CLfdf_ndf);
|
||||
aeroLiftParts -> storeCommands (*command_line);
|
||||
|
||||
// additional variables to streamline flap routine in aerodeflections
|
||||
ndf = CLfdf_ndf;
|
||||
int temp_counter = 1;
|
||||
while (temp_counter <= ndf)
|
||||
{
|
||||
dfArray[temp_counter] = CLfdf_dfArray[temp_counter];
|
||||
TimeArray[temp_counter] = dfTimefdf_TimeArray[temp_counter];
|
||||
temp_counter++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CLfadf_flag:
|
||||
{
|
||||
CLfadf = aircraft_directory + linetoken3;
|
||||
token4 >> token_value_convert1;
|
||||
token5 >> token_value_convert2;
|
||||
token6 >> token_value_convert3;
|
||||
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 (CLfadf) and
|
||||
conversion factors; function returns array of
|
||||
flap deflections (dfArray) and corresponding
|
||||
alpha (aArray) and delta CL (CLArray) values and
|
||||
max number of terms in alpha arrays (nAlphaArray)
|
||||
and deflection array (ndf) */
|
||||
uiuc_2DdataFileReader(CLfadf,
|
||||
CLfadf_aArray,
|
||||
CLfadf_dfArray,
|
||||
CLfadf_CLArray,
|
||||
CLfadf_nAlphaArray,
|
||||
CLfadf_ndf);
|
||||
aeroLiftParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CZo_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CZo = token_value;
|
||||
CZo_clean = CZo;
|
||||
aeroLiftParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CZ_a_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CZ_a = token_value;
|
||||
CZ_a_clean = CZ_a;
|
||||
aeroLiftParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CZ_a2_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CZ_a2 = token_value;
|
||||
CZ_a2_clean = CZ_a2;
|
||||
aeroLiftParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CZ_a3_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CZ_a3 = token_value;
|
||||
CZ_a3_clean = CZ_a3;
|
||||
aeroLiftParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CZ_adot_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CZ_adot = token_value;
|
||||
CZ_adot_clean = CZ_adot;
|
||||
aeroLiftParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CZ_q_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CZ_q = token_value;
|
||||
CZ_q_clean = CZ_q;
|
||||
aeroLiftParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CZ_de_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CZ_de = token_value;
|
||||
CZ_de_clean = CZ_de;
|
||||
aeroLiftParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CZ_deb2_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CZ_deb2 = token_value;
|
||||
CZ_deb2_clean = CZ_deb2;
|
||||
aeroLiftParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CZ_df_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CZ_df = token_value;
|
||||
CZ_df_clean = CZ_df;
|
||||
aeroLiftParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CZ_adf_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CZ_adf = token_value;
|
||||
CZ_adf_clean = CZ_adf;
|
||||
aeroLiftParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CZfa_flag:
|
||||
{
|
||||
CZfa = 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);
|
||||
/* 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;
|
||||
}
|
||||
case CZfabetaf_flag:
|
||||
{
|
||||
int CZfabetaf_index, i;
|
||||
string CZfabetaf_file;
|
||||
double flap_value;
|
||||
CZfabetaf_file = aircraft_directory + linetoken3;
|
||||
token4 >> CZfabetaf_index;
|
||||
if (CZfabetaf_index < 0 || CZfabetaf_index >= 30)
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
if (CZfabetaf_index > CZfabetaf_nf)
|
||||
CZfabetaf_nf = CZfabetaf_index;
|
||||
token5 >> flap_value;
|
||||
token6 >> token_value_convert1;
|
||||
token7 >> token_value_convert2;
|
||||
token8 >> token_value_convert3;
|
||||
token9 >> token_value_convert4;
|
||||
token10 >> CZfabetaf_nice;
|
||||
convert_z = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
convert_y = uiuc_convert(token_value_convert3);
|
||||
convert_f = uiuc_convert(token_value_convert4);
|
||||
CZfabetaf_fArray[CZfabetaf_index] = flap_value * convert_f;
|
||||
/* call 2D File Reader with file name (CZfabetaf_file) and
|
||||
conversion factors; function returns array of
|
||||
beta (betaArray) and corresponding
|
||||
alpha (aArray) and CZ (CZArray) values and
|
||||
max number of terms in alpha arrays (nAlphaArray)
|
||||
and beta array (nbeta) */
|
||||
uiuc_2DdataFileReader(CZfabetaf_file,
|
||||
datafile_xArray,
|
||||
datafile_yArray,
|
||||
datafile_zArray,
|
||||
datafile_nxArray,
|
||||
datafile_ny);
|
||||
d_2_to_3(datafile_xArray, CZfabetaf_aArray, CZfabetaf_index);
|
||||
d_1_to_2(datafile_yArray, CZfabetaf_betaArray, CZfabetaf_index);
|
||||
d_2_to_3(datafile_zArray, CZfabetaf_CZArray, CZfabetaf_index);
|
||||
i_1_to_2(datafile_nxArray, CZfabetaf_nAlphaArray, CZfabetaf_index);
|
||||
CZfabetaf_nbeta[CZfabetaf_index] = datafile_ny;
|
||||
if (CZfabetaf_first==true)
|
||||
{
|
||||
if (CZfabetaf_nice == 1)
|
||||
{
|
||||
CZfabetaf_na_nice = datafile_nxArray[1];
|
||||
CZfabetaf_nb_nice = datafile_ny;
|
||||
d_1_to_1(datafile_yArray, CZfabetaf_bArray_nice);
|
||||
for (i=1; i<=CZfabetaf_na_nice; i++)
|
||||
CZfabetaf_aArray_nice[i] = datafile_xArray[1][i];
|
||||
}
|
||||
aeroLiftParts -> storeCommands (*command_line);
|
||||
CZfabetaf_first=false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CZfadef_flag:
|
||||
{
|
||||
int CZfadef_index, i;
|
||||
string CZfadef_file;
|
||||
double flap_value;
|
||||
CZfadef_file = aircraft_directory + linetoken3;
|
||||
token4 >> CZfadef_index;
|
||||
if (CZfadef_index < 0 || CZfadef_index >= 30)
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
if (CZfadef_index > CZfadef_nf)
|
||||
CZfadef_nf = CZfadef_index;
|
||||
token5 >> flap_value;
|
||||
token6 >> token_value_convert1;
|
||||
token7 >> token_value_convert2;
|
||||
token8 >> token_value_convert3;
|
||||
token9 >> token_value_convert4;
|
||||
token10 >> CZfadef_nice;
|
||||
convert_z = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
convert_y = uiuc_convert(token_value_convert3);
|
||||
convert_f = uiuc_convert(token_value_convert4);
|
||||
CZfadef_fArray[CZfadef_index] = flap_value * convert_f;
|
||||
/* call 2D File Reader with file name (CZfadef_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(CZfadef_file,
|
||||
datafile_xArray,
|
||||
datafile_yArray,
|
||||
datafile_zArray,
|
||||
datafile_nxArray,
|
||||
datafile_ny);
|
||||
d_2_to_3(datafile_xArray, CZfadef_aArray, CZfadef_index);
|
||||
d_1_to_2(datafile_yArray, CZfadef_deArray, CZfadef_index);
|
||||
d_2_to_3(datafile_zArray, CZfadef_CZArray, CZfadef_index);
|
||||
i_1_to_2(datafile_nxArray, CZfadef_nAlphaArray, CZfadef_index);
|
||||
CZfadef_nde[CZfadef_index] = datafile_ny;
|
||||
if (CZfadef_first==true)
|
||||
{
|
||||
if (CZfadef_nice == 1)
|
||||
{
|
||||
CZfadef_na_nice = datafile_nxArray[1];
|
||||
CZfadef_nde_nice = datafile_ny;
|
||||
d_1_to_1(datafile_yArray, CZfadef_deArray_nice);
|
||||
for (i=1; i<=CZfadef_na_nice; i++)
|
||||
CZfadef_aArray_nice[i] = datafile_xArray[1][i];
|
||||
}
|
||||
aeroLiftParts -> storeCommands (*command_line);
|
||||
CZfadef_first=false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CZfaqf_flag:
|
||||
{
|
||||
int CZfaqf_index, i;
|
||||
string CZfaqf_file;
|
||||
double flap_value;
|
||||
CZfaqf_file = aircraft_directory + linetoken3;
|
||||
token4 >> CZfaqf_index;
|
||||
if (CZfaqf_index < 0 || CZfaqf_index >= 30)
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
if (CZfaqf_index > CZfaqf_nf)
|
||||
CZfaqf_nf = CZfaqf_index;
|
||||
token5 >> flap_value;
|
||||
token6 >> token_value_convert1;
|
||||
token7 >> token_value_convert2;
|
||||
token8 >> token_value_convert3;
|
||||
token9 >> token_value_convert4;
|
||||
token10 >> CZfaqf_nice;
|
||||
convert_z = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
convert_y = uiuc_convert(token_value_convert3);
|
||||
convert_f = uiuc_convert(token_value_convert4);
|
||||
CZfaqf_fArray[CZfaqf_index] = flap_value * convert_f;
|
||||
/* call 2D File Reader with file name (CZfaqf_file) and
|
||||
conversion factors; function returns array of
|
||||
pitch rate (qArray) and corresponding
|
||||
alpha (aArray) and delta CZ (CZArray) values and
|
||||
max number of terms in alpha arrays (nAlphaArray)
|
||||
and pitch rate array (nq) */
|
||||
uiuc_2DdataFileReader(CZfaqf_file,
|
||||
datafile_xArray,
|
||||
datafile_yArray,
|
||||
datafile_zArray,
|
||||
datafile_nxArray,
|
||||
datafile_ny);
|
||||
d_2_to_3(datafile_xArray, CZfaqf_aArray, CZfaqf_index);
|
||||
d_1_to_2(datafile_yArray, CZfaqf_qArray, CZfaqf_index);
|
||||
d_2_to_3(datafile_zArray, CZfaqf_CZArray, CZfaqf_index);
|
||||
i_1_to_2(datafile_nxArray, CZfaqf_nAlphaArray, CZfaqf_index);
|
||||
CZfaqf_nq[CZfaqf_index] = datafile_ny;
|
||||
if (CZfaqf_first==true)
|
||||
{
|
||||
if (CZfaqf_nice == 1)
|
||||
{
|
||||
CZfaqf_na_nice = datafile_nxArray[1];
|
||||
CZfaqf_nq_nice = datafile_ny;
|
||||
d_1_to_1(datafile_yArray, CZfaqf_qArray_nice);
|
||||
for (i=1; i<=CZfaqf_na_nice; i++)
|
||||
CZfaqf_aArray_nice[i] = datafile_xArray[1][i];
|
||||
}
|
||||
aeroLiftParts -> storeCommands (*command_line);
|
||||
CZfaqf_first=false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
if (ignore_unknown_keywords) {
|
||||
// do nothing
|
||||
} else {
|
||||
// print error message
|
||||
uiuc_warnings_errors(2, *command_line);
|
||||
}
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
21
src/FDM/UIUCModel/uiuc_menu_CL.h
Normal file
21
src/FDM/UIUCModel/uiuc_menu_CL.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
|
||||
#ifndef _MENU_CL_H_
|
||||
#define _MENU_CL_H_
|
||||
|
||||
#include "uiuc_aircraft.h"
|
||||
#include "uiuc_convert.h"
|
||||
#include "uiuc_1DdataFileReader.h"
|
||||
#include "uiuc_2DdataFileReader.h"
|
||||
#include "uiuc_menu_functions.h"
|
||||
#include <FDM/LaRCsim/ls_generic.h>
|
||||
#include <FDM/LaRCsim/ls_cockpit.h> /* Long_trim defined */
|
||||
#include <FDM/LaRCsim/ls_constants.h> /* INVG defined */
|
||||
|
||||
void parse_CL( const string& linetoken2, const string& linetoken3,
|
||||
const string& linetoken4, const string& linetoken5,
|
||||
const string& linetoken6, const string& linetoken7,
|
||||
const string& linetoken8, const string& linetoken9,
|
||||
const string& linetoken10, const string& aircraft_directory,
|
||||
LIST command_line );
|
||||
|
||||
#endif //_MENU_CL_H_
|
548
src/FDM/UIUCModel/uiuc_menu_CY.cpp
Normal file
548
src/FDM/UIUCModel/uiuc_menu_CY.cpp
Normal file
|
@ -0,0 +1,548 @@
|
|||
/**********************************************************************
|
||||
|
||||
FILENAME: uiuc_menu_CY.cpp
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
DESCRIPTION: reads input data for specified aircraft and creates
|
||||
approporiate data storage space
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
STATUS: alpha version
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
REFERENCES: based on "menu reader" format of Michael Selig
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
HISTORY: 04/04/2003 initial release
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
AUTHOR(S): Robert Deters <rdeters@uiuc.edu>
|
||||
Michael Selig <m-selig@uiuc.edu>
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
VARIABLES:
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
INPUTS: n/a
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
OUTPUTS: n/a
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
CALLED BY: uiuc_menu()
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
CALLS TO: check_float() if needed
|
||||
d_2_to_3() if needed
|
||||
d_1_to_2() if needed
|
||||
i_1_to_2() if needed
|
||||
d_1_to_1() if needed
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
COPYRIGHT: (C) 2003 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 <simgear/compiler.h>
|
||||
|
||||
#if defined( __MWERKS__ )
|
||||
// -dw- optimizer chokes (big-time) trying to optimize humongous
|
||||
// loop/switch statements
|
||||
#pragma optimization_level 0
|
||||
#endif
|
||||
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include STL_IOSTREAM
|
||||
|
||||
#include "uiuc_menu_CY.h"
|
||||
|
||||
SG_USING_STD(cerr);
|
||||
SG_USING_STD(cout);
|
||||
SG_USING_STD(endl);
|
||||
|
||||
#ifndef _MSC_VER
|
||||
SG_USING_STD(exit);
|
||||
#endif
|
||||
|
||||
void parse_CY( const string& linetoken2, const string& linetoken3,
|
||||
const string& linetoken4, const string& linetoken5,
|
||||
const string& linetoken6, const string& linetoken7,
|
||||
const string& linetoken8, const string& linetoken9,
|
||||
const string& linetoken10, const string& aircraft_directory,
|
||||
LIST command_line ) {
|
||||
double token_value;
|
||||
int token_value_convert1, token_value_convert2, token_value_convert3;
|
||||
int token_value_convert4;
|
||||
double datafile_xArray[100][100], datafile_yArray[100];
|
||||
double datafile_zArray[100][100];
|
||||
double convert_f;
|
||||
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());
|
||||
istrstream token10(linetoken10.c_str());
|
||||
|
||||
static bool CYfabetaf_first = true;
|
||||
static bool CYfadaf_first = true;
|
||||
static bool CYfadrf_first = true;
|
||||
static bool CYfapf_first = true;
|
||||
static bool CYfarf_first = true;
|
||||
|
||||
switch(CY_map[linetoken2])
|
||||
{
|
||||
case CYo_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CYo = token_value;
|
||||
CYo_clean = CYo;
|
||||
aeroSideforceParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CY_beta_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CY_beta = token_value;
|
||||
CY_beta_clean = CY_beta;
|
||||
aeroSideforceParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CY_p_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CY_p = token_value;
|
||||
CY_p_clean = CY_p;
|
||||
aeroSideforceParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CY_r_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CY_r = token_value;
|
||||
CY_r_clean = CY_r;
|
||||
aeroSideforceParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CY_da_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
CY_da = token_value;
|
||||
CY_da_clean = CY_da;
|
||||
aeroSideforceParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CY_dr_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(2, *command_line);
|
||||
|
||||
CY_dr = token_value;
|
||||
CY_dr_clean = CY_dr;
|
||||
aeroSideforceParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CY_dra_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(2, *command_line);
|
||||
|
||||
CY_dra = token_value;
|
||||
CY_dra_clean = CY_dra;
|
||||
aeroSideforceParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CY_bdot_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(2, *command_line);
|
||||
|
||||
CY_bdot = token_value;
|
||||
CY_bdot_clean = CY_bdot;
|
||||
aeroSideforceParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CYfada_flag:
|
||||
{
|
||||
CYfada = aircraft_directory + linetoken3;
|
||||
token4 >> token_value_convert1;
|
||||
token5 >> token_value_convert2;
|
||||
token6 >> token_value_convert3;
|
||||
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 (CYfada) and
|
||||
conversion factors; function returns array of
|
||||
aileron deflections (daArray) and corresponding
|
||||
alpha (aArray) and delta CY (CYArray) values and
|
||||
max number of terms in alpha arrays (nAlphaArray)
|
||||
and deflection array (nda) */
|
||||
uiuc_2DdataFileReader(CYfada,
|
||||
CYfada_aArray,
|
||||
CYfada_daArray,
|
||||
CYfada_CYArray,
|
||||
CYfada_nAlphaArray,
|
||||
CYfada_nda);
|
||||
aeroSideforceParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CYfbetadr_flag:
|
||||
{
|
||||
CYfbetadr = aircraft_directory + linetoken3;
|
||||
token4 >> token_value_convert1;
|
||||
token5 >> token_value_convert2;
|
||||
token6 >> token_value_convert3;
|
||||
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 (CYfbetadr) and
|
||||
conversion factors; function returns array of
|
||||
rudder deflections (drArray) and corresponding
|
||||
beta (betaArray) and delta CY (CYArray) values and
|
||||
max number of terms in beta arrays (nBetaArray)
|
||||
and deflection array (ndr) */
|
||||
uiuc_2DdataFileReader(CYfbetadr,
|
||||
CYfbetadr_betaArray,
|
||||
CYfbetadr_drArray,
|
||||
CYfbetadr_CYArray,
|
||||
CYfbetadr_nBetaArray,
|
||||
CYfbetadr_ndr);
|
||||
aeroSideforceParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case CYfabetaf_flag:
|
||||
{
|
||||
int CYfabetaf_index, i;
|
||||
string CYfabetaf_file;
|
||||
double flap_value;
|
||||
CYfabetaf_file = aircraft_directory + linetoken3;
|
||||
token4 >> CYfabetaf_index;
|
||||
if (CYfabetaf_index < 0 || CYfabetaf_index >= 30)
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
if (CYfabetaf_index > CYfabetaf_nf)
|
||||
CYfabetaf_nf = CYfabetaf_index;
|
||||
token5 >> flap_value;
|
||||
token6 >> token_value_convert1;
|
||||
token7 >> token_value_convert2;
|
||||
token8 >> token_value_convert3;
|
||||
token9 >> token_value_convert4;
|
||||
token10 >> CYfabetaf_nice;
|
||||
convert_z = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
convert_y = uiuc_convert(token_value_convert3);
|
||||
convert_f = uiuc_convert(token_value_convert4);
|
||||
CYfabetaf_fArray[CYfabetaf_index] = flap_value * convert_f;
|
||||
/* call 2D File Reader with file name (CYfabetaf_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(CYfabetaf_file,
|
||||
datafile_xArray,
|
||||
datafile_yArray,
|
||||
datafile_zArray,
|
||||
datafile_nxArray,
|
||||
datafile_ny);
|
||||
d_2_to_3(datafile_xArray, CYfabetaf_aArray, CYfabetaf_index);
|
||||
d_1_to_2(datafile_yArray, CYfabetaf_betaArray, CYfabetaf_index);
|
||||
d_2_to_3(datafile_zArray, CYfabetaf_CYArray, CYfabetaf_index);
|
||||
i_1_to_2(datafile_nxArray, CYfabetaf_nAlphaArray, CYfabetaf_index);
|
||||
CYfabetaf_nbeta[CYfabetaf_index] = datafile_ny;
|
||||
if (CYfabetaf_first==true)
|
||||
{
|
||||
if (CYfabetaf_nice == 1)
|
||||
{
|
||||
CYfabetaf_na_nice = datafile_nxArray[1];
|
||||
CYfabetaf_nb_nice = datafile_ny;
|
||||
d_1_to_1(datafile_yArray, CYfabetaf_bArray_nice);
|
||||
for (i=1; i<=CYfabetaf_na_nice; i++)
|
||||
CYfabetaf_aArray_nice[i] = datafile_xArray[1][i];
|
||||
}
|
||||
aeroSideforceParts -> storeCommands (*command_line);
|
||||
CYfabetaf_first=false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CYfadaf_flag:
|
||||
{
|
||||
int CYfadaf_index, i;
|
||||
string CYfadaf_file;
|
||||
double flap_value;
|
||||
CYfadaf_file = aircraft_directory + linetoken3;
|
||||
token4 >> CYfadaf_index;
|
||||
if (CYfadaf_index < 0 || CYfadaf_index >= 30)
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
if (CYfadaf_index > CYfadaf_nf)
|
||||
CYfadaf_nf = CYfadaf_index;
|
||||
token5 >> flap_value;
|
||||
token6 >> token_value_convert1;
|
||||
token7 >> token_value_convert2;
|
||||
token8 >> token_value_convert3;
|
||||
token9 >> token_value_convert4;
|
||||
token10 >> CYfadaf_nice;
|
||||
convert_z = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
convert_y = uiuc_convert(token_value_convert3);
|
||||
convert_f = uiuc_convert(token_value_convert4);
|
||||
CYfadaf_fArray[CYfadaf_index] = flap_value * convert_f;
|
||||
/* call 2D File Reader with file name (CYfadaf_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(CYfadaf_file,
|
||||
datafile_xArray,
|
||||
datafile_yArray,
|
||||
datafile_zArray,
|
||||
datafile_nxArray,
|
||||
datafile_ny);
|
||||
d_2_to_3(datafile_xArray, CYfadaf_aArray, CYfadaf_index);
|
||||
d_1_to_2(datafile_yArray, CYfadaf_daArray, CYfadaf_index);
|
||||
d_2_to_3(datafile_zArray, CYfadaf_CYArray, CYfadaf_index);
|
||||
i_1_to_2(datafile_nxArray, CYfadaf_nAlphaArray, CYfadaf_index);
|
||||
CYfadaf_nda[CYfadaf_index] = datafile_ny;
|
||||
if (CYfadaf_first==true)
|
||||
{
|
||||
if (CYfadaf_nice == 1)
|
||||
{
|
||||
CYfadaf_na_nice = datafile_nxArray[1];
|
||||
CYfadaf_nda_nice = datafile_ny;
|
||||
d_1_to_1(datafile_yArray, CYfadaf_daArray_nice);
|
||||
for (i=1; i<=CYfadaf_na_nice; i++)
|
||||
CYfadaf_aArray_nice[i] = datafile_xArray[1][i];
|
||||
}
|
||||
aeroSideforceParts -> storeCommands (*command_line);
|
||||
CYfadaf_first=false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CYfadrf_flag:
|
||||
{
|
||||
int CYfadrf_index, i;
|
||||
string CYfadrf_file;
|
||||
double flap_value;
|
||||
CYfadrf_file = aircraft_directory + linetoken3;
|
||||
token4 >> CYfadrf_index;
|
||||
if (CYfadrf_index < 0 || CYfadrf_index >= 30)
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
if (CYfadrf_index > CYfadrf_nf)
|
||||
CYfadrf_nf = CYfadrf_index;
|
||||
token5 >> flap_value;
|
||||
token6 >> token_value_convert1;
|
||||
token7 >> token_value_convert2;
|
||||
token8 >> token_value_convert3;
|
||||
token9 >> token_value_convert4;
|
||||
token10 >> CYfadrf_nice;
|
||||
convert_z = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
convert_y = uiuc_convert(token_value_convert3);
|
||||
convert_f = uiuc_convert(token_value_convert4);
|
||||
CYfadrf_fArray[CYfadrf_index] = flap_value * convert_f;
|
||||
/* call 2D File Reader with file name (CYfadrf_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(CYfadrf_file,
|
||||
datafile_xArray,
|
||||
datafile_yArray,
|
||||
datafile_zArray,
|
||||
datafile_nxArray,
|
||||
datafile_ny);
|
||||
d_2_to_3(datafile_xArray, CYfadrf_aArray, CYfadrf_index);
|
||||
d_1_to_2(datafile_yArray, CYfadrf_drArray, CYfadrf_index);
|
||||
d_2_to_3(datafile_zArray, CYfadrf_CYArray, CYfadrf_index);
|
||||
i_1_to_2(datafile_nxArray, CYfadrf_nAlphaArray, CYfadrf_index);
|
||||
CYfadrf_ndr[CYfadrf_index] = datafile_ny;
|
||||
if (CYfadrf_first==true)
|
||||
{
|
||||
if (CYfadrf_nice == 1)
|
||||
{
|
||||
CYfadrf_na_nice = datafile_nxArray[1];
|
||||
CYfadrf_ndr_nice = datafile_ny;
|
||||
d_1_to_1(datafile_yArray, CYfadrf_drArray_nice);
|
||||
for (i=1; i<=CYfadrf_na_nice; i++)
|
||||
CYfadrf_aArray_nice[i] = datafile_xArray[1][i];
|
||||
}
|
||||
aeroSideforceParts -> storeCommands (*command_line);
|
||||
CYfadrf_first=false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CYfapf_flag:
|
||||
{
|
||||
int CYfapf_index, i;
|
||||
string CYfapf_file;
|
||||
double flap_value;
|
||||
CYfapf_file = aircraft_directory + linetoken3;
|
||||
token4 >> CYfapf_index;
|
||||
if (CYfapf_index < 0 || CYfapf_index >= 30)
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
if (CYfapf_index > CYfapf_nf)
|
||||
CYfapf_nf = CYfapf_index;
|
||||
token5 >> flap_value;
|
||||
token6 >> token_value_convert1;
|
||||
token7 >> token_value_convert2;
|
||||
token8 >> token_value_convert3;
|
||||
token9 >> token_value_convert4;
|
||||
token10 >> CYfapf_nice;
|
||||
convert_z = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
convert_y = uiuc_convert(token_value_convert3);
|
||||
convert_f = uiuc_convert(token_value_convert4);
|
||||
CYfapf_fArray[CYfapf_index] = flap_value * convert_f;
|
||||
/* call 2D File Reader with file name (CYfapf_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(CYfapf_file,
|
||||
datafile_xArray,
|
||||
datafile_yArray,
|
||||
datafile_zArray,
|
||||
datafile_nxArray,
|
||||
datafile_ny);
|
||||
d_2_to_3(datafile_xArray, CYfapf_aArray, CYfapf_index);
|
||||
d_1_to_2(datafile_yArray, CYfapf_pArray, CYfapf_index);
|
||||
d_2_to_3(datafile_zArray, CYfapf_CYArray, CYfapf_index);
|
||||
i_1_to_2(datafile_nxArray, CYfapf_nAlphaArray, CYfapf_index);
|
||||
CYfapf_np[CYfapf_index] = datafile_ny;
|
||||
if (CYfapf_first==true)
|
||||
{
|
||||
if (CYfapf_nice == 1)
|
||||
{
|
||||
CYfapf_na_nice = datafile_nxArray[1];
|
||||
CYfapf_np_nice = datafile_ny;
|
||||
d_1_to_1(datafile_yArray, CYfapf_pArray_nice);
|
||||
for (i=1; i<=CYfapf_na_nice; i++)
|
||||
CYfapf_aArray_nice[i] = datafile_xArray[1][i];
|
||||
}
|
||||
aeroSideforceParts -> storeCommands (*command_line);
|
||||
CYfapf_first=false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CYfarf_flag:
|
||||
{
|
||||
int CYfarf_index, i;
|
||||
string CYfarf_file;
|
||||
double flap_value;
|
||||
CYfarf_file = aircraft_directory + linetoken3;
|
||||
token4 >> CYfarf_index;
|
||||
if (CYfarf_index < 0 || CYfarf_index >= 30)
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
if (CYfarf_index > CYfarf_nf)
|
||||
CYfarf_nf = CYfarf_index;
|
||||
token5 >> flap_value;
|
||||
token6 >> token_value_convert1;
|
||||
token7 >> token_value_convert2;
|
||||
token8 >> token_value_convert3;
|
||||
token9 >> token_value_convert4;
|
||||
token10 >> CYfarf_nice;
|
||||
convert_z = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
convert_y = uiuc_convert(token_value_convert3);
|
||||
convert_f = uiuc_convert(token_value_convert4);
|
||||
CYfarf_fArray[CYfarf_index] = flap_value * convert_f;
|
||||
/* call 2D File Reader with file name (CYfarf_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(CYfarf_file,
|
||||
datafile_xArray,
|
||||
datafile_yArray,
|
||||
datafile_zArray,
|
||||
datafile_nxArray,
|
||||
datafile_ny);
|
||||
d_2_to_3(datafile_xArray, CYfarf_aArray, CYfarf_index);
|
||||
d_1_to_2(datafile_yArray, CYfarf_rArray, CYfarf_index);
|
||||
d_2_to_3(datafile_zArray, CYfarf_CYArray, CYfarf_index);
|
||||
i_1_to_2(datafile_nxArray, CYfarf_nAlphaArray, CYfarf_index);
|
||||
CYfarf_nr[CYfarf_index] = datafile_ny;
|
||||
if (CYfarf_first==true)
|
||||
{
|
||||
if (CYfarf_nice == 1)
|
||||
{
|
||||
CYfarf_na_nice = datafile_nxArray[1];
|
||||
CYfarf_nr_nice = datafile_ny;
|
||||
d_1_to_1(datafile_yArray, CYfarf_rArray_nice);
|
||||
for (i=1; i<=CYfarf_na_nice; i++)
|
||||
CYfarf_aArray_nice[i] = datafile_xArray[1][i];
|
||||
}
|
||||
aeroSideforceParts -> storeCommands (*command_line);
|
||||
CYfarf_first=false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
if (ignore_unknown_keywords) {
|
||||
// do nothing
|
||||
} else {
|
||||
// print error message
|
||||
uiuc_warnings_errors(2, *command_line);
|
||||
}
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
21
src/FDM/UIUCModel/uiuc_menu_CY.h
Normal file
21
src/FDM/UIUCModel/uiuc_menu_CY.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
|
||||
#ifndef _MENU_CY_H_
|
||||
#define _MENU_CY_H_
|
||||
|
||||
#include "uiuc_aircraft.h"
|
||||
#include "uiuc_convert.h"
|
||||
#include "uiuc_1DdataFileReader.h"
|
||||
#include "uiuc_2DdataFileReader.h"
|
||||
#include "uiuc_menu_functions.h"
|
||||
#include <FDM/LaRCsim/ls_generic.h>
|
||||
#include <FDM/LaRCsim/ls_cockpit.h> /* Long_trim defined */
|
||||
#include <FDM/LaRCsim/ls_constants.h> /* INVG defined */
|
||||
|
||||
void parse_CY( const string& linetoken2, const string& linetoken3,
|
||||
const string& linetoken4, const string& linetoken5,
|
||||
const string& linetoken6, const string& linetoken7,
|
||||
const string& linetoken8, const string& linetoken9,
|
||||
const string& linetoken10, const string& aircraft_directory,
|
||||
LIST command_line );
|
||||
|
||||
#endif //_MENU_CY_H_
|
519
src/FDM/UIUCModel/uiuc_menu_Cm.cpp
Normal file
519
src/FDM/UIUCModel/uiuc_menu_Cm.cpp
Normal file
|
@ -0,0 +1,519 @@
|
|||
/**********************************************************************
|
||||
|
||||
FILENAME: uiuc_menu_Cm.cpp
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
DESCRIPTION: reads input data for specified aircraft and creates
|
||||
approporiate data storage space
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
STATUS: alpha version
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
REFERENCES: based on "menu reader" format of Michael Selig
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
HISTORY: 04/04/2003 initial release
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
AUTHOR(S): Robert Deters <rdeters@uiuc.edu>
|
||||
Michael Selig <m-selig@uiuc.edu>
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
VARIABLES:
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
INPUTS: n/a
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
OUTPUTS: n/a
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
CALLED BY: uiuc_menu()
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
CALLS TO: check_float() if needed
|
||||
d_2_to_3() if needed
|
||||
d_1_to_2() if needed
|
||||
i_1_to_2() if needed
|
||||
d_1_to_1() if needed
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
COPYRIGHT: (C) 2003 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 <simgear/compiler.h>
|
||||
|
||||
#if defined( __MWERKS__ )
|
||||
// -dw- optimizer chokes (big-time) trying to optimize humongous
|
||||
// loop/switch statements
|
||||
#pragma optimization_level 0
|
||||
#endif
|
||||
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include STL_IOSTREAM
|
||||
|
||||
#include "uiuc_menu_Cm.h"
|
||||
|
||||
SG_USING_STD(cerr);
|
||||
SG_USING_STD(cout);
|
||||
SG_USING_STD(endl);
|
||||
|
||||
#ifndef _MSC_VER
|
||||
SG_USING_STD(exit);
|
||||
#endif
|
||||
|
||||
void parse_Cm( const string& linetoken2, const string& linetoken3,
|
||||
const string& linetoken4, const string& linetoken5,
|
||||
const string& linetoken6, const string& linetoken7,
|
||||
const string& linetoken8, const string& linetoken9,
|
||||
const string& linetoken10, const string& aircraft_directory,
|
||||
LIST command_line ) {
|
||||
double token_value;
|
||||
int token_value_convert1, token_value_convert2, token_value_convert3;
|
||||
int token_value_convert4;
|
||||
double datafile_xArray[100][100], datafile_yArray[100];
|
||||
double datafile_zArray[100][100];
|
||||
double convert_f;
|
||||
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());
|
||||
istrstream token10(linetoken10.c_str());
|
||||
|
||||
static bool Cmfabetaf_first = true;
|
||||
static bool Cmfadef_first = true;
|
||||
static bool Cmfaqf_first = true;
|
||||
|
||||
switch(Cm_map[linetoken2])
|
||||
{
|
||||
case Cmo_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Cmo = token_value;
|
||||
Cmo_clean = Cmo;
|
||||
aeroPitchParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Cm_a_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Cm_a = token_value;
|
||||
Cm_a_clean = Cm_a;
|
||||
aeroPitchParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Cm_a2_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Cm_a2 = token_value;
|
||||
Cm_a2_clean = Cm_a2;
|
||||
aeroPitchParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Cm_adot_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Cm_adot = token_value;
|
||||
Cm_adot_clean = Cm_adot;
|
||||
aeroPitchParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Cm_q_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Cm_q = token_value;
|
||||
Cm_q_clean = Cm_q;
|
||||
aeroPitchParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Cm_ih_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Cm_ih = token_value;
|
||||
aeroPitchParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Cm_de_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Cm_de = token_value;
|
||||
Cm_de_clean = Cm_de;
|
||||
aeroPitchParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Cm_b2_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Cm_b2 = token_value;
|
||||
Cm_b2_clean = Cm_b2;
|
||||
aeroPitchParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Cm_r_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Cm_r = token_value;
|
||||
Cm_r_clean = Cm_r;
|
||||
aeroPitchParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Cm_df_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Cm_df = token_value;
|
||||
Cm_df_clean = Cm_df;
|
||||
aeroPitchParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Cm_ds_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Cm_ds = token_value;
|
||||
aeroPitchParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Cm_dg_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Cm_dg = token_value;
|
||||
aeroPitchParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Cmfa_flag:
|
||||
{
|
||||
Cmfa = 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);
|
||||
/* call 1D File Reader with file name (Cmfa) and conversion
|
||||
factors; function returns array of alphas (aArray) and
|
||||
corresponding Cm values (CmArray) and max number of
|
||||
terms in arrays (nAlpha) */
|
||||
uiuc_1DdataFileReader(Cmfa,
|
||||
Cmfa_aArray,
|
||||
Cmfa_CmArray,
|
||||
Cmfa_nAlpha);
|
||||
aeroPitchParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Cmfade_flag:
|
||||
{
|
||||
Cmfade = aircraft_directory + linetoken3;
|
||||
token4 >> token_value_convert1;
|
||||
token5 >> token_value_convert2;
|
||||
token6 >> token_value_convert3;
|
||||
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 (Cmfade) and
|
||||
conversion factors; function returns array of
|
||||
elevator deflections (deArray) and corresponding
|
||||
alpha (aArray) and delta Cm (CmArray) values and
|
||||
max number of terms in alpha arrays (nAlphaArray)
|
||||
and deflection array (nde) */
|
||||
uiuc_2DdataFileReader(Cmfade,
|
||||
Cmfade_aArray,
|
||||
Cmfade_deArray,
|
||||
Cmfade_CmArray,
|
||||
Cmfade_nAlphaArray,
|
||||
Cmfade_nde);
|
||||
aeroPitchParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Cmfdf_flag:
|
||||
{
|
||||
Cmfdf = 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);
|
||||
/* call 1D File Reader with file name (Cmfdf) and conversion
|
||||
factors; function returns array of dfs (dfArray) and
|
||||
corresponding Cm values (CmArray) and max number of
|
||||
terms in arrays (ndf) */
|
||||
uiuc_1DdataFileReader(Cmfdf,
|
||||
Cmfdf_dfArray,
|
||||
Cmfdf_CmArray,
|
||||
Cmfdf_ndf);
|
||||
aeroPitchParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Cmfadf_flag:
|
||||
{
|
||||
Cmfadf = aircraft_directory + linetoken3;
|
||||
token4 >> token_value_convert1;
|
||||
token5 >> token_value_convert2;
|
||||
token6 >> token_value_convert3;
|
||||
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 (Cmfadf) and
|
||||
conversion factors; function returns array of
|
||||
flap deflections (dfArray) and corresponding
|
||||
alpha (aArray) and delta Cm (CmArray) values and
|
||||
max number of terms in alpha arrays (nAlphaArray)
|
||||
and deflection array (ndf) */
|
||||
uiuc_2DdataFileReader(Cmfadf,
|
||||
Cmfadf_aArray,
|
||||
Cmfadf_dfArray,
|
||||
Cmfadf_CmArray,
|
||||
Cmfadf_nAlphaArray,
|
||||
Cmfadf_ndf);
|
||||
aeroPitchParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Cmfabetaf_flag:
|
||||
{
|
||||
int Cmfabetaf_index, i;
|
||||
string Cmfabetaf_file;
|
||||
double flap_value;
|
||||
Cmfabetaf_file = aircraft_directory + linetoken3;
|
||||
token4 >> Cmfabetaf_index;
|
||||
if (Cmfabetaf_index < 0 || Cmfabetaf_index >= 30)
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
if (Cmfabetaf_index > Cmfabetaf_nf)
|
||||
Cmfabetaf_nf = Cmfabetaf_index;
|
||||
token5 >> flap_value;
|
||||
token6 >> token_value_convert1;
|
||||
token7 >> token_value_convert2;
|
||||
token8 >> token_value_convert3;
|
||||
token9 >> token_value_convert4;
|
||||
token10 >> Cmfabetaf_nice;
|
||||
convert_z = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
convert_y = uiuc_convert(token_value_convert3);
|
||||
convert_f = uiuc_convert(token_value_convert4);
|
||||
Cmfabetaf_fArray[Cmfabetaf_index] = flap_value * convert_f;
|
||||
/* call 2D File Reader with file name (Cmfabetaf_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(Cmfabetaf_file,
|
||||
datafile_xArray,
|
||||
datafile_yArray,
|
||||
datafile_zArray,
|
||||
datafile_nxArray,
|
||||
datafile_ny);
|
||||
d_2_to_3(datafile_xArray, Cmfabetaf_aArray, Cmfabetaf_index);
|
||||
d_1_to_2(datafile_yArray, Cmfabetaf_betaArray, Cmfabetaf_index);
|
||||
d_2_to_3(datafile_zArray, Cmfabetaf_CmArray, Cmfabetaf_index);
|
||||
i_1_to_2(datafile_nxArray, Cmfabetaf_nAlphaArray, Cmfabetaf_index);
|
||||
Cmfabetaf_nbeta[Cmfabetaf_index] = datafile_ny;
|
||||
if (Cmfabetaf_first==true)
|
||||
{
|
||||
if (Cmfabetaf_nice == 1)
|
||||
{
|
||||
Cmfabetaf_na_nice = datafile_nxArray[1];
|
||||
Cmfabetaf_nb_nice = datafile_ny;
|
||||
d_1_to_1(datafile_yArray, Cmfabetaf_bArray_nice);
|
||||
for (i=1; i<=Cmfabetaf_na_nice; i++)
|
||||
Cmfabetaf_aArray_nice[i] = datafile_xArray[1][i];
|
||||
}
|
||||
aeroPitchParts -> storeCommands (*command_line);
|
||||
Cmfabetaf_first=false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Cmfadef_flag:
|
||||
{
|
||||
int Cmfadef_index, i;
|
||||
string Cmfadef_file;
|
||||
double flap_value;
|
||||
Cmfadef_file = aircraft_directory + linetoken3;
|
||||
token4 >> Cmfadef_index;
|
||||
if (Cmfadef_index < 0 || Cmfadef_index >= 30)
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
if (Cmfadef_index > Cmfadef_nf)
|
||||
Cmfadef_nf = Cmfadef_index;
|
||||
token5 >> flap_value;
|
||||
token6 >> token_value_convert1;
|
||||
token7 >> token_value_convert2;
|
||||
token8 >> token_value_convert3;
|
||||
token9 >> token_value_convert4;
|
||||
token10 >> Cmfadef_nice;
|
||||
convert_z = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
convert_y = uiuc_convert(token_value_convert3);
|
||||
convert_f = uiuc_convert(token_value_convert4);
|
||||
Cmfadef_fArray[Cmfadef_index] = flap_value * convert_f;
|
||||
/* call 2D File Reader with file name (Cmfadef_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(Cmfadef_file,
|
||||
datafile_xArray,
|
||||
datafile_yArray,
|
||||
datafile_zArray,
|
||||
datafile_nxArray,
|
||||
datafile_ny);
|
||||
d_2_to_3(datafile_xArray, Cmfadef_aArray, Cmfadef_index);
|
||||
d_1_to_2(datafile_yArray, Cmfadef_deArray, Cmfadef_index);
|
||||
d_2_to_3(datafile_zArray, Cmfadef_CmArray, Cmfadef_index);
|
||||
i_1_to_2(datafile_nxArray, Cmfadef_nAlphaArray, Cmfadef_index);
|
||||
Cmfadef_nde[Cmfadef_index] = datafile_ny;
|
||||
if (Cmfadef_first==true)
|
||||
{
|
||||
if (Cmfadef_nice == 1)
|
||||
{
|
||||
Cmfadef_na_nice = datafile_nxArray[1];
|
||||
Cmfadef_nde_nice = datafile_ny;
|
||||
d_1_to_1(datafile_yArray, Cmfadef_deArray_nice);
|
||||
for (i=1; i<=Cmfadef_na_nice; i++)
|
||||
Cmfadef_aArray_nice[i] = datafile_xArray[1][i];
|
||||
}
|
||||
aeroPitchParts -> storeCommands (*command_line);
|
||||
Cmfadef_first=false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Cmfaqf_flag:
|
||||
{
|
||||
int Cmfaqf_index, i;
|
||||
string Cmfaqf_file;
|
||||
double flap_value;
|
||||
Cmfaqf_file = aircraft_directory + linetoken3;
|
||||
token4 >> Cmfaqf_index;
|
||||
if (Cmfaqf_index < 0 || Cmfaqf_index >= 30)
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
if (Cmfaqf_index > Cmfaqf_nf)
|
||||
Cmfaqf_nf = Cmfaqf_index;
|
||||
token5 >> flap_value;
|
||||
token6 >> token_value_convert1;
|
||||
token7 >> token_value_convert2;
|
||||
token8 >> token_value_convert3;
|
||||
token9 >> token_value_convert4;
|
||||
token10 >> Cmfaqf_nice;
|
||||
convert_z = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
convert_y = uiuc_convert(token_value_convert3);
|
||||
convert_f = uiuc_convert(token_value_convert4);
|
||||
Cmfaqf_fArray[Cmfaqf_index] = flap_value * convert_f;
|
||||
/* call 2D File Reader with file name (Cmfaqf_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(Cmfaqf_file,
|
||||
datafile_xArray,
|
||||
datafile_yArray,
|
||||
datafile_zArray,
|
||||
datafile_nxArray,
|
||||
datafile_ny);
|
||||
d_2_to_3(datafile_xArray, Cmfaqf_aArray, Cmfaqf_index);
|
||||
d_1_to_2(datafile_yArray, Cmfaqf_qArray, Cmfaqf_index);
|
||||
d_2_to_3(datafile_zArray, Cmfaqf_CmArray, Cmfaqf_index);
|
||||
i_1_to_2(datafile_nxArray, Cmfaqf_nAlphaArray, Cmfaqf_index);
|
||||
Cmfaqf_nq[Cmfaqf_index] = datafile_ny;
|
||||
if (Cmfaqf_first==true)
|
||||
{
|
||||
if (Cmfaqf_nice == 1)
|
||||
{
|
||||
Cmfaqf_na_nice = datafile_nxArray[1];
|
||||
Cmfaqf_nq_nice = datafile_ny;
|
||||
d_1_to_1(datafile_yArray, Cmfaqf_qArray_nice);
|
||||
for (i=1; i<=Cmfaqf_na_nice; i++)
|
||||
Cmfaqf_aArray_nice[i] = datafile_xArray[1][i];
|
||||
}
|
||||
aeroPitchParts -> storeCommands (*command_line);
|
||||
Cmfaqf_first=false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
if (ignore_unknown_keywords) {
|
||||
// do nothing
|
||||
} else {
|
||||
// print error message
|
||||
uiuc_warnings_errors(2, *command_line);
|
||||
}
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
21
src/FDM/UIUCModel/uiuc_menu_Cm.h
Normal file
21
src/FDM/UIUCModel/uiuc_menu_Cm.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
|
||||
#ifndef _MENU_CM_H_
|
||||
#define _MENU_CM_H_
|
||||
|
||||
#include "uiuc_aircraft.h"
|
||||
#include "uiuc_convert.h"
|
||||
#include "uiuc_1DdataFileReader.h"
|
||||
#include "uiuc_2DdataFileReader.h"
|
||||
#include "uiuc_menu_functions.h"
|
||||
#include <FDM/LaRCsim/ls_generic.h>
|
||||
#include <FDM/LaRCsim/ls_cockpit.h> /* Long_trim defined */
|
||||
#include <FDM/LaRCsim/ls_constants.h> /* INVG defined */
|
||||
|
||||
void parse_Cm( const string& linetoken2, const string& linetoken3,
|
||||
const string& linetoken4, const string& linetoken5,
|
||||
const string& linetoken6, const string& linetoken7,
|
||||
const string& linetoken8, const string& linetoken9,
|
||||
const string& linetoken10, const string& aircraft_directory,
|
||||
LIST command_line );
|
||||
|
||||
#endif //_MENU_CM_H_
|
548
src/FDM/UIUCModel/uiuc_menu_Cn.cpp
Normal file
548
src/FDM/UIUCModel/uiuc_menu_Cn.cpp
Normal file
|
@ -0,0 +1,548 @@
|
|||
/**********************************************************************
|
||||
|
||||
FILENAME: uiuc_menu_Cn.cpp
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
DESCRIPTION: reads input data for specified aircraft and creates
|
||||
approporiate data storage space
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
STATUS: alpha version
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
REFERENCES: based on "menu reader" format of Michael Selig
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
HISTORY: 04/04/2003 initial release
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
AUTHOR(S): Robert Deters <rdeters@uiuc.edu>
|
||||
Michael Selig <m-selig@uiuc.edu>
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
VARIABLES:
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
INPUTS: n/a
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
OUTPUTS: n/a
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
CALLED BY: uiuc_menu()
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
CALLS TO: check_float() if needed
|
||||
d_2_to_3() if needed
|
||||
d_1_to_2() if needed
|
||||
i_1_to_2() if needed
|
||||
d_1_to_1() if needed
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
COPYRIGHT: (C) 2003 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 <simgear/compiler.h>
|
||||
|
||||
#if defined( __MWERKS__ )
|
||||
// -dw- optimizer chokes (big-time) trying to optimize humongous
|
||||
// loop/switch statements
|
||||
#pragma optimization_level 0
|
||||
#endif
|
||||
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include STL_IOSTREAM
|
||||
|
||||
#include "uiuc_menu_Cn.h"
|
||||
|
||||
SG_USING_STD(cerr);
|
||||
SG_USING_STD(cout);
|
||||
SG_USING_STD(endl);
|
||||
|
||||
#ifndef _MSC_VER
|
||||
SG_USING_STD(exit);
|
||||
#endif
|
||||
|
||||
void parse_Cn( const string& linetoken2, const string& linetoken3,
|
||||
const string& linetoken4, const string& linetoken5,
|
||||
const string& linetoken6, const string& linetoken7,
|
||||
const string& linetoken8, const string& linetoken9,
|
||||
const string& linetoken10, const string& aircraft_directory,
|
||||
LIST command_line ) {
|
||||
double token_value;
|
||||
int token_value_convert1, token_value_convert2, token_value_convert3;
|
||||
int token_value_convert4;
|
||||
double datafile_xArray[100][100], datafile_yArray[100];
|
||||
double datafile_zArray[100][100];
|
||||
double convert_f;
|
||||
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());
|
||||
istrstream token10(linetoken10.c_str());
|
||||
|
||||
static bool Cnfabetaf_first = true;
|
||||
static bool Cnfadaf_first = true;
|
||||
static bool Cnfadrf_first = true;
|
||||
static bool Cnfapf_first = true;
|
||||
static bool Cnfarf_first = true;
|
||||
|
||||
switch(Cn_map[linetoken2])
|
||||
{
|
||||
case Cno_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Cno = token_value;
|
||||
Cno_clean = Cno;
|
||||
aeroYawParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Cn_beta_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Cn_beta = token_value;
|
||||
Cn_beta_clean = Cn_beta;
|
||||
aeroYawParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Cn_p_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Cn_p = token_value;
|
||||
Cn_p_clean = Cn_p;
|
||||
aeroYawParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Cn_r_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Cn_r = token_value;
|
||||
Cn_r_clean = Cn_r;
|
||||
aeroYawParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Cn_da_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Cn_da = token_value;
|
||||
Cn_da_clean = Cn_da;
|
||||
aeroYawParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Cn_dr_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Cn_dr = token_value;
|
||||
Cn_dr_clean = Cn_dr;
|
||||
aeroYawParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Cn_q_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Cn_q = token_value;
|
||||
Cn_q_clean = Cn_q;
|
||||
aeroYawParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Cn_b3_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Cn_b3 = token_value;
|
||||
Cn_b3_clean = Cn_b3;
|
||||
aeroYawParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Cnfada_flag:
|
||||
{
|
||||
Cnfada = aircraft_directory + linetoken3;
|
||||
token4 >> token_value_convert1;
|
||||
token5 >> token_value_convert2;
|
||||
token6 >> token_value_convert3;
|
||||
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 (Cnfada) and
|
||||
conversion factors; function returns array of
|
||||
aileron deflections (daArray) and corresponding
|
||||
alpha (aArray) and delta Cn (CnArray) values and
|
||||
max number of terms in alpha arrays (nAlphaArray)
|
||||
and deflection array (nda) */
|
||||
uiuc_2DdataFileReader(Cnfada,
|
||||
Cnfada_aArray,
|
||||
Cnfada_daArray,
|
||||
Cnfada_CnArray,
|
||||
Cnfada_nAlphaArray,
|
||||
Cnfada_nda);
|
||||
aeroYawParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Cnfbetadr_flag:
|
||||
{
|
||||
Cnfbetadr = aircraft_directory + linetoken3;
|
||||
token4 >> token_value_convert1;
|
||||
token5 >> token_value_convert2;
|
||||
token6 >> token_value_convert3;
|
||||
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 (Cnfbetadr) and
|
||||
conversion factors; function returns array of
|
||||
rudder deflections (drArray) and corresponding
|
||||
beta (betaArray) and delta Cn (CnArray) values and
|
||||
max number of terms in beta arrays (nBetaArray)
|
||||
and deflection array (ndr) */
|
||||
uiuc_2DdataFileReader(Cnfbetadr,
|
||||
Cnfbetadr_betaArray,
|
||||
Cnfbetadr_drArray,
|
||||
Cnfbetadr_CnArray,
|
||||
Cnfbetadr_nBetaArray,
|
||||
Cnfbetadr_ndr);
|
||||
aeroYawParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Cnfabetaf_flag:
|
||||
{
|
||||
int Cnfabetaf_index, i;
|
||||
string Cnfabetaf_file;
|
||||
double flap_value;
|
||||
Cnfabetaf_file = aircraft_directory + linetoken3;
|
||||
token4 >> Cnfabetaf_index;
|
||||
if (Cnfabetaf_index < 0 || Cnfabetaf_index >= 100)
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
if (Cnfabetaf_index > Cnfabetaf_nf)
|
||||
Cnfabetaf_nf = Cnfabetaf_index;
|
||||
token5 >> flap_value;
|
||||
token6 >> token_value_convert1;
|
||||
token7 >> token_value_convert2;
|
||||
token8 >> token_value_convert3;
|
||||
token9 >> token_value_convert4;
|
||||
token10 >> Cnfabetaf_nice;
|
||||
convert_z = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
convert_y = uiuc_convert(token_value_convert3);
|
||||
convert_f = uiuc_convert(token_value_convert4);
|
||||
Cnfabetaf_fArray[Cnfabetaf_index] = flap_value * convert_f;
|
||||
/* call 2D File Reader with file name (Cnfabetaf_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(Cnfabetaf_file,
|
||||
datafile_xArray,
|
||||
datafile_yArray,
|
||||
datafile_zArray,
|
||||
datafile_nxArray,
|
||||
datafile_ny);
|
||||
d_2_to_3(datafile_xArray, Cnfabetaf_aArray, Cnfabetaf_index);
|
||||
d_1_to_2(datafile_yArray, Cnfabetaf_betaArray, Cnfabetaf_index);
|
||||
d_2_to_3(datafile_zArray, Cnfabetaf_CnArray, Cnfabetaf_index);
|
||||
i_1_to_2(datafile_nxArray, Cnfabetaf_nAlphaArray, Cnfabetaf_index);
|
||||
Cnfabetaf_nbeta[Cnfabetaf_index] = datafile_ny;
|
||||
if (Cnfabetaf_first==true)
|
||||
{
|
||||
if (Cnfabetaf_nice == 1)
|
||||
{
|
||||
Cnfabetaf_na_nice = datafile_nxArray[1];
|
||||
Cnfabetaf_nb_nice = datafile_ny;
|
||||
d_1_to_1(datafile_yArray, Cnfabetaf_bArray_nice);
|
||||
for (i=1; i<=Cnfabetaf_na_nice; i++)
|
||||
Cnfabetaf_aArray_nice[i] = datafile_xArray[1][i];
|
||||
}
|
||||
aeroYawParts -> storeCommands (*command_line);
|
||||
Cnfabetaf_first=false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Cnfadaf_flag:
|
||||
{
|
||||
int Cnfadaf_index, i;
|
||||
string Cnfadaf_file;
|
||||
double flap_value;
|
||||
Cnfadaf_file = aircraft_directory + linetoken3;
|
||||
token4 >> Cnfadaf_index;
|
||||
if (Cnfadaf_index < 0 || Cnfadaf_index >= 100)
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
if (Cnfadaf_index > Cnfadaf_nf)
|
||||
Cnfadaf_nf = Cnfadaf_index;
|
||||
token5 >> flap_value;
|
||||
token6 >> token_value_convert1;
|
||||
token7 >> token_value_convert2;
|
||||
token8 >> token_value_convert3;
|
||||
token9 >> token_value_convert4;
|
||||
token10 >> Cnfadaf_nice;
|
||||
convert_z = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
convert_y = uiuc_convert(token_value_convert3);
|
||||
convert_f = uiuc_convert(token_value_convert4);
|
||||
Cnfadaf_fArray[Cnfadaf_index] = flap_value * convert_f;
|
||||
/* call 2D File Reader with file name (Cnfadaf_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(Cnfadaf_file,
|
||||
datafile_xArray,
|
||||
datafile_yArray,
|
||||
datafile_zArray,
|
||||
datafile_nxArray,
|
||||
datafile_ny);
|
||||
d_2_to_3(datafile_xArray, Cnfadaf_aArray, Cnfadaf_index);
|
||||
d_1_to_2(datafile_yArray, Cnfadaf_daArray, Cnfadaf_index);
|
||||
d_2_to_3(datafile_zArray, Cnfadaf_CnArray, Cnfadaf_index);
|
||||
i_1_to_2(datafile_nxArray, Cnfadaf_nAlphaArray, Cnfadaf_index);
|
||||
Cnfadaf_nda[Cnfadaf_index] = datafile_ny;
|
||||
if (Cnfadaf_first==true)
|
||||
{
|
||||
if (Cnfadaf_nice == 1)
|
||||
{
|
||||
Cnfadaf_na_nice = datafile_nxArray[1];
|
||||
Cnfadaf_nda_nice = datafile_ny;
|
||||
d_1_to_1(datafile_yArray, Cnfadaf_daArray_nice);
|
||||
for (i=1; i<=Cnfadaf_na_nice; i++)
|
||||
Cnfadaf_aArray_nice[i] = datafile_xArray[1][i];
|
||||
}
|
||||
aeroYawParts -> storeCommands (*command_line);
|
||||
Cnfadaf_first=false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Cnfadrf_flag:
|
||||
{
|
||||
int Cnfadrf_index, i;
|
||||
string Cnfadrf_file;
|
||||
double flap_value;
|
||||
Cnfadrf_file = aircraft_directory + linetoken3;
|
||||
token4 >> Cnfadrf_index;
|
||||
if (Cnfadrf_index < 0 || Cnfadrf_index >= 100)
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
if (Cnfadrf_index > Cnfadrf_nf)
|
||||
Cnfadrf_nf = Cnfadrf_index;
|
||||
token5 >> flap_value;
|
||||
token6 >> token_value_convert1;
|
||||
token7 >> token_value_convert2;
|
||||
token8 >> token_value_convert3;
|
||||
token9 >> token_value_convert4;
|
||||
token10 >> Cnfadrf_nice;
|
||||
convert_z = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
convert_y = uiuc_convert(token_value_convert3);
|
||||
convert_f = uiuc_convert(token_value_convert4);
|
||||
Cnfadrf_fArray[Cnfadrf_index] = flap_value * convert_f;
|
||||
/* call 2D File Reader with file name (Cnfadrf_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(Cnfadrf_file,
|
||||
datafile_xArray,
|
||||
datafile_yArray,
|
||||
datafile_zArray,
|
||||
datafile_nxArray,
|
||||
datafile_ny);
|
||||
d_2_to_3(datafile_xArray, Cnfadrf_aArray, Cnfadrf_index);
|
||||
d_1_to_2(datafile_yArray, Cnfadrf_drArray, Cnfadrf_index);
|
||||
d_2_to_3(datafile_zArray, Cnfadrf_CnArray, Cnfadrf_index);
|
||||
i_1_to_2(datafile_nxArray, Cnfadrf_nAlphaArray, Cnfadrf_index);
|
||||
Cnfadrf_ndr[Cnfadrf_index] = datafile_ny;
|
||||
if (Cnfadrf_first==true)
|
||||
{
|
||||
if (Cnfadrf_nice == 1)
|
||||
{
|
||||
Cnfadrf_na_nice = datafile_nxArray[1];
|
||||
Cnfadrf_ndr_nice = datafile_ny;
|
||||
d_1_to_1(datafile_yArray, Cnfadrf_drArray_nice);
|
||||
for (i=1; i<=Cnfadrf_na_nice; i++)
|
||||
Cnfadrf_aArray_nice[i] = datafile_xArray[1][i];
|
||||
}
|
||||
aeroYawParts -> storeCommands (*command_line);
|
||||
Cnfadrf_first=false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Cnfapf_flag:
|
||||
{
|
||||
int Cnfapf_index, i;
|
||||
string Cnfapf_file;
|
||||
double flap_value;
|
||||
Cnfapf_file = aircraft_directory + linetoken3;
|
||||
token4 >> Cnfapf_index;
|
||||
if (Cnfapf_index < 0 || Cnfapf_index >= 100)
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
if (Cnfapf_index > Cnfapf_nf)
|
||||
Cnfapf_nf = Cnfapf_index;
|
||||
token5 >> flap_value;
|
||||
token6 >> token_value_convert1;
|
||||
token7 >> token_value_convert2;
|
||||
token8 >> token_value_convert3;
|
||||
token9 >> token_value_convert4;
|
||||
token10 >> Cnfapf_nice;
|
||||
convert_z = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
convert_y = uiuc_convert(token_value_convert3);
|
||||
convert_f = uiuc_convert(token_value_convert4);
|
||||
Cnfapf_fArray[Cnfapf_index] = flap_value * convert_f;
|
||||
/* call 2D File Reader with file name (Cnfapf_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(Cnfapf_file,
|
||||
datafile_xArray,
|
||||
datafile_yArray,
|
||||
datafile_zArray,
|
||||
datafile_nxArray,
|
||||
datafile_ny);
|
||||
d_2_to_3(datafile_xArray, Cnfapf_aArray, Cnfapf_index);
|
||||
d_1_to_2(datafile_yArray, Cnfapf_pArray, Cnfapf_index);
|
||||
d_2_to_3(datafile_zArray, Cnfapf_CnArray, Cnfapf_index);
|
||||
i_1_to_2(datafile_nxArray, Cnfapf_nAlphaArray, Cnfapf_index);
|
||||
Cnfapf_np[Cnfapf_index] = datafile_ny;
|
||||
if (Cnfapf_first==true)
|
||||
{
|
||||
if (Cnfapf_nice == 1)
|
||||
{
|
||||
Cnfapf_na_nice = datafile_nxArray[1];
|
||||
Cnfapf_np_nice = datafile_ny;
|
||||
d_1_to_1(datafile_yArray, Cnfapf_pArray_nice);
|
||||
for (i=1; i<=Cnfapf_na_nice; i++)
|
||||
Cnfapf_aArray_nice[i] = datafile_xArray[1][i];
|
||||
}
|
||||
aeroYawParts -> storeCommands (*command_line);
|
||||
Cnfapf_first=false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Cnfarf_flag:
|
||||
{
|
||||
int Cnfarf_index, i;
|
||||
string Cnfarf_file;
|
||||
double flap_value;
|
||||
Cnfarf_file = aircraft_directory + linetoken3;
|
||||
token4 >> Cnfarf_index;
|
||||
if (Cnfarf_index < 0 || Cnfarf_index >= 100)
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
if (Cnfarf_index > Cnfarf_nf)
|
||||
Cnfarf_nf = Cnfarf_index;
|
||||
token5 >> flap_value;
|
||||
token6 >> token_value_convert1;
|
||||
token7 >> token_value_convert2;
|
||||
token8 >> token_value_convert3;
|
||||
token9 >> token_value_convert4;
|
||||
token10 >> Cnfarf_nice;
|
||||
convert_z = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
convert_y = uiuc_convert(token_value_convert3);
|
||||
convert_f = uiuc_convert(token_value_convert4);
|
||||
Cnfarf_fArray[Cnfarf_index] = flap_value * convert_f;
|
||||
/* call 2D File Reader with file name (Cnfarf_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(Cnfarf_file,
|
||||
datafile_xArray,
|
||||
datafile_yArray,
|
||||
datafile_zArray,
|
||||
datafile_nxArray,
|
||||
datafile_ny);
|
||||
d_2_to_3(datafile_xArray, Cnfarf_aArray, Cnfarf_index);
|
||||
d_1_to_2(datafile_yArray, Cnfarf_rArray, Cnfarf_index);
|
||||
d_2_to_3(datafile_zArray, Cnfarf_CnArray, Cnfarf_index);
|
||||
i_1_to_2(datafile_nxArray, Cnfarf_nAlphaArray, Cnfarf_index);
|
||||
Cnfarf_nr[Cnfarf_index] = datafile_ny;
|
||||
if (Cnfarf_first==true)
|
||||
{
|
||||
if (Cnfarf_nice == 1)
|
||||
{
|
||||
Cnfarf_na_nice = datafile_nxArray[1];
|
||||
Cnfarf_nr_nice = datafile_ny;
|
||||
d_1_to_1(datafile_yArray, Cnfarf_rArray_nice);
|
||||
for (i=1; i<=Cnfarf_na_nice; i++)
|
||||
Cnfarf_aArray_nice[i] = datafile_xArray[1][i];
|
||||
}
|
||||
aeroYawParts -> storeCommands (*command_line);
|
||||
Cnfarf_first=false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
if (ignore_unknown_keywords) {
|
||||
// do nothing
|
||||
} else {
|
||||
// print error message
|
||||
uiuc_warnings_errors(2, *command_line);
|
||||
}
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
21
src/FDM/UIUCModel/uiuc_menu_Cn.h
Normal file
21
src/FDM/UIUCModel/uiuc_menu_Cn.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
|
||||
#ifndef _MENU_CN_H_
|
||||
#define _MENU_CN_H_
|
||||
|
||||
#include "uiuc_aircraft.h"
|
||||
#include "uiuc_convert.h"
|
||||
#include "uiuc_1DdataFileReader.h"
|
||||
#include "uiuc_2DdataFileReader.h"
|
||||
#include "uiuc_menu_functions.h"
|
||||
#include <FDM/LaRCsim/ls_generic.h>
|
||||
#include <FDM/LaRCsim/ls_cockpit.h> /* Long_trim defined */
|
||||
#include <FDM/LaRCsim/ls_constants.h> /* INVG defined */
|
||||
|
||||
void parse_Cn( const string& linetoken2, const string& linetoken3,
|
||||
const string& linetoken4, const string& linetoken5,
|
||||
const string& linetoken6, const string& linetoken7,
|
||||
const string& linetoken8, const string& linetoken9,
|
||||
const string& linetoken10, const string& aircraft_directory,
|
||||
LIST command_line );
|
||||
|
||||
#endif //_MENU_CN_H_
|
536
src/FDM/UIUCModel/uiuc_menu_Croll.cpp
Normal file
536
src/FDM/UIUCModel/uiuc_menu_Croll.cpp
Normal file
|
@ -0,0 +1,536 @@
|
|||
/**********************************************************************
|
||||
|
||||
FILENAME: uiuc_menu_Croll.cpp
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
DESCRIPTION: reads input data for specified aircraft and creates
|
||||
approporiate data storage space
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
STATUS: alpha version
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
REFERENCES: based on "menu reader" format of Michael Selig
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
HISTORY: 04/04/2003 initial release
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
AUTHOR(S): Robert Deters <rdeters@uiuc.edu>
|
||||
Michael Selig <m-selig@uiuc.edu>
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
VARIABLES:
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
INPUTS: n/a
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
OUTPUTS: n/a
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
CALLED BY: uiuc_menu()
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
CALLS TO: check_float() if needed
|
||||
d_2_to_3() if needed
|
||||
d_1_to_2() if needed
|
||||
i_1_to_2() if needed
|
||||
d_1_to_1() if needed
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
COPYRIGHT: (C) 2003 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 <simgear/compiler.h>
|
||||
|
||||
#if defined( __MWERKS__ )
|
||||
// -dw- optimizer chokes (big-time) trying to optimize humongous
|
||||
// loop/switch statements
|
||||
#pragma optimization_level 0
|
||||
#endif
|
||||
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include STL_IOSTREAM
|
||||
|
||||
#include "uiuc_menu_Croll.h"
|
||||
|
||||
SG_USING_STD(cerr);
|
||||
SG_USING_STD(cout);
|
||||
SG_USING_STD(endl);
|
||||
|
||||
#ifndef _MSC_VER
|
||||
SG_USING_STD(exit);
|
||||
#endif
|
||||
|
||||
void parse_Cl( const string& linetoken2, const string& linetoken3,
|
||||
const string& linetoken4, const string& linetoken5,
|
||||
const string& linetoken6, const string& linetoken7,
|
||||
const string& linetoken8, const string& linetoken9,
|
||||
const string& linetoken10, const string& aircraft_directory,
|
||||
LIST command_line ) {
|
||||
double token_value;
|
||||
int token_value_convert1, token_value_convert2, token_value_convert3;
|
||||
int token_value_convert4;
|
||||
double datafile_xArray[100][100], datafile_yArray[100];
|
||||
double datafile_zArray[100][100];
|
||||
double convert_f;
|
||||
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());
|
||||
istrstream token10(linetoken10.c_str());
|
||||
|
||||
static bool Clfabetaf_first = true;
|
||||
static bool Clfadaf_first = true;
|
||||
static bool Clfadrf_first = true;
|
||||
static bool Clfapf_first = true;
|
||||
static bool Clfarf_first = true;
|
||||
|
||||
switch(Cl_map[linetoken2])
|
||||
{
|
||||
case Clo_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Clo = token_value;
|
||||
Clo_clean = Clo;
|
||||
aeroRollParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Cl_beta_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Cl_beta = token_value;
|
||||
Cl_beta_clean = Cl_beta;
|
||||
aeroRollParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Cl_p_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Cl_p = token_value;
|
||||
Cl_p_clean = Cl_p;
|
||||
aeroRollParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Cl_r_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Cl_r = token_value;
|
||||
Cl_r_clean = Cl_r;
|
||||
aeroRollParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Cl_da_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Cl_da = token_value;
|
||||
Cl_da_clean = Cl_da;
|
||||
aeroRollParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Cl_dr_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Cl_dr = token_value;
|
||||
Cl_dr_clean = Cl_dr;
|
||||
aeroRollParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Cl_daa_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Cl_daa = token_value;
|
||||
Cl_daa_clean = Cl_daa;
|
||||
aeroRollParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Clfada_flag:
|
||||
{
|
||||
Clfada = aircraft_directory + linetoken3;
|
||||
token4 >> token_value_convert1;
|
||||
token5 >> token_value_convert2;
|
||||
token6 >> token_value_convert3;
|
||||
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 (Clfada) and
|
||||
conversion factors; function returns array of
|
||||
aileron deflections (daArray) and corresponding
|
||||
alpha (aArray) and delta Cl (ClArray) values and
|
||||
max number of terms in alpha arrays (nAlphaArray)
|
||||
and deflection array (nda) */
|
||||
uiuc_2DdataFileReader(Clfada,
|
||||
Clfada_aArray,
|
||||
Clfada_daArray,
|
||||
Clfada_ClArray,
|
||||
Clfada_nAlphaArray,
|
||||
Clfada_nda);
|
||||
aeroRollParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Clfbetadr_flag:
|
||||
{
|
||||
Clfbetadr = aircraft_directory + linetoken3;
|
||||
token4 >> token_value_convert1;
|
||||
token5 >> token_value_convert2;
|
||||
token6 >> token_value_convert3;
|
||||
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 (Clfbetadr) and
|
||||
conversion factors; function returns array of
|
||||
rudder deflections (drArray) and corresponding
|
||||
beta (betaArray) and delta Cl (ClArray) values and
|
||||
max number of terms in beta arrays (nBetaArray)
|
||||
and deflection array (ndr) */
|
||||
uiuc_2DdataFileReader(Clfbetadr,
|
||||
Clfbetadr_betaArray,
|
||||
Clfbetadr_drArray,
|
||||
Clfbetadr_ClArray,
|
||||
Clfbetadr_nBetaArray,
|
||||
Clfbetadr_ndr);
|
||||
aeroRollParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Clfabetaf_flag:
|
||||
{
|
||||
int Clfabetaf_index, i;
|
||||
string Clfabetaf_file;
|
||||
double flap_value;
|
||||
Clfabetaf_file = aircraft_directory + linetoken3;
|
||||
token4 >> Clfabetaf_index;
|
||||
if (Clfabetaf_index < 0 || Clfabetaf_index >= 100)
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
if (Clfabetaf_index > Clfabetaf_nf)
|
||||
Clfabetaf_nf = Clfabetaf_index;
|
||||
token5 >> flap_value;
|
||||
token6 >> token_value_convert1;
|
||||
token7 >> token_value_convert2;
|
||||
token8 >> token_value_convert3;
|
||||
token9 >> token_value_convert4;
|
||||
token10 >> Clfabetaf_nice;
|
||||
convert_z = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
convert_y = uiuc_convert(token_value_convert3);
|
||||
convert_f = uiuc_convert(token_value_convert4);
|
||||
Clfabetaf_fArray[Clfabetaf_index] = flap_value * convert_f;
|
||||
/* call 2D File Reader with file name (Clfabetaf_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(Clfabetaf_file,
|
||||
datafile_xArray,
|
||||
datafile_yArray,
|
||||
datafile_zArray,
|
||||
datafile_nxArray,
|
||||
datafile_ny);
|
||||
d_2_to_3(datafile_xArray, Clfabetaf_aArray, Clfabetaf_index);
|
||||
d_1_to_2(datafile_yArray, Clfabetaf_betaArray, Clfabetaf_index);
|
||||
d_2_to_3(datafile_zArray, Clfabetaf_ClArray, Clfabetaf_index);
|
||||
i_1_to_2(datafile_nxArray, Clfabetaf_nAlphaArray, Clfabetaf_index);
|
||||
Clfabetaf_nbeta[Clfabetaf_index] = datafile_ny;
|
||||
if (Clfabetaf_first==true)
|
||||
{
|
||||
if (Clfabetaf_nice == 1)
|
||||
{
|
||||
Clfabetaf_na_nice = datafile_nxArray[1];
|
||||
Clfabetaf_nb_nice = datafile_ny;
|
||||
d_1_to_1(datafile_yArray, Clfabetaf_bArray_nice);
|
||||
for (i=1; i<=Clfabetaf_na_nice; i++)
|
||||
Clfabetaf_aArray_nice[i] = datafile_xArray[1][i];
|
||||
}
|
||||
aeroRollParts -> storeCommands (*command_line);
|
||||
Clfabetaf_first=false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Clfadaf_flag:
|
||||
{
|
||||
int Clfadaf_index, i;
|
||||
string Clfadaf_file;
|
||||
double flap_value;
|
||||
Clfadaf_file = aircraft_directory + linetoken3;
|
||||
token4 >> Clfadaf_index;
|
||||
if (Clfadaf_index < 0 || Clfadaf_index >= 100)
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
if (Clfadaf_index > Clfadaf_nf)
|
||||
Clfadaf_nf = Clfadaf_index;
|
||||
token5 >> flap_value;
|
||||
token6 >> token_value_convert1;
|
||||
token7 >> token_value_convert2;
|
||||
token8 >> token_value_convert3;
|
||||
token9 >> token_value_convert4;
|
||||
token10 >> Clfadaf_nice;
|
||||
convert_z = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
convert_y = uiuc_convert(token_value_convert3);
|
||||
convert_f = uiuc_convert(token_value_convert4);
|
||||
Clfadaf_fArray[Clfadaf_index] = flap_value * convert_f;
|
||||
/* call 2D File Reader with file name (Clfadaf_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(Clfadaf_file,
|
||||
datafile_xArray,
|
||||
datafile_yArray,
|
||||
datafile_zArray,
|
||||
datafile_nxArray,
|
||||
datafile_ny);
|
||||
d_2_to_3(datafile_xArray, Clfadaf_aArray, Clfadaf_index);
|
||||
d_1_to_2(datafile_yArray, Clfadaf_daArray, Clfadaf_index);
|
||||
d_2_to_3(datafile_zArray, Clfadaf_ClArray, Clfadaf_index);
|
||||
i_1_to_2(datafile_nxArray, Clfadaf_nAlphaArray, Clfadaf_index);
|
||||
Clfadaf_nda[Clfadaf_index] = datafile_ny;
|
||||
if (Clfadaf_first==true)
|
||||
{
|
||||
if (Clfadaf_nice == 1)
|
||||
{
|
||||
Clfadaf_na_nice = datafile_nxArray[1];
|
||||
Clfadaf_nda_nice = datafile_ny;
|
||||
d_1_to_1(datafile_yArray, Clfadaf_daArray_nice);
|
||||
for (i=1; i<=Clfadaf_na_nice; i++)
|
||||
Clfadaf_aArray_nice[i] = datafile_xArray[1][i];
|
||||
}
|
||||
aeroRollParts -> storeCommands (*command_line);
|
||||
Clfadaf_first=false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Clfadrf_flag:
|
||||
{
|
||||
int Clfadrf_index, i;
|
||||
string Clfadrf_file;
|
||||
double flap_value;
|
||||
Clfadrf_file = aircraft_directory + linetoken3;
|
||||
token4 >> Clfadrf_index;
|
||||
if (Clfadrf_index < 0 || Clfadrf_index >= 100)
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
if (Clfadrf_index > Clfadrf_nf)
|
||||
Clfadrf_nf = Clfadrf_index;
|
||||
token5 >> flap_value;
|
||||
token6 >> token_value_convert1;
|
||||
token7 >> token_value_convert2;
|
||||
token8 >> token_value_convert3;
|
||||
token9 >> token_value_convert4;
|
||||
token10 >> Clfadrf_nice;
|
||||
convert_z = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
convert_y = uiuc_convert(token_value_convert3);
|
||||
convert_f = uiuc_convert(token_value_convert4);
|
||||
Clfadrf_fArray[Clfadrf_index] = flap_value * convert_f;
|
||||
/* call 2D File Reader with file name (Clfadrf_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(Clfadrf_file,
|
||||
datafile_xArray,
|
||||
datafile_yArray,
|
||||
datafile_zArray,
|
||||
datafile_nxArray,
|
||||
datafile_ny);
|
||||
d_2_to_3(datafile_xArray, Clfadrf_aArray, Clfadrf_index);
|
||||
d_1_to_2(datafile_yArray, Clfadrf_drArray, Clfadrf_index);
|
||||
d_2_to_3(datafile_zArray, Clfadrf_ClArray, Clfadrf_index);
|
||||
i_1_to_2(datafile_nxArray, Clfadrf_nAlphaArray, Clfadrf_index);
|
||||
Clfadrf_ndr[Clfadrf_index] = datafile_ny;
|
||||
if (Clfadrf_first==true)
|
||||
{
|
||||
if (Clfadrf_nice == 1)
|
||||
{
|
||||
Clfadrf_na_nice = datafile_nxArray[1];
|
||||
Clfadrf_ndr_nice = datafile_ny;
|
||||
d_1_to_1(datafile_yArray, Clfadrf_drArray_nice);
|
||||
for (i=1; i<=Clfadrf_na_nice; i++)
|
||||
Clfadrf_aArray_nice[i] = datafile_xArray[1][i];
|
||||
}
|
||||
aeroRollParts -> storeCommands (*command_line);
|
||||
Clfadrf_first=false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Clfapf_flag:
|
||||
{
|
||||
int Clfapf_index, i;
|
||||
string Clfapf_file;
|
||||
double flap_value;
|
||||
Clfapf_file = aircraft_directory + linetoken3;
|
||||
token4 >> Clfapf_index;
|
||||
if (Clfapf_index < 0 || Clfapf_index >= 100)
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
if (Clfapf_index > Clfapf_nf)
|
||||
Clfapf_nf = Clfapf_index;
|
||||
token5 >> flap_value;
|
||||
token6 >> token_value_convert1;
|
||||
token7 >> token_value_convert2;
|
||||
token8 >> token_value_convert3;
|
||||
token9 >> token_value_convert4;
|
||||
token10 >> Clfapf_nice;
|
||||
convert_z = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
convert_y = uiuc_convert(token_value_convert3);
|
||||
convert_f = uiuc_convert(token_value_convert4);
|
||||
Clfapf_fArray[Clfapf_index] = flap_value * convert_f;
|
||||
/* call 2D File Reader with file name (Clfapf_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(Clfapf_file,
|
||||
datafile_xArray,
|
||||
datafile_yArray,
|
||||
datafile_zArray,
|
||||
datafile_nxArray,
|
||||
datafile_ny);
|
||||
d_2_to_3(datafile_xArray, Clfapf_aArray, Clfapf_index);
|
||||
d_1_to_2(datafile_yArray, Clfapf_pArray, Clfapf_index);
|
||||
d_2_to_3(datafile_zArray, Clfapf_ClArray, Clfapf_index);
|
||||
i_1_to_2(datafile_nxArray, Clfapf_nAlphaArray, Clfapf_index);
|
||||
Clfapf_np[Clfapf_index] = datafile_ny;
|
||||
if (Clfapf_first==true)
|
||||
{
|
||||
if (Clfapf_nice == 1)
|
||||
{
|
||||
Clfapf_na_nice = datafile_nxArray[1];
|
||||
Clfapf_np_nice = datafile_ny;
|
||||
d_1_to_1(datafile_yArray, Clfapf_pArray_nice);
|
||||
for (i=1; i<=Clfapf_na_nice; i++)
|
||||
Clfapf_aArray_nice[i] = datafile_xArray[1][i];
|
||||
}
|
||||
aeroRollParts -> storeCommands (*command_line);
|
||||
Clfapf_first=false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Clfarf_flag:
|
||||
{
|
||||
int Clfarf_index, i;
|
||||
string Clfarf_file;
|
||||
double flap_value;
|
||||
Clfarf_file = aircraft_directory + linetoken3;
|
||||
token4 >> Clfarf_index;
|
||||
if (Clfarf_index < 0 || Clfarf_index >= 100)
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
if (Clfarf_index > Clfarf_nf)
|
||||
Clfarf_nf = Clfarf_index;
|
||||
token5 >> flap_value;
|
||||
token6 >> token_value_convert1;
|
||||
token7 >> token_value_convert2;
|
||||
token8 >> token_value_convert3;
|
||||
token9 >> token_value_convert4;
|
||||
token10 >> Clfarf_nice;
|
||||
convert_z = uiuc_convert(token_value_convert1);
|
||||
convert_x = uiuc_convert(token_value_convert2);
|
||||
convert_y = uiuc_convert(token_value_convert3);
|
||||
convert_f = uiuc_convert(token_value_convert4);
|
||||
Clfarf_fArray[Clfarf_index] = flap_value * convert_f;
|
||||
/* call 2D File Reader with file name (Clfarf_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(Clfarf_file,
|
||||
datafile_xArray,
|
||||
datafile_yArray,
|
||||
datafile_zArray,
|
||||
datafile_nxArray,
|
||||
datafile_ny);
|
||||
d_2_to_3(datafile_xArray, Clfarf_aArray, Clfarf_index);
|
||||
d_1_to_2(datafile_yArray, Clfarf_rArray, Clfarf_index);
|
||||
d_2_to_3(datafile_zArray, Clfarf_ClArray, Clfarf_index);
|
||||
i_1_to_2(datafile_nxArray, Clfarf_nAlphaArray, Clfarf_index);
|
||||
Clfarf_nr[Clfarf_index] = datafile_ny;
|
||||
if (Clfarf_first==true)
|
||||
{
|
||||
if (Clfarf_nice == 1)
|
||||
{
|
||||
Clfarf_na_nice = datafile_nxArray[1];
|
||||
Clfarf_nr_nice = datafile_ny;
|
||||
d_1_to_1(datafile_yArray, Clfarf_rArray_nice);
|
||||
for (i=1; i<=Clfarf_na_nice; i++)
|
||||
Clfarf_aArray_nice[i] = datafile_xArray[1][i];
|
||||
}
|
||||
aeroRollParts -> storeCommands (*command_line);
|
||||
Clfarf_first=false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
if (ignore_unknown_keywords) {
|
||||
// do nothing
|
||||
} else {
|
||||
// print error message
|
||||
uiuc_warnings_errors(2, *command_line);
|
||||
}
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
21
src/FDM/UIUCModel/uiuc_menu_Croll.h
Normal file
21
src/FDM/UIUCModel/uiuc_menu_Croll.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
|
||||
#ifndef _MENU_CROLL_H_
|
||||
#define _MENU_CROLL_H_
|
||||
|
||||
#include "uiuc_aircraft.h"
|
||||
#include "uiuc_convert.h"
|
||||
#include "uiuc_1DdataFileReader.h"
|
||||
#include "uiuc_2DdataFileReader.h"
|
||||
#include "uiuc_menu_functions.h"
|
||||
#include <FDM/LaRCsim/ls_generic.h>
|
||||
#include <FDM/LaRCsim/ls_cockpit.h> /* Long_trim defined */
|
||||
#include <FDM/LaRCsim/ls_constants.h> /* INVG defined */
|
||||
|
||||
void parse_Cl( const string& linetoken2, const string& linetoken3,
|
||||
const string& linetoken4, const string& linetoken5,
|
||||
const string& linetoken6, const string& linetoken7,
|
||||
const string& linetoken8, const string& linetoken9,
|
||||
const string& linetoken10, const string& aircraft_directory,
|
||||
LIST command_line );
|
||||
|
||||
#endif //_MENU_CROLL_H_
|
520
src/FDM/UIUCModel/uiuc_menu_controlSurface.cpp
Normal file
520
src/FDM/UIUCModel/uiuc_menu_controlSurface.cpp
Normal file
|
@ -0,0 +1,520 @@
|
|||
/**********************************************************************
|
||||
|
||||
FILENAME: uiuc_menu_controlSurface.cpp
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
DESCRIPTION: reads input data for specified aircraft and creates
|
||||
approporiate data storage space
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
STATUS: alpha version
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
REFERENCES: based on "menu reader" format of Michael Selig
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
HISTORY: 04/04/2003 initial release
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
AUTHOR(S): Robert Deters <rdeters@uiuc.edu>
|
||||
Michael Selig <m-selig@uiuc.edu>
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
VARIABLES:
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
INPUTS: n/a
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
OUTPUTS: n/a
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
CALLED BY: uiuc_menu()
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
CALLS TO: check_float() if needed
|
||||
d_2_to_3() if needed
|
||||
d_1_to_2() if needed
|
||||
i_1_to_2() if needed
|
||||
d_1_to_1() if needed
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
COPYRIGHT: (C) 2003 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 <simgear/compiler.h>
|
||||
|
||||
#if defined( __MWERKS__ )
|
||||
// -dw- optimizer chokes (big-time) trying to optimize humongous
|
||||
// loop/switch statements
|
||||
#pragma optimization_level 0
|
||||
#endif
|
||||
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include STL_IOSTREAM
|
||||
|
||||
#include "uiuc_menu_controlSurface.h"
|
||||
|
||||
SG_USING_STD(cerr);
|
||||
SG_USING_STD(cout);
|
||||
SG_USING_STD(endl);
|
||||
|
||||
#ifndef _MSC_VER
|
||||
SG_USING_STD(exit);
|
||||
#endif
|
||||
|
||||
void parse_controlSurface( const string& linetoken2, const string& linetoken3,
|
||||
const string& linetoken4, const string& linetoken5,
|
||||
const string& linetoken6, const string& linetoken7,
|
||||
const string& linetoken8, const string& linetoken9,
|
||||
const string& linetoken10,
|
||||
const string& aircraft_directory,
|
||||
LIST command_line ) {
|
||||
double token_value;
|
||||
int token_value_convert1, token_value_convert2;
|
||||
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());
|
||||
istrstream token10(linetoken10.c_str());
|
||||
|
||||
switch(controlSurface_map[linetoken2])
|
||||
{
|
||||
case de_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
demax = token_value;
|
||||
|
||||
if (check_float(linetoken4))
|
||||
token4 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
demin = token_value;
|
||||
break;
|
||||
}
|
||||
case da_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
damax = token_value;
|
||||
|
||||
if (check_float(linetoken4))
|
||||
token4 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
damin = token_value;
|
||||
break;
|
||||
}
|
||||
case dr_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
drmax = token_value;
|
||||
|
||||
if (check_float(linetoken4))
|
||||
token4 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
drmin = token_value;
|
||||
break;
|
||||
}
|
||||
case set_Long_trim_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
set_Long_trim = true;
|
||||
elevator_tab = token_value;
|
||||
break;
|
||||
}
|
||||
case set_Long_trim_deg_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
set_Long_trim = true;
|
||||
elevator_tab = token_value * DEG_TO_RAD;
|
||||
break;
|
||||
}
|
||||
case zero_Long_trim_flag:
|
||||
{
|
||||
zero_Long_trim = true;
|
||||
break;
|
||||
}
|
||||
case elevator_step_flag:
|
||||
{
|
||||
// set step input flag
|
||||
elevator_step = true;
|
||||
|
||||
// read in step angle in degrees and convert
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
elevator_step_angle = token_value * DEG_TO_RAD;
|
||||
|
||||
// read in step start time
|
||||
if (check_float(linetoken4))
|
||||
token4 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
elevator_step_startTime = token_value;
|
||||
break;
|
||||
}
|
||||
case elevator_singlet_flag:
|
||||
{
|
||||
// set singlet input flag
|
||||
elevator_singlet = true;
|
||||
|
||||
// read in singlet angle in degrees and convert
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
elevator_singlet_angle = token_value * DEG_TO_RAD;
|
||||
|
||||
// read in singlet start time
|
||||
if (check_float(linetoken4))
|
||||
token4 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
elevator_singlet_startTime = token_value;
|
||||
|
||||
// read in singlet duration
|
||||
if (check_float(linetoken5))
|
||||
token5 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
elevator_singlet_duration = token_value;
|
||||
break;
|
||||
}
|
||||
case elevator_doublet_flag:
|
||||
{
|
||||
// set doublet input flag
|
||||
elevator_doublet = true;
|
||||
|
||||
// read in doublet angle in degrees and convert
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
elevator_doublet_angle = token_value * DEG_TO_RAD;
|
||||
|
||||
// read in doublet start time
|
||||
if (check_float(linetoken4))
|
||||
token4 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
elevator_doublet_startTime = token_value;
|
||||
|
||||
// read in doublet duration
|
||||
if (check_float(linetoken5))
|
||||
token5 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
elevator_doublet_duration = token_value;
|
||||
break;
|
||||
}
|
||||
case elevator_input_flag:
|
||||
{
|
||||
elevator_input = true;
|
||||
elevator_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(elevator_input_file,
|
||||
elevator_input_timeArray,
|
||||
elevator_input_deArray,
|
||||
elevator_input_ntime);
|
||||
token6 >> token_value;
|
||||
elevator_input_startTime = token_value;
|
||||
break;
|
||||
}
|
||||
case aileron_input_flag:
|
||||
{
|
||||
aileron_input = true;
|
||||
aileron_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(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 = 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(rudder_input_file,
|
||||
rudder_input_timeArray,
|
||||
rudder_input_drArray,
|
||||
rudder_input_ntime);
|
||||
token6 >> token_value;
|
||||
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;
|
||||
break;
|
||||
}
|
||||
case pilot_ail_no_flag:
|
||||
{
|
||||
pilot_ail_no_check = true;
|
||||
break;
|
||||
}
|
||||
case pilot_rud_no_flag:
|
||||
{
|
||||
pilot_rud_no_check = true;
|
||||
break;
|
||||
}
|
||||
case flap_max_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
use_flaps = true;
|
||||
flap_max = token_value;
|
||||
break;
|
||||
}
|
||||
case flap_rate_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
use_flaps = true;
|
||||
flap_rate = token_value;
|
||||
break;
|
||||
}
|
||||
case spoiler_max_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
use_spoilers = true;
|
||||
spoiler_max = token_value;
|
||||
break;
|
||||
}
|
||||
case spoiler_rate_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
use_spoilers = true;
|
||||
spoiler_rate = token_value;
|
||||
break;
|
||||
}
|
||||
case aileron_sas_KP_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
aileron_sas_KP = token_value;
|
||||
break;
|
||||
}
|
||||
case aileron_sas_max_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
aileron_sas_max = token_value;
|
||||
use_aileron_sas_max = true;
|
||||
break;
|
||||
}
|
||||
case aileron_stick_gain_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
aileron_stick_gain = token_value;
|
||||
use_aileron_stick_gain = true;
|
||||
break;
|
||||
}
|
||||
case elevator_sas_KQ_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
elevator_sas_KQ = token_value;
|
||||
break;
|
||||
}
|
||||
case elevator_sas_max_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
elevator_sas_max = token_value;
|
||||
use_elevator_sas_max = true;
|
||||
break;
|
||||
}
|
||||
case elevator_sas_min_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
elevator_sas_min = token_value;
|
||||
use_elevator_sas_min = true;
|
||||
break;
|
||||
}
|
||||
case elevator_stick_gain_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
elevator_stick_gain = token_value;
|
||||
use_elevator_stick_gain = true;
|
||||
break;
|
||||
}
|
||||
case rudder_sas_KR_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
rudder_sas_KR = token_value;
|
||||
break;
|
||||
}
|
||||
case rudder_sas_max_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
rudder_sas_max = token_value;
|
||||
use_rudder_sas_max = true;
|
||||
break;
|
||||
}
|
||||
case rudder_stick_gain_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
rudder_stick_gain = token_value;
|
||||
use_rudder_stick_gain = true;
|
||||
break;
|
||||
}
|
||||
case use_aileron_sas_type1_flag:
|
||||
{
|
||||
use_aileron_sas_type1 = true;
|
||||
break;
|
||||
}
|
||||
case use_elevator_sas_type1_flag:
|
||||
{
|
||||
use_elevator_sas_type1 = true;
|
||||
break;
|
||||
}
|
||||
case use_rudder_sas_type1_flag:
|
||||
{
|
||||
use_rudder_sas_type1 = true;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
if (ignore_unknown_keywords) {
|
||||
// do nothing
|
||||
} else {
|
||||
// print error message
|
||||
uiuc_warnings_errors(2, *command_line);
|
||||
}
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
22
src/FDM/UIUCModel/uiuc_menu_controlSurface.h
Normal file
22
src/FDM/UIUCModel/uiuc_menu_controlSurface.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
|
||||
#ifndef _MENU_CONTROLSURFACE_H_
|
||||
#define _MENU_CONTROLSURFACE_H_
|
||||
|
||||
#include "uiuc_aircraft.h"
|
||||
#include "uiuc_convert.h"
|
||||
#include "uiuc_1DdataFileReader.h"
|
||||
#include "uiuc_2DdataFileReader.h"
|
||||
#include "uiuc_menu_functions.h"
|
||||
#include <FDM/LaRCsim/ls_generic.h>
|
||||
#include <FDM/LaRCsim/ls_cockpit.h> /* Long_trim defined */
|
||||
#include <FDM/LaRCsim/ls_constants.h> /* INVG defined */
|
||||
|
||||
void parse_controlSurface( const string& linetoken2, const string& linetoken3,
|
||||
const string& linetoken4, const string& linetoken5,
|
||||
const string& linetoken6, const string& linetoken7,
|
||||
const string& linetoken8, const string& linetoken9,
|
||||
const string& linetoken10,
|
||||
const string& aircraft_directory,
|
||||
LIST command_line );
|
||||
|
||||
#endif //_MENU_CONTROLSURFACE_H_
|
484
src/FDM/UIUCModel/uiuc_menu_engine.cpp
Normal file
484
src/FDM/UIUCModel/uiuc_menu_engine.cpp
Normal file
|
@ -0,0 +1,484 @@
|
|||
/**********************************************************************
|
||||
|
||||
FILENAME: uiuc_menu_engine.cpp
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
DESCRIPTION: reads input data for specified aircraft and creates
|
||||
approporiate data storage space
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
STATUS: alpha version
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
REFERENCES: based on "menu reader" format of Michael Selig
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
HISTORY: 04/04/2003 initial release
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
AUTHOR(S): Robert Deters <rdeters@uiuc.edu>
|
||||
Michael Selig <m-selig@uiuc.edu>
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
VARIABLES:
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
INPUTS: n/a
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
OUTPUTS: n/a
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
CALLED BY: uiuc_menu()
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
CALLS TO: check_float() if needed
|
||||
d_2_to_3() if needed
|
||||
d_1_to_2() if needed
|
||||
i_1_to_2() if needed
|
||||
d_1_to_1() if needed
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
COPYRIGHT: (C) 2003 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 <simgear/compiler.h>
|
||||
|
||||
#if defined( __MWERKS__ )
|
||||
// -dw- optimizer chokes (big-time) trying to optimize humongous
|
||||
// loop/switch statements
|
||||
#pragma optimization_level 0
|
||||
#endif
|
||||
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include STL_IOSTREAM
|
||||
|
||||
#include "uiuc_menu_engine.h"
|
||||
|
||||
SG_USING_STD(cerr);
|
||||
SG_USING_STD(cout);
|
||||
SG_USING_STD(endl);
|
||||
|
||||
#ifndef _MSC_VER
|
||||
SG_USING_STD(exit);
|
||||
#endif
|
||||
|
||||
void parse_engine( const string& linetoken2, const string& linetoken3,
|
||||
const string& linetoken4, const string& linetoken5,
|
||||
const string& linetoken6, const string& linetoken7,
|
||||
const string& linetoken8, const string& linetoken9,
|
||||
const string& linetoken10,const string& aircraft_directory,
|
||||
LIST command_line ) {
|
||||
double token_value;
|
||||
int token_value_convert1, token_value_convert2;
|
||||
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());
|
||||
istrstream token10(linetoken10.c_str());
|
||||
|
||||
switch(engine_map[linetoken2])
|
||||
{
|
||||
case simpleSingle_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
simpleSingleMaxThrust = token_value;
|
||||
engineParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case simpleSingleModel_flag:
|
||||
{
|
||||
simpleSingleModel = true;
|
||||
/* input the thrust at zero speed */
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
t_v0 = token_value;
|
||||
/* input slope of thrust at speed for which thrust is zero */
|
||||
if (check_float(linetoken4))
|
||||
token4 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
dtdv_t0 = token_value;
|
||||
/* input speed at which thrust is zero */
|
||||
if (check_float(linetoken5))
|
||||
token5 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
v_t0 = token_value;
|
||||
dtdvvt = -dtdv_t0 * v_t0 / t_v0;
|
||||
engineParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case c172_flag:
|
||||
{
|
||||
engineParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case cherokee_flag:
|
||||
{
|
||||
engineParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Throttle_pct_input_flag:
|
||||
{
|
||||
Throttle_pct_input = true;
|
||||
Throttle_pct_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(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;
|
||||
}
|
||||
case gyroForce_Q_body_flag:
|
||||
{
|
||||
/* include gyroscopic forces due to pitch */
|
||||
gyroForce_Q_body = true;
|
||||
break;
|
||||
}
|
||||
case gyroForce_R_body_flag:
|
||||
{
|
||||
/* include gyroscopic forces due to yaw */
|
||||
gyroForce_R_body = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case slipstream_effects_flag:
|
||||
{
|
||||
// include slipstream effects
|
||||
b_slipstreamEffects = true;
|
||||
if (!simpleSingleModel)
|
||||
uiuc_warnings_errors(3, *command_line);
|
||||
break;
|
||||
}
|
||||
case propDia_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
propDia = token_value;
|
||||
break;
|
||||
}
|
||||
case eta_q_Cm_q_flag:
|
||||
{
|
||||
// include slipstream effects due to Cm_q
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
eta_q_Cm_q_fac = token_value;
|
||||
if (eta_q_Cm_q_fac == 0.0) {eta_q_Cm_q_fac = 1.0;}
|
||||
break;
|
||||
}
|
||||
case eta_q_Cm_adot_flag:
|
||||
{
|
||||
// include slipstream effects due to Cm_adot
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
eta_q_Cm_adot_fac = token_value;
|
||||
if (eta_q_Cm_adot_fac == 0.0) {eta_q_Cm_adot_fac = 1.0;}
|
||||
break;
|
||||
}
|
||||
case eta_q_Cmfade_flag:
|
||||
{
|
||||
// include slipstream effects due to Cmfade
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
eta_q_Cmfade_fac = token_value;
|
||||
if (eta_q_Cmfade_fac == 0.0) {eta_q_Cmfade_fac = 1.0;}
|
||||
break;
|
||||
}
|
||||
case eta_q_Cm_de_flag:
|
||||
{
|
||||
// include slipstream effects due to Cmfade
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
eta_q_Cm_de_fac = token_value;
|
||||
if (eta_q_Cm_de_fac == 0.0) {eta_q_Cm_de_fac = 1.0;}
|
||||
break;
|
||||
}
|
||||
case eta_q_Cl_beta_flag:
|
||||
{
|
||||
// include slipstream effects due to Cl_beta
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
eta_q_Cl_beta_fac = token_value;
|
||||
if (eta_q_Cl_beta_fac == 0.0) {eta_q_Cl_beta_fac = 1.0;}
|
||||
break;
|
||||
}
|
||||
case eta_q_Cl_p_flag:
|
||||
{
|
||||
// include slipstream effects due to Cl_p
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
eta_q_Cl_p_fac = token_value;
|
||||
if (eta_q_Cl_p_fac == 0.0) {eta_q_Cl_p_fac = 1.0;}
|
||||
break;
|
||||
}
|
||||
case eta_q_Cl_r_flag:
|
||||
{
|
||||
// include slipstream effects due to Cl_r
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
eta_q_Cl_r_fac = token_value;
|
||||
if (eta_q_Cl_r_fac == 0.0) {eta_q_Cl_r_fac = 1.0;}
|
||||
break;
|
||||
}
|
||||
case eta_q_Cl_dr_flag:
|
||||
{
|
||||
// include slipstream effects due to Cl_dr
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
eta_q_Cl_dr_fac = token_value;
|
||||
if (eta_q_Cl_dr_fac == 0.0) {eta_q_Cl_dr_fac = 1.0;}
|
||||
break;
|
||||
}
|
||||
case eta_q_CY_beta_flag:
|
||||
{
|
||||
// include slipstream effects due to CY_beta
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
eta_q_CY_beta_fac = token_value;
|
||||
if (eta_q_CY_beta_fac == 0.0) {eta_q_CY_beta_fac = 1.0;}
|
||||
break;
|
||||
}
|
||||
case eta_q_CY_p_flag:
|
||||
{
|
||||
// include slipstream effects due to CY_p
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
eta_q_CY_p_fac = token_value;
|
||||
if (eta_q_CY_p_fac == 0.0) {eta_q_CY_p_fac = 1.0;}
|
||||
break;
|
||||
}
|
||||
case eta_q_CY_r_flag:
|
||||
{
|
||||
// include slipstream effects due to CY_r
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
eta_q_CY_r_fac = token_value;
|
||||
if (eta_q_CY_r_fac == 0.0) {eta_q_CY_r_fac = 1.0;}
|
||||
break;
|
||||
}
|
||||
case eta_q_CY_dr_flag:
|
||||
{
|
||||
// include slipstream effects due to CY_dr
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
eta_q_CY_dr_fac = token_value;
|
||||
if (eta_q_CY_dr_fac == 0.0) {eta_q_CY_dr_fac = 1.0;}
|
||||
break;
|
||||
}
|
||||
case eta_q_Cn_beta_flag:
|
||||
{
|
||||
// include slipstream effects due to Cn_beta
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
eta_q_Cn_beta_fac = token_value;
|
||||
if (eta_q_Cn_beta_fac == 0.0) {eta_q_Cn_beta_fac = 1.0;}
|
||||
break;
|
||||
}
|
||||
case eta_q_Cn_p_flag:
|
||||
{
|
||||
// include slipstream effects due to Cn_p
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
eta_q_Cn_p_fac = token_value;
|
||||
if (eta_q_Cn_p_fac == 0.0) {eta_q_Cn_p_fac = 1.0;}
|
||||
break;
|
||||
}
|
||||
case eta_q_Cn_r_flag:
|
||||
{
|
||||
// include slipstream effects due to Cn_r
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
eta_q_Cn_r_fac = token_value;
|
||||
if (eta_q_Cn_r_fac == 0.0) {eta_q_Cn_r_fac = 1.0;}
|
||||
break;
|
||||
}
|
||||
case eta_q_Cn_dr_flag:
|
||||
{
|
||||
// include slipstream effects due to Cn_dr
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
eta_q_Cn_dr_fac = token_value;
|
||||
if (eta_q_Cn_dr_fac == 0.0) {eta_q_Cn_dr_fac = 1.0;}
|
||||
break;
|
||||
}
|
||||
|
||||
case omega_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
minOmega = token_value;
|
||||
if (check_float(linetoken4))
|
||||
token4 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
maxOmega = token_value;
|
||||
break;
|
||||
}
|
||||
case omegaRPM_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
minOmegaRPM = token_value;
|
||||
minOmega = minOmegaRPM * 2.0 * LS_PI / 60;
|
||||
if (check_float(linetoken4))
|
||||
token4 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
maxOmegaRPM = token_value;
|
||||
maxOmega = maxOmegaRPM * 2.0 * LS_PI / 60;
|
||||
break;
|
||||
}
|
||||
case polarInertia_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
polarInertia = token_value;
|
||||
break;
|
||||
}
|
||||
case forcemom_flag:
|
||||
{
|
||||
engineParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Xp_input_flag:
|
||||
{
|
||||
Xp_input = true;
|
||||
Xp_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(Xp_input_file,
|
||||
Xp_input_timeArray,
|
||||
Xp_input_XpArray,
|
||||
Xp_input_ntime);
|
||||
token6 >> token_value;
|
||||
Xp_input_startTime = token_value;
|
||||
break;
|
||||
}
|
||||
case Zp_input_flag:
|
||||
{
|
||||
Zp_input = true;
|
||||
Zp_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(Zp_input_file,
|
||||
Zp_input_timeArray,
|
||||
Zp_input_ZpArray,
|
||||
Zp_input_ntime);
|
||||
token6 >> token_value;
|
||||
Zp_input_startTime = token_value;
|
||||
break;
|
||||
}
|
||||
case Mp_input_flag:
|
||||
{
|
||||
Mp_input = true;
|
||||
Mp_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(Mp_input_file,
|
||||
Mp_input_timeArray,
|
||||
Mp_input_MpArray,
|
||||
Mp_input_ntime);
|
||||
token6 >> token_value;
|
||||
Mp_input_startTime = token_value;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
if (ignore_unknown_keywords) {
|
||||
// do nothing
|
||||
} else {
|
||||
// print error message
|
||||
uiuc_warnings_errors(2, *command_line);
|
||||
}
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
21
src/FDM/UIUCModel/uiuc_menu_engine.h
Normal file
21
src/FDM/UIUCModel/uiuc_menu_engine.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
|
||||
#ifndef _MENU_ENGINE_H_
|
||||
#define _MENU_ENGINE_H_
|
||||
|
||||
#include "uiuc_aircraft.h"
|
||||
#include "uiuc_convert.h"
|
||||
#include "uiuc_1DdataFileReader.h"
|
||||
#include "uiuc_2DdataFileReader.h"
|
||||
#include "uiuc_menu_functions.h"
|
||||
#include <FDM/LaRCsim/ls_generic.h>
|
||||
#include <FDM/LaRCsim/ls_cockpit.h> /* Long_trim defined */
|
||||
#include <FDM/LaRCsim/ls_constants.h> /* INVG defined */
|
||||
|
||||
void parse_engine( const string& linetoken2, const string& linetoken3,
|
||||
const string& linetoken4, const string& linetoken5,
|
||||
const string& linetoken6, const string& linetoken7,
|
||||
const string& linetoken8, const string& linetoken9,
|
||||
const string& linetoken10,const string& aircraft_directory,
|
||||
LIST command_line );
|
||||
|
||||
#endif //_MENU_ENGINE_H_
|
172
src/FDM/UIUCModel/uiuc_menu_fog.cpp
Normal file
172
src/FDM/UIUCModel/uiuc_menu_fog.cpp
Normal file
|
@ -0,0 +1,172 @@
|
|||
/**********************************************************************
|
||||
|
||||
FILENAME: uiuc_menu_fog.cpp
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
DESCRIPTION: reads input data for specified aircraft and creates
|
||||
approporiate data storage space
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
STATUS: alpha version
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
REFERENCES: based on "menu reader" format of Michael Selig
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
HISTORY: 04/04/2003 initial release
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
AUTHOR(S): Robert Deters <rdeters@uiuc.edu>
|
||||
Michael Selig <m-selig@uiuc.edu>
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
VARIABLES:
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
INPUTS: n/a
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
OUTPUTS: n/a
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
CALLED BY: uiuc_menu()
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
CALLS TO: check_float() if needed
|
||||
d_2_to_3() if needed
|
||||
d_1_to_2() if needed
|
||||
i_1_to_2() if needed
|
||||
d_1_to_1() if needed
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
COPYRIGHT: (C) 2003 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 <simgear/compiler.h>
|
||||
|
||||
#if defined( __MWERKS__ )
|
||||
// -dw- optimizer chokes (big-time) trying to optimize humongous
|
||||
// loop/switch statements
|
||||
#pragma optimization_level 0
|
||||
#endif
|
||||
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include STL_IOSTREAM
|
||||
|
||||
#include "uiuc_menu_fog.h"
|
||||
|
||||
SG_USING_STD(cerr);
|
||||
SG_USING_STD(cout);
|
||||
SG_USING_STD(endl);
|
||||
|
||||
#ifndef _MSC_VER
|
||||
SG_USING_STD(exit);
|
||||
#endif
|
||||
|
||||
void parse_fog( const string& linetoken2, const string& linetoken3,
|
||||
const string& linetoken4, const string& linetoken5,
|
||||
const string& linetoken6, const string& linetoken7,
|
||||
const string& linetoken8, const string& linetoken9,
|
||||
const string& linetoken10, const string& aircraft_directory,
|
||||
LIST command_line ) {
|
||||
double token_value;
|
||||
int token_value_convert1;
|
||||
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());
|
||||
istrstream token10(linetoken10.c_str());
|
||||
|
||||
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:
|
||||
{
|
||||
if (ignore_unknown_keywords) {
|
||||
// do nothing
|
||||
} else {
|
||||
// print error message
|
||||
uiuc_warnings_errors(2, *command_line);
|
||||
}
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
21
src/FDM/UIUCModel/uiuc_menu_fog.h
Normal file
21
src/FDM/UIUCModel/uiuc_menu_fog.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
|
||||
#ifndef _MENU_FOG_H_
|
||||
#define _MENU_FOG_H_
|
||||
|
||||
#include "uiuc_aircraft.h"
|
||||
#include "uiuc_convert.h"
|
||||
#include "uiuc_1DdataFileReader.h"
|
||||
#include "uiuc_2DdataFileReader.h"
|
||||
#include "uiuc_menu_functions.h"
|
||||
#include <FDM/LaRCsim/ls_generic.h>
|
||||
#include <FDM/LaRCsim/ls_cockpit.h> /* Long_trim defined */
|
||||
#include <FDM/LaRCsim/ls_constants.h> /* INVG defined */
|
||||
|
||||
void parse_fog( const string& linetoken2, const string& linetoken3,
|
||||
const string& linetoken4, const string& linetoken5,
|
||||
const string& linetoken6, const string& linetoken7,
|
||||
const string& linetoken8, const string& linetoken9,
|
||||
const string& linetoken10, const string& aircraft_directory,
|
||||
LIST command_line );
|
||||
|
||||
#endif //_MENU_FOG_H_
|
44
src/FDM/UIUCModel/uiuc_menu_functions.cpp
Normal file
44
src/FDM/UIUCModel/uiuc_menu_functions.cpp
Normal file
|
@ -0,0 +1,44 @@
|
|||
|
||||
#include "uiuc_menu_functions.h"
|
||||
|
||||
bool check_float( const string &token)
|
||||
{
|
||||
float value;
|
||||
istrstream stream(token.c_str());
|
||||
return (stream >> value);
|
||||
}
|
||||
|
||||
void d_2_to_3( double array2D[100][100], double array3D[][100][100], int index3D)
|
||||
{
|
||||
for (register int i=0; i<=99; i++)
|
||||
{
|
||||
for (register int j=1; j<=99; j++)
|
||||
{
|
||||
array3D[index3D][i][j]=array2D[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void d_1_to_2( double array1D[100], double array2D[][100], int index2D)
|
||||
{
|
||||
for (register int i=0; i<=99; i++)
|
||||
{
|
||||
array2D[index2D][i]=array1D[i];
|
||||
}
|
||||
}
|
||||
|
||||
void d_1_to_1( double array1[100], double array2[100] )
|
||||
{
|
||||
for (register int i=0; i<=99; i++)
|
||||
{
|
||||
array2[i]=array1[i];
|
||||
}
|
||||
}
|
||||
|
||||
void i_1_to_2( int array1D[100], int array2D[][100], int index2D)
|
||||
{
|
||||
for (register int i=0; i<=99; i++)
|
||||
{
|
||||
array2D[index2D][i]=array1D[i];
|
||||
}
|
||||
}
|
21
src/FDM/UIUCModel/uiuc_menu_functions.h
Normal file
21
src/FDM/UIUCModel/uiuc_menu_functions.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
|
||||
#ifndef _MENU_FUNCTIONS_H_
|
||||
#define _MENU_FUNCTIONS_H_
|
||||
|
||||
#include "uiuc_aircraft.h"
|
||||
#include <simgear/compiler.h>
|
||||
|
||||
#include <string>
|
||||
#include STL_IOSTREAM
|
||||
#include STL_STRSTREAM
|
||||
|
||||
SG_USING_STD(istrstream);
|
||||
|
||||
void d_2_to_3( double array2D[100][100], double array3D[][100][100], int index3D);
|
||||
void d_1_to_2( double array1D[100], double array2D[][100], int index2D);
|
||||
void d_1_to_1( double array1[100], double array2[100] );
|
||||
void i_1_to_2( int array1D[100], int array2D[][100], int index2D);
|
||||
bool check_float( const string &token);
|
||||
//bool check_float( const string &token);
|
||||
|
||||
#endif //_MENU_FUNCTIONS_H_
|
242
src/FDM/UIUCModel/uiuc_menu_gear.cpp
Normal file
242
src/FDM/UIUCModel/uiuc_menu_gear.cpp
Normal file
|
@ -0,0 +1,242 @@
|
|||
/**********************************************************************
|
||||
|
||||
FILENAME: uiuc_menu_gear.cpp
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
DESCRIPTION: reads input data for specified aircraft and creates
|
||||
approporiate data storage space
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
STATUS: alpha version
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
REFERENCES: based on "menu reader" format of Michael Selig
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
HISTORY: 04/04/2003 initial release
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
AUTHOR(S): Robert Deters <rdeters@uiuc.edu>
|
||||
Michael Selig <m-selig@uiuc.edu>
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
VARIABLES:
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
INPUTS: n/a
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
OUTPUTS: n/a
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
CALLED BY: uiuc_menu()
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
CALLS TO: check_float() if needed
|
||||
d_2_to_3() if needed
|
||||
d_1_to_2() if needed
|
||||
i_1_to_2() if needed
|
||||
d_1_to_1() if needed
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
COPYRIGHT: (C) 2003 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 <simgear/compiler.h>
|
||||
|
||||
#if defined( __MWERKS__ )
|
||||
// -dw- optimizer chokes (big-time) trying to optimize humongous
|
||||
// loop/switch statements
|
||||
#pragma optimization_level 0
|
||||
#endif
|
||||
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include STL_IOSTREAM
|
||||
|
||||
#include "uiuc_menu_gear.h"
|
||||
|
||||
SG_USING_STD(cerr);
|
||||
SG_USING_STD(cout);
|
||||
SG_USING_STD(endl);
|
||||
|
||||
#ifndef _MSC_VER
|
||||
SG_USING_STD(exit);
|
||||
#endif
|
||||
|
||||
void parse_gear( const string& linetoken2, const string& linetoken3,
|
||||
const string& linetoken4, const string& linetoken5,
|
||||
const string& linetoken6, const string& linetoken7,
|
||||
const string& linetoken8, const string& linetoken9,
|
||||
const string& linetoken10, const string& aircraft_directory,
|
||||
LIST command_line ) {
|
||||
double token_value;
|
||||
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());
|
||||
istrstream token10(linetoken10.c_str());
|
||||
|
||||
switch(gear_map[linetoken2])
|
||||
{
|
||||
case Dx_gear_flag:
|
||||
{
|
||||
int index;
|
||||
token3 >> index;
|
||||
if (index < 0 || index >= 16)
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
if (check_float(linetoken4))
|
||||
token4 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
D_gear_v[index][0] = token_value;
|
||||
gear_model[index] = true;
|
||||
break;
|
||||
}
|
||||
case Dy_gear_flag:
|
||||
{
|
||||
int index;
|
||||
token3 >> index;
|
||||
if (index < 0 || index >= 16)
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
if (check_float(linetoken4))
|
||||
token4 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
D_gear_v[index][1] = token_value;
|
||||
gear_model[index] = true;
|
||||
break;
|
||||
}
|
||||
case Dz_gear_flag:
|
||||
{
|
||||
int index;
|
||||
token3 >> index;
|
||||
if (index < 0 || index >= 16)
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
if (check_float(linetoken4))
|
||||
token4 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
D_gear_v[index][2] = token_value;
|
||||
gear_model[index] = true;
|
||||
break;
|
||||
}
|
||||
case cgear_flag:
|
||||
{
|
||||
int index;
|
||||
token3 >> index;
|
||||
if (index < 0 || index >= 16)
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
if (check_float(linetoken4))
|
||||
token4 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
cgear[index] = token_value;
|
||||
gear_model[index] = true;
|
||||
break;
|
||||
}
|
||||
case kgear_flag:
|
||||
{
|
||||
int index;
|
||||
token3 >> index;
|
||||
if (index < 0 || index >= 16)
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
if (check_float(linetoken4))
|
||||
token4 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
kgear[index] = token_value;
|
||||
gear_model[index] = true;
|
||||
break;
|
||||
}
|
||||
case muGear_flag:
|
||||
{
|
||||
int index;
|
||||
token3 >> index;
|
||||
if (index < 0 || index >= 16)
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
if (check_float(linetoken4))
|
||||
token4 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
muGear[index] = token_value;
|
||||
gear_model[index] = true;
|
||||
break;
|
||||
}
|
||||
case strutLength_flag:
|
||||
{
|
||||
int index;
|
||||
token3 >> index;
|
||||
if (index < 0 || index >= 16)
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
if (check_float(linetoken4))
|
||||
token4 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
strutLength[index] = token_value;
|
||||
gear_model[index] = true;
|
||||
break;
|
||||
}
|
||||
case gear_max_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
use_gear = true;
|
||||
gear_max = token_value;
|
||||
break;
|
||||
}
|
||||
case gear_rate_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
use_gear = true;
|
||||
gear_rate = token_value/3;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
if (ignore_unknown_keywords) {
|
||||
// do nothing
|
||||
} else {
|
||||
// print error message
|
||||
uiuc_warnings_errors(2, *command_line);
|
||||
}
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
21
src/FDM/UIUCModel/uiuc_menu_gear.h
Normal file
21
src/FDM/UIUCModel/uiuc_menu_gear.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
|
||||
#ifndef _MENU_GEAR_H_
|
||||
#define _MENU_GEAR_H_
|
||||
|
||||
#include "uiuc_aircraft.h"
|
||||
#include "uiuc_convert.h"
|
||||
#include "uiuc_1DdataFileReader.h"
|
||||
#include "uiuc_2DdataFileReader.h"
|
||||
#include "uiuc_menu_functions.h"
|
||||
#include <FDM/LaRCsim/ls_generic.h>
|
||||
#include <FDM/LaRCsim/ls_cockpit.h> /* Long_trim defined */
|
||||
#include <FDM/LaRCsim/ls_constants.h> /* INVG defined */
|
||||
|
||||
void parse_gear( const string& linetoken2, const string& linetoken3,
|
||||
const string& linetoken4, const string& linetoken5,
|
||||
const string& linetoken6, const string& linetoken7,
|
||||
const string& linetoken8, const string& linetoken9,
|
||||
const string& linetoken10, const string& aircraft_directory,
|
||||
LIST command_line );
|
||||
|
||||
#endif //_MENU_GEAR_H_
|
199
src/FDM/UIUCModel/uiuc_menu_geometry.cpp
Normal file
199
src/FDM/UIUCModel/uiuc_menu_geometry.cpp
Normal file
|
@ -0,0 +1,199 @@
|
|||
/**********************************************************************
|
||||
|
||||
FILENAME: uiuc_menu_geometry.cpp
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
DESCRIPTION: reads input data for specified aircraft and creates
|
||||
approporiate data storage space
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
STATUS: alpha version
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
REFERENCES: based on "menu reader" format of Michael Selig
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
HISTORY: 04/04/2003 initial release
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
AUTHOR(S): Robert Deters <rdeters@uiuc.edu>
|
||||
Michael Selig <m-selig@uiuc.edu>
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
VARIABLES:
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
INPUTS: n/a
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
OUTPUTS: n/a
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
CALLED BY: uiuc_menu()
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
CALLS TO: check_float() if needed
|
||||
d_2_to_3() if needed
|
||||
d_1_to_2() if needed
|
||||
i_1_to_2() if needed
|
||||
d_1_to_1() if needed
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
COPYRIGHT: (C) 2003 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 <simgear/compiler.h>
|
||||
|
||||
#if defined( __MWERKS__ )
|
||||
// -dw- optimizer chokes (big-time) trying to optimize humongous
|
||||
// loop/switch statements
|
||||
#pragma optimization_level 0
|
||||
#endif
|
||||
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include STL_IOSTREAM
|
||||
|
||||
#include "uiuc_menu_geometry.h"
|
||||
|
||||
SG_USING_STD(cerr);
|
||||
SG_USING_STD(cout);
|
||||
SG_USING_STD(endl);
|
||||
|
||||
#ifndef _MSC_VER
|
||||
SG_USING_STD(exit);
|
||||
#endif
|
||||
|
||||
void parse_geometry( const string& linetoken2, const string& linetoken3,
|
||||
const string& linetoken4, const string& linetoken5,
|
||||
const string& linetoken6, const string& linetoken7,
|
||||
const string& linetoken8, const string& linetoken9,
|
||||
const string& linetoken10,
|
||||
const string& aircraft_directory, LIST command_line ) {
|
||||
double token_value;
|
||||
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());
|
||||
istrstream token10(linetoken10.c_str());
|
||||
|
||||
switch(geometry_map[linetoken2])
|
||||
{
|
||||
case bw_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
bw = token_value;
|
||||
geometryParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case cbar_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
cbar = token_value;
|
||||
geometryParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Sw_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Sw = token_value;
|
||||
geometryParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case ih_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
ih = token_value;
|
||||
geometryParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case bh_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
bh = token_value;
|
||||
geometryParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case ch_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
ch = token_value;
|
||||
geometryParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Sh_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Sh = token_value;
|
||||
geometryParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
if (ignore_unknown_keywords) {
|
||||
// do nothing
|
||||
} else {
|
||||
// print error message
|
||||
uiuc_warnings_errors(2, *command_line);
|
||||
}
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
21
src/FDM/UIUCModel/uiuc_menu_geometry.h
Normal file
21
src/FDM/UIUCModel/uiuc_menu_geometry.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
|
||||
#ifndef _MENU_GEOMETRY_H_
|
||||
#define _MENU_GEOMETRY_H_
|
||||
|
||||
#include "uiuc_aircraft.h"
|
||||
#include "uiuc_convert.h"
|
||||
#include "uiuc_1DdataFileReader.h"
|
||||
#include "uiuc_2DdataFileReader.h"
|
||||
#include "uiuc_menu_functions.h"
|
||||
#include <FDM/LaRCsim/ls_generic.h>
|
||||
#include <FDM/LaRCsim/ls_cockpit.h> /* Long_trim defined */
|
||||
#include <FDM/LaRCsim/ls_constants.h> /* INVG defined */
|
||||
|
||||
void parse_geometry( const string& linetoken2, const string& linetoken3,
|
||||
const string& linetoken4, const string& linetoken5,
|
||||
const string& linetoken6, const string& linetoken7,
|
||||
const string& linetoken8, const string& linetoken9,
|
||||
const string& linetoken10,
|
||||
const string& aircraft_directory, LIST command_line );
|
||||
|
||||
#endif //_MENU_GEOMETRY_H_
|
1267
src/FDM/UIUCModel/uiuc_menu_ice.cpp
Normal file
1267
src/FDM/UIUCModel/uiuc_menu_ice.cpp
Normal file
File diff suppressed because it is too large
Load diff
21
src/FDM/UIUCModel/uiuc_menu_ice.h
Normal file
21
src/FDM/UIUCModel/uiuc_menu_ice.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
|
||||
#ifndef _MENU_ICE_H_
|
||||
#define _MENU_ICE_H_
|
||||
|
||||
#include "uiuc_aircraft.h"
|
||||
#include "uiuc_convert.h"
|
||||
#include "uiuc_1DdataFileReader.h"
|
||||
#include "uiuc_2DdataFileReader.h"
|
||||
#include "uiuc_menu_functions.h"
|
||||
#include <FDM/LaRCsim/ls_generic.h>
|
||||
#include <FDM/LaRCsim/ls_cockpit.h> /* Long_trim defined */
|
||||
#include <FDM/LaRCsim/ls_constants.h> /* INVG defined */
|
||||
|
||||
void parse_ice( const string& linetoken2, const string& linetoken3,
|
||||
const string& linetoken4, const string& linetoken5,
|
||||
const string& linetoken6, const string& linetoken7,
|
||||
const string& linetoken8, const string& linetoken9,
|
||||
const string& linetoken10, const string& aircraft_directory,
|
||||
LIST command_line );
|
||||
|
||||
#endif //_MENU_ICE_H_
|
500
src/FDM/UIUCModel/uiuc_menu_init.cpp
Normal file
500
src/FDM/UIUCModel/uiuc_menu_init.cpp
Normal file
|
@ -0,0 +1,500 @@
|
|||
/**********************************************************************
|
||||
|
||||
FILENAME: uiuc_menu_init.cpp
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
DESCRIPTION: reads input data for specified aircraft and creates
|
||||
approporiate data storage space
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
STATUS: alpha version
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
REFERENCES: based on "menu reader" format of Michael Selig
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
HISTORY: 04/04/2003 initial release
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
AUTHOR(S): Robert Deters <rdeters@uiuc.edu>
|
||||
Michael Selig <m-selig@uiuc.edu>
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
VARIABLES:
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
INPUTS: n/a
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
OUTPUTS: n/a
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
CALLED BY: uiuc_menu()
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
CALLS TO: check_float() if needed
|
||||
d_2_to_3() if needed
|
||||
d_1_to_2() if needed
|
||||
i_1_to_2() if needed
|
||||
d_1_to_1() if needed
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
COPYRIGHT: (C) 2003 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 <simgear/compiler.h>
|
||||
|
||||
#if defined( __MWERKS__ )
|
||||
// -dw- optimizer chokes (big-time) trying to optimize humongous
|
||||
// loop/switch statements
|
||||
#pragma optimization_level 0
|
||||
#endif
|
||||
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include STL_IOSTREAM
|
||||
|
||||
#include "uiuc_menu_init.h"
|
||||
|
||||
SG_USING_STD(cerr);
|
||||
SG_USING_STD(cout);
|
||||
SG_USING_STD(endl);
|
||||
|
||||
#ifndef _MSC_VER
|
||||
SG_USING_STD(exit);
|
||||
#endif
|
||||
|
||||
void parse_init( const string& linetoken2, const string& linetoken3,
|
||||
const string& linetoken4, const string& linetoken5,
|
||||
const string& linetoken6, const string& linetoken7,
|
||||
const string& linetoken8, const string& linetoken9,
|
||||
const string& linetoken10, const string& aircraft_directory,
|
||||
LIST command_line ) {
|
||||
double token_value;
|
||||
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());
|
||||
istrstream token10(linetoken10.c_str());
|
||||
int token_value_recordRate;
|
||||
|
||||
switch(init_map[linetoken2])
|
||||
{
|
||||
case Dx_pilot_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Dx_pilot = token_value;
|
||||
initParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Dy_pilot_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Dy_pilot = token_value;
|
||||
initParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Dz_pilot_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Dz_pilot = token_value;
|
||||
initParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Dx_cg_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Dx_cg = token_value;
|
||||
initParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Dy_cg_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Dy_cg = token_value;
|
||||
initParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Dz_cg_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Dz_cg = token_value;
|
||||
initParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Altitude_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Altitude = token_value;
|
||||
initParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case V_north_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
V_north = token_value;
|
||||
initParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case V_east_flag:
|
||||
{
|
||||
initParts -> storeCommands (*command_line);
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
V_east = token_value;
|
||||
break;
|
||||
}
|
||||
case V_down_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
V_down = token_value;
|
||||
initParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case P_body_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
P_body_init_true = true;
|
||||
P_body_init = token_value;
|
||||
initParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Q_body_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Q_body_init_true = true;
|
||||
Q_body_init = token_value;
|
||||
initParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case R_body_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
R_body_init_true = true;
|
||||
R_body_init = token_value;
|
||||
initParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Phi_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Phi_init_true = true;
|
||||
Phi_init = token_value;
|
||||
initParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Theta_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Theta_init_true = true;
|
||||
Theta_init = token_value;
|
||||
initParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Psi_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Psi_init_true = true;
|
||||
Psi_init = token_value;
|
||||
initParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Long_trim_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Long_trim = token_value;
|
||||
initParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case recordRate_flag:
|
||||
{
|
||||
//can't use check_float since variable is integer
|
||||
token3 >> token_value_recordRate;
|
||||
recordRate = 120 / token_value_recordRate;
|
||||
break;
|
||||
}
|
||||
case recordStartTime_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
recordStartTime = token_value;
|
||||
break;
|
||||
}
|
||||
case use_V_rel_wind_2U_flag:
|
||||
{
|
||||
use_V_rel_wind_2U = true;
|
||||
break;
|
||||
}
|
||||
case nondim_rate_V_rel_wind_flag:
|
||||
{
|
||||
nondim_rate_V_rel_wind = true;
|
||||
break;
|
||||
}
|
||||
case use_abs_U_body_2U_flag:
|
||||
{
|
||||
use_abs_U_body_2U = true;
|
||||
break;
|
||||
}
|
||||
case dyn_on_speed_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
dyn_on_speed = token_value;
|
||||
break;
|
||||
}
|
||||
case dyn_on_speed_zero_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
dyn_on_speed_zero = token_value;
|
||||
break;
|
||||
}
|
||||
case use_dyn_on_speed_curve1_flag:
|
||||
{
|
||||
use_dyn_on_speed_curve1 = true;
|
||||
break;
|
||||
}
|
||||
case use_Alpha_dot_on_speed_flag:
|
||||
{
|
||||
use_Alpha_dot_on_speed = true;
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
Alpha_dot_on_speed = token_value;
|
||||
break;
|
||||
}
|
||||
case use_gamma_horiz_on_speed_flag:
|
||||
{
|
||||
use_gamma_horiz_on_speed = true;
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
gamma_horiz_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))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Alpha_init_true = true;
|
||||
Alpha_init = token_value;
|
||||
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;
|
||||
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;
|
||||
}
|
||||
case ignore_unknown_keywords_flag:
|
||||
{
|
||||
ignore_unknown_keywords=true;
|
||||
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 (ignore_unknown_keywords){
|
||||
// do nothing
|
||||
} else {
|
||||
// print error message
|
||||
uiuc_warnings_errors(2, *command_line);
|
||||
}
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
21
src/FDM/UIUCModel/uiuc_menu_init.h
Normal file
21
src/FDM/UIUCModel/uiuc_menu_init.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
|
||||
#ifndef _MENU_INIT_H_
|
||||
#define _MENU_INIT_H_
|
||||
|
||||
#include "uiuc_aircraft.h"
|
||||
#include "uiuc_convert.h"
|
||||
#include "uiuc_1DdataFileReader.h"
|
||||
#include "uiuc_2DdataFileReader.h"
|
||||
#include "uiuc_menu_functions.h"
|
||||
#include <FDM/LaRCsim/ls_generic.h>
|
||||
#include <FDM/LaRCsim/ls_cockpit.h> /* Long_trim defined */
|
||||
#include <FDM/LaRCsim/ls_constants.h> /* INVG defined */
|
||||
|
||||
void parse_init( const string& linetoken2, const string& linetoken3,
|
||||
const string& linetoken4, const string& linetoken5,
|
||||
const string& linetoken6, const string& linetoken7,
|
||||
const string& linetoken8, const string& linetoken9,
|
||||
const string& linetoken10, const string& aircraft_directory,
|
||||
LIST command_line );
|
||||
|
||||
#endif //_MENU_INIT_H_
|
277
src/FDM/UIUCModel/uiuc_menu_mass.cpp
Normal file
277
src/FDM/UIUCModel/uiuc_menu_mass.cpp
Normal file
|
@ -0,0 +1,277 @@
|
|||
/**********************************************************************
|
||||
|
||||
FILENAME: uiuc_menu_mass.cpp
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
DESCRIPTION: reads input data for specified aircraft and creates
|
||||
approporiate data storage space
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
STATUS: alpha version
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
REFERENCES: based on "menu reader" format of Michael Selig
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
HISTORY: 04/04/2003 initial release
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
AUTHOR(S): Robert Deters <rdeters@uiuc.edu>
|
||||
Michael Selig <m-selig@uiuc.edu>
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
VARIABLES:
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
INPUTS: n/a
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
OUTPUTS: n/a
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
CALLED BY: uiuc_menu()
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
CALLS TO: check_float() if needed
|
||||
d_2_to_3() if needed
|
||||
d_1_to_2() if needed
|
||||
i_1_to_2() if needed
|
||||
d_1_to_1() if needed
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
COPYRIGHT: (C) 2003 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 <simgear/compiler.h>
|
||||
|
||||
#if defined( __MWERKS__ )
|
||||
// -dw- optimizer chokes (big-time) trying to optimize humongous
|
||||
// loop/switch statements
|
||||
#pragma optimization_level 0
|
||||
#endif
|
||||
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include STL_IOSTREAM
|
||||
|
||||
#include "uiuc_menu_mass.h"
|
||||
|
||||
SG_USING_STD(cerr);
|
||||
SG_USING_STD(cout);
|
||||
SG_USING_STD(endl);
|
||||
|
||||
#ifndef _MSC_VER
|
||||
SG_USING_STD(exit);
|
||||
#endif
|
||||
|
||||
void parse_mass( const string& linetoken2, const string& linetoken3,
|
||||
const string& linetoken4, const string& linetoken5,
|
||||
const string& linetoken6, const string& linetoken7,
|
||||
const string& linetoken8, const string& linetoken9,
|
||||
const string& linetoken10, const string& aircraft_directory,
|
||||
LIST command_line ) {
|
||||
double token_value;
|
||||
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());
|
||||
istrstream token10(linetoken10.c_str());
|
||||
|
||||
switch(mass_map[linetoken2])
|
||||
{
|
||||
case Weight_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Weight = token_value;
|
||||
Mass = Weight * INVG;
|
||||
massParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Mass_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Mass = token_value;
|
||||
massParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case I_xx_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
I_xx = token_value;
|
||||
massParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case I_yy_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
I_yy = token_value;
|
||||
massParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case I_zz_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
I_zz = token_value;
|
||||
massParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case I_xz_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
I_xz = token_value;
|
||||
massParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Mass_appMass_ratio_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Mass_appMass_ratio = token_value;
|
||||
massParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case I_xx_appMass_ratio_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
I_xx_appMass_ratio = token_value;
|
||||
massParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case I_yy_appMass_ratio_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
I_yy_appMass_ratio = token_value;
|
||||
massParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case I_zz_appMass_ratio_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
I_zz_appMass_ratio = token_value;
|
||||
massParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case Mass_appMass_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
Mass_appMass = token_value;
|
||||
massParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case I_xx_appMass_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
I_xx_appMass = token_value;
|
||||
massParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case I_yy_appMass_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
I_yy_appMass = token_value;
|
||||
massParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
case I_zz_appMass_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
I_zz_appMass = token_value;
|
||||
massParts -> storeCommands (*command_line);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
if (ignore_unknown_keywords) {
|
||||
// do nothing
|
||||
} else {
|
||||
// print error message
|
||||
uiuc_warnings_errors(2, *command_line);
|
||||
}
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
21
src/FDM/UIUCModel/uiuc_menu_mass.h
Normal file
21
src/FDM/UIUCModel/uiuc_menu_mass.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
|
||||
#ifndef _MENU_MASS_H_
|
||||
#define _MENU_MASS_H_
|
||||
|
||||
#include "uiuc_aircraft.h"
|
||||
#include "uiuc_convert.h"
|
||||
#include "uiuc_1DdataFileReader.h"
|
||||
#include "uiuc_2DdataFileReader.h"
|
||||
#include "uiuc_menu_functions.h"
|
||||
#include <FDM/LaRCsim/ls_generic.h>
|
||||
#include <FDM/LaRCsim/ls_cockpit.h> /* Long_trim defined */
|
||||
#include <FDM/LaRCsim/ls_constants.h> /* INVG defined */
|
||||
|
||||
void parse_mass( const string& linetoken2, const string& linetoken3,
|
||||
const string& linetoken4, const string& linetoken5,
|
||||
const string& linetoken6, const string& linetoken7,
|
||||
const string& linetoken8, const string& linetoken9,
|
||||
const string& linetoken10,const string& aircraft_directory,
|
||||
LIST command_line );
|
||||
|
||||
#endif //_MENU_MASS_H_
|
164
src/FDM/UIUCModel/uiuc_menu_misc.cpp
Normal file
164
src/FDM/UIUCModel/uiuc_menu_misc.cpp
Normal file
|
@ -0,0 +1,164 @@
|
|||
/**********************************************************************
|
||||
|
||||
FILENAME: uiuc_menu_misc.cpp
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
DESCRIPTION: reads input data for specified aircraft and creates
|
||||
approporiate data storage space
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
STATUS: alpha version
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
REFERENCES: based on "menu reader" format of Michael Selig
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
HISTORY: 04/04/2003 initial release
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
AUTHOR(S): Robert Deters <rdeters@uiuc.edu>
|
||||
Michael Selig <m-selig@uiuc.edu>
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
VARIABLES:
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
INPUTS: n/a
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
OUTPUTS: n/a
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
CALLED BY: uiuc_menu()
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
CALLS TO: check_float() if needed
|
||||
d_2_to_3() if needed
|
||||
d_1_to_2() if needed
|
||||
i_1_to_2() if needed
|
||||
d_1_to_1() if needed
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
COPYRIGHT: (C) 2003 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 <simgear/compiler.h>
|
||||
|
||||
#if defined( __MWERKS__ )
|
||||
// -dw- optimizer chokes (big-time) trying to optimize humongous
|
||||
// loop/switch statements
|
||||
#pragma optimization_level 0
|
||||
#endif
|
||||
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include STL_IOSTREAM
|
||||
|
||||
#include "uiuc_menu_misc.h"
|
||||
|
||||
SG_USING_STD(cerr);
|
||||
SG_USING_STD(cout);
|
||||
SG_USING_STD(endl);
|
||||
|
||||
#ifndef _MSC_VER
|
||||
SG_USING_STD(exit);
|
||||
#endif
|
||||
|
||||
void parse_misc( const string& linetoken2, const string& linetoken3,
|
||||
const string& linetoken4, const string& linetoken5,
|
||||
const string& linetoken6, const string& linetoken7,
|
||||
const string& linetoken8, const string& linetoken9,
|
||||
const string& linetoken10, const string& aircraft_directory,
|
||||
LIST command_line ) {
|
||||
double token_value;
|
||||
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());
|
||||
istrstream token10(linetoken10.c_str());
|
||||
|
||||
switch(misc_map[linetoken2])
|
||||
{
|
||||
case simpleHingeMomentCoef_flag:
|
||||
{
|
||||
if (check_float(linetoken3))
|
||||
token3 >> token_value;
|
||||
else
|
||||
uiuc_warnings_errors(1, *command_line);
|
||||
|
||||
simpleHingeMomentCoef = token_value;
|
||||
break;
|
||||
}
|
||||
case dfTimefdf_flag:
|
||||
{
|
||||
dfTimefdf = linetoken3;
|
||||
/* call 1D File Reader with file name (dfTimefdf);
|
||||
function returns array of dfs (dfArray) and
|
||||
corresponding time values (TimeArray) and max
|
||||
number of terms in arrays (ndf) */
|
||||
uiuc_1DdataFileReader(dfTimefdf,
|
||||
dfTimefdf_dfArray,
|
||||
dfTimefdf_TimeArray,
|
||||
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;
|
||||
}
|
||||
default:
|
||||
{
|
||||
if (ignore_unknown_keywords) {
|
||||
// do nothing
|
||||
} else {
|
||||
// print error message
|
||||
uiuc_warnings_errors(2, *command_line);
|
||||
}
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
22
src/FDM/UIUCModel/uiuc_menu_misc.h
Normal file
22
src/FDM/UIUCModel/uiuc_menu_misc.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
|
||||
#ifndef _MENU_MISC_H_
|
||||
#define _MENU_MISC_H_
|
||||
|
||||
#include "uiuc_aircraft.h"
|
||||
#include "uiuc_convert.h"
|
||||
#include "uiuc_1DdataFileReader.h"
|
||||
#include "uiuc_2DdataFileReader.h"
|
||||
#include "uiuc_menu_functions.h"
|
||||
#include <FDM/LaRCsim/ls_generic.h>
|
||||
#include <FDM/LaRCsim/ls_cockpit.h> /* Long_trim defined */
|
||||
#include <FDM/LaRCsim/ls_constants.h> /* INVG defined */
|
||||
#include "uiuc_flapdata.h"
|
||||
|
||||
void parse_misc( const string& linetoken2, const string& linetoken3,
|
||||
const string& linetoken4, const string& linetoken5,
|
||||
const string& linetoken6, const string& linetoken7,
|
||||
const string& linetoken8, const string& linetoken9,
|
||||
const string& linetoken10, const string& aircraft_directory,
|
||||
LIST command_line );
|
||||
|
||||
#endif //_MENU_MISC_H_
|
2230
src/FDM/UIUCModel/uiuc_menu_record.cpp
Normal file
2230
src/FDM/UIUCModel/uiuc_menu_record.cpp
Normal file
File diff suppressed because it is too large
Load diff
21
src/FDM/UIUCModel/uiuc_menu_record.h
Normal file
21
src/FDM/UIUCModel/uiuc_menu_record.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
|
||||
#ifndef _MENU_RECORD_H_
|
||||
#define _MENU_RECORD_H_
|
||||
|
||||
#include "uiuc_aircraft.h"
|
||||
#include "uiuc_convert.h"
|
||||
#include "uiuc_1DdataFileReader.h"
|
||||
#include "uiuc_2DdataFileReader.h"
|
||||
#include "uiuc_menu_functions.h"
|
||||
#include <FDM/LaRCsim/ls_generic.h>
|
||||
#include <FDM/LaRCsim/ls_cockpit.h> /* Long_trim defined */
|
||||
#include <FDM/LaRCsim/ls_constants.h> /* INVG defined */
|
||||
|
||||
void parse_record( const string& linetoken2, const string& linetoken3,
|
||||
const string& linetoken4, const string& linetoken5,
|
||||
const string& linetoken6, const string& linetoken7,
|
||||
const string& linetoken8, const string& linetoken9,
|
||||
const string& linetoken10, const string& aircraft_directory,
|
||||
LIST command_line );
|
||||
|
||||
#endif //_MENU_RECORD_H_
|
|
@ -45,18 +45,16 @@
|
|||
#include "uiuc_pah_ap.h"
|
||||
|
||||
double pah_ap(double pitch, double pitchrate, double pitch_ref, double V,
|
||||
double sample_t)
|
||||
double sample_t, int init)
|
||||
{
|
||||
// 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)
|
||||
if (init == 0)
|
||||
{
|
||||
init = -1;
|
||||
u2prev = 0;
|
||||
x1prev = 0;
|
||||
x2prev = 0;
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
#define _PAH_AP_H_
|
||||
|
||||
double pah_ap(double pitch, double pitchrate, double pitch_ref, double V,
|
||||
double sample_t);
|
||||
double sample_t, int init);
|
||||
|
||||
#endif //_PAH_AP_H_
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
----------------------------------------------------------------------
|
||||
|
||||
HISTORY: 01/30/2000 (BS) initial release
|
||||
09/19/2002 (MSS) appended zeros to lines w/ comments
|
||||
09/19/2002 (MSS) appended zeros to lines w/ comments
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
|
@ -109,7 +109,7 @@ string ParseFile :: getToken(string inputLine, int tokenNo)
|
|||
|
||||
while (tokencounter < tokenNo)
|
||||
{
|
||||
if ((pos1 == inputLine.npos) || (pos1 == -1) || (pos == -1) )
|
||||
if ((pos1 == inputLine.npos) || (pos1 == -1) || (pos == -1) )
|
||||
return ""; //return an empty string if tokenNo exceeds the No of tokens in the line
|
||||
|
||||
inputLine = inputLine.substr(pos1 , MAXLINE);
|
||||
|
@ -119,7 +119,7 @@ string ParseFile :: getToken(string inputLine, int tokenNo)
|
|||
}
|
||||
|
||||
if (pos1== -1 || pos == -1)
|
||||
return "";
|
||||
return "";
|
||||
else
|
||||
return inputLine.substr(pos , pos1-pos); // return the desired token
|
||||
}
|
||||
|
|
|
@ -33,15 +33,17 @@
|
|||
11/12/2001 (RD) Added new variables needed for the non-
|
||||
linear Twin Otter model at zero flaps
|
||||
(CxfxxfI). Removed zero flap variables.
|
||||
Added flap_pos and flap_goal.
|
||||
Added flap_pos and flap_cmd_deg.
|
||||
02/13/2002 (RD) Added variables so linear aero model
|
||||
values can be recorded
|
||||
03/03/2003 (RD) Added flap_cmd_record
|
||||
03/16/2003 (RD) Added trigger record variables
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
AUTHOR(S): Jeff Scott <jscott@mail.com>
|
||||
AUTHOR(S): Jeff Scott http://www.jeffscott.net/
|
||||
Robert Deters <rdeters@uiuc.edu>
|
||||
|
||||
Michael Selig <m-selig@uiuc.edu>
|
||||
----------------------------------------------------------------------
|
||||
|
||||
VARIABLES:
|
||||
|
@ -82,6 +84,11 @@
|
|||
|
||||
**********************************************************************/
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
#include <simgear/misc/sg_path.hxx>
|
||||
#include <Aircraft/aircraft.hxx>
|
||||
#include <Main/fg_props.hxx>
|
||||
|
||||
#include "uiuc_recorder.h"
|
||||
|
||||
SG_USING_STD(endl); // -dw
|
||||
|
@ -777,7 +784,7 @@ void uiuc_recorder( double dt )
|
|||
break;
|
||||
}
|
||||
|
||||
/******************** Control Inputs *******************/
|
||||
/************************ Controls ***********************/
|
||||
case Long_control_record:
|
||||
{
|
||||
fout << Long_control << " ";
|
||||
|
@ -843,14 +850,14 @@ void uiuc_recorder( double dt )
|
|||
fout << flap << " ";
|
||||
break;
|
||||
}
|
||||
case flap_deg_record:
|
||||
case flap_cmd_record:
|
||||
{
|
||||
fout << flap * RAD_TO_DEG << " ";
|
||||
fout << flap_cmd << " ";
|
||||
break;
|
||||
}
|
||||
case flap_goal_record:
|
||||
case flap_cmd_deg_record:
|
||||
{
|
||||
fout << flap_goal << " ";
|
||||
fout << flap_cmd * RAD_TO_DEG << " ";
|
||||
break;
|
||||
}
|
||||
case flap_pos_record:
|
||||
|
@ -858,6 +865,36 @@ void uiuc_recorder( double dt )
|
|||
fout << flap_pos << " ";
|
||||
break;
|
||||
}
|
||||
case flap_pos_deg_record:
|
||||
{
|
||||
fout << flap_pos * RAD_TO_DEG << " ";
|
||||
break;
|
||||
}
|
||||
case Spoiler_handle_record:
|
||||
{
|
||||
fout << Spoiler_handle << " ";
|
||||
break;
|
||||
}
|
||||
case spoiler_cmd_deg_record:
|
||||
{
|
||||
fout << spoiler_cmd_deg << " ";
|
||||
break;
|
||||
}
|
||||
case spoiler_pos_deg_record:
|
||||
{
|
||||
fout << spoiler_pos_deg << " ";
|
||||
break;
|
||||
}
|
||||
case spoiler_pos_norm_record:
|
||||
{
|
||||
fout << spoiler_pos_norm << " ";
|
||||
break;
|
||||
}
|
||||
case spoiler_pos_record:
|
||||
{
|
||||
fout << spoiler_pos << " ";
|
||||
break;
|
||||
}
|
||||
|
||||
/****************** Aero Coefficients ******************/
|
||||
case CD_record:
|
||||
|
@ -920,6 +957,11 @@ void uiuc_recorder( double dt )
|
|||
fout << CDK_save << " ";
|
||||
break;
|
||||
}
|
||||
case CLK_save_record:
|
||||
{
|
||||
fout << CLK_save << " ";
|
||||
break;
|
||||
}
|
||||
case CD_a_save_record:
|
||||
{
|
||||
fout << CD_a_save << " ";
|
||||
|
@ -945,6 +987,36 @@ void uiuc_recorder( double dt )
|
|||
fout << CD_de_save << " ";
|
||||
break;
|
||||
}
|
||||
case CD_dr_save_record:
|
||||
{
|
||||
fout << CD_dr_save << " ";
|
||||
break;
|
||||
}
|
||||
case CD_da_save_record:
|
||||
{
|
||||
fout << CD_da_save << " ";
|
||||
break;
|
||||
}
|
||||
case CD_beta_save_record:
|
||||
{
|
||||
fout << CD_beta_save << " ";
|
||||
break;
|
||||
}
|
||||
case CD_df_save_record:
|
||||
{
|
||||
fout << CD_df_save << " ";
|
||||
break;
|
||||
}
|
||||
case CD_ds_save_record:
|
||||
{
|
||||
fout << CD_ds_save << " ";
|
||||
break;
|
||||
}
|
||||
case CD_dg_save_record:
|
||||
{
|
||||
fout << CD_dg_save << " ";
|
||||
break;
|
||||
}
|
||||
case CXo_save_record:
|
||||
{
|
||||
fout << CXo_save << " ";
|
||||
|
@ -1080,6 +1152,21 @@ void uiuc_recorder( double dt )
|
|||
fout << CL_de_save << " ";
|
||||
break;
|
||||
}
|
||||
case CL_df_save_record:
|
||||
{
|
||||
fout << CL_df_save << " ";
|
||||
break;
|
||||
}
|
||||
case CL_ds_save_record:
|
||||
{
|
||||
fout << CL_ds_save << " ";
|
||||
break;
|
||||
}
|
||||
case CL_dg_save_record:
|
||||
{
|
||||
fout << CL_dg_save << " ";
|
||||
break;
|
||||
}
|
||||
case CZo_save_record:
|
||||
{
|
||||
fout << CZo_save << " ";
|
||||
|
@ -1220,6 +1307,16 @@ void uiuc_recorder( double dt )
|
|||
fout << Cm_df_save << " ";
|
||||
break;
|
||||
}
|
||||
case Cm_ds_save_record:
|
||||
{
|
||||
fout << Cm_ds_save << " ";
|
||||
break;
|
||||
}
|
||||
case Cm_dg_save_record:
|
||||
{
|
||||
fout << Cm_dg_save << " ";
|
||||
break;
|
||||
}
|
||||
case CY_record:
|
||||
{
|
||||
fout << CY << " ";
|
||||
|
@ -1969,43 +2066,43 @@ void uiuc_recorder( double dt )
|
|||
break;
|
||||
}
|
||||
|
||||
/*********************** Moments ***********************/
|
||||
//case flapper_freq_record:
|
||||
// {
|
||||
//fout << flapper_freq << " ";
|
||||
//break;
|
||||
// }
|
||||
//case flapper_phi_record:
|
||||
// {
|
||||
//fout << flapper_phi << " ";
|
||||
//break;
|
||||
// }
|
||||
//case flapper_phi_deg_record:
|
||||
// {
|
||||
//fout << flapper_phi*RAD_TO_DEG << " ";
|
||||
//break;
|
||||
// }
|
||||
//case flapper_Lift_record:
|
||||
// {
|
||||
//fout << flapper_Lift << " ";
|
||||
//break;
|
||||
// }
|
||||
//case flapper_Thrust_record:
|
||||
// {
|
||||
//fout << flapper_Thrust << " ";
|
||||
//break;
|
||||
// }
|
||||
//case flapper_Inertia_record:
|
||||
// {
|
||||
//fout << flapper_Inertia << " ";
|
||||
//break;
|
||||
// }
|
||||
//case flapper_Moment_record:
|
||||
// {
|
||||
//fout << flapper_Moment << " ";
|
||||
//break;
|
||||
// }
|
||||
/*********************** debug ***********************/
|
||||
/********************* flapper variables *********************/
|
||||
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;
|
||||
}
|
||||
/********* MSS debug and other data *******************/
|
||||
/* debug variables for use in probing data */
|
||||
/* comment out old lines, and add new */
|
||||
/* only remove code that you have written */
|
||||
|
@ -2016,30 +2113,34 @@ void uiuc_recorder( double dt )
|
|||
// fout << eta_q_Cm_adot_fac << " ";
|
||||
// fout << eta_q_Cmfade_fac << " ";
|
||||
// fout << eta_q_Cl_dr_fac << " ";
|
||||
// fout << eta_q_Cm_de_fac << " ";
|
||||
// eta on tail
|
||||
// fout << tc << " ";
|
||||
// fout << eta_q << " ";
|
||||
// engine RPM
|
||||
// fout << engineOmega * 60 / (2 * LS_PI)<< " ";
|
||||
// vertical climb rate in fpm
|
||||
// fout << V_down * 60 << " ";
|
||||
fout << V_down * 60 << " ";
|
||||
// vertical climb rate in fps
|
||||
// fout << V_down << " ";
|
||||
// w_induced downwash at tail due to wing
|
||||
//fout << w_induced << " ";
|
||||
// w_induced downwash at tail due to wing
|
||||
fout << gammaWing << " ";
|
||||
// fout << gammaWing << " ";
|
||||
//fout << outside_control << " ";
|
||||
break;
|
||||
}
|
||||
case debug2_record:
|
||||
{
|
||||
//Lift to drag ratio
|
||||
// fout << V_north/V_down << " ";
|
||||
// Lift to drag ratio
|
||||
// fout << V_ground_speed/V_down_rel_ground << " ";
|
||||
// g's through the c.g. of the aircraft
|
||||
// fout << (-A_Z_cg/32.174) << " ";
|
||||
fout << (-A_Z_cg/32.174) << " ";
|
||||
// L/D via forces (used in 201 class for L/D)
|
||||
// fout << (F_Z_wind/F_X_wind) << " ";
|
||||
// gyroscopic moment (see uiuc_wrapper.cpp)
|
||||
// fout << (polarInertia * engineOmega * Q_body) << " ";
|
||||
// downwashAngle at tail
|
||||
fout << downwashAngle * 57.29 << " ";
|
||||
// fout << downwashAngle * 57.29 << " ";
|
||||
// w_induced from engine
|
||||
// fout << w_i << " ";
|
||||
// fout << w_induced << " ";
|
||||
break;
|
||||
}
|
||||
case debug3_record:
|
||||
|
@ -2048,15 +2149,143 @@ void uiuc_recorder( double dt )
|
|||
// fout << (Cos_alpha * Cos_alpha) << " ";
|
||||
// gyroscopic moment (see uiuc_wrapper.cpp)
|
||||
// fout << (-polarInertia * engineOmega * R_body) << " ";
|
||||
// AlphaTail
|
||||
// fout << AlphaTail * 57.29 << " ";
|
||||
// fout << Alpha * 57.29 << " ";
|
||||
// eta on tail
|
||||
// fout << eta_q << " ";
|
||||
// flapper cycle percentage
|
||||
fout << (sin(flapper_phi - 3 * LS_PI / 2)) << " ";
|
||||
break;
|
||||
}
|
||||
/********* RD debug and other data *******************/
|
||||
/* debug variables for use in probing data */
|
||||
/* comment out old lines, and add new */
|
||||
/* only remove code that you have written */
|
||||
case debug4_record:
|
||||
{
|
||||
// flapper F_X_aero_flapper
|
||||
fout << F_X_aero_flapper << " ";
|
||||
break;
|
||||
}
|
||||
case debug5_record:
|
||||
{
|
||||
// flapper F_Z_aero_flapper
|
||||
//fout << F_Z_aero_flapper << " ";
|
||||
// gear_rate
|
||||
fout << gear_rate << " ";
|
||||
break;
|
||||
}
|
||||
case debug6_record:
|
||||
{
|
||||
//gear_max
|
||||
fout << gear_max << " ";
|
||||
break;
|
||||
}
|
||||
case V_down_fpm_record:
|
||||
{
|
||||
fout << V_down * 60 << " ";
|
||||
break;
|
||||
}
|
||||
case eta_q_record:
|
||||
{
|
||||
fout << eta_q << " ";
|
||||
break;
|
||||
}
|
||||
|
||||
};
|
||||
case rpm_record:
|
||||
{
|
||||
fout << (engineOmega * 60 / (2 * LS_PI)) << " ";
|
||||
break;
|
||||
}
|
||||
case elevator_sas_deg_record:
|
||||
{
|
||||
fout << elevator_sas * RAD_TO_DEG << " ";
|
||||
break;
|
||||
}
|
||||
case aileron_sas_deg_record:
|
||||
{
|
||||
fout << aileron_sas * RAD_TO_DEG << " ";
|
||||
break;
|
||||
}
|
||||
case rudder_sas_deg_record:
|
||||
{
|
||||
fout << rudder_sas * RAD_TO_DEG << " ";
|
||||
break;
|
||||
}
|
||||
case w_induced_record:
|
||||
{
|
||||
fout << w_induced << " ";
|
||||
break;
|
||||
}
|
||||
case downwashAngle_deg_record:
|
||||
{
|
||||
fout << downwashAngle * RAD_TO_DEG << " ";
|
||||
break;
|
||||
}
|
||||
case alphaTail_deg_record:
|
||||
{
|
||||
fout << alphaTail * RAD_TO_DEG << " ";
|
||||
break;
|
||||
}
|
||||
case gammaWing_record:
|
||||
{
|
||||
fout << gammaWing << " ";
|
||||
break;
|
||||
}
|
||||
case LD_record:
|
||||
{
|
||||
fout << V_ground_speed/V_down_rel_ground << " ";
|
||||
break;
|
||||
}
|
||||
case gload_record:
|
||||
{
|
||||
fout << -A_Z_cg/32.174 << " ";
|
||||
break;
|
||||
}
|
||||
case gyroMomentQ_record:
|
||||
{
|
||||
fout << polarInertia * engineOmega * Q_body << " ";
|
||||
break;
|
||||
}
|
||||
case gyroMomentR_record:
|
||||
{
|
||||
fout << -polarInertia * engineOmega * R_body << " ";
|
||||
break;
|
||||
}
|
||||
case Gear_handle_record:
|
||||
{
|
||||
fout << Gear_handle << " ";
|
||||
break;
|
||||
}
|
||||
case gear_cmd_norm_record:
|
||||
{
|
||||
fout << gear_cmd_norm << " ";
|
||||
break;
|
||||
}
|
||||
case gear_pos_norm_record:
|
||||
{
|
||||
fout << gear_pos_norm << " ";
|
||||
break;
|
||||
}
|
||||
/****************Trigger Variables*******************/
|
||||
case trigger_on_record:
|
||||
{
|
||||
fout << trigger_on << " ";
|
||||
break;
|
||||
}
|
||||
case trigger_num_record:
|
||||
{
|
||||
fout << trigger_num << " ";
|
||||
break;
|
||||
}
|
||||
case trigger_toggle_record:
|
||||
{
|
||||
fout << trigger_toggle << " ";
|
||||
break;
|
||||
}
|
||||
case trigger_counter_record:
|
||||
{
|
||||
fout << trigger_counter << " ";
|
||||
break;
|
||||
}
|
||||
};
|
||||
} // end record map
|
||||
}
|
||||
recordStep++;
|
||||
|
|
|
@ -11,9 +11,9 @@ Prints to screen the follow:
|
|||
- Error Code (errorCode)
|
||||
|
||||
- Message indicating the problem. This message should be preceded by
|
||||
"Warning", "Error" or "Note". Warnings are non-fatal and the code
|
||||
will pause. Errors are fatal and will stop the code. Notes are only
|
||||
for information.
|
||||
"Warning", "Error" or "Note". Warnings are non-fatal and the code
|
||||
will pause. Errors are fatal and will stop the code. Notes are
|
||||
only for information.
|
||||
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
@ -74,9 +74,6 @@ for information.
|
|||
USA or view http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
**********************************************************************/
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <cstdlib> // exit
|
||||
|
||||
#include "uiuc_warnings_errors.h"
|
||||
|
||||
|
@ -96,7 +93,7 @@ void uiuc_warnings_errors(int errorCode, string line)
|
|||
exit(-1);
|
||||
break;
|
||||
case 2:
|
||||
cerr << "UIUC ERROR 2: Unknown identifier in \"" << line << "\" (check uiuc_maps_*.cpp)" << endl;
|
||||
cerr << "UIUC ERROR 2: Unknown identifier in \"" << line << "\" (check uiuc_map_*.cpp)" << endl;
|
||||
exit(-1);
|
||||
break;
|
||||
case 3:
|
||||
|
@ -111,6 +108,14 @@ void uiuc_warnings_errors(int errorCode, string line)
|
|||
cerr << "UIUC ERROR 5: Must use dyn_on_speed not equal to zero: \"" << line << endl;
|
||||
exit(-1);
|
||||
break;
|
||||
case 6:
|
||||
cerr << "UIUC ERROR 6: Table lookup data exceeds 99 point limit: \"" << endl;
|
||||
exit(-1);
|
||||
break;
|
||||
case 7:
|
||||
cerr << "UIUC ERROR 7: Need to download data file for the ornithopter. Go to http://www.aae.uiuc.edu/m-selig/apasim/Aircraft-uiuc.html " << endl;
|
||||
exit(-1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <simgear/compiler.h>
|
||||
|
||||
#include <string>
|
||||
#include <cstdlib>
|
||||
#include STL_IOSTREAM
|
||||
|
||||
SG_USING_STD(string);
|
||||
|
|
|
@ -27,7 +27,11 @@
|
|||
02/24/2002 (GD) Added uiuc_network_routine()
|
||||
03/27/2002 (RD) Changed how forces are calculated when
|
||||
body-axis is used
|
||||
|
||||
12/11/2002 (RD) Divided uiuc_network_routine into
|
||||
uiuc_network_recv_routine and
|
||||
uiuc_network_send_routine
|
||||
03/16/2003 (RD) Added trigger lines in recorder area
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
AUTHOR(S): Bipin Sehgal <bsehgal@uiuc.edu>
|
||||
|
@ -87,6 +91,7 @@
|
|||
#include "uiuc_aircraft.h"
|
||||
#include "uiuc_aircraftdir.h"
|
||||
#include "uiuc_coefficients.h"
|
||||
#include "uiuc_getwind.h"
|
||||
#include "uiuc_engine.h"
|
||||
#include "uiuc_gear.h"
|
||||
#include "uiuc_aerodeflections.h"
|
||||
|
@ -97,19 +102,21 @@
|
|||
//#include "Main/simple_udp.h"
|
||||
#include "uiuc_fog.h" //321654
|
||||
//#include "uiuc_network.h"
|
||||
//#include "uiuc_get_flapper.h"
|
||||
#include "uiuc_get_flapper.h"
|
||||
|
||||
SG_USING_STD(cout);
|
||||
SG_USING_STD(endl);
|
||||
|
||||
extern "C" void uiuc_initial_init ();
|
||||
extern "C" void uiuc_vel_init ();
|
||||
extern "C" void uiuc_init_aeromodel ();
|
||||
extern "C" void uiuc_force_moment(double dt);
|
||||
extern "C" void uiuc_engine_routine();
|
||||
extern "C" void uiuc_wind_routine();
|
||||
extern "C" void uiuc_gear_routine();
|
||||
extern "C" void uiuc_record_routine(double dt);
|
||||
//extern "C" void uiuc_network_routine();
|
||||
extern "C" void uiuc_vel_init ();
|
||||
extern "C" void uiuc_initial_init ();
|
||||
extern "C" void uiuc_network_recv_routine();
|
||||
extern "C" void uiuc_network_send_routine();
|
||||
|
||||
AIRCRAFT *aircraft_ = new AIRCRAFT;
|
||||
AIRCRAFTDIR *aircraftdir_ = new AIRCRAFTDIR;
|
||||
|
@ -192,10 +199,6 @@ void uiuc_force_moment(double dt)
|
|||
|
||||
uiuc_aerodeflections(dt);
|
||||
uiuc_coefficients(dt);
|
||||
//if (flapper_model)
|
||||
// {
|
||||
// uiuc_get_flapper(dt);
|
||||
// }
|
||||
|
||||
/* Calculate the forces */
|
||||
if (CX && CZ)
|
||||
|
@ -258,12 +261,13 @@ void uiuc_force_moment(double dt)
|
|||
M_m_aero += -polarInertia * engineOmega * R_body;
|
||||
|
||||
// ornithopter support
|
||||
//if (flapper_model)
|
||||
// {
|
||||
// F_X_aero += F_X_aero_flapper;
|
||||
// F_Z_aero += F_Z_aero_flapper;
|
||||
// M_m_aero += flapper_Moment;
|
||||
// }
|
||||
if (flapper_model)
|
||||
{
|
||||
uiuc_get_flapper(dt);
|
||||
F_X_aero += F_X_aero_flapper;
|
||||
F_Z_aero += F_Z_aero_flapper;
|
||||
M_m_aero += flapper_Moment;
|
||||
}
|
||||
|
||||
// fog field update
|
||||
Fog = 0;
|
||||
|
@ -304,6 +308,11 @@ void uiuc_force_moment(double dt)
|
|||
|
||||
}
|
||||
|
||||
void uiuc_wind_routine()
|
||||
{
|
||||
uiuc_getwind();
|
||||
}
|
||||
|
||||
void uiuc_engine_routine()
|
||||
{
|
||||
uiuc_engine();
|
||||
|
@ -316,13 +325,31 @@ void uiuc_gear_routine ()
|
|||
|
||||
void uiuc_record_routine(double dt)
|
||||
{
|
||||
if (trigger_last_time_step == 0 && trigger_on == 1) {
|
||||
if (trigger_toggle == 0)
|
||||
trigger_toggle = 1;
|
||||
else
|
||||
trigger_toggle = 0;
|
||||
trigger_num++;
|
||||
if (trigger_num % 2 != 0)
|
||||
trigger_counter++;
|
||||
}
|
||||
|
||||
if (Simtime >= recordStartTime)
|
||||
uiuc_recorder(dt);
|
||||
|
||||
trigger_last_time_step = trigger_on;
|
||||
}
|
||||
|
||||
//void uiuc_network_routine()
|
||||
//{
|
||||
// if (use_uiuc_network)
|
||||
// uiuc_network(2); //send data
|
||||
//}
|
||||
void uiuc_network_recv_routine()
|
||||
{
|
||||
//if (use_uiuc_network)
|
||||
//uiuc_network(1);
|
||||
}
|
||||
|
||||
void uiuc_network_send_routine()
|
||||
{
|
||||
//if (use_uiuc_network)
|
||||
//uiuc_network(2);
|
||||
}
|
||||
//end uiuc_wrapper.cpp
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
|
||||
void uiuc_init_aeromodel ();
|
||||
void uiuc_force_moment(double dt);
|
||||
void uiuc_wind_routine();
|
||||
void uiuc_engine_routine();
|
||||
void uiuc_gear_routine();
|
||||
void uiuc_record_routine(double dt);
|
||||
//void uiuc_network_routine();
|
||||
void uiuc_network_recv_routine();
|
||||
void uiuc_network_send_routine();
|
||||
void uiuc_vel_init ();
|
||||
void uiuc_initial_init ();
|
||||
|
|
Loading…
Add table
Reference in a new issue