1 // vacuum.cxx - a vacuum pump connected to the aircraft engine.
2 // Written by David Megginson, started 2002.
4 // This file is in the Public Domain and comes with no warranty.
7 #include <Main/fg_props.hxx>
10 VacuumSystem::VacuumSystem( int i )
15 VacuumSystem::~VacuumSystem ()
22 // TODO: allow index of engine to be
24 SGPropertyNode *node = fgGetNode("/systems/vacuum", num, true );
25 _serviceable_node = node->getChild("serviceable", 0, true);
26 _rpm_node = fgGetNode("/engines/engine[0]/rpm", true);
27 _pressure_node = fgGetNode("/environment/pressure-inhg", true);
28 _suction_node = node->getChild("suction-inhg", 0, true);
37 VacuumSystem::unbind ()
42 VacuumSystem::update (double dt)
44 // Model taken from steam.cxx
48 if (!_serviceable_node->getBoolValue()) {
51 double rpm = _rpm_node->getDoubleValue();
52 double pressure = _pressure_node->getDoubleValue();
53 // This magic formula yields about 4 inhg at 700 rpm
54 suction = pressure * rpm / (rpm + 4875.0);
56 // simple regulator model that clamps smoothly to about 5 inhg
57 // over a normal rpm range
58 double max = (rpm > 0 ? 5.39 - 1.0 / ( rpm * 0.00111 ) : 0);
59 if ( suction < 0.0 ) suction = 0.0;
60 if ( suction > max ) suction = max;
62 _suction_node->setDoubleValue(suction);