]> git.mxchange.org Git - flightgear.git/commitdiff
JSBSim fixes.
authorErik Hofman <erik@ehofman.com>
Mon, 26 Sep 2011 07:07:59 +0000 (09:07 +0200)
committerErik Hofman <erik@ehofman.com>
Mon, 26 Sep 2011 07:07:59 +0000 (09:07 +0200)
16 files changed:
src/FDM/JSBSim/FGFDMExec.cpp
src/FDM/JSBSim/models/FGFCS.cpp
src/FDM/JSBSim/models/FGOutput.cpp
src/FDM/JSBSim/models/atmosphere/FGStandardAtmosphere.cpp
src/FDM/JSBSim/models/atmosphere/FGStandardAtmosphere.h
src/FDM/JSBSim/models/atmosphere/FGWinds.cpp
src/FDM/JSBSim/models/propulsion/FGPiston.cpp
src/FDM/JSBSim/models/propulsion/FGPropeller.cpp
src/FDM/JSBSim/models/propulsion/FGPropeller.h
src/FDM/JSBSim/models/propulsion/FGRotor.cpp
src/FDM/JSBSim/models/propulsion/FGRotor.h
src/FDM/JSBSim/models/propulsion/FGTank.cpp
src/FDM/JSBSim/models/propulsion/FGTank.h
src/FDM/JSBSim/models/propulsion/FGThruster.h
src/FDM/JSBSim/models/propulsion/FGTurbine.cpp
src/FDM/JSBSim/models/propulsion/FGTurboProp.cpp [changed mode: 0644->0755]

index 8d29a688f2eb487acfbfc241018e7d9fab7aee03..87ee94dad97ea3c948e0ead4c662e2d39e8152bb 100644 (file)
@@ -70,7 +70,7 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGFDMExec.cpp,v 1.114 2011/09/11 11:36:04 bcoconni Exp $";
+static const char *IdSrc = "$Id: FGFDMExec.cpp,v 1.115 2011/09/25 11:56:00 bcoconni Exp $";
 static const char *IdHdr = ID_FDMEXEC;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -564,8 +564,8 @@ void FGFDMExec::Initialize(FGInitialCondition *FGIC)
   LoadInputs(eAtmosphere);
   Atmosphere->Run(false);
   Winds->SetWindNED( FGIC->GetWindNFpsIC(),
-                          FGIC->GetWindEFpsIC(),
-                          FGIC->GetWindDFpsIC() );
+                     FGIC->GetWindEFpsIC(),
+                     FGIC->GetWindDFpsIC() );
   Auxiliary->Run(false);
 }
 
@@ -1152,11 +1152,14 @@ bool FGFDMExec::SetOutputDirectives(const string& fname)
   result = Output->Load(0);
 
   if (result) {
+    Output->Run(holding);
     Outputs.push_back(Output);
     typedef double (FGOutput::*iOPMF)(void) const;
     string outputProp = CreateIndexedPropertyName("simulation/output",Outputs.size()-1);
     instance->Tie(outputProp+"/log_rate_hz", Output, (iOPMF)0, &FGOutput::SetRate, false);
   }
+  else
+    delete Output;
 
   return result;
 }
index d781f54f18aa5b359702307c3eed937f796afac1..3f659831f5c03944085cc9eb75ae589ed4e657db 100644 (file)
@@ -64,7 +64,7 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGFCS.cpp,v 1.76 2011/08/14 20:15:56 jberndt Exp $";
+static const char *IdSrc = "$Id: FGFCS.cpp,v 1.77 2011/09/25 14:05:40 bcoconni Exp $";
 static const char *IdHdr = ID_FCS;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -665,6 +665,8 @@ bool FGFCS::Load(Element* el, SystemType systype)
     channel_element = document->FindNextElement("channel");
   }
 
+  PostLoad(document, PropertyManager);
+
   ResetParser();
 
   return true;
index aa30ad07aa98b3c83132e9e629b66d3fd6b3f076..46c9b15ce70b4a31cfef76579ccdd4283267f25a 100644 (file)
@@ -77,7 +77,7 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGOutput.cpp,v 1.60 2011/09/11 11:36:04 bcoconni Exp $";
+static const char *IdSrc = "$Id: FGOutput.cpp,v 1.62 2011/09/25 15:38:30 bcoconni Exp $";
 static const char *IdHdr = ID_OUTPUT;
 
 // (stolen from FGFS native_fdm.cxx)
@@ -1003,8 +1003,12 @@ bool FGOutput::Load(Element* element)
 
   if (!document) return false;
 
-  name = FDMExec->GetRootDir() + document->GetAttributeValue("name");
   SetType(document->GetAttributeValue("type"));
