1
0
Fork 0

UIUC flight model contribution. This is based on LaRCsim, but can read

the aircraft parameters from a file.  It still uses Tony's <crappy> (and I
mean that in a constructive way) gear model. :-)
This commit is contained in:
curt 2000-03-22 22:01:33 +00:00
parent 863423054e
commit 8f3aa1bebd
42 changed files with 6189 additions and 5 deletions

View file

@ -3,12 +3,26 @@ EXTRA_DIST = \
c172_engine.c \
c172_gear.c \
c172_init.c \
navion_init.h
navion_init.h \
uiuc_aero.c
if ENABLE_NAVION
NAVION_MODEL = \
navion_aero.c navion_engine.c navion_gear.c navion_init.c navion_init.h
else
NAVION_MODEL =
endif
if ENABLE_C172
AIRCRAFT_MODEL = c172_aero.c c172_engine.c c172_gear.c c172_init.c navion_init.h
C172_MODEL = c172_aero.c c172_engine.c c172_gear.c c172_init.c navion_init.h
else
AIRCRAFT_MODEL = navion_aero.c navion_engine.c navion_gear.c navion_init.c navion_init.h
C172_MODEL =
endif
if ENABLE_UIUC
UIUC_MODEL = uiuc_aero.c c172_init.c navion_init.h
else
UIUC_MODEL =
endif
# AIRCRAFT_MODEL = cherokee_aero.c cherokee_engine.c cherokee_gear.c cherokee_init.c navion_init.h
@ -29,7 +43,7 @@ libLaRCsim_a_SOURCES = \
ls_sim_control.h \
ls_step.c ls_step.h \
ls_sym.h ls_types.h \
$(AIRCRAFT_MODEL) \
$(NAVION_MODEL) $(C172_MODEL) $(UIUC_MODEL) \
ls_interface.c ls_interface.h
INCLUDES += -I$(top_builddir) -I$(top_builddir)/src

View file

@ -1,4 +1,4 @@
SUBDIRS = Balloon JSBsim LaRCsim
SUBDIRS = Balloon JSBsim LaRCsim UIUCModel
noinst_LIBRARIES = libFlight.a

View file

@ -0,0 +1,25 @@
noinst_LIBRARIES = libUIUCModel.a
libUIUCModel_a_SOURCES = \
uiuc_1DdataFileReader.cpp \
uiuc_1Dinterpolation.cpp \
uiuc_2DdataFileReader.cpp \
uiuc_2Dinterpolation.cpp \
uiuc_aerodeflections.cpp \
uiuc_coefficients.cpp \
uiuc_convert.cpp \
uiuc_engine.cpp\
uiuc_ice.cpp \
uiuc_initializemaps.cpp \
uiuc_initializemaps1.cpp \
uiuc_initializemaps2.cpp \
uiuc_initializemaps3.cpp \
uiuc_initializemaps4.cpp \
uiuc_menu.cpp \
uiuc_parsefile.cpp \
uiuc_recorder.cpp \
uiuc_warnings_errors.cpp \
uiuc_wrapper.cpp
INCLUDES += -I$(top_builddir)

View file

@ -0,0 +1,109 @@
/**********************************************************************
FILENAME: uiuc_1DdataFileReader.cpp
----------------------------------------------------------------------
DESCRIPTION: Reads name of data file to be opened and reads data
into appropriate arrays or matrices
----------------------------------------------------------------------
STATUS: alpha version
----------------------------------------------------------------------
REFERENCES:
----------------------------------------------------------------------
HISTORY: 02/15/2000 initial release
----------------------------------------------------------------------
AUTHOR(S): Jeff Scott <jscott@mail.com>
----------------------------------------------------------------------
VARIABLES:
----------------------------------------------------------------------
INPUTS: -1D data file name
-conversion factor for y data
-conversion factor for x data
----------------------------------------------------------------------
OUTPUTS: -array of x data
-array of y data
-max number of data sets
----------------------------------------------------------------------
CALLED BY: uiuc_menu.cpp
----------------------------------------------------------------------
CALLS TO: specified 1D data file
----------------------------------------------------------------------
COPYRIGHT: (C) 2000 by Michael Selig
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA or view http://www.gnu.org/copyleft/gpl.html.
**********************************************************************/
#include "uiuc_1DdataFileReader.h"
int
uiuc_1DdataFileReader( string file_name, double convert_x, double convert_y,
double x[100], double y[100], int &xmax )
{
ParseFile *matrix;
double token_value1;
double token_value2;
int counter = 1, data = 0;
string linetoken1;
string linetoken2;
stack command_list;
/* Read the file and get the list of commands */
matrix = new ParseFile(file_name);
command_list = matrix -> getCommands();
for (LIST command_line = command_list.begin(); command_line!=command_list.end(); ++command_line)
{
linetoken1 = matrix -> getToken(*command_line, 1); // gettoken(string,tokenNo);
linetoken2 = matrix -> getToken(*command_line, 2); // 2 represents token No 2
istrstream token1(linetoken1.c_str());
istrstream token2(linetoken2.c_str());
token1 >> token_value1;
token2 >> token_value2;
x[counter] = token_value1 * convert_x;
y[counter] = token_value2 * convert_y;
xmax = counter;
counter++;
data = 1;
}
return data;
}
// end uiuc_1DdataFileReader.cpp

View file

@ -0,0 +1,16 @@
#ifndef _1D_DATA_FILE_READER_H_
#define _1D_DATA_FILE_READER_H_
#include <strstream.h>
#include "uiuc_parsefile.h"
#include "uiuc_aircraft.h"
int uiuc_1DdataFileReader( string file_name,
double convert_x,
double convert_y,
double x[100],
double y[100],
int &xmax );
#endif // _1D_DATA_FILE_READER_H_

View file

@ -0,0 +1,119 @@
/**********************************************************************
FILENAME: uiuc_1Dinterpolation.cpp
----------------------------------------------------------------------
DESCRIPTION: reads in the yData and xData arrays and the value of x
to be interpolated on; performs 1D interpolation,
i.e. y=f(x)
----------------------------------------------------------------------
STATUS: alpha version
----------------------------------------------------------------------
REFERENCES: syntax based on interp function in c172_aero.c
mathematics based on linear interpolation functions
found in
Kreyszig, Erwin. Advanced Engineering Mathematics,
7th ed. NY: John Wiley & Sons, 1993.
----------------------------------------------------------------------
HISTORY: 02/03/2000 initial release
----------------------------------------------------------------------
AUTHOR(S): Jeff Scott <jscott@mail.com>
----------------------------------------------------------------------
VARIABLES:
----------------------------------------------------------------------
INPUTS: -array of x data
-array of y data
-max number of data pairs
-x value to be interpolated on
----------------------------------------------------------------------
OUTPUTS: -y as function of x
----------------------------------------------------------------------
CALLED BY: uiuc_coefficients.cpp
----------------------------------------------------------------------
CALLS TO: none
----------------------------------------------------------------------
COPYRIGHT: (C) 2000 by Michael Selig
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA or view http://www.gnu.org/copyleft/gpl.html.
**********************************************************************/
#include "uiuc_1Dinterpolation.h"
double uiuc_1Dinterpolation( double xData[100], double yData[100], int xmax, double x )
{
double x1=0, x2=0, y1=0, y2=0, L1=0, L2=0;
int i=2;
float yfx=0;
//check bounds on x to see if data range encloses it
// NOTE: [1] is first element of all arrays, [0] not used
if (x <= xData[1]) //if x less than lowest x
{
yfx = yData[1]; //let y equal lowest y
}
else if (x >= xData[xmax]) //if x greater than greatest x
{
yfx = yData[xmax]; //let y equal greatest y
}
else //x between xmax and x min
{
/*loop increases i until x is less than a known x,
e.g. Alpha from LaRCsim less than Alpha given in
tabulated data; once this value is found, i becomes
the upper bound and i-1 the lower bound*/
while (xData[i] <= x) //bracket upper bound
{
i++;
}
x2 = xData[i]; //set upper bounds
y2 = yData[i];
x1 = xData[i-1]; //set lower bounds
y1 = yData[i-1];
//calculate Langrange polynomial coefficients
//(see Kreyszig, pg. 937)
L1 = (x - x2) / (x1 - x2);
L2 = (x - x1) / (x2 - x1);
//solve for y=f(x)
yfx = L1 * y1 + L2 * y2;
}
return yfx;
}
// end uiuc_1Dinterpolation.cpp

View file

@ -0,0 +1,6 @@
#ifndef _1D_INTERPOLATION_H_
#define _1D_INTERPOLATION_H_
double uiuc_1Dinterpolation( double xData[100], double yData[100], int xmax, double x );
#endif // _1D_INTERPOLATION_H_

View file

@ -0,0 +1,135 @@
/**********************************************************************
FILENAME: uiuc_2DdataFileReader.cpp
----------------------------------------------------------------------
DESCRIPTION: Reads name of data file to be opened and reads data
into appropriate arrays or matrices
----------------------------------------------------------------------
STATUS: alpha version
----------------------------------------------------------------------
REFERENCES:
----------------------------------------------------------------------
HISTORY: 02/29/2000 initial release
----------------------------------------------------------------------
AUTHOR(S): Jeff Scott <jscott@mail.com>
----------------------------------------------------------------------
VARIABLES:
----------------------------------------------------------------------
INPUTS: -2D file name
-conversion factor for x data
-conversion factor for y data
-conversion factor for z data
----------------------------------------------------------------------
OUTPUTS: -2D array of x data for each y case
-1D array of y data
-2D array of z data for each y case
-1D array of max number of x-z data sets for each y case
-max number of y data sets
----------------------------------------------------------------------
CALLED BY: uiuc_menu.cpp
----------------------------------------------------------------------
CALLS TO: specified 2D data file
----------------------------------------------------------------------
COPYRIGHT: (C) 2000 by Michael Selig
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA or view http://www.gnu.org/copyleft/gpl.html.
**********************************************************************/
#include "uiuc_2DdataFileReader.h"
int uiuc_2DdataFileReader( string file_name,
double convert_x,
double convert_y,
double convert_z,
double x[100][100],
double y[100],
double z[100][100],
int xmax[100],
int &ymax)
{
ParseFile *matrix;
double token_value1;
double token_value2;
int counter_y = 1, counter_x = 1, data = 0;
string linetoken1;
string linetoken2;
stack command_list;
/* Read the file and get the list of commands */
matrix = new ParseFile(file_name);
command_list = matrix -> getCommands();
for (LIST command_line = command_list.begin(); command_line!=command_list.end(); ++command_line)
{
linetoken1 = matrix -> getToken(*command_line, 1); // gettoken(string,tokenNo);
linetoken2 = matrix -> getToken(*command_line, 2); // 2 represents token No 2
istrstream token1(linetoken1.c_str());
istrstream token2(linetoken2.c_str());
//reset token_value2 for first if statement
token_value2 = -999;
token1 >> token_value1;
token2 >> token_value2;
//check to see if only one value on line (token2 blank)
if (token_value2 == -999)
{
y[counter_y] = token_value1 * convert_y;
ymax = counter_y;
counter_y++;
counter_x = 1;
}
else
{
x[counter_y-1][counter_x] = token_value1 * convert_x;
z[counter_y-1][counter_x] = token_value2 * convert_z;
xmax[counter_y-1] = counter_x;
counter_x++;
}
}
data = 1;
return data;
}
// end uiuc_2DdataFileReader.cpp

View file

@ -0,0 +1,13 @@
#ifndef _2D_DATA_FILE_READER_H_
#define _2D_DATA_FILE_READER_H_
#include <strstream.h>
#include "uiuc_parsefile.h"
#include "uiuc_aircraft.h"
int
uiuc_2DdataFileReader( string file_name, double convert_x, double convert_y, double convert_z,
double x[100][100], double y[100], double z[100][100], int xmax[100],
int &ymax);
#endif // _2D_DATA_FILE_READER_H_

View file

