]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/FGTank.h
Make yasim accept the launchbar and hook properties. They are not tied to anything...
[flightgear.git] / src / FDM / JSBSim / FGTank.h
index b36c6e1ab8f7b70a391b5ac4e21bf9bac7873e7f..ec8ecbb530b96c8f0190d2bd771f490a841cc7f5 100644 (file)
@@ -44,8 +44,10 @@ SENTRY
 INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#include "FGConfigFile.h"
 #include "FGJSBBase.h"
+#include "FGConfigFile.h"
+#include "FGColumnVector3.h"
+#include "FGAuxiliary.h"
 
 #ifdef FGFS
 #  include <simgear/compiler.h>
@@ -57,7 +59,7 @@ INCLUDES
 #else
 # include <string>
   using std::string;
-# if !defined(sgi) || defined(__GNUC__)
+# if !defined(sgi) || defined(__GNUC__) || (_COMPILER_VERSION >= 740)
    using std::cerr;
    using std::endl;
    using std::cout;
@@ -65,13 +67,66 @@ INCLUDES
 #endif
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-DEFINES
+DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #define ID_TANK "$Id$"
 
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+FORWARD DECLARATIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
 namespace JSBSim {
 
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DOCUMENTATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/** Models a fuel tank.
+    @author Jon Berndt
+    @see Akbar, Raza et al. "A Simple Analysis of Fuel Addition to the CWT of
+    747", California Institute of Technology, 1998
+<P>
+    Fuel temperature is calculated using the following assumptions:
+<P>
+    Fuel temperature will only be calculated for tanks which have an initial fuel
+    temperature specified in the configuration file.
+<P>
+    The surface area of the tank is estimated from the capacity in pounds.  It
+    is assumed that the tank is a wing tank with dimensions h by 4h by 10h. The
+    volume of the tank is then 40(h)(h)(h). The area of the upper or lower 
+    surface is then 40(h)(h).  The volume is also equal to the capacity divided
+    by 49.368 lbs/cu-ft, for jet fuel.  The surface area of one side can then be
+    derived from the tank's capacity.  
+<P>
+    The heat capacity of jet fuel is assumed to be 900 Joules/lbm/K, and the 
+    heat transfer factor of the tank is 1.115 Watts/sq-ft/K.
+<P>
+Configuration File Format
+<pre>
+\<AC_TANK TYPE="\<FUEL | OXIDIZER>" NUMBER="\<n>">
+  XLOC        \<x location>
+  YLOC        \<y location>
+  ZLOC        \<z location>
+  RADIUS      \<radius>
+  CAPACITY    \<capacity>
+  CONTENTS    \<contents>
+  TEMPERATURE \<fuel temperature>
+\</AC_TANK>
+</pre>
+Definition of the tank configuration file parameters:
+<pre>
+<b>TYPE</b> - One of FUEL or OXIDIZER.
+<b>XLOC</b> - Location of tank on aircraft's x-axis, inches.
+<b>YLOC</b> - Location of tank on aircraft's y-axis, inches.
+<b>ZLOC</b> - Location of tank on aircraft's z-axis, inches.
+<b>RADIUS</b> - Equivalent radius of tank, inches, for modeling slosh.
+<b>CAPACITY</b> - Capacity in pounds.
+<b>CONTENTS</b> - Initial contents in pounds.
+<b>TEMPERATURE</b> - Initial temperature in degrees Fahrenheit.
+</pre>
+  */
+
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DECLARATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@@ -79,31 +134,38 @@ CLASS DECLARATION
 class FGTank : public FGJSBBase
 {
 public:
-  FGTank(FGConfigFile*);
+  FGTank(FGConfigFile*, FGFDMExec*);
   ~FGTank();
 
-  double Reduce(double);
+  double Drain(double);
+  double Calculate(double dt);
   int GetType(void) {return Type;}
   bool GetSelected(void) {return Selected;}
   double GetPctFull(void) {return PctFull;}
   double GetContents(void) {return Contents;}
-  double inline GetX(void) {return X;}
-  double inline GetY(void) {return Y;}
-  double inline GetZ(void) {return Z;}
+  double GetTemperature_degC(void) {return Temperature;}
+  double GetTemperature(void) {return CelsiusToFahrenheit(Temperature);}
+  const FGColumnVector3& GetXYZ(void) {return vXYZ;}
+  double GetXYZ(int idx) {return vXYZ(idx);}
 
-  void SetContents(double contents) { Contents = contents; }
+  double Fill(double amount);
+  void SetContents(double amount);
+  void SetTemperature(double temp) { Temperature = temp; }
 
   enum TankType {ttUNKNOWN, ttFUEL, ttOXIDIZER};
 
 private:
   TankType Type;
   string type;
-  double X, Y, Z;
+  FGColumnVector3 vXYZ;
   double Capacity;
   double Radius;
   double PctFull;
   double Contents;
+  double Area;
+  double Temperature;      
   bool  Selected;
+  FGAuxiliary* Auxiliary;
   void Debug(int from);
 };
 }