]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/models/FGGasCell.h
Better fix for a compilation problem with MSVC 2012
[flightgear.git] / src / FDM / JSBSim / models / FGGasCell.h
index de34fb670aef7013f0baa4fa6481ce03b304a591..ff3613c17bd0c2d9fcbfe416e51090b61b0a5d40 100644 (file)
@@ -4,7 +4,7 @@
  Author:       Anders Gidenstam
  Date started: 01/21/2006
 
  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
 
  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,8 +32,8 @@ This class simulates a generic gas cell for static buoyancy.
 SENTRY
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 SENTRY
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#ifndef FGGasCell_H
-#define FGGasCell_H
+#ifndef FGGASCELL_H
+#define FGGASCELL_H
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 INCLUDES
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 INCLUDES
@@ -50,7 +50,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_GASCELL "$Id: FGGasCell.h,v 1.10 2009/10/24 22:59:30 jberndt Exp $"
+#define ID_GASCELL "$Id: FGGasCell.h,v 1.12 2011/08/06 13:47:59 jberndt Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -172,11 +172,18 @@ CLASS DECLARATION
 class FGGasCell : public FGForce
 {
 public:
 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. */
   /** 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
   ~FGGasCell();
 
   /** Runs the gas cell model; called by BuoyantForces
@@ -189,12 +196,12 @@ public:
 
   /** Get the center of gravity location of the gas cell
       (including any ballonets)
 
   /** 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)
   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)
   double GetXYZ(int idx) const {return vXYZ(idx);}
 
   /** Get the current mass of the gas cell (including any ballonets)
@@ -202,7 +209,7 @@ public:
   double GetMass(void) const {return Mass;}
 
   /** Get the moments of inertia of the gas cell (including any ballonets)
   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;}
 
       in slug ft<sup>2</sup>. */
   const FGMatrix33& GetInertia(void) const {return gasCellJ;}
 
@@ -210,7 +217,7 @@ public:
 
       Note that the buoyancy of the gas cell is handled separately by the
       FGForce part and not included here.
 
       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
   const FGColumnVector3& GetMassMoment(void) const {return gasCellM;}
 
   /** Get the current gas temperature inside the gas cell
@@ -221,6 +228,8 @@ public:
       @return gas pressure in lbs / ft<sup>2</sup>. */
   double GetPressure(void) const {return Pressure;}
 
       @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};
 private:
 
   enum GasType {ttUNKNOWN, ttHYDROGEN, ttHELIUM, ttAIR};
@@ -229,8 +238,8 @@ private:
   std::string type;
   int CellNum;
   // Structural constants
   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]
   FGColumnVector3 vXYZ;             // [in]
   double Xradius, Yradius, Zradius; // [ft]
   double Xwidth, Ywidth, Zwidth;    // [ft]
@@ -240,22 +249,19 @@ private:
   typedef vector <FGBallonet*> BallonetArray;
   BallonetArray Ballonet;
   // Variables
   typedef vector <FGBallonet*> BallonetArray;
   BallonetArray Ballonet;
   // Variables
-  double Pressure;          // [lbs/ft]
+  double Pressure;          // [lbs/ft^2]
   double Contents;          // [mol]
   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]
   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;
   FGPropertyManager* PropertyManager;
-  FGInertial* Inertial;
   FGMassBalance* MassBalance;
   void Debug(int from);
 
   FGMassBalance* MassBalance;
   void Debug(int from);
 
@@ -295,7 +301,6 @@ private:
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 /** Models a ballonet inside a gas cell.
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 /** 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
     Not intended to be used outside FGGasCell.
     See FGGasCell for the configuration file format.
     @author Anders Gidenstam
@@ -303,7 +308,7 @@ private:
 class FGBallonet : public FGJSBBase
 {
 public:
 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
   ~FGBallonet();
 
   /** Runs the ballonet model; called by FGGasCell
@@ -312,10 +317,10 @@ public:
 
 
   /** Get the center of gravity location of the ballonet
 
 
   /** 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
   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
   double GetXYZ(int idx) const {return vXYZ(idx);}
 
   /** Get the current mass of the ballonets
@@ -323,7 +328,8 @@ public:
   double GetMass(void) const {return Contents * M_air;}
 
   /** Get the moments of inertia of the ballonet
   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
   const FGMatrix33& GetInertia(void) const {return ballonetJ;}
 
   /** Get the current volume of the ballonet
@@ -333,11 +339,13 @@ public:
       @return heat flow in lbs ft / sec. */
   double GetHeatFlow(void) const {return dU;}       // [lbs ft / sec]
 
       @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
 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]
   FGColumnVector3 vXYZ;             // [in]
   double Xradius, Yradius, Zradius; // [ft]
   double Xwidth, Ywidth, Zwidth;    // [ft]
@@ -347,19 +355,17 @@ private:
   FGFunction* BlowerInput;          // [ft^3 / sec]
   FGGasCell* Parent;
   // Variables
   FGFunction* BlowerInput;          // [ft^3 / sec]
   FGGasCell* Parent;
   // Variables
-  double Pressure;         // [lbs/ft]
+  double Pressure;         // [lbs/ft^2]
   double Contents;         // [mol]
   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).
   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;
   FGPropertyManager* PropertyManager;
-  FGInertial* Inertial;
+  FGMassBalance* MassBalance;
   void Debug(int from);
 
   /* Constants. */
   void Debug(int from);
 
   /* Constants. */