]> git.mxchange.org Git - flightgear.git/commitdiff
Sync. With JSBSim CVS
authorErik Hofman <erik@ehofman.com>
Fri, 25 Nov 2011 12:38:08 +0000 (13:38 +0100)
committerErik Hofman <erik@ehofman.com>
Fri, 25 Nov 2011 12:38:08 +0000 (13:38 +0100)
44 files changed:
src/FDM/JSBSim/FGFDMExec.cpp
src/FDM/JSBSim/FGFDMExec.h
src/FDM/JSBSim/initialization/FGInitialCondition.cpp
src/FDM/JSBSim/initialization/FGInitialCondition.h
src/FDM/JSBSim/initialization/FGTrim.cpp
src/FDM/JSBSim/input_output/FGGroundCallback.h
src/FDM/JSBSim/input_output/FGScript.cpp [changed mode: 0644->0755]
src/FDM/JSBSim/math/FGCondition.cpp
src/FDM/JSBSim/math/FGLocation.cpp
src/FDM/JSBSim/math/FGLocation.h
src/FDM/JSBSim/math/FGQuaternion.cpp
src/FDM/JSBSim/math/FGQuaternion.h
src/FDM/JSBSim/models/FGAccelerations.h
src/FDM/JSBSim/models/FGAircraft.h
src/FDM/JSBSim/models/FGAuxiliary.cpp [changed mode: 0644->0755]
src/FDM/JSBSim/models/FGAuxiliary.h
src/FDM/JSBSim/models/FGBuoyantForces.cpp
src/FDM/JSBSim/models/FGBuoyantForces.h
src/FDM/JSBSim/models/FGExternalForce.cpp [changed mode: 0644->0755]
src/FDM/JSBSim/models/FGExternalForce.h [changed mode: 0644->0755]
src/FDM/JSBSim/models/FGExternalReactions.h [changed mode: 0644->0755]
src/FDM/JSBSim/models/FGFCS.h
src/FDM/JSBSim/models/FGInertial.cpp
src/FDM/JSBSim/models/FGInertial.h
src/FDM/JSBSim/models/FGLGear.cpp
src/FDM/JSBSim/models/FGLGear.h
src/FDM/JSBSim/models/FGMassBalance.cpp
src/FDM/JSBSim/models/FGMassBalance.h
src/FDM/JSBSim/models/FGOutput.h
src/FDM/JSBSim/models/FGPropagate.cpp
src/FDM/JSBSim/models/FGPropagate.h
src/FDM/JSBSim/models/FGPropulsion.cpp
src/FDM/JSBSim/models/FGPropulsion.h
src/FDM/JSBSim/models/atmosphere/FGWinds.cpp
src/FDM/JSBSim/models/atmosphere/FGWinds.h
src/FDM/JSBSim/models/flight_control/FGFCSFunction.h [changed mode: 0644->0755]
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/FGForce.h
src/FDM/JSBSim/models/propulsion/FGPropeller.cpp
src/FDM/JSBSim/models/propulsion/FGPropeller.h
src/FDM/JSBSim/models/propulsion/FGTank.cpp
src/FDM/JSBSim/models/propulsion/FGTank.h

index 570baf75f1abd61ba4c0e69cf6f0111c495a2e3b..d5c81f8217d5a6f7b3e8b33f30e9fb49f7facac9 100644 (file)
@@ -70,7 +70,7 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGFDMExec.cpp,v 1.118 2011/10/22 15:11:23 bcoconni Exp $";
+static const char *IdSrc = "$Id: FGFDMExec.cpp,v 1.120 2011/11/10 12:06:13 jberndt Exp $";
 static const char *IdHdr = ID_FDMEXEC;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -82,10 +82,9 @@ CLASS IMPLEMENTATION
 
 FGFDMExec::FGFDMExec(FGPropertyManager* root, unsigned int* fdmctr) : Root(root), FDMctr(fdmctr)
 {
-
   Frame           = 0;
   Error           = 0;
-  GroundCallback  = new FGDefaultGroundCallback();
+  SetGroundCallback(new FGDefaultGroundCallback());
   IC              = 0;
   Trim            = 0;
   Script          = 0;
@@ -186,9 +185,6 @@ FGFDMExec::~FGFDMExec()
 
   if (FDMctr > 0) (*FDMctr)--;
 
-  if(GroundCallback)
-     delete GroundCallback;
-
   Debug(1);
 }
 
@@ -213,7 +209,7 @@ bool FGFDMExec::Allocate(void)
   Models[ePropulsion]        = new FGPropulsion(this);
   Models[eAerodynamics]      = new FGAerodynamics (this);
 
-  GroundCallback->SetSeaLevelRadius(((FGInertial*)Models[eInertial])->GetRefRadius());
+  GetGroundCallback()->SetSeaLevelRadius(((FGInertial*)Models[eInertial])->GetRefRadius());
 
   Models[eGroundReactions]   = new FGGroundReactions(this);
   Models[eExternalReactions] = new FGExternalReactions(this);
@@ -616,14 +612,6 @@ string FGFDMExec::GetOutputFileName(void)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-void FGFDMExec::SetGroundCallback(FGGroundCallback* p)
-{
-  delete GroundCallback;
-  GroundCallback = p;
-}
-
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
 vector <string> FGFDMExec::EnumerateFDMs(void)
 {
   vector <string> FDMList;
@@ -1137,7 +1125,7 @@ void FGFDMExec::ForceOutput(int idx)
 {
   if (idx >= (int)0 && idx < (int)Outputs.size()) Outputs[idx]->Print();
 }
-       
+
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 bool FGFDMExec::SetOutputDirectives(const string& fname)
index 68dc380d1d3b43d050039d2967d8786d0294407d..2628a66ff5bae9c08d8295e653ff1029998b389f 100644 (file)
@@ -47,7 +47,6 @@ INCLUDES
 #include "initialization/FGTrim.h"
 #include "FGJSBBase.h"
 #include "input_output/FGPropertyManager.h"
-#include "input_output/FGGroundCallback.h"
 #include "input_output/FGXMLFileRead.h"
 #include "models/FGPropagate.h"
 #include "math/FGColumnVector3.h"
@@ -56,7 +55,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_FDMEXEC "$Id: FGFDMExec.h,v 1.72 2011/10/14 22:46:49 bcoconni Exp $"
+#define ID_FDMEXEC "$Id: FGFDMExec.h,v 1.74 2011/11/09 21:58:26 bcoconni Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -181,7 +180,7 @@ CLASS DOCUMENTATION
                                 property actually maps toa function call of DoTrim().
 
     @author Jon S. Berndt
-    @version $Revision: 1.72 $
+    @version $Revision: 1.74 $
 */
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -268,10 +267,14 @@ public:
       @return true if successful */
   bool RunIC(void);
 
-  /** Sets the ground callback pointer.
-      @param gc A pointer to a ground callback object.
+  /** Sets the ground callback pointer. For optimal memory management, a shared
+      pointer is used internally that maintains a reference counter. The calling
+      application must therefore use FGGroundCallback_ptr 'smart pointers' to
+      manage their copy of the ground callback.
+      @param gc A pointer to a ground callback object
+      @see FGGroundCallback
    */
-  void SetGroundCallback(FGGroundCallback* gc);
+  void SetGroundCallback(FGGroundCallback* gc) { FGLocation::SetGroundCallback(gc); }
 
   /** Loads an aircraft model.
       @param AircraftPath path to the aircraft/ directory. For instance:
@@ -328,7 +331,7 @@ public:
   bool SetSystemsPath(const string& path)   { SystemsPath = RootDir + path; return true; }
   
   /// @name Top-level executive State and Model retrieval mechanism
-  //@{
+  ///@{
   /// Returns the FGAtmosphere pointer.
   FGAtmosphere* GetAtmosphere(void)    {return (FGAtmosphere*)Models[eAtmosphere];}
   /// Returns the FGAccelerations pointer.
@@ -359,15 +362,19 @@ public:
   FGAuxiliary* GetAuxiliary(void)      {return (FGAuxiliary*)Models[eAuxiliary];}
   /// Returns the FGInput pointer.
   FGInput* GetInput(void)              {return (FGInput*)Models[eInput];}
-  /// Returns the FGGroundCallback pointer.
-  FGGroundCallback* GetGroundCallback(void) {return GroundCallback;}
+  /** Get a pointer to the ground callback currently used. It is recommanded
+      to store the returned pointer in a 'smart pointer' FGGroundCallback_ptr.
+      @return A pointer to the current ground callback object.
+      @see FGGroundCallback
+   */
+  FGGroundCallback* GetGroundCallback(void) {return FGLocation::GetGroundCallback();}
   /// Retrieves the script object
   FGScript* GetScript(void) {return Script;}
-  // Returns a pointer to the FGInitialCondition object
+  /// Returns a pointer to the FGInitialCondition object
   FGInitialCondition* GetIC(void)      {return IC;}
-  // Returns a pointer to the FGTrim object
+  /// Returns a pointer to the FGTrim object
   FGTrim* GetTrim(void);
-  //@}
+  ///@}
 
   /// Retrieves the engine path.
   const string& GetEnginePath(void)    {return EnginePath;}
@@ -391,7 +398,7 @@ public:
   }
 
   /// Returns the model name.
-  const string& GetModelName(void) { return modelName; }
+  const string& GetModelName(void) const { return modelName; }
 /*
   /// Returns the current time.
   double GetSimTime(void);
@@ -404,9 +411,9 @@ public:
   /// Returns a vector of strings representing the names of all loaded models (future)
   vector <string> EnumerateFDMs(void);
   /// Gets the number of child FDMs.
-  int GetFDMCount(void) {return (int)ChildFDMList.size();}
+  int GetFDMCount(void) const {return (int)ChildFDMList.size();}
   /// Gets a particular child FDM.
-  childData* GetChildFDM(int i) {return ChildFDMList[i];}
+  childData* GetChildFDM(int i) const {return ChildFDMList[i];}
   /// Marks this instance of the Exec object as a "child" object.
   void SetChild(bool ch) {IsChild = ch;}
 
@@ -503,7 +510,7 @@ public:
   double GetSimTime(void) const { return sim_time; }
 
   /// Returns the simulation delta T.
-  double GetDeltaT(void) {return dT;}
+  double GetDeltaT(void) const {return dT;}
 
   /// Suspends the simulation and sets the delta T to zero.
   void SuspendIntegration(void) {saved_dT = dT; dT = 0.0;}
@@ -513,7 +520,7 @@ public:
 
   /** Returns the simulation suspension state.
       @return true if suspended, false if executing  */