+
+  name = document->GetAttributeValue("name");
+  if (((Type == otCSV) || (Type == otTab)) && (name != "cout") && (name !="COUT"))
+    name = FDMExec->GetRootDir() + name;
+
   Port = document->GetAttributeValue("port");
   if (!Port.empty() && (Type == otSocket || Type == otFlightGear)) {
     port = atoi(Port.c_str());
index e25a7138b6a1ec10ecd13e83503b2e6dec67e93c..fd40e90046237202c26405e5937aac66494355ab 100644 (file)
@@ -50,7 +50,7 @@ INCLUDES
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGStandardAtmosphere.cpp,v 1.19 2011/09/11 11:36:04 bcoconni Exp $";
+static const char *IdSrc = "$Id: FGStandardAtmosphere.cpp,v 1.20 2011/09/18 12:06:21 bcoconni Exp $";
 static const char *IdHdr = ID_STANDARDATMOSPHERE;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -420,7 +420,7 @@ void FGStandardAtmosphere::bind(void)
                                     (PMF)&FGStandardAtmosphere::SetTemperatureBias);
   PropertyManager->Tie("atmosphere/SL-graded-delta-T", this, eRankine,
                                     (PMFi)&FGStandardAtmosphere::GetTemperatureDeltaGradient,
-                                                                       (PMF)&FGStandardAtmosphere::SetSLTemperatureGradedDelta);
+                                    (PMF)&FGStandardAtmosphere::SetSLTemperatureGradedDelta);
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index 380550adee5515e6f42b1f23050e3d3013203d06..2e5c376768f0daa5f07930948a2525f0c9bfc109 100644 (file)
@@ -46,7 +46,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_STANDARDATMOSPHERE "$Id: FGStandardAtmosphere.h,v 1.15 2011/08/17 23:56:01 jberndt Exp $"
+#define ID_STANDARDATMOSPHERE "$Id: FGStandardAtmosphere.h,v 1.16 2011/09/18 12:06:21 bcoconni Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -93,7 +93,7 @@ consistently and accurately calculated.
 
   @author Jon Berndt
   @see "U.S. Standard Atmosphere, 1976", NASA TM-X-74335
-  @version $Id: FGStandardAtmosphere.h,v 1.15 2011/08/17 23:56:01 jberndt Exp $
+  @version $Id: FGStandardAtmosphere.h,v 1.16 2011/09/18 12:06:21 bcoconni Exp $
 */
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -139,11 +139,13 @@ public:
   virtual double GetStdTemperatureRatio(double h) const { return GetStdTemperature(h)*rSLtemperature; }
 
   /// Returns the temperature bias over the sea level value in degrees Rankine.
-  virtual double GetTemperatureBias(eTemperature to) const {return TemperatureBias;}
+  virtual double GetTemperatureBias(eTemperature to) const
+  { if (to == eCelsius || to == eKelvin) return TemperatureBias/1.80; else return TemperatureBias; }
 
   /// Returns the temperature gradient to be applied on top of the standard
   /// temperature gradient.
-  virtual double GetTemperatureDeltaGradient() { return TemperatureDeltaGradient;}
+  virtual double GetTemperatureDeltaGradient(eTemperature to)
+  { if (to == eCelsius || to == eKelvin) return TemperatureDeltaGradient/1.80; else return TemperatureDeltaGradient; }
 
   /// Sets the Sea Level temperature, if it is to be different than the standard.
   /// This function will calculate a bias - a difference - from the standard
index c24648e3a1a5588a7d626f3250b51135b01a231c..e54c348ec2b3184da9a56984627a72942a41b80a 100644 (file)
@@ -284,8 +284,13 @@ void FGWinds::Turbulence(double h)
     double
       T_V = in.totalDeltaT, // for compatibility of nomenclature
       sig_p = 1.9/sqrt(L_w*b_w)*sig_w, // Yeager1998, eq. (8)
+<<<<<<< FGWinds.cpp
+//    sig_q = sqrt(M_PI/2/L_w/b_w), // eq. (14)
+///   sig_r = sqrt(2*M_PI/3/L_w/b_w), // eq. (17)
+=======
       //sig_q = sqrt(M_PI/2/L_w/b_w), // eq. (14)
       //sig_r = sqrt(2*M_PI/3/L_w/b_w), // eq. (17)
+>>>>>>> 1.5
       L_p = sqrt(L_w*b_w)/2.6, // eq. (10)
       tau_u = L_u/in.V, // eq. (6)
       tau_w = L_w/in.V, // eq. (3)
