]> git.mxchange.org Git - flightgear.git/blob - src/Systems/static.cxx
b3c916d8092af73904a9b809a56fccd201195ae0
[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 #include <Main/util.hxx>
9
10
11 StaticSystem::StaticSystem ( SGPropertyNode *node )
12     :
13     _name(node->getStringValue("name", "static")),
14     _num(node->getIntValue("number", 0))
15 {
16 }
17
18 StaticSystem::~StaticSystem ()
19 {
20 }
21
22 void
23 StaticSystem::init ()
24 {
25     string branch;
26     branch = "/systems/" + _name;
27
28     SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
29     _serviceable_node = node->getChild("serviceable", 0, true);
30     _pressure_in_node = fgGetNode("/environment/pressure-inhg", true);
31     _pressure_out_node = node->getChild("pressure-inhg", 0, true);
32 }
33
34 void
35 StaticSystem::bind ()
36 {
37 }
38
39 void
40 StaticSystem::unbind ()
41 {
42 }
43
44 void
45 StaticSystem::update (double dt)
46 {
47     if (_serviceable_node->getBoolValue()) {
48         
49         double target = _pressure_in_node->getDoubleValue();
50         double current = _pressure_out_node->getDoubleValue();
51         // double delta = target - current;
52         _pressure_out_node->setDoubleValue(fgGetLowPass(current, target, dt));
53     }
54 }
55
56 // end of static.cxx