Added recent ground effect modeling changes.
This commit is contained in:
parent
450de25cc7
commit
97067e62a2
8 changed files with 101 additions and 58 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 > 0) DisplayCoeffFactors();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (debug_lvl & 2) cout << "Instantiated: FGCoefficient" << endl;
|
||||
}
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
|
|
@ -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);
|
||||
|
||||
/** 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};
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
|
|
@ -129,7 +129,7 @@ private:
|
|||
double SeaLevelRadius;
|
||||
double gamma;
|
||||
double Vt, Vground;
|
||||
double hoverb,b;
|
||||
float hoverb,b;
|
||||
|
||||
double psigt;
|
||||
|
||||
|
|
|
@ -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 \
|
||||
|
|
Loading…
Reference in a new issue