]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/models/propulsion/FGTank.h
Merge branch 'next' of gitorious.org:fg/flightgear into next
[flightgear.git] / src / FDM / JSBSim / models / propulsion / FGTank.h
index 12e7e5fc9e6b2899399888ea4d9028f1966e45f8..c1cfa020fbb8b40ccbc2f03e6cc57154c00724cd 100644 (file)
@@ -52,7 +52,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_TANK "$Id: FGTank.h,v 1.21 2010/02/05 05:53:00 jberndt Exp $"
+#define ID_TANK "$Id: FGTank.h,v 1.26 2011/10/31 14:54:41 bcoconni Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -100,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>
 
@@ -209,33 +218,34 @@ public:
   /** Performs local, tanks-specific calculations, such as fuel temperature.
       This function calculates the temperature of the fuel in the tank.
       @param dt the time step for this model.
+      @param TempC the Total Air Temperature in degrees Celsius.
       @return the current temperature in degrees Celsius.
   */
-  double Calculate(double dt);
+  double Calculate(double dt, double TempC);
 
   /** Retrieves the type of tank: Fuel or Oxidizer.
       @return the tank type, 0 for undefined, 1 for fuel, and 2 for oxidizer.
   */
-  int GetType(void) {return Type;}
+  int GetType(void) const {return Type;}
 
   /** Resets the tank parameters to the initial conditions */
   void ResetToIC(void);
 
   /** If the tank is set to supply fuel, this function returns true.
       @return true if this tank is set to a non-zero priority.*/
-  bool GetSelected(void) {return Selected;}
+  bool GetSelected(void) const {return Selected;}
 
   /** Gets the tank fill level.
       @return the fill level in percent, from 0 to 100.*/
-  double GetPctFull(void) {return PctFull;}
+  double GetPctFull(void) const {return PctFull;}
 
   /** Gets the capacity of the tank.
       @return the capacity of the tank in pounds. */
-  double GetCapacity(void) {return Capacity;}
+  double GetCapacity(void) const {return Capacity;}
 
   /** Gets the capacity of the tank.
       @return the capacity of the tank in gallons. */
-  double GetCapacityGallons(void) {return Capacity/Density;}
+  double GetCapacityGallons(void) const {return Capacity/Density;}
 
   /** Gets the contents of the tank.
       @return the contents of the tank in pounds. */
@@ -250,24 +260,24 @@ public:
       given in the configuration file. 
       @return the temperature of the fuel in degrees C IF an initial temperature
       is given, otherwise 0.0 C is returned. */
-  double GetTemperature_degC(void) {return Temperature;}
+  double GetTemperature_degC(void) const {return Temperature;}
 
   /** Gets the temperature of the fuel.
       The temperature of the fuel is calculated if an initial tempearture is
       given in the configuration file. 
       @return the temperature of the fuel in degrees F IF an initial temperature
       is given, otherwise 32 degrees F is returned. */
-  double GetTemperature(void) {return CelsiusToFahrenheit(Temperature);}
+  double GetTemperature(void) const {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 ProcessFuelName(const std::string& name); 
 
-  double GetIxx(void) {return Ixx;}
-  double GetIyy(void) {return Iyy;}
-  double GetIzz(void) {return Izz;}
+  double GetIxx(void) const {return Ixx;}
+  double GetIyy(void) const {return Iyy;}
+  double GetIzz(void) const {return Izz;}
 
-  double GetStandpipe(void) {return Standpipe;}
+  double GetStandpipe(void) const {return Standpipe;}
 
   int  GetPriority(void) const {return Priority;}
   void SetPriority(int p) { Priority = p; Selected = p>0 ? true:false; } 
@@ -275,10 +285,13 @@ public:
   double GetDensity(void) const {return Density;}
   void   SetDensity(double d) { Density = d; }
 
-  const FGColumnVector3 GetXYZ(void);
-  const double GetXYZ(int idx);
+  double GetExternalFlow(void) const {return ExternalFlow;}
+  void   SetExternalFlow(double f) { ExternalFlow = f; }
+
+  FGColumnVector3 GetXYZ(void) const;
+  double GetXYZ(int idx) const;
 
-  const GrainType GetGrainType(void) {return grainType;}
+  const GrainType GetGrainType(void) const {return grainType;}
 
   double Fill(double amount);
   void SetContents(double amount);
@@ -306,13 +319,16 @@ private:
   double Izz;
   double PctFull;
   double Contents, InitialContents;
+  double PreviousUsed;
   double Area;
   double Temperature, InitialTemperature;
   double Standpipe, InitialStandpipe;
+  double ExternalFlow;
   bool  Selected;
   int Priority, InitialPriority;
   FGFDMExec* Exec;
   FGPropertyManager* PropertyManager;
+
   void CalculateInertias(void);
   void Debug(int from);
 };