From a9d81f2e65116344084ee4f21e860ecd83662877 Mon Sep 17 00:00:00 2001 From: tony Date: Fri, 24 Jan 2003 12:55:28 +0000 Subject: [PATCH] Latest JSBSim updates, including use of new "JSBSim" namespace --- src/FDM/JSBSim/FGAerodynamics.cpp | 3 + src/FDM/JSBSim/FGAerodynamics.h | 3 + src/FDM/JSBSim/FGAircraft.cpp | 3 + src/FDM/JSBSim/FGAircraft.h | 3 + src/FDM/JSBSim/FGAtmosphere.cpp | 3 + src/FDM/JSBSim/FGAtmosphere.h | 4 + src/FDM/JSBSim/FGAuxiliary.cpp | 3 + src/FDM/JSBSim/FGAuxiliary.h | 4 + src/FDM/JSBSim/FGCoefficient.cpp | 3 + src/FDM/JSBSim/FGCoefficient.h | 4 + src/FDM/JSBSim/FGColumnVector3.cpp | 3 + src/FDM/JSBSim/FGColumnVector3.h | 4 +- src/FDM/JSBSim/FGColumnVector4.cpp | 5 +- src/FDM/JSBSim/FGColumnVector4.h | 4 +- src/FDM/JSBSim/FGConfigFile.cpp | 4 +- src/FDM/JSBSim/FGConfigFile.h | 4 +- src/FDM/JSBSim/FGEngine.cpp | 4 +- src/FDM/JSBSim/FGEngine.h | 7 +- src/FDM/JSBSim/FGFCS.cpp | 3 + src/FDM/JSBSim/FGFCS.h | 4 +- src/FDM/JSBSim/FGFDMExec.cpp | 9 +- src/FDM/JSBSim/FGFDMExec.h | 4 +- src/FDM/JSBSim/FGFactorGroup.cpp | 3 + src/FDM/JSBSim/FGFactorGroup.h | 4 +- src/FDM/JSBSim/FGForce.cpp | 4 +- src/FDM/JSBSim/FGForce.h | 4 +- src/FDM/JSBSim/FGGroundReactions.cpp | 4 +- src/FDM/JSBSim/FGGroundReactions.h | 4 +- src/FDM/JSBSim/FGInertial.cpp | 4 +- src/FDM/JSBSim/FGInertial.h | 4 +- src/FDM/JSBSim/FGInitialCondition.cpp | 4 +- src/FDM/JSBSim/FGInitialCondition.h | 4 +- src/FDM/JSBSim/FGJSBBase.cpp | 5 +- src/FDM/JSBSim/FGJSBBase.h | 4 +- src/FDM/JSBSim/FGLGear.cpp | 96 +++++++++---- src/FDM/JSBSim/FGLGear.h | 16 ++- src/FDM/JSBSim/FGMassBalance.cpp | 4 +- src/FDM/JSBSim/FGMassBalance.h | 4 +- src/FDM/JSBSim/FGMatrix33.cpp | 4 +- src/FDM/JSBSim/FGMatrix33.h | 4 +- src/FDM/JSBSim/FGModel.cpp | 4 +- src/FDM/JSBSim/FGModel.h | 4 +- src/FDM/JSBSim/FGNozzle.cpp | 4 +- src/FDM/JSBSim/FGNozzle.h | 4 +- src/FDM/JSBSim/FGOutput.cpp | 4 +- src/FDM/JSBSim/FGOutput.h | 4 +- src/FDM/JSBSim/FGPiston.cpp | 4 + src/FDM/JSBSim/FGPiston.h | 4 +- src/FDM/JSBSim/FGPosition.cpp | 4 +- src/FDM/JSBSim/FGPosition.h | 4 +- src/FDM/JSBSim/FGPropeller.cpp | 4 +- src/FDM/JSBSim/FGPropeller.h | 4 +- src/FDM/JSBSim/FGPropertyManager.cpp | 4 + src/FDM/JSBSim/FGPropertyManager.h | 4 +- src/FDM/JSBSim/FGPropulsion.cpp | 15 +- src/FDM/JSBSim/FGPropulsion.h | 4 +- src/FDM/JSBSim/FGRocket.cpp | 4 +- src/FDM/JSBSim/FGRocket.h | 4 +- src/FDM/JSBSim/FGRotation.cpp | 4 +- src/FDM/JSBSim/FGRotation.h | 4 +- src/FDM/JSBSim/FGRotor.cpp | 4 +- src/FDM/JSBSim/FGRotor.h | 4 +- src/FDM/JSBSim/FGScript.cpp | 4 +- src/FDM/JSBSim/FGScript.h | 4 +- src/FDM/JSBSim/FGState.cpp | 4 +- src/FDM/JSBSim/FGState.h | 4 +- src/FDM/JSBSim/FGTable.cpp | 9 +- src/FDM/JSBSim/FGTable.h | 4 +- src/FDM/JSBSim/FGTank.cpp | 16 ++- src/FDM/JSBSim/FGTank.h | 4 +- src/FDM/JSBSim/FGThruster.cpp | 4 +- src/FDM/JSBSim/FGThruster.h | 4 +- src/FDM/JSBSim/FGTranslation.cpp | 4 +- src/FDM/JSBSim/FGTranslation.h | 62 +++++++- src/FDM/JSBSim/FGTrim.cpp | 4 +- src/FDM/JSBSim/FGTrim.h | 21 +-- src/FDM/JSBSim/FGTrimAxis.cpp | 5 +- src/FDM/JSBSim/FGTrimAxis.h | 4 +- src/FDM/JSBSim/FGTurbine.cpp | 4 +- src/FDM/JSBSim/FGTurbine.h | 4 +- src/FDM/JSBSim/FGUtility.cpp | 4 +- src/FDM/JSBSim/FGUtility.h | 4 +- src/FDM/JSBSim/FGfdmSocket.cpp | 4 +- src/FDM/JSBSim/FGfdmSocket.h | 4 +- src/FDM/JSBSim/JSBSim.cxx | 1 + src/FDM/JSBSim/JSBSim.hxx | 4 + src/FDM/JSBSim/Makefile.am | 4 +- src/FDM/JSBSim/filtersjb/FGDeadBand.cpp | 54 ++++++- src/FDM/JSBSim/filtersjb/FGDeadBand.h | 18 ++- src/FDM/JSBSim/filtersjb/FGFCSComponent.cpp | 20 +-- src/FDM/JSBSim/filtersjb/FGFCSComponent.h | 8 +- src/FDM/JSBSim/filtersjb/FGFilter.cpp | 7 +- src/FDM/JSBSim/filtersjb/FGFilter.h | 5 +- src/FDM/JSBSim/filtersjb/FGGain.cpp | 14 +- src/FDM/JSBSim/filtersjb/FGGain.h | 4 +- src/FDM/JSBSim/filtersjb/FGGradient.cpp | 4 +- src/FDM/JSBSim/filtersjb/FGGradient.h | 4 +- src/FDM/JSBSim/filtersjb/FGKinemat.cpp | 8 +- src/FDM/JSBSim/filtersjb/FGKinemat.h | 4 +- src/FDM/JSBSim/filtersjb/FGSummer.cpp | 8 +- src/FDM/JSBSim/filtersjb/FGSummer.h | 4 +- src/FDM/JSBSim/filtersjb/FGSwitch.cpp | 149 +++++++++++++++++++- src/FDM/JSBSim/filtersjb/FGSwitch.h | 93 ++++++++++-- src/FDM/JSBSim/filtersjb/Makefile.am | 3 +- 104 files changed, 769 insertions(+), 191 deletions(-) diff --git a/src/FDM/JSBSim/FGAerodynamics.cpp b/src/FDM/JSBSim/FGAerodynamics.cpp index eaeaa194d..214a6f0b6 100644 --- a/src/FDM/JSBSim/FGAerodynamics.cpp +++ b/src/FDM/JSBSim/FGAerodynamics.cpp @@ -41,6 +41,8 @@ INCLUDES #include "FGCoefficient.h" #include "FGPropertyManager.h" +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_AERODYNAMICS; @@ -404,3 +406,4 @@ void FGAerodynamics::Debug(int from) } } +} // namespace JSBSim diff --git a/src/FDM/JSBSim/FGAerodynamics.h b/src/FDM/JSBSim/FGAerodynamics.h index 5adac5b86..66796a325 100644 --- a/src/FDM/JSBSim/FGAerodynamics.h +++ b/src/FDM/JSBSim/FGAerodynamics.h @@ -94,6 +94,7 @@ CLASS DOCUMENTATION /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS DECLARATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +namespace JSBSim { class FGAerodynamics : public FGModel { @@ -177,6 +178,8 @@ private: void Debug(int from); }; +} // namespace JSBSim + //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #endif diff --git a/src/FDM/JSBSim/FGAircraft.cpp b/src/FDM/JSBSim/FGAircraft.cpp index 2e94ecfad..b8b532a57 100644 --- a/src/FDM/JSBSim/FGAircraft.cpp +++ b/src/FDM/JSBSim/FGAircraft.cpp @@ -84,6 +84,8 @@ INCLUDES #include "FGOutput.h" #include "FGPropertyManager.h" +namespace JSBSim { + /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ @@ -380,3 +382,4 @@ void FGAircraft::Debug(int from) } } +} // namespace JSBSim diff --git a/src/FDM/JSBSim/FGAircraft.h b/src/FDM/JSBSim/FGAircraft.h index 7d4b0be61..0a9b107b6 100644 --- a/src/FDM/JSBSim/FGAircraft.h +++ b/src/FDM/JSBSim/FGAircraft.h @@ -109,6 +109,8 @@ CLASS DOCUMENTATION CLASS DECLARATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +namespace JSBSim { + class FGAircraft : public FGModel { public: /** Constructor @@ -186,6 +188,7 @@ private: void Debug(int from); }; +} // namespace JSBSim //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #endif diff --git a/src/FDM/JSBSim/FGAtmosphere.cpp b/src/FDM/JSBSim/FGAtmosphere.cpp index 0e945a3cc..e6f58d8f2 100644 --- a/src/FDM/JSBSim/FGAtmosphere.cpp +++ b/src/FDM/JSBSim/FGAtmosphere.cpp @@ -62,6 +62,8 @@ INCLUDES #include "FGColumnVector4.h" #include "FGPropertyManager.h" +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_ATMOSPHERE; @@ -431,3 +433,4 @@ void FGAtmosphere::Debug(int from) } } +} // namespace JSBSim diff --git a/src/FDM/JSBSim/FGAtmosphere.h b/src/FDM/JSBSim/FGAtmosphere.h index 43894a114..4290f1714 100644 --- a/src/FDM/JSBSim/FGAtmosphere.h +++ b/src/FDM/JSBSim/FGAtmosphere.h @@ -82,6 +82,8 @@ CLASS DOCUMENTATION CLASS DECLARATION *******************************************************************************/ +namespace JSBSim { + class FGAtmosphere : public FGModel { public: @@ -190,6 +192,8 @@ private: void Debug(int from); }; +} // namespace JSBSim + /******************************************************************************/ #endif diff --git a/src/FDM/JSBSim/FGAuxiliary.cpp b/src/FDM/JSBSim/FGAuxiliary.cpp index fcadc8000..845341b24 100644 --- a/src/FDM/JSBSim/FGAuxiliary.cpp +++ b/src/FDM/JSBSim/FGAuxiliary.cpp @@ -57,6 +57,8 @@ INCLUDES #include "FGColumnVector4.h" #include "FGPropertyManager.h" +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_AUXILIARY; @@ -315,3 +317,4 @@ void FGAuxiliary::Debug(int from) } } +} // namespace JSBSim diff --git a/src/FDM/JSBSim/FGAuxiliary.h b/src/FDM/JSBSim/FGAuxiliary.h index 9210156c6..3f6018edc 100644 --- a/src/FDM/JSBSim/FGAuxiliary.h +++ b/src/FDM/JSBSim/FGAuxiliary.h @@ -75,6 +75,8 @@ CLASS DOCUMENTATION CLASS DECLARATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +namespace JSBSim { + class FGAuxiliary : public FGModel { public: /** Constructor @@ -129,6 +131,8 @@ private: void Debug(int from); }; +} // namespace JSBSim + //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #endif diff --git a/src/FDM/JSBSim/FGCoefficient.cpp b/src/FDM/JSBSim/FGCoefficient.cpp index 523d8ff7a..ab7927a44 100644 --- a/src/FDM/JSBSim/FGCoefficient.cpp +++ b/src/FDM/JSBSim/FGCoefficient.cpp @@ -61,6 +61,8 @@ INCLUDES # include STL_IOMANIP #endif +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_COEFFICIENT; @@ -420,3 +422,4 @@ void FGCoefficient::Debug(int from) } } +} // namespace JSBSim diff --git a/src/FDM/JSBSim/FGCoefficient.h b/src/FDM/JSBSim/FGCoefficient.h index a809ae11a..55ad7a165 100644 --- a/src/FDM/JSBSim/FGCoefficient.h +++ b/src/FDM/JSBSim/FGCoefficient.h @@ -61,6 +61,8 @@ using std::vector; FORWARD DECLARATIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +namespace JSBSim { + class FGFDMExec; class FGState; class FGAtmosphere; @@ -208,6 +210,8 @@ private: virtual void Debug(int from); }; +} // using namespace JSBSim + //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #endif diff --git a/src/FDM/JSBSim/FGColumnVector3.cpp b/src/FDM/JSBSim/FGColumnVector3.cpp index 4684da529..254317631 100644 --- a/src/FDM/JSBSim/FGColumnVector3.cpp +++ b/src/FDM/JSBSim/FGColumnVector3.cpp @@ -20,6 +20,8 @@ INCLUDES #include "FGColumnVector3.h" +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_COLUMNVECTOR3; @@ -324,3 +326,4 @@ void FGColumnVector3::Debug(int from) } } +} // namespace JSBSim diff --git a/src/FDM/JSBSim/FGColumnVector3.h b/src/FDM/JSBSim/FGColumnVector3.h index dad53abf0..35a5c8743 100644 --- a/src/FDM/JSBSim/FGColumnVector3.h +++ b/src/FDM/JSBSim/FGColumnVector3.h @@ -66,6 +66,8 @@ FORWARD DECLARATIONS DECLARATION: FGColumnVector3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +namespace JSBSim { + class FGColumnVector3 : public FGJSBBase { public: @@ -110,6 +112,6 @@ private: int rowCtr; void Debug(int from); }; - +} //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #endif diff --git a/src/FDM/JSBSim/FGColumnVector4.cpp b/src/FDM/JSBSim/FGColumnVector4.cpp index 8a0cd99f2..de65c0117 100644 --- a/src/FDM/JSBSim/FGColumnVector4.cpp +++ b/src/FDM/JSBSim/FGColumnVector4.cpp @@ -20,6 +20,8 @@ INCLUDES #include "FGColumnVector4.h" +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_COLUMNVECTOR4; @@ -309,5 +311,4 @@ void FGColumnVector4::Debug(int from) } } } - - +} diff --git a/src/FDM/JSBSim/FGColumnVector4.h b/src/FDM/JSBSim/FGColumnVector4.h index eca61df03..ab65e1402 100644 --- a/src/FDM/JSBSim/FGColumnVector4.h +++ b/src/FDM/JSBSim/FGColumnVector4.h @@ -66,6 +66,8 @@ FORWARD DECLARATIONS DECLARATION: FGColumnVector4 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +namespace JSBSim { + class FGColumnVector4 : public FGJSBBase { public: @@ -109,7 +111,7 @@ private: int rowCtr; void Debug(int from); }; - +} //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #endif diff --git a/src/FDM/JSBSim/FGConfigFile.cpp b/src/FDM/JSBSim/FGConfigFile.cpp index a3bb23477..e0d42cb06 100644 --- a/src/FDM/JSBSim/FGConfigFile.cpp +++ b/src/FDM/JSBSim/FGConfigFile.cpp @@ -21,6 +21,8 @@ INCLUDES #include #include +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_CONFIGFILE; @@ -339,4 +341,4 @@ void FGConfigFile::Debug(int from) } } } - +} diff --git a/src/FDM/JSBSim/FGConfigFile.h b/src/FDM/JSBSim/FGConfigFile.h index f71367eaf..f415210d8 100644 --- a/src/FDM/JSBSim/FGConfigFile.h +++ b/src/FDM/JSBSim/FGConfigFile.h @@ -104,6 +104,8 @@ CLASS DOCUMENTATION CLASS DECLARATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +namespace JSBSim { + class FGConfigFile : public FGJSBBase { public: @@ -146,7 +148,7 @@ private: void Debug(int from); }; - +} //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #endif diff --git a/src/FDM/JSBSim/FGEngine.cpp b/src/FDM/JSBSim/FGEngine.cpp index f977a8846..0117166d7 100644 --- a/src/FDM/JSBSim/FGEngine.cpp +++ b/src/FDM/JSBSim/FGEngine.cpp @@ -56,6 +56,8 @@ INCLUDES #include "FGEngine.h" #include "FGTank.h" +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_ENGINE; @@ -211,4 +213,4 @@ void FGEngine::Debug(int from) } } } - +} diff --git a/src/FDM/JSBSim/FGEngine.h b/src/FDM/JSBSim/FGEngine.h index fde9f0adb..14d15149b 100644 --- a/src/FDM/JSBSim/FGEngine.h +++ b/src/FDM/JSBSim/FGEngine.h @@ -67,6 +67,9 @@ DEFINITIONS #define ID_ENGINE "$Id$" using std::string; +using std::vector; + +namespace JSBSim { /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FORWARD DECLARATIONS @@ -84,8 +87,6 @@ class FGPosition; class FGAuxiliary; class FGOutput; -using std::vector; - /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ @@ -241,7 +242,7 @@ protected: vector SourceTanks; virtual void Debug(int from); }; - +} #include "FGState.h" #include "FGFDMExec.h" #include "FGAtmosphere.h" diff --git a/src/FDM/JSBSim/FGFCS.cpp b/src/FDM/JSBSim/FGFCS.cpp index c6ee9bd83..c53d5e75e 100644 --- a/src/FDM/JSBSim/FGFCS.cpp +++ b/src/FDM/JSBSim/FGFCS.cpp @@ -57,6 +57,8 @@ INCLUDES #include "filtersjb/FGSummer.h" #include "filtersjb/FGKinemat.h" +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_FCS; @@ -896,3 +898,4 @@ void FGFCS::Debug(int from) } } +} diff --git a/src/FDM/JSBSim/FGFCS.h b/src/FDM/JSBSim/FGFCS.h index 4af471e74..c2f560b47 100644 --- a/src/FDM/JSBSim/FGFCS.h +++ b/src/FDM/JSBSim/FGFCS.h @@ -65,6 +65,8 @@ DEFINITIONS FORWARD DECLARATIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +namespace JSBSim { + typedef enum { iDe=0, iDaL, iDaR, iDr, iDsb, iDsp, iDf, NNorm } FcIdx; typedef enum { ofRad=0, ofNorm, ofMag , NForms} OutputForm; @@ -644,7 +646,7 @@ private: int ToNormalize[NNorm]; void Debug(int from); }; - +} #endif diff --git a/src/FDM/JSBSim/FGFDMExec.cpp b/src/FDM/JSBSim/FGFDMExec.cpp index 75ee4615a..166fdee45 100644 --- a/src/FDM/JSBSim/FGFDMExec.cpp +++ b/src/FDM/JSBSim/FGFDMExec.cpp @@ -73,6 +73,8 @@ INCLUDES #include "FGInitialCondition.h" #include "FGPropertyManager.h" +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_FDMEXEC; @@ -245,12 +247,11 @@ bool FGFDMExec::Allocate(void) if (Error > 0) result = false; IC = new FGInitialCondition(this); - //Trim is allocated as needed by GetTrim() - // Schedule a model. The second arg (the integer) is the pass number. For // instance, the atmosphere model gets executed every fifth pass it is called // by the executive. Everything else here gets executed each pass. + // IC and Trim objects are NOT scheduled. Schedule(Atmosphere, 1); Schedule(FCS, 1); @@ -265,9 +266,6 @@ bool FGFDMExec::Allocate(void) Schedule(Position, 1); Schedule(Auxiliary, 1); Schedule(Output, 1); - //IC and Trim are *not* scheduled objects - - modelLoaded = false; @@ -700,4 +698,5 @@ void FGFDMExec::Debug(int from) } } } +} diff --git a/src/FDM/JSBSim/FGFDMExec.h b/src/FDM/JSBSim/FGFDMExec.h index 08f6161bc..155d3aba9 100644 --- a/src/FDM/JSBSim/FGFDMExec.h +++ b/src/FDM/JSBSim/FGFDMExec.h @@ -113,6 +113,8 @@ CLASS DOCUMENTATION CLASS DECLARATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +namespace JSBSim { + class FGFDMExec : public FGJSBBase { public: @@ -317,7 +319,7 @@ private: bool DeAllocate(void); void Debug(int from); }; - +} //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #endif diff --git a/src/FDM/JSBSim/FGFactorGroup.cpp b/src/FDM/JSBSim/FGFactorGroup.cpp index 9d96439ea..ebf1da9a6 100644 --- a/src/FDM/JSBSim/FGFactorGroup.cpp +++ b/src/FDM/JSBSim/FGFactorGroup.cpp @@ -60,6 +60,8 @@ INCLUDES # include STL_IOMANIP #endif +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_FACTORGROUP; @@ -200,3 +202,4 @@ void FGFactorGroup::Debug(int from) } } +} diff --git a/src/FDM/JSBSim/FGFactorGroup.h b/src/FDM/JSBSim/FGFactorGroup.h index 9a118c188..cbed19b3d 100644 --- a/src/FDM/JSBSim/FGFactorGroup.h +++ b/src/FDM/JSBSim/FGFactorGroup.h @@ -62,6 +62,8 @@ using std::vector; FORWARD DECLARATIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +namespace JSBSim { + class FGFDMExec; class FGState; class FGAtmosphere; @@ -120,5 +122,5 @@ private: FGPropertyManager *node; void Debug(int from); }; - +} #endif diff --git a/src/FDM/JSBSim/FGForce.cpp b/src/FDM/JSBSim/FGForce.cpp index 91dd746e6..86d4b915c 100644 --- a/src/FDM/JSBSim/FGForce.cpp +++ b/src/FDM/JSBSim/FGForce.cpp @@ -48,6 +48,8 @@ and the cg. #include "FGColumnVector4.h" #include "FGForce.h" +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_FORCE; @@ -179,4 +181,4 @@ void FGForce::Debug(int from) } } } - +} diff --git a/src/FDM/JSBSim/FGForce.h b/src/FDM/JSBSim/FGForce.h index dfacc4a19..a54e69f2b 100644 --- a/src/FDM/JSBSim/FGForce.h +++ b/src/FDM/JSBSim/FGForce.h @@ -217,6 +217,8 @@ and vMn, the moments, can be made directly. Otherwise, the usage is similar.
CLASS DECLARATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +namespace JSBSim { + class FGForce : public FGJSBBase { public: @@ -328,6 +330,6 @@ private: virtual void Debug(int from); }; - +} #endif diff --git a/src/FDM/JSBSim/FGGroundReactions.cpp b/src/FDM/JSBSim/FGGroundReactions.cpp index 676271986..960cda262 100644 --- a/src/FDM/JSBSim/FGGroundReactions.cpp +++ b/src/FDM/JSBSim/FGGroundReactions.cpp @@ -38,6 +38,8 @@ INCLUDES #include "FGGroundReactions.h" #include "FGPropertyManager.h" +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_GROUNDREACTIONS; @@ -269,4 +271,4 @@ void FGGroundReactions::Debug(int from) } } } - +} diff --git a/src/FDM/JSBSim/FGGroundReactions.h b/src/FDM/JSBSim/FGGroundReactions.h index 842d70837..e589263e3 100644 --- a/src/FDM/JSBSim/FGGroundReactions.h +++ b/src/FDM/JSBSim/FGGroundReactions.h @@ -65,6 +65,8 @@ INCLUDES CLASS DECLARATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +namespace JSBSim { + class FGGroundReactions : public FGModel { public: @@ -100,7 +102,7 @@ private: void Debug(int from); }; - +} //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #endif diff --git a/src/FDM/JSBSim/FGInertial.cpp b/src/FDM/JSBSim/FGInertial.cpp index 091f6647d..53516939f 100644 --- a/src/FDM/JSBSim/FGInertial.cpp +++ b/src/FDM/JSBSim/FGInertial.cpp @@ -39,6 +39,8 @@ INCLUDES #include "FGPosition.h" #include "FGMassBalance.h" +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_INERTIAL; @@ -190,4 +192,4 @@ void FGInertial::Debug(int from) } } } - +} diff --git a/src/FDM/JSBSim/FGInertial.h b/src/FDM/JSBSim/FGInertial.h index 5130c92db..1ec306610 100644 --- a/src/FDM/JSBSim/FGInertial.h +++ b/src/FDM/JSBSim/FGInertial.h @@ -66,6 +66,8 @@ CLASS DECLARATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +namespace JSBSim { + class FGInertial : public FGModel { public: @@ -101,7 +103,7 @@ private: double GM; void Debug(int from); }; - +} //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #endif diff --git a/src/FDM/JSBSim/FGInitialCondition.cpp b/src/FDM/JSBSim/FGInitialCondition.cpp index f9fbc31b5..16a912192 100644 --- a/src/FDM/JSBSim/FGInitialCondition.cpp +++ b/src/FDM/JSBSim/FGInitialCondition.cpp @@ -57,6 +57,8 @@ INCLUDES #include "FGConfigFile.h" #include "FGPropertyManager.h" +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_INITIALCONDITION; @@ -1021,4 +1023,4 @@ void FGInitialCondition::Debug(int from) } } } - +} diff --git a/src/FDM/JSBSim/FGInitialCondition.h b/src/FDM/JSBSim/FGInitialCondition.h index 753b26dc2..c83838e45 100644 --- a/src/FDM/JSBSim/FGInitialCondition.h +++ b/src/FDM/JSBSim/FGInitialCondition.h @@ -60,6 +60,8 @@ DEFINITIONS #define ID_INITIALCONDITION "$Id$" +namespace JSBSim { + typedef enum { setvt, setvc, setve, setmach, setuvw, setned, setvg } speedset; typedef enum { setwned, setwmd, setwhc } windset; @@ -301,6 +303,6 @@ private: bool solve(double *y, double x); void Debug(int from); }; - +} #endif diff --git a/src/FDM/JSBSim/FGJSBBase.cpp b/src/FDM/JSBSim/FGJSBBase.cpp index a38a4c697..db7c0c348 100644 --- a/src/FDM/JSBSim/FGJSBBase.cpp +++ b/src/FDM/JSBSim/FGJSBBase.cpp @@ -37,6 +37,8 @@ INCLUDES #include "FGJSBBase.h" +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_JSBBASE; @@ -67,7 +69,7 @@ const double FGJSBBase::in3tom3 = 1.638706E-5; const double FGJSBBase::Reng = 1716.0; const double FGJSBBase::SHRatio = 1.40; const string FGJSBBase::needed_cfg_version = "1.60"; -const string FGJSBBase::JSBSim_version = "0.9.2"; +const string FGJSBBase::JSBSim_version = "0.9.4"; queue FGJSBBase::Messages; FGJSBBase::Message FGJSBBase::localMsg; @@ -183,4 +185,5 @@ void FGJSBBase::disableHighLighting(void) { //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +} // namespace JSBSim diff --git a/src/FDM/JSBSim/FGJSBBase.h b/src/FDM/JSBSim/FGJSBBase.h index f203f36e3..80d3e17ea 100644 --- a/src/FDM/JSBSim/FGJSBBase.h +++ b/src/FDM/JSBSim/FGJSBBase.h @@ -105,6 +105,8 @@ CLASS DOCUMENTATION CLASS DECLARATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +namespace JSBSim { + class FGJSBBase { public: /// Constructor for FGJSBBase. @@ -231,7 +233,7 @@ protected: static const string needed_cfg_version; static const string JSBSim_version; }; - +} //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #endif diff --git a/src/FDM/JSBSim/FGLGear.cpp b/src/FDM/JSBSim/FGLGear.cpp index ac73b6ee5..b717df1c1 100644 --- a/src/FDM/JSBSim/FGLGear.cpp +++ b/src/FDM/JSBSim/FGLGear.cpp @@ -41,6 +41,8 @@ INCLUDES #include "FGLGear.h" #include +namespace JSBSim { + /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ @@ -49,7 +51,6 @@ DEFINITIONS GLOBAL DATA %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ - static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_LGEAR; @@ -107,8 +108,9 @@ FGLGear::FGLGear(FGConfigFile* AC_cfg, FGFDMExec* fdmex) : Exec(fdmex) WOW = lastWOW = true; // should the value be initialized to true? ReportEnable = true; FirstContact = false; - Reported = false; - DistanceTraveled = 0.0; + StartedGroundRun = false; + TakeoffReported = LandingReported = false; + LandingDistanceTraveled = TakeoffDistanceTraveled = TakeoffDistanceTraveled50ft = 0.0; MaximumStrutForce = MaximumStrutTravel = 0.0; SinkRate = GroundSpeed = 0.0; @@ -154,7 +156,10 @@ FGLGear::FGLGear(const FGLGear& lgear) lastWOW = lgear.lastWOW; ReportEnable = lgear.ReportEnable; FirstContact = lgear.FirstContact; - DistanceTraveled = lgear.DistanceTraveled; + StartedGroundRun = lgear.StartedGroundRun; + LandingDistanceTraveled = lgear.LandingDistanceTraveled; + TakeoffDistanceTraveled = lgear.TakeoffDistanceTraveled; + TakeoffDistanceTraveled50ft = lgear.TakeoffDistanceTraveled50ft; MaximumStrutForce = lgear.MaximumStrutForce; MaximumStrutTravel = lgear.MaximumStrutTravel; @@ -169,7 +174,8 @@ FGLGear::FGLGear(const FGLGear& lgear) maxCompLen = lgear.maxCompLen; SinkRate = lgear.SinkRate; GroundSpeed = lgear.GroundSpeed; - Reported = lgear.Reported; + LandingReported = lgear.LandingReported; + TakeoffReported = lgear.TakeoffReported; name = lgear.name; sSteerType = lgear.sSteerType; sRetractable = lgear.sRetractable; @@ -197,6 +203,7 @@ FGColumnVector3& FGLGear::Force(void) { double SteerGain = 0; double SinWheel, CosWheel; + double deltaT; vForce.InitMatrix(); vMoment.InitMatrix(); @@ -264,6 +271,19 @@ FGColumnVector3& FGLGear::Force(void) FirstContact = true; SinkRate = compressSpeed; GroundSpeed = Position->GetVel().Magnitude(); + TakeoffReported = false; + } + +// If the takeoff run is starting, initialize. + + if ((Position->GetVel().Magnitude() > 0.1) && + (FCS->GetBrake(bgLeft) == 0) && + (FCS->GetBrake(bgRight) == 0) && + (FCS->GetThrottlePos(0) == 1) && !StartedGroundRun) + { + TakeoffDistanceTraveled = 0; + TakeoffDistanceTraveled50ft = 0; + StartedGroundRun = true; } // The following needs work regarding friction coefficients and braking and @@ -412,20 +432,32 @@ FGColumnVector3& FGLGear::Force(void) if (Position->GetDistanceAGL() > 200.0) { FirstContact = false; - Reported = false; - DistanceTraveled = 0.0; + StartedGroundRun = false; + LandingReported = false; + LandingDistanceTraveled = 0.0; MaximumStrutForce = MaximumStrutTravel = 0.0; } compressLength = 0.0; // reset compressLength to zero for data output validity } - if (FirstContact) { - DistanceTraveled += Position->GetVel().Magnitude()*State->Getdt()*Aircraft->GetRate(); - } + deltaT = State->Getdt()*Aircraft->GetRate(); + + if (FirstContact) LandingDistanceTraveled += Position->GetVground()*deltaT; - if (ReportEnable && Position->GetVel().Magnitude() <= 0.05 && !Reported) { - if (debug_lvl > 0) Report(); + if (StartedGroundRun) { + TakeoffDistanceTraveled50ft += Position->GetVground()*deltaT; + if (WOW) TakeoffDistanceTraveled += Position->GetVground()*deltaT; + } + + if (ReportEnable && Position->GetVground() <= 0.05 && !LandingReported) { + if (debug_lvl > 0) Report(erLand); + } + + if (ReportEnable && !TakeoffReported && + (vLocalGear(eZ) - Position->GetDistanceAGL()) < -50.0) + { + if (debug_lvl > 0) Report(erTakeoff); } if (lastWOW != WOW) { @@ -450,20 +482,32 @@ FGColumnVector3& FGLGear::Force(void) //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -void FGLGear::Report(void) +void FGLGear::Report(ReportType repType) { - cout << endl << "Touchdown report for " << name << endl; - cout << " Sink rate at contact: " << SinkRate << " fps, " - << SinkRate*0.3408 << " mps" << endl; - cout << " Contact ground speed: " << GroundSpeed*.5925 << " knots, " - << GroundSpeed*0.3408 << " mps" << endl; - cout << " Maximum contact force: " << MaximumStrutForce << " lbs, " - << MaximumStrutForce*4.448 << " Newtons" << endl; - cout << " Maximum strut travel: " << MaximumStrutTravel*12.0 << " inches, " - << MaximumStrutTravel*30.48 << " cm" << endl; - cout << " Distance traveled: " << DistanceTraveled << " ft, " - << DistanceTraveled*0.3408 << " meters" << endl; - Reported = true; + switch(repType) { + case erLand: + cout << endl << "Touchdown report for " << name << endl; + cout << " Sink rate at contact: " << SinkRate << " fps, " + << SinkRate*0.3408 << " mps" << endl; + cout << " Contact ground speed: " << GroundSpeed*.5925 << " knots, " + << GroundSpeed*0.3408 << " mps" << endl; + cout << " Maximum contact force: " << MaximumStrutForce << " lbs, " + << MaximumStrutForce*4.448 << " Newtons" << endl; + cout << " Maximum strut travel: " << MaximumStrutTravel*12.0 << " inches, " + << MaximumStrutTravel*30.48 << " cm" << endl; + cout << " Distance traveled: " << LandingDistanceTraveled << " ft, " + << LandingDistanceTraveled*0.3408 << " meters" << endl; + LandingReported = true; + break; + case erTakeoff: + cout << endl << "Takeoff report for " << name << endl; + cout << " Distance traveled: " << TakeoffDistanceTraveled + << " ft, " << TakeoffDistanceTraveled*0.3408 << " meters" << endl; + cout << " Distance traveled (over 50'): " << TakeoffDistanceTraveled50ft + << " ft, " << TakeoffDistanceTraveled50ft*0.3408 << " meters" << endl; + TakeoffReported = true; + break; + } } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -522,3 +566,5 @@ void FGLGear::Debug(int from) } } +} // namespace JSBSim + diff --git a/src/FDM/JSBSim/FGLGear.h b/src/FDM/JSBSim/FGLGear.h index 8bfc6e21a..e849d229e 100644 --- a/src/FDM/JSBSim/FGLGear.h +++ b/src/FDM/JSBSim/FGLGear.h @@ -60,6 +60,8 @@ DEFINITIONS FORWARD DECLARATIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +namespace JSBSim { + class FGAircraft; class FGPosition; class FGRotation; @@ -186,6 +188,8 @@ public: enum BrakeGroup {bgNone=0, bgLeft, bgRight, bgCenter, bgNose, bgTail }; /// Steering group membership enumerators enum SteerType {stSteer, stFixed, stCaster}; + /// Report type enumerators + enum ReportType {erNone=0, erTakeoff, erLand}; /** Constructor @param Executive a pointer to the parent executive object @param File a pointer to the config file instance */ @@ -265,7 +269,9 @@ private: double maxCompLen; double SinkRate; double GroundSpeed; - double DistanceTraveled; + double TakeoffDistanceTraveled; + double TakeoffDistanceTraveled50ft; + double LandingDistanceTraveled; double MaximumStrutForce; double MaximumStrutTravel; double SideWhlVel, RollingWhlVel; @@ -275,7 +281,9 @@ private: bool WOW; bool lastWOW; bool FirstContact; - bool Reported; + bool StartedGroundRun; + bool LandingReported; + bool TakeoffReported; bool ReportEnable; bool isRetractable; bool GearUp, GearDown; @@ -296,10 +304,10 @@ private: FGFCS* FCS; FGMassBalance* MassBalance; - void Report(void); + void Report(ReportType rt); void Debug(int from); }; - +} #include "FGAircraft.h" #include "FGPosition.h" #include "FGRotation.h" diff --git a/src/FDM/JSBSim/FGMassBalance.cpp b/src/FDM/JSBSim/FGMassBalance.cpp index 5df0f3c18..ab9b725d4 100644 --- a/src/FDM/JSBSim/FGMassBalance.cpp +++ b/src/FDM/JSBSim/FGMassBalance.cpp @@ -41,6 +41,8 @@ INCLUDES #include "FGMassBalance.h" #include "FGPropertyManager.h" +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_MASSBALANCE; @@ -290,4 +292,4 @@ void FGMassBalance::Debug(int from) } } } - +} diff --git a/src/FDM/JSBSim/FGMassBalance.h b/src/FDM/JSBSim/FGMassBalance.h index dbdbf1c95..7abd55466 100644 --- a/src/FDM/JSBSim/FGMassBalance.h +++ b/src/FDM/JSBSim/FGMassBalance.h @@ -52,6 +52,8 @@ INCLUDES CLASS DECLARATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +namespace JSBSim { + class FGMassBalance : public FGModel { @@ -113,6 +115,6 @@ private: FGColumnVector3 PointMassCG; void Debug(int from); }; - +} //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #endif diff --git a/src/FDM/JSBSim/FGMatrix33.cpp b/src/FDM/JSBSim/FGMatrix33.cpp index 830e99ddd..65e046e48 100644 --- a/src/FDM/JSBSim/FGMatrix33.cpp +++ b/src/FDM/JSBSim/FGMatrix33.cpp @@ -21,6 +21,8 @@ INCLUDES #include "FGMatrix33.h" #include "FGColumnVector3.h" +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_MATRIX33; @@ -440,4 +442,4 @@ void FGMatrix33::Debug(int from) } } } - +} diff --git a/src/FDM/JSBSim/FGMatrix33.h b/src/FDM/JSBSim/FGMatrix33.h index 74328fa0c..e43e4f0c6 100644 --- a/src/FDM/JSBSim/FGMatrix33.h +++ b/src/FDM/JSBSim/FGMatrix33.h @@ -65,6 +65,8 @@ DEFINITIONS FORWARD DECLARATIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +namespace JSBSim { + class FGColumnVector3; /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -128,5 +130,5 @@ private: unsigned int rowCtr, colCtr; void Debug(int from); }; - +} #endif diff --git a/src/FDM/JSBSim/FGModel.cpp b/src/FDM/JSBSim/FGModel.cpp index 6520196e6..dcad25c17 100644 --- a/src/FDM/JSBSim/FGModel.cpp +++ b/src/FDM/JSBSim/FGModel.cpp @@ -55,6 +55,8 @@ INCLUDES #include "FGAuxiliary.h" #include "FGOutput.h" +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_MODEL; @@ -199,4 +201,4 @@ void FGModel::Debug(int from) } } } - +} diff --git a/src/FDM/JSBSim/FGModel.h b/src/FDM/JSBSim/FGModel.h index 740f4521b..6cd7a8295 100644 --- a/src/FDM/JSBSim/FGModel.h +++ b/src/FDM/JSBSim/FGModel.h @@ -70,6 +70,8 @@ using namespace std; FORWARD DECLARATIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +namespace JSBSim { + class FGFDMExec; class FGState; class FGAtmosphere; @@ -157,7 +159,7 @@ protected: FGOutput* Output; FGPropertyManager* PropertyManager; }; - +} //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #endif diff --git a/src/FDM/JSBSim/FGNozzle.cpp b/src/FDM/JSBSim/FGNozzle.cpp index b73401838..d46a622b7 100644 --- a/src/FDM/JSBSim/FGNozzle.cpp +++ b/src/FDM/JSBSim/FGNozzle.cpp @@ -44,6 +44,8 @@ INCLUDES #include "FGNozzle.h" +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_NOZZLE; @@ -149,4 +151,4 @@ void FGNozzle::Debug(int from) } } } - +} diff --git a/src/FDM/JSBSim/FGNozzle.h b/src/FDM/JSBSim/FGNozzle.h index 08906083c..1c9ab8027 100644 --- a/src/FDM/JSBSim/FGNozzle.h +++ b/src/FDM/JSBSim/FGNozzle.h @@ -69,6 +69,8 @@ CLASS DOCUMENTATION CLASS DECLARATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +namespace JSBSim { + class FGNozzle : public FGThruster { public: @@ -89,7 +91,7 @@ private: double Area2; void Debug(int from); }; - +} //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #endif diff --git a/src/FDM/JSBSim/FGOutput.cpp b/src/FDM/JSBSim/FGOutput.cpp index b3b385808..f35662a6c 100644 --- a/src/FDM/JSBSim/FGOutput.cpp +++ b/src/FDM/JSBSim/FGOutput.cpp @@ -52,6 +52,8 @@ INCLUDES #include "FGPosition.h" #include "FGAuxiliary.h" +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_OUTPUT; @@ -557,4 +559,4 @@ void FGOutput::Debug(int from) } } } - +} diff --git a/src/FDM/JSBSim/FGOutput.h b/src/FDM/JSBSim/FGOutput.h index 0d8f5fe3e..37bf06c4c 100644 --- a/src/FDM/JSBSim/FGOutput.h +++ b/src/FDM/JSBSim/FGOutput.h @@ -62,6 +62,8 @@ INCLUDES CLASS DECLARATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +namespace JSBSim { + class FGOutput : public FGModel { public: @@ -107,7 +109,7 @@ private: FGfdmSocket* socket; void Debug(int from); }; - +} //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #endif diff --git a/src/FDM/JSBSim/FGPiston.cpp b/src/FDM/JSBSim/FGPiston.cpp index 3b224cf3c..dbbc88588 100644 --- a/src/FDM/JSBSim/FGPiston.cpp +++ b/src/FDM/JSBSim/FGPiston.cpp @@ -42,6 +42,8 @@ INCLUDES #include "FGPiston.h" #include "FGPropulsion.h" +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_PISTON; @@ -569,3 +571,5 @@ FGPiston::CalcFuelNeed(void) { return FuelFlow_gph / 3600 * 6 * State->Getdt() * Propulsion->GetRate(); } + +} // namespace JSBSim diff --git a/src/FDM/JSBSim/FGPiston.h b/src/FDM/JSBSim/FGPiston.h index 909ed1920..3f0d67b6d 100644 --- a/src/FDM/JSBSim/FGPiston.h +++ b/src/FDM/JSBSim/FGPiston.h @@ -80,6 +80,8 @@ DOCUMENTATION CLASS DECLARATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +namespace JSBSim { + class FGPiston : public FGEngine { public: @@ -162,6 +164,6 @@ private: void Debug(int from); }; - +} //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #endif diff --git a/src/FDM/JSBSim/FGPosition.cpp b/src/FDM/JSBSim/FGPosition.cpp index 74cd727bb..b13c11010 100644 --- a/src/FDM/JSBSim/FGPosition.cpp +++ b/src/FDM/JSBSim/FGPosition.cpp @@ -86,6 +86,8 @@ INCLUDES #include "FGPropertyManager.h" +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_POSITION; @@ -348,4 +350,4 @@ void FGPosition::Debug(int from) } } } - +} diff --git a/src/FDM/JSBSim/FGPosition.h b/src/FDM/JSBSim/FGPosition.h index 358d5a0a0..b1f5fde91 100644 --- a/src/FDM/JSBSim/FGPosition.h +++ b/src/FDM/JSBSim/FGPosition.h @@ -74,6 +74,8 @@ DOCUMENTATION CLASS DECLARATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +namespace JSBSim { + class FGPosition : public FGModel { public: /** Constructor @@ -148,7 +150,7 @@ private: void GetState(void); void Debug(int from); }; - +} //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #endif diff --git a/src/FDM/JSBSim/FGPropeller.cpp b/src/FDM/JSBSim/FGPropeller.cpp index 1bd9118ef..6dff5c587 100644 --- a/src/FDM/JSBSim/FGPropeller.cpp +++ b/src/FDM/JSBSim/FGPropeller.cpp @@ -38,6 +38,8 @@ INCLUDES #include "FGPropeller.h" #include "FGFCS.h" +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_PROPELLER; @@ -293,4 +295,4 @@ void FGPropeller::Debug(int from) } } } - +} diff --git a/src/FDM/JSBSim/FGPropeller.h b/src/FDM/JSBSim/FGPropeller.h index f6ed849af..071cefb0e 100644 --- a/src/FDM/JSBSim/FGPropeller.h +++ b/src/FDM/JSBSim/FGPropeller.h @@ -91,6 +91,8 @@ CLASS DOCUMENTATION CLASS DECLARATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +namespace JSBSim { + class FGPropeller : public FGThruster { public: @@ -178,7 +180,7 @@ private: FGTable *cPower; void Debug(int from); }; - +} //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #endif diff --git a/src/FDM/JSBSim/FGPropertyManager.cpp b/src/FDM/JSBSim/FGPropertyManager.cpp index bd778f940..d0f810ab8 100644 --- a/src/FDM/JSBSim/FGPropertyManager.cpp +++ b/src/FDM/JSBSim/FGPropertyManager.cpp @@ -47,6 +47,8 @@ COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */ +namespace JSBSim { + //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% string FGPropertyManager::mkPropertyName(string name, bool lowercase) { @@ -312,3 +314,5 @@ void FGPropertyManager::Tie (const string &name, double *pointer, cout << "Failed to tie property " << name << " to a pointer" << endl; } + +} // namespace JSBSim diff --git a/src/FDM/JSBSim/FGPropertyManager.h b/src/FDM/JSBSim/FGPropertyManager.h index aefa5cb58..57e090daf 100644 --- a/src/FDM/JSBSim/FGPropertyManager.h +++ b/src/FDM/JSBSim/FGPropertyManager.h @@ -70,6 +70,8 @@ CLASS DOCUMENTATION CLASS DECLARATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +namespace JSBSim { + class FGPropertyManager : public SGPropertyNode { public: /// Constructor @@ -608,6 +610,6 @@ class FGPropertyManager : public SGPropertyNode { "Failed to tie property " << name << " to indexed object methods" << endl; } }; - +} #endif // FGPROPERTYMANAGER_H diff --git a/src/FDM/JSBSim/FGPropulsion.cpp b/src/FDM/JSBSim/FGPropulsion.cpp index 3ee7b2058..f40972fa2 100644 --- a/src/FDM/JSBSim/FGPropulsion.cpp +++ b/src/FDM/JSBSim/FGPropulsion.cpp @@ -55,12 +55,6 @@ INCLUDES #include "FGPropulsion.h" #include "FGPropertyManager.h" - -static const char *IdSrc = "$Id$"; -static const char *IdHdr = ID_PROPULSION; - -extern short debug_lvl; - #if defined (__APPLE__) /* Not all systems have the gcvt function */ inline char* gcvt (double value, int ndigits, char *buf) { @@ -70,6 +64,13 @@ inline char* gcvt (double value, int ndigits, char *buf) { } #endif +namespace JSBSim { + +static const char *IdSrc = "$Id$"; +static const char *IdHdr = ID_PROPULSION; + +extern short debug_lvl; + /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION @@ -702,4 +703,4 @@ void FGPropulsion::Debug(int from) } } } - +} diff --git a/src/FDM/JSBSim/FGPropulsion.h b/src/FDM/JSBSim/FGPropulsion.h index 56eecf4c3..2e8e803a7 100644 --- a/src/FDM/JSBSim/FGPropulsion.h +++ b/src/FDM/JSBSim/FGPropulsion.h @@ -98,6 +98,8 @@ CLASS DOCUMENTATION CLASS DECLARATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +namespace JSBSim { + class FGPropulsion : public FGModel { public: @@ -216,7 +218,7 @@ private: FGColumnVector3 vXYZtank; void Debug(int from); }; - +} //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #endif diff --git a/src/FDM/JSBSim/FGRocket.cpp b/src/FDM/JSBSim/FGRocket.cpp index ec1bb7215..b786bc4ed 100644 --- a/src/FDM/JSBSim/FGRocket.cpp +++ b/src/FDM/JSBSim/FGRocket.cpp @@ -40,6 +40,8 @@ INCLUDES #include "FGRocket.h" +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_ROCKET; @@ -160,4 +162,4 @@ void FGRocket::Debug(int from) } } } - +} diff --git a/src/FDM/JSBSim/FGRocket.h b/src/FDM/JSBSim/FGRocket.h index 58142fb49..0635b8fb8 100644 --- a/src/FDM/JSBSim/FGRocket.h +++ b/src/FDM/JSBSim/FGRocket.h @@ -104,6 +104,8 @@ CLASS DOCUMENTATION CLASS DECLARATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +namespace JSBSim { + class FGRocket : public FGEngine { public: @@ -135,7 +137,7 @@ private: double PC; void Debug(int from); }; - +} //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #endif diff --git a/src/FDM/JSBSim/FGRotation.cpp b/src/FDM/JSBSim/FGRotation.cpp index 88eeea4d9..77a4ea5ce 100644 --- a/src/FDM/JSBSim/FGRotation.cpp +++ b/src/FDM/JSBSim/FGRotation.cpp @@ -69,6 +69,8 @@ INCLUDES #include "FGPropertyManager.h" +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_ROTATION; @@ -279,4 +281,4 @@ void FGRotation::Debug(int from) } } } - +} diff --git a/src/FDM/JSBSim/FGRotation.h b/src/FDM/JSBSim/FGRotation.h index 5122535fc..db6538aaa 100644 --- a/src/FDM/JSBSim/FGRotation.h +++ b/src/FDM/JSBSim/FGRotation.h @@ -78,6 +78,8 @@ INCLUDES CLASS DECLARATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +namespace JSBSim { + class FGRotation : public FGModel { public: @@ -141,7 +143,7 @@ private: void Debug(int from); }; - +} //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #endif diff --git a/src/FDM/JSBSim/FGRotor.cpp b/src/FDM/JSBSim/FGRotor.cpp index 3d0c7f3e0..71436a97c 100644 --- a/src/FDM/JSBSim/FGRotor.cpp +++ b/src/FDM/JSBSim/FGRotor.cpp @@ -37,6 +37,8 @@ INCLUDES #include "FGRotor.h" +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_ROTOR; @@ -109,4 +111,4 @@ void FGRotor::Debug(int from) } } } - +} diff --git a/src/FDM/JSBSim/FGRotor.h b/src/FDM/JSBSim/FGRotor.h index dde526de5..624eb63c3 100644 --- a/src/FDM/JSBSim/FGRotor.h +++ b/src/FDM/JSBSim/FGRotor.h @@ -50,6 +50,8 @@ INCLUDES CLASS DECLARATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +namespace JSBSim { + class FGRotor : public FGThruster { public: @@ -61,6 +63,6 @@ public: private: void Debug(int from); }; - +} //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #endif diff --git a/src/FDM/JSBSim/FGScript.cpp b/src/FDM/JSBSim/FGScript.cpp index f17221325..aa85b427f 100644 --- a/src/FDM/JSBSim/FGScript.cpp +++ b/src/FDM/JSBSim/FGScript.cpp @@ -57,6 +57,8 @@ INCLUDES #include "FGScript.h" #include "FGConfigFile.h" +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_FGSCRIPT; @@ -415,4 +417,4 @@ void FGScript::Debug(int from) } } } - +} diff --git a/src/FDM/JSBSim/FGScript.h b/src/FDM/JSBSim/FGScript.h index b188d6855..269a96f0d 100644 --- a/src/FDM/JSBSim/FGScript.h +++ b/src/FDM/JSBSim/FGScript.h @@ -133,6 +133,8 @@ CLASS DOCUMENTATION CLASS DECLARATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +namespace JSBSim { + class FGScript : public FGJSBBase { public: @@ -198,7 +200,7 @@ private: FGPropertyManager* PropertyManager; void Debug(int from); }; - +} //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #endif diff --git a/src/FDM/JSBSim/FGState.cpp b/src/FDM/JSBSim/FGState.cpp index 6ce19c407..9adba93f2 100644 --- a/src/FDM/JSBSim/FGState.cpp +++ b/src/FDM/JSBSim/FGState.cpp @@ -53,6 +53,8 @@ INCLUDES #include "FGState.h" +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_STATE; @@ -477,4 +479,4 @@ void FGState::Debug(int from) } } } - +} diff --git a/src/FDM/JSBSim/FGState.h b/src/FDM/JSBSim/FGState.h index 3eaf0f2b2..ffab08c73 100644 --- a/src/FDM/JSBSim/FGState.h +++ b/src/FDM/JSBSim/FGState.h @@ -108,6 +108,8 @@ CLASS DOCUMENTATION CLASS DECLARATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +namespace JSBSim { + class FGState : public FGJSBBase { public: @@ -362,7 +364,7 @@ private: void Debug(int from); }; - +} //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/src/FDM/JSBSim/FGTable.cpp b/src/FDM/JSBSim/FGTable.cpp index 248ca8ebd..531c1222d 100644 --- a/src/FDM/JSBSim/FGTable.cpp +++ b/src/FDM/JSBSim/FGTable.cpp @@ -44,6 +44,10 @@ INCLUDES #include #endif +using namespace std; + +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_TABLE; @@ -51,7 +55,6 @@ static const char *IdHdr = ID_TABLE; CLASS IMPLEMENTATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -using namespace std; FGTable::FGTable(int NRows, int NCols) : nRows(NRows), nCols(NCols) { @@ -313,6 +316,4 @@ void FGTable::Debug(int from) } } } - - - +} diff --git a/src/FDM/JSBSim/FGTable.h b/src/FDM/JSBSim/FGTable.h index cdee7d186..483e945b5 100644 --- a/src/FDM/JSBSim/FGTable.h +++ b/src/FDM/JSBSim/FGTable.h @@ -76,6 +76,8 @@ CLASS DECLARATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +namespace JSBSim { + class FGTable : public FGJSBBase { public: @@ -111,7 +113,7 @@ private: double** Allocate(void); void Debug(int from); }; - +} //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #endif diff --git a/src/FDM/JSBSim/FGTank.cpp b/src/FDM/JSBSim/FGTank.cpp index 9f77de5a1..664b6b4ce 100644 --- a/src/FDM/JSBSim/FGTank.cpp +++ b/src/FDM/JSBSim/FGTank.cpp @@ -38,6 +38,14 @@ INCLUDES #include "FGTank.h" +#if !defined ( sgi ) || defined( __GNUC__ ) +using std::cerr; +using std::endl; +using std::cout; +#endif + +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_TANK; @@ -45,12 +53,6 @@ static const char *IdHdr = ID_TANK; CLASS IMPLEMENTATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -#if !defined ( sgi ) || defined( __GNUC__ ) -using std::cerr; -using std::endl; -using std::cout; -#endif - FGTank::FGTank(FGConfigFile* AC_cfg) { string token; @@ -156,4 +158,4 @@ void FGTank::Debug(int from) } } } - +} diff --git a/src/FDM/JSBSim/FGTank.h b/src/FDM/JSBSim/FGTank.h index e689112da..944e0968c 100644 --- a/src/FDM/JSBSim/FGTank.h +++ b/src/FDM/JSBSim/FGTank.h @@ -74,6 +74,8 @@ DEFINES CLASS DECLARATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +namespace JSBSim { + class FGTank : public FGJSBBase { public: @@ -104,7 +106,7 @@ private: bool Selected; void Debug(int from); }; - +} //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #endif diff --git a/src/FDM/JSBSim/FGThruster.cpp b/src/FDM/JSBSim/FGThruster.cpp index f1330f967..adddcbc56 100644 --- a/src/FDM/JSBSim/FGThruster.cpp +++ b/src/FDM/JSBSim/FGThruster.cpp @@ -37,6 +37,8 @@ INCLUDES #include "FGThruster.h" +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_THRUSTER; @@ -115,4 +117,4 @@ void FGThruster::Debug(int from) } } } - +} diff --git a/src/FDM/JSBSim/FGThruster.h b/src/FDM/JSBSim/FGThruster.h index cba795d41..1d99d475d 100644 --- a/src/FDM/JSBSim/FGThruster.h +++ b/src/FDM/JSBSim/FGThruster.h @@ -64,6 +64,8 @@ CLASS DOCUMENTATION CLASS DECLARATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +namespace JSBSim { + class FGThruster : public FGForce { public: @@ -96,7 +98,7 @@ protected: double deltaT; virtual void Debug(int from); }; - +} //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #endif diff --git a/src/FDM/JSBSim/FGTranslation.cpp b/src/FDM/JSBSim/FGTranslation.cpp index 8f19d5193..7b415b6bb 100644 --- a/src/FDM/JSBSim/FGTranslation.cpp +++ b/src/FDM/JSBSim/FGTranslation.cpp @@ -70,6 +70,8 @@ INCLUDES #include "FGOutput.h" #include "FGPropertyManager.h" +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_TRANSLATION; @@ -322,4 +324,4 @@ void FGTranslation::Debug(int from) } } } - +} diff --git a/src/FDM/JSBSim/FGTranslation.h b/src/FDM/JSBSim/FGTranslation.h index 8a17e9581..814857e67 100644 --- a/src/FDM/JSBSim/FGTranslation.h +++ b/src/FDM/JSBSim/FGTranslation.h @@ -82,40 +82,100 @@ INCLUDES CLASS DECLARATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +namespace JSBSim { + class FGTranslation : public FGModel { public: FGTranslation(FGFDMExec*); ~FGTranslation(); + /** Bound Properties + GetUVW(1): velocities/u-fps + GetUVW(2): velocities/v-fps + GetUVW(3): velocities/w-fps + */ inline double GetUVW (int idx) const { return vUVW(idx); } inline FGColumnVector3& GetUVW (void) { return vUVW; } inline FGColumnVector3& GetUVWdot(void) { return vUVWdot; } + /** Bound Properties + GetUVWdot(1): accelerations/udot-fps + GetUVWdot(2): accelerations/vdot-fps + GetUVWdot(3): accelerations/wdot-fps + */ inline double GetUVWdot(int idx) const { return vUVWdot(idx); } inline FGColumnVector3& GetAeroUVW (void) { return vAeroUVW; } + /** Bound Properties + GetAeroUVW(1): velocities/u-aero-fps + GetAeroUVW(2): velocities/v-aero-fps + GetAeroUVW(3): velocities/w-aero-fps + */ inline double GetAeroUVW (int idx) const { return vAeroUVW(idx); } + /** Bound Property: aero/alpha-rad + */ double Getalpha(void) const { return alpha; } + /** Bound Property: aero/beta-rad + */ double Getbeta (void) const { return beta; } + /** Bound Property: aero/mag-beta-rad + */ inline double GetMagBeta(void) const { return fabs(beta); } + /** Bound Property: aero/qbar-psf + */ double Getqbar (void) const { return qbar; } + /** Bound Property: aero/qbarUW-psf + */ double GetqbarUW (void) const { return qbarUW; } + /** Bound Property: aero/qbarUV-psf + */ double GetqbarUV (void) const { return qbarUV; } + /** Bound Property: velocities/vt-fps + */ inline double GetVt (void) const { return Vt; } + /** Bound Property: velocities/mach-norm + */ double GetMach (void) const { return Mach; } + /** Bound Property: aero/alphadot-rad_sec + */ double Getadot (void) const { return adot; } + /** Bound Property: aero/betadot-rad_sec + */ double Getbdot (void) const { return bdot; } + /** Bound Properties + SetUVW(1): velocities/u-fps + SetUVW(2): velocities/v-fps + SetUVW(3): velocities/w-fps + */ void SetUVW(FGColumnVector3 tt) { vUVW = tt; } void SetAeroUVW(FGColumnVector3 tt) { vAeroUVW = tt; } + /** Bound Property: aero/alpha-rad + */ inline void Setalpha(double tt) { alpha = tt; } + /** Bound Property: aero/beta-rad + */ inline void Setbeta (double tt) { beta = tt; } + /** Bound Property: aero/qbar-psf + */ inline void Setqbar (double tt) { qbar = tt; } + /** Bound Property: aero/qbarUW-psf + */ inline void SetqbarUW (double tt) { qbarUW = tt; } + /** Bound Property: aero/qbarUV-psf + */ inline void SetqbarUV (double tt) { qbarUV = tt; } + /** Bound Property: velocities/vt-fps + */ inline void SetVt (double tt) { Vt = tt; } + /** Bound Property: velocities/mach-norm + */ inline void SetMach (double tt) { Mach=tt; } + /** Bound Property: aero/alphadot-rad_sec + */ inline void Setadot (double tt) { adot = tt; } + /** Bound Property: aero/betadot-rad_sec + */ inline void Setbdot (double tt) { bdot = tt; } inline void SetAB(double t1, double t2) { alpha=t1; beta=t2; } @@ -139,7 +199,7 @@ private: double adot,bdot; void Debug(int from); }; - +} //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #endif diff --git a/src/FDM/JSBSim/FGTrim.cpp b/src/FDM/JSBSim/FGTrim.cpp index 21dae465d..6f2c1710f 100644 --- a/src/FDM/JSBSim/FGTrim.cpp +++ b/src/FDM/JSBSim/FGTrim.cpp @@ -58,6 +58,8 @@ INCLUDES #pragma warning (disable : 4786 4788) #endif +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_TRIM; @@ -665,4 +667,4 @@ void FGTrim::SetMode(TrimMode tt) { current_axis=0; } //YOU WERE WARNED, BUT YOU DID IT ANYWAY. - +} diff --git a/src/FDM/JSBSim/FGTrim.h b/src/FDM/JSBSim/FGTrim.h index 4a75f5905..1276c5851 100644 --- a/src/FDM/JSBSim/FGTrim.h +++ b/src/FDM/JSBSim/FGTrim.h @@ -62,14 +62,16 @@ DEFINITIONS #define ID_TRIM "$Id$" -typedef enum { tLongitudinal, tFull, tGround, tPullup, - tCustom, tNone, tTurn - } TrimMode; - #if defined(_WIN32) && !defined(__CYGWIN__) #define snprintf _snprintf #endif +namespace JSBSim { + +typedef enum { tLongitudinal, tFull, tGround, tPullup, + tCustom, tNone, tTurn + } TrimMode; + /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FORWARD DECLARATIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ @@ -302,15 +304,6 @@ public: inline double GetTargetNlf(void) { return targetNlf; } }; - +} #endif - - - - - - - - - diff --git a/src/FDM/JSBSim/FGTrimAxis.cpp b/src/FDM/JSBSim/FGTrimAxis.cpp index 485dbd5c2..8a1b024d0 100644 --- a/src/FDM/JSBSim/FGTrimAxis.cpp +++ b/src/FDM/JSBSim/FGTrimAxis.cpp @@ -48,6 +48,8 @@ INCLUDES #include "FGAerodynamics.h" +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_TRIMAXIS; @@ -482,5 +484,4 @@ void FGTrimAxis::Debug(int from) } } } - - +} diff --git a/src/FDM/JSBSim/FGTrimAxis.h b/src/FDM/JSBSim/FGTrimAxis.h index e687a2771..605bca53e 100644 --- a/src/FDM/JSBSim/FGTrimAxis.h +++ b/src/FDM/JSBSim/FGTrimAxis.h @@ -48,6 +48,8 @@ INCLUDES #define DEFAULT_TOLERANCE 0.001 +namespace JSBSim { + const string StateNames[10]= { "all","udot","vdot","wdot","qdot","pdot","rdot", "hmgt","nlf" }; @@ -165,5 +167,5 @@ private: void Debug(int from); }; - +} #endif diff --git a/src/FDM/JSBSim/FGTurbine.cpp b/src/FDM/JSBSim/FGTurbine.cpp index 437e34011..e329f2c21 100644 --- a/src/FDM/JSBSim/FGTurbine.cpp +++ b/src/FDM/JSBSim/FGTurbine.cpp @@ -42,6 +42,8 @@ INCLUDES #include "FGTurbine.h" +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_TURBINE; @@ -251,4 +253,4 @@ void FGTurbine::Debug(int from) } } } - +} diff --git a/src/FDM/JSBSim/FGTurbine.h b/src/FDM/JSBSim/FGTurbine.h index fee3b66ff..bfeca9c1c 100644 --- a/src/FDM/JSBSim/FGTurbine.h +++ b/src/FDM/JSBSim/FGTurbine.h @@ -53,6 +53,8 @@ INCLUDES CLASS DECLARATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +namespace JSBSim { + class FGTurbine : public FGEngine { public: @@ -88,7 +90,7 @@ private: void Debug(int from); }; - +} //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #endif diff --git a/src/FDM/JSBSim/FGUtility.cpp b/src/FDM/JSBSim/FGUtility.cpp index 5ec59baab..c6d0b2018 100644 --- a/src/FDM/JSBSim/FGUtility.cpp +++ b/src/FDM/JSBSim/FGUtility.cpp @@ -61,6 +61,8 @@ INCLUDES #include "FGState.h" #include "FGFDMExec.h" +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_UTILITY; @@ -125,4 +127,4 @@ void FGUtility::Debug(int from) } } } - +} diff --git a/src/FDM/JSBSim/FGUtility.h b/src/FDM/JSBSim/FGUtility.h index 4514c253c..154314d20 100644 --- a/src/FDM/JSBSim/FGUtility.h +++ b/src/FDM/JSBSim/FGUtility.h @@ -50,6 +50,8 @@ DEFINES CLASS DECLARATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +namespace JSBSim { + class FGFDMExec; class FGState; @@ -64,6 +66,6 @@ private: FGFDMExec* FDMExec; void Debug(int from); }; - +} //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #endif diff --git a/src/FDM/JSBSim/FGfdmSocket.cpp b/src/FDM/JSBSim/FGfdmSocket.cpp index 9d86bbab5..d117100da 100644 --- a/src/FDM/JSBSim/FGfdmSocket.cpp +++ b/src/FDM/JSBSim/FGfdmSocket.cpp @@ -39,6 +39,8 @@ INCLUDES #include "FGfdmSocket.h" +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_FDMSOCKET; @@ -204,4 +206,4 @@ void FGfdmSocket::Debug(int from) } } } - +} diff --git a/src/FDM/JSBSim/FGfdmSocket.h b/src/FDM/JSBSim/FGfdmSocket.h index a03e58e9c..ff6ef5562 100644 --- a/src/FDM/JSBSim/FGfdmSocket.h +++ b/src/FDM/JSBSim/FGfdmSocket.h @@ -88,6 +88,8 @@ CLASS DECLARATION using std::string; +namespace JSBSim { + class FGfdmSocket : public FGJSBBase { public: @@ -109,5 +111,5 @@ private: bool connected; void Debug(int from); }; - +} #endif diff --git a/src/FDM/JSBSim/JSBSim.cxx b/src/FDM/JSBSim/JSBSim.cxx index ef7c086de..a114dcc13 100644 --- a/src/FDM/JSBSim/JSBSim.cxx +++ b/src/FDM/JSBSim/JSBSim.cxx @@ -796,3 +796,4 @@ void FGJSBsim::update_ic(void) { fgic->SetClimbRateFpsIC( get_Climb_Rate() ); } } + diff --git a/src/FDM/JSBSim/JSBSim.hxx b/src/FDM/JSBSim/JSBSim.hxx index dbb294bda..cdbc3c768 100644 --- a/src/FDM/JSBSim/JSBSim.hxx +++ b/src/FDM/JSBSim/JSBSim.hxx @@ -57,6 +57,7 @@ FORWARD DECLARATIONS #include +namespace JSBSim { class FGState; class FGAtmosphere; class FGFCS; @@ -71,6 +72,9 @@ class FGPosition; class FGAuxiliary; class FGOutput; class FGInitialCondition; +} + +using namespace JSBSim; /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs] diff --git a/src/FDM/JSBSim/Makefile.am b/src/FDM/JSBSim/Makefile.am index 9c337da37..d8e245fc3 100644 --- a/src/FDM/JSBSim/Makefile.am +++ b/src/FDM/JSBSim/Makefile.am @@ -41,9 +41,7 @@ libJSBSim_a_SOURCES = \ FGTranslation.cpp FGTranslation.h \ FGTrim.cpp FGTrim.h \ FGTrimAxis.cpp FGTrimAxis.h \ - FGTurboJet.cpp FGTurboJet.h \ - FGTurboProp.cpp FGTurboProp.h \ - FGTurboShaft.cpp FGTurboShaft.h \ + FGTurbine.cpp FGTurbine.h \ FGUtility.cpp FGUtility.h \ FGEngine.cpp FGEngine.h \ FGTank.cpp FGTank.h \ diff --git a/src/FDM/JSBSim/filtersjb/FGDeadBand.cpp b/src/FDM/JSBSim/filtersjb/FGDeadBand.cpp index 00d99177f..e9e6d3383 100644 --- a/src/FDM/JSBSim/filtersjb/FGDeadBand.cpp +++ b/src/FDM/JSBSim/filtersjb/FGDeadBand.cpp @@ -39,6 +39,8 @@ INCLUDES #include "FGDeadBand.h" +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_DEADBAND; @@ -56,14 +58,30 @@ FGDeadBand::FGDeadBand(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs), AC_cfg->GetNextConfigLine(); string token; + clipmax = clipmin = 0.0; + clip = false; + gain = 1.0; + width = 0.0; + while ((token = AC_cfg->GetValue()) != string("/COMPONENT")) { *AC_cfg >> token; - if (token == "ID") { - *AC_cfg >> ID; - } else if (token == "INPUT") { - *AC_cfg >> InputIdx; - } else { + if (token == "INPUT") { + if (InputNodes.size() > 0) { + cerr << "Deadband can only accept one input" << endl; + } else { + *AC_cfg >> token; + InputNodes.push_back(resolveSymbol(token)); + } + } else if (token == "WIDTH") { + *AC_cfg >> width; + } else if (token == "CLIPTO") { + *AC_cfg >> clipmin >> clipmax; + if (clipmax > clipmin) clip = true; + } else if (token == "GAIN") { + *AC_cfg >> gain; + } else if (token == "OUTPUT") { *AC_cfg >> token; + OutputNode = PropertyManager->GetNode(token); } } FGFCSComponent::bind(); @@ -83,6 +101,23 @@ bool FGDeadBand::Run(void ) { FGFCSComponent::Run(); // call the base class for initialization of Input + Input = InputNodes[0]->getDoubleValue(); + + if (Input < -width/2.0) { + Output = (Input + width/2.0)*gain; + } else if (Input > width/2.0) { + Output = (Input - width/2.0)*gain; + } else { + Output = 0.0; + } + + if (clip) { + if (Output > clipmax) Output = clipmax; + else if (Output < clipmin) Output = clipmin; + } + + if (IsOutput) SetOutput(); + return true; } @@ -111,7 +146,12 @@ void FGDeadBand::Debug(int from) if (debug_lvl & 1) { // Standard console startup message output if (from == 0) { // Constructor - + cout << " INPUT: " << InputNodes[0]->getName() << endl; + cout << " DEADBAND WIDTH: " << width << endl; + cout << " GAIN: " << gain << endl; + if (clip) cout << " CLIPTO: " << clipmin + << ", " << clipmax << endl; + if (IsOutput) cout << " OUTPUT: " << OutputNode->getName() << endl; } } if (debug_lvl & 2 ) { // Instantiation/Destruction notification @@ -131,4 +171,4 @@ void FGDeadBand::Debug(int from) } } } - +} diff --git a/src/FDM/JSBSim/filtersjb/FGDeadBand.h b/src/FDM/JSBSim/filtersjb/FGDeadBand.h index a20f4b152..1f30e4dc0 100644 --- a/src/FDM/JSBSim/filtersjb/FGDeadBand.h +++ b/src/FDM/JSBSim/filtersjb/FGDeadBand.h @@ -50,6 +50,8 @@ DEFINITIONS FORWARD DECLARATIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +namespace JSBSim { + class FGFCS; /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -62,6 +64,16 @@ CLASS DOCUMENTATION /** Models a deadband object. Owned and Operated by the FGFCS class. + + + INPUT {input} + WIDTH {deadband width} + GAIN {optional deadband gain} + MIN {minimum value} + MAX {maximum value} + OUTPUT {optional output parameter to set} + + @author Jon S. Berndt @see - */ @@ -80,10 +92,14 @@ public: private: FGConfigFile* AC_cfg; + double width; + double clipmax, clipmin; + bool clip; + double gain; void Debug(int from); }; - +} //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #endif diff --git a/src/FDM/JSBSim/filtersjb/FGFCSComponent.cpp b/src/FDM/JSBSim/filtersjb/FGFCSComponent.cpp index 14608d121..de20fad4e 100644 --- a/src/FDM/JSBSim/filtersjb/FGFCSComponent.cpp +++ b/src/FDM/JSBSim/filtersjb/FGFCSComponent.cpp @@ -39,6 +39,8 @@ INCLUDES #include "FGFCSComponent.h" +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_FCSCOMPONENT; @@ -49,7 +51,6 @@ CLASS IMPLEMENTATION FGFCSComponent::FGFCSComponent(FGFCS* _fcs) : fcs(_fcs) { Type = ""; - ID = 0; Input = 0.0; Output = 0.0; OutputNode = 0; @@ -82,14 +83,14 @@ bool FGFCSComponent::Run(void) //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -FGPropertyManager* FGFCSComponent::resolveSymbol(string token) { +FGPropertyManager* FGFCSComponent::resolveSymbol(string token) +{ string prop; - FGPropertyManager* tmp=PropertyManager->GetNode(token,false); - if( !tmp ){ - if( token.find("/") == token.npos ) - prop = "model/" + token; + FGPropertyManager* tmp = PropertyManager->GetNode(token,false); + if (!tmp) { + if (token.find("/") == token.npos) prop = "model/" + token; cerr << "Creating new property " << prop << endl; - tmp=PropertyManager->GetNode(token,true); + tmp = PropertyManager->GetNode(token,true); } return tmp; } @@ -97,7 +98,8 @@ FGPropertyManager* FGFCSComponent::resolveSymbol(string token) { //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -void FGFCSComponent::bind(void) { +void FGFCSComponent::bind(void) +{ string tmp = "fcs/" + PropertyManager->mkPropertyName(Name, true); FGPropertyManager *tmpn; PropertyManager->Tie( tmp,this, &FGFCSComponent::GetOutput); @@ -154,4 +156,4 @@ void FGFCSComponent::Debug(int from) } } } - +} diff --git a/src/FDM/JSBSim/filtersjb/FGFCSComponent.h b/src/FDM/JSBSim/filtersjb/FGFCSComponent.h index 2e7f8e858..688eb63d6 100644 --- a/src/FDM/JSBSim/filtersjb/FGFCSComponent.h +++ b/src/FDM/JSBSim/filtersjb/FGFCSComponent.h @@ -59,6 +59,8 @@ using std::string; FORWARD DECLARATIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +namespace JSBSim { + class FGFCS; /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -119,16 +121,14 @@ protected: FGPropertyManager* treenode; string Type; string Name; - int ID; - vector InputNodes; - int InputIdx; + vector InputNodes; double Input; FGPropertyManager* OutputNode; double Output; bool IsOutput; virtual void Debug(int from); }; - +} #include "../FGFCS.h" #endif diff --git a/src/FDM/JSBSim/filtersjb/FGFilter.cpp b/src/FDM/JSBSim/filtersjb/FGFilter.cpp index 15a685faa..3dc26999d 100644 --- a/src/FDM/JSBSim/filtersjb/FGFilter.cpp +++ b/src/FDM/JSBSim/filtersjb/FGFilter.cpp @@ -39,6 +39,8 @@ INCLUDES #include "FGFilter.h" +namespace JSBSim { + static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_FILTER; @@ -69,8 +71,7 @@ FGFilter::FGFilter(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs), while ((token = AC_cfg->GetValue()) != string("/COMPONENT")) { *AC_cfg >> token; - if (token == "ID") *AC_cfg >> ID; - else if (token == "C1") *AC_cfg >> C1; + if (token == "C1") *AC_cfg >> C1; else if (token == "C2") *AC_cfg >> C2; else if (token == "C3") *AC_cfg >> C3; else if (token == "C4") *AC_cfg >> C4; @@ -239,4 +240,4 @@ void FGFilter::Debug(int from) } } } - +} diff --git a/src/FDM/JSBSim/filtersjb/FGFilter.h b/src/FDM/JSBSim/filtersjb/FGFilter.h index e7e745e2c..95cdc47a5 100644 --- a/src/FDM/JSBSim/filtersjb/FGFilter.h +++ b/src/FDM/JSBSim/filtersjb/FGFilter.h @@ -69,7 +69,6 @@ CLASS DOCUMENTATION
     
     <COMPONENT NAME="Elevator Filter" TYPE="LAG_FILTER">
