]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/models/FGMassBalance.h
sync with JSB JSBSim CVS
[flightgear.git] / src / FDM / JSBSim / models / FGMassBalance.h
index be461a1e8204f950418ee91a61fb5ef07bd7471a..9b11290b1da451607bcaa2a7b9e89774344eb8e4 100644 (file)
@@ -49,7 +49,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_MASSBALANCE "$Id: FGMassBalance.h,v 1.21 2010/08/12 04:07:11 jberndt Exp $"
+#define ID_MASSBALANCE "$Id: FGMassBalance.h,v 1.27 2011/11/09 21:58:26 bcoconni Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONSS
@@ -116,7 +116,14 @@ public:
 
   bool Load(Element* el);
   bool InitModel(void);
-  bool Run(void);
+  /** Runs the Mass Balance model; called by the Executive
+      Can pass in a value indicating if the executive is directing the simulation to Hold.
+      @param Holding if true, the executive has been directed to hold the sim from 
+                     advancing time. Some models may ignore this flag, such as the Input
+                     model, which may need to be active to listen on a socket for the
+                     "Resume" command to be given.
+      @return false if no error */
+  bool Run(bool Holding);
 
   double GetMass(void) const {return Mass;}
   double GetWeight(void) const {return Weight;}
@@ -131,13 +138,13 @@ public:
       slugs at the given vector r in the structural frame. The units
       should be for the mass in slug and the vector in the structural
       frame as usual in inches.
-      @param slugs the mass of this single pointmass given in slugs
+      @param mass_sl the mass of this single pointmass given in slugs
       @param r the location of this single pointmass in the structural frame
    */
-  FGMatrix33 GetPointmassInertia(double slugs, const FGColumnVector3& r) const
+  FGMatrix33 GetPointmassInertia(double mass_sl, const FGColumnVector3& r) const
   {
     FGColumnVector3 v = StructuralToBody( r );
-    FGColumnVector3 sv = slugs*v;
+    FGColumnVector3 sv = mass_sl*v;
     double xx = sv(1)*v(1);
     double yy = sv(2)*v(2);
     double zz = sv(3)*v(3);
@@ -160,18 +167,27 @@ public:
    */
   FGColumnVector3 StructuralToBody(const FGColumnVector3& r) const;
 
-  inline void SetEmptyWeight(double EW) { EmptyWeight = EW;}
-  inline void SetBaseCG(const FGColumnVector3& CG) {vbaseXYZcg = vXYZcg = CG;}
+  void SetEmptyWeight(double EW) { EmptyWeight = EW;}
+  void SetBaseCG(const FGColumnVector3& CG) {vbaseXYZcg = vXYZcg = CG;}
 
   void AddPointMass(Element* el);
-  double GetTotalPointMassWeight(void);
+  double GetTotalPointMassWeight(void) const;
 
-  FGColumnVector3& GetPointMassMoment(void);
-  FGMatrix33& GetJ(void) {return mJ;}
-  FGMatrix33& GetJinv(void) {return mJinv;}
-  void SetAircraftBaseInertias(FGMatrix33 BaseJ) {baseJ = BaseJ;}
+  const FGColumnVector3& GetPointMassMoment(void);
+  const FGMatrix33& GetJ(void) const {return mJ;}
+  const FGMatrix33& GetJinv(void) const {return mJinv;}
+  void SetAircraftBaseInertias(const FGMatrix33& BaseJ) {baseJ = BaseJ;}
   void GetMassPropertiesReport(void) const;
   
+  struct Inputs {
+    double GasMass;
+    double TanksWeight;
+    FGColumnVector3 GasMoment;
+    FGMatrix33 GasInertia;
+    FGColumnVector3 TanksMoment;
+    FGMatrix33 TankInertia;
+  } in;
+
 private:
   double Weight;
   double EmptyWeight;
@@ -188,7 +204,7 @@ private:
   FGColumnVector3 vbaseXYZcg;
   FGColumnVector3 vPMxyz;
   FGColumnVector3 PointMassCG;
-  FGMatrix33& CalculatePMInertias(void);
+  const FGMatrix33& CalculatePMInertias(void);
 
 
   /** The PointMass structure encapsulates a point mass object, moments of inertia
@@ -239,9 +255,9 @@ private:
     double GetPointMassLocation(int axis) const {return Location(axis);}
     double GetPointMassWeight(void) const {return Weight;}
     esShape GetShapeType(void) {return eShapeType;}
-    FGColumnVector3 GetLocation(void) {return Location;}
-    FGMatrix33 GetPointMassInertia(void) {return mPMInertia;}
-    string GetName(void) {return Name;}
+    const FGColumnVector3& GetLocation(void) {return Location;}
+    const FGMatrix33& GetPointMassInertia(void) {return mPMInertia;}
+    const string& GetName(void) {return Name;}
 
     void SetPointMassLocation(int axis, double value) {Location(axis) = value;}
     void SetPointMassWeight(double wt) {Weight = wt;}