]> git.mxchange.org Git - flightgear.git/commitdiff
Added recent ground effect modeling changes.
authorcurt <curt>
Mon, 23 Jul 2001 20:31:59 +0000 (20:31 +0000)
committercurt <curt>
Mon, 23 Jul 2001 20:31:59 +0000 (20:31 +0000)
src/FDM/JSBSim/FGAerodynamics.cpp
src/FDM/JSBSim/FGAerodynamics.h
src/FDM/JSBSim/FGAircraft.h
src/FDM/JSBSim/FGCoefficient.cpp
src/FDM/JSBSim/FGCoefficient.h
src/FDM/JSBSim/FGPosition.cpp
src/FDM/JSBSim/FGPosition.h
src/FDM/JSBSim/Makefile.am

index 666dca618efe6685bfcfe0da2d7c5da5bbf8dd1a..2239c150252c68108f57730783caac5ebb1718d6 100644 (file)
@@ -37,6 +37,8 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGAerodynamics.h"
+#include "FGFactorGroup.h"
+#include "FGCoefficient.h"
 
 static const char *IdSrc = "$Id$";
 static const char *IdHdr = ID_AERODYNAMICS;
@@ -143,8 +145,13 @@ bool FGAerodynamics::Load(FGConfigFile* AC_cfg)
       axis = AC_cfg->GetValue("NAME");
       AC_cfg->GetNextConfigLine();
       while ((token = AC_cfg->GetValue()) != "/AXIS") {
-        ca.push_back(new FGCoefficient(FDMExec, AC_cfg));
-        if (debug_lvl > 0) DisplayCoeffFactors(ca.back()->Getmultipliers());
+        if( token == "COEFFICIENT" ) {
+          ca.push_back( new FGCoefficient(FDMExec) );
+          ca.back()->Load(AC_cfg);
+        } else if ( token == "GROUP" ) {
+          ca.push_back( new FGFactorGroup(FDMExec) );
+          ca.back()->Load(AC_cfg);
+        }
       }
       Coeff[AxisIdx[axis]] = ca;
       AC_cfg->GetNextConfigLine();
@@ -156,19 +163,6 @@ bool FGAerodynamics::Load(FGConfigFile* AC_cfg)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-void FGAerodynamics::DisplayCoeffFactors(vector <eParam> multipliers)
-{
-  unsigned int i;
-
-  cout << "   Non-Dimensionalized by: ";
-
-  for (i=0; i<multipliers.size();i++) cout << State->paramdef[multipliers[i]];
-
-  cout << endl;
-}
-
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
 string FGAerodynamics::GetCoefficientStrings(void)
 {
   string CoeffStrings = "";
@@ -182,7 +176,7 @@ string FGAerodynamics::GetCoefficientStrings(void)
       } else {
         CoeffStrings += ", ";
       }
-      CoeffStrings += Coeff[axis][sd]->Getname();
+      CoeffStrings += Coeff[axis][sd]->GetCoefficientStrings();
     }
   }
   return CoeffStrings;
@@ -203,8 +197,7 @@ string FGAerodynamics::GetCoefficientValues(void)
       } else {
         SDValues += ", ";
       }
-      sprintf(buffer, "%9.6f", Coeff[axis][sd]->GetSD());
-      SDValues += string(buffer);
+      SDValues += Coeff[axis][sd]->GetCoefficientValues();
     }
   }
 
index 817e014531f57f7cc579e8d9cf31976b9aedf413..65cffbd7a5e2711fa8c3a53c608f602a36446b3a 100644 (file)
@@ -58,6 +58,7 @@ INCLUDES
 #include "FGMassBalance.h"
 #include "FGTranslation.h"
 #include "FGCoefficient.h"
+#include "FGFactorGroup.h"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
@@ -65,6 +66,7 @@ DEFINITIONS
 
 #define ID_AERODYNAMICS "$Id$"
 
+
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@@ -107,12 +109,6 @@ public:
       @return true if successful */
   bool Load(FGConfigFile* AC_cfg);
 
-  /** Outputs coefficient information.
-      Non-dimensionalizing parameter descriptions are output
-      for each aero coefficient defined.
-      @param multipliers the list of multipliers for this coefficient.*/
-  void DisplayCoeffFactors(vector <eParam> multipliers);
-
   /** Gets the total aerodynamic force vector.
       @return a force vector reference. */
   FGColumnVector& GetForces(void) {return vForces;}
