]> git.mxchange.org Git - flightgear.git/commitdiff
Latest JSBSim changes.
authordavid <david>
Thu, 13 Dec 2001 04:48:34 +0000 (04:48 +0000)
committerdavid <david>
Thu, 13 Dec 2001 04:48:34 +0000 (04:48 +0000)
94 files changed:
src/FDM/JSBSim/FGAerodynamics.cpp
src/FDM/JSBSim/FGAerodynamics.h
src/FDM/JSBSim/FGAircraft.cpp
src/FDM/JSBSim/FGAircraft.h
src/FDM/JSBSim/FGAtmosphere.cpp
src/FDM/JSBSim/FGAtmosphere.h
src/FDM/JSBSim/FGAuxiliary.cpp
src/FDM/JSBSim/FGAuxiliary.h
src/FDM/JSBSim/FGCoefficient.cpp
src/FDM/JSBSim/FGCoefficient.h
src/FDM/JSBSim/FGColumnVector3.cpp
src/FDM/JSBSim/FGColumnVector3.h
src/FDM/JSBSim/FGColumnVector4.cpp
src/FDM/JSBSim/FGColumnVector4.h
src/FDM/JSBSim/FGConfigFile.cpp
src/FDM/JSBSim/FGConfigFile.h
src/FDM/JSBSim/FGEngine.cpp
src/FDM/JSBSim/FGEngine.h
src/FDM/JSBSim/FGFCS.cpp
src/FDM/JSBSim/FGFCS.h
src/FDM/JSBSim/FGFDMExec.cpp
src/FDM/JSBSim/FGFDMExec.h
src/FDM/JSBSim/FGFactorGroup.cpp
src/FDM/JSBSim/FGFactorGroup.h
src/FDM/JSBSim/FGForce.cpp
src/FDM/JSBSim/FGForce.h
src/FDM/JSBSim/FGGroundReactions.cpp
src/FDM/JSBSim/FGGroundReactions.h
src/FDM/JSBSim/FGInertial.cpp
src/FDM/JSBSim/FGInertial.h
src/FDM/JSBSim/FGInitialCondition.cpp
src/FDM/JSBSim/FGJSBBase.h
src/FDM/JSBSim/FGLGear.cpp
src/FDM/JSBSim/FGLGear.h
src/FDM/JSBSim/FGMassBalance.cpp
src/FDM/JSBSim/FGMassBalance.h
src/FDM/JSBSim/FGMatrix33.cpp
src/FDM/JSBSim/FGMatrix33.h
src/FDM/JSBSim/FGNozzle.cpp
src/FDM/JSBSim/FGNozzle.h
src/FDM/JSBSim/FGOutput.cpp
src/FDM/JSBSim/FGOutput.h
src/FDM/JSBSim/FGPiston.cpp
src/FDM/JSBSim/FGPiston.h
src/FDM/JSBSim/FGPosition.cpp
src/FDM/JSBSim/FGPosition.h
src/FDM/JSBSim/FGPropeller.cpp
src/FDM/JSBSim/FGPropeller.h
src/FDM/JSBSim/FGPropulsion.cpp
src/FDM/JSBSim/FGPropulsion.h
src/FDM/JSBSim/FGRocket.cpp
src/FDM/JSBSim/FGRocket.h
src/FDM/JSBSim/FGRotation.cpp
src/FDM/JSBSim/FGRotation.h
src/FDM/JSBSim/FGRotor.cpp
src/FDM/JSBSim/FGRotor.h
src/FDM/JSBSim/FGState.cpp
src/FDM/JSBSim/FGState.h
src/FDM/JSBSim/FGTable.cpp
src/FDM/JSBSim/FGTable.h
src/FDM/JSBSim/FGTank.cpp
src/FDM/JSBSim/FGTank.h
src/FDM/JSBSim/FGThruster.cpp
src/FDM/JSBSim/FGThruster.h
src/FDM/JSBSim/FGTranslation.cpp
src/FDM/JSBSim/FGTranslation.h
src/FDM/JSBSim/FGTrimAxis.cpp
src/FDM/JSBSim/FGTrimAxis.h
src/FDM/JSBSim/FGTurboJet.cpp
src/FDM/JSBSim/FGTurboJet.h
src/FDM/JSBSim/FGTurboProp.cpp
src/FDM/JSBSim/FGTurboProp.h
src/FDM/JSBSim/FGTurboShaft.cpp
src/FDM/JSBSim/FGTurboShaft.h
src/FDM/JSBSim/FGUtility.cpp
src/FDM/JSBSim/FGUtility.h
src/FDM/JSBSim/FGfdmSocket.h
src/FDM/JSBSim/JSBSim.cpp
src/FDM/JSBSim/filtersjb/FGDeadBand.cpp
src/FDM/JSBSim/filtersjb/FGDeadBand.h
src/FDM/JSBSim/filtersjb/FGFCSComponent.cpp
src/FDM/JSBSim/filtersjb/FGFCSComponent.h
src/FDM/JSBSim/filtersjb/FGFilter.cpp
src/FDM/JSBSim/filtersjb/FGFilter.h
src/FDM/JSBSim/filtersjb/FGGain.cpp
src/FDM/JSBSim/filtersjb/FGGain.h
src/FDM/JSBSim/filtersjb/FGGradient.cpp
src/FDM/JSBSim/filtersjb/FGGradient.h
src/FDM/JSBSim/filtersjb/FGKinemat.cpp
src/FDM/JSBSim/filtersjb/FGKinemat.h
src/FDM/JSBSim/filtersjb/FGSummer.cpp
src/FDM/JSBSim/filtersjb/FGSummer.h
src/FDM/JSBSim/filtersjb/FGSwitch.cpp
src/FDM/JSBSim/filtersjb/FGSwitch.h

index 10e0b18bae87c8494d86bcec9b4a04ab6b0a8395..ac33907bd6fc052145ae4956fccb57f8bceaa081 100644 (file)
@@ -203,7 +203,7 @@ double FGAerodynamics::GetLoD(void)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-void FGAerodynamics::Debug(void)
+void FGAerodynamics::Debug(int from)
 {
     //TODO: Add your source code here
 }
index 21b4230eba368d422fef12b06e10a5f7be583413..d70f8145e3bcb5f8cd382bebd81545b325d73ab9 100644 (file)
@@ -146,7 +146,7 @@ private:
   FGColumnVector3 vLastFs;
   FGColumnVector3 vDXYZcg;
 
-  void Debug(void);
+  void Debug(int from);
 };
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index 52c8ef5ab71c6549e1223285f2a7fdcd4a60556b..ac3f48459c89b73ca05a5d746e53d3178a54e9a9 100644 (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
 }
index 8dc7beb7c92532714af6e0ff5a545c16b49c9fd9..3346de06d445dc42c38fd6c796cc6c164a561bd3 100644 (file)
@@ -232,7 +232,7 @@ private:
   bool ReadUndercarriage(FGConfigFile*);
   bool ReadPrologue(FGConfigFile*);
   bool ReadOutput(FGConfigFile*);
-  void Debug(void);
+  void Debug(int from);
 };
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index 318516a5f318394a27074695cdba49faae014174..2f9f24066dbc3d0855cddd29a6d3285256602925 100644 (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)
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGAtmosphere::Debug(void)
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGAtmosphere::Debug(int from)
 {
-  if (frame == 0) {
-    cout << "vTurbulence(X), vTurbulence(Y), vTurbulence(Z), "
-         << "vTurbulenceGrad(X), vTurbulenceGrad(Y), vTurbulenceGrad(Z), "
-         << "vDirection(X), vDirection(Y), vDirection(Z), "
-         << "Magnitude, "
-         << "vTurbPQR(P), vTurbPQR(Q), vTurbPQR(R), " << endl;
-  } else {
-    cout << vTurbulence << ", " << vTurbulenceGrad << ", " << vDirection << ", " << Magnitude << ", " << vTurbPQR << endl;
+  if (debug_lvl <= 0) return;
+
+  if (debug_lvl & 1) { // Standard console startup message output
+    if (from == 0) { // Constructor
+    }
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGAtmosphere" << endl;
+    if (from == 1) cout << "Destroyed:    FGAtmosphere" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+  }
+  if (debug_lvl & 16) { // Sanity checking
+  }
+  if (debug_lvl & 32) { // Turbulence
+    if (frame == 0 && from == 2) {
+      cout << "vTurbulence(X), vTurbulence(Y), vTurbulence(Z), "
+           << "vTurbulenceGrad(X), vTurbulenceGrad(Y), vTurbulenceGrad(Z), "
+           << "vDirection(X), vDirection(Y), vDirection(Z), "
+           << "Magnitude, "
+           << "vTurbPQR(P), vTurbPQR(Q), vTurbPQR(R), " << endl;
+    } else if (from == 2) {
+      cout << vTurbulence << ", " << vTurbulenceGrad << ", " << vDirection << ", " << Magnitude << ", " << vTurbPQR << endl;
+    }
   }
 }
 
index 5b1e8648c677fcfab9ce3c1a4e76706670b4e313..f88031280a756218e9a828e598e1dd373776d5fd 100644 (file)
@@ -176,7 +176,7 @@ private:
 
   void Calculate(double altitude);
   void Turbulence(void);
-  void Debug(void);
+  void Debug(int from);
 };
 
 /******************************************************************************/
