X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FFDM%2FJSBSim%2Fmodels%2FFGExternalReactions.cpp;h=f9e98f9f5ea359574ab9959e7a4c8e0d07493a36;hb=024ef128e3395e8c0e32b360abe19b4d345e4f80;hp=a9b6ee2753b33f4c45331656e6c5ad2aad078d5a;hpb=edd83dd7e8fd7162ae49da6113ad797c68769f20;p=flightgear.git diff --git a/src/FDM/JSBSim/models/FGExternalReactions.cpp b/src/FDM/JSBSim/models/FGExternalReactions.cpp old mode 100755 new mode 100644 index a9b6ee275..f9e98f9f5 --- a/src/FDM/JSBSim/models/FGExternalReactions.cpp +++ b/src/FDM/JSBSim/models/FGExternalReactions.cpp @@ -53,7 +53,7 @@ DEFINITIONS GLOBAL DATA %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -static const char *IdSrc = "$Id$"; +static const char *IdSrc = "$Id: FGExternalReactions.cpp,v 1.12 2011/07/20 12:16:34 jberndt Exp $"; static const char *IdHdr = ID_EXTERNALREACTIONS; /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -63,6 +63,7 @@ CLASS IMPLEMENTATION FGExternalReactions::FGExternalReactions(FGFDMExec* fdmex) : FGModel(fdmex) { NoneDefined = true; + Debug(0); } @@ -70,6 +71,14 @@ FGExternalReactions::FGExternalReactions(FGFDMExec* fdmex) : FGModel(fdmex) bool FGExternalReactions::Load(Element* el) { + // check if a file attribute was specified + string fname = el->GetAttributeValue("file"); + if (!fname.empty()) { + string file = FDMExec->GetFullAircraftPath() + "/" + fname; + el = LoadXMLDocument(file); + if (el == 0L) return false; + } + FGModel::Load(el); // Call the base class Load() function to load interface properties. Debug(2); @@ -85,7 +94,9 @@ bool FGExternalReactions::Load(Element* el) force_element = el->FindNextElement("force"); } - FGModel::PostLoad(el); + PostLoad(el, PropertyManager); + + if (!NoneDefined) bind(); return true; } @@ -104,17 +115,15 @@ FGExternalReactions::~FGExternalReactions() bool FGExternalReactions::InitModel(void) { - if (!FGModel::InitModel()) return false; - return true; } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -bool FGExternalReactions::Run() +bool FGExternalReactions::Run(bool Holding) { - if (FGModel::Run()) return true; - if (FDMExec->Holding()) return false; // if paused don't execute + if (FGModel::Run(Holding)) return true; + if (Holding) return false; // if paused don't execute if (NoneDefined) return true; RunPreFunctions(); @@ -132,6 +141,20 @@ bool FGExternalReactions::Run() return false; } +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +void FGExternalReactions::bind(void) +{ + typedef double (FGExternalReactions::*PMF)(int) const; + PropertyManager->Tie("moments/l-external-lbsft", this, eL, (PMF)&FGExternalReactions::GetMoments); + PropertyManager->Tie("moments/m-external-lbsft", this, eM, (PMF)&FGExternalReactions::GetMoments); + PropertyManager->Tie("moments/n-external-lbsft", this, eN, (PMF)&FGExternalReactions::GetMoments); + PropertyManager->Tie("forces/fbx-external-lbs", this, eX, (PMF)&FGExternalReactions::GetForces); + PropertyManager->Tie("forces/fby-external-lbs", this, eY, (PMF)&FGExternalReactions::GetForces); + PropertyManager->Tie("forces/fbz-external-lbs", this, eZ, (PMF)&FGExternalReactions::GetForces); +} + + //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // The bitmasked value choices are as follows: // unset: In this case (the default) JSBSim would only print