From 1df7b9cdc243d1941047292baf37e5b18d8299e3 Mon Sep 17 00:00:00 2001 From: Erik Hofman Date: Mon, 26 Sep 2011 09:07:59 +0200 Subject: [PATCH] JSBSim fixes. --- src/FDM/JSBSim/FGFDMExec.cpp | 9 ++++++--- src/FDM/JSBSim/models/FGFCS.cpp | 4 +++- src/FDM/JSBSim/models/FGOutput.cpp | 8 ++++++-- .../JSBSim/models/atmosphere/FGStandardAtmosphere.cpp | 4 ++-- .../JSBSim/models/atmosphere/FGStandardAtmosphere.h | 10 ++++++---- src/FDM/JSBSim/models/atmosphere/FGWinds.cpp | 5 +++++ src/FDM/JSBSim/models/propulsion/FGPiston.cpp | 9 +++++---- src/FDM/JSBSim/models/propulsion/FGPropeller.cpp | 4 +++- src/FDM/JSBSim/models/propulsion/FGPropeller.h | 10 ++++++++-- src/FDM/JSBSim/models/propulsion/FGRotor.cpp | 8 ++++---- src/FDM/JSBSim/models/propulsion/FGRotor.h | 8 ++++---- src/FDM/JSBSim/models/propulsion/FGTank.cpp | 4 ++-- src/FDM/JSBSim/models/propulsion/FGTank.h | 4 ++-- src/FDM/JSBSim/models/propulsion/FGThruster.h | 6 ++++-- src/FDM/JSBSim/models/propulsion/FGTurbine.cpp | 3 ++- src/FDM/JSBSim/models/propulsion/FGTurboProp.cpp | 6 ++++-- 16 files changed, 66 insertions(+), 36 deletions(-) mode change 100644 => 100755 src/FDM/JSBSim/models/propulsion/FGTurboProp.cpp diff --git a/src/FDM/JSBSim/FGFDMExec.cpp b/src/FDM/JSBSim/FGFDMExec.cpp index 8d29a688f..87ee94dad 100644 --- a/src/FDM/JSBSim/FGFDMExec.cpp +++ b/src/FDM/JSBSim/FGFDMExec.cpp @@ -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; } diff --git a/src/FDM/JSBSim/models/FGFCS.cpp b/src/FDM/JSBSim/models/FGFCS.cpp index d781f54f1..3f659831f 100644 --- a/src/FDM/JSBSim/models/FGFCS.cpp +++ b/src/FDM/JSBSim/models/FGFCS.cpp @@ -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; diff --git a/src/FDM/JSBSim/models/FGOutput.cpp b/src/FDM/JSBSim/models/FGOutput.cpp index aa30ad07a..46c9b15ce 100644 --- a/src/FDM/JSBSim/models/FGOutput.cpp +++ b/src/FDM/JSBSim/models/FGOutput.cpp @@ -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()); diff --git a/src/FDM/JSBSim/models/atmosphere/FGStandardAtmosphere.cpp b/src/FDM/JSBSim/models/atmosphere/FGStandardAtmosphere.cpp index e25a7138b..fd40e9004 100644 --- a/src/FDM/JSBSim/models/atmosphere/FGStandardAtmosphere.cpp +++ b/src/FDM/JSBSim/models/atmosphere/FGStandardAtmosphere.cpp @@ -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); } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/src/FDM/JSBSim/models/atmosphere/FGStandardAtmosphere.h b/src/FDM/JSBSim/models/atmosphere/FGStandardAtmosphere.h index 380550ade..2e5c37676 100644 --- a/src/FDM/JSBSim/models/atmosphere/FGStandardAtmosphere.h +++ b/src/FDM/JSBSim/models/atmosphere/FGStandardAtmosphere.h @@ -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 diff --git a/src/FDM/JSBSim/models/atmosphere/FGWinds.cpp b/src/FDM/JSBSim/models/atmosphere/FGWinds.cpp index c24648e3a..e54c348ec 100644 --- a/src/FDM/JSBSim/models/atmosphere/FGWinds.cpp +++ b/src/FDM/JSBSim/models/atmosphere/FGWinds.cpp @@ -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) diff --git a/src/FDM/JSBSim/models/propulsion/FGPiston.cpp b/src/FDM/JSBSim/models/propulsion/FGPiston.cpp index c3cb90800..304c00971 100644 --- a/src/FDM/JSBSim/models/propulsion/FGPiston.cpp +++ b/src/FDM/JSBSim/models/propulsion/FGPiston.cpp @@ -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; } diff --git a/src/FDM/JSBSim/models/propulsion/FGPropeller.cpp b/src/FDM/JSBSim/models/propulsion/FGPropeller.cpp index 411f12a65..ead7dec9b 100644 --- a/src/FDM/JSBSim/models/propulsion/FGPropeller.cpp +++ b/src/FDM/JSBSim/models/propulsion/FGPropeller.cpp @@ -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"; diff --git a/src/FDM/JSBSim/models/propulsion/FGPropeller.h b/src/FDM/JSBSim/models/propulsion/FGPropeller.h index 94fb454ec..6e918a4eb 100644 --- a/src/FDM/JSBSim/models/propulsion/FGPropeller.h +++ b/src/FDM/JSBSim/models/propulsion/FGPropeller.h @@ -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
  • Various NACA Technical Notes and Reports
  • @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; } diff --git a/src/FDM/JSBSim/models/propulsion/FGRotor.cpp b/src/FDM/JSBSim/models/propulsion/FGRotor.cpp index 55a711cee..0a733fb83 100644 --- a/src/FDM/JSBSim/models/propulsion/FGRotor.cpp +++ b/src/FDM/JSBSim/models/propulsion/FGRotor.cpp @@ -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 { diff --git a/src/FDM/JSBSim/models/propulsion/FGRotor.h b/src/FDM/JSBSim/models/propulsion/FGRotor.h index 85d1b3e6e..9e0bb0511 100644 --- a/src/FDM/JSBSim/models/propulsion/FGRotor.h +++ b/src/FDM/JSBSim/models/propulsion/FGRotor.h @@ -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 @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. diff --git a/src/FDM/JSBSim/models/propulsion/FGTank.cpp b/src/FDM/JSBSim/models/propulsion/FGTank.cpp index a0417d540..718185a65 100644 --- a/src/FDM/JSBSim/models/propulsion/FGTank.cpp +++ b/src/FDM/JSBSim/models/propulsion/FGTank.cpp @@ -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)); } diff --git a/src/FDM/JSBSim/models/propulsion/FGTank.h b/src/FDM/JSBSim/models/propulsion/FGTank.h index dc929beb5..c5c97ce98 100644 --- a/src/FDM/JSBSim/models/propulsion/FGTank.h +++ b/src/FDM/JSBSim/models/propulsion/FGTank.h @@ -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;} diff --git a/src/FDM/JSBSim/models/propulsion/FGThruster.h b/src/FDM/JSBSim/models/propulsion/FGThruster.h index 04313d797..92d76c949 100644 --- a/src/FDM/JSBSim/models/propulsion/FGThruster.h +++ b/src/FDM/JSBSim/models/propulsion/FGThruster.h @@ -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); diff --git a/src/FDM/JSBSim/models/propulsion/FGTurbine.cpp b/src/FDM/JSBSim/models/propulsion/FGTurbine.cpp index 5b676ed8f..b5712ad26 100644 --- a/src/FDM/JSBSim/models/propulsion/FGTurbine.cpp +++ b/src/FDM/JSBSim/models/propulsion/FGTurbine.cpp @@ -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; } diff --git a/src/FDM/JSBSim/models/propulsion/FGTurboProp.cpp b/src/FDM/JSBSim/models/propulsion/FGTurboProp.cpp old mode 100644 new mode 100755 index 58188112a..c0bb27912 --- a/src/FDM/JSBSim/models/propulsion/FGTurboProp.cpp +++ b/src/FDM/JSBSim/models/propulsion/FGTurboProp.cpp @@ -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; } -- 2.39.5