index 65c9fd755a023742d97a675848757bf2f550d831..4657cb34c16ea652b3908a5669935d292e49a552 100644 (file)
@@ -213,7 +213,7 @@ void FGAuxiliary::GetState(void)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-void FGAuxiliary::Debug(void)
+void FGAuxiliary::Debug(int from)
 {
     //TODO: Add your source code here
 }
index a29ae2303511e26a82b42314dc090263cf6c07b2..e0b8a575a0408e1430eda51fad4185a0fb71c4ec 100644 (file)
@@ -119,7 +119,7 @@ private:
   double earthPosAngle;
 
   void GetState(void);
-  void Debug(void);
+  void Debug(int from);
 };
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index 927084f824ebca999e7e4d74b2f96ec1de7b84af..c7c2d06e29f1d38a39a98b0385f4f2f21844fee4 100644 (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: ";
 
-  ifmultipliers.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
+  }
+}
 
index fb574aa7133c997abf9513b139948f13c7076c3b..0c1e1c951bcb394e01bac6ba8f94c2964d35f43a 100644 (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);
 };
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index b974bea86b36ad7c3276e37ad6193a1876ae6482..70a785dff9172ec96004318d5c817df1ef45b680 100644 (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
 }
index 20572e427547905fda282c588a8fd7c101b88523..032333cfac1f6bbd50bf435efe5cb98a033c5a78 100644 (file)
@@ -110,7 +110,7 @@ public:
 private:
   double data[4];
   int rowCtr;
-  void Debug(void);
+  void Debug(int from);
 };
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index 6f76cdc24e9c6b94454f14329162af9e5758899d..30a100913e38ab20ff6ac19d19d93cc49a4b3132 100644 (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
 }
index db311dfcbb284cdf0d034b2c679f7552ab92b9ee..d1e10d80245a8b64db2cc1490f30d93824e7ba4a 100644 (file)
@@ -109,7 +109,7 @@ public:
 private:
   double data[5];
   int rowCtr;
-  void Debug(void);
+  void Debug(int from);
 };
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index 4816cb2917b21edb42ee2f2e9a764a15bf6596f6..29dc717aca8f4c5d3767c1533460b4ca011e0419 100644 (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)
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGConfigFile::Debug(void)
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGConfigFile::Debug(int from)
 {
-    //TODO: Add your source code here
+  if (debug_lvl <= 0) return;
+
+  if (debug_lvl & 1) { // Standard console startup message output
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGConfigFile" << endl;
+    if (from == 1) cout << "Destroyed:    FGConfigFile" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+  }
+  if (debug_lvl & 16) { // Sanity checking
+  }
 }
 
index 258f65cad62d88edfa9728d537aea735baef40c6..d4144b5618ad25cb1cb078af9693fe959e06195e 100644 (file)
@@ -134,7 +134,7 @@ private:
   bool     CommentsOn;
   bool     Opened;
   unsigned int      CurrentIndex;
-  void Debug(void);
+  void Debug(int from);
 };
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index 4c24dcc6480d9425e4127f426206462a3fefcb09..7f7c2956c1d9fffc7dd632dc658a4853e73e56fd 100644 (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)
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGEngine::Debug(void)
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGEngine::Debug(int from)
 {
-    //TODO: Add your source code here
-}
+  if (debug_lvl <= 0) return;
+
+  if (debug_lvl & 1) { // Standard console startup message output
+    if (from == 0) { // Constructor
 
+    }
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGEngine" << endl;
+    if (from == 1) cout << "Destroyed:    FGEngine" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+  }
+  if (debug_lvl & 16) { // Sanity checking
+  }
+}
index e919bf3b67fba2ec85aaf786ec1986e1270baec4..8e2f92471d9ce6714ebc0836c9b7bae1708f5a9e 100644 (file)
@@ -234,7 +234,7 @@ protected:
   FGOutput*       Output;
 
   vector <int> SourceTanks;
-  void Debug(void);
+  virtual void Debug(int from);
 };
 
 #include "FGState.h"
index b08c7c96704af61bc5cd90b3b1f75e84dadcaf48..0a3b63cd3cfecb555e2c97781b724fcb2930316d 100644 (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)
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGFCS::Debug(void)
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGFCS::Debug(int from)
 {
-    //TODO: Add your source code here
-}
+  if (debug_lvl <= 0) return;
+
+  if (debug_lvl & 1) { // Standard console startup message output
+    if (from == 0) { // Constructor
 
+    }
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGFCS" << endl;
+    if (from == 1) cout << "Destroyed:    FGFCS" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+  }
+  if (debug_lvl & 16) { // Sanity checking
+  }
+}
index edd0b6ef77d09b3a3e371c4250dd5c9022a0a5fe..b960ed1e7d8c01bd619c0e7d62ff17d6944d3e45 100644 (file)
@@ -426,7 +426,7 @@ private:
   double GearCmd,GearPos;
 
   vector <FGFCSComponent*> Components;
-  void Debug(void);
+  void Debug(int from);
 };
 
 #include "FGState.h"
index 5666b2ef0e67bd39f5fc79c72661fdd5ccaa41e6..b679cccbc425119c0f267b69e86a3ad1809f8005 100644 (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)
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGFDMExec::Debug(void)
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGFDMExec::Debug(int from)
 {
-    //TODO: Add your source code here
-}
+  unsigned int i;
+
+  if (debug_lvl <= 0) return;
+
+  if (debug_lvl & 1) { // Standard console startup message output
+    if (from == 0) { // Constructor
+      cout << "\n\n     " << highint << underon << "JSBSim Flight Dynamics Model v"
+                                     << JSBSim_version << underoff << normint << endl;
+      cout << halfint << "            [cfg file spec v" << needed_cfg_version << "]\n\n";
+      cout << normint << "JSBSim startup beginning ...\n\n";
+    } else if (from == 3) {
+      cout << "\n\nJSBSim startup complete\n\n";
+    } else if (from == 4)  { // print out script data
+      vector <struct condition>::iterator iterConditions = Conditions.begin();
+      int count=0;
+
+      cout << "\n  Script goes from " << StartTime << " to " << EndTime
+           << " with dt = " << State->Getdt() << endl << endl;
+
+      while (iterConditions < Conditions.end()) {
+        cout << "  Condition: " << count++ << endl;
+        cout << "    if (";
+
+        for (i=0; i<iterConditions->TestValue.size(); i++) {
+          if (i>0) cout << " and" << endl << "        ";
+          cout << "(" << State->paramdef[iterConditions->TestParam[i]]
+                      << iterConditions->Comparison[i] << " "
+                      << iterConditions->TestValue[i] << ")";
+        }
+        cout << ") then {";
+
+        for (i=0; i<iterConditions->SetValue.size(); i++) {
+          cout << endl << "      set" << State->paramdef[iterConditions->SetParam[i]]
+               << "to " << iterConditions->SetValue[i];
 
+          switch (iterConditions->Type[i]) {
+          case FG_VALUE:
+            cout << " (constant";
+            break;
+          case FG_DELTA:
+            cout << " (delta";
+            break;
+          case FG_BOOL:
+            cout << " (boolean";
+            break;
+          default:
+            cout << " (unspecified type";
+          }
+
+          switch (iterConditions->Action[i]) {
+          case FG_RAMP:
+            cout << " via ramp";
+            break;
+          case FG_STEP:
+            cout << " via step";
+            break;
+          case FG_EXP:
+            cout << " via exponential approach";
+            break;
+          default:
+            cout << " via unspecified action";
+          }
+
+          if (!iterConditions->Persistent[i]) cout << endl
+                             << "                              once";
+          else cout << endl
+                             << "                              repeatedly";
+
+          if (iterConditions->Action[i] == FG_RAMP ||
+              iterConditions->Action[i] == FG_EXP) cout << endl
+                             << "                              with time constant "
+                             << iterConditions->TC[i];
+        }
+        cout << ")" << endl << "    }" << endl << endl;
+
+        iterConditions++;
+      }
+
+      cout << endl;
+    }
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGFDMExec" << endl;
+    if (from == 1) cout << "Destroyed:    FGFDMExec" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+    if (from == 2) {
+      cout << "================== Frame: " << Frame << "  Time: "
+           << State->Getsim_time() << endl;
+    }
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+  }
+  if (debug_lvl & 16) { // Sanity checking
+  }
+}
index 9fde7b6a91df568e43310b3daf74d047cde3f1b0..dd9e633000730497f37992a26bc7f6718c00705e 100644 (file)
@@ -347,7 +347,7 @@ private:
 
   bool Allocate(void);
   bool DeAllocate(void);
