40#include "FGBuoyantForces.h"
41#include "input_output/FGXMLElement.h"
42#include "input_output/FGLog.h"
56 vTotalForces.InitMatrix();
57 vTotalMoments.InitMatrix();
68 for (
unsigned int i=0; i<Cells.size(); i++)
delete Cells[i];
76bool FGBuoyantForces::InitModel(
void)
78 if (!FGModel::InitModel())
return false;
80 vTotalForces.InitMatrix();
81 vTotalMoments.InitMatrix();
91 if (Holding)
return false;
92 if (NoneDefined)
return true;
96 vTotalForces.InitMatrix();
97 vTotalMoments.InitMatrix();
99 for (
unsigned int i=0; i<Cells.size(); i++) {
100 Cells[i]->Calculate(FDMExec->
GetDeltaT());
101 vTotalForces += Cells[i]->GetBodyForces();
102 vTotalMoments += Cells[i]->GetMoments();
122 gas_cell_element = document->
FindElement(
"gas_cell");
123 while (gas_cell_element) {
125 Cells.push_back(
new FGGasCell(FDMExec, gas_cell_element, Cells.size(), in));
129 PostLoad(document, FDMExec);
144 for (
unsigned int i = 0; i < Cells.size(); i++) {
145 Gw += Cells[i]->GetMass();
155 vXYZgasCell_arm.InitMatrix();
156 for (
unsigned int i = 0; i < Cells.size(); i++) {
157 vXYZgasCell_arm += Cells[i]->GetMassMoment();
159 return vXYZgasCell_arm;
166 size_t size = Cells.size();
168 if (size == 0)
return gasCellJ;
172 for (
unsigned int i=0; i < size; i++) {
173 gasCellJ += Cells[i]->GetInertia();
183 string CoeffStrings =
"";
213 string SDValues =
"";
241void FGBuoyantForces::bind(
void)
244 PropertyManager->Tie(
"moments/l-buoyancy-lbsft",
this, eL,
246 PropertyManager->Tie(
"moments/m-buoyancy-lbsft",
this, eM,
248 PropertyManager->Tie(
"moments/n-buoyancy-lbsft",
this, eN,
250 PropertyManager->Tie(
"forces/fbx-buoyancy-lbs",
this, eX,
252 PropertyManager->Tie(
"forces/fby-buoyancy-lbs",
this, eY,
254 PropertyManager->Tie(
"forces/fbz-buoyancy-lbs",
this, eZ,
277void FGBuoyantForces::Debug(
int from)
279 if (debug_lvl <= 0)
return;
283 FGLogging log(LogLevel::DEBUG);
284 log <<
"\n Buoyant Forces: \n";
287 if (debug_lvl & 2 ) {
288 FGLogging log(LogLevel::DEBUG);
289 if (from == 0) log <<
"Instantiated: FGBuoyantForces\n";
290 if (from == 1) log <<
"Destroyed: FGBuoyantForces\n";
292 if (debug_lvl & 4 ) {
294 if (debug_lvl & 8 ) {
296 if (debug_lvl & 16) {
298 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.