@ -0,0 +1,254 @@
/**********************************************************************
FILENAME: uiuc_2Dinterpolation.cpp
----------------------------------------------------------------------
DESCRIPTION: reads in the zData, yData, and xData arrays and the
values of x and y to be interpolated on; performs 2D
interpolation, i.e. z=f(x,y)
----------------------------------------------------------------------
STATUS: alpha version
----------------------------------------------------------------------
REFERENCES: similar to 2D interpolation in Selig's propid code
(see alcl.f)
mathematics based on linear interpolation functions
(see 1Dinterpolation.cpp for references)
----------------------------------------------------------------------
HISTORY: 02/06/2000 initial release
----------------------------------------------------------------------
AUTHOR(S): Jeff Scott <jscott@mail.com>
----------------------------------------------------------------------
VARIABLES:
----------------------------------------------------------------------
INPUTS: -2D array of x data for each y case
-1D array of y data
-2D array of z data for each y case
-1D array of max number of x-z data sets for each y case
-max number of y data
-x value to be interpolated on
-y value to be interpolated on
----------------------------------------------------------------------
OUTPUTS: -z as function of x and y
----------------------------------------------------------------------
CALLED BY: uiuc_coefficients.cpp
----------------------------------------------------------------------
CALLS TO: none
----------------------------------------------------------------------
COPYRIGHT: (C) 2000 by Michael Selig
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA or view http://www.gnu.org/copyleft/gpl.html.
**********************************************************************/
#include "uiuc_2Dinterpolation.h"
double uiuc_2Dinterpolation( double xData[100][100],
double yData[100],
double zData[100][100],
int xmax[100],
int ymax,
double x,
double y )
{
int xmaxl=0, xmaxu=0;
double x11=0, x12=0, x21=0, x22=0, y1=0, y2=0;
double z11=0, z12=0, z21=0, z22=0, z1=0, z2=0;
double L11=0, L12=0, L21=0, L22=0, L1=0, L2=0;
int i=2, j=2;
float zfxy=0;
bool luby=false; //upper bound on y (deflection)
bool llby=false; //lower bound on y
bool lubx1=false; //upper x bound on lower y
bool llbx1=false; //lower x bound on lower y
bool lubx2=false; //upper x bound on upper y
bool llbx2=false; //lower x bound on upper y
// check bounds on y (control deflection) to see if data range encloses it
// NOTE: [1] is first element of all arrays, [0] not used
if (y <= yData[1]) //if y less than lowest y
{
llby = true;
y1 = yData[1];
xmaxl = xmax[1];
xmaxu = xmax[ymax];
}
else if (y >= yData[ymax]) //if y greater than greatest y
{
luby = true;
y2 = yData[ymax];
j = ymax;
xmaxl = xmax[1];
xmaxu = xmax[ymax];
}
else //y between ymax and ymin
{
/* loop increases j until y is less than a known y,
e.g. elevator from LaRCsim less than de given in
tabulated data; once this value is found, j becomes
the upper bound and j-1 the lower bound on y */
while (yData[j] <= y) //bracket upper bound
{
j++;
}
y2 = yData[j]; //set upper bound on y
y1 = yData[j-1]; //set lower bound on y
xmaxu = xmax[j]; //set max x on upper y
xmaxl = xmax[j-1]; //set max x on lower y
}
//check bounds on x (alpha) to see if data range encloses it
//x less than lowest x on lower y curve:
if (x <= xData[j-1][1])
{
llbx1 = true;
z11 = zData[j-1][1];
z1 = z2 = z11;
}
//x greater than greatest x on lower y curve:
if (x >= xData[j-1][xmaxl])
{
lubx1 = true;
z12 = zData[j-1][xmaxl];
z1 = z2 = z12;
}
//x less than lowest x on upper y curve:
if (x <= xData[j][1])
{
llbx2 = true;
z21 = zData[j][1];
z1 = z2 = z21;
}
//x greater than greatest x on upper y curve:
if (x >= xData[j][xmaxu])
{
lubx2 = true;
z22 = zData[j][xmaxu];
z1 = z2 = z22;
}
//x between xmax and x min
//interpolate on lower y-curve
if (llbx1 == false && lubx1 == false)
{
/* loop increases i until x is less than a known x,
e.g. Alpha from LaRCsim less than Alpha given in
tabulated data; once this value is found, i becomes
the upper bound and i-1 the lower bound */
//bracket x bounds on lower y curve
while (xData[j-1][i] <= x)
{
i++;
}
x12 = xData[j-1][i]; //set upper x and z on lower y
z12 = zData[j-1][i];
x11 = xData[j-1][i-1]; //set lower x and z on lower y
z11 = zData[j-1][i-1];
//do linear interpolation on x1 terms (lower y-curve)
L11 = (x - x12) / (x11 - x12);
L12 = (x - x11) / (x12 - x11);
z1 = L11 * z11 + L12 * z12;
}
//interpolate on upper y-curve
if (llbx2 == false && lubx2 == false)
{
//bracket x bounds on upper y curve
i = 1;
while (xData[j][i] <= x)
{
i++;
}
x22 = xData[j][i]; //set upper x and z on upper y
z22 = zData[j][i];
x21 = xData[j][i-1]; //set lower x and z on upper y
z21 = zData[j][i-1];
//do linear interpolation on x2 terms (upper y-curve)
L21 = (x - x22) / (x21 - x22);
L22 = (x - x21) / (x22 - x21);
z2 = L21 * z21 + L22 * z22;
}
//now have all data needed to find coefficient, check cases:
if (llby == true)
{
if (llbx1 == true || llbx2 == true)
{
z1 = z11;
z2 = z21;
}
if (lubx1 == true || lubx2 == true)
{
z1 = z12;
z2 = z22;
}
else
{
zfxy = z1;
}
}
else if (luby == true)
{
if (llbx1 == true || llbx2 == true)
{
z1 = z11;
z2 = z21;
}
if (lubx1 == true || lubx2 == true)
{
z1 = z12;
z2 = z22;
}
else
{
zfxy = z2;
}
}
//do linear interpolation on y terms
L1 = (y - y2) / (y1 - y2);
L2 = (y - y1) / (y2 - y1);
//solve for z=f(x,y)
zfxy = L1 * z1 + L2 * z2;
return zfxy;
}
// end uiuc_2Dinterpolation.cpp

View file

@ -0,0 +1,8 @@
#ifndef _2D_INTERPOLATION_H_
#define _2D_INTERPOLATION_H_
double
uiuc_2Dinterpolation( double xData[100][100], double yData[100], double zData[100][100],
int xmax[100], int ymax, double x, double y );
#endif // _2D_INTERPOLATION_H_

View file

@ -0,0 +1,90 @@
/**********************************************************************
FILENAME: uiuc_aerodeflections.cpp
----------------------------------------------------------------------
DESCRIPTION: determine the aero control surface deflections
elevator [rad]
aileron [rad]
rudder [rad]
----------------------------------------------------------------------
STATUS: alpha version
----------------------------------------------------------------------
REFERENCES: based on deflection portions of c172_aero.c and
uiuc_aero.c
----------------------------------------------------------------------
HISTORY: 01/30/2000 initial release
----------------------------------------------------------------------
AUTHOR(S): Jeff Scott <jscott@mail.com>
Michael Selig <m-selig@uiuc.edu>
----------------------------------------------------------------------
VARIABLES:
----------------------------------------------------------------------
INPUTS: *
----------------------------------------------------------------------
OUTPUTS: *
----------------------------------------------------------------------
CALLED BY: *
----------------------------------------------------------------------
CALLS TO: *
----------------------------------------------------------------------
COPYRIGHT: (C) 2000 by Michael Selig
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA or view http://www.gnu.org/copyleft/gpl.html.
**********************************************************************/
#include "uiuc_aerodeflections.h"
void uiuc_aerodeflections()
{
// for now, consider deflections to be equal
// damin = damax
aileron = - Lat_control * damax * DEG_TO_RAD;
// for now, consider deflections to be equal
// demin = demax
elevator = Long_control * demax * DEG_TO_RAD + Long_trim;
// for now, consider deflections to be equal
// drmin = drmax
rudder = - Rudder_pedal * drmax * DEG_TO_RAD;
return;
}
// end uiuc_aerodeflections.cpp

View file

@ -0,0 +1,11 @@
#ifndef _AERODEFLECTIONS_H_
#define _AERODEFLECTIONS_H_
#include "uiuc_aircraft.h" /* uses aileron, elevator, rudder */
#include "../FDM/LaRCsim/ls_cockpit.h" /* uses Long_control, Lat_control, Rudder_pedal */
#include "../FDM/LaRCsim/ls_constants.h" /* uses RAD_TO_DEG, DEG_TO_RAD */
void uiuc_aerodeflections();
#endif // _AERODEFLECTIONS_H_

View file