-  void Debug(void);
+  void Debug(int from);
 };
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index 37ef3d921e68843d70ddbf5e676a7cc4a2e328c0..5b3e0b9a07510fbf18d5b349d0c44e4326eddd0e 100644 (file)
@@ -69,41 +69,39 @@ 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();
-    iftoken == "FACTOR") {
+    if (token == "FACTOR") {
       FGCoefficient::Load(AC_cfg);
-      //if (debug_lvl > 0) DisplayCoeffFactors(ca.back()->Getmultipliers());
     } 
     token = AC_cfg->GetValue();  
-    while ( token != string("/GROUP") ) {
-          sum.push_back( new FGCoefficient(FDMExec) );
-          sum.back()->Load(AC_cfg);
-          //if (debug_lvl > 0) DisplayCoeffFactors(ca.back()->Getmultipliers());
-          token = AC_cfg->GetValue(); 
+    while (token != string("/GROUP") ) {
+      sum.push_back( new FGCoefficient(FDMExec) );
+      sum.back()->Load(AC_cfg);
+      token = AC_cfg->GetValue(); 
     }
     AC_cfg->GetNextConfigLine();
     return true;
@@ -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;
-}        
+}
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-
-void FGFactorGroup::Debug(void)
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGFactorGroup::Debug(int from)
 {
-  cout << "FGCoefficient::GetSD(): " << FGCoefficient::GetSD() << endl;
-  cout << "FGFactorGroup::SDtotal: " << SDtotal << endl;
-}
+  if (debug_lvl <= 0) return;
 
+  if (debug_lvl & 1) { // Standard console startup message output
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGFactorGroup" << endl;
+    if (from == 1) cout << "Destroyed:    FGFactorGroup" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+    if (from == 2) {
+      cout << "FGCoefficient::GetSD(): " << FGCoefficient::GetSD() << endl;
+      cout << "FGFactorGroup::SDtotal: " << SDtotal << endl;
+    }
+  }
+  if (debug_lvl & 16) { // Sanity checking
+  }
+}
index 2a2b418aab272504d6ccd46395f50869906c12b9..0484119a1afcddfa4372358fedd33b990d81c2d3 100644 (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 
index a1bd2172f2be04ea1ad70eef6cd731971a0fbf40..d2da596c2b719e7ee4e24c410230e88cc25b6839 100644 (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)
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGForce::Debug(void)
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGForce::Debug(int from)
 {
-    //TODO: Add your source code here
+  if (debug_lvl <= 0) return;
+
+  if (debug_lvl & 1) { // Standard console startup message output
+    if (from == 0) { // Constructor
+
+    }
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGForce" << endl;
+    if (from == 1) cout << "Destroyed:    FGForce" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+  }
+  if (debug_lvl & 16) { // Sanity checking
+  }
 }
 
index 595667574099b820d21aae1d7d8a4369981d0845..dfacc4a194c4f990c97a761c40c51e610a05bea7 100644 (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
index 5d478f6a7b3c35d02cd1d44b0189e6358034ff55..b041df3bd4afa07c8503fa8f21c6b617b65a0596 100644 (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)
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGGroundReactions::Debug(void)
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGGroundReactions::Debug(int from)
 {
-    //TODO: Add your source code here
+  if (debug_lvl <= 0) return;
+
+  if (debug_lvl & 1) { // Standard console startup message output
+    if (from == 0) { // Constructor
+
+    }
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGGroundReactions" << endl;
+    if (from == 1) cout << "Destroyed:    FGGroundReactions" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+  }
+  if (debug_lvl & 16) { // Sanity checking
+  }
 }
 
index 7c0ffdcf38dcb0bef2bad02482b46dee7572c13d..21b774ab5894108e0bd45345eab56b643b077770 100644 (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);
 };
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index f5189108fc8cb6a62f2890ecc20c00e121c61d77..9f680d203cd95cd59ce038975d3a78e813aea8b8 100644 (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)
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGInertial::Debug(void)
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGInertial::Debug(int from)
 {
-    //TODO: Add your source code here
+  if (debug_lvl <= 0) return;
+
+  if (debug_lvl & 1) { // Standard console startup message output
+    if (from == 0) { // Constructor
+
+    }
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGInertial" << endl;
+    if (from == 1) cout << "Destroyed:    FGInertial" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+  }
+  if (debug_lvl & 16) { // Sanity checking
+  }
 }
 
index 6c0031b966dc37b0a4a00aacc9f96070ba2d55e6..7a1da74cf5c49dc496990858932e452b5b13d972 100644 (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);
 };
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index e641fa86c735ebbef2a0677136b225aeaa37e692..99cad97a5cfef446caf249986402e8cb1f51e86e 100644 (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 -
index b805f056befbf0326641c6d772402f651f1e8e1c..ee55600d2f0a23d118b5b0c2907b6d4d5fc21529 100644 (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;
index eb42ff08a8a6cbf882efa1109163b60b15687f23..e7cc9e4ef1b135d13cbb018b74ee6be0ad3ddec3 100644 (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)
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGLGear::Debug(void)
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGLGear::Debug(int from)
 {
-  // TODO: Add user code here
+  if (debug_lvl <= 0) return;
+
+  if (debug_lvl & 1) { // Standard console startup message output
+    if (from == 0) { // Constructor
+      cout << "    Name: " << name << endl;
+      cout << "      Location: " << vXYZ << endl;
+      cout << "      Spring Constant:  " << kSpring << endl;
+      cout << "      Damping Constant: " << bDamp << endl;
+      cout << "      Dynamic Friction: " << dynamicFCoeff << endl;
+      cout << "      Static Friction:  " << staticFCoeff << endl;
+      cout << "      Rolling Friction: " << rollingFCoeff << endl;
+      cout << "      Steering Type:    " << sSteerType << endl;
+      cout << "      Grouping:         " << sBrakeGroup << endl;
+      cout << "      Max Steer Angle:  " << maxSteerAngle << endl;
+      cout << "      Retractable:      " << Retractable << endl;
+    }
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGLGear" << endl;
+    if (from == 1) cout << "Destroyed:    FGLGear" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+  }
+  if (debug_lvl & 16) { // Sanity checking
+  }
 }
 
index fe2aff02b190c00fb3fc75b79df5cdc059c36aef..575a7814618af814575f167ee73b7f4c2d5d04d4 100644 (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"
index a7f2eb93bf40196047693733252e405b4a1de1fc..2770191ab82833368ac50f7343684b5218c84d55 100644 (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,16 +186,50 @@ double FGMassBalance::GetPMIxz(void)
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGMassBalance::Debug(void)
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGMassBalance::Debug(int from)
 {
-  if (debug_lvl & 16) { // Sanity check variables
-    if (EmptyWeight <= 0.0 || EmptyWeight > 1e9)
-      cout << "MassBalance::EmptyWeight out of bounds: " << EmptyWeight << endl;
-    if (Weight <= 0.0 || Weight > 1e9)
-      cout << "MassBalance::Weight out of bounds: " << Weight << endl;
-    if (Mass <= 0.0 || Mass > 1e9)
-      cout << "MassBalance::Mass out of bounds: " << Mass << endl;
+  if (debug_lvl <= 0) return;
+
+  if (debug_lvl & 1) { // Standard console startup message output
+    if (from == 0) { // Constructor
+
+    }
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGPiston" << endl;
+    if (from == 1) cout << "Destroyed:    FGPiston" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+  }
+  if (debug_lvl & 16) { // Sanity checking
+    if (from == 2) {
+      if (EmptyWeight <= 0.0 || EmptyWeight > 1e9)
+        cout << "MassBalance::EmptyWeight out of bounds: " << EmptyWeight << endl;
+      if (Weight <= 0.0 || Weight > 1e9)
+        cout << "MassBalance::Weight out of bounds: " << Weight << endl;
+      if (Mass <= 0.0 || Mass > 1e9)
+        cout << "MassBalance::Mass out of bounds: " << Mass << endl;
+    }
   }
 }
 
index 5efda6698cf38f3ea1602a381c794f763455a198..69c84fd46a2f06fe72bab4d5944d8b4281a2550e 100644 (file)
@@ -108,7 +108,7 @@ private:
   vector <FGColumnVector3> PointMassLoc;
   vector <double> PointMassWeight;
   FGColumnVector3 PointMassCG;
-  void Debug(void);
+  void Debug(int from);
 };
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index dba3689917be13aadb9a29b42c8e0961bfc72e9e..0c066df5959718b52e8b6c7b7fc4fa24ab797d83 100644 (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)
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGMatrix33::Debug(void)
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGMatrix33::Debug(int from)
 {
-    //TODO: Add your source code here
-}
+  if (debug_lvl <= 0) return;
 
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+  if (debug_lvl & 1) { // Standard console startup message output
+    if (from == 0) { // Constructor
+
+    }
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGMatrix33" << endl;
+    if (from == 1) cout << "Destroyed:    FGMatrix33" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+  }
+  if (debug_lvl & 16) { // Sanity checking
+  }
+}
 
index df592228053e8f8c60806f87e18b10b7ca30c296..7eff24dd778f285bd185358778b81ffab22eefc9 100644 (file)
@@ -128,7 +128,7 @@ protected:
 private:
   void TransposeSquare(void);
   unsigned int rowCtr, colCtr;
-  void Debug(void);
+  void Debug(int from);
 };
 
 #endif
index 3f0869081c75ca7c93790d77667d314839c8f799..001df2463445504eb0faff4742828e2f2675aa67 100644 (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)
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGNozzle::Debug(void)
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGNozzle::Debug(int from)
 {
-    //TODO: Add your source code here
+  if (debug_lvl <= 0) return;
+
+  if (debug_lvl & 1) { // Standard console startup message output
+    if (from == 0) { // Constructor
+      cout << "      Nozzle Name: " << Name << endl;
+      cout << "      Nozzle Exit Pressure = " << PE << endl;
+      cout << "      Nozzle Expansion Ratio = " << ExpR << endl;
+      cout << "      Nozzle Efficiency = " << nzlEff << endl;
+      cout << "      Nozzle Diameter = " << Diameter << endl;
+    }
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGNozzle" << endl;
+    if (from == 1) cout << "Destroyed:    FGNozzle" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+  }
+  if (debug_lvl & 16) { // Sanity checking
+  }
 }
 
index 93c4d39d21b5886e35495d1ca1dfcc17ef38d4a0..c0b0b9b5680701081c9b4c5e699185ab8aa1a7e7 100644 (file)
@@ -83,7 +83,7 @@ private:
   double Diameter;
   double AreaT;
   double Area2;
-  void Debug(void);
+  void Debug(int from);
 };
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index aff96cc482feaf0d80346daf518337c6828acf84..02f8eff1782326bc148e3a6753f4300e1bafc65a 100644 (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)
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGOutput::Debug(void)
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGOutput::Debug(int from)
 {
-    //TODO: Add your source code here
+  if (debug_lvl <= 0) return;
+
+  if (debug_lvl & 1) { // Standard console startup message output
+    if (from == 0) { // Constructor
+
+    }
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGOutput" << endl;
+    if (from == 1) cout << "Destroyed:    FGOutput" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+  }
+  if (debug_lvl & 16) { // Sanity checking
+  }
 }
 
index a22157ec20476d0e9b8bfe8cc0bcb43cc7ea1bd1..a87f6348bc997c094340fa4726fea09fe11e04ae 100644 (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);
 };
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index de5b7db5f3a069b0975c74fb9f4be91c5f8339d0..725499f1a68ecc21032fb64eabe5a9171e5e33a7 100644 (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,27 +121,21 @@ 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
+  // FIXME: calculate from actual fuel flow
   ConsumeFuel();
 
   Throttle = FCS->GetThrottlePos(EngineNumber);
@@ -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)
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGPiston::Debug(void)
+//
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGPiston::Debug(int from)
 {
-  //TODO: Add your source code here
+  if (debug_lvl <= 0) return;
+
+  if (debug_lvl & 1) { // Standard console startup message output
+    if (from == 0) { // Constructor
+
+      cout << "\n    Engine Name: "         << Name << endl;
+      cout << "      MinManifoldPressure: " << MinManifoldPressure_inHg << endl;
+      cout << "      MaxManifoldPressure: " << MaxManifoldPressure_inHg << endl;
+      cout << "      Displacement: "        << Displacement             << endl;
+      cout << "      MaxHP: "               << MaxHP                    << endl;
+      cout << "      Cycles: "              << Cycles                   << endl;
+      cout << "      IdleRPM: "             << IdleRPM                  << endl;
+      cout << "      MaxThrottle: "         << MaxThrottle              << endl;
+      cout << "      MinThrottle: "         << MinThrottle              << endl;
+      cout << "      SLFuelFlowMax: "       << SLFuelFlowMax            << endl;
+
+      cout << endl;
+      cout << "      Combustion Efficiency table:" << endl;
+      Lookup_Combustion_Efficiency->Print();
+      cout << endl;
+
+      cout << endl;
+      cout << "      Power Mixture Correlation table:" << endl;
+      Power_Mixture_Correlation->Print();
+      cout << endl;
+
+    }
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGPiston" << endl;
+    if (from == 1) cout << "Destroyed:    FGPiston" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+  }
+  if (debug_lvl & 16) { // Sanity checking
+  }
 }
 