-      ID           16
       INPUT        15
       C1           600
       OUTPUT       FG_ELEVATOR_POS
@@ -87,6 +86,8 @@ CLASS DOCUMENTATION
 CLASS DECLARATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
+namespace JSBSim {
+
 class FGFilter  : public FGFCSComponent         
 {
 public:
@@ -121,6 +122,6 @@ private:
   FGConfigFile* AC_cfg;
   void Debug(int from);
 };
-
+}
 #endif
 
diff --git a/src/FDM/JSBSim/filtersjb/FGGain.cpp b/src/FDM/JSBSim/filtersjb/FGGain.cpp
index a98ccb623..1c7117996 100644
--- a/src/FDM/JSBSim/filtersjb/FGGain.cpp
+++ b/src/FDM/JSBSim/filtersjb/FGGain.cpp
@@ -39,6 +39,8 @@ INCLUDES
 
 #include "FGGain.h" 
 
+namespace JSBSim {
+
 static const char *IdSrc = "$Id$";
 static const char *IdHdr = ID_GAIN;
 
@@ -69,11 +71,9 @@ FGGain::FGGain(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
 
   while ((token = AC_cfg->GetValue()) != string("/COMPONENT")) {
     *AC_cfg >> token;
-    if (token == "ID") {
-      *AC_cfg >> ID;
-    } else if (token == "INPUT") {
+    if (token == "INPUT") {
       token = AC_cfg->GetValue("INPUT");
-      if( InputNodes.size() > 0 ) {
+      if (InputNodes.size() > 0) {
         cerr << "Gains can only accept one input" << endl;
       } else  {
         *AC_cfg >> token;
@@ -132,10 +132,10 @@ bool FGGain::Run(void )
     Output = Gain * Input;
   } else if (Type == "SCHEDULED_GAIN") {
     LookupVal = ScheduledBy->getDoubleValue();
-	  SchedGain = Table->GetValue(LookupVal);
+    SchedGain = Table->GetValue(LookupVal);
     Output = Gain * SchedGain * Input;
   } else if (Type == "AEROSURFACE_SCALE") {
-    if(!invert) {
+    if (!invert) {
       OutputPct = Input;
       if (Input >= 0.0) Output = Input * Max;
       else Output = Input * -Min;
@@ -206,4 +206,4 @@ void FGGain::Debug(int from)
     }
   }
 }
-
+}
diff --git a/src/FDM/JSBSim/filtersjb/FGGain.h b/src/FDM/JSBSim/filtersjb/FGGain.h
index 592da07e7..562a1a65c 100644
--- a/src/FDM/JSBSim/filtersjb/FGGain.h
+++ b/src/FDM/JSBSim/filtersjb/FGGain.h
@@ -60,6 +60,8 @@ DEFINES
 
 #define ID_GAIN "$Id$"
 
+namespace JSBSim {
+
 class FGFCS;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -89,5 +91,5 @@ private:
 
   void Debug(int from);
 };
-
+}
 #endif
diff --git a/src/FDM/JSBSim/filtersjb/FGGradient.cpp b/src/FDM/JSBSim/filtersjb/FGGradient.cpp
index c1efab8dd..270ea2746 100644
--- a/src/FDM/JSBSim/filtersjb/FGGradient.cpp
+++ b/src/FDM/JSBSim/filtersjb/FGGradient.cpp
@@ -39,6 +39,8 @@ INCLUDES
 
 #include "FGGradient.h"
 
+namespace JSBSim {
+
 static const char *IdSrc = "$Id$";
 static const char *IdHdr = ID_GRADIENT;
 
@@ -119,4 +121,4 @@ void FGGradient::Debug(int from)
     }
   }
 }
-
+}
diff --git a/src/FDM/JSBSim/filtersjb/FGGradient.h b/src/FDM/JSBSim/filtersjb/FGGradient.h
index dd87aaeb6..fdb2c1025 100644
--- a/src/FDM/JSBSim/filtersjb/FGGradient.h
+++ b/src/FDM/JSBSim/filtersjb/FGGradient.h
@@ -50,6 +50,8 @@ DEFINES
 
 #define ID_GRADIENT "$Id$"
 
+namespace JSBSim {
+
 class FGFCS;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -68,5 +70,5 @@ private:
   FGConfigFile* AC_cfg;
   void Debug(int from);
 };
-
+}
 #endif