@ -0,0 +1,764 @@
/**********************************************************************
FILENAME: uiuc_aircraft.h
----------------------------------------------------------------------
DESCRIPTION: creates maps for all keywords and variables expected in
aircraft input file, includes all parameters that
define the aircraft for use in the uiuc aircraft models.
----------------------------------------------------------------------
STATUS: alpha version
----------------------------------------------------------------------
REFERENCES:
----------------------------------------------------------------------
HISTORY: 01/26/2000 initial release
02/10/2000 (JS) changed aeroData to aeroParts (etc.)
added Twin Otter 2.5 equation variables
added Dx_cg (etc.) to init & record maps
added controlsMixer to top level map
02/18/2000 (JS) added variables needed for 1D file
reading of CL and CD as functions of alpha
02/29/2000 (JS) added variables needed for 2D file
reading of CL, CD, and Cm as functions of
alpha and delta_e; of CY and Cn as function
of alpha and delta_r; and of Cl and Cn as
functions of alpha and delta_a
03/02/2000 (JS) added record features for 1D and 2D
interpolations
----------------------------------------------------------------------
AUTHOR(S): Bipin Sehgal <bsehgal@uiuc.edu>
Jeff Scott <jscott@mail.com>
----------------------------------------------------------------------
VARIABLES:
----------------------------------------------------------------------
INPUTS: none
----------------------------------------------------------------------
OUTPUTS: none
----------------------------------------------------------------------
CALLED BY: uiuc_1DdataFileReader.cpp
uiuc_2DdataFileReader.cpp
uiuc_aerodeflections.cpp
uiuc_coefficients.cpp
uiuc_engine.cpp
uiuc_initializemaps.cpp
uiuc_menu.cpp
uiuc_recorder.cpp
----------------------------------------------------------------------
CALLS TO: none
----------------------------------------------------------------------
COPYRIGHT: (C) 2000 by Michael Selig
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA or view http://www.gnu.org/copyleft/gpl.html.
**********************************************************************/
#ifndef _AIRCRAFT_H_
#define _AIRCRAFT_H_
#include <map>
#include <iostream>
#include "uiuc_parsefile.h"
typedef stack :: iterator LIST;
/* Add more keywords here if required*/
enum {init_flag = 1000, geometry_flag, controlSurface_flag, controlsMixer_flag,
mass_flag, engine_flag, CD_flag, CL_flag, Cm_flag, CY_flag, Cl_flag,
Cn_flag, gear_flag, ice_flag, record_flag};
// init ======= Initial values for equation of motion
enum {Dx_pilot_flag = 2000, Dy_pilot_flag, Dz_pilot_flag,
Dx_cg_flag, Dy_cg_flag, Dz_cg_flag,
V_north_flag, V_east_flag, V_down_flag,
P_body_flag, Q_body_flag, R_body_flag,
Phi_flag, Theta_flag, Psi_flag};
// geometry === Aircraft-specific geometric quantities
enum {bw_flag = 3000, cbar_flag, Sw_flag};
// controlSurface = Control surface deflections and properties
enum {de_flag = 4000, da_flag, dr_flag};
// controlsMixer == Controls mixer
enum {nomix_flag = 14000};
//mass ======== Aircraft-specific mass properties
enum {Mass_flag = 5000, I_xx_flag, I_yy_flag, I_zz_flag, I_xz_flag};
// engine ===== Propulsion data
enum {simpleSingle_flag = 6000, c172_flag};
// CD ========= Aerodynamic x-force quantities (longitudinal)
enum {CDo_flag = 7000, CDK_flag, CD_a_flag, CD_de_flag, CDfa_flag, CDfade_flag};
// CL ========= Aerodynamic z-force quantities (longitudinal)
enum {CLo_flag = 8000, CL_a_flag, CL_adot_flag, CL_q_flag, CL_de_flag, CLfa_flag, CLfade_flag};
// Cm ========= Aerodynamic m-moment quantities (longitudinal)
enum {Cmo_flag = 9000, Cm_a_flag, Cm_adot_flag, Cm_q_flag, Cm_de_flag, Cmfade_flag};
// CY ========= Aerodynamic y-force quantities (lateral)
enum {CYo_flag = 10000, CY_beta_flag, CY_p_flag, CY_r_flag, CY_da_flag, CY_dr_flag,
CYfada_flag, CYfbetadr_flag};
// Cl ========= Aerodynamic l-moment quantities (lateral)
enum {Clo_flag = 11000, Cl_beta_flag, Cl_betafCL_flag, Cl_p_flag, Cl_r_flag, Cl_rfCL_flag,
Cl_da_flag, Cl_dr_flag, Clfada_flag, Clfbetadr_flag};
// Cn ========= Aerodynamic n-moment quantities (lateral)
enum {Cno_flag = 12000, Cn_beta_flag, Cn_betafCL_flag, Cn_p_flag, Cn_pfCL_flag, Cn_r_flag,
Cn_rfCL_flag, Cn_da_flag, Cn_dr_flag, Cn_drfCL_flag, Cnfada_flag, Cnfbetadr_flag};
// gear ======= Landing gear model quantities
// ice ======== Ice model quantities
enum {iceTime_flag = 15000, transientTime_flag, eta_final_flag,
kCDo_flag, kCDK_flag, kCD_a_flag, kCD_de_flag,
kCLo_flag, kCL_a_flag, kCL_adot_flag, kCL_q_flag, kCL_de_flag,
kCmo_flag, kCm_a_flag, kCm_adot_flag, kCm_q_flag, kCm_de_flag,
kCYo_flag, kCY_beta_flag, kCY_p_flag, kCY_r_flag, kCY_da_flag, kCY_dr_flag,
kClo_flag, kCl_beta_flag, kCl_p_flag, kCl_r_flag, kCl_da_flag, kCl_dr_flag,
kCno_flag, kCn_beta_flag, kCn_p_flag, kCn_r_flag, kCn_da_flag, kCn_dr_flag};
// record ===== Record desired quantites to file
enum {Dx_pilot_record = 13000, Dy_pilot_record, Dz_pilot_record,
Dx_cg_record, Dy_cg_record, Dz_cg_record,
V_north_record, V_east_record, V_down_record,
V_rel_wind_record, Dynamic_pressure_record,
Alpha_record, Alpha_dot_record, Beta_record, Beta_dot_record, Gamma_record,
P_body_record, Q_body_record, R_body_record,
Phi_record, Theta_record, Psi_record, Theta_dot_record,
density_record, Mass_record, Simtime_record, dt_record,
elevator_record, aileron_record, rudder_record,
CD_record, CDfaI_record, CDfadeI_record,
CL_record, CLfaI_record, CLfadeI_record,
Cm_record, CmfadeI_record,
CY_record, CYfadaI_record, CYfbetadrI_record,
Cl_record, ClfadaI_record, ClfbetadrI_record,
Cn_record, CnfadaI_record, CnfbetadrI_record,
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,
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};
typedef struct
{
// ParseFile stuff [] Bipin to add more comments
ParseFile *airplane;
#define airplane aircraft_->airplane
ParseFile *initParts;
#define initParts aircraft_->initParts
ParseFile *geometryParts;
#define geometryParts aircraft_->geometryParts
ParseFile *massParts;
#define massParts aircraft_->massParts
ParseFile *aeroParts;
#define aeroParts aircraft_->aeroParts
ParseFile *engineParts;
#define engineParts aircraft_->engineParts
ParseFile *gearParts;
#define gearParts aircraft_->gearParts
ParseFile *recordParts;
#define recordParts aircraft_->recordParts
/*= Keywords (token1) ===========================================*/
map <string,int> Keyword_map;
#define Keyword_map aircraft_->Keyword_map
double CL;
double CD;
double Cm;
double CY;
double Cl;
double Cn;
#define CL aircraft_->CL
#define CD aircraft_->CD
#define Cm aircraft_->Cm
#define CY aircraft_->CY
#define Cl aircraft_->Cl
#define Cn aircraft_->Cn
/*========================================*/
/* Variables (token2) - 14 groups (000210)*/
/*========================================*/
/* Variables (token2) ===========================================*/
/* init ========== Initial values for equations of motion =======*/
map <string,int> init_map;
#define init_map aircraft_->init_map
/* Variables (token2) ===========================================*/
/* geometry ====== Aircraft-specific geometric quantities =======*/
map <string,int> geometry_map;
#define geometry_map aircraft_->geometry_map
double bw;
double cbar;
double Sw;
#define bw aircraft_->bw
#define cbar aircraft_->cbar
#define Sw aircraft_->Sw
/* Variables (token2) ===========================================*/
/* controlSurface Control surface deflections and properties ===*/
map <string,int> controlSurface_map;
#define controlSurface_map aircraft_->controlSurface_map
double demax;
double demin;
double damax;
double damin;
double drmax;
double drmin;
#define demax aircraft_->demax
#define demin aircraft_->demin
#define damax aircraft_->damax
#define damin aircraft_->damin
#define drmax aircraft_->drmax
#define drmin aircraft_->drmin
double aileron;
double elevator;
double rudder;
#define aileron aircraft_->aileron
#define elevator aircraft_->elevator
#define rudder aircraft_->rudder
/* Variables (token2) ===========================================*/
/* controlsMixer = Control mixer ================================*/
map <string,int> controlsMixer_map;
#define controlsMixer_map aircraft_->controlsMixer_map
double nomix;
#define nomix aircraft_->nomix
/* Variables (token2) ===========================================*/
/* mass =========== Aircraft-specific mass properties ===========*/
map <string,int> mass_map;
#define mass_map aircraft_->mass_map
/* Variables (token2) ===========================================*/
/* engine ======== Propulsion data ==============================*/
map <string,int> engine_map;
#define engine_map aircraft_->engine_map
double simpleSingleMaxThrust;
#define simpleSingleMaxThrust aircraft_->simpleSingleMaxThrust
/* Variables (token2) ===========================================*/
/* CD ============ Aerodynamic x-force quantities (longitudinal) */
map <string,int> CD_map;
#define CD_map aircraft_->CD_map
double CDo;
double CDK;
double CD_a;
double CD_de;
#define CDo aircraft_->CDo
#define CDK aircraft_->CDK
#define CD_a aircraft_->CD_a
#define CD_de aircraft_->CD_de
string CDfa;
int CDfaData;
double CDfa_aArray[100];
double CDfa_CDArray[100];
int CDfa_nAlpha;
double CDfaI;
#define CDfa aircraft_->CDfa
#define CDfaData aircraft_->CDfaData
#define CDfa_aArray aircraft_->CDfa_aArray
#define CDfa_CDArray aircraft_->CDfa_CDArray
#define CDfa_nAlpha aircraft_->CDfa_nAlpha
#define CDfaI aircraft_->CDfaI
string CDfade;
int CDfadeData;
double CDfade_aArray[100][100];
double CDfade_deArray[100];
double CDfade_CDArray[100][100];
int CDfade_nAlphaArray[100];
int CDfade_nde;
double CDfadeI;
#define CDfade aircraft_->CDfade
#define CDfadeData aircraft_->CDfadeData
#define CDfade_aArray aircraft_->CDfade_aArray
#define CDfade_deArray aircraft_->CDfade_deArray
#define CDfade_CDArray aircraft_->CDfade_CDArray
#define CDfade_nAlphaArray aircraft_->CDfade_nAlphaArray
#define CDfade_nde aircraft_->CDfade_nde
#define CDfadeI aircraft_->CDfadeI
/* Variables (token2) ===========================================*/
/* CL ============ Aerodynamic z-force quantities (longitudinal) */
map <string,int> CL_map;
#define CL_map aircraft_->CL_map
double CLo;
double CL_a;
double CL_adot;
double CL_q;
double CL_de;
#define CLo aircraft_->CLo
#define CL_a aircraft_->CL_a
#define CL_adot aircraft_->CL_adot
#define CL_q aircraft_->CL_q
#define CL_de aircraft_->CL_de
string CLfa;
int CLfaData;
double CLfa_aArray[100];
double CLfa_CLArray[100];
int CLfa_nAlpha;
double CLfaI;
#define CLfa aircraft_->CLfa
#define CLfaData aircraft_->CLfaData
#define CLfa_aArray aircraft_->CLfa_aArray
#define CLfa_CLArray aircraft_->CLfa_CLArray
#define CLfa_nAlpha aircraft_->CLfa_nAlpha
#define CLfaI aircraft_->CLfaI
string CLfade;
int CLfadeData;
double CLfade_aArray[100][100];
double CLfade_deArray[100];
double CLfade_CLArray[100][100];
int CLfade_nAlphaArray[100];
int CLfade_nde;
double CLfadeI;
#define CLfade aircraft_->CLfade
#define CLfadeData aircraft_->CLfadeData
#define CLfade_aArray aircraft_->CLfade_aArray
#define CLfade_deArray aircraft_->CLfade_deArray
#define CLfade_CLArray aircraft_->CLfade_CLArray
#define CLfade_nAlphaArray aircraft_->CLfade_nAlphaArray
#define CLfade_nde aircraft_->CLfade_nde
#define CLfadeI aircraft_->CLfadeI
/* Variables (token2) ===========================================*/
/* Cm ============ Aerodynamic m-moment quantities (longitudinal) */
map <string,int> Cm_map;
#define Cm_map aircraft_->Cm_map
double Cmo;
double Cm_a;
double Cm_adot;
double Cm_q;
double Cm_de;
#define Cmo aircraft_->Cmo
#define Cm_a aircraft_->Cm_a
#define Cm_adot aircraft_->Cm_adot
#define Cm_q aircraft_->Cm_q
#define Cm_de aircraft_->Cm_de
string Cmfade;
int CmfadeData;
double Cmfade_aArray[100][100];
double Cmfade_deArray[100];
double Cmfade_CmArray[100][100];
int Cmfade_nAlphaArray[100];
int Cmfade_nde;
double CmfadeI;
#define Cmfade aircraft_->Cmfade
#define CmfadeData aircraft_->CmfadeData
#define Cmfade_aArray aircraft_->Cmfade_aArray
#define Cmfade_deArray aircraft_->Cmfade_deArray
#define Cmfade_CmArray aircraft_->Cmfade_CmArray
#define Cmfade_nAlphaArray aircraft_->Cmfade_nAlphaArray
#define Cmfade_nde aircraft_->Cmfade_nde
#define CmfadeI aircraft_->CmfadeI
/* Variables (token2) ===========================================*/
/* CY ============ Aerodynamic y-force quantities (lateral) =====*/
map <string,int> CY_map;
#define CY_map aircraft_->CY_map
double CYo;
double CY_beta;
double CY_p;
double CY_r;
double CY_da;
double CY_dr;
#define CYo aircraft_->CYo
#define CY_beta aircraft_->CY_beta
#define CY_p aircraft_->CY_p
#define CY_r aircraft_->CY_r
#define CY_da aircraft_->CY_da
#define CY_dr aircraft_->CY_dr
string CYfada;
int CYfadaData;
double CYfada_aArray[100][100];
double CYfada_daArray[100];
double CYfada_CYArray[100][100];
int CYfada_nAlphaArray[100];
int CYfada_nda;
double CYfadaI;
#define CYfada aircraft_->CYfada
#define CYfadaData aircraft_->CYfadaData
#define CYfada_aArray aircraft_->CYfada_aArray
#define CYfada_daArray aircraft_->CYfada_daArray
#define CYfada_CYArray aircraft_->CYfada_CYArray
#define CYfada_nAlphaArray aircraft_->CYfada_nAlphaArray
#define CYfada_nda aircraft_->CYfada_nda
#define CYfadaI aircraft_->CYfadaI
string CYfbetadr;
int CYfbetadrData;
double CYfbetadr_betaArray[100][100];
double CYfbetadr_drArray[100];
double CYfbetadr_CYArray[100][100];
int CYfbetadr_nBetaArray[100];
int CYfbetadr_ndr;
double CYfbetadrI;
#define CYfbetadr aircraft_->CYfbetadr
#define CYfbetadrData aircraft_->CYfbetadrData
#define CYfbetadr_betaArray aircraft_->CYfbetadr_betaArray
#define CYfbetadr_drArray aircraft_->CYfbetadr_drArray
#define CYfbetadr_CYArray aircraft_->CYfbetadr_CYArray
#define CYfbetadr_nBetaArray aircraft_->CYfbetadr_nBetaArray
#define CYfbetadr_ndr aircraft_->CYfbetadr_ndr
#define CYfbetadrI aircraft_->CYfbetadrI
/* Variables (token2) ===========================================*/
/* Cl ============ Aerodynamic l-moment quantities (lateral) ====*/
map <string,int> Cl_map;
#define Cl_map aircraft_->Cl_map
double Clo;
double Cl_beta;
double Cl_betafCL;
double Cl_p;
double Cl_r;
double Cl_rfCL;
double Cl_da;
double Cl_dr;
#define Clo aircraft_->Clo
#define Cl_beta aircraft_->Cl_beta
#define Cl_betafCL aircraft_->Cl_betafCL
#define Cl_p aircraft_->Cl_p
#define Cl_r aircraft_->Cl_r
#define Cl_rfCL aircraft_->Cl_rfCL
#define Cl_da aircraft_->Cl_da
#define Cl_dr aircraft_->Cl_dr
string Clfada;
int ClfadaData;
double Clfada_aArray[100][100];
double Clfada_daArray[100];
double Clfada_ClArray[100][100];
int Clfada_nAlphaArray[100];
int Clfada_nda;
double ClfadaI;
#define Clfada aircraft_->Clfada
#define ClfadaData aircraft_->ClfadaData
#define Clfada_aArray aircraft_->Clfada_aArray
#define Clfada_daArray aircraft_->Clfada_daArray
#define Clfada_ClArray aircraft_->Clfada_ClArray
#define Clfada_nAlphaArray aircraft_->Clfada_nAlphaArray
#define Clfada_nda aircraft_->Clfada_nda
#define ClfadaI aircraft_->ClfadaI
string Clfbetadr;
int ClfbetadrData;
double Clfbetadr_betaArray[100][100];
double Clfbetadr_drArray[100];
double Clfbetadr_ClArray[100][100];
int Clfbetadr_nBetaArray[100];
int Clfbetadr_ndr;
double ClfbetadrI;
#define Clfbetadr aircraft_->Clfbetadr
#define ClfbetadrData aircraft_->ClfbetadrData
#define Clfbetadr_betaArray aircraft_->Clfbetadr_betaArray
#define Clfbetadr_drArray aircraft_->Clfbetadr_drArray
#define Clfbetadr_ClArray aircraft_->Clfbetadr_ClArray
#define Clfbetadr_nBetaArray aircraft_->Clfbetadr_nBetaArray
#define Clfbetadr_ndr aircraft_->Clfbetadr_ndr
#define ClfbetadrI aircraft_->ClfbetadrI
/* Variables (token2) ===========================================*/
/* Cn ============ Aerodynamic n-moment quantities (lateral) ====*/
map <string,int> Cn_map;
#define Cn_map aircraft_->Cn_map
double Cno;
double Cn_beta;
double Cn_p;
double Cn_r;
double Cn_da;
double Cn_dr;
#define Cno aircraft_->Cno
#define Cn_beta aircraft_->Cn_beta
#define Cn_p aircraft_->Cn_p
#define Cn_r aircraft_->Cn_r
#define Cn_da aircraft_->Cn_da
#define Cn_dr aircraft_->Cn_dr
string Cnfada;
int CnfadaData;
double Cnfada_aArray[100][100];
double Cnfada_daArray[100];
double Cnfada_CnArray[100][100];
int Cnfada_nAlphaArray[100];
int Cnfada_nda;
double CnfadaI;
#define Cnfada aircraft_->Cnfada
#define CnfadaData aircraft_->CnfadaData
#define Cnfada_aArray aircraft_->Cnfada_aArray
#define Cnfada_daArray aircraft_->Cnfada_daArray
#define Cnfada_CnArray aircraft_->Cnfada_CnArray
#define Cnfada_nAlphaArray aircraft_->Cnfada_nAlphaArray
#define Cnfada_nda aircraft_->Cnfada_nda
#define CnfadaI aircraft_->CnfadaI
string Cnfbetadr;
int CnfbetadrData;
double Cnfbetadr_betaArray[100][100];
double Cnfbetadr_drArray[100];
double Cnfbetadr_CnArray[100][100];
int Cnfbetadr_nBetaArray[100];
int Cnfbetadr_ndr;
double CnfbetadrI;
#define Cnfbetadr aircraft_->Cnfbetadr
#define CnfbetadrData aircraft_->CnfbetadrData
#define Cnfbetadr_betaArray aircraft_->Cnfbetadr_betaArray
#define Cnfbetadr_drArray aircraft_->Cnfbetadr_drArray
#define Cnfbetadr_CnArray aircraft_->Cnfbetadr_CnArray
#define Cnfbetadr_nBetaArray aircraft_->Cnfbetadr_nBetaArray
#define Cnfbetadr_ndr aircraft_->Cnfbetadr_ndr
#define CnfbetadrI aircraft_->CnfbetadrI
/* Variables (token2) ===========================================*/
/* gear ========== Landing gear model quantities ================*/
map <string,int> gear_map;
#define gear_map aircraft_->gear_map
/* Variables (token2) ===========================================*/
/* ice =========== Ice model quantities ======================== */
map <string,int> ice_map;
#define ice_map aircraft_->ice_map
double iceTime;
double transientTime;
double eta_final;
double eta;
#define iceTime aircraft_->iceTime
#define transientTime aircraft_->transientTime
#define eta_final aircraft_->eta_final
#define eta aircraft_->eta
double kCDo;
double kCDK;
double kCD_a;
double kCD_de;
double CDo_clean;
double CDK_clean;
double CD_a_clean;
double CD_de_clean;
#define kCDo aircraft_->kCDo
#define kCDK aircraft_->kCDK
#define kCD_a aircraft_->kCD_a
#define kCD_de aircraft_->kCD_de
#define CDo_clean aircraft_->CDo_clean
#define CDK_clean aircraft_->CDK_clean
#define CD_a_clean aircraft_->CD_a_clean
#define CD_de_clean aircraft_->CD_de_clean
double kCLo;
double kCL_a;
double kCL_adot;
double kCL_q;
double kCL_de;
double CLo_clean;
double CL_a_clean;
double CL_adot_clean;
double CL_q_clean;
double CL_de_clean;
#define kCLo aircraft_->kCLo
#define kCL_a aircraft_->kCL_a
#define kCL_adot aircraft_->kCL_adot
#define kCL_q aircraft_->kCL_q
#define kCL_de aircraft_->kCL_de
#define CLo_clean aircraft_->CLo_clean
#define CL_a_clean aircraft_->CL_a_clean
#define CL_adot_clean aircraft_->CL_adot_clean
#define CL_q_clean aircraft_->CL_q_clean
#define CL_de_clean aircraft_->CL_de_clean
double kCmo;
double kCm_a;
double kCm_adot;
double kCm_q;
double kCm_de;
double Cmo_clean;
double Cm_a_clean;
double Cm_adot_clean;
double Cm_q_clean;
double Cm_de_clean;
#define kCmo aircraft_->kCmo
#define kCm_a aircraft_->kCm_a
#define kCm_adot aircraft_->kCm_adot
#define kCm_q aircraft_->kCm_q
#define kCm_de aircraft_->kCm_de
#define Cmo_clean aircraft_->Cmo_clean
#define Cm_a_clean aircraft_->Cm_a_clean
#define Cm_adot_clean aircraft_->Cm_adot_clean
#define Cm_q_clean aircraft_->Cm_q_clean
#define Cm_de_clean aircraft_->Cm_de_clean
double kCYo;
double kCY_beta;
double kCY_p;
double kCY_r;
double kCY_da;
double kCY_dr;
double CYo_clean;
double CY_beta_clean;
double CY_p_clean;
double CY_r_clean;
double CY_da_clean;
double CY_dr_clean;
#define kCYo aircraft_->kCYo
#define kCY_beta aircraft_->kCY_beta
#define kCY_p aircraft_->kCY_p
#define kCY_r aircraft_->kCY_r
#define kCY_da aircraft_->kCY_da
#define kCY_dr aircraft_->kCY_dr
#define CYo_clean aircraft_->CYo_clean
#define CY_beta_clean aircraft_->CY_beta_clean
#define CY_p_clean aircraft_->CY_p_clean
#define CY_r_clean aircraft_->CY_r_clean
#define CY_da_clean aircraft_->CY_da_clean
#define CY_dr_clean aircraft_->CY_dr_clean
double kClo;
double kCl_beta;
double kCl_p;
double kCl_r;
double kCl_da;
double kCl_dr;
double Clo_clean;
double Cl_beta_clean;
double Cl_p_clean;
double Cl_r_clean;
double Cl_da_clean;
double Cl_dr_clean;
#define kClo aircraft_->kClo
#define kCl_beta aircraft_->kCl_beta
#define kCl_p aircraft_->kCl_p
#define kCl_r aircraft_->kCl_r
#define kCl_da aircraft_->kCl_da
#define kCl_dr aircraft_->kCl_dr
#define Clo_clean aircraft_->Clo_clean
#define Cl_beta_clean aircraft_->Cl_beta_clean
#define Cl_p_clean aircraft_->Cl_p_clean
#define Cl_r_clean aircraft_->Cl_r_clean
#define Cl_da_clean aircraft_->Cl_da_clean
#define Cl_dr_clean aircraft_->Cl_dr_clean
double kCno;
double kCn_beta;
double kCn_p;
double kCn_r;
double kCn_da;
double kCn_dr;
double Cno_clean;
double Cn_beta_clean;
double Cn_p_clean;
double Cn_r_clean;
double Cn_da_clean;
double Cn_dr_clean;
#define kCno aircraft_->kCno
#define kCn_beta aircraft_->kCn_beta
#define kCn_p aircraft_->kCn_p
#define kCn_r aircraft_->kCn_r
#define kCn_da aircraft_->kCn_da
#define kCn_dr aircraft_->kCn_dr
#define Cno_clean aircraft_->Cno_clean
#define Cn_beta_clean aircraft_->Cn_beta_clean
#define Cn_p_clean aircraft_->Cn_p_clean
#define Cn_r_clean aircraft_->Cn_r_clean
#define Cn_da_clean aircraft_->Cn_da_clean
#define Cn_dr_clean aircraft_->Cn_dr_clean
/* Variables (token2) ===========================================*/
/* record ======== Record desired quantites to file =============*/
map <string,int> record_map;
#define record_map aircraft_->record_map
/***** Forces *******/
double F_X_wind, F_Y_wind, F_Z_wind;
#define F_X_wind aircraft_->F_X_wind
#define F_Y_wind aircraft_->F_Y_wind
#define F_Z_wind aircraft_->F_Z_wind
/* Miscellaneous ================================================*/
int conversion1, conversion2, conversion3;
double confac1, confac2, confac3;
#define conversion1 aircraft_->conversion1
#define conversion2 aircraft_->conversion2
#define conversion3 aircraft_->conversion3
#define confac1 aircraft_->confac1
#define confac2 aircraft_->confac2
#define confac3 aircraft_->confac3
ofstream fout;
#define fout aircraft_->fout
} AIRCRAFT;
// usually defined in the first program that includes uiuc_aircraft.h
extern AIRCRAFT *aircraft_;
#endif // endif _AIRCRAFT_H

