%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include "FGAerodynamics.h"
+#include "FGFactorGroup.h"
+#include "FGCoefficient.h"
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_AERODYNAMICS;
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();
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-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 = "";
} else {
CoeffStrings += ", ";
}
- CoeffStrings += Coeff[axis][sd]->Getname();
+ CoeffStrings += Coeff[axis][sd]->GetCoefficientStrings();
}
}
return CoeffStrings;
} else {
SDValues += ", ";
}
- sprintf(buffer, "%9.6f", Coeff[axis][sd]->GetSD());
- SDValues += string(buffer);
+ SDValues += Coeff[axis][sd]->GetCoefficientValues();
}
}
#include "FGMassBalance.h"
#include "FGTranslation.h"
#include "FGCoefficient.h"
+#include "FGFactorGroup.h"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DEFINITIONS
#define ID_AERODYNAMICS "$Id$"
+
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@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;}
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,
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;
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;
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;
-}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//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;
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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};
RunwayRadius = SeaLevelRadius;
DistanceAGL = Radius - RunwayRadius; // Geocentric
vRunwayNormal(3) = -1.0; // Initialized for standalone mode
+ b =1;
+
if (debug_lvl & 2) cout << "Instantiated: " << Name << endl;
}
h = Radius - SeaLevelRadius; // Geocentric
DistanceAGL = Radius - RunwayRadius; // Geocentric
-
+
hoverb = DistanceAGL/b;
if (Vt > 0) {
Vt = Translation->GetVt();
vVel = State->GetTb2l() * Translation->GetUVW();
vVelDot = State->GetTb2l() * Translation->GetUVWdot();
-
+
b = Aircraft->GetWingSpan();
}
h = tt;
Radius = h + SeaLevelRadius;
DistanceAGL = Radius - RunwayRadius; // Geocentric
+ hoverb = DistanceAGL/b;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DistanceAGL=tt;
Radius = RunwayRadius + DistanceAGL;
h = Radius - SeaLevelRadius;
+ hoverb = DistanceAGL/b;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
double SeaLevelRadius;
double gamma;
double Vt, Vground;
- double hoverb,b;
+ float hoverb,b;
double psigt;
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 \