1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 Header: FGBuoyantForces.h
4 Author: Anders Gidenstam, Jon S. Berndt
7 ------------- Copyright (C) 2008 Anders Gidenstam -------------
8 ------------- Copyright (C) 2008 Jon S. Berndt (jon@jsbsim.org) -------------
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
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
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.
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.
28 --------------------------------------------------------------------------------
31 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
33 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
35 #ifndef FGBuoyanTFORCES_H
36 #define FGBuoyanTFORCES_H
38 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
46 #include "FGGasCell.h"
47 #include "math/FGColumnVector3.h"
48 #include "input_output/FGXMLFileRead.h"
50 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
52 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
54 #define ID_BUOYANTFORCES "$Id$"
56 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
58 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
62 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
64 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
66 /** Encapsulates the Buoyant forces calculations.
67 This class owns and contains the list of force/coefficients that define the
68 Buoyant properties of an air vehicle.
70 Here's an example of a gas cell specification:
75 <!-- Interface properties -->
76 <property>ballonets/in-flow-ft3ps[0]</property>
78 <gas_cell type="HYDROGEN">
84 <x_radius unit="M"> 22.86 </x_radius>
85 <y_radius unit="M"> 4.55 </y_radius>
86 <z_radius unit="M"> 4.55 </z_radius>
87 <max_overpressure unit="PA"> 340.0 </max_overpressure>
88 <valve_coefficient unit="M4*SEC/KG"> 0.015 </valve_coefficient>
91 ... {other gas cells} ...
96 See FGGasCell for the full configuration file format for gas cells.
98 @author Anders Gidenstam, Jon S. Berndt
102 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
104 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
106 class FGBuoyantForces : public FGModel, public FGXMLFileRead
111 @param Executive a pointer to the parent executive object */
112 FGBuoyantForces(FGFDMExec* Executive);
116 bool InitModel(void);
118 /** Runs the Buoyant forces model; called by the Executive
119 @return false if no error */
122 /** Loads the Buoyant forces model.
123 The Load function for this class expects the XML parser to
124 have found the Buoyant_forces keyword in the configuration file.
125 @param element pointer to the current XML element for Buoyant forces parameters.
126 @return true if successful */
127 bool Load(Element* element);
129 /** Gets the total Buoyant force vector.
130 @return a force vector. */
131 const FGColumnVector3& GetForces(void) const {return vTotalForces;}
133 /** Gets the total Buoyancy moment vector.
134 @return a moment vector. */
135 const FGColumnVector3& GetMoments(void) const {return vTotalMoments;}
137 /** Gets the total gas mass. The gas mass is part of the aircraft's
139 @return mass in slugs. */
140 double GetGasMass(void);
142 /** Gets the total moment from the gas mass.
143 @return a moment vector. */
144 const FGColumnVector3& GetGasMassMoment(void);
146 /** Gets the total moments of inertia for the gas mass.
148 const FGMatrix33& GetGasMassInertia(void);
150 /** Gets the strings for the current set of gas cells.
151 @param delimeter either a tab or comma string depending on output type
152 @return a string containing the descriptive names for all parameters */
153 string GetBuoyancyStrings(string delimeter);
155 /** Gets the coefficient values.
156 @param delimeter either a tab or comma string depending on output type
157 @return a string containing the numeric values for the current set of
159 string GetBuoyancyValues(string delimeter);
162 vector <FGGasCell*> Cells;
163 // Buoyant forces and moments. Excluding the gas weight.
164 FGColumnVector3 vTotalForces;
165 FGColumnVector3 vTotalMoments;
167 // Gas mass related masses, inertias and moments.
169 FGColumnVector3 vGasCellXYZ;
170 FGColumnVector3 vXYZgasCell_arm;
176 void Debug(int from);
179 } // namespace JSBSim
181 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%