40#include "FGExternalForce.h"
41#include "FGExternalReactions.h"
42#include "input_output/FGXMLElement.h"
43#include "input_output/FGLog.h"
71 while (force_element) {
73 Forces.back()->setForce(force_element);
80 while (moment_element) {
82 Forces.back()->setMoment(moment_element);
86 PostLoad(el, FDMExec);
88 if (!Forces.empty()) bind();
97 for (
unsigned int i=0; i<Forces.size(); i++)
delete Forces[i];
104bool FGExternalReactions::InitModel(
void)
106 if (!FGModel::InitModel())
return false;
108 vTotalForces.InitMatrix();
109 vTotalMoments.InitMatrix();
119 if (Holding)
return false;
120 if (Forces.empty())
return true;
124 vTotalForces.InitMatrix();
125 vTotalMoments.InitMatrix();
127 for (
unsigned int i=0; i<Forces.size(); i++) {
128 vTotalForces += Forces[i]->GetBodyForces();
129 vTotalMoments += Forces[i]->GetMoments();
139void FGExternalReactions::bind(
void)
169void FGExternalReactions::Debug(
int from)
171 if (debug_lvl <= 0)
return;
177 FGLogging log(LogLevel::DEBUG);
178 log <<
"\n External Reactions: \n";
181 if (debug_lvl & 2 ) {
182 FGLogging log(LogLevel::DEBUG);
183 if (from == 0) log <<
"Instantiated: FGExternalReactions\n";
184 if (from == 1) log <<
"Destroyed: FGExternalReactions\n";
186 if (debug_lvl & 4 ) {
188 if (debug_lvl & 8 ) {
190 if (debug_lvl & 16) {
192 if (debug_lvl & 64) {
Element * FindElement(const std::string &el="")
Searches for a specified element.
Element * FindNextElement(const std::string &el="")
Searches for the next element as specified.
Encapsulates code that models an individual arbitrary force, moment or a combination thereof.
const FGColumnVector3 & GetMoments(void) const
Retrieves the total moment resulting from the forces defined in the external reactions.
bool Load(Element *el) override
Loads the external forces from the XML configuration file.
~FGExternalReactions(void) override
Destructor.
bool Run(bool Holding) override
Sum all the constituent forces for this cycle.
FGExternalReactions(FGFDMExec *fdmex)
Constructor.
const FGColumnVector3 & GetForces(void) const
Retrieves the total forces defined in the external reactions.
Encapsulates the JSBSim simulation executive.
Base class for all scheduled JSBSim models.
virtual bool Run(bool Holding)
Runs the model; called by the Executive.
bool Upload(Element *el, bool preLoad)
Uploads this model in memory.
Main namespace for the JSBSim Flight Dynamics Model.