42 #include "FGExternalReactions.h" 43 #include "input_output/FGXMLElement.h" 57 IDENT(IdSrc,
"$Id: FGExternalReactions.cpp,v 1.21 2015/01/31 14:56:21 bcoconni Exp $");
58 IDENT(IdHdr,ID_EXTERNALREACTIONS);
85 while (force_element) {
92 PostLoad(el, PropertyManager);
94 if (!NoneDefined) bind();
103 for (
unsigned int i=0; i<Forces.size(); i++)
delete Forces[i];
111 bool FGExternalReactions::InitModel(
void)
113 if (!FGModel::InitModel())
return false;
115 vTotalForces.InitMatrix();
116 vTotalMoments.InitMatrix();
126 if (Holding)
return false;
127 if (NoneDefined)
return true;
131 vTotalForces.InitMatrix();
132 vTotalMoments.InitMatrix();
134 for (
unsigned int i=0; i<Forces.size(); i++) {
135 vTotalForces += Forces[i]->GetBodyForces();
136 vTotalMoments += Forces[i]->GetMoments();
146 void FGExternalReactions::bind(
void)
150 PropertyManager->
Tie(
"moments/m-external-lbsft",
this, eM, (PMF)&FGExternalReactions::GetMoments);
151 PropertyManager->
Tie(
"moments/n-external-lbsft",
this, eN, (PMF)&FGExternalReactions::GetMoments);
153 PropertyManager->
Tie(
"forces/fby-external-lbs",
this, eY, (PMF)&FGExternalReactions::GetForces);
154 PropertyManager->
Tie(
"forces/fbz-external-lbs",
this, eZ, (PMF)&FGExternalReactions::GetForces);
177 void FGExternalReactions::Debug(
int from)
179 if (debug_lvl <= 0)
return;
185 cout << endl <<
" External Reactions: " << endl;
188 if (debug_lvl & 2 ) {
189 if (from == 0) cout <<
"Instantiated: FGExternalReactions" << endl;
190 if (from == 1) cout <<
"Destroyed: FGExternalReactions" << endl;
192 if (debug_lvl & 4 ) {
194 if (debug_lvl & 8 ) {
196 if (debug_lvl & 16) {
198 if (debug_lvl & 64) {
200 cout << IdSrc << endl;
201 cout << IdHdr << endl;
bool Load(Element *el)
Loads the external forces from the XML configuration file.
Encapsulates code that models an individual arbitrary force.
Element * FindElement(const std::string &el="")
Searches for a specified element.
virtual bool Run(bool Holding)
Runs the model; called by the Executive.
void Tie(const std::string &name, bool *pointer, bool useDefault=true)
Tie a property to an external bool variable.
const FGColumnVector3 & GetMoments(void) const
Retrieves the total moment resulting from the forces defined in the external reactions.
const FGColumnVector3 & GetForces(void) const
Retrieves the total forces defined in the external reactions.
~FGExternalReactions(void)
Destructor.
Base class for all scheduled JSBSim models.
Element * FindNextElement(const std::string &el="")
Searches for the next element as specified.
Encapsulates the JSBSim simulation executive.
bool Run(bool Holding)
Sum all the constituent forces for this cycle.
virtual bool Load(Element *el)
Loads this model.
Manages the external and/or arbitrary forces.