]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/models/propulsion/FGTank.h
Merge branch 'next' of git://gitorious.org/fg/flightgear into next
[flightgear.git] / src / FDM / JSBSim / models / propulsion / FGTank.h
index 141d01003f4ab7d5bfc97f8fb367689c187be290..4bf420a3826dba15e7a165616aaf16ca5e944074 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.23 2011/06/13 15:23:09 jentron Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -67,6 +60,10 @@ FORWARD DECLARATIONS
 
 namespace JSBSim {
 
+class Element;
+class FGPropertyManager;
+class FGFDMExec;
+
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DOCUMENTATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@@ -103,7 +100,16 @@ CLASS DOCUMENTATION
     tree at <tt>propulsion/tank[i]/contents-lbs</tt>, where i is the tank number (Tanks
     are automatically numbered, starting at zero, in the order in which they are read in
     the aircraft configuration file).  The latter method allows one to use a system of FCS
-    components to control tank contents. 
+    components to control tank contents.
+
+    There is also a property <tt>propulsion/tank[i]/external-flow-rate-pps</tt>. Setting
+    this property to a positive value causes the tank to fill at the rate specified.
+    Setting a negative number causes the tank to drain. The value is the rate in pounds
+    of fuel per second. The tank will not fill past 100% full and will not drain below 0%.
+    Fuel may be transfered between two tanks by setting the source tank's external flow rate
+    to a negative value and the destination's external flow rate to the same positive value.
+    Care must be taken to stop fuel flow before the source tank becomes empty to prevent
+    phantom fuel being created.
 
 <h3>Configuration File Format:</h3>
 
@@ -129,6 +135,7 @@ CLASS DOCUMENTATION
   <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
 
@@ -144,6 +151,9 @@ CLASS DOCUMENTATION
 - \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.
@@ -194,6 +204,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.
@@ -255,6 +268,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;}
@@ -264,9 +281,17 @@ 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; }
+
+  double GetExternalFlow(void) const {return ExternalFlow;}
+  void   SetExternalFlow(double f) { ExternalFlow = f; }
+
   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);
@@ -274,15 +299,12 @@ public:
   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;
@@ -299,6 +321,7 @@ private:
   double Area;
   double Temperature, InitialTemperature;
   double Standpipe, InitialStandpipe;
+  double ExternalFlow;
   bool  Selected;
   int Priority, InitialPriority;
   FGFDMExec* Exec;