]> git.mxchange.org Git - flightgear.git/commitdiff
Sync. with JSBSim CVS: although it looks a large part it is mostly bug fixes and...
authorErik Hofman <erik@ehofman.com>
Sat, 18 Jan 2014 09:56:15 +0000 (10:56 +0100)
committerErik Hofman <erik@ehofman.com>
Sat, 18 Jan 2014 09:56:15 +0000 (10:56 +0100)
112 files changed:
src/FDM/JSBSim/CMakeLists.txt
src/FDM/JSBSim/FGFDMExec.cpp
src/FDM/JSBSim/FGFDMExec.h
src/FDM/JSBSim/FGJSBBase.cpp
src/FDM/JSBSim/FGJSBBase.h
src/FDM/JSBSim/JSBSim.cxx
src/FDM/JSBSim/initialization/FGInitialCondition.cpp
src/FDM/JSBSim/initialization/FGSimplexTrim.cpp [changed mode: 0644->0755]
src/FDM/JSBSim/initialization/FGTrim.cpp
src/FDM/JSBSim/initialization/FGTrimAxis.cpp
src/FDM/JSBSim/initialization/FGTrimmer.cpp [changed mode: 0644->0755]
src/FDM/JSBSim/input_output/FGOutputFG.cpp
src/FDM/JSBSim/input_output/FGOutputFile.cpp
src/FDM/JSBSim/input_output/FGOutputSocket.cpp
src/FDM/JSBSim/input_output/FGOutputTextFile.cpp
src/FDM/JSBSim/input_output/FGOutputType.cpp
src/FDM/JSBSim/input_output/FGPropertyReader.cpp [new file with mode: 0644]
src/FDM/JSBSim/input_output/FGPropertyReader.h [new file with mode: 0644]
src/FDM/JSBSim/input_output/FGScript.cpp
src/FDM/JSBSim/input_output/FGScript.h
src/FDM/JSBSim/input_output/FGXMLElement.cpp
src/FDM/JSBSim/input_output/FGXMLElement.h
src/FDM/JSBSim/input_output/FGXMLFileRead.h
src/FDM/JSBSim/input_output/FGXMLParse.cpp
src/FDM/JSBSim/input_output/FGfdmSocket.cpp
src/FDM/JSBSim/input_output/string_utilities.h
src/FDM/JSBSim/math/FGColumnVector3.cpp
src/FDM/JSBSim/math/FGColumnVector3.h
src/FDM/JSBSim/math/FGCondition.cpp
src/FDM/JSBSim/math/FGFunction.cpp
src/FDM/JSBSim/math/FGLocation.cpp
src/FDM/JSBSim/math/FGMatrix33.cpp
src/FDM/JSBSim/math/FGModelFunctions.cpp
src/FDM/JSBSim/math/FGModelFunctions.h
src/FDM/JSBSim/math/FGNelderMead.cpp [changed mode: 0644->0755]
src/FDM/JSBSim/math/FGPropertyValue.cpp
src/FDM/JSBSim/math/FGQuaternion.cpp
src/FDM/JSBSim/math/FGRealValue.cpp [changed mode: 0644->0755]
src/FDM/JSBSim/math/FGRungeKutta.cpp
src/FDM/JSBSim/math/FGTable.cpp
src/FDM/JSBSim/models/FGAccelerations.cpp
src/FDM/JSBSim/models/FGAccelerations.h
src/FDM/JSBSim/models/FGAerodynamics.cpp
src/FDM/JSBSim/models/FGAircraft.cpp
src/FDM/JSBSim/models/FGAtmosphere.cpp
src/FDM/JSBSim/models/FGAuxiliary.cpp [changed mode: 0644->0755]
src/FDM/JSBSim/models/FGBuoyantForces.cpp
src/FDM/JSBSim/models/FGExternalForce.cpp [changed mode: 0644->0755]
src/FDM/JSBSim/models/FGExternalReactions.cpp
src/FDM/JSBSim/models/FGFCS.cpp
src/FDM/JSBSim/models/FGFCSChannel.h
src/FDM/JSBSim/models/FGGasCell.cpp
src/FDM/JSBSim/models/FGGroundReactions.cpp
src/FDM/JSBSim/models/FGGroundReactions.h
src/FDM/JSBSim/models/FGInertial.cpp
src/FDM/JSBSim/models/FGInertial.h
src/FDM/JSBSim/models/FGInput.cpp [changed mode: 0644->0755]
src/FDM/JSBSim/models/FGLGear.cpp
src/FDM/JSBSim/models/FGLGear.h
src/FDM/JSBSim/models/FGMassBalance.cpp
src/FDM/JSBSim/models/FGModel.cpp
src/FDM/JSBSim/models/FGOutput.cpp
src/FDM/JSBSim/models/FGPropagate.cpp
src/FDM/JSBSim/models/FGPropagate.h
src/FDM/JSBSim/models/FGPropulsion.cpp
src/FDM/JSBSim/models/FGSurface.cpp [new file with mode: 0644]
src/FDM/JSBSim/models/FGSurface.h [new file with mode: 0644]
src/FDM/JSBSim/models/atmosphere/FGMSIS.cpp [changed mode: 0644->0755]
src/FDM/JSBSim/models/atmosphere/FGMars.cpp [changed mode: 0644->0755]
src/FDM/JSBSim/models/atmosphere/FGStandardAtmosphere.cpp
src/FDM/JSBSim/models/atmosphere/FGWinds.cpp
src/FDM/JSBSim/models/flight_control/FGAccelerometer.cpp
src/FDM/JSBSim/models/flight_control/FGAccelerometer.h
src/FDM/JSBSim/models/flight_control/FGActuator.cpp
src/FDM/JSBSim/models/flight_control/FGActuator.h
src/FDM/JSBSim/models/flight_control/FGAngles.cpp
src/FDM/JSBSim/models/flight_control/FGDeadBand.cpp
src/FDM/JSBSim/models/flight_control/FGDistributor.cpp
src/FDM/JSBSim/models/flight_control/FGFCSComponent.cpp
src/FDM/JSBSim/models/flight_control/FGFCSComponent.h
src/FDM/JSBSim/models/flight_control/FGFCSFunction.cpp
src/FDM/JSBSim/models/flight_control/FGFilter.cpp
src/FDM/JSBSim/models/flight_control/FGFilter.h
src/FDM/JSBSim/models/flight_control/FGGain.cpp
src/FDM/JSBSim/models/flight_control/FGGyro.cpp
src/FDM/JSBSim/models/flight_control/FGKinemat.cpp
src/FDM/JSBSim/models/flight_control/FGMagnetometer.cpp
src/FDM/JSBSim/models/flight_control/FGPID.cpp [changed mode: 0644->0755]
src/FDM/JSBSim/models/flight_control/FGPID.h [changed mode: 0644->0755]
src/FDM/JSBSim/models/flight_control/FGSensor.cpp [changed mode: 0644->0755]
src/FDM/JSBSim/models/flight_control/FGSensor.h [changed mode: 0644->0755]
src/FDM/JSBSim/models/flight_control/FGSummer.cpp
src/FDM/JSBSim/models/flight_control/FGSwitch.cpp
src/FDM/JSBSim/models/flight_control/FGWaypoint.cpp
src/FDM/JSBSim/models/propulsion/FGElectric.cpp
src/FDM/JSBSim/models/propulsion/FGElectric.h
src/FDM/JSBSim/models/propulsion/FGEngine.cpp
src/FDM/JSBSim/models/propulsion/FGEngine.h
src/FDM/JSBSim/models/propulsion/FGForce.cpp
src/FDM/JSBSim/models/propulsion/FGNozzle.cpp
src/FDM/JSBSim/models/propulsion/FGNozzle.h
src/FDM/JSBSim/models/propulsion/FGPiston.cpp
src/FDM/JSBSim/models/propulsion/FGPiston.h
src/FDM/JSBSim/models/propulsion/FGPropeller.cpp
src/FDM/JSBSim/models/propulsion/FGRocket.cpp
src/FDM/JSBSim/models/propulsion/FGRotor.cpp
src/FDM/JSBSim/models/propulsion/FGTank.cpp
src/FDM/JSBSim/models/propulsion/FGThruster.cpp
src/FDM/JSBSim/models/propulsion/FGThruster.h
src/FDM/JSBSim/models/propulsion/FGTransmission.cpp
src/FDM/JSBSim/models/propulsion/FGTurbine.cpp
src/FDM/JSBSim/models/propulsion/FGTurboProp.cpp

