1
0
Fork 0
This commit is contained in:
Torsten Dreyer 2011-02-06 22:28:40 +01:00
commit 07190fb953
2 changed files with 12 additions and 3 deletions

View file

@ -26,6 +26,7 @@
#endif
#include <simgear/compiler.h>
#include <simgear/sg_inlines.h>
#include <stdio.h> // size_t
#include <string>
@ -217,12 +218,20 @@ FGJSBsim::FGJSBsim( double dt )
FGTank* tank = Propulsion->GetTank(i);
d = node->getNode( "density-ppg", true )->getDoubleValue();
if( d > 0.0 )
if( d > 0.0 ) {
tank->SetDensity( d );
} else {
node->getNode( "density-ppg", true )->setDoubleValue( SG_MAX2<double>(tank->GetDensity(), 0.1) );
}
d = node->getNode( "level-lbs", true )->getDoubleValue();
if( d > 0.0 )
if( d > 0.0 ) {
tank->SetContents( d );
} else {
node->getNode( "level-lbs", true )->setDoubleValue( tank->GetContents() );
}
/* Capacity is read-only in FGTank and can't be overwritten from FlightGear */
node->getNode("capacity-gal_us", true )->setDoubleValue( tank->GetCapacityGallons() );
}
Propulsion->SetFuelFreeze((fgGetNode("/sim/freeze/fuel",true))->getBoolValue());

View file

@ -37,7 +37,7 @@ static const double M3_PER_IMPGAL = 1.0/IMPGAL_PER_M3;
TankProperties::TankProperties(SGPropertyNode_ptr rootNode ) :
_content_kg(0.0),
_density_kgpm3(755.0), // avg. AVGAS density (more or less)
_density_kgpm3(0.0),
_capacity_m3(0.0)
{
_tiedProperties.setRoot( rootNode );