-  bool IntegrationSuspended(void) {return dT == 0.0;}
+  bool IntegrationSuspended(void) const {return dT == 0.0;}
 
   /** Sets the current sim time.
       @param cur_time the current time
@@ -588,7 +595,6 @@ private:
   bool trim_status;
   int ta_mode;
 
-  FGGroundCallback*   GroundCallback;
   FGScript*           Script;
   FGInitialCondition* IC;
   FGTrim*             Trim;
index d787193f595abdd3d95c984c03f88ff50f4d2c15..1706b3019444cb36aff194fd3529cd22a046fcdf 100644 (file)
@@ -63,7 +63,7 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGInitialCondition.cpp,v 1.75 2011/10/23 15:05:32 bcoconni Exp $";
+static const char *IdSrc = "$Id: FGInitialCondition.cpp,v 1.78 2011/11/09 21:57:51 bcoconni Exp $";
 static const char *IdHdr = ID_INITIALCONDITION;
 
 //******************************************************************************
@@ -109,13 +109,16 @@ void FGInitialCondition::ResetIC(double u0, double v0, double w0,
   vPQR_body = FGColumnVector3(p0, q0, r0);
   alpha = alpha0;  beta = beta0;
 
-  position.SetPosition(lonRad0, latRad0, altAGLFt0 + terrain_elevation + sea_level_radius);
+  position.SetLongitude(lonRad0);
+  position.SetLatitude(latRad0);
+  position.SetAltitudeAGL(altAGLFt0, fdmex->GetSimTime());
 
   orientation = FGQuaternion(phi0, theta0, psi0);
   const FGMatrix33& Tb2l = orientation.GetTInv();
 
   vUVW_NED = Tb2l * FGColumnVector3(u0, v0, w0);
   vt = vUVW_NED.Magnitude();
+  lastSpeedSet = setuvw;
 
   Tw2b = FGMatrix33(calpha*cbeta, -calpha*sbeta,  -salpha,
                            sbeta,         cbeta,      0.0,
@@ -130,11 +133,12 @@ void FGInitialCondition::ResetIC(double u0, double v0, double w0,
 void FGInitialCondition::InitializeIC(void)
 {
   alpha=beta=0;
-  terrain_elevation = 0;
-  sea_level_radius = fdmex->GetInertial()->GetRefRadius();
+
   position.SetEllipse(fdmex->GetInertial()->GetSemimajor(), fdmex->GetInertial()->GetSemiminor());
-  position.SetPosition(0., 0., sea_level_radius);
+
+  position.SetPositionGeodetic(0.0, 0.0, 0.0);
   position.SetEarthPositionAngle(fdmex->GetPropagate()->GetEarthPositionAngle());
+
   orientation = FGQuaternion(0.0, 0.0, 0.0);
   vUVW_NED.InitMatrix();
   vPQR_body.InitMatrix();
@@ -144,6 +148,9 @@ void FGInitialCondition::InitializeIC(void)
 
   Tw2b.InitMatrix(1., 0., 0., 0., 1., 0., 0., 0., 1.);
   Tb2w.InitMatrix(1., 0., 0., 0., 1., 0., 0., 0., 1.);
+
+  lastSpeedSet = setvt;
+  lastAltitudeSet = setasl;
 }
 
 //******************************************************************************
@@ -185,7 +192,7 @@ void FGInitialCondition::WriteStateFile(int num)
 
 void FGInitialCondition::SetVequivalentKtsIC(double ve)
 {
-  double altitudeASL = position.GetRadius() - sea_level_radius;
+  double altitudeASL = position.GetAltitudeASL();
   double rho = Atmosphere->GetDensity(altitudeASL);
   double rhoSL = Atmosphere->GetDensitySL();
   SetVtrueFpsIC(ve*ktstofps*sqrt(rhoSL/rho));
@@ -196,7 +203,7 @@ void FGInitialCondition::SetVequivalentKtsIC(double ve)
 
 void FGInitialCondition::SetMachIC(double mach)
 {
-  double altitudeASL = position.GetRadius() - sea_level_radius;
+  double altitudeASL = position.GetAltitudeASL();
   double temperature = Atmosphere->GetTemperature(altitudeASL);
   double soundSpeed = sqrt(SHRatio*Reng*temperature);
   SetVtrueFpsIC(mach*soundSpeed);
@@ -207,7 +214,7 @@ void FGInitialCondition::SetMachIC(double mach)
 
 void FGInitialCondition::SetVcalibratedKtsIC(double vcas)
 {
-  double altitudeASL = position.GetRadius() - sea_level_radius;
+  double altitudeASL = position.GetAltitudeASL();
   double pressure = Atmosphere->GetPressure(altitudeASL);
   double pressureSL = Atmosphere->GetPressureSL();
   double rhoSL = Atmosphere->GetDensitySL();
@@ -671,6 +678,49 @@ void FGInitialCondition::SetWindDirDegIC(double dir)
   calcAeroAngles(_vt_NED);
 }
 
+//******************************************************************************
+
+void FGInitialCondition::SetSeaLevelRadiusFtIC(double slr)
+{
+  fdmex->GetGroundCallback()->SetSeaLevelRadius(slr);
+}
+
+//******************************************************************************
+
+void FGInitialCondition::SetTerrainElevationFtIC(double elev)
+{
+  double agl = GetAltitudeAGLFtIC();
+
+  fdmex->GetGroundCallback()->SetTerrainGeoCentRadius(elev + position.GetSeaLevelRadius());
+
+  if (lastAltitudeSet == setagl)
+    SetAltitudeAGLFtIC(agl);
+}
+
+//******************************************************************************
+
+double FGInitialCondition::GetAltitudeAGLFtIC(void) const
+{
+  return position.GetAltitudeAGL(fdmex->GetSimTime());
+}
+
+//******************************************************************************
+
+double FGInitialCondition::GetTerrainElevationFtIC(void) const
+{
+  return position.GetTerrainRadius(fdmex->GetSimTime())
+       - position.GetSeaLevelRadius();
+}
+
+//******************************************************************************
+
+void FGInitialCondition::SetAltitudeAGLFtIC(double agl)
+{
+  double terrainElevation = position.GetTerrainRadius(fdmex->GetSimTime()) - position.GetSeaLevelRadius();
+  SetAltitudeASLFtIC(agl + terrainElevation);
+  lastAltitudeSet = setagl;
+}
+
 //******************************************************************************
 // Set the altitude SL. If the airspeed has been previously set with parameters
 // that are atmosphere dependent (Mach, VCAS, VEAS) then the true airspeed is
@@ -678,7 +728,7 @@ void FGInitialCondition::SetWindDirDegIC(double dir)
 
 void FGInitialCondition::SetAltitudeASLFtIC(double alt)
 {
-  double altitudeASL = position.GetRadius() - sea_level_radius;
+  double altitudeASL = position.GetAltitudeASL();
   double temperature = Atmosphere->GetTemperature(altitudeASL);
   double pressure = Atmosphere->GetPressure(altitudeASL);
   double pressureSL = Atmosphere->GetPressureSL();
@@ -691,7 +741,7 @@ void FGInitialCondition::SetAltitudeASLFtIC(double alt)
   double ve0 = vt * sqrt(rho/rhoSL);
 
   altitudeASL=alt;
-  position.SetRadius(alt + sea_level_radius);
+  position.SetAltitudeASL(alt);
 
   temperature = Atmosphere->GetTemperature(altitudeASL);
   soundSpeed = sqrt(SHRatio*Reng*temperature);
@@ -712,6 +762,47 @@ void FGInitialCondition::SetAltitudeASLFtIC(double alt)
     default: // Make the compiler stop complaining about missing enums
       break;
   }
+
+  lastAltitudeSet = setasl;
+}
+
+//******************************************************************************
+
+void FGInitialCondition::SetLatitudeRadIC(double lat)
+{
+  double altitude;
+
+  switch(lastAltitudeSet) {
+  case setagl:
+    altitude = GetAltitudeAGLFtIC();
+    position.SetLatitude(lat);
+    SetAltitudeAGLFtIC(altitude);
+    break;
+  default:
+    altitude = position.GetAltitudeASL();
+    position.SetLatitude(lat);
+    position.SetAltitudeASL(altitude);
+  }
+}
+
+//******************************************************************************
+
+void FGInitialCondition::SetLongitudeRadIC(double lon)
+{
+  double altitude;
+
+  switch(lastAltitudeSet) {
+  case setagl:
+    altitude = GetAltitudeAGLFtIC();
+    position.SetLongitude(lon);
+    SetAltitudeAGLFtIC(altitude);
+    break;
+  default:
+    altitude = position.GetAltitudeASL();
+    position.SetLongitude(lon);
+    position.SetAltitudeASL(altitude);
+    break;
+  }
 }
 
 //******************************************************************************
@@ -764,7 +855,7 @@ double FGInitialCondition::GetBodyWindFpsIC(int idx) const
 
 double FGInitialCondition::GetVcalibratedKtsIC(void) const
 {
-  double altitudeASL = position.GetRadius() - sea_level_radius;
+  double altitudeASL = position.GetAltitudeASL();
   double temperature = Atmosphere->GetTemperature(altitudeASL);
   double pressure = Atmosphere->GetPressure(altitudeASL);
   double pressureSL = Atmosphere->GetPressureSL();
@@ -778,7 +869,7 @@ double FGInitialCondition::GetVcalibratedKtsIC(void) const
 
 double FGInitialCondition::GetVequivalentKtsIC(void) const
 {
-  double altitudeASL = position.GetRadius() - sea_level_radius;
+  double altitudeASL = position.GetAltitudeASL();
   double rho = Atmosphere->GetDensity(altitudeASL);
   double rhoSL = Atmosphere->GetDensitySL();
   return fpstokts * vt * sqrt(rho/rhoSL);
@@ -788,7 +879,7 @@ double FGInitialCondition::GetVequivalentKtsIC(void) const
 
 double FGInitialCondition::GetMachIC(void) const
 {
-  double altitudeASL = position.GetRadius() - sea_level_radius;
+  double altitudeASL = position.GetAltitudeASL();
   double temperature = Atmosphere->GetTemperature(altitudeASL);
   double soundSpeed = sqrt(SHRatio*Reng*temperature);
   return vt / soundSpeed;
@@ -868,18 +959,18 @@ bool FGInitialCondition::Load_v1(void)
   bool result = true;
 
   if (document->FindElement("latitude"))
-    position.SetLatitude(document->FindElementValueAsNumberConvertTo("latitude", "RAD"));
+    SetLatitudeRadIC(document->FindElementValueAsNumberConvertTo("latitude", "RAD"));
   if (document->FindElement("longitude"))
-    position.SetLongitude(document->FindElementValueAsNumberConvertTo("longitude", "RAD"));
+    SetLongitudeRadIC(document->FindElementValueAsNumberConvertTo("longitude", "RAD"));
   if (document->FindElement("elevation"))
-    terrain_elevation = document->FindElementValueAsNumberConvertTo("elevation", "FT");
+    SetTerrainElevationFtIC(document->FindElementValueAsNumberConvertTo("elevation", "FT"));
 
   if (document->FindElement("altitude")) // This is feet above ground level
-    position.SetRadius(document->FindElementValueAsNumberConvertTo("altitude", "FT") + terrain_elevation + sea_level_radius);
+    SetAltitudeAGLFtIC(document->FindElementValueAsNumberConvertTo("altitude", "FT"));
   else if (document->FindElement("altitudeAGL")) // This is feet above ground level
-    position.SetRadius(document->FindElementValueAsNumberConvertTo("altitudeAGL", "FT") + terrain_elevation + sea_level_radius);
+    SetAltitudeAGLFtIC(document->FindElementValueAsNumberConvertTo("altitudeAGL", "FT"));
   else if (document->FindElement("altitudeMSL")) // This is feet above sea level
-    position.SetRadius(document->FindElementValueAsNumberConvertTo("altitudeMSL", "FT") + sea_level_radius);
+    SetAltitudeASLFtIC(document->FindElementValueAsNumberConvertTo("altitudeMSL", "FT"));
 
   FGColumnVector3 vOrient = orientation.GetEuler();
 
@@ -957,9 +1048,6 @@ bool FGInitialCondition::Load_v2(void)
   if (document->FindElement("earth_position_angle"))
     position.SetEarthPositionAngle(document->FindElementValueAsNumberConvertTo("earth_position_angle", "RAD"));
 
-  if (document->FindElement("elevation"))
-    terrain_elevation = document->FindElementValueAsNumberConvertTo("elevation", "FT");
-
   // Initialize vehicle position
   //
   // Allowable frames:
@@ -974,20 +1062,25 @@ bool FGInitialCondition::Load_v2(void)
       position = position.GetTi2ec() * position_el->FindElementTripletConvertTo("FT");
     } else if (frame == "ecef") {
       if (!position_el->FindElement("x") && !position_el->FindElement("y") && !position_el->FindElement("z")) {
+
+        if (position_el->FindElement("longitude"))
+          position.SetLongitude(position_el->FindElementValueAsNumberConvertTo("longitude", "RAD"));
+
+        if (position_el->FindElement("latitude"))
+          position.SetLatitude(position_el->FindElementValueAsNumberConvertTo("latitude", "RAD"));
+
         if (position_el->FindElement("radius")) {
           position.SetRadius(position_el->FindElementValueAsNumberConvertTo("radius", "FT"));
         } else if (position_el->FindElement("altitudeAGL")) {
-          position.SetRadius(sea_level_radius + terrain_elevation + position_el->FindElementValueAsNumberConvertTo("altitudeAGL", "FT"));
+          position.SetAltitudeAGL(position_el->FindElementValueAsNumberConvertTo("altitudeAGL", "FT"),
+                                  fdmex->GetSimTime());
         } else if (position_el->FindElement("altitudeMSL")) {
-          position.SetRadius(sea_level_radius + position_el->FindElementValueAsNumberConvertTo("altitudeMSL", "FT"));
+          position.SetAltitudeASL(position_el->FindElementValueAsNumberConvertTo("altitudeMSL", "FT"));
         } else {
           cerr << endl << "  No altitude or radius initial condition is given." << endl;
           result = false;
         }
-        if (position_el->FindElement("longitude"))
-          position.SetLongitude(position_el->FindElementValueAsNumberConvertTo("longitude", "RAD"));
-        if (position_el->FindElement("latitude"))
-          position.SetLatitude(position_el->FindElementValueAsNumberConvertTo("latitude", "RAD"));
+
       } else {
         position = position_el->FindElementTripletConvertTo("FT");
       }
@@ -1000,6 +1093,9 @@ bool FGInitialCondition::Load_v2(void)
     result = false;
   }
 
+  if (document->FindElement("elevation"))
+    fdmex->GetGroundCallback()->SetTerrainGeoCentRadius(document->FindElementValueAsNumberConvertTo("elevation", "FT")+position.GetSeaLevelRadius());
+
   // End of position initialization
 
   // Initialize vehicle orientation
@@ -1101,8 +1197,10 @@ bool FGInitialCondition::Load_v2(void)
     if (frame == "eci") {
       FGColumnVector3 omega_cross_r = vOmegaEarth * (position.GetTec2i() * position);
       vUVW_NED = mTec2l * (vInitVelocity - omega_cross_r);
+      lastSpeedSet = setned;
     } else if (frame == "ecef") {
       vUVW_NED = mTec2l * vInitVelocity;
+      lastSpeedSet = setned;
     } else if (frame == "local") {
       vUVW_NED = vInitVelocity;
       lastSpeedSet = setned;
index 03f11f06481e0fed68e23d85f59a8a0de8a0dc66..ce56991aa1356712aed3b8059de06573f663759b 100644 (file)
@@ -54,7 +54,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_INITIALCONDITION "$Id: FGInitialCondition.h,v 1.31 2011/10/23 15:05:32 bcoconni Exp $"
+#define ID_INITIALCONDITION "$Id: FGInitialCondition.h,v 1.32 2011/11/06 18:14:51 bcoconni Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -68,6 +68,7 @@ class FGColumnVector3;
 class FGAtmosphere;
 
 typedef enum { setvt, setvc, setve, setmach, setuvw, setned, setvg } speedset;
+typedef enum { setasl, setagl} altitudeset;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DOCUMENTATION
@@ -214,7 +215,7 @@ CLASS DOCUMENTATION
    @property ic/r-rad_sec (read/write) Yaw rate initial condition in radians/second
 
    @author Tony Peden
-   @version "$Id: FGInitialCondition.h,v 1.31 2011/10/23 15:05:32 bcoconni Exp $"
+   @version "$Id: FGInitialCondition.h,v 1.32 2011/11/06 18:14:51 bcoconni Exp $"
 */
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -291,24 +292,23 @@ public:
 
   /** Sets the initial Altitude above ground level.
       @param agl Altitude above ground level in feet */
-  void SetAltitudeAGLFtIC(double agl)
-  { SetAltitudeASLFtIC(terrain_elevation + agl); }
+  void SetAltitudeAGLFtIC(double agl);
 
   /** Sets the initial sea level radius from planet center
       @param sl_rad sea level radius in feet */
-  void SetSeaLevelRadiusFtIC(double sl_rad) { sea_level_radius = sl_rad; }
+  void SetSeaLevelRadiusFtIC(double slr);
 
   /** Sets the initial terrain elevation.
       @param elev Initial terrain elevation in feet */
-  void SetTerrainElevationFtIC(double elev) { terrain_elevation = elev; }
+  void SetTerrainElevationFtIC(double elev);
 
   /** Sets the initial latitude.
       @param lat Initial latitude in degrees */
-  void SetLatitudeDegIC(double lat) { position.SetLatitude(lat*degtorad); }
+  void SetLatitudeDegIC(double lat) { SetLatitudeRadIC(lat*degtorad); }
 
   /** Sets the initial longitude.
       @param lon Initial longitude in degrees */
-  void SetLongitudeDegIC(double lon) { position.SetLongitude(lon*degtorad); }
+  void SetLongitudeDegIC(double lon) { SetLongitudeRadIC(lon*degtorad); }
 
   /** Gets the initial calibrated airspeed.
       @return Initial calibrated airspeed in knots */
@@ -370,15 +370,15 @@ public:
 
   /** Gets the initial altitude above sea level.
       @return Initial altitude in feet. */
-  double GetAltitudeASLFtIC(void) const { return position.GetRadius() - sea_level_radius; }
+  double GetAltitudeASLFtIC(void) const { return position.GetAltitudeASL(); }
 
   /** Gets the initial altitude above ground level.
       @return Initial altitude AGL in feet */
-  double GetAltitudeAGLFtIC(void) const { return position.GetRadius() - sea_level_radius - terrain_elevation; }
+  double GetAltitudeAGLFtIC(void) const;
 
   /** Gets the initial terrain elevation.
       @return Initial terrain elevation in feet */
-  double GetTerrainElevationFtIC(void) const { return terrain_elevation; }
+  double GetTerrainElevationFtIC(void) const;
 
   /** Sets the initial ground speed.
       @param vg Initial ground speed in feet/second */
@@ -585,11 +585,11 @@ public:
 
   /** Sets the initial latitude.
       @param lat Initial latitude in radians */
-  void SetLatitudeRadIC(double lat) { position.SetLatitude(lat); }
+  void SetLatitudeRadIC(double lat);
 
   /** Sets the initial longitude.
       @param lon Initial longitude in radians */
-  void SetLongitudeRadIC(double lon) { position.SetLongitude(lon); }
+  void SetLongitudeRadIC(double lon);
 
   /** Sets the target normal load factor.
       @param nlf Normal load factor*/
@@ -665,14 +665,14 @@ private:
   FGLocation position;
   FGQuaternion orientation;
   double vt;
-  double sea_level_radius;
-  double terrain_elevation;
+
   double targetNlfIC;
 
   FGMatrix33 Tw2b, Tb2w;
   double  alpha, beta;
 
   speedset lastSpeedSet;
+  altitudeset lastAltitudeSet;
 
   FGFDMExec *fdmex;
   FGPropertyManager *PropertyManager;
index cc863c85dc19bd407dda24a631fa35a04f952a73..f20c96ef4e9a774b2e0ba29e90af9148db9c8d3a 100644 (file)
@@ -54,7 +54,7 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGTrim.cpp,v 1.15 2011/02/19 16:29:29 bcoconni Exp $";
+static const char *IdSrc = "$Id: FGTrim.cpp,v 1.16 2011/11/10 12:06:13 jberndt Exp $";
 static const char *IdHdr = ID_TRIM;
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -244,7 +244,7 @@ bool FGTrim::DoTrim(void) {
     //<< "  " << TrimAxes[current_axis]->GetControlName()<< endl;
     if(TrimAxes[current_axis]->GetStateType() == tQdot) {
       if(mode == tGround) {
-         TrimAxes[current_axis]->initTheta();
+        TrimAxes[current_axis]->initTheta();
       }
     }
     xlo=TrimAxes[current_axis]->GetControlMin();
index 10063f9b95f205f43d9455ff594e80b6b333c038..91937956df507bfd47a7d755626325f63e66ccc8 100644 (file)
@@ -38,17 +38,21 @@ SENTRY
 INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#include "math/FGColumnVector3.h"
-#include "math/FGLocation.h"
+#include "FGJSBBase.h"
+#include "simgear/structure/SGReferenced.hxx"
+#include "simgear/structure/SGSharedPtr.hxx"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_GROUNDCALLBACK "$Id: FGGroundCallback.h,v 1.12 2011/10/14 22:46:49 bcoconni Exp $"
+#define ID_GROUNDCALLBACK "$Id: FGGroundCallback.h,v 1.15 2011/11/19 14:14:57 bcoconni Exp $"
 
 namespace JSBSim {
 
+class FGLocation;
+class FGColumnVector3;
+
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DOCUMENTATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@@ -59,14 +63,14 @@ CLASS DOCUMENTATION
     ball formed earth with an adjustable terrain elevation.
 
     @author Mathias Froehlich
-    @version $Id: FGGroundCallback.h,v 1.12 2011/10/14 22:46:49 bcoconni Exp $
+    @version $Id: FGGroundCallback.h,v 1.15 2011/11/19 14:14:57 bcoconni Exp $
 */
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DECLARATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-class FGGroundCallback : public FGJSBBase
+class FGGroundCallback : public FGJSBBase, public SGReferenced
 {
 public:
 
@@ -119,6 +123,8 @@ public:
 
 };
 
+typedef SGSharedPtr<FGGroundCallback> FGGroundCallback_ptr;
+
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 // The default sphere earth implementation:
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
old mode 100644 (file)
new mode 100755 (executable)
index 7a88d54..acf1736
@@ -55,7 +55,7 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGScript.cpp,v 1.48 2011/09/07 02:36:04 jberndt Exp $";
+static const char *IdSrc = "$Id: FGScript.cpp,v 1.49 2011/11/10 12:06:14 jberndt Exp $";
 static const char *IdHdr = ID_FGSCRIPT;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -595,7 +595,7 @@ void FGScript::Debug(int from)
             cout << "  Notifications" << ":" << endl << "    {" << endl;
             for (unsigned j=0; j<Events[i].NotifyProperties.size();j++) {
               cout << "      "
-                  << Events[i].NotifyProperties[j]->GetRelativeName("/fdm/jsbsim/")
+                   << Events[i].NotifyProperties[j]->GetRelativeName("/fdm/jsbsim/")
                    << endl;
             }
             cout << "    }" << endl;
index 719a3e79d392c43f6383eeff23243f089c8a3a08..16106874ac382bc84ad825d8b14526a3eadc4f4e 100644 (file)
@@ -45,7 +45,7 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGCondition.cpp,v 1.14 2011/04/05 20:20:21 andgi Exp $";
+static const char *IdSrc = "$Id: FGCondition.cpp,v 1.16 2011/11/10 12:06:14 jberndt Exp $";
 static const char *IdHdr = ID_CONDITION;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -131,7 +131,7 @@ FGCondition::FGCondition(const string& test, FGPropertyManager* PropertyManager)
   }
   Comparison = mComparison[conditional];
   if (Comparison == ecUndef) {
-       throw("Comparison operator: \""+conditional+"\" does not exist.  Please check the conditional.");
+    throw("Comparison operator: \""+conditional+"\" does not exist.  Please check the conditional.");
   }
   if (is_number(property2)) {
     TestValue = atof(property2.c_str());
@@ -269,8 +269,8 @@ void FGCondition::PrintCondition(void )
   } else {
     if (TestParam2 != 0L)
       cout << "    " << TestParam1->GetName() << " "
-                        << conditional << " "
-                        << TestParam2->GetName();
+           << conditional << " "
+           << TestParam2->GetName();
     else
       cout << "    " << TestParam1->GetName() << " "
                      << conditional << " " << TestValue;
index ce10adfef0a6fc6fc4b4244c6dce4bcee8667224..95c6e6e7d0dc6babc8c4062f5f18ef9bdb88a02f 100644 (file)
@@ -7,6 +7,7 @@
 
  ------- Copyright (C) 1999  Jon S. Berndt (jon@jsbsim.org) ------------------
  -------           (C) 2004  Mathias Froehlich (Mathias.Froehlich@web.de) ----
+ -------           (C) 2011  Ola Røer Thorsen (ola@silentwings.no) -----------
 
  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
@@ -33,6 +34,8 @@ It has vector properties, so you can add multiply ....
 HISTORY
 ------------------------------------------------------------------------------
 04/04/2004   MF    Created
+11/01/2011   ORT   Encapsulated ground callback code in FGLocation and removed
+                   it from FGFDMExec.
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 INCLUDES
@@ -45,10 +48,14 @@ INCLUDES
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGLocation.cpp,v 1.25 2011/10/16 00:19:56 bcoconni Exp $";
+static const char *IdSrc = "$Id: FGLocation.cpp,v 1.26 2011/11/06 18:14:51 bcoconni Exp $";
 static const char *IdHdr = ID_LOCATION;
 using std::cerr;
 using std::endl;
+
+// Set up the default ground callback object.
+FGGroundCallback_ptr FGLocation::GroundCallback = NULL;
+
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
index 743d6ea0934911ba7191ff289824b351a8f4ffb9..7042d798ba6901a4dfa306d602c025c3678cb0d5 100644 (file)
@@ -6,6 +6,7 @@
 
  ------- Copyright (C) 1999  Jon S. Berndt (jon@jsbsim.org) ------------------
  -------           (C) 2004  Mathias Froehlich (Mathias.Froehlich@web.de) ----
+ -------           (C) 2011  Ola Røer Thorsen (ola@silentwings.no) -----------
 
  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
@@ -27,6 +28,8 @@
 HISTORY
 -------------------------------------------------------------------------------
 04/04/2004   MF   Created from code previously in the old positions class.
+11/01/2011   ORT  Encapsulated ground callback code in FGLocation and removed
+                  it from FGFDMExec.
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 SENTRY
@@ -43,12 +46,13 @@ INCLUDES
 #include "input_output/FGPropertyManager.h"
 #include "FGColumnVector3.h"
 #include "FGMatrix33.h"
+#include "input_output/FGGroundCallback.h"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_LOCATION "$Id: FGLocation.h,v 1.28 2011/08/04 12:46:32 jberndt Exp $"
+#define ID_LOCATION "$Id: FGLocation.h,v 1.29 2011/11/06 18:14:51 bcoconni Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -142,7 +146,7 @@ CLASS DOCUMENTATION
     @see W. C. Durham "Aircraft Dynamics & Control", section 2.2
 
     @author Mathias Froehlich
-    @version $Id: FGLocation.h,v 1.28 2011/08/04 12:46:32 jberndt Exp $
+    @version $Id: FGLocation.h,v 1.29 2011/11/06 18:14:51 bcoconni Exp $
   */
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -306,6 +310,70 @@ public:
   //double GetRadius() const { return mECLoc.Magnitude(); } // may not work with FlightGear
   double GetRadius() const { ComputeDerived(); return mRadius; }
 
+  /// @name Functions that need the ground callback to be set
+  ///@{
+  /** Set the altitude above sea level.
+      @param altitudeASL altitude above Sea Level in feet. */
+  void SetAltitudeASL(double altitudeASL)
+  { SetRadius(GroundCallback->GetSeaLevelRadius(*this) + altitudeASL); }
+
+  /** Set the altitude above ground level.
+      @param altitudeAGL altitude above Ground Level in feet. */
+  void SetAltitudeAGL(double altitudeAGL, double time)
+  { SetRadius(GroundCallback->GetTerrainGeoCentRadius(time, *this) + altitudeAGL); }
+
+  /** Get the local sea level radius
+      @return the sea level radius at the location in feet. */
+  double GetSeaLevelRadius(void) const
+  { ComputeDerived(); return GroundCallback->GetSeaLevelRadius(*this); }
+
+  /** Get the local terrain radius
+      @return the terrain level radius at the location in feet. */
+  double GetTerrainRadius(double time) const
+  { ComputeDerived(); return GroundCallback->GetTerrainGeoCentRadius(time, *this); }
+
+  /** Get the altitude above sea level.
+      @return the altitude ASL in feet. */
+  double GetAltitudeASL() const
+  { ComputeDerived(); return GroundCallback->GetAltitude(*this); }
+
+  /** Get the altitude above ground level.
+      @return the altitude AGL in feet. */
+  double GetAltitudeAGL(double time) const {
+    FGLocation c;
+    FGColumnVector3 n,v,w;
+    return GetContactPoint(time,c,n,v,w);
+  }
+
+  /** Get terrain contact point information below the current location.
+      @param time    Simulation time
+      @param contact Contact point location
+      @param normal  Terrain normal vector in contact point    (ECEF frame)
+      @param v       Terrain linear velocity in contact point  (ECEF frame)
+      @param w       Terrain angular velocity in contact point (ECEF frame)
+      @return Location altitude above contact point (AGL) in feet. */
+  double GetContactPoint(double time,
+                         FGLocation& contact, FGColumnVector3& normal,
+                         FGColumnVector3& v, FGColumnVector3& w) const
+  { ComputeDerived(); return GroundCallback->GetAGLevel(time, *this, contact, normal, v, w); }
+
+  /** Sets the ground callback pointer. For optimal memory management, a shared
+      pointer is used internally that maintains a reference counter. The calling
+      application must therefore use FGGroundCallback_ptr 'smart pointers' to
+      manage their copy of the ground callback.
+      @param gc A pointer to a ground callback object
+      @see FGGroundCallback
+   */
+  static void SetGroundCallback(FGGroundCallback* gc) { GroundCallback = gc; }
+
+  /** Get a pointer to the ground callback currently used. It is recommanded
+      to store the returned pointer in a 'smart pointer' FGGroundCallback_ptr.
+      @return A pointer to the current ground callback object.
+      @see FGGroundCallback
+   */
+  static FGGroundCallback* GetGroundCallback(void) { return GroundCallback; }
+  ///@}
+
   /** Transform matrix from local horizontal to earth centered frame.
       Returns a const reference to the rotation matrix of the transform from
       the local horizontal frame to the earth centered frame. */
@@ -520,6 +588,9 @@ private:
       The C++ keyword "mutable" tells the compiler that the data member is
       allowed to change during a const member function. */
   mutable bool mCacheValid;
+
+  /** The ground callback object pointer */
+  static FGGroundCallback_ptr GroundCallback;
 };
 
 /** Scalar multiplication.
index e983550a6da97b574f5240dbbe6508f0904735fa..f147a3a2bc531f9610216704a9391939d96203f7 100644 (file)
@@ -57,7 +57,7 @@ using std::endl;
 
 namespace JSBSim {
   
-static const char *IdSrc = "$Id: FGQuaternion.cpp,v 1.19 2010/12/07 12:57:14 jberndt Exp $";
+static const char *IdSrc = "$Id: FGQuaternion.cpp,v 1.20 2011/10/31 14:54:40 bcoconni Exp $";
 static const char *IdHdr = ID_QUATERNION;
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -154,10 +154,10 @@ FGQuaternion::FGQuaternion(const FGMatrix33& m) : mCacheValid(false)
 /** Returns the derivative of the quaternion corresponding to the
     angular velocities PQR.
     See Stevens and Lewis, "Aircraft Control and Simulation", Second Edition,
-    Equation 1.3-36. 
+    Equation 1.3-36.
     Also see Jack Kuipers, "Quaternions and Rotation Sequences", Equation 11.12.
 */
-FGQuaternion FGQuaternion::GetQDot(const FGColumnVector3& PQR)
+FGQuaternion FGQuaternion::GetQDot(const FGColumnVector3& PQR) const
 {
   return FGQuaternion(
     -0.5*( data[1]*PQR(eP) + data[2]*PQR(eQ) + data[3]*PQR(eR)),
index 8486b49f83068745d0f29b07180c21c74166033a..841ecc2622c3e3dbb85dfc4ccf034bf23c79d32b 100644 (file)
@@ -47,7 +47,7 @@ SENTRY
   DEFINITIONS
   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_QUATERNION "$Id: FGQuaternion.h,v 1.22 2010/12/07 12:57:14 jberndt Exp $"
+#define ID_QUATERNION "$Id: FGQuaternion.h,v 1.23 2011/10/31 14:54:40 bcoconni Exp $"
 
 namespace JSBSim {
 
@@ -164,7 +164,7 @@ public:
       @return the quaternion derivative
       @see Stevens and Lewis, "Aircraft Control and Simulation", Second Edition,
            Equation 1.3-36. */
-  FGQuaternion GetQDot(const FGColumnVector3& PQR);
+  FGQuaternion GetQDot(const FGColumnVector3& PQR) const;
 
   /** Transformation matrix.
       @return a reference to the transformation/rotation matrix
@@ -527,7 +527,4 @@ inline FGQuaternion operator*(double scalar, const FGQuaternion& q) {
 std::ostream& operator<<(std::ostream& os, const FGQuaternion& q);
 
 } // namespace JSBSim
-
-#include "FGMatrix33.h"
-
 #endif
index 5cc609103df437fecbb54aef614c2421cfa2483d..bb50da67f8bcbedfd092cc9138d7b7e26923e001 100644 (file)
@@ -50,7 +50,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_ACCELERATIONS "$Id: FGAccelerations.h,v 1.7 2011/08/21 15:46:48 bcoconni Exp $"
+#define ID_ACCELERATIONS "$Id: FGAccelerations.h,v 1.8 2011/10/31 14:54:41 bcoconni Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -70,7 +70,7 @@ CLASS DOCUMENTATION
     -Calculate the translational velocity
 
     @author Jon S. Berndt, Mathias Froehlich, Bertrand Coconnier
-    @version $Id: FGAccelerations.h,v 1.7 2011/08/21 15:46:48 bcoconni Exp $
+    @version $Id: FGAccelerations.h,v 1.8 2011/10/31 14:54:41 bcoconni Exp $
   */
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -151,7 +151,7 @@ public:
   */
   double GetUVWdot(int idx) const { return vUVWdot(idx); }
 
-  FGColumnVector3& GetBodyAccel(void) { return vBodyAccel; }
+  const FGColumnVector3& GetBodyAccel(void) const { return vBodyAccel; }
 
   double GetBodyAccel(int idx) const { return vBodyAccel(idx); }
 
index a7a2ba69b71214cd881e92239eb93a61d0e3b378..13a499bd54a693d790e1c25db3045ee86716364d 100644 (file)
@@ -50,7 +50,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_AIRCRAFT "$Id: FGAircraft.h,v 1.18 2011/07/10 20:18:14 jberndt Exp $"
+#define ID_AIRCRAFT "$Id: FGAircraft.h,v 1.19 2011/11/10 12:06:14 jberndt Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -91,10 +91,10 @@ CLASS DOCUMENTATION
 @endcode
 
     @author Jon S. Berndt
-    @version $Id: FGAircraft.h,v 1.18 2011/07/10 20:18:14 jberndt Exp $
+    @version $Id: FGAircraft.h,v 1.19 2011/11/10 12:06:14 jberndt Exp $
     @see Cooke, Zyda, Pratt, and McGhee, "NPSNET: Flight Simulation Dynamic Modeling
-          Using Quaternions", Presence, Vol. 1, No. 4, pp. 404-420  Naval Postgraduate
-          School, January 1994
+     Using Quaternions", Presence, Vol. 1, No. 4, pp. 404-420  Naval Postgraduate
+     School, January 1994
     @see D. M. Henderson, "Euler Angles, Quaternions, and Transformation Matrices",
      JSC 12960, July 1977
     @see Richard E. McFarland, "A Standard Kinematic Model for Flight Simulation at
old mode 100644 (file)
new mode 100755 (executable)
index 8e29a7e..d18b305
@@ -50,7 +50,7 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGAuxiliary.cpp,v 1.53 2011/08/17 23:56:01 jberndt Exp $";
+static const char *IdSrc = "$Id: FGAuxiliary.cpp,v 1.55 2011/11/12 18:59:11 bcoconni Exp $";
 static const char *IdHdr = ID_AUXILIARY;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -180,6 +180,8 @@ bool FGAuxiliary::Run(bool Holding)
     }
   }
 
+  UpdateWindMatrices();
+
   Re = Vt * in.Wingchord / in.KinematicViscosity;
 
   double densityD2 = 0.5*in.Density;
@@ -278,7 +280,7 @@ bool FGAuxiliary::Run(bool Holding)
 //          sin(B)          cos(B)     0
 //   sin(a)*cos(B)  -sin(a)*sin(B)   cos(a)
 
-FGMatrix33& FGAuxiliary::GetTw2b(void)
+void FGAuxiliary::UpdateWindMatrices(void)
 {
   double ca, cb, sa, sb;
 
@@ -297,31 +299,7 @@ FGMatrix33& FGAuxiliary::GetTw2b(void)
   mTw2b(3,2) = -sa*sb;
   mTw2b(3,3) =  ca;
 
-  return mTw2b;
-}
-
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-FGMatrix33& FGAuxiliary::GetTb2w(void)
-{
-  double ca, cb, sa, sb;
-
-  ca = cos(alpha);
-  sa = sin(alpha);
-  cb = cos(beta);
-  sb = sin(beta);
-
-  mTb2w(1,1) = ca*cb;
-  mTb2w(1,2) = sb;
-  mTb2w(1,3) = sa*cb;
-  mTb2w(2,1) = -ca*sb;
-  mTb2w(2,2) = cb;
-  mTb2w(2,3) = -sa*sb;
-  mTb2w(3,1) = -sa;
-  mTb2w(3,2) = 0.0;
-  mTb2w(3,3) = ca;
-
-  return mTb2w;
+  mTb2w = mTw2b.Transposed();
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index 45a7382f50fa274ce757006ad3b69544a3f29939..01fc0b91fb3ada339052bcd0fa7b112cca67830a 100644 (file)
@@ -48,7 +48,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_AUXILIARY "$Id: FGAuxiliary.h,v 1.23 2011/08/17 23:56:01 jberndt Exp $"
+#define ID_AUXILIARY "$Id: FGAuxiliary.h,v 1.25 2011/11/12 18:59:11 bcoconni Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -99,7 +99,7 @@ CLASS DOCUMENTATION
     to the JSBSim vPQRdot vector, and the w parameter is equivalent to vPQR.
 
     @author Tony Peden, Jon Berndt
-    @version $Id: FGAuxiliary.h,v 1.23 2011/08/17 23:56:01 jberndt Exp $
+    @version $Id: FGAuxiliary.h,v 1.25 2011/11/12 18:59:11 bcoconni Exp $
 */
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -195,12 +195,12 @@ public:
   /** Calculates and returns the wind-to-body axis transformation matrix.
       @return a reference to the wind-to-body transformation matrix.
       */
-  FGMatrix33& GetTw2b(void);
+  const FGMatrix33& GetTw2b(void) { return mTw2b; }
 
   /** Calculates and returns the body-to-wind axis transformation matrix.
       @return a reference to the wind-to-body transformation matrix.
       */
-  FGMatrix33& GetTb2w(void);
+  const FGMatrix33& GetTb2w(void) { return mTb2w; }
 
   double Getqbar          (void) const { return qbar;       }
   double GetqbarUW        (void) const { return qbarUW;     }
@@ -225,7 +225,7 @@ public:
   /** The vertical acceleration in g's of the aircraft center of gravity. */
   double GetNz            (void) const { return Nz;         }
 
-  FGColumnVector3& GetNwcg(void) { return vNwcg; }
+  const FGColumnVector3& GetNwcg(void) const { return vNwcg; }
 
   double GetHOverBCG(void) const { return hoverbcg; }
   double GetHOverBMAC(void) const { return hoverbmac; }
@@ -248,7 +248,7 @@ public:
   double GetLatitudeRelativePosition  (void) const { return lat_relative_position; }
   double GetDistanceRelativePosition  (void) const { return relative_position; }
 
-  void SetAeroPQR(FGColumnVector3 tt) { vAeroPQR = tt; }
+  void SetAeroPQR(const FGColumnVector3& tt) { vAeroPQR = tt; }
 
   struct Inputs {
     double Pressure;
@@ -329,6 +329,8 @@ private:
   double lat_relative_position;
   double relative_position;
 
+  void UpdateWindMatrices(void);
+
   void CalculateRelativePosition(void);
 
   void bind(void);
index d98d543dd038cb7f3d3ca7d1255a9b52194827d6..b5081760850183e647859ae7b12e9147b969d9d7 100644 (file)
@@ -45,7 +45,7 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGBuoyantForces.cpp,v 1.20 2011/08/06 13:47:59 jberndt Exp $";
+static const char *IdSrc = "$Id: FGBuoyantForces.cpp,v 1.21 2011/10/31 14:54:41 bcoconni Exp $";
 static const char *IdHdr = ID_BUOYANTFORCES;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -146,7 +146,7 @@ bool FGBuoyantForces::Load(Element *element)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-double FGBuoyantForces::GetGasMass(void)
+double FGBuoyantForces::GetGasMass(void) const
 {
   double Gw = 0.0;
 
@@ -187,7 +187,7 @@ const FGMatrix33& FGBuoyantForces::GetGasMassInertia(void)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGBuoyantForces::GetBuoyancyStrings(string delimeter)
+string FGBuoyantForces::GetBuoyancyStrings(const string& delimeter)
 {
   string CoeffStrings = "";
 /*
@@ -217,7 +217,7 @@ string FGBuoyantForces::GetBuoyancyStrings(string delimeter)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGBuoyantForces::GetBuoyancyValues(string delimeter)
+string FGBuoyantForces::GetBuoyancyValues(const string& delimeter)
 {
   string SDValues = "";
 /*
index a844b9c3b491989b4ac7cbcf484a7bccf8a87c1d..4b23841c7259d05bbb5360a53f5f6ecd2486a97d 100644 (file)
@@ -51,7 +51,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_BUOYANTFORCES "$Id: FGBuoyantForces.h,v 1.15 2011/08/14 20:15:56 jberndt Exp $"
+#define ID_BUOYANTFORCES "$Id: FGBuoyantForces.h,v 1.16 2011/10/31 14:54:41 bcoconni Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -96,7 +96,7 @@ CLASS DOCUMENTATION
     See FGGasCell for the full configuration file format for gas cells.
 
     @author Anders Gidenstam, Jon S. Berndt
-    @version $Id: FGBuoyantForces.h,v 1.15 2011/08/14 20:15:56 jberndt Exp $
+    @version $Id: FGBuoyantForces.h,v 1.16 2011/10/31 14:54:41 bcoconni Exp $
 */
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -150,7 +150,7 @@ public:
   /** Gets the total gas mass. The gas mass is part of the aircraft's
       inertia.
       @return mass in slugs. */
-  double GetGasMass(void);
+  double GetGasMass(void) const;
 
   /** Gets the total moment from the gas mass.
       @return a moment vector in the structural frame in lbs in. */
@@ -164,13 +164,13 @@ public:
   /** Gets the strings for the current set of gas cells.
       @param delimeter either a tab or comma string depending on output type
       @return a string containing the descriptive names for all parameters */
-  string GetBuoyancyStrings(string delimeter);
+  string GetBuoyancyStrings(const string& delimeter);
 
   /** Gets the coefficient values.
       @param delimeter either a tab or comma string depending on output type
       @return a string containing the numeric values for the current set of
       parameters */
-  string GetBuoyancyValues(string delimeter);
+  string GetBuoyancyValues(const string& delimeter);
 
   FGGasCell::Inputs in;
 
old mode 100644 (file)
new mode 100755 (executable)
index 12ade79..f0ef173
@@ -60,7 +60,7 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGExternalForce.cpp,v 1.10 2009/10/24 22:59:30 jberndt Exp $";
+static const char *IdSrc = "$Id: FGExternalForce.cpp,v 1.11 2011/10/31 14:54:41 bcoconni Exp $";
 static const char *IdHdr = ID_EXTERNALFORCE;
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -168,7 +168,7 @@ void FGExternalForce::SetMagnitude(double mag)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-FGColumnVector3& FGExternalForce::GetBodyForces(void)
+const FGColumnVector3& FGExternalForce::GetBodyForces(void)
 {
   if (Magnitude_Function) {
     double mag = Magnitude_Function->GetValue();
old mode 100644 (file)
new mode 100755 (executable)
index 5ece2bf..5c8ec26
@@ -51,7 +51,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_EXTERNALFORCE "$Id: FGExternalForce.h,v 1.9 2010/11/18 12:38:06 jberndt Exp $"
+#define ID_EXTERNALFORCE "$Id: FGExternalForce.h,v 1.10 2011/10/31 14:54:41 bcoconni Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -154,7 +154,7 @@ public:
   void SetMagnitude(double mag);
   void SetAzimuth(double az) {azimuth = az;}
 
-  FGColumnVector3& GetBodyForces(void);
+  const FGColumnVector3& GetBodyForces(void);
   double GetMagnitude(void) const {return magnitude;}
   double GetAzimuth(void) const {return azimuth;}
   double GetX(void) const {return vDirection(eX);}
old mode 100644 (file)
new mode 100755 (executable)
index 9f9164e..7945abf
@@ -48,7 +48,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_EXTERNALREACTIONS "$Id: FGExternalReactions.h,v 1.13 2011/07/20 12:16:34 jberndt Exp $"
+#define ID_EXTERNALREACTIONS "$Id: FGExternalReactions.h,v 1.14 2011/10/31 14:54:41 bcoconni Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -153,13 +153,13 @@ public:
   /** Retrieves the total forces defined in the external reactions.
       @return the total force in pounds.
   */
-  FGColumnVector3 GetForces(void) const {return vTotalForces;}
+  const FGColumnVector3& GetForces(void) const {return vTotalForces;}
   double GetForces(int idx) const {return vTotalForces(idx);}
 
   /** Retrieves the total moment resulting from the forces defined in the external reactions.
       @return the total moment in foot-pounds.
   */
-  FGColumnVector3 GetMoments(void) const {return vTotalMoments;}
+  const FGColumnVector3& GetMoments(void) const {return vTotalMoments;}
   double GetMoments(int idx) const {return vTotalMoments(idx);}
 
 private:
index c48cc4cc1884774ca8566a0e59f48b98915687cb..5c485c2bd01af1849d07c2c9289da3857b43bc96 100644 (file)
@@ -51,7 +51,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_FCS "$Id: FGFCS.h,v 1.39 2011/08/14 20:15:56 jberndt Exp $"
+#define ID_FCS "$Id: FGFCS.h,v 1.40 2011/10/31 14:54:41 bcoconni Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -168,7 +168,7 @@ CLASS DOCUMENTATION
     @property gear/tailhook-pos-norm
 
     @author Jon S. Berndt
-    @version $Revision: 1.39 $
+    @version $Revision: 1.40 $
     @see FGActuator
     @see FGDeadBand
     @see FGFCSFunction
@@ -243,14 +243,14 @@ public:
       @return throttle command in range from 0 - 1.0 for the given engine */
   double GetThrottleCmd(int engine) const;
 
-  vector <double> GetThrottleCmd() const {return ThrottleCmd;}
+  const vector<double>& GetThrottleCmd() const {return ThrottleCmd;}
 
   /** Gets the mixture command.
       @param engine engine ID number
       @return mixture command in range from 0 - 1.0 for the given engine */
   double GetMixtureCmd(int engine) const { return MixtureCmd[engine]; }
 
-  vector <double> GetMixtureCmd() const {return MixtureCmd;}
+  const vector<double>& GetMixtureCmd() const {return MixtureCmd;}
 
   /** Gets the prop pitch command.
       @param engine engine ID number
@@ -322,20 +322,20 @@ public:
       @return throttle position for the given engine in range from 0 - 1.0 */
   double GetThrottlePos(int engine) const;
 
-  vector <double> GetThrottlePos() const {return ThrottlePos;}
+  const vector<double>& GetThrottlePos() const {return ThrottlePos;}
 
   /** Gets the mixture position.
       @param engine engine ID number
       @return mixture position for the given engine in range from 0 - 1.0 */
   double GetMixturePos(int engine) const { return MixturePos[engine]; }
 
-  vector <double> GetMixturePos() const {return MixturePos;}
+  const vector<double>& GetMixturePos() const {return MixturePos;}
 
   /** Gets the steering position.
       @return steering position in degrees */
   double GetSteerPosDeg(int gear) const { return SteerPosDeg[gear]; }
 
-  vector <double> GetSteerPosDeg() const {return SteerPosDeg;}
+  const vector<double>& GetSteerPosDeg() const {return SteerPosDeg;}
 
   /** Gets the gear position (0 up, 1 down), defaults to down
       @return gear position (0 up, 1 down) */
@@ -354,14 +354,14 @@ public:
       @return prop pitch position for the given engine in range from 0 - 1.0 */
   double GetPropAdvance(int engine) const { return PropAdvance[engine]; }
 
-  vector <double> GetPropAdvance() const { return PropAdvance; }
+  const vector<double>& GetPropAdvance() const { return PropAdvance; }
 
   /** Gets the prop feather position.
       @param engine engine ID number
       @return prop fether for the given engine (on / off)*/
   bool GetPropFeather(int engine) const { return PropFeather[engine]; }
 
-  vector <bool> GetPropFeather() const { return PropFeather; }
+  const vector<bool>& GetPropFeather() const { return PropFeather; }
   //@}
 
   /** Retrieves all component names for inclusion in output stream
@@ -528,7 +528,7 @@ public:
       @return the brake setting for the supplied brake group argument */
   double GetBrake(FGLGear::BrakeGroup bg);
 
-  vector <double> GetBrakePos() const {return BrakePos;}
+  const vector<double>& GetBrakePos() const {return BrakePos;}
 
   /** Gets the left brake.
       @return the left brake setting. */
index b241f78eda6878117f9b297eb6347cacad634a40..1f4d011dc9c6a86dcd5ce70a0d8f803da673e25e 100644 (file)
@@ -43,7 +43,7 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGInertial.cpp,v 1.24 2011/08/04 12:46:32 jberndt Exp $";
+static const char *IdSrc = "$Id: FGInertial.cpp,v 1.25 2011/10/31 14:54:41 bcoconni Exp $";
 static const char *IdHdr = ID_INERTIAL;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -130,7 +130,7 @@ double FGInertial::GetGAccel(double r) const
 // and therefore may need to be expressed (transformed) in another frame,
 // depending on how it is used. See Stevens and Lewis eqn. 1.4-16.
 
-FGColumnVector3 FGInertial::GetGravityJ2(FGColumnVector3 position) const
+FGColumnVector3 FGInertial::GetGravityJ2(const FGColumnVector3& position) const
 {
   FGColumnVector3 J2Gravity;
 
index 0e08abe29a2bef8504dbfafdb1eea6d2343019d8..0bf9f460fbbdbdcded79b3a1f9d51abea632b9ea 100644 (file)
@@ -47,7 +47,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_INERTIAL "$Id: FGInertial.h,v 1.19 2011/08/04 12:46:32 jberndt Exp $"
+#define ID_INERTIAL "$Id: FGInertial.h,v 1.20 2011/10/31 14:54:41 bcoconni Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -86,9 +86,9 @@ public:
   double SLgravity(void) const {return gAccelReference;}
   double gravity(void) const {return gAccel;}
   double omega(void) const {return RotationRate;}
-  FGColumnVector3 GetOmegaPlanet() const {return vOmegaPlanet;}
+  const FGColumnVector3& GetOmegaPlanet() const {return vOmegaPlanet;}
   double GetGAccel(double r) const;
-  FGColumnVector3 GetGravityJ2(FGColumnVector3 position) const;
+  FGColumnVector3 GetGravityJ2(const FGColumnVector3& position) const;
   double GetRefRadius(void) const {return RadiusReference;}
   double GetSemimajor(void) const {return a;}
   double GetSemiminor(void) const {return b;}
index cb3d8f521f8a064b608e7bf0e17f5b376a1ac803..5f801f4281bd009586fd9b6529cfa70e737dde0a 100644 (file)
@@ -60,7 +60,7 @@ DEFINITIONS
 GLOBAL DATA
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-static const char *IdSrc = "$Id: FGLGear.cpp,v 1.89 2011/09/11 11:36:04 bcoconni Exp $";
+static const char *IdSrc = "$Id: FGLGear.cpp,v 1.92 2011/11/10 12:06:14 jberndt Exp $";
 static const char *IdHdr = ID_LGEAR;
 
 // Body To Structural (body frame is rotated 180 deg about Y and lengths are given in
@@ -274,7 +274,7 @@ FGLGear::~FGLGear()
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-FGColumnVector3& FGLGear::GetBodyForces(void)
+const FGColumnVector3& FGLGear::GetBodyForces(void)
 {
   double t = fdmex->GetSimTime();
 
@@ -290,7 +290,7 @@ FGColumnVector3& FGLGear::GetBodyForces(void)
     gearLoc = in.Location.LocalToLocation(vLocalGear);
     // Compute the height of the theoretical location of the wheel (if strut is
     // not compressed) with respect to the ground level
-    double height = fdmex->GetGroundCallback()->GetAGLevel(t, gearLoc, contact, normal, terrainVel, dummy);
+    double height = gearLoc.GetContactPoint(t, contact, normal, terrainVel, dummy);
     vGroundNormal = in.Tec2b * normal;
 
     // The height returned above is the AGL and is expressed in the Z direction
@@ -339,11 +339,10 @@ FGColumnVector3& FGLGear::GetBodyForces(void)
       vLocalWhlVel = Transform().Transposed() * vBodyWhlVel;
 
       if (fdmex->GetTrimStatus())
-       compressSpeed = 0.0; // Steady state is sought during trimming
+        compressSpeed = 0.0; // Steady state is sought during trimming
       else {
-       compressSpeed = -vLocalWhlVel(eX);
-       if (eContactType == ctBOGEY)
-         compressSpeed /= LGearProj;
+        compressSpeed = -vLocalWhlVel(eX);
+        if (eContactType == ctBOGEY) compressSpeed /= LGearProj;
       }
 
       ComputeVerticalStrutForce();
index ba44029feb7b7ba61600a08f9c2eb46481c1a1f5..792f1bb2ea6d1cfb9f298ebcdff0c708ea57307a 100644 (file)
@@ -49,7 +49,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_LGEAR "$Id: FGLGear.h,v 1.47 2011/08/30 21:05:56 bcoconni Exp $"
+#define ID_LGEAR "$Id: FGLGear.h,v 1.48 2011/10/31 14:54:41 bcoconni Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -178,7 +178,7 @@ CLASS DOCUMENTATION
         </contact>
 @endcode
     @author Jon S. Berndt
-    @version $Id: FGLGear.h,v 1.47 2011/08/30 21:05:56 bcoconni Exp $
+    @version $Id: FGLGear.h,v 1.48 2011/10/31 14:54:41 bcoconni 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",
@@ -238,19 +238,19 @@ public:
   ~FGLGear();
 
   /// The Force vector for this gear
-  FGColumnVector3& GetBodyForces(void);
+  const FGColumnVector3& GetBodyForces(void);
 
   /// Gets the location of the gear in Body axes
-  FGColumnVector3 GetBodyLocation(void) const { return in.vWhlBodyVec[GearNumber]; }
+  const FGColumnVector3& GetBodyLocation(void) const { return in.vWhlBodyVec[GearNumber]; }
   double GetBodyLocation(int idx) const { return in.vWhlBodyVec[GearNumber](idx); }
 
-  FGColumnVector3& GetLocalGear(void) { return vLocalGear; }
+  const FGColumnVector3& GetLocalGear(void) const { return vLocalGear; }
   double GetLocalGear(int idx) const { return vLocalGear(idx); }
 
   /// Gets the name of the gear
-  string GetName(void) const {return name;          }
+  const string& GetName(void) const {return name; }
   /// Gets the Weight On Wheels flag value
-  bool   GetWOW(void) const {return WOW;           }
+  bool    GetWOW(void) const {return WOW; }
   /// Gets the current compressed length of the gear in feet
   double  GetCompLen(void) const {return compressLength;}
   /// Gets the current gear compression velocity in ft/sec
@@ -276,17 +276,17 @@ public:
   /** Get the console touchdown reporting feature
       @return true if reporting is turned on */
   bool GetReport(void) const  { return ReportEnable; }
-  double GetSteerNorm(void) const    { return radtodeg/maxSteerAngle*SteerAngle; }
+  double GetSteerNorm(void) const { return radtodeg/maxSteerAngle*SteerAngle; }
   double GetDefaultSteerAngle(double cmd) const { return cmd*maxSteerAngle; }
   double GetstaticFCoeff(void) const { return staticFCoeff; }
 
-  int GetBrakeGroup(void) const { return (int)eBrakeGrp; }
-  int GetSteerType(void) const  { return (int)eSteerType; }
+  int  GetBrakeGroup(void) const   { return (int)eBrakeGrp; }
+  int  GetSteerType(void) const    { return (int)eSteerType; }
 
-  bool GetSteerable(void) const        { return eSteerType != stFixed; }
-  bool GetRetractable(void) const      { return isRetractable;   }
-  bool GetGearUnitUp(void) const       { return GearUp;          }
-  bool GetGearUnitDown(void) const     { return GearDown;        }
+  bool GetSteerable(void) const    { return eSteerType != stFixed; }
+  bool GetRetractable(void) const  { return isRetractable;   }
+  bool GetGearUnitUp(void) const   { return GearUp;          }
+  bool GetGearUnitDown(void) const { return GearDown;        }
   double GetWheelRollForce(void) {
     UpdateForces();
     FGColumnVector3 vForce = mTGear.Transposed() * FGForce::GetBodyForces();
index 9cb32f885824efe2ac7518a7b4ac198d1b6d8a97..dbd8ab3a64565c40fa7b0ac28d4bab5bcd69a30c 100644 (file)
@@ -49,7 +49,7 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGMassBalance.cpp,v 1.37 2011/07/12 01:52:49 jberndt Exp $";
+static const char *IdSrc = "$Id: FGMassBalance.cpp,v 1.39 2011/11/09 21:58:26 bcoconni Exp $";
 static const char *IdHdr = ID_MASSBALANCE;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -291,7 +291,7 @@ void FGMassBalance::AddPointMass(Element* el)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-double FGMassBalance::GetTotalPointMassWeight(void)
+double FGMassBalance::GetTotalPointMassWeight(void) const
 {
   double PM_total_weight = 0.0;
 
@@ -303,7 +303,7 @@ double FGMassBalance::GetTotalPointMassWeight(void)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-FGColumnVector3& FGMassBalance::GetPointMassMoment(void)
+const FGColumnVector3& FGMassBalance::GetPointMassMoment(void)
 {
   PointMassCG.InitMatrix();
 
@@ -315,7 +315,7 @@ FGColumnVector3& FGMassBalance::GetPointMassMoment(void)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-FGMatrix33& FGMassBalance::CalculatePMInertias(void)
+const FGMatrix33& FGMassBalance::CalculatePMInertias(void)
 {
   unsigned int size;
 
index 981eef6dec3d19510f55039614e99a49e3a0807c..9b11290b1da451607bcaa2a7b9e89774344eb8e4 100644 (file)
@@ -49,7 +49,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_MASSBALANCE "$Id: FGMassBalance.h,v 1.25 2011/07/28 12:48:19 jberndt Exp $"
+#define ID_MASSBALANCE "$Id: FGMassBalance.h,v 1.27 2011/11/09 21:58:26 bcoconni Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONSS
@@ -171,12 +171,12 @@ public:
   void SetBaseCG(const FGColumnVector3& CG) {vbaseXYZcg = vXYZcg = CG;}
 
   void AddPointMass(Element* el);
-  double GetTotalPointMassWeight(void);
+  double GetTotalPointMassWeight(void) const;
 
-  FGColumnVector3& GetPointMassMoment(void);
+  const FGColumnVector3& GetPointMassMoment(void);
   const FGMatrix33& GetJ(void) const {return mJ;}
   const FGMatrix33& GetJinv(void) const {return mJinv;}
-  void SetAircraftBaseInertias(FGMatrix33 BaseJ) {baseJ = BaseJ;}
+  void SetAircraftBaseInertias(const FGMatrix33& BaseJ) {baseJ = BaseJ;}
   void GetMassPropertiesReport(void) const;
   
   struct Inputs {
@@ -204,7 +204,7 @@ private:
   FGColumnVector3 vbaseXYZcg;
   FGColumnVector3 vPMxyz;
   FGColumnVector3 PointMassCG;
-  FGMatrix33& CalculatePMInertias(void);
+  const FGMatrix33& CalculatePMInertias(void);
 
 
   /** The PointMass structure encapsulates a point mass object, moments of inertia
@@ -255,9 +255,9 @@ private:
     double GetPointMassLocation(int axis) const {return Location(axis);}
     double GetPointMassWeight(void) const {return Weight;}
     esShape GetShapeType(void) {return eShapeType;}
-    FGColumnVector3 GetLocation(void) {return Location;}
-    FGMatrix33 GetPointMassInertia(void) {return mPMInertia;}
-    string GetName(void) {return Name;}
+    const FGColumnVector3& GetLocation(void) {return Location;}
+    const FGMatrix33& GetPointMassInertia(void) {return mPMInertia;}
+    const string& GetName(void) {return Name;}
 
     void SetPointMassLocation(int axis, double value) {Location(axis) = value;}
     void SetPointMassWeight(double wt) {Weight = wt;}
index 2640bbdcb677c58cbccc1e085223a05241a298be..b7a62d57a8dca86442677cdc8e425ea0cadb3864 100644 (file)
@@ -51,7 +51,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_OUTPUT "$Id: FGOutput.h,v 1.23 2011/05/20 03:18:36 jberndt Exp $"
+#define ID_OUTPUT "$Id: FGOutput.h,v 1.24 2011/11/10 12:06:14 jberndt Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -91,13 +91,13 @@ CLASS DOCUMENTATION
       Examples:
 </pre>
 @code
-       <output name="localhost" type="FLIGHTGEAR" port="5500" protocol="tcp" rate="10"/>
+<output name="localhost" type="FLIGHTGEAR" port="5500" protocol="tcp" rate="10"/>
 @endcode
 @code
-       <output name="B737_datalog.csv" type="CSV" rate="20">
-          <property> velocities/vc-kts </property>
-          <velocities> ON </velocities>
-       </output>
+<output name="B737_datalog.csv" type="CSV" rate="20">
+   <property> velocities/vc-kts </property>
+   <velocities> ON </velocities>
+</output>
 @endcode
 <br>
 <pre>
@@ -124,7 +124,7 @@ CLASS DOCUMENTATION
     propulsion       ON|OFF
 </pre>
     NOTE that Time is always output with the data.
-    @version $Id: FGOutput.h,v 1.23 2011/05/20 03:18:36 jberndt Exp $
+    @version $Id: FGOutput.h,v 1.24 2011/11/10 12:06:14 jberndt Exp $
  */
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index d1ec2b922cdb3df6437eea721323d9ad53c467cf..2ff471740dafc681d3904d10821f9f5415b49350 100644 (file)
@@ -68,7 +68,7 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGPropagate.cpp,v 1.98 2011/10/22 15:11:24 bcoconni Exp $";
+static const char *IdSrc = "$Id: FGPropagate.cpp,v 1.100 2011/11/06 18:14:51 bcoconni Exp $";
 static const char *IdHdr = ID_PROPAGATE;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -113,10 +113,8 @@ FGPropagate::~FGPropagate(void)
 bool FGPropagate::InitModel(void)
 {
   // For initialization ONLY:
-  VState.vLocation.SetRadius( FDMExec->GetGroundCallback()->
-                              GetTerrainGeoCentRadius(0.0,VState.vLocation) + 4.0 );
-
   VState.vLocation.SetEllipse(in.SemiMajor, in.SemiMinor);
+  VState.vLocation.SetAltitudeAGL(4.0, FDMExec->GetSimTime());
 
   vInertialVelocity.InitMatrix();
 
@@ -137,8 +135,6 @@ bool FGPropagate::InitModel(void)
 
 void FGPropagate::SetInitialState(const FGInitialCondition *FGIC)
 {
-  SetTerrainElevation(FGIC->GetTerrainElevationFtIC());
-
   // Initialize the State Vector elements and the transformation matrices
 
   // Set the position lat/lon/radius
@@ -371,7 +367,7 @@ void FGPropagate::UpdateBodyMatrices(void)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-void FGPropagate::SetInertialOrientation(FGQuaternion Qi) {
+void FGPropagate::SetInertialOrientation(const FGQuaternion& Qi) {
   VState.qAttitudeECI = Qi;
   VState.qAttitudeECI.Normalize();
   UpdateBodyMatrices();
@@ -380,7 +376,7 @@ void FGPropagate::SetInertialOrientation(FGQuaternion Qi) {
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-void FGPropagate::SetInertialVelocity(FGColumnVector3 Vi) {
+void FGPropagate::SetInertialVelocity(const FGColumnVector3& Vi) {
   VState.vInertialVelocity = Vi;
   CalculateUVW();
   vVel = Tb2l * VState.vUVW;
@@ -388,7 +384,7 @@ void FGPropagate::SetInertialVelocity(FGColumnVector3 Vi) {
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-void FGPropagate::SetInertialRates(FGColumnVector3 vRates) {
+void FGPropagate::SetInertialRates(const FGColumnVector3& vRates) {
   VState.vPQRi = Ti2b * vRates;
   VState.vPQR = VState.vPQRi - Ti2b * in.vOmegaPlanet;
 }
@@ -397,23 +393,21 @@ void FGPropagate::SetInertialRates(FGColumnVector3 vRates) {
 
 void FGPropagate::RecomputeLocalTerrainVelocity()
 {
-   FGLocation contact;
-   FGColumnVector3 normal;
-   FDMExec->GetGroundCallback()->GetAGLevel(FDMExec->GetSimTime(),
-                                            VState.vLocation,
-                                            contact, normal,
-                                            LocalTerrainVelocity,
-                                            LocalTerrainAngularVelocity);
+  FGLocation contact;
+  FGColumnVector3 normal;
+  VState.vLocation.GetContactPoint(FDMExec->GetSimTime(), contact, normal,
+                                   LocalTerrainVelocity, LocalTerrainAngularVelocity);
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 void FGPropagate::SetTerrainElevation(double terrainElev)
 {
-  double radius = terrainElev + FDMExec->GetGroundCallback()->GetSeaLevelRadius(VState.vLocation);
+  double radius = terrainElev + VState.vLocation.GetSeaLevelRadius();
   FDMExec->GetGroundCallback()->SetTerrainGeoCentRadius(radius);
 }
 
+
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 void FGPropagate::SetSeaLevelRadius(double tt)
@@ -425,49 +419,22 @@ void FGPropagate::SetSeaLevelRadius(double tt)
 
 double FGPropagate::GetLocalTerrainRadius(void) const
 {
-  return FDMExec->GetGroundCallback()->GetTerrainGeoCentRadius(FDMExec->GetSimTime(),
-                                                               VState.vLocation);
-}
-
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-double FGPropagate::GetTerrainElevation(void) const
-{
-  return GetLocalTerrainRadius()
-       - FDMExec->GetGroundCallback()->GetSeaLevelRadius(VState.vLocation);
+  return VState.vLocation.GetTerrainRadius(FDMExec->GetSimTime());
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 double FGPropagate::GetDistanceAGL(void) const
 {
-  FGColumnVector3 dummy;
-  FGLocation dummyloc;
-  double t = FDMExec->GetSimTime();
-  return FDMExec->GetGroundCallback()->GetAGLevel(t, VState.vLocation, dummyloc,
-                                                  dummy, dummy, dummy);
-}
-
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGPropagate::SetAltitudeASL(double altASL)
-{
-  SetRadius(altASL + FDMExec->GetGroundCallback()->GetSeaLevelRadius(VState.vLocation));
-}
-
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-double FGPropagate::GetAltitudeASL(void) const
-{
-  return VState.vLocation.GetRadius()
-       - FDMExec->GetGroundCallback()->GetSeaLevelRadius(VState.vLocation);
+  return VState.vLocation.GetAltitudeAGL(FDMExec->GetSimTime());
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 void FGPropagate::SetDistanceAGL(double tt)
 {
-  SetAltitudeASL(tt + GetTerrainElevation());
+  VState.vLocation.SetAltitudeAGL(tt, FDMExec->GetSimTime());
+  UpdateVehicleState();
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -508,7 +475,6 @@ void FGPropagate::UpdateVehicleState(void)
 void FGPropagate::SetLocation(const FGLocation& l)
 {
   VState.vLocation = l;
-  VState.vLocation.SetEarthPositionAngle(l.GetEPA());
   Ti2ec = VState.vLocation.GetTi2ec(); // useless ?
   Tec2i = Ti2ec.Transposed();
   UpdateVehicleState();
index e1384f616901b415aefbe964d319cd071ad17281..232c306dea286f3979bd71c77904a9c08ad02941 100644 (file)
@@ -49,7 +49,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_PROPAGATE "$Id: FGPropagate.h,v 1.64 2011/10/14 22:46:49 bcoconni Exp $"
+#define ID_PROPAGATE "$Id: FGPropagate.h,v 1.67 2011/11/09 22:07:17 bcoconni Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -93,7 +93,7 @@ CLASS DOCUMENTATION
     @endcode
 
     @author Jon S. Berndt, Mathias Froehlich, Bertrand Coconnier
-    @version $Id: FGPropagate.h,v 1.64 2011/10/14 22:46:49 bcoconni Exp $
+    @version $Id: FGPropagate.h,v 1.67 2011/11/09 22:07:17 bcoconni Exp $
   */
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -257,7 +257,7 @@ public:
       @param idx the index of the velocity component desired (1-based).
       @return The body frame velocity component.
   */
-  double GetUVW   (int idx) const { return VState.vUVW(idx); }
+  double GetUVW(int idx) const { return VState.vUVW(idx); }
 
   /** Retrieves a Local frame velocity component.
       Retrieves a Local frame velocity component. The velocity returned is
@@ -286,14 +286,14 @@ public:
 
   /** Calculates and retrieves the velocity vector relative to the earth centered earth fixed (ECEF) frame.
   */
-  const FGColumnVector3 GetECEFVelocity(void) const {return Tb2ec * VState.vUVW; }
+  FGColumnVector3 GetECEFVelocity(void) const {return Tb2ec * VState.vUVW; }
 
   /** Returns the current altitude above sea level.
       This function returns the altitude above sea level.
       units ft
       @return The current altitude above sea level in feet.
   */
-  double GetAltitudeASL(void)   const;
+  double GetAltitudeASL(void) const { return VState.vLocation.GetAltitudeASL(); }
 
   /** Returns the current altitude above sea level.
       This function returns the altitude above sea level.
@@ -387,7 +387,7 @@ public:
   const FGColumnVector3& GetTerrainAngularVelocity(void) const { return LocalTerrainAngularVelocity; }
   void RecomputeLocalTerrainVelocity();
 
-  double GetTerrainElevation(void) const;
+  double GetTerrainElevation(void) const { return GetLocalTerrainRadius() - VState.vLocation.GetSeaLevelRadius(); }
   double GetDistanceAGL(void)  const;
   double GetRadius(void) const {
       if (VState.vLocation.GetRadius() == 0) return 1.0;
@@ -467,21 +467,21 @@ public:
 
   void SetEarthPositionAngle(double epa) {VState.vLocation.SetEarthPositionAngle(epa);}
 
-  void SetInertialOrientation(FGQuaternion Qi);
-  void SetInertialVelocity(FGColumnVector3 Vi);
-  void SetInertialRates(FGColumnVector3 vRates);
+  void SetInertialOrientation(const FGQuaternion& Qi);
+  void SetInertialVelocity(const FGColumnVector3& Vi);
+  void SetInertialRates(const FGColumnVector3& vRates);
 
   const FGQuaternion GetQuaternion(void) const { return VState.qAttitudeLocal; }
   const FGQuaternion GetQuaternionECI(void) const { return VState.qAttitudeECI; }
 
   void SetPQR(unsigned int i, double val) {
-      if ((i>=1) && (i<=3) )
-          VState.vPQR(i) = val;
+    VState.vPQR(i) = val;
+    VState.vPQRi = VState.vPQR + Ti2b * in.vOmegaPlanet;
   }
 
   void SetUVW(unsigned int i, double val) {
-      if ((i>=1) && (i<=3) )
-          VState.vUVW(i) = val;
+    VState.vUVW(i) = val;
+    CalculateInertialVelocity();
   }
 
 // SET functions
@@ -505,7 +505,11 @@ public:
     VState.vInertialPosition = Tec2i * VState.vLocation;
   }
 
-  void SetAltitudeASL(double altASL);
+  void SetAltitudeASL(double altASL)
+  {
+    VState.vLocation.SetAltitudeASL(altASL);
+    UpdateVehicleState();
+  }
   void SetAltitudeASLmeters(double altASL) { SetAltitudeASL(altASL/fttom); }
 
   void SetSeaLevelRadius(double tt);
@@ -525,7 +529,7 @@ public:
       SetLocation(l);
   }
 
-  void NudgeBodyLocation(FGColumnVector3 deltaLoc) {
+  void NudgeBodyLocation(const FGColumnVector3& deltaLoc) {
     VState.vInertialPosition -= Tb2i*deltaLoc;
     VState.vLocation -= Tb2ec*deltaLoc;
   }
index 2021c822e52a328d4d5ea55120459ecb0584a3f7..bdf0cc9cef63708ec40cf9f7238162d2ad936322 100644 (file)
@@ -66,7 +66,7 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGPropulsion.cpp,v 1.51 2011/09/11 11:36:04 bcoconni Exp $";
+static const char *IdSrc = "$Id: FGPropulsion.cpp,v 1.52 2011/10/31 14:54:41 bcoconni Exp $";
 static const char *IdHdr = ID_PROPULSION;
 
 extern short debug_lvl;
@@ -584,7 +584,7 @@ string FGPropulsion::GetPropulsionTankReport()
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-FGColumnVector3& FGPropulsion::GetTanksMoment(void)
+const FGColumnVector3& FGPropulsion::GetTanksMoment(void)
 {
   vXYZtank_arm.InitMatrix();
   for (unsigned int i=0; i<Tanks.size(); i++) {
@@ -597,7 +597,7 @@ FGColumnVector3& FGPropulsion::GetTanksMoment(void)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-double FGPropulsion::GetTanksWeight(void)
+double FGPropulsion::GetTanksWeight(void) const
 {
   double Tw = 0.0;
 
@@ -608,7 +608,7 @@ double FGPropulsion::GetTanksWeight(void)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-FGMatrix33& FGPropulsion::CalculateTankInertias(void)
+const FGMatrix33& FGPropulsion::CalculateTankInertias(void)
 {
   unsigned int size;
 
index b16b17382df134552621d1069587c5f486ce7a18..4be73b1698acb0814b0ce5e533a5445c45bc5c6d 100644 (file)
@@ -50,7 +50,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_PROPULSION "$Id: FGPropulsion.h,v 1.30 2011/08/03 03:21:06 jberndt Exp $"
+#define ID_PROPULSION "$Id: FGPropulsion.h,v 1.31 2011/10/31 14:54:41 bcoconni Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -92,7 +92,7 @@ CLASS DOCUMENTATION
   @endcode
 
     @author Jon S. Berndt
-    @version $Id: FGPropulsion.h,v 1.30 2011/08/03 03:21:06 jberndt Exp $
+    @version $Id: FGPropulsion.h,v 1.31 2011/10/31 14:54:41 bcoconni Exp $
     @see
     FGEngine
     FGTank
@@ -180,13 +180,13 @@ public:
   void DoRefuel(double time_slice);
   void DumpFuel(double time_slice);
 
-  FGColumnVector3& GetTanksMoment(void);
-  double GetTanksWeight(void);
+  const FGColumnVector3& GetTanksMoment(void);
+  double GetTanksWeight(void) const;
 
   std::ifstream* FindEngineFile(const std::string& filename);
   std::string FindEngineFullPathname(const std::string& engine_filename);
   inline int GetActiveEngine(void) const {return ActiveEngine;}
-  inline bool GetFuelFreeze(void) {return FuelFreeze;}
+  inline bool GetFuelFreeze(void) const {return FuelFreeze;}
   double GetTotalFuelQuantity(void) const {return TotalFuelQuantity;}
 
   void SetMagnetos(int setting);
@@ -194,7 +194,7 @@ public:
   void SetCutoff(int setting=0);
   void SetActiveEngine(int engine);
   void SetFuelFreeze(bool f);
-  FGMatrix33& CalculateTankInertias(void);
+  const FGMatrix33& CalculateTankInertias(void);
 
   struct FGEngine::Inputs in;
 
index c24648e3a1a5588a7d626f3250b51135b01a231c..6101446877bb17f072ec8879753f9497c9238a4c 100644 (file)
@@ -51,7 +51,7 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGWinds.cpp,v 1.5 2011/09/11 11:36:04 bcoconni Exp $";
+static const char *IdSrc = "$Id: FGWinds.cpp,v 1.6 2011/11/10 12:02:34 jberndt Exp $";
 static const char *IdHdr = ID_WINDS;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -435,6 +435,46 @@ void FGWinds::CosineGust()
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
+void FGWinds::NumberOfUpDownburstCells(int num)
+{
+  for (unsigned int i=0; i<UpDownBurstCells.size();i++) delete UpDownBurstCells[i];
+  UpDownBurstCells.clear();
+  if (num >= 0) {
+    for (unsigned int i=0; i<num; i++) UpDownBurstCells.push_back(new struct UpDownBurst);
+  }
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+// Calculates the distance between a specified point (where presumably the
+// Up/Downburst is centered) and the current vehicle location. The distance
+// here is calculated from the Haversine formula.
+
+double FGWinds::DistanceFromRingCenter(double lat, double lon)
+{
+  double deltaLat = in.latitude - lat;
+  double deltaLong = in.longitude - lon;
+  double dLat2 = deltaLat/2.0;
+  double dLong2 = deltaLong/2.0;
+  double a = sin(dLat2)*sin(dLat2)
+             + cos(lat)*cos(in.latitude)*sin(dLong2)*sin(dLong2);
+  double c = 2.0*atan2(sqrt(a), sqrt(1.0 - a));
+  double d = in.planetRadius*c;
+  return d;
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+void FGWinds::UpDownBurst()
+{
+
+  for (unsigned int i=0; i<UpDownBurstCells.size(); i++) {
+    double d = DistanceFromRingCenter(UpDownBurstCells[i]->ringLatitude, UpDownBurstCells[i]->ringLongitude);
+
+  }
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
 void FGWinds::bind(void)
 {
   typedef double (FGWinds::*PMF)(int) const;
@@ -473,6 +513,16 @@ void FGWinds::bind(void)
   PropertyManager->Tie("atmosphere/cosine-gust/Z-velocity-ft_sec", this, (Ptr)0L, &FGWinds::GustZComponent);
   PropertyManager->Tie("atmosphere/cosine-gust/start", this, (PMFt)0L, (PMFi)&FGWinds::StartGust);
 
+  // User-specified Up- Down-burst parameters
+  PropertyManager->Tie("atmosphere/updownburst/number-of-cells", this, (PMFt)0L, &FGWinds::NumberOfUpDownburstCells);
+//  PropertyManager->Tie("atmosphere/updownburst/", this, (Ptr)0L, &FGWinds::);
+//  PropertyManager->Tie("atmosphere/updownburst/", this, (Ptr)0L, &FGWinds::);
+//  PropertyManager->Tie("atmosphere/updownburst/", this, (Ptr)0L, &FGWinds::);
+//  PropertyManager->Tie("atmosphere/updownburst/", this, (Ptr)0L, &FGWinds::);
+//  PropertyManager->Tie("atmosphere/updownburst/", this, (Ptr)0L, &FGWinds::);
+//  PropertyManager->Tie("atmosphere/updownburst/", this, (Ptr)0L, &FGWinds::);
+//  PropertyManager->Tie("atmosphere/updownburst/", this, (Ptr)0L, &FGWinds::);
+
   // User-specified turbulence (local navigational/geographic frame: N-E-D)
   PropertyManager->Tie("atmosphere/turb-north-fps", this, eNorth, (PMF)&FGWinds::GetTurbNED,
                                                           (PMFd)&FGWinds::SetTurbNED);
index 8d8aa0552b76991db370d3f325639470f92defca..fac8338e53cab228b9afc9833fe00751599e9298 100644 (file)
@@ -47,7 +47,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_WINDS "$Id: FGWinds.h,v 1.6 2011/10/22 15:11:24 bcoconni Exp $"
+#define ID_WINDS "$Id: FGWinds.h,v 1.9 2011/11/19 14:14:57 bcoconni Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -154,7 +154,7 @@ public:
   virtual void SetWindNED(const FGColumnVector3& wind) { vWindNED=wind; }
 
   /// Retrieves the wind components in NED frame.
-  virtual FGColumnVector3& GetWindNED(void) { return vWindNED; }
+  virtual const FGColumnVector3& GetWindNED(void) const { return vWindNED; }
 
   /// Retrieves a wind component in NED frame.
   virtual double GetWindNED(int idx) const {return vWindNED(idx);}
@@ -194,7 +194,7 @@ public:
   virtual double GetTurbNED(int idx) const {return vTurbulenceNED(idx);}
 
   /// Retrieves the gust components in NED frame.
-  virtual FGColumnVector3& GetGustNED(void) {return vGustNED;}
+  virtual const FGColumnVector3& GetGustNED(void) const {return vGustNED;}
 
   /** Turbulence models available: ttNone, ttStandard, ttBerndt, ttCulp, ttMilspec, ttTustin */
   virtual void   SetTurbType(tType tt) {turbType = tt;}
@@ -264,7 +264,14 @@ public:
     double ringRadius;                             ///<- The radius of the ring (feet).
     double ringCoreRadius;                         ///<- The cross-section "core" radius of the ring (feet).
     double circulation;                            ///<- The circulation (gamma) (feet-squared per second).
-    struct OneMinusCosineProfile oneMCosineProfile;
+    struct OneMinusCosineProfile oneMCosineProfile;///<- A gust profile structure.
+    UpDownBurst() {                                ///<- Constructor
+      ringLatitude = ringLongitude = 0.0;
+      ringAltitude = 1000.0;
+      ringRadius = 2000.0;
+      ringCoreRadius = 100.0;
+      circulation = 100000.0;
+    }
   };
 
   // 1 - Cosine gust setters
@@ -293,11 +300,17 @@ public:
   /// Specifies the Z component of velocity in the specified gust frame (ft/sec).
   virtual void GustZComponent(double z) {oneMinusCosineGust.vWind(eZ) = z;}
 
+  // Up- Down-burst functions
+  void NumberOfUpDownburstCells(int num);
+
   struct Inputs {
     double V;
     double wingspan;
     double DistanceAGL;
     double AltitudeASL;
+    double longitude;
+    double latitude;
+    double planetRadius;
     FGMatrix33 Tl2b;
     FGMatrix33 Tw2b;
     double totalDeltaT;
@@ -320,6 +333,7 @@ private:
   FGColumnVector3 vTurbPQR;
 
   struct OneMinusCosineGust oneMinusCosineGust;
+  std::vector <struct UpDownBurst*> UpDownBurstCells;
 
   // Dryden turbulence model
   double windspeed_at_20ft; ///< in ft/s
@@ -334,12 +348,13 @@ private:
   FGColumnVector3 vBurstGust;
   FGColumnVector3 vTurbulenceNED;
 
-  /// Get T, P and rho for a standard atmosphere at the given altitude.
   void Turbulence(double h);
+  void UpDownBurst();
 
   void CosineGust();
   double CosineGustProfile( double startDuration, double steadyDuration,
                             double endDuration, double elapsedTime);
+  double DistanceFromRingCenter(double lat, double lon);
 
   virtual void bind(void);
   void Debug(int from);
old mode 100644 (file)
new mode 100755 (executable)
index d6524ed..779014c
@@ -45,7 +45,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_FCSFUNCTION "$Id: FGFCSFunction.h,v 1.7 2009/10/02 10:30:09 jberndt Exp $"
+#define ID_FCSFUNCTION "$Id: FGFCSFunction.h,v 1.8 2011/11/10 12:06:14 jberndt Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -94,18 +94,18 @@ a function (from an aero specification):
         <table>
             <independentVar>velocities/mach</independentVar>
             <tableData>
-                0.0000 0.0220
-                0.2000 0.0200
-                0.6500 0.0220
-                0.9000 0.0240
-                0.9700 0.0500
+                0.0000  0.0220
+                0.2000  0.0200
+                0.6500  0.0220
+                0.9000  0.0240
+                0.9700  0.0500
             </tableData>
         </table>
     </product>
 </function>
 @endcode
 
-    @version $Id: FGFCSFunction.h,v 1.7 2009/10/02 10:30:09 jberndt Exp $
+    @version $Id: FGFCSFunction.h,v 1.8 2011/11/10 12:06:14 jberndt Exp $
 */
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index e0c056b37925ae23bbf369ecf8533269c70c8554..3769934bdfbc759debd1bd24f62186be81772a13 100644 (file)
@@ -53,7 +53,7 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGEngine.cpp,v 1.47 2011/09/11 11:36:04 bcoconni Exp $";
+static const char *IdSrc = "$Id: FGEngine.cpp,v 1.48 2011/10/31 14:54:41 bcoconni Exp $";
 static const char *IdHdr = ID_ENGINE;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -183,7 +183,8 @@ unsigned int FGEngine::GetSourceTank(unsigned int i) const
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-void FGEngine::SetPlacement(FGColumnVector3& location, FGColumnVector3& orientation)
+void FGEngine::SetPlacement(const FGColumnVector3& location,
+                            const FGColumnVector3& orientation)
 {
   X = location(eX);
   Y = location(eY);
@@ -201,14 +202,14 @@ double FGEngine::GetThrust(void) const
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-  FGColumnVector3& FGEngine::GetBodyForces(void)
+const FGColumnVector3& FGEngine::GetBodyForces(void)
 {
   return Thruster->GetBodyForces();
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-FGColumnVector3& FGEngine::GetMoments(void)
+const FGColumnVector3& FGEngine::GetMoments(void)
 {
   return Thruster->GetMoments();
 }
index 33db9998e96fe578ecfa3bdc464f898062e6d33d..66c59ad424ce0ea03bdf13f2167852e0f97aae4d 100644 (file)
@@ -55,7 +55,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_ENGINE "$Id: FGEngine.h,v 1.27 2011/08/17 23:56:01 jberndt Exp $"
+#define ID_ENGINE "$Id: FGEngine.h,v 1.29 2011/11/10 12:06:14 jberndt Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -108,12 +108,12 @@ CLASS DOCUMENTATION
 @endcode
 <pre>
     NOTES:
-       
-       Not all thruster types can be matched with a given engine type.  See the class
-       documentation for engine and thruster classes.
+
+  Not all thruster types can be matched with a given engine type.  See the class
+  documentation for engine and thruster classes.
 </pre>     
     @author Jon S. Berndt
-    @version $Id: FGEngine.h,v 1.27 2011/08/17 23:56:01 jberndt Exp $
+    @version $Id: FGEngine.h,v 1.29 2011/11/10 12:06:14 jberndt Exp $
 */
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -157,28 +157,28 @@ public:
 
   enum EngineType {etUnknown, etRocket, etPiston, etTurbine, etTurboprop, etElectric};
 
-  EngineType      GetType(void) { return Type; }
-  virtual string  GetName(void) { return Name; }
+  EngineType             GetType(void) const { return Type; }
+  virtual const string&  GetName(void) const { return Name; }
 
   // Engine controls
-  virtual double  GetThrottleMin(void) { return MinThrottle; }
-  virtual double  GetThrottleMax(void) { return MaxThrottle; }
-  virtual bool    GetStarter(void) { return Starter; }
+  virtual double  GetThrottleMin(void) const { return MinThrottle; }
+  virtual double  GetThrottleMax(void) const { return MaxThrottle; }
+  virtual bool    GetStarter(void) const     { return Starter; }
 
   virtual double getFuelFlow_gph () const {return FuelFlow_gph;}
   virtual double getFuelFlow_pph () const {return FuelFlow_pph;}
   virtual double GetFuelFlowRate(void) const {return FuelFlowRate;}
   virtual double GetFuelFlowRateGPH(void) const {return FuelFlowRate*3600/6.02;}
   virtual double GetFuelUsedLbs(void) const {return FuelUsedLbs;}
-  virtual bool   GetStarved(void) { return Starved; }
+  virtual bool   GetStarved(void) const { return Starved; }
   virtual bool   GetRunning(void) const { return Running; }
-  virtual bool   GetCranking(void) { return Cranking; }
+  virtual bool   GetCranking(void) const { return Cranking; }
 
   virtual void SetStarved(bool tt) { Starved = tt; }
   virtual void SetStarved(void)    { Starved = true; }
 
   virtual void SetRunning(bool bb) { Running=bb; }
-  virtual void SetName(string name) { Name = name; }
+  virtual void SetName(const string& name) { Name = name; }
   virtual void SetFuelFreeze(bool f) { FuelFreeze = f; }
 
   virtual void SetStarter(bool s) { Starter = s; }
@@ -194,7 +194,7 @@ public:
   virtual double GetThrust(void) const;
     
   /// Sets engine placement information
-  virtual void SetPlacement(FGColumnVector3& location, FGColumnVector3& orientation);
+  virtual void SetPlacement(const FGColumnVector3& location, const FGColumnVector3& orientation);
 
   /** The fuel need is calculated based on power levels and flow rate for that
       power level. It is also turned from a rate into an actual amount (pounds)
@@ -206,11 +206,11 @@ public:
 
   virtual double GetPowerAvailable(void) {return 0.0;};
 
-  virtual FGColumnVector3& GetBodyForces(void);
-  virtual FGColumnVector3& GetMoments(void);
+  virtual const FGColumnVector3& GetBodyForces(void);
+  virtual const FGColumnVector3& GetMoments(void);
 
   bool LoadThruster(Element *el);
-  FGThruster* GetThruster(void) {return Thruster;}
+  FGThruster* GetThruster(void) const {return Thruster;}
 
   unsigned int GetSourceTank(unsigned int i) const;
   unsigned int GetNumSourceTanks() const {return SourceTanks.size();}
index bd5872b95fd173561082d5229108d5b8e6af1701..787e184a1c2f304888d88a6efc7d60799b8e4748 100644 (file)
@@ -53,7 +53,7 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGForce.cpp,v 1.16 2011/08/04 12:46:32 jberndt Exp $";
+static const char *IdSrc = "$Id: FGForce.cpp,v 1.17 2011/10/31 14:54:41 bcoconni Exp $";
 static const char *IdHdr = ID_FORCE;
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -89,7 +89,7 @@ FGForce::~FGForce()
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-FGColumnVector3& FGForce::GetBodyForces(void)
+const FGColumnVector3& FGForce::GetBodyForces(void)
 {
   vFb = Transform()*vFn;
 
@@ -106,7 +106,7 @@ FGColumnVector3& FGForce::GetBodyForces(void)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-FGMatrix33 FGForce::Transform(void)
+const FGMatrix33& FGForce::Transform(void) const
 {
   switch(ttype) {
   case tWindBody:
index 9ec0d30649ab725e0904bdadaceee545e9e7ea85..f517bce0be03740748343282a382eb017024b244 100644 (file)
@@ -66,7 +66,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_FORCE "$Id: FGForce.h,v 1.13 2009/10/05 04:48:03 jberndt Exp $"
+#define ID_FORCE "$Id: FGForce.h,v 1.14 2011/10/31 14:54:41 bcoconni Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -215,7 +215,7 @@ and vMn, the moments, can be made directly. Otherwise, the usage is similar.<br>
 <br><br></p>
 
     @author Tony Peden
-    @version $Id: FGForce.h,v 1.13 2009/10/05 04:48:03 jberndt Exp $
+    @version $Id: FGForce.h,v 1.14 2011/10/31 14:54:41 bcoconni Exp $
 */
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -238,12 +238,12 @@ public:
 
   enum TransformType { tNone, tWindBody, tLocalBody, tCustom };
 
-  virtual FGColumnVector3& GetBodyForces(void);
+  virtual const FGColumnVector3& GetBodyForces(void);
 
   inline double GetBodyXForce(void) const { return vFb(eX); }
   inline double GetBodyYForce(void) const { return vFb(eY); }
   inline double GetBodyZForce(void) const { return vFb(eZ); }
-  inline FGColumnVector3& GetMoments(void) { return vM; }
+  inline const FGColumnVector3& GetMoments(void) const { return vM; }
 
   // Normal point of application, JSBsim structural coords
   // (inches, x +back, y +right, z +up)
@@ -273,8 +273,8 @@ public:
   inline double SetActingLocationX(double x) {vActingXYZn(eX) = x; return x;}
   inline double SetActingLocationY(double y) {vActingXYZn(eY) = y; return y;}
   inline double SetActingLocationZ(double z) {vActingXYZn(eZ) = z; return z;}
-  inline void SetLocation(FGColumnVector3 vv) { vXYZn = vv; SetActingLocation(vv);}
-  inline void SetActingLocation(FGColumnVector3 vv) { vActingXYZn = vv; }
+  inline void SetLocation(const FGColumnVector3& vv) { vXYZn = vv; SetActingLocation(vv);}
+  inline void SetActingLocation(const FGColumnVector3& vv) { vActingXYZn = vv; }
 
   inline double GetLocationX( void ) const { return vXYZn(eX);}
   inline double GetLocationY( void ) const { return vXYZn(eY);}
@@ -282,8 +282,8 @@ public:
   inline double GetActingLocationX( void ) const { return vActingXYZn(eX);}
   inline double GetActingLocationY( void ) const { return vActingXYZn(eY);}
   inline double GetActingLocationZ( void ) const { return vActingXYZn(eZ);}
-  FGColumnVector3& GetLocation(void) { return vXYZn; }
-  FGColumnVector3& GetActingLocation(void) { return vActingXYZn; }
+  const FGColumnVector3& GetLocation(void) const { return vXYZn; }
+  const FGColumnVector3& GetActingLocation(void) const { return vActingXYZn; }
 
   //these angles are relative to body axes, not earth!!!!!
   //I'm using these because pitch, roll, and yaw are easy to visualize,
@@ -293,7 +293,7 @@ public:
   //They are in radians.
 
   void SetAnglesToBody(double broll, double bpitch, double byaw);
-  inline void  SetAnglesToBody(FGColumnVector3 vv) {
+  inline void  SetAnglesToBody(const FGColumnVector3& vv) {
     SetAnglesToBody(vv(eRoll), vv(ePitch), vv(eYaw));
   }
 
@@ -304,13 +304,13 @@ public:
   double GetPitch(void) const {return vOrient(ePitch);}
   double GetYaw(void) const {return vOrient(eYaw);}
 
-  inline FGColumnVector3& GetAnglesToBody(void) {return vOrient;}
+  inline const FGColumnVector3& GetAnglesToBody(void) const {return vOrient;}
   inline double GetAnglesToBody(int axis) const {return vOrient(axis);}
 
   inline void SetTransformType(TransformType ii) { ttype=ii; }
   inline TransformType GetTransformType(void) const { return ttype; }
 
-  FGMatrix33 Transform(void);
+  const FGMatrix33& Transform(void) const;
 
 protected:
   FGFDMExec *fdmex;
index f2c0167e19b4fc4e82c3f1d2a33f4db20da7d828..7837d39ff3f32c0f23f469d15ac33f9f64893582 100644 (file)
@@ -45,7 +45,7 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGPropeller.cpp,v 1.39 2011/10/15 13:00:57 bcoconni Exp $";
+static const char *IdSrc = "$Id: FGPropeller.cpp,v 1.41 2011/11/17 21:07:30 jentron Exp $";
 static const char *IdHdr = ID_PROPELLER;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -223,6 +223,10 @@ double FGPropeller::Calculate(double EnginePower)
   if (CtMach) ThrustCoeff *= CtMach->GetValue(HelicalTipMach);
 
   if (P_Factor > 0.0001) {
+//    alpha = sin(fdmex->GetAuxiliary()->Getalpha() + FGThruster::GetPitch());
+//    beta  = sin(fdmex->GetAuxiliary()->Getbeta() + FGThruster::GetYaw());
+//    SetActingLocationY( GetLocationY() + P_Factor*alpha*Sense);
+//    SetActingLocationZ( GetLocationZ() + P_Factor*beta*Sense);
     SetActingLocationY( GetLocationY() + P_Factor*in.Alpha*Sense);
     SetActingLocationZ( GetLocationZ() + P_Factor*in.Beta*Sense);
   }
@@ -334,8 +338,8 @@ double FGPropeller::GetPowerRequired(void)
      double CL = (90.0 - Pitch) / 20.0;
      if (CL > 1.5) CL = 1.5;
      double BladeArea = Diameter * Diameter / 32.0 * numBlades;
-     vTorque(eX) = -Sense*BladeArea*Diameter*Vel*Vel*rho*0.19*CL;
-     PowerRequired = fabs(vTorque(eX))*0.2*M_PI;
+     vTorque(eX) = -Sense*BladeArea*Diameter*fabs(Vel)*Vel*rho*0.19*CL;
+     PowerRequired = Sense*(vTorque(eX))*0.2*M_PI;
   }
 
   return PowerRequired;
@@ -343,7 +347,7 @@ double FGPropeller::GetPowerRequired(void)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-FGColumnVector3 FGPropeller::GetPFactor()
+FGColumnVector3 FGPropeller::GetPFactor() const
 {
   double px=0.0, py, pz;
 
@@ -355,7 +359,7 @@ FGColumnVector3 FGPropeller::GetPFactor()
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGPropeller::GetThrusterLabels(int id, string delimeter)
+string FGPropeller::GetThrusterLabels(int id, const string& delimeter)
 {
   std::ostringstream buf;
 
@@ -372,7 +376,7 @@ string FGPropeller::GetThrusterLabels(int id, string delimeter)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGPropeller::GetThrusterValues(int id, string delimeter)
+string FGPropeller::GetThrusterValues(int id, const string& delimeter)
 {
   std::ostringstream buf;
 
index 6e918a4eb22e11a30b000b39cee36fc77894ad0c..1b353d2cba81a1437cfe90a5f97a3d387c124433 100644 (file)
@@ -45,7 +45,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_PROPELLER "$Id: FGPropeller.h,v 1.19 2011/09/24 14:26:46 jentron Exp $"
+#define ID_PROPELLER "$Id: FGPropeller.h,v 1.20 2011/10/31 14:54:41 bcoconni Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -142,7 +142,7 @@ CLASS DOCUMENTATION
     <li>Various NACA Technical Notes and Reports</li>
     </ul>
     @author Jon S. Berndt
-    @version $Id: FGPropeller.h,v 1.19 2011/09/24 14:26:46 jentron Exp $
+    @version $Id: FGPropeller.h,v 1.20 2011/10/31 14:54:41 bcoconni Exp $
     @see FGEngine
     @see FGThruster
 */
@@ -175,7 +175,7 @@ public:
   void SetEngineRPM(double rpm) {RPM = rpm/GearRatio;}
 
   /// Returns true of this propeller is variable pitch
-  bool IsVPitch(void) {return MaxPitch != MinPitch;}
+  bool IsVPitch(void) const {return MaxPitch != MinPitch;}
 
   /** This commands the pitch of the blade to change to the value supplied.
       This call is meant to be issued either from the cockpit or by the flight
@@ -207,25 +207,25 @@ public:
   void SetSense(double s) { Sense = s;}
 
   /// Retrieves the pitch of the propeller in degrees.
-  double GetPitch(void)         { return Pitch;         }
+  double GetPitch(void) const     { return Pitch;         }
 
   /// Retrieves the RPMs of the propeller
-  double GetRPM(void)     const { return RPM;           } 
+  double GetRPM(void) const       { return RPM;           } 
 
   /// Calculates the RPMs of the engine based on gear ratio
-  double GetEngineRPM(void)     const { return RPM * GearRatio;  } 
+  double GetEngineRPM(void) const { return RPM * GearRatio;  } 
 
   /// Retrieves the propeller moment of inertia
-  double GetIxx(void)           { return Ixx;           }
+  double GetIxx(void) const       { return Ixx;           }
 
   /// Retrieves the coefficient of thrust multiplier
-  double GetCtFactor(void)      { return CtFactor;      }
+  double GetCtFactor(void) const  { return CtFactor;      }
 
   /// Retrieves the coefficient of power multiplier
-  double GetCpFactor(void)      { return CpFactor;      }
+  double GetCpFactor(void) const  { return CpFactor;      }
 
   /// Retrieves the propeller diameter
-  double GetDiameter(void)      { return Diameter;      }
+  double GetDiameter(void) const  { return Diameter;      }
 
   /// Retrieves propeller thrust table
   FGTable* GetCThrustTable(void) const { return cThrust;}
@@ -238,7 +238,7 @@ public:
   FGTable* GetCpMachTable(void) const { return CpMach; }
 
   /// Retrieves the Torque in foot-pounds (Don't you love the English system?)
-  double GetTorque(void)        { return vTorque(eX);    }
+  double GetTorque(void) const  { return vTorque(eX); }
 
   /** Retrieves the power required (or "absorbed") by the propeller -
       i.e. the power required to keep spinning the propeller at the current
@@ -255,16 +255,16 @@ public:
       would be slowed.
       @return the thrust in pounds */
   double Calculate(double EnginePower);
-  FGColumnVector3 GetPFactor(void);
-  string GetThrusterLabels(int id, string delimeter);
-  string GetThrusterValues(int id, string delimeter);
+  FGColumnVector3 GetPFactor(void) const;
+  string GetThrusterLabels(int id, const string& delimeter);
+  string GetThrusterValues(int id, const string& delimeter);
 
   void   SetReverseCoef (double c) { Reverse_coef = c; }
-  double GetReverseCoef (void) { return Reverse_coef; }
+  double GetReverseCoef (void) const { return Reverse_coef; }
   void   SetReverse (bool r) { Reversed = r; }
-  bool   GetReverse (void) { return Reversed; }
+  bool   GetReverse (void) const { return Reversed; }
   void   SetFeather (bool f) { Feathered = f; }
-  bool   GetFeather (void) { return Feathered; }
+  bool   GetFeather (void) const { return Feathered; }
   double GetThrustCoefficient(void) const {return ThrustCoeff;}
   double GetHelicalTipMach(void) const {return HelicalTipMach;}
   int    GetConstantSpeed(void) const {return ConstantSpeed;}
index 718185a652caf6608dff99da858fc1d7f39d1efe..6c53d56f2b68b4bf8f4efa6e30dd3145549416a5 100644 (file)
@@ -47,7 +47,7 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGTank.cpp,v 1.32 2011/09/18 13:04:34 bcoconni Exp $";
+static const char *IdSrc = "$Id: FGTank.cpp,v 1.33 2011/10/31 14:54:41 bcoconni Exp $";
 static const char *IdHdr = ID_TANK;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -197,14 +197,14 @@ void FGTank::ResetToIC(void)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-const FGColumnVector3 FGTank::GetXYZ(void)
+FGColumnVector3 FGTank::GetXYZ(void) const
 {
   return vXYZ_drain + (Contents/Capacity)*(vXYZ - vXYZ_drain);
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-double FGTank::GetXYZ(int idx)
+double FGTank::GetXYZ(int idx) const
 {
   return vXYZ_drain(idx) + (Contents/Capacity)*(vXYZ(idx)-vXYZ_drain(idx));
 }
@@ -331,7 +331,7 @@ void FGTank::CalculateInertias(void)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-double FGTank::ProcessFuelName(std::string const& name)
+double FGTank::ProcessFuelName(const std::string& name)
 {
    if      (name == "AVGAS")    return 6.02; 
    else if (name == "JET-A")    return 6.74;
index c5c97ce984700704246f90639e891a11c42fcaac..c1cfa020fbb8b40ccbc2f03e6cc57154c00724cd 100644 (file)
@@ -52,7 +52,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_TANK "$Id: FGTank.h,v 1.25 2011/09/18 13:04:34 bcoconni Exp $"
+#define ID_TANK "$Id: FGTank.h,v 1.26 2011/10/31 14:54:41 bcoconni Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -226,26 +226,26 @@ public:
   /** Retrieves the type of tank: Fuel or Oxidizer.
       @return the tank type, 0 for undefined, 1 for fuel, and 2 for oxidizer.
   */
-  int GetType(void) {return Type;}
+  int GetType(void) const {return Type;}
 
   /** Resets the tank parameters to the initial conditions */
   void ResetToIC(void);
 
   /** If the tank is set to supply fuel, this function returns true.
       @return true if this tank is set to a non-zero priority.*/
-  bool GetSelected(void) {return Selected;}
+  bool GetSelected(void) const {return Selected;}
 
   /** Gets the tank fill level.
       @return the fill level in percent, from 0 to 100.*/
-  double GetPctFull(void) {return PctFull;}
+  double GetPctFull(void) const {return PctFull;}
 
   /** Gets the capacity of the tank.
       @return the capacity of the tank in pounds. */
-  double GetCapacity(void) {return Capacity;}
+  double GetCapacity(void) const {return Capacity;}
 
   /** Gets the capacity of the tank.
       @return the capacity of the tank in gallons. */
-  double GetCapacityGallons(void) {return Capacity/Density;}
+  double GetCapacityGallons(void) const {return Capacity/Density;}
 
   /** Gets the contents of the tank.
       @return the contents of the tank in pounds. */
@@ -260,24 +260,24 @@ public:
       given in the configuration file. 
       @return the temperature of the fuel in degrees C IF an initial temperature
       is given, otherwise 0.0 C is returned. */
-  double GetTemperature_degC(void) {return Temperature;}
+  double GetTemperature_degC(void) const {return Temperature;}
 
   /** Gets the temperature of the fuel.
       The temperature of the fuel is calculated if an initial tempearture is
       given in the configuration file. 
       @return the temperature of the fuel in degrees F IF an initial temperature
       is given, otherwise 32 degrees F is returned. */
-  double GetTemperature(void) {return CelsiusToFahrenheit(Temperature);}
+  double GetTemperature(void) const {return CelsiusToFahrenheit(Temperature);}
 
   /** Returns the density of a named fuel type.
       @return the density, in lbs/gal, or 6.6 if name cannot be resolved. */
-  double ProcessFuelName(std::string const& name); 
+  double ProcessFuelName(const std::string& name); 
 
-  double GetIxx(void) {return Ixx;}
-  double GetIyy(void) {return Iyy;}
-  double GetIzz(void) {return Izz;}
+  double GetIxx(void) const {return Ixx;}
+  double GetIyy(void) const {return Iyy;}
+  double GetIzz(void) const {return Izz;}
 
-  double GetStandpipe(void) {return Standpipe;}
+  double GetStandpipe(void) const {return Standpipe;}
 
   int  GetPriority(void) const {return Priority;}
   void SetPriority(int p) { Priority = p; Selected = p>0 ? true:false; } 
@@ -288,10 +288,10 @@ public:
   double GetExternalFlow(void) const {return ExternalFlow;}
   void   SetExternalFlow(double f) { ExternalFlow = f; }
 
-  const FGColumnVector3 GetXYZ(void);
-  double GetXYZ(int idx);
+  FGColumnVector3 GetXYZ(void) const;
+  double GetXYZ(int idx) const;
 
-  const GrainType GetGrainType(void) {return grainType;}
+  const GrainType GetGrainType(void) const {return grainType;}
 
   double Fill(double amount);
   void SetContents(double amount);