View file

@ -0,0 +1,81 @@
/**********************************************************************
FILENAME: uiuc_aircraftdir.h
----------------------------------------------------------------------
DESCRIPTION: Stores the name of the aircraft directory to be used
----------------------------------------------------------------------
STATUS: alpha version
----------------------------------------------------------------------
REFERENCES:
----------------------------------------------------------------------
HISTORY: 02/22/2000 initial release
----------------------------------------------------------------------
AUTHOR(S): Bipin Sehgal <bsehgal@uiuc.edu>
----------------------------------------------------------------------
VARIABLES:
----------------------------------------------------------------------
INPUTS: *
----------------------------------------------------------------------
OUTPUTS: *
----------------------------------------------------------------------
CALLED BY: *
----------------------------------------------------------------------
CALLS TO: *
----------------------------------------------------------------------
COPYRIGHT: (C) 2000 by Michael Selig
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA or view http://www.gnu.org/copyleft/gpl.html.
**********************************************************************/
#ifndef _AIRCRAFTDIR_H_
#define _AIRCRAFTDIR_H_
#include <string>
typedef struct
{
string aircraft_dir;
#define aircraft_dir aircraftdir_->aircraft_dir
} AIRCRAFTDIR;
// usually defined in the first program that includes uiuc_aircraft.h
extern AIRCRAFTDIR *aircraftdir_;
#endif // endif _AIRCRAFTDIR_H

View file

