X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FSystems%2Fvacuum.cxx;h=9bf84e284d48fb5a4f992cb8122fb61426c1162c;hb=9c63b7713307eb4db9f6df7959fe83977f561c42;hp=b7f91e0ec29dd2f8dbb2aced1c4bb1cb78b4f1b6;hpb=c6062ad93cf3bfbffb6dec63cd6844167bb56980;p=flightgear.git diff --git a/src/Systems/vacuum.cxx b/src/Systems/vacuum.cxx index b7f91e0ec..9bf84e284 100644 --- a/src/Systems/vacuum.cxx +++ b/src/Systems/vacuum.cxx @@ -46,6 +46,14 @@ VacuumSystem::init() } _pressure_node = fgGetNode("/environment/pressure-inhg", true); _suction_node = node->getChild("suction-inhg", 0, true); + + reinit(); +} + +void +VacuumSystem::reinit() +{ + _suction_node->setDoubleValue(0.0); } void @@ -69,14 +77,14 @@ VacuumSystem::update (double dt) if (!_serviceable_node->getBoolValue()) { suction = 0.0; } else { - // select the source with the max rpm + // select the source with the max rpm double rpm = 0.0; - for ( i = 0; i < _rpm_nodes.size(); i++ ) { - double tmp = _rpm_nodes[i]->getDoubleValue() * _scale; - if ( tmp > rpm ) { - rpm = tmp; - } - } + for ( i = 0; i < _rpm_nodes.size(); i++ ) { + double tmp = _rpm_nodes[i]->getDoubleValue() * _scale; + if ( tmp > rpm ) { + rpm = tmp; + } + } double pressure = _pressure_node->getDoubleValue(); // This magic formula yields about 4 inhg at 700 rpm suction = pressure * rpm / (rpm + 4875.0);