]> git.mxchange.org Git - flightgear.git/commitdiff
Sync. with JSBSim CVS
authorehofman <ehofman>
Sat, 24 Oct 2009 08:25:55 +0000 (08:25 +0000)
committerTim Moore <timoore@redhat.com>
Sat, 24 Oct 2009 17:50:27 +0000 (19:50 +0200)
src/FDM/JSBSim/input_output/FGXMLElement.cpp
src/FDM/JSBSim/input_output/FGXMLElement.h
src/FDM/JSBSim/models/FGLGear.cpp
src/FDM/JSBSim/models/propulsion/FGEngine.cpp
src/FDM/JSBSim/models/propulsion/FGTank.cpp
src/FDM/JSBSim/models/propulsion/FGTank.h

index 50eba40abc66c141b501a77417eb3eb4f5146655..044ead516b96112da36c820916f8a98b5dac82e2 100755 (executable)
@@ -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;
   }
 }
 
index d00986e3ef3d7c8fc17a6d662412b27ab41e2c29..e4cac49d253fae01737701a8a0c5220e5ddf5bf1 100755 (executable)
@@ -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$
index 7df378b83cad4de07c1414cc6cfc077065876d2f..a470fd5f4727655f68e31adaf27d8bf76deaef32 100644 (file)
@@ -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;
index 99c8df174c4dcf47a80e15420eb04573cf0c1287..ae447b05a0c8f48374e8b2f6da5b06a790596eb5 100644 (file)
@@ -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; i<Propulsion->GetNumTanks(); 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; i<Propulsion->GetNumTanks(); 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; i<FeedList.size(); i++) {
+    Tank = Propulsion->GetTank(FeedList[i]);
+    Tank->Drain(FuelNeeded); 
+  }
 
-    // Remove equal amount of fuel from each feed tank.  
-    FuelNeeded = FuelToBurn/TanksWithFuel;
-    for (i=0; i<FeedList.size(); i++) {
-      Tank = Propulsion->GetTank(FeedList[i]);
-      Tank->Drain(FuelNeeded); 
-      FuelToBurn -= FuelNeeded;
-    }
-  }  // while
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index 56e68d08fd18f2015b1c41fcdb93d1b5c5e47d14..ffeb562767bb3fd955b9449ba61e6d1caf8310be 100644 (file)
@@ -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)
index 8bc0d0fa68981cb4824b5e3ab07b6718e7473aab..141d01003f4ab7d5bfc97f8fb367689c187be290 100644 (file)
@@ -128,6 +128,7 @@ CLASS DOCUMENTATION
   <temperature> {number} </temperature> <!-- must be degrees fahrenheit -->
   <standpipe unit="{LBS | KG"}> {number} </standpipe>
   <priority> {integer} </priority>
+  <density unit="{KG/L | LBS/GAL}"> {number} </density>
 </tank>
 @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); }