@ -0,0 +1,631 @@
/**********************************************************************
FILENAME: uiuc_coefficients.cpp
----------------------------------------------------------------------
DESCRIPTION: computes aggregated aerodynamic coefficients
----------------------------------------------------------------------
STATUS: alpha version
----------------------------------------------------------------------
REFERENCES: Roskam, Jan. Airplane Flight Dynamics and Automatic
Flight Controls, Part I. Lawrence, KS: DARcorporation,
1995.
----------------------------------------------------------------------
HISTORY: 01/29/2000 initial release
02/01/2000 (JS) changed map name from aeroData to
aeroPart
02/18/2000 (JS) added calls to 1Dinterpolation
function from CLfa and CDfa switches
02/24/2000 added icing model functions
02/29/2000 (JS) added calls to 2Dinterpolation
function from CLfade, CDfade, Cmfade,
CYfada, CYfbetadr, Clfada, Clfbetadr,
Cnfada, and Cnfbetadr switches
----------------------------------------------------------------------
AUTHOR(S): Bipin Sehgal <bsehgal@uiuc.edu>
Jeff Scott <jscott@mail.com>
----------------------------------------------------------------------
VARIABLES:
----------------------------------------------------------------------
INPUTS: -Alpha
-aileron
-elevator
-rudder
-coefficient components
----------------------------------------------------------------------
OUTPUTS: -CL
-CD
-Cm
-CY
-Cl
-Cn
----------------------------------------------------------------------
CALLED BY: ?
----------------------------------------------------------------------
CALLS TO: uiuc_1Dinterpolation
uiuc_2Dinterpolation
uiuc_ice
----------------------------------------------------------------------
COPYRIGHT: (C) 2000 by Michael Selig
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA or view http://www.gnu.org/copyleft/gpl.html.
**********************************************************************/
#include "uiuc_coefficients.h"
/* set speed at which dynamic pressure terms will be accounted for
since if velocity is too small, coefficients will go to infinity */
#define ON_VELOCITY 33 /* 20 kts */
void uiuc_coefficients()
{
string linetoken1;
string linetoken2;
stack command_list;
double cbar_2U = 0, b_2U = 0;
double slope = 0;
bool ice_on = false;
// determine if speed is sufficient to compute dynamic pressure
if (U_body > ON_VELOCITY)
{
cbar_2U = cbar / (2.0 * U_body);
b_2U = bw / (2.0 * U_body);
}
else
{
cbar_2U = 0.0;
b_2U = 0.0;
}
//check to see if icing model engaged and set flag
if (Simtime >= iceTime)
{
ice_on = true;
}
// slowly increase icing severity over period of transientTime
if (Simtime >= iceTime && Simtime < (iceTime + transientTime))
{
slope = eta_final / transientTime;
eta = slope * (Simtime - iceTime);
}
else
{
eta = eta_final;
}
CL = CD = Cm = CY = Cl = Cn = 0.0;
command_list = aeroParts -> getCommands();
for (LIST command_line = command_list.begin(); command_line!=command_list.end(); ++command_line)
{
linetoken1 = aeroParts -> getToken(*command_line, 1); // function parameters gettoken(string,tokenNo);
linetoken2 = aeroParts -> getToken(*command_line, 2); // 2 represents token No 2
switch (Keyword_map[linetoken1])
{
case CD_flag:
{
switch(CD_map[linetoken2])
{
case CDo_flag:
{
if (ice_on == true)
{
CDo = uiuc_ice(CDo_clean,kCDo,eta);
}
CD += CDo;
break;
}
case CDK_flag:
{
if (ice_on == true)
{
CDK = uiuc_ice(CDK_clean,kCDK,eta);
}
CD += CDK * CL * CL;
break;
}
case CD_a_flag:
{
if (ice_on == true)
{
CD_a = uiuc_ice(CD_a_clean,kCD_a,eta);
}
CD += CD_a * Alpha;
break;
}
case CD_de_flag:
{
if (ice_on == true)
{
CD_de = uiuc_ice(CD_de_clean,kCD_de,eta);
}
CD += CD_de * elevator;
break;
}
case CDfa_flag:
{
CDfaI = uiuc_1Dinterpolation(CDfa_aArray,
CDfa_CDArray,
CDfa_nAlpha,
Alpha);
CD += CDfaI;
break;
}
case CDfade_flag:
{
CDfadeI = uiuc_2Dinterpolation(CDfade_aArray,
CDfade_deArray,
CDfade_CDArray,
CDfade_nAlphaArray,
CDfade_nde,
Alpha,
elevator);
CD += CDfadeI;
break;
}
};
break;
} // end CD map
case CL_flag:
{
switch(CL_map[linetoken2])
{
case CLo_flag:
{
if (ice_on == true)
{
CLo = uiuc_ice(CLo_clean,kCLo,eta);
}
CL += CLo;
break;
}
case CL_a_flag:
{
if (ice_on == true)
{
CL_a = uiuc_ice(CL_a_clean,kCL_a,eta);
}
CL += CL_a * Alpha;
break;
}
case CL_adot_flag:
{
if (ice_on == true)
{
CL_adot = uiuc_ice(CL_adot_clean,kCL_a,eta);
}
/* CL_adot must be mulitplied by cbar/2U
(see Roskam Control book, Part 1, pg. 147) */
CL += CL_adot * Alpha_dot * cbar_2U;
break;
}
case CL_q_flag:
{
if (ice_on == true)
{
CL_q = uiuc_ice(CL_q_clean,kCL_q,eta);
}
/* CL_q must be mulitplied by cbar/2U
(see Roskam Control book, Part 1, pg. 147) */
/* why multiply by Theta_dot instead of Q_body?
that is what is done in c172_aero.c; assume it
has something to do with axes systems */
CL += CL_q * Theta_dot * cbar_2U;
break;
}
case CL_de_flag:
{
if (ice_on == true)
{
CL_de = uiuc_ice(CL_de_clean,kCL_de,eta);
}
CL += CL_de * elevator;
break;
}
case CLfa_flag:
{
CLfaI = uiuc_1Dinterpolation(CLfa_aArray,
CLfa_CLArray,
CLfa_nAlpha,
Alpha);
CL += CLfaI;
break;
}
case CLfade_flag:
{
CLfadeI = uiuc_2Dinterpolation(CLfade_aArray,
CLfade_deArray,
CLfade_CLArray,
CLfade_nAlphaArray,
CLfade_nde,
Alpha,
elevator);
CL += CLfadeI;
break;
}
};
break;
} // end CL map
case Cm_flag:
{
switch(Cm_map[linetoken2])
{
case Cmo_flag:
{
if (ice_on == true)
{
Cmo = uiuc_ice(Cmo_clean,kCmo,eta);
}
Cm += Cmo;
break;
}
case Cm_a_flag:
{
if (ice_on == true)
{
Cm_a = uiuc_ice(Cm_a_clean,kCm_a,eta);
}
Cm += Cm_a * Alpha;
break;
}
case Cm_adot_flag:
{
if (ice_on == true)
{
Cm_adot = uiuc_ice(Cm_adot_clean,kCm_a,eta);
}
/* Cm_adot must be mulitplied by cbar/2U
(see Roskam Control book, Part 1, pg. 147) */
Cm += Cm_adot * Alpha_dot * cbar_2U;
break;
}
case Cm_q_flag:
{
if (ice_on == true)
{
Cm_q = uiuc_ice(Cm_q_clean,kCm_q,eta);
}
/* Cm_q must be mulitplied by cbar/2U
(see Roskam Control book, Part 1, pg. 147) */
Cm += Cm_q * Q_body * cbar_2U;
break;
}
case Cm_de_flag:
{
if (ice_on == true)
{
Cm_de = uiuc_ice(Cm_de_clean,kCm_de,eta);
}
Cm += Cm_de * elevator;
break;
}
case Cmfade_flag:
{
CmfadeI = uiuc_2Dinterpolation(Cmfade_aArray,
Cmfade_deArray,
Cmfade_CmArray,
Cmfade_nAlphaArray,
Cmfade_nde,
Alpha,
elevator);
Cm += CmfadeI;
break;
}
};
break;
} // end Cm map
case CY_flag:
{
switch(CY_map[linetoken2])
{
case CYo_flag:
{
if (ice_on == true)
{
CYo = uiuc_ice(CYo_clean,kCYo,eta);
}
CY += CYo;
break;
}
case CY_beta_flag:
{
if (ice_on == true)
{
CY_beta = uiuc_ice(CY_beta_clean,kCY_beta,eta);
}
CY += CY_beta * Beta;
break;
}
case CY_p_flag:
{
if (ice_on == true)
{
CY_p = uiuc_ice(CY_p_clean,kCY_p,eta);
}
/* CY_p must be mulitplied by b/2U
(see Roskam Control book, Part 1, pg. 147) */
CY += CY_p * P_body * b_2U;
break;
}
case CY_r_flag:
{
if (ice_on == true)
{
CY_r = uiuc_ice(CY_r_clean,kCY_r,eta);
}
/* CY_r must be mulitplied by b/2U
(see Roskam Control book, Part 1, pg. 147) */
CY += CY_r * R_body * b_2U;
break;
}
case CY_da_flag:
{
if (ice_on == true)
{
CY_da = uiuc_ice(CY_da_clean,kCY_da,eta);
}
CY += CY_da * aileron;
break;
}
case CY_dr_flag:
{
if (ice_on == true)
{
CY_dr = uiuc_ice(CY_dr_clean,kCY_dr,eta);
}
CY += CY_dr * rudder;
break;
}
case CYfada_flag:
{
CYfadaI = uiuc_2Dinterpolation(CYfada_aArray,
CYfada_daArray,
CYfada_CYArray,
CYfada_nAlphaArray,
CYfada_nda,
Alpha,
aileron);
CY += CYfadaI;
break;
}
case CYfbetadr_flag:
{
CYfbetadrI = uiuc_2Dinterpolation(CYfbetadr_betaArray,
CYfbetadr_drArray,
CYfbetadr_CYArray,
CYfbetadr_nBetaArray,
CYfbetadr_ndr,
Beta,
rudder);
CY += CYfbetadrI;
break;
}
};
break;
} // end CY map
case Cl_flag:
{
switch(Cl_map[linetoken2])
{
case Clo_flag:
{
if (ice_on == true)
{
Clo = uiuc_ice(Clo_clean,kClo,eta);
}
Cl += Clo;
break;
}
case Cl_beta_flag:
{
if (ice_on == true)
{
Cl_beta = uiuc_ice(Cl_beta_clean,kCl_beta,eta);
}
Cl += Cl_beta * Beta;
break;
}
case Cl_p_flag:
{
if (ice_on == true)
{
Cl_p = uiuc_ice(Cl_p_clean,kCl_p,eta);
}
/* Cl_p must be mulitplied by b/2U
(see Roskam Control book, Part 1, pg. 147) */
Cl += Cl_p * P_body * b_2U;
break;
}
case Cl_r_flag:
{
if (ice_on == true)
{
Cl_r = uiuc_ice(Cl_r_clean,kCl_r,eta);
}
/* Cl_r must be mulitplied by b/2U
(see Roskam Control book, Part 1, pg. 147) */
Cl += Cl_r * R_body * b_2U;
break;
}
case Cl_da_flag:
{
if (ice_on == true)
{
Cl_da = uiuc_ice(Cl_da_clean,kCl_da,eta);
}
Cl += Cl_da * aileron;
break;
}
case Cl_dr_flag:
{
if (ice_on == true)
{
Cl_dr = uiuc_ice(Cl_dr_clean,kCl_dr,eta);
}
Cl += Cl_dr * rudder;
break;
}
case Clfada_flag:
{
ClfadaI = uiuc_2Dinterpolation(Clfada_aArray,
Clfada_daArray,
Clfada_ClArray,
Clfada_nAlphaArray,
Clfada_nda,
Alpha,
aileron);
Cl += ClfadaI;
break;
}
case Clfbetadr_flag:
{
ClfbetadrI = uiuc_2Dinterpolation(Clfbetadr_betaArray,
Clfbetadr_drArray,
Clfbetadr_ClArray,
Clfbetadr_nBetaArray,
Clfbetadr_ndr,
Beta,
rudder);
Cl += ClfbetadrI;
break;
}
};
break;
} // end Cl map
case Cn_flag:
{
switch(Cn_map[linetoken2])
{
case Cno_flag:
{
if (ice_on == true)
{
Cno = uiuc_ice(Cno_clean,kCno,eta);
}
Cn += Cno;
break;
}
case Cn_beta_flag:
{
if (ice_on == true)
{
Cn_beta = uiuc_ice(Cn_beta_clean,kCn_beta,eta);
}
Cn += Cn_beta * Beta;
break;
}
case Cn_p_flag:
{
if (ice_on == true)
{
Cn_p = uiuc_ice(Cn_p_clean,kCn_p,eta);
}
/* Cn_p must be mulitplied by b/2U
(see Roskam Control book, Part 1, pg. 147) */
Cn += Cn_p * P_body * b_2U;
break;
}
case Cn_r_flag:
{
if (ice_on == true)
{
Cn_r = uiuc_ice(Cn_r_clean,kCn_r,eta);
}
/* Cn_r must be mulitplied by b/2U
(see Roskam Control book, Part 1, pg. 147) */
Cn += Cn_r * R_body * b_2U;
break;
}
case Cn_da_flag:
{
if (ice_on == true)
{
Cn_da = uiuc_ice(Cn_da_clean,kCn_da,eta);
}
Cn += Cn_da * aileron;
break;
}
case Cn_dr_flag:
{
if (ice_on == true)
{
Cn_dr = uiuc_ice(Cn_dr_clean,kCn_dr,eta);
}
Cn += Cn_dr * rudder;
break;
}
case Cnfada_flag:
{
CnfadaI = uiuc_2Dinterpolation(Cnfada_aArray,
Cnfada_daArray,
Cnfada_CnArray,
Cnfada_nAlphaArray,
Cnfada_nda,
Alpha,
aileron);
Cn += CnfadaI;
break;
}
case Cnfbetadr_flag:
{
CnfbetadrI = uiuc_2Dinterpolation(Cnfbetadr_betaArray,
Cnfbetadr_drArray,
Cnfbetadr_CnArray,
Cnfbetadr_nBetaArray,
Cnfbetadr_ndr,
Beta,
rudder);
Cn += CnfbetadrI;
break;
}
};
break;
} // end Cn map
};
} // end keyword map
return;
}
// end uiuc_coefficients.cpp

View file

@ -0,0 +1,11 @@
#include "uiuc_parsefile.h"
#include "uiuc_aircraft.h"
#include "uiuc_1Dinterpolation.h"
#include "uiuc_2Dinterpolation.h"
#include "uiuc_ice.h"
#include "../FDM/LaRCsim/ls_generic.h"
extern double Simtime;
void uiuc_coefficients();

View file

@ -0,0 +1,88 @@
/**********************************************************************
FILENAME: uiuc_convert.cpp
----------------------------------------------------------------------
DESCRIPTION: reads conversion type and sets conversion factors
----------------------------------------------------------------------
STATUS: alpha version
----------------------------------------------------------------------
REFERENCES:
----------------------------------------------------------------------
HISTORY: 02/22/2000 initial release
----------------------------------------------------------------------
AUTHOR(S): Jeff Scott <jscott@mail.com>
----------------------------------------------------------------------
VARIABLES:
----------------------------------------------------------------------
INPUTS: -coversion type
----------------------------------------------------------------------
OUTPUTS: -conversion factor
----------------------------------------------------------------------
CALLED BY: uiuc_menu.cpp
----------------------------------------------------------------------
CALLS TO: none
----------------------------------------------------------------------
COPYRIGHT: (C) 2000 by Michael Selig
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA or view http://www.gnu.org/copyleft/gpl.html.
**********************************************************************/
#include "uiuc_convert.h"
double uiuc_convert( int conversionType )
{
double factor;
switch(conversionType)
{
case 0:
{
factor = 1;
break;
}
case 1:
{
factor = DEG_TO_RAD;
break;
}
};
return factor;
}
// end uiuc_convert.cpp

View file

@ -0,0 +1,8 @@
#ifndef _CONVERT_H_
#define _CONVERT_H_
#include "../FDM/LaRCsim/ls_constants.h" /* uses RAD_TO_DEG, DEG_TO_RAD */
double uiuc_convert( int conversionType );
#endif // _CONVERT_H_

View file

