//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-void FGAerodynamics::Debug(void)
+void FGAerodynamics::Debug(int from)
{
//TODO: Add your source code here
}
FGColumnVector3 vLastFs;
FGColumnVector3 vDXYZcg;
- void Debug(void);
+ void Debug(int from);
};
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-void FGAircraft::Debug(void)
+void FGAircraft::Debug(int from)
{
//TODO: Add your source code here
}
bool ReadUndercarriage(FGConfigFile*);
bool ReadPrologue(FGConfigFile*);
bool ReadOutput(FGConfigFile*);
- void Debug(void);
+ void Debug(int from);
};
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// turbType = ttBerndt; // temporarily disable turbulence until fully tested
TurbGain = 100.0;
- if (debug_lvl & 2) cout << "Instantiated: " << Name << endl;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGAtmosphere::~FGAtmosphere()
{
- if (debug_lvl & 2) cout << "Destroyed: FGAtmosphere" << endl;
+ Debug(1);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
State->Seta(soundspeed);
- if (debug_lvl > 1) Debug();
+ Debug(2);
} else { // skip Run() execution this time
}
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGAtmosphere::Debug(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(int from)
{
- if (frame == 0) {
- 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 {
- cout << vTurbulence << ", " << vTurbulenceGrad << ", " << vDirection << ", " << Magnitude << ", " << vTurbPQR << endl;
+ 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: 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;
+ }
}
}
void Calculate(double altitude);
void Turbulence(void);
- void Debug(void);
+ void Debug(int from);
};
/******************************************************************************/
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-void FGAuxiliary::Debug(void)
+void FGAuxiliary::Debug(int from)
{
//TODO: Add your source code here
}
double earthPosAngle;
void GetState(void);
- void Debug(void);
+ void Debug(int from);
};
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-bool FGCoefficient::Load(FGConfigFile *AC_cfg) {
+bool FGCoefficient::Load(FGConfigFile *AC_cfg)
+{
int start, end, n;
- string multparms, mult;
+ string mult;
if (AC_cfg) {
name = AC_cfg->GetValue("NAME");
method = AC_cfg->GetValue("TYPE");
AC_cfg->GetNextConfigLine();
*AC_cfg >> description;
- if (debug_lvl > 0) {
- cout << "\n " << highint << underon << name << underoff << normint << endl;
- cout << " " << description << endl;
- cout << " " << method << endl;
- }
if (method == "EQUATION") type = EQUATION;
else if (method == "TABLE") type = TABLE;
if (type == VECTOR || type == TABLE) {
*AC_cfg >> rows;
- if (debug_lvl > 0) cout << " Rows: " << rows << " ";
if (type == TABLE) {
*AC_cfg >> columns;
- if (debug_lvl > 0) cout << "Cols: " << columns;
Table = new FGTable(rows, columns);
} else {
Table = new FGTable(rows);
}
- if (debug_lvl > 0) cout << endl;
-
- *AC_cfg >> multparms;
- LookupR = State->GetParameterIndex(multparms);
- if (debug_lvl > 0) cout << " Row indexing parameter: " << multparms << endl;
+ *AC_cfg >> multparmsRow;
+ LookupR = State->GetParameterIndex(multparmsRow);
}
if (type == TABLE) {
- *AC_cfg >> multparms;
- LookupC = State->GetParameterIndex(multparms);
- if (debug_lvl > 0) cout << " Column indexing parameter: " << multparms << endl;
+ *AC_cfg >> multparmsCol;
+ LookupC = State->GetParameterIndex(multparmsCol);
}
// Here, read in the line of the form (e.g.) FG_MACH|FG_QBAR|FG_ALPHA
// End of non-dimensionalizing parameter read-in
}
- switch(type) {
- case VALUE:
+ if (type == VALUE) {
*AC_cfg >> StaticValue;
- if (debug_lvl > 0) cout << " Value = " << StaticValue << endl;
- break;
- case VECTOR:
- case TABLE:
+ } else if (type == VECTOR || type == TABLE) {
*Table << *AC_cfg;
- if (debug_lvl > 0) Table->Print();
- break;
- case EQUATION:
- case UNKNOWN:
+ } else {
cerr << "Unimplemented coefficient type: " << type << endl;
- break;
}
+
AC_cfg->GetNextConfigLine();
- if (debug_lvl > 0) DisplayCoeffFactors();
+ Debug(2);
+
return true;
} else {
return false;
double FGCoefficient::TotalValue()
{
-
switch(type) {
case 0:
return -1;
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-void FGCoefficient::Debug(void)
-{
- //TODO: Add your source code here
-}
-
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
void FGCoefficient::DisplayCoeffFactors(void)
{
unsigned int i;
cout << " Non-Dimensionalized by: ";
- if( multipliers.size() == 0) {
+ if (multipliers.size() == 0) {
cout << "none" << endl;
} else {
- for (i=0; i<multipliers.size();i++)
+ for (i=0; i<multipliers.size(); i++)
cout << FDMExec->GetState()->paramdef[multipliers[i]];
}
cout << endl;
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-string FGCoefficient::GetCoefficientValues(void) {
+string FGCoefficient::GetCoefficientValues(void)
+{
char buffer[10];
string value;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+// 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
+ }
+}
string description;
string name;
string method;
+ string multparms;
+ string multparmsRow;
+ string multparmsCol;
double Value(double, double);
double Value(double);
double Value(void);
FGAuxiliary* Auxiliary;
FGOutput* Output;
- virtual void Debug(void);
+ virtual void Debug(int from);
};
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-void FGColumnVector3::Debug(void)
+void FGColumnVector3::Debug(int from)
{
//TODO: Add your source code here
}
private:
double data[4];
int rowCtr;
- void Debug(void);
+ void Debug(int from);
};
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-void FGColumnVector4::Debug(void)
+void FGColumnVector4::Debug(int from)
{
//TODO: Add your source code here
}
private:
double data[5];
int rowCtr;
- void Debug(void);
+ void Debug(int from);
};
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#endif
else Opened = false;
- if (debug_lvl & 2) cout << "Instantiated: FGConfigFile" << endl;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGConfigFile::~FGConfigFile()
{
cfgfile.close();
- if (debug_lvl & 2) cout << "Destroyed: FGConfigFile" << endl;
+ Debug(1);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
string FGConfigFile::GetNextConfigLine(void)
{
-
int comment_starts_at;
int comment_ends_at;
int comment_length;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGConfigFile::Debug(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(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
+ }
}
bool CommentsOn;
bool Opened;
unsigned int CurrentIndex;
- void Debug(void);
+ void Debug(int from);
};
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Running = false;
Cranking = Starter = false;
- if (debug_lvl & 2) cout << "Instantiated: FGEngine" << endl;
+ Debug(0);
TrimMode = false;
}
FGEngine::~FGEngine()
{
- if (debug_lvl & 2) cout << "Destroyed: FGEngine" << endl;
+ Debug(1);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGEngine::Debug(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 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
+ }
+}
FGOutput* Output;
vector <int> SourceTanks;
- void Debug(void);
+ virtual void Debug(int from);
};
#include "FGState.h"
GearCmd = GearPos = 1; // default to gear down
LeftBrake = RightBrake = CenterBrake = 0.0;
- if (debug_lvl & 2) cout << "Instantiated: " << Name << endl;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
unsigned int i;
for (i=0;i<Components.size();i++) delete Components[i];
- if (debug_lvl & 2) cout << "Destroyed: FGFCS" << endl;
+ Debug(1);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-double FGFCS::GetBrake(FGLGear::BrakeGroup bg) {
+double FGFCS::GetBrake(FGLGear::BrakeGroup bg)
+{
switch (bg) {
case FGLGear::bgLeft:
return LeftBrake;
string FGFCS::GetComponentStrings(void)
{
unsigned int comp;
-
string CompStrings = "";
bool firstime = true;
string FGFCS::GetComponentValues(void)
{
unsigned int comp;
-
string CompValues = "";
char buffer[10];
bool firstime = true;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGFCS::Debug(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(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
+ }
+}
double GearCmd,GearPos;
vector <FGFCSComponent*> Components;
- void Debug(void);
+ void Debug(int from);
};
#include "FGState.h"
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#ifdef FGFS
-# include <time.h>
# include <simgear/compiler.h>
# include STL_IOSTREAM
# include STL_ITERATOR
#else
# if defined(sgi) && !defined(__GNUC__)
# include <iostream.h>
-# include <time.h>
# else
# include <iostream>
-# include <ctime>
# endif
# include <iterator>
#endif
debug_lvl = 1;
}
- if (debug_lvl > 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;
+ Debug(0);
Allocate();
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-FGFDMExec::~FGFDMExec() {
+FGFDMExec::~FGFDMExec()
+{
DeAllocate();
- if (debug_lvl & 2) cout << "Destroyed: FGFDMExec" << endl;
+
+ Debug(1);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-bool FGFDMExec::Allocate(void) {
-
+bool FGFDMExec::Allocate(void)
+{
bool result=true;
Atmosphere = new FGAtmosphere(this);
if (State->Getsim_time() >= EndTime) return false;
}
- if (debug_lvl & 4)
- cout << "================== Frame: " << Frame << " Time: "
- << State->Getsim_time() << endl;
+ Debug(2);
while (!model_iterator->Run()) {
model_iterator = model_iterator->NextModel;
if (result) {
modelLoaded = true;
- if (debug_lvl > 0) cout << "\n\nJSBSim startup complete\n\n";
+ Debug(3);
} else {
cerr << fgred
<< " FGFDMExec: Failed to load aircraft and/or engine model"
}
}
+ } else if (token.empty()) {
+ // do nothing
} else {
cerr << "Unrecognized keyword in script file: \"" << token << "\" [runscript] " << endl;
}
exit(-1);
}
- // print out conditions for double-checking if requested
-
- 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;
- }
+ Debug(4);
result = LoadModel("aircraft", "engine", aircraft);
if (!result) {
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGFDMExec::Debug(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(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
+ }
+}
bool Allocate(void);
bool DeAllocate(void);
- void Debug(void);
+ void Debug(int from);
};
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGFactorGroup::FGFactorGroup( FGFDMExec* fdmex ) : FGCoefficient( fdmex)
{
- FDMExec=fdmex;
- if (debug_lvl & 2) cout << "Instantiated: FGFactorGroup" << endl;
+ FDMExec = fdmex;
+
+ Debug(0);
}
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
FGFactorGroup::~FGFactorGroup()
{
- unsigned i;
- for (i=0; i<sum.size(); i++) {
- delete sum[i];
- }
- if (debug_lvl & 2) cout << "Destroyed: FGFactorGroup" << endl;
+ for (unsigned int i=0; i<sum.size(); i++) delete sum[i];
+
+ Debug(1);
}
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-bool FGFactorGroup::Load(FGConfigFile *AC_cfg) {
+bool FGFactorGroup::Load(FGConfigFile *AC_cfg)
+{
string token;
- if(AC_cfg) {
+ if (AC_cfg) {
name = AC_cfg->GetValue("NAME");
AC_cfg->GetNextConfigLine();
*AC_cfg >> description;
token = AC_cfg->GetValue();
- if( token == "FACTOR") {
+ if (token == "FACTOR") {
FGCoefficient::Load(AC_cfg);
- //if (debug_lvl > 0) DisplayCoeffFactors(ca.back()->Getmultipliers());
}
token = AC_cfg->GetValue();
- while ( token != string("/GROUP") ) {
- sum.push_back( new FGCoefficient(FDMExec) );
- sum.back()->Load(AC_cfg);
- //if (debug_lvl > 0) DisplayCoeffFactors(ca.back()->Getmultipliers());
- token = AC_cfg->GetValue();
+ while (token != string("/GROUP") ) {
+ sum.push_back( new FGCoefficient(FDMExec) );
+ sum.back()->Load(AC_cfg);
+ token = AC_cfg->GetValue();
}
AC_cfg->GetNextConfigLine();
return true;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-double FGFactorGroup::TotalValue(void) {
- unsigned i;
- double totalsum=0;
- SDtotal=0.0;
- for(i=0;i<sum.size();i++) {
- totalsum+=sum[i]->TotalValue();
+double FGFactorGroup::TotalValue(void)
+{
+ unsigned int i;
+ double totalsum = 0;
+ SDtotal = 0.0;
+ for (i=0; i<sum.size(); i++) {
+ totalsum += sum[i]->TotalValue();
SDtotal += sum[i]->GetSD();
}
totalsum *= FGCoefficient::TotalValue();
SDtotal *= FGCoefficient::GetSD();
- if (debug_lvl & 8) Debug();
+ Debug(2);
return totalsum;
-}
+}
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-
-void FGFactorGroup::Debug(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 FGFactorGroup::Debug(int from)
{
- cout << "FGCoefficient::GetSD(): " << FGCoefficient::GetSD() << endl;
- cout << "FGFactorGroup::SDtotal: " << SDtotal << endl;
-}
+ 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
+ }
+}
typedef vector<FGCoefficient*> CoeffArray;
CoeffArray sum;
double SDtotal;
- void Debug(void);
+ void Debug(int from);
};
#endif
mT(2,2) = 1;
mT(3,3) = 1;
vSense.InitMatrix(1);
- if (debug_lvl & 2) cout << "Instantiated: FGForce" << endl;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGForce::~FGForce()
{
- if (debug_lvl & 2) cout << "Destroyed: FGForce" << endl;
+ Debug(1);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGForce::Debug(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 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
+ }
}
FGColumnVector3 vMn;
FGColumnVector3 vH;
- virtual void Debug(void);
-
private:
FGColumnVector3 vFb;
FGColumnVector3 vM;
FGColumnVector3 vSense;
FGMatrix33 mT;
+
+ virtual void Debug(int from);
};
#endif
{
Name = "FGGroundReactions";
- if (debug_lvl & 2) cout << "Instantiated: " << Name << endl;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+FGGroundReactions::~FGGroundReactions(void)
+{
+ Debug(1);
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bool FGGroundReactions::Run(void)
{
double steerAngle = 0.0;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGGroundReactions::Debug(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(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
+ }
}
{
public:
FGGroundReactions(FGFDMExec*);
- ~FGGroundReactions() {};
+ ~FGGroundReactions(void);
bool Run(void);
bool Load(FGConfigFile* AC_cfg);
FGColumnVector3 vMaxStaticGrip;
FGColumnVector3 vMaxMomentResist;
- void Debug(void);
+ void Debug(int from);
};
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
gAccelReference = GM/(RadiusReference*RadiusReference);
gAccel = GM/(RadiusReference*RadiusReference);
- if (debug_lvl & 2) cout << "Instantiated: FGInertial" << endl;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGInertial::~FGInertial(void)
{
- if (debug_lvl & 2) cout << "Destroyed: FGInertial" << endl;
+ Debug(1);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGInertial::Debug(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 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
+ }
}
double RefRadius(void) {return RadiusReference;}
private:
- void Debug(void);
FGColumnVector3 vOmegaLocal;
FGColumnVector3 vForces;
FGColumnVector3 vRadius;
double RadiusReference;
double RotationRate;
double GM;
+ void Debug(int from);
};
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wnorth=whead*cos(psi) + wcross*cos(psi+M_PI/2);
weast=whead*sin(psi) + wcross*sin(psi+M_PI/2);
break;
+ case setwned:
+ break;
}
uw=wnorth*ctheta*cpsi +
weast*ctheta*spsi -
static queue <Message*> Messages;
- virtual void Debug(void) {};
+ virtual void Debug(int from) {};
static short debug_lvl;
static unsigned int frame;
FGLGear::FGLGear(FGConfigFile* AC_cfg, FGFDMExec* fdmex) : Exec(fdmex)
{
string tmp;
- string Retractable;
*AC_cfg >> tmp >> name >> vXYZ(1) >> vXYZ(2) >> vXYZ(3)
>> kSpring >> bDamp>> dynamicFCoeff >> staticFCoeff
>> rollingFCoeff >> sSteerType >> sBrakeGroup
>> 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;
else if (sBrakeGroup == "RIGHT" ) eBrakeGrp = bgRight;
else if (sBrakeGroup == "CENTER") eBrakeGrp = bgCenter;
<< sSteerType << " is undefined." << endl;
}
- if( Retractable == "RETRACT" ) {
+ if ( Retractable == "RETRACT" ) {
isRetractable=true;
} else {
isRetractable=false;
vLocalGear = State->GetTb2l() * vWhlBodyVec;
- if (debug_lvl & 2) cout << "Instantiated: FGLGear" << endl;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
isRetractable = lgear.isRetractable;
GearUp = lgear.GearUp;
GearDown = lgear.GearDown;
+
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGLGear::~FGLGear()
{
- if (debug_lvl & 2) cout << "Destroyed: FGLGear" << endl;
+ Debug(1);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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) {
PutMessage("Crash Detected");
Exec->Freeze();
}
-
-
}
return vForce;
}
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGLGear::Debug(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(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
+ }
}
string name;
string sSteerType;
string sBrakeGroup;
+ string Retractable;
BrakeGroup eBrakeGrp;
SteerType eSteerType;
FGMassBalance* MassBalance;
void Report(void);
- void Debug(void);
+ void Debug(int from);
};
#include "FGAircraft.h"
{
Name = "FGMassBalance";
- if (debug_lvl & 2) cout << "Instantiated: FGMassBalance" << endl;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGMassBalance::~FGMassBalance()
{
- if (debug_lvl & 2) cout << "Destroyed: FGMassBalance" << endl;
+ Debug(1);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Ixy = baseIxy + Propulsion->GetTanksIxy(vXYZcg) + GetPMIxy();
Ixz = baseIxz + Propulsion->GetTanksIxz(vXYZcg) + GetPMIxz();
- if (debug_lvl > 1) Debug();
+ Debug(2);
return false;
} else {
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGMassBalance::Debug(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(int from)
{
- if (debug_lvl & 16) { // Sanity check variables
- 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;
+ 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: 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;
+ }
}
}
vector <FGColumnVector3> PointMassLoc;
vector <double> PointMassWeight;
FGColumnVector3 PointMassCG;
- void Debug(void);
+ void Debug(int from);
};
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
InitMatrix();
rowCtr = colCtr = 1;
- if (debug_lvl & 2) cout << "Instantiated: FGMatrix33" << endl;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
InitMatrix();
rowCtr = colCtr = 1;
- if (debug_lvl & 2) cout << "Instantiated: FGMatrix33" << endl;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
data[3][2] = M.data[3][2];
data[3][3] = M.data[3][3];
- if (debug_lvl & 2) cout << "Instantiated: FGMatrix33" << endl;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{
rowCtr = colCtr = 1;
- if (debug_lvl & 2) cout << "Destroyed: FGMatrix33" << endl;
+ Debug(1);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGMatrix33::Debug(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 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
+ }
+}
private:
void TransposeSquare(void);
unsigned int rowCtr, colCtr;
- void Debug(void);
+ void Debug(int from);
};
#endif
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;
Type = ttNozzle;
Area2 = (Diameter*Diameter/4.0)*M_PI;
AreaT = Area2/ExpR;
- if (debug_lvl & 2) cout << "Instantiated: FGNozzle" << endl;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGNozzle::~FGNozzle()
{
- if (debug_lvl & 2) cout << "Destroyed: FGNozzle" << endl;
+ Debug(1);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGNozzle::Debug(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(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
+ }
}
double Diameter;
double AreaT;
double Area2;
- void Debug(void);
+ void Debug(int from);
};
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#ifdef FG_WITH_JSBSIM_SOCKET
socket = new FGfdmSocket("localhost",1138);
#endif
- if (debug_lvl & 2) cout << "Instantiated: " << Name << endl;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGOutput::~FGOutput()
{
if (socket) delete socket;
- if (debug_lvl & 2) cout << "Destroyed: FGOutput" << endl;
+ Debug(1);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
outstream << ", ";
outstream << GroundReactions->GetGroundReactionStrings();
}
- if (SubSystems & ssPropulsion) {
+ if (SubSystems & ssPropulsion && Propulsion->GetNumEngines() > 0) {
outstream << ", ";
outstream << Propulsion->GetPropulsionStrings();
}
outstream << ", ";
outstream << GroundReactions->GetGroundReactionValues();
}
- if (SubSystems & ssPropulsion) {
+ if (SubSystems & ssPropulsion && Propulsion->GetNumEngines() > 0) {
outstream << ", ";
outstream << Propulsion->GetPropulsionValues();
}
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGOutput::Debug(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 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
+ }
}
enum {otNone, otCSV, otTab, otSocket, otTerminal, otUnknown} Type;
ofstream datafile;
FGfdmSocket* socket;
- void Debug(void);
+ void Debug(int from);
};
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-FGPiston::FGPiston(FGFDMExec* exec, FGConfigFile* Eng_cfg)
- : FGEngine(exec),
- //these must be initialized this way as they are declared const
+FGPiston::FGPiston(FGFDMExec* exec, FGConfigFile* Eng_cfg) : FGEngine(exec),
CONVERT_CUBIC_INCHES_TO_METERS_CUBED(1.638706e-5),
R_air(287.3),
rho_fuel(800), // estimate
Cp_air(1005),
Cp_fuel(1700)
{
-
string token;
- MinManifoldPressure_inHg=6.5;
- MaxManifoldPressure_inHg=28.5;
- Displacement=360;
- MaxHP=200;
- Cycles=2;
- IdleRPM=600;
- // Set constants
+ MinManifoldPressure_inHg = 6.5;
+ MaxManifoldPressure_inHg = 28.5;
+ Displacement = 360;
+ MaxHP = 200;
+ Cycles = 2;
+ IdleRPM = 600;
Name = Eng_cfg->GetValue("NAME");
Eng_cfg->GetNextConfigLine();
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;
crank_counter = 0;
- EngineNumber = 0; // FIXME: this should be the actual number
- OilTemp_degK = 298; // FIXME: should be initialized in FGEngine
+ EngineNumber = 0;
+ OilTemp_degK = 298;
dt = State->Getdt();
*Lookup_Combustion_Efficiency << 1.60 << 0.525;
*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 << (14.7/1.6) << 78.0;
*Power_Mixture_Correlation << 10 << 86.0;
*Power_Mixture_Correlation << 20 << 74.0;
*Power_Mixture_Correlation << (14.7/0.6) << 58;
- cout << endl;
- cout << " Power Mixture Correlation table:" << endl;
- Power_Mixture_Correlation->Print();
- cout << endl;
-
- if (debug_lvl & 2) cout << "Instantiated: FGPiston" << endl;
+ Debug(0); // Call Debug() routine from constructor if needed
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGPiston::~FGPiston()
{
- if (debug_lvl & 2) cout << "Destroyed: FGPiston" << endl;
+ Debug(1); // Call Debug() routine from constructor if needed
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
double FGPiston::Calculate(double PowerRequired)
{
-
- // FIXME: calculate from actual fuel flow
+ // FIXME: calculate from actual fuel flow
ConsumeFuel();
Throttle = FCS->GetThrottlePos(EngineNumber);
/**
* 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.
* 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,
* equivalence_ratio, Cycles, MaxHP
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGPiston::Debug(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(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
+ }
}
double HP;
double combustion_efficiency;
- void Debug(void);
+ void Debug(int from);
};
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Longitude = Latitude = 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);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGPosition::Debug(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 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
+ }
}
double psigt;
void GetState(void);
- void Debug(void);
+ void Debug(int from);
};
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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)
{
}
}
- 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;
RPM = 0;
vTorque.InitMatrix();
- if (debug_lvl & 2) cout << "Instantiated: FGPropeller" << endl;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{
if (cThrust) delete cThrust;
if (cPower) delete cPower;
- if (debug_lvl & 2) cout << "Destroyed: FGPropeller" << endl;
+ Debug(1);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-void FGPropeller::Debug(void)
+FGColumnVector3 FGPropeller::GetPFactor()
+{
+ 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)
{
- //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 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
+ }
}
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-\r
- Header: FGPropeller.h\r
- Author: Jon S. Berndt\r
- Date started: 08/24/00\r
-\r
- ------------- Copyright (C) 2000 Jon S. Berndt (jsb@hal-pc.org) -------------\r
-\r
- This program is free software; you can redistribute it and/or modify it under\r
- the terms of the GNU General Public License as published by the Free Software\r
- Foundation; either version 2 of the License, or (at your option) any later\r
- version.\r
-\r
- This program is distributed in the hope that it will be useful, but WITHOUT\r
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more\r
- details.\r
-\r
- You should have received a copy of the GNU General Public License along with\r
- this program; if not, write to the Free Software Foundation, Inc., 59 Temple\r
- Place - Suite 330, Boston, MA 02111-1307, USA.\r
-\r
- Further information about the GNU General Public License can also be found on\r
- the world wide web at http://www.gnu.org.\r
-\r
-HISTORY\r
---------------------------------------------------------------------------------\r
-08/24/00 JSB Created\r
-\r
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-SENTRY\r
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
-\r
-#ifndef FGPROPELLER_H\r
-#define FGPROPELLER_H\r
-\r
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-INCLUDES\r
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
-\r
-#include "FGThruster.h"\r
-#include "FGTable.h"\r
-#include "FGTranslation.h"\r
-#include "FGRotation.h"\r
-\r
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-DEFINITIONS\r
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
-\r
-#define ID_PROPELLER "$Id$"\r
-\r
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-FORWARD DECLARATIONS\r
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
-\r
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]\r
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
-\r
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-CLASS DOCUMENTATION\r
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
-\r
-/** Propeller modeling class.\r
- FGPropeller models a propeller given the tabular data for Ct and Cp\r
- indexed by advance ratio "J". The data for the propeller is\r
- stored in a config file named "prop_name.xml". The propeller config file\r
- is referenced from the main aircraft config file in the "Propulsion" section.\r
- See the constructor for FGPropeller to see what is read in and what should\r
- be stored in the config file.<br>\r
- Several references were helpful, here:<ul>\r
- <li>Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics",\r
- Wiley & Sons, 1979 ISBN 0-471-03032-5</li>\r
- <li>Edwin Hartman, David Biermann, "The Aerodynamic Characteristics of\r
- Full Scale Propellers Having 2, 3, and 4 Blades of Clark Y and R.A.F. 6\r
- Airfoil Sections", NACA Report TN-640, 1938 (?)</li>\r
- <li>Various NACA Technical Notes and Reports</li>\r
- <ul>\r
- @author Jon S. Berndt\r
- @version $Id$\r
- @see FGEngine\r
- @see FGThruster\r
- @see FGTable\r
-*/\r
-\r
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-CLASS DECLARATION\r
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
-\r
-class FGPropeller : public FGThruster {\r
-\r
-public:\r
- /** Constructor for FGPropeller.\r
- @param exec a pointer to the main executive object\r
- @param AC_cfg a pointer to the main aircraft config file object */\r
- FGPropeller(FGFDMExec* exec, FGConfigFile* AC_cfg);\r
-\r
- /// Destructor for FGPropeller - deletes the FGTable objects\r
- ~FGPropeller();\r
-\r
- /** Sets the Revolutions Per Minute for the propeller. Normally the propeller\r
- instance will calculate its own rotational velocity, given the Torque\r
- produced by the engine and integrating over time using the standard\r
- equation for rotational acceleration "a": a = Q/I , where Q is Torque and\r
- I is moment of inertia for the propeller.\r
- @param rpm the rotational velocity of the propeller */\r
- void SetRPM(double rpm) {RPM = rpm;}\r
-\r
- /** This commands the pitch of the blade to change to the value supplied.\r
- This call is meant to be issued either from the cockpit or by the flight\r
- control system (perhaps to maintain constant RPM for a constant-speed\r
- propeller). This value will be limited to be within whatever is specified\r
- in the config file for Max and Min pitch. It is also one of the lookup\r
- indices to the power and thrust tables for variable-pitch propellers.\r
- @param pitch the pitch of the blade in degrees. */\r
- void SetPitch(double pitch) {Pitch = pitch;}\r
- \r
- void SetPFactor(double pf) {P_Factor = pf;}\r
- \r
- void SetSense(double s) { Sense = s;}\r
-\r
- /// Retrieves the pitch of the propeller in degrees.\r
- double GetPitch(void) { return Pitch; }\r
- \r
- /// Retrieves the RPMs of the propeller\r
- double GetRPM(void) { return RPM; }\r
- \r
- /// Retrieves the propeller moment of inertia\r
- double GetIxx(void) { return Ixx; }\r
- \r
- /// Retrieves the Torque in foot-pounds (Don't you love the English system?)\r
- double GetTorque(void) { return vTorque(eX); }\r
- \r
- /** Retrieves the power required (or "absorbed") by the propeller -\r
- i.e. the power required to keep spinning the propeller at the current\r
- velocity, air density, and rotational rate. */\r
- double GetPowerRequired(void);\r
- \r
- /** Calculates and returns the thrust produced by this propeller.\r
- Given the excess power available from the engine (in foot-pounds), the thrust is\r
- calculated, as well as the current RPM. The RPM is calculated by integrating\r
- the torque provided by the engine over what the propeller "absorbs"\r
- (essentially the "drag" of the propeller).\r
- @param PowerAvailable this is the excess power provided by the engine to\r
- accelerate the prop. It could be negative, dictating that the propeller\r
- would be slowed.\r
- @return the thrust in pounds */\r
- double Calculate(double PowerAvailable);\r
-\r
-private:\r
- int numBlades;\r
- double RPM;\r
- double Ixx;\r
- double Diameter;\r
- double MaxPitch;\r
- double MinPitch;\r
- double MinRPM;\r
- double MaxRPM;\r
- double P_Factor;\r
- double Sense;\r
- double Pitch;\r
- double ExcessTorque;\r
- FGColumnVector3 vTorque;\r
- FGTable *cThrust;\r
- FGTable *cPower;\r
- void Debug(void);\r
-};\r
-\r
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-#endif\r
-\r
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+ Header: FGPropeller.h
+ Author: Jon S. Berndt
+ Date started: 08/24/00
+
+ ------------- Copyright (C) 2000 Jon S. Berndt (jsb@hal-pc.org) -------------
+
+ 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
+ Foundation; either version 2 of the License, or (at your option) any later
+ version.
+
+ 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
+ FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ details.
+
+ 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
+ Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ Further information about the GNU General Public License can also be found on
+ the world wide web at http://www.gnu.org.
+
+HISTORY
+--------------------------------------------------------------------------------
+08/24/00 JSB Created
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+SENTRY
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+#ifndef FGPROPELLER_H
+#define FGPROPELLER_H
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+INCLUDES
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+#include "FGThruster.h"
+#include "FGTable.h"
+#include "FGTranslation.h"
+#include "FGRotation.h"
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+DEFINITIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+#define ID_PROPELLER "$Id$"
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+FORWARD DECLARATIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DOCUMENTATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/** Propeller modeling class.
+ FGPropeller models a propeller given the tabular data for Ct and Cp
+ indexed by advance ratio "J". The data for the propeller is
+ 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.
+ See the constructor for FGPropeller to see what is read in and what should
+ be stored in the config file.<br>
+ Several references were helpful, here:<ul>
+ <li>Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics",
+ Wiley & Sons, 1979 ISBN 0-471-03032-5</li>
+ <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
+ Airfoil Sections", NACA Report TN-640, 1938 (?)</li>
+ <li>Various NACA Technical Notes and Reports</li>
+ <ul>
+ @author Jon S. Berndt
+ @version $Id$
+ @see FGEngine
+ @see FGThruster
+ @see FGTable
+*/
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DECLARATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+class FGPropeller : public FGThruster {
+
+public:
+ /** Constructor for FGPropeller.
+ @param exec a pointer to the main executive object
+ @param AC_cfg a pointer to the main aircraft config file object */
+ FGPropeller(FGFDMExec* exec, FGConfigFile* AC_cfg);
+
+ /// Destructor for FGPropeller - deletes the FGTable objects
+ ~FGPropeller();
+
+ /** Sets the Revolutions Per Minute for the propeller. Normally the propeller
+ instance will calculate its own rotational velocity, given the Torque
+ produced by the engine and integrating over time using the standard
+ equation for rotational acceleration "a": a = Q/I , where Q is Torque and
+ I is moment of inertia for the propeller.
+ @param rpm the rotational velocity of the propeller */
+ void SetRPM(double rpm) {RPM = rpm;}
+
+ /// Returns true of this propeller is variable pitch
+ bool IsVPitch(void) {return MaxPitch != MinPitch;}
+
+ /** This commands the pitch of the blade to change to the value supplied.
+ This call is meant to be issued either from the cockpit or by the flight
+ control system (perhaps to maintain constant RPM for a constant-speed
+ propeller). This value will be limited to be within whatever is specified
+ 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.
+ @param pitch the pitch of the blade in degrees. */
+ void SetPitch(double pitch) {Pitch = pitch;}
+
+ /// Sets the P-Factor constant
+ void SetPFactor(double pf) {P_Factor = pf;}
+
+ /** Sets the rotation sense of the propeller.
+ @param s this value should be +/- 1 ONLY. +1 indicates clockwise rotation as
+ viewed by someone standing behind the engine looking forward into
+ the direction of flight. */
+ void SetSense(double s) { Sense = s;}
+
+ /// Retrieves the pitch of the propeller in degrees.
+ double GetPitch(void) { return Pitch; }
+
+ /// Retrieves the RPMs of the propeller
+ double GetRPM(void) { return RPM; }
+
+ /// Retrieves the propeller moment of inertia
+ double GetIxx(void) { return Ixx; }
+
+ /// Retrieves the Torque in foot-pounds (Don't you love the English system?)
+ double GetTorque(void) { return vTorque(eX); }
+
+ /** Retrieves the power required (or "absorbed") by the propeller -
+ i.e. the power required to keep spinning the propeller at the current
+ velocity, air density, and rotational rate. */
+ double GetPowerRequired(void);
+
+ /** Calculates and returns the thrust produced by this propeller.
+ 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
+ the torque provided by the engine over what the propeller "absorbs"
+ (essentially the "drag" of the propeller).
+ @param PowerAvailable this is the excess power provided by the engine to
+ accelerate the prop. It could be negative, dictating that the propeller
+ would be slowed.
+ @return the thrust in pounds */
+ double Calculate(double PowerAvailable);
+ FGColumnVector3 GetPFactor(void);
+
+private:
+ int numBlades;
+ double RPM;
+ double Ixx;
+ double Diameter;
+ double MaxPitch;
+ double MinPitch;
+ double MinRPM;
+ double MaxRPM;
+ double P_Factor;
+ double Sense;
+ double Pitch;
+ double ExcessTorque;
+ FGColumnVector3 vTorque;
+ FGTable *cThrust;
+ FGTable *cPower;
+ void Debug(int from);
+};
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+#endif
+
CLASS IMPLEMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-
FGPropulsion::FGPropulsion(FGFDMExec* exec) : FGModel(exec)
{
Name = "FGPropulsion";
numTanks = numEngines = numThrusters = 0;
numOxiTanks = numFuelTanks = 0;
- if (debug_lvl & 2) cout << "Instantiated: " << Name << endl;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{
for (unsigned int i=0; i<Engines.size(); i++) delete Engines[i];
Engines.clear();
- if (debug_lvl & 2) cout << "Destroyed: FGPropulsion" << endl;
+ Debug(1);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
bool FGPropulsion::ICEngineStart(void)
{
double PowerAvailable;
Thrusters[numThrusters]->SetAnglesToBody(0, Pitch, Yaw);
if (thrType == "FG_PROPELLER" && P_Factor > 0.001) {
((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);
- cout << " Sense: " << Sense << endl;
+ if (debug_lvl > 0) cout << " Sense: " << Sense << endl;
}
Thrusters[numThrusters]->SetdeltaT(dt*rate);
Thrusters[numThrusters]->SetThrusterNumber(numThrusters);
PropulsionStrings += ", ";
+ FGPropeller* Propeller = (FGPropeller*)Thrusters[i];
switch(Thrusters[i]->GetType()) {
case FGThruster::ttNozzle:
PropulsionStrings += (Thrusters[i]->GetName() + "_Thrust[" + buffer + "]");
break;
case FGThruster::ttPropeller:
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 + "], ");
+ if (Propeller->IsVPitch())
+ PropulsionStrings += (Thrusters[i]->GetName() + "_Pitch[" + buffer + "], ");
PropulsionStrings += (Thrusters[i]->GetName() + "_RPM[" + buffer + "]");
break;
default:
case FGThruster::ttRotor:
break;
case FGThruster::ttPropeller:
- PropulsionValues += (string(gcvt(((FGPropeller*)Thrusters[i])->GetTorque(), 10, buff)) + ", ");
- PropulsionValues += (string(gcvt(((FGPropeller*)Thrusters[i])->GetThrust(), 10, buff)) + ", ");
- PropulsionValues += (string(gcvt(((FGPropeller*)Thrusters[i])->GetRPM(), 10, buff)));
+ FGPropeller* Propeller = (FGPropeller*)Thrusters[i];
+ FGColumnVector3 vPFactor = Propeller->GetPFactor();
+ 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;
}
}
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGPropulsion::Debug(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 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
+ }
}
FGColumnVector3 vForces;
FGColumnVector3 vMoments;
FGColumnVector3 vXYZtank;
- void Debug(void);
+ void Debug(int from);
};
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
else cerr << "Unhandled token in Engine config file: " << token << endl;
}
- if (debug_lvl > 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;
- }
+ Debug(0);
EngineNumber = 0;
Type = etRocket;
PC = 0.0;
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()
{
- if (debug_lvl & 2) cout << "Destroyed: FGRocket" << endl;
+ Debug(1);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGRocket::Debug(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 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
+ }
}
double kFactor;
double Variance;
double PC;
- void Debug(void);
+ void Debug(int from);
};
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
cTht=cPhi=cPsi=1.0;
sTht=sPhi=sPsi=0.0;
- if (debug_lvl & 2) cout << "Instantiated: " << Name << endl;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGRotation::~FGRotation()
{
- if (debug_lvl & 2) cout << "Destroyed: FGRotation" << endl;
+ Debug(1);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
vlastPQRdot = vPQRdot;
- if (debug_lvl > 1) Debug();
+ if (debug_lvl > 1) Debug(2);
return false;
} else {
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGRotation::Debug(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(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 (fabs(vPQR(eP)) > 100)
- cout << "FGRotation::P (Roll Rate) out of bounds: " << vPQR(eP) << endl;
- if (fabs(vPQR(eQ)) > 100)
- cout << "FGRotation::Q (Pitch Rate) out of bounds: " << vPQR(eQ) << endl;
- if (fabs(vPQR(eR)) > 100)
- cout << "FGRotation::R (Yaw Rate) out of bounds: " << vPQR(eR) << endl;
+ if (from == 2) {
+ if (fabs(vPQR(eP)) > 100)
+ cout << "FGRotation::P (Roll Rate) out of bounds: " << vPQR(eP) << endl;
+ if (fabs(vPQR(eQ)) > 100)
+ cout << "FGRotation::Q (Pitch Rate) out of bounds: " << vPQR(eQ) << endl;
+ if (fabs(vPQR(eR)) > 100)
+ cout << "FGRotation::R (Yaw Rate) out of bounds: " << vPQR(eR) << endl;
+ }
}
}
-
void GetState(void);
- void Debug(void);
+ void Debug(int from);
};
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGRotor::FGRotor(FGFDMExec *FDMExec) : FGThruster(FDMExec)
{
- if (debug_lvl & 2) cout << "Instantiated: FGRotor" << endl;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGRotor::~FGRotor()
{
- if (debug_lvl & 2) cout << "Destroyed: FGRotor" << endl;
+ Debug(1);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGRotor::Debug(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 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
+ }
}
-
double Calculate(double);
private:
- void Debug(void);
+ void Debug(int from);
};
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RegisterVariable(FG_VBARV, " v-tail volume " );
RegisterVariable(FG_SET_LOGGING, " data_logging " );
- if (debug_lvl & 2) cout << "Instantiated: FGState" << endl;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGState::~FGState()
{
- if (debug_lvl & 2) cout << "Destroyed: FGState" << endl;
+ Debug(1);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGState::Debug(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(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
+ }
}
typedef map<string, eParam> CoeffMap;
CoeffMap coeffdef;
- void Debug(void);
int ActiveEngine;
+ void Debug(int from);
};
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Data = Allocate();
- if (debug_lvl & 2) cout << "Instantiated: FGTable" << endl;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
rowCounter = 1;
Data = Allocate();
- if (debug_lvl & 2) cout << "Instantiated: FGTable" << endl;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{
for (int r=0; r<=nRows; r++) if (Data[r]) delete[] Data[r];
if (Data) delete[] Data;
- if (debug_lvl & 2) cout << "Destroyed: FGTable" << endl;
+ Debug(1);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
return *this;
}
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-/*
-FGTable& FGTable::operator<<(const double n)
-{
- *this << (double)n;
- return *this;
-}
-*/
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGTable::Print(void)
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGTable::Debug(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(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
+ }
}
int colCounter;
int rowCounter;
double** Allocate(void);
- void Debug(void);
+ void Debug(int from);
};
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGTank::FGTank(FGConfigFile* AC_cfg)
{
- string type = AC_cfg->GetValue("TYPE");
string token;
+ type = AC_cfg->GetValue("TYPE");
+
if (type == "FUEL") Type = ttFUEL;
else if (type == "OXIDIZER") Type = ttOXIDIZER;
else Type = ttUNKNOWN;
PctFull = 0;
}
- if (debug_lvl > 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;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGTank::~FGTank()
{
- if (debug_lvl & 2) cout << "Destroyed: FGTank" << endl;
+ Debug(1);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGTank::Debug(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 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
+ }
}
private:
TankType Type;
+ string type;
double X, Y, Z;
double Capacity;
double Radius;
double PctFull;
double Contents;
bool Selected;
- void Debug(void);
+ void Debug(int from);
};
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{
SetTransformType(FGForce::tCustom);
- if (debug_lvl & 2) cout << "Instantiated: FGThruster" << endl;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGThruster::~FGThruster()
{
- if (debug_lvl & 2) cout << "Destroyed: FGThruster" << endl;
+ Debug(1);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGThruster::Debug(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 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
+ }
}
double Thrust;
double PowerRequired;
double deltaT;
- virtual void Debug(void);
+ virtual void Debug(int from);
};
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
alpha = beta = 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);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
vlastUVWdot = vUVWdot;
- if (debug_lvl > 1) Debug();
+ if (debug_lvl > 1) Debug(1);
return false;
} else {
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGTranslation::Debug(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(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)
cout << "FGTranslation::U velocity out of bounds: " << vUVW(eU) << endl;
if (fabs(vUVW(eV)) > 1e6)
cout << "FGTranslation::qbar is out of bounds: " << qbar << endl;
}
}
-
double alpha, beta;
double adot,bdot;
- void Debug(void);
+ void Debug(int from);
};
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}
- 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);
}
/*****************************************************************************/
}
/*****************************************************************************/
-
-void FGTrimAxis::Debug(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(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
+ }
}
double computeHmgt(void);
- void Debug(void);
+ void Debug(int from);
};
#endif
FGTurboJet::FGTurboJet(FGFDMExec* exec, FGConfigFile* cfg) : FGEngine(exec)
{
- if (debug_lvl & 2) cout << "Instantiated: FGTurboJet" << endl;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGTurboJet::~FGTurboJet()
{
- if (debug_lvl & 2) cout << "Destroyed: FGTurboJet" << endl;
+ Debug(1);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGTurboJet::Debug(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 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
+ }
}
double Calculate(double);
private:
- void Debug(void);
+ void Debug(int from);
};
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGTurboProp::FGTurboProp(FGFDMExec* exec, FGConfigFile* cfg) : FGEngine(exec)
{
- if (debug_lvl & 2) cout << "Instantiated: FGTurboProp" << endl;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGTurboProp::~FGTurboProp()
{
- if (debug_lvl & 2) cout << "Destroyed: FGTurboProp" << endl;
+ Debug(1);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGTurboProp::Debug(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 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
+ }
}
double Calculate(double);
private:
- void Debug(void);
+ void Debug(int from);
};
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGTurboShaft::FGTurboShaft(FGFDMExec* exec, FGConfigFile* cfg) : FGEngine(exec)
{
- if (debug_lvl & 2) cout << "Instantiated: FGTurboShaft" << endl;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGTurboShaft::~FGTurboShaft()
{
- if (debug_lvl & 2) cout << "Destroyed: FGTurboShaft" << endl;
+ Debug(1);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGTurboShaft::Debug(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 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
+ }
}
+
double Calculate(double);
private:
- void Debug(void);
+ void Debug(int from);
};
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGUtility::FGUtility()
{
- if (debug_lvl & 2) cout << "Instantiated: FGUtility" << endl;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGUtility::~FGUtility()
{
- if (debug_lvl & 2) cout << "Destroyed: FGUtility" << endl;
+ Debug(1);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGUtility::Debug(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 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
+ }
}
-
private:
FGState* State;
FGFDMExec* FDMExec;
- void Debug(void);
+ void Debug(int from);
};
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
struct sockaddr_in scktName;
struct hostent *host;
string buffer;
+ void Debug(int from) {}
};
#endif
#ifdef FGFS
#include <simgear/compiler.h>
#include STL_IOSTREAM
-# ifdef SG_HAVE_STD_INCLUDES
-# include <ctime>
-# else
-# include <time.h>
-# endif
#else
# if defined(sgi) && !defined(__GNUC__)
# include <iostream.h>
-# include <time.h>
# else
# include <iostream>
-# include <ctime>
# endif
#endif
}
}
+//
+// RUN loop. MESSAGES are read inside the Run() loop and output as necessary.
+//
+
FGJSBBase::Message* msg;
while (FDMExec->Run()) {
while (FDMExec->ReadMessage()) {
}
}
- if (debug_lvl & 2) cout << "Instantiated: FGDeadBand" << endl;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGDeadBand::~FGDeadBand()
{
- if (debug_lvl & 2) cout << "Destroyed: FGDeadBand" << endl;
+ Debug(1);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGDeadBand::Debug(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(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
+ }
}
private:
FGConfigFile* AC_cfg;
- void Debug(void);
+ void Debug(int from);
};
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OutputIdx = FG_UNDEF;
IsOutput = false;
- if (debug_lvl & 2) cout << "Instantiated: FGFCSComponent" << endl;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGFCSComponent::~FGFCSComponent()
{
- if (debug_lvl & 2) cout << "Destroyed: FGFCSComponent" << endl;
+ Debug(1);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGFCSComponent::Debug(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(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
+ }
+}
eParam OutputIdx;
double Output;
bool IsOutput;
- virtual void Debug(void);
+ virtual void Debug(int from);
};
#include "../FGFCS.h"
break;
}
- if (debug_lvl > 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;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGFilter::~FGFilter()
{
- if (debug_lvl & 2) cout << "Destroyed: FGFilter" << endl;
+ Debug(1);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGFilter::Debug(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(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
+ }
}
double PreviousOutput1;
double PreviousOutput2;
FGConfigFile* AC_cfg;
- void Debug(void);
+ void Debug(int from);
};
#endif
*Table << *AC_cfg;
}
}
-
- 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;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGGain::~FGGain()
{
- if (debug_lvl & 2) cout << "Destroyed: FGGain" << endl;
+ Debug(1);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGGain::Debug(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(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
+ }
}
int Rows;
eParam ScheduledBy;
- void Debug(void);
+ void Debug(int from);
};
#endif
Type = AC_cfg->GetValue("TYPE");
Name = AC_cfg->GetValue("NAME");
- if (debug_lvl & 2) cout << "Instantiated: FGGradient" << endl;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGGradient::~FGGradient()
{
- if (debug_lvl & 2) cout << "Destroyed: FGGradient" << endl;
+ Debug(1);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGGradient::Debug(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(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
+ }
}
private:
FGConfigFile* AC_cfg;
- void Debug(void);
+ void Debug(int from);
};
#endif
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
FGKinemat::FGKinemat(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
-AC_cfg(AC_cfg) {
+ AC_cfg(AC_cfg)
+{
string token;
double tmpDetent;
double tmpTime;
}
}
- if (debug_lvl > 1) {
- 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;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}
}
}
- lastInputCmd=InputCmd;
- Output=OutputPos;
- }
- //cout << "FGKinemat::Run Handle: " << InputCmd << " Position: " << OutputPos << " Output: " << Output << endl;
- if (IsOutput) {
- //cout << "Calling SetOutput()" << endl;
- SetOutput();
+ lastInputCmd = InputCmd;
+ Output = OutputPos;
}
- //cout << "Out FGKinemat::Run" << endl;
+
+ if (IsOutput) SetOutput();
+
return true;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGKinemat::Debug(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 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
+ }
}
double OutputPos;
bool InTransit;
- void Debug(void);
+ void Debug(int from);
};
#endif
}
}
- if (debug_lvl > 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;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGSummer::~FGSummer()
{
- if (debug_lvl & 2) cout << "Destroyed: FGSummer" << endl;
+ Debug(1);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGSummer::Debug(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(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
+ }
}
vector <int> InputTypes;
bool clip;
double clipmin,clipmax;
- void Debug(void);
+ void Debug(int from);
};
#endif
Type = AC_cfg->GetValue("TYPE");
Name = AC_cfg->GetValue("NAME");
- if (debug_lvl & 2) cout << "Instantiated: FGSwitch" << endl;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGSwitch::~FGSwitch()
{
- if (debug_lvl & 2) cout << "Destroyed: FGSwitch" << endl;
+ Debug(1);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGSwitch::Debug(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(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
+ }
}
bool Run(void);
private:
- void Debug(void);
FGFCS* fcs;
FGConfigFile* AC_cfg;
+ void Debug(int from);
};
#endif