1999-02-05 21:26:01 +00:00
|
|
|
/*******************************************************************************
|
|
|
|
|
|
|
|
Header: FGCoefficient.h
|
|
|
|
Author: Jon Berndt
|
|
|
|
Date started: 12/28/98
|
|
|
|
|
|
|
|
------------- Copyright (C) 1999 Jon S. Berndt (jsb@hal-pc.org) -------------
|
|
|
|
|
|
|
|
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; either version 2 of the License, or (at your option) any later
|
|
|
|
version.
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
Further information about the GNU General Public License can also be found on
|
|
|
|
the world wide web at http://www.gnu.org.
|
|
|
|
|
|
|
|
HISTORY
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
12/28/98 JSB Created
|
|
|
|
|
1999-02-11 21:05:34 +00:00
|
|
|
********************************************************************************
|
1999-02-05 21:26:01 +00:00
|
|
|
SENTRY
|
|
|
|
*******************************************************************************/
|
|
|
|
|
|
|
|
#ifndef FGCOEFFICIENT_H
|
|
|
|
#define FGCOEFFICIENT_H
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
INCLUDES
|
|
|
|
*******************************************************************************/
|
1999-02-26 22:09:10 +00:00
|
|
|
#ifdef FGFS
|
|
|
|
# include <Include/compiler.h>
|
|
|
|
# include STL_STRING
|
|
|
|
# ifdef FG_HAVE_STD_INCLUDES
|
|
|
|
# include <fstream>
|
|
|
|
# else
|
|
|
|
# include <fstream.h>
|
|
|
|
# endif
|
|
|
|
FG_USING_STD(string);
|
|
|
|
#else
|
|
|
|
# include <string>
|
|
|
|
# include <fstream>
|
|
|
|
#endif
|
1999-02-05 21:26:01 +00:00
|
|
|
|
1999-06-21 05:01:31 +00:00
|
|
|
#include <map>
|
|
|
|
|
1999-02-05 21:26:01 +00:00
|
|
|
/*******************************************************************************
|
|
|
|
DEFINES
|
|
|
|
*******************************************************************************/
|
1999-05-08 03:19:08 +00:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
1999-02-05 21:26:01 +00:00
|
|
|
#define FG_QBAR 1
|
|
|
|
#define FG_WINGAREA 2
|
|
|
|
#define FG_WINGSPAN 4
|
|
|
|
#define FG_CBAR 8
|
|
|
|
#define FG_ALPHA 16
|
|
|
|
#define FG_ALPHADOT 32
|
|
|
|
#define FG_BETA 64
|
|
|
|
#define FG_BETADOT 128
|
|
|
|
#define FG_PITCHRATE 256
|
|
|
|
#define FG_ROLLRATE 512
|
|
|
|
#define FG_YAWRATE 1024
|
|
|
|
#define FG_ELEVATOR 2048
|
|
|
|
#define FG_AILERON 4096
|
|
|
|
#define FG_RUDDER 8192
|
|
|
|
#define FG_MACH 16384
|
|
|
|
#define FG_ALTITUDE 32768L
|
1999-06-28 17:39:20 +00:00
|
|
|
#define FG_BI2VEL 65536L
|
|
|
|
#define FG_CI2VEL 131072L
|
1999-02-05 21:26:01 +00:00
|
|
|
|
|
|
|
/*******************************************************************************
|
1999-03-02 01:02:51 +00:00
|
|
|
FORWARD DECLARATIONS
|
1999-02-05 21:26:01 +00:00
|
|
|
*******************************************************************************/
|
1999-02-11 21:05:34 +00:00
|
|
|
class FGFDMExec;
|
|
|
|
class FGState;
|
|
|
|
class FGAtmosphere;
|
|
|
|
class FGFCS;
|
|
|
|
class FGAircraft;
|
|
|
|
class FGTranslation;
|
|
|
|
class FGRotation;
|
|
|
|
class FGPosition;
|
|
|
|
class FGAuxiliary;
|
|
|
|
class FGOutput;
|
|
|
|
|
1999-03-02 01:02:51 +00:00
|
|
|
/*******************************************************************************
|
|
|
|
COMMENTS, REFERENCES, and NOTES
|
1999-06-21 05:01:31 +00:00
|
|
|
********************************************************************************
|
|
|
|
|
1999-03-02 01:02:51 +00:00
|
|
|
This class models the stability derivative coefficient lookup tables or
|
|
|
|
equations. Note that the coefficients need not be calculated each delta-t.
|
|
|
|
|
|
|
|
FG_QBAR 1
|
|
|
|
FG_WINGAREA 2
|
|
|
|
FG_WINGSPAN 4
|
|
|
|
FG_CBAR 8
|
|
|
|
FG_ALPHA 16
|
|
|
|
FG_ALPHADOT 32
|
|
|
|
FG_BETA 64
|
|
|
|
FG_BETADOT 128
|
|
|
|
FG_PITCHRATE 256
|
|
|
|
FG_ROLLRATE 512
|
|
|
|
FG_YAWRATE 1024
|
|
|
|
FG_ELEVATOR 2048
|
|
|
|
FG_AILERON 4096
|
|
|
|
FG_RUDDER 8192
|
|
|
|
FG_MACH 16384
|
|
|
|
FG_ALTITUDE 32768L
|
1999-06-28 17:39:20 +00:00
|
|
|
FG_BI2VEL 65536L
|
|
|
|
FG_CI2VEL 131072L
|
1999-06-21 05:01:31 +00:00
|
|
|
|
|
|
|
********************************************************************************
|
1999-03-02 01:02:51 +00:00
|
|
|
CLASS DECLARATION
|
|
|
|
*******************************************************************************/
|
|
|
|
|
1999-02-05 21:26:01 +00:00
|
|
|
class FGCoefficient
|
|
|
|
{
|
|
|
|
public:
|
1999-05-08 03:19:08 +00:00
|
|
|
FGCoefficient(FGFDMExec*, ifstream&);
|
1999-02-05 21:26:01 +00:00
|
|
|
~FGCoefficient(void);
|
|
|
|
bool Allocate(int);
|
|
|
|
bool Allocate(int, int);
|
|
|
|
float Value(float, float);
|
|
|
|
float Value(float);
|
|
|
|
float Value(void);
|
1999-05-08 03:19:08 +00:00
|
|
|
float TotalValue(void);
|
1999-03-02 01:02:51 +00:00
|
|
|
enum Type {UNKNOWN, VALUE, VECTOR, TABLE, EQUATION};
|
|
|
|
|
1999-02-05 21:26:01 +00:00
|
|
|
protected:
|
|
|
|
|
|
|
|
private:
|
1999-06-21 05:01:31 +00:00
|
|
|
typedef map<string, long> CoeffMap;
|
|
|
|
CoeffMap coeffdef;
|
1999-02-26 22:09:10 +00:00
|
|
|
string filename;
|
|
|
|
string description;
|
|
|
|
string name;
|
|
|
|
string method;
|
1999-02-05 21:26:01 +00:00
|
|
|
float StaticValue;
|
|
|
|
float *Table2D;
|
|
|
|
float **Table3D;
|
1999-02-26 22:09:10 +00:00
|
|
|
float LookupR, LookupC;
|
|
|
|
long int mult_idx[10];
|
1999-02-05 21:26:01 +00:00
|
|
|
int rows, columns;
|
1999-03-02 01:02:51 +00:00
|
|
|
Type type;
|
1999-02-05 21:26:01 +00:00
|
|
|
int multipliers;
|
|
|
|
int mult_count;
|
|
|
|
|
|
|
|
float GetCoeffVal(int);
|
1999-02-11 21:05:34 +00:00
|
|
|
|
|
|
|
FGFDMExec* FDMExec;
|
|
|
|
FGState* State;
|
|
|
|
FGAtmosphere* Atmosphere;
|
|
|
|
FGFCS* FCS;
|
|
|
|
FGAircraft* Aircraft;
|
|
|
|
FGTranslation* Translation;
|
|
|
|
FGRotation* Rotation;
|
|
|
|
FGPosition* Position;
|
|
|
|
FGAuxiliary* Auxiliary;
|
|
|
|
FGOutput* Output;
|
1999-02-05 21:26:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
#endif
|