diff --git a/src/FDM/JSBSim/filtersjb/FGKinemat.cpp b/src/FDM/JSBSim/filtersjb/FGKinemat.cpp
index 798f42c13..8c29a6577 100644
--- a/src/FDM/JSBSim/filtersjb/FGKinemat.cpp
+++ b/src/FDM/JSBSim/filtersjb/FGKinemat.cpp
@@ -39,6 +39,8 @@ INCLUDES
 
 #include "FGKinemat.h"
 
+namespace JSBSim {
+
 static const char *IdSrc = "$Id$";
 static const char *IdHdr = ID_FLAPS;
 
@@ -65,9 +67,7 @@ FGKinemat::FGKinemat(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
 
   while ((token = AC_cfg->GetValue()) != string("/COMPONENT")) {
     *AC_cfg >> token;
-    if (token == "ID") {
-      *AC_cfg >> ID;
-    } else if (token == "INPUT") {
+    if (token == "INPUT") {
       token = AC_cfg->GetValue("INPUT");
       if( InputNodes.size() > 0 ) {
         cerr << "Kinemat can only accept one input" << endl;
@@ -226,4 +226,4 @@ void FGKinemat::Debug(int from)
     }
   }
 }
-
+}
diff --git a/src/FDM/JSBSim/filtersjb/FGKinemat.h b/src/FDM/JSBSim/filtersjb/FGKinemat.h
index 56f612f46..6437ce368 100644
--- a/src/FDM/JSBSim/filtersjb/FGKinemat.h
+++ b/src/FDM/JSBSim/filtersjb/FGKinemat.h
@@ -66,6 +66,8 @@ DEFINES
 CLASS DECLARATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
+namespace JSBSim {
+
 class FGKinemat  : public FGFCSComponent {
 public:
   FGKinemat(FGFCS* fcs, FGConfigFile* AC_cfg);
@@ -88,5 +90,5 @@ private:
 
   void Debug(int from);
 };
-
+}
 #endif
diff --git a/src/FDM/JSBSim/filtersjb/FGSummer.cpp b/src/FDM/JSBSim/filtersjb/FGSummer.cpp
index 2b367b5a2..b045f7d69 100644
--- a/src/FDM/JSBSim/filtersjb/FGSummer.cpp
+++ b/src/FDM/JSBSim/filtersjb/FGSummer.cpp
@@ -39,6 +39,8 @@ INCLUDES
 
 #include "FGSummer.h"            
 
+namespace JSBSim {
+
 static const char *IdSrc = "$Id$";
 static const char *IdHdr = ID_SUMMER;
 
@@ -63,9 +65,7 @@ FGSummer::FGSummer(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
   while ((token = AC_cfg->GetValue()) != string("/COMPONENT")) {
     *AC_cfg >> token;
 
-    if (token == "ID") {
-      *AC_cfg >> ID;
-    } else if (token == "INPUT") {
+    if (token == "INPUT") {
       token = AC_cfg->GetValue("INPUT");
       *AC_cfg >> token;
       InputNodes.push_back( resolveSymbol(token) );
@@ -169,4 +169,4 @@ void FGSummer::Debug(int from)
     }
   }
 }
-
+}
diff --git a/src/FDM/JSBSim/filtersjb/FGSummer.h b/src/FDM/JSBSim/filtersjb/FGSummer.h
index e8817cb87..b2edfda89 100644
--- a/src/FDM/JSBSim/filtersjb/FGSummer.h
+++ b/src/FDM/JSBSim/filtersjb/FGSummer.h
@@ -85,6 +85,8 @@ CLASS DOCUMENTATION
 CLASS DECLARATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
+namespace JSBSim {
+
 class FGSummer  : public FGFCSComponent
 {
 public:
@@ -105,5 +107,5 @@ private:
   double Bias;
   void Debug(int from);
 };
-
+}
 #endif
diff --git a/src/FDM/JSBSim/filtersjb/FGSwitch.cpp b/src/FDM/JSBSim/filtersjb/FGSwitch.cpp
index c2521bf3a..c4df95dca 100644
--- a/src/FDM/JSBSim/filtersjb/FGSwitch.cpp
+++ b/src/FDM/JSBSim/filtersjb/FGSwitch.cpp
@@ -33,12 +33,35 @@ HISTORY
 COMMENTS, REFERENCES,  and NOTES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
+The SWITCH component is defined as follows (see the API documentation for more
+information):
+
+
+  
+    {property} {conditional} {property|value}
+    
+      {property} {conditional} {property|value}
+      ...
+    
+    ...
+  
+  
+    {property} {conditional} {property|value}
+    ...
+  
+  ...
+
+
+Also, see the header file (FGSwitch.h) for further details.
+
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGSwitch.h"
 
+namespace JSBSim {
+
 static const char *IdSrc = "$Id$";
 static const char *IdHdr = ID_SWITCH;
 
@@ -50,9 +73,55 @@ CLASS IMPLEMENTATION
 FGSwitch::FGSwitch(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
                                                        AC_cfg(AC_cfg)
 {
+  string token, value;
+  struct test *current_test;
+  struct FGCondition *current_condition;
+
   Type = AC_cfg->GetValue("TYPE");
   Name = AC_cfg->GetValue("NAME");
 
+  AC_cfg->GetNextConfigLine();
+  while ((token = AC_cfg->GetValue()) != string("/COMPONENT")) {
+
+    // See the above documentation, or the API docs, for information on what
+    // the SWITCH component is supposed to look like in the configuration file.
+    // Below, the switch component is read in.
+
+    if (token == "TEST") {
+      tests.push_back(*(new test));
+      current_test = &tests.back();
+
+      if (AC_cfg->GetValue("LOGIC") == "OR") {
+        current_test->Logic = eOR;
+      } else if (AC_cfg->GetValue("LOGIC") == "AND") {
+        current_test->Logic = eAND;
+      } else if (AC_cfg->GetValue("LOGIC") == "DEFAULT") {
+        current_test->Logic = eDefault;
+      } else { // error
+        cerr << "Unrecognized LOGIC token  in switch component: " << Name << endl;
+      }
+      
+      value = AC_cfg->GetValue("VALUE");
+      if (value.empty()) {
+        cerr << "No VALUE supplied for switch component: " << Name << endl;
+      } else {
+        if (value.find_first_not_of("-.0123456789eE") == string::npos) {
+          // if true (and execution falls into this block), "value" is a number.
+          current_test->OutputVal = atof(value.c_str());
+        } else {
+          // "value" must be a property if execution passes to here.
+          current_test->OutputProp = PropertyManager->GetNode(value);
+        }
+      }
+
+      AC_cfg->GetNextConfigLine();
+      while (AC_cfg->GetValue() != "/TEST") {
+        current_test->conditions.push_back(*(new FGCondition(AC_cfg, PropertyManager)));
+      }
+    }
+    AC_cfg->GetNextConfigLine();
+  }
+
   FGFCSComponent::bind();
 
   Debug(0);
@@ -69,8 +138,40 @@ FGSwitch::~FGSwitch()
 
 bool FGSwitch::Run(void )
 {
+  vector ::iterator iTests = tests.begin();
+  vector ::iterator iConditions;
+  bool pass = false;
+
   FGFCSComponent::Run(); // call the base class for initialization of Input
 
+  while (iTests < tests.end()) {
+    iConditions = iTests->conditions.begin();
+ 
+    if (iTests->Logic == eDefault) {
+      Output = iTests->GetValue();
+    } else if (iTests->Logic == eAND) {
+      pass = true;
+      while (iConditions < iTests->conditions.end()) {
+        if (!iConditions->Evaluate()) pass = false;
+        *iConditions++;
+      }
+    } else if (iTests->Logic == eOR) {
+      pass = false;
+      while (iConditions < iTests->conditions.end()) {
+        if (iConditions->Evaluate()) pass = true;
+        *iConditions++;
+      }
+    } else {
+      cerr << "Invalid logic test" << endl;
+    }
+
+    if (pass) {
+      Output = iTests->GetValue();
+      break;
+    }
+    *iTests++;
+  }
+
   return true;
 }
 
@@ -95,11 +196,57 @@ bool FGSwitch::Run(void )
 
 void FGSwitch::Debug(int from)
 {
+  vector ::iterator iTests = tests.begin();
+  vector ::iterator iConditions;
+  string comp, scratch;
+  string indent = "        ";
+  bool first = false;
+
   if (debug_lvl <= 0) return;
 
   if (debug_lvl & 1) { // Standard console startup message output
     if (from == 0) { // Constructor
+      while (iTests < tests.end()) {
+
+        scratch = " if ";
+
+        switch(iTests->Logic) {
+        case (elUndef):
+          comp = " UNSET ";
+          cerr << "Unset logic for test condition" << endl;
+          break;
+        case (eAND):
+          comp = " AND ";
+          break;
+        case (eOR):
+          comp=" OR ";
+          break;
+        case (eDefault):
+          scratch = " by default.";
+          break;
+        default:
+          comp = " UNKNOWN ";
+          cerr << "Unknown logic for test condition" << endl;
+        }
 
+        if (iTests->OutputProp != 0L)
+          cout << indent << "Switch VALUE is " << iTests->OutputProp->GetName() << scratch << endl;
+        else 
+          cout << indent << "Switch VALUE is " << iTests->OutputVal << scratch << endl;
+
+        iConditions = iTests->conditions.begin();
+        first = true;
+        while (iConditions < iTests->conditions.end()) {
+          if (!first) cout << indent << comp << " ";
+          else cout << indent << " ";
+          first = false;
+          iConditions->PrintCondition();
+          cout << endl;
+          *iConditions++;
+        }
+        cout << endl;
+        *iTests++;
+      }
     }
   }
   if (debug_lvl & 2 ) { // Instantiation/Destruction notification
@@ -119,4 +266,4 @@ void FGSwitch::Debug(int from)
     }
   }
 }
-
+}
diff --git a/src/FDM/JSBSim/filtersjb/FGSwitch.h b/src/FDM/JSBSim/filtersjb/FGSwitch.h
index 8bfe0e1b1..b29d86e3b 100644
--- a/src/FDM/JSBSim/filtersjb/FGSwitch.h
+++ b/src/FDM/JSBSim/filtersjb/FGSwitch.h
@@ -1,8 +1,8 @@
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
  Header:       FGSwitch.h
- Author:       
- Date started: 
+ Author:       Jon S. Berndt
+ Date started: 12/23/2002
 
  ------------- Copyright (C)  -------------
 
@@ -26,10 +26,6 @@
 HISTORY
 --------------------------------------------------------------------------------
 
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES,  and NOTES
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 SENTRY
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@@ -43,16 +39,71 @@ INCLUDES
 
 #include "FGFCSComponent.h"
 #include "../FGConfigFile.h"
+#include "FGCondition.h"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-DEFINES
+DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #define ID_SWITCH "$Id$"
 
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DOCUMENTATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/** Encapsulates a switch for the flight control system.
+
+The SWITCH component models a switch - either on/off or a multi-choice rotary
+switch. The switch can represent a physical cockpit switch, or can represent a
+logical switch, where several conditions might need to be satisfied before a
+particular state is reached. The VALUE of the switch - the output value - is
+chosen depending on the state of the switch. Each switch is comprised of two or
+more TESTs. Each TEST has a VALUE associated with it. The first TEST that
+evaluates to TRUE will set the output value of the switch according to the VALUE
+parameter belonging to that TEST. Each TEST contains one or more CONDITIONS, which
+each must be logically related (if there are more than one) given the value of
+the LOGIC parameter, and which takes the form:
+
+  property conditional property|value
+
+e.g.
+
+  qbar GE 21.0
+
+or,
+
+  roll_rate < pitch_rate
+
+Within a TEST, a CONDITION_GROUP can be specified. A CONDITION_GROUP allows for
+complex groupings of logical comparisons. Each CONDITION_GROUP contains
+additional conditions, as well as possibly additional CONDITION_GROUPs.
+
+
+  
+    {property} {conditional} {property|value}
+    
+      {property} {conditional} {property|value}
+      ...
+    
+    ...
+  
+  
+    {property} {conditional} {property|value}
+    ...
+  
+  ...
+
+*/
+   
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DECLARATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
 
 class FGSwitch  : public FGFCSComponent
 {
@@ -65,7 +116,33 @@ public:
 private:
   FGFCS* fcs;
   FGConfigFile* AC_cfg;
+
+  enum eLogic {elUndef=0, eAND, eOR, eDefault};
+  enum eComparison {ecUndef=0, eEQ, eNE, eGT, eGE, eLT, eLE};
+  map  mComparison;
+
+  struct test {
+    vector  conditions;
+    eLogic Logic;
+    double OutputVal;
+    FGPropertyManager *OutputProp;
+    
+    double GetValue(void) {
+      if (OutputProp == 0L) return OutputVal;
+      else                  return OutputProp->getDoubleValue();
+    }
+
+    test(void) { // constructor for the test structure
+      Logic      = elUndef;
+      OutputVal  = 0.0;
+      OutputProp = 0L;
+    }
+
+  };
+
+  vector  tests;
+  
   void Debug(int from);
 };
-
+}
 #endif
diff --git a/src/FDM/JSBSim/filtersjb/Makefile.am b/src/FDM/JSBSim/filtersjb/Makefile.am
index 90ad2c5c2..ad4345d49 100644
--- a/src/FDM/JSBSim/filtersjb/Makefile.am
+++ b/src/FDM/JSBSim/filtersjb/Makefile.am
@@ -10,7 +10,8 @@ libfiltersjb_a_SOURCES = \
 	FGGradient.cpp FGGradient.h \
 	FGKinemat.cpp FGKinemat.h \
 	FGSummer.cpp FGSummer.h \
-	FGSwitch.cpp FGSwitch.h
+	FGSwitch.cpp FGSwitch.h \
+        FGCondition.cpp FGCondition.h
 
 AM_CXXFLAGS = -DFGFS
 
-- 
2.39.5