Coeff = new CoeffArray[6];
- if (debug_lvl & 2) cout << "Instantiated: FGAerodynamics" << endl;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}
delete[] Coeff;
- if (debug_lvl & 2) cout << "Destroyed: FGAerodynamics" << endl;
+ Debug(1);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if (vFs(1) != 0.00) return vFs(3)/vFs(1);
else return 0.00;
}
-
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+// 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 FGAerodynamics::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: FGAerodynamics" << endl;
+ if (from == 1) cout << "Destroyed: FGAerodynamics" << 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 & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-bool FGAircraft::Load(FGConfigFile* AC_cfg)
-{
- string token;
-
- if (!ReadPrologue(AC_cfg)) return false;
-
- while ((AC_cfg->GetNextConfigLine() != string("EOF")) &&
- (token = AC_cfg->GetValue()) != string("/FDM_CONFIG")) {
- if (token == "METRICS") {
- if (debug_lvl > 0) cout << fgcyan << "\n Reading Metrics" << fgdef << endl;
- if (!ReadMetrics(AC_cfg)) return false;
- } else if (token == "AERODYNAMICS") {
- if (debug_lvl > 0) cout << fgcyan << "\n Reading Aerodynamics" << fgdef << endl;
- if (!ReadAerodynamics(AC_cfg)) return false;
- } else if (token == "UNDERCARRIAGE") {
- if (debug_lvl > 0) cout << fgcyan << "\n Reading Landing Gear" << fgdef << endl;
- if (!ReadUndercarriage(AC_cfg)) return false;
- } else if (token == "PROPULSION") {
- if (debug_lvl > 0) cout << fgcyan << "\n Reading Propulsion" << fgdef << endl;
- if (!ReadPropulsion(AC_cfg)) return false;
- } else if (token == "FLIGHT_CONTROL") {
- if (debug_lvl > 0) cout << fgcyan << "\n Reading Flight Control" << fgdef << endl;
- if (!ReadFlightControls(AC_cfg)) return false;
- } else if (token == "OUTPUT") {
- if (debug_lvl > 0) cout << fgcyan << "\n Reading Output directives" << fgdef << endl;
- if (!ReadOutput(AC_cfg)) return false;
- }
- }
-
- return true;
-}
-
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
bool FGAircraft::Run(void)
{
if (!FGModel::Run()) { // if false then execute this Run()
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-bool FGAircraft::ReadPrologue(FGConfigFile* AC_cfg)
-{
- string token = AC_cfg->GetValue();
- string scratch;
- AircraftName = AC_cfg->GetValue("NAME");
- if (debug_lvl > 0) cout << underon << "Reading Aircraft Configuration File"
- << underoff << ": " << highint << AircraftName << normint << endl;
- scratch = AC_cfg->GetValue("VERSION").c_str();
-
- CFGVersion = AC_cfg->GetValue("VERSION");
-
- if (debug_lvl > 0)
- cout << " Version: " << highint << CFGVersion
- << normint << endl;
- if (CFGVersion != needed_cfg_version) {
- cerr << endl << fgred << "YOU HAVE AN INCOMPATIBLE CFG FILE FOR THIS AIRCRAFT."
- " RESULTS WILL BE UNPREDICTABLE !!" << endl;
- cerr << "Current version needed is: " << needed_cfg_version << endl;
- cerr << " You have version: " << CFGVersion << endl << fgdef << endl;
- return false;
- }
- return true;
-}
-
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-bool FGAircraft::ReadMetrics(FGConfigFile* AC_cfg)
+bool FGAircraft::Load(FGConfigFile* AC_cfg)
{
string token = "";
string parameter;
return true;
}
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-bool FGAircraft::ReadPropulsion(FGConfigFile* AC_cfg)
-{
- if (!Propulsion->Load(AC_cfg)) {
- cerr << " Propulsion not successfully loaded" << endl;
- return false;
- }
- return true;
-}
-
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-bool FGAircraft::ReadFlightControls(FGConfigFile* AC_cfg)
-{
- if (!FCS->Load(AC_cfg)) {
- cerr << " Flight Controls not successfully loaded" << endl;
- return false;
- }
- return true;
-}
-
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-bool FGAircraft::ReadAerodynamics(FGConfigFile* AC_cfg)
-{
- if (!Aerodynamics->Load(AC_cfg)) {
- cerr << " Aerodynamics not successfully loaded" << endl;
- return false;
- }
- return true;
-}
-
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-bool FGAircraft::ReadUndercarriage(FGConfigFile* AC_cfg)
-{
- if (!GroundReactions->Load(AC_cfg)) {
- cerr << " Ground Reactions not successfully loaded" << endl;
- return false;
- }
- return true;
-}
-
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-bool FGAircraft::ReadOutput(FGConfigFile* AC_cfg)
-{
- if (!Output->Load(AC_cfg)) {
- cerr << " Output not successfully loaded" << endl;
- return false;
- }
- return true;
-}
-
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The bitmasked value choices are as follows:
// unset: In this case (the default) JSBSim would only print
}
if (debug_lvl & 16) { // Sanity checking
}
- if (debug_lvl & 32) { // Turbulence
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
}
}
COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-Longitudinal
- CL0 - Reference lift at zero alpha
- CD0 - Reference drag at zero alpha
- CDM - Drag due to Mach
- CLa - Lift curve slope (w.r.t. alpha)
- CDa - Drag curve slope (w.r.t. alpha)
- CLq - Lift due to pitch rate
- CLM - Lift due to Mach
- CLadt - Lift due to alpha rate
-
- Cmadt - Pitching Moment due to alpha rate
- Cm0 - Reference Pitching moment at zero alpha
- Cma - Pitching moment slope (w.r.t. alpha)
- Cmq - Pitch damping (pitch moment due to pitch rate)
- CmM - Pitch Moment due to Mach
-
-Lateral
- Cyb - Side force due to sideslip
- Cyr - Side force due to yaw rate
-
- Clb - Dihedral effect (roll moment due to sideslip)
- Clp - Roll damping (roll moment due to roll rate)
- Clr - Roll moment due to yaw rate
- Cnb - Weathercocking stability (yaw moment due to sideslip)
- Cnp - Rudder adverse yaw (yaw moment due to roll rate)
- Cnr - Yaw damping (yaw moment due to yaw rate)
-
-Control
- CLDe - Lift due to elevator
- CDDe - Drag due to elevator
- CyDr - Side force due to rudder
- CyDa - Side force due to aileron
-
- CmDe - Pitch moment due to elevator
- ClDa - Roll moment due to aileron
- ClDr - Roll moment due to rudder
- CnDr - Yaw moment due to rudder
- CnDa - Yaw moment due to aileron
-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
landing gear, etc. These constituent parts may actually run as separate
JSBSim models themselves, but the responsibility for initializing them and
for retrieving their force and moment contributions falls to FGAircraft.<br>
- When an aircraft model is loaded the config file is parsed and for each of the
- sections of the config file (propulsion, flight control, etc.) the
- corresponding "ReadXXX()" method is called. From within this method the
- "Load()" method of that system is called (e.g. LoadFCS).
+
@author Jon S. Berndt
@version $Id$
@see
inline void SetAlphaCLMax(double tt) { alphaclmax=tt; }
inline void SetAlphaCLMin(double tt) { alphaclmin=tt; }
+ inline void SetAircraftName(string name) {AircraftName = name;}
inline double GetStallWarn(void) { return impending_stall; }
double lbarh,lbarv,vbarh,vbarv;
double alphaclmax,alphaclmin;
double impending_stall;
- string CFGVersion;
string AircraftName;
- bool ReadMetrics(FGConfigFile*);
- bool ReadPropulsion(FGConfigFile*);
- bool ReadFlightControls(FGConfigFile*);
- bool ReadAerodynamics(FGConfigFile*);
- bool ReadUndercarriage(FGConfigFile*);
- bool ReadPrologue(FGConfigFile*);
- bool ReadOutput(FGConfigFile*);
void Debug(int from);
};
cout << vTurbulence << ", " << vTurbulenceGrad << ", " << vDirection << ", " << Magnitude << ", " << vTurbPQR << endl;
}
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
psl = rhosl = 1;
earthPosAngle = 0.0;
- if (debug_lvl & 2) cout << "Instantiated: " << Name << endl;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGAuxiliary::~FGAuxiliary()
{
- if (debug_lvl & 2) cout << "Destroyed: FGAuxiliary" << 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 FGAuxiliary::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: FGAuxiliary" << endl;
+ if (from == 1) cout << "Destroyed: FGAuxiliary" << 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 & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
}
if (debug_lvl & 16) { // Sanity checking
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
rowCtr = 1;
data[0]=0; data[1]=0; data[2]=0; data[3]=0;
- if (debug_lvl & 2) cout << "Instantiated: FGColumnVector3" << endl;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
rowCtr = 1;
data[0] = 0; data[eX] = X; data[eY] = Y; data[eZ] = Z;
- if (debug_lvl & 2) cout << "Instantiated: FGColumnVector3" << endl;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGColumnVector3::~FGColumnVector3(void)
{
- if (debug_lvl & 2) cout << "Destroyed: FGColumnVector3" << endl;
+ Debug(1);
}
data[3] = b.data[3];
rowCtr = 1;
- if (debug_lvl & 2) cout << "Instantiated: FGColumnVector3" << endl;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
data[3] = b.data[3];
rowCtr = 1;
- if (debug_lvl & 2) cout << "Instantiated: FGColumnVector3" << endl;
-
return *this;
}
return *this;
}
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+// 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 FGColumnVector3::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: FGColumnVector3" << endl;
+ if (from == 1) cout << "Destroyed: FGColumnVector3" << 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 & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
rowCtr = 1;
data[1]=0;data[2]=0;data[3]=0;data[4]=0;
- if (debug_lvl & 2) cout << "Instantiated: FGColumnVector4" << endl;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
rowCtr = 1;
data[1]=0;data[2]=0;data[3]=0;data[4]=0;
- if (debug_lvl & 2) cout << "Instantiated: FGColumnVector4" << endl;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGColumnVector4::~FGColumnVector4(void)
{
- if (debug_lvl & 2) cout << "Destroyed: FGColumnVector4" << endl;
+ Debug(1);
}
rowCtr = 1;
- if (debug_lvl & 2) cout << "Instantiated: FGColumnVector4" << endl;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
data[3] = b.data[3];
data[4] = b.data[4];
rowCtr = 1;
-
- if (debug_lvl & 2) cout << "Instantiated: FGColumnVector4" << endl;
-
return *this;
}
if (++rowCtr > 4) rowCtr = 1;
return *this;
}
-
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+// 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 FGColumnVector4::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: FGColumnVector4" << endl;
+ if (from == 1) cout << "Destroyed: FGColumnVector4" << 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 & 64) { // Sanity checking
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
+
}
if (debug_lvl & 16) { // Sanity checking
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
}
if (debug_lvl & 16) { // Sanity checking
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
+
}
if (debug_lvl & 16) { // Sanity checking
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
+
Author: Jon S. Berndt
Date started: 11/17/98
Purpose: Schedules and runs the model routines.
- Called by: The GUI.
------------- Copyright (C) 1999 Jon S. Berndt (jsb@hal-pc.org) -------------
GLOBAL DECLARATIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-short debug_lvl; // This describes to any interested entity the debug level
- // requested by setting the JSBSIM_DEBUG environment variable.
- // The bitmasked value choices are as follows:
- // a) 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
- // b) 0: This requests JSBSim not to output any messages
- // whatsoever.
- // c) 1: This value explicity requests the normal JSBSim
- // startup messages
- // d) 2: This value asks for a message to be printed out when
- // a class is instantiated
- // e) 4: When this value is set, a message is displayed when a
- // FGModel object executes its Run() method
- // f) 8: When this value is set, various runtime state variables
- // are printed out periodically
- // g) 16: When set various parameters are sanity checked and
- // a message is printed out when they go out of bounds.
-
unsigned int FGFDMExec::FDMctr = 0;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
terminate = false;
frozen = false;
modelLoaded = false;
- Scripted = false;
IdFDM = FDMctr;
FDMctr++;
model_iterator = FirstModel;
if (model_iterator == 0L) return false;
- if (Scripted) {
- RunScript();
- if (State->Getsim_time() >= EndTime) return false;
- }
-
Debug(2);
while (!model_iterator->Run()) {
bool FGFDMExec::LoadModel(string APath, string EPath, string model)
{
- bool result = false;
-
+ bool result = true;
+ string token;
string aircraftCfgFileName;
AircraftPath = APath;
Allocate();
}
- result = Aircraft->Load(&AC_cfg);
+ if (!ReadPrologue(&AC_cfg)) return false;
+
+ while ((AC_cfg.GetNextConfigLine() != string("EOF")) &&
+ (token = AC_cfg.GetValue()) != string("/FDM_CONFIG")) {
+ if (token == "METRICS") {
+ if (debug_lvl > 0) cout << fgcyan << "\n Reading Metrics" << fgdef << endl;
+ if (!ReadMetrics(&AC_cfg)) result = false;
+ } else if (token == "AERODYNAMICS") {
+ if (debug_lvl > 0) cout << fgcyan << "\n Reading Aerodynamics" << fgdef << endl;
+ if (!ReadAerodynamics(&AC_cfg)) result = false;
+ } else if (token == "UNDERCARRIAGE") {
+ if (debug_lvl > 0) cout << fgcyan << "\n Reading Landing Gear" << fgdef << endl;
+ if (!ReadUndercarriage(&AC_cfg)) result = false;
+ } else if (token == "PROPULSION") {
+ if (debug_lvl > 0) cout << fgcyan << "\n Reading Propulsion" << fgdef << endl;
+ if (!ReadPropulsion(&AC_cfg)) result = false;
+ } else if (token == "FLIGHT_CONTROL") {
+ if (debug_lvl > 0) cout << fgcyan << "\n Reading Flight Control" << fgdef << endl;
+ if (!ReadFlightControls(&AC_cfg)) result = false;
+ } else if (token == "OUTPUT") {
+ if (debug_lvl > 0) cout << fgcyan << "\n Reading Output directives" << fgdef << endl;
+ if (!ReadOutput(&AC_cfg)) result = false;
+ }
+ }
if (result) {
modelLoaded = true;
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-bool FGFDMExec::LoadScript(string script)
+bool FGFDMExec::ReadPrologue(FGConfigFile* AC_cfg)
{
- FGConfigFile Script(script);
- string token="";
- string aircraft="";
- string initialize="";
- bool result = false;
- double dt = 0.0;
- unsigned i;
- struct condition *newCondition;
-
- if (!Script.IsOpen()) return false;
-
- Script.GetNextConfigLine();
- ScriptName = Script.GetValue("name");
- Scripted = true;
- if (debug_lvl > 0) cout << "Reading Script File " << ScriptName << endl;
-
- while (Script.GetNextConfigLine() != string("EOF") && Script.GetValue() != string("/runscript")) {
- token = Script.GetValue();
- if (token == "use") {
- if ((token = Script.GetValue("aircraft")) != string("")) {
- aircraft = token;
- if (debug_lvl > 0) cout << " Use aircraft: " << token << endl;
- } else if ((token = Script.GetValue("initialize")) != string("")) {
- initialize = token;
- if (debug_lvl > 0) cout << " Use reset file: " << token << endl;
- } else {
- cerr << "Unknown 'use' keyword: \"" << token << "\"" << endl;
- }
- } else if (token == "run") {
- StartTime = strtod(Script.GetValue("start").c_str(), NULL);
- State->Setsim_time(StartTime);
- EndTime = strtod(Script.GetValue("end").c_str(), NULL);
- dt = strtod(Script.GetValue("dt").c_str(), NULL);
- State->Setdt(dt);
- Script.GetNextConfigLine();
- token = Script.GetValue();
- while (token != string("/run")) {
-
- if (token == "when") {
- Script.GetNextConfigLine();
- token = Script.GetValue();
- newCondition = new struct condition();
- while (token != string("/when")) {
- if (token == "parameter") {
- newCondition->TestParam.push_back(State->GetParameterIndex(Script.GetValue("name")));
- newCondition->TestValue.push_back(strtod(Script.GetValue("value").c_str(), NULL));
- newCondition->Comparison.push_back(Script.GetValue("comparison"));
- } else if (token == "set") {
- newCondition->SetParam.push_back(State->GetParameterIndex(Script.GetValue("name")));
- newCondition->SetValue.push_back(strtod(Script.GetValue("value").c_str(), NULL));
- newCondition->Triggered.push_back(false);
- newCondition->OriginalValue.push_back(0.0);
- newCondition->newValue.push_back(0.0);
- newCondition->StartTime.push_back(0.0);
- newCondition->EndTime.push_back(0.0);
- string tempCompare = Script.GetValue("type");
- if (tempCompare == "FG_DELTA") newCondition->Type.push_back(FG_DELTA);
- else if (tempCompare == "FG_BOOL") newCondition->Type.push_back(FG_BOOL);
- else if (tempCompare == "FG_VALUE") newCondition->Type.push_back(FG_VALUE);
- else newCondition->Type.push_back((eType)0);
- tempCompare = Script.GetValue("action");
- if (tempCompare == "FG_RAMP") newCondition->Action.push_back(FG_RAMP);
- else if (tempCompare == "FG_STEP") newCondition->Action.push_back(FG_STEP);
- else if (tempCompare == "FG_EXP") newCondition->Action.push_back(FG_EXP);
- else newCondition->Action.push_back((eAction)0);
-
- if (Script.GetValue("persistent") == "true")
- newCondition->Persistent.push_back(true);
- else
- newCondition->Persistent.push_back(false);
-
- newCondition->TC.push_back(strtod(Script.GetValue("tc").c_str(), NULL));
-
- } else {
- cerr << "Unrecognized keyword in script file: \" [when] " << token << "\"" << endl;
- }
- Script.GetNextConfigLine();
- token = Script.GetValue();
- }
- Conditions.push_back(*newCondition);
- Script.GetNextConfigLine();
- token = Script.GetValue();
-
- } else {
- cerr << "Error reading script file: expected \"when\", got \"" << token << "\"" << endl;
- }
-
- }
- } else if (token.empty()) {
- // do nothing
- } else {
- cerr << "Unrecognized keyword in script file: \"" << token << "\" [runscript] " << endl;
- }
+ string token = AC_cfg->GetValue();
+ string scratch;
+ string AircraftName;
+
+ AircraftName = AC_cfg->GetValue("NAME");
+ Aircraft->SetAircraftName(AircraftName);
+
+ if (debug_lvl > 0) cout << underon << "Reading Aircraft Configuration File"
+ << underoff << ": " << highint << AircraftName << normint << endl;
+ scratch = AC_cfg->GetValue("VERSION").c_str();
+
+ CFGVersion = AC_cfg->GetValue("VERSION");
+
+ if (debug_lvl > 0)
+ cout << " Version: " << highint << CFGVersion
+ << normint << endl;
+ if (CFGVersion != needed_cfg_version) {
+ cerr << endl << fgred << "YOU HAVE AN INCOMPATIBLE CFG FILE FOR THIS AIRCRAFT."
+ " RESULTS WILL BE UNPREDICTABLE !!" << endl;
+ cerr << "Current version needed is: " << needed_cfg_version << endl;
+ cerr << " You have version: " << CFGVersion << endl << fgdef << endl;
+ return false;
}
+ return true;
+}
- if (aircraft == "") {
- cerr << "Aircraft file not loaded in script" << endl;
- exit(-1);
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+bool FGFDMExec::ReadPropulsion(FGConfigFile* AC_cfg)
+{
+ if (!Propulsion->Load(AC_cfg)) {
+ cerr << " Propulsion not successfully loaded" << endl;
+ return false;
}
+ return true;
+}
- Debug(4);
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- result = LoadModel("aircraft", "engine", aircraft);
- if (!result) {
- cerr << "Aircraft file " << aircraft << " was not found" << endl;
- exit(-1);
+bool FGFDMExec::ReadFlightControls(FGConfigFile* AC_cfg)
+{
+ if (!FCS->Load(AC_cfg)) {
+ cerr << " Flight Controls not successfully loaded" << endl;
+ return false;
}
+ return true;
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- FGInitialCondition IC(this);
- if ( ! IC.Load("aircraft", aircraft, initialize)) {
- cerr << "Initialization unsuccessful" << endl;
- exit(-1);
+bool FGFDMExec::ReadAerodynamics(FGConfigFile* AC_cfg)
+{
+ if (!Aerodynamics->Load(AC_cfg)) {
+ cerr << " Aerodynamics not successfully loaded" << endl;
+ return false;
}
+ return true;
+}
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+bool FGFDMExec::ReadUndercarriage(FGConfigFile* AC_cfg)
+{
+ if (!GroundReactions->Load(AC_cfg)) {
+ cerr << " Ground Reactions not successfully loaded" << endl;
+ return false;
+ }
return true;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-void FGFDMExec::RunScript(void)
+bool FGFDMExec::ReadMetrics(FGConfigFile* AC_cfg)
{
- vector <struct condition>::iterator iC = Conditions.begin();
- bool truth = false;
- bool WholeTruth = false;
- unsigned i;
-
- double currentTime = State->Getsim_time();
- double newSetValue = 0;
-
- while (iC < Conditions.end()) {
- // determine whether the set of conditional tests for this condition equate
- // to true
- for (i=0; i<iC->TestValue.size(); i++) {
- if (iC->Comparison[i] == "lt")
- truth = State->GetParameter(iC->TestParam[i]) < iC->TestValue[i];
- else if (iC->Comparison[i] == "le")
- truth = State->GetParameter(iC->TestParam[i]) <= iC->TestValue[i];
- else if (iC->Comparison[i] == "eq")
- truth = State->GetParameter(iC->TestParam[i]) == iC->TestValue[i];
- else if (iC->Comparison[i] == "ge")
- truth = State->GetParameter(iC->TestParam[i]) >= iC->TestValue[i];
- else if (iC->Comparison[i] == "gt")
- truth = State->GetParameter(iC->TestParam[i]) > iC->TestValue[i];
- else if (iC->Comparison[i] == "ne")
- truth = State->GetParameter(iC->TestParam[i]) != iC->TestValue[i];
- else
- cerr << "Bad comparison" << endl;
-
- if (i == 0) WholeTruth = truth;
- else WholeTruth = WholeTruth && truth;
-
- if (!truth && iC->Persistent[i] && iC->Triggered[i]) iC->Triggered[i] = false;
- }
+ if (!Aircraft->Load(AC_cfg)) {
+ cerr << " Aircraft metrics not successfully loaded" << endl;
+ return false;
+ }
+ return true;
+}
- // if the conditions are true, do the setting of the desired parameters
-
- if (WholeTruth) {
- for (i=0; i<iC->SetValue.size(); i++) {
- if ( ! iC->Triggered[i]) {
- iC->OriginalValue[i] = State->GetParameter(iC->SetParam[i]);
- switch (iC->Type[i]) {
- case FG_VALUE:
- iC->newValue[i] = iC->SetValue[i];
- break;
- case FG_DELTA:
- iC->newValue[i] = iC->OriginalValue[i] + iC->SetValue[i];
- break;
- case FG_BOOL:
- iC->newValue[i] = iC->SetValue[i];
- break;
- default:
- cerr << "Invalid Type specified" << endl;
- break;
- }
- iC->Triggered[i] = true;
- iC->StartTime[i] = currentTime;
- }
-
- switch (iC->Action[i]) {
- case FG_RAMP:
- newSetValue = (currentTime - iC->StartTime[i])/(iC->TC[i])
- * (iC->newValue[i] - iC->OriginalValue[i]) + iC->OriginalValue[i];
- if (newSetValue > iC->newValue[i]) newSetValue = iC->newValue[i];
- break;
- case FG_STEP:
- newSetValue = iC->newValue[i];
- break;
- case FG_EXP:
- newSetValue = (1 - exp(-(currentTime - iC->StartTime[i])/(iC->TC[i])))
- * (iC->newValue[i] - iC->OriginalValue[i]) + iC->OriginalValue[i];
- break;
- default:
- cerr << "Invalid Action specified" << endl;
- break;
- }
- State->SetParameter(iC->SetParam[i], newSetValue);
- }
- }
- iC++;
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+bool FGFDMExec::ReadOutput(FGConfigFile* AC_cfg)
+{
+ if (!Output->Load(AC_cfg)) {
+ cerr << " Output not successfully loaded" << endl;
+ return false;
}
+ return true;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGFDMExec::Debug(int from)
{
- unsigned int i;
-
if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
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 (debug_lvl & 16) { // Sanity checking
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
+
FORWARD DECLARATIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-class FGState;
-class FGAtmosphere;
-class FGFCS;
-class FGPropulsion;
-class FGMassBalance;
-class FGAerodynamics;
-class FGInertial;
-class FGGroundReactions;
-class FGAircraft;
-class FGTranslation;
-class FGRotation;
-class FGPosition;
-class FGAuxiliary;
-class FGOutput;
class FGInitialCondition;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
other flight simulator) this class is typically instantiated by an interface
class on the simulator side.
- <h4>Scripting support provided in the Executive</h4>
-
- <p>There is simple scripting support provided in the FGFDMExec
- class. Commands are specified using the <u>Simple Scripting
- Directives for JSBSim</u> (SSDJ). The script file is in XML
- format. A test condition (or conditions) can be set up in the
- script and when the condition evaluates to true, the specified
- action[s] is/are taken. A test condition can be <em>persistent</em>,
- meaning that if a test condition evaluates to true, then passes
- and evaluates to false, the condition is reset and may again be
- triggered. When the set of tests evaluates to true for a given
- condition, an item may be set to another value. This value might
- be a boolean, a value, or a delta value, and the change from the
- current value to the new value can be either via a step function,
- a ramp, or an exponential approach. The speed of a ramp or
- approach is specified via the time constant. Here is the format
- of the script file:</p>
-
- <pre><strong><?xml version="1.0"?>
- <runscript name="C172-01A">
-
- <!--
- This run is for testing C172 runs
- -->
-
- <use aircraft="c172">
- <use initialize="reset00">
-
- <run start="0.0" end="4.5" dt="0.05">
- <when>
- <parameter name="FG_TIME" comparison="ge" value="0.25">
- <parameter name="FG_TIME" comparison="le" value="0.50">
- <set name="FG_AILERON_CMD" type="FG_VALUE" value="0.25"
- action="FG_STEP" persistent="false" tc ="0.25">
- </when>
- <when>
- <parameter name="FG_TIME" comparison="ge" value="0.5">
- <parameter name="FG_TIME" comparison="le" value="1.5">
- <set name="FG_AILERON_CMD" type="FG_DELTA" value="0.5"
- action="FG_EXP" persistent="false" tc ="0.5">
- </when>
- <when>
- <parameter name="FG_TIME" comparison="ge" value="1.5">
- <parameter name="FG_TIME" comparison="le" value="2.5">
- <set name="FG_RUDDER_CMD" type="FG_DELTA" value="0.5"
- action="FG_RAMP" persistent="false" tc ="0.5">
- </when>
- </run>
-
- </runscript></strong></pre>
-
- <p>The first line must always be present. The second line
- identifies this file as a script file, and gives a descriptive
- name to the script file. Comments are next, delineated by the
- <!-- and --> symbols. The aircraft and initialization files
- to be used are specified in the "use" lines. Next,
- comes the "run" section, where the conditions are
- described in "when" clauses.</p>
+ When an aircraft model is loaded the config file is parsed and for each of the
+ sections of the config file (propulsion, flight control, etc.) the
+ corresponding "ReadXXX()" method is called. From within this method the
+ "Load()" method of that system is called (e.g. LoadFCS).
<h4>JSBSim Debugging Directives</h4>
@return Currently returns 0 always. */
int Schedule(FGModel* model, int rate);
- /** This executes each scheduled model in succession, as well as running any
- scripts which are loaded.
+ /** This executes each scheduled model in succession.
@return true if successful, false if sim should be ended */
bool Run(void);
@return true if successful*/
bool LoadModel(string AircraftPath, string EnginePath, string model);
- /** Loads a script to drive JSBSim (usually in standalone mode).
- The language is the Simple Script Directives for JSBSim (SSDJ).
- @param script the filename (including path name, if any) for the script.
- @return true if successful */
- bool LoadScript(string script);
-
- /** This function is called each pass through the executive Run() method IF
- scripting is enabled. */
- void RunScript(void);
-
bool SetEnginePath(string path) {EnginePath = path; return true;}
bool SetAircraftPath(string path) {AircraftPath = path; return true;}
- bool SetScriptPath(string path) {ScriptPath = path; return true;}
/// @name Top-level executive State and Model retrieval mechanism
//@{
inline string GetAircraftPath(void) {return AircraftPath;}
private:
- enum eAction {
- FG_RAMP = 1,
- FG_STEP = 2,
- FG_EXP = 3
- };
-
- enum eType {
- FG_VALUE = 1,
- FG_DELTA = 2,
- FG_BOOL = 3
- };
-
- struct condition {
- vector <eParam> TestParam;
- vector <eParam> SetParam;
- vector <double> TestValue;
- vector <double> SetValue;
- vector <string> Comparison;
- vector <double> TC;
- vector <bool> Persistent;
- vector <eAction> Action;
- vector <eType> Type;
- vector <bool> Triggered;
- vector <double> newValue;
- vector <double> OriginalValue;
- vector <double> StartTime;
- vector <double> EndTime;
-
- condition() {
- }
- };
-
FGModel* FirstModel;
bool frozen;
unsigned int IdFDM;
static unsigned int FDMctr;
bool modelLoaded;
- bool Scripted;
string AircraftPath;
string EnginePath;
- string ScriptPath;
- string ScriptName;
- double StartTime;
- double EndTime;
- vector <struct condition> Conditions;
+ string CFGVersion;
FGState* State;
FGAtmosphere* Atmosphere;
FGAuxiliary* Auxiliary;
FGOutput* Output;
+ bool ReadMetrics(FGConfigFile*);
+ bool ReadPropulsion(FGConfigFile*);
+ bool ReadFlightControls(FGConfigFile*);
+ bool ReadAerodynamics(FGConfigFile*);
+ bool ReadUndercarriage(FGConfigFile*);
+ bool ReadPrologue(FGConfigFile*);
+ bool ReadOutput(FGConfigFile*);
+
bool Allocate(void);
bool DeAllocate(void);
void Debug(int from);
}
if (debug_lvl & 16) { // Sanity checking
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
+
}
if (debug_lvl & 16) { // Sanity checking
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bool FGGroundReactions::Run(void)
{
- double steerAngle = 0.0;
- double xForces = 0.0, yForces = 0.0;
+// double steerAngle = 0.0;
+// double xForces = 0.0, yForces = 0.0;
if (!FGModel::Run()) {
vForces.InitMatrix();
}
if (debug_lvl & 16) { // Sanity checking
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
}
if (debug_lvl & 16) { // Sanity checking
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
cout << "FGInitialCondition: This class requires a pointer to a valid FGFDMExec object" << endl;
}
- if (debug_lvl & 2) cout << "Instantiated: FGInitialCondition" << endl;
+ Debug(0);
}
//******************************************************************************
FGInitialCondition::~FGInitialCondition()
{
- if (debug_lvl & 2) cout << "Destroyed: FGInitialCondition" << endl;
+ Debug(1);
}
//******************************************************************************
fdmex->RunIC(this);
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 FGInitialCondition::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: FGInitialCondition" << endl;
+ if (from == 1) cout << "Destroyed: FGInitialCondition" << 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 & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
+}
+
bool findInterval(double x,double guess);
bool solve(double *y, double x);
+ void Debug(int from);
};
#endif
}
if (debug_lvl & 16) { // Sanity checking
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
cout << "MassBalance::Mass out of bounds: " << Mass << endl;
}
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
}
if (debug_lvl & 16) { // Sanity checking
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+// The bitmasked value choices are as follows:
+// unset: In this case (the default) JSBSim would only print
+// out the normally expected messages, essentially echoing
+// the config files as they are read. If the environment
+// variable is not set, debug_lvl is set to 1 internally
+// 0: This requests JSBSim not to output any messages
+// whatsoever.
+// 1: This value explicity requests the normal JSBSim
+// startup messages
+// 2: This value asks for a message to be printed out when
+// a class is instantiated
+// 4: When this value is set, a message is displayed when a
+// FGModel object executes its Run() method
+// 8: When this value is set, various runtime state variables
+// are printed out periodically
+// 16: When set various parameters are sanity checked and
+// a message is printed out when they go out of bounds
+
+void FGModel::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: FGModel" << endl;
+ if (from == 1) cout << "Destroyed: FGModel" << 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 & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
+}
protected:
int exe_ctr;
int rate;
+
+ virtual void Debug(int from);
FGFDMExec* FDMExec;
FGState* State;
}
if (debug_lvl & 16) { // Sanity checking
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
}
if (debug_lvl & 16) { // Sanity checking
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
}
if (debug_lvl & 16) { // Sanity checking
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
}
if (debug_lvl & 16) { // Sanity checking
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
}
if (debug_lvl & 16) { // Sanity checking
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
}
if (debug_lvl & 16) { // Sanity checking
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
}
if (debug_lvl & 16) { // Sanity checking
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
cout << "FGRotation::R (Yaw Rate) out of bounds: " << vPQR(eR) << endl;
}
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
+
inline FGColumnVector3& GetEulerRates(void) { return vEulerRates; }
inline double GetEulerRates(int axis) { return vEulerRates(axis); }
inline void SetPQR(FGColumnVector3 tt) {vPQR = tt;}
+ inline void SetPQR(double p, double q, double r) {vPQR(eP)=p;
+ vPQR(eQ)=q;
+ vPQR(eR)=r;}
inline void SetEuler(FGColumnVector3 tt) {vEuler = tt;}
inline double Getphi(void) {return vEuler(1);}
}
if (debug_lvl & 16) { // Sanity checking
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
string initialize="";\r
bool result = false;\r
double dt = 0.0;\r
- unsigned i;\r
struct condition *newCondition;\r
\r
if (!Script.IsOpen()) return false;\r
}\r
if (debug_lvl & 16) { // Sanity checking\r
}\r
+ if (debug_lvl & 64) {\r
+ if (from == 0) { // Constructor\r
+ cout << IdSrc << endl;\r
+ cout << IdHdr << endl;\r
+ }\r
+ }\r
}\r
\r
void FGState::SetParameter(eParam val_idx, double val)
{
- int i;
+ unsigned i;
switch(val_idx) {
case FG_ELEVATOR_POS:
}
if (debug_lvl & 16) { // Sanity checking
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
+
}
if (debug_lvl & 16) { // Sanity checking
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
+
}
if (debug_lvl & 16) { // Sanity checking
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
}
if (debug_lvl & 16) { // Sanity checking
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
if (qbar > 1e6 || qbar < 0.00)
cout << "FGTranslation::qbar is out of bounds: " << qbar << endl;
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
+
~FGTranslation();
inline FGColumnVector3& GetUVW (void) { return vUVW; }
- inline double GetUVW (int idx) { return vUVW(idx); }
+ inline double GetUVW (int idx) { return vUVW(idx); }
inline FGColumnVector3& GetUVWdot(void) { return vUVWdot; }
- inline double GetUVWdot(int idx) { return vUVWdot(idx); }
+ inline double GetUVWdot(int idx) { return vUVWdot(idx); }
inline FGColumnVector3& GetvAeroUVW (void) { return vAeroUVW; }
- inline double GetvAeroUVW (int idx) { return vAeroUVW(idx); }
+ inline double GetvAeroUVW (int idx) { return vAeroUVW(idx); }
inline double Getalpha(void) { return alpha; }
inline double Getbeta (void) { return beta; }
TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tRdot,tRudder ));
break;
case tTurn:
- TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tNlf,tAlpha ));
+ TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tWdot,tAlpha ));
TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tUdot,tThrottle ));
TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tQdot,tPitchTrim ));
- TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tVdot,tBeta ));
- TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tPdot,tAileron ));
- TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tRdot,tRudder ));
+ //TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tVdot,tBeta ));
+ //TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tPdot,tAileron ));
+ //TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tRdot,tRudder ));
break;
-
- }
+ case tCustom:
+ case tNone:
+ break;
+}
//cout << "TrimAxes.size(): " << TrimAxes.size() << endl;
sub_iterations=new double[TrimAxes.size()];
successful=new double[TrimAxes.size()];
cout << "nlf done" << endl;
} else if (mode == tTurn) {
setupTurn();
- TrimAxes[0]->SetStateTarget(targetNlf);
+ //TrimAxes[0]->SetStateTarget(targetNlf);
}
do {
axis_count=0;
for(current_axis=0;current_axis<TrimAxes.size();current_axis++) {
setDebug();
-
+ updateRates();
Nsub=0;
if(!solution[current_axis]) {
if(checkLimits()) {
<< fgic->GetVtrueFpsIC() << endl;
q=g*(targetNlf-cgamma)/fgic->GetVtrueFpsIC();
cout << targetNlf << ", " << q << endl;
- vPQR.InitMatrix();
- vPQR(2)=q;
- cout << vPQR << endl;
- fdmex->GetRotation()->SetPQR(vPQR);
+ fdmex->GetRotation()->SetPQR(0,q,0);
cout << "setPitchRateInPullup() complete" << endl;
}
void FGTrim::setupTurn(void){
- FGColumnVector3 vPQR;
- float g,q,r,phi, psidot;
+ double g,phi;
phi = fgic->GetRollAngleRadIC();
if( fabs(phi) > 0.01 && fabs(phi) < 1.56 ) {
targetNlf = 1 / cos(phi);
g = fdmex->GetInertial()->gravity();
psidot = g*tan(phi) / fgic->GetVtrueFpsIC();
- q = psidot*sin(phi);
- r = psidot*cos(phi);
- vPQR(1)=0;vPQR(2)=q;vPQR(3)=r;
- fdmex->GetRotation()->SetPQR(vPQR);
- cout << targetNlf << ", " << vPQR*57.29577 << endl;
+ cout << targetNlf << ", " << psidot << endl;
}
}
+void FGTrim::updateRates(void){
+ if(mode == tTurn) {
+ double p,q,r,theta,phi;
+ theta=fgic->GetPitchAngleRadIC();
+ phi=fgic->GetRollAngleRadIC();
+ p=-psidot*sin(theta);
+ q=psidot*cos(theta)*sin(phi);
+ r=psidot*cos(theta)*cos(phi);
+ fdmex->GetRotation()->SetPQR(p,q,r);
+ }
+}
void FGTrim::setDebug(void) {
if(debug_axis == tAll ||
double xlo,xhi,alo,ahi;
double targetNlf;
int debug_axis;
+
+ double psidot,thetadot;
FGFDMExec* fdmex;
FGInitialCondition* fgic;
void setupPullup(void);
void setupTurn(void);
+ void updateRates(void);
+
void setDebug(void);
public:
case tRdot: tolerance = DEFAULT_TOLERANCE / 10; break;
case tHmgt: tolerance = 0.01; break;
case tNlf: state_target=1.0; tolerance = 1E-5; break;
+ case tAll: break;
}
solver_eps=tolerance;
void FGTrimAxis::getState(void) {
switch(state) {
- case tUdot: state_value=fdmex->GetTranslation()->GetUVWdot()(1)-state_target; break;
- case tVdot: state_value=fdmex->GetTranslation()->GetUVWdot()(2)-state_target; break;
- case tWdot: state_value=fdmex->GetTranslation()->GetUVWdot()(3)-state_target; break;
+ case tUdot: state_value=fdmex->GetTranslation()->GetUVWdot(1)-state_target; break;
+ case tVdot: state_value=fdmex->GetTranslation()->GetUVWdot(2)-state_target; break;
+ case tWdot: state_value=fdmex->GetTranslation()->GetUVWdot(3)-state_target; break;
case tQdot: state_value=fdmex->GetRotation()->GetPQRdot(2)-state_target;break;
case tPdot: state_value=fdmex->GetRotation()->GetPQRdot(1)-state_target; break;
case tRdot: state_value=fdmex->GetRotation()->GetPQRdot(3)-state_target; break;
case tHmgt: state_value=computeHmgt()-state_target; break;
case tNlf: state_value=fdmex->GetAircraft()->GetNlf()-state_target; break;
+ case tAll: break;
}
}
void FGTrimAxis::Debug(int from)
{
- if (debug_lvl <= 0) return;
- if (debug_lvl & 1) { // Standard console startup message output
+ if (debug_lvl <= 0) return;
+ if (debug_lvl & 1 ) { // Standard console startup message output
if (from == 0) { // Constructor
}
}
if (debug_lvl & 16) { // Sanity checking
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
+
}
if (debug_lvl & 16) { // Sanity checking
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
}
if (debug_lvl & 16) { // Sanity checking
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
}
if (debug_lvl & 16) { // Sanity checking
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
}
if (debug_lvl & 16) { // Sanity checking
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
cout << "Could not create socket for FDM, error = " << errno << endl;
}
}
-
- if (debug_lvl & 2) cout << "Instantiated: FGfdmSocket" << endl;
+ Debug(0);
}
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
FGfdmSocket::~FGfdmSocket()
{
#ifndef macintosh
#ifdef __BORLANDC__
WSACleanup();
#endif
+ Debug(1);
}
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
void FGfdmSocket::Clear(void)
{
buffer = "";
size = 0;
}
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
void FGfdmSocket::Append(const char* item)
{
if (size == 0) buffer += string(item);
size++;
}
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
void FGfdmSocket::Append(double item)
{
char s[25];
- sprintf(s,"%12.7f\0",item);
+ sprintf(s,"%12.7f",item);
if (size == 0) buffer += string(s);
else buffer += string(",") + string(s);
size++;
}
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
void FGfdmSocket::Append(long item)
{
char s[25];
- sprintf(s,"%12d\0",item);
+ sprintf(s,"%12d",item);
if (size == 0) buffer += string(s);
else buffer += string(",") + string(s);
size++;
}
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
void FGfdmSocket::Send(void)
{
buffer += string("\n");
}
}
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+// 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 FGfdmSocket::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: FGfdmSocket" << endl;
+ if (from == 1) cout << "Destroyed: FGfdmSocket" << 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 & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
+}
+
struct sockaddr_in scktName;
struct hostent *host;
string buffer;
- void Debug(int from) {}
+ void Debug(int from);
};
#endif
#include "FGAuxiliary.h"
#include "FGOutput.h"
#include "FGConfigFile.h"
+#include "FGScript.h"
#ifdef FGFS
#include <simgear/compiler.h>
int main(int argc, char** argv)
{
FGFDMExec* FDMExec;
- float cmd = 0.0;
bool result = false;
- bool scripted = false;
+ bool Scripted = false;
+ FGScript* Script;
- if (argc == 2) {
- FGConfigFile testFile(argv[1]);
-
- if (!testFile.IsOpen()) {
- cout << "Script file not opened" << endl;
- exit(-1);
- }
-
- testFile.GetNextConfigLine();
- if (testFile.GetValue("runscript").length() <= 0) {
- cout << "File: " << argv[1] << " is not a script file" << endl;
- exit(-1);
- }
- scripted = true;
- } else if (argc != 3) {
- cout << endl
+ if (argc != 3 && argc != 2) {
+ cerr << endl
<< " You must enter the name of a registered aircraft and reset point:"
<< endl << endl << " FDM <aircraft name> <reset file>" << endl;
- cout << endl << " Alternatively, you may specify only the name of a script file:"
+ cerr << endl << " Alternatively, you may specify only the name of a script file:"
<< endl << endl << " FDM <script file>" << endl << endl;
exit(0);
}
FDMExec = new FGFDMExec();
- if (scripted) { // form jsbsim <scriptfile>
- result = FDMExec->LoadScript(argv[1]);
+ if (argc == 2) { // SCRIPTED CASE
+
+ Script = new FGScript(FDMExec);
+ result = Script->LoadScript(argv[1]);
+
if (!result) {
cerr << "Script file " << argv[1] << " was not successfully loaded" << endl;
exit(-1);
}
+
+ Scripted = true;
+
} else { // form jsbsim <acname> <resetfile>
+
if ( ! FDMExec->LoadModel("aircraft", "engine", string(argv[1]))) {
cerr << " JSBSim could not be started" << endl << endl;
exit(-1);
//
FGJSBBase::Message* msg;
- while (FDMExec->Run()) {
+ result = FDMExec->Run();
+ while (result) {
while (FDMExec->ReadMessage()) {
msg = FDMExec->ProcessMessage();
switch (msg->type) {
break;
}
}
+
+ if (Scripted) {
+ if (!Script->RunScript()) break;
+ }
+
+ result = FDMExec->Run();
}
delete FDMExec;
}
if (debug_lvl & 16) { // Sanity checking
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
}
if (debug_lvl & 16) { // Sanity checking
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
+
case eIntegrator:
Output = Input * ca + PreviousInput1 * ca + PreviousOutput1;
break;
+ case eUnknown:
+ break;
}
}
}
if (debug_lvl & 16) { // Sanity checking
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
}
if (debug_lvl & 16) { // Sanity checking
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
}
if (debug_lvl & 16) { // Sanity checking
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
FGKinemat::~FGKinemat()
{
- if (debug_lvl & 2) cout << "Destroyed: FGKinemat" << endl;
+ Debug(1);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}
if (debug_lvl & 16) { // Sanity checking
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
}
if (debug_lvl & 16) { // Sanity checking
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}
}
if (debug_lvl & 16) { // Sanity checking
}
+ if (debug_lvl & 64) {
+ if (from == 0) { // Constructor
+ cout << IdSrc << endl;
+ cout << IdHdr << endl;
+ }
+ }
}