]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/models/propulsion/FGTank.h
Sync. with JSBSim CVS
[flightgear.git] / src / FDM / JSBSim / models / propulsion / FGTank.h
index f9bb0332f55b88a2252c4141616374d55db35e3f..141d01003f4ab7d5bfc97f8fb367689c187be290 100644 (file)
@@ -4,7 +4,7 @@
  Author:       Jon S. Berndt
  Date started: 01/21/99
 
- ------------- Copyright (C) 1999  Jon S. Berndt (jsb@hal-pc.org) -------------
+ ------------- Copyright (C) 1999  Jon S. Berndt (jon@jsbsim.org) -------------
 
  This program is free software; you can redistribute it and/or modify it under
  the terms of the GNU Lesser General Public License as published by the Free Software
@@ -44,10 +44,10 @@ SENTRY
 INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#include <FGJSBBase.h>
-#include <input_output/FGXMLElement.h>
-#include <math/FGColumnVector3.h>
-#include <models/FGAuxiliary.h>
+#include "FGFDMExec.h"
+#include "FGJSBBase.h"
+#include "input_output/FGXMLElement.h"
+#include "math/FGColumnVector3.h"
 #include <string>
 
 using std::string;
@@ -109,6 +109,9 @@ CLASS DOCUMENTATION
 
 @code
 <tank type="{FUEL | OXIDIZER}">
+  <grain_config type="{CYLINDRICAL | ENDBURNING}">
+    <length unit="{IN | FT | M}"> {number} </radius>
+  </grain_config>
   <location unit="{FT | M | IN}">
     <x> {number} </x>
     <y> {number} </y>
@@ -119,11 +122,13 @@ CLASS DOCUMENTATION
     <y> {number} </y>
     <z> {number} </z>
   </drain_location>
-  <radius unit="{FT | M}"> {number} </radius>
+  <radius unit="{IN | FT | M}"> {number} </radius>
   <capacity unit="{LBS | KG}"> {number} </capacity>
   <contents unit="{LBS | KG}"> {number} </contents>
   <temperature> {number} </temperature> <!-- must be degrees fahrenheit -->
   <standpipe unit="{LBS | KG"}> {number} </standpipe>
+  <priority> {integer} </priority>
+  <density unit="{KG/L | LBS/GAL}"> {number} </density>
 </tank>
 @endcode
 
@@ -131,10 +136,14 @@ CLASS DOCUMENTATION
 
 - \b type - One of FUEL or OXIDIZER.  This is required.
 - \b radius - Equivalent radius of tank for modeling slosh, defaults to inches.
+- \b grain_config type - One of CYLINDRICAL or ENDBURNING.
+- \b length - length of tank for modeling solid fuel propellant grain, defaults to inches.
 - \b capacity - Capacity, defaults to pounds.
 - \b contents - Initial contents, defaults to pounds.
 - \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.
 
 location:
 - \b x - Location of tank on aircraft's x-axis, defaults to inches.
@@ -155,10 +164,12 @@ be printed to the console if the location is not given
 - \b y - 0.0  (both full and drained CG locations)
 - \b z - 0.0  (both full and drained CG locations)
 - \b radius - 0.0
-- \b capacity - 0.0
+- \b capacity - 0.00001 (tank capacity must not be zero)
 - \b contents - 0.0
-- \b temperature - -9999.0
-- \b standpipe - 0.0
+- \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
@@ -206,8 +217,8 @@ public:
   /** Resets the tank parameters to the initial conditions */
   void ResetToIC(void);
 
-  /** If the tank is supplying fuel, this function returns true.
-      @return true if this tank is feeding an engine.*/
+  /** 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;}
 
   /** Gets the tank fill level.
@@ -218,10 +229,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. 
@@ -236,34 +255,55 @@ public:
       is given, otherwise 32 degrees F is returned. */
   double GetTemperature(void) {return CelsiusToFahrenheit(Temperature);}
 
+  double GetIxx(void) {return Ixx;}
+  double GetIyy(void) {return Iyy;}
+  double GetIzz(void) {return Izz;}
+
   double GetStandpipe(void) {return Standpipe;}
 
+  int  GetPriority(void) const {return Priority;}
+  void SetPriority(int p) { Priority = p; Selected = p>0 ? true:false; } 
+
   const FGColumnVector3 GetXYZ(void);
   const double GetXYZ(int idx);
 
   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;
   FGColumnVector3 vXYZ;
   FGColumnVector3 vXYZ_drain;
   double Capacity;
   double Radius;
+  double InnerRadius;
+  double Length;
+  double Volume;
+  double Density;
+  double Ixx;
+  double Iyy;
+  double Izz;
   double PctFull;
   double Contents, InitialContents;
   double Area;
   double Temperature, InitialTemperature;
   double Standpipe, InitialStandpipe;
   bool  Selected;
-  FGAuxiliary* Auxiliary;
+  int Priority, InitialPriority;
+  FGFDMExec* Exec;
   FGPropertyManager* PropertyManager;
+  void CalculateInertias(void);
   void Debug(int from);
 };
 }