1
0
Fork 0

Latest JSBSim changes.

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -85,20 +85,16 @@ FGCoefficient::~FGCoefficient()
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bool FGCoefficient::Load(FGConfigFile *AC_cfg) {
bool FGCoefficient::Load(FGConfigFile *AC_cfg)
{
int start, end, n;
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;
@ -108,26 +104,20 @@ bool FGCoefficient::Load(FGConfigFile *AC_cfg) {
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
@ -152,23 +142,17 @@ bool FGCoefficient::Load(FGConfigFile *AC_cfg) {
// 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;
@ -224,7 +208,6 @@ double FGCoefficient::Value(void)
double FGCoefficient::TotalValue()
{
switch(type) {
case 0:
return -1;
@ -249,23 +232,16 @@ void FGCoefficient::DumpSD(void)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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;
@ -273,7 +249,8 @@ void FGCoefficient::DisplayCoeffFactors(void)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
string FGCoefficient::GetCoefficientValues(void) {
string FGCoefficient::GetCoefficientValues(void)
{
char buffer[10];
string value;
@ -283,4 +260,64 @@ string FGCoefficient::GetCoefficientValues(void) {
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGCoefficient::Debug(int from)
{
if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
if (from == 2) { // Loading
cout << "\n " << highint << underon << name << underoff << normint << endl;
cout << " " << description << endl;
cout << " " << method << endl;
if (type == VECTOR || type == TABLE) {
cout << " Rows: " << rows << " ";
if (type == TABLE) {
cout << "Cols: " << columns;
}
cout << endl << " Row indexing parameter: " << multparmsRow << endl;
}
if (type == TABLE) {
cout << " Column indexing parameter: " << multparmsCol << endl;
}
if (type == VALUE) {
cout << " Value = " << StaticValue << endl;
} else if (type == VECTOR || type == TABLE) {
Table->Print();
}
DisplayCoeffFactors();
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGCoefficient" << endl;
if (from == 1) cout << "Destroyed: FGCoefficient" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
}
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -69,40 +69,38 @@ CLASS IMPLEMENTATION
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") ) {
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();
}
AC_cfg->GetNextConfigLine();
@ -114,25 +112,58 @@ bool FGFactorGroup::Load(FGConfigFile *AC_cfg) {
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
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;
}
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
// 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(void)
void FGFactorGroup::Debug(int from)
{
if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGFactorGroup" << endl;
if (from == 1) cout << "Destroyed: FGFactorGroup" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
if (from == 2) {
cout << "FGCoefficient::GetSD(): " << FGCoefficient::GetSD() << endl;
cout << "FGFactorGroup::SDtotal: " << SDtotal << endl;
}
}
if (debug_lvl & 16) { // Sanity checking
}
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -48,9 +48,7 @@ static const char *IdHdr = ID_PISTON;
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
@ -58,16 +56,14 @@ FGPiston::FGPiston(FGFDMExec* exec, FGConfigFile* Eng_cfg)
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();
@ -85,23 +81,10 @@ FGPiston::FGPiston(FGFDMExec* exec, FGConfigFile* Eng_cfg)
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();
@ -123,11 +106,6 @@ FGPiston::FGPiston(FGFDMExec* exec, FGConfigFile* Eng_cfg)
*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;
@ -143,26 +121,20 @@ FGPiston::FGPiston(FGFDMExec* exec, FGConfigFile* Eng_cfg)
*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
ConsumeFuel();
@ -357,10 +329,10 @@ void FGPiston::doFuelFlow(void)
/**
* 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
@ -522,9 +494,64 @@ void FGPiston::doOilPressure(void)
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
// out the normally expected messages, essentially echoing
// the config files as they are read. If the environment
// variable is not set, debug_lvl is set to 1 internally
// 0: This requests JSBSim not to output any messages
// whatsoever.
// 1: This value explicity requests the normal JSBSim
// startup messages
// 2: This value asks for a message to be printed out when
// a class is instantiated
// 4: When this value is set, a message is displayed when a
// FGModel object executes its Run() method
// 8: When this value is set, various runtime state variables
// are printed out periodically
// 16: When set various parameters are sanity checked and
// a message is printed out when they go out of bounds
void FGPiston::Debug(void)
void FGPiston::Debug(int from)
{
//TODO: Add your source code here
if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
if (from == 0) { // Constructor
cout << "\n Engine Name: " << Name << endl;
cout << " MinManifoldPressure: " << MinManifoldPressure_inHg << endl;
cout << " MaxManifoldPressure: " << MaxManifoldPressure_inHg << endl;
cout << " Displacement: " << Displacement << endl;
cout << " MaxHP: " << MaxHP << endl;
cout << " Cycles: " << Cycles << endl;
cout << " IdleRPM: " << IdleRPM << endl;
cout << " MaxThrottle: " << MaxThrottle << endl;
cout << " MinThrottle: " << MinThrottle << endl;
cout << " SLFuelFlowMax: " << SLFuelFlowMax << endl;
cout << endl;
cout << " Combustion Efficiency table:" << endl;
Lookup_Combustion_Efficiency->Print();
cout << endl;
cout << endl;
cout << " Power Mixture Correlation table:" << endl;
Power_Mixture_Correlation->Print();
cout << endl;
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGPiston" << endl;
if (from == 1) cout << "Destroyed: FGPiston" << endl;
}
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
}
if (debug_lvl & 8 ) { // Runtime state variables
}
if (debug_lvl & 16) { // Sanity checking
}
}

View file

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

View file

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

View file

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

View file

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

View file

@ -106,6 +106,9 @@ public:
@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
@ -115,8 +118,13 @@ public:
@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.
@ -146,6 +154,7 @@ public:
would be slowed.
@return the thrust in pounds */
double Calculate(double PowerAvailable);
FGColumnVector3 GetPFactor(void);
private:
int numBlades;
@ -163,7 +172,7 @@ private:
FGColumnVector3 vTorque;
FGTable *cThrust;
FGTable *cPower;
void Debug(void);
void Debug(int from);
};
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -95,13 +95,14 @@ public:
private:
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);
};
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -54,18 +54,11 @@ INCLUDES
#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
@ -152,6 +145,10 @@ int main(int argc, char** argv)
}
}
//
// RUN loop. MESSAGES are read inside the Run() loop and output as necessary.
//
FGJSBBase::Message* msg;
while (FDMExec->Run()) {
while (FDMExec->ReadMessage()) {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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