40#include "FGBuoyantForces.h"
41#include "input_output/FGXMLElement.h"
42#include "input_output/FGLog.h"
54 Name =
"FGBuoyantForces";
58 vTotalForces.InitMatrix();
59 vTotalMoments.InitMatrix();
70 for (
unsigned int i=0; i<Cells.size(); i++)
delete Cells[i];
78bool FGBuoyantForces::InitModel(
void)
80 if (!FGModel::InitModel())
return false;
82 vTotalForces.InitMatrix();
83 vTotalMoments.InitMatrix();
93 if (Holding)
return false;
94 if (NoneDefined)
return true;
98 vTotalForces.InitMatrix();
99 vTotalMoments.InitMatrix();
101 for (
unsigned int i=0; i<Cells.size(); i++) {
102 Cells[i]->Calculate(FDMExec->
GetDeltaT());
103 vTotalForces += Cells[i]->GetBodyForces();
104 vTotalMoments += Cells[i]->GetMoments();
124 gas_cell_element = document->
FindElement(
"gas_cell");
125 while (gas_cell_element) {
127 Cells.push_back(
new FGGasCell(FDMExec, gas_cell_element, Cells.size(), in));
131 PostLoad(document, FDMExec);
146 for (
unsigned int i = 0; i < Cells.size(); i++) {
147 Gw += Cells[i]->GetMass();
157 vXYZgasCell_arm.InitMatrix();
158 for (
unsigned int i = 0; i < Cells.size(); i++) {
159 vXYZgasCell_arm += Cells[i]->GetMassMoment();
161 return vXYZgasCell_arm;
168 size_t size = Cells.size();
170 if (size == 0)
return gasCellJ;
174 for (
unsigned int i=0; i < size; i++) {
175 gasCellJ += Cells[i]->GetInertia();
185 string CoeffStrings =
"";
215 string SDValues =
"";
243void FGBuoyantForces::bind(
void)
246 PropertyManager->Tie(
"moments/l-buoyancy-lbsft",
this, eL,
248 PropertyManager->Tie(
"moments/m-buoyancy-lbsft",
this, eM,
250 PropertyManager->Tie(
"moments/n-buoyancy-lbsft",
this, eN,
252 PropertyManager->Tie(
"forces/fbx-buoyancy-lbs",
this, eX,
254 PropertyManager->Tie(
"forces/fby-buoyancy-lbs",
this, eY,
256 PropertyManager->Tie(
"forces/fbz-buoyancy-lbs",
this, eZ,
279void FGBuoyantForces::Debug(
int from)
281 if (debug_lvl <= 0)
return;
285 FGLogging log(LogLevel::DEBUG);
286 log <<
"\n Buoyant Forces: \n";
289 if (debug_lvl & 2 ) {
290 FGLogging log(LogLevel::DEBUG);
291 if (from == 0) log <<
"Instantiated: FGBuoyantForces\n";
292 if (from == 1) log <<
"Destroyed: FGBuoyantForces\n";
294 if (debug_lvl & 4 ) {
296 if (debug_lvl & 8 ) {
298 if (debug_lvl & 16) {
300 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 the Buoyant forces calculations.
const FGColumnVector3 & GetMoments(void) const
Gets the total Buoyancy moment vector.
~FGBuoyantForces() override
Destructor.
bool Load(Element *element) override
Loads the Buoyant forces model.
FGBuoyantForces(FGFDMExec *Executive)
Constructor.
std::string GetBuoyancyStrings(const std::string &delimeter)
Gets the strings for the current set of gas cells.
const FGMatrix33 & GetGasMassInertia(void)
Gets the total moments of inertia for the gas mass in the body frame.
bool Run(bool Holding) override
Runs the Buoyant forces model; called by the Executive Can pass in a value indicating if the executiv...
double GetGasMass(void) const
Gets the total gas mass.
std::string GetBuoyancyValues(const std::string &delimeter)
Gets the coefficient values.
const FGColumnVector3 & GetGasMassMoment(void)
Gets the total moment from the gas mass.
const FGColumnVector3 & GetForces(void) const
Gets the total Buoyant force vector.
This class implements a 3 element column vector.
Encapsulates the JSBSim simulation executive.
double GetDeltaT(void) const
Returns the simulation delta T.
Handles matrix math operations.
void InitMatrix(void)
Initialize the matrix.
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.