index 7aab17ebbea2b866aa24a069d087456e96b9109d..7d9eb19163bfd7802fdff42ea2c72c026f6f3666 100644 (file)
@@ -156,7 +156,7 @@ private:
   double HP;
   double combustion_efficiency;
 
-  void Debug(void);
+  void Debug(int from);
 };
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index cc3a95cef237c5a8015a56bee3b92546b3f29fb4..33f244dfbc5bfe8431ee4c2ff48dad6878dd0387 100644 (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) {
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGPosition::Debug(void)
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGPosition::Debug(int from)
 {
-    //TODO: Add your source code here
+  if (debug_lvl <= 0) return;
+
+  if (debug_lvl & 1) { // Standard console startup message output
+    if (from == 0) { // Constructor
+
+    }
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGPosition" << endl;
+    if (from == 1) cout << "Destroyed:    FGPosition" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+  }
+  if (debug_lvl & 16) { // Sanity checking
+  }
 }
 
index 86479afa4ac4558955b0628de275c0e3107a2440..0e91ab26f1b61b28d14dabcb571dfc66ff248f52 100644 (file)
@@ -139,7 +139,7 @@ private:
   double psigt;
 
   void GetState(void);
-  void Debug(void);
+  void Debug(int from);
 };
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index 9ae5abcddb71cc66a42dbd324bc489c426fbaa5a..92e4c5340ca088dceb0cffcb6d94d84946630a1d 100644 (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()
+{
+  double px=0.0, py, pz;
+
+  py = Thrust * Sense * (GetActingLocationY() - GetLocationY()) / 12.0;
+  pz = Thrust * Sense * (GetActingLocationZ() - GetLocationZ()) / 12.0;
+
+  return FGColumnVector3(px, py, pz);
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGPropeller::Debug(int from)
 {
-    //TODO: Add your source code here
+  if (debug_lvl <= 0) return;
+
+  if (debug_lvl & 1) { // Standard console startup message output
+    if (from == 0) { // Constructor
+      cout << "\n    Propeller Name: " << Name << endl;
+      cout << "      IXX = " << Ixx << endl;
+      cout << "      Diameter = " << Diameter << " ft." << endl;
+      cout << "      Number of Blades  = " << numBlades << endl;
+      cout << "      Minimum Pitch  = " << MinPitch << endl;
+      cout << "      Maximum Pitch  = " << MaxPitch << endl;
+      cout << "      Thrust Coefficient: " <<  endl;
+      cThrust->Print();
+      cout << "      Power Coefficient: " <<  endl;
+      cPower->Print();
+    }
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGPropeller" << endl;
+    if (from == 1) cout << "Destroyed:    FGPropeller" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+  }
+  if (debug_lvl & 16) { // Sanity checking
+  }
 }
 
index 23c9aaadc62484123e1032c74fd230ce5e4a5907..14fe39bdd5f0ebb398804d014bca2700c1e9e131 100644 (file)
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-\r
- Header:       FGPropeller.h\r
- Author:       Jon S. Berndt\r
- Date started: 08/24/00\r
-\r
- ------------- Copyright (C) 2000  Jon S. Berndt (jsb@hal-pc.org) -------------\r
-\r
- This program is free software; you can redistribute it and/or modify it under\r
- the terms of the GNU General Public License as published by the Free Software\r
- Foundation; either version 2 of the License, or (at your option) any later\r
- version.\r
-\r
- This program is distributed in the hope that it will be useful, but WITHOUT\r
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
- FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more\r
- details.\r
-\r
- You should have received a copy of the GNU General Public License along with\r
- this program; if not, write to the Free Software Foundation, Inc., 59 Temple\r
- Place - Suite 330, Boston, MA  02111-1307, USA.\r
-\r
- Further information about the GNU General Public License can also be found on\r
- the world wide web at http://www.gnu.org.\r
-\r
-HISTORY\r
---------------------------------------------------------------------------------\r
-08/24/00  JSB  Created\r
-\r
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-SENTRY\r
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
-\r
-#ifndef FGPROPELLER_H\r
-#define FGPROPELLER_H\r
-\r
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-INCLUDES\r
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
-\r
-#include "FGThruster.h"\r
-#include "FGTable.h"\r
-#include "FGTranslation.h"\r
-#include "FGRotation.h"\r
-\r
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-DEFINITIONS\r
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
-\r
-#define ID_PROPELLER "$Id$"\r
-\r
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-FORWARD DECLARATIONS\r
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
-\r
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]\r
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
-\r
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-CLASS DOCUMENTATION\r
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
-\r
-/** Propeller modeling class.\r
-    FGPropeller models a propeller given the tabular data for Ct and Cp\r
-    indexed by advance ratio "J". The data for the propeller is\r
-    stored in a config file named "prop_name.xml". The propeller config file\r
-    is referenced from the main aircraft config file in the "Propulsion" section.\r
-    See the constructor for FGPropeller to see what is read in and what should\r
-    be stored in the config file.<br>\r
-    Several references were helpful, here:<ul>\r
-    <li>Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics",\r
-     Wiley & Sons, 1979 ISBN 0-471-03032-5</li>\r
-    <li>Edwin Hartman, David Biermann, "The Aerodynamic Characteristics of\r
-    Full Scale Propellers Having 2, 3, and 4 Blades of Clark Y and R.A.F. 6\r
-    Airfoil Sections", NACA Report TN-640, 1938 (?)</li>\r
-    <li>Various NACA Technical Notes and Reports</li>\r
-    <ul>\r
-    @author Jon S. Berndt\r
-    @version $Id$\r
-    @see FGEngine\r
-    @see FGThruster\r
-    @see FGTable\r
-*/\r
-\r
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-CLASS DECLARATION\r
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
-\r
-class FGPropeller : public FGThruster {\r
-\r
-public:\r
-  /** Constructor for FGPropeller.\r
-      @param exec a pointer to the main executive object\r
-      @param AC_cfg a pointer to the main aircraft config file object */\r
-  FGPropeller(FGFDMExec* exec, FGConfigFile* AC_cfg);\r
-\r
-  /// Destructor for FGPropeller - deletes the FGTable objects\r
-  ~FGPropeller();\r
-\r
-  /** Sets the Revolutions Per Minute for the propeller. Normally the propeller\r
-      instance will calculate its own rotational velocity, given the Torque\r
-      produced by the engine and integrating over time using the standard\r
-      equation for rotational acceleration "a": a = Q/I , where Q is Torque and\r
-      I is moment of inertia for the propeller.\r
-      @param rpm the rotational velocity of the propeller */\r
-  void SetRPM(double rpm) {RPM = rpm;}\r
-\r
-  /** This commands the pitch of the blade to change to the value supplied.\r
-      This call is meant to be issued either from the cockpit or by the flight\r
-      control system (perhaps to maintain constant RPM for a constant-speed\r
-      propeller). This value will be limited to be within whatever is specified\r
-      in the config file for Max and Min pitch. It is also one of the lookup\r
-      indices to the power and thrust tables for variable-pitch propellers.\r
-      @param pitch the pitch of the blade in degrees. */\r
-  void SetPitch(double pitch) {Pitch = pitch;}\r
-  \r
-  void SetPFactor(double pf) {P_Factor = pf;}\r
-  \r
-  void SetSense(double s) { Sense = s;}\r
-\r
-  /// Retrieves the pitch of the propeller in degrees.\r
-  double GetPitch(void)         { return Pitch;         }\r
-  \r
-  /// Retrieves the RPMs of the propeller\r
-  double GetRPM(void)           { return RPM;           }\r
-  \r
-  /// Retrieves the propeller moment of inertia\r
-  double GetIxx(void)           { return Ixx;           }\r
-  \r
-  /// Retrieves the Torque in foot-pounds (Don't you love the English system?)\r
-  double GetTorque(void)        { return vTorque(eX);    }\r
-  \r
-  /** Retrieves the power required (or "absorbed") by the propeller -\r
-      i.e. the power required to keep spinning the propeller at the current\r
-      velocity, air density,  and rotational rate. */\r
-  double GetPowerRequired(void);\r
-  \r
-  /** Calculates and returns the thrust produced by this propeller.\r
-      Given the excess power available from the engine (in foot-pounds), the thrust is\r
-      calculated, as well as the current RPM. The RPM is calculated by integrating\r
-      the torque provided by the engine over what the propeller "absorbs"\r
-      (essentially the "drag" of the propeller).\r
-      @param PowerAvailable this is the excess power provided by the engine to\r
-      accelerate the prop. It could be negative, dictating that the propeller\r
-      would be slowed.\r
-      @return the thrust in pounds */\r
-  double Calculate(double PowerAvailable);\r
-\r
-private:\r
-  int   numBlades;\r
-  double RPM;\r
-  double Ixx;\r
-  double Diameter;\r
-  double MaxPitch;\r
-  double MinPitch;\r
-  double MinRPM;\r
-  double MaxRPM;\r
-  double P_Factor;\r
-  double Sense;\r
-  double Pitch;\r
-  double ExcessTorque;\r
-  FGColumnVector3 vTorque;\r
-  FGTable *cThrust;\r
-  FGTable *cPower;\r
-  void Debug(void);\r
-};\r
-\r
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-#endif\r
-\r
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+ Header:       FGPropeller.h
+ Author:       Jon S. Berndt
+ Date started: 08/24/00
+
+ ------------- Copyright (C) 2000  Jon S. Berndt (jsb@hal-pc.org) -------------
+
+ This program is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any later
+ version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ Place - Suite 330, Boston, MA  02111-1307, USA.
+
+ Further information about the GNU General Public License can also be found on
+ the world wide web at http://www.gnu.org.
+
+HISTORY
+--------------------------------------------------------------------------------
+08/24/00  JSB  Created
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+SENTRY
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+#ifndef FGPROPELLER_H
+#define FGPROPELLER_H
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+INCLUDES
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+#include "FGThruster.h"
+#include "FGTable.h"
+#include "FGTranslation.h"
+#include "FGRotation.h"
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+DEFINITIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+#define ID_PROPELLER "$Id$"
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+FORWARD DECLARATIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DOCUMENTATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/** Propeller modeling class.
+    FGPropeller models a propeller given the tabular data for Ct and Cp
+    indexed by advance ratio "J". The data for the propeller is
+    stored in a config file named "prop_name.xml". The propeller config file
+    is referenced from the main aircraft config file in the "Propulsion" section.
+    See the constructor for FGPropeller to see what is read in and what should
+    be stored in the config file.<br>
+    Several references were helpful, here:<ul>
+    <li>Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics",
+     Wiley & Sons, 1979 ISBN 0-471-03032-5</li>
+    <li>Edwin Hartman, David Biermann, "The Aerodynamic Characteristics of
+    Full Scale Propellers Having 2, 3, and 4 Blades of Clark Y and R.A.F. 6
+    Airfoil Sections", NACA Report TN-640, 1938 (?)</li>
+    <li>Various NACA Technical Notes and Reports</li>
+    <ul>
+    @author Jon S. Berndt
+    @version $Id$
+    @see FGEngine
+    @see FGThruster
+    @see FGTable
+*/
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DECLARATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+class FGPropeller : public FGThruster {
+
+public:
+  /** Constructor for FGPropeller.
+      @param exec a pointer to the main executive object
+      @param AC_cfg a pointer to the main aircraft config file object */
+  FGPropeller(FGFDMExec* exec, FGConfigFile* AC_cfg);
+
+  /// Destructor for FGPropeller - deletes the FGTable objects
+  ~FGPropeller();
+
+  /** Sets the Revolutions Per Minute for the propeller. Normally the propeller
+      instance will calculate its own rotational velocity, given the Torque
+      produced by the engine and integrating over time using the standard
+      equation for rotational acceleration "a": a = Q/I , where Q is Torque and
+      I is moment of inertia for the propeller.
+      @param rpm the rotational velocity of the propeller */
+  void SetRPM(double rpm) {RPM = rpm;}
+
+  /// Returns true of this propeller is variable pitch
+  bool IsVPitch(void) {return MaxPitch != MinPitch;}
+
+  /** This commands the pitch of the blade to change to the value supplied.
+      This call is meant to be issued either from the cockpit or by the flight
+      control system (perhaps to maintain constant RPM for a constant-speed
+      propeller). This value will be limited to be within whatever is specified
+      in the config file for Max and Min pitch. It is also one of the lookup
+      indices to the power and thrust tables for variable-pitch propellers.
+      @param pitch the pitch of the blade in degrees. */
+  void SetPitch(double pitch) {Pitch = pitch;}
+
+  /// Sets the P-Factor constant
+  void SetPFactor(double pf) {P_Factor = pf;}
+
+  /** Sets the rotation sense of the propeller.
+      @param s this value should be +/- 1 ONLY. +1 indicates clockwise rotation as
+               viewed by someone standing behind the engine looking forward into
+               the direction of flight. */
+  void SetSense(double s) { Sense = s;}
+
+  /// Retrieves the pitch of the propeller in degrees.
+  double GetPitch(void)         { return Pitch;         }
+  
+  /// Retrieves the RPMs of the propeller
+  double GetRPM(void)           { return RPM;           }
+  
+  /// Retrieves the propeller moment of inertia
+  double GetIxx(void)           { return Ixx;           }
+  
+  /// Retrieves the Torque in foot-pounds (Don't you love the English system?)
+  double GetTorque(void)        { return vTorque(eX);    }
+  
+  /** Retrieves the power required (or "absorbed") by the propeller -
+      i.e. the power required to keep spinning the propeller at the current
+      velocity, air density,  and rotational rate. */
+  double GetPowerRequired(void);
+  
+  /** Calculates and returns the thrust produced by this propeller.
+      Given the excess power available from the engine (in foot-pounds), the thrust is
+      calculated, as well as the current RPM. The RPM is calculated by integrating
+      the torque provided by the engine over what the propeller "absorbs"
+      (essentially the "drag" of the propeller).
+      @param PowerAvailable this is the excess power provided by the engine to
+      accelerate the prop. It could be negative, dictating that the propeller
+      would be slowed.
+      @return the thrust in pounds */
+  double Calculate(double PowerAvailable);
+  FGColumnVector3 GetPFactor(void);
+
+private:
+  int   numBlades;
+  double RPM;
+  double Ixx;
+  double Diameter;
+  double MaxPitch;
+  double MinPitch;
+  double MinRPM;
+  double MaxRPM;
+  double P_Factor;
+  double Sense;
+  double Pitch;
+  double ExcessTorque;
+  FGColumnVector3 vTorque;
+  FGTable *cThrust;
+  FGTable *cPower;
+  void Debug(int from);
+};
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+#endif
+
index e8a148e1f2bc21f12f6ead4a2ac3d5f2a9c8994d..177e954fe965c92ebecae918b22a75e81c805a60 100644 (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)
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGPropulsion::Debug(void)
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGPropulsion::Debug(int from)
 {
-    //TODO: Add your source code here
+  if (debug_lvl <= 0) return;
+
+  if (debug_lvl & 1) { // Standard console startup message output
+    if (from == 0) { // Constructor
+
+    }
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGPropulsion" << endl;
+    if (from == 1) cout << "Destroyed:    FGPropulsion" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+  }
+  if (debug_lvl & 16) { // Sanity checking
+  }
 }
 
index 6cb2342a84c70d48fe777d80a92b440d5d0b08ff..6072da1b1f19b79061fda1df8094eb299cc558be 100644 (file)
@@ -198,7 +198,7 @@ private:
   FGColumnVector3 vForces;
   FGColumnVector3 vMoments;
   FGColumnVector3 vXYZtank;
-  void Debug(void);
+  void Debug(int from);
 };
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index 9a2e7bba58f57c33c06408b366318fa9d161c5f2..c5ca65d680fc1f6c9d45989b2fe6e8d15842f775 100644 (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)
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGRocket::Debug(void)
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGRocket::Debug(int from)
 {
-    //TODO: Add your source code here
+  if (debug_lvl <= 0) return;
+
+  if (debug_lvl & 1) { // Standard console startup message output
+    if (from == 0) { // Constructor
+      cout << "      Engine Name: " << Name << endl;
+      cout << "      Specific Heat Ratio = " << SHR << endl;
+      cout << "      Maximum Chamber Pressure = " << maxPC << endl;
+      cout << "      Propulsive Efficiency = " << propEff << endl;
+      cout << "      MaxThrottle = " << MaxThrottle << endl;
+      cout << "      MinThrottle = " << MinThrottle << endl;
+      cout << "      FuelFlowMax = " << SLFuelFlowMax << endl;
+      cout << "      OxiFlowMax = " << SLOxiFlowMax << endl;
+      cout << "      Variance = " << Variance << endl;
+    }
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGRocket" << endl;
+    if (from == 1) cout << "Destroyed:    FGRocket" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+  }
+  if (debug_lvl & 16) { // Sanity checking
+  }
 }
 
