}
}
- resetPropertyState();
-
fdmex = new FGFDMExec( (FGPropertyManager*)globals->get_props() );
// Register ground callback.
// Set initial fuel levels if provided.
for (unsigned int i = 0; i < Propulsion->GetNumTanks(); i++) {
+ double d;
SGPropertyNode * node = fgGetNode("/consumables/fuel/tank", i, true);
- if (node->getChild("level-gal_us", 0, false) != 0) {
- Propulsion->GetTank(i)->SetContents(node->getDoubleValue("level-gal_us") * 6.6);
- } else {
- node->setDoubleValue("level-lbs", Propulsion->GetTank(i)->GetContents());
- node->setDoubleValue("level-gal_us", Propulsion->GetTank(i)->GetContents() / 6.6);
- }
- node->setDoubleValue("capacity-gal_us",
- Propulsion->GetTank(i)->GetCapacity() / 6.6);
+ FGTank* tank = Propulsion->GetTank(i);
+
+ d = node->getNode( "density-ppg", true )->getDoubleValue();
+ if( d > 0.0 )
+ tank->SetDensity( d );
+
+ d = node->getNode( "level-lbs", true )->getDoubleValue();
+ if( d > 0.0 )
+ tank->SetContents( d );
}
Propulsion->SetFuelFreeze((fgGetNode("/sim/freeze/fuel",true))->getBoolValue());
fgGetDouble("/fdm/jsbsim/systems/hook/tailhook-offset-x-in", 196),
fgGetDouble("/fdm/jsbsim/systems/hook/tailhook-offset-y-in", 0),
fgGetDouble("/fdm/jsbsim/systems/hook/tailhook-offset-z-in", -16));
+ last_hook_tip[0] = 0; last_hook_tip[1] = 0; last_hook_tip[2] = 0;
+ last_hook_root[0] = 0; last_hook_root[1] = 0; last_hook_root[2] = 0;
crashed = false;
}
/******************************************************************************/
+void FGJSBsim::unbind()
+{
+ fdmex->Unbind();
+ FGInterface::unbind();
+}
+
+/******************************************************************************/
+
// Run an iteration of the EOM (equations of motion)
void FGJSBsim::update( double dt )
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-lbs"));
+ double fuelDensity = node->getDoubleValue("density-ppg");
+
+ if (fuelDensity < 0.1)
+ fuelDensity = 6.0; // Use average fuel value
+
+ tank->SetDensity(fuelDensity);
+ tank->SetContents(node->getDoubleValue("level-lbs"));
}
Propulsion->SetFuelFreeze((fgGetNode("/sim/freeze/fuel",true))->getBoolValue());
FGTank* tank = Propulsion->GetTank(i);
double contents = tank->GetContents();
double temp = tank->GetTemperature_degC();
- node->setDoubleValue("level-gal_us", contents/6.6);
+ double fuelDensity = tank->GetDensity();
+
+ if (fuelDensity < 0.1)
+ fuelDensity = 6.0; // Use average fuel value
+
+ node->setDoubleValue("density-ppg" , fuelDensity);
node->setDoubleValue("level-lbs", contents);
if (temp != -9999.0) node->setDoubleValue("temperature_degC", temp);
}
fgSetDouble("/fdm/jsbsim/systems/hook/tailhook-pos-deg", fi);
}
-void FGJSBsim::resetPropertyState()
-{
-// this code works-around bug #222:
-// http://code.google.com/p/flightgear-bugs/issues/detail?id=222
-// for whatever reason, having an existing value for the WOW
-// property causes the NaNs. Should that be fixed, this code can die
- SGPropertyNode* gear = fgGetNode("/fdm/jsbsim/gear", false);
- if (!gear) {
- return;
- }
-
- int index = 0;
- SGPropertyNode* unitNode = NULL;
- for (; (unitNode = gear->getChild("unit", index)) != NULL; ++index) {
- unitNode->removeChild("WOW", 0, false);
- }
-}
-