]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/models/propulsion/FGTank.h
Merge branch 'next' into durk-atc
[flightgear.git] / src / FDM / JSBSim / models / propulsion / FGTank.h
index 8bc0d0fa68981cb4824b5e3ab07b6718e7473aab..12e7e5fc9e6b2899399888ea4d9028f1966e45f8 100644 (file)
@@ -44,22 +44,15 @@ SENTRY
 INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#include "FGFDMExec.h"
 #include "FGJSBBase.h"
-#include "input_output/FGXMLElement.h"
 #include "math/FGColumnVector3.h"
 #include <string>
 
-using std::string;
-using std::cerr;
-using std::endl;
-using std::cout;
-
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_TANK "$Id$"
+#define ID_TANK "$Id: FGTank.h,v 1.21 2010/02/05 05:53:00 jberndt Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -67,6 +60,10 @@ FORWARD DECLARATIONS
 
 namespace JSBSim {
 
+class Element;
+class FGPropertyManager;
+class FGFDMExec;
+
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DOCUMENTATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@@ -128,6 +125,8 @@ CLASS DOCUMENTATION
   <temperature> {number} </temperature> <!-- must be degrees fahrenheit -->
   <standpipe unit="{LBS | KG"}> {number} </standpipe>
   <priority> {integer} </priority>
+  <density unit="{KG/L | LBS/GAL}"> {number} </density>
+  <type> {string} </type> <!-- will override previous density setting -->
 </tank>
 @endcode
 
@@ -142,6 +141,10 @@ CLASS DOCUMENTATION
 - \b temperature - Initial temperature, defaults to degrees Fahrenheit.
 - \b standpipe - Minimum contents to which tank can dump, defaults to pounds.
 - \b priority - Establishes feed sequence of tank. "1" is the highest priority.
+- \b density - Density of liquid tank contents.
+- \b type - Named fuel type. One of AVGAS, JET-A, JET-A1, JET-B, JP-1, JP-2, JP-3,
+- \b        JP-4, JP-5, JP-6, JP-7, JP-8, JP-8+100, RP-1, T-1, ETHANOL, HYDRAZINE,
+- \b        F-34, F-35, F-40, F-44, AVTAG, AVCAT
 
 location:
 - \b x - Location of tank on aircraft's x-axis, defaults to inches.
@@ -167,6 +170,7 @@ be printed to the console if the location is not given
 - \b temperature - -9999.0 (flag which indicates no temperature is set)
 - \b standpipe - 0.0 (all contents may be dumped)
 - \b priority - 1 (highest feed sequence priority)
+- \b density - 6.6
 
     @author Jon Berndt, Dave Culp
     @see Akbar, Raza et al. "A Simple Analysis of Fuel Addition to the CWT of
@@ -191,6 +195,9 @@ public:
   /// Destructor
   ~FGTank();
 
+  enum TankType {ttUNKNOWN, ttFUEL, ttOXIDIZER};
+  enum GrainType {gtUNKNOWN, gtCYLINDRICAL, gtENDBURNING};
+
   /** Removes fuel from the tank.
       This function removes fuel from a tank. If the tank empties, it is
       deselected.
@@ -226,10 +233,18 @@ public:
       @return the capacity of the tank in pounds. */
   double GetCapacity(void) {return Capacity;}
 
+  /** Gets the capacity of the tank.
+      @return the capacity of the tank in gallons. */
+  double GetCapacityGallons(void) {return Capacity/Density;}
+
   /** Gets the contents of the tank.
       @return the contents of the tank in pounds. */
   double GetContents(void) const {return Contents;}
 
+  /** Gets the contents of the tank.
+      @return the contents of the tank in gallons. */
+  double GetContentsGallons(void) const {return Contents/Density;}
+
   /** Gets the temperature of the fuel.
       The temperature of the fuel is calculated if an initial tempearture is
       given in the configuration file. 
@@ -244,6 +259,10 @@ public:
       is given, otherwise 32 degrees F is returned. */
   double GetTemperature(void) {return CelsiusToFahrenheit(Temperature);}
 
+  /** Returns the density of a named fuel type.
+      @return the density, in lbs/gal, or 6.6 if name cannot be resolved. */
+  double ProcessFuelName(std::string const& name); 
+
   double GetIxx(void) {return Ixx;}
   double GetIyy(void) {return Iyy;}
   double GetIzz(void) {return Izz;}
@@ -253,24 +272,27 @@ public:
   int  GetPriority(void) const {return Priority;}
   void SetPriority(int p) { Priority = p; Selected = p>0 ? true:false; } 
 
+  double GetDensity(void) const {return Density;}
+  void   SetDensity(double d) { Density = d; }
+
   const FGColumnVector3 GetXYZ(void);
   const double GetXYZ(int idx);
 
+  const GrainType GetGrainType(void) {return grainType;}
+
   double Fill(double amount);
   void SetContents(double amount);
+  void SetContentsGallons(double gallons);
   void SetTemperature(double temp) { Temperature = temp; }
   void SetStandpipe(double amount) { Standpipe = amount; }
   void SetSelected(bool sel) { sel==true ? SetPriority(1):SetPriority(0); }
 
-  enum TankType {ttUNKNOWN, ttFUEL, ttOXIDIZER};
-  enum GrainType {gtUNKNOWN, gtCYLINDRICAL, gtENDBURNING};
-
 private:
   TankType Type;
   GrainType grainType;
   int TankNumber;
-  string type;
-  string strGType;
+  std::string type;
+  std::string strGType;
   FGColumnVector3 vXYZ;
   FGColumnVector3 vXYZ_drain;
   double Capacity;