40#include "FGExternalForce.h"
41#include "FGExternalReactions.h"
42#include "input_output/FGXMLElement.h"
43#include "input_output/FGLog.h"
70 while (force_element) {
71 auto force = std::make_unique<FGExternalForce>(FDMExec);
72 force->setForce(force_element);
73 Add(std::move(force));
78 while (moment_element) {
79 auto moment = std::make_unique<FGExternalForce>(FDMExec);
80 moment->setMoment(moment_element);
81 Add(std::move(moment));
85 PostLoad(el, FDMExec);
95 Forces.push_back(std::move(force));
107bool FGExternalReactions::InitModel(
void)
109 if (!FGModel::InitModel())
return false;
111 vTotalForces.InitMatrix();
112 vTotalMoments.InitMatrix();
122 if (Holding)
return false;
123 if (Forces.empty())
return true;
127 vTotalForces.InitMatrix();
128 vTotalMoments.InitMatrix();
130 for (
unsigned int i=0; i<Forces.size(); i++) {
131 vTotalForces += Forces[i]->GetBodyForces();
132 vTotalMoments += Forces[i]->GetMoments();
142void FGExternalReactions::bind(
void)
172void FGExternalReactions::Debug(
int from)
174 if (debug_lvl <= 0)
return;
180 FGLogging log(LogLevel::DEBUG);
181 log <<
"\n External Reactions: \n";
184 if (debug_lvl & 2 ) {
185 FGLogging log(LogLevel::DEBUG);
186 if (from == 0) log <<
"Instantiated: FGExternalReactions\n";
187 if (from == 1) log <<
"Destroyed: FGExternalReactions\n";
189 if (debug_lvl & 4 ) {
191 if (debug_lvl & 8 ) {
193 if (debug_lvl & 16) {
195 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.
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.
void Add(std::unique_ptr< FGExternalForce > force)
Adds a force or moment created in code to the external reactions.
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.