From: Ron J. <wi...@je...> - 2011-01-29 17:09:42
|
On Saturday 29 January 2011 07:36:54 Bertrand Coconnier wrote: > 2011/1/28 Hal V. Engel <hv...@gm...>: > > 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. + double fuelDensity = Propulsion->GetTank(i)->GetDensity(); ( ... ) + Propulsion->GetTank(i)->GetContents() / fuelDensity); Should we guard against GetDensity() returning 0? Thanks, Ron |