index c3cb908003e9bce9c347db10acda75f5705bc042..304c00971a06ea7c02f93e8abf565ce1a4f4f1de 100644 (file)
@@ -50,7 +50,7 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGPiston.cpp,v 1.65 2011/09/11 12:06:54 bcoconni Exp $";
+static const char *IdSrc = "$Id: FGPiston.cpp,v 1.67 2011/09/25 23:56:11 jentron Exp $";
 static const char *IdHdr = ID_PISTON;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -336,8 +336,6 @@ FGPiston::FGPiston(FGFDMExec* exec, Element* el, int engine_number, struct Input
   PropertyManager->Tie(property_name, &BoostSpeed);
   property_name = base_property_name + "/cht-degF";
   PropertyManager->Tie(property_name, this, &FGPiston::getCylinderHeadTemp_degF);
-  property_name = base_property_name + "/engine-rpm";
-  PropertyManager->Tie(property_name, this, &FGPiston::getRPM);
   property_name = base_property_name + "/oil-temperature-degF";
   PropertyManager->Tie(property_name, this, &FGPiston::getOilTemp_degF);
   property_name = base_property_name + "/oil-pressure-psi";
@@ -436,7 +434,9 @@ void FGPiston::Calculate(void)
 
   RunPreFunctions();
 
-  RPM = Thruster->GetRPM() * Thruster->GetGearRatio();
+/* The thruster controls the engine RPM because it encapsulates the gear ratio and other transmission variables */
+  RPM = Thruster->GetEngineRPM();
+
   MeanPistonSpeed_fps =  ( RPM * Stroke) / (360); // AKA 2 * (RPM/60) * ( Stroke / 12) or 2NS
 
   IAS = in.Vc;
@@ -479,6 +479,7 @@ void FGPiston::Calculate(void)
 double FGPiston::CalcFuelNeed(void)
 {
   FuelExpended = FuelFlowRate * in.TotalDeltaT;
+  if (!Starved) FuelUsedLbs += FuelExpended; 
   return FuelExpended;
 }
 
index 411f12a6583515dd0a0fb7109004b28949daa6d4..ead7dec9b30ae26e3a88dfe82b718878849af58c 100644 (file)
@@ -45,7 +45,7 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGPropeller.cpp,v 1.37 2011/09/11 12:06:54 bcoconni Exp $";
+static const char *IdSrc = "$Id: FGPropeller.cpp,v 1.38 2011/09/24 14:26:46 jentron Exp $";
 static const char *IdHdr = ID_PROPELLER;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -147,6 +147,8 @@ FGPropeller::FGPropeller(FGFDMExec* exec, Element* prop_element, int num)
 
   string property_name, base_property_name;
   base_property_name = CreateIndexedPropertyName("propulsion/engine", EngineNum);
+  property_name = base_property_name + "/engine-rpm";
+  PropertyManager->Tie( property_name.c_str(), this, &FGPropeller::GetEngineRPM );
   property_name = base_property_name + "/advance-ratio";
   PropertyManager->Tie( property_name.c_str(), &J );
   property_name = base_property_name + "/blade-angle";
index 94fb454ec903ebe3f7e99e0094cd961ba8ee7b47..6e918a4eb22e11a30b000b39cee36fc77894ad0c 100644 (file)
@@ -45,7 +45,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_PROPELLER "$Id: FGPropeller.h,v 1.18 2011/06/06 22:39:52 jentron Exp $"
+#define ID_PROPELLER "$Id: FGPropeller.h,v 1.19 2011/09/24 14:26:46 jentron Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -142,7 +142,7 @@ CLASS DOCUMENTATION
     <li>Various NACA Technical Notes and Reports</li>
     </ul>
     @author Jon S. Berndt
-    @version $Id: FGPropeller.h,v 1.18 2011/06/06 22:39:52 jentron Exp $
+    @version $Id: FGPropeller.h,v 1.19 2011/09/24 14:26:46 jentron Exp $
     @see FGEngine
     @see FGThruster
 */
@@ -171,6 +171,9 @@ public:
       @param rpm the rotational velocity of the propeller */
   void SetRPM(double rpm) {RPM = rpm;}
 
+  /** Sets the Revolutions Per Minute for the propeller using the engine gear ratio **/
+  void SetEngineRPM(double rpm) {RPM = rpm/GearRatio;}
+
   /// Returns true of this propeller is variable pitch
   bool IsVPitch(void) {return MaxPitch != MinPitch;}
 
@@ -209,6 +212,9 @@ public:
   /// Retrieves the RPMs of the propeller
   double GetRPM(void)     const { return RPM;           } 
 
+  /// Calculates the RPMs of the engine based on gear ratio
+  double GetEngineRPM(void)     const { return RPM * GearRatio;  } 
+
   /// Retrieves the propeller moment of inertia
   double GetIxx(void)           { return Ixx;           }
 
index 55a711cee183c01cf2448a8a5392acdf52d39482..0a733fb838b55ee3ed0801ddce826784a6131772 100644 (file)
@@ -55,7 +55,7 @@ using std::cout;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGRotor.cpp,v 1.16 2011/09/17 16:39:19 bcoconni Exp $";
+static const char *IdSrc = "$Id: FGRotor.cpp,v 1.17 2011/09/24 14:26:46 jentron Exp $";
 static const char *IdHdr = ID_ROTOR;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -706,7 +706,7 @@ bool FGRotor::BindModel(void)
   property_name = base_property_name + "/rotor-rpm";
   PropertyManager->Tie( property_name.c_str(), this, &FGRotor::GetRPM );
 
-  property_name = base_property_name + "/x-engine-rpm"; // used for RPM eXchange
+  property_name = base_property_name + "/engine-rpm";
   PropertyManager->Tie( property_name.c_str(), this, &FGRotor::GetEngineRPM );
 
   property_name = base_property_name + "/rotor-thrust-lbs"; // might be redundant - check!
@@ -778,11 +778,11 @@ bool FGRotor::BindModel(void)
       ExtRPMsource = PropertyManager->GetNode(property_name, true);
     } else if (RPMdefinition >= 0 && RPMdefinition != EngineNum) {
       string ipn = CreateIndexedPropertyName("propulsion/engine", RPMdefinition);
-      property_name = ipn + "/x-engine-rpm";
+      property_name = ipn + "/engine-rpm";
       ExtRPMsource = PropertyManager->GetNode(property_name, false);
       if (! ExtRPMsource) {
         cerr << "# Warning: Engine number " << EngineNum << "." << endl;
-        cerr << "# No 'x-engine-rpm' property found for engine " << RPMdefinition << "." << endl;
+        cerr << "# No 'engine-rpm' property found for engine " << RPMdefinition << "." << endl;
         cerr << "# Please check order of engine definitons."  << endl;
       }
     } else {
index 85d1b3e6efe6ae756e974695ccf0ccd0c9e3e592..9e0bb0511fa42da9b9f1253471cddd25d5ff95e9 100644 (file)
@@ -46,7 +46,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_ROTOR "$Id: FGRotor.h,v 1.10 2011/09/17 16:39:19 bcoconni Exp $"
+#define ID_ROTOR "$Id: FGRotor.h,v 1.11 2011/09/24 14:26:46 jentron Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -205,7 +205,7 @@ CLASS DOCUMENTATION
     </dl>
 
     @author Thomas Kreitler
-    @version $Id: FGRotor.h,v 1.10 2011/09/17 16:39:19 bcoconni Exp $
+    @version $Id: FGRotor.h,v 1.11 2011/09/24 14:26:46 jentron Exp $
   */
 
 
@@ -238,11 +238,11 @@ public:
 
   /// Retrieves the RPMs of the rotor.
   double GetRPM(void) const { return RPM; }
-  
-  // void   SetRPM(double rpm) { RPM = rpm; }
+  void   SetRPM(double rpm) { RPM = rpm; }
   
   /// Retrieves the RPMs of the Engine, as seen from this rotor.
   double GetEngineRPM(void) const { return GearRatio*RPM; } // bit of a hack.
+  void SetEngineRPM(double rpm) { RPM = rpm/GearRatio; } // bit of a hack.
   /// Tells the rotor's gear ratio, usually the engine asks for this.
   double GetGearRatio(void) { return GearRatio; }
   /// Retrieves the thrust of the rotor.
index a0417d540b7b8255091f0021c2d41b9468c6bba4..718185a652caf6608dff99da858fc1d7f39d1efe 100644 (file)
@@ -47,7 +47,7 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGTank.cpp,v 1.31 2011/08/03 03:21:06 jberndt Exp $";
+static const char *IdSrc = "$Id: FGTank.cpp,v 1.32 2011/09/18 13:04:34 bcoconni Exp $";
 static const char *IdHdr = ID_TANK;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -204,7 +204,7 @@ const FGColumnVector3 FGTank::GetXYZ(void)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-const double FGTank::GetXYZ(int idx)
+double FGTank::GetXYZ(int idx)
 {
   return vXYZ_drain(idx) + (Contents/Capacity)*(vXYZ(idx)-vXYZ_drain(idx));
 }
index dc929beb5db7d75196ec18e487b80d6277f63ddf..c5c97ce984700704246f90639e891a11c42fcaac 100644 (file)
@@ -52,7 +52,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_TANK "$Id: FGTank.h,v 1.24 2011/08/03 03:21:06 jberndt Exp $"
+#define ID_TANK "$Id: FGTank.h,v 1.25 2011/09/18 13:04:34 bcoconni Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -289,7 +289,7 @@ public:
   void   SetExternalFlow(double f) { ExternalFlow = f; }
 
   const FGColumnVector3 GetXYZ(void);
-  const double GetXYZ(int idx);
+  double GetXYZ(int idx);
 
   const GrainType GetGrainType(void) {return grainType;}
 
index 04313d797600edb3d0d2e0478a9282c75da1f9a3..92d76c949b9b0381dc53f53c7ef15574b5f7df68 100644 (file)
@@ -46,7 +46,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_THRUSTER "$Id: FGThruster.h,v 1.17 2011/08/03 03:21:06 jberndt Exp $"
+#define ID_THRUSTER "$Id: FGThruster.h,v 1.18 2011/09/24 14:26:46 jentron Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -74,7 +74,7 @@ CLASS DOCUMENTATION
     1.57 (pi/2) results in no thrust at all.
  
     @author Jon Berndt
-    @version $Id: FGThruster.h,v 1.17 2011/08/03 03:21:06 jberndt Exp $
+    @version $Id: FGThruster.h,v 1.18 2011/09/24 14:26:46 jentron Exp $
     */
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -98,6 +98,7 @@ public:
   }
   void SetName(string name) {Name = name;}
   virtual void SetRPM(double rpm) {};
+  virtual void SetEngineRPM(double rpm) {};
   virtual double GetPowerRequired(void) {return 0.0;}
   virtual void SetdeltaT(double dt) {deltaT = dt;}
   double GetThrust(void) const {return Thrust;}
@@ -108,6 +109,7 @@ public:
   double GetClutchCtrl(void) const { return ClutchCtrlNorm; }
   void SetClutchCtrl(double c) { ClutchCtrlNorm = c; }
   virtual double GetRPM(void) const { return 0.0; };
+  virtual double GetEngineRPM(void) const { return 0.0; };
   double GetGearRatio(void) {return GearRatio; }
   virtual string GetThrusterLabels(int id, string delimeter);
   virtual string GetThrusterValues(int id, string delimeter);
index 5b676ed8f62558428e87320811f58841b2061220..b5712ad26b069c663a9396139dd7a0b5b5951086 100644 (file)
@@ -49,7 +49,7 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGTurbine.cpp,v 1.35 2011/08/04 13:45:42 jberndt Exp $";
+static const char *IdSrc = "$Id: FGTurbine.cpp,v 1.36 2011/09/25 23:56:11 jentron Exp $";
 static const char *IdHdr = ID_TURBINE;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -385,6 +385,7 @@ double FGTurbine::CalcFuelNeed(void)
 {
   FuelFlowRate = FuelFlow_pph / 3600.0; // Calculates flow in lbs/sec from lbs/hr
   FuelExpended = FuelFlowRate * in.TotalDeltaT;     // Calculates fuel expended in this time step
+  if (!Starved) FuelUsedLbs += FuelExpended; 
   return FuelExpended;
 }
 
