]> 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 9d43f17b97f4e3185a4f667efee40d7d868d45ef..ec8ecbb530b96c8f0190d2bd771f490a841cc7f5 100644 (file)
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
  Header:       FGTank.h
  Author:       Jon S. Berndt
@@ -33,65 +33,142 @@ HISTORY
 --------------------------------------------------------------------------------
 01/21/99   JSB   Created
 
-********************************************************************************
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 SENTRY
-*******************************************************************************/
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #ifndef FGTank_H
 #define FGTank_H
 
-/*******************************************************************************
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 INCLUDES
-*******************************************************************************/
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+#include "FGJSBBase.h"
+#include "FGConfigFile.h"
+#include "FGColumnVector3.h"
+#include "FGAuxiliary.h"
 
 #ifdef FGFS
 #  include <simgear/compiler.h>
 #  include STL_STRING
-   FG_USING_STD(string);
+  SG_USING_STD(string);
+  SG_USING_STD(cerr);
+  SG_USING_STD(endl);
+  SG_USING_STD(cout);
 #else
-#  include <string>
+# include <string>
+  using std::string;
+# if !defined(sgi) || defined(__GNUC__) || (_COMPILER_VERSION >= 740)
+   using std::cerr;
+   using std::endl;
+   using std::cout;
+# endif
 #endif
 
-#include "FGConfigFile.h"
-
-/*******************************************************************************
-DEFINES
-*******************************************************************************/
-
-using namespace std;
-
-/*******************************************************************************
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+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
-*******************************************************************************/
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-class FGTank
+class FGTank : public FGJSBBase
 {
 public:
-  FGTank(FGConfigFile*);
-  ~FGTank(void);
+  FGTank(FGConfigFile*, FGFDMExec*);
+  ~FGTank();
 
-  float Reduce(float);
+  double Drain(double);
+  double Calculate(double dt);
   int GetType(void) {return Type;}
   bool GetSelected(void) {return Selected;}
-  float GetPctFull(void) {return PctFull;}
-  float GetContents(void) {return Contents;}
-  float inline GetX(void) {return X;}
-  float inline GetY(void) {return Y;}
-  float inline GetZ(void) {return Z;}
+  double GetPctFull(void) {return PctFull;}
+  double GetContents(void) {return Contents;}
+  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);}
+
+  double Fill(double amount);
+  void SetContents(double amount);
+  void SetTemperature(double temp) { Temperature = temp; }
 
   enum TankType {ttUNKNOWN, ttFUEL, ttOXIDIZER};
 
 private:
   TankType Type;
-  float X, Y, Z;
-  float Capacity;
-  float Radius;
-  float PctFull;
-  float Contents;
+  string type;
+  FGColumnVector3 vXYZ;
+  double Capacity;
+  double Radius;
+  double PctFull;
+  double Contents;
+  double Area;
+  double Temperature;      
   bool  Selected;
-
-protected:
+  FGAuxiliary* Auxiliary;
+  void Debug(int from);
 };
-
-/******************************************************************************/
+}
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 #endif
+