index 35b49de9cd13e0a63a994fd1e609075e9cc5dc96..dd54ae2a07144762d9c1c84df4341979ff47e52b 100644 (file)
@@ -129,7 +129,7 @@ private:
   double kFactor;
   double Variance;
   double PC;
-  void Debug(void);
+  void Debug(int from);
 };
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index d7a440040382dbd66599289bdde089db9faf0959..e56205b02a8e48672cd171f367223f838c9d5837 100644 (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,16 +150,49 @@ void FGRotation::GetState(void)
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGRotation::Debug(void)
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGRotation::Debug(int from)
 {
+  if (debug_lvl <= 0) return;
+
+  if (debug_lvl & 1) { // Standard console startup message output
+    if (from == 0) { // Constructor
+
+    }
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGRotation" << endl;
+    if (from == 1) cout << "Destroyed:    FGRotation" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+  }
   if (debug_lvl & 16) { // Sanity check variables
-    if (fabs(vPQR(eP)) > 100)
-      cout << "FGRotation::P (Roll Rate) out of bounds: " << vPQR(eP) << endl;
-    if (fabs(vPQR(eQ)) > 100)
-      cout << "FGRotation::Q (Pitch Rate) out of bounds: " << vPQR(eQ) << endl;
-    if (fabs(vPQR(eR)) > 100)
-      cout << "FGRotation::R (Yaw Rate) out of bounds: " << vPQR(eR) << endl;
+    if (from == 2) {
+      if (fabs(vPQR(eP)) > 100)
+        cout << "FGRotation::P (Roll Rate) out of bounds: " << vPQR(eP) << endl;
+      if (fabs(vPQR(eQ)) > 100)
+        cout << "FGRotation::Q (Pitch Rate) out of bounds: " << vPQR(eQ) << endl;
+      if (fabs(vPQR(eR)) > 100)
+        cout << "FGRotation::R (Yaw Rate) out of bounds: " << vPQR(eR) << endl;
+    }
   }
 }
-
index 7bd3f61d6879f7b1052d804135adfb510f78d5b6..3952a4f395f7cae2294deaf59eef9db0c3e94e3c 100644 (file)
@@ -129,7 +129,7 @@ private:
 
   void GetState(void);
 
-  void Debug(void);
+  void Debug(int from);
 };
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index 51bc5d49178b423b1fd2790a7bce91f9ebc9d258..195795bbc13625e92d7c4360acd657d1d1f166a8 100644 (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)
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGRotor::Debug(void)
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGRotor::Debug(int from)
 {
-    //TODO: Add your source code here
+  if (debug_lvl <= 0) return;
+
+  if (debug_lvl & 1) { // Standard console startup message output
+    if (from == 0) { // Constructor
+
+    }
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGRotor" << endl;
+    if (from == 1) cout << "Destroyed:    FGRotor" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+  }
+  if (debug_lvl & 16) { // Sanity checking
+  }
 }
 
