]> git.mxchange.org Git - flightgear.git/commitdiff
Sync. w. JSBSim CVS
authorehofman <ehofman>
Thu, 16 Dec 2004 12:47:20 +0000 (12:47 +0000)
committerehofman <ehofman>
Thu, 16 Dec 2004 12:47:20 +0000 (12:47 +0000)
41 files changed:
src/FDM/JSBSim/FGAerodynamics.cpp
src/FDM/JSBSim/FGAerodynamics.h
src/FDM/JSBSim/FGCoefficient.cpp
src/FDM/JSBSim/FGColumnVector3.cpp
src/FDM/JSBSim/FGColumnVector3.h
src/FDM/JSBSim/FGConfigFile.cpp
src/FDM/JSBSim/FGElectric.cpp
src/FDM/JSBSim/FGElectric.h
src/FDM/JSBSim/FGEngine.cpp
src/FDM/JSBSim/FGEngine.h
src/FDM/JSBSim/FGFCS.cpp
src/FDM/JSBSim/FGFCS.h
src/FDM/JSBSim/FGGroundReactions.cpp
src/FDM/JSBSim/FGGroundReactions.h
src/FDM/JSBSim/FGLocation.h
src/FDM/JSBSim/FGMatrix33.h
src/FDM/JSBSim/FGNozzle.cpp
src/FDM/JSBSim/FGNozzle.h
src/FDM/JSBSim/FGOutput.cpp
src/FDM/JSBSim/FGOutput.h
src/FDM/JSBSim/FGPiston.cpp
src/FDM/JSBSim/FGPiston.h
src/FDM/JSBSim/FGPropagate.cpp
src/FDM/JSBSim/FGPropeller.cpp
src/FDM/JSBSim/FGPropeller.h
src/FDM/JSBSim/FGPropertyManager.cpp
src/FDM/JSBSim/FGPropulsion.cpp
src/FDM/JSBSim/FGPropulsion.h
src/FDM/JSBSim/FGRocket.cpp
src/FDM/JSBSim/FGRocket.h
src/FDM/JSBSim/FGRotor.cpp
src/FDM/JSBSim/FGRotor.h
src/FDM/JSBSim/FGScript.cpp
src/FDM/JSBSim/FGThruster.cpp
src/FDM/JSBSim/FGThruster.h
src/FDM/JSBSim/FGTrim.h
src/FDM/JSBSim/FGTurbine.cpp
src/FDM/JSBSim/FGTurbine.h
src/FDM/JSBSim/JSBSim.cxx
src/FDM/JSBSim/JSBSim.hxx
src/FDM/JSBSim/filtersjb/FGFCSComponent.cpp

index d77ab2f6d4c105cc08827a53c2b2172d5eabd40c..8a95e85e10250c84593a02de474794ec7c1b6add 100644 (file)
@@ -220,7 +220,7 @@ bool FGAerodynamics::Load(FGConfigFile* AC_cfg)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGAerodynamics::GetCoefficientStrings(void)
+string FGAerodynamics::GetCoefficientStrings(string delimeter)
 {
   string CoeffStrings = "";
   bool firstime = true;
@@ -231,7 +231,7 @@ string FGAerodynamics::GetCoefficientStrings(void)
       if (firstime) {
         firstime = false;
       } else {
-        CoeffStrings += ", ";
+        CoeffStrings += delimeter;
       }
       CoeffStrings += Coeff[axis][sd]->GetCoefficientName();
     }
@@ -241,7 +241,7 @@ string FGAerodynamics::GetCoefficientStrings(void)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGAerodynamics::GetCoefficientValues(void)
+string FGAerodynamics::GetCoefficientValues(string delimeter)
 {
   string SDValues = "";
   bool firstime = true;
@@ -251,7 +251,7 @@ string FGAerodynamics::GetCoefficientValues(void)
       if (firstime) {
         firstime = false;
       } else {
-        SDValues += ", ";
+        SDValues += delimeter;
       }
       SDValues += Coeff[axis][sd]->GetSDstring();
     }
index 35c35820abc1df30333b9c958b4210c69391a2c7..3947101de9519bb60ae42ecbd5ef6c62913220b5 100644 (file)
@@ -156,13 +156,15 @@ public:
   inline void SetAlphaCLMin(double tt) { alphaclmin=tt; }
 
   /** Gets the strings for the current set of coefficients.
+      @param delimeter either a tab or comma string depending on output type
       @return a string containing the descriptive names for all coefficients */
-  string GetCoefficientStrings(void);
+  string GetCoefficientStrings(string delimeter);
 
   /** Gets the coefficient values.
+      @param delimeter either a tab or comma string depending on output type
       @return a string containing the numeric values for the current set of
       coefficients */
-  string GetCoefficientValues(void);
+  string GetCoefficientValues(string delimeter);
   
   void bind(void);
   void bindModel(void);
index 3f42398e329fba88733a1b7a40c7275a782a35a3..32f70fc517ed8c43bee4262b14d911b40fa0d75d 100644 (file)
@@ -168,9 +168,10 @@ bool FGCoefficient::Load(FGConfigFile *AC_cfg)
     end = multparms.length();
 
     n = multparms.find("|");
