2011/1/28 Hal V. Engel <hven...@gmail.com>:
> A thread was opened on the forum about how the C172P appeared to be
> incorrectly calculating the amount of fuel in gallons based on the weight of
> the fuel. It appears that the conversion is using 6.6 lbs/gal when it should
> be using something close to 6.0. That is
>
> /fdm/jsbsim/propulsion/tank[n]/contents-lbs divided by
> /consumables/fuel/tank[n]/level-us_gal == 6.6
>
> I also had an issue with this for the p51d-jsbsim model and I had to use 6.6
> as the conversion factor when setting up the fuel tanks in order to get
> /consumables/fuel/tank[n]/level-us_gal to report the correct amount of fuel.
> What is really strange is that /consumables/fuel/tank[n]/density-ppg = 6.0.
> Is this a bug or is there some other issue that aircraft developers need to be
> aware of to get this to work correctly?
>
> Hal
>
Hi Hal,
This is somehow a bug since the fuel density is hardcoded to 6.6
lbs/gal in src/FDM/JSBSim/JSBSim.cxx. Enclosed patch reads the fuel
density from JSBSim to make conversion between volume and density.
Note that JSBSim allows different sort of fuel density to be used (see
JSBSim reference manual chapter 3.1.7.1 pp. 39-40). Most of the fuels
seem to be around 6.6 lbs/gal with the notable exception of AVGAS and
HYDRAZINE.
Cheers,
Bertrand.
diff --git a/src/FDM/JSBSim/JSBSim.cxx b/src/FDM/JSBSim/JSBSim.cxx
index f802c8c..c752e5e 100644
--- a/src/FDM/JSBSim/JSBSim.cxx
+++ b/src/FDM/JSBSim/JSBSim.cxx
@@ -215,14 +213,15 @@ FGJSBsim::FGJSBsim( double dt )
// Set initial fuel levels if provided.
for (unsigned int i = 0; i < Propulsion->GetNumTanks(); i++) {
SGPropertyNode * node = fgGetNode("/consumables/fuel/tank", i, true);
+ double fuelDensity = Propulsion->GetTank(i)->GetDensity();
if (node->getChild("level-gal_us", 0, false) != 0) {
- Propulsion->GetTank(i)->SetContents(node->getDoubleValue("level-gal_us") * 6.6);
+ Propulsion->GetTank(i)->SetContents(node->getDoubleValue("level-gal_us") * fuelDensity);
} else {
node->setDoubleValue("level-lbs", Propulsion->GetTank(i)->GetContents());
- node->setDoubleValue("level-gal_us", Propulsion->GetTank(i)->GetContents() / 6.6);
+ node->setDoubleValue("level-gal_us", Propulsion->GetTank(i)->GetContents() / fuelDensity);
}
node->setDoubleValue("capacity-gal_us",
- Propulsion->GetTank(i)->GetCapacity() / 6.6);
+ Propulsion->GetTank(i)->GetCapacity() / fuelDensity);
}
Propulsion->SetFuelFreeze((fgGetNode("/sim/freeze/fuel",true))->getBoolValue());
@@ -670,7 +696,7 @@ bool FGJSBsim::copy_to_JSBsim()
for (i = 0; i < Propulsion->GetNumTanks(); i++) {
SGPropertyNode * node = fgGetNode("/consumables/fuel/tank", i, true);
FGTank * tank = Propulsion->GetTank(i);
- tank->SetContents(node->getDoubleValue("level-gal_us") * 6.6);
+ tank->SetContents(node->getDoubleValue("level-gal_us") * Propulsion->GetTank(i)->GetDensity());
// tank->SetContents(node->getDoubleValue("level-lbs"));
}
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel