JSBSim Flight Dynamics Model  1.0 (02 March 2017)
An Open Source Flight Dynamics and Control Software Library in C++
FGBuoyantForces Class Reference

Encapsulates the Buoyant forces calculations. More...

#include <FGBuoyantForces.h>

+ Inheritance diagram for FGBuoyantForces:
+ Collaboration diagram for FGBuoyantForces:

Public Member Functions

 FGBuoyantForces (FGFDMExec *Executive)
 Constructor. More...
 
 ~FGBuoyantForces ()
 Destructor.
 
std::string GetBuoyancyStrings (const std::string &delimeter)
 Gets the strings for the current set of gas cells. More...
 
std::string GetBuoyancyValues (const std::string &delimeter)
 Gets the coefficient values. More...
 
const FGColumnVector3GetForces (void) const
 Gets the total Buoyant force vector. More...
 
double GetForces (int idx) const
 Gets a component of the total Buoyant force vector. More...
 
double GetGasMass (void) const
 Gets the total gas mass. More...
 
const FGMatrix33GetGasMassInertia (void)
 Gets the total moments of inertia for the gas mass in the body frame. More...
 
const FGColumnVector3GetGasMassMoment (void)
 Gets the total moment from the gas mass. More...
 
const FGColumnVector3GetMoments (void) const
 Gets the total Buoyancy moment vector. More...
 
double GetMoments (int idx) const
 Gets a component of the total Buoyancy moment vector. More...
 
bool InitModel (void)
 
bool Load (Element *element)
 Loads the Buoyant forces model. More...
 
bool Run (bool Holding)
 Runs the Buoyant forces model; called by the Executive Can pass in a value indicating if the executive is directing the simulation to Hold. More...
 
- Public Member Functions inherited from FGModel
 FGModel (FGFDMExec *)
 Constructor.
 
virtual ~FGModel ()
 Destructor.
 
virtual SGPath FindFullPathName (const SGPath &path) const
 
FGFDMExecGetExec (void)
 
unsigned int GetRate (void)
 Get the output rate for the model in frames.
 
void SetPropertyManager (FGPropertyManager *fgpm)
 
void SetRate (unsigned int tt)
 Set the ouput rate for the model in frames.
 
- Public Member Functions inherited from FGModelFunctions
std::string GetFunctionStrings (const std::string &delimeter) const
 Gets the strings for the current set of functions. More...
 
std::string GetFunctionValues (const std::string &delimeter) const
 Gets the function values. More...
 
FGFunctionGetPreFunction (const std::string &name)
 Get one of the "pre" function. More...
 
bool Load (Element *el, FGPropertyManager *PropertyManager, std::string prefix="")
 
void PostLoad (Element *el, FGPropertyManager *PropertyManager, std::string prefix="")
 
void PreLoad (Element *el, FGPropertyManager *PropertyManager, std::string prefix="")
 
void RunPostFunctions (void)
 
void RunPreFunctions (void)
 
- Public Member Functions inherited from FGJSBBase
 FGJSBBase ()
 Constructor for FGJSBBase.
 
virtual ~FGJSBBase ()
 Destructor for FGJSBBase.
 
void disableHighLighting (void)
 Disables highlighting in the console output.
 
std::string GetVersion (void)
 Returns the version number of JSBSim. More...
 
void PutMessage (const Message &msg)
 Places a Message structure on the Message queue. More...
 
void PutMessage (const std::string &text)
 Creates a message with the given text and places it on the queue. More...
 
void PutMessage (const std::string &text, bool bVal)
 Creates a message with the given text and boolean value and places it on the queue. More...
 
void PutMessage (const std::string &text, int iVal)
 Creates a message with the given text and integer value and places it on the queue. More...
 
void PutMessage (const std::string &text, double dVal)
 Creates a message with the given text and double value and places it on the queue. More...
 
int SomeMessages (void)
 Reads the message on the queue (but does not delete it). More...
 
void ProcessMessage (void)
 Reads the message on the queue and removes it from the queue. More...
 
MessageProcessNextMessage (void)
 Reads the next message on the queue and removes it from the queue. More...
 

Public Attributes

FGGasCell::Inputs in
 
- Public Attributes inherited from FGModel
std::string Name
 

Additional Inherited Members

- Public Types inherited from FGJSBBase
enum  { eL = 1, eM, eN }
 Moments L, M, N.
 
enum  { eP = 1, eQ, eR }
 Rates P, Q, R.
 
enum  { eU = 1, eV, eW }
 Velocities U, V, W.
 
enum  { eX = 1, eY, eZ }
 Positions X, Y, Z.
 
enum  { ePhi = 1, eTht, ePsi }
 Euler angles Phi, Theta, Psi.
 
enum  { eDrag = 1, eSide, eLift }
 Stability axis forces, Drag, Side force, Lift.
 
enum  { eRoll = 1, ePitch, eYaw }
 Local frame orientation Roll, Pitch, Yaw.
 
enum  { eNorth = 1, eEast, eDown }
 Local frame position North, East, Down.
 
enum  { eLat = 1, eLong, eRad }
 Locations Radius, Latitude, Longitude.
 
enum  {
  inNone = 0, inDegrees, inRadians, inMeters,
  inFeet
}
 Conversion specifiers.
 
- Static Public Member Functions inherited from FGJSBBase
static double CelsiusToFahrenheit (double celsius)
 Converts from degrees Celsius to degrees Fahrenheit. More...
 
static double CelsiusToKelvin (double celsius)
 Converts from degrees Celsius to degrees Kelvin. More...
 
static double CelsiusToRankine (double celsius)
 Converts from degrees Celsius to degrees Rankine. More...
 
static double Constrain (double min, double value, double max)
 Constrain a value between a minimum and a maximum value.
 
static bool EqualToRoundoff (double a, double b)
 Finite precision comparison. More...
 
static bool EqualToRoundoff (float a, float b)
 Finite precision comparison. More...
 
static bool EqualToRoundoff (float a, double b)
 Finite precision comparison. More...
 
static bool EqualToRoundoff (double a, float b)
 Finite precision comparison. More...
 
static double FahrenheitToCelsius (double fahrenheit)
 Converts from degrees Fahrenheit to degrees Celsius. More...
 
static double FeetToMeters (double measure)
 Converts from feet to meters. More...
 
static double GaussianRandomNumber (void)
 
static double KelvinToCelsius (double kelvin)
 Converts from degrees Kelvin to degrees Celsius. More...
 
static double KelvinToFahrenheit (double kelvin)
 Converts from degrees Kelvin to degrees Fahrenheit. More...
 
static double KelvinToRankine (double kelvin)
 Converts from degrees Kelvin to degrees Rankine. More...
 
static double MachFromVcalibrated (double vcas, double p, double psl, double rhosl)
 Calculate the Mach number from the calibrated airspeed. More...
 
static double PitotTotalPressure (double mach, double p)
 Compute the total pressure in front of the Pitot tube. More...
 
static double RankineToCelsius (double rankine)
 Converts from degrees Rankine to degrees Celsius. More...
 
static double RankineToKelvin (double rankine)
 Converts from degrees Rankine to degrees Kelvin. More...
 
static double sign (double num)
 
static double VcalibratedFromMach (double mach, double p, double psl, double rhosl)
 Calculate the calibrated airspeed from the Mach number. More...
 
- Static Public Attributes inherited from FGJSBBase
static short debug_lvl = 1
 
static char highint [5] = {27, '[', '1', 'm', '\0' }
 highlights text
 
static char halfint [5] = {27, '[', '2', 'm', '\0' }
 low intensity text
 
static char normint [6] = {27, '[', '2', '2', 'm', '\0' }
 normal intensity text
 
static char reset [5] = {27, '[', '0', 'm', '\0' }
 resets text properties
 
static char underon [5] = {27, '[', '4', 'm', '\0' }
 underlines text
 
static char underoff [6] = {27, '[', '2', '4', 'm', '\0' }
 underline off
 
