-/*******************************************************************************
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Header: FGCoefficient.h
Author: Jon Berndt
--------------------------------------------------------------------------------
12/28/98 JSB Created
-********************************************************************************
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SENTRY
-*******************************************************************************/
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#ifndef FGCOEFFICIENT_H
#define FGCOEFFICIENT_H
-/*******************************************************************************
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
INCLUDES
-*******************************************************************************/
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
#ifdef FGFS
# include <simgear/compiler.h>
-# include STL_STRING
- FG_USING_STD(string);
-#else
-# include <string>
#endif
-#include <map>
+#include <vector>
+#include <string>
#include "FGConfigFile.h"
-#include "FGDefs.h"
+#include "FGTable.h"
+#include "FGJSBBase.h"
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+DEFINITIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-/*******************************************************************************
-DEFINES
-*******************************************************************************/
+#define ID_COEFFICIENT "$Id$"
-using namespace std;
+using std::vector;
-/*******************************************************************************
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
-*******************************************************************************/
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
class FGFDMExec;
class FGState;
class FGAtmosphere;
class FGAuxiliary;
class FGOutput;
-/*******************************************************************************
-COMMENTS, REFERENCES, and NOTES
-********************************************************************************
-
-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_MACH 2048
-FG_ALTITUDE 4096
-FG_BI2VEL 8192
-FG_CI2VEL 16384
-FG_ELEVATOR_POS 32768L
-FG_AILERON_POS 65536L
-FG_RUDDER_POS 131072L
-FG_SPDBRAKE_POS 262144L
-FG_FLAPS_POS 524288L
-FG_ELEVATOR_CMD 1048576L
-FG_AILERON_CMD 2097152L
-FG_RUDDER_CMD 4194304L
-FG_SPDBRAKE_CMD 8388608L
-FG_FLAPS_CMD 16777216L
-FG_SPARE1 33554432L
-FG_SPARE2 67108864L
-FG_SPARE3 134217728L
-FG_SPARE4 268435456L
-FG_SPARE5 536870912L
-FG_SPARE6 1073741824L
-
-The above definitions are found in FGDefs.h
-
-********************************************************************************
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+Note that the coefficients need not be calculated each delta-t. This is
+something that may be fixed someday.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DOCUMENTATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/** This class models the stability derivative coefficient lookup tables.
+ Each coefficient for an axis is stored in that axes' vector of coefficients.
+ Each FDM execution frame the Run() method of the [currently] FGAircraft model
+ is called and the coefficient value is calculated.
+ @author Jon S. Berndt
+ @version $Id$
+ @see -
+*/
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DECLARATION
-*******************************************************************************/
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-class FGCoefficient
+class FGCoefficient : public FGJSBBase
{
public:
- FGCoefficient(FGFDMExec*, FGConfigFile*);
- ~FGCoefficient(void);
- bool Allocate(int);
- bool Allocate(int, int);
- float Value(float, float);
- float Value(float);
- float Value(void);
- float TotalValue(void);
- inline float GetSDValue(void) {return SD;}
- inline void SetSDValue(float tt) {SD = tt;}
- inline long int Getmultipliers(void) {return multipliers;}
- void DumpSD(void);
- enum Type {UNKNOWN, VALUE, VECTOR, TABLE, EQUATION};
-
-protected:
+ FGCoefficient(FGFDMExec*);
+ virtual ~FGCoefficient();
+
+ virtual bool Load(FGConfigFile* AC_cfg);
+
+ typedef vector <eParam> MultVec;
+ virtual double TotalValue(void);
+ virtual inline string Getname(void) {return name;}
+ virtual inline double GetSD(void) { return SD;}
+ inline MultVec Getmultipliers(void) {return multipliers;}
+ void DumpSD(void);
+
+ /** Outputs coefficient information.
+ Non-dimensionalizing parameter descriptions are output
+ for each aero coefficient defined.
+ @param multipliers the list of multipliers for this coefficient.*/
+ virtual void DisplayCoeffFactors(void);
+ virtual inline string GetCoefficientStrings(void) { return name; }
+ virtual string GetCoefficientValues(void);
+
+ inline void setBias(double b) { bias=b; }
+ inline void setGain(double g) { gain=g; };
+ inline double getBias(void) { return bias; }
+ inline double getGain(void) { return gain; }
private:
+ enum Type {UNKNOWN, VALUE, VECTOR, TABLE, EQUATION};
+
int numInstances;
string filename;
string description;
string name;
string method;
- float StaticValue;
- float *Table2D;
- float **Table3D;
- float LookupR, LookupC;
- long int multipliers;
- long int mult_idx[10];
+ string multparms;
+ string multparmsRow;
+ string multparmsCol;
+ double Value(double, double);
+ double Value(double);
+ double Value(void);
+ double StaticValue;
+ double bias,gain;
+ eParam LookupR, LookupC;
+ MultVec multipliers;
int rows, columns;
Type type;
- int mult_count;
- float SD; // Actual stability derivative (or other coefficient) value
+ double SD; // Actual stability derivative (or other coefficient) value
+ FGTable *Table;
FGFDMExec* FDMExec;
FGState* State;
FGPosition* Position;
FGAuxiliary* Auxiliary;
FGOutput* Output;
+
+ virtual void Debug(int from);
};
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#endif
+