]> git.mxchange.org Git - flightgear.git/blob - src/Systems/vacuum.cxx
MSVC fix from Frederic Bouvier
[flightgear.git] / src / Systems / vacuum.cxx
1 // vacuum.cxx - a vacuum pump connected to the aircraft engine.
2 // Written by David Megginson, started 2002.
3 //
4 // This file is in the Public Domain and comes with no warranty.
5
6 #include "vacuum.hxx"
7 #include <Main/fg_props.hxx>
8
9
10 VacuumSystem::VacuumSystem ()
11 {
12 }
13
14 VacuumSystem::~VacuumSystem ()
15 {
16 }
17
18 void
19 VacuumSystem::init ()
20 {
21                                 // TODO: allow index of pump and engine
22                                 // to be configured.
23     _serviceable_node = fgGetNode("/systems/vacuum[0]/serviceable", true);
24     _rpm_node = fgGetNode("/engines/engine[0]/rpm", true);
25     _pressure_node = fgGetNode("/environment/pressure-inhg", true);
26     _suction_node = fgGetNode("/systems/vacuum[0]/suction-inhg", true);
27 }
28
29 void
30 VacuumSystem::bind ()
31 {
32 }
33
34 void
35 VacuumSystem::unbind ()
36 {
37 }
38
39 void
40 VacuumSystem::update (double dt)
41 {
42     // Model taken from steam.cxx
43
44     double suction;
45
46     if (!_serviceable_node->getBoolValue()) {
47         suction = 0.0;
48     } else {
49         double rpm = _rpm_node->getDoubleValue();
50         double pressure = _pressure_node->getDoubleValue();
51         suction = pressure * rpm / (rpm + 10000.0);
52         if (suction > 5.0)
53             suction = 5.0;
54     }
55     _suction_node->setDoubleValue(suction);
56 }
57
58 // end of vacuum.cxx