1
0
Fork 0

Latest JSBSim changes.

This commit is contained in:
david 2001-12-13 04:48:34 +00:00
parent 37c2b6002c
commit 5c3f4e999d
94 changed files with 2056 additions and 753 deletions

View file

@ -203,7 +203,7 @@ double FGAerodynamics::GetLoD(void)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGAerodynamics::Debug(void) void FGAerodynamics::Debug(int from)
{ {
//TODO: Add your source code here //TODO: Add your source code here
} }

View file

@ -146,7 +146,7 @@ private:
FGColumnVector3 vLastFs; FGColumnVector3 vLastFs;
FGColumnVector3 vDXYZcg; FGColumnVector3 vDXYZcg;
void Debug(void); void Debug(int from);
}; };
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -377,7 +377,7 @@ bool FGAircraft::ReadOutput(FGConfigFile* AC_cfg)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGAircraft::Debug(void) void FGAircraft::Debug(int from)
{ {
//TODO: Add your source code here //TODO: Add your source code here
} }

View file

@ -232,7 +232,7 @@ private:
bool ReadUndercarriage(FGConfigFile*); bool ReadUndercarriage(FGConfigFile*);
bool ReadPrologue(FGConfigFile*); bool ReadPrologue(FGConfigFile*);
bool ReadOutput(FGConfigFile*); bool ReadOutput(FGConfigFile*);
void Debug(void); void Debug(int from);
}; };
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -87,14 +87,14 @@ FGAtmosphere::FGAtmosphere(FGFDMExec* fdmex) : FGModel(fdmex)
// turbType = ttBerndt; // temporarily disable turbulence until fully tested // turbType = ttBerndt; // temporarily disable turbulence until fully tested
TurbGain = 100.0; TurbGain = 100.0;
if (debug_lvl & 2) cout << "Instantiated: " << Name << endl; Debug(0);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGAtmosphere::~FGAtmosphere() FGAtmosphere::~FGAtmosphere()
{ {
if (debug_lvl & 2) cout << "Destroyed: FGAtmosphere" << endl; Debug(1);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -145,7 +145,7 @@ bool FGAtmosphere::Run(void)
State->Seta(soundspeed); State->Seta(soundspeed);
if (debug_lvl > 1) Debug(); Debug(2);
} else { // skip Run() execution this time } else { // skip Run() execution this time
} }
@ -291,17 +291,52 @@ void FGAtmosphere::Turbulence(void)
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGAtmosphere::Debug(void) void FGAtmosphere::Debug(int from)
{ {
if (frame == 0) { if (debug_lvl <= 0) return;
cout << "vTurbulence(X), vTurbulence(Y), vTurbulence(Z), "
<< "vTurbulenceGrad(X), vTurbulenceGrad(Y), vTurbulenceGrad(Z), " if (debug_lvl & 1) { // Standard console startup message output
<< "vDirection(X), vDirection(Y), vDirection(Z), " if (from == 0) { // Constructor
<< "Magnitude, " }
<< "vTurbPQR(P), vTurbPQR(Q), vTurbPQR(R), " << endl; }
} else { if (debug_lvl & 2 ) { // Instantiation/Destruction notification
cout << vTurbulence << ", " << vTurbulenceGrad << ", " << vDirection << ", " << Magnitude << ", " << vTurbPQR << endl; if (from == 0) cout << "Instantiated: FGAtmosphere" << endl;
if (from == 1) cout << "Destroyed: FGAtmosphere" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
}
if (debug_lvl & 32) { // Turbulence
if (frame == 0 && from == 2) {
cout << "vTurbulence(X), vTurbulence(Y), vTurbulence(Z), "
<< "vTurbulenceGrad(X), vTurbulenceGrad(Y), vTurbulenceGrad(Z), "
<< "vDirection(X), vDirection(Y), vDirection(Z), "
<< "Magnitude, "
<< "vTurbPQR(P), vTurbPQR(Q), vTurbPQR(R), " << endl;
} else if (from == 2) {
cout << vTurbulence << ", " << vTurbulenceGrad << ", " << vDirection << ", " << Magnitude << ", " << vTurbPQR << endl;
}
} }
} }

View file

@ -176,7 +176,7 @@ private:
void Calculate(double altitude); void Calculate(double altitude);
void Turbulence(void); void Turbulence(void);
void Debug(void); void Debug(int from);
}; };
/******************************************************************************/ /******************************************************************************/

View file

@ -213,7 +213,7 @@ void FGAuxiliary::GetState(void)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGAuxiliary::Debug(void) void FGAuxiliary::Debug(int from)
{ {
//TODO: Add your source code here //TODO: Add your source code here
} }

View file

