 |
JSBSim Flight Dynamics Model
1.1.11 (13 Feb 2022)
An Open Source Flight Dynamics and Control Software Library in C++
|
39 #include "FGFDMExec.h"
40 #include "FGBuoyantForces.h"
41 #include "input_output/FGXMLElement.h"
53 Name =
"FGBuoyantForces";
57 vTotalForces.InitMatrix();
58 vTotalMoments.InitMatrix();
69 for (
unsigned int i=0; i<Cells.size(); i++)
delete Cells[i];
77 bool FGBuoyantForces::InitModel(
void)
79 if (!FGModel::InitModel())
return false;
81 vTotalForces.InitMatrix();
82 vTotalMoments.InitMatrix();
92 if (Holding)
return false;
93 if (NoneDefined)
return true;
97 vTotalForces.InitMatrix();
98 vTotalMoments.InitMatrix();
100 for (
unsigned int i=0; i<Cells.size(); i++) {
101 Cells[i]->Calculate(FDMExec->
GetDeltaT());
102 vTotalForces += Cells[i]->GetBodyForces();
103 vTotalMoments += Cells[i]->GetMoments();
123 gas_cell_element = document->
FindElement(
"gas_cell");
124 while (gas_cell_element) {
126 Cells.push_back(
new FGGasCell(FDMExec, gas_cell_element, Cells.size(), in));
130 PostLoad(document, FDMExec);
145 for (
unsigned int i = 0; i < Cells.size(); i++) {
146 Gw += Cells[i]->GetMass();
156 vXYZgasCell_arm.InitMatrix();
157 for (
unsigned int i = 0; i < Cells.size(); i++) {
158 vXYZgasCell_arm += Cells[i]->GetMassMoment();
160 return vXYZgasCell_arm;
167 size_t size = Cells.size();
169 if (size == 0)
return gasCellJ;
173 for (
unsigned int i=0; i < size; i++) {
174 gasCellJ += Cells[i]->GetInertia();
184 string CoeffStrings =
"";
214 string SDValues =
"";
242 void FGBuoyantForces::bind(
void)
245 PropertyManager->
Tie(
"moments/l-buoyancy-lbsft",
this, eL,
247 PropertyManager->
Tie(
"moments/m-buoyancy-lbsft",
this, eM,
249 PropertyManager->
Tie(
"moments/n-buoyancy-lbsft",
this, eN,
251 PropertyManager->
Tie(
"forces/fbx-buoyancy-lbs",
this, eX,
253 PropertyManager->
Tie(
"forces/fby-buoyancy-lbs",
this, eY,
255 PropertyManager->
Tie(
"forces/fbz-buoyancy-lbs",
this, eZ,
278 void FGBuoyantForces::Debug(
int from)
280 if (debug_lvl <= 0)
return;
284 cout << endl <<
" Buoyant Forces: " << endl;
287 if (debug_lvl & 2 ) {
288 if (from == 0) cout <<
"Instantiated: FGBuoyantForces" << endl;
289 if (from == 1) cout <<
"Destroyed: FGBuoyantForces" << endl;
291 if (debug_lvl & 4 ) {
293 if (debug_lvl & 8 ) {
295 if (debug_lvl & 16) {
297 if (debug_lvl & 64) {
Encapsulates the JSBSim simulation executive.
bool Upload(Element *el, bool preLoad)
Uploads this model in memory.
This class implements a 3 element column vector.
Base class for all scheduled JSBSim models.
Element * FindElement(const std::string &el="")
Searches for a specified element.
const FGMatrix33 & GetGasMassInertia(void)
Gets the total moments of inertia for the gas mass in the body frame.
bool Load(Element *element) override
Loads the Buoyant forces model.
Handles matrix math operations.
~FGBuoyantForces() override
Destructor.
const FGColumnVector3 & GetMoments(void) const
Gets the total Buoyancy moment vector.
const FGColumnVector3 & GetGasMassMoment(void)
Gets the total moment from the gas mass.
double GetDeltaT(void) const
Returns the simulation delta T.
virtual bool Run(bool Holding)
Runs the model; called by the Executive.
std::string GetBuoyancyStrings(const std::string &delimeter)
Gets the strings for the current set of gas cells.
Element * FindNextElement(const std::string &el="")
Searches for the next element as specified.
std::string GetBuoyancyValues(const std::string &delimeter)
Gets the coefficient values.
double GetGasMass(void) const
Gets the total gas mass.
void InitMatrix(void)
Initialize the matrix.
bool Run(bool Holding) override
Runs the Buoyant forces model; called by the Executive Can pass in a value indicating if the executiv...
Encapsulates the Buoyant forces calculations.
void Tie(const std::string &name, T *pointer)
Tie a property to an external variable.
const FGColumnVector3 & GetForces(void) const
Gets the total Buoyant force vector.