-
index a13408408d4e5435b50a1c1a6403ed526745e9e8..dde526de5432c9d2c897a02cb6d12edf69cd1999 100644 (file)
@@ -59,7 +59,7 @@ public:
   double Calculate(double);
 
 private:
-  void Debug(void);
+  void Debug(int from);
 };
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index 5e3996a199007c1de5e8a6eaaa247590c642892c..c36af44e8ad5057e2b1f7a0423622933a758b915 100644 (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) {
 
 } 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGState::Debug(void)
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGState::Debug(int from)
 {
-    //TODO: Add your source code here
+  if (debug_lvl <= 0) return;
+
+  if (debug_lvl & 1) { // Standard console startup message output
+    if (from == 0) { // Constructor
+
+    }
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGState" << endl;
+    if (from == 1) cout << "Destroyed:    FGState" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+  }
+  if (debug_lvl & 16) { // Sanity checking
+  }
 }
 
index a60abaea15f8e68b7428bf0b73fa2e9a1b83f900..b3e7267e502638d4be7f9fd07fc1d318e3fcbf73 100644 (file)
@@ -340,8 +340,8 @@ private:
 
   typedef map<string, eParam> CoeffMap;
   CoeffMap coeffdef;
-  void Debug(void);
   int ActiveEngine;
+  void Debug(int from);
 };
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index 58e7e688b2f940846da2d62e275648aafdfddb76..0c564a1c759f365bd82b475931bd0599c1ad75f6 100644 (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)
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGTable::Debug(void)
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGTable::Debug(int from)
 {
-    //TODO: Add your source code here
+  if (debug_lvl <= 0) return;
+
+  if (debug_lvl & 1) { // Standard console startup message output
+    if (from == 0) { // Constructor
+
+    }
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGTable" << endl;
+    if (from == 1) cout << "Destroyed:    FGTable" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+  }
+  if (debug_lvl & 16) { // Sanity checking
+  }
 }
 
 
index 4a20d688afe75f6b6efaf3cbc9523c85a0c64613..6d5b55b2d692ba53a748d8147f2c573123b1074f 100644 (file)
@@ -105,7 +105,7 @@ private:
   int colCounter;
   int rowCounter;
   double** Allocate(void);
-  void Debug(void);
+  void Debug(int from);
 };
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index 65f7242df2908e8e319189c3e31ae24246ee21e0..5ed9699091a64ee668fba2ca77b62621c2045763 100644 (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)
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGTank::Debug(void)
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGTank::Debug(int from)
 {
-    //TODO: Add your source code here
+  if (debug_lvl <= 0) return;
+
+  if (debug_lvl & 1) { // Standard console startup message output
+    if (from == 0) { // Constructor
+      cout << "      " << type << " tank holds " << Capacity << " lbs. " << type << endl;
+      cout << "      currently at " << PctFull << "% of maximum capacity" << endl;
+      cout << "      Tank location (X, Y, Z): " << X << ", " << Y << ", " << Z << endl;
+      cout << "      Effective radius: " << Radius << " inches" << endl;
+    }
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGTank" << endl;
+    if (from == 1) cout << "Destroyed:    FGTank" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+  }
+  if (debug_lvl & 16) { // Sanity checking
+  }
 }
 