@ -0,0 +1,121 @@
/**********************************************************************
FILENAME: uiuc_engine.cpp
----------------------------------------------------------------------
DESCRIPTION: determine the engine forces and moments
----------------------------------------------------------------------
STATUS: alpha version
----------------------------------------------------------------------
REFERENCES: based on portions of c172_engine.c, called from ls_model
----------------------------------------------------------------------
HISTORY: 01/30/2000 initial release
----------------------------------------------------------------------
AUTHOR(S): Bipin Sehgal <bsehgal@uiuc.edu>
Jeff Scott <jscott@mail.com>
Michael Selig <m-selig@uiuc.edu>
----------------------------------------------------------------------
VARIABLES:
----------------------------------------------------------------------
INPUTS: -engine model
----------------------------------------------------------------------
OUTPUTS: -F_X_engine
-F_Z_engine
-M_m_engine
----------------------------------------------------------------------
CALLED BY: uiuc_wrapper.cpp
----------------------------------------------------------------------
CALLS TO: none
----------------------------------------------------------------------
COPYRIGHT: (C) 2000 by Michael Selig
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA or view http://www.gnu.org/copyleft/gpl.html.
**********************************************************************/
#include "uiuc_engine.h"
void uiuc_engine()
{
stack command_list;
string linetoken1;
string linetoken2;
/* [] mss questions: why do this here ... and then undo it later?
... does Throttle[3] get modified? */
Throttle[3] = Throttle_pct;
command_list = engineParts -> getCommands();
if (command_list.begin() == command_list.end())
{
cerr << "ERROR: Engine not specified. Aircraft cannot fly without the engine" << endl;
exit(-1);
}
for (LIST command_line = command_list.begin(); command_line!=command_list.end(); ++command_line)
{
//cout << *command_line << endl;
linetoken1 = engineParts -> getToken(*command_line, 1); // function parameters gettoken(string,tokenNo);
linetoken2 = engineParts -> getToken(*command_line, 2); // 2 represents token No 2
switch(engine_map[linetoken2])
{
case simpleSingle_flag:
{
//c172 engine lines ... looks like 0.83 is just a thrust reduction
/* F_X_engine = Throttle[3]*350/0.83; */
/* F_Z_engine = Throttle[3]*4.9/0.83; */
/* M_m_engine = F_X_engine*0.734*cbar; */
F_X_engine = Throttle[3]*simpleSingleMaxThrust;
break;
}
case c172_flag:
{
F_X_engine = Throttle[3]*350/0.83;
F_Z_engine = Throttle[3]*4.9/0.83;
M_m_engine = F_X_engine*0.734*cbar;
break;
}
};
Throttle_pct = Throttle[3];
return;
}
}
// end uiuc_engine.cpp

View file

@ -0,0 +1,9 @@
#ifndef _ENGINE_H_
#define _ENGINE_H_
#include "uiuc_aircraft.h"
#include "../FDM/LaRCsim/ls_generic.h"
#include "../FDM/LaRCsim/ls_cockpit.h"
void uiuc_engine();
#endif // _ENGINE_H_

View file

@ -0,0 +1,82 @@
/**********************************************************************
FILENAME: uiuc_ice.cpp
----------------------------------------------------------------------
DESCRIPTION: reads in clean coefficient and icing severity
parameters and returns iced coefficient
----------------------------------------------------------------------
STATUS: alpha version
----------------------------------------------------------------------
REFERENCES:
----------------------------------------------------------------------
HISTORY: 02/22/2000 initial release
----------------------------------------------------------------------
AUTHOR(S): Jeff Scott <jscott@mail.com>
----------------------------------------------------------------------
VARIABLES:
------------------------------------------------string ----------------------
INPUTS: -clean aero coefficient
-icing parameter for that coefficient (kC)
-icing severity (eta)
----------------------------------------------------------------------
OUTPUTS: -iced aero coefficient
----------------------------------------------------------------------
CALLED BY: uiuc_coefficients.cpp
----------------------------------------------------------------------
CALLS TO: none
----------------------------------------------------------------------
COPYRIGHT: (C) 2000 by Michael Selig
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA or view http://www.gnu.org/copyleft/gpl.html.
**********************************************************************/
#include "uiuc_ice.h"
double uiuc_ice( double Ca_clean, double kCa, double eta_temp )
{
double Ca_iced = 0;
//cout << "Ice Model Engaged" << endl;
Ca_iced = Ca_clean * (1 + kCa * eta_temp);
return Ca_iced;
}
// end uiuc_ice.cpp

View file

@ -0,0 +1,6 @@
#ifndef _ICE_H_
#define _ICE_H_
double uiuc_ice( double Ca_clean, double kCa, double eta_temp );
#endif // _ICE_H_

View file

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

View file

@ -0,0 +1,15 @@
#ifndef _INITIALIZEMAPS_H_
#define _INITIALIZEMAPS_H_
#include "uiuc_aircraft.h"
void uiuc_initializemaps();
/* split this routine up into smaller chunks so it can be digested by
average machines */
void uiuc_initializemaps1();
void uiuc_initializemaps2();
void uiuc_initializemaps3();
void uiuc_initializemaps4();
#endif // _INITIALIZEMAPS_H_

View file

@ -0,0 +1,130 @@
/**********************************************************************
*
* FILENAME: uiuc_initializemaps1.cpp
*
* ----------------------------------------------------------------------
*
* DESCRIPTION: Initializes the maps for various keywords
*
* ----------------------------------------------------------------------
*
* STATUS: alpha version
*
* ----------------------------------------------------------------------
*
* REFERENCES:
*
* ----------------------------------------------------------------------
*
* HISTORY: 01/26/2000 initial release
*
* ----------------------------------------------------------------------
*
* AUTHOR(S): Bipin Sehgal <bsehgal@uiuc.edu>
*
* ----------------------------------------------------------------------
*
* VARIABLES:
*
* ----------------------------------------------------------------------
*
* INPUTS: *
*
* ----------------------------------------------------------------------
*
* OUTPUTS: *
*
* ----------------------------------------------------------------------
*
* CALLED BY: uiuc_wrapper.cpp
*
* ----------------------------------------------------------------------
*
* CALLS TO: *
*
* ----------------------------------------------------------------------
*
* COPYRIGHT: (C) 2000 by Michael Selig
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA or view http://www.gnu.org/copyleft/gpl.html.
*
***********************************************************************/
#include "uiuc_initializemaps.h"
void uiuc_initializemaps1 ()
{
Keyword_map["init"] = init_flag;
Keyword_map["geometry"] = geometry_flag;
Keyword_map["controlSurface"] = controlSurface_flag;
Keyword_map["mass"] = mass_flag;
Keyword_map["engine"] = engine_flag;
Keyword_map["CD"] = CD_flag;
Keyword_map["CL"] = CL_flag;
Keyword_map["Cm"] = Cm_flag;
Keyword_map["CY"] = CY_flag;
Keyword_map["Cl"] = Cl_flag;
Keyword_map["Cn"] = Cn_flag;
Keyword_map["gear"] = gear_flag;
Keyword_map["ice"] = ice_flag;
Keyword_map["record"] = record_flag;
init_map["Dx_pilot"] = Dx_pilot_flag;
init_map["Dy_pilot"] = Dy_pilot_flag;
init_map["Dz_pilot"] = Dz_pilot_flag;
init_map["V_north"] = V_north_flag;
init_map["V_east"] = V_east_flag;
init_map["V_down"] = V_down_flag;
init_map["P_body"] = P_body_flag;
init_map["Q_body"] = Q_body_flag;
init_map["R_body"] = R_body_flag;
init_map["Phi"] = Phi_flag;
init_map["Theta"] = Theta_flag;
init_map["Psi"] = Psi_flag;
geometry_map["bw"] = bw_flag;
geometry_map["cbar"] = cbar_flag;
geometry_map["Sw"] = Sw_flag;
controlSurface_map["de"] = de_flag;
controlSurface_map["da"] = da_flag;
controlSurface_map["dr"] = dr_flag;
mass_map["Mass"] = Mass_flag;
mass_map["I_xx"] = I_xx_flag;
mass_map["I_yy"] = I_yy_flag;
mass_map["I_zz"] = I_zz_flag;
mass_map["I_xz"] = I_xz_flag;
engine_map["simpleSingle"] = simpleSingle_flag;
engine_map["c172"] = c172_flag;
CD_map["CDo"] = CDo_flag;
CD_map["CDK"] = CDK_flag;
CD_map["CD_a"] = CD_a_flag;
CD_map["CD_de"] = CD_de_flag;
CD_map["CDfa"] = CDfa_flag;
CD_map["CDfade"] = CDfade_flag;
}
// end uiuc_initializemaps.cpp

View file

@ -0,0 +1,116 @@
/**********************************************************************
*
* FILENAME: uiuc_initializemaps.cpp
*
* ----------------------------------------------------------------------
*
* DESCRIPTION: Initializes the maps for various keywords
*
* ----------------------------------------------------------------------
*
* STATUS: alpha version
*
* ----------------------------------------------------------------------
*
* REFERENCES:
*
* ----------------------------------------------------------------------
*
* HISTORY: 01/26/2000 initial release
*
* ----------------------------------------------------------------------
*
* AUTHOR(S): Bipin Sehgal <bsehgal@uiuc.edu>
*
* ----------------------------------------------------------------------
*
* VARIABLES:
*
* ----------------------------------------------------------------------
*
* INPUTS: *
*
* ----------------------------------------------------------------------
*
* OUTPUTS: *
*
* ----------------------------------------------------------------------
*
* CALLED BY: uiuc_wrapper.cpp
*
* ----------------------------------------------------------------------
*
* CALLS TO: *
*
* ----------------------------------------------------------------------
*
* COPYRIGHT: (C) 2000 by Michael Selig
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA or view http://www.gnu.org/copyleft/gpl.html.
*
***********************************************************************/
#include "uiuc_initializemaps.h"
void uiuc_initializemaps2 ()
{
CL_map["CLo"] = CLo_flag;
CL_map["CL_a"] = CL_a_flag;
CL_map["CL_adot"] = CL_adot_flag;
CL_map["CL_q"] = CL_q_flag;
CL_map["CL_de"] = CL_de_flag;
CL_map["CLfa"] = CLfa_flag;
CL_map["CLfade"] = CLfade_flag;
Cm_map["Cmo"] = Cmo_flag;
Cm_map["Cm_a"] = Cm_a_flag;
Cm_map["Cm_adot"] = Cm_adot_flag;
Cm_map["Cm_q"] = Cm_q_flag;
Cm_map["Cm_de"] = Cm_de_flag;
Cm_map["Cmfade"] = Cmfade_flag;
CY_map["CYo"] = CYo_flag;
CY_map["CY_beta"] = CY_beta_flag;
CY_map["CY_p"] = CY_p_flag;
CY_map["CY_r"] = CY_r_flag;
CY_map["CY_da"] = CY_da_flag;
CY_map["CY_dr"] = CY_dr_flag;
CY_map["CYfada"] = CYfada_flag;
CY_map["CYfbetadr"] = CYfbetadr_flag;
Cl_map["Clo"] = Clo_flag;
Cl_map["Cl_beta"] = Cl_beta_flag;
Cl_map["Cl_p"] = Cl_p_flag;
Cl_map["Cl_r"] = Cl_r_flag;
Cl_map["Cl_da"] = Cl_da_flag;
Cl_map["Cl_dr"] = Cl_dr_flag;
Cl_map["Clfada"] = Clfada_flag;
Cl_map["Clfbetadr"] = Clfbetadr_flag;
Cn_map["Cno"] = Cno_flag;
Cn_map["Cn_beta"] = Cn_beta_flag;
Cn_map["Cn_p"] = Cn_p_flag;
Cn_map["Cn_r"] = Cn_r_flag;
Cn_map["Cn_da"] = Cn_da_flag;
Cn_map["Cn_dr"] = Cn_dr_flag;
Cn_map["Cnfada"] = Cnfada_flag;
Cn_map["Cnfbetadr"] = Cnfbetadr_flag;
}
// end uiuc_initializemaps.cpp

View file

@ -0,0 +1,107 @@
/**********************************************************************
*
* FILENAME: uiuc_initializemaps.cpp
*
* ----------------------------------------------------------------------
*
* DESCRIPTION: Initializes the maps for various keywords
*
* ----------------------------------------------------------------------
*
* STATUS: alpha version
*
* ----------------------------------------------------------------------
*
* REFERENCES:
*
* ----------------------------------------------------------------------
*
* HISTORY: 01/26/2000 initial release
*
* ----------------------------------------------------------------------
*
* AUTHOR(S): Bipin Sehgal <bsehgal@uiuc.edu>
*
* ----------------------------------------------------------------------
*
* VARIABLES:
*
* ----------------------------------------------------------------------
*
* INPUTS: *
*
* ----------------------------------------------------------------------
*
* OUTPUTS: *
*
* ----------------------------------------------------------------------
*
* CALLED BY: uiuc_wrapper.cpp
*
* ----------------------------------------------------------------------
*
* CALLS TO: *
*
* ----------------------------------------------------------------------
*
* COPYRIGHT: (C) 2000 by Michael Selig
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA or view http://www.gnu.org/copyleft/gpl.html.
*
***********************************************************************/
#include "uiuc_initializemaps.h"
void uiuc_initializemaps3 ()
{
ice_map["iceTime"] = iceTime_flag;
ice_map["transientTime"] = transientTime_flag;
ice_map["eta_final"] = eta_final_flag;
ice_map["kCDo"] = kCDo_flag;
ice_map["kCDK"] = kCDK_flag;
ice_map["kCD_a"] = kCD_a_flag;
ice_map["kCD_de"] = kCD_de_flag;
ice_map["kCLo"] = kCLo_flag;
ice_map["kCL_a"] = kCL_a_flag;
ice_map["kCL_adot"] = kCL_adot_flag;
ice_map["kCL_q"] = kCL_q_flag;
ice_map["kCL_de"] = kCL_de_flag;
ice_map["kCmo"] = kCmo_flag;
ice_map["kCm_a"] = kCm_a_flag;
ice_map["kCm_adot"] = kCm_adot_flag;
ice_map["kCm_q"] = kCm_q_flag;
ice_map["kCm_de"] = kCm_de_flag;
ice_map["kCYo"] = kCYo_flag;
ice_map["kCY_beta"] = kCY_beta_flag;
ice_map["kCY_p"] = kCY_p_flag;
ice_map["kCY_r"] = kCY_r_flag;
ice_map["kCY_da"] = kCY_da_flag;
ice_map["kCY_dr"] = kCY_dr_flag;
ice_map["kClo"] = kClo_flag;
ice_map["kCl_beta"] = kCl_beta_flag;
ice_map["kCl_p"] = kCl_p_flag;
ice_map["kCl_r"] = kCl_r_flag;
ice_map["kCl_da"] = kCl_da_flag;
ice_map["kCl_dr"] = kCl_dr_flag;
ice_map["kCno"] = kCno_flag;
ice_map["kCn_beta"] = kCn_beta_flag;
ice_map["kCn_p"] = kCn_p_flag;
ice_map["kCn_r"] = kCn_r_flag;
ice_map["kCn_da"] = kCn_da_flag;
ice_map["kCn_dr"] = kCn_dr_flag;
}
// end uiuc_initializemaps.cpp

