X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FFDM%2FJSBSim%2Fmodels%2FFGExternalReactions.cpp;h=e39f8fb07bf2b83bed5f22d98249731ea0751807;hb=68f54290481701429a04cd33c06be2674fc2b3a4;hp=0add9cf3962c0127e2a00cf8e9d048651aca16f2;hpb=f7f17a4744aaa1dbcd9e64b1a4bc97de888ed892;p=flightgear.git diff --git a/src/FDM/JSBSim/models/FGExternalReactions.cpp b/src/FDM/JSBSim/models/FGExternalReactions.cpp index 0add9cf39..e39f8fb07 100755 --- a/src/FDM/JSBSim/models/FGExternalReactions.cpp +++ b/src/FDM/JSBSim/models/FGExternalReactions.cpp @@ -37,8 +37,12 @@ INCLUDES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ #include "FGExternalReactions.h" +#include "input_output/FGXMLElement.h" +#include #include +using namespace std; + namespace JSBSim { /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -49,7 +53,7 @@ DEFINITIONS GLOBAL DATA %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -static const char *IdSrc = "$Id$"; +static const char *IdSrc = "$Id: FGExternalReactions.cpp,v 1.9 2010/09/07 00:40:03 jberndt Exp $"; static const char *IdHdr = ID_EXTERNALREACTIONS; /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -66,26 +70,9 @@ FGExternalReactions::FGExternalReactions(FGFDMExec* fdmex) : FGModel(fdmex) bool FGExternalReactions::Load(Element* el) { - Debug(2); + FGModel::Load(el); // Call the base class Load() function to load interface properties. - // Interface properties are all stored in the interface properties array. - // ToDo: Interface properties should not be created if they already exist. - // A check should be done prior to creation. This ought to make it easier - // to work with FlightGear, where some properties used in definitions may - // already have been created, but would not be seen when JSBSim is run - // in standalone mode. - - Element* property_element; - property_element = el->FindElement("property"); - while (property_element) { - double value=0.0; - if ( ! property_element->GetAttributeValue("value").empty()) - value = property_element->GetAttributeValueAsNumber("value"); - interface_properties.push_back(new double(value)); - string interface_property_string = property_element->GetDataLine(); - PropertyManager->Tie(interface_property_string, interface_properties.back()); - property_element = el->FindNextElement("property"); - } + Debug(2); // Parse force elements @@ -98,6 +85,8 @@ bool FGExternalReactions::Load(Element* el) force_element = el->FindNextElement("force"); } + PostLoad(el, PropertyManager); + return true; } @@ -107,8 +96,7 @@ FGExternalReactions::~FGExternalReactions() { for (unsigned int i=0; iHolding()) return false; // if paused don't execute if (NoneDefined) return true; + RunPreFunctions(); + vTotalForces.InitMatrix(); vTotalMoments.InitMatrix(); @@ -137,6 +127,8 @@ bool FGExternalReactions::Run() vTotalMoments += Forces[i]->GetMoments(); } + RunPostFunctions(); + return false; }