From 4a854fcc3ec4e9508ec6d70d50fb1a92183cb04e Mon Sep 17 00:00:00 2001 From: tony Date: Tue, 30 Apr 2002 13:42:26 +0000 Subject: [PATCH] JSBSim updates, including MSVC fixes from Bernie Bright --- src/FDM/JSBSim/FGAerodynamics.cpp | 22 +++++++++++--------- src/FDM/JSBSim/FGAerodynamics.h | 14 +++++++------ src/FDM/JSBSim/FGAircraft.cpp | 25 +++++++++++----------- src/FDM/JSBSim/FGAtmosphere.cpp | 8 ++++--- src/FDM/JSBSim/FGAtmosphere.h | 1 + src/FDM/JSBSim/FGAuxiliary.cpp | 13 ++++++------ src/FDM/JSBSim/FGCoefficient.h | 8 ++++--- src/FDM/JSBSim/FGFCS.cpp | 21 ++++++++++++------- src/FDM/JSBSim/FGFDMExec.cpp | 9 ++++---- src/FDM/JSBSim/FGFDMExec.h | 4 ++-- src/FDM/JSBSim/FGFactorGroup.cpp | 1 - src/FDM/JSBSim/FGFactorGroup.h | 3 +++ src/FDM/JSBSim/FGGroundReactions.cpp | 15 +++++++------- src/FDM/JSBSim/FGInertial.cpp | 7 ++++--- src/FDM/JSBSim/FGMassBalance.cpp | 9 ++++---- src/FDM/JSBSim/FGPropertyManager.h | 29 ++++++++++++-------------- src/FDM/JSBSim/FGPropulsion.cpp | 13 ++++++------ src/FDM/JSBSim/FGRotation.cpp | 31 ++++++++++++++-------------- src/FDM/JSBSim/FGTranslation.cpp | 19 +++++++++-------- src/FDM/JSBSim/FGTrim.cpp | 11 ++++++---- src/FDM/JSBSim/FGTrimAxis.cpp | 4 ++++ 21 files changed, 148 insertions(+), 119 deletions(-) diff --git a/src/FDM/JSBSim/FGAerodynamics.cpp b/src/FDM/JSBSim/FGAerodynamics.cpp index 8cc13af21..a379b2076 100644 --- a/src/FDM/JSBSim/FGAerodynamics.cpp +++ b/src/FDM/JSBSim/FGAerodynamics.cpp @@ -225,24 +225,26 @@ string FGAerodynamics::GetCoefficientValues(void) void FGAerodynamics::bind(void) { + typedef double (FGAerodynamics::*PMF)(int) const; + PropertyManager->Tie("forces/fbx-aero-lbs", this,1, - &FGAerodynamics::GetForces); + (PMF)&FGAerodynamics::GetForces); PropertyManager->Tie("forces/fby-aero-lbs", this,2, - &FGAerodynamics::GetForces); + (PMF)&FGAerodynamics::GetForces); PropertyManager->Tie("forces/fbz-aero-lbs", this,3, - &FGAerodynamics::GetForces); + (PMF)&FGAerodynamics::GetForces); PropertyManager->Tie("moments/l-aero-lbsft", this,1, - &FGAerodynamics::GetMoments); + (PMF)&FGAerodynamics::GetMoments); PropertyManager->Tie("moments/m-aero-lbsft", this,2, - &FGAerodynamics::GetMoments); + (PMF)&FGAerodynamics::GetMoments); PropertyManager->Tie("moments/n-aero-lbsft", this,3, - &FGAerodynamics::GetMoments); + (PMF)&FGAerodynamics::GetMoments); PropertyManager->Tie("forces/fwx-aero-lbs", this,1, - &FGAerodynamics::GetvFs); + (PMF)&FGAerodynamics::GetvFs); PropertyManager->Tie("forces/fwy-aero-lbs", this,2, - &FGAerodynamics::GetvFs); + (PMF)&FGAerodynamics::GetvFs); PropertyManager->Tie("forces/fwz-aero-lbs", this,3, - &FGAerodynamics::GetvFs); + (PMF)&FGAerodynamics::GetvFs); PropertyManager->Tie("forces/lod-norm", this, &FGAerodynamics::GetLoD); PropertyManager->Tie("aero/cl-squared-norm", this, @@ -259,7 +261,7 @@ void FGAerodynamics::bindModel(void) node = PropertyManager->GetNode("aero/buildup",true); for (i=0;iGetNode( string(AxisNames[i]),true ); - for (j=0; j < Coeff[i].size(); j++) { + for (j=0; j < Coeff[i].size(); j++) { Coeff[i][j]->bind(node); } node = (FGPropertyManager*)node->getParent(); diff --git a/src/FDM/JSBSim/FGAerodynamics.h b/src/FDM/JSBSim/FGAerodynamics.h index 7c0eb7728..8119a2f08 100644 --- a/src/FDM/JSBSim/FGAerodynamics.h +++ b/src/FDM/JSBSim/FGAerodynamics.h @@ -115,17 +115,17 @@ public: /** Gets the total aerodynamic force vector. @return a force vector reference. */ FGColumnVector3& GetForces(void) {return vForces;} - inline double GetForces(int n) const {return vForces(n);} + double GetForces(int n) const {return vForces(n);} /** Gets the total aerodynamic moment vector. @return a moment vector reference. */ FGColumnVector3& GetMoments(void) {return vMoments;} - inline double GetMoments(int n) const {return vMoments(n);} + double GetMoments(int n) const {return vMoments(n);} - inline FGColumnVector3& GetvLastFs(void) { return vLastFs; } - inline double GetvLastFs(int axis) const { return vLastFs(axis); } - inline FGColumnVector3& GetvFs(void) { return vFs; } - inline double GetvFs(int axis) const { return vFs(axis); } + FGColumnVector3& GetvLastFs(void) { return vLastFs; } + double GetvLastFs(int axis) const { return vLastFs(axis); } + FGColumnVector3& GetvFs(void) { return vFs; } + double GetvFs(int axis) const { return vFs(axis); } inline double GetLoD(void) const { return lod; } inline double GetClSquared(void) const { return clsq; } @@ -153,6 +153,8 @@ private: FGColumnVector3 vLastFs; FGColumnVector3 vDXYZcg; double clsq,lod; + + typedef double (FGAerodynamics::*PMF)(int) const; void Debug(int from); }; diff --git a/src/FDM/JSBSim/FGAircraft.cpp b/src/FDM/JSBSim/FGAircraft.cpp index 37f2efeb4..073afba3d 100644 --- a/src/FDM/JSBSim/FGAircraft.cpp +++ b/src/FDM/JSBSim/FGAircraft.cpp @@ -281,6 +281,7 @@ bool FGAircraft::Load(FGConfigFile* AC_cfg) void FGAircraft::bind(void) { + typedef double (FGAircraft::*PMF)(int) const; PropertyManager->Tie("metrics/Sw-sqft", this, &FGAircraft::GetWingArea); PropertyManager->Tie("metrics/bw-ft", this, @@ -306,29 +307,29 @@ void FGAircraft::bind(void) PropertyManager->Tie("metrics/vbarv-norm", this, &FGAircraft::Getvbarv); PropertyManager->Tie("moments/l-total-lbsft", this,1, - &FGAircraft::GetMoments); + (PMF)&FGAircraft::GetMoments); PropertyManager->Tie("moments/m-total-lbsft", this,2, - &FGAircraft::GetMoments); + (PMF)&FGAircraft::GetMoments); PropertyManager->Tie("moments/n-total-lbsft", this,3, - &FGAircraft::GetMoments); + (PMF)&FGAircraft::GetMoments); PropertyManager->Tie("forces/fbx-total-lbs", this,1, - &FGAircraft::GetForces); + (PMF)&FGAircraft::GetForces); PropertyManager->Tie("forces/fby-total-lbs", this,2, - &FGAircraft::GetForces); + (PMF)&FGAircraft::GetForces); PropertyManager->Tie("forces/fbz-total-lbs", this,3, - &FGAircraft::GetForces); + (PMF)&FGAircraft::GetForces); PropertyManager->Tie("metrics/aero-rp-x-ft", this,1, - &FGAircraft::GetXYZrp); + (PMF)&FGAircraft::GetXYZrp); PropertyManager->Tie("metrics/aero-rp-y-ft", this,2, - &FGAircraft::GetXYZrp); + (PMF)&FGAircraft::GetXYZrp); PropertyManager->Tie("metrics/aero-rp-z-ft", this,3, - &FGAircraft::GetXYZrp); + (PMF)&FGAircraft::GetXYZrp); PropertyManager->Tie("metrics/eyepoint-x-ft", this,1, - &FGAircraft::GetXYZep); + (PMF)&FGAircraft::GetXYZep); PropertyManager->Tie("metrics/eyepoint-y-ft", this,2, - &FGAircraft::GetXYZep); + (PMF)&FGAircraft::GetXYZep); PropertyManager->Tie("metrics/eyepoint-z-ft", this,3, - &FGAircraft::GetXYZep); + (PMF)&FGAircraft::GetXYZep); PropertyManager->Tie("metrics/alpha-max-deg", this, &FGAircraft::GetAlphaCLMax, &FGAircraft::SetAlphaCLMax, diff --git a/src/FDM/JSBSim/FGAtmosphere.cpp b/src/FDM/JSBSim/FGAtmosphere.cpp index 30c172cff..c59fbc451 100644 --- a/src/FDM/JSBSim/FGAtmosphere.cpp +++ b/src/FDM/JSBSim/FGAtmosphere.cpp @@ -36,6 +36,7 @@ HISTORY 11/24/98 JSB Created 07/23/99 TP Added implementation of 1959 Standard Atmosphere Moved calculation of Mach number to FGTranslation + Later updated to '76 model %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% COMMENTS, REFERENCES, and NOTES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -298,6 +299,7 @@ void FGAtmosphere::Turbulence(void) void FGAtmosphere::bind(void) { + typedef double (FGAtmosphere::*PMF)(int) const; PropertyManager->Tie("atmosphere/T-R", this, &FGAtmosphere::GetTemperature); PropertyManager->Tie("atmosphere/rho-slugs_ft3", this, @@ -325,11 +327,11 @@ void FGAtmosphere::bind(void) PropertyManager->Tie("atmosphere/psiw-rad", this, &FGAtmosphere::GetWindPsi); PropertyManager->Tie("atmosphere/p-turb-rad_sec", this,1, - &FGAtmosphere::GetTurbPQR); + (PMF)&FGAtmosphere::GetTurbPQR); PropertyManager->Tie("atmosphere/q-turb-rad_sec", this,2, - &FGAtmosphere::GetTurbPQR); + (PMF)&FGAtmosphere::GetTurbPQR); PropertyManager->Tie("atmosphere/r-turb-rad_sec", this,3, - &FGAtmosphere::GetTurbPQR); + (PMF)&FGAtmosphere::GetTurbPQR); } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/src/FDM/JSBSim/FGAtmosphere.h b/src/FDM/JSBSim/FGAtmosphere.h index f4c6fcf44..5dd820d34 100644 --- a/src/FDM/JSBSim/FGAtmosphere.h +++ b/src/FDM/JSBSim/FGAtmosphere.h @@ -29,6 +29,7 @@ HISTORY 11/24/98 JSB Created 07/23/99 TP Added implementation of 1959 Standard Atmosphere Moved calculation of Mach number to FGTranslation + Updated to '76 model ******************************************************************************** diff --git a/src/FDM/JSBSim/FGAuxiliary.cpp b/src/FDM/JSBSim/FGAuxiliary.cpp index de8230b1c..698c7faab 100644 --- a/src/FDM/JSBSim/FGAuxiliary.cpp +++ b/src/FDM/JSBSim/FGAuxiliary.cpp @@ -199,6 +199,7 @@ double FGAuxiliary::GetCrossWind(void) void FGAuxiliary::bind(void) { + typedef double (FGAuxiliary::*PMF)(int) const; PropertyManager->Tie("velocities/vc-fps", this, &FGAuxiliary::GetVcalibratedFPS); PropertyManager->Tie("velocities/vc-kts", this, @@ -208,17 +209,17 @@ void FGAuxiliary::bind(void) PropertyManager->Tie("velocities/ve-kts", this, &FGAuxiliary::GetVequivalentKTS); PropertyManager->Tie("accelerations/a-pilot-x-ft_sec2", this,1, - &FGAuxiliary::GetPilotAccel); + (PMF)&FGAuxiliary::GetPilotAccel); PropertyManager->Tie("accelerations/a-pilot-y-ft_sec2", this,2, - &FGAuxiliary::GetPilotAccel); + (PMF)&FGAuxiliary::GetPilotAccel); PropertyManager->Tie("accelerations/a-pilot-z-ft_sec2", this,3, - &FGAuxiliary::GetPilotAccel); + (PMF)&FGAuxiliary::GetPilotAccel); PropertyManager->Tie("accelerations/n-pilot-x-norm", this,1, - &FGAuxiliary::GetNpilot); + (PMF)&FGAuxiliary::GetNpilot); PropertyManager->Tie("accelerations/n-pilot-y-norm", this,2, - &FGAuxiliary::GetNpilot); + (PMF)&FGAuxiliary::GetNpilot); PropertyManager->Tie("accelerations/n-pilot-z-norm", this,3, - &FGAuxiliary::GetNpilot); + (PMF)&FGAuxiliary::GetNpilot); PropertyManager->Tie("position/epa-rad", this, &FGAuxiliary::GetEarthPositionAngle); /* PropertyManager->Tie("atmosphere/headwind-fps", this, diff --git a/src/FDM/JSBSim/FGCoefficient.h b/src/FDM/JSBSim/FGCoefficient.h index f447e2297..1a076907d 100644 --- a/src/FDM/JSBSim/FGCoefficient.h +++ b/src/FDM/JSBSim/FGCoefficient.h @@ -133,14 +133,14 @@ public: protected: FGFDMExec* FDMExec; - string description; - string name; - FGPropertyManager *node; + private: enum Type {UNKNOWN, VALUE, VECTOR, TABLE, EQUATION}; int numInstances; + string description; + string name; string filename; string method; string multparms; @@ -154,6 +154,8 @@ private: double bias,gain; FGPropertyManager *LookupR, *LookupC; + FGPropertyManager *node; // must be private!! + MultVec multipliers; int rows, columns; Type type; diff --git a/src/FDM/JSBSim/FGFCS.cpp b/src/FDM/JSBSim/FGFCS.cpp index ddc102772..9b5e5a6d5 100644 --- a/src/FDM/JSBSim/FGFCS.cpp +++ b/src/FDM/JSBSim/FGFCS.cpp @@ -605,32 +605,39 @@ void FGFCS::bind(void) void FGFCS::bindModel(void) { unsigned i; - + char tmp[80]; + for (i=0; iTie("fcs/throttle-cmd-norm",this,i, + snprintf(tmp,80,"fcs/throttle-cmd-norm[%u]",i); + PropertyManager->Tie( tmp,this,i, &FGFCS::GetThrottleCmd, &FGFCS::SetThrottleCmd, true ); - PropertyManager->Tie("fcs/throttle-pos-norm",this,i, + snprintf(tmp,80,"fcs/throttle-pos-norm[%u]",i); + PropertyManager->Tie( tmp,this,i, &FGFCS::GetThrottlePos, &FGFCS::SetThrottlePos, true ); if ( MixtureCmd.size() > i ) { - PropertyManager->Tie("fcs/mixture-cmd-norm",this,i, + snprintf(tmp,80,"fcs/mixture-cmd-norm[%u]",i); + PropertyManager->Tie( tmp,this,i, &FGFCS::GetMixtureCmd, &FGFCS::SetMixtureCmd, true ); - PropertyManager->Tie("fcs/mixture-pos-norm",this,i, + snprintf(tmp,80,"fcs/mixture-pos-norm[%u]",i); + PropertyManager->Tie( tmp,this,i, &FGFCS::GetMixturePos, &FGFCS::SetMixturePos, true ); } if ( PropAdvanceCmd.size() > i ) { - PropertyManager->Tie("fcs/advance-cmd-norm",this,i, + snprintf(tmp,80,"fcs/advance-cmd-norm[%u]",i); + PropertyManager->Tie( tmp,this,i, &FGFCS::GetPropAdvanceCmd, &FGFCS::SetPropAdvanceCmd, true ); - PropertyManager->Tie("fcs/advance-pos-norm",this,i, + snprintf(tmp,80,"fcs/advance-pos-norm[%u]",i); + PropertyManager->Tie( tmp,this,i, &FGFCS::GetPropAdvance, &FGFCS::SetPropAdvance, true ); diff --git a/src/FDM/JSBSim/FGFDMExec.cpp b/src/FDM/JSBSim/FGFDMExec.cpp index 84945690d..72badc4a5 100644 --- a/src/FDM/JSBSim/FGFDMExec.cpp +++ b/src/FDM/JSBSim/FGFDMExec.cpp @@ -117,7 +117,7 @@ FGFDMExec::FGFDMExec(FGPropertyManager* root) IdFDM = FDMctr; FDMctr++; - + try { char* num = getenv("JSBSIM_DEBUG"); if (!num) debug_lvl = 1; @@ -154,7 +154,7 @@ FGFDMExec::~FGFDMExec() cout << "Caught error: " << msg << endl; } - for (int i=1; iexec; + for (unsigned int i=1; iexec; SlaveFDMList.clear(); Debug(1); @@ -332,7 +332,7 @@ bool FGFDMExec::Run(void) Debug(2); - for (int i=0; iIncrTime(); - return true; } @@ -377,7 +376,7 @@ vector FGFDMExec::EnumerateFDMs(void) FDMList.push_back(Aircraft->GetAircraftName()); - for (int i=1; iexec->GetAircraft()->GetAircraftName()); } diff --git a/src/FDM/JSBSim/FGFDMExec.h b/src/FDM/JSBSim/FGFDMExec.h index 5355aaab5..4a53c7f68 100644 --- a/src/FDM/JSBSim/FGFDMExec.h +++ b/src/FDM/JSBSim/FGFDMExec.h @@ -207,7 +207,7 @@ public: FGPropertyManager* GetPropertyManager(void); vector EnumerateFDMs(void); void SetSlave(void) {IsSlave = true;} - + private: FGModel* FirstModel; @@ -221,7 +221,7 @@ private: bool IsSlave; static FGPropertyManager *master; FGPropertyManager *instance; - + struct slaveData { FGFDMExec* exec; string info; diff --git a/src/FDM/JSBSim/FGFactorGroup.cpp b/src/FDM/JSBSim/FGFactorGroup.cpp index 156210935..9d96439ea 100644 --- a/src/FDM/JSBSim/FGFactorGroup.cpp +++ b/src/FDM/JSBSim/FGFactorGroup.cpp @@ -147,7 +147,6 @@ void FGFactorGroup::bind(FGPropertyManager* parent) void FGFactorGroup::unbind(void) { unsigned i; - FGCoefficient::unbind(); for (i=0; i < sum.size(); i++) { sum[i]->unbind(); diff --git a/src/FDM/JSBSim/FGFactorGroup.h b/src/FDM/JSBSim/FGFactorGroup.h index dda152e01..5a6640cb1 100644 --- a/src/FDM/JSBSim/FGFactorGroup.h +++ b/src/FDM/JSBSim/FGFactorGroup.h @@ -117,6 +117,9 @@ private: CoeffArray sum; double SDtotal; double totalValue; + string description; + string name; + FGPropertyManager *node; void Debug(int from); }; diff --git a/src/FDM/JSBSim/FGGroundReactions.cpp b/src/FDM/JSBSim/FGGroundReactions.cpp index 46602a049..ee31e6fb3 100644 --- a/src/FDM/JSBSim/FGGroundReactions.cpp +++ b/src/FDM/JSBSim/FGGroundReactions.cpp @@ -166,21 +166,22 @@ string FGGroundReactions::GetGroundReactionValues(void) //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% void FGGroundReactions::bind(void) -{ +{ + typedef double (FGGroundReactions::*PMF)(int) const; PropertyManager->Tie("gear/num-units", this, &FGGroundReactions::GetNumGearUnits); PropertyManager->Tie("moments/l-gear-lbsft", this,1, - &FGGroundReactions::GetMoments); + (PMF)&FGGroundReactions::GetMoments); PropertyManager->Tie("moments/m-gear-lbsft", this,2, - &FGGroundReactions::GetMoments); + (PMF)&FGGroundReactions::GetMoments); PropertyManager->Tie("moments/n-gear-lbsft", this,3, - &FGGroundReactions::GetMoments); + (PMF)&FGGroundReactions::GetMoments); PropertyManager->Tie("forces/fbx-gear-lbs", this,1, - &FGGroundReactions::GetForces); + (PMF)&FGGroundReactions::GetForces); PropertyManager->Tie("forces/fby-gear-lbs", this,2, - &FGGroundReactions::GetForces); + (PMF)&FGGroundReactions::GetForces); PropertyManager->Tie("forces/fbz-gear-lbs", this,3, - &FGGroundReactions::GetForces); + (PMF)&FGGroundReactions::GetForces); } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/src/FDM/JSBSim/FGInertial.cpp b/src/FDM/JSBSim/FGInertial.cpp index f76274036..b3d3f5989 100644 --- a/src/FDM/JSBSim/FGInertial.cpp +++ b/src/FDM/JSBSim/FGInertial.cpp @@ -129,12 +129,13 @@ bool FGInertial::LoadInertial(FGConfigFile* AC_cfg) void FGInertial::bind(void) { + typedef double (FGInertial::*PMF)(int) const; PropertyManager->Tie("forces/fbx-inertial-lbs", this,1, - &FGInertial::GetForces); + (PMF)&FGInertial::GetForces); PropertyManager->Tie("forces/fby-inertial-lbs", this,2, - &FGInertial::GetForces); + (PMF)&FGInertial::GetForces); PropertyManager->Tie("forces/fbz-inertial-lbs", this,3, - &FGInertial::GetForces); + (PMF)&FGInertial::GetForces); } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/src/FDM/JSBSim/FGMassBalance.cpp b/src/FDM/JSBSim/FGMassBalance.cpp index 54f39639a..053428829 100644 --- a/src/FDM/JSBSim/FGMassBalance.cpp +++ b/src/FDM/JSBSim/FGMassBalance.cpp @@ -191,7 +191,8 @@ double FGMassBalance::GetPMIxz(void) //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% void FGMassBalance::bind(void) -{ +{ + typedef double (FGMassBalance::*PMF)(int) const; PropertyManager->Tie("inertia/mass-slugs", this, &FGMassBalance::GetMass); PropertyManager->Tie("inertia/weight-lbs", this, @@ -207,11 +208,11 @@ void FGMassBalance::bind(void) PropertyManager->Tie("inertia/ixz-lbsft2", this, &FGMassBalance::GetIxz); PropertyManager->Tie("inertia/cg-x-ft", this,1, - &FGMassBalance::GetXYZcg); + (PMF)&FGMassBalance::GetXYZcg); PropertyManager->Tie("inertia/cg-y-ft", this,2, - &FGMassBalance::GetXYZcg); + (PMF)&FGMassBalance::GetXYZcg); PropertyManager->Tie("inertia/cg-z-ft", this,3, - &FGMassBalance::GetXYZcg); + (PMF)&FGMassBalance::GetXYZcg); } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/src/FDM/JSBSim/FGPropertyManager.h b/src/FDM/JSBSim/FGPropertyManager.h index cad5dc5ff..95001a307 100644 --- a/src/FDM/JSBSim/FGPropertyManager.h +++ b/src/FDM/JSBSim/FGPropertyManager.h @@ -357,7 +357,6 @@ class FGPropertyManager:public SGPropertyNode { } - //////////////////////////////////////////////////////////////////////// // Convenience functions for setting property attributes. //////////////////////////////////////////////////////////////////////// @@ -382,7 +381,7 @@ class FGPropertyManager:public SGPropertyNode { if (node == 0) cout << "Attempt to set archive flag for non-existant property " - << name; + << name << endl; else node->setAttribute(SGPropertyNode::ARCHIVE, state); } @@ -407,7 +406,7 @@ class FGPropertyManager:public SGPropertyNode { if (node == 0) cout << "Attempt to set read flag for non-existant property " - << name; + << name << endl; else node->setAttribute(SGPropertyNode::READ, state); } @@ -432,13 +431,12 @@ class FGPropertyManager:public SGPropertyNode { if (node == 0) cout << "Attempt to set write flag for non-existant property " - << name; + << name << endl; else node->setAttribute(SGPropertyNode::WRITE, state); } - //////////////////////////////////////////////////////////////////////// // Convenience functions for tying properties, with logging. //////////////////////////////////////////////////////////////////////// @@ -454,7 +452,7 @@ class FGPropertyManager:public SGPropertyNode { Untie (const string &name) { if (!untie(name.c_str())) - cout << "Failed to untie property " << name; + cout << "Failed to untie property " << name << endl; } @@ -478,7 +476,7 @@ class FGPropertyManager:public SGPropertyNode { if (!tie(name.c_str(), SGRawValuePointer(pointer), useDefault)) cout << - "Failed to tie property " << name << " to a pointer"; + "Failed to tie property " << name << " to a pointer" << endl; } @@ -500,7 +498,7 @@ class FGPropertyManager:public SGPropertyNode { if (!tie(name.c_str(), SGRawValuePointer(pointer), useDefault)) cout << - "Failed to tie property " << name << " to a pointer"; + "Failed to tie property " << name << " to a pointer" << endl; } @@ -522,7 +520,7 @@ class FGPropertyManager:public SGPropertyNode { if (!tie(name.c_str(), SGRawValuePointer(pointer), useDefault)) cout << - "Failed to tie property " << name << " to a pointer"; + "Failed to tie property " << name << " to a pointer" << endl; } @@ -544,7 +542,7 @@ class FGPropertyManager:public SGPropertyNode { if (!tie(name.c_str(), SGRawValuePointer(pointer), useDefault)) cout << - "Failed to tie property " << name << " to a pointer"; + "Failed to tie property " << name << " to a pointer" << endl; } @@ -566,7 +564,7 @@ class FGPropertyManager:public SGPropertyNode { if (!tie(name.c_str(), SGRawValuePointer(pointer), useDefault)) cout << - "Failed to tie property " << name << " to a pointer"; + "Failed to tie property " << name << " to a pointer" << endl; } /* template void @@ -610,7 +608,7 @@ class FGPropertyManager:public SGPropertyNode { if (!tie(name.c_str(), SGRawValueFunctions(getter, setter), useDefault)) cout << - "Failed to tie property " << name << " to functions"; + "Failed to tie property " << name << " to functions" << endl; } @@ -643,7 +641,7 @@ class FGPropertyManager:public SGPropertyNode { setter), useDefault)) cout << - "Failed to tie property " << name << " to indexed functions"; + "Failed to tie property " << name << " to indexed functions" << endl; } @@ -675,7 +673,7 @@ class FGPropertyManager:public SGPropertyNode { SGRawValueMethods(*obj, getter, setter), useDefault)) cout << - "Failed to tie property " << name << " to object methods"; + "Failed to tie property " << name << " to object methods" << endl; } @@ -711,11 +709,10 @@ class FGPropertyManager:public SGPropertyNode { setter), useDefault)) cout << - "Failed to tie property " << name << " to indexed object methods"; + "Failed to tie property " << name << " to indexed object methods" << endl; } }; - #endif // FGPROPERTYMANAGER_H diff --git a/src/FDM/JSBSim/FGPropulsion.cpp b/src/FDM/JSBSim/FGPropulsion.cpp index 7a31a46aa..4a97bdd94 100644 --- a/src/FDM/JSBSim/FGPropulsion.cpp +++ b/src/FDM/JSBSim/FGPropulsion.cpp @@ -550,6 +550,7 @@ double FGPropulsion::GetTanksIxy(const FGColumnVector3& vXYZcg) void FGPropulsion::bind(void) { + typedef double (FGPropulsion::*PMF)(int) const; /* PropertyManager->Tie("propulsion/num-engines", this, &FGPropulsion::GetNumEngines); PropertyManager->Tie("propulsion/num-tanks", this, @@ -559,17 +560,17 @@ void FGPropulsion::bind(void) PropertyManager->Tie("propulsion/num-sel-ox-tanks", this, &FGPropulsion::GetnumSelectedOxiTanks); PropertyManager->Tie("forces/fbx-prop-lbs", this,1, - &FGPropulsion::GetForces); + (PMF)&FGPropulsion::GetForces); PropertyManager->Tie("forces/fby-prop-lbs", this,2, - &FGPropulsion::GetForces); + (PMF)&FGPropulsion::GetForces); PropertyManager->Tie("forces/fbz-prop-lbs", this,3, - &FGPropulsion::GetForces); + (PMF)&FGPropulsion::GetForces); PropertyManager->Tie("moments/l-prop-lbsft", this,1, - &FGPropulsion::GetMoments); + (PMF)&FGPropulsion::GetMoments); PropertyManager->Tie("moments/m-prop-lbsft", this,2, - &FGPropulsion::GetMoments); + (PMF)&FGPropulsion::GetMoments); PropertyManager->Tie("moments/n-prop-lbsft", this,3, - &FGPropulsion::GetMoments); + (PMF)&FGPropulsion::GetMoments); //PropertyManager->Tie("propulsion/tanks-weight-lbs", this, // &FGPropulsion::GetTanksWeight); } diff --git a/src/FDM/JSBSim/FGRotation.cpp b/src/FDM/JSBSim/FGRotation.cpp index 18ce859ae..aa48af0e1 100644 --- a/src/FDM/JSBSim/FGRotation.cpp +++ b/src/FDM/JSBSim/FGRotation.cpp @@ -158,36 +158,37 @@ void FGRotation::GetState(void) void FGRotation::bind(void) { + typedef double (FGRotation::*PMF)(int) const; PropertyManager->Tie("velocities/p-rad_sec", this,1, - &FGRotation::GetPQR); + (PMF)&FGRotation::GetPQR); PropertyManager->Tie("velocities/q-rad_sec", this,2, - &FGRotation::GetPQR); + (PMF)&FGRotation::GetPQR); PropertyManager->Tie("velocities/r-rad_sec", this,3, - &FGRotation::GetPQR); + (PMF)&FGRotation::GetPQR); PropertyManager->Tie("velocities/p-aero-rad_sec", this,1, - &FGRotation::GetAeroPQR); + (PMF)&FGRotation::GetAeroPQR); PropertyManager->Tie("velocities/q-aero-rad_sec", this,2, - &FGRotation::GetAeroPQR); + (PMF)&FGRotation::GetAeroPQR); PropertyManager->Tie("velocities/r-aero-rad_sec", this,3, - &FGRotation::GetAeroPQR); + (PMF)&FGRotation::GetAeroPQR); PropertyManager->Tie("accelerations/pdot-rad_sec", this,1, - &FGRotation::GetPQRdot); + (PMF)&FGRotation::GetPQRdot); PropertyManager->Tie("accelerations/qdot-rad_sec", this,2, - &FGRotation::GetPQRdot); + (PMF)&FGRotation::GetPQRdot); PropertyManager->Tie("accelerations/rdot-rad_sec", this,3, - &FGRotation::GetPQRdot); + (PMF)&FGRotation::GetPQRdot); PropertyManager->Tie("attitude/roll-rad", this,1, - &FGRotation::GetEuler); + (PMF)&FGRotation::GetEuler); PropertyManager->Tie("attitude/pitch-rad", this,2, - &FGRotation::GetEuler); + (PMF)&FGRotation::GetEuler); PropertyManager->Tie("attitude/heading-true-rad", this,3, - &FGRotation::GetEuler); + (PMF)&FGRotation::GetEuler); PropertyManager->Tie("velocities/phidot-rad_sec", this,1, - &FGRotation::GetEulerRates); + (PMF)&FGRotation::GetEulerRates); PropertyManager->Tie("velocities/thetadot-rad_sec", this,2, - &FGRotation::GetEulerRates); + (PMF)&FGRotation::GetEulerRates); PropertyManager->Tie("velocities/psidot-rad_sec", this,3, - &FGRotation::GetEulerRates); + (PMF)&FGRotation::GetEulerRates); PropertyManager->Tie("attitude/phi-rad", this, &FGRotation::Getphi); PropertyManager->Tie("attitude/theta-rad", this, diff --git a/src/FDM/JSBSim/FGTranslation.cpp b/src/FDM/JSBSim/FGTranslation.cpp index 4223e557a..268af3ace 100644 --- a/src/FDM/JSBSim/FGTranslation.cpp +++ b/src/FDM/JSBSim/FGTranslation.cpp @@ -165,30 +165,31 @@ bool FGTranslation::Run(void) void FGTranslation::bind(void) { + typedef double (FGTranslation::*PMF)(int) const; PropertyManager->Tie("velocities/u-fps", this,1, - &FGTranslation::GetUVW /*, + (PMF)&FGTranslation::GetUVW /*, &FGTranslation::SetUVW, true */); PropertyManager->Tie("velocities/v-fps", this,2, - &FGTranslation::GetUVW /*, + (PMF)&FGTranslation::GetUVW /*, &FGTranslation::SetUVW, true*/); PropertyManager->Tie("velocities/w-fps", this,3, - &FGTranslation::GetUVW /*, + (PMF)&FGTranslation::GetUVW /*, &FGTranslation::SetUVW, true*/); PropertyManager->Tie("accelerations/udot-fps", this,1, - &FGTranslation::GetUVWdot); + (PMF)&FGTranslation::GetUVWdot); PropertyManager->Tie("accelerations/vdot-fps", this,2, - &FGTranslation::GetUVWdot); + (PMF)&FGTranslation::GetUVWdot); PropertyManager->Tie("accelerations/wdot-fps", this,3, - &FGTranslation::GetUVWdot); + (PMF)&FGTranslation::GetUVWdot); PropertyManager->Tie("velocities/u-aero-fps", this,1, - &FGTranslation::GetAeroUVW); + (PMF)&FGTranslation::GetAeroUVW); PropertyManager->Tie("velocities/v-aero-fps", this,2, - &FGTranslation::GetAeroUVW); + (PMF)&FGTranslation::GetAeroUVW); PropertyManager->Tie("velocities/w-aero-fps", this,3, - &FGTranslation::GetAeroUVW); + (PMF)&FGTranslation::GetAeroUVW); PropertyManager->Tie("aero/alpha-rad", this, &FGTranslation::Getalpha, &FGTranslation::Setalpha, diff --git a/src/FDM/JSBSim/FGTrim.cpp b/src/FDM/JSBSim/FGTrim.cpp index 3b974f61a..e4a5c2ea6 100644 --- a/src/FDM/JSBSim/FGTrim.cpp +++ b/src/FDM/JSBSim/FGTrim.cpp @@ -610,23 +610,26 @@ void FGTrim::setupTurn(void){ g = fdmex->GetInertial()->gravity(); psidot = g*tan(phi) / fgic->GetUBodyFpsIC(); cout << targetNlf << ", " << psidot << endl; - } + } + } void FGTrim::updateRates(void){ if( mode == tTurn ) { double phi = fgic->GetRollAngleRadIC(); double g = fdmex->GetInertial()->gravity(); + double p,q,r,theta; if(fabs(phi) > 0.001 && fabs(phi) < 1.56 ) { - double p,q,r,theta,phi; theta=fgic->GetPitchAngleRadIC(); phi=fgic->GetRollAngleRadIC(); psidot = g*tan(phi) / fgic->GetUBodyFpsIC(); p=-psidot*sin(theta); q=psidot*cos(theta)*sin(phi); r=psidot*cos(theta)*cos(phi); - fdmex->GetRotation()->SetPQR(p,q,r); - } + } else { + p=q=r=0; + } + fdmex->GetRotation()->SetPQR(p,q,r); } else if( mode == tPullup && fabs(targetNlf-1) > 0.01) { float g,q,cgamma; FGColumnVector3 vPQR; diff --git a/src/FDM/JSBSim/FGTrimAxis.cpp b/src/FDM/JSBSim/FGTrimAxis.cpp index f8417f8c5..eca04970a 100644 --- a/src/FDM/JSBSim/FGTrimAxis.cpp +++ b/src/FDM/JSBSim/FGTrimAxis.cpp @@ -32,6 +32,10 @@ INCLUDES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +#ifdef _MSC_VER +# pragma warning (disable : 4786) +#endif + #include #include -- 2.39.5