index 213fef7738ec2d249b24c2d03e8c5f711724f2ec..48bfbdc1868e05213e9409ed0385b59a78f56ed1 100644 (file)
@@ -162,15 +162,15 @@ public:
   inline float GetAlphaCLMax(void) { return alphaclmax; }
   inline float GetAlphaCLMin(void) { return alphaclmin; }
 
-  inline void SetGearUp(bool tt) { GearUp = tt; }
+  inline void SetGear(bool tt) { GearUp = tt; }
+  inline void SetGearUp(void) { GearUp = true; }
+  inline void SetGearDown(bool tt) { GearUp = false; }
   inline void SetAlphaCLMax(float tt) { alphaclmax=tt; }
   inline void SetAlphaCLMin(float tt) { alphaclmin=tt; }
 
   string GetGroundReactionStrings(void);
   string GetGroundReactionValues(void);
 
-  float GetLoD(void);
-
   /// Subsystem types for specifying which will be output in the FDM data logging
   enum  SubSystems {
     /** Subsystem: Simulation (= 1)          */ ssSimulation      = 1,
index b8ec8528fae5daea17bab0553f4561dd30916136..e1c0dc5b71a5028ef817241be1ede7f2b998d1c6 100644 (file)
@@ -75,22 +75,35 @@ extern short debug_lvl;
 CLASS IMPLEMENTATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-FGCoefficient::FGCoefficient(FGFDMExec* fdex, FGConfigFile* AC_cfg)
+FGCoefficient::FGCoefficient( FGFDMExec* fdex )
 {
-  int start, end, n;
-  string multparms;
 
   FDMExec = fdex;
   State   = FDMExec->GetState();
   Table   = 0;
 
+  if (debug_lvl & 2) cout << "Instantiated: FGCoefficient" << endl;
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+FGCoefficient::~FGCoefficient()
+{
+  if (Table) delete Table;
+  if (debug_lvl & 2) cout << "Destroyed:    FGCoefficient" << endl;
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+bool FGCoefficient::Load(FGConfigFile *AC_cfg) {
+  int start, end, n;
+  string multparms, mult;
+
   if (AC_cfg) {
     name = AC_cfg->GetValue("NAME");
     method = AC_cfg->GetValue("TYPE");
-
     AC_cfg->GetNextConfigLine();
     *AC_cfg >> description;
-
     if (debug_lvl > 0) {
       cout << "\n   " << highint << underon << name << underoff << normint << endl;
       cout << "   " << description << endl;
@@ -137,17 +150,18 @@ FGCoefficient::FGCoefficient(FGFDMExec* fdex, FGConfigFile* AC_cfg)
     n     = multparms.find("|");
     start = 0;
 
-    while (n < end && n >= 0) {
-      n -= start;
+    if(multparms != "FG_NONE") {
+      while (n < end && n >= 0) {
+        n -= start;
+        mult = multparms.substr(start,n);
+        multipliers.push_back( State->GetParameterIndex(mult) );
+        start += n+1;
+        n = multparms.find("|",start);
+      }
       multipliers.push_back(State->GetParameterIndex(multparms.substr(start,n)));
-      start += n+1;
-      n = multparms.find("|",start);
+      // End of non-dimensionalizing parameter read-in
     }
 
-    multipliers.push_back(State->GetParameterIndex(multparms.substr(start,n)));
-
-    // End of non-dimensionalizing parameter read-in
-
     switch(type) {
     case VALUE:
       *AC_cfg >> StaticValue;
@@ -164,17 +178,14 @@ FGCoefficient::FGCoefficient(FGFDMExec* fdex, FGConfigFile* AC_cfg)
       break;
     }
     AC_cfg->GetNextConfigLine();
-  }
-  if (debug_lvl & 2) cout << "Instantiated: FGCoefficient" << endl;
+    if (debug_lvl > 0) DisplayCoeffFactors();
+    return true;
+  } else {
+    return false;
+  }  
 }
 
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-FGCoefficient::~FGCoefficient()
-{
-  if (Table) delete Table;
-  if (debug_lvl & 2) cout << "Destroyed:    FGCoefficient" << endl;
-}
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
@@ -253,3 +264,32 @@ void FGCoefficient::Debug(void)
     //TODO: Add your source code here
 }
 
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+void FGCoefficient::DisplayCoeffFactors(void)
+{
+  unsigned int i;
+
+  cout << "   Non-Dimensionalized by: ";
+
+  if( multipliers.size() == 0) {
+    cout << "none" << endl;
+  } else {
+    for (i=0; i<multipliers.size();i++) 
+        cout << FDMExec->GetState()->paramdef[multipliers[i]];
+  }
+  cout << endl;
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+string FGCoefficient::GetCoefficientValues(void) {
+  char buffer[10];
+  string value;
+  //value = ", ";
+  snprintf(buffer,10,"%9.6f",SD);
+  value += string(buffer);
+  return value;
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index ce236f131fe3043ba4fceb3821987e659e55c10a..e279f6b17f155bb10d106bd811f2aa55343e6b84 100644 (file)
@@ -98,16 +98,25 @@ CLASS DECLARATION
 class FGCoefficient
 {
 public:
-  FGCoefficient(FGFDMExec*, FGConfigFile*);
+  FGCoefficient(FGFDMExec*);
   ~FGCoefficient();
-
+  
+  virtual bool Load(FGConfigFile* AC_cfg);
+  
   typedef vector <eParam> MultVec;
-  float TotalValue(void);
-  inline string Getname(void) {return name;}
-  inline float GetSD(void) {return SD;}
+  virtual float TotalValue(void);
+  virtual inline string Getname(void) {return name;}
+  virtual inline float GetSD(void) { return SD;}
   inline MultVec Getmultipliers(void) {return multipliers;}
-  void DumpSD(void);
-
+  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);
 private:
   enum Type {UNKNOWN, VALUE, VECTOR, TABLE, EQUATION};
 
index 078f495b8a9a4336aa0fb33bde582cdc0f4b2e70..29576930aa89cf73a69c7eb179799e7915ecc60f 100644 (file)
@@ -108,6 +108,8 @@ FGPosition::FGPosition(FGFDMExec* fdmex) : FGModel(fdmex),
   RunwayRadius   = SeaLevelRadius;
   DistanceAGL    = Radius - RunwayRadius;  // Geocentric
   vRunwayNormal(3) = -1.0;                 // Initialized for standalone mode
+  b =1;
+  
 
   if (debug_lvl & 2) cout << "Instantiated: " << Name << endl;
 }
@@ -157,7 +159,7 @@ bool FGPosition:: Run(void) {
     h = Radius - SeaLevelRadius;           // Geocentric
 
     DistanceAGL = Radius - RunwayRadius;   // Geocentric
-
+    
     hoverb = DistanceAGL/b;
 
     if (Vt > 0) {
@@ -186,7 +188,7 @@ void FGPosition::GetState(void) {
   Vt        = Translation->GetVt();
   vVel      = State->GetTb2l() * Translation->GetUVW();
   vVelDot   = State->GetTb2l() * Translation->GetUVWdot();
-
+  
   b = Aircraft->GetWingSpan();
 }
 
@@ -196,6 +198,7 @@ void FGPosition::Seth(double tt) {
  h = tt;
  Radius    = h + SeaLevelRadius;
  DistanceAGL = Radius - RunwayRadius;   // Geocentric
+ hoverb = DistanceAGL/b;
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -204,6 +207,7 @@ void FGPosition::SetDistanceAGL(double tt) {
   DistanceAGL=tt;
   Radius = RunwayRadius + DistanceAGL;
   h = Radius - SeaLevelRadius;
+  hoverb = DistanceAGL/b;
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index 97d57d6107a7e80ad9dcdc80db020cf51386cf25..ca93d258a2441e02b0050b4d7a74cabb3d25687d 100644 (file)
@@ -129,7 +129,7 @@ private:
   double SeaLevelRadius;
   double gamma;
   double Vt, Vground;
-  double hoverb,b;
+  float hoverb,b;
 
   double psigt;
 
index 24c8783b4db19a76ce276ec356f1189b923a1c00..6f547a3b3dedd1ee368603c5e2f261dfacceb376 100644 (file)
@@ -21,6 +21,7 @@ libJSBSim_a_SOURCES = \
        FGDefs.h \
        FGFCS.cpp FGFCS.h \
        FGFDMExec.cpp FGFDMExec.h \
+       FGFactorGroup.cpp FGFactorGroup.h \
        FGForce.cpp FGForce.h \
         FGInertial.cpp FGInertial.h \
        FGInitialCondition.cpp FGInitialCondition.h \