@ -119,7 +119,7 @@ private:
double earthPosAngle; double earthPosAngle;
void GetState(void); void GetState(void);
void Debug(void); void Debug(int from);
}; };
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -85,20 +85,16 @@ FGCoefficient::~FGCoefficient()
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bool FGCoefficient::Load(FGConfigFile *AC_cfg) { bool FGCoefficient::Load(FGConfigFile *AC_cfg)
{
int start, end, n; int start, end, n;
string multparms, mult; string mult;
if (AC_cfg) { if (AC_cfg) {
name = AC_cfg->GetValue("NAME"); name = AC_cfg->GetValue("NAME");
method = AC_cfg->GetValue("TYPE"); method = AC_cfg->GetValue("TYPE");
AC_cfg->GetNextConfigLine(); AC_cfg->GetNextConfigLine();
*AC_cfg >> description; *AC_cfg >> description;
if (debug_lvl > 0) {
cout << "\n " << highint << underon << name << underoff << normint << endl;
cout << " " << description << endl;
cout << " " << method << endl;
}
if (method == "EQUATION") type = EQUATION; if (method == "EQUATION") type = EQUATION;
else if (method == "TABLE") type = TABLE; else if (method == "TABLE") type = TABLE;
@ -108,26 +104,20 @@ bool FGCoefficient::Load(FGConfigFile *AC_cfg) {
if (type == VECTOR || type == TABLE) { if (type == VECTOR || type == TABLE) {
*AC_cfg >> rows; *AC_cfg >> rows;
if (debug_lvl > 0) cout << " Rows: " << rows << " ";
if (type == TABLE) { if (type == TABLE) {
*AC_cfg >> columns; *AC_cfg >> columns;
if (debug_lvl > 0) cout << "Cols: " << columns;
Table = new FGTable(rows, columns); Table = new FGTable(rows, columns);
} else { } else {
Table = new FGTable(rows); Table = new FGTable(rows);
} }
if (debug_lvl > 0) cout << endl; *AC_cfg >> multparmsRow;
LookupR = State->GetParameterIndex(multparmsRow);
*AC_cfg >> multparms;
LookupR = State->GetParameterIndex(multparms);
if (debug_lvl > 0) cout << " Row indexing parameter: " << multparms << endl;
} }
if (type == TABLE) { if (type == TABLE) {
*AC_cfg >> multparms; *AC_cfg >> multparmsCol;
LookupC = State->GetParameterIndex(multparms); LookupC = State->GetParameterIndex(multparmsCol);
if (debug_lvl > 0) cout << " Column indexing parameter: " << multparms << endl;
} }
// Here, read in the line of the form (e.g.) FG_MACH|FG_QBAR|FG_ALPHA // Here, read in the line of the form (e.g.) FG_MACH|FG_QBAR|FG_ALPHA
@ -152,23 +142,17 @@ bool FGCoefficient::Load(FGConfigFile *AC_cfg) {
// End of non-dimensionalizing parameter read-in // End of non-dimensionalizing parameter read-in
} }
switch(type) { if (type == VALUE) {
case VALUE:
*AC_cfg >> StaticValue; *AC_cfg >> StaticValue;
if (debug_lvl > 0) cout << " Value = " << StaticValue << endl; } else if (type == VECTOR || type == TABLE) {
break;
case VECTOR:
case TABLE:
*Table << *AC_cfg; *Table << *AC_cfg;
if (debug_lvl > 0) Table->Print(); } else {
break;
case EQUATION:
case UNKNOWN:
cerr << "Unimplemented coefficient type: " << type << endl; cerr << "Unimplemented coefficient type: " << type << endl;
break;
} }
AC_cfg->GetNextConfigLine(); AC_cfg->GetNextConfigLine();
if (debug_lvl > 0) DisplayCoeffFactors(); Debug(2);
return true; return true;
} else { } else {
return false; return false;
@ -224,7 +208,6 @@ double FGCoefficient::Value(void)
double FGCoefficient::TotalValue() double FGCoefficient::TotalValue()
{ {
switch(type) { switch(type) {
case 0: case 0:
return -1; return -1;
@ -249,23 +232,16 @@ void FGCoefficient::DumpSD(void)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGCoefficient::Debug(void)
{
//TODO: Add your source code here
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGCoefficient::DisplayCoeffFactors(void) void FGCoefficient::DisplayCoeffFactors(void)
{ {
unsigned int i; unsigned int i;
cout << " Non-Dimensionalized by: "; cout << " Non-Dimensionalized by: ";
if( multipliers.size() == 0) { if (multipliers.size() == 0) {
cout << "none" << endl; cout << "none" << endl;
} else { } else {
for (i=0; i<multipliers.size();i++) for (i=0; i<multipliers.size(); i++)
cout << FDMExec->GetState()->paramdef[multipliers[i]]; cout << FDMExec->GetState()->paramdef[multipliers[i]];
} }
cout << endl; cout << endl;
@ -273,7 +249,8 @@ void FGCoefficient::DisplayCoeffFactors(void)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
string FGCoefficient::GetCoefficientValues(void) { string FGCoefficient::GetCoefficientValues(void)
{
char buffer[10]; char buffer[10];
string value; string value;
@ -283,4 +260,64 @@ string FGCoefficient::GetCoefficientValues(void) {
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGCoefficient::Debug(int from)
{
if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
if (from == 2) { // Loading
cout << "\n " << highint << underon << name << underoff << normint << endl;
cout << " " << description << endl;
cout << " " << method << endl;
if (type == VECTOR || type == TABLE) {
cout << " Rows: " << rows << " ";
if (type == TABLE) {
cout << "Cols: " << columns;
}
cout << endl << " Row indexing parameter: " << multparmsRow << endl;
}
if (type == TABLE) {
cout << " Column indexing parameter: " << multparmsCol << endl;
}
if (type == VALUE) {
cout << " Value = " << StaticValue << endl;
} else if (type == VECTOR || type == TABLE) {
Table->Print();
}
DisplayCoeffFactors();
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGCoefficient" << endl;
if (from == 1) cout << "Destroyed: FGCoefficient" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
}
}

View file

@ -126,6 +126,9 @@ private:
string description; string description;
string name; string name;
string method; string method;
string multparms;
string multparmsRow;
string multparmsCol;
double Value(double, double); double Value(double, double);
double Value(double); double Value(double);
double Value(void); double Value(void);
@ -148,7 +151,7 @@ private:
FGAuxiliary* Auxiliary; FGAuxiliary* Auxiliary;
FGOutput* Output; FGOutput* Output;
virtual void Debug(void); virtual void Debug(int from);
}; };
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -285,7 +285,7 @@ FGColumnVector3& FGColumnVector3::operator<<(const double ff)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGColumnVector3::Debug(void) void FGColumnVector3::Debug(int from)
{ {
//TODO: Add your source code here //TODO: Add your source code here
} }

View file

@ -110,7 +110,7 @@ public:
private: private:
double data[4]; double data[4];
int rowCtr; int rowCtr;
void Debug(void); void Debug(int from);
}; };
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -273,7 +273,7 @@ FGColumnVector4& FGColumnVector4::operator<<(const double ff)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGColumnVector4::Debug(void) void FGColumnVector4::Debug(int from)
{ {
//TODO: Add your source code here //TODO: Add your source code here
} }

View file

@ -109,7 +109,7 @@ public:
private: private:
double data[5]; double data[5];
int rowCtr; int rowCtr;
void Debug(void); void Debug(int from);
}; };
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -45,7 +45,7 @@ FGConfigFile::FGConfigFile(string cfgFileName)
#endif #endif
else Opened = false; else Opened = false;
if (debug_lvl & 2) cout << "Instantiated: FGConfigFile" << endl; Debug(0);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -53,14 +53,13 @@ FGConfigFile::FGConfigFile(string cfgFileName)
FGConfigFile::~FGConfigFile() FGConfigFile::~FGConfigFile()
{ {
cfgfile.close(); cfgfile.close();
if (debug_lvl & 2) cout << "Destroyed: FGConfigFile" << endl; Debug(1);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
string FGConfigFile::GetNextConfigLine(void) string FGConfigFile::GetNextConfigLine(void)
{ {
int comment_starts_at; int comment_starts_at;
int comment_ends_at; int comment_ends_at;
int comment_length; int comment_length;
@ -317,9 +316,39 @@ void FGConfigFile::ResetLineIndexToZero(void)
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGConfigFile::Debug(void) void FGConfigFile::Debug(int from)
{ {
//TODO: Add your source code here if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGConfigFile" << endl;
if (from == 1) cout << "Destroyed: FGConfigFile" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
}
} }

View file

@ -134,7 +134,7 @@ private:
bool CommentsOn; bool CommentsOn;
bool Opened; bool Opened;
unsigned int CurrentIndex; unsigned int CurrentIndex;
void Debug(void); void Debug(int from);
}; };
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -85,7 +85,7 @@ FGEngine::FGEngine(FGFDMExec* exec)
Running = false; Running = false;
Cranking = Starter = false; Cranking = Starter = false;
if (debug_lvl & 2) cout << "Instantiated: FGEngine" << endl; Debug(0);
TrimMode = false; TrimMode = false;
} }
@ -93,7 +93,7 @@ FGEngine::FGEngine(FGFDMExec* exec)
FGEngine::~FGEngine() FGEngine::~FGEngine()
{ {
if (debug_lvl & 2) cout << "Destroyed: FGEngine" << endl; Debug(1);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -154,9 +154,41 @@ void FGEngine::AddFeedTank(int tkID)
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGEngine::Debug(void) void FGEngine::Debug(int from)
{ {
//TODO: Add your source code here if (debug_lvl <= 0) return;
}
if (debug_lvl & 1) { // Standard console startup message output
if (from == 0) { // Constructor
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGEngine" << endl;
if (from == 1) cout << "Destroyed: FGEngine" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
}
}

View file

@ -234,7 +234,7 @@ protected:
FGOutput* Output; FGOutput* Output;
vector <int> SourceTanks; vector <int> SourceTanks;
void Debug(void); virtual void Debug(int from);
}; };
#include "FGState.h" #include "FGState.h"

View file

@ -72,7 +72,7 @@ FGFCS::FGFCS(FGFDMExec* fdmex) : FGModel(fdmex)
GearCmd = GearPos = 1; // default to gear down GearCmd = GearPos = 1; // default to gear down
LeftBrake = RightBrake = CenterBrake = 0.0; LeftBrake = RightBrake = CenterBrake = 0.0;
if (debug_lvl & 2) cout << "Instantiated: " << Name << endl; Debug(0);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -89,7 +89,7 @@ FGFCS::~FGFCS()
unsigned int i; unsigned int i;
for (i=0;i<Components.size();i++) delete Components[i]; for (i=0;i<Components.size();i++) delete Components[i];
if (debug_lvl & 2) cout << "Destroyed: FGFCS" << endl; Debug(1);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -304,7 +304,8 @@ string FGFCS::GetComponentName(int idx) {
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
double FGFCS::GetBrake(FGLGear::BrakeGroup bg) { double FGFCS::GetBrake(FGLGear::BrakeGroup bg)
{
switch (bg) { switch (bg) {
case FGLGear::bgLeft: case FGLGear::bgLeft:
return LeftBrake; return LeftBrake;
@ -323,7 +324,6 @@ double FGFCS::GetBrake(FGLGear::BrakeGroup bg) {
string FGFCS::GetComponentStrings(void) string FGFCS::GetComponentStrings(void)
{ {
unsigned int comp; unsigned int comp;
string CompStrings = ""; string CompStrings = "";
bool firstime = true; bool firstime = true;
@ -342,7 +342,6 @@ string FGFCS::GetComponentStrings(void)
string FGFCS::GetComponentValues(void) string FGFCS::GetComponentValues(void)
{ {
unsigned int comp; unsigned int comp;
string CompValues = ""; string CompValues = "";
char buffer[10]; char buffer[10];
bool firstime = true; bool firstime = true;
@ -371,9 +370,41 @@ void FGFCS::AddThrottle(void)
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGFCS::Debug(void) void FGFCS::Debug(int from)
{ {
//TODO: Add your source code here if (debug_lvl <= 0) return;
}
if (debug_lvl & 1) { // Standard console startup message output
if (from == 0) { // Constructor
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGFCS" << endl;
if (from == 1) cout << "Destroyed: FGFCS" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
}
}

View file

@ -426,7 +426,7 @@ private:
double GearCmd,GearPos; double GearCmd,GearPos;
vector <FGFCSComponent*> Components; vector <FGFCSComponent*> Components;
void Debug(void); void Debug(int from);
}; };
#include "FGState.h" #include "FGState.h"

View file

@ -43,17 +43,14 @@ INCLUDES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#ifdef FGFS #ifdef FGFS
# include <time.h>
# include <simgear/compiler.h> # include <simgear/compiler.h>
# include STL_IOSTREAM # include STL_IOSTREAM
# include STL_ITERATOR # include STL_ITERATOR
#else #else
# if defined(sgi) && !defined(__GNUC__) # if defined(sgi) && !defined(__GNUC__)
# include <iostream.h> # include <iostream.h>
# include <time.h>
# else # else
# include <iostream> # include <iostream>
# include <ctime>
# endif # endif
# include <iterator> # include <iterator>
#endif #endif
@ -146,29 +143,24 @@ FGFDMExec::FGFDMExec(void)
debug_lvl = 1; debug_lvl = 1;
} }
if (debug_lvl > 0) { Debug(0);
cout << "\n\n " << highint << underon << "JSBSim Flight Dynamics Model v"
<< JSBSim_version << underoff << normint << endl;
cout << halfint << " [cfg file spec v" << needed_cfg_version << "]\n\n";
cout << normint << "JSBSim startup beginning ...\n\n";
}
if (debug_lvl & 2) cout << "Instantiated: FGFDMExec" << endl;
Allocate(); Allocate();
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGFDMExec::~FGFDMExec() { FGFDMExec::~FGFDMExec()
{
DeAllocate(); DeAllocate();
if (debug_lvl & 2) cout << "Destroyed: FGFDMExec" << endl;
Debug(1);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bool FGFDMExec::Allocate(void) { bool FGFDMExec::Allocate(void)
{
bool result=true; bool result=true;
Atmosphere = new FGAtmosphere(this); Atmosphere = new FGAtmosphere(this);
@ -340,9 +332,7 @@ bool FGFDMExec::Run(void)
if (State->Getsim_time() >= EndTime) return false; if (State->Getsim_time() >= EndTime) return false;
} }
if (debug_lvl & 4) Debug(2);
cout << "================== Frame: " << Frame << " Time: "
<< State->Getsim_time() << endl;
while (!model_iterator->Run()) { while (!model_iterator->Run()) {
model_iterator = model_iterator->NextModel; model_iterator = model_iterator->NextModel;
@ -395,7 +385,7 @@ bool FGFDMExec::LoadModel(string APath, string EPath, string model)
if (result) { if (result) {
modelLoaded = true; modelLoaded = true;
if (debug_lvl > 0) cout << "\n\nJSBSim startup complete\n\n"; Debug(3);
} else { } else {
cerr << fgred cerr << fgred
<< " FGFDMExec: Failed to load aircraft and/or engine model" << " FGFDMExec: Failed to load aircraft and/or engine model"
@ -497,6 +487,8 @@ bool FGFDMExec::LoadScript(string script)
} }
} }
} else if (token.empty()) {
// do nothing
} else { } else {
cerr << "Unrecognized keyword in script file: \"" << token << "\" [runscript] " << endl; cerr << "Unrecognized keyword in script file: \"" << token << "\" [runscript] " << endl;
} }
@ -507,76 +499,7 @@ bool FGFDMExec::LoadScript(string script)
exit(-1); exit(-1);
} }
// print out conditions for double-checking if requested Debug(4);
if (debug_lvl > 0) {
vector <struct condition>::iterator iterConditions = Conditions.begin();
int count=0;
cout << "\n Script goes from " << StartTime << " to " << EndTime
<< " with dt = " << dt << endl << endl;
while (iterConditions < Conditions.end()) {
cout << " Condition: " << count++ << endl;
cout << " if (";
for (i=0; i<iterConditions->TestValue.size(); i++) {
if (i>0) cout << " and" << endl << " ";
cout << "(" << State->paramdef[iterConditions->TestParam[i]]
<< iterConditions->Comparison[i] << " "
<< iterConditions->TestValue[i] << ")";
}
cout << ") then {";
for (i=0; i<iterConditions->SetValue.size(); i++) {
cout << endl << " set" << State->paramdef[iterConditions->SetParam[i]]
<< "to " << iterConditions->SetValue[i];
switch (iterConditions->Type[i]) {
case FG_VALUE:
cout << " (constant";
break;
case FG_DELTA:
cout << " (delta";
break;
case FG_BOOL:
cout << " (boolean";
break;
default:
cout << " (unspecified type";
}
switch (iterConditions->Action[i]) {
case FG_RAMP:
cout << " via ramp";
break;
case FG_STEP:
cout << " via step";
break;
case FG_EXP:
cout << " via exponential approach";
break;
default:
cout << " via unspecified action";
}
if (!iterConditions->Persistent[i]) cout << endl
<< " once";
else cout << endl
<< " repeatedly";
if (iterConditions->Action[i] == FG_RAMP ||
iterConditions->Action[i] == FG_EXP) cout << endl
<< " with time constant "
<< iterConditions->TC[i];
}
cout << ")" << endl << " }" << endl << endl;
iterConditions++;
}
cout << endl;
}
result = LoadModel("aircraft", "engine", aircraft); result = LoadModel("aircraft", "engine", aircraft);
if (!result) { if (!result) {
@ -673,9 +596,119 @@ void FGFDMExec::RunScript(void)
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGFDMExec::Debug(void) void FGFDMExec::Debug(int from)
{ {
//TODO: Add your source code here unsigned int i;
}
if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
if (from == 0) { // Constructor
cout << "\n\n " << highint << underon << "JSBSim Flight Dynamics Model v"
<< JSBSim_version << underoff << normint << endl;
cout << halfint << " [cfg file spec v" << needed_cfg_version << "]\n\n";
cout << normint << "JSBSim startup beginning ...\n\n";
} else if (from == 3) {
cout << "\n\nJSBSim startup complete\n\n";
} else if (from == 4) { // print out script data
vector <struct condition>::iterator iterConditions = Conditions.begin();
int count=0;
cout << "\n Script goes from " << StartTime << " to " << EndTime
<< " with dt = " << State->Getdt() << endl << endl;
while (iterConditions < Conditions.end()) {
cout << " Condition: " << count++ << endl;
cout << " if (";
for (i=0; i<iterConditions->TestValue.size(); i++) {
if (i>0) cout << " and" << endl << " ";
cout << "(" << State->paramdef[iterConditions->TestParam[i]]
<< iterConditions->Comparison[i] << " "
<< iterConditions->TestValue[i] << ")";
}
cout << ") then {";
for (i=0; i<iterConditions->SetValue.size(); i++) {
cout << endl << " set" << State->paramdef[iterConditions->SetParam[i]]
<< "to " << iterConditions->SetValue[i];
switch (iterConditions->Type[i]) {
case FG_VALUE:
cout << " (constant";
break;
case FG_DELTA:
cout << " (delta";
break;
case FG_BOOL:
cout << " (boolean";
break;
default:
cout << " (unspecified type";
}
switch (iterConditions->Action[i]) {
case FG_RAMP:
cout << " via ramp";
break;
case FG_STEP:
cout << " via step";
break;
case FG_EXP:
cout << " via exponential approach";
break;
default:
cout << " via unspecified action";
}
if (!iterConditions->Persistent[i]) cout << endl
<< " once";
else cout << endl
<< " repeatedly";
if (iterConditions->Action[i] == FG_RAMP ||
iterConditions->Action[i] == FG_EXP) cout << endl
<< " with time constant "
<< iterConditions->TC[i];
}
cout << ")" << endl << " }" << endl << endl;
iterConditions++;
}
cout << endl;
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGFDMExec" << endl;
if (from == 1) cout << "Destroyed: FGFDMExec" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
if (from == 2) {
cout << "================== Frame: " << Frame << " Time: "
<< State->Getsim_time() << endl;
}
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
}
}

View file

@ -347,7 +347,7 @@ private:
bool Allocate(void); bool Allocate(void);
bool DeAllocate(void); bool DeAllocate(void);
void Debug(void); void Debug(int from);
}; };
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -69,41 +69,39 @@ CLASS IMPLEMENTATION
FGFactorGroup::FGFactorGroup( FGFDMExec* fdmex ) : FGCoefficient( fdmex) FGFactorGroup::FGFactorGroup( FGFDMExec* fdmex ) : FGCoefficient( fdmex)
{ {
FDMExec=fdmex; FDMExec = fdmex;
if (debug_lvl & 2) cout << "Instantiated: FGFactorGroup" << endl;
Debug(0);
} }
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
FGFactorGroup::~FGFactorGroup() FGFactorGroup::~FGFactorGroup()
{ {
unsigned i; for (unsigned int i=0; i<sum.size(); i++) delete sum[i];
for (i=0; i<sum.size(); i++) {
delete sum[i]; Debug(1);
}
if (debug_lvl & 2) cout << "Destroyed: FGFactorGroup" << endl;
} }
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
bool FGFactorGroup::Load(FGConfigFile *AC_cfg) { bool FGFactorGroup::Load(FGConfigFile *AC_cfg)
{
string token; string token;
if(AC_cfg) { if (AC_cfg) {
name = AC_cfg->GetValue("NAME"); name = AC_cfg->GetValue("NAME");
AC_cfg->GetNextConfigLine(); AC_cfg->GetNextConfigLine();
*AC_cfg >> description; *AC_cfg >> description;
token = AC_cfg->GetValue(); token = AC_cfg->GetValue();
if( token == "FACTOR") { if (token == "FACTOR") {
FGCoefficient::Load(AC_cfg); FGCoefficient::Load(AC_cfg);
//if (debug_lvl > 0) DisplayCoeffFactors(ca.back()->Getmultipliers());
} }
token = AC_cfg->GetValue(); token = AC_cfg->GetValue();
while ( token != string("/GROUP") ) { while (token != string("/GROUP") ) {
sum.push_back( new FGCoefficient(FDMExec) ); sum.push_back( new FGCoefficient(FDMExec) );
sum.back()->Load(AC_cfg); sum.back()->Load(AC_cfg);
//if (debug_lvl > 0) DisplayCoeffFactors(ca.back()->Getmultipliers()); token = AC_cfg->GetValue();
token = AC_cfg->GetValue();
} }
AC_cfg->GetNextConfigLine(); AC_cfg->GetNextConfigLine();
return true; return true;
@ -114,25 +112,58 @@ bool FGFactorGroup::Load(FGConfigFile *AC_cfg) {
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
double FGFactorGroup::TotalValue(void) { double FGFactorGroup::TotalValue(void)
unsigned i; {
double totalsum=0; unsigned int i;
SDtotal=0.0; double totalsum = 0;
for(i=0;i<sum.size();i++) { SDtotal = 0.0;
totalsum+=sum[i]->TotalValue(); for (i=0; i<sum.size(); i++) {
totalsum += sum[i]->TotalValue();
SDtotal += sum[i]->GetSD(); SDtotal += sum[i]->GetSD();
} }
totalsum *= FGCoefficient::TotalValue(); totalsum *= FGCoefficient::TotalValue();
SDtotal *= FGCoefficient::GetSD(); SDtotal *= FGCoefficient::GetSD();
if (debug_lvl & 8) Debug(); Debug(2);
return totalsum; return totalsum;
}
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
void FGFactorGroup::Debug(void)
{
cout << "FGCoefficient::GetSD(): " << FGCoefficient::GetSD() << endl;
cout << "FGFactorGroup::SDtotal: " << SDtotal << endl;
} }
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGFactorGroup::Debug(int from)
{
if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGFactorGroup" << endl;
if (from == 1) cout << "Destroyed: FGFactorGroup" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
if (from == 2) {
cout << "FGCoefficient::GetSD(): " << FGCoefficient::GetSD() << endl;
cout << "FGFactorGroup::SDtotal: " << SDtotal << endl;
}
}
if (debug_lvl & 16) { // Sanity checking
}
}

View file

@ -111,7 +111,7 @@ class FGFactorGroup: public FGCoefficient {
typedef vector<FGCoefficient*> CoeffArray; typedef vector<FGCoefficient*> CoeffArray;
CoeffArray sum; CoeffArray sum;
double SDtotal; double SDtotal;
void Debug(void); void Debug(int from);
}; };
#endif #endif

View file

@ -61,14 +61,14 @@ FGForce::FGForce(FGFDMExec *FDMExec) :
mT(2,2) = 1; mT(2,2) = 1;
mT(3,3) = 1; mT(3,3) = 1;
vSense.InitMatrix(1); vSense.InitMatrix(1);
if (debug_lvl & 2) cout << "Instantiated: FGForce" << endl; Debug(0);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGForce::~FGForce() FGForce::~FGForce()
{ {
if (debug_lvl & 2) cout << "Destroyed: FGForce" << endl; Debug(1);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -135,9 +135,42 @@ void FGForce::SetAnglesToBody(double broll, double bpitch, double byaw)
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGForce::Debug(void) void FGForce::Debug(int from)
{ {
//TODO: Add your source code here if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
if (from == 0) { // Constructor
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGForce" << endl;
if (from == 1) cout << "Destroyed: FGForce" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
}
} }

View file

@ -316,8 +316,6 @@ protected:
FGColumnVector3 vMn; FGColumnVector3 vMn;
FGColumnVector3 vH; FGColumnVector3 vH;
virtual void Debug(void);
private: private:
FGColumnVector3 vFb; FGColumnVector3 vFb;
FGColumnVector3 vM; FGColumnVector3 vM;
@ -327,6 +325,8 @@ private:
FGColumnVector3 vSense; FGColumnVector3 vSense;
FGMatrix33 mT; FGMatrix33 mT;
virtual void Debug(int from);
}; };
#endif #endif

View file

@ -49,11 +49,17 @@ FGGroundReactions::FGGroundReactions(FGFDMExec* fgex) : FGModel(fgex)
{ {
Name = "FGGroundReactions"; Name = "FGGroundReactions";
if (debug_lvl & 2) cout << "Instantiated: " << Name << endl; Debug(0);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGGroundReactions::~FGGroundReactions(void)
{
Debug(1);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bool FGGroundReactions::Run(void) bool FGGroundReactions::Run(void)
{ {
double steerAngle = 0.0; double steerAngle = 0.0;
@ -194,9 +200,42 @@ string FGGroundReactions::GetGroundReactionValues(void)
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGGroundReactions::Debug(void) void FGGroundReactions::Debug(int from)
{ {
//TODO: Add your source code here if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
if (from == 0) { // Constructor
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGGroundReactions" << endl;
if (from == 1) cout << "Destroyed: FGGroundReactions" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
}
} }

View file

@ -69,7 +69,7 @@ class FGGroundReactions : public FGModel
{ {
public: public:
FGGroundReactions(FGFDMExec*); FGGroundReactions(FGFDMExec*);
~FGGroundReactions() {}; ~FGGroundReactions(void);
bool Run(void); bool Run(void);
bool Load(FGConfigFile* AC_cfg); bool Load(FGConfigFile* AC_cfg);
@ -93,7 +93,7 @@ private:
FGColumnVector3 vMaxStaticGrip; FGColumnVector3 vMaxStaticGrip;
FGColumnVector3 vMaxMomentResist; FGColumnVector3 vMaxMomentResist;
void Debug(void); void Debug(int from);
}; };
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -60,14 +60,14 @@ FGInertial::FGInertial(FGFDMExec* fgex) : FGModel(fgex)
gAccelReference = GM/(RadiusReference*RadiusReference); gAccelReference = GM/(RadiusReference*RadiusReference);
gAccel = GM/(RadiusReference*RadiusReference); gAccel = GM/(RadiusReference*RadiusReference);
if (debug_lvl & 2) cout << "Instantiated: FGInertial" << endl; Debug(0);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGInertial::~FGInertial(void) FGInertial::~FGInertial(void)
{ {
if (debug_lvl & 2) cout << "Destroyed: FGInertial" << endl; Debug(1);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -123,9 +123,42 @@ bool FGInertial::LoadInertial(FGConfigFile* AC_cfg)
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGInertial::Debug(void) void FGInertial::Debug(int from)
{ {
//TODO: Add your source code here if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
if (from == 0) { // Constructor
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGInertial" << endl;
if (from == 1) cout << "Destroyed: FGInertial" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
}
} }

View file

@ -83,7 +83,6 @@ public:
double RefRadius(void) {return RadiusReference;} double RefRadius(void) {return RadiusReference;}
private: private:
void Debug(void);
FGColumnVector3 vOmegaLocal; FGColumnVector3 vOmegaLocal;
FGColumnVector3 vForces; FGColumnVector3 vForces;
FGColumnVector3 vRadius; FGColumnVector3 vRadius;
@ -93,6 +92,7 @@ private:
double RadiusReference; double RadiusReference;
double RotationRate; double RotationRate;
double GM; double GM;
void Debug(int from);
}; };
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -366,6 +366,8 @@ void FGInitialCondition::calcWindUVW(void) {
wnorth=whead*cos(psi) + wcross*cos(psi+M_PI/2); wnorth=whead*cos(psi) + wcross*cos(psi+M_PI/2);
weast=whead*sin(psi) + wcross*sin(psi+M_PI/2); weast=whead*sin(psi) + wcross*sin(psi+M_PI/2);
break; break;
case setwned:
break;
} }
uw=wnorth*ctheta*cpsi + uw=wnorth*ctheta*cpsi +
weast*ctheta*spsi - weast*ctheta*spsi -

View file

@ -262,7 +262,7 @@ protected:
static queue <Message*> Messages; static queue <Message*> Messages;
virtual void Debug(void) {}; virtual void Debug(int from) {};
static short debug_lvl; static short debug_lvl;
static unsigned int frame; static unsigned int frame;

View file

@ -60,27 +60,12 @@ CLASS IMPLEMENTATION
FGLGear::FGLGear(FGConfigFile* AC_cfg, FGFDMExec* fdmex) : Exec(fdmex) FGLGear::FGLGear(FGConfigFile* AC_cfg, FGFDMExec* fdmex) : Exec(fdmex)
{ {
string tmp; string tmp;
string Retractable;
*AC_cfg >> tmp >> name >> vXYZ(1) >> vXYZ(2) >> vXYZ(3) *AC_cfg >> tmp >> name >> vXYZ(1) >> vXYZ(2) >> vXYZ(3)
>> kSpring >> bDamp>> dynamicFCoeff >> staticFCoeff >> kSpring >> bDamp>> dynamicFCoeff >> staticFCoeff
>> rollingFCoeff >> sSteerType >> sBrakeGroup >> rollingFCoeff >> sSteerType >> sBrakeGroup
>> maxSteerAngle >> Retractable; >> maxSteerAngle >> Retractable;
if (debug_lvl > 0) {
cout << " Name: " << name << endl;
cout << " Location: " << vXYZ << endl;
cout << " Spring Constant: " << kSpring << endl;
cout << " Damping Constant: " << bDamp << endl;
cout << " Dynamic Friction: " << dynamicFCoeff << endl;
cout << " Static Friction: " << staticFCoeff << endl;
cout << " Rolling Friction: " << rollingFCoeff << endl;
cout << " Steering Type: " << sSteerType << endl;
cout << " Grouping: " << sBrakeGroup << endl;
cout << " Max Steer Angle: " << maxSteerAngle << endl;
cout << " Retractable: " << Retractable << endl;
}
if (sBrakeGroup == "LEFT" ) eBrakeGrp = bgLeft; if (sBrakeGroup == "LEFT" ) eBrakeGrp = bgLeft;
else if (sBrakeGroup == "RIGHT" ) eBrakeGrp = bgRight; else if (sBrakeGroup == "RIGHT" ) eBrakeGrp = bgRight;
else if (sBrakeGroup == "CENTER") eBrakeGrp = bgCenter; else if (sBrakeGroup == "CENTER") eBrakeGrp = bgCenter;
@ -100,7 +85,7 @@ FGLGear::FGLGear(FGConfigFile* AC_cfg, FGFDMExec* fdmex) : Exec(fdmex)
<< sSteerType << " is undefined." << endl; << sSteerType << " is undefined." << endl;
} }
if( Retractable == "RETRACT" ) { if ( Retractable == "RETRACT" ) {
isRetractable=true; isRetractable=true;
} else { } else {
isRetractable=false; isRetractable=false;
@ -132,7 +117,7 @@ FGLGear::FGLGear(FGConfigFile* AC_cfg, FGFDMExec* fdmex) : Exec(fdmex)
vLocalGear = State->GetTb2l() * vWhlBodyVec; vLocalGear = State->GetTb2l() * vWhlBodyVec;
if (debug_lvl & 2) cout << "Instantiated: FGLGear" << endl; Debug(0);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -181,13 +166,15 @@ FGLGear::FGLGear(const FGLGear& lgear)
isRetractable = lgear.isRetractable; isRetractable = lgear.isRetractable;
GearUp = lgear.GearUp; GearUp = lgear.GearUp;
GearDown = lgear.GearDown; GearDown = lgear.GearDown;
Debug(0);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGLGear::~FGLGear() FGLGear::~FGLGear()
{ {
if (debug_lvl & 2) cout << "Destroyed: FGLGear" << endl; Debug(1);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -413,9 +400,7 @@ FGColumnVector3& FGLGear::Force(void)
MaximumStrutForce = MaximumStrutTravel = 0.0; MaximumStrutForce = MaximumStrutTravel = 0.0;
} }
compressLength = 0.0;// reset compressLength to zero for data output validity compressLength = 0.0; // reset compressLength to zero for data output validity
} }
if (FirstContact) { if (FirstContact) {
@ -442,8 +427,6 @@ FGColumnVector3& FGLGear::Force(void)
PutMessage("Crash Detected"); PutMessage("Crash Detected");
Exec->Freeze(); Exec->Freeze();
} }
} }
return vForce; return vForce;
} }
@ -467,9 +450,52 @@ void FGLGear::Report(void)
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGLGear::Debug(void) void FGLGear::Debug(int from)
{ {
// TODO: Add user code here if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
if (from == 0) { // Constructor
cout << " Name: " << name << endl;
cout << " Location: " << vXYZ << endl;
cout << " Spring Constant: " << kSpring << endl;
cout << " Damping Constant: " << bDamp << endl;
cout << " Dynamic Friction: " << dynamicFCoeff << endl;
cout << " Static Friction: " << staticFCoeff << endl;
cout << " Rolling Friction: " << rollingFCoeff << endl;
cout << " Steering Type: " << sSteerType << endl;
cout << " Grouping: " << sBrakeGroup << endl;
cout << " Max Steer Angle: " << maxSteerAngle << endl;
cout << " Retractable: " << Retractable << endl;
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGLGear" << endl;
if (from == 1) cout << "Destroyed: FGLGear" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
}
} }

View file

@ -268,6 +268,7 @@ private:
string name; string name;
string sSteerType; string sSteerType;
string sBrakeGroup; string sBrakeGroup;
string Retractable;
BrakeGroup eBrakeGrp; BrakeGroup eBrakeGrp;
SteerType eSteerType; SteerType eSteerType;
@ -282,7 +283,7 @@ private:
FGMassBalance* MassBalance; FGMassBalance* MassBalance;
void Report(void); void Report(void);
void Debug(void); void Debug(int from);
}; };
#include "FGAircraft.h" #include "FGAircraft.h"

View file

@ -52,14 +52,14 @@ FGMassBalance::FGMassBalance(FGFDMExec* fdmex) : FGModel(fdmex)
{ {
Name = "FGMassBalance"; Name = "FGMassBalance";
if (debug_lvl & 2) cout << "Instantiated: FGMassBalance" << endl; Debug(0);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGMassBalance::~FGMassBalance() FGMassBalance::~FGMassBalance()
{ {
if (debug_lvl & 2) cout << "Destroyed: FGMassBalance" << endl; Debug(1);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -85,7 +85,7 @@ bool FGMassBalance::Run(void)
Ixy = baseIxy + Propulsion->GetTanksIxy(vXYZcg) + GetPMIxy(); Ixy = baseIxy + Propulsion->GetTanksIxy(vXYZcg) + GetPMIxy();
Ixz = baseIxz + Propulsion->GetTanksIxz(vXYZcg) + GetPMIxz(); Ixz = baseIxz + Propulsion->GetTanksIxz(vXYZcg) + GetPMIxz();
if (debug_lvl > 1) Debug(); Debug(2);
return false; return false;
} else { } else {
@ -186,16 +186,50 @@ double FGMassBalance::GetPMIxz(void)
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGMassBalance::Debug(void) void FGMassBalance::Debug(int from)
{ {
if (debug_lvl & 16) { // Sanity check variables if (debug_lvl <= 0) return;
if (EmptyWeight <= 0.0 || EmptyWeight > 1e9)
cout << "MassBalance::EmptyWeight out of bounds: " << EmptyWeight << endl; if (debug_lvl & 1) { // Standard console startup message output
if (Weight <= 0.0 || Weight > 1e9) if (from == 0) { // Constructor
cout << "MassBalance::Weight out of bounds: " << Weight << endl;
if (Mass <= 0.0 || Mass > 1e9) }
cout << "MassBalance::Mass out of bounds: " << Mass << endl; }
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGPiston" << endl;
if (from == 1) cout << "Destroyed: FGPiston" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
if (from == 2) {
if (EmptyWeight <= 0.0 || EmptyWeight > 1e9)
cout << "MassBalance::EmptyWeight out of bounds: " << EmptyWeight << endl;
if (Weight <= 0.0 || Weight > 1e9)
cout << "MassBalance::Weight out of bounds: " << Weight << endl;
if (Mass <= 0.0 || Mass > 1e9)
cout << "MassBalance::Mass out of bounds: " << Mass << endl;
}
} }
} }

View file

@ -108,7 +108,7 @@ private:
vector <FGColumnVector3> PointMassLoc; vector <FGColumnVector3> PointMassLoc;
vector <double> PointMassWeight; vector <double> PointMassWeight;
FGColumnVector3 PointMassCG; FGColumnVector3 PointMassCG;
void Debug(void); void Debug(int from);
}; };
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -35,7 +35,7 @@ FGMatrix33::FGMatrix33(void)
InitMatrix(); InitMatrix();
rowCtr = colCtr = 1; rowCtr = colCtr = 1;
if (debug_lvl & 2) cout << "Instantiated: FGMatrix33" << endl; Debug(0);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -45,7 +45,7 @@ FGMatrix33::FGMatrix33(int r, int c)
InitMatrix(); InitMatrix();
rowCtr = colCtr = 1; rowCtr = colCtr = 1;
if (debug_lvl & 2) cout << "Instantiated: FGMatrix33" << endl; Debug(0);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -64,7 +64,7 @@ FGMatrix33::FGMatrix33(const FGMatrix33& M)
data[3][2] = M.data[3][2]; data[3][2] = M.data[3][2];
data[3][3] = M.data[3][3]; data[3][3] = M.data[3][3];
if (debug_lvl & 2) cout << "Instantiated: FGMatrix33" << endl; Debug(0);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -73,7 +73,7 @@ FGMatrix33::~FGMatrix33(void)
{ {
rowCtr = colCtr = 1; rowCtr = colCtr = 1;
if (debug_lvl & 2) cout << "Destroyed: FGMatrix33" << endl; Debug(1);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -396,11 +396,42 @@ FGColumnVector3 FGMatrix33::operator*(const FGColumnVector3& Col)
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGMatrix33::Debug(void) void FGMatrix33::Debug(int from)
{ {
//TODO: Add your source code here if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
if (from == 0) { // Constructor
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGMatrix33" << endl;
if (from == 1) cout << "Destroyed: FGMatrix33" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
}
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -128,7 +128,7 @@ protected:
private: private:
void TransposeSquare(void); void TransposeSquare(void);
unsigned int rowCtr, colCtr; unsigned int rowCtr, colCtr;
void Debug(void); void Debug(int from);
}; };
#endif #endif

View file

@ -67,27 +67,19 @@ FGNozzle::FGNozzle(FGFDMExec* FDMExec, FGConfigFile* Nzl_cfg) : FGThruster(FDMEx
else cerr << "Unhandled token in Nozzle config file: " << token << endl; else cerr << "Unhandled token in Nozzle config file: " << token << endl;
} }
if (debug_lvl > 0) {
cout << " Nozzle Name: " << Name << endl;
cout << " Nozzle Exit Pressure = " << PE << endl;
cout << " Nozzle Expansion Ratio = " << ExpR << endl;
cout << " Nozzle Efficiency = " << nzlEff << endl;
cout << " Nozzle Diameter = " << Diameter << endl;
}
Thrust = 0; Thrust = 0;
Type = ttNozzle; Type = ttNozzle;
Area2 = (Diameter*Diameter/4.0)*M_PI; Area2 = (Diameter*Diameter/4.0)*M_PI;
AreaT = Area2/ExpR; AreaT = Area2/ExpR;
if (debug_lvl & 2) cout << "Instantiated: FGNozzle" << endl; Debug(0);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGNozzle::~FGNozzle() FGNozzle::~FGNozzle()
{ {
if (debug_lvl & 2) cout << "Destroyed: FGNozzle" << endl; Debug(1);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -109,9 +101,46 @@ double FGNozzle::GetPowerRequired(void)
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGNozzle::Debug(void) void FGNozzle::Debug(int from)
{ {
//TODO: Add your source code here if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
if (from == 0) { // Constructor
cout << " Nozzle Name: " << Name << endl;
cout << " Nozzle Exit Pressure = " << PE << endl;
cout << " Nozzle Expansion Ratio = " << ExpR << endl;
cout << " Nozzle Efficiency = " << nzlEff << endl;
cout << " Nozzle Diameter = " << Diameter << endl;
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGNozzle" << endl;
if (from == 1) cout << "Destroyed: FGNozzle" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
}
} }

View file

@ -83,7 +83,7 @@ private:
double Diameter; double Diameter;
double AreaT; double AreaT;
double Area2; double Area2;
void Debug(void); void Debug(int from);
}; };
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -72,7 +72,7 @@ FGOutput::FGOutput(FGFDMExec* fdmex) : FGModel(fdmex)
#ifdef FG_WITH_JSBSIM_SOCKET #ifdef FG_WITH_JSBSIM_SOCKET
socket = new FGfdmSocket("localhost",1138); socket = new FGfdmSocket("localhost",1138);
#endif #endif
if (debug_lvl & 2) cout << "Instantiated: " << Name << endl; Debug(0);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -80,7 +80,7 @@ FGOutput::FGOutput(FGFDMExec* fdmex) : FGModel(fdmex)
FGOutput::~FGOutput() FGOutput::~FGOutput()
{ {
if (socket) delete socket; if (socket) delete socket;
if (debug_lvl & 2) cout << "Destroyed: FGOutput" << endl; Debug(1);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -209,7 +209,7 @@ void FGOutput::DelimitedOutput(string fname)
outstream << ", "; outstream << ", ";
outstream << GroundReactions->GetGroundReactionStrings(); outstream << GroundReactions->GetGroundReactionStrings();
} }
if (SubSystems & ssPropulsion) { if (SubSystems & ssPropulsion && Propulsion->GetNumEngines() > 0) {
outstream << ", "; outstream << ", ";
outstream << Propulsion->GetPropulsionStrings(); outstream << Propulsion->GetPropulsionStrings();
} }
@ -284,7 +284,7 @@ void FGOutput::DelimitedOutput(string fname)
outstream << ", "; outstream << ", ";
outstream << GroundReactions->GetGroundReactionValues(); outstream << GroundReactions->GetGroundReactionValues();
} }
if (SubSystems & ssPropulsion) { if (SubSystems & ssPropulsion && Propulsion->GetNumEngines() > 0) {
outstream << ", "; outstream << ", ";
outstream << Propulsion->GetPropulsionValues(); outstream << Propulsion->GetPropulsionValues();
} }
@ -481,9 +481,42 @@ bool FGOutput::Load(FGConfigFile* AC_cfg)
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGOutput::Debug(void) void FGOutput::Debug(int from)
{ {
//TODO: Add your source code here if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
if (from == 0) { // Constructor
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGOutput" << endl;
if (from == 1) cout << "Destroyed: FGOutput" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
}
} }

View file

@ -105,7 +105,7 @@ private:
enum {otNone, otCSV, otTab, otSocket, otTerminal, otUnknown} Type; enum {otNone, otCSV, otTab, otSocket, otTerminal, otUnknown} Type;
ofstream datafile; ofstream datafile;
FGfdmSocket* socket; FGfdmSocket* socket;
void Debug(void); void Debug(int from);
}; };
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -48,9 +48,7 @@ static const char *IdHdr = ID_PISTON;
CLASS IMPLEMENTATION CLASS IMPLEMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
FGPiston::FGPiston(FGFDMExec* exec, FGConfigFile* Eng_cfg) FGPiston::FGPiston(FGFDMExec* exec, FGConfigFile* Eng_cfg) : FGEngine(exec),
: FGEngine(exec),
//these must be initialized this way as they are declared const
CONVERT_CUBIC_INCHES_TO_METERS_CUBED(1.638706e-5), CONVERT_CUBIC_INCHES_TO_METERS_CUBED(1.638706e-5),
R_air(287.3), R_air(287.3),
rho_fuel(800), // estimate rho_fuel(800), // estimate
@ -58,16 +56,14 @@ FGPiston::FGPiston(FGFDMExec* exec, FGConfigFile* Eng_cfg)
Cp_air(1005), Cp_air(1005),
Cp_fuel(1700) Cp_fuel(1700)
{ {
string token; string token;
MinManifoldPressure_inHg=6.5; MinManifoldPressure_inHg = 6.5;
MaxManifoldPressure_inHg=28.5; MaxManifoldPressure_inHg = 28.5;
Displacement=360; Displacement = 360;
MaxHP=200; MaxHP = 200;
Cycles=2; Cycles = 2;
IdleRPM=600; IdleRPM = 600;
// Set constants
Name = Eng_cfg->GetValue("NAME"); Name = Eng_cfg->GetValue("NAME");
Eng_cfg->GetNextConfigLine(); Eng_cfg->GetNextConfigLine();
@ -85,23 +81,10 @@ FGPiston::FGPiston(FGFDMExec* exec, FGConfigFile* Eng_cfg)
else cerr << "Unhandled token in Engine config file: " << token << endl; else cerr << "Unhandled token in Engine config file: " << token << endl;
} }
if (debug_lvl > 0) {
cout << "\n Engine Name: " << Name << endl;
cout << " MinManifoldPressure: " << MinManifoldPressure_inHg << endl;
cout << " MaxManifoldPressure: " << MaxManifoldPressure_inHg << endl;
cout << " Displacement: " << Displacement << endl;
cout << " MaxHP: " << MaxHP << endl;
cout << " Cycles: " << Cycles << endl;
cout << " IdleRPM: " << IdleRPM << endl;
cout << " MaxThrottle: " << MaxThrottle << endl;
cout << " MinThrottle: " << MinThrottle << endl;
cout << " SLFuelFlowMax: " << SLFuelFlowMax << endl;
}
Type = etPiston; Type = etPiston;
crank_counter = 0; crank_counter = 0;
EngineNumber = 0; // FIXME: this should be the actual number EngineNumber = 0;
OilTemp_degK = 298; // FIXME: should be initialized in FGEngine OilTemp_degK = 298;
dt = State->Getdt(); dt = State->Getdt();
@ -123,11 +106,6 @@ FGPiston::FGPiston(FGFDMExec* exec, FGConfigFile* Eng_cfg)
*Lookup_Combustion_Efficiency << 1.60 << 0.525; *Lookup_Combustion_Efficiency << 1.60 << 0.525;
*Lookup_Combustion_Efficiency << 2.00 << 0.345; *Lookup_Combustion_Efficiency << 2.00 << 0.345;
cout << endl;
cout << " Combustion Efficiency table:" << endl;
Lookup_Combustion_Efficiency->Print();
cout << endl;
Power_Mixture_Correlation = new FGTable(13); Power_Mixture_Correlation = new FGTable(13);
*Power_Mixture_Correlation << (14.7/1.6) << 78.0; *Power_Mixture_Correlation << (14.7/1.6) << 78.0;
*Power_Mixture_Correlation << 10 << 86.0; *Power_Mixture_Correlation << 10 << 86.0;
@ -143,27 +121,21 @@ FGPiston::FGPiston(FGFDMExec* exec, FGConfigFile* Eng_cfg)
*Power_Mixture_Correlation << 20 << 74.0; *Power_Mixture_Correlation << 20 << 74.0;
*Power_Mixture_Correlation << (14.7/0.6) << 58; *Power_Mixture_Correlation << (14.7/0.6) << 58;
cout << endl; Debug(0); // Call Debug() routine from constructor if needed
cout << " Power Mixture Correlation table:" << endl;
Power_Mixture_Correlation->Print();
cout << endl;
if (debug_lvl & 2) cout << "Instantiated: FGPiston" << endl;
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGPiston::~FGPiston() FGPiston::~FGPiston()
{ {
if (debug_lvl & 2) cout << "Destroyed: FGPiston" << endl; Debug(1); // Call Debug() routine from constructor if needed
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
double FGPiston::Calculate(double PowerRequired) double FGPiston::Calculate(double PowerRequired)
{ {
// FIXME: calculate from actual fuel flow
// FIXME: calculate from actual fuel flow
ConsumeFuel(); ConsumeFuel();
Throttle = FCS->GetThrottlePos(EngineNumber); Throttle = FCS->GetThrottlePos(EngineNumber);
@ -357,10 +329,10 @@ void FGPiston::doFuelFlow(void)
/** /**
* Calculate the power produced by the engine. * Calculate the power produced by the engine.
* *
* <p>Currently, the JSBSim propellor model does not allow the * Currently, the JSBSim propellor model does not allow the
* engine to produce enough RPMs to get up to a high horsepower. * engine to produce enough RPMs to get up to a high horsepower.
* When tested with sufficient RPM, it has no trouble reaching * When tested with sufficient RPM, it has no trouble reaching
* 200HP.</p> * 200HP.
* *
* Inputs: ManifoldPressure_inHg, p_amb, p_amb_sea_level, RPM, T_amb, * Inputs: ManifoldPressure_inHg, p_amb, p_amb_sea_level, RPM, T_amb,
* equivalence_ratio, Cycles, MaxHP * equivalence_ratio, Cycles, MaxHP
@ -522,9 +494,64 @@ void FGPiston::doOilPressure(void)
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGPiston::Debug(void) void FGPiston::Debug(int from)
{ {
//TODO: Add your source code here if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
if (from == 0) { // Constructor
cout << "\n Engine Name: " << Name << endl;
cout << " MinManifoldPressure: " << MinManifoldPressure_inHg << endl;
cout << " MaxManifoldPressure: " << MaxManifoldPressure_inHg << endl;
cout << " Displacement: " << Displacement << endl;
cout << " MaxHP: " << MaxHP << endl;
cout << " Cycles: " << Cycles << endl;
cout << " IdleRPM: " << IdleRPM << endl;
cout << " MaxThrottle: " << MaxThrottle << endl;
cout << " MinThrottle: " << MinThrottle << endl;
cout << " SLFuelFlowMax: " << SLFuelFlowMax << endl;
cout << endl;
cout << " Combustion Efficiency table:" << endl;
Lookup_Combustion_Efficiency->Print();
cout << endl;
cout << endl;
cout << " Power Mixture Correlation table:" << endl;
Power_Mixture_Correlation->Print();
cout << endl;
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGPiston" << endl;
if (from == 1) cout << "Destroyed: FGPiston" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
}
} }

View file

@ -156,7 +156,7 @@ private:
double HP; double HP;
double combustion_efficiency; double combustion_efficiency;
void Debug(void); void Debug(int from);
}; };
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -103,14 +103,14 @@ FGPosition::FGPosition(FGFDMExec* fdmex) : FGModel(fdmex)
Longitude = Latitude = 0.0; Longitude = Latitude = 0.0;
gamma = Vt = Vground = 0.0; gamma = Vt = Vground = 0.0;
if (debug_lvl & 2) cout << "Instantiated: " << Name << endl; Debug(0);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGPosition::~FGPosition() FGPosition::~FGPosition(void)
{ {
if (debug_lvl & 2) cout << "Destroyed: FGPosition" << endl; Debug(1);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -226,9 +226,42 @@ void FGPosition::SetDistanceAGL(double tt) {
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGPosition::Debug(void) void FGPosition::Debug(int from)
{ {
//TODO: Add your source code here if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
if (from == 0) { // Constructor
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGPosition" << endl;
if (from == 1) cout << "Destroyed: FGPosition" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
}
} }

View file

@ -139,7 +139,7 @@ private:
double psigt; double psigt;
void GetState(void); void GetState(void);
void Debug(void); void Debug(int from);
}; };
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -45,6 +45,10 @@ static const char *IdHdr = ID_PROPELLER;
CLASS IMPLEMENTATION CLASS IMPLEMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
// This class currently makes certain assumptions when calculating torque and
// p-factor. That is, that the axis of rotation is the X axis of the aircraft -
// not just the X-axis of the engine/propeller. This may or may not work for a
// helicopter.
FGPropeller::FGPropeller(FGFDMExec* exec, FGConfigFile* Prop_cfg) : FGThruster(exec) FGPropeller::FGPropeller(FGFDMExec* exec, FGConfigFile* Prop_cfg) : FGThruster(exec)
{ {
@ -90,24 +94,11 @@ FGPropeller::FGPropeller(FGFDMExec* exec, FGConfigFile* Prop_cfg) : FGThruster(e
} }
} }
if (debug_lvl > 0) {
cout << "\n Propeller Name: " << Name << endl;
cout << " IXX = " << Ixx << endl;
cout << " Diameter = " << Diameter << " ft." << endl;
cout << " Number of Blades = " << numBlades << endl;
cout << " Minimum Pitch = " << MinPitch << endl;
cout << " Maximum Pitch = " << MaxPitch << endl;
cout << " Thrust Coefficient: " << endl;
cThrust->Print();
cout << " Power Coefficient: " << endl;
cPower->Print();
}
Type = ttPropeller; Type = ttPropeller;
RPM = 0; RPM = 0;
vTorque.InitMatrix(); vTorque.InitMatrix();
if (debug_lvl & 2) cout << "Instantiated: FGPropeller" << endl; Debug(0);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -116,7 +107,7 @@ FGPropeller::~FGPropeller()
{ {
if (cThrust) delete cThrust; if (cThrust) delete cThrust;
if (cPower) delete cPower; if (cPower) delete cPower;
if (debug_lvl & 2) cout << "Destroyed: FGPropeller" << endl; Debug(1);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -224,8 +215,62 @@ double FGPropeller::GetPowerRequired(void)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGPropeller::Debug(void) FGColumnVector3 FGPropeller::GetPFactor()
{ {
//TODO: Add your source code here double px=0.0, py, pz;
py = Thrust * Sense * (GetActingLocationY() - GetLocationY()) / 12.0;
pz = Thrust * Sense * (GetActingLocationZ() - GetLocationZ()) / 12.0;
return FGColumnVector3(px, py, pz);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGPropeller::Debug(int from)
{
if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
if (from == 0) { // Constructor
cout << "\n Propeller Name: " << Name << endl;
cout << " IXX = " << Ixx << endl;
cout << " Diameter = " << Diameter << " ft." << endl;
cout << " Number of Blades = " << numBlades << endl;
cout << " Minimum Pitch = " << MinPitch << endl;
cout << " Maximum Pitch = " << MaxPitch << endl;
cout << " Thrust Coefficient: " << endl;
cThrust->Print();
cout << " Power Coefficient: " << endl;
cPower->Print();
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGPropeller" << endl;
if (from == 1) cout << "Destroyed: FGPropeller" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
}
} }

View file

@ -1,171 +1,180 @@
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Header: FGPropeller.h Header: FGPropeller.h
Author: Jon S. Berndt Author: Jon S. Berndt
Date started: 08/24/00 Date started: 08/24/00
------------- Copyright (C) 2000 Jon S. Berndt (jsb@hal-pc.org) ------------- ------------- Copyright (C) 2000 Jon S. Berndt (jsb@hal-pc.org) -------------
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later Foundation; either version 2 of the License, or (at your option) any later
version. version.
This program is distributed in the hope that it will be useful, but WITHOUT This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details. details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place - Suite 330, Boston, MA 02111-1307, USA. Place - Suite 330, Boston, MA 02111-1307, USA.
Further information about the GNU General Public License can also be found on Further information about the GNU General Public License can also be found on
the world wide web at http://www.gnu.org. the world wide web at http://www.gnu.org.
HISTORY HISTORY
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
08/24/00 JSB Created 08/24/00 JSB Created
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SENTRY SENTRY
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#ifndef FGPROPELLER_H #ifndef FGPROPELLER_H
#define FGPROPELLER_H #define FGPROPELLER_H
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
INCLUDES INCLUDES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include "FGThruster.h" #include "FGThruster.h"
#include "FGTable.h" #include "FGTable.h"
#include "FGTranslation.h" #include "FGTranslation.h"
#include "FGRotation.h" #include "FGRotation.h"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DEFINITIONS DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_PROPELLER "$Id$" #define ID_PROPELLER "$Id$"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS FORWARD DECLARATIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs] COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/** Propeller modeling class. /** Propeller modeling class.
FGPropeller models a propeller given the tabular data for Ct and Cp FGPropeller models a propeller given the tabular data for Ct and Cp
indexed by advance ratio "J". The data for the propeller is indexed by advance ratio "J". The data for the propeller is
stored in a config file named "prop_name.xml". The propeller config file stored in a config file named "prop_name.xml". The propeller config file
is referenced from the main aircraft config file in the "Propulsion" section. is referenced from the main aircraft config file in the "Propulsion" section.
See the constructor for FGPropeller to see what is read in and what should See the constructor for FGPropeller to see what is read in and what should
be stored in the config file.<br> be stored in the config file.<br>
Several references were helpful, here:<ul> Several references were helpful, here:<ul>
<li>Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics", <li>Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics",
Wiley & Sons, 1979 ISBN 0-471-03032-5</li> Wiley & Sons, 1979 ISBN 0-471-03032-5</li>
<li>Edwin Hartman, David Biermann, "The Aerodynamic Characteristics of <li>Edwin Hartman, David Biermann, "The Aerodynamic Characteristics of
Full Scale Propellers Having 2, 3, and 4 Blades of Clark Y and R.A.F. 6 Full Scale Propellers Having 2, 3, and 4 Blades of Clark Y and R.A.F. 6
Airfoil Sections", NACA Report TN-640, 1938 (?)</li> Airfoil Sections", NACA Report TN-640, 1938 (?)</li>
<li>Various NACA Technical Notes and Reports</li> <li>Various NACA Technical Notes and Reports</li>
<ul> <ul>
@author Jon S. Berndt @author Jon S. Berndt
@version $Id$ @version $Id$
@see FGEngine @see FGEngine
@see FGThruster @see FGThruster
@see FGTable @see FGTable
*/ */
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DECLARATION CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
class FGPropeller : public FGThruster { class FGPropeller : public FGThruster {
public: public:
/** Constructor for FGPropeller. /** Constructor for FGPropeller.
@param exec a pointer to the main executive object @param exec a pointer to the main executive object
@param AC_cfg a pointer to the main aircraft config file object */ @param AC_cfg a pointer to the main aircraft config file object */
FGPropeller(FGFDMExec* exec, FGConfigFile* AC_cfg); FGPropeller(FGFDMExec* exec, FGConfigFile* AC_cfg);
/// Destructor for FGPropeller - deletes the FGTable objects /// Destructor for FGPropeller - deletes the FGTable objects
~FGPropeller(); ~FGPropeller();
/** Sets the Revolutions Per Minute for the propeller. Normally the propeller /** Sets the Revolutions Per Minute for the propeller. Normally the propeller
instance will calculate its own rotational velocity, given the Torque instance will calculate its own rotational velocity, given the Torque
produced by the engine and integrating over time using the standard produced by the engine and integrating over time using the standard
equation for rotational acceleration "a": a = Q/I , where Q is Torque and equation for rotational acceleration "a": a = Q/I , where Q is Torque and
I is moment of inertia for the propeller. I is moment of inertia for the propeller.
@param rpm the rotational velocity of the propeller */ @param rpm the rotational velocity of the propeller */
void SetRPM(double rpm) {RPM = rpm;} void SetRPM(double rpm) {RPM = rpm;}
/** This commands the pitch of the blade to change to the value supplied. /// Returns true of this propeller is variable pitch
This call is meant to be issued either from the cockpit or by the flight bool IsVPitch(void) {return MaxPitch != MinPitch;}
control system (perhaps to maintain constant RPM for a constant-speed
propeller). This value will be limited to be within whatever is specified /** This commands the pitch of the blade to change to the value supplied.
in the config file for Max and Min pitch. It is also one of the lookup This call is meant to be issued either from the cockpit or by the flight
indices to the power and thrust tables for variable-pitch propellers. control system (perhaps to maintain constant RPM for a constant-speed
@param pitch the pitch of the blade in degrees. */ propeller). This value will be limited to be within whatever is specified
void SetPitch(double pitch) {Pitch = pitch;} in the config file for Max and Min pitch. It is also one of the lookup
indices to the power and thrust tables for variable-pitch propellers.
void SetPFactor(double pf) {P_Factor = pf;} @param pitch the pitch of the blade in degrees. */
void SetPitch(double pitch) {Pitch = pitch;}
void SetSense(double s) { Sense = s;}
/// Sets the P-Factor constant
/// Retrieves the pitch of the propeller in degrees. void SetPFactor(double pf) {P_Factor = pf;}
double GetPitch(void) { return Pitch; }
/** Sets the rotation sense of the propeller.
/// Retrieves the RPMs of the propeller @param s this value should be +/- 1 ONLY. +1 indicates clockwise rotation as
double GetRPM(void) { return RPM; } viewed by someone standing behind the engine looking forward into
the direction of flight. */
/// Retrieves the propeller moment of inertia void SetSense(double s) { Sense = s;}
double GetIxx(void) { return Ixx; }
/// Retrieves the pitch of the propeller in degrees.
/// Retrieves the Torque in foot-pounds (Don't you love the English system?) double GetPitch(void) { return Pitch; }
double GetTorque(void) { return vTorque(eX); }
/// Retrieves the RPMs of the propeller
/** Retrieves the power required (or "absorbed") by the propeller - double GetRPM(void) { return RPM; }
i.e. the power required to keep spinning the propeller at the current
velocity, air density, and rotational rate. */ /// Retrieves the propeller moment of inertia
double GetPowerRequired(void); double GetIxx(void) { return Ixx; }
/** Calculates and returns the thrust produced by this propeller. /// Retrieves the Torque in foot-pounds (Don't you love the English system?)
Given the excess power available from the engine (in foot-pounds), the thrust is double GetTorque(void) { return vTorque(eX); }
calculated, as well as the current RPM. The RPM is calculated by integrating
the torque provided by the engine over what the propeller "absorbs" /** Retrieves the power required (or "absorbed") by the propeller -
(essentially the "drag" of the propeller). i.e. the power required to keep spinning the propeller at the current
@param PowerAvailable this is the excess power provided by the engine to velocity, air density, and rotational rate. */
accelerate the prop. It could be negative, dictating that the propeller double GetPowerRequired(void);
would be slowed.
@return the thrust in pounds */ /** Calculates and returns the thrust produced by this propeller.
double Calculate(double PowerAvailable); Given the excess power available from the engine (in foot-pounds), the thrust is
calculated, as well as the current RPM. The RPM is calculated by integrating
private: the torque provided by the engine over what the propeller "absorbs"
int numBlades; (essentially the "drag" of the propeller).
double RPM; @param PowerAvailable this is the excess power provided by the engine to
double Ixx; accelerate the prop. It could be negative, dictating that the propeller
double Diameter; would be slowed.
double MaxPitch; @return the thrust in pounds */
double MinPitch; double Calculate(double PowerAvailable);
double MinRPM; FGColumnVector3 GetPFactor(void);
double MaxRPM;
double P_Factor; private:
double Sense; int numBlades;
double Pitch; double RPM;
double ExcessTorque; double Ixx;
FGColumnVector3 vTorque; double Diameter;
FGTable *cThrust; double MaxPitch;
FGTable *cPower; double MinPitch;
void Debug(void); double MinRPM;
}; double MaxRPM;
double P_Factor;
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% double Sense;
#endif double Pitch;
double ExcessTorque;
FGColumnVector3 vTorque;
FGTable *cThrust;
FGTable *cPower;
void Debug(int from);
};
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#endif

View file

@ -61,7 +61,6 @@ static const char *IdHdr = ID_PROPULSION;
CLASS IMPLEMENTATION CLASS IMPLEMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
FGPropulsion::FGPropulsion(FGFDMExec* exec) : FGModel(exec) FGPropulsion::FGPropulsion(FGFDMExec* exec) : FGModel(exec)
{ {
Name = "FGPropulsion"; Name = "FGPropulsion";
@ -69,7 +68,7 @@ FGPropulsion::FGPropulsion(FGFDMExec* exec) : FGModel(exec)
numTanks = numEngines = numThrusters = 0; numTanks = numEngines = numThrusters = 0;
numOxiTanks = numFuelTanks = 0; numOxiTanks = numFuelTanks = 0;
if (debug_lvl & 2) cout << "Instantiated: " << Name << endl; Debug(0);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -78,7 +77,7 @@ FGPropulsion::~FGPropulsion()
{ {
for (unsigned int i=0; i<Engines.size(); i++) delete Engines[i]; for (unsigned int i=0; i<Engines.size(); i++) delete Engines[i];
Engines.clear(); Engines.clear();
if (debug_lvl & 2) cout << "Destroyed: FGPropulsion" << endl; Debug(1);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -149,7 +148,6 @@ bool FGPropulsion::GetSteadyState(void)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bool FGPropulsion::ICEngineStart(void) bool FGPropulsion::ICEngineStart(void)
{ {
double PowerAvailable; double PowerAvailable;
@ -318,9 +316,9 @@ bool FGPropulsion::Load(FGConfigFile* AC_cfg)
Thrusters[numThrusters]->SetAnglesToBody(0, Pitch, Yaw); Thrusters[numThrusters]->SetAnglesToBody(0, Pitch, Yaw);
if (thrType == "FG_PROPELLER" && P_Factor > 0.001) { if (thrType == "FG_PROPELLER" && P_Factor > 0.001) {
((FGPropeller*)Thrusters[numThrusters])->SetPFactor(P_Factor); ((FGPropeller*)Thrusters[numThrusters])->SetPFactor(P_Factor);
cout << " P-Factor: " << P_Factor << endl; if (debug_lvl > 0) cout << " P-Factor: " << P_Factor << endl;
((FGPropeller*)Thrusters[numThrusters])->SetSense(Sense); ((FGPropeller*)Thrusters[numThrusters])->SetSense(Sense);
cout << " Sense: " << Sense << endl; if (debug_lvl > 0) cout << " Sense: " << Sense << endl;
} }
Thrusters[numThrusters]->SetdeltaT(dt*rate); Thrusters[numThrusters]->SetdeltaT(dt*rate);
Thrusters[numThrusters]->SetThrusterNumber(numThrusters); Thrusters[numThrusters]->SetThrusterNumber(numThrusters);
@ -373,6 +371,7 @@ string FGPropulsion::GetPropulsionStrings(void)
PropulsionStrings += ", "; PropulsionStrings += ", ";
FGPropeller* Propeller = (FGPropeller*)Thrusters[i];
switch(Thrusters[i]->GetType()) { switch(Thrusters[i]->GetType()) {
case FGThruster::ttNozzle: case FGThruster::ttNozzle:
PropulsionStrings += (Thrusters[i]->GetName() + "_Thrust[" + buffer + "]"); PropulsionStrings += (Thrusters[i]->GetName() + "_Thrust[" + buffer + "]");
@ -381,7 +380,12 @@ string FGPropulsion::GetPropulsionStrings(void)
break; break;
case FGThruster::ttPropeller: case FGThruster::ttPropeller:
PropulsionStrings += (Thrusters[i]->GetName() + "_Torque[" + buffer + "], "); PropulsionStrings += (Thrusters[i]->GetName() + "_Torque[" + buffer + "], ");
PropulsionStrings += (Thrusters[i]->GetName() + "_PFactor_Roll[" + buffer + "], ");
PropulsionStrings += (Thrusters[i]->GetName() + "_PFactor_Pitch[" + buffer + "], ");
PropulsionStrings += (Thrusters[i]->GetName() + "_PFactor_Yaw[" + buffer + "], ");
PropulsionStrings += (Thrusters[i]->GetName() + "_Thrust[" + buffer + "], "); PropulsionStrings += (Thrusters[i]->GetName() + "_Thrust[" + buffer + "], ");
if (Propeller->IsVPitch())
PropulsionStrings += (Thrusters[i]->GetName() + "_Pitch[" + buffer + "], ");
PropulsionStrings += (Thrusters[i]->GetName() + "_RPM[" + buffer + "]"); PropulsionStrings += (Thrusters[i]->GetName() + "_RPM[" + buffer + "]");
break; break;
default: default:
@ -427,9 +431,16 @@ string FGPropulsion::GetPropulsionValues(void)
case FGThruster::ttRotor: case FGThruster::ttRotor:
break; break;
case FGThruster::ttPropeller: case FGThruster::ttPropeller:
PropulsionValues += (string(gcvt(((FGPropeller*)Thrusters[i])->GetTorque(), 10, buff)) + ", "); FGPropeller* Propeller = (FGPropeller*)Thrusters[i];
PropulsionValues += (string(gcvt(((FGPropeller*)Thrusters[i])->GetThrust(), 10, buff)) + ", "); FGColumnVector3 vPFactor = Propeller->GetPFactor();
PropulsionValues += (string(gcvt(((FGPropeller*)Thrusters[i])->GetRPM(), 10, buff))); PropulsionValues += string(gcvt(Propeller->GetTorque(), 10, buff)) + ", ";
PropulsionValues += string(gcvt(vPFactor(eRoll), 10, buff)) + ", ";
PropulsionValues += string(gcvt(vPFactor(ePitch), 10, buff)) + ", ";
PropulsionValues += string(gcvt(vPFactor(eYaw), 10, buff)) + ", ";
PropulsionValues += string(gcvt(Propeller->GetThrust(), 10, buff)) + ", ";
if (Propeller->IsVPitch())
PropulsionValues += string(gcvt(Propeller->GetPitch(), 10, buff)) + ", ";
PropulsionValues += string(gcvt(Propeller->GetRPM(), 10, buff));
break; break;
} }
} }
@ -532,9 +543,42 @@ double FGPropulsion::GetTanksIxy(const FGColumnVector3& vXYZcg)
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGPropulsion::Debug(void) void FGPropulsion::Debug(int from)
{ {
//TODO: Add your source code here if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
if (from == 0) { // Constructor
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGPropulsion" << endl;
if (from == 1) cout << "Destroyed: FGPropulsion" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
}
} }

View file

@ -198,7 +198,7 @@ private:
FGColumnVector3 vForces; FGColumnVector3 vForces;
FGColumnVector3 vMoments; FGColumnVector3 vMoments;
FGColumnVector3 vXYZtank; FGColumnVector3 vXYZtank;
void Debug(void); void Debug(int from);
}; };
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -67,32 +67,20 @@ FGRocket::FGRocket(FGFDMExec* exec, FGConfigFile* Eng_cfg) : FGEngine(exec)
else cerr << "Unhandled token in Engine config file: " << token << endl; else cerr << "Unhandled token in Engine config file: " << token << endl;
} }
if (debug_lvl > 0) { Debug(0);
cout << " Engine Name: " << Name << endl;
cout << " Specific Heat Ratio = " << SHR << endl;
cout << " Maximum Chamber Pressure = " << maxPC << endl;
cout << " Propulsive Efficiency = " << propEff << endl;
cout << " MaxThrottle = " << MaxThrottle << endl;
cout << " MinThrottle = " << MinThrottle << endl;
cout << " FuelFlowMax = " << SLFuelFlowMax << endl;
cout << " OxiFlowMax = " << SLOxiFlowMax << endl;
cout << " Variance = " << Variance << endl;
}
EngineNumber = 0; EngineNumber = 0;
Type = etRocket; Type = etRocket;
PC = 0.0; PC = 0.0;
kFactor = (2.0*SHR*SHR/(SHR-1.0))*pow(2.0/(SHR+1), (SHR+1)/(SHR-1)); kFactor = (2.0*SHR*SHR/(SHR-1.0))*pow(2.0/(SHR+1), (SHR+1)/(SHR-1));
if (debug_lvl & 2) cout << "Instantiated: FGRocket" << endl;
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGRocket::~FGRocket() FGRocket::~FGRocket()
{ {
if (debug_lvl & 2) cout << "Destroyed: FGRocket" << endl; Debug(1);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -120,9 +108,50 @@ double FGRocket::Calculate(double pe)
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGRocket::Debug(void) void FGRocket::Debug(int from)
{ {
//TODO: Add your source code here if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
if (from == 0) { // Constructor
cout << " Engine Name: " << Name << endl;
cout << " Specific Heat Ratio = " << SHR << endl;
cout << " Maximum Chamber Pressure = " << maxPC << endl;
cout << " Propulsive Efficiency = " << propEff << endl;
cout << " MaxThrottle = " << MaxThrottle << endl;
cout << " MinThrottle = " << MinThrottle << endl;
cout << " FuelFlowMax = " << SLFuelFlowMax << endl;
cout << " OxiFlowMax = " << SLOxiFlowMax << endl;
cout << " Variance = " << Variance << endl;
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGRocket" << endl;
if (from == 1) cout << "Destroyed: FGRocket" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
}
} }

View file

@ -129,7 +129,7 @@ private:
double kFactor; double kFactor;
double Variance; double Variance;
double PC; double PC;
void Debug(void); void Debug(int from);
}; };
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -81,14 +81,14 @@ FGRotation::FGRotation(FGFDMExec* fdmex) : FGModel(fdmex)
cTht=cPhi=cPsi=1.0; cTht=cPhi=cPsi=1.0;
sTht=sPhi=sPsi=0.0; sTht=sPhi=sPsi=0.0;
if (debug_lvl & 2) cout << "Instantiated: " << Name << endl; Debug(0);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGRotation::~FGRotation() FGRotation::~FGRotation()
{ {
if (debug_lvl & 2) cout << "Destroyed: FGRotation" << endl; Debug(1);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -128,7 +128,7 @@ bool FGRotation::Run(void)
vlastPQRdot = vPQRdot; vlastPQRdot = vPQRdot;
if (debug_lvl > 1) Debug(); if (debug_lvl > 1) Debug(2);
return false; return false;
} else { } else {
@ -150,16 +150,49 @@ void FGRotation::GetState(void)
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGRotation::Debug(void) void FGRotation::Debug(int from)
{ {
if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
if (from == 0) { // Constructor
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGRotation" << endl;
if (from == 1) cout << "Destroyed: FGRotation" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity check variables if (debug_lvl & 16) { // Sanity check variables
if (fabs(vPQR(eP)) > 100) if (from == 2) {
cout << "FGRotation::P (Roll Rate) out of bounds: " << vPQR(eP) << endl; if (fabs(vPQR(eP)) > 100)
if (fabs(vPQR(eQ)) > 100) cout << "FGRotation::P (Roll Rate) out of bounds: " << vPQR(eP) << endl;
cout << "FGRotation::Q (Pitch Rate) out of bounds: " << vPQR(eQ) << endl; if (fabs(vPQR(eQ)) > 100)
if (fabs(vPQR(eR)) > 100) cout << "FGRotation::Q (Pitch Rate) out of bounds: " << vPQR(eQ) << endl;
cout << "FGRotation::R (Yaw Rate) out of bounds: " << vPQR(eR) << endl; if (fabs(vPQR(eR)) > 100)
cout << "FGRotation::R (Yaw Rate) out of bounds: " << vPQR(eR) << endl;
}
} }
} }

View file

@ -129,7 +129,7 @@ private:
void GetState(void); void GetState(void);
void Debug(void); void Debug(int from);
}; };
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -47,14 +47,14 @@ CLASS IMPLEMENTATION
FGRotor::FGRotor(FGFDMExec *FDMExec) : FGThruster(FDMExec) FGRotor::FGRotor(FGFDMExec *FDMExec) : FGThruster(FDMExec)
{ {
if (debug_lvl & 2) cout << "Instantiated: FGRotor" << endl; Debug(0);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGRotor::~FGRotor() FGRotor::~FGRotor()
{ {
if (debug_lvl & 2) cout << "Destroyed: FGRotor" << endl; Debug(1);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -65,10 +65,42 @@ double FGRotor::Calculate(double PowerAvailable)
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGRotor::Debug(void) void FGRotor::Debug(int from)
{ {
//TODO: Add your source code here if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
if (from == 0) { // Constructor
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGRotor" << endl;
if (from == 1) cout << "Destroyed: FGRotor" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
}
} }

View file

@ -59,7 +59,7 @@ public:
double Calculate(double); double Calculate(double);
private: private:
void Debug(void); void Debug(int from);
}; };
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -153,14 +153,14 @@ FGState::FGState(FGFDMExec* fdex)
RegisterVariable(FG_VBARV, " v-tail volume " ); RegisterVariable(FG_VBARV, " v-tail volume " );
RegisterVariable(FG_SET_LOGGING, " data_logging " ); RegisterVariable(FG_SET_LOGGING, " data_logging " );
if (debug_lvl & 2) cout << "Instantiated: FGState" << endl; Debug(0);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGState::~FGState() FGState::~FGState()
{ {
if (debug_lvl & 2) cout << "Destroyed: FGState" << endl; Debug(1);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -843,9 +843,42 @@ void FGState::ReportState(void) {
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGState::Debug(void) void FGState::Debug(int from)
{ {
//TODO: Add your source code here if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
if (from == 0) { // Constructor
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGState" << endl;
if (from == 1) cout << "Destroyed: FGState" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
}
} }

View file

@ -340,8 +340,8 @@ private:
typedef map<string, eParam> CoeffMap; typedef map<string, eParam> CoeffMap;
CoeffMap coeffdef; CoeffMap coeffdef;
void Debug(void);
int ActiveEngine; int ActiveEngine;
void Debug(int from);
}; };
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -69,7 +69,7 @@ FGTable::FGTable(int NRows, int NCols) : nRows(NRows), nCols(NCols)
Data = Allocate(); Data = Allocate();
if (debug_lvl & 2) cout << "Instantiated: FGTable" << endl; Debug(0);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -81,7 +81,7 @@ FGTable::FGTable(int NRows) : nRows(NRows), nCols(1)
rowCounter = 1; rowCounter = 1;
Data = Allocate(); Data = Allocate();
if (debug_lvl & 2) cout << "Instantiated: FGTable" << endl; Debug(0);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -104,7 +104,7 @@ FGTable::~FGTable()
{ {
for (int r=0; r<=nRows; r++) if (Data[r]) delete[] Data[r]; for (int r=0; r<=nRows; r++) if (Data[r]) delete[] Data[r];
if (Data) delete[] Data; if (Data) delete[] Data;
if (debug_lvl & 2) cout << "Destroyed: FGTable" << endl; Debug(1);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -202,14 +202,6 @@ FGTable& FGTable::operator<<(const int n)
return *this; return *this;
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
/*
FGTable& FGTable::operator<<(const double n)
{
*this << (double)n;
return *this;
}
*/
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGTable::Print(void) void FGTable::Print(void)
@ -237,10 +229,43 @@ void FGTable::Print(void)
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGTable::Debug(void) void FGTable::Debug(int from)
{ {
//TODO: Add your source code here if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
if (from == 0) { // Constructor
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGTable" << endl;
if (from == 1) cout << "Destroyed: FGTable" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
}
} }

View file

@ -105,7 +105,7 @@ private:
int colCounter; int colCounter;
int rowCounter; int rowCounter;
double** Allocate(void); double** Allocate(void);
void Debug(void); void Debug(int from);
}; };
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -53,9 +53,10 @@ using std::cout;
FGTank::FGTank(FGConfigFile* AC_cfg) FGTank::FGTank(FGConfigFile* AC_cfg)
{ {
string type = AC_cfg->GetValue("TYPE");
string token; string token;
type = AC_cfg->GetValue("TYPE");
if (type == "FUEL") Type = ttFUEL; if (type == "FUEL") Type = ttFUEL;
else if (type == "OXIDIZER") Type = ttOXIDIZER; else if (type == "OXIDIZER") Type = ttOXIDIZER;
else Type = ttUNKNOWN; else Type = ttUNKNOWN;
@ -80,21 +81,14 @@ FGTank::FGTank(FGConfigFile* AC_cfg)
PctFull = 0; PctFull = 0;
} }
if (debug_lvl > 0) { Debug(0);
cout << " " << type << " tank holds " << Capacity << " lbs. " << type << endl;
cout << " currently at " << PctFull << "% of maximum capacity" << endl;
cout << " Tank location (X, Y, Z): " << X << ", " << Y << ", " << Z << endl;
cout << " Effective radius: " << Radius << " inches" << endl;
}
if (debug_lvl & 2) cout << "Instantiated: FGTank" << endl;
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGTank::~FGTank() FGTank::~FGTank()
{ {
if (debug_lvl & 2) cout << "Destroyed: FGTank" << endl; Debug(1);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -117,9 +111,45 @@ double FGTank::Reduce(double used)
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGTank::Debug(void) void FGTank::Debug(int from)
{ {
//TODO: Add your source code here if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
if (from == 0) { // Constructor
cout << " " << type << " tank holds " << Capacity << " lbs. " << type << endl;
cout << " currently at " << PctFull << "% of maximum capacity" << endl;
cout << " Tank location (X, Y, Z): " << X << ", " << Y << ", " << Z << endl;
cout << " Effective radius: " << Radius << " inches" << endl;
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGTank" << endl;
if (from == 1) cout << "Destroyed: FGTank" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
}
} }

View file

@ -95,13 +95,14 @@ public:
private: private:
TankType Type; TankType Type;
string type;
double X, Y, Z; double X, Y, Z;
double Capacity; double Capacity;
double Radius; double Radius;
double PctFull; double PctFull;
double Contents; double Contents;
bool Selected; bool Selected;
void Debug(void); void Debug(int from);
}; };
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -50,20 +50,53 @@ FGThruster::FGThruster(FGFDMExec *FDMExec) : FGForce(FDMExec),
{ {
SetTransformType(FGForce::tCustom); SetTransformType(FGForce::tCustom);
if (debug_lvl & 2) cout << "Instantiated: FGThruster" << endl; Debug(0);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGThruster::~FGThruster() FGThruster::~FGThruster()
{ {
if (debug_lvl & 2) cout << "Destroyed: FGThruster" << endl; Debug(1);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGThruster::Debug(void) void FGThruster::Debug(int from)
{ {
//TODO: Add your source code here if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
if (from == 0) { // Constructor
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGThruster" << endl;
if (from == 1) cout << "Destroyed: FGThruster" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
}
} }

View file

@ -92,7 +92,7 @@ protected:
double Thrust; double Thrust;
double PowerRequired; double PowerRequired;
double deltaT; double deltaT;
virtual void Debug(void); virtual void Debug(int from);
}; };
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -86,14 +86,14 @@ FGTranslation::FGTranslation(FGFDMExec* fdmex) : FGModel(fdmex)
alpha = beta = 0.0; alpha = beta = 0.0;
adot = bdot = 0.0; adot = bdot = 0.0;
if (debug_lvl & 2) cout << "Instantiated: " << Name << endl; Debug(0);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGTranslation::~FGTranslation() FGTranslation::~FGTranslation(void)
{ {
if (debug_lvl & 2) cout << "Destroyed: FGTranslation" << endl; Debug(1);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -150,7 +150,7 @@ bool FGTranslation::Run(void)
vlastUVWdot = vUVWdot; vlastUVWdot = vUVWdot;
if (debug_lvl > 1) Debug(); if (debug_lvl > 1) Debug(1);
return false; return false;
} else { } else {
@ -159,10 +159,42 @@ bool FGTranslation::Run(void)
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGTranslation::Debug(void) void FGTranslation::Debug(int from)
{ {
if (debug_lvl & 16) { // Sanity check variables if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
if (from == 0) { // Constructor
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGTranslation" << endl;
if (from == 1) cout << "Destroyed: FGTranslation" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
if (fabs(vUVW(eU)) > 1e6) if (fabs(vUVW(eU)) > 1e6)
cout << "FGTranslation::U velocity out of bounds: " << vUVW(eU) << endl; cout << "FGTranslation::U velocity out of bounds: " << vUVW(eU) << endl;
if (fabs(vUVW(eV)) > 1e6) if (fabs(vUVW(eV)) > 1e6)
@ -181,4 +213,3 @@ void FGTranslation::Debug(void)
cout << "FGTranslation::qbar is out of bounds: " << qbar << endl; cout << "FGTranslation::qbar is out of bounds: " << qbar << endl;
} }
} }

View file

@ -128,7 +128,7 @@ private:
double alpha, beta; double alpha, beta;
double adot,bdot; double adot,bdot;
void Debug(void); void Debug(int from);
}; };
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -139,14 +139,14 @@ FGTrimAxis::FGTrimAxis(FGFDMExec* fdex, FGInitialCondition* ic, State st,
} }
if (debug_lvl & 2) cout << "Instantiated: FGTrimAxis" << endl; Debug(0);
} }
/*****************************************************************************/ /*****************************************************************************/
FGTrimAxis::~FGTrimAxis() FGTrimAxis::~FGTrimAxis(void)
{ {
if (debug_lvl & 2) cout << "Destroyed: FGTrimAxis" << endl; Debug(1);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -430,8 +430,42 @@ double FGTrimAxis::GetAvgStability( void ) {
} }
/*****************************************************************************/ /*****************************************************************************/
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGTrimAxis::Debug(void) void FGTrimAxis::Debug(int from)
{ {
if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
if (from == 0) { // Constructor
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGTrimAxis" << endl;
if (from == 1) cout << "Destroyed: FGTrimAxis" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
}
} }

View file

@ -167,7 +167,7 @@ private:
double computeHmgt(void); double computeHmgt(void);
void Debug(void); void Debug(int from);
}; };
#endif #endif

View file

@ -50,14 +50,14 @@ CLASS IMPLEMENTATION
FGTurboJet::FGTurboJet(FGFDMExec* exec, FGConfigFile* cfg) : FGEngine(exec) FGTurboJet::FGTurboJet(FGFDMExec* exec, FGConfigFile* cfg) : FGEngine(exec)
{ {
if (debug_lvl & 2) cout << "Instantiated: FGTurboJet" << endl; Debug(0);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGTurboJet::~FGTurboJet() FGTurboJet::~FGTurboJet()
{ {
if (debug_lvl & 2) cout << "Destroyed: FGTurboJet" << endl; Debug(1);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -69,9 +69,42 @@ double FGTurboJet::Calculate(double dummy)
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGTurboJet::Debug(void) void FGTurboJet::Debug(int from)
{ {
//TODO: Add your source code here if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
if (from == 0) { // Constructor
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGTurboJet" << endl;
if (from == 1) cout << "Destroyed: FGTurboJet" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
}
} }

View file

@ -60,7 +60,7 @@ public:
double Calculate(double); double Calculate(double);
private: private:
void Debug(void); void Debug(int from);
}; };
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -49,14 +49,14 @@ CLASS IMPLEMENTATION
FGTurboProp::FGTurboProp(FGFDMExec* exec, FGConfigFile* cfg) : FGEngine(exec) FGTurboProp::FGTurboProp(FGFDMExec* exec, FGConfigFile* cfg) : FGEngine(exec)
{ {
if (debug_lvl & 2) cout << "Instantiated: FGTurboProp" << endl; Debug(0);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGTurboProp::~FGTurboProp() FGTurboProp::~FGTurboProp()
{ {
if (debug_lvl & 2) cout << "Destroyed: FGTurboProp" << endl; Debug(1);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -68,9 +68,42 @@ double FGTurboProp::Calculate(double dummy)
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGTurboProp::Debug(void) void FGTurboProp::Debug(int from)
{ {
//TODO: Add your source code here if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
if (from == 0) { // Constructor
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGTurboProp" << endl;
if (from == 1) cout << "Destroyed: FGTurboProp" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
}
} }

View file

@ -59,7 +59,7 @@ public:
double Calculate(double); double Calculate(double);
private: private:
void Debug(void); void Debug(int from);
}; };
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -49,14 +49,14 @@ CLASS IMPLEMENTATION
FGTurboShaft::FGTurboShaft(FGFDMExec* exec, FGConfigFile* cfg) : FGEngine(exec) FGTurboShaft::FGTurboShaft(FGFDMExec* exec, FGConfigFile* cfg) : FGEngine(exec)
{ {
if (debug_lvl & 2) cout << "Instantiated: FGTurboShaft" << endl; Debug(0);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGTurboShaft::~FGTurboShaft() FGTurboShaft::~FGTurboShaft()
{ {
if (debug_lvl & 2) cout << "Destroyed: FGTurboShaft" << endl; Debug(1);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -67,8 +67,42 @@ double FGTurboShaft::Calculate(double dummy) {
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGTurboShaft::Debug(void) void FGTurboShaft::Debug(int from)
{ {
//TODO: Add your source code here if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
if (from == 0) { // Constructor
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGTurboShaft" << endl;
if (from == 1) cout << "Destroyed: FGTurboShaft" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
}
} }

View file

@ -59,7 +59,7 @@ public:
double Calculate(double); double Calculate(double);
private: private:
void Debug(void); void Debug(int from);
}; };
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -70,20 +70,53 @@ CLASS IMPLEMENTATION
FGUtility::FGUtility() FGUtility::FGUtility()
{ {
if (debug_lvl & 2) cout << "Instantiated: FGUtility" << endl; Debug(0);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGUtility::~FGUtility() FGUtility::~FGUtility()
{ {
if (debug_lvl & 2) cout << "Destroyed: FGUtility" << endl; Debug(1);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGUtility::Debug(void) void FGUtility::Debug(int from)
{ {
if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
if (from == 0) { // Constructor
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGUtility" << endl;
if (from == 1) cout << "Destroyed: FGUtility" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
}
} }

View file

@ -62,7 +62,7 @@ public:
private: private:
FGState* State; FGState* State;
FGFDMExec* FDMExec; FGFDMExec* FDMExec;
void Debug(void); void Debug(int from);
}; };
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -107,6 +107,7 @@ private:
struct sockaddr_in scktName; struct sockaddr_in scktName;
struct hostent *host; struct hostent *host;
string buffer; string buffer;
void Debug(int from) {}
}; };
#endif #endif

View file

@ -54,18 +54,11 @@ INCLUDES
#ifdef FGFS #ifdef FGFS
#include <simgear/compiler.h> #include <simgear/compiler.h>
#include STL_IOSTREAM #include STL_IOSTREAM
# ifdef SG_HAVE_STD_INCLUDES
# include <ctime>
# else
# include <time.h>
# endif
#else #else
# if defined(sgi) && !defined(__GNUC__) # if defined(sgi) && !defined(__GNUC__)
# include <iostream.h> # include <iostream.h>
# include <time.h>
# else # else
# include <iostream> # include <iostream>
# include <ctime>
# endif # endif
#endif #endif
@ -152,6 +145,10 @@ int main(int argc, char** argv)
} }
} }
//
// RUN loop. MESSAGES are read inside the Run() loop and output as necessary.
//
FGJSBBase::Message* msg; FGJSBBase::Message* msg;
while (FDMExec->Run()) { while (FDMExec->Run()) {
while (FDMExec->ReadMessage()) { while (FDMExec->ReadMessage()) {

View file

@ -67,14 +67,14 @@ FGDeadBand::FGDeadBand(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
} }
} }
if (debug_lvl & 2) cout << "Instantiated: FGDeadBand" << endl; Debug(0);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGDeadBand::~FGDeadBand() FGDeadBand::~FGDeadBand()
{ {
if (debug_lvl & 2) cout << "Destroyed: FGDeadBand" << endl; Debug(1);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -87,9 +87,42 @@ bool FGDeadBand::Run(void )
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGDeadBand::Debug(void) void FGDeadBand::Debug(int from)
{ {
//TODO: Add your source code here if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
if (from == 0) { // Constructor
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGDeadBand" << endl;
if (from == 1) cout << "Destroyed: FGDeadBand" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
}
} }

View file

@ -81,7 +81,7 @@ public:
private: private:
FGConfigFile* AC_cfg; FGConfigFile* AC_cfg;
void Debug(void); void Debug(int from);
}; };
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -57,14 +57,14 @@ FGFCSComponent::FGFCSComponent(FGFCS* _fcs) : fcs(_fcs)
OutputIdx = FG_UNDEF; OutputIdx = FG_UNDEF;
IsOutput = false; IsOutput = false;
if (debug_lvl & 2) cout << "Instantiated: FGFCSComponent" << endl; Debug(0);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGFCSComponent::~FGFCSComponent() FGFCSComponent::~FGFCSComponent()
{ {
if (debug_lvl & 2) cout << "Destroyed: FGFCSComponent" << endl; Debug(1);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -94,9 +94,38 @@ bool FGFCSComponent::Run(void)
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGFCSComponent::Debug(void) void FGFCSComponent::Debug(int from)
{ {
//TODO: Add your source code here if (debug_lvl <= 0) return;
}
if (debug_lvl & 1) { // Standard console startup message output
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGFCSComponent" << endl;
if (from == 1) cout << "Destroyed: FGFCSComponent" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
}
}

View file

@ -115,7 +115,7 @@ protected:
eParam OutputIdx; eParam OutputIdx;
double Output; double Output;
bool IsOutput; bool IsOutput;
virtual void Debug(void); virtual void Debug(int from);
}; };
#include "../FGFCS.h" #include "../FGFCS.h"

View file

@ -131,26 +131,14 @@ FGFilter::FGFilter(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
break; break;
} }
if (debug_lvl > 0) { Debug(0);
cout << " ID: " << ID << endl;
cout << " INPUT: " << InputIdx << endl;
cout << " C1: " << C1 << endl;
cout << " C2: " << C2 << endl;
cout << " C3: " << C3 << endl;
cout << " C4: " << C4 << endl;
cout << " C5: " << C5 << endl;
cout << " C6: " << C6 << endl;
if (IsOutput) cout << " OUTPUT: " << sOutputIdx << endl;
}
if (debug_lvl & 2) cout << "Instantiated: FGFilter" << endl;
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGFilter::~FGFilter() FGFilter::~FGFilter()
{ {
if (debug_lvl & 2) cout << "Destroyed: FGFilter" << endl; Debug(1);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -198,9 +186,50 @@ bool FGFilter::Run(void)
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGFilter::Debug(void) void FGFilter::Debug(int from)
{ {
//TODO: Add your source code here if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
if (from == 0) { // Constructor
cout << " ID: " << ID << endl;
cout << " INPUT: " << InputIdx << endl;
cout << " C1: " << C1 << endl;
cout << " C2: " << C2 << endl;
cout << " C3: " << C3 << endl;
cout << " C4: " << C4 << endl;
cout << " C5: " << C5 << endl;
cout << " C6: " << C6 << endl;
if (IsOutput) cout << " OUTPUT: " << sOutputIdx << endl;
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGFilter" << endl;
if (from == 1) cout << "Destroyed: FGFilter" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
}
} }

View file

@ -115,7 +115,7 @@ private:
double PreviousOutput1; double PreviousOutput1;
double PreviousOutput2; double PreviousOutput2;
FGConfigFile* AC_cfg; FGConfigFile* AC_cfg;
void Debug(void); void Debug(int from);
}; };
#endif #endif

View file

@ -104,28 +104,14 @@ FGGain::FGGain(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
*Table << *AC_cfg; *Table << *AC_cfg;
} }
} }
Debug(0);
if (debug_lvl > 0) {
cout << " ID: " << ID << endl;
cout << " INPUT: " << InputIdx << endl;
cout << " GAIN: " << Gain << endl;
if (IsOutput) cout << " OUTPUT: " << sOutputIdx << endl;
cout << " MIN: " << Min << endl;
cout << " MAX: " << Max << endl;
if (ScheduledBy != FG_UNDEF) {
cout << " Scheduled by parameter: " << ScheduledBy << endl;
Table->Print();
}
}
if (debug_lvl & 2) cout << "Instantiated: FGGain" << endl;
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGGain::~FGGain() FGGain::~FGGain()
{ {
if (debug_lvl & 2) cout << "Destroyed: FGGain" << endl; Debug(1);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -155,9 +141,51 @@ bool FGGain::Run(void )
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGGain::Debug(void) void FGGain::Debug(int from)
{ {
//TODO: Add your source code here if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
if (from == 0) { // Constructor
cout << " ID: " << ID << endl;
cout << " INPUT: " << InputIdx << endl;
cout << " GAIN: " << Gain << endl;
if (IsOutput) cout << " OUTPUT: " << sOutputIdx << endl;
cout << " MIN: " << Min << endl;
cout << " MAX: " << Max << endl;
if (ScheduledBy != FG_UNDEF) {
cout << " Scheduled by parameter: " << ScheduledBy << endl;
Table->Print();
}
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGGain" << endl;
if (from == 1) cout << "Destroyed: FGGain" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
}
} }

View file

@ -82,7 +82,7 @@ private:
int Rows; int Rows;
eParam ScheduledBy; eParam ScheduledBy;
void Debug(void); void Debug(int from);
}; };
#endif #endif

View file

@ -53,14 +53,14 @@ FGGradient::FGGradient(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
Type = AC_cfg->GetValue("TYPE"); Type = AC_cfg->GetValue("TYPE");
Name = AC_cfg->GetValue("NAME"); Name = AC_cfg->GetValue("NAME");
if (debug_lvl & 2) cout << "Instantiated: FGGradient" << endl; Debug(0);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGGradient::~FGGradient() FGGradient::~FGGradient()
{ {
if (debug_lvl & 2) cout << "Destroyed: FGGradient" << endl; Debug(1);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -73,9 +73,42 @@ bool FGGradient::Run(void )
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGGradient::Debug(void) void FGGradient::Debug(int from)
{ {
//TODO: Add your source code here if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
if (from == 0) { // Constructor
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGGradient" << endl;
if (from == 1) cout << "Destroyed: FGGradient" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
}
} }

View file

@ -66,7 +66,7 @@ public:
private: private:
FGConfigFile* AC_cfg; FGConfigFile* AC_cfg;
void Debug(void); void Debug(int from);
}; };
#endif #endif

View file

@ -47,7 +47,8 @@ CLASS IMPLEMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
FGKinemat::FGKinemat(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs), FGKinemat::FGKinemat(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
AC_cfg(AC_cfg) { AC_cfg(AC_cfg)
{
string token; string token;
double tmpDetent; double tmpDetent;
double tmpTime; double tmpTime;
@ -86,17 +87,7 @@ AC_cfg(AC_cfg) {
} }
} }
if (debug_lvl > 1) { Debug(0);
cout << " ID: " << ID << endl;
cout << " INPUT: " << InputIdx << endl;
cout << " DETENTS: " << NumDetents << endl;
for(int i=0;i<NumDetents;i++) {
cout << " " << Detents[i] << " " << TransitionTimes[i] << endl;
}
if (IsOutput) cout << " OUTPUT: " <<sOutputIdx << endl;
}
if (debug_lvl & 2) cout << "Instantiated: FGKinemat" << endl;
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -163,22 +154,58 @@ bool FGKinemat::Run(void ) {
} }
} }
} }
lastInputCmd=InputCmd; lastInputCmd = InputCmd;
Output=OutputPos; Output = OutputPos;
} }
//cout << "FGKinemat::Run Handle: " << InputCmd << " Position: " << OutputPos << " Output: " << Output << endl;
if (IsOutput) { if (IsOutput) SetOutput();
//cout << "Calling SetOutput()" << endl;
SetOutput();
}
//cout << "Out FGKinemat::Run" << endl;
return true; return true;
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGKinemat::Debug(void) void FGKinemat::Debug(int from)
{ {
//TODO: Add your source code here if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
if (from == 0) { // Constructor
cout << " ID: " << ID << endl;
cout << " INPUT: " << InputIdx << endl;
cout << " DETENTS: " << NumDetents << endl;
for(int i=0;i<NumDetents;i++) {
cout << " " << Detents[i] << " " << TransitionTimes[i] << endl;
}
if (IsOutput) cout << " OUTPUT: " <<sOutputIdx << endl;
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGKinemat" << endl;
if (from == 1) cout << "Destroyed: FGKinemat" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
}
} }

View file

@ -82,7 +82,7 @@ private:
double OutputPos; double OutputPos;
bool InTransit; bool InTransit;
void Debug(void); void Debug(int from);
}; };
#endif #endif

View file

@ -90,25 +90,14 @@ FGSummer::FGSummer(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
} }
} }
if (debug_lvl > 0) { Debug(0);
cout << " ID: " << ID << endl;
cout << " INPUTS: " << endl;
for (unsigned i=0;i<InputIndices.size();i++) {
cout << " " << InputIndices[i] << endl;
}
if (clipmax > clipmin) cout << " CLIPTO: " << clipmin
<< ", " << clipmax << endl;
if (IsOutput) cout << " OUTPUT: " <<sOutputIdx << endl;
}
if (debug_lvl & 2) cout << "Instantiated: FGSummer" << endl;
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGSummer::~FGSummer() FGSummer::~FGSummer()
{ {
if (debug_lvl & 2) cout << "Destroyed: FGSummer" << endl; Debug(1);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -144,9 +133,49 @@ bool FGSummer::Run(void )
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGSummer::Debug(void) void FGSummer::Debug(int from)
{ {
//TODO: Add your source code here if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
if (from == 0) { // Constructor
cout << " ID: " << ID << endl;
cout << " INPUTS: " << endl;
for (unsigned i=0;i<InputIndices.size();i++) {
cout << " " << InputIndices[i] << endl;
}
if (clipmax > clipmin) cout << " CLIPTO: " << clipmin
<< ", " << clipmax << endl;
if (IsOutput) cout << " OUTPUT: " <<sOutputIdx << endl;
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGSummer" << endl;
if (from == 1) cout << "Destroyed: FGSummer" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
}
} }

View file

@ -80,7 +80,7 @@ private:
vector <int> InputTypes; vector <int> InputTypes;
bool clip; bool clip;
double clipmin,clipmax; double clipmin,clipmax;
void Debug(void); void Debug(int from);
}; };
#endif #endif

View file

@ -53,14 +53,14 @@ FGSwitch::FGSwitch(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
Type = AC_cfg->GetValue("TYPE"); Type = AC_cfg->GetValue("TYPE");
Name = AC_cfg->GetValue("NAME"); Name = AC_cfg->GetValue("NAME");
if (debug_lvl & 2) cout << "Instantiated: FGSwitch" << endl; Debug(0);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGSwitch::~FGSwitch() FGSwitch::~FGSwitch()
{ {
if (debug_lvl & 2) cout << "Destroyed: FGSwitch" << endl; Debug(1);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -73,9 +73,42 @@ bool FGSwitch::Run(void )
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGSwitch::Debug(void) void FGSwitch::Debug(int from)
{ {
//TODO: Add your source code here if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
if (from == 0) { // Constructor
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGSwitch" << endl;
if (from == 1) cout << "Destroyed: FGSwitch" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
}
} }

View file

@ -63,9 +63,9 @@ public:
bool Run(void); bool Run(void);
private: private:
void Debug(void);
FGFCS* fcs; FGFCS* fcs;
FGConfigFile* AC_cfg; FGConfigFile* AC_cfg;
void Debug(int from);
}; };
#endif #endif