]> 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 4c1759a548553781e19a209264b70d90785b095b..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,41 +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>
-
-#ifdef FGFS
-#  include <simgear/compiler.h>
-#  include STL_STRING
-  SG_USING_STD(string);
-  SG_USING_STD(cerr);
-  SG_USING_STD(endl);
-  SG_USING_STD(cout);
-#else
-# 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 "FGJSBBase.h"
+#include "math/FGColumnVector3.h"
+#include "models/propulsion/FGForce.h"
+#include "math/FGFunction.h"
+
+#include <string>
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_GASCELL "$Id$"
+#define ID_GASCELL "$Id: FGGasCell.h,v 1.12 2011/08/06 13:47:59 jberndt Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -75,6 +59,7 @@ FORWARD DECLARATIONS
 namespace JSBSim {
 
 class FGBallonet;
+class Element;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DOCUMENTATION
@@ -187,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
@@ -200,51 +192,54 @@ public:
 
   /** Get the index of this gas cell
       @return gas cell index. */
-  int GetIndex(void) {return CellNum;}
+  int GetIndex(void) const {return CellNum;}
 
   /** Get the center of gravity location of the gas cell
       (including any ballonets)
-      @return CoG location in the structural frame. */
-  const FGColumnVector3& GetXYZ(void) {return vXYZ;}
+      @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. */
-  double GetXYZ(int idx) {return vXYZ(idx);}
+      @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)
       @return gas mass in slug. */
-  double GetMass(void) {return Mass;}
+  double GetMass(void) const {return Mass;}
 
   /** Get the moments of inertia of the gas cell (including any ballonets)
-      @return moments of inertia matrix in slug ft<sup>2</sup>. */
-  FGMatrix33& GetInertia(void) {return gasCellJ;}
+      @return moments of inertia matrix in the body frame
+      in slug ft<sup>2</sup>. */
+  const FGMatrix33& GetInertia(void) const {return gasCellJ;}
 
   /** Get the moment due to mass of the gas cell (including any ballonets)
 
       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. */
-  FGColumnVector3& GetMassMoment(void) {return gasCellM;}
+      @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
       @return gas temperature in Rankine. */
-  double GetTemperature(void) {return Temperature;}
+  double GetTemperature(void) const {return Temperature;}
 
   /** Get the current gas pressure inside the gas cell
       @return gas pressure in lbs / ft<sup>2</sup>. */
-  double GetPressure(void) {return Pressure;}
+  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]
@@ -254,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);
 
@@ -309,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
@@ -317,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
@@ -326,32 +317,35 @@ public:
 
 
   /** Get the center of gravity location of the ballonet
-      @return CoG location in the structural frame. */
-  const FGColumnVector3& GetXYZ(void) {return vXYZ;}
+      @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. */
-  double GetXYZ(int idx) {return vXYZ(idx);}
+      @return CoG location in the structural frame in inches. */
+  double GetXYZ(int idx) const {return vXYZ(idx);}
 
   /** Get the current mass of the ballonets
       @return mass in slug. */
-  double GetMass(void) {return Contents * M_air;}
+  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>. */
-  FGMatrix33& GetInertia(void) {return ballonetJ;}
+      @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
       @return volume in ft<sup>3</sup>. */
-  double GetVolume(void) {return Volume;}
+  double GetVolume(void) const {return Volume;}
   /** Get the current heat flow into the ballonet
       @return heat flow in lbs ft / sec. */
-  double GetHeatFlow(void) {return dU;}             // [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]
@@ -361,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. */