index 15be71714e4e0df92371a48727ab2e9f2074e9e3..2408ed9dd77070f7f787dedb7c3c4c200333ea32 100644 (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);
 };
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index 07cb48f3b8d0ed58015cb8d84dd45e91c5a7e037..ebe861803a9456697d87a0984edccf020be3e209 100644 (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);
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGThruster::Debug(void)
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGThruster::Debug(int from)
 {
-    //TODO: Add your source code here
+  if (debug_lvl <= 0) return;
+
+  if (debug_lvl & 1) { // Standard console startup message output
+    if (from == 0) { // Constructor
+
+    }
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGThruster" << endl;
+    if (from == 1) cout << "Destroyed:    FGThruster" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+  }
+  if (debug_lvl & 16) { // Sanity checking
+  }
 }
 
index bf0eb1a9b6a851b1872e171eb1433f79967b3023..d46956e0c5967abbc6515d99098c742d89387b63 100644 (file)
@@ -92,7 +92,7 @@ protected:
   double Thrust;
   double PowerRequired;
   double deltaT;
-  virtual void Debug(void);
+  virtual void Debug(int from);
 };
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index 5c76642f82f839d5a1e6f3b906c3c18295342147..d191b8c74371469772d2a628c6399da629999da0 100644 (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)
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGTranslation::Debug(void)
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGTranslation::Debug(int from)
 {
-  if (debug_lvl & 16) { // Sanity check variables
+  if (debug_lvl <= 0) return;
+
+  if (debug_lvl & 1) { // Standard console startup message output
+    if (from == 0) { // Constructor
+
+    }
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGTranslation" << endl;
+    if (from == 1) cout << "Destroyed:    FGTranslation" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+  }
+  if (debug_lvl & 16) { // Sanity checking
     if (fabs(vUVW(eU)) > 1e6)
       cout << "FGTranslation::U velocity out of bounds: " << vUVW(eU) << endl;
     if (fabs(vUVW(eV)) > 1e6)
@@ -181,4 +213,3 @@ void FGTranslation::Debug(void)
       cout << "FGTranslation::qbar is out of bounds: " << qbar << endl;
   }
 }
-
index d15e920115785879b7825eb116b0ba4b915b7543..a4939638007e1b6c9ba52bf1acec1e32eae67d31 100644 (file)
@@ -128,7 +128,7 @@ private:
   double alpha, beta;
   double adot,bdot;
 
-  void Debug(void);
+  void Debug(int from);
 };
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index 4412bf6c733fd6831348445c1573462c80a1e2e5..2fe3213f168c2aee9fa0ae01502f7e495472627e 100644 (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 ) {
 }
 
 /*****************************************************************************/
-
-void FGTrimAxis::Debug(void)
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGTrimAxis::Debug(int from)
 {
+  if (debug_lvl <= 0) return;
+
+  if (debug_lvl & 1) { // Standard console startup message output
+    if (from == 0) { // Constructor
+
+    }
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGTrimAxis" << endl;
+    if (from == 1) cout << "Destroyed:    FGTrimAxis" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+  }
+  if (debug_lvl & 16) { // Sanity checking
+  }
 }
 
index a5ea5c00d2a3ae4f4bfdf12b98b98a45e8aa7f59..86537800a7adea2a0b185d6c7dd0d3be76861f7d 100644 (file)
@@ -167,7 +167,7 @@ private:
   
   double computeHmgt(void);
   
-  void Debug(void);
+  void Debug(int from);
 };
 
 #endif
index 4f0b867ac0019c708b1325161ceb4757572d343c..3812fdc7f6c66b69c5a18114ffcdc786e9315861 100644 (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)
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGTurboJet::Debug(void)
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGTurboJet::Debug(int from)
 {
-    //TODO: Add your source code here
+  if (debug_lvl <= 0) return;
+
+  if (debug_lvl & 1) { // Standard console startup message output
+    if (from == 0) { // Constructor
+
+    }
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGTurboJet" << endl;
+    if (from == 1) cout << "Destroyed:    FGTurboJet" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+  }
+  if (debug_lvl & 16) { // Sanity checking
+  }
 }
 
index 1db6bc8e34350863082abedfe8abbdefa7802772..214ae6e85bbb9a5dede0cab3a346dc732bb67b5b 100644 (file)
@@ -60,7 +60,7 @@ public:
   double Calculate(double);
   
 private:
-  void Debug(void);
+  void Debug(int from);
 };
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index 5cad270cef997b09a0469c10abd78975181e2263..1179cbfafe51d47cd9579abf1c137f47e375a90a 100644 (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)
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGTurboProp::Debug(void)
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGTurboProp::Debug(int from)
 {
-    //TODO: Add your source code here
+  if (debug_lvl <= 0) return;
+
+  if (debug_lvl & 1) { // Standard console startup message output
+    if (from == 0) { // Constructor
+
+    }
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGTurboProp" << endl;
+    if (from == 1) cout << "Destroyed:    FGTurboProp" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+  }
+  if (debug_lvl & 16) { // Sanity checking
+  }
 }
 
index 822f73505beca64b8ae2ad0eccda828e6c4e3d64..3b855714af8744aecde25a0781f649735bd69c23 100644 (file)
@@ -59,7 +59,7 @@ public:
 
   double Calculate(double);
 private:
-  void Debug(void);
+  void Debug(int from);
 };
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index 0c454e1e42c808f2d58ca7670f4171c37a46d019..ce414d2741a0ab531813548e4fa97274c748aad8 100644 (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) {
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGTurboShaft::Debug(void)
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGTurboShaft::Debug(int from)
 {
-    //TODO: Add your source code here
+  if (debug_lvl <= 0) return;
+
+  if (debug_lvl & 1) { // Standard console startup message output
+    if (from == 0) { // Constructor
+
+    }
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGTurboShaft" << endl;
+    if (from == 1) cout << "Destroyed:    FGTurboShaft" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+  }
+  if (debug_lvl & 16) { // Sanity checking
+  }
 }
+
index 3f2d2aba776f9a553c7139c93aa9f3d4bc001d0c..beceb9b186d975c2bc46dda888cb6a7af7f3b622 100644 (file)
@@ -59,7 +59,7 @@ public:
 
   double Calculate(double);
 private:
-  void Debug(void);
+  void Debug(int from);
 };
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index 9866eac9f38fcefb8f8cf0391ca6fa9440f2a630..7e275a8e404405038c7961d2585b8adc09307d24 100644 (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);
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGUtility::Debug(void)
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGUtility::Debug(int from)
 {
+  if (debug_lvl <= 0) return;
+
+  if (debug_lvl & 1) { // Standard console startup message output
+    if (from == 0) { // Constructor
+
+    }
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGUtility" << endl;
+    if (from == 1) cout << "Destroyed:    FGUtility" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+  }
+  if (debug_lvl & 16) { // Sanity checking
+  }
 }
 
-
index 061fa90c9c20b8ee373ec0fe2b473539e37fe93d..4514c253c07371b010f997d3a7be8f473f1eb625 100644 (file)
@@ -62,7 +62,7 @@ public:
 private:
   FGState* State;
   FGFDMExec* FDMExec;
-  void Debug(void);
+  void Debug(int from);
 };
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index a01dae7ce4ecd750f688355f6297f059a8ae38ff..1aa09bda3b6862ea7b5880fd71d81471ca49ba6d 100644 (file)
@@ -107,6 +107,7 @@ private:
   struct sockaddr_in scktName;
   struct hostent *host;
   string buffer;
+  void Debug(int from) {}
 };
 
 #endif
index 59d8672e038c2935289e63c31fde6f5bfd225e77..8d3db58bcdf61d784ffdb72c3041e5d16882f1a2 100644 (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()) {
index 45210296cf0a51a9d18bafb3a78f8cff580873f8..1ffeeebbc46dea0eb5d6f4f8ce43deb81edea097 100644 (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 )
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGDeadBand::Debug(void)
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGDeadBand::Debug(int from)
 {
-    //TODO: Add your source code here
+  if (debug_lvl <= 0) return;
+
+  if (debug_lvl & 1) { // Standard console startup message output
+    if (from == 0) { // Constructor
+
+    }
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGDeadBand" << endl;
+    if (from == 1) cout << "Destroyed:    FGDeadBand" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+  }
+  if (debug_lvl & 16) { // Sanity checking
+  }
 }
 
index 9f91dfe0e479dd1db0aeba720f280da9301b9776..a20f4b152ff71bd87acb506b80bec1b76365cb0e 100644 (file)
@@ -81,7 +81,7 @@ public:
 private:
   FGConfigFile* AC_cfg;
   
-  void Debug(void);
+  void Debug(int from);
 };
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index b4b1e3e45a1588481ca325ba21422a21e7cb6ebb..ec7a596b26b2d98acb4f6a811da8411ffccc1b93 100644 (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)
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGFCSComponent::Debug(void)
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGFCSComponent::Debug(int from)
 {
-    //TODO: Add your source code here
-}
+  if (debug_lvl <= 0) return;
 
