]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/FGCoefficient.h
JSBSim tweaks.
[flightgear.git] / src / FDM / JSBSim / FGCoefficient.h
index a1c2ca4af9db8587debd15670a571b766996dd66..5cd6799c31cf52039caad5095f43a66b68a72bf7 100644 (file)
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
  Header:       FGCoefficient.h
  Author:       Jon Berndt
@@ -27,60 +27,39 @@ HISTORY
 --------------------------------------------------------------------------------
 12/28/98   JSB   Created
 
-********************************************************************************
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 SENTRY
-*******************************************************************************/
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #ifndef FGCOEFFICIENT_H
 #define FGCOEFFICIENT_H
 
-/*******************************************************************************
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 INCLUDES
-*******************************************************************************/
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
 #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>
+#  include <simgear/compiler.h>
 #endif
 
-#include <map>
-
-/*******************************************************************************
-DEFINES
-*******************************************************************************/
-
-using namespace std;
-
-#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
-#define FG_BI2VEL   65536L
-#define FG_CI2VEL  131072L
-
-/*******************************************************************************
+#include <vector>
+#include <string>
+#include "FGConfigFile.h"
+#include "FGDefs.h"
+#include "FGTable.h"
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+DEFINITIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+#define ID_COEFFICIENT "$Id$"
+
+using std::vector;
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
-*******************************************************************************/
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
 class FGFDMExec;
 class FGState;
 class FGAtmosphere;
@@ -92,73 +71,47 @@ class FGPosition;
 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_ELEVATOR  2048
-FG_AILERON   4096
-FG_RUDDER    8192
-FG_MACH     16384
-FG_ALTITUDE 32768L
-FG_BI2VEL   65536L
-FG_CI2VEL  131072L
-
-********************************************************************************
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+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
 {
-public:
-  FGCoefficient(FGFDMExec*, ifstream&);
-  ~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;}
-  void DumpSD(void);
+  typedef vector <eParam> MultVec;
   enum Type {UNKNOWN, VALUE, VECTOR, TABLE, EQUATION};
 
-protected:
-
-private:
-  typedef map<string, long> CoeffMap;
-  CoeffMap coeffdef;
+  int numInstances;
   string filename;
   string description;
   string name;
   string method;
   float StaticValue;
-  float *Table2D;
-  float **Table3D;
-  float LookupR, LookupC;
-  long int mult_idx[10];
+  eParam LookupR, LookupC;
+  MultVec multipliers;
   int rows, columns;
   Type type;
-  int multipliers;
-  int mult_count;
   float SD; // Actual stability derivative (or other coefficient) value
-
-  float GetCoeffVal(int);
+  FGTable *Table;
 
   FGFDMExec*      FDMExec;
   FGState*        State;
@@ -170,7 +123,23 @@ private:
   FGPosition*     Position;
   FGAuxiliary*    Auxiliary;
   FGOutput*       Output;
+
+public:
+  FGCoefficient(FGFDMExec*, FGConfigFile*);
+  ~FGCoefficient();
+
+  float Value(float, float);
+  float Value(float);
+  float Value(void);
+  float TotalValue(void);
+  inline string Getname(void) {return name;}
+  inline float GetSD(void) {return SD;}
+  inline MultVec Getmultipliers(void) {return multipliers;}
+  void DumpSD(void);
+private:
+  void Debug(void);
 };
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 #endif
+