static char fgblue [6] = {27, '[', '3', '4', 'm', '\0' }
 blue text
 
static char fgcyan [6] = {27, '[', '3', '6', 'm', '\0' }
 cyan text
 
static char fgred [6] = {27, '[', '3', '1', 'm', '\0' }
 red text
 
static char fggreen [6] = {27, '[', '3', '2', 'm', '\0' }
 green text
 
static char fgdef [6] = {27, '[', '3', '9', 'm', '\0' }
 default text
 
- Protected Member Functions inherited from FGJSBBase
void Debug (int)
 
- Static Protected Member Functions inherited from FGJSBBase
static std::string CreateIndexedPropertyName (const std::string &Property, int index)
 
- Protected Attributes inherited from FGModel
unsigned int exe_ctr
 
FGFDMExecFDMExec
 
FGPropertyManagerPropertyManager
 
unsigned int rate
 
- Protected Attributes inherited from FGModelFunctions
FGPropertyReader LocalProperties
 
std::vector< FGFunction * > PostFunctions
 
std::vector< FGFunction * > PreFunctions
 
- Static Protected Attributes inherited from FGJSBBase
static const double degtorad = 0.017453292519943295769236907684886
 
static const double fpstokts = 1.0/ktstofps
 
static const double fttom = 0.3048
 
static int gaussian_random_number_phase = 0
 
static const double hptoftlbssec = 550.0
 
static const double in3tom3 = 1.638706E-5
 
static const double inchtoft = 0.08333333
 
static const double inhgtopa = 3386.38
 
static const std::string JSBSim_version = "1.0 " __DATE__ " " __TIME__
 
static const double kgtolb = 2.20462
 
static const double kgtoslug = 0.06852168
 
static const double ktstofps = 1.68781
 
static const double lbtoslug = 1.0/slugtolb
 
static Message localMsg
 
static const double m3toft3 = 1.0/(fttom*fttom*fttom)
 
static double Mair = 28.9645
 
static unsigned int messageId = 0
 
static std::queue< MessageMessages
 
static const std::string needed_cfg_version = "2.0"
 
static const double psftoinhg = 0.014138
 
static const double psftopa = 47.88
 
static const double radtodeg = 57.295779513082320876798154814105
 
static double Reng = 1716.56
 
static double Rstar = 1545.348
 
static const double SHRatio = 1.40
 
static const double slugtolb = 32.174049
 

Detailed Description

Encapsulates the Buoyant forces calculations.

This class owns and contains the list of force/coefficients that define the Buoyant properties of an air vehicle.

Here's an example of a gas cell specification:

<buoyant_forces>
<!-- Interface properties -->
<property>ballonets/in-flow-ft3ps[0]</property>
<gas_cell type="HYDROGEN">
<location unit="M">
<x> 18.8 </x>
<y> 0.0 </y>
<z> 0.0 </z>
</location>
<x_radius unit="M"> 22.86 </x_radius>
<y_radius unit="M"> 4.55 </y_radius>
<z_radius unit="M"> 4.55 </z_radius>
<max_overpressure unit="PA"> 340.0 </max_overpressure>
<valve_coefficient unit="M4*SEC/KG"> 0.015 </valve_coefficient>
</gas_cell>
... {other gas cells} ...
</buoyant_forces>

See FGGasCell for the full configuration file format for gas cells.

Author
Anders Gidenstam, Jon S. Berndt
Version
Id
FGBuoyantForces.h,v 1.18 2013/11/24 11:40:55 bcoconni Exp

Definition at line 105 of file FGBuoyantForces.h.

Constructor & Destructor Documentation

◆ FGBuoyantForces()

FGBuoyantForces ( FGFDMExec Executive)

Constructor.

Parameters
Executivea pointer to the parent executive object

Definition at line 57 of file FGBuoyantForces.cpp.