+  if (debug_lvl & 1) { // Standard console startup message output
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGFCSComponent" << endl;
+    if (from == 1) cout << "Destroyed:    FGFCSComponent" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+  }
+  if (debug_lvl & 16) { // Sanity checking
+  }
+}
index a1a5582137989ed2e9bc6edcf11fc7b8580f747c..8a6ec33f88caee12c10cee11ae5a67e9552796a9 100644 (file)
@@ -115,7 +115,7 @@ protected:
   eParam OutputIdx;
   double Output;
   bool IsOutput;
-  virtual void Debug(void);
+  virtual void Debug(int from);
 };
 
 #include "../FGFCS.h"
index 842aa6d8ad56abd3b1dfd04ff0983564e89404e1..d95c8c30a70ec512700645bbdcf509f168476421 100644 (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)
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGFilter::Debug(void)
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGFilter::Debug(int from)
 {
-    //TODO: Add your source code here
+  if (debug_lvl <= 0) return;
+
+  if (debug_lvl & 1) { // Standard console startup message output
+    if (from == 0) { // Constructor
+      cout << "      ID: " << ID << endl;
+      cout << "      INPUT: " << InputIdx << endl;
+      cout << "      C1: " << C1 << endl;
+      cout << "      C2: " << C2 << endl;
+      cout << "      C3: " << C3 << endl;
+      cout << "      C4: " << C4 << endl;
+      cout << "      C5: " << C5 << endl;
+      cout << "      C6: " << C6 << endl;
+      if (IsOutput) cout << "      OUTPUT: " << sOutputIdx << endl;
+    }
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGFilter" << endl;
+    if (from == 1) cout << "Destroyed:    FGFilter" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+  }
+  if (debug_lvl & 16) { // Sanity checking
+  }
 }
 
index 8a6255aff07d50625e9201cd36ff11b15a91d4bf..d085bb7b9a7396b41a990cd2df6f8ef16f93a1ac 100644 (file)
@@ -115,7 +115,7 @@ private:
   double PreviousOutput1;
   double PreviousOutput2;
   FGConfigFile* AC_cfg;
-  void Debug(void);
+  void Debug(int from);
 };
 
 #endif
index b89b72fbc31bac8ee4858cef7ffa0dc0c88857cf..0ca990c9c1058b36ad9b8d537d625ed2b63a0811 100644 (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 )
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGGain::Debug(void)
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGGain::Debug(int from)
 {
-    //TODO: Add your source code here
+  if (debug_lvl <= 0) return;
+
+  if (debug_lvl & 1) { // Standard console startup message output
+    if (from == 0) { // Constructor
+      cout << "      ID: " << ID << endl;
+      cout << "      INPUT: " << InputIdx << endl;
+      cout << "      GAIN: " << Gain << endl;
+      if (IsOutput) cout << "      OUTPUT: " << sOutputIdx << endl;
+      cout << "      MIN: " << Min << endl;
+      cout << "      MAX: " << Max << endl;
+      if (ScheduledBy != FG_UNDEF) {
+        cout << "      Scheduled by parameter: " << ScheduledBy << endl;
+        Table->Print();
+      }
+    }
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGGain" << endl;
+    if (from == 1) cout << "Destroyed:    FGGain" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+  }
+  if (debug_lvl & 16) { // Sanity checking
+  }
 }
 
index a5f33c6ea520701edb2dbc573b1af3576bf51ecc..7fced50e1058dafdfcf2a86d1de00bfb4ec71e1e 100644 (file)
@@ -82,7 +82,7 @@ private:
   int Rows;
   eParam ScheduledBy;
 
-  void Debug(void);
+  void Debug(int from);
 };
 
 #endif
index af22700fa7ee35de9ddb2be01b72d79a34bde414..27aadf39233245754230749324d9964a973683b8 100644 (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 )
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGGradient::Debug(void)
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGGradient::Debug(int from)
 {
-    //TODO: Add your source code here
+  if (debug_lvl <= 0) return;
+
+  if (debug_lvl & 1) { // Standard console startup message output
+    if (from == 0) { // Constructor
+
+    }
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGGradient" << endl;
+    if (from == 1) cout << "Destroyed:    FGGradient" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+  }
+  if (debug_lvl & 16) { // Sanity checking
+  }
 }
 
index 66d335d508b06f36a8b75147e972411b0b431541..dd87aaeb64bb71591c99851f2e7022d38afeb55b 100644 (file)
@@ -66,7 +66,7 @@ public:
 
 private:
   FGConfigFile* AC_cfg;
-  void Debug(void);
+  void Debug(int from);
 };
 
 #endif
index 934d64d3be3bf470ae35602b93eb6a6c2c8a7dcd..cea8cb313e9a6464242179c13bb2d7afe2cdac7e 100644 (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;
-  }
-  //cout << "FGKinemat::Run Handle: " << InputCmd << " Position: " << OutputPos << " Output: " << Output << endl;
-  if (IsOutput) {
-    //cout << "Calling SetOutput()" << endl;
-    SetOutput();
+    lastInputCmd = InputCmd;
+    Output = OutputPos;
   }
-  //cout << "Out FGKinemat::Run" << endl;
+
+  if (IsOutput) SetOutput();
+
   return true;
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGKinemat::Debug(void)
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGKinemat::Debug(int from)
 {
-    //TODO: Add your source code here
+  if (debug_lvl <= 0) return;
+
+  if (debug_lvl & 1) { // Standard console startup message output
+    if (from == 0) { // Constructor
+      cout << "      ID: " << ID << endl;
+      cout << "      INPUT: " << InputIdx << endl;
+      cout << "      DETENTS: " << NumDetents << endl;
+      for(int i=0;i<NumDetents;i++) {
+        cout << "        " << Detents[i] << " " << TransitionTimes[i] << endl;
+      }
+      if (IsOutput) cout << "      OUTPUT: " <<sOutputIdx << endl;
+    }
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGKinemat" << endl;
+    if (from == 1) cout << "Destroyed:    FGKinemat" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+  }
+  if (debug_lvl & 16) { // Sanity checking
+  }
 }
 
index bf04a4a7e8f085c56c5d29cad6ceb5399c192552..cea2b549e34cf1d98b921d1a54d58046e377374e 100644 (file)
@@ -82,7 +82,7 @@ private:
   double OutputPos;
   bool  InTransit;
 
-  void Debug(void);
+  void Debug(int from);
 };
 
 #endif
index 17ce819baa2a126551e9b8e6328e90cefb03dfd3..af1bf02e55faf3baa8f37d997177db8a082d64d9 100644 (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 )
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGSummer::Debug(void)
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGSummer::Debug(int from)
 {
-    //TODO: Add your source code here
+  if (debug_lvl <= 0) return;
+
+  if (debug_lvl & 1) { // Standard console startup message output
+    if (from == 0) { // Constructor
+      cout << "      ID: " << ID << endl;
+      cout << "      INPUTS: " << endl;
+      for (unsigned i=0;i<InputIndices.size();i++) {
+        cout << "        " << InputIndices[i] << endl;
+      }
+      if (clipmax > clipmin) cout << "      CLIPTO: " << clipmin 
+                                  << ", " << clipmax << endl;
+      if (IsOutput) cout << "      OUTPUT: " <<sOutputIdx <<  endl;
+    }
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGSummer" << endl;
+    if (from == 1) cout << "Destroyed:    FGSummer" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+  }
+  if (debug_lvl & 16) { // Sanity checking
+  }
 }
 
index 557f1a4bbf17f24d4dd7ac1c2fcaa7591b6f815d..f4234897ce5fd753478075bac6102d46928303dc 100644 (file)
@@ -80,7 +80,7 @@ private:
   vector <int> InputTypes;
   bool clip;
   double clipmin,clipmax;
-  void Debug(void);
+  void Debug(int from);
 };
 
 #endif
index 8c369f58dfb2cec87426c4134cc5101c76753f2e..0d0a93ace1431f380ffb6e4a8584c6517d68532c 100644 (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 )
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGSwitch::Debug(void)
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGSwitch::Debug(int from)
 {
-    //TODO: Add your source code here
+  if (debug_lvl <= 0) return;
+
+  if (debug_lvl & 1) { // Standard console startup message output
+    if (from == 0) { // Constructor
+
+    }
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGSwitch" << endl;
+    if (from == 1) cout << "Destroyed:    FGSwitch" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+  }
+  if (debug_lvl & 16) { // Sanity checking
+  }
 }
 
index 9d5997b3166e98df6e70f97f31fcf36c3a341d37..8bfe0e1b1454501f407ea523615a19351fd428d1 100644 (file)
@@ -63,9 +63,9 @@ public:
   bool Run(void);
 
 private:
-  void Debug(void);
   FGFCS* fcs;
   FGConfigFile* AC_cfg;
+  void Debug(int from);
 };
 
 #endif