]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/models/FGGasCell.h
Merge branch 'next' of gitorious.org:fg/flightgear into next
[flightgear.git] / src / FDM / JSBSim / models / FGGasCell.h
index 0ad485cee3928530fec98ce46a86ce543a17d180..ff3613c17bd0c2d9fcbfe416e51090b61b0a5d40 100644 (file)
@@ -4,7 +4,7 @@
  Author:       Anders Gidenstam
  Date started: 01/21/2006
 
- ----- Copyright (C) 2006 - 2008  Anders Gidenstam (anders(at)gidenstam.org) --
+ ----- Copyright (C) 2006 - 2011  Anders Gidenstam (anders(at)gidenstam.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
@@ -32,30 +32,25 @@ This class simulates a generic gas cell for static buoyancy.
 SENTRY
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#ifndef FGGasCell_H
-#define FGGasCell_H
+#ifndef FGGASCELL_H
+#define FGGASCELL_H
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGJSBBase.h"
-#include "input_output/FGXMLElement.h"
 #include "math/FGColumnVector3.h"
 #include "models/propulsion/FGForce.h"
 #include "math/FGFunction.h"
 
 #include <string>
-using std::string;
-using std::cerr;
-using std::endl;
-using std::cout;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_GASCELL "$Id$"
+#define ID_GASCELL "$Id: FGGasCell.h,v 1.12 2011/08/06 13:47:59 jberndt Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -64,6 +59,7 @@ FORWARD DECLARATIONS
 namespace JSBSim {
 
 class FGBallonet;
+class Element;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DOCUMENTATION
@@ -176,11 +172,18 @@ CLASS DECLARATION
 class FGGasCell : public FGForce
 {
 public:
+  struct Inputs {
+    double Pressure;
+    double Temperature;
+    double Density;
+    double gravity;
+  };
+
   /** Constructor
       @param exec Executive a pointer to the parent executive object
       @param el   Pointer to configuration file XML node
       @param num  Gas cell index number. */
-  FGGasCell(FGFDMExec* exec, Element* el, int num);
+  FGGasCell(FGFDMExec* exec, Element* el, int num, const struct Inputs& input);
   ~FGGasCell();
 
   /** Runs the gas cell model; called by BuoyantForces
@@ -193,12 +196,12 @@ public:
 
   /** Get the center of gravity location of the gas cell
       (including any ballonets)
-      @return CoG location in the structural frame. */
+      @return CoG location in the structural frame in inches. */
   const FGColumnVector3& GetXYZ(void) const {return vXYZ;}
 
   /** Get the center of gravity location of the gas cell
       (including any ballonets)
-      @return CoG location in the structural frame. */
+      @return CoG location in the structural frame in inches. */
   double GetXYZ(int idx) const {return vXYZ(idx);}
 
   /** Get the current mass of the gas cell (including any ballonets)
@@ -206,7 +209,7 @@ public:
   double GetMass(void) const {return Mass;}
 
   /** Get the moments of inertia of the gas cell (including any ballonets)
-      @return moments of inertia matrix relative the gas cell location
+      @return moments of inertia matrix in the body frame
       in slug ft<sup>2</sup>. */
   const FGMatrix33& GetInertia(void) const {return gasCellJ;}
 
@@ -214,7 +217,7 @@ public:
 
       Note that the buoyancy of the gas cell is handled separately by the
       FGForce part and not included here.
-      @return moment vector in lbs ft. */
+      @return moment vector in the structural frame in lbs in. */
   const FGColumnVector3& GetMassMoment(void) const {return gasCellM;}
 
   /** Get the current gas temperature inside the gas cell
@@ -225,16 +228,18 @@ public:
       @return gas pressure in lbs / ft<sup>2</sup>. */
   double GetPressure(void) const {return Pressure;}
 
+  const struct Inputs& in;
+
 private:
 
   enum GasType {ttUNKNOWN, ttHYDROGEN, ttHELIUM, ttAIR};
 
   GasType Type;
-  string type;
+  std::string type;
   int CellNum;
   // Structural constants
-  double MaxVolume;                 // [ft]
-  double MaxOverpressure;           // [lbs/ft]
+  double MaxVolume;                 // [ft^2]
+  double MaxOverpressure;           // [lbs/ft^2]
   FGColumnVector3 vXYZ;             // [in]
   double Xradius, Yradius, Zradius; // [ft]
   double Xwidth, Ywidth, Zwidth;    // [ft]
@@ -244,22 +249,19 @@ private:
   typedef vector <FGBallonet*> BallonetArray;
   BallonetArray Ballonet;
   // Variables
-  double Pressure;          // [lbs/ft]
+  double Pressure;          // [lbs/ft^2]
   double Contents;          // [mol]
-  double Volume;            // [ft]
-  double dVolumeIdeal;      // [ft]
+  double Volume;            // [ft^2]
+  double dVolumeIdeal;      // [ft^2]
   double Temperature;       // [Rankine]
   double Buoyancy;          // [lbs] Note: Gross lift.
                             // Does not include the weight of the gas itself.
   double ValveOpen;         // 0 <= ValveOpen <= 1 (or higher).
   double Mass;              // [slug]
-  FGMatrix33 gasCellJ;      // [slug foot]
-  FGColumnVector3 gasCellM; // [lbs ft]
+  FGMatrix33 gasCellJ;      // [slug foot^2]
+  FGColumnVector3 gasCellM; // [lbs in]
 
-  FGAuxiliary* Auxiliary;
-  FGAtmosphere* Atmosphere;
   FGPropertyManager* PropertyManager;
-  FGInertial* Inertial;
   FGMassBalance* MassBalance;
   void Debug(int from);
 
@@ -299,7 +301,6 @@ private:
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 /** Models a ballonet inside a gas cell.
-    Models a ballonet inside a gas cell.
     Not intended to be used outside FGGasCell.
     See FGGasCell for the configuration file format.
     @author Anders Gidenstam
@@ -307,7 +308,7 @@ private:
 class FGBallonet : public FGJSBBase
 {
 public:
-  FGBallonet(FGFDMExec* exec, Element* el, int num, FGGasCell* parent);
+  FGBallonet(FGFDMExec* exec, Element* el, int num, FGGasCell* parent, const struct FGGasCell::Inputs& input);
   ~FGBallonet();
 
   /** Runs the ballonet model; called by FGGasCell
@@ -316,10 +317,10 @@ public:
 
 
   /** Get the center of gravity location of the ballonet
-      @return CoG location in the structural frame. */
+      @return CoG location in the structural frame in inches. */
   const FGColumnVector3& GetXYZ(void) const {return vXYZ;}
   /** Get the center of gravity location of the ballonet
-      @return CoG location in the structural frame. */
+      @return CoG location in the structural frame in inches. */
   double GetXYZ(int idx) const {return vXYZ(idx);}
 
   /** Get the current mass of the ballonets
@@ -327,7 +328,8 @@ public:
   double GetMass(void) const {return Contents * M_air;}
 
   /** Get the moments of inertia of the ballonet
-      @return moments of inertia matrix in slug ft<sup>2</sup>. */
+      @return moments of inertia matrix in the body frame in
+      slug ft<sup>2</sup>. */
   const FGMatrix33& GetInertia(void) const {return ballonetJ;}
 
   /** Get the current volume of the ballonet
@@ -337,11 +339,13 @@ public:
       @return heat flow in lbs ft / sec. */
   double GetHeatFlow(void) const {return dU;}       // [lbs ft / sec]
 
+  const struct FGGasCell::Inputs& in;
+
 private:
   int CellNum;
   // Structural constants
-  double MaxVolume;                 // [ft]
-  double MaxOverpressure;           // [lbs/ft]
+  double MaxVolume;                 // [ft^2]
+  double MaxOverpressure;           // [lbs/ft^2]
   FGColumnVector3 vXYZ;             // [in]
   double Xradius, Yradius, Zradius; // [ft]
   double Xwidth, Ywidth, Zwidth;    // [ft]
@@ -351,19 +355,17 @@ private:
   FGFunction* BlowerInput;          // [ft^3 / sec]
   FGGasCell* Parent;
   // Variables
-  double Pressure;         // [lbs/ft]
+  double Pressure;         // [lbs/ft^2]
   double Contents;         // [mol]
-  double Volume;           // [ft]
-  double dVolumeIdeal;     // [ft]
+  double Volume;           // [ft^2]
+  double dVolumeIdeal;     // [ft^2]
   double dU;               // [lbs ft / sec]
   double Temperature;      // [Rankine]
   double ValveOpen;        // 0 <= ValveOpen <= 1 (or higher).
-  FGMatrix33 ballonetJ;     // [slug foot]
+  FGMatrix33 ballonetJ;     // [slug foot^2]
 
-  FGAuxiliary* Auxiliary;
-  FGAtmosphere* Atmosphere;
   FGPropertyManager* PropertyManager;
-  FGInertial* Inertial;
+  FGMassBalance* MassBalance;
   void Debug(int from);
 
   /* Constants. */