old mode 100644 (file)
new mode 100755 (executable)
index 5818811..c0bb279
@@ -53,7 +53,7 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGTurboProp.cpp,v 1.22 2011/08/04 13:45:42 jberndt Exp $";
+static const char *IdSrc = "$Id: FGTurboProp.cpp,v 1.24 2011/09/25 23:56:11 jentron Exp $";
 static const char *IdHdr = ID_TURBOPROP;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -170,7 +170,8 @@ void FGTurboProp::Calculate(void)
 
   ThrottlePos = in.ThrottlePos[EngineNumber];
 
-  RPM = Thruster->GetRPM() * Thruster->GetGearRatio();
+/* The thruster controls the engine RPM because it encapsulates the gear ratio and other transmission variables */
+  RPM = Thruster->GetEngineRPM();
   if (thrusterType == FGThruster::ttPropeller) {
     ((FGPropeller*)Thruster)->SetAdvance(in.PropAdvance[EngineNumber]);
     ((FGPropeller*)Thruster)->SetFeather(in.PropFeather[EngineNumber]);
@@ -409,6 +410,7 @@ double FGTurboProp::CalcFuelNeed(void)
 {
   FuelFlowRate = FuelFlow_pph / 3600.0;
   FuelExpended = FuelFlowRate * in.TotalDeltaT;
+  if (!Starved) FuelUsedLbs += FuelExpended;
   return FuelExpended;
 }