View file

@ -0,0 +1,143 @@
/**********************************************************************
*
* FILENAME: uiuc_initializemaps.cpp
*
* ----------------------------------------------------------------------
*
* DESCRIPTION: Initializes the maps for various keywords
*
* ----------------------------------------------------------------------
*
* STATUS: alpha version
*
* ----------------------------------------------------------------------
*
* REFERENCES:
*
* ----------------------------------------------------------------------
*
* HISTORY: 01/26/2000 initial release
*
* ----------------------------------------------------------------------
*
* AUTHOR(S): Bipin Sehgal <bsehgal@uiuc.edu>
*
* ----------------------------------------------------------------------
*
* VARIABLES:
*
* ----------------------------------------------------------------------
*
* INPUTS: *
*
* ----------------------------------------------------------------------
*
* OUTPUTS: *
*
* ----------------------------------------------------------------------
*
* CALLED BY: uiuc_wrapper.cpp
*
* ----------------------------------------------------------------------
*
* CALLS TO: *
*
* ----------------------------------------------------------------------
*
* COPYRIGHT: (C) 2000 by Michael Selig
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA or view http://www.gnu.org/copyleft/gpl.html.
*
***********************************************************************/
#include "uiuc_initializemaps.h"
void uiuc_initializemaps4 ()
{
record_map["Dx_pilot"] = Dx_pilot_record ;
record_map["Dy_pilot"] = Dy_pilot_record ;
record_map["Dz_pilot"] = Dz_pilot_record ;
record_map["V_north"] = V_north_record ;
record_map["V_east"] = V_east_record ;
record_map["V_down"] = V_down_record ;
record_map["V_rel_wind"] = V_rel_wind_record ;
record_map["Dynamic_pressure"] = Dynamic_pressure_record ;
record_map["Alpha"] = Alpha_record ;
record_map["Alpha_dot"] = Alpha_dot_record ;
record_map["Beta"] = Beta_record ;
record_map["Beta_dot"] = Beta_dot_record ;
record_map["Gamma"] = Gamma_record ;
record_map["P_body"] = P_body_record ;
record_map["Q_body"] = Q_body_record ;
record_map["R_body"] = R_body_record ;
record_map["Phi"] = Phi_record ;
record_map["Theta"] = Theta_record ;
record_map["Psi"] = Psi_record ;
record_map["Theta_dot"] = Theta_dot_record ;
record_map["density"] = density_record ;
record_map["Mass"] = Mass_record ;
record_map["Simtime"] = Simtime_record ;
record_map["dt"] = dt_record ;
record_map["elevator"] = elevator_record ;
record_map["aileron"] = aileron_record ;
record_map["rudder"] = rudder_record ;
record_map["CD"] = CD_record ;
record_map["CDfaI"] = CDfaI_record ;
record_map["CDfadeI"] = CDfadeI_record ;
record_map["CL"] = CL_record ;
record_map["CLfaI"] = CLfaI_record ;
record_map["CLfadeI"] = CLfadeI_record ;
record_map["Cm"] = Cm_record ;
record_map["CmfadeI"] = CmfadeI_record ;
record_map["CY"] = CY_record ;
record_map["CYfadaI"] = CYfadaI_record ;
record_map["CYfbetadrI"] = CYfbetadrI_record ;
record_map["Cl"] = Cl_record ;
record_map["ClfadaI"] = ClfadaI_record ;
record_map["ClfbetadrI"] = ClfbetadrI_record ;
record_map["Cn"] = Cn_record ;
record_map["CnfadaI"] = CnfadaI_record ;
record_map["CnfbetadrI"] = CnfbetadrI_record ;
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 ;
record_map["F_X_aero"] = F_X_aero_record ;
record_map["F_Y_aero"] = F_Y_aero_record ;
record_map["F_Z_aero"] = F_Z_aero_record ;
record_map["F_X_engine"] = F_X_engine_record ;
record_map["F_Y_engine"] = F_Y_engine_record ;
record_map["F_Z_engine"] = F_Z_engine_record ;
record_map["F_X_gear"] = F_X_gear_record ;
record_map["F_Y_gear"] = F_Y_gear_record ;
record_map["F_Z_gear"] = F_Z_gear_record ;
record_map["F_X"] = F_X_record ;
record_map["F_Y"] = F_Y_record ;
record_map["F_Z"] = F_Z_record ;
record_map["M_l_aero"] = M_l_aero_record ;
record_map["M_m_aero"] = M_m_aero_record ;
record_map["M_n_aero"] = M_n_aero_record ;
record_map["M_l_engine"] = M_l_engine_record ;
record_map["M_m_engine"] = M_m_engine_record ;
record_map["M_n_engine"] = M_n_engine_record ;
record_map["M_l_gear"] = M_l_gear_record ;
record_map["M_m_gear"] = M_m_gear_record ;
record_map["M_n_gear"] = M_n_gear_record ;
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 ;
}
// end uiuc_initializemaps.cpp

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,17 @@
#ifndef _MENU_H_
#define _MENU_H_
#include "uiuc_aircraft.h"
#include "uiuc_convert.h"
#include "uiuc_parsefile.h"
#include "uiuc_warnings_errors.h"
#include "uiuc_initializemaps.h"
#include "uiuc_1DdataFileReader.h"
#include "uiuc_2DdataFileReader.h"
#include "../FDM/LaRCsim/ls_generic.h"
bool check_float(string &token); // To check whether the token is a float or not
void uiuc_menu (string aircraft);
#endif //_MENU_H_

View file

@ -0,0 +1,159 @@
/**********************************************************************
FILENAME: uiuc_parsefile.cpp
----------------------------------------------------------------------
DESCRIPTION: Reads the input file and stores data in a list
gets tokens from each line of the list
----------------------------------------------------------------------
STATUS: alpha version
----------------------------------------------------------------------
REFERENCES:
----------------------------------------------------------------------
HISTORY: 01/30/2000 initial release
----------------------------------------------------------------------
AUTHOR(S): Bipin Sehgal <bsehgal@uiuc.edu>
----------------------------------------------------------------------
VARIABLES:
----------------------------------------------------------------------
INPUTS: *
----------------------------------------------------------------------
OUTPUTS: *
----------------------------------------------------------------------
CALLED BY: *
----------------------------------------------------------------------
CALLS TO: *
----------------------------------------------------------------------
COPYRIGHT: (C) 2000 by Michael Selig
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA or view http://www.gnu.org/copyleft/gpl.html.
**********************************************************************/
#include "uiuc_parsefile.h"
ParseFile :: ParseFile (const string fileName)
{
file.open(fileName.c_str());
readFile();
}
ParseFile :: ~ParseFile ()
{
file.close();
}
void ParseFile :: removeComments(string& inputLine)
{
int pos = inputLine.find_first_of(COMMENT);
if (pos != inputLine.npos) // a "#" exists in the line
{
if (inputLine.find_first_not_of(DELIMITERS) == pos)
inputLine = ""; // Complete line a comment
else
inputLine = inputLine.substr(0,pos); //Truncate the comment from the line
}
}
string ParseFile :: getToken(string inputLine, int tokenNo)
{
int pos = 0;
int pos1 = 0;
int tokencounter = 0;
while (tokencounter < tokenNo)
{
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);
pos = inputLine.find_first_not_of(DELIMITERS);
pos1 = inputLine.find_first_of(DELIMITERS , pos);
tokencounter ++;
}
if (pos1== -1 || pos == -1)
return "";
else
return inputLine.substr(pos , pos1-pos); // return the desired token
}
void ParseFile :: storeCommands(string inputLine)
{
int pos;
int pos1;
int wordlength;
string line;
inputLine += " "; // To take care of the case when last character is not a blank
pos = inputLine.find_first_not_of(DELIMITERS);
pos1 = inputLine.find_first_of(DELIMITERS);
while ((pos != inputLine.npos) && (pos1 != inputLine.npos))
{
line += inputLine.substr(pos , pos1 - pos)+ " ";
inputLine = inputLine.substr(pos1, inputLine.size()- (pos1 - pos));
pos = inputLine.find_first_not_of(DELIMITERS);
pos1 = inputLine.find_first_of(DELIMITERS , pos);
}
line += inputLine; // Add the last word to the line
commands.push_back(line);
}
void ParseFile :: readFile()
{
string line;
while (getline(file , line))
{
removeComments(line);
if (line.find_first_not_of(DELIMITERS) != line.npos) // strip off blank lines
storeCommands(line);
}
}
stack ParseFile :: getCommands()
{
return commands;
}
//end uiuc_parsefile.cpp

View file

@ -0,0 +1,36 @@
#ifndef _PARSE_FILE_H_
#define _PARSE_FILE_H_
#include <string>
#include <list>
#include <fstream>
#define DELIMITERS " \t"
#define COMMENT "#"
#define MAXLINE 200 // Max size of the line of the input file
typedef list<string> stack; //list to contain the input file "command_lines"
class ParseFile
{
private:
stack commands;
ifstream file;
void readFile();
public:
ParseFile() {}
ParseFile(const string fileName);
~ParseFile();
void removeComments(string& inputLine);
string getToken(string inputLine, int tokenNo);
void storeCommands(string inputLine);
stack getCommands();
};
#endif // _PARSE_FILE_H_

View file