index c31b355ba99c245b4722f6b5a112c1afa2de79c6..550d1eca8ccc0e092db8d5b33e5a5668fb87de71 100644 (file)
@@ -12,6 +12,7 @@ set(HEADERS
     initialization/FGLinearization.h
     input_output/FGXMLParse.h
     input_output/FGXMLFileRead.h
+    input_output/FGPropertyReader.h
     input_output/FGPropertyManager.h
     input_output/FGScript.h
     input_output/FGfdmSocket.h
@@ -49,6 +50,7 @@ set(HEADERS
     models/FGExternalReactions.h
     models/FGFCS.h
     models/FGGasCell.h
+    models/FGSurface.h
     models/FGGroundReactions.h
     models/FGInertial.h
     models/FGInput.h
@@ -106,6 +108,7 @@ set(SOURCES
     initialization/FGTrimmer.cpp
     initialization/FGLinearization.cpp
     input_output/FGGroundCallback.cpp
+    input_output/FGPropertyReader.cpp
     input_output/FGPropertyManager.cpp
     input_output/FGScript.cpp
     input_output/FGXMLElement.cpp
@@ -139,6 +142,7 @@ set(SOURCES
     models/FGExternalReactions.cpp
     models/FGFCS.cpp
     models/FGGasCell.cpp
+    models/FGSurface.cpp
     models/FGGroundReactions.cpp
     models/FGInertial.cpp
     models/FGInput.cpp
index b61529229c40c3947ff50ab9792c1792907a8bb8..2f05d2f1d13e9090272f70ad1f1bb7dbb3cf3bbe 100644 (file)
@@ -75,8 +75,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGFDMExec.cpp,v 1.150 2013/11/24 11:40:55 bcoconni Exp $";
-static const char *IdHdr = ID_FDMEXEC;
+IDENT(IdSrc,"$Id: FGFDMExec.cpp,v 1.154 2014/01/13 10:45:59 ehofman Exp $");
+IDENT(IdHdr,ID_FDMEXEC);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
@@ -101,6 +101,7 @@ FGFDMExec::FGFDMExec(FGPropertyManager* root, unsigned int* fdmctr) : Root(root)
   holding = false;
   Terminate = false;
   StandAlone = false;
+  ResetMode = 0;
 
   IncrementThenHolding = false;  // increment then hold is off by default
   TimeStepsUntilHold = -1;
@@ -152,13 +153,13 @@ FGFDMExec::FGFDMExec(FGPropertyManager* root, unsigned int* fdmctr) : Root(root)
 
   Constructing = true;
   typedef int (FGFDMExec::*iPMF)(void) const;
-  typedef double (FGFDMExec::*dPMF)(void) const;
+//  typedef double (FGFDMExec::*dPMF)(void) const;
 //  typedef unsigned int (FGFDMExec::*uiPMF)(void) const;
 //  instance->Tie("simulation/do_trim_analysis", this, (iPMF)0, &FGFDMExec::DoTrimAnalysis, false);
   instance->Tie("simulation/do_simple_trim", this, (iPMF)0, &FGFDMExec::DoTrim, false);
   instance->Tie("simulation/do_simplex_trim", this, (iPMF)0, &FGFDMExec::DoSimplexTrim);
   instance->Tie("simulation/do_linearization", this, (iPMF)0, &FGFDMExec::DoLinearization);
-  instance->Tie("simulation/reset", this, (iPMF)0, &FGFDMExec::ResetToInitialConditions, false);
+  instance->Tie("simulation/reset", (int*)&ResetMode);
   instance->Tie("simulation/randomseed", this, (iPMF)0, &FGFDMExec::SRand, false);
   instance->Tie("simulation/terminate", (int *)&Terminate);
   instance->Tie("simulation/sim-time-sec", this, &FGFDMExec::GetSimTime);
@@ -360,9 +361,16 @@ bool FGFDMExec::Run(void)
     Models[i]->Run(holding);
   }
 
+  if (ResetMode) {
+    if (ResetMode == 1) Output->SetStartNewOutput();
+
+    ResetMode = 0;
+    ResetToInitialConditions();
+  }
+
   if (Terminate) success = false;
 
-  return (success);
+  return success;
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -583,7 +591,8 @@ bool FGFDMExec::RunIC(void)
 {
   FGPropulsion* propulsion = (FGPropulsion*)Models[ePropulsion];
 
-  Models[eOutput]->InitModel();
+  if (!trim_status)
+    Models[eOutput]->InitModel();
 
   SuspendIntegration(); // saves the integration rate, dt, then sets it to 0.0.
   Initialize(IC);
@@ -603,26 +612,15 @@ void FGFDMExec::Initialize(FGInitialCondition *FGIC)
   Setsim_time(0.0);
 
   Propagate->SetInitialState( FGIC );
+  LoadInputs(eInertial);
+  Inertial->Run(false);
   LoadInputs(eAccelerations);
   Accelerations->Run(false);
   LoadInputs(ePropagate);
   Propagate->InitializeDerivatives();
-  LoadInputs(eAtmosphere);
-  Atmosphere->Run(false);
   Winds->SetWindNED(FGIC->GetWindNEDFpsIC());
-  Auxiliary->Run(false);
-}
-
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-//
-// A private, internal function call for Tie-ing to a property, so it needs an
-// argument.
-
-void FGFDMExec::ResetToInitialConditions(int mode)
-{
-  if (mode == 1) Output->SetStartNewOutput();
-
-  ResetToInitialConditions();
+  LoadInputs(eMassBalance);
+  MassBalance->Run(false);
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -639,9 +637,9 @@ void FGFDMExec::ResetToInitialConditions(void)
     Models[i]->InitModel();
   }
 
-  RunIC();
-
   if (Script) Script->ResetEvents();
+
+  RunIC();
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index bf421552330cb51970af51a1179b133bc50db7ac..408abef1554b4b42c18e60f8a7cddfac693516cc 100644 (file)
@@ -55,7 +55,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_FDMEXEC "$Id: FGFDMExec.h,v 1.85 2013/11/24 11:40:55 bcoconni Exp $"
+#define ID_FDMEXEC "$Id: FGFDMExec.h,v 1.86 2014/01/02 21:37:14 bcoconni Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -178,7 +178,7 @@ CLASS DOCUMENTATION
                                 property actually maps toa function call of DoTrim().
 
     @author Jon S. Berndt
-    @version $Revision: 1.85 $
+    @version $Revision: 1.86 $
 */
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -621,6 +621,7 @@ private:
 
   bool trim_status;
   int ta_mode;
+  unsigned int ResetMode;
 
   FGScript*           Script;
   FGInitialCondition* IC;
@@ -640,7 +641,6 @@ private:
   bool ReadFileHeader(Element*);
   bool ReadChild(Element*);
   bool ReadPrologue(Element*);
-  void ResetToInitialConditions(int mode);
   void SRand(int sr);
   void LoadInputs(unsigned int idx);
   void LoadPlanetConstants(void);
index 7a2ad6714e542e0aab58ad9bc56b8c37d8d22387..b509fd1b8d6ef19672e9a8fc56174a3c64e31a5e 100644 (file)
@@ -44,8 +44,8 @@ INCLUDES
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGJSBBase.cpp,v 1.36 2013/01/25 13:39:11 jberndt Exp $";
-static const char *IdHdr = ID_JSBBASE;
+IDENT(IdSrc,"$Id: FGJSBBase.cpp,v 1.38 2014/01/13 10:45:59 ehofman Exp $");
+IDENT(IdHdr,ID_JSBBASE);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
index bcc6e3fdf8be6de82fcf48abc7d14e221f3c846f..3dd78df9d7bf228626fbd08154fca36f490e7975 100644 (file)
@@ -51,12 +51,13 @@ using std::max;
 #ifndef M_PI
 #  define M_PI 3.14159265358979323846
 #endif
+#define IDENT(a,b)      static const char* const (a)[] = {b,(a)[0]}
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_JSBBASE "$Id: FGJSBBase.h,v 1.38 2013/06/20 13:01:48 jberndt Exp $"
+#define ID_JSBBASE "$Id: FGJSBBase.h,v 1.39 2014/01/13 10:45:59 ehofman Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -72,7 +73,7 @@ CLASS DOCUMENTATION
 *   This class provides universal constants, utility functions, messaging
 *   functions, and enumerated constants to JSBSim.
     @author Jon S. Berndt
-    @version $Id: FGJSBBase.h,v 1.38 2013/06/20 13:01:48 jberndt Exp $
+    @version $Id: FGJSBBase.h,v 1.39 2014/01/13 10:45:59 ehofman Exp $
 */
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index c276c2c48526263b8c07fbcdd8ee88548a854b22..f6faecb6c775c431dc42e95853e8269cdfcbc794 100644 (file)
@@ -36,6 +36,7 @@
 #include <simgear/math/sg_geodesy.hxx>
 #include <simgear/misc/sg_path.hxx>
 #include <simgear/structure/commands.hxx>
+#include <simgear/bvh/BVHMaterial.hxx>
 
 #include <FDM/flight.hxx>
 
@@ -1335,9 +1336,30 @@ FGJSBsim::get_agl_ft(double t, const double pt[3], double alt_off,
    if (!FGInterface::get_agl_ft(t, pt, alt_off, contact, normal, vel,
                                 angularVel, material, id))
        return false;
+
    SGGeod geodPt = SGGeod::fromCart(SG_FEET_TO_METER*SGVec3d(pt));
    SGQuatd hlToEc = SGQuatd::fromLonLat(geodPt);
    *agl = dot(hlToEc.rotate(SGVec3d(0, 0, 1)), SGVec3d(contact) - SGVec3d(pt));
+
+   static SGPropertyNode_ptr terrain_nas = fgGetNode("/fdm/jsbsim/environment/terrain-hight", false);
+   if (!terrain_nas && material) {
+      double frictionFactor = (*material).get_friction_factor();
+      double rollingFriction = (*material).get_rolling_friction();
+      
+      if ((rollingFriction != 1.0) && (rollingFriction > 0.001)) {
+        frictionFactor = rollingFriction/0.02;
+      }
+      GroundReactions->SetFrictionFactor(frictionFactor);
+
+      // 1 Pascal = 0.00014503773800721815 lbs/in^2
+      double pressure = (*material).get_load_resistance(); // N/m^2 (or Pascal)
+      GroundReactions->SetMaximumForce(pressure*0.00014503773800721815);
+
+      GroundReactions->SetBumpiness((*material).get_bumpiness());
+      GroundReactions->SetSolid((*material).get_solid());
+      GroundReactions->SetPosition(pt);
+   }
+
    return true;
 }
 
index 804a61ed8f092bc81aca600d137238fde6f08591..4df18d631a942fc6a64cfd60d943eda7bda95931 100644 (file)
@@ -55,6 +55,7 @@ INCLUDES
 #include "models/FGAtmosphere.h"
 #include "models/FGPropagate.h"
 #include "models/FGPropulsion.h"
+#include "models/FGAccelerations.h"
 #include "models/FGFCS.h"
 #include "input_output/FGPropertyManager.h"
 #include "input_output/string_utilities.h"
@@ -65,8 +66,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGInitialCondition.cpp,v 1.89 2013/11/24 11:40:55 bcoconni Exp $";
-static const char *IdHdr = ID_INITIALCONDITION;
+IDENT(IdSrc,"$Id: FGInitialCondition.cpp,v 1.93 2014/01/13 10:46:00 ehofman Exp $");
+IDENT(IdHdr,ID_INITIALCONDITION);
 
 //******************************************************************************
 
@@ -886,9 +887,12 @@ bool FGInitialCondition::Load(string rstfile, bool useStoredPath)
     exit(-1);
   }
 
-  double version = document->GetAttributeValueAsNumber("version");
+  double version = HUGE_VAL;
   bool result = false;
 
+  if (document->HasAttribute("version"))
+    version = document->GetAttributeValueAsNumber("version");
+
   if (version == HUGE_VAL) {
     result = Load_v1(document); // Default to the old version
   } else if (version >= 3.0) {
@@ -1002,10 +1006,19 @@ bool FGInitialCondition::Load_v2(Element* document)
 {
   FGColumnVector3 vOrient;
   bool result = true;
-  FGColumnVector3 vOmegaEarth = fdmex->GetInertial()->GetOmegaPlanet();
 
+  // support both earth_position_angle and planet_position_angle, for now.
   if (document->FindElement("earth_position_angle"))
     position.SetEarthPositionAngle(document->FindElementValueAsNumberConvertTo("earth_position_angle", "RAD"));
+  if (document->FindElement("planet_position_angle"))
+    position.SetEarthPositionAngle(document->FindElementValueAsNumberConvertTo("planet_position_angle", "RAD"));
+
+  if (document->FindElement("planet_rotation_rate")) {
+    fdmex->GetInertial()->SetOmegaPlanet(document->FindElementValueAsNumberConvertTo("planet_rotation_rate", "RAD"));
+    fdmex->GetPropagate()->in.vOmegaPlanet     = fdmex->GetInertial()->GetOmegaPlanet();
+    fdmex->GetAccelerations()->in.vOmegaPlanet = fdmex->GetInertial()->GetOmegaPlanet();
+  }
+  FGColumnVector3 vOmegaEarth = fdmex->GetInertial()->GetOmegaPlanet();
 
   // Initialize vehicle position
   //
old mode 100644 (file)
new mode 100755 (executable)
index b8e645a..1f8a196
@@ -23,7 +23,7 @@ namespace JSBSim {
 
 FGSimplexTrim::FGSimplexTrim(FGFDMExec * fdm, TrimMode mode)
 {
-    std::clock_t time_start=clock(), time_trimDone, time_linDone;
+    std::clock_t time_start=clock(), time_trimDone;
 
     // variables
     FGTrimmer::Constraints constraints;
@@ -43,12 +43,10 @@ FGSimplexTrim::FGSimplexTrim(FGFDMExec * fdm, TrimMode mode)
     bool showConvergence = node->GetBool("trim/solver/showConvergence");
     bool pause = node->GetBool("trim/solver/pause");
     bool showSimplex = node->GetBool("trim/solver/showSimplex");
-    bool variablePropPitch = node->GetBool("trim/solver/variablePropPitch");
 
     // flight conditions
     double phi = fdm->GetIC()->GetPhiRadIC();
     double theta = fdm->GetIC()->GetThetaRadIC();
-    double psi = fdm->GetIC()->GetPsiRadIC();
     double gd = fdm->GetInertial()->gravity();
 
     constraints.velocity = fdm->GetIC()->GetVtrueFpsIC();
@@ -110,8 +108,8 @@ FGSimplexTrim::FGSimplexTrim(FGFDMExec * fdm, TrimMode mode)
         std::cout << "\ntrim computation time: " << (time_trimDone - time_start)/double(CLOCKS_PER_SEC) << "s \n" << std::endl;
     }
 
-    if (solver) delete solver;
-    if (trimmer) delete trimmer;
+    delete solver;
+    delete trimmer;
 }
 
 } // JSBSim
index bb346598a12073a54ed3d8a3c1de150068cfbbf0..d4b1112e3e5edb93d7fd228f846790bc2be1f2d6 100644 (file)
@@ -57,8 +57,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGTrim.cpp,v 1.18 2013/11/24 16:53:15 bcoconni Exp $";
-static const char *IdHdr = ID_TRIM;
+IDENT(IdSrc,"$Id: FGTrim.cpp,v 1.22 2014/01/13 10:46:00 ehofman Exp $");
+IDENT(IdHdr,ID_TRIM);
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
@@ -242,8 +242,8 @@ bool FGTrim::DoTrim(void) {
 
   fdmex->DisableOutput();
 
-  fdmex->RunIC();
   fdmex->SetTrimStatus(true);
+  fdmex->RunIC();
   fdmex->SuspendIntegration();
 
   fgic->SetPRadpsIC(0.0);
@@ -381,9 +381,9 @@ bool FGTrim::DoTrim(void) {
         cout << endl << "  Trim failed" << endl;
   }
 
-  fdmex->SetTrimStatus(false);
   fdmex->ResumeIntegration();
   fdmex->RunIC();
+  fdmex->SetTrimStatus(false);
   fdmex->EnableOutput();
 
   for(i=0;i < fdmex->GetGroundReactions()->GetNumGearUnits();i++){
index 2fbaec8a28815f3b0a3cae76cf93f34b8aca505c..4eb1d63d56807b51b952067207d34b8bc2773791 100644 (file)
@@ -56,8 +56,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGTrimAxis.cpp,v 1.15 2013/11/24 16:53:15 bcoconni Exp $";
-static const char *IdHdr = ID_TRIMAXIS;
+IDENT(IdSrc,"$Id: FGTrimAxis.cpp,v 1.17 2014/01/13 10:46:00 ehofman Exp $");
+IDENT(IdHdr,ID_TRIMAXIS);
 
 /*****************************************************************************/
 
old mode 100644 (file)
new mode 100755 (executable)
index b019486..f64326c
@@ -189,7 +189,6 @@ void FGTrimmer::printSolution(std::ostream & stream, const std::vector<double> &
     eval(v);
 
     //double dt = m_fdm->GetDeltaT();
-    double thrust = m_fdm->GetPropulsion()->GetEngine(0)->GetThruster()->GetThrust();
     double elevator = m_fdm->GetFCS()->GetDePos(ofNorm);
     double aileron = m_fdm->GetFCS()->GetDaLPos(ofNorm);
     double rudder = m_fdm->GetFCS()->GetDrPos(ofNorm);
index b6a2964e1b05e2170267763aac4abb68174fc883..99c98dca39f00d846c95b7535f6749387e650b3b 100644 (file)
@@ -71,8 +71,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGOutputFG.cpp,v 1.6 2013/11/09 14:06:36 bcoconni Exp $";
-static const char *IdHdr = ID_OUTPUTFG;
+IDENT(IdSrc,"$Id: FGOutputFG.cpp,v 1.8 2014/01/13 10:46:00 ehofman Exp $");
+IDENT(IdHdr,ID_OUTPUTFG);
 
 // (stolen from FGFS native_fdm.cxx)
 // The function htond is defined this way due to the way some
index c1cfc7d32dd999ccd730227d9a5fbbefdf63c0dc..431c2ebe0fe0c3979f7ff3c0a6981729fad365c9 100644 (file)
@@ -47,8 +47,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGOutputFile.cpp,v 1.4 2013/11/24 11:40:55 bcoconni Exp $";
-static const char *IdHdr = ID_OUTPUTFILE;
+IDENT(IdSrc,"$Id: FGOutputFile.cpp,v 1.6 2014/01/13 10:46:00 ehofman Exp $");
+IDENT(IdHdr,ID_OUTPUTFILE);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
index 7e913ff66d1c0f0298348f4f2ebaaf7ca04487a3..60b3e7a3b2481b8dff165511d227e3f37fe0434f 100644 (file)
@@ -60,8 +60,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGOutputSocket.cpp,v 1.6 2013/11/24 11:40:55 bcoconni Exp $";
-static const char *IdHdr = ID_OUTPUTSOCKET;
+IDENT(IdSrc,"$Id: FGOutputSocket.cpp,v 1.8 2014/01/13 10:46:00 ehofman Exp $");
+IDENT(IdHdr,ID_OUTPUTSOCKET);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
index 03c593bad42462b40df63c4d683b04df38b42fe2..e6abcef35ddf667510b6531402b86558123427c4 100644 (file)
@@ -64,8 +64,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGOutputTextFile.cpp,v 1.7 2013/11/24 11:40:55 bcoconni Exp $";
-static const char *IdHdr = ID_OUTPUTTEXTFILE;
+IDENT(IdSrc,"$Id: FGOutputTextFile.cpp,v 1.10 2014/01/13 10:46:00 ehofman Exp $");
+IDENT(IdHdr,ID_OUTPUTTEXTFILE);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
@@ -76,7 +76,7 @@ bool FGOutputTextFile::Load(Element* el)
   if(!FGOutputFile::Load(el))
     return false;
 
-  PreLoad(el, PropertyManager);
+//  PreLoad(el, PropertyManager);
 
   string type = el->GetAttributeValue("type");
   string delim;
index 90b9c2c7a13fbe725dc2bf7195e661763ccc78bf..09cbc62b699c68dd2e29cde9c7e7418c154fdc80 100644 (file)
@@ -46,8 +46,8 @@ INCLUDES
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGOutputType.cpp,v 1.7 2013/09/27 19:45:40 jberndt Exp $";
-static const char *IdHdr = ID_OUTPUTTYPE;
+IDENT(IdSrc,"$Id: FGOutputType.cpp,v 1.10 2014/01/13 10:46:00 ehofman Exp $");
+IDENT(IdHdr,ID_OUTPUTTYPE);
 
 using namespace std;
 
@@ -101,7 +101,7 @@ void FGOutputType::SetIdx(int idx)
 bool FGOutputType::Load(Element* element)
 {
   // Perform base class Load.
-//  if(!FGModel::Load(element)) return false;
+  PreLoad(element, PropertyManager);
 
   if (element->FindElementValue("simulation") == string("ON"))
     SubSystems += ssSimulation;
diff --git a/src/FDM/JSBSim/input_output/FGPropertyReader.cpp b/src/FDM/JSBSim/input_output/FGPropertyReader.cpp
new file mode 100644 (file)
index 0000000..b6c001a
--- /dev/null
@@ -0,0 +1,134 @@
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+ Module:       FGPropertyReader.cpp
+ Author:       Bertrand Coconnier
+ Date started: 12/30/13
+ Purpose:      Read and manage properties from XML data
+
+  ------------- Copyright (C) 2013 Bertrand Coconnier -------------
+
+ This program is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser 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 Lesser General Public License for more
+ details.
+
+ You should have received a copy of the GNU Lesser 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 Lesser General Public License can also be found on
+ the world wide web at http://www.gnu.org.
+
+FUNCTIONAL DESCRIPTION
+--------------------------------------------------------------------------------
+This class reads and manages properties defined in XML data
+
+HISTORY
+--------------------------------------------------------------------------------
+12/30/13   BC    Created
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+INCLUDES
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+#include "FGPropertyReader.h"
+#include "FGPropertyManager.h"
+#include "FGXMLElement.h"
+#include "FGJSBBase.h"
+
+using namespace std;
+
+namespace JSBSim {
+
+IDENT(IdSrc,"$Id: FGPropertyReader.cpp,v 1.3 2014/01/13 10:46:00 ehofman Exp $");
+IDENT(IdHdr,ID_PROPERTYREADER);
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS IMPLEMENTATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+bool FGPropertyReader::ResetToIC(void)
+{
+  map<FGPropertyNode_ptr, double>::iterator it = interface_prop_initial_value.begin();
+  for (;it != interface_prop_initial_value.end(); ++it) {
+    FGPropertyNode* node = it->first;
+    if (!node->getAttribute(SGPropertyNode::PRESERVE))
+      node->setDoubleValue(it->second);
+  }
+
+  return true;
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+void FGPropertyReader::LoadProperties(Element* el, FGPropertyManager* PM,
+                                     bool override)
+{
+  // Interface properties are all stored in the interface properties array.
+  string interface_property_string = "";
+
+  Element *property_element = el->FindElement("property");
+  if (property_element && FGJSBBase::debug_lvl > 0) {
+    cout << endl << "    ";
+    if (override)
+      cout << "Overriding";
+    else
+      cout << "Declared";
+    cout << " properties" << endl << endl;
+  }
+
+  while (property_element) {
+    FGPropertyNode* node = 0;
+    double value=0.0;
+    if ( ! property_element->GetAttributeValue("value").empty())
+      value = property_element->GetAttributeValueAsNumber("value");
+
+    interface_property_string = property_element->GetDataLine();
+    if (PM->HasNode(interface_property_string)) {
+      if (override) {
+        node = PM->GetNode(interface_property_string);
+
+        if (FGJSBBase::debug_lvl > 0) {
+          if (interface_prop_initial_value.find(node) == interface_prop_initial_value.end()) {
+            cout << property_element->ReadFrom()
+                 << "  The following property will be overridden but it has not been" << endl
+                 << "  defined in the current model '" << el->GetName() << "'" << endl;
+          }
+
+          cout << "      " << "Overriding value for property " << interface_property_string << endl
+               << "       (old value: " << node->getDoubleValue() << "  new value: " << value << ")"
+               << endl << endl;
+        }
+
+        node->setDoubleValue(value);
+      }
+      else {
+        cerr << property_element->ReadFrom()
+             << "      Property " << interface_property_string 
+             << " is already defined." << endl;
+       property_element = el->FindNextElement("property");
+       continue;
+      }
+    } else {
+      interface_properties.push_back(value);
+      PM->Tie(interface_property_string, &interface_properties.back());
+      if (FGJSBBase::debug_lvl > 0)
+        cout << "      " << interface_property_string << " (initial value: " 
+             << value << ")" << endl << endl;
+      node = PM->GetNode(interface_property_string);
+    }
+    interface_prop_initial_value[node] = value;
+    if (property_element->GetAttributeValue("persistent") == string("true"))
+      node->setAttribute(SGPropertyNode::PRESERVE, true);
+
+    property_element = el->FindNextElement("property");
+  }
+  
+  // End of interface property loading logic
+}
+}
diff --git a/src/FDM/JSBSim/input_output/FGPropertyReader.h b/src/FDM/JSBSim/input_output/FGPropertyReader.h
new file mode 100644 (file)
index 0000000..c50b363
--- /dev/null
@@ -0,0 +1,82 @@
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+ Header:       FGPropertyReader.h
+ Author:       Bertrand Coconnier
+ Date started: 12/30/13
+
+ ------------- Copyright (C) 2013 Bertrand Coconnier -------------
+
+ This program is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser 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 Lesser General Public License for more
+ details.
+
+ You should have received a copy of the GNU Lesser 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 Lesser General Public License can also be found on
+ the world wide web at http://www.gnu.org.
+
+HISTORY
+--------------------------------------------------------------------------------
+12/30/13   BC    Created
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+SENTRY
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+#ifndef FGPROPERTYREADER_H
+#define FGPROPERTYREADER_H
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+INCLUDES
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+#include <list>
+#include <map>
+
+#include "simgear/structure/SGSharedPtr.hxx"
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+DEFINITIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+#define ID_PROPERTYREADER "$Id: FGPropertyReader.h,v 1.1 2014/01/02 22:37:47 bcoconni Exp $"
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+FORWARD DECLARATIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+namespace JSBSim {
+
+class Element;
+class FGPropertyManager;
+class FGPropertyNode;
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DOCUMENTATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DECLARATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+class FGPropertyReader
+{
+public:
+  void LoadProperties(Element* el, FGPropertyManager* PropertyManager, bool override);
+  bool ResetToIC(void);
+
+protected:
+  std::list<double> interface_properties;
+  std::map<SGSharedPtr<FGPropertyNode>, double> interface_prop_initial_value;
+};
+}
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+#endif
index 5a0e548e8a1b8def12508fe6b1015df5d100ae8f..72438c296cc426631a2fcb037d17f2460f00f5d2 100755 (executable)
@@ -55,8 +55,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGScript.cpp,v 1.53 2013/11/24 11:40:55 bcoconni Exp $";
-static const char *IdHdr = ID_FGSCRIPT;
+IDENT(IdSrc,"$Id: FGScript.cpp,v 1.56 2014/01/13 10:46:01 ehofman Exp $");
+IDENT(IdHdr,ID_FGSCRIPT);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 GLOBAL DECLARATIONS
@@ -81,12 +81,6 @@ FGScript::~FGScript()
 {
   unsigned int i, j;
 
-  for (i=0; i<local_properties.size(); i++) {
-    delete local_properties[i]->value;
-    delete local_properties[i];
-  }
-  local_properties.clear();
-
   for (i=0; i<Events.size(); i++) {
     delete Events[i].Condition;
     for (j=0; j<Events[i].Functions.size(); j++)
@@ -106,7 +100,6 @@ bool FGScript::LoadScript(string script, double deltaT, const string initfile)
   Element *element=0, *run_element=0, *event_element=0;
   Element *condition_element=0, *set_element=0, *delay_element=0;
   Element *notify_element = 0L, *notify_property_element = 0L;
-  Element *property_element = 0L;
   Element *output_element = 0L;
   Element *input_element = 0L;
   bool result = false;
@@ -207,26 +200,10 @@ bool FGScript::LoadScript(string script, double deltaT, const string initfile)
   }
 
   // Read local property/value declarations
-  property_element = run_element->FindElement("property");
-  while (property_element) {
-
-    double value=0.0;
-    string title="";
-
-    title = property_element->GetDataLine();
-    if ( ! property_element->GetAttributeValue("value").empty())
-      value = property_element->GetAttributeValueAsNumber("value");
-
-    LocalProps *localProp = new LocalProps(value);
-    localProp->title = title;
-    local_properties.push_back(localProp);
-    if (PropertyManager->HasNode(title)) {
-      PropertyManager->GetNode(title)->setDoubleValue(value);
-    } else {
-      PropertyManager->Tie(localProp->title, localProp->value);
-    }
-    property_element = run_element->FindNextElement("property");
-  }
+  int saved_debug_lvl = debug_lvl;
+  debug_lvl = 0; // Disable messages
+  LoadProperties(run_element, PropertyManager, true);
+  debug_lvl = saved_debug_lvl;
 
   // Read "events" from script
 
@@ -365,6 +342,16 @@ bool FGScript::LoadScript(string script, double deltaT, const string initfile)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
+void FGScript::ResetEvents(void)
+{
+  //ResetToIC();
+
+  for (unsigned int i=0; i<Events.size(); i++)
+    Events[i].reset();
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
 bool FGScript::RunScript(void)
 {
   unsigned i, j;
@@ -557,13 +544,15 @@ void FGScript::Debug(int from)
         ceil(1.0/FDMExec->GetDeltaT()) << " Hz)" << endl;
       cout << endl;
 
-      for (unsigned int i=0; i<local_properties.size(); i++) {
-        cout << "Local property: " << local_properties[i]->title 
-             << " = " << PropertyManager->GetNode(local_properties[i]->title)->getDoubleValue()
+      map<FGPropertyNode_ptr, double>::iterator it = interface_prop_initial_value.begin();
+      for (; it != interface_prop_initial_value.end(); ++it) {
+        FGPropertyNode* node = it->first;
+        cout << "Local property: " << node->GetName()
+             << " = " << node->getDoubleValue()
              << endl;
       }
       
-      if (local_properties.size() > 0) cout << endl;
+      if (!interface_prop_initial_value.empty()) cout << endl;
 
       for (unsigned i=0; i<Events.size(); i++) {
         cout << "Event " << i;
index 81d4d9e541f88bb23192b58cd7e361cfaf17caff..2b6b438791941fed1a217efd10ed98619e2f0a79 100644 (file)
@@ -38,17 +38,19 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include <vector>
+#include <map>
 
 #include "FGFDMExec.h"
 #include "FGJSBBase.h"
 #include "math/FGFunction.h"
 #include "math/FGCondition.h"
+#include "FGPropertyReader.h"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_FGSCRIPT "$Id: FGScript.h,v 1.27 2013/11/24 11:40:55 bcoconni Exp $"
+#define ID_FGSCRIPT "$Id: FGScript.h,v 1.28 2014/01/02 22:37:47 bcoconni Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -157,14 +159,14 @@ CLASS DOCUMENTATION
     comes the &quot;run&quot; section, where the conditions are
     described in &quot;event&quot; clauses.</p>
     @author Jon S. Berndt
-    @version "$Id: FGScript.h,v 1.27 2013/11/24 11:40:55 bcoconni Exp $"
+    @version "$Id: FGScript.h,v 1.28 2014/01/02 22:37:47 bcoconni Exp $"
 */
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DECLARATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-class FGScript : public FGJSBBase
+class FGScript : public FGPropertyReader, public FGJSBBase
 {
 public:
   /// Default constructor
@@ -190,9 +192,7 @@ public:
       @return false if script should exit (i.e. if time limits are violated */
   bool RunScript(void);
 
-  void ResetEvents(void) {
-    for (unsigned int i=0; i<Events.size(); i++) Events[i].reset();
-  }
+  void ResetEvents(void);
 
 private:
   enum eAction {
@@ -253,20 +253,10 @@ private:
     }
   };
 
-  struct LocalProps {
-    double *value;
-    std::string title;
-    LocalProps(double initial_value=0) {
-      value = new double(initial_value);
-      title = "";
-    }
-  };
-
   std::string  ScriptName;
   double  StartTime;
   double  EndTime;
   std::vector <struct event> Events;
-  std::vector <LocalProps*> local_properties;
 
   FGFDMExec* FDMExec;
   FGPropertyManager* PropertyManager;
index 4f7c9d5aacccc883677141e10ddc01712c3e66e3..2e3215692e9bca1fd001d5ded59c61e1c470b4c9 100755 (executable)
@@ -44,8 +44,8 @@ FORWARD DECLARATIONS
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGXMLElement.cpp,v 1.41 2013/11/16 14:51:20 bcoconni Exp $";
-static const char *IdHdr = ID_XMLELEMENT;
+IDENT(IdSrc,"$Id: FGXMLElement.cpp,v 1.45 2014/01/13 10:46:02 ehofman Exp $");
+IDENT(IdHdr,ID_XMLELEMENT);
 
 bool Element::converterIsInitialized = false;
 map <string, map <string, double> > Element::convert;
@@ -233,7 +233,6 @@ Element::Element(const string& nm)
     convert["KG/L"]["KG/L"] = 1.0;
     convert["LBS/GAL"]["LBS/GAL"] = 1.0;
   }
-  attribute_key.resize(0);
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -243,7 +242,6 @@ Element::~Element(void)
   for (unsigned int i=0; i<children.size(); i++) delete children[i];
   data_lines.clear();
   attributes.clear();
-  attribute_key.clear();
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -258,16 +256,9 @@ string Element::GetAttributeValue(const string& attr)
 
 bool Element::HasAttribute(const string& attr)
 {
-  bool status=true;
-  int select=-1;
+  map<string, string>::iterator found = attributes.find(attr);
 
-  unsigned int attr_cnt = attribute_key.size();
-
-  for (unsigned int i=0; i<attr_cnt; i++) {
-    if (attribute_key[i] == attr) select = i;
-  }
-  if (select < 0) status=false;
-  return status;
+  return found != attributes.end();
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -276,7 +267,11 @@ double Element::GetAttributeValueAsNumber(const string& attr)
 {
   string attribute = GetAttributeValue(attr);
 
-  if (attribute.empty()) return HUGE_VAL;
+  if (attribute.empty()) {
+    cerr << ReadFrom() << "Expecting numeric attribute value, but got no data"
+         << endl;
+    exit(-1);
+  }
   else {
     double number=0;
     if (is_number(trim(attribute)))
@@ -342,11 +337,15 @@ double Element::GetDataAsNumber(void)
 
     return number;
   } else if (data_lines.size() == 0) {
-    return HUGE_VAL;
+    cerr << ReadFrom() << "Expected numeric value, but got no data" << endl;
+    exit(-1);
   } else {
-    cerr << ReadFrom() << "Attempting to get single data value from multiple lines in element "
-         << name << endl;
-    return HUGE_VAL;
+    cerr << ReadFrom() << "Attempting to get single data value in element "
+         << "<" << name << ">" << endl
+         << " from multiple lines:" << endl;
+    for(unsigned int i=0; i<data_lines.size(); ++i)
+      cerr << data_lines[i] << endl;
+    exit(-1);
   }
 }
 
@@ -634,9 +633,11 @@ void Element::Print(unsigned int level)
   level+=2;
   for (spaces=0; spaces<=level; spaces++) cout << " "; // format output
   cout << "Element Name: " << name;
-  for (i=0; i<attributes.size(); i++) {
-    cout << "  " << attribute_key[i] << " = " << attributes[attribute_key[i]];
-  }
+
+  map<string, string>::iterator it;
+  for (it = attributes.begin(); it != attributes.end(); ++it)
+    cout << "  " << it->first << " = " << it->second;
+
   cout << endl;
   for (i=0; i<data_lines.size(); i++) {
     for (spaces=0; spaces<=level; spaces++) cout << " "; // format output
@@ -651,7 +652,6 @@ void Element::Print(unsigned int level)
 
 void Element::AddAttribute(const string& name, const string& value)
 {
-  attribute_key.push_back(name);
   attributes[name] = value;
 }
 
index b4fa5352f4a03f65dc0c6cbfacf2f86a1c253da0..9224b1eb87e2551ddb016d1a49f268648beb67ea 100755 (executable)
@@ -38,13 +38,14 @@ INCLUDES
 #include <map>
 #include <vector>
 
+#include "FGJSBBase.h"
 #include "math/FGColumnVector3.h"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_XMLELEMENT "$Id: FGXMLElement.h,v 1.18 2013/11/16 14:51:20 bcoconni Exp $"
+#define ID_XMLELEMENT "$Id: FGXMLElement.h,v 1.20 2014/01/13 10:46:02 ehofman Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -136,7 +137,7 @@ CLASS DOCUMENTATION
     - GAL = gallon (U.S. liquid) 
 
     @author Jon S. Berndt
-    @version $Id: FGXMLElement.h,v 1.18 2013/11/16 14:51:20 bcoconni Exp $
+    @version $Id: FGXMLElement.h,v 1.20 2014/01/13 10:46:02 ehofman Exp $
 */
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -363,7 +364,6 @@ private:
   std::map <std::string, std::string> attributes;
   std::vector <std::string> data_lines;
   std::vector <Element*> children;
-  std::vector <std::string> attribute_key;
   Element *parent;
   unsigned int element_index;
   std::string file_name;
index c921427028757c57172796566f5d8e4fa9b16b9c..1c912862a37072dc0b8500a0c8b84a2194b381db 100755 (executable)
@@ -43,7 +43,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_XMLFILEREAD "$Id: FGXMLFileRead.h,v 1.8 2013/11/24 11:40:55 bcoconni Exp $"
+#define ID_XMLFILEREAD "$Id: FGXMLFileRead.h,v 1.9 2013/12/01 14:33:51 bcoconni Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -58,7 +58,7 @@ public:
 
   Element* LoadXMLDocument(std::string XML_filename, bool verbose=true)
   {
-    return LoadXMLDocument(XML_filename, file_parser, true);
+    return LoadXMLDocument(XML_filename, file_parser, verbose);
   }
 
   Element* LoadXMLDocument(std::string XML_filename, FGXMLParse& fparse, bool verbose=true)
index 3710f14f5de3c4405f5cbddc8736700f57fc73ff..e6b4c87c0493ded74ee6398f47990ccc284250cd 100755 (executable)
@@ -40,8 +40,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGXMLParse.cpp,v 1.12 2013/11/16 14:51:20 bcoconni Exp $";
-static const char *IdHdr = ID_XMLPARSE;
+IDENT(IdSrc,"$Id: FGXMLParse.cpp,v 1.14 2014/01/13 10:46:03 ehofman Exp $");
+IDENT(IdHdr,ID_XMLPARSE);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
index d1edb67394876a630d64a7fd39311f8437d78143..843fb75d5e7a528b6f690fbb32f9117ec70fcc2d 100644 (file)
@@ -52,8 +52,8 @@ using std::string;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGfdmSocket.cpp,v 1.27 2010/05/13 03:07:59 jberndt Exp $";
-static const char *IdHdr = ID_FDMSOCKET;
+IDENT(IdSrc,"$Id: FGfdmSocket.cpp,v 1.29 2014/01/13 10:46:03 ehofman Exp $");
+IDENT(IdHdr,ID_FDMSOCKET);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
index aa64f64c40872a4a0d4da91808ad8d3e0daa73bc..d25e258b351beab95ae390405a7ab3bce70e9d98 100644 (file)
@@ -44,11 +44,12 @@ INCLUDES
 #include <vector>
 #include <stdio.h>
 
+
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_STRINGUTILS "$Id: string_utilities.h,v 1.16 2013/11/17 05:14:21 jberndt Exp $"
+#define ID_STRINGUTILS "$Id: string_utilities.h,v 1.18 2014/01/13 10:46:03 ehofman Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -168,16 +169,16 @@ CLASS DECLARATION
 
   string to_string(float x)
   {
-    std::ostringstream o;\r
-    if (!(o << x)) cerr << "Bad float to string conversion" << endl;\r
-    return o.str();\r
+    std::ostringstream o;
+    if (!(o << x)) cerr << "Bad float to string conversion" << endl;
+    return o.str();
   }
 
   string to_string(double x)
   {
-    std::ostringstream o;\r
-    if (!(o << x)) cerr << "Bad double to string conversion" << endl;\r
-    return o.str();\r
+    std::ostringstream o;
+    if (!(o << x)) cerr << "Bad double to string conversion" << endl;
+    return o.str();
   }
 
   string replace(string str, const string& oldstr, const string& newstr)
index beab994f514b967909a6cb96abbd3e0576fef58b..95f97135fe6402edaa0285717661874f5b7a9908 100644 (file)
@@ -37,6 +37,7 @@ HISTORY
 INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
+#include "FGJSBBase.h"
 #include "FGColumnVector3.h"
 #include <iostream>
 #include <sstream>
@@ -47,8 +48,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGColumnVector3.cpp,v 1.15 2012/02/07 00:27:51 jentron Exp $";
-static const char *IdHdr = ID_COLUMNVECTOR3;
+IDENT(IdSrc,"$Id: FGColumnVector3.cpp,v 1.17 2014/01/13 10:46:03 ehofman Exp $");
+IDENT(IdHdr,ID_COLUMNVECTOR3);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
index d0f83cc624e3b9134307d4b852e07bc9d79c44dc..cd66076c6d86174ce1f7cc3e0553f278aaa0363f 100644 (file)
@@ -46,7 +46,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_COLUMNVECTOR3 "$Id: FGColumnVector3.h,v 1.17 2011/12/10 15:49:21 bcoconni Exp $"
+#define ID_COLUMNVECTOR3 "$Id: FGColumnVector3.h,v 1.18 2013/11/30 10:25:33 bcoconni Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -60,7 +60,7 @@ CLASS DOCUMENTATION
 
 /** This class implements a 3 element column vector.
     @author Jon S. Berndt, Tony Peden, et. al.
-    @version $Id: FGColumnVector3.h,v 1.17 2011/12/10 15:49:21 bcoconni Exp $
+    @version $Id: FGColumnVector3.h,v 1.18 2013/11/30 10:25:33 bcoconni Exp $
 */
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -240,17 +240,17 @@ public:
       is equal to zero it is left untouched.   */
   FGColumnVector3& Normalize(void);
 
-  /** Dot product of two vectors
-      Compute and return the euclidean dot (or scalar) product of two vectors
-      v1 and v2 */
-  friend double DotProduct(const FGColumnVector3& v1, const FGColumnVector3& v2) {
-    return v1.data[0]*v2.data[0] + v1.data[1]*v2.data[1] + v1.data[2]*v2.data[2];
-  }
-
 private:
   double data[3];
 };
 
+/** Dot product of two vectors
+    Compute and return the euclidean dot (or scalar) product of two vectors
+    v1 and v2 */
+inline double DotProduct(const FGColumnVector3& v1, const FGColumnVector3& v2) {
+  return v1(1)*v2(1) + v1(2)*v2(2) + v1(3)*v2(3);
+}
+
 /** Scalar multiplication.
     @param scalar scalar value to multiply with.
     @param A Vector to multiply.
index e24cd2f621e1e601f0c3b5ee6e2b19606437504a..34b2988270881c27fe26ee85434e20c1ac8bc4c0 100644 (file)
@@ -45,8 +45,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGCondition.cpp,v 1.18 2013/01/26 17:06:49 bcoconni Exp $";
-static const char *IdHdr = ID_CONDITION;
+IDENT(IdSrc,"$Id: FGCondition.cpp,v 1.20 2014/01/13 10:46:03 ehofman Exp $");
+IDENT(IdHdr,ID_CONDITION);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
index 6beeedb89b21cf0da66abc7cce33872074b72e6c..2aeef75c00dd8088338ed1b496cb57c363ee0efc 100755 (executable)
@@ -43,8 +43,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGFunction.cpp,v 1.53 2013/09/27 19:42:08 jberndt Exp $";
-static const char *IdHdr = ID_FUNCTION;
+IDENT(IdSrc,"$Id: FGFunction.cpp,v 1.55 2014/01/13 10:46:03 ehofman Exp $");
+IDENT(IdHdr,ID_FUNCTION);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
index 12afdadde51f00371c4b068d192812c329d0788c..88a1946b7a705c3766e39d627aec4527b2afbdf2 100644 (file)
@@ -47,8 +47,8 @@ INCLUDES
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGLocation.cpp,v 1.30 2013/10/19 17:59:51 bcoconni Exp $";
-static const char *IdHdr = ID_LOCATION;
+IDENT(IdSrc,"$Id: FGLocation.cpp,v 1.32 2014/01/13 10:46:03 ehofman Exp $");
+IDENT(IdHdr,ID_LOCATION);
 using std::cerr;
 using std::endl;
 
index ef41cfb784ec1e0f89bfbb6c90ee2662eeada89d..1cc0d46ae0c8b4e8bb61446c2d770758050082e7 100644 (file)
@@ -49,8 +49,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGMatrix33.cpp,v 1.14 2012/11/22 22:04:06 bcoconni Exp $";
-static const char *IdHdr = ID_MATRIX33;
+IDENT(IdSrc,"$Id: FGMatrix33.cpp,v 1.16 2014/01/13 10:46:03 ehofman Exp $");
+IDENT(IdHdr,ID_MATRIX33);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
index 200a67db182a23bce62b4aaa665c1495a7f85d25..957bf069712da26dbab3a1430fc84439720f027f 100755 (executable)
@@ -41,14 +41,15 @@ INCLUDES
 #include <sstream>
 #include <string>
 #include "FGModelFunctions.h"
+#include "FGFunction.h"
 #include "input_output/FGXMLElement.h"
 
 using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGModelFunctions.cpp,v 1.7 2013/11/24 11:40:55 bcoconni Exp $";
-static const char *IdHdr = ID_MODELFUNCTIONS;
+IDENT(IdSrc,"$Id: FGModelFunctions.cpp,v 1.12 2014/01/13 10:46:03 ehofman Exp $");
+IDENT(IdHdr,ID_MODELFUNCTIONS);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
@@ -56,9 +57,6 @@ CLASS IMPLEMENTATION
 
 FGModelFunctions::~FGModelFunctions()
 {
-  for (unsigned int i=0; i<interface_properties.size(); i++) delete interface_properties[i];
-  interface_properties.clear();
-
   for (unsigned int i=0; i<PreFunctions.size(); i++) delete PreFunctions[i];
   for (unsigned int i=0; i<PostFunctions.size(); i++) delete PostFunctions[i];
 
@@ -67,34 +65,18 @@ FGModelFunctions::~FGModelFunctions()
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-bool FGModelFunctions::Load(Element* el, FGPropertyManager* PM, string prefix)
+bool FGModelFunctions::InitModel(void)
 {
-  // Interface properties are all stored in the interface properties array.
-  string interface_property_string = "";
-
-  Element *property_element = el->FindElement("property");
-  if (property_element && debug_lvl > 0) cout << endl << "    Declared properties" 
-                                              << endl << endl;
-  while (property_element) {
-    interface_property_string = property_element->GetDataLine();
-    if (PM->HasNode(interface_property_string)) {
-      cerr << "      Property " << interface_property_string 
-           << " is already defined." << endl;
-    } else {
-      double value=0.0;
-      if ( ! property_element->GetAttributeValue("value").empty())
-        value = property_element->GetAttributeValueAsNumber("value");
-      interface_properties.push_back(new double(value));
-      PM->Tie(interface_property_string, interface_properties.back());
-      if (debug_lvl > 0)
-        cout << "      " << interface_property_string << " (initial value: " 
-             << value << ")" << endl << endl;
-    }
-    property_element = el->FindNextElement("property");
-  }
-  
-  // End of interface property loading logic
+  ResetToIC();
 
+  return true;
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+bool FGModelFunctions::Load(Element* el, FGPropertyManager* PM, string prefix)
+{
+  LoadProperties(el, PM, false);
   PreLoad(el, PM, prefix);
 
   return true; // TODO: Need to make this value mean something.
index 6b56e2483a70d459fe51764b56334e916f5c86ee..f67c203fb23567216a30d110d4cdaf314af84d41 100755 (executable)
@@ -34,16 +34,18 @@ SENTRY
 INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#include "FGJSBBase.h"
 #include <vector>
-#include "math/FGFunction.h"
-#include "input_output/FGPropertyManager.h"
+#include <map>
+#include <list>
+
+#include "FGJSBBase.h"
+#include "input_output/FGPropertyReader.h"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_MODELFUNCTIONS "$Id: FGModelFunctions.h,v 1.6 2013/11/24 11:40:55 bcoconni Exp $"
+#define ID_MODELFUNCTIONS "$Id: FGModelFunctions.h,v 1.9 2014/01/02 22:37:48 bcoconni Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -51,6 +53,10 @@ FORWARD DECLARATIONS
 
 namespace JSBSim {
 
+class FGFunction;
+class Element;
+class FGPropertyManager;
+
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DOCUMENTATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@@ -72,7 +78,7 @@ CLASS DOCUMENTATION
 DECLARATION: FGModelFunctions
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-class FGModelFunctions : public FGJSBBase
+class FGModelFunctions : public FGPropertyReader, public FGJSBBase
 {
 public:
   virtual ~FGModelFunctions();
@@ -96,7 +102,8 @@ public:
 protected:
   std::vector <FGFunction*> PreFunctions;
   std::vector <FGFunction*> PostFunctions;
-  std::vector <double*> interface_properties;
+
+  virtual bool InitModel(void);
 };
 
 } // namespace JSBSim
old mode 100644 (file)
new mode 100755 (executable)
index c38cb5d..9484994
@@ -68,9 +68,8 @@ void FGNelderMead::update()
         {
             if (std::abs(minCost-minCostPrevResize) < std::numeric_limits<float>::epsilon())
             {
-                throw std::runtime_error("unable to escape local minimum!");
                 m_status = -1;
-                return;
+                throw std::runtime_error("unable to escape local minimum!");
             }
             //std::cout << "reinitializing step size" << std::endl;
             guess = m_simplex[m_iMin];
@@ -90,7 +89,6 @@ void FGNelderMead::update()
         {
             m_status = -1;
             throw;
-            return;
         }
     }
 
@@ -120,7 +118,6 @@ void FGNelderMead::update()
     {
         m_status = -1;
         throw std::runtime_error("max iterations exceeded!");
-        return;
     }
     // check for convergence break condition
     else if ( m_cost[m_iMin] < abstol )
@@ -243,9 +240,8 @@ void FGNelderMead::update()
 
     catch (const std::exception & e)
     {
-        throw;
         m_status = -1;
-        return;
+        throw;
     }
 
     // iteration
@@ -374,9 +370,8 @@ double FGNelderMead::eval(const std::vector<double> & vertex, bool check)
         } else {
             return cost1;
         }
-    } else {
-        return m_f->eval(vertex);
     }
+    return m_f->eval(vertex);
 }
 
 } // JSBSim
index f4b759154f32aafc73769e37940b76743d3c5b19..ff25cb379bf8f8bedd299618f98b746e1194d8a7 100755 (executable)
@@ -34,8 +34,8 @@ INCLUDES
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGPropertyValue.cpp,v 1.9 2013/09/27 19:42:53 jberndt Exp $";
-static const char *IdHdr = ID_PROPERTYVALUE;
+IDENT(IdSrc,"$Id: FGPropertyValue.cpp,v 1.11 2014/01/13 10:46:03 ehofman Exp $");
+IDENT(IdHdr,ID_PROPERTYVALUE);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
index 6f0295555e80239de6649d13884b5a79a1432b9c..7dfbc538ee63825f78b33b7f8ca8dd14df3893e2 100644 (file)
@@ -58,8 +58,8 @@ using std::endl;
 
 namespace JSBSim {
   
-static const char *IdSrc = "$Id: FGQuaternion.cpp,v 1.22 2012/09/17 12:27:44 jberndt Exp $";
-static const char *IdHdr = ID_QUATERNION;
+IDENT(IdSrc,"$Id: FGQuaternion.cpp,v 1.24 2014/01/13 10:46:03 ehofman Exp $");
+IDENT(IdHdr,ID_QUATERNION);
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
old mode 100644 (file)
new mode 100755 (executable)
index a30f9fc..54d1857
@@ -32,8 +32,8 @@ INCLUDES
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGRealValue.cpp,v 1.4 2009/08/30 03:51:28 jberndt Exp $";
-static const char *IdHdr = ID_REALVALUE;
+IDENT(IdSrc,"$Id: FGRealValue.cpp,v 1.6 2014/01/13 10:46:03 ehofman Exp $");
+IDENT(IdHdr,ID_REALVALUE);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
index bc3dabc0796abefa62dcd723e0c9aef367e4273f..da2117c4d569af4b9884daa2bbfb390efbccd22b 100644 (file)
@@ -33,6 +33,7 @@
 #include <iostream>
 #include <cmath>
 
+#include "FGJSBBase.h"
 #include "FGRungeKutta.h"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -44,8 +45,8 @@ using std::endl;
 
 namespace JSBSim {
   
-static const char *IdSrc = "$Id: FGRungeKutta.cpp,v 1.1 2010/06/02 04:05:13 jberndt Exp $";
-static const char *IdHdr = ID_RUNGEKUTTA;
+IDENT(IdSrc,"$Id: FGRungeKutta.cpp,v 1.3 2014/01/13 10:46:03 ehofman Exp $");
+IDENT(IdHdr,ID_RUNGEKUTTA);
 
 const double FGRungeKutta::RealLimit = 1e30;
 
index 2bc2b7499a0b797b012cbf864dd22970330d97b4..8b951f86e92b58f71868e7cff98589fd1f9ea210 100644 (file)
@@ -47,8 +47,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGTable.cpp,v 1.29 2013/01/26 17:06:49 bcoconni Exp $";
-static const char *IdHdr = ID_TABLE;
+IDENT(IdSrc,"$Id: FGTable.cpp,v 1.31 2014/01/13 10:46:03 ehofman Exp $");
+IDENT(IdHdr,ID_TABLE);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
index 605d1974fca9155f275d92a926132c73bbc5af2f..bc5c71196da8b23605a53d3c3a2c7e6ca9ef5d9f 100644 (file)
@@ -60,8 +60,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGAccelerations.cpp,v 1.14 2012/09/15 17:00:56 bcoconni Exp $";
-static const char *IdHdr = ID_ACCELERATIONS;
+IDENT(IdSrc,"$Id: FGAccelerations.cpp,v 1.19 2014/01/13 10:46:03 ehofman Exp $");
+IDENT(IdHdr,ID_ACCELERATIONS);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
@@ -97,6 +97,8 @@ FGAccelerations::~FGAccelerations(void)
 
 bool FGAccelerations::InitModel(void)
 {
+  if (!FGModel::InitModel()) return false;
+
   vPQRidot.InitMatrix();
   vUVWidot.InitMatrix();
   vGravAccel.InitMatrix();
@@ -364,6 +366,7 @@ void FGAccelerations::bind(void)
   PropertyManager->Tie("accelerations/vdot-ft_sec2", this, eV, (PMF)&FGAccelerations::GetUVWdot);
   PropertyManager->Tie("accelerations/wdot-ft_sec2", this, eW, (PMF)&FGAccelerations::GetUVWdot);
 
+  PropertyManager->Tie("accelerations/gravity-ft_sec2", this, &FGAccelerations::GetGravAccelMagnitude);
   PropertyManager->Tie("simulation/gravity-model", &gravType);
   PropertyManager->Tie("simulation/gravitational-torque", &gravTorque);
 
index 0a83d55a817f51aa83e7df7bb17f6182528bf640..2fd4386b3e6f0b7ebbc576bc25d7f67bbe2c0aec 100644 (file)
@@ -50,7 +50,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_ACCELERATIONS "$Id: FGAccelerations.h,v 1.14 2012/09/25 12:44:36 jberndt Exp $"
+#define ID_ACCELERATIONS "$Id: FGAccelerations.h,v 1.15 2013/11/29 18:56:30 jberndt Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -97,7 +97,7 @@ CLASS DOCUMENTATION
          NASA SP-8024, May 1969
 
     @author Jon S. Berndt, Mathias Froehlich, Bertrand Coconnier
-    @version $Id: FGAccelerations.h,v 1.14 2012/09/25 12:44:36 jberndt Exp $
+    @version $Id: FGAccelerations.h,v 1.15 2013/11/29 18:56:30 jberndt Exp $
   */
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -235,6 +235,8 @@ public:
 
   const FGColumnVector3& GetGravAccel(void) const {return vGravAccel; }
 
+  double GetGravAccelMagnitude(void) const { return vGravAccel.Magnitude(); }
+
   /** Retrieves a component of the acceleration resulting from the applied forces.
       Retrieves a component of the ratio between the sum of all forces applied
       on the craft to its mass. The value returned is extracted from the vBodyAccel
index 494fa41ca7baf1d16d890daf144fae4c00414662..9d97c937aea37084840e5be3019d1ba130fcafed 100644 (file)
@@ -40,6 +40,7 @@ INCLUDES
 #include <sstream>
 #include <iomanip>
 #include <cstdlib>
+
 #include "FGFDMExec.h"
 #include "FGAerodynamics.h"
 #include "input_output/FGPropertyManager.h"
@@ -50,8 +51,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGAerodynamics.cpp,v 1.49 2013/11/24 11:40:55 bcoconni Exp $";
-static const char *IdHdr = ID_AERODYNAMICS;
+IDENT(IdSrc,"$Id: FGAerodynamics.cpp,v 1.52 2014/01/13 10:46:04 ehofman Exp $");
+IDENT(IdHdr,ID_AERODYNAMICS);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
@@ -130,7 +131,8 @@ bool FGAerodynamics::InitModel(void)
   bi2vel = ci2vel = 0.0;
   AeroRPShift = 0;
   vDeltaRP.InitMatrix();
-
+  vForces.InitMatrix();
+  vMoments.InitMatrix();
   return true;
 }
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index fe46509df0e29ddfd20cefef191269d9be177f08..0c7d90f5e3bee9a234b4895ed3697dd71fce6cef 100644 (file)
@@ -60,8 +60,8 @@ DEFINITIONS
 GLOBAL DATA
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-static const char *IdSrc = "$Id: FGAircraft.cpp,v 1.35 2013/11/24 11:40:55 bcoconni Exp $";
-static const char *IdHdr = ID_AIRCRAFT;
+IDENT(IdSrc,"$Id: FGAircraft.cpp,v 1.39 2014/01/13 10:46:04 ehofman Exp $");
+IDENT(IdHdr,ID_AIRCRAFT);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
@@ -95,6 +95,11 @@ FGAircraft::~FGAircraft()
 
 bool FGAircraft::InitModel(void)
 {
+  if (!FGModel::InitModel()) return false;
+
+  vForces.InitMatrix();
+  vMoments.InitMatrix();
+
   return true;
 }
 
@@ -131,7 +136,7 @@ bool FGAircraft::Load(Element* el)
   string element_name;
   Element* element;
 
-  FGModel::Load(el);
+  if (!FGModel::Load(el)) return false;
 
   if (el->FindElement("wingarea"))
     WingArea = el->FindElementValueAsNumberConvertTo("wingarea", "FT2");
index 9ac2439fd52dffd0ff08d866043acf4b6be18a65..5ad8ad3b2ddde231eb961edab74059043a1e2f47 100644 (file)
@@ -50,8 +50,8 @@ INCLUDES
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGAtmosphere.cpp,v 1.55 2013/01/26 17:06:49 bcoconni Exp $";
-static const char *IdHdr = ID_ATMOSPHERE;
+IDENT(IdSrc,"$Id: FGAtmosphere.cpp,v 1.58 2014/01/13 10:46:04 ehofman Exp $");
+IDENT(IdHdr,ID_ATMOSPHERE);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
@@ -80,6 +80,8 @@ FGAtmosphere::~FGAtmosphere()
 
 bool FGAtmosphere::InitModel(void)
 {
+  if (!FGModel::InitModel()) return false;
+
   Calculate(0.0);
   SLtemperature = Temperature = 518.67;
   SLpressure = Pressure = 2116.22;
old mode 100644 (file)
new mode 100755 (executable)
index 492458d..07133bc
@@ -50,8 +50,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGAuxiliary.cpp,v 1.62 2013/09/11 12:43:20 jberndt Exp $";
-static const char *IdHdr = ID_AUXILIARY;
+IDENT(IdSrc,"$Id: FGAuxiliary.cpp,v 1.65 2014/01/13 10:46:06 ehofman Exp $");
+IDENT(IdHdr,ID_AUXILIARY);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
@@ -96,6 +96,8 @@ FGAuxiliary::FGAuxiliary(FGFDMExec* fdmex) : FGModel(fdmex)
 
 bool FGAuxiliary::InitModel(void)
 {
+  if (!FGModel::InitModel()) return false;
+
   pt = in.Pressure;
   tat = in.Temperature;
   tatc = RankineToCelsius(tat);
index 078acbd717205a61eec34b19c02f1ec0ad6c3fed..68c945adc003870795b89475740648a8b64a6b6a 100644 (file)
@@ -48,8 +48,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGBuoyantForces.cpp,v 1.22 2013/11/24 11:40:55 bcoconni Exp $";
-static const char *IdHdr = ID_BUOYANTFORCES;
+IDENT(IdSrc,"$Id: FGBuoyantForces.cpp,v 1.26 2014/01/13 10:46:06 ehofman Exp $");
+IDENT(IdHdr,ID_BUOYANTFORCES);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
@@ -83,6 +83,11 @@ FGBuoyantForces::~FGBuoyantForces()
 
 bool FGBuoyantForces::InitModel(void)
 {
+  if (!FGModel::InitModel()) return false;
+
+  vTotalForces.InitMatrix();
+  vTotalMoments.InitMatrix();
+
   return true;
 }
 
@@ -140,7 +145,7 @@ bool FGBuoyantForces::Load(Element *element)
     gas_cell_element = document->FindNextElement("gas_cell");
   }
   
-  PostLoad(element, PropertyManager);
+  PostLoad(document, PropertyManager);
 
   if (!NoneDefined) {
     bind();
old mode 100644 (file)
new mode 100755 (executable)
index 2493257..010b311
@@ -60,8 +60,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGExternalForce.cpp,v 1.12 2012/12/23 14:56:58 bcoconni Exp $";
-static const char *IdHdr = ID_EXTERNALFORCE;
+IDENT(IdSrc,"$Id: FGExternalForce.cpp,v 1.14 2014/01/13 10:46:07 ehofman Exp $");
+IDENT(IdHdr,ID_EXTERNALFORCE);
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
index 730b790131c271f9216b35eee5f8f68fb639894e..6e72838b65d1c366615f1f61ff7ba892883dc3ed 100755 (executable)
@@ -55,8 +55,8 @@ DEFINITIONS
 GLOBAL DATA
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-static const char *IdSrc = "$Id: FGExternalReactions.cpp,v 1.13 2013/11/24 11:40:56 bcoconni Exp $";
-static const char *IdHdr = ID_EXTERNALREACTIONS;
+IDENT(IdSrc,"$Id: FGExternalReactions.cpp,v 1.17 2014/01/13 10:46:07 ehofman Exp $");
+IDENT(IdHdr,ID_EXTERNALREACTIONS);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
@@ -119,6 +119,11 @@ FGExternalReactions::~FGExternalReactions()
 
 bool FGExternalReactions::InitModel(void)
 {
+  if (!FGModel::InitModel()) return false;
+
+  vTotalForces.InitMatrix();
+  vTotalMoments.InitMatrix();
+
   return true;
 }
 
index 59deaafa2128bb8e09d44be7758b5e7d8091e24f..fcb9a3f358ecf20b741a9430f438ad4dad4e66ec 100644 (file)
@@ -71,8 +71,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGFCS.cpp,v 1.83 2013/11/24 11:40:56 bcoconni Exp $";
-static const char *IdHdr = ID_FCS;
+IDENT(IdSrc,"$Id: FGFCS.cpp,v 1.87 2014/01/13 10:46:07 ehofman Exp $");
+IDENT(IdHdr,ID_FCS);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
@@ -124,6 +124,8 @@ FGFCS::~FGFCS()
 
 bool FGFCS::InitModel(void)
 {
+  if (!FGModel::InitModel()) return false;
+
   unsigned int i;
 
   for (i=0; i<ThrottlePos.size(); i++) ThrottlePos[i] = 0.0;
@@ -539,33 +541,8 @@ bool FGFCS::Load(Element* el, SystemType systype)
   // systems to be defined in a file, with overrides or initial loaded constants
   // supplied in the relevant element of the aircraft configuration file.
 
-  Element* property_element = 0;
-
-  if (!fname.empty()) {
-    property_element = el->FindElement("property");
-    if (property_element && debug_lvl > 0) cout << endl << "    Overriding properties" << endl << endl;
-    while (property_element) {
-      double value=0.0;
-      if ( ! property_element->GetAttributeValue("value").empty())
-        value = property_element->GetAttributeValueAsNumber("value");
-
-      interface_property_string = property_element->GetDataLine();
-      if (PropertyManager->HasNode(interface_property_string)) {
-        FGPropertyNode* node = PropertyManager->GetNode(interface_property_string);
-        if (debug_lvl > 0)
-          cout << "      " << "Overriding value for property " << interface_property_string
-               << " (old value: " << node->getDoubleValue() << "  new value: " << value << ")" << endl;
-        node->setDoubleValue(value);
-      } else {
-        interface_properties.push_back(new double(value));
-        PropertyManager->Tie(interface_property_string, interface_properties.back());
-        if (debug_lvl > 0)
-          cout << "      " << interface_property_string << " (initial value: " << value << ")" << endl;
-      }
-      
-      property_element = el->FindNextElement("property");
-    }
-  }
+  if (!fname.empty())
+    LoadProperties(el, PropertyManager, true);
 
   channel_element = document->FindElement("channel");
   
index cb2686f0bbef0d12d3d98d45b552b0168c6ecad4..6d9b440858413ca744461070a27a0807eef07fc6 100755 (executable)
@@ -44,7 +44,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_FCSCHANNEL "$Id: FGFCSChannel.h,v 1.3 2013/09/27 19:44:45 jberndt Exp $"
+#define ID_FCSCHANNEL "$Id: FGFCSChannel.h,v 1.4 2013/12/22 15:21:51 bcoconni Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -97,18 +97,8 @@ public:
   }
   /// Reset the components that can be reset
   void Reset() {
-    for (unsigned int i=0; i<FCSComponents.size(); i++) {
-      if (FCSComponents[i]->GetType() == "LAG" ||
-          FCSComponents[i]->GetType() == "LEAD_LAG" ||
-          FCSComponents[i]->GetType() == "WASHOUT" ||
-          FCSComponents[i]->GetType() == "SECOND_ORDER_FILTER" ||
-          FCSComponents[i]->GetType() == "INTEGRATOR")
-      {
-        ((FGFilter*)FCSComponents[i])->ResetPastStates();
-      } else if (FCSComponents[i]->GetType() == "PID" ) {
-        ((FGPID*)FCSComponents[i])->ResetPastStates();
-      }
-    }
+    for (unsigned int i=0; i<FCSComponents.size(); i++)
+      FCSComponents[i]->ResetPastStates();
   }
   /// Executes all the components in a channel.
   void Execute() {
index 77e547412f05101081e943015eb7f22fd74cbc43..7a5626650c5a952f22ebf470dfe3654b02096ae2 100644 (file)
@@ -50,8 +50,8 @@ using std::max;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGGasCell.cpp,v 1.18 2013/04/17 20:24:27 andgi Exp $";
-static const char *IdHdr = ID_GASCELL;
+IDENT(IdSrc,"$Id: FGGasCell.cpp,v 1.20 2014/01/13 10:46:07 ehofman Exp $");
+IDENT(IdHdr,ID_GASCELL);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
index 1a0970af1ed2e58128c9289498035d53c22275ae..42a66f29353ad83156337150586e757a77388a14 100644 (file)
@@ -49,8 +49,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGGroundReactions.cpp,v 1.43 2013/11/24 11:40:56 bcoconni Exp $";
-static const char *IdHdr = ID_GROUNDREACTIONS;
+IDENT(IdSrc,"$Id: FGGroundReactions.cpp,v 1.47 2014/01/13 10:46:07 ehofman Exp $");
+IDENT(IdHdr,ID_GROUNDREACTIONS);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
@@ -79,6 +79,16 @@ FGGroundReactions::~FGGroundReactions(void)
 
 bool FGGroundReactions::InitModel(void)
 {
+  if (!FGModel::InitModel()) return false;
+
+  vForces.InitMatrix();
+  vMoments.InitMatrix();
+
+  multipliers.clear();
+
+  for (unsigned int i=0; i<lGear.size(); i++)
+    lGear[i]->ResetToIC();
+
   return true;
 }
 
@@ -102,7 +112,7 @@ bool FGGroundReactions::Run(bool Holding)
   // Perhaps there is some commonality for things which only need to be
   // calculated once.
   for (unsigned int i=0; i<lGear.size(); i++) {
-    vForces  += lGear[i]->GetBodyForces();
+    vForces  += lGear[i]->GetBodyForces(this);
     vMoments += lGear[i]->GetMoments();
   }
 
@@ -251,7 +261,6 @@ string FGGroundReactions::GetGroundReactionValues(string delimeter) const
 
 void FGGroundReactions::bind(void)
 {
-  typedef double (FGGroundReactions::*PMF)(int) const;
   PropertyManager->Tie("gear/num-units", this, &FGGroundReactions::GetNumGearUnits);
   PropertyManager->Tie("gear/wow", this, &FGGroundReactions::GetWOW);
 }
index 0619a87717abd3ec88b0ebfabca2b4083fa3d941..339b1c5f84f8e84aab7766c598143fe475a4a6a4 100644 (file)
@@ -40,11 +40,12 @@ INCLUDES
 
 #include <vector>
 
+#include "FGSurface.h"
 #include "FGModel.h"
 #include "FGLGear.h"
 #include "math/FGColumnVector3.h"
 
-#define ID_GROUNDREACTIONS "$Id: FGGroundReactions.h,v 1.27 2013/11/24 11:40:56 bcoconni Exp $"
+#define ID_GROUNDREACTIONS "$Id: FGGroundReactions.h,v 1.28 2014/01/16 09:03:04 ehofman Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -77,7 +78,7 @@ CLASS DOCUMENTATION
 CLASS DECLARATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-class FGGroundReactions : public FGModel
+class FGGroundReactions : public FGModel, public FGSurface
 {
 public:
   FGGroundReactions(FGFDMExec*);
index 42f2b77110fe8e5ca7843626cda99e905317edab..8a6aeec3f4a4e10b17c5c0a6a226fe96ebfab46f 100644 (file)
@@ -43,8 +43,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGInertial.cpp,v 1.26 2011/12/11 17:03:05 bcoconni Exp $";
-static const char *IdHdr = ID_INERTIAL;
+IDENT(IdSrc,"$Id: FGInertial.cpp,v 1.29 2014/01/13 10:46:07 ehofman Exp $");
+IDENT(IdHdr,ID_INERTIAL);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
@@ -95,7 +95,7 @@ FGInertial::~FGInertial(void)
 
 bool FGInertial::InitModel(void)
 {
-  return true;
+  return FGModel::InitModel();
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index f4b5328ccb522f179e948d2f1a6f932d45847c0b..d283fc728c872ccd8a7ddb808f9874c41392d930 100644 (file)
@@ -47,7 +47,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_INERTIAL "$Id: FGInertial.h,v 1.21 2012/11/23 21:42:29 bcoconni Exp $"
+#define ID_INERTIAL "$Id: FGInertial.h,v 1.22 2013/11/30 21:22:08 jberndt Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -87,6 +87,10 @@ public:
   double gravity(void) const {return gAccel;}
   double omega(void) const {return RotationRate;}
   const FGColumnVector3& GetOmegaPlanet() const {return vOmegaPlanet;}
+  void SetOmegaPlanet(double rate) {
+    RotationRate = rate;
+    vOmegaPlanet = FGColumnVector3( 0.0, 0.0, RotationRate );
+  }
   double GetGAccel(double r) const;
   FGColumnVector3 GetGravityJ2(const FGColumnVector3& position) const;
   double GetRefRadius(void) const {return RadiusReference;}
old mode 100644 (file)
new mode 100755 (executable)
index d10ceac..6b8c961
@@ -53,8 +53,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGInput.cpp,v 1.25 2013/01/26 17:06:50 bcoconni Exp $";
-static const char *IdHdr = ID_INPUT;
+IDENT(IdSrc,"$Id: FGInput.cpp,v 1.28 2014/01/13 10:46:07 ehofman Exp $");
+IDENT(IdHdr,ID_INPUT);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
@@ -81,7 +81,7 @@ FGInput::~FGInput()
 
 bool FGInput::InitModel(void)
 {
-  return true;
+  return FGModel::InitModel();
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index 3796bffe320e67b81bc6fee62142ae9fd763ceee..631d42c9eb7577c43d09d801a158ec2fe37e762e 100644 (file)
@@ -62,8 +62,8 @@ DEFINITIONS
 GLOBAL DATA
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-static const char *IdSrc = "$Id: FGLGear.cpp,v 1.106 2013/11/24 11:40:56 bcoconni Exp $";
-static const char *IdHdr = ID_LGEAR;
+IDENT(IdSrc,"$Id: FGLGear.cpp,v 1.111 2014/01/16 14:00:30 ehofman Exp $");
+IDENT(IdHdr,ID_LGEAR);
 
 // Body To Structural (body frame is rotated 180 deg about Y and lengths are given in
 // ft instead of inches)
@@ -210,28 +210,12 @@ FGLGear::FGLGear(Element* el, FGFDMExec* fdmex, int number, const struct Inputs&
          << sBrakeGroup << " is undefined." << endl;
   }
 
-  GearPos  = 1.0;
-  useFCSGearPos = false;
-
 // Add some AI here to determine if gear is located properly according to its
 // brake group type ??
 
-  WOW = lastWOW = false;
+  useFCSGearPos = false;
   ReportEnable = true;
-  FirstContact = false;
-  StartedGroundRun = false;
   TakeoffReported = LandingReported = false;
-  LandingDistanceTraveled = TakeoffDistanceTraveled = TakeoffDistanceTraveled50ft = 0.0;
-  MaximumStrutForce = MaximumStrutTravel = 0.0;
-  SinkRate = GroundSpeed = 0.0;
-
-  vWhlVelVec.InitMatrix();
-
-  compressLength  = 0.0;
-  compressSpeed   = 0.0;
-  maxCompLen      = 0.0;
-
-  WheelSlip = 0.0;
 
   // Set Pacejka terms
 
@@ -240,8 +224,7 @@ FGLGear::FGLGear(Element* el, FGFDMExec* fdmex, int number, const struct Inputs&
   Peak = staticFCoeff;
   Curvature = 1.03;
 
-  // Initialize Lagrange multipliers
-  memset(LMultiplier, 0, sizeof(LMultiplier));
+  ResetToIC();
 
   Debug(0);
 }
@@ -257,7 +240,32 @@ FGLGear::~FGLGear()
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-const FGColumnVector3& FGLGear::GetBodyForces(void)
+void FGLGear::ResetToIC(void)
+{
+  GearPos  = 1.0;
+
+  WOW = lastWOW = false;
+  FirstContact = false;
+  StartedGroundRun = false;
+  LandingDistanceTraveled = TakeoffDistanceTraveled = TakeoffDistanceTraveled50ft = 0.0;
+  MaximumStrutForce = MaximumStrutTravel = 0.0;
+  SinkRate = GroundSpeed = 0.0;
+
+  vWhlVelVec.InitMatrix();
+
+  compressLength  = 0.0;
+  compressSpeed   = 0.0;
+  maxCompLen      = 0.0;
+
+  WheelSlip = 0.0;
+
+  // Initialize Lagrange multipliers
+  memset(LMultiplier, 0, sizeof(LMultiplier));
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+const FGColumnVector3& FGLGear::GetBodyForces(FGSurface *surface)
 {
   double gearPos = 1.0;
   double t = fdmex->GetSimTime();
@@ -278,8 +286,17 @@ const FGColumnVector3& FGLGear::GetBodyForces(void)
     // not compressed) with respect to the ground level
     double height = gearLoc.GetContactPoint(t, contact, normal, terrainVel, dummy);
 
+    double maxForce = DBL_MAX;
+    bool isSolid = true;
+    if (surface) {
+      height -= (*surface).GetBumpHeight();
+      frictionFactor = (*surface).GetFrictionFactor();
+      maxForce = (*surface).GetMaximumForce();
+      isSolid =  (*surface).GetSolid();
+    }
+
     if (height < 0.0) {
-      WOW = true;
+      WOW = isSolid;
       vGroundNormal = in.Tec2b * normal;
 
       // The height returned by GetGroundCallback() is the AGL and is expressed
@@ -294,8 +311,14 @@ const FGColumnVector3& FGLGear::GetBodyForces(void)
       // including the strut compression.
       switch(eContactType) {
       case ctBOGEY:
-        compressLength = LGearProj > 0.0 ? height * normalZ / LGearProj : 0.0;
-        vWhlDisplVec = mTGear * FGColumnVector3(0., 0., -compressLength);
+        if (isSolid) {
+          compressLength = LGearProj > 0.0 ? height * normalZ / LGearProj : 0.0;
+          vWhlDisplVec = mTGear * FGColumnVector3(0., 0., -compressLength);
+        } else {
+          // Gears don't (or hardly) compress is liquids
+          compressLength = 0.0;
+          vWhlDisplVec = 0.0 * vGroundNormal;
+        }
         break;
       case ctSTRUCTURE:
         compressLength = height * normalZ / DotProduct(normal, normal);
@@ -308,7 +331,13 @@ const FGColumnVector3& FGLGear::GetBodyForces(void)
       FGColumnVector3 vBodyWhlVel = in.PQR * vWhlContactVec;
       vBodyWhlVel += in.UVW - in.Tec2b * terrainVel;
 
-      vWhlVelVec = mTGear.Transposed() * vBodyWhlVel;
+      if (isSolid) {
+        vWhlVelVec = mTGear.Transposed() * vBodyWhlVel;
+      } else {
+        // wheels don't spin up in liquids: let wheel spin down slowly
+        vWhlVelVec(eX) -= 13.0 * in.TotalDeltaT;
+        if (vWhlVelVec(eX) < 0.0) vWhlVelVec(eX) = 0.0;
+      }
 
       InitializeReporting();
       ComputeSteeringAngle();
@@ -324,7 +353,7 @@ const FGColumnVector3& FGLGear::GetBodyForces(void)
           compressSpeed /= LGearProj;
       }
 
-      ComputeVerticalStrutForce();
+      ComputeVerticalStrutForce(maxForce);
 
       // Compute the friction coefficients in the wheel ground plane.
       if (eContactType == ctBOGEY) {
@@ -546,10 +575,10 @@ void FGLGear::CrashDetect(void)
 
 void FGLGear::ComputeBrakeForceCoefficient(void)
 {
-  BrakeFCoeff = rollingFCoeff;
+  BrakeFCoeff = frictionFactor * rollingFCoeff;
 
   if (eBrakeGrp != bgNone)
-    BrakeFCoeff += in.BrakePos[eBrakeGrp] * (staticFCoeff - rollingFCoeff);
+    BrakeFCoeff += in.BrakePos[eBrakeGrp] * frictionFactor * (staticFCoeff - rollingFCoeff);
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -570,6 +599,7 @@ void FGLGear::ComputeSideForceCoefficient(void)
     double StiffSlip = Stiffness*WheelSlip;
     FCoeff = Peak * sin(Shape*atan(StiffSlip - Curvature*(StiffSlip - atan(StiffSlip))));
   }
+  FCoeff *= frictionFactor;
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -579,7 +609,7 @@ void FGLGear::ComputeSideForceCoefficient(void)
 // possibly give a "rebound damping factor" that differs from the compression
 // case.
 
-void FGLGear::ComputeVerticalStrutForce(void)
+void FGLGear::ComputeVerticalStrutForce(double maxForce)
 {
   double springForce = 0;
   double dampForce = 0;
@@ -606,6 +636,10 @@ void FGLGear::ComputeVerticalStrutForce(void)
     }
 
     StrutForce = min(springForce + dampForce, (double)0.0);
+    if (StrutForce > maxForce) {
+      StrutForce = maxForce;
+      compressLength = -StrutForce / kSpring;
+    }
   }
 
   // The reaction force of the wheel is always normal to the ground
@@ -657,7 +691,7 @@ void FGLGear::ComputeJacobian(const FGColumnVector3& vWhlContactVec)
     LMultiplier[ftDynamic].ForceJacobian = mT * velocityDirection;
     LMultiplier[ftDynamic].MomentJacobian = vWhlContactVec * LMultiplier[ftDynamic].ForceJacobian;
     LMultiplier[ftDynamic].Max = 0.;
-    LMultiplier[ftDynamic].Min = -fabs(dynamicFCoeff * vFn(eZ));
+    LMultiplier[ftDynamic].Min = -fabs(frictionFactor * dynamicFCoeff * vFn(eZ));
 
     // The Lagrange multiplier value obtained from the previous iteration is kept
     // This is supposed to accelerate the convergence of the projected Gauss-Seidel
index 45844e424fa3f711aea2d0e5799d4259ec704b2a..791a6a30a55bcf9d5aa2737a1f448a37739240ee 100644 (file)
@@ -43,12 +43,13 @@ INCLUDES
 #include "models/propulsion/FGForce.h"
 #include "math/FGColumnVector3.h"
 #include "math/LagrangeMultiplier.h"
+#include "FGSurface.h"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_LGEAR "$Id: FGLGear.h,v 1.58 2013/11/15 22:43:01 bcoconni Exp $"
+#define ID_LGEAR "$Id: FGLGear.h,v 1.61 2014/01/16 14:00:42 ehofman Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -177,7 +178,7 @@ CLASS DOCUMENTATION
         </contact>
 @endcode
     @author Jon S. Berndt
-    @version $Id: FGLGear.h,v 1.58 2013/11/15 22:43:01 bcoconni Exp $
+    @version $Id: FGLGear.h,v 1.61 2014/01/16 14:00:42 ehofman Exp $
     @see Richard E. McFarland, "A Standard Kinematic Model for Flight Simulation at
      NASA-Ames", NASA CR-2497, January 1975
     @see Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics",
@@ -190,7 +191,7 @@ CLASS DOCUMENTATION
 CLASS DECLARATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-class FGLGear : public FGForce
+class FGLGear : public FGForce, protected FGSurface
 {
 public:
   struct Inputs {
@@ -237,7 +238,7 @@ public:
   ~FGLGear();
 
   /// The Force vector for this gear
-  const FGColumnVector3& GetBodyForces(void);
+  const FGColumnVector3& GetBodyForces(FGSurface *surface = NULL);
 
   /// Gets the location of the gear in Body axes
   FGColumnVector3 GetBodyLocation(void) const {
@@ -315,6 +316,7 @@ public:
 
   const struct Inputs& in;
 
+  void ResetToIC(void);
   void bind(void);
 
 private:
@@ -332,7 +334,6 @@ private:
   double bDampRebound;
   double compressLength;
   double compressSpeed;
-  double staticFCoeff, dynamicFCoeff, rollingFCoeff;
   double Stiffness, Shape, Peak, Curvature; // Pacejka factors
   double BrakeFCoeff;
   double maxCompLen;
@@ -376,7 +377,7 @@ private:
   void ComputeSteeringAngle(void);
   void ComputeSlipAngle(void);
   void ComputeSideForceCoefficient(void);
-  void ComputeVerticalStrutForce(void);
+  void ComputeVerticalStrutForce(double maxForce = DBL_MAX);
   void ComputeGroundFrame(void);
   void ComputeJacobian(const FGColumnVector3& vWhlContactVec);
   void UpdateForces(void);
index 0226cabd4c0fe06b3e0ffddecdb79ffdb97ac08c..3d24d1b3b38575a7e37fc4b94ea691db8d90f8c4 100644 (file)
@@ -41,6 +41,7 @@ INCLUDES
 #include <iostream>
 #include <iomanip>
 #include <cstdlib>
+
 #include "FGMassBalance.h"
 #include "FGFDMExec.h"
 #include "input_output/FGPropertyManager.h"
@@ -51,8 +52,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGMassBalance.cpp,v 1.43 2013/11/24 11:40:56 bcoconni Exp $";
-static const char *IdHdr = ID_MASSBALANCE;
+IDENT(IdSrc,"$Id: FGMassBalance.cpp,v 1.47 2014/01/13 10:46:07 ehofman Exp $");
+IDENT(IdHdr,ID_MASSBALANCE);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
@@ -92,6 +93,8 @@ FGMassBalance::~FGMassBalance()
 
 bool FGMassBalance::InitModel(void)
 {
+  if (!FGModel::InitModel()) return false;
+
   vLastXYZcg.InitMatrix(0.0);
   vDeltaXYZcg.InitMatrix(0.0);
 
index 79f0cc9e4849e8064eb16d1c184cfc412979a315..d3b6c138725a1f7ace34ca61a835492e131f3922 100644 (file)
@@ -46,8 +46,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGModel.cpp,v 1.21 2013/01/14 22:44:52 bcoconni Exp $";
-static const char *IdHdr = ID_MODEL;
+IDENT(IdSrc,"$Id: FGModel.cpp,v 1.24 2014/01/13 10:46:07 ehofman Exp $");
+IDENT(IdHdr,ID_MODEL);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 GLOBAL DECLARATIONS
@@ -84,7 +84,7 @@ FGModel::~FGModel()
 bool FGModel::InitModel(void)
 {
   exe_ctr = 1;
-  return true;
+  return FGModelFunctions::InitModel();
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index 1593621815d888e6726739399a4b49f80a329cd5..668011d36acf1808b9de687e6648f6b84fd870fe 100644 (file)
@@ -51,8 +51,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGOutput.cpp,v 1.74 2013/11/24 11:40:56 bcoconni Exp $";
-static const char *IdHdr = ID_OUTPUT;
+IDENT(IdSrc,"$Id: FGOutput.cpp,v 1.77 2014/01/13 10:46:07 ehofman Exp $");
+IDENT(IdHdr,ID_OUTPUT);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
@@ -86,6 +86,8 @@ bool FGOutput::InitModel(void)
 {
   bool ret = false;
 
+  if (!FGModel::InitModel()) return false;
+
   vector<FGOutputType*>::iterator it;
   for (it = OutputTypes.begin(); it != OutputTypes.end(); ++it)
     ret &= (*it)->InitModel();
index 12efa827acea3651a8424f28fb4e0e01aafa5cd2..6564df5e4030639588a615407d0fdc905f536511 100644 (file)
@@ -78,8 +78,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGPropagate.cpp,v 1.119 2013/11/24 11:40:56 bcoconni Exp $";
-static const char *IdHdr = ID_PROPAGATE;
+IDENT(IdSrc,"$Id: FGPropagate.cpp,v 1.123 2014/01/13 10:46:07 ehofman Exp $");
+IDENT(IdHdr,ID_PROPAGATE);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
@@ -120,6 +120,8 @@ FGPropagate::~FGPropagate(void)
 
 bool FGPropagate::InitModel(void)
 {
+  if (!FGModel::InitModel()) return false;
+
   // For initialization ONLY:
   VState.vLocation.SetEllipse(in.SemiMajor, in.SemiMinor);
   VState.vLocation.SetAltitudeAGL(4.0, FDMExec->GetSimTime());
@@ -719,6 +721,10 @@ void FGPropagate::bind(void)
   PropertyManager->Tie("velocities/qi-rad_sec", this, eQ, (PMF)&FGPropagate::GetPQRi);
   PropertyManager->Tie("velocities/ri-rad_sec", this, eR, (PMF)&FGPropagate::GetPQRi);
 
+  PropertyManager->Tie("velocities/eci-x-fps", this, eX, (PMF)&FGPropagate::GetInertialVelocity);
+  PropertyManager->Tie("velocities/eci-y-fps", this, eY, (PMF)&FGPropagate::GetInertialVelocity);
+  PropertyManager->Tie("velocities/eci-z-fps", this, eZ, (PMF)&FGPropagate::GetInertialVelocity);
+
   PropertyManager->Tie("velocities/eci-velocity-mag-fps", this, &FGPropagate::GetInertialVelocityMagnitude);
   PropertyManager->Tie("velocities/ned-velocity-mag-fps", this, &FGPropagate::GetNEDVelocityMagnitude);
 
@@ -739,6 +745,14 @@ void FGPropagate::bind(void)
                           &FGPropagate::GetTerrainElevation,
                           &FGPropagate::SetTerrainElevation, false);
 
+  PropertyManager->Tie("position/eci-x-ft", this, eX, (PMF)&FGPropagate::GetInertialPosition);
+  PropertyManager->Tie("position/eci-y-ft", this, eY, (PMF)&FGPropagate::GetInertialPosition);
+  PropertyManager->Tie("position/eci-z-ft", this, eZ, (PMF)&FGPropagate::GetInertialPosition);
+
+  PropertyManager->Tie("position/ecef-x-ft", this, eX, (PMF)&FGPropagate::GetLocation);
+  PropertyManager->Tie("position/ecef-y-ft", this, eY, (PMF)&FGPropagate::GetLocation);
+  PropertyManager->Tie("position/ecef-z-ft", this, eZ, (PMF)&FGPropagate::GetLocation);
+
   PropertyManager->Tie("position/epa-rad", this, &FGPropagate::GetEarthPositionAngle);
   PropertyManager->Tie("metrics/terrain-radius", this, &FGPropagate::GetLocalTerrainRadius);
 
index 5d4acf868b20db033284b1abb45347e75d736838..f0f0129280ceaf9466e2b6c2953cdbce8021fa69 100644 (file)
@@ -49,7 +49,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_PROPAGATE "$Id: FGPropagate.h,v 1.78 2013/09/14 11:26:04 bcoconni Exp $"
+#define ID_PROPAGATE "$Id: FGPropagate.h,v 1.80 2013/12/22 17:08:59 jberndt Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -93,7 +93,7 @@ CLASS DOCUMENTATION
     @endcode
 
     @author Jon S. Berndt, Mathias Froehlich, Bertrand Coconnier
-    @version $Id: FGPropagate.h,v 1.78 2013/09/14 11:26:04 bcoconni Exp $
+    @version $Id: FGPropagate.h,v 1.80 2013/12/22 17:08:59 jberndt Exp $
   */
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -301,10 +301,12 @@ public:
   /** Retrieves the inertial velocity vector in ft/sec.
   */
   const FGColumnVector3& GetInertialVelocity(void) const { return VState.vInertialVelocity; }
+  double GetInertialVelocity(int i) const { return VState.vInertialVelocity(i); }
 
   /** Retrieves the inertial position vector.
   */
   const FGColumnVector3& GetInertialPosition(void) const { return VState.vInertialPosition; }
+  double GetInertialPosition(int i) const { return VState.vInertialPosition(i); }
 
   /** Calculates and retrieves the velocity vector relative to the earth centered earth fixed (ECEF) frame.
   */
@@ -440,6 +442,7 @@ public:
   double GetLongitudeDeg(void) const { return VState.vLocation.GetLongitudeDeg(); }
   double GetLatitudeDeg(void) const { return VState.vLocation.GetLatitudeDeg(); }
   const FGLocation& GetLocation(void) const { return VState.vLocation; }
+  double GetLocation(int i) const { return VState.vLocation(i); }
 
   /** Retrieves the local-to-body transformation matrix.
       The quaternion class, being the means by which the orientation of the
@@ -596,7 +599,6 @@ private:
   struct VehicleState VState;
 
   FGColumnVector3 vVel;
-  FGColumnVector3 vLocation;
   FGMatrix33 Tec2b;
   FGMatrix33 Tb2ec;
   FGMatrix33 Tl2b;   // local to body frame matrix copy for immediate local use
index 8066846d6c4367dba56733c268e102e5dbc76b15..580653a6289d180a9c941e1e5e39bb599684840d 100644 (file)
@@ -67,8 +67,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGPropulsion.cpp,v 1.71 2013/11/24 11:40:56 bcoconni Exp $";
-static const char *IdHdr = ID_PROPULSION;
+IDENT(IdSrc,"$Id: FGPropulsion.cpp,v 1.76 2014/01/13 10:46:07 ehofman Exp $");
+IDENT(IdHdr,ID_PROPULSION);
 
 extern short debug_lvl;
 
@@ -119,12 +119,17 @@ bool FGPropulsion::InitModel(void)
 {
   bool result = true;
 
+  if (!FGModel::InitModel()) return false;
+
+  vForces.InitMatrix();
+  vMoments.InitMatrix();
+
   for (unsigned int i=0; i<numTanks; i++) Tanks[i]->ResetToIC();
 
   for (unsigned int i=0; i<numEngines; i++) {
     switch (Engines[i]->GetType()) {
       case FGEngine::etPiston:
-        ((FGPiston*)Engines[i])->ResetToIC();
+        Engines[i]->ResetToIC();
         try {
           if (HasInitializedEngines && (InitializedEngines & i)) InitRunning(i);
         } catch (string str) {
@@ -133,7 +138,7 @@ bool FGPropulsion::InitModel(void)
         }
         break;
       case FGEngine::etTurbine:
-        ((FGTurbine*)Engines[i])->ResetToIC();
+        Engines[i]->ResetToIC();
         try {
           if (HasInitializedEngines && (InitializedEngines & i)) InitRunning(i);
         } catch (string str) {
diff --git a/src/FDM/JSBSim/models/FGSurface.cpp b/src/FDM/JSBSim/models/FGSurface.cpp
new file mode 100644 (file)
index 0000000..70a89fc
--- /dev/null
@@ -0,0 +1,137 @@
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+ Module:       FGSurface.cpp
+ Author:       Erik Hofman
+ Date started: 01/15/14
+ Purpose:      Base class for all surface properties
+ Called by:    GroundReactions
+
+ ------------- Copyright (C) 2014  Jon S. Berndt (jon@jsbsim.org) -------------
+
+ This program is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser 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 Lesser General Public License for more
+ details.
+
+ You should have received a copy of the GNU Lesser 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 Lesser General Public License can also be found on
+ the world wide web at http://www.gnu.org.
+
+FUNCTIONAL DESCRIPTION
+--------------------------------------------------------------------------------
+This base class for the GroundReactions class defines methoed and holds data
+for all surface types.
+
+HISTORY
+--------------------------------------------------------------------------------
+01/15/14   EMH   Created
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+INCLUDES
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+#include "FGSurface.h"
+
+using namespace std;
+
+namespace JSBSim {
+
+IDENT(IdSrc,"$Id: FGSurface.cpp,v 1.2 2014/01/16 12:31:50 ehofman Exp $");
+IDENT(IdHdr,ID_SURFACE);
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+GLOBAL DECLARATIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS IMPLEMENTATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+FGSurface::FGSurface()
+{
+  frictionFactor = 1.0;
+  rollingFCoeff = 0.02;
+  MaximumForce = DBL_MAX;
+  bumpiness = 0.0;
+  isSolid = true;
+}
+
+FGSurface::FGSurface(FGFDMExec* fdmex = NULL)
+{
+  frictionFactor = 1.0;
+  rollingFCoeff = 0.02;
+  MaximumForce = DBL_MAX;
+  bumpiness = 0.0;
+  isSolid = true;
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+FGSurface::~FGSurface()
+{
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+float FGSurface::GetBumpHeight()
+{
+  if (bumpiness < 0.001) return 0.0f;
+
+  double x = pos[0]*0.1;
+  double y = pos[1]*0.1;
+  x -= floor(x);
+  y -= floor(y);
+  x *= 2*M_PI;
+  y *= 2*M_PI;
+  //now x and y are in the range of 0..2pi
+  //we need a function, that is periodically on 2pi and gives some
+  //height. This is not very fast, but for a beginning.
+  //maybe this should be done by interpolating between some precalculated
+  //values
+  static const float maxGroundBumpAmplitude=0.4;
+  float h = sin(x)+sin(7*x)+sin(8*x)+sin(13*x);
+  h += sin(2*y)+sin(5*y)+sin(9*y*x)+sin(17*y);
+
+  return h*(1/8.)*bumpiness*maxGroundBumpAmplitude;
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+string FGSurface::GetSurfaceStrings(string delimeter) const
+{
+  std::ostringstream buf;
+
+  buf << "FrictionFactor" << delimeter
+      << "RollingFriction" << delimeter
+      << "MaximumForce" << delimeter
+      << "Bumpiness" << delimeter
+      << "IsSolid";
+  
+  return buf.str();
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+string FGSurface::GetSurfaceValues(string delimeter) const
+{
+  std::ostringstream buf;
+  buf << GetFrictionFactor() << delimeter
+      << GetRollingFriction() << delimeter
+      << GetMaximumForce() << delimeter
+      << GetBumpiness() << delimeter
+      << (GetSolid() ? "1" : "0");
+
+  return buf.str();
+}
+
+}
+
diff --git a/src/FDM/JSBSim/models/FGSurface.h b/src/FDM/JSBSim/models/FGSurface.h
new file mode 100644 (file)
index 0000000..232c59c
--- /dev/null
@@ -0,0 +1,138 @@
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+ Header:       FGSurface.h
+ Author:       Erik Hofman
+ Date started: 01/15/14
+
+ ------------- Copyright (C) 2014  Jon S. Berndt (jon@jsbsim.org) -------------
+
+ This program is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser 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 Lesser General Public License for more
+ details.
+
+ You should have received a copy of the GNU Lesser 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 Lesser General Public License can also be found on
+ the world wide web at http://www.gnu.org.
+
+HISTORY
+--------------------------------------------------------------------------------
+01/15/14   EMH   Created
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+SENTRY
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+#ifndef FGSURFACE_H
+#define FGSURFACE_H
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+INCLUDES
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+#include "FGFDMExec.h"
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+DEFINITIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+#define ID_SURFACE "$Id: FGSurface.h,v 1.2 2014/01/16 12:31:50 ehofman Exp $"
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+FORWARD DECLARATIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+namespace JSBSim {
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DOCUMENTATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/** Base class for all surface properties
+    @author Erik M. Hofman
+  */
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DECLARATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+class FGSurface
+{
+public:
+
+  /// Constructor
+  FGSurface();
+
+  /// Constructor
+  FGSurface(FGFDMExec* fdmex);
+  /// Destructor
+  ~FGSurface();
+
+  /// Sets the friction factor of the surface area
+  void SetFrictionFactor(double friction) { frictionFactor = friction; }
+
+  /// Sets the load capacity of the surface area
+  void SetMaximumForce(double force ) { MaximumForce = force; }
+
+  /// Sets the bumpiness factor associated with the surface
+  void SetBumpiness(double bump) { bumpiness = bump; }
+
+  /// Sets the surface is a solid flag value
+  void SetSolid(bool solid) { isSolid = solid; }
+
+  /// Set the currect position for bumpiness calulcation
+  void SetPosition(const double pt[3]) {
+      pos[0] = pt[0]; pos[1] = pt[1]; pos[2] = pt[2];
+  }
+
+
+  /// Gets the friction factor of the surface area
+  double GetFrictionFactor(void) const { return frictionFactor; }
+
+  /// Gets the rolling friction of the surface area
+  double GetRollingFriction(void) const { return rollingFCoeff; }
+
+  /// Gets the static friction of the surface area
+  double GetStaticFriction(void) const { return staticFCoeff; }
+
+  /// Gets the dynamic friction of the surface area
+  double GetDynamicFriction(void) const { return dynamicFCoeff; }
+
+  /// Gets the maximum force for this surface point
+  double GetMaximumForce(void) const { return MaximumForce; }
+
+  /// Gets the bumpiness factor associated with the surface
+  double GetBumpiness(void) const { return bumpiness; }
+
+  /// Gets the surface is a solid flag value
+  bool   GetSolid(void) const { return isSolid; }
+
+  /// Returns the height of the bump at the provided offset
+  float  GetBumpHeight();
+
+  std::string GetSurfaceStrings(std::string delimeter) const;
+  std::string GetSurfaceValues(std::string delimeter) const;
+
+protected:
+  double staticFCoeff, dynamicFCoeff, rollingFCoeff;
+  double frictionFactor;
+  double MaximumForce;
+  double bumpiness;
+  bool isSolid;
+
+private:
+  double pos[3];
+};
+
+}
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+#endif
+
old mode 100644 (file)
new mode 100755 (executable)
index 562b08d..38ff4f8
@@ -66,8 +66,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGMSIS.cpp,v 1.19 2011/12/11 17:03:05 bcoconni Exp $";
-static const char *IdHdr = ID_MSIS;
+IDENT(IdSrc,"$Id: FGMSIS.cpp,v 1.24 2014/01/13 10:46:07 ehofman Exp $");
+IDENT(IdHdr,ID_MSIS);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 EXTERNAL GLOBAL DATA
@@ -464,7 +464,7 @@ void MSIS::spline (double *x, double *y, int n, double yp1, double ypn, double *
   for (k=n-2;k>=0;k--)
     y2[k] = y2[k] * y2[k+1] + u[k];
 
-  delete u;
+  delete[] u;
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -739,9 +739,7 @@ double MSIS::globe7(double *p, struct nrlmsise_input *input,
  *       Upper Thermosphere Parameters */
   double t[15];
   int i,j;
-  int sw9=1;
   double apd;
-  double xlong;
   double tloc;
   double c, s, c2, c4, s2;
   double sr = 7.2722E-5;
@@ -749,7 +747,6 @@ double MSIS::globe7(double *p, struct nrlmsise_input *input,
   double dr = 1.72142E-2;
   double hr = 0.2618;
   double cd32, cd18, cd14, cd39;
-  double p32, p18, p14, p39;
   double df;
   double f1, f2;
   double tinf;
@@ -758,11 +755,6 @@ double MSIS::globe7(double *p, struct nrlmsise_input *input,
   tloc=input->lst;
   for (j=0;j<14;j++)
     t[j]=0;
-  if (flags->sw[9]>0)
-    sw9=1;
-  else if (flags->sw[9]<0)
-    sw9=-1;
-  xlong = input->g_long;
 
   /* calculate legendre polynomials */
   c = sin(input->g_lat * dgtr);
@@ -810,10 +802,6 @@ double MSIS::globe7(double *p, struct nrlmsise_input *input,
   cd18 = cos(2.0*dr*(input->doy-p[17]));
   cd14 = cos(dr*(input->doy-p[13]));
   cd39 = cos(2.0*dr*(input->doy-p[38]));
-  p32=p[31];
-  p18=p[17];
-  p14=p[13];
-  p39=p[38];
 
   /* F10.7 EFFECT */
   df = input->f107 - input->f107A;
@@ -971,7 +959,6 @@ double MSIS::glob7s(double *p, struct nrlmsise_input *input,
   double t[14] = {0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,};
   double tt=0.0;
   double cd32=0.0, cd18=0.0, cd14=0.0, cd39=0.0;
-  double p32=0.0, p18=0.0, p14=0.0, p39=0.0;
   int i=0,j=0;
   double dr=1.72142E-2;
   double dgtr=1.74533E-2;
@@ -988,10 +975,6 @@ double MSIS::glob7s(double *p, struct nrlmsise_input *input,
   cd18 = cos(2.0*dr*(input->doy-p[17]));
   cd14 = cos(dr*(input->doy-p[13]));
   cd39 = cos(2.0*dr*(input->doy-p[38]));
-  p32=p[31];
-  p18=p[17];
-  p14=p[13];
-  p39=p[38];
 
   /* F10.7 */
   t[0] = p[21]*dfa;
@@ -1295,14 +1278,14 @@ void MSIS::gts7(struct nrlmsise_input *input, struct nrlmsise_flags *flags,
  */
   double za=0.0;
   int i, j;
-  double ddum=0.0, z=0.0;
+  double z=0.0;
   double zn1[5] = {120.0, 110.0, 100.0, 90.0, 72.5};
   double tinf=0.0;
   int mn1 = 5;
   double g0=0.0;
   double tlb=0.0;
-  double s=0.0, z0=0.0, t0=0.0, tr12=0.0;
-  double db01=0.0, db04=0.0, db14=0.0, db16=0.0, db28=0.0, db32=0.0, db40=0.0, db48=0.0;
+  double s=0.0;
+  double db01=0.0, db04=0.0, db14=0.0, db16=0.0, db28=0.0, db32=0.0, db40=0.0;
   double zh28=0.0, zh04=0.0, zh16=0.0, zh32=0.0, zh40=0.0, zh01=0.0, zh14=0.0;
   double zhm28=0.0, zhm04=0.0, zhm16=0.0, zhm32=0.0, zhm40=0.0, zhm01=0.0, zhm14=0.0;
   double xmd=0.0;
@@ -1361,10 +1344,6 @@ void MSIS::gts7(struct nrlmsise_input *input, struct nrlmsise_flags *flags,
     meso_tgn1[1]=ptm[8]*pma[8][0]*meso_tn1[4]*meso_tn1[4]/(pow((ptm[4]*ptl[3][0]),2.0));
   }
 
-  z0 = zn1[3];
-  t0 = meso_tn1[3];
-  tr12 = 1.0;
-
   /* N2 variation factor at Zlb */
   g28=flags->sw[21]*globe7(pd[2], input, flags);
 
@@ -1601,13 +1580,12 @@ void MSIS::gts7(struct nrlmsise_input *input, struct nrlmsise_flags *flags,
 
   /* total mass density */
   output->d[5] = 1.66E-24*(4.0*output->d[0]+16.0*output->d[1]+28.0*output->d[2]+32.0*output->d[3]+40.0*output->d[4]+ output->d[6]+14.0*output->d[7]);
-  db48=1.66E-24*(4.0*db04+16.0*db16+28.0*db28+32.0*db32+40.0*db40+db01+14.0*db14);
 
 
 
   /* temperature */
   z = sqrt(input->alt*input->alt);
-  ddum = densu(z,1.0, tinf, tlb, 0.0, 0.0, &output->t[1], ptm[5], s, mn1, zn1, meso_tn1, meso_tgn1);
+  densu(z,1.0, tinf, tlb, 0.0, 0.0, &output->t[1], ptm[5], s, mn1, zn1, meso_tn1, meso_tgn1);
   if (flags->sw[0]) {
     for(i=0;i<9;i++)
       output->d[i]=output->d[i]*1.0E6;
old mode 100644 (file)
new mode 100755 (executable)
index 28673d3..8bc320f
@@ -48,8 +48,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGMars.cpp,v 1.11 2011/06/21 13:54:40 jberndt Exp $";
-static const char *IdHdr = ID_MARS;
+IDENT(IdSrc,"$Id: FGMars.cpp,v 1.13 2014/01/13 10:46:07 ehofman Exp $");
+IDENT(IdHdr,ID_MARS);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
index 86f648859e747a2acb42d472232f899b96d69df4..664b3274ab30ce4355d386a9106a2cc53240ccff 100644 (file)
@@ -50,8 +50,8 @@ INCLUDES
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGStandardAtmosphere.cpp,v 1.21 2012/04/13 13:18:27 jberndt Exp $";
-static const char *IdHdr = ID_STANDARDATMOSPHERE;
+IDENT(IdSrc,"$Id: FGStandardAtmosphere.cpp,v 1.23 2014/01/13 10:46:07 ehofman Exp $");
+IDENT(IdHdr,ID_STANDARDATMOSPHERE);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
index ef732c5142970b60f849080205d7ce91d9ef1054..18237ce7ada4ebbb011188f1cbf223b83bbd4aa4 100644 (file)
@@ -51,8 +51,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGWinds.cpp,v 1.8 2012/12/02 12:59:19 bcoconni Exp $";
-static const char *IdHdr = ID_WINDS;
+IDENT(IdSrc,"$Id: FGWinds.cpp,v 1.11 2014/01/13 10:46:07 ehofman Exp $");
+IDENT(IdHdr,ID_WINDS);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
@@ -120,7 +120,7 @@ FGWinds::~FGWinds()
 
 bool FGWinds::InitModel(void)
 {
-  return true;
+  return FGModel::InitModel();
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index e4113aa6fdfb070f77a46954c0e3881438082787..11f39835fe8d7ef97447a47f729b7e8a13db4ed4 100755 (executable)
@@ -51,8 +51,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGAccelerometer.cpp,v 1.12 2013/11/24 11:40:56 bcoconni Exp $";
-static const char *IdHdr = ID_ACCELEROMETER;
+IDENT(IdSrc,"$Id: FGAccelerometer.cpp,v 1.15 2014/01/13 10:46:07 ehofman Exp $");
+IDENT(IdHdr,ID_ACCELEROMETER);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
@@ -65,7 +65,6 @@ FGAccelerometer::FGAccelerometer(FGFCS* fcs, Element* element)
   Propagate = fcs->GetExec()->GetPropagate();
   Accelerations = fcs->GetExec()->GetAccelerations();
   MassBalance = fcs->GetExec()->GetMassBalance();
-  Inertial = fcs->GetExec()->GetInertial();
   
   Element* location_element = element->FindElement("location");
   if (location_element) vLocation = location_element->FindElementTripletConvertTo("IN");
index 70aabd3fc0c7ab8772058dc4c15eeb8630630117..7b59bc1526b7dd0b7f50470e8a2996fa28b03a94 100755 (executable)
@@ -39,14 +39,13 @@ INCLUDES
 
 #include "FGSensor.h"
 #include "math/FGColumnVector3.h"
-#include "math/FGMatrix33.h"
 #include "FGSensorOrientation.h"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_ACCELEROMETER "$Id: FGAccelerometer.h,v 1.7 2013/11/24 11:40:56 bcoconni Exp $"
+#define ID_ACCELEROMETER "$Id: FGAccelerometer.h,v 1.8 2013/12/07 12:21:14 bcoconni Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -57,7 +56,6 @@ namespace JSBSim {
 class FGFCS;
 class FGPropagate;
 class FGAccelerations;
-class FGInertial;
 class FGMassBalance;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -119,14 +117,14 @@ The only required element in the accelerometer definition is the input element.
 case, no degradation would be modeled, and the output would simply be the input.
 
 For noise, if the type is PERCENT, then the value supplied is understood to be a
-percentage variance. That is, if the number given is 0.05, the the variance is
+percentage variance. That is, if the number given is 0.05, the variance is
 understood to be +/-0.05 percent maximum variance. So, the actual value for the accelerometer
 will be *anywhere* from 0.95 to 1.05 of the actual "perfect" value at any time -
 even varying all the way from 0.95 to 1.05 in adjacent frames - whatever the delta
 time.
 
 @author Jon S. Berndt
-@version $Revision: 1.7 $
+@version $Revision: 1.8 $
 */
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -145,7 +143,6 @@ private:
   FGPropagate* Propagate;
   FGAccelerations* Accelerations;
   FGMassBalance* MassBalance;
-  FGInertial* Inertial;
   FGColumnVector3 vLocation;
   FGColumnVector3 vRadius;
   FGColumnVector3 vAccel;
index 1be3971b40bddf1a30ca239f10f917160e47192e..e917e3aca3c295549cda773681061a236e410a6a 100644 (file)
@@ -44,8 +44,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGActuator.cpp,v 1.29 2013/11/24 11:40:56 bcoconni Exp $";
-static const char *IdHdr = ID_ACTUATOR;
+IDENT(IdSrc,"$Id: FGActuator.cpp,v 1.32 2014/01/13 10:46:07 ehofman Exp $");
+IDENT(IdHdr,ID_ACTUATOR);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
@@ -138,6 +138,16 @@ FGActuator::~FGActuator()
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
+void FGActuator::ResetPastStates(void)
+{
+  FGFCSComponent::ResetPastStates();
+
+  PreviousOutput = PreviousHystOutput = PreviousRateLimOutput
+    = PreviousLagInput = PreviousLagOutput = Output = 0.0; 
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
 bool FGActuator::Run(void )
 {
   Input = InputNodes[0]->getDoubleValue() * InputSigns[0];
index 6c3fff546497527731b859c5699780d35a6e1c23..d131d7ab919191ba72dedd4fadffb0ca6667d5fa 100644 (file)
@@ -43,7 +43,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_ACTUATOR "$Id: FGActuator.h,v 1.16 2013/11/24 11:40:56 bcoconni Exp $"
+#define ID_ACTUATOR "$Id: FGActuator.h,v 1.18 2014/01/02 21:58:42 bcoconni Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -119,7 +119,7 @@ Example:
 @endcode
 
 @author Jon S. Berndt
-@version $Revision: 1.16 $
+@version $Revision: 1.18 $
 */
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -138,6 +138,7 @@ public:
       It calls private functions if needed to perform the hysteresis, lag,
       limiting, etc. functions. */
   bool Run (void);
+  void ResetPastStates(void);
 
   // these may need to have the bool argument replaced with a double
   /** This function fails the actuator to zero. The motion to zero
index fea7f68a377f6755a3b5fb75627ae898234d3c2d..4c17a07a6dddbaad60490e889994197ac7a1893f 100755 (executable)
@@ -74,8 +74,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGAngles.cpp,v 1.2 2013/09/27 19:36:28 jberndt Exp $";
-static const char *IdHdr = ID_ANGLES;
+IDENT(IdSrc,"$Id: FGAngles.cpp,v 1.4 2014/01/13 10:46:07 ehofman Exp $");
+IDENT(IdHdr,ID_ANGLES);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
index 5507ecfd32949abf64ba68353d2f4fc91ce7ddbc..6fa9d3bef9f00cc34395201d6cfc9ebf1bac9532 100644 (file)
@@ -46,8 +46,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGDeadBand.cpp,v 1.12 2012/11/17 18:03:19 jberndt Exp $";
-static const char *IdHdr = ID_DEADBAND;
+IDENT(IdSrc,"$Id: FGDeadBand.cpp,v 1.14 2014/01/13 10:46:07 ehofman Exp $");
+IDENT(IdHdr,ID_DEADBAND);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
index da16ddbf3ff2efa927461d1d417fb9e5e6768204..a78a3dbd34c051f9abf568f75ebbf5181037d810 100755 (executable)
@@ -48,8 +48,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGDistributor.cpp,v 1.3 2013/11/24 11:40:56 bcoconni Exp $";
-static const char *IdHdr = ID_DISTRIBUTOR;
+IDENT(IdSrc,"$Id: FGDistributor.cpp,v 1.5 2014/01/13 10:46:08 ehofman Exp $");
+IDENT(IdHdr,ID_DISTRIBUTOR);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
index 630f5cb8c38afb4a74ac044be2bf8fd263f21090..39d586972895227d1a1329789ed8c7052c860e45 100644 (file)
@@ -48,8 +48,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGFCSComponent.cpp,v 1.37 2013/09/27 19:38:36 jberndt Exp $";
-static const char *IdHdr = ID_FCSCOMPONENT;
+IDENT(IdSrc,"$Id: FGFCSComponent.cpp,v 1.40 2014/01/13 10:46:08 ehofman Exp $");
+IDENT(IdHdr,ID_FCSCOMPONENT);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
@@ -236,6 +236,15 @@ FGFCSComponent::~FGFCSComponent()
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
+void FGFCSComponent::ResetPastStates(void)
+{
+  index = 0;
+  for (unsigned int i = 0; i < output_array.size(); ++i)
+    output_array[i] = 0.0;
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
 void FGFCSComponent::SetOutput(void)
 {
   for (unsigned int i=0; i<OutputNodes.size(); i++) OutputNodes[i]->setDoubleValue(Output);
index 77b014095eabd3118a6f92df33386a333e111983..7ccaebf26fe1d7d1fa4c9d47902bfdb43e79d676 100644 (file)
@@ -46,7 +46,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_FCSCOMPONENT "$Id: FGFCSComponent.h,v 1.23 2013/09/27 19:38:44 jberndt Exp $"
+#define ID_FCSCOMPONENT "$Id: FGFCSComponent.h,v 1.25 2014/01/02 21:58:42 bcoconni Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -82,7 +82,7 @@ CLASS DOCUMENTATION
     - FGAngle
 
     @author Jon S. Berndt
-    @version $Id: FGFCSComponent.h,v 1.23 2013/09/27 19:38:44 jberndt Exp $
+    @version $Id: FGFCSComponent.h,v 1.25 2014/01/02 21:58:42 bcoconni Exp $
     @see Documentation for the FGFCS class, and for the configuration file class
 */
 
@@ -104,6 +104,7 @@ public:
   std::string GetName(void) const {return Name;}
   std::string GetType(void) const { return Type; }
   virtual double GetOutputPct(void) const { return 0; }
+  virtual void ResetPastStates(void);
 
 protected:
   FGFCS* fcs;
index 6d21a055f91e96b447979b1fae991c71823d5313..118267c05785a1fd896112e6937d7e418250426b 100755 (executable)
@@ -47,8 +47,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGFCSFunction.cpp,v 1.13 2013/11/24 11:40:57 bcoconni Exp $";
-static const char *IdHdr = ID_FCSFUNCTION;
+IDENT(IdSrc,"$Id: FGFCSFunction.cpp,v 1.15 2014/01/13 10:46:08 ehofman Exp $");
+IDENT(IdHdr,ID_FCSFUNCTION);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
index 54739e837236b6c08f3d2c56c8eb349367dda039..9060688968a19b2f55aaa2ceebf8d2e452ea6ae9 100644 (file)
@@ -48,8 +48,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGFilter.cpp,v 1.15 2009/10/24 22:59:30 jberndt Exp $";
-static const char *IdHdr = ID_FILTER;
+IDENT(IdSrc,"$Id: FGFilter.cpp,v 1.20 2014/01/13 10:46:09 ehofman Exp $");
+IDENT(IdHdr,ID_FILTER);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
@@ -96,6 +96,15 @@ FGFilter::~FGFilter()
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
+void FGFilter::ResetPastStates(void)
+{
+  FGFCSComponent::ResetPastStates();
+
+  Input = 0.0; Initialize = true;
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
 void FGFilter::ReadFilterCoefficients(Element* element, int index)
 {
   // index is known to be 1-7. 
index 4211ccc72facbd3ec89a29d350be70f59c49fe27..b899126d36dbc9852e39af6ffce3f24a79e1fd0e 100644 (file)
@@ -43,7 +43,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_FILTER "$Id: FGFilter.h,v 1.13 2013/01/26 17:06:50 bcoconni Exp $"
+#define ID_FILTER "$Id: FGFilter.h,v 1.14 2014/01/02 21:58:42 bcoconni Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -228,7 +228,7 @@ is so that the last component in a "string" can copy its value to the appropriat
 output, such as the elevator, or speedbrake, etc.
 
 @author Jon S. Berndt
-@version $Revision: 1.13 $
+@version $Revision: 1.14 $
 
 */
 
@@ -247,7 +247,7 @@ public:
   /** When true, causes previous values to be set to current values. This
       is particularly useful for first pass. */
   bool Initialize;
-  void ResetPastStates(void) {Input = 0.0; Initialize = true;}
+  void ResetPastStates(void);
   
   enum {eLag, eLeadLag, eOrder2, eWashout, eIntegrator, eUnknown} FilterType;
 
index fb864e06bba13feff4df23913d702df2c328b100..0a2cad21dc177dd889fdb2e027421f0ead4de173 100644 (file)
@@ -47,8 +47,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGGain.cpp,v 1.23 2011/04/18 08:51:12 andgi Exp $";
-static const char *IdHdr = ID_GAIN;
+IDENT(IdSrc,"$Id: FGGain.cpp,v 1.25 2014/01/13 10:46:09 ehofman Exp $");
+IDENT(IdHdr,ID_GAIN);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
index cc5ce5360f7c377e34eeb7486559cf51d22276e3..ceaafef326bce21e3351b1c9e651347dd898c2e0 100755 (executable)
@@ -47,8 +47,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGGyro.cpp,v 1.8 2013/11/24 11:40:57 bcoconni Exp $";
-static const char *IdHdr = ID_GYRO;
+IDENT(IdSrc,"$Id: FGGyro.cpp,v 1.10 2014/01/13 10:46:09 ehofman Exp $");
+IDENT(IdHdr,ID_GYRO);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
index 4a597f7b479ab51b55537e1f37a68d23aa0aebb4..56bdecd2438cd38fd9f32a47d0b6039f94423f62 100644 (file)
@@ -46,8 +46,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGKinemat.cpp,v 1.10 2009/10/24 22:59:30 jberndt Exp $";
-static const char *IdHdr = ID_FLAPS;
+IDENT(IdSrc,"$Id: FGKinemat.cpp,v 1.14 2014/01/13 10:46:09 ehofman Exp $");
+IDENT(IdHdr,ID_FLAPS);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
index 8eefb8ce8a7b67e6cce57e37e3e7ac065857ce48..eeb2b1c1c3bf0375946a2f7891e45b146754e83f 100755 (executable)
@@ -49,8 +49,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGMagnetometer.cpp,v 1.7 2013/11/24 11:40:57 bcoconni Exp $";
-static const char *IdHdr = ID_MAGNETOMETER;
+IDENT(IdSrc,"$Id: FGMagnetometer.cpp,v 1.9 2014/01/13 10:46:09 ehofman Exp $");
+IDENT(IdHdr,ID_MAGNETOMETER);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
old mode 100644 (file)
new mode 100755 (executable)
index 95efe60..20bd629
@@ -44,8 +44,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGPID.cpp,v 1.21 2013/02/02 06:05:26 jberndt Exp $";
-static const char *IdHdr = ID_PID;
+IDENT(IdSrc,"$Id: FGPID.cpp,v 1.24 2014/01/13 10:46:09 ehofman Exp $");
+IDENT(IdHdr,ID_PID);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
@@ -156,6 +156,15 @@ FGPID::~FGPID()
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
+void FGPID::ResetPastStates(void)
+{
+  FGFCSComponent::ResetPastStates();
+
+  Input_prev = Input_prev2 = Output = I_out_total = 0.0;
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
 bool FGPID::Run(void )
 {
   double I_out_delta = 0.0;
old mode 100644 (file)
new mode 100755 (executable)
index 6069d3b..6961859
@@ -44,7 +44,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_PID "$Id: FGPID.h,v 1.15 2013/02/02 06:05:26 jberndt Exp $"
+#define ID_PID "$Id: FGPID.h,v 1.16 2014/01/02 21:58:42 bcoconni Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -116,7 +116,7 @@ For example,
 </pre>
 
     @author Jon S. Berndt
-    @version $Revision: 1.15 $
+    @version $Revision: 1.16 $
 */
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -130,7 +130,7 @@ public:
   ~FGPID();
 
   bool Run (void);
-  void ResetPastStates(void) {Input_prev = Input_prev2 = Output = I_out_total = 0.0;}
+  void ResetPastStates(void);
 
     /// These define the indices use to select the various integrators.
   enum eIntegrateType {eNone = 0, eRectEuler, eTrapezoidal, eAdamsBashforth2, eAdamsBashforth3};
old mode 100644 (file)
new mode 100755 (executable)
index 9aedc65..9318795
@@ -46,8 +46,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGSensor.cpp,v 1.24 2012/11/17 18:03:19 jberndt Exp $";
-static const char *IdHdr = ID_SENSOR;
+IDENT(IdSrc,"$Id: FGSensor.cpp,v 1.27 2014/01/13 10:46:10 ehofman Exp $");
+IDENT(IdHdr,ID_SENSOR);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
@@ -137,6 +137,15 @@ FGSensor::~FGSensor()
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
+void FGSensor::ResetPastStates(void)
+{
+  FGFCSComponent::ResetPastStates();
+
+  PreviousOutput = PreviousInput = Output = 0.0;
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
 bool FGSensor::Run(void)
 {
   Input = InputNodes[0]->getDoubleValue() * InputSigns[0];
old mode 100644 (file)
new mode 100755 (executable)
index be0eea2..a183c25
@@ -44,7 +44,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_SENSOR "$Id: FGSensor.h,v 1.22 2013/06/10 01:59:16 jberndt Exp $"
+#define ID_SENSOR "$Id: FGSensor.h,v 1.24 2014/01/02 21:58:42 bcoconni Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -124,7 +124,7 @@ The delay element can specify a frame delay. The integer number provided is
 the number of frames to delay the output signal.
 
 @author Jon S. Berndt
-@version $Revision: 1.22 $
+@version $Revision: 1.24 $
 */
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -147,6 +147,7 @@ public:
   int    GetQuantized(void) const {return quantized;}
 
   virtual bool Run (void);
+  void ResetPastStates(void);
 
 protected:
   enum eNoiseType {ePercent=0, eAbsolute} NoiseType;
index b67cbf70d4ad42678236bed2f808ac897c9641db..37d7dffff6b3a7ae3203cc89c9d0f528292bf3d1 100644 (file)
@@ -45,8 +45,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGSummer.cpp,v 1.8 2010/08/21 22:56:11 jberndt Exp $";
-static const char *IdHdr = ID_SUMMER;
+IDENT(IdSrc,"$Id: FGSummer.cpp,v 1.10 2014/01/13 10:46:10 ehofman Exp $");
+IDENT(IdHdr,ID_SUMMER);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
index 4d91a30d89601a4c5738c117af6ece700afb8264..0ca9d07dc97b2fa7a13bd9366d84cde9b68141e8 100644 (file)
@@ -70,8 +70,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGSwitch.cpp,v 1.27 2013/11/24 11:40:57 bcoconni Exp $";
-static const char *IdHdr = ID_SWITCH;
+IDENT(IdSrc,"$Id: FGSwitch.cpp,v 1.29 2014/01/13 10:46:10 ehofman Exp $");
+IDENT(IdHdr,ID_SWITCH);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
index 35f398746c675a7ddfae02ce4196c579877299aa..5f4d6239758e51fa34772bec73c9eaec483cbd4d 100755 (executable)
@@ -45,8 +45,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGWaypoint.cpp,v 1.2 2013/08/30 04:44:59 jberndt Exp $";
-static const char *IdHdr = ID_WAYPOINT;
+IDENT(IdSrc,"$Id: FGWaypoint.cpp,v 1.5 2014/01/13 10:46:10 ehofman Exp $");
+IDENT(IdHdr,ID_WAYPOINT);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
index 088a41993372e822edc27a258a673954c40e69fb..b211981d6b877f3f85cd892a8006e5aacbb5a71f 100644 (file)
@@ -50,8 +50,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGElectric.cpp,v 1.14 2013/11/24 11:40:57 bcoconni Exp $";
-static const char *IdHdr = ID_ELECTRIC;
+IDENT(IdSrc,"$Id: FGElectric.cpp,v 1.16 2014/01/13 10:46:10 ehofman Exp $");
+IDENT(IdHdr,ID_ELECTRIC);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
index cfbdf167895d2ec3b3f0941aeb70cd7167ccec90..fc4b064df2419eab876aae09f30d1900504bfd65 100644 (file)
@@ -44,7 +44,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_ELECTRIC "$Id: FGElectric.h,v 1.12 2013/11/24 11:40:57 bcoconni Exp $";
+#define ID_ELECTRIC "$Id: FGElectric.h,v 1.12 2013/11/24 11:40:57 bcoconni Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
index 62917a7bcb26ed73a4d3a3df1e4fdd0657d329b5..75f07bd3e0dbdaf1fdc1f7983c6243ec8b24d21d 100644 (file)
@@ -54,8 +54,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGEngine.cpp,v 1.54 2013/11/24 11:40:57 bcoconni Exp $";
-static const char *IdHdr = ID_ENGINE;
+IDENT(IdSrc,"$Id: FGEngine.cpp,v 1.57 2014/01/13 10:46:10 ehofman Exp $");
+IDENT(IdHdr,ID_ENGINE);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
@@ -76,8 +76,6 @@ FGEngine::FGEngine(FGFDMExec* exec, Element* engine_element, int engine_number,
   MaxThrottle = 1.0;
   MinThrottle = 0.0;
 
-  ResetToIC(); // initialize dynamic terms
-
   FDMExec = exec;
 
   PropertyManager = FDMExec->GetPropertyManager();
@@ -112,6 +110,8 @@ FGEngine::FGEngine(FGFDMExec* exec, Element* engine_element, int engine_number,
     cerr << "No thruster definition supplied with engine definition." << endl;
   }
 
+  ResetToIC(); // initialize dynamic terms
+
   // Load feed tank[s] references
   local_element = engine_element->GetParent()->FindElement("feed");
   while (local_element) {
@@ -160,6 +160,7 @@ void FGEngine::ResetToIC(void)
   FuelFlowRate = 0.0;
   FuelFreeze = false;
   FuelUsedLbs = 0.0;
+  Thruster->ResetToIC();
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index a275833954b2b3ff32575e09336242b9b9144cc1..942a6b4fab886c70475ebabda17030289e28277c 100644 (file)
@@ -53,7 +53,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_ENGINE "$Id: FGEngine.h,v 1.38 2013/11/24 11:40:57 bcoconni Exp $"
+#define ID_ENGINE "$Id: FGEngine.h,v 1.39 2013/12/22 17:14:37 bcoconni Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -111,7 +111,7 @@ CLASS DOCUMENTATION
   documentation for engine and thruster classes.
 </pre>     
     @author Jon S. Berndt
-    @version $Id: FGEngine.h,v 1.38 2013/11/24 11:40:57 bcoconni Exp $
+    @version $Id: FGEngine.h,v 1.39 2013/12/22 17:14:37 bcoconni Exp $
 */
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -184,7 +184,7 @@ public:
   virtual int InitRunning(void){ return 1; }
 
   /** Resets the Engine parameters to the initial conditions */
-  void ResetToIC(void);
+  virtual void ResetToIC(void);
 
   /** Calculates the thrust of the engine, and other engine functions. */
   virtual void Calculate(void) = 0;
index 787e184a1c2f304888d88a6efc7d60799b8e4748..a579f7773644a0e5a4cb40940022752a5ac82406 100644 (file)
@@ -53,8 +53,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGForce.cpp,v 1.17 2011/10/31 14:54:41 bcoconni Exp $";
-static const char *IdHdr = ID_FORCE;
+IDENT(IdSrc,"$Id: FGForce.cpp,v 1.19 2014/01/13 10:46:10 ehofman Exp $");
+IDENT(IdHdr,ID_FORCE);
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
index c9616e1a2f3b78691eee3719ef2d406c9ed729fc..4a1171b9a56cf2c9085b6b510a1bf9899a6f8b72 100644 (file)
@@ -46,8 +46,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGNozzle.cpp,v 1.15 2012/03/18 15:48:35 jentron Exp $";
-static const char *IdHdr = ID_NOZZLE;
+IDENT(IdSrc,"$Id: FGNozzle.cpp,v 1.17 2014/01/13 10:46:10 ehofman Exp $");
+IDENT(IdHdr,ID_NOZZLE);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
index 68f5d28f1b0183e264f2315e5ee5a64d26d1e998..2ef6e851f0cbb77c8e4673904841b4c7bea2442e 100644 (file)
@@ -44,7 +44,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_NOZZLE "$Id: FGNozzle.h,v 1.10 2012/03/18 15:48:36 jentron Exp $";
+#define ID_NOZZLE "$Id: FGNozzle.h,v 1.10 2012/03/18 15:48:36 jentron Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
index 10e43820e5a42e505dde0ad2ed7ffc87779f5268..48e723728c8043c16516e40de3f630e2792b7d47 100644 (file)
@@ -51,8 +51,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGPiston.cpp,v 1.72 2013/11/24 11:40:57 bcoconni Exp $";
-static const char *IdHdr = ID_PISTON;
+IDENT(IdSrc,"$Id: FGPiston.cpp,v 1.74 2014/01/13 10:46:10 ehofman Exp $");
+IDENT(IdHdr,ID_PISTON);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
index 8c56ace3df17594a55bcde863b37856dc4a42101..3f3ae89008801d34c2d69e48aecb8905395960ec 100644 (file)
@@ -46,7 +46,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_PISTON "$Id: FGPiston.h,v 1.35 2012/04/07 01:50:54 jentron Exp $";
+#define ID_PISTON "$Id: FGPiston.h,v 1.35 2012/04/07 01:50:54 jentron Exp $"
 #define FG_MAX_BOOST_SPEEDS 3
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index 9d341ef82ec907d1043bed3c53f786426d43c051..33066c74bedbe9eb67dffd518b2ee6c9a7c79eef 100644 (file)
@@ -45,8 +45,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGPropeller.cpp,v 1.46 2013/01/06 22:11:42 jentron Exp $";
-static const char *IdHdr = ID_PROPELLER;
+IDENT(IdSrc,"$Id: FGPropeller.cpp,v 1.48 2014/01/13 10:46:10 ehofman Exp $");
+IDENT(IdHdr,ID_PROPELLER);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
index 6d4123ab35b1f9bd9317ef9c25273a5ba5e4bfba..c7310b734dd20fe592d66fad9d7d579a6b05bbf7 100644 (file)
@@ -49,8 +49,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGRocket.cpp,v 1.31 2013/11/24 11:40:57 bcoconni Exp $";
-static const char *IdHdr = ID_ROCKET;
+IDENT(IdSrc,"$Id: FGRocket.cpp,v 1.33 2014/01/13 10:46:10 ehofman Exp $");
+IDENT(IdHdr,ID_ROCKET);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
index 977c96726215f811d185435a9749a4e5fdab9a31..2c6141330b647864d3d41efd40c908b21abf9c3b 100644 (file)
@@ -57,8 +57,8 @@ using std::ostringstream;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGRotor.cpp,v 1.21 2013/11/24 11:40:57 bcoconni Exp $";
-static const char *IdHdr = ID_ROTOR;
+IDENT(IdSrc,"$Id: FGRotor.cpp,v 1.23 2014/01/13 10:46:10 ehofman Exp $");
+IDENT(IdHdr,ID_ROTOR);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 MISC
index c59be5c923e6ab786e2b1673906eee68d3d889e3..95829d3c487d46943728fc7efbdf5b5f623f3952 100644 (file)
@@ -47,8 +47,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGTank.cpp,v 1.37 2013/06/10 02:04:12 jberndt Exp $";
-static const char *IdHdr = ID_TANK;
+IDENT(IdSrc,"$Id: FGTank.cpp,v 1.39 2014/01/13 10:46:10 ehofman Exp $");
+IDENT(IdHdr,ID_TANK);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
index 7bd53efb944063184c16b3ff7064f1f05c6b5686..516f1b4e082920ec447b751aac85644c55b92216 100644 (file)
@@ -45,8 +45,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGThruster.cpp,v 1.18 2013/01/12 21:11:59 jberndt Exp $";
-static const char *IdHdr = ID_THRUSTER;
+IDENT(IdSrc,"$Id: FGThruster.cpp,v 1.21 2014/01/13 10:46:10 ehofman Exp $");
+IDENT(IdHdr,ID_THRUSTER);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
@@ -65,8 +65,6 @@ FGThruster::FGThruster(FGFDMExec *FDMExec, Element *el, int num ): FGForce(FDMEx
   Name = el->GetAttributeValue("name");
 
   GearRatio = 1.0;
-  ReverserAngle = 0.0;
-  Thrust = 0.0;
   EngineNum = num;
   PropertyManager = FDMExec->GetPropertyManager();
 
@@ -95,25 +93,26 @@ FGThruster::FGThruster(FGFDMExec *FDMExec, Element *el, int num ): FGForce(FDMEx
 
   } else {
 
-  element = thruster_element->FindElement("orient");
-  if (element)  orientation = element->FindElementTripletConvertTo("RAD");
-
-  SetAnglesToBody(orientation);
-  property_name = base_property_name + "/pitch-angle-rad";
-  PropertyManager->Tie( property_name.c_str(), (FGForce *)this, &FGForce::GetPitch, &FGForce::SetPitch);
-  property_name = base_property_name + "/yaw-angle-rad";
-  PropertyManager->Tie( property_name.c_str(), (FGForce *)this, &FGForce::GetYaw, &FGForce::SetYaw);
-
-  if (el->GetName() == "direct") // this is a direct thruster. At this time
-                                 // only a direct thruster can be reversed.
-  {
-    property_name = base_property_name + "/reverser-angle-rad";
-    PropertyManager->Tie( property_name.c_str(), (FGThruster *)this, &FGThruster::GetReverserAngle,
-                                                          &FGThruster::SetReverserAngle);
-  }
+    element = thruster_element->FindElement("orient");
+    if (element)  orientation = element->FindElementTripletConvertTo("RAD");
+
+    SetAnglesToBody(orientation);
+    property_name = base_property_name + "/pitch-angle-rad";
+    PropertyManager->Tie( property_name.c_str(), (FGForce *)this, &FGForce::GetPitch, &FGForce::SetPitch);
+    property_name = base_property_name + "/yaw-angle-rad";
+    PropertyManager->Tie( property_name.c_str(), (FGForce *)this, &FGForce::GetYaw, &FGForce::SetYaw);
+
+    if (el->GetName() == "direct") // this is a direct thruster. At this time
+                                   // only a direct thruster can be reversed.
+      {
+        property_name = base_property_name + "/reverser-angle-rad";
+        PropertyManager->Tie( property_name.c_str(), (FGThruster *)this, &FGThruster::GetReverserAngle,
+                              &FGThruster::SetReverserAngle);
+      }
 
   }
 
+  ResetToIC();
 
   Debug(0);
 }
@@ -127,6 +126,15 @@ FGThruster::~FGThruster()
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
+void FGThruster::ResetToIC(void)
+{
+  ReverserAngle = 0.0;
+  Thrust = 0.0;
+  SetActingLocation(vXYZn);
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
 string FGThruster::GetThrusterLabels(int id, const string& delimeter)
 {
   std::ostringstream buf;
index b783d406019ab6cd2e3768159e82dc41b5db4352..0ac1dafe6652e7b112f3a32772a3ea7d572d6fef 100644 (file)
@@ -46,7 +46,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_THRUSTER "$Id: FGThruster.h,v 1.20 2012/03/18 15:48:36 jentron Exp $"
+#define ID_THRUSTER "$Id: FGThruster.h,v 1.22 2013/12/22 17:14:37 bcoconni Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -74,7 +74,7 @@ CLASS DOCUMENTATION
     1.57 (pi/2) results in no thrust at all.
  
     @author Jon Berndt
-    @version $Id: FGThruster.h,v 1.20 2012/03/18 15:48:36 jentron Exp $
+    @version $Id: FGThruster.h,v 1.22 2013/12/22 17:14:37 bcoconni Exp $
     */
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -112,6 +112,8 @@ public:
   virtual std::string GetThrusterLabels(int id, const std::string& delimeter);
   virtual std::string GetThrusterValues(int id, const std::string& delimeter);
 
+  virtual void ResetToIC(void);
+
   struct Inputs {
     double TotalDeltaT;
     double H_agl;
index a887dcd3ee81159689c8cf7e6083a15082a51aae..6822b22a9afd6963b78db1e3a2d743f441f2d3c9 100644 (file)
@@ -48,8 +48,8 @@ using std::endl;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGTransmission.cpp,v 1.2 2013/11/15 22:43:03 bcoconni Exp $";
-static const char *IdHdr = ID_TRANSMISSION;
+IDENT(IdSrc,"$Id: FGTransmission.cpp,v 1.4 2014/01/13 10:46:10 ehofman Exp $");
+IDENT(IdHdr,ID_TRANSMISSION);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
index d48439103c08c45990257f81eca8997502b9cdd8..6ab51091dc10e802ce1365537d82288b365eeb10 100644 (file)
@@ -50,8 +50,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGTurbine.cpp,v 1.38 2013/11/24 11:40:57 bcoconni Exp $";
-static const char *IdHdr = ID_TURBINE;
+IDENT(IdSrc,"$Id: FGTurbine.cpp,v 1.40 2014/01/13 10:46:10 ehofman Exp $");
+IDENT(IdHdr,ID_TURBINE);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
index fa3109c66a89491731aa01fc9a792ecb3aceefd9..f1920554506b7f3591c4ae172fc5962c884faaae 100755 (executable)
@@ -54,8 +54,8 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGTurboProp.cpp,v 1.26 2013/11/24 14:22:22 bcoconni Exp $";
-static const char *IdHdr = ID_TURBOPROP;
+IDENT(IdSrc,"$Id: FGTurboProp.cpp,v 1.28 2014/01/13 10:46:10 ehofman Exp $");
+IDENT(IdHdr,ID_TURBOPROP);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION