diff --git a/src/FDM/JSBSim/FGFDMExec.cpp b/src/FDM/JSBSim/FGFDMExec.cpp
index 570baf75f..d5c81f821 100644
--- a/src/FDM/JSBSim/FGFDMExec.cpp
+++ b/src/FDM/JSBSim/FGFDMExec.cpp
@@ -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 FGFDMExec::EnumerateFDMs(void)
{
vector 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)
diff --git a/src/FDM/JSBSim/FGFDMExec.h b/src/FDM/JSBSim/FGFDMExec.h
index 68dc380d1..2628a66ff 100644
--- a/src/FDM/JSBSim/FGFDMExec.h
+++ b/src/FDM/JSBSim/FGFDMExec.h
@@ -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 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;
diff --git a/src/FDM/JSBSim/initialization/FGInitialCondition.cpp b/src/FDM/JSBSim/initialization/FGInitialCondition.cpp
index d787193f5..1706b3019 100644
--- a/src/FDM/JSBSim/initialization/FGInitialCondition.cpp
+++ b/src/FDM/JSBSim/initialization/FGInitialCondition.cpp
@@ -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;
diff --git a/src/FDM/JSBSim/initialization/FGInitialCondition.h b/src/FDM/JSBSim/initialization/FGInitialCondition.h
index 03f11f064..ce56991aa 100644
--- a/src/FDM/JSBSim/initialization/FGInitialCondition.h
+++ b/src/FDM/JSBSim/initialization/FGInitialCondition.h
@@ -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;
diff --git a/src/FDM/JSBSim/initialization/FGTrim.cpp b/src/FDM/JSBSim/initialization/FGTrim.cpp
index cc863c85d..f20c96ef4 100644
--- a/src/FDM/JSBSim/initialization/FGTrim.cpp
+++ b/src/FDM/JSBSim/initialization/FGTrim.cpp
@@ -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();
diff --git a/src/FDM/JSBSim/input_output/FGGroundCallback.h b/src/FDM/JSBSim/input_output/FGGroundCallback.h
index 10063f9b9..91937956d 100644
--- a/src/FDM/JSBSim/input_output/FGGroundCallback.h
+++ b/src/FDM/JSBSim/input_output/FGGroundCallback.h
@@ -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_ptr;
+
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The default sphere earth implementation:
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
diff --git a/src/FDM/JSBSim/input_output/FGScript.cpp b/src/FDM/JSBSim/input_output/FGScript.cpp
old mode 100644
new mode 100755
index 7a88d54ab..acf17368e
--- a/src/FDM/JSBSim/input_output/FGScript.cpp
+++ b/src/FDM/JSBSim/input_output/FGScript.cpp
@@ -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; jGetRelativeName("/fdm/jsbsim/")
+ << Events[i].NotifyProperties[j]->GetRelativeName("/fdm/jsbsim/")
<< endl;
}
cout << " }" << endl;
diff --git a/src/FDM/JSBSim/math/FGCondition.cpp b/src/FDM/JSBSim/math/FGCondition.cpp
index 719a3e79d..16106874a 100644
--- a/src/FDM/JSBSim/math/FGCondition.cpp
+++ b/src/FDM/JSBSim/math/FGCondition.cpp
@@ -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;
diff --git a/src/FDM/JSBSim/math/FGLocation.cpp b/src/FDM/JSBSim/math/FGLocation.cpp
index ce10adfef..95c6e6e7d 100644
--- a/src/FDM/JSBSim/math/FGLocation.cpp
+++ b/src/FDM/JSBSim/math/FGLocation.cpp
@@ -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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
diff --git a/src/FDM/JSBSim/math/FGLocation.h b/src/FDM/JSBSim/math/FGLocation.h
index 743d6ea09..7042d798b 100644
--- a/src/FDM/JSBSim/math/FGLocation.h
+++ b/src/FDM/JSBSim/math/FGLocation.h
@@ -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.
diff --git a/src/FDM/JSBSim/math/FGQuaternion.cpp b/src/FDM/JSBSim/math/FGQuaternion.cpp
index e983550a6..f147a3a2b 100644
--- a/src/FDM/JSBSim/math/FGQuaternion.cpp
+++ b/src/FDM/JSBSim/math/FGQuaternion.cpp
@@ -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)),
diff --git a/src/FDM/JSBSim/math/FGQuaternion.h b/src/FDM/JSBSim/math/FGQuaternion.h
index 8486b49f8..841ecc262 100644
--- a/src/FDM/JSBSim/math/FGQuaternion.h
+++ b/src/FDM/JSBSim/math/FGQuaternion.h
@@ -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
diff --git a/src/FDM/JSBSim/models/FGAccelerations.h b/src/FDM/JSBSim/models/FGAccelerations.h
index 5cc609103..bb50da67f 100644
--- a/src/FDM/JSBSim/models/FGAccelerations.h
+++ b/src/FDM/JSBSim/models/FGAccelerations.h
@@ -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); }
diff --git a/src/FDM/JSBSim/models/FGAircraft.h b/src/FDM/JSBSim/models/FGAircraft.h
index a7a2ba69b..13a499bd5 100644
--- a/src/FDM/JSBSim/models/FGAircraft.h
+++ b/src/FDM/JSBSim/models/FGAircraft.h
@@ -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
diff --git a/src/FDM/JSBSim/models/FGAuxiliary.cpp b/src/FDM/JSBSim/models/FGAuxiliary.cpp
old mode 100644
new mode 100755
index 8e29a7e39..d18b3052f
--- a/src/FDM/JSBSim/models/FGAuxiliary.cpp
+++ b/src/FDM/JSBSim/models/FGAuxiliary.cpp
@@ -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();
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
diff --git a/src/FDM/JSBSim/models/FGAuxiliary.h b/src/FDM/JSBSim/models/FGAuxiliary.h
index 45a7382f5..01fc0b91f 100644
--- a/src/FDM/JSBSim/models/FGAuxiliary.h
+++ b/src/FDM/JSBSim/models/FGAuxiliary.h
@@ -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);
diff --git a/src/FDM/JSBSim/models/FGBuoyantForces.cpp b/src/FDM/JSBSim/models/FGBuoyantForces.cpp
index d98d543dd..b50817608 100644
--- a/src/FDM/JSBSim/models/FGBuoyantForces.cpp
+++ b/src/FDM/JSBSim/models/FGBuoyantForces.cpp
@@ -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 = "";
/*
diff --git a/src/FDM/JSBSim/models/FGBuoyantForces.h b/src/FDM/JSBSim/models/FGBuoyantForces.h
index a844b9c3b..4b23841c7 100644
--- a/src/FDM/JSBSim/models/FGBuoyantForces.h
+++ b/src/FDM/JSBSim/models/FGBuoyantForces.h
@@ -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;
diff --git a/src/FDM/JSBSim/models/FGExternalForce.cpp b/src/FDM/JSBSim/models/FGExternalForce.cpp
old mode 100644
new mode 100755
index 12ade79e7..f0ef173b5
--- a/src/FDM/JSBSim/models/FGExternalForce.cpp
+++ b/src/FDM/JSBSim/models/FGExternalForce.cpp
@@ -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();
diff --git a/src/FDM/JSBSim/models/FGExternalForce.h b/src/FDM/JSBSim/models/FGExternalForce.h
old mode 100644
new mode 100755
index 5ece2bf22..5c8ec266b
--- a/src/FDM/JSBSim/models/FGExternalForce.h
+++ b/src/FDM/JSBSim/models/FGExternalForce.h
@@ -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);}
diff --git a/src/FDM/JSBSim/models/FGExternalReactions.h b/src/FDM/JSBSim/models/FGExternalReactions.h
old mode 100644
new mode 100755
index 9f9164ed4..7945abf88
--- a/src/FDM/JSBSim/models/FGExternalReactions.h
+++ b/src/FDM/JSBSim/models/FGExternalReactions.h
@@ -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:
diff --git a/src/FDM/JSBSim/models/FGFCS.h b/src/FDM/JSBSim/models/FGFCS.h
index c48cc4cc1..5c485c2bd 100644
--- a/src/FDM/JSBSim/models/FGFCS.h
+++ b/src/FDM/JSBSim/models/FGFCS.h
@@ -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 GetThrottleCmd() const {return ThrottleCmd;}
+ const vector& 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 GetMixtureCmd() const {return MixtureCmd;}
+ const vector& 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 GetThrottlePos() const {return ThrottlePos;}
+ const vector& 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 GetMixturePos() const {return MixturePos;}
+ const vector& GetMixturePos() const {return MixturePos;}
/** Gets the steering position.
@return steering position in degrees */
double GetSteerPosDeg(int gear) const { return SteerPosDeg[gear]; }
- vector GetSteerPosDeg() const {return SteerPosDeg;}
+ const vector& 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 GetPropAdvance() const { return PropAdvance; }
+ const vector& 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 GetPropFeather() const { return PropFeather; }
+ const vector& 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 GetBrakePos() const {return BrakePos;}
+ const vector& GetBrakePos() const {return BrakePos;}
/** Gets the left brake.
@return the left brake setting. */
diff --git a/src/FDM/JSBSim/models/FGInertial.cpp b/src/FDM/JSBSim/models/FGInertial.cpp
index b241f78ed..1f4d011dc 100644
--- a/src/FDM/JSBSim/models/FGInertial.cpp
+++ b/src/FDM/JSBSim/models/FGInertial.cpp
@@ -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;
diff --git a/src/FDM/JSBSim/models/FGInertial.h b/src/FDM/JSBSim/models/FGInertial.h
index 0e08abe29..0bf9f460f 100644
--- a/src/FDM/JSBSim/models/FGInertial.h
+++ b/src/FDM/JSBSim/models/FGInertial.h
@@ -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;}
diff --git a/src/FDM/JSBSim/models/FGLGear.cpp b/src/FDM/JSBSim/models/FGLGear.cpp
index cb3d8f521..5f801f428 100644
--- a/src/FDM/JSBSim/models/FGLGear.cpp
+++ b/src/FDM/JSBSim/models/FGLGear.cpp
@@ -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();
diff --git a/src/FDM/JSBSim/models/FGLGear.h b/src/FDM/JSBSim/models/FGLGear.h
index ba44029fe..792f1bb2e 100644
--- a/src/FDM/JSBSim/models/FGLGear.h
+++ b/src/FDM/JSBSim/models/FGLGear.h
@@ -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
@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();
diff --git a/src/FDM/JSBSim/models/FGMassBalance.cpp b/src/FDM/JSBSim/models/FGMassBalance.cpp
index 9cb32f885..dbd8ab3a6 100644
--- a/src/FDM/JSBSim/models/FGMassBalance.cpp
+++ b/src/FDM/JSBSim/models/FGMassBalance.cpp
@@ -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;
diff --git a/src/FDM/JSBSim/models/FGMassBalance.h b/src/FDM/JSBSim/models/FGMassBalance.h
index 981eef6de..9b11290b1 100644
--- a/src/FDM/JSBSim/models/FGMassBalance.h
+++ b/src/FDM/JSBSim/models/FGMassBalance.h
@@ -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;}
diff --git a/src/FDM/JSBSim/models/FGOutput.h b/src/FDM/JSBSim/models/FGOutput.h
index 2640bbdcb..b7a62d57a 100644
--- a/src/FDM/JSBSim/models/FGOutput.h
+++ b/src/FDM/JSBSim/models/FGOutput.h
@@ -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:
@code
-
+
@endcode
@code
-
+
@endcode
@@ -124,7 +124,7 @@ CLASS DOCUMENTATION
propulsion ON|OFF
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 $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
diff --git a/src/FDM/JSBSim/models/FGPropagate.cpp b/src/FDM/JSBSim/models/FGPropagate.cpp
index d1ec2b922..2ff471740 100644
--- a/src/FDM/JSBSim/models/FGPropagate.cpp
+++ b/src/FDM/JSBSim/models/FGPropagate.cpp
@@ -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();
diff --git a/src/FDM/JSBSim/models/FGPropagate.h b/src/FDM/JSBSim/models/FGPropagate.h
index e1384f616..232c306de 100644
--- a/src/FDM/JSBSim/models/FGPropagate.h
+++ b/src/FDM/JSBSim/models/FGPropagate.h
@@ -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;
}
diff --git a/src/FDM/JSBSim/models/FGPropulsion.cpp b/src/FDM/JSBSim/models/FGPropulsion.cpp
index 2021c822e..bdf0cc9ce 100644
--- a/src/FDM/JSBSim/models/FGPropulsion.cpp
+++ b/src/FDM/JSBSim/models/FGPropulsion.cpp
@@ -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= 0) {
+ for (unsigned int i=0; iringLatitude, 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);
diff --git a/src/FDM/JSBSim/models/atmosphere/FGWinds.h b/src/FDM/JSBSim/models/atmosphere/FGWinds.h
index 8d8aa0552..fac8338e5 100644
--- a/src/FDM/JSBSim/models/atmosphere/FGWinds.h
+++ b/src/FDM/JSBSim/models/atmosphere/FGWinds.h
@@ -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 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);
diff --git a/src/FDM/JSBSim/models/flight_control/FGFCSFunction.h b/src/FDM/JSBSim/models/flight_control/FGFCSFunction.h
old mode 100644
new mode 100755
index d6524edf2..779014ce1
--- a/src/FDM/JSBSim/models/flight_control/FGFCSFunction.h
+++ b/src/FDM/JSBSim/models/flight_control/FGFCSFunction.h
@@ -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):
velocities/mach
- 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
@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 $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
diff --git a/src/FDM/JSBSim/models/propulsion/FGEngine.cpp b/src/FDM/JSBSim/models/propulsion/FGEngine.cpp
index e0c056b37..3769934bd 100644
--- a/src/FDM/JSBSim/models/propulsion/FGEngine.cpp
+++ b/src/FDM/JSBSim/models/propulsion/FGEngine.cpp
@@ -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();
}
diff --git a/src/FDM/JSBSim/models/propulsion/FGEngine.h b/src/FDM/JSBSim/models/propulsion/FGEngine.h
index 33db9998e..66c59ad42 100644
--- a/src/FDM/JSBSim/models/propulsion/FGEngine.h
+++ b/src/FDM/JSBSim/models/propulsion/FGEngine.h
@@ -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
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.
@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();}
diff --git a/src/FDM/JSBSim/models/propulsion/FGForce.cpp b/src/FDM/JSBSim/models/propulsion/FGForce.cpp
index bd5872b95..787e184a1 100644
--- a/src/FDM/JSBSim/models/propulsion/FGForce.cpp
+++ b/src/FDM/JSBSim/models/propulsion/FGForce.cpp
@@ -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:
diff --git a/src/FDM/JSBSim/models/propulsion/FGForce.h b/src/FDM/JSBSim/models/propulsion/FGForce.h
index 9ec0d3064..f517bce0b 100644
--- a/src/FDM/JSBSim/models/propulsion/FGForce.h
+++ b/src/FDM/JSBSim/models/propulsion/FGForce.h
@@ -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.
@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;
diff --git a/src/FDM/JSBSim/models/propulsion/FGPropeller.cpp b/src/FDM/JSBSim/models/propulsion/FGPropeller.cpp
index f2c0167e1..7837d39ff 100644
--- a/src/FDM/JSBSim/models/propulsion/FGPropeller.cpp
+++ b/src/FDM/JSBSim/models/propulsion/FGPropeller.cpp
@@ -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;
diff --git a/src/FDM/JSBSim/models/propulsion/FGPropeller.h b/src/FDM/JSBSim/models/propulsion/FGPropeller.h
index 6e918a4eb..1b353d2cb 100644
--- a/src/FDM/JSBSim/models/propulsion/FGPropeller.h
+++ b/src/FDM/JSBSim/models/propulsion/FGPropeller.h
@@ -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
Various NACA Technical Notes and Reports
@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;}
diff --git a/src/FDM/JSBSim/models/propulsion/FGTank.cpp b/src/FDM/JSBSim/models/propulsion/FGTank.cpp
index 718185a65..6c53d56f2 100644
--- a/src/FDM/JSBSim/models/propulsion/FGTank.cpp
+++ b/src/FDM/JSBSim/models/propulsion/FGTank.cpp
@@ -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;
diff --git a/src/FDM/JSBSim/models/propulsion/FGTank.h b/src/FDM/JSBSim/models/propulsion/FGTank.h
index c5c97ce98..c1cfa020f 100644
--- a/src/FDM/JSBSim/models/propulsion/FGTank.h
+++ b/src/FDM/JSBSim/models/propulsion/FGTank.h
@@ -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);