@ -0,0 +1,452 @@
/**********************************************************************
FILENAME: uiuc_recorder.cpp
----------------------------------------------------------------------
DESCRIPTION: outputs variables specified in input file to recorder
file
----------------------------------------------------------------------
STATUS: alpha version
----------------------------------------------------------------------
REFERENCES: Liberty, Jesse. "Sam's Teach Yourself C++ in 21 Days,"
3rd ed., 1999.
----------------------------------------------------------------------
HISTORY: 01/31/2000 initial release
03/02/2000 (JS) added record options for 1D and 2D
interpolated variables
----------------------------------------------------------------------
AUTHOR(S): Jeff Scott <jscott@mail.com>
----------------------------------------------------------------------
VARIABLES:
----------------------------------------------------------------------
INPUTS: n/a
----------------------------------------------------------------------
OUTPUTS: -variables recorded in uiuc_recorder.dat
----------------------------------------------------------------------
CALLED BY: uiuc_wrapper.cpp
----------------------------------------------------------------------
CALLS TO: none
----------------------------------------------------------------------
COPYRIGHT: (C) 2000 by Michael Selig
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA or view http://www.gnu.org/copyleft/gpl.html.
**********************************************************************/
#include "uiuc_recorder.h"
void uiuc_recorder(double dt )
{
stack command_list;
string linetoken;
static int init = 0;
string record_variables = "# ";
command_list = recordParts->getCommands();
fout << endl;
for (LIST command_line = command_list.begin(); command_line!=command_list.end(); ++command_line)
record_variables += recordParts->getToken(*command_line,2) + " ";
fout << record_variables << endl;
for (LIST command_line = command_list.begin(); command_line!=command_list.end(); ++command_line)
{
linetoken = recordParts->getToken(*command_line, 2);
switch(record_map[linetoken])
{
case Dx_pilot_record:
{
fout << Dx_pilot << " ";
break;
}
case Dy_pilot_record:
{
fout << Dy_pilot << " ";
break;
}
case Dz_pilot_record:
{
fout << Dz_pilot << " ";
break;
}
case V_north_record:
{
fout << V_north << " ";
break;
}
case V_east_record:
{
fout << V_east << " ";
break;
}
case V_down_record:
{
fout << V_down << " ";
break;
}
case V_rel_wind_record:
{
fout << V_rel_wind << " ";
break;
}
case Dynamic_pressure_record:
{
fout << Dynamic_pressure << " ";
break;
}
case Alpha_record:
{
fout << Alpha << " ";
break;
}
case Alpha_dot_record:
{
fout << Alpha_dot << " ";
break;
}
case Beta_record:
{
fout << Beta << " ";
break;
}
case Beta_dot_record:
{
fout << Beta_dot << " ";
break;
}
case Gamma_record:
{
// fout << Gamma << " ";
break;
}
case P_body_record:
{
fout << P_body << " ";
break;
}
case Q_body_record:
{
fout << Q_body << " ";
break;
}
case R_body_record:
{
fout << R_body << " ";
break;
}
case Phi_record:
{
fout << Phi << " ";
break;
}
case Theta_record:
{
fout << Theta << " ";
break;
}
case Psi_record:
{
fout << Psi << " ";
break;
}
case Theta_dot_record:
{
fout << Theta_dot << " ";
break;
}
case density_record:
{
fout << Density << " ";
break;
}
case Mass_record:
{
fout << Mass << " ";
break;
}
case Simtime_record:
{
fout << Simtime << " ";
break;
}
case dt_record:
{
fout << dt << " ";
break;
}
case elevator_record:
{
fout << elevator << " ";
break;
}
case aileron_record:
{
fout << aileron << " ";
break;
}
case rudder_record:
{
fout << rudder << " ";
break;
}
case CD_record:
{
fout << CD << " ";
break;
}
case CDfaI_record:
{
fout << CDfaI << " ";
break;
}
case CDfadeI_record:
{
fout << CDfadeI << " ";
break;
}
case CL_record:
{
fout << CL << " ";
break;
}
case CLfaI_record:
{
fout << CLfaI << " ";
break;
}
case CLfadeI_record:
{
fout << CLfadeI << " ";
break;
}
case Cm_record:
{
fout << Cm << " ";
break;
}
case CmfadeI_record:
{
fout << CmfadeI << " ";
break;
}
case CY_record:
{
fout << CY << " ";
break;
}
case CYfadaI_record:
{
fout << CYfadaI << " ";
break;
}
case CYfbetadrI_record:
{
fout << CYfbetadrI << " ";
break;
}
case Cl_record:
{
fout << Cl << " ";
break;
}
case ClfadaI_record:
{
fout << ClfadaI << " ";
break;
}
case ClfbetadrI_record:
{
fout << ClfbetadrI << " ";
break;
}
case Cn_record:
{
fout << Cn << " ";
break;
}
case CnfadaI_record:
{
fout << CnfadaI << " ";
break;
}
case CnfbetadrI_record:
{
fout << CnfbetadrI << " ";
break;
}
case F_X_wind_record:
{
fout << F_X_wind << " ";
break;
}
case F_Y_wind_record:
{
fout << F_Y_wind << " ";
break;
}
case F_Z_wind_record:
{
fout << F_Z_wind << " ";
break;
}
case F_X_aero_record:
{
fout << F_X_aero << " ";
break;
}
case F_Y_aero_record:
{
fout << F_Y_aero << " ";
break;
}
case F_Z_aero_record:
{
fout << F_Z_aero << " ";
break;
}
case F_X_engine_record:
{
fout << F_X_engine << " ";
break;
}
case F_Y_engine_record:
{
fout << F_Y_engine << " ";
break;
}
case F_Z_engine_record:
{
fout << F_Z_engine << " ";
break;
}
case F_X_gear_record:
{
fout << F_X_gear << " ";
break;
}
case F_Y_gear_record:
{
fout << F_Y_gear << " ";
break;
}
case F_Z_gear_record:
{
fout << F_Z_gear << " ";
break;
}
case F_X_record:
{
fout << F_X << " ";
break;
}
case F_Y_record:
{
fout << F_Y << " ";
break;
}
case F_Z_record:
{
fout << F_Z << " ";
break;
}
case M_l_aero_record:
{
fout << M_l_aero << " ";
break;
}
case M_m_aero_record:
{
fout << M_m_aero << " ";
break;
}
case M_n_aero_record:
{
fout << M_n_aero << " ";
break;
}
case M_l_engine_record:
{
fout << M_l_engine << " ";
break;
}
case M_m_engine_record:
{
fout << M_m_engine << " ";
break;
}
case M_n_engine_record:
{
fout << M_n_engine << " ";
break;
}
case M_l_gear_record:
{
fout << M_l_gear << " ";
break;
}
case M_m_gear_record:
{
fout << M_m_gear << " ";
break;
}
case M_n_gear_record:
{
fout << M_n_gear << " ";
break;
}
case M_l_rp_record:
{
fout << M_l_rp << " ";
break;
}
case M_m_rp_record:
{
fout << M_m_rp << " ";
break;
}
case M_n_rp_record:
{
fout << M_n_rp << " ";
break;
}
};
} // end record map
}
// end uiuc_recorder.cpp

View file

@ -0,0 +1,13 @@
#ifndef _RECORDER_H
#define _RECORDER_H
#include "uiuc_parsefile.h"
#include "uiuc_aircraft.h"
#include "../FDM/LaRCsim/ls_generic.h"
extern double Simtime;
void uiuc_recorder(double dt );
#endif //_RECORDER_H

View file

@ -0,0 +1,94 @@
/**********************************************************************
FILENAME: uiuc_warnings_errors.cpp
----------------------------------------------------------------------
DESCRIPTION:
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.
----------------------------------------------------------------------
STATUS: alpha version
----------------------------------------------------------------------
REFERENCES: based on "menu reader" format of Michael Selig
----------------------------------------------------------------------
HISTORY: 01/29/2000 initial release
----------------------------------------------------------------------
AUTHOR(S): Bipin Sehgal <bsehgal@uiuc.edu>
Jeff Scott <jscott@mail.com>
Michael Selig <m-selig@uiuc.edu>
----------------------------------------------------------------------
VARIABLES:
----------------------------------------------------------------------
INPUTS: -error code
-input line
----------------------------------------------------------------------
OUTPUTS: -warning/error message to screen
----------------------------------------------------------------------
CALLED BY: uiuc_menu.cpp
----------------------------------------------------------------------
CALLS TO: none
----------------------------------------------------------------------
COPYRIGHT: (C) 2000 by Michael Selig
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA or view http://www.gnu.org/copyleft/gpl.html.
**********************************************************************/
#include "uiuc_warnings_errors.h"
void uiuc_warnings_errors(int errorCode, string line)
{
switch (errorCode)
{
case 1:
cerr << "UIUC ERROR: The value of the coefficient in \"" << line << "\" should be of type float" << endl;
exit(-1);
break;
case 2:
cerr << "UIUC ERROR: Unknown identifier in \"" << line << "\"" << endl;
exit(-1);
break;
}
}
// end uiuc_warnings_errors.cpp

View file

@ -0,0 +1,9 @@
#ifndef _WARNINGS_ERRORS_H_
#define _WARNINGS_ERRORS_H_
#include <string>
#include <iostream>
void uiuc_warnings_errors(int errorCode, string line);
#endif //_WARNINGS_ERRORS_H_

View file

@ -0,0 +1,129 @@
/**********************************************************************
*
* FILENAME: uiuc_wrapper.cpp
*
* ----------------------------------------------------------------------
*
* DESCRIPTION: A wrapper(interface) between the UIUC Aeromodel (C++ files)
* and the LaRCsim FDM (C files)
*
* ----------------------------------------------------------------------
*
* STATUS: alpha version
*
* ----------------------------------------------------------------------
*
* REFERENCES:
*
* ----------------------------------------------------------------------
*
* HISTORY: 01/26/2000 initial release
*
* ----------------------------------------------------------------------
*
* AUTHOR(S): Bipin Sehgal <bsehgal@uiuc.edu>
*
* ----------------------------------------------------------------------
*
* VARIABLES:
*
* ----------------------------------------------------------------------
*
* INPUTS: *
*
* ----------------------------------------------------------------------
*
* OUTPUTS: *
*
* ----------------------------------------------------------------------
*
* CALLED BY: *
*
* ----------------------------------------------------------------------
*
* CALLS TO: *
*
* ----------------------------------------------------------------------
*
* COPYRIGHT: (C) 2000 by Michael Selig
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA or view http://www.gnu.org/copyleft/gpl.html.
*
***********************************************************************/
#include "uiuc_aircraft.h"
#include "uiuc_aircraftdir.h"
#include "uiuc_coefficients.h"
#include "uiuc_engine.h"
#include "uiuc_aerodeflections.h"
#include "uiuc_recorder.h"
#include "uiuc_menu.h"
#include "../LaRCsim/ls_generic.h"
extern "C" void uiuc_init_aeromodel ();
extern "C" void uiuc_force_moment(double dt);
extern "C" void uiuc_engine_routine();
AIRCRAFT *aircraft_;
AIRCRAFTDIR *aircraftdir_;
void uiuc_init_aeromodel ()
{
string aircraft;
if (aircraft_dir != "")
aircraft = aircraft_dir + "/";
aircraft += "aircraft.dat";
cout << "We are using "<< aircraft << endl;
uiuc_initializemaps(); // Initialize the <string,int> maps
uiuc_menu(aircraft); // Read the specified aircraft file
}
void uiuc_force_moment(double dt)
{
double qS = Dynamic_pressure * Sw;
double qScbar = qS * cbar;
double qSb = qS * bw;
uiuc_aerodeflections();
uiuc_coefficients();
/* Calculate the wind axis forces */
F_X_wind = -1 * CD * qS;
F_Y_wind = CY * qS;
F_Z_wind = -1 * CL * qS;
/* wind-axis to body-axis transformation */
F_X_aero = F_X_wind * Cos_alpha * Cos_beta - F_Y_wind * Cos_alpha * Sin_beta - F_Z_wind * Sin_alpha;
F_Y_aero = F_X_wind * Sin_beta + F_Y_wind * Cos_beta;
F_Z_aero = F_X_wind * Sin_alpha * Cos_beta - F_Y_wind * Sin_alpha * Sin_beta + F_Z_wind * Cos_alpha;
/* Moment calculations */
M_l_aero = Cl * qSb;
M_m_aero = Cm * qScbar;
M_n_aero = Cn * qSb;
uiuc_recorder(dt);
}
void uiuc_engine_routine()
{
uiuc_engine();
}
//end uiuc_wrapper.cpp

View file

@ -0,0 +1,4 @@
void uiuc_init_aeromodel ();
void uiuc_force_moment(double dt);
void uiuc_engine_routine();

View file

@ -54,6 +54,7 @@ fgfs_LDADD = \
$(top_builddir)/src/FDM/Balloon/libBalloon.a \
$(top_builddir)/src/FDM/JSBsim/libJSBsim.a \
$(top_builddir)/src/FDM/LaRCsim/libLaRCsim.a \
$(top_builddir)/src/FDM/UIUCModel/libUIUCModel.a \
$(top_builddir)/src/GUI/libGUI.a \
$(top_builddir)/src/Scenery/libScenery.a \
$(top_builddir)/src/Airports/libAirports.a \

View file

@ -79,6 +79,8 @@
#include <Autopilot/autopilot.hxx>
#include <Cockpit/cockpit.hxx>
#include <Cockpit/steam.hxx>
#include <FDM/UIUCModel/uiuc_aircraft.h>
#include <FDM/UIUCModel/uiuc_aircraftdir.h>
#include <GUI/gui.h>
#include <Joystick/joystick.hxx>
#ifdef FG_NETWORK_OLK
@ -1294,6 +1296,10 @@ int main( int argc, char **argv ) {
// seed the random number generater
fg_srandom();
// AIRCRAFTDIR defined in uiuc_aircraftdir.h
aircraft_ = new AIRCRAFT;
aircraftdir_ = new AIRCRAFTDIR;
// Load the configuration parameters
if ( !fgInitConfig(argc, argv) ) {
FG_LOG( FG_GENERAL, FG_ALERT, "Config option parsing failed ..." );

View file

@ -45,6 +45,7 @@ bool global_fullscreen = true;
#include <Include/general.hxx>
#include <Cockpit/cockpit.hxx>
#include <FDM/flight.hxx>
#include <FDM/UIUCModel/uiuc_aircraftdir.h>
#ifdef FG_NETWORK_OLK
# include <NetworkOLK/network.h>
#endif
@ -194,6 +195,8 @@ fgOPTIONS::fgOPTIONS() :
network_olk(false)
{
aircraft_dir=""; // Initialize the Aircraft directory to "" (UIUC)
// set initial values/defaults
time_offset_type=FG_TIME_SYS_OFFSET;
char* envp = ::getenv( "FG_ROOT" );
@ -658,6 +661,8 @@ int fgOPTIONS::parse_option( const string& arg ) {
flight_model = parse_fdm( arg.substr(6) );
} else if ( arg.find( "--aircraft=" ) != string::npos ) {
aircraft = arg.substr(11);
} else if ( arg.find( "--aircraft-dir=" ) != string::npos ) {
aircraft_dir = arg.substr(15); // (UIUC)
} else if ( arg.find( "--model-hz=" ) != string::npos ) {
model_hz = atoi( arg.substr(11) );
} else if ( arg.find( "--speed=" ) != string::npos ) {
@ -886,6 +891,10 @@ void fgOPTIONS::usage ( void ) {
<< endl;
cout << "\t--speed=n: run the FDM this much faster than real time" << endl;
cout << endl;
//(UIUC)
cout <<"Aircraft model directory" << endl;
cout <<"\t--aircraft-dir=<path> path is relative to the path of the executable" << endl;
cout << endl;
cout << "Initial Position and Orientation:" << endl;
cout << "\t--airport-id=ABCD: specify starting postion by airport id"