+    if (n == string::npos) n = end;
     start = 0;
     if (multparms != string("none")) {
-      while (n < end && n >= 0) {
+      while (n < end && n != string::npos) {
         n -= start;
         mult = multparms.substr(start,n);
         multipliers.push_back( resolveSymbol( mult ) );
index ebb16e1dd2e46ef02ac20bd17726262715b3662a..a52cc6e1052a6918eab1b8ca3b116f6e2a59fddd 100644 (file)
@@ -19,6 +19,7 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGColumnVector3.h"
+#include <cstdio>
 
 namespace JSBSim {
 
@@ -37,6 +38,15 @@ FGColumnVector3::FGColumnVector3(void)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
+string FGColumnVector3::Dump(string delimeter) const
+{
+  char buffer[256];
+  sprintf(buffer, "%f%s%f%s%f", Entry(1), delimeter.c_str(), Entry(2), delimeter.c_str(), Entry(3));
+  return string(buffer);
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
 FGColumnVector3 FGColumnVector3::operator/(const double scalar) const
 {
   if (scalar != 0.0)
@@ -44,7 +54,7 @@ FGColumnVector3 FGColumnVector3::operator/(const double scalar) const
 
   cerr << "Attempt to divide by zero in method "
     "FGColumnVector3::operator/(const double scalar), "
-    "object " << this << endl; 
+    "object " << this << endl;
   return FGColumnVector3();
 }
 
@@ -97,7 +107,7 @@ ostream& operator<<(ostream& os, const FGColumnVector3& col)
 {
   os << col(1) << " , " << col(2) << " , " << col(3);
   return os;
-}  
+}
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 //    The bitmasked value choices are as follows:
index a83afacdd1aff1f8ac2db2ad9e5e599f408110e8..19a508b6bbd8168d5ada7b29f7e7646894b12ebb 100644 (file)
@@ -89,19 +89,14 @@ class FGColumnVector3 : public FGJSBBase
 {
 public:
   /** Default initializer.
-
-      Create a zero vector.
-   */
+      Create a zero vector.   */
   FGColumnVector3(void);
 
   /** Initialization by given values.
-
       @param X value of the x-conponent.
       @param Y value of the y-conponent.
       @param Z value of the z-conponent.
-
-      Create a vector from the doubles given in the arguments.
-   */
+      Create a vector from the doubles given in the arguments.   */
   FGColumnVector3(double X, double Y, double Z) {
     data[0] = X;
     data[1] = Y;
@@ -110,11 +105,8 @@ public:
   }
 
   /** Copy constructor.
-
       @param v Vector which is used for initialization.
-
-      Create copy of the vector given in the argument.
-   */
+      Create copy of the vector given in the argument.   */
   FGColumnVector3(const FGColumnVector3& v) {
     data[0] = v.data[0];
     data[1] = v.data[1];
@@ -122,69 +114,51 @@ public:
     Debug(0);
   }
 
-  /** Destructor.
-   */
+  /// Destructor.
   ~FGColumnVector3(void) { Debug(1); }
 
-
   /** Read access the entries of the vector.
-
       @param idx the component index.
-
       Return the value of the matrix entry at the given index.
       Indices are counted starting with 1.
-
-      Note that the index given in the argument is unchecked.
-   */
+      Note that the index given in the argument is unchecked.   */
   double operator()(unsigned int idx) const { return Entry(idx); }
 
   /** Write access the entries of the vector.
-
       @param idx the component index.
-
       Return a reference to the vector entry at the given index.
       Indices are counted starting with 1.
-
-      Note that the index given in the argument is unchecked.
-   */
+      Note that the index given in the argument is unchecked.   */
   double& operator()(unsigned int idx) { return Entry(idx); }
 
   /** Read access the entries of the vector.
-
       @param idx the component index.
-
       Return the value of the matrix entry at the given index.
       Indices are counted starting with 1.
-
       This function is just a shortcut for the @ref double
       operator()(unsigned int idx) const function. It is
       used internally to access the elements in a more convenient way.
-
-      Note that the index given in the argument is unchecked.
-   */
+      Note that the index given in the argument is unchecked.   */
   double Entry(unsigned int idx) const { return data[idx-1]; }
 
   /** Write access the entries of the vector.
-
       @param idx the component index.
-
       Return a reference to the vector entry at the given index.
       Indices are counted starting with 1.
-
       This function is just a shortcut for the @ref double&
       operator()(unsigned int idx) function. It is
       used internally to access the elements in a more convenient way.
-
-      Note that the index given in the argument is unchecked.
-   */
+      Note that the index given in the argument is unchecked.   */
   double& Entry(unsigned int idx) { return data[idx-1]; }
 
-  /** Assignment operator.
+  /** Prints the contents of the vector
+      @param delimeter the item separator (tab or comma)
+      @return a string with the delimeter-separated contents of the vector  */
+  string Dump(string delimeter) const;
 
+  /** Assignment operator.
       @param b source vector.
-
-      Copy the content of the vector given in the argument into *this.
-   */
+      Copy the content of the vector given in the argument into *this.   */
   FGColumnVector3& operator=(const FGColumnVector3& b) {
     data[0] = b.data[0];
     data[1] = b.data[1];
@@ -193,71 +167,53 @@ public:
   }
 
   /**  Comparison operator.
-
       @param b other vector.
-
-      Returns true if both vectors are exactly the same.
-   */
+      Returns true if both vectors are exactly the same.   */
   bool operator==(const FGColumnVector3& b) const {
     return data[0] == b.data[0] && data[1] == b.data[1] && data[2] == b.data[2];
   }
 
   /** Comparison operator.
-
       @param b other vector.
-
-      Returns false if both vectors are exactly the same.
-   */
+      Returns false if both vectors are exactly the same.   */
   bool operator!=(const FGColumnVector3& b) const { return ! operator==(b); }
 
   /** Multiplication by a scalar.
-
       @param scalar scalar value to multiply the vector with.
       @return The resulting vector from the multiplication with that scalar.
-
-      Multiply the vector with the scalar given in the argument.
-   */
+      Multiply the vector with the scalar given in the argument.   */
   FGColumnVector3 operator*(const double scalar) const {
     return FGColumnVector3(scalar*Entry(1), scalar*Entry(2), scalar*Entry(3));
   }
 
   /** Multiply by 1/scalar.
-
       @param scalar scalar value to devide the vector through.
       @return The resulting vector from the division through that scalar.
-
-      Multiply the vector with the 1/scalar given in the argument.
-   */
+      Multiply the vector with the 1/scalar given in the argument.   */
   FGColumnVector3 operator/(const double scalar) const;
 
   /** Cross product multiplication.
-
       @param v vector to multiply with.
       @return The resulting vector from the cross product multiplication.
-
       Compute and return the cross product of the current vector with
-      the given argument.
-   */
+      the given argument.   */
   FGColumnVector3 operator*(const FGColumnVector3& V) const {
     return FGColumnVector3( Entry(2) * V(3) - Entry(3) * V(2),
                             Entry(3) * V(1) - Entry(1) * V(3),
                             Entry(1) * V(2) - Entry(2) * V(1) );
   }
 
-  /** Addition operator.
-   */
+  /// Addition operator.
   FGColumnVector3 operator+(const FGColumnVector3& B) const {
     return FGColumnVector3( Entry(1) + B(1), Entry(2) + B(2), Entry(3) + B(3) );
   }
 
-  /** Subtraction operator.
-   */
+  /// Subtraction operator.
   FGColumnVector3 operator-(const FGColumnVector3& B) const {
     return FGColumnVector3( Entry(1) - B(1), Entry(2) - B(2), Entry(3) - B(3) );
   }
 
-  /** Subtract an other vector.
-   */
+  /// Subtract an other vector.
   FGColumnVector3& operator-=(const FGColumnVector3 &B) {
     Entry(1) -= B(1);
     Entry(2) -= B(2);
@@ -265,8 +221,7 @@ public:
     return *this;
   }
 
-  /** Add an other vector.
-   */
+  /// Add an other vector.
   FGColumnVector3& operator+=(const FGColumnVector3 &B) {
     Entry(1) += B(1);
     Entry(2) += B(2);
@@ -274,8 +229,7 @@ public:
     return *this;
   }
 
-  /** Scale by a scalar.
-   */
+  /// Scale by a scalar.
   FGColumnVector3& operator*=(const double scalar) {
     Entry(1) *= scalar;
     Entry(2) *= scalar;
@@ -283,8 +237,7 @@ public:
     return *this;
   }
 
-  /** Scale by a 1/scalar.
-   */
+  /// Scale by a 1/scalar.
   FGColumnVector3& operator/=(const double scalar);
 
   void InitMatrix(void) { data[0] = data[1] = data[2] = 0.0; }
@@ -294,25 +247,19 @@ public:
   }
 
   /** Length of the vector.
-
-      Compute and return the euclidean norm of this vector.
-   */
+      Compute and return the euclidean norm of this vector.   */
   double Magnitude(void) const;
 
   /** Length of the vector in a coordinate axis plane.
-
       Compute and return the euclidean norm of this vector projected into
-      the coordinate axis plane idx1-idx2.
-   */
+      the coordinate axis plane idx1-idx2.   */
   double Magnitude(int idx1, int idx2) const {
     return sqrt( Entry(idx1)*Entry(idx1) +  Entry(idx2)*Entry(idx2) );
   }
 
   /** Normalize.
-
       Normalize the vector to have the Magnitude() == 1.0. If the vector
-      is equal to zero it is left untouched.
-   */
+      is equal to zero it is left untouched.   */
   FGColumnVector3& Normalize(void);
 
   // ??? Is this something sensible ??
@@ -340,24 +287,18 @@ private:
 };
 
 /** Scalar multiplication.
-
     @param scalar scalar value to multiply with.
     @param A Vector to multiply.
-
-    Multiply the Vector with a scalar value.
-*/
+    Multiply the Vector with a scalar value.*/
 inline FGColumnVector3 operator*(double scalar, const FGColumnVector3& A) {
   // use already defined operation.
   return A*scalar;
 }
 
 /** Write vector to a stream.
-
     @param os Stream to write to.
     @param M Matrix to write.
-
-    Write the matrix to a stream.
-*/
+    Write the matrix to a stream.*/
 ostream& operator<<(ostream& os, const FGColumnVector3& col);
 
 } // namespace JSBSim
index 8930caafd0af459284e5f093cc75a13cdc418ced..f994aba06c8549061514569f5c20ade262c274b1 100644 (file)
@@ -214,7 +214,7 @@ string FGConfigFile::GetLine(void)
       }
     } else {
       if ((test = cfgfile.get()) != EOF) { // get *next* character
-#if defined ( sgi ) && !defined( __GNUC__ ) && (_COMPILER_VERSION < 740)
+#if defined ( sgi ) && !defined( __GNUC__ ) && (_COMPILER_VERSION < 740) || defined (_MSC_VER)
         if (test >= 0x20 || test == 0x09) cfgfile.putback(test);
 #else
         if (test >= 0x20 || test == 0x09) cfgfile.unget();
index 4cc12f006612d60868aa3895a3ed377aede29e51..c62c5e328e3cb245c9685744bcafe4f96da19998 100644 (file)
@@ -91,19 +91,19 @@ double FGElectric::Calculate(void)
 
   PowerAvailable = (HP * hptoftlbssec) - Thruster->GetPowerRequired();
 
-  return Thruster->Calculate(PowerAvailable);
+  return Thrust = Thruster->Calculate(PowerAvailable);
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGElectric::GetEngineLabels(void)
+string FGElectric::GetEngineLabels(string delimeter)
 {
   return ""; // currently no labels are returned for this engine
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGElectric::GetEngineValues(void)
+string FGElectric::GetEngineValues(string delimeter)
 {
   return ""; // currently no values are returned for this engine
 }
index 7e865e2dbe6f6ddd8ac544389aeacb25d72268fa..20884f5f01a7ca2d0673e5c7b6127bbf8332f6fd 100644 (file)
@@ -82,8 +82,8 @@ public:
   double GetPowerAvailable(void) {return PowerAvailable;}
   double CalcFuelNeed(void);
   double getRPM(void) {return RPM;}
-  string GetEngineLabels(void);
-  string GetEngineValues(void);
+  string GetEngineLabels(string delimeter);
+  string GetEngineValues(string delimeter);
 
 private:
 
index 38193a2a2856680fb5a42f0e208dc111803185c8..a76a6acf4a6788a56f16fb11255755c4767b2d52 100644 (file)
@@ -87,6 +87,7 @@ FGEngine::FGEngine(FGFDMExec* exec, int engine_number) : EngineNumber(engine_num
   TrimMode = false;
   FuelFlow_gph = 0.0;
   FuelFlow_pph = 0.0;
+  FuelFreeze = false;
 
   FDMExec = exec;
   State = FDMExec->GetState();
@@ -99,7 +100,11 @@ FGEngine::FGEngine(FGFDMExec* exec, int engine_number) : EngineNumber(engine_num
   Output = FDMExec->GetOutput();
 
   PropertyManager = FDMExec->GetPropertyManager();
-
+  
+  char property_name[80];
+  snprintf(property_name, 80, "propulsion/engine[%u]/thrust", EngineNumber);
+  PropertyManager->Tie( property_name, &Thrust);
+  
   Debug(0);
 }
 
@@ -107,9 +112,12 @@ FGEngine::FGEngine(FGFDMExec* exec, int engine_number) : EngineNumber(engine_num
 
 FGEngine::~FGEngine()
 {
-  if (Thruster)
-    delete Thruster;
+  if (Thruster) delete Thruster;
 
+  char property_name[80];
+  snprintf(property_name, 80, "propulsion/engine[%u]/thrust", EngineNumber);
+  PropertyManager->Untie( property_name);
+  
   Debug(1);
 }
 
@@ -121,6 +129,8 @@ FGEngine::~FGEngine()
 
 void FGEngine::ConsumeFuel(void)
 {
+  if (FuelFreeze) return;
+  unsigned int i;
   double Fshortage, Oshortage, TanksWithFuel;
   FGTank* Tank;
 
@@ -128,7 +138,7 @@ void FGEngine::ConsumeFuel(void)
   Fshortage = Oshortage = TanksWithFuel = 0.0;
 
   // count how many assigned tanks have fuel
-  for (unsigned int i=0; i<SourceTanks.size(); i++) {
+  for (i=0; i<SourceTanks.size(); i++) {
     Tank = Propulsion->GetTank(SourceTanks[i]);
     if (Tank->GetContents() > 0.0) {
       ++TanksWithFuel;
@@ -136,7 +146,7 @@ void FGEngine::ConsumeFuel(void)
   }
   if (!TanksWithFuel) return;
 
-  for (unsigned int i=0; i<SourceTanks.size(); i++) {
+  for (i=0; i<SourceTanks.size(); i++) {
     Tank = Propulsion->GetTank(SourceTanks[i]);
     if (Tank->GetType() == FGTank::ttFUEL) {
        Fshortage += Tank->Drain(CalcFuelNeed()/TanksWithFuel);
index a4d63c2d1bb26b99144e79922e4a767451da6c61..82705413f67a2fe0131c048aad9b1622940c3941 100644 (file)
@@ -135,6 +135,7 @@ public:
   virtual void SetRunning(bool bb) { Running=bb; }
   virtual void SetName(string name) { Name = name; }
   virtual void AddFeedTank(int tkID);
+  virtual void SetFuelFreeze(bool f) { FuelFreeze = f; }
 
   virtual void SetStarter(bool s) { Starter = s; }
 
@@ -175,8 +176,8 @@ public:
   bool LoadThruster(FGConfigFile* AC_cfg);
   FGThruster* GetThruster(void) {return Thruster;}
 
-  virtual string GetEngineLabels(void) = 0;
-  virtual string GetEngineValues(void) = 0;
+  virtual string GetEngineLabels(string delimeter) = 0;
+  virtual string GetEngineValues(string delimeter) = 0;
 
 protected:
   FGPropertyManager* PropertyManager;
@@ -202,6 +203,7 @@ protected:
   bool  Running;
   bool  Cranking;
   bool  TrimMode;
+  bool  FuelFreeze;
 
   double FuelFlow_gph;
   double FuelFlow_pph;
index cfeb2d5716fa61fc5175c6d2c23e731cd566b6d2..daa900a6827e9c77c20a165376180b663791b17a 100644 (file)
@@ -420,7 +420,7 @@ double FGFCS::GetBrake(FGLGear::BrakeGroup bg)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGFCS::GetComponentStrings(void)
+string FGFCS::GetComponentStrings(string delimeter)
 {
   unsigned int comp;
   string CompStrings = "";
@@ -428,14 +428,14 @@ string FGFCS::GetComponentStrings(void)
 
   for (comp = 0; comp < FCSComponents.size(); comp++) {
     if (firstime) firstime = false;
-    else          CompStrings += ", ";
+    else          CompStrings += delimeter;
 
     CompStrings += FCSComponents[comp]->GetName();
   }
 
   for (comp = 0; comp < APComponents.size(); comp++)
   {
-    CompStrings += ", ";
+    CompStrings += delimeter;
     CompStrings += APComponents[comp]->GetName();
   }
 
@@ -444,7 +444,7 @@ string FGFCS::GetComponentStrings(void)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGFCS::GetComponentValues(void)
+string FGFCS::GetComponentValues(string delimeter)
 {
   unsigned int comp;
   string CompValues = "";
@@ -453,14 +453,14 @@ string FGFCS::GetComponentValues(void)
 
   for (comp = 0; comp < FCSComponents.size(); comp++) {
     if (firstime) firstime = false;
-    else          CompValues += ", ";
+    else          CompValues += delimeter;
 
     sprintf(buffer, "%9.6f", FCSComponents[comp]->GetOutput());
     CompValues += string(buffer);
   }
 
   for (comp = 0; comp < APComponents.size(); comp++) {
-    sprintf(buffer, ", %9.6f", APComponents[comp]->GetOutput());
+    sprintf(buffer, "%s%9.6f", delimeter.c_str(), APComponents[comp]->GetOutput());
     CompValues += string(buffer);
   }
 
index 43d8822b2e7c8587d9356e90b91951a2074b66f7..4775e69019bf53bcf1d4e9b0e41d67e2924aa23b 100644 (file)
@@ -425,11 +425,16 @@ public:
       @return pointer to the State object */
   inline FGState* GetState(void) { return State; }
 
-  /** Retrieves all component names for inclusion in output stream */
-  string GetComponentStrings(void);
-
-  /** Retrieves all component outputs for inclusion in output stream */
-  string GetComponentValues(void);
+  /** Retrieves all component names for inclusion in output stream
+      @param delimeter either a tab or comma string depending on output type
+      @return a string containing the descriptive names for all components */
+  string GetComponentStrings(string delimeter);
+
+  /** Retrieves all component outputs for inclusion in output stream
+      @param delimeter either a tab or comma string depending on output type
+      @return a string containing the numeric values for the current set of
+      component outputs */
+  string GetComponentValues(string delimeter);
 
   /// @name Pilot input command setting
   //@{
index abd19c88d508bc724acf33cb546b7855fe0b9cef..2a30b623438a01603319335b782265ca90a99a37 100644 (file)
@@ -120,30 +120,30 @@ bool FGGroundReactions::Load(FGConfigFile* AC_cfg)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGGroundReactions::GetGroundReactionStrings(void)
+string FGGroundReactions::GetGroundReactionStrings(string delimeter)
 {
   std::ostringstream buf;
 
   for (unsigned int i=0;i<lGear.size();i++) {
     string name = lGear[i].GetName();
-    buf << name << "_WOW, "
-        << name << "_stroke, "
-        << name << "_strokeVel, "
-        << name << "_CompressForce, "
-        << name << "_WhlSideForce, "
-        << name << "_WhlVelVecX, "
-        << name << "_WhlVelVecY, "
-        << name << "_WhlRollForce, "
-        << name << "_BodyXForce, "
-        << name << "_BodyYForce, "
-        << name << "_WhlSlipDegrees, ";
+    buf << name << "_WOW" << delimeter
+        << name << "_stroke" << delimeter
+        << name << "_strokeVel" << delimeter
+        << name << "_CompressForce" << delimeter
+        << name << "_WhlSideForce" << delimeter
+        << name << "_WhlVelVecX" << delimeter
+        << name << "_WhlVelVecY" << delimeter
+        << name << "_WhlRollForce" << delimeter
+        << name << "_BodyXForce" << delimeter
+        << name << "_BodyYForce" << delimeter
+        << name << "_WhlSlipDegrees" << delimeter;
   }
 
-  buf << "TotalGearForce_X, "
-      << "TotalGearForce_Y, "
-      << "TotalGearForce_Z, "
-      << "TotalGearMoment_L, "
-      << "TotalGearMoment_M, "
+  buf << "TotalGearForce_X" << delimeter
+      << "TotalGearForce_Y" << delimeter
+      << "TotalGearForce_Z" << delimeter
+      << "TotalGearMoment_L" << delimeter
+      << "TotalGearMoment_M" << delimeter
       << "TotalGearMoment_N";
 
   return buf.str();
@@ -151,30 +151,30 @@ string FGGroundReactions::GetGroundReactionStrings(void)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGGroundReactions::GetGroundReactionValues(void)
+string FGGroundReactions::GetGroundReactionValues(string delimeter)
 {
   std::ostringstream buf;
 
   for (unsigned int i=0;i<lGear.size();i++) {
     FGLGear& gear = lGear[i];
     buf << (gear.GetWOW() ? "1, " : "0, ")
-        << setprecision(5) << gear.GetCompLen() << ", "
-        << setprecision(6) << gear.GetCompVel() << ", "
-        << setprecision(10) << gear.GetCompForce() << ", "
-        << setprecision(6) << gear.GetWheelVel(eX) << ", "
-        << gear.GetWheelVel(eY) << ", "
-        << gear.GetWheelSideForce() << ", "
-        << gear.GetWheelRollForce() << ", "
-        << gear.GetBodyXForce() << ", "
-        << gear.GetBodyYForce() << ", "
-        << gear.GetWheelSlipAngle() << ", ";
+        << setprecision(5) << gear.GetCompLen() << delimeter
+        << setprecision(6) << gear.GetCompVel() << delimeter
+        << setprecision(10) << gear.GetCompForce() << delimeter
+        << setprecision(6) << gear.GetWheelVel(eX) << delimeter
+        << gear.GetWheelVel(eY) << delimeter
+        << gear.GetWheelSideForce() << delimeter
+        << gear.GetWheelRollForce() << delimeter
+        << gear.GetBodyXForce() << delimeter
+        << gear.GetBodyYForce() << delimeter
+        << gear.GetWheelSlipAngle() << delimeter;
   }
 
-  buf << vForces(eX) << ", "
-      << vForces(eY) << ", "
-      << vForces(eZ) << ", "
-      << vMoments(eX) << ", "
-      << vMoments(eY) << ", "
+  buf << vForces(eX) << delimeter
+      << vForces(eY) << delimeter
+      << vForces(eZ) << delimeter
+      << vMoments(eX) << delimeter
+      << vMoments(eY) << delimeter
       << vMoments(eZ);
 
   return buf.str();
index db75cf46295cd5a89f20a28ce3f1958005395994..ce3a5a9e967547312cf456bf40190e7432c7c9a7 100644 (file)
@@ -85,8 +85,8 @@ public:
   double GetForces(int idx) const {return vForces(idx);}
   FGColumnVector3& GetMoments(void) {return vMoments;}
   double GetMoments(int idx) const {return vMoments(idx);}
-  string GetGroundReactionStrings(void);
-  string GetGroundReactionValues(void);
+  string GetGroundReactionStrings(string delimeter);
+  string GetGroundReactionValues(string delimeter);
   
   inline int GetNumGearUnits(void) const { return lGear.size(); }
 
index 026241ebde0930da7e07806eccb97f81e15c5cf5..d0c3eca8de2e8ee095c5fdb82c58093f9680c496 100644 (file)
@@ -124,6 +124,10 @@ CLASS DOCUMENTATION
     same magnitude for all components in this representation which is
     an advantage for numerical stability in implicit time-stepping too.
 
+    Note: The latitude is a GEOCENTRIC value. FlightGear
+    converts latitude to a geodetic value and uses that. In order to get best
+    matching relative to a map, geocentric latitude must be converted to geodetic.
+
     @see W. C. Durham "Aircraft Dynamics & Control", section 2.2
 
     @author Mathias Froehlich
@@ -141,7 +145,10 @@ public:
   FGLocation() { mCacheValid = false; }
 
   /** Constructor to set the longitude, latitude and the distance
-      from the center of the earth. */
+      from the center of the earth.
+      @param lon longitude
+      @param lat GEOCENTRIC latitude
+      @param distance from center of earth to vehicle in feet*/
   FGLocation(double lon, double lat, double radius);
 
   /** Copy constructor. */
index dc68b73584733c4a4f9ae1542296e76679854e22..9bc78ee09346982e549e2cf88cb826db07b19883 100644 (file)
@@ -113,17 +113,12 @@ public:
   };
 
   /** Default initializer.
-
-      Create a zero matrix.
-   */
+      Create a zero matrix.  */
   FGMatrix33(void);
 
   /** Copy constructor.
-
       @param M Matrix which is used for initialization.
-
-      Create copy of the matrix given in the argument.
-   */
+      Create copy of the matrix given in the argument.  */
   FGMatrix33(const FGMatrix33& M) {
     Entry(1,1) = M.Entry(1,1);
     Entry(2,1) = M.Entry(2,1);
@@ -139,7 +134,6 @@ public:
   }
 
   /** Initialization by given values.
-
       @param m11 value of the 1,1 Matrix element.
       @param m12 value of the 1,2 Matrix element.
       @param m13 value of the 1,3 Matrix element.
@@ -149,9 +143,7 @@ public:
       @param m31 value of the 3,1 Matrix element.
       @param m32 value of the 3,2 Matrix element.
       @param m33 value of the 3,3 Matrix element.
-
-      Create a matrix from the doubles given in the arguments.
-   */
+      Create a matrix from the doubles given in the arguments.   */
   FGMatrix33(double m11, double m12, double m13,
              double m21, double m22, double m23,
              double m31, double m32, double m33) {
@@ -168,30 +160,24 @@ public:
     Debug(0);
   }
 
-  /** Destructor.
-   */
+  /// Destructor.
   ~FGMatrix33(void) { Debug(1); }
 
   /** Read access the entries of the matrix.
       @param row Row index.
       @param col Column index.
-
       @return the value of the matrix entry at the given row and
-      column indices. Indices are counted starting with 1.
-   */
+      column indices. Indices are counted starting with 1.   */
   double operator()(unsigned int row, unsigned int col) const {
     return Entry(row, col);
   }
 
   /** Write access the entries of the matrix.
       Note that the indices given in the arguments are unchecked.
-
       @param row Row index.
       @param col Column index.
-
       @return a reference to the matrix entry at the given row and
-      column indices. Indices are counted starting with 1.
-   */
+      column indices. Indices are counted starting with 1.   */
   double& operator()(unsigned int row, unsigned int col) {
     return Entry(row, col);
   }
@@ -200,15 +186,11 @@ public:
       This function is just a shortcut for the @ref double&
       operator()(unsigned int row, unsigned int col) function. It is
       used internally to access the elements in a more convenient way.
-
       Note that the indices given in the arguments are unchecked.
-
       @param row Row index.
       @param col Column index.
-
       @return the value of the matrix entry at the given row and
-      column indices. Indices are counted starting with 1.
-   */
+      column indices. Indices are counted starting with 1.   */
   double Entry(unsigned int row, unsigned int col) const {
     return data[(col-1)*eRows+row-1];
   }
@@ -217,34 +199,27 @@ public:
       This function is just a shortcut for the @ref double&
       operator()(unsigned int row, unsigned int col) function. It is
       used internally to access the elements in a more convenient way.
-
       Note that the indices given in the arguments are unchecked.
-
       @param row Row index.
       @param col Column index.
-
       @return a reference to the matrix entry at the given row and
-      column indices. Indices are counted starting with 1.
-   */
+      column indices. Indices are counted starting with 1.   */
    double& Entry(unsigned int row, unsigned int col) {
      return data[(col-1)*eRows+row-1];
    }
 
   /** Number of rows in the matrix.
-      @return the number of rows in the matrix.
-   */
+      @return the number of rows in the matrix.   */
    unsigned int Rows(void) const { return eRows; }
 
   /** Number of cloumns in the matrix.
-      @return the number of columns in the matrix.
-   */
+      @return the number of columns in the matrix.   */
    unsigned int Cols(void) const { return eColumns; }
 
   /** Transposed matrix.
       This function only returns the transpose of this matrix. This matrix itself
       remains unchanged.
-      @return the transposed matrix.
-   */
+      @return the transposed matrix.   */
   FGMatrix33 Transposed(void) const {
     return FGMatrix33( Entry(1,1), Entry(2,1), Entry(3,1),
                        Entry(1,2), Entry(2,2), Entry(3,2),
@@ -252,18 +227,15 @@ public:
   }
 
   /** Transposes this matrix.
-      This function only transposes this matrix. Nothing is returned.
-   */
+      This function only transposes this matrix. Nothing is returned.   */
   void T(void);
 
 /** Initialize the matrix.
-    This function initializes a matrix to all 0.0.
- */
+    This function initializes a matrix to all 0.0. */
   void InitMatrix(void);
 
 /** Initialize the matrix.
-    This function initializes a matrix to user specified values.
- */
+    This function initializes a matrix to user specified values. */
   void InitMatrix(double m11, double m12, double m13,
                   double m21, double m22, double m23,
                   double m31, double m32, double m33) {
@@ -279,8 +251,7 @@ public:
   }
 
   /** Determinant of the matrix.
-      @return the determinant of the matrix.
-   */
+      @return the determinant of the matrix.   */
   double Determinant(void) const;
 
   /** Return if the matrix is invertible.
@@ -288,24 +259,19 @@ public:
       invertible. This is done by simply computing the determinant and
       check if it is zero. Note that this test does not cover any
       instabilities caused by nearly singular matirces using finite
-      arithmetics. It only checks exact singularity.
-   */
+      arithmetics. It only checks exact singularity.   */
   bool Invertible(void) const { return 0.0 != Determinant(); }
 
   /** Return the inverse of the matrix.
       Computes and returns if the inverse of the matrix. It is computed
       by Cramers Rule. Also there are no checks performed if the matrix
       is invertible. If you are not sure that it really is check this
-      with the @ref Invertible() call before.
-   */
+      with the @ref Invertible() call before.   */
   FGMatrix33 Inverse(void) const;
 
   /** Assignment operator.
-
       @param A source matrix.
-
-      Copy the content of the matrix given in the argument into *this.
-   */
+      Copy the content of the matrix given in the argument into *this.   */
   FGMatrix33& operator=(const FGMatrix33& A) {
     data[0] = A.data[0];
     data[1] = A.data[1];
@@ -320,113 +286,80 @@ public:
   }
 
   /** Matrix vector multiplication.
-
       @param v vector to multiply with.
       @return matric vector product.
-
       Compute and return the product of the current matrix with the
-      vector given in the argument.
-   */
+      vector given in the argument.   */
   FGColumnVector3 operator*(const FGColumnVector3& v) const;
 
   /** Matrix subtraction.
-
       @param B matrix to add to.
       @return difference of the matrices.
-
       Compute and return the sum of the current matrix and the matrix
-      B given in the argument.
-  */
+      B given in the argument.  */
   FGMatrix33 operator-(const FGMatrix33& B) const;
 
   /** Matrix addition.
-
       @param B matrix to add to.
       @return sum of the matrices.
-
       Compute and return the sum of the current matrix and the matrix
-      B given in the argument.
-  */
+      B given in the argument.  */
   FGMatrix33 operator+(const FGMatrix33& B) const;
 
   /** Matrix product.
-
       @param B matrix to add to.
       @return product of the matrices.
-
       Compute and return the product of the current matrix and the matrix
-      B given in the argument.
-  */
+      B given in the argument.  */
   FGMatrix33 operator*(const FGMatrix33& B) const;
 
   /** Multiply the matrix with a scalar.
-
       @param scalar scalar factor to multiply with.
       @return scaled matrix.
-
       Compute and return the product of the current matrix with the
-      scalar value scalar given in the argument.
-  */
+      scalar value scalar given in the argument.  */
   FGMatrix33 operator*(const double scalar) const;
 
   /** Multiply the matrix with 1.0/scalar.
-
       @param scalar scalar factor to divide through.
       @return scaled matrix.
-
       Compute and return the product of the current matrix with the
-      scalar value 1.0/scalar, where scalar is given in the argument.
-  */
+      scalar value 1.0/scalar, where scalar is given in the argument.  */
   FGMatrix33 operator/(const double scalar) const;
 
   /** In place matrix subtraction.
-
       @param B matrix to subtract.
       @return reference to the current matrix.
-
       Compute the diffence from the current matrix and the matrix B
-      given in the argument.
-  */
+      given in the argument.  */
   FGMatrix33& operator-=(const FGMatrix33 &B);
 
   /** In place matrix addition.
-
       @param B matrix to add.
       @return reference to the current matrix.
-
       Compute the sum of the current matrix and the matrix B
-      given in the argument.
-  */
+      given in the argument.  */
   FGMatrix33& operator+=(const FGMatrix33 &B);
 
   /** In place matrix multiplication.
-
       @param B matrix to multiply with.
       @return reference to the current matrix.
-
       Compute the product of the current matrix and the matrix B
-      given in the argument.
-  */
+      given in the argument.  */
   FGMatrix33& operator*=(const FGMatrix33 &B);
 
   /** In place matrix scale.
-
       @param scalar scalar value to multiply with.
       @return reference to the current matrix.
-
       Compute the product of the current matrix and the scalar value scalar
-      given in the argument.
-  */
+      given in the argument.  */
   FGMatrix33& operator*=(const double scalar);
 
   /** In place matrix scale.
-
       @param scalar scalar value to divide through.
       @return reference to the current matrix.
-
       Compute the product of the current matrix and the scalar value
-      1.0/scalar, where scalar is given in the argument.
-  */
+      1.0/scalar, where scalar is given in the argument.  */
   FGMatrix33& operator/=(const double scalar);
 
 private:
@@ -436,33 +369,24 @@ private:
 };
 
 /** Scalar multiplication.
-
     @param scalar scalar value to multiply with.
     @param A Matrix to multiply.
-
-    Multiply the Matrix with a scalar value.
-*/
+    Multiply the Matrix with a scalar value.*/
 inline FGMatrix33 operator*(double scalar, const FGMatrix33& A) {
   // use already defined operation.
   return A*scalar;
 }
 
 /** Write matrix to a stream.
-
     @param os Stream to write to.
     @param M Matrix to write.
-
-    Write the matrix to a stream.
-*/
+    Write the matrix to a stream.*/
 ostream& operator<<(ostream& os, const FGMatrix33& M);
 
 /** Read matrix from a stream.
-
     @param os Stream to read from.
     @param M Matrix to initialize with the values from the stream.
-
-    Read matrix from a stream.
-*/
+    Read matrix from a stream.*/
 istream& operator>>(istream& is, FGMatrix33& M);
 
 } // namespace JSBSim
index bbab526866c4a0f4b7e149e0813ff07a2c2c96eb..c159c12a78acd23bf7e6b6515883a4c79efe5e67 100644 (file)
@@ -66,7 +66,6 @@ FGNozzle::FGNozzle(FGFDMExec* FDMExec, FGConfigFile* Nzl_cfg, int num) : FGThrus
   }
 
   Thrust = 0;
-  ReverserAngle = 0.0;
   Type = ttNozzle;
   Area2 = (Diameter*Diameter/4.0)*M_PI;
   AreaT = Area2/ExpR;
@@ -95,7 +94,7 @@ double FGNozzle::Calculate(double CfPc)
 {
   double pAtm = fdmex->GetAtmosphere()->GetPressure();
   Thrust = max((double)0.0, (CfPc * AreaT + (PE - pAtm)*Area2) * nzlEff);
-  vFn(1) = Thrust * cos(ReverserAngle);
+  vFn(1) = Thrust;
 
   ThrustCoeff = max((double)0.0, CfPc / ((pAtm - PE) * Area2));
 
@@ -111,7 +110,7 @@ double FGNozzle::GetPowerRequired(void)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGNozzle::GetThrusterLabels(int id)
+string FGNozzle::GetThrusterLabels(int id, string delimeter)
 {
   std::ostringstream buf;
 
@@ -122,7 +121,7 @@ string FGNozzle::GetThrusterLabels(int id)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGNozzle::GetThrusterValues(int id)
+string FGNozzle::GetThrusterValues(int id, string delimeter)
 {
   std::ostringstream buf;
 
index 5c9e76c18031ac57633798caf18adafa576914a8..d329fa1e167ae8486f146502323c78f4a246bbb8 100644 (file)
@@ -75,11 +75,11 @@ public:
 
   double Calculate(double CfPc);
   double GetPowerRequired(void);
-  string GetThrusterLabels(int id);
-  string GetThrusterValues(int id);
+  string GetThrusterLabels(int id, string delimeter);
+  string GetThrusterValues(int id, string delimeter);
 
 private:
-  double ReverserAngle;
+
   double PE;
   double ExpR;
   double nzlEff;
index dc7730d669b6f9b09daa93a637ac8708be779a20..dc3e43facb197af9cf7cd35e5a06df378193b1c4 100644 (file)
@@ -72,6 +72,7 @@ FGOutput::FGOutput(FGFDMExec* fdmex) : FGModel(fdmex)
   SubSystems = 0;
   enabled = true;
   outputInFileName = "";
+  delimeter = ", ";
 
   Debug(0);
 }
@@ -94,7 +95,7 @@ bool FGOutput::Run(void)
     if (FGModel::Run()) return true;
     if (Type == otSocket) {
       SocketOutput();
-    } else if (Type == otCSV) {
+    } else if (Type == otCSV || Type == otTab) {
       DelimitedOutput(Filename);
     } else if (Type == otTerminal) {
       // Not done yet
@@ -113,8 +114,10 @@ void FGOutput::SetType(string type)
 {
   if (type == "CSV") {
     Type = otCSV;
+    delimeter = ", ";
   } else if (type == "TABULAR") {
     Type = otTab;
+    delimeter = "\t";
   } else if (type == "SOCKET") {
     Type = otSocket;
   } else if (type == "TERMINAL") {
@@ -147,89 +150,89 @@ void FGOutput::DelimitedOutput(string fname)
       // Nothing here, yet
     }
     if (SubSystems & ssAerosurfaces) {
-      outstream << ", ";
-      outstream << "Aileron Cmd, ";
-      outstream << "Elevator Cmd, ";
-      outstream << "Rudder Cmd, ";
-      outstream << "Flap Cmd, ";
-      outstream << "Left Aileron Pos, ";
-      outstream << "Right Aileron Pos, ";
-      outstream << "Elevator Pos, ";
-      outstream << "Rudder Pos, ";
+      outstream << delimeter;
+      outstream << "Aileron Cmd" + delimeter;
+      outstream << "Elevator Cmd" + delimeter;
+      outstream << "Rudder Cmd" + delimeter;
+      outstream << "Flap Cmd" + delimeter;
+      outstream << "Left Aileron Pos" + delimeter;
+      outstream << "Right Aileron Pos" + delimeter;
+      outstream << "Elevator Pos" + delimeter;
+      outstream << "Rudder Pos" + delimeter;
       outstream << "Flap Pos";
     }
     if (SubSystems & ssRates) {
-      outstream << ", ";
-      outstream << "P, Q, R, ";
-      outstream << "Pdot, Qdot, Rdot";
+      outstream << delimeter;
+      outstream << "P" + delimeter + "Q" + delimeter + "R" + delimeter;
+      outstream << "Pdot" + delimeter + "Qdot" + delimeter + "Rdot";
     }
     if (SubSystems & ssVelocities) {
-      outstream << ", ";
-      outstream << "QBar, ";
-      outstream << "Vtotal, ";
-      outstream << "UBody, VBody, WBody, ";
-      outstream << "UAero, VAero, WAero, ";
-      outstream << "Vn, Ve, Vd";
+      outstream << delimeter;
+      outstream << "QBar" + delimeter;
+      outstream << "Vtotal" + delimeter;
+      outstream << "UBody" + delimeter + "VBody" + delimeter + "WBody" + delimeter;
+      outstream << "UAero" + delimeter + "VAero" + delimeter + "WAero" + delimeter;
+      outstream << "Vn" + delimeter + "Ve" + delimeter + "Vd";
     }
     if (SubSystems & ssForces) {
-      outstream << ", ";
-      outstream << "Drag, Side, Lift, ";
-      outstream << "L/D, ";
-      outstream << "Xforce, Yforce, Zforce";
+      outstream << delimeter;
+      outstream << "Drag" + delimeter + "Side" + delimeter + "Lift" + delimeter;
+      outstream << "L/D" + delimeter;
+      outstream << "Xforce" + delimeter + "Yforce" + delimeter + "Zforce";
     }
     if (SubSystems & ssMoments) {
-      outstream << ", ";
-      outstream << "L, M, N";
+      outstream << delimeter;
+      outstream << "L" + delimeter + "M" + delimeter + "N";
     }
     if (SubSystems & ssAtmosphere) {
-      outstream << ", ";
-      outstream << "Rho, ";
-      outstream << "NWind, EWind, DWind";
+      outstream << delimeter;
+      outstream << "Rho" + delimeter;
+      outstream << "NWind" + delimeter + "EWind" + delimeter + "DWind";
     }
     if (SubSystems & ssMassProps) {
-      outstream << ", ";
-      outstream << "Ixx, ";
-      outstream << "Ixy, ";
-      outstream << "Ixz, ";
-      outstream << "Iyx, ";
-      outstream << "Iyy, ";
-      outstream << "Iyz, ";
-      outstream << "Izx, ";
-      outstream << "Izy, ";
-      outstream << "Izz, ";
-      outstream << "Mass, ";
-      outstream << "Xcg, Ycg, Zcg";
+      outstream << delimeter;
+      outstream << "Ixx" + delimeter;
+      outstream << "Ixy" + delimeter;
+      outstream << "Ixz" + delimeter;
+      outstream << "Iyx" + delimeter;
+      outstream << "Iyy" + delimeter;
+      outstream << "Iyz" + delimeter;
+      outstream << "Izx" + delimeter;
+      outstream << "Izy" + delimeter;
+      outstream << "Izz" + delimeter;
+      outstream << "Mass" + delimeter;
+      outstream << "Xcg" + delimeter + "Ycg" + delimeter + "Zcg";
     }
     if (SubSystems & ssPropagate) {
-      outstream << ", ";
-      outstream << "Altitude, ";
-      outstream << "Phi, Tht, Psi, ";
-      outstream << "Alpha, ";
-      outstream << "Beta, ";
-      outstream << "Latitude (Deg), ";
-      outstream << "Longitude (Deg), ";
-      outstream << "Distance AGL, ";
+      outstream << delimeter;
+      outstream << "Altitude" + delimeter;
+      outstream << "Phi" + delimeter + "Tht" + delimeter + "Psi" + delimeter;
+      outstream << "Alpha" + delimeter;
+      outstream << "Beta" + delimeter;
+      outstream << "Latitude (Deg)" + delimeter;
+      outstream << "Longitude (Deg)" + delimeter;
+      outstream << "Distance AGL" + delimeter;
       outstream << "Runway Radius";
     }
     if (SubSystems & ssCoefficients) {
-      scratch = Aerodynamics->GetCoefficientStrings();
-      if (scratch.length() != 0) outstream << ", " << scratch;
+      scratch = Aerodynamics->GetCoefficientStrings(delimeter);
+      if (scratch.length() != 0) outstream << delimeter << scratch;
     }
     if (SubSystems & ssFCS) {
-      scratch = FCS->GetComponentStrings();
-      if (scratch.length() != 0) outstream << ", " << scratch;
+      scratch = FCS->GetComponentStrings(delimeter);
+      if (scratch.length() != 0) outstream << delimeter << scratch;
     }
     if (SubSystems & ssGroundReactions) {
-      outstream << ", ";
-      outstream << GroundReactions->GetGroundReactionStrings();
+      outstream << delimeter;
+      outstream << GroundReactions->GetGroundReactionStrings(delimeter);
     }
     if (SubSystems & ssPropulsion && Propulsion->GetNumEngines() > 0) {
-      outstream << ", ";
-      outstream << Propulsion->GetPropulsionStrings();
+      outstream << delimeter;
+      outstream << Propulsion->GetPropulsionStrings(delimeter);
     }
     if (OutputProperties.size() > 0) {
       for (unsigned int i=0;i<OutputProperties.size();i++) {
-        outstream << ", " << OutputProperties[i]->GetName();
+        outstream << delimeter << OutputProperties[i]->GetName();
       }
     }
 
@@ -241,81 +244,81 @@ void FGOutput::DelimitedOutput(string fname)
   if (SubSystems & ssSimulation) {
   }
   if (SubSystems & ssAerosurfaces) {
-    outstream << ", ";
-    outstream << FCS->GetDaCmd() << ", ";
-    outstream << FCS->GetDeCmd() << ", ";
-    outstream << FCS->GetDrCmd() << ", ";
-    outstream << FCS->GetDfCmd() << ", ";
-    outstream << FCS->GetDaLPos() << ", ";
-    outstream << FCS->GetDaRPos() << ", ";
-    outstream << FCS->GetDePos() << ", ";
-    outstream << FCS->GetDrPos() << ", ";
+    outstream << delimeter;
+    outstream << FCS->GetDaCmd() << delimeter;
+    outstream << FCS->GetDeCmd() << delimeter;
+    outstream << FCS->GetDrCmd() << delimeter;
+    outstream << FCS->GetDfCmd() << delimeter;
+    outstream << FCS->GetDaLPos() << delimeter;
+    outstream << FCS->GetDaRPos() << delimeter;
+    outstream << FCS->GetDePos() << delimeter;
+    outstream << FCS->GetDrPos() << delimeter;
     outstream << FCS->GetDfPos();
   }
   if (SubSystems & ssRates) {
-    outstream << ", ";
-    outstream << Propagate->GetPQR() << ", ";
-    outstream << Propagate->GetPQRdot();
+    outstream << delimeter;
+    outstream << Propagate->GetPQR().Dump(delimeter) << delimeter;
+    outstream << Propagate->GetPQRdot().Dump(delimeter);
   }
   if (SubSystems & ssVelocities) {
-    outstream << ", ";
-    outstream << Auxiliary->Getqbar() << ", ";
-    outstream << setprecision(12) << Auxiliary->GetVt() << ", ";
-    outstream << setprecision(12) << Propagate->GetUVW() << ", ";
-    outstream << Auxiliary->GetAeroUVW() << ", ";
-    outstream << Propagate->GetVel();
+    outstream << delimeter;
+    outstream << Auxiliary->Getqbar() << delimeter;
+    outstream << setprecision(12) << Auxiliary->GetVt() << delimeter;
+    outstream << setprecision(12) << Propagate->GetUVW().Dump(delimeter) << delimeter;
+    outstream << Auxiliary->GetAeroUVW().Dump(delimeter) << delimeter;
+    outstream << Propagate->GetVel().Dump(delimeter);
   }
   if (SubSystems & ssForces) {
-    outstream << ", ";
-    outstream << Aerodynamics->GetvFs() << ", ";
-    outstream << Aerodynamics->GetLoD() << ", ";
-    outstream << Aircraft->GetForces();
+    outstream << delimeter;
+    outstream << Aerodynamics->GetvFs() << delimeter;
+    outstream << Aerodynamics->GetLoD() << delimeter;
+    outstream << Aircraft->GetForces().Dump(delimeter);
   }
   if (SubSystems & ssMoments) {
-    outstream << ", ";
-    outstream << Aircraft->GetMoments();
+    outstream << delimeter;
+    outstream << Aircraft->GetMoments().Dump(delimeter);
   }
   if (SubSystems & ssAtmosphere) {
-    outstream << ", ";
-    outstream << Atmosphere->GetDensity() << ", ";
-    outstream << Atmosphere->GetWindNED();
+    outstream << delimeter;
+    outstream << Atmosphere->GetDensity() << delimeter;
+    outstream << Atmosphere->GetWindNED().Dump(delimeter);
   }
   if (SubSystems & ssMassProps) {
-    outstream << ", ";
-    outstream << MassBalance->GetJ() << ", ";
-    outstream << MassBalance->GetMass() << ", ";
+    outstream << delimeter;
+    outstream << MassBalance->GetJ() << delimeter;
+    outstream << MassBalance->GetMass() << delimeter;
     outstream << MassBalance->GetXYZcg();
   }
   if (SubSystems & ssPropagate) {
-    outstream << ", ";
-    outstream << Propagate->Geth() << ", ";
-    outstream << Propagate->GetEuler() << ", ";
-    outstream << Auxiliary->Getalpha(inDegrees) << ", ";
-    outstream << Auxiliary->Getbeta(inDegrees) << ", ";
-    outstream << Propagate->GetLocation().GetLatitudeDeg() << ", ";
-    outstream << Propagate->GetLocation().GetLongitudeDeg() << ", ";
-    outstream << Propagate->GetDistanceAGL() << ", ";
+    outstream << delimeter;
+    outstream << Propagate->Geth() << delimeter;
+    outstream << Propagate->GetEuler().Dump(delimeter) << delimeter;
+    outstream << Auxiliary->Getalpha(inDegrees) << delimeter;
+    outstream << Auxiliary->Getbeta(inDegrees) << delimeter;
+    outstream << Propagate->GetLocation().GetLatitudeDeg() << delimeter;
+    outstream << Propagate->GetLocation().GetLongitudeDeg() << delimeter;
+    outstream << Propagate->GetDistanceAGL() << delimeter;
     outstream << Propagate->GetRunwayRadius();
   }
   if (SubSystems & ssCoefficients) {
-    scratch = Aerodynamics->GetCoefficientValues();
-    if (scratch.length() != 0) outstream << ", " << scratch;
+    scratch = Aerodynamics->GetCoefficientValues(delimeter);
+    if (scratch.length() != 0) outstream << delimeter << scratch;
   }
   if (SubSystems & ssFCS) {
-    scratch = FCS->GetComponentValues();
-    if (scratch.length() != 0) outstream << ", " << scratch;
+    scratch = FCS->GetComponentValues(delimeter);
+    if (scratch.length() != 0) outstream << delimeter << scratch;
   }
   if (SubSystems & ssGroundReactions) {
-    outstream << ", ";
-    outstream << GroundReactions->GetGroundReactionValues();
+    outstream << delimeter;
+    outstream << GroundReactions->GetGroundReactionValues(delimeter);
   }
   if (SubSystems & ssPropulsion && Propulsion->GetNumEngines() > 0) {
-    outstream << ", ";
-    outstream << Propulsion->GetPropulsionValues();
+    outstream << delimeter;
+    outstream << Propulsion->GetPropulsionValues(delimeter);
   }
 
   for (unsigned int i=0;i<OutputProperties.size();i++) {
-    outstream << ", " << OutputProperties[i]->getDoubleValue();
+    outstream << delimeter << OutputProperties[i]->getDoubleValue();
   }
 
   outstream << endl;
index 40064d036865252d55ec7e0a208185078e090fca..410e62fcb3b6929133952290044157d7e76f143b 100644 (file)
@@ -161,7 +161,7 @@ public:
 private:
   bool sFirstPass, dFirstPass, enabled;
   int SubSystems;
-  string Filename, outputInFileName;
+  string Filename, outputInFileName, delimeter;
   enum {otNone, otCSV, otTab, otSocket, otTerminal, otUnknown} Type;
   ofstream datafile;
   FGfdmSocket* socket;
index dde46eea41ac7981339d5174103707fb38575362..0981f2e70928d18a69cd079f79597ac6b8aab333 100644 (file)
@@ -93,7 +93,7 @@ FGPiston::FGPiston(FGFDMExec* exec, FGConfigFile* Eng_cfg, int engine_number)
   bTakeoffBoost = false;
   TakeoffBoost = 0.0;   // Default to no extra takeoff-boost
   int i;
-  for(i=0; i<FG_MAX_BOOST_SPEEDS; ++i) {
+  for (i=0; i<FG_MAX_BOOST_SPEEDS; i++) {
     RatedBoost[i] = 0.0;
     RatedPower[i] = 0.0;
     RatedAltitude[i] = 0.0;
@@ -102,6 +102,10 @@ FGPiston::FGPiston(FGFDMExec* exec, FGConfigFile* Eng_cfg, int engine_number)
     RatedRPM[i] = 2500;
     TakeoffMAP[i] = 100000;
   }
+  for (i=0; i<FG_MAX_BOOST_SPEEDS-1; i++) {
+    BoostSwitchAltitude[i] = 0.0;
+    BoostSwitchPressure[i] = 0.0;
+  }
 
   // Initialisation
   volumetric_efficiency = 0.8;  // Actually f(speed, load) but this will get us running
@@ -277,7 +281,7 @@ double FGPiston::Calculate(void)
 
   PowerAvailable = (HP * hptoftlbssec) - Thruster->GetPowerRequired();
 
-  return Thruster->Calculate(PowerAvailable);
+  return Thrust = Thruster->Calculate(PowerAvailable);
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -698,23 +702,25 @@ void FGPiston::doOilPressure(void)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGPiston::GetEngineLabels(void)
+string FGPiston::GetEngineLabels(string delimeter)
 {
   std::ostringstream buf;
 
-  buf << Name << "_PwrAvail[" << EngineNumber << "], "
-      << Thruster->GetThrusterLabels(EngineNumber);
+  buf << Name << "_PwrAvail[" << EngineNumber << "]" << delimeter
+      << Name << "_HP[" << EngineNumber << "]" << delimeter
+      << Thruster->GetThrusterLabels(EngineNumber, delimeter);
 
   return buf.str();
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGPiston::GetEngineValues(void)
+string FGPiston::GetEngineValues(string delimeter)
 {
   std::ostringstream buf;
 
-  buf << PowerAvailable << ", " << Thruster->GetThrusterValues(EngineNumber);
+  buf << PowerAvailable << delimeter << HP << delimeter
+      << Thruster->GetThrusterValues(EngineNumber, delimeter);
 
   return buf.str();
 }
index 197f36cc42fb8c16c9f5f385e3174321df476849..7039aa4d75f47a1a41d06a13bc4654162ee0ae42 100644 (file)
@@ -146,8 +146,8 @@ public:
   /// Destructor
   ~FGPiston();
 
-  string GetEngineLabels(void);
-  string GetEngineValues(void);
+  string GetEngineLabels(string delimeter);
+  string GetEngineValues(string delimeter);
 
   double Calculate(void);
   double GetPowerAvailable(void) {return PowerAvailable;}
index 57f489b5b99820b77f4745d7031ce94e26276ac8..3890d6e64384bbb2330dcc338cf8c965ab8439ed 100644 (file)
@@ -210,12 +210,12 @@ bool FGPropagate::Run(void)
   // Compute body frame accelerations based on the current body forces
   vUVWdot = VState.vUVW*VState.vPQR + vForces/mass;
 
-  // Centrifugal acceleration.
+  // Coriolis acceleration.
   FGColumnVector3 ecVel = Tl2ec*vVel;
   FGColumnVector3 ace = 2.0*omega*ecVel;
   vUVWdot -= Tl2b*(Tec2l*ace);
 
-  // Coriolis acceleration.
+  // Centrifugal acceleration.
   FGColumnVector3 aeec = omega*(omega*VState.vLocation);
   vUVWdot -= Tl2b*(Tec2l*aeec);
 
index 2832498ca62bbb6c94401f1143b3a9be86f233ea..d205a3a621900d3f561de6c76624cf7c1bb6c813 100644 (file)
@@ -124,7 +124,7 @@ FGPropeller::~FGPropeller()
   char property_name[80];
   snprintf(property_name, 80, "propulsion/c-thrust[%u]", EngineNum);
   PropertyManager->Untie( property_name );
-  
+
   Debug(1);
 }
 
@@ -252,16 +252,16 @@ FGColumnVector3 FGPropeller::GetPFactor()
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGPropeller::GetThrusterLabels(int id)
+string FGPropeller::GetThrusterLabels(int id, string delimeter)
 {
   std::ostringstream buf;
 
-  buf << Name << "_Torque[" << id << "], "
-      << Name << "_PFactor_Pitch[" << id << "], "
-      << Name << "_PFactor_Yaw[" << id << "], "
-      << Name << "_Thrust[" << id << "], ";
+  buf << Name << "_Torque[" << id << "]" << delimeter
+      << Name << "_PFactor_Pitch[" << id << "]" << delimeter
+      << Name << "_PFactor_Yaw[" << id << "]" << delimeter
+      << Name << "_Thrust[" << id << "]" << delimeter;
   if (IsVPitch())
-    buf << Name << "_Pitch[" << id << "], ";
+    buf << Name << "_Pitch[" << id << "]" << delimeter;
   buf << Name << "_RPM[" << id << "]";
 
   return buf.str();
@@ -269,17 +269,17 @@ string FGPropeller::GetThrusterLabels(int id)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGPropeller::GetThrusterValues(int id)
+string FGPropeller::GetThrusterValues(int id, string delimeter)
 {
   std::ostringstream buf;
 
   FGColumnVector3 vPFactor = GetPFactor();
-  buf << vTorque(eX) << ", "
-      << vPFactor(ePitch) << ", "
-      << vPFactor(eYaw) << ", "
-      << Thrust << ", ";
+  buf << vTorque(eX) << delimeter
+      << vPFactor(ePitch) << delimeter
+      << vPFactor(eYaw) << delimeter
+      << Thrust << delimeter;
   if (IsVPitch())
-    buf << Pitch << ", ";
+    buf << Pitch << delimeter;
   buf << RPM;
 
   return buf.str();
index 0c8ba9f17a6b70c75ec3e6b50f7b86621e40b594..2d5037a97ed8eff910a94c6f8788d9a2b706cd9f 100644 (file)
@@ -153,8 +153,8 @@ public:
       @return the thrust in pounds */
   double Calculate(double PowerAvailable);
   FGColumnVector3 GetPFactor(void);
-  string GetThrusterLabels(int id);
-  string GetThrusterValues(int id);
+  string GetThrusterLabels(int id, string delimeter);
+  string GetThrusterValues(int id, string delimeter);
 
 private:
   int   numBlades;
index 2b3843b89956fd8a0f4db8c0896873d9eef25cd4..42d632d4b5927ccaa442bbe992e52e32eb236055 100644 (file)
@@ -75,9 +75,9 @@ FGPropertyManager*
 FGPropertyManager::GetNode (const string &path, bool create)
 {
   SGPropertyNode* node=this->getNode(path.c_str(), create);
-  if(node == 0)
-    cout << "FGPropertyManager::GetNode() No node found for "
-         << path << endl;
+  //if(node == 0)
+  //  cout << "FGPropertyManager::GetNode() No node found for "
+  //       << path << endl;
   return (FGPropertyManager*)node;
 }
 
index 09cf080c8b3f799266ca4d827ca34707a1420a12..bdb0a211bf3af0d128488b844449d192121d3f93 100644 (file)
@@ -50,6 +50,7 @@ INCLUDES
 #include "FGPiston.h"
 #include "FGElectric.h"
 #include "FGPropertyManager.h"
+#include <sstream>
 
 namespace JSBSim {
 
@@ -73,6 +74,7 @@ FGPropulsion::FGPropulsion(FGFDMExec* exec) : FGModel(exec)
   ActiveEngine = -1; // -1: ALL, 0: Engine 1, 1: Engine 2 ...
   tankJ.InitMatrix();
   refuel = false;
+  fuel_freeze = false;
 
   bind();
 
@@ -93,6 +95,8 @@ FGPropulsion::~FGPropulsion()
 
 bool FGPropulsion::Run(void)
 {
+  unsigned int i;
+
   if (FGModel::Run()) return true;
 
   double dt = State->Getdt();
@@ -100,18 +104,18 @@ bool FGPropulsion::Run(void)
   vForces.InitMatrix();
   vMoments.InitMatrix();
 
-  for (unsigned int i=0; i<numEngines; i++) {
+  for (i=0; i<numEngines; i++) {
     Engines[i]->Calculate();
     vForces  += Engines[i]->GetBodyForces();  // sum body frame forces
     vMoments += Engines[i]->GetMoments();     // sum body frame moments
   }
 
-  for (unsigned int i=0; i<numTanks; i++) {
+  for (i=0; i<numTanks; i++) {
     Tanks[i]->Calculate( dt * rate );
   }
 
   if (refuel) DoRefuel( dt * rate );
-
+  
   return false;
 }
 
@@ -318,16 +322,23 @@ bool FGPropulsion::Load(FGConfigFile* AC_cfg)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGPropulsion::GetPropulsionStrings(void)
+string FGPropulsion::GetPropulsionStrings(string delimeter)
 {
+  unsigned int i;
+
   string PropulsionStrings = "";
   bool firstime = true;
+  stringstream buf;
 
-  for (unsigned int i=0;i<Engines.size();i++) {
+  for (i=0; i<Engines.size(); i++) {
     if (firstime)  firstime = false;
-    else           PropulsionStrings += ", ";
+    else           PropulsionStrings += delimeter;
 
-    PropulsionStrings += Engines[i]->GetEngineLabels();
+    PropulsionStrings += Engines[i]->GetEngineLabels(delimeter);
+  }
+  for (i=0; i<Tanks.size(); i++) {
+    if (Tanks[i]->GetType() == FGTank::ttFUEL) buf << delimeter << "Fuel Tank " << i;
+    else if (Tanks[i]->GetType() == FGTank::ttOXIDIZER) buf << delimeter << "Oxidizer Tank " << i;
   }
 
   return PropulsionStrings;
@@ -335,16 +346,23 @@ string FGPropulsion::GetPropulsionStrings(void)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGPropulsion::GetPropulsionValues(void)
+string FGPropulsion::GetPropulsionValues(string delimeter)
 {
+  unsigned int i;
+
   string PropulsionValues = "";
   bool firstime = true;
+  stringstream buf;
 
-  for (unsigned int i=0;i<Engines.size();i++) {
+  for (i=0; i<Engines.size(); i++) {
     if (firstime)  firstime = false;
-    else           PropulsionValues += ", ";
+    else           PropulsionValues += delimeter;
 
-    PropulsionValues += Engines[i]->GetEngineValues();
+    PropulsionValues += Engines[i]->GetEngineValues(delimeter);
+  }
+  for (i=0; i<Tanks.size(); i++) {
+    buf << delimeter;
+    buf << Tanks[i]->GetContents();
   }
 
   return PropulsionValues;
@@ -498,6 +516,16 @@ void FGPropulsion::DoRefuel(double time_slice)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
+void FGPropulsion::SetFuelFreeze(bool f) 
+{
+  fuel_freeze = f;
+  for (unsigned int i=0; i<numEngines; i++) {
+    Engines[i]->SetFuelFreeze(f);
+  }
+}  
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
 void FGPropulsion::bind(void)
 {
   typedef double (FGPropulsion::*PMF)(int) const;
index 11a1fbb5169c232a6914e34eec2b950bc3bccbd8..6d143f79b1bd2909fbefd61d9652bd12cca93bd5 100644 (file)
@@ -150,8 +150,8 @@ public:
       be done before calling this (i.e. magnetos, starter engage, etc.) */
   bool ICEngineStart(void);
 
-  string GetPropulsionStrings(void);
-  string GetPropulsionValues(void);
+  string GetPropulsionStrings(string delimeter);
+  string GetPropulsionValues(string delimeter);
 
   inline FGColumnVector3& GetForces(void)  {return vForces; }
   inline double GetForces(int n) const { return vForces(n);}
@@ -172,11 +172,13 @@ public:
   }
 
   inline int GetActiveEngine(void);
+  inline bool GetFuelFreeze(void) {return fuel_freeze;}
 
   void SetMagnetos(int setting);
   void SetStarter(int setting);
   void SetCutoff(int setting=0);
   void SetActiveEngine(int engine);
+  void SetFuelFreeze(bool f);  
   FGMatrix33& CalculateTankInertias(void);
 
   void bind();
@@ -199,6 +201,7 @@ private:
   FGColumnVector3 vXYZtank_arm;
   FGMatrix33 tankJ;
   bool refuel;
+  bool fuel_freeze;
 
   void Debug(int from);
 };
index 0d0497b99713c98eed0737a113d176c6ff6d6def..c7131f341071861055b51f89ee1623524523e9dc 100644 (file)
@@ -113,28 +113,28 @@ double FGRocket::Calculate(void)
     Flameout = false;
   }
 
-  return Thruster->Calculate(Cf*maxPC*PctPower*propEff);
+  return Thrust = Thruster->Calculate(Cf*maxPC*PctPower*propEff);
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGRocket::GetEngineLabels(void)
+string FGRocket::GetEngineLabels(string delimeter)
 {
   std::ostringstream buf;
 
-  buf << Name << "_ChamberPress[" << EngineNumber << "], "
-      << Thruster->GetThrusterLabels(EngineNumber);
+  buf << Name << "_ChamberPress[" << EngineNumber << "]" << delimeter
+      << Thruster->GetThrusterLabels(EngineNumber, delimeter);
 
   return buf.str();
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGRocket::GetEngineValues(void)
+string FGRocket::GetEngineValues(string delimeter)
 {
   std::ostringstream buf;
 
-  buf << PC << ", " << Thruster->GetThrusterValues(EngineNumber);
+  buf << PC << delimeter << Thruster->GetThrusterValues(EngineNumber, delimeter);
 
   return buf.str();
 }
index a4d237e8b297a198ce309f5fc6cc88e2dda1f3b2..00befb0d415c4f981e658273d8fab86a55170868 100644 (file)
@@ -123,8 +123,8 @@ public:
       sustainable setting.
       @return true if engine has flamed out. */
   bool GetFlameout(void) {return Flameout;}
-  string GetEngineLabels(void);
-  string GetEngineValues(void);
+  string GetEngineLabels(string delimeter);
+  string GetEngineValues(string delimeter);
 
 private:
   double SHR;
index 8332f13a859d0d40478cbdbab308d66d8e7f9df8..b1efdde7653daa78d365c6e7a25747ef0b5e6501 100644 (file)
@@ -68,14 +68,14 @@ double FGRotor::Calculate(double PowerAvailable)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGRotor::GetThrusterLabels(int id)
+string FGRotor::GetThrusterLabels(int id, string delimeter)
 {
   return "";
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGRotor::GetThrusterValues(int id)
+string FGRotor::GetThrusterValues(int id, string delimeter)
 {
   return "";
 }
index 2fddbaf2a79b7d9998cc4fe3f8876d55cd1254b1..2e4b3b34d87119a2922778781e135d26880695f4 100644 (file)
@@ -70,8 +70,8 @@ public:
   ~FGRotor();
 
   double Calculate(double);
-  string GetThrusterLabels(int id);
-  string GetThrusterValues(int id);
+  string GetThrusterLabels(int id, string delimeter);
+  string GetThrusterValues(int id, string delimeter);
 
 private:
   void Debug(int from);
index 7c9ec35ddd6d19507cc26cf6d055852d97bba187..4d77492cb4fbc998efacb454fb9cd49a38056de0 100644 (file)
@@ -56,6 +56,7 @@ INCLUDES
 
 #include "FGScript.h"
 #include "FGConfigFile.h"
+#include "FGTrim.h"
 
 namespace JSBSim {
 
@@ -105,7 +106,7 @@ bool FGScript::LoadScript( string script )
   if (Script.GetValue("runscript").length() <= 0) {
     cerr << "File: " << script << " is not a script file" << endl;
     delete FDMExec;
-    return false; 
+    return false;
   }
   ScriptName = Script.GetValue("name");
   Scripted = true;
@@ -168,14 +169,14 @@ bool FGScript::LoadScript( string script )
               else if (tempCompare == "FG_STEP") newCondition->Action.push_back(FG_STEP);
               else if (tempCompare == "FG_EXP")  newCondition->Action.push_back(FG_EXP);
               else                               newCondition->Action.push_back((eAction)0);
-              
+
               if (Script.GetValue("persistent") == "true")
                 newCondition->Persistent.push_back(true);
               else
                 newCondition->Persistent.push_back(false);
-               
+
               newCondition->TC.push_back(strtod(Script.GetValue("tc").c_str(), NULL));
-             
+
             } else {
               cerr << "Unrecognized keyword in script file: \" [when] " << token << "\"" << endl;
             }
@@ -212,6 +213,12 @@ bool FGScript::LoadScript( string script )
     exit(-1);
   }
 
+  FGTrim fgt(FDMExec, tFull);
+  if ( !fgt.DoTrim() ) {
+    cout << "Trim Failed" << endl;
+  }
+  fgt.Report();
+
   return true;
 }
 
index 2573daa9c206f9cb0064e76053d351c8aec9110c..4d4a4edcb9331a7af68ac51d59ef09a57e5c09a6 100644 (file)
@@ -72,11 +72,15 @@ FGThruster::FGThruster(FGFDMExec *FDMExec,
 
   EngineNum = num;
   ThrustCoeff = 0.0;
+  ReverserAngle = 0.0;
   PropertyManager = FDMExec->GetPropertyManager();
 
   char property_name[80];
   snprintf(property_name, 80, "propulsion/c-thrust[%u]", EngineNum);
   PropertyManager->Tie( property_name, &ThrustCoeff );
+  snprintf(property_name, 80, "propulsion/engine[%u]/reverser-angle", EngineNum);
+  PropertyManager->Tie( property_name, &ReverserAngle );
+
 
   Debug(0);
 }
@@ -88,13 +92,15 @@ FGThruster::~FGThruster()
   char property_name[80];
   snprintf(property_name, 80, "propulsion/c-thrust[%u]", EngineNum);
   PropertyManager->Untie( property_name );
+  snprintf(property_name, 80, "propulsion/engine[%u]/reverser-angle", EngineNum);
+  PropertyManager->Untie( property_name );
 
   Debug(1);
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGThruster::GetThrusterLabels(int id)
+string FGThruster::GetThrusterLabels(int id, string delimeter)
 {
   std::ostringstream buf;
 
@@ -105,7 +111,7 @@ string FGThruster::GetThrusterLabels(int id)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGThruster::GetThrusterValues(int id)
+string FGThruster::GetThrusterValues(int id, string delimeter)
 {
   std::ostringstream buf;
 
index 35cc9d3f06d339c1cf7c6e78139cf3a4ee9f399e..ff523588df49c244c7f4b4d1f6bca97735cea6b5 100644 (file)
@@ -80,8 +80,9 @@ public:
   enum eType {ttNozzle, ttRotor, ttPropeller, ttDirect};
 
   virtual double Calculate(double tt) {
-       Thrust = tt; vFn(1) = Thrust;
-       return 0.0;
+       Thrust = tt;
+       vFn(1) = Thrust * cos(ReverserAngle);
+       return vFn(1);
   }
   void SetName(string name) {Name = name;}
   virtual void SetRPM(double rpm) {};
@@ -92,8 +93,11 @@ public:
   string GetName(void) {return Name;}
   virtual double GetRPM(void) { return 0.0; };
   double GetGearRatio(void) {return GearRatio; }
-  virtual string GetThrusterLabels(int id);
-  virtual string GetThrusterValues(int id);
+  virtual string GetThrusterLabels(int id, string delimeter);
+  virtual string GetThrusterValues(int id, string delimeter);
+  void SetReverserAngle(double radians) { ReverserAngle = radians; }
+  double GetReverserAngle(void) {return ReverserAngle;}
+
 
   inline void SetThrustCoefficient(double ct) { ThrustCoeff = ct; }
 
@@ -105,6 +109,7 @@ protected:
   double deltaT;
   double GearRatio;
   double ThrustCoeff;
+  double ReverserAngle;
   int EngineNum;
   FGPropertyManager* PropertyManager;
   virtual void Debug(int from);
index 6d8069813705b390642b406414e2d1ab678930a3..401d4d7d302b8631c45270e704a15f76a865430d 100644 (file)
@@ -1,44 +1,44 @@
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
  Header:       FGTrim.h
  Author:       Tony Peden
  Date started: 7/1/99
+
  ------------- Copyright (C) 1999  Anthony K. Peden (apeden@earthlink.net) -------------
+
  This program is free software; you can redistribute it and/or modify it under
  the terms of the GNU General Public License as published by the Free Software
  Foundation; either version 2 of the License, or (at your option) any later
  version.
+
  This program is distributed in the hope that it will be useful, but WITHOUT
  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
  details.
+
  You should have received a copy of the GNU General Public License along with
  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
  Place - Suite 330, Boston, MA  02111-1307, USA.
+
  Further information about the GNU General Public License can also be found on
  the world wide web at http://www.gnu.org.
+
+
  HISTORY
 --------------------------------------------------------------------------------
 9/8/99   TP   Created
+
+
 FUNCTIONAL DESCRIPTION
 --------------------------------------------------------------------------------
+
 This class takes the given set of IC's and finds the aircraft state required to
-maintain a specified flight condition.  This flight condition can be 
+maintain a specified flight condition.  This flight condition can be
 steady-level with non-zero sideslip, a steady turn, a pull-up or pushover.
 On-ground conditions can be trimmed as well, but this is currently limited to
 adjusting altitude and pitch angle only. It is implemented using an iterative,
-one-axis-at-a-time scheme.  
+one-axis-at-a-time scheme.
+
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 SENTRY
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@@ -72,8 +72,8 @@ FORWARD DECLARATIONS
 
 namespace JSBSim {
 
-typedef enum { tLongitudinal, tFull, tGround, tPullup, 
-               tCustom, tNone, tTurn 
+typedef enum { tLongitudinal, tFull, tGround, tPullup,
+               tCustom, tNone, tTurn
              } TrimMode;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -85,10 +85,10 @@ CLASS DOCUMENTATION
     the steady state described by the FGInitialCondition object .  It does this
     iteratively by assigning a control to each state and adjusting that control
     until the state is within a specified tolerance of zero. States include the
-    recti-linear accelerations udot, vdot, and wdot, the angular accelerations 
+    recti-linear accelerations udot, vdot, and wdot, the angular accelerations
     qdot, pdot, and rdot, and the difference between heading and ground track.
     Controls include the usual flight deck controls available to the pilot plus
-    angle of attack (alpha), sideslip angle(beta), flight path angle (gamma), 
+    angle of attack (alpha), sideslip angle(beta), flight path angle (gamma),
     pitch attitude(theta), roll attitude(phi), and altitude above ground.  The
     last three are used for on-ground trimming. The state-control pairs used in
     a given trim are completely user configurable and several pre-defined modes
@@ -99,32 +99,32 @@ CLASS DOCUMENTATION
     - tPullup: tLongitudinal but adjust alpha to achieve load factor input
                with SetTargetNlf()
     - tGround: wdot with altitude, qdot with theta, and pdot with phi
-    
+
     The remaining modes include <b>tCustom</b>, which is completely user defined and
     <b>tNone</b>.
 
     Note that trims can (and do) fail for reasons that are completely outside
-    the control of the trimming routine itself. The most common problem is the 
+    the control of the trimming routine itself. The most common problem is the
     initial conditions: is the model capable of steady state flight
     at those conditions?  Check the speed, altitude, configuration (flaps,
     gear, etc.), weight, cg, and anything else that may be relevant.
-    
+
     Example usage:<pre>
     FGFDMExec* FDMExec = new FGFDMExec();
 
     FGInitialCondition* fgic = new FGInitialCondition(FDMExec);
-    FGTrim *fgt(FDMExec,fgic,tFull);
+    FGTrim fgt(FDMExec, fgic, tFull);
     fgic->SetVcaibratedKtsIC(100);
     fgic->SetAltitudeFtIC(1000);
     fgic->SetClimbRate(500);
-    if( !fgt->DoTrim() ) {
+    if( !fgt.DoTrim() ) {
       cout << "Trim Failed" << endl;
     }
-    fgt->ReportState(); </pre>  
+    fgt.Report(); </pre>
     @author Tony Peden
     @version "$Id$"
-*/       
-  
+*/
+
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DECLARATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@@ -155,14 +155,14 @@ private:
   double xlo,xhi,alo,ahi;
   double targetNlf;
   int debug_axis;
-  
+
   double psidot,thetadot;
 
   FGFDMExec* fdmex;
   FGInitialCondition* fgic;
-   
+
   bool solve(void);
-  
+
   /** @return false if there is no change in the current axis accel
       between accel(control_min) and accel(control_max). If there is a
       change, sets solutionDomain to:
@@ -173,10 +173,10 @@ private:
   bool findInterval(void);
 
   bool checkLimits(void);
-  
+
   void setupPullup(void);
   void setupTurn(void);
-  
+
   void updateRates(void);
 
   void setDebug(void);
@@ -194,17 +194,17 @@ public:
   */
   bool DoTrim(void);
 
-  /** Print the results of the trim. For each axis trimmed, this 
+  /** Print the results of the trim. For each axis trimmed, this
       includes the final state value, control value, and tolerance
       used.
       @return true if trim succeeds
-  */     
+  */
   void Report(void);
-  
+
   /** Iteration statistics
   */
   void TrimStats();
-  
+
   /** Clear all state-control pairs and set a predefined trim mode
       @param tm the set of axes to trim. Can be:
              tLongitudinal, tFull, tGround, tCustom, or tNone
@@ -214,26 +214,26 @@ public:
   /** Clear all state-control pairs from the current configuration.
       The trimming routine must have at least one state-control pair
       configured to be useful
-  */    
+  */
   void ClearStates(void);
 
   /** Add a state-control pair to the current configuration. See the enums
       State and Control in FGTrimAxis.h for the available options.
       Will fail if the given state is already configured.
-      @param state the accel or other condition to zero 
+      @param state the accel or other condition to zero
       @param control the control used to zero the state
       @return true if add is successful
-  */    
+  */
   bool AddState( State state, Control control );
-  
+
   /** Remove a specific state-control pair from the current configuration
       @param state the state to remove
       @return true if removal is successful
-  */    
+  */
   bool RemoveState( State state );
-  
+
   /** Change the control used to zero a state previously configured
-      @param state the accel or other condition to zero 
+      @param state the accel or other condition to zero
       @param new_control the control used to zero the state
   */
   bool EditState( State state, Control new_control );
@@ -242,9 +242,9 @@ public:
       flight path angle (gamma) once it becomes apparent that there
       is not enough/too much thrust.
       @param bb true to enable fallback
-  */     
+  */
   inline void SetGammaFallback(bool bb) { gamma_fallback=bb; }
-  
+
   /** query the fallback state
       @return true if fallback is enabled.
   */
@@ -253,40 +253,40 @@ public:
   /** Set the iteration limit. DoTrim() will return false if limit
       iterations are reached before trim is achieved.  The default
       is 60.  This does not ordinarily need to be changed.
-      @param ii integer iteration limit 
+      @param ii integer iteration limit
   */
   inline void SetMaxCycles(int ii) { max_iterations = ii; }
-  
+
   /** Set the per-axis iteration limit.  Attempt to zero each state
       by iterating limit times before moving on to the next. The
       default limit is 100 and also does not ordinarily need to
       be changed.
-      @param ii integer iteration limit 
-  */    
+      @param ii integer iteration limit
+  */
   inline void SetMaxCyclesPerAxis(int ii) { max_sub_iterations = ii; }
-  
+
   /** Set the tolerance for declaring a state trimmed. Angular accels are
-      held to a tolerance of 1/10th of the given.  The default is 
+      held to a tolerance of 1/10th of the given.  The default is
       0.001 for the recti-linear accelerations and 0.0001 for the angular.
-  */         
+  */
   inline void SetTolerance(double tt) {
     Tolerance = tt;
     A_Tolerance = tt / 10;
   }
-  
-  /** 
+
+  /**
     Debug level 1 shows results of each top-level iteration
     Debug level 2 shows level 1 & results of each per-axis iteration
-  */  
+  */
   inline void SetDebug(int level) { DebugLevel = level; }
   inline void ClearDebug(void) { DebugLevel = 0; }
-  
+
   /**
     Output debug data for one of the axes
     The State enum is defined in FGTrimAxis.h
-  */  
+  */
   inline void DebugState(State state) { debug_axis=state; }
-  
+
   inline void SetTargetNlf(float nlf) { targetNlf=nlf; }
   inline double GetTargetNlf(void) { return targetNlf; }
 
index 909413f8b3afe6f34c194d61fc4dcbdf74824525..d43031b38252f26c9e64c9b2d07439f10f57273a 100644 (file)
@@ -113,21 +113,19 @@ double FGTurbine::Calculate(void)
   if (Stalled) phase = tpStall;
   if (Seized) phase = tpSeize;
 
-  double CT = 0.0;
   switch (phase) {
     case tpOff:    Thrust = Off(); break;
-    case tpRun:    Thrust = Run(CT); break;
+    case tpRun:    Thrust = Run(); break;
     case tpSpinUp: Thrust = SpinUp(); break;
     case tpStart:  Thrust = Start(); break;
     case tpStall:  Thrust = Stall(); break;
     case tpSeize:  Thrust = Seize(); break;
-    case tpTrim:   Thrust = Trim(CT); break;
+    case tpTrim:   Thrust = Trim(); break;
     default: Thrust = Off();
   }
 
-  Thruster->SetThrustCoefficient(CT);
-
-  return Thruster->Calculate(Thrust);
+  // The thruster can modify the thrust, eg. thrust reverser
+  return Thrust = Thruster->Calculate(Thrust);
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -150,13 +148,12 @@ double FGTurbine::Off(void)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-double FGTurbine::Run(double &TC)
+double FGTurbine::Run(void)
 {
   double idlethrust, milthrust, thrust;
   double N2norm;   // 0.0 = idle N2, 1.0 = maximum N2
-
-  idlethrust = ThrustTables[0]->TotalValue();
-  milthrust = (1.0 - idlethrust) * ThrustTables[1]->TotalValue();
+  idlethrust = MilThrust * ThrustTables[0]->TotalValue();
+  milthrust = (MilThrust - idlethrust) * ThrustTables[1]->TotalValue();
 
   Running = true;
   Starter = false;
@@ -164,19 +161,18 @@ double FGTurbine::Run(double &TC)
   N2 = Seek(&N2, IdleN2 + ThrottlePos * N2_factor, delay, delay * 3.0);
   N1 = Seek(&N1, IdleN1 + ThrottlePos * N1_factor, delay, delay * 2.4);
   N2norm = (N2 - IdleN2) / N2_factor;
-  TC = idlethrust + (milthrust * N2norm * N2norm);
-  thrust = TC * MilThrust;
+  thrust = idlethrust + (milthrust * N2norm * N2norm);
   EGT_degC = TAT + 363.1 + ThrottlePos * 357.1;
   OilPressure_psi = N2 * 0.62;
   OilTemp_degK = Seek(&OilTemp_degK, 366.0, 1.2, 0.1);
 
   if (!Augmentation) {
-    double correctedTSFC = TSFC + TSFC - (N2norm * TSFC);
+    double correctedTSFC = TSFC * (0.84 + (1-N2norm)*(1-N2norm));
     FuelFlow_pph = Seek(&FuelFlow_pph, thrust * correctedTSFC, 1000.0, 100000);
     if (FuelFlow_pph < IdleFF) FuelFlow_pph = IdleFF;
     NozzlePosition = Seek(&NozzlePosition, 1.0 - N2norm, 0.8, 0.8);
-    TC = TC * (1.0 - BleedDemand);
-    EPR = 1.0 + TC;
+    thrust = thrust * (1.0 - BleedDemand);
+    EPR = 1.0 + thrust/MilThrust;
   }
 
   if (AugMethod == 1) {
@@ -185,8 +181,7 @@ double FGTurbine::Run(double &TC)
   }
 
   if ((Augmented == 1) && Augmentation && (AugMethod < 2)) {
-    TC = ThrustTables[2]->TotalValue();
-    thrust = TC * MaxThrust;
+    thrust = MaxThrust * ThrustTables[2]->TotalValue();
     FuelFlow_pph = Seek(&FuelFlow_pph, thrust * ATSFC, 5000.0, 10000.0);
     NozzlePosition = Seek(&NozzlePosition, 1.0, 0.8, 0.8);
   }
@@ -194,9 +189,8 @@ double FGTurbine::Run(double &TC)
   if (AugMethod == 2) {
     if (AugmentCmd > 0.0) {
       Augmentation = true;
-      double tdiff = ThrustTables[2]->TotalValue() - TC;
-      TC += (tdiff * AugmentCmd);
-      thrust = TC * MaxThrust;
+      double tdiff = (MaxThrust * ThrustTables[2]->TotalValue()) - thrust;
+      thrust += (tdiff * AugmentCmd);
       FuelFlow_pph = Seek(&FuelFlow_pph, thrust * ATSFC, 5000.0, 10000.0);
       NozzlePosition = Seek(&NozzlePosition, 1.0, 0.8, 0.8);
     } else {
@@ -205,8 +199,7 @@ double FGTurbine::Run(double &TC)
   }
 
   if ((Injected == 1) && Injection) {
-    TC = TC * ThrustTables[3]->TotalValue();
-    thrust = thrust * ThrustTables[3]->TotalValue();
+     thrust = thrust * ThrustTables[3]->TotalValue();
   }
 
   ConsumeFuel();
@@ -244,6 +237,7 @@ double FGTurbine::Start(void)
       EGT_degC = Seek(&EGT_degC, TAT + 363.1, 21.3, 7.3);
       FuelFlow_pph = Seek(&FuelFlow_pph, IdleFF, 103.7, 103.7);
       OilPressure_psi = N2 * 0.62;
+      ConsumeFuel();
       }
     else {
       phase = tpRun;
@@ -269,6 +263,7 @@ double FGTurbine::Stall(void)
   FuelFlow_pph = IdleFF;
   N1 = Seek(&N1, qbar/10.0, 0, N1/10.0);
   N2 = Seek(&N2, qbar/15.0, 0, N2/10.0);
+  ConsumeFuel();
   if (ThrottlePos < 0.01) phase = tpRun;        // clear the stall with throttle
 
   return 0.0;
@@ -282,6 +277,7 @@ double FGTurbine::Seize(void)
     N2 = 0.0;
     N1 = Seek(&N1, qbar/20.0, 0, N1/15.0);
     FuelFlow_pph = IdleFF;
+    ConsumeFuel();
     OilPressure_psi = 0.0;
     OilTemp_degK = Seek(&OilTemp_degK, TAT + 273.0, 0, 0.2);
     Running = false;
@@ -290,20 +286,17 @@ double FGTurbine::Seize(void)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-double FGTurbine::Trim(double &TC)
+double FGTurbine::Trim(void)
 {
     double idlethrust, milthrust, thrust, tdiff;
-    idlethrust = ThrustTables[0]->TotalValue();;
-    milthrust = (1.0 - TC) * ThrustTables[1]->TotalValue();
-    TC = (idlethrust + (milthrust * ThrottlePos * ThrottlePos))
+    idlethrust = MilThrust * ThrustTables[0]->TotalValue();;
+    milthrust = (MilThrust - idlethrust) * ThrustTables[1]->TotalValue();
+    thrust = (idlethrust + (milthrust * ThrottlePos * ThrottlePos))
           * (1.0 - BleedDemand);
     if (AugmentCmd > 0.0) {
-      tdiff = ThrustTables[2]->TotalValue() - TC;
-      TC += (tdiff * AugmentCmd);
-      thrust = TC * MaxThrust;
-
-     } else
-      thrust = TC * MilThrust;
+      tdiff = (MaxThrust * ThrustTables[2]->TotalValue()) - thrust;
+      thrust += (tdiff * AugmentCmd);
+    } 
 
     return thrust;
 }
@@ -427,26 +420,26 @@ bool FGTurbine::Load(FGConfigFile *Eng_cfg)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGTurbine::GetEngineLabels(void)
+string FGTurbine::GetEngineLabels(string delimeter)
 {
   std::ostringstream buf;
 
-  buf << Name << "_N1[" << EngineNumber << "], "
-      << Name << "_N2[" << EngineNumber << "], "
-      << Thruster->GetThrusterLabels(EngineNumber);
+  buf << Name << "_N1[" << EngineNumber << "]" << delimeter
+      << Name << "_N2[" << EngineNumber << "]" << delimeter
+      << Thruster->GetThrusterLabels(EngineNumber, delimeter);
 
   return buf.str();
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGTurbine::GetEngineValues(void)
+string FGTurbine::GetEngineValues(string delimeter)
 {
   std::ostringstream buf;
 
-  buf << N1 << ", "
-      << N2 << ", "
-      << Thruster->GetThrusterValues(EngineNumber);
+  buf << N1 << delimeter
+      << N2 << delimeter
+      << Thruster->GetThrusterValues(EngineNumber, delimeter);
 
   return buf.str();
 }
@@ -457,10 +450,12 @@ void FGTurbine::bindmodel()
 {
   char property_name[80];
 
-  snprintf(property_name, 80, "propulsion/n1[%u]", EngineNumber);
+  snprintf(property_name, 80, "propulsion/engine[%u]/n1", EngineNumber);
   PropertyManager->Tie( property_name, &N1);
-  snprintf(property_name, 80, "propulsion/n2[%u]", EngineNumber);
+  snprintf(property_name, 80, "propulsion/engine[%u]/n2", EngineNumber);
   PropertyManager->Tie( property_name, &N2);
+  snprintf(property_name, 80, "propulsion/engine[%u]/fuel-flow", EngineNumber);
+  PropertyManager->Tie( property_name, &FuelFlow_pph);
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -469,10 +464,12 @@ void FGTurbine::unbind()
 {
   char property_name[80];
 
-  snprintf(property_name, 80, "propulsion/n1[%u]", EngineNumber);
+  snprintf(property_name, 80, "propulsion/engine[%u]/n1", EngineNumber);
   PropertyManager->Untie(property_name);
-  snprintf(property_name, 80, "propulsion/n2[%u]", EngineNumber);
+  snprintf(property_name, 80, "propulsion/engine[%u]/n2", EngineNumber);
   PropertyManager->Untie(property_name);
+  snprintf(property_name, 80, "propulsion/engine[%u]/fuel-flow", EngineNumber);
+  PropertyManager->Untie( property_name);
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index 547d5da75fd743b4d4652582964ff789d0612dbd..5f685e61107985f7a3ccb9fc87b420da59fab372 100644 (file)
@@ -182,8 +182,8 @@ public:
   void SetReverse(bool reversed) { Reversed = reversed; }
   void SetCutoff(bool cutoff) { Cutoff = cutoff; }
 
-  string GetEngineLabels(void);
-  string GetEngineValues(void);
+  string GetEngineLabels(string delimeter);
+  string GetEngineValues(string delimeter);
 
 private:
 
@@ -233,12 +233,12 @@ private:
   double NozzlePosition;
 
   double Off(void);
-  double Run(double &CT);
+  double Run();
   double SpinUp(void);
   double Start(void);
   double Stall(void);
   double Seize(void);
-  double Trim(double &CT);
+  double Trim();
 
   void SetDefaults(void);
   bool Load(FGConfigFile *ENG_cfg);
index 6a69fef387881fa86062b18244104f617b8eef7a..3129a961ec7c12c9a1649143f2fa23785c418650 100644 (file)
@@ -2,7 +2,7 @@
 //
 // Written by Curtis Olson, started February 1999.
 //
-// Copyright (C) 1999  Curtis L. Olson  - http://www.flightgear.org/~curt
+// Copyright (C) 1999  Curtis L. Olson  - curt@flightgear.org
 //
 // This program is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License as
@@ -171,7 +171,8 @@ FGJSBsim::FGJSBsim( double dt )
         node->setDoubleValue("level-gal_us", Propulsion->GetTank(i)->GetContents() / 6.6);
       }
     }
-
+    Propulsion->SetFuelFreeze((fgGetNode("/sim/freeze/fuel",true))->getBoolValue());
+    
     fgSetDouble("/fdm/trim/pitch-trim", FCS->GetPitchTrimCmd());
     fgSetDouble("/fdm/trim/throttle",   FCS->GetThrottleCmd(0));
     fgSetDouble("/fdm/trim/aileron",    FCS->GetDaCmd());
@@ -503,7 +504,8 @@ bool FGJSBsim::copy_to_JSBsim()
     }
     SGPropertyNode* node = fgGetNode("/systems/refuel", true);
     Propulsion->SetRefuel(node->getDoubleValue("contact"));
-
+    Propulsion->SetFuelFreeze((fgGetNode("/sim/freeze/fuel",true))->getBoolValue());
+    
     return true;
 }
 
@@ -692,11 +694,9 @@ bool FGJSBsim::copy_from_JSBsim()
 
     }
 
-    static const SGPropertyNode *fuel_freeze = fgGetNode("/sim/freeze/fuel");
-
     // Copy the fuel levels from JSBSim if fuel
     // freeze not enabled.
-    if ( ! fuel_freeze->getBoolValue() ) {
+    if ( ! Propulsion->GetFuelFreeze() ) {
       for (i = 0; i < Propulsion->GetNumTanks(); i++) {
         SGPropertyNode * node = fgGetNode("/consumables/fuel/tank", i, true);
         FGTank* tank = Propulsion->GetTank(i);
index 961f88b1bd3f7c70e7d7abec06b8761a703a4467..d1a54a5a3d66d676293765b5ab97fb70091e4869 100644 (file)
@@ -5,7 +5,7 @@
  Maintained by: Tony Peden, Curt Olson
  Date started:  02/01/1999
 
------- Copyright (C) 1999 - 2000  Curtis L. Olson (http://www.flightgear.org/~curt) ------
+------ Copyright (C) 1999 - 2000  Curtis L. Olson (curt@flightgear.org) ------
 
  This program is free software; you can redistribute it and/or
  modify it under the terms of the GNU General Public License as
index de20fad4e9845b2d2a708140b62c602a73af720f..41bb1ac3918926c787243fc210d46788306c4474 100644 (file)
@@ -89,7 +89,7 @@ FGPropertyManager* FGFCSComponent::resolveSymbol(string token)
   FGPropertyManager* tmp = PropertyManager->GetNode(token,false);
   if (!tmp) {
     if (token.find("/") == token.npos) prop = "model/" + token;
-    cerr << "Creating new property " << prop << endl;
+    //cerr << "Creating new property " << prop << endl;
     tmp = PropertyManager->GetNode(token,true);
   }
   return tmp;