From 7283e506b2016c2373a11cc515b992f244177016 Mon Sep 17 00:00:00 2001 From: ehofman Date: Sat, 24 Oct 2009 08:25:55 +0000 Subject: [PATCH] Sync. with JSBSim CVS --- src/FDM/JSBSim/input_output/FGXMLElement.cpp | 6 ++ src/FDM/JSBSim/input_output/FGXMLElement.h | 5 ++ src/FDM/JSBSim/models/FGLGear.cpp | 5 +- src/FDM/JSBSim/models/propulsion/FGEngine.cpp | 58 +++++++++---------- src/FDM/JSBSim/models/propulsion/FGTank.cpp | 14 ++++- src/FDM/JSBSim/models/propulsion/FGTank.h | 12 ++++ 6 files changed, 66 insertions(+), 34 deletions(-) diff --git a/src/FDM/JSBSim/input_output/FGXMLElement.cpp b/src/FDM/JSBSim/input_output/FGXMLElement.cpp index 50eba40ab..044ead516 100755 --- a/src/FDM/JSBSim/input_output/FGXMLElement.cpp +++ b/src/FDM/JSBSim/input_output/FGXMLElement.cpp @@ -138,6 +138,9 @@ Element::Element(string nm) // Fuel Consumption convert["LBS/HP*HR"]["KG/KW*HR"] = 0.6083; convert["KG/KW*HR"]["LBS/HP*HR"] = 1.0/convert["LBS/HP*HR"]["KG/KW*HR"]; + // Density + convert["KG/L"]["LBS/GAL"] = 8.3454045; + convert["LBS/GAL"]["KG/L"] = 1.0/convert["KG/L"]["LBS/GAL"]; // Length convert["M"]["M"] = 1.00; @@ -200,6 +203,9 @@ Element::Element(string nm) // Fuel Consumption convert["LBS/HP*HR"]["LBS/HP*HR"] = 1.0; convert["KG/KW*HR"]["KG/KW*HR"] = 1.0; + // Density + convert["KG/L"]["KG/L"] = 1.0; + convert["LBS/GAL"]["LBS/GAL"] = 1.0; } } diff --git a/src/FDM/JSBSim/input_output/FGXMLElement.h b/src/FDM/JSBSim/input_output/FGXMLElement.h index d00986e3e..e4cac49d2 100755 --- a/src/FDM/JSBSim/input_output/FGXMLElement.h +++ b/src/FDM/JSBSim/input_output/FGXMLElement.h @@ -92,6 +92,7 @@ CLASS DOCUMENTATION - convert["KG/MIN"]["LBS/MIN"] = convert["KG"]["LBS"]; - convert["LBS/HP*HR"]["KG/KW*HR"] = 0.6083; - convert["KG/KW*HR"]["LBS/HP*HR"] = 1/convert["LBS/HP*HR"]["KG/KW*HR"]; + - convert["KG/L"]["LBS/GAL"] = 8.3454045; - convert["M"]["M"] = 1.00; - convert["FT"]["FT"] = 1.00; @@ -119,6 +120,8 @@ CLASS DOCUMENTATION - convert["LBS/MIN"]["LBS/MIN"] = 1.0; - convert["LBS/HP*HR"]["LBS/HP*HR"] = 1.0; - convert["KG/KW*HR"]["KG/KW*HR"] = 1.0; + - convert["KG/L"]["KG/L"] = 1.0; + - convert["LBS/GAL"]["LBS/GAL"] = 1.0; Where: - N = newtons @@ -136,6 +139,8 @@ CLASS DOCUMENTATION - WATTS = watts - HP = horsepower - HR = hour + - L = liter + - GAL = gallon (U.S. liquid) @author Jon S. Berndt @version $Id$ diff --git a/src/FDM/JSBSim/models/FGLGear.cpp b/src/FDM/JSBSim/models/FGLGear.cpp index 7df378b83..a470fd5f4 100644 --- a/src/FDM/JSBSim/models/FGLGear.cpp +++ b/src/FDM/JSBSim/models/FGLGear.cpp @@ -65,7 +65,8 @@ CLASS IMPLEMENTATION FGLGear::FGLGear(Element* el, FGFDMExec* fdmex, int number) : FGForce(fdmex), - GearNumber(number) + GearNumber(number), + SteerAngle(0.0) { Element *force_table=0; Element *dampCoeff=0; @@ -397,6 +398,8 @@ FGColumnVector3& FGLGear::GetBodyForces(void) WOW = false; compressLength = 0.0; compressSpeed = 0.0; + WheelSlip = 0.0; + StrutForce = 0.0; // Let wheel spin down slowly vWhlVelVec(eX) -= 13.0*dT; diff --git a/src/FDM/JSBSim/models/propulsion/FGEngine.cpp b/src/FDM/JSBSim/models/propulsion/FGEngine.cpp index 99c8df174..ae447b05a 100644 --- a/src/FDM/JSBSim/models/propulsion/FGEngine.cpp +++ b/src/FDM/JSBSim/models/propulsion/FGEngine.cpp @@ -184,42 +184,38 @@ void FGEngine::ConsumeFuel(void) FuelToBurn = CalcFuelNeed(); if (FuelToBurn == 0.0) return; - while (FuelToBurn > 0.0) { - - // Count how many fuel tanks with the current priority level have fuel. - // If none, then try next lower priority. Build the feed list. - while ((TanksWithFuel == 0) && (CurrentPriority <= Propulsion->GetNumTanks())) { - for (i=0; iGetNumTanks(); i++) { - if (SourceTanks[i] != 0) { - Tank = Propulsion->GetTank(i); - if (Tank->GetType() == FGTank::ttFUEL) { - if ((Tank->GetContents() > 0.0) && ((unsigned int)Tank->GetPriority() == CurrentPriority)) { - ++TanksWithFuel; - FeedList.push_back(i); - } - } else { - cerr << "No oxidizer tanks should be used for this engine type." << endl; - } + // Count how many fuel tanks with the current priority level have fuel. + // If none, then try next lower priority. Build the feed list. + while ((TanksWithFuel == 0) && (CurrentPriority <= Propulsion->GetNumTanks())) { + for (i=0; iGetNumTanks(); i++) { + if (SourceTanks[i] != 0) { + Tank = Propulsion->GetTank(i); + if (Tank->GetType() == FGTank::ttFUEL) { + if ((Tank->GetContents() > 0.0) && ((unsigned int)Tank->GetPriority() == CurrentPriority)) { + ++TanksWithFuel; + FeedList.push_back(i); + } + } else { + cerr << "No oxidizer tanks should be used for this engine type." << endl; } } - if (TanksWithFuel == 0) CurrentPriority++; } + if (TanksWithFuel == 0) CurrentPriority++; + } - // No fuel found at any priority! - if (TanksWithFuel == 0) { - Starved = true; - return; - } + // No fuel found at any priority! + if (TanksWithFuel == 0) { + Starved = true; + return; + } + + // Remove equal amount of fuel from each feed tank. + FuelNeeded = FuelToBurn/TanksWithFuel; + for (i=0; iGetTank(FeedList[i]); + Tank->Drain(FuelNeeded); + } - // Remove equal amount of fuel from each feed tank. - FuelNeeded = FuelToBurn/TanksWithFuel; - for (i=0; iGetTank(FeedList[i]); - Tank->Drain(FuelNeeded); - FuelToBurn -= FuelNeeded; - } - - } // while } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/src/FDM/JSBSim/models/propulsion/FGTank.cpp b/src/FDM/JSBSim/models/propulsion/FGTank.cpp index 56e68d08f..ffeb56276 100644 --- a/src/FDM/JSBSim/models/propulsion/FGTank.cpp +++ b/src/FDM/JSBSim/models/propulsion/FGTank.cpp @@ -59,7 +59,8 @@ FGTank::FGTank(FGFDMExec* exec, Element* el, int tank_number) Element* element; Element* element_Grain; Area = 1.0; - Temperature = -9999.0; + Density = 6.6; + InitialTemperature = Temperature = -9999.0; Ixx = Iyy = Izz = 0.0; Radius = Contents = Standpipe = Length = InnerRadius = 0.0; Capacity = 0.00001; @@ -96,6 +97,8 @@ FGTank::FGTank(FGFDMExec* exec, Element* el, int tank_number) InitialStandpipe = Standpipe = el->FindElementValueAsNumberConvertTo("standpipe", "LBS"); if (el->FindElement("priority")) InitialPriority = Priority = el->FindElementValueAsNumber("priority"); + if (el->FindElement("density")) + Density = el->FindElementValueAsNumberConvertTo("density", "LBS/GAL"); SetPriority( InitialPriority ); // this will also set the Selected flag @@ -206,7 +209,6 @@ double FGTank::Drain(double used) Contents = 0.0; PctFull = 0.0; - SetPriority(0); } if (grainType != gtUNKNOWN) CalculateInertias(); @@ -245,6 +247,14 @@ void FGTank::SetContents(double amount) } } +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +void FGTank::SetContentsGallons(double gallons) +{ + SetContents(gallons * Density); +} + + //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% double FGTank::Calculate(double dt) diff --git a/src/FDM/JSBSim/models/propulsion/FGTank.h b/src/FDM/JSBSim/models/propulsion/FGTank.h index 8bc0d0fa6..141d01003 100644 --- a/src/FDM/JSBSim/models/propulsion/FGTank.h +++ b/src/FDM/JSBSim/models/propulsion/FGTank.h @@ -128,6 +128,7 @@ CLASS DOCUMENTATION {number} {number} {integer} + {number} @endcode @@ -142,6 +143,7 @@ CLASS DOCUMENTATION - \b temperature - Initial temperature, defaults to degrees Fahrenheit. - \b standpipe - Minimum contents to which tank can dump, defaults to pounds. - \b priority - Establishes feed sequence of tank. "1" is the highest priority. +- \b density - Density of liquid tank contents. location: - \b x - Location of tank on aircraft's x-axis, defaults to inches. @@ -167,6 +169,7 @@ be printed to the console if the location is not given - \b temperature - -9999.0 (flag which indicates no temperature is set) - \b standpipe - 0.0 (all contents may be dumped) - \b priority - 1 (highest feed sequence priority) +- \b density - 6.6 @author Jon Berndt, Dave Culp @see Akbar, Raza et al. "A Simple Analysis of Fuel Addition to the CWT of @@ -226,10 +229,18 @@ public: @return the capacity of the tank in pounds. */ double GetCapacity(void) {return Capacity;} + /** Gets the capacity of the tank. + @return the capacity of the tank in gallons. */ + double GetCapacityGallons(void) {return Capacity/Density;} + /** Gets the contents of the tank. @return the contents of the tank in pounds. */ double GetContents(void) const {return Contents;} + /** Gets the contents of the tank. + @return the contents of the tank in gallons. */ + double GetContentsGallons(void) const {return Contents/Density;} + /** Gets the temperature of the fuel. The temperature of the fuel is calculated if an initial tempearture is given in the configuration file. @@ -258,6 +269,7 @@ public: double Fill(double amount); void SetContents(double amount); + void SetContentsGallons(double gallons); void SetTemperature(double temp) { Temperature = temp; } void SetStandpipe(double amount) { Standpipe = amount; } void SetSelected(bool sel) { sel==true ? SetPriority(1):SetPriority(0); } -- 2.39.5