]> git.mxchange.org Git - flightgear.git/blob - src/Systems/static.cxx
9e2b6aff19989d02ff092aa7000949f64a14fb89
[flightgear.git] / src / Systems / static.cxx
1 // static.cxx - the static air system.
2 // Written by David Megginson, started 2002.
3 //
4 // This file is in the Public Domain and comes with no warranty.
5
6 #include "static.hxx"
7 #include <Main/fg_props.hxx>
8
9
10 StaticSystem::StaticSystem ()
11 {
12 }
13
14 StaticSystem::~StaticSystem ()
15 {
16 }
17
18 void
19 StaticSystem::init ()
20 {
21     _serviceable_node = fgGetNode("/systems/static[0]/serviceable", true);
22     _pressure_in_node = fgGetNode("/environment/pressure-inhg", true);
23     _pressure_out_node = fgGetNode("/systems/static[0]/pressure-inhg", true);
24 }
25
26 void
27 StaticSystem::bind ()
28 {
29 }
30
31 void
32 StaticSystem::unbind ()
33 {
34 }
35
36 void
37 StaticSystem::update (double dt)
38 {
39     if (_serviceable_node->getBoolValue()) {
40         double target = _pressure_in_node->getDoubleValue();
41         double current = _pressure_out_node->getDoubleValue();
42         double delta = target - current;
43         current += delta * dt;
44         _pressure_out_node->setDoubleValue(current);
45     }
46 }
47
48 // end of static.cxx