]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/models/FGExternalReactions.cpp
sync with JSB JSBSim CVS
[flightgear.git] / src / FDM / JSBSim / models / FGExternalReactions.cpp
old mode 100755 (executable)
new mode 100644 (file)
index 54a219b..f9e98f9
@@ -53,7 +53,7 @@ DEFINITIONS
 GLOBAL DATA
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-static const char *IdSrc = "$Id: FGExternalReactions.cpp,v 1.10 2011/05/20 03:18:36 jberndt Exp $";
+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);
@@ -87,6 +96,8 @@ bool FGExternalReactions::Load(Element* el)
 
   PostLoad(el, PropertyManager);
 
+  if (!NoneDefined) bind();
+
   return true;
 }
 
@@ -130,6 +141,20 @@ bool FGExternalReactions::Run(bool Holding)
   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