57  : FGModel(FDMExec)
58 {
59  Name = "FGBuoyantForces";
60 
61  NoneDefined = true;
62 
63  vTotalForces.InitMatrix();
64  vTotalMoments.InitMatrix();
65 
66  gasCellJ.InitMatrix();
67 
68  Debug(0);
69 }
FGModel(FGFDMExec *)
Constructor.
Definition: FGModel.cpp:60
void InitMatrix(void)
Initialize the matrix.
Definition: FGMatrix33.cpp:257
+ Here is the call graph for this function:

Member Function Documentation

◆ GetBuoyancyStrings()

string GetBuoyancyStrings ( const std::string &  delimeter)

Gets the strings for the current set of gas cells.

Parameters
delimetereither a tab or comma string depending on output type
Returns
a string containing the descriptive names for all parameters

Definition at line 188 of file FGBuoyantForces.cpp.

189 {
190  string CoeffStrings = "";
191 /*
192  bool firstime = true;
193  for (sd = 0; sd < variables.size(); sd++) {
194  if (firstime) {
195  firstime = false;
196  } else {
197  CoeffStrings += delimeter;
198  }
199  CoeffStrings += variables[sd]->GetName();
200  }
201 
202  for (axis = 0; axis < 6; axis++) {
203  for (sd = 0; sd < AeroFunctions[axis].size(); sd++) {
204  if (firstime) {
205  firstime = false;
206  } else {
207  CoeffStrings += delimeter;
208  }
209  CoeffStrings += AeroFunctions[axis][sd]->GetName();
210  }
211  }
212 */
213  return CoeffStrings;
214 }
+ Here is the caller graph for this function:

◆ GetBuoyancyValues()

string GetBuoyancyValues ( const std::string &  delimeter)

Gets the coefficient values.

Parameters
delimetereither a tab or comma string depending on output type
Returns
a string containing the numeric values for the current set of parameters

Definition at line 218 of file FGBuoyantForces.cpp.

