JSBSim Flight Dynamics Model  1.1.11 (13 Feb 2022)
An Open Source Flight Dynamics and Control Software Library in C++
FGBuoyantForces.h
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 
3  Header: FGBuoyantForces.h
4  Author: Anders Gidenstam, Jon S. Berndt
5  Date started: 01/21/08
6 
7  ------------- Copyright (C) 2008 - 2011 Anders Gidenstam -------------
8  ------------- Copyright (C) 2008 Jon S. Berndt (jon@jsbsim.org) -------------
9 
10  This program is free software; you can redistribute it and/or modify it under
11  the terms of the GNU Lesser General Public License as published by the Free Software
12  Foundation; either version 2 of the License, or (at your option) any later
13  version.
14 
15  This program is distributed in the hope that it will be useful, but WITHOUT
16  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17  FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
18  details.
19 
20  You should have received a copy of the GNU Lesser General Public License along with
21  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
22  Place - Suite 330, Boston, MA 02111-1307, USA.
23 
24  Further information about the GNU Lesser General Public License can also be found on
25  the world wide web at http://www.gnu.org.
26 
27 HISTORY
28 --------------------------------------------------------------------------------
29 01/21/08 JSB Created
30 
31 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
32 SENTRY
33 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
34 
35 #ifndef FGBUOYANTFORCES_H
36 #define FGBUOYANTFORCES_H
37 
38 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
39 INCLUDES
40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
41 
42 #include <vector>
43 #include <map>
44 
45 #include "FGModel.h"
46 #include "FGGasCell.h"
47 #include "math/FGColumnVector3.h"
48 
49 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
50 FORWARD DECLARATIONS
51 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
52 
53 namespace JSBSim {
54 
55 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
56 CLASS DOCUMENTATION
57 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
58 
94 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
95 CLASS DECLARATION
96 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
97 
98 class FGBuoyantForces : public FGModel
99 {
100 
101 public:
104  FGBuoyantForces(FGFDMExec* Executive);
106  ~FGBuoyantForces() override;
107 
108  bool InitModel(void) override;
109 
117  bool Run(bool Holding) override;
118 
124  bool Load(Element* element) override;
125 
128  const FGColumnVector3& GetForces(void) const {return vTotalForces;}
129 
132  double GetForces(int idx) const {return vTotalForces(idx);}
133 
136  const FGColumnVector3& GetMoments(void) const {return vTotalMoments;}
137 
140  double GetMoments(int idx) const {return vTotalMoments(idx);}
141 
145  double GetGasMass(void) const;
146 
149  const FGColumnVector3& GetGasMassMoment(void);
150 
154  const FGMatrix33& GetGasMassInertia(void);
155 
159  std::string GetBuoyancyStrings(const std::string& delimeter);
160 
165  std::string GetBuoyancyValues(const std::string& delimeter);
166 
168 
169 private:
170  std::vector <FGGasCell*> Cells;
171  // Buoyant forces and moments. Excluding the gas weight.
172  FGColumnVector3 vTotalForces; // [lbs]
173  FGColumnVector3 vTotalMoments; // [lbs ft]
174 
175  // Gas mass related masses, inertias and moments.
176  FGMatrix33 gasCellJ; // [slug ft^2]
177  FGColumnVector3 vGasCellXYZ;
178  FGColumnVector3 vXYZgasCell_arm; // [lbs in]
179 
180  bool NoneDefined;
181 
182  void bind(void);
183 
184  void Debug(int from) override;
185 };
186 
187 } // namespace JSBSim
188 
189 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
190 #endif
JSBSim::FGFDMExec
Encapsulates the JSBSim simulation executive.
Definition: FGFDMExec.h:185
JSBSim::FGGasCell::Inputs
Definition: FGGasCell.h:169
JSBSim::FGColumnVector3
This class implements a 3 element column vector.
Definition: FGColumnVector3.h:63
JSBSim::FGModel
Base class for all scheduled JSBSim models.
Definition: FGModel.h:68
JSBSim::FGBuoyantForces::FGBuoyantForces
FGBuoyantForces(FGFDMExec *Executive)
Constructor.
Definition: FGBuoyantForces.cpp:51
JSBSim::FGBuoyantForces::GetGasMassInertia
const FGMatrix33 & GetGasMassInertia(void)
Gets the total moments of inertia for the gas mass in the body frame.
Definition: FGBuoyantForces.cpp:165
JSBSim::FGBuoyantForces::Load
bool Load(Element *element) override
Loads the Buoyant forces model.
Definition: FGBuoyantForces.cpp:113
JSBSim::FGMatrix33
Handles matrix math operations.
Definition: FGMatrix33.h:69
JSBSim::FGBuoyantForces::~FGBuoyantForces
~FGBuoyantForces() override
Destructor.
Definition: FGBuoyantForces.cpp:67
JSBSim::FGBuoyantForces::GetMoments
const FGColumnVector3 & GetMoments(void) const
Gets the total Buoyancy moment vector.
Definition: FGBuoyantForces.h:136
JSBSim::FGBuoyantForces::GetGasMassMoment
const FGColumnVector3 & GetGasMassMoment(void)
Gets the total moment from the gas mass.
Definition: FGBuoyantForces.cpp:154
JSBSim::FGBuoyantForces::GetBuoyancyStrings
std::string GetBuoyancyStrings(const std::string &delimeter)
Gets the strings for the current set of gas cells.
Definition: FGBuoyantForces.cpp:182
JSBSim::FGBuoyantForces::GetMoments
double GetMoments(int idx) const
Gets a component of the total Buoyancy moment vector.
Definition: FGBuoyantForces.h:140
JSBSim::FGBuoyantForces::GetBuoyancyValues
std::string GetBuoyancyValues(const std::string &delimeter)
Gets the coefficient values.
Definition: FGBuoyantForces.cpp:212
JSBSim::FGBuoyantForces::GetGasMass
double GetGasMass(void) const
Gets the total gas mass.
Definition: FGBuoyantForces.cpp:141
JSBSim::FGBuoyantForces::GetForces
double GetForces(int idx) const
Gets a component of the total Buoyant force vector.
Definition: FGBuoyantForces.h:132
JSBSim::FGBuoyantForces::Run
bool Run(bool Holding) override
Runs the Buoyant forces model; called by the Executive Can pass in a value indicating if the executiv...
Definition: FGBuoyantForces.cpp:89
JSBSim::FGBuoyantForces
Encapsulates the Buoyant forces calculations.
Definition: FGBuoyantForces.h:98
JSBSim::Element
Definition: FGXMLElement.h:143
JSBSim::FGBuoyantForces::GetForces
const FGColumnVector3 & GetForces(void) const
Gets the total Buoyant force vector.
Definition: FGBuoyantForces.h:128