]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/FGCoefficient.h
Curt Olson:
[flightgear.git] / src / FDM / JSBSim / FGCoefficient.h
index 69e3d1d04bedd434a69194ee84ff4ae5149f4ad8..01c6abb806337bc84401ecb1efc53a833606ca82 100644 (file)
@@ -61,6 +61,8 @@ using std::vector;
 FORWARD DECLARATIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 FORWARD DECLARATIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
+namespace JSBSim {
+
 class FGFDMExec;
 class FGState;
 class FGAtmosphere;
 class FGFDMExec;
 class FGState;
 class FGAtmosphere;
@@ -73,23 +75,16 @@ class FGAuxiliary;
 class FGOutput;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 class FGOutput;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-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
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 CLASS DOCUMENTATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-/** This class models the stability derivative coefficient lookup tables.
+/** This class models the aero coefficient and stability derivative coefficient
+    lookup table, value, vector, or equation (equation not modeled, yet).
     Each coefficient for an axis is stored in that axes' vector of coefficients.
     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.
+    Each FDM execution frame the Run() method of the FGAerodynamics model
+    is called and the coefficient values are calculated.
     @author Jon S. Berndt
     @version $Id$
     @author Jon S. Berndt
     @version $Id$
-    @see -
 */
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 */
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -99,42 +94,73 @@ CLASS DECLARATION
 class FGCoefficient : public FGJSBBase
 {
 public:
 class FGCoefficient : public FGJSBBase
 {
 public:
-  FGCoefficient(FGFDMExec*);
+  /** Constructor.
+      @param exec a pointer to the FGFDMExec instance. */
+  FGCoefficient(FGFDMExec* exec);
+  /// Destructor.
   virtual ~FGCoefficient();
   
   virtual ~FGCoefficient();
   
+  /** Loads the stability derivative/aero coefficient data from the config file
+      as directed by the FGAerodynamics instance.
+      @param AC_cfg a pointer to the current config file instance. */
   virtual bool Load(FGConfigFile* AC_cfg);
   
   typedef vector <FGPropertyManager*> MultVec;
   virtual bool Load(FGConfigFile* AC_cfg);
   
   typedef vector <FGPropertyManager*> MultVec;
+
+  enum Type {UNKNOWN, VALUE, VECTOR, TABLE, EQUATION};
+
+  /** Returns the value for this coefficient.
+      Each instance of FGCoefficient stores a value for the "type" of coefficient
+      it is, one of: VALUE, VECTOR, TABLE, or EQUATION. This TotalValue function 
+      is called when the value for a coefficient needs to be known. When it is called,
+      depending on what type of coefficient is represented by the FGCoefficient
+      instance, TotalValue() directs the appropriate Value() function to be called.
+      The type of coefficient represented is determined when the config file is read.
+      The coefficient definition includes the "type" specifier.
+      @return the current value of the coefficient represented by this instance of
+      FGCoefficient. */
   virtual double TotalValue(void);
   virtual double TotalValue(void);
+
+  /** Returns the value for this coefficient.
+      TotalValue is stored each time TotalValue() is called. This function returns
+      the stored value but does not calculate it anew. This is valuable for merely
+      printing out the value.
+      @return the most recently calculated and stored value of the coefficient
+      represented by this instance of FGCoefficient. */
   virtual inline double GetValue(void) const { return totalValue; }
   virtual inline double GetValue(void) const { return totalValue; }
+
+  /// Returns the name of this coefficient.
   virtual inline string Getname(void) const {return name;}
   virtual inline string Getname(void) const {return name;}
+
+  /// Returns the value of the coefficient only - before it is re-dimensionalized.
   virtual inline double GetSD(void) const { return SD;}
   virtual inline double GetSD(void) const { return SD;}
-  inline MultVec Getmultipliers(void) {return multipliers;}
-  void DumpSD(void);  
-  
+
   /** Outputs coefficient information.
       Non-dimensionalizing parameter descriptions are output
   /** Outputs coefficient information.
       Non-dimensionalizing parameter descriptions are output
-      for each aero coefficient defined.
-      @param multipliers the list of multipliers for this coefficient.*/
+      for each aero coefficient defined. */
   virtual void DisplayCoeffFactors(void);
   virtual void DisplayCoeffFactors(void);
-  virtual inline string GetCoefficientStrings(void) { return name; }
-  virtual string GetCoefficientValues(void);
-  
+
+  /// Returns the name of the coefficient.
+  virtual inline string GetCoefficientName(void) { return name; }
+  /// Returns the stability derivative or coefficient value as a string.
+  virtual string GetSDstring(void);
+
   inline void setBias(double b) { bias=b; }
   inline void setGain(double g) { gain=g; };
   inline double getBias(void) const { return bias; }
   inline double getGain(void) const { return gain; }
   
   inline void setBias(double b) { bias=b; }
   inline void setGain(double g) { gain=g; };
   inline double getBias(void) const { return bias; }
   inline double getGain(void) const { return gain; }
   
-  void bind(FGPropertyManager *node);
-  void unbind(void);
+  virtual void bind(FGPropertyManager *parent);
+  virtual void unbind(void);
 
 
-private:
-  enum Type {UNKNOWN, VALUE, VECTOR, TABLE, EQUATION};
+protected:
+  FGFDMExec* FDMExec;
 
 
+private:
   int numInstances;
   int numInstances;
-  string filename;
   string description;
   string name;
   string description;
   string name;
+  string filename;
   string method;
   string multparms;
   string multparmsRow;
   string method;
   string multparms;
   string multparmsRow;
@@ -146,7 +172,8 @@ private:
   double totalValue;
   double bias,gain;
   FGPropertyManager *LookupR, *LookupC;
   double totalValue;
   double bias,gain;
   FGPropertyManager *LookupR, *LookupC;
-  FGPropertyManager *node;
+  
+  FGPropertyManager *node; // must be private!!
   
   MultVec multipliers;
   int rows, columns;
   
   MultVec multipliers;
   int rows, columns;
@@ -154,7 +181,6 @@ private:
   double SD; // Actual stability derivative (or other coefficient) value
   FGTable *Table;
 
   double SD; // Actual stability derivative (or other coefficient) value
   FGTable *Table;
 
-  FGFDMExec*      FDMExec;
   FGState*        State;
   FGAtmosphere*   Atmosphere;
   FGFCS*          FCS;
   FGState*        State;
   FGAtmosphere*   Atmosphere;
   FGFCS*          FCS;
@@ -165,10 +191,14 @@ private:
   FGAuxiliary*    Auxiliary;
   FGOutput*       Output;
   FGPropertyManager* PropertyManager;
   FGAuxiliary*    Auxiliary;
   FGOutput*       Output;
   FGPropertyManager* PropertyManager;
+  
+  FGPropertyManager* resolveSymbol(string name);
 
   virtual void Debug(int from);
 };
 
 
   virtual void Debug(int from);
 };
 
+} // using namespace JSBSim
+
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 #endif
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 #endif