219 {
220  string SDValues = "";
221 /*
222  bool firstime = true;
223  for (sd = 0; sd < variables.size(); sd++) {
224  if (firstime) {
225  firstime = false;
226  } else {
227  SDValues += delimeter;
228  }
229  SDValues += variables[sd]->GetValueAsString();
230  }
231 
232  for (unsigned int axis = 0; axis < 6; axis++) {
233  for (unsigned int sd = 0; sd < AeroFunctions[axis].size(); sd++) {
234  if (firstime) {
235  firstime = false;
236  } else {
237  SDValues += delimeter;
238  }
239  SDValues += AeroFunctions[axis][sd]->GetValueAsString();
240  }
241  }
242 */
243  return SDValues;
244 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetForces() [1/2]

const FGColumnVector3& GetForces ( void  ) const
inline

Gets the total Buoyant force vector.

Returns
a force vector in lbs.

Definition at line 135 of file FGBuoyantForces.h.

135 {return vTotalForces;}
+ Here is the caller graph for this function:

◆ GetForces() [2/2]

double GetForces ( int  idx) const
inline

Gets a component of the total Buoyant force vector.

Returns
a component of the force vector in lbs.

Definition at line 139 of file FGBuoyantForces.h.

139 {return vTotalForces(idx);}

◆ GetGasMass()

double GetGasMass ( void  ) const

Gets the total gas mass.

The gas mass is part of the aircraft's inertia.

Returns
mass in slugs.

Definition at line 147 of file FGBuoyantForces.cpp.

148 {
149  double Gw = 0.0;
150 
151  for (unsigned int i = 0; i < Cells.size(); i++) {
152  Gw += Cells[i]->GetMass();
153  }
154 
155  return Gw;
156 }
+ Here is the caller graph for this function:

◆ GetGasMassInertia()

const FGMatrix33 & GetGasMassInertia ( void  )

Gets the total moments of inertia for the gas mass in the body frame.

Returns
moments of inertia matrix in the body frame in slug ft2.

Definition at line 171 of file FGBuoyantForces.cpp.

172 {
173  size_t size = Cells.size();
174 
175  if (size == 0) return gasCellJ;
176 
177  gasCellJ = FGMatrix33();
178 
179  for (unsigned int i=0; i < size; i++) {
180  gasCellJ += Cells[i]->GetInertia();
181  }
182 
183  return gasCellJ;
184 }
+ Here is the caller graph for this function:

◆ GetGasMassMoment()

const FGColumnVector3 & GetGasMassMoment ( void  )

Gets the total moment from the gas mass.

Returns
a moment vector in the structural frame in lbs in.

Definition at line 160 of file FGBuoyantForces.cpp.

161 {
162  vXYZgasCell_arm.InitMatrix();
163  for (unsigned int i = 0; i < Cells.size(); i++) {
164  vXYZgasCell_arm += Cells[i]->GetMassMoment();
165  }
166  return vXYZgasCell_arm;
167 }
+ Here is the caller graph for this function:

◆ GetMoments() [1/2]

const FGColumnVector3& GetMoments ( void  ) const
inline

Gets the total Buoyancy moment vector.

Returns
a moment vector in the body frame in lbs ft.

Definition at line 143 of file FGBuoyantForces.h.

143 {return vTotalMoments;}
+ Here is the caller graph for this function:

◆ GetMoments() [2/2]

double GetMoments ( int  idx) const
inline

Gets a component of the total Buoyancy moment vector.

Returns
a component of the moment vector in the body frame in lbs ft.

Definition at line 147 of file FGBuoyantForces.h.

147 {return vTotalMoments(idx);}
+ Here is the call graph for this function:

◆ Load()

bool Load ( Element element)
virtual

Loads the Buoyant forces model.

The Load function for this class expects the XML parser to have found the Buoyant_forces keyword in the configuration file.

Parameters
elementpointer to the current XML element for Buoyant forces parameters.
Returns
true if successful

Reimplemented from FGModel.

Definition at line 119 of file FGBuoyantForces.cpp.

120 {
121  Element *gas_cell_element;
122 
123  Debug(2);
124 
125  // Perform base class Pre-Load
126  if (!FGModel::Load(document))
127  return false;
128 
129  gas_cell_element = document->FindElement("gas_cell");
130  while (gas_cell_element) {
131  NoneDefined = false;
132  Cells.push_back(new FGGasCell(FDMExec, gas_cell_element, Cells.size(), in));
133  gas_cell_element = document->FindNextElement("gas_cell");
134  }
135 
136  PostLoad(document, PropertyManager);
137 
138  if (!NoneDefined) {
139  bind();
140  }
141 
142  return true;
143 }
virtual bool Load(Element *el)
Loads this model.
Definition: FGModel.cpp:113
+ Here is the call graph for this function:

◆ Run()

bool Run ( bool  Holding)
virtual

Runs the Buoyant forces model; called by the Executive Can pass in a value indicating if the executive is directing the simulation to Hold.

Parameters
Holdingif true, the executive has been directed to hold the sim from advancing time. Some models may ignore this flag, such as the Input model, which may need to be active to listen on a socket for the "Resume" command to be given.
Returns
false if no error

Reimplemented from FGModel.

Definition at line 95 of file FGBuoyantForces.cpp.

96 {
97  if (FGModel::Run(Holding)) return true;
98  if (Holding) return false; // if paused don't execute
99  if (NoneDefined) return true;
100 
101  RunPreFunctions();
102 
103  vTotalForces.InitMatrix();
104  vTotalMoments.InitMatrix();
105 
106  for (unsigned int i=0; i<Cells.size(); i++) {
107  Cells[i]->Calculate(FDMExec->GetDeltaT());
108  vTotalForces += Cells[i]->GetBodyForces();
109  vTotalMoments += Cells[i]->GetMoments();
110  }
111 
112  RunPostFunctions();
113 
114  return false;
115 }
virtual bool Run(bool Holding)
Runs the model; called by the Executive.
Definition: FGModel.cpp:92
double GetDeltaT(void) const
Returns the simulation delta T.
Definition: FGFDMExec.h:536
+ Here is the call graph for this function:

The documentation for this class was generated from the following files: