1 // static.cxx - the static air system.
2 // Written by David Megginson, started 2002.
4 // This file is in the Public Domain and comes with no warranty.
10 #include <Main/fg_props.hxx>
11 #include <Main/util.hxx>
14 StaticSystem::StaticSystem ( SGPropertyNode *node )
16 _name(node->getStringValue("name", "static")),
17 _num(node->getIntValue("number", 0)),
18 _tau(node->getDoubleValue("tau", 1))
23 StaticSystem::~StaticSystem ()
30 std::string branch = "/systems/" + _name;
32 SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
33 _serviceable_node = node->getChild("serviceable", 0, true);
34 _pressure_in_node = fgGetNode("/environment/pressure-inhg", true);
35 _pressure_out_node = node->getChild("pressure-inhg", 0, true);
44 StaticSystem::unbind ()
49 StaticSystem::update (double dt)
51 if (_serviceable_node->getBoolValue()) {
52 double trat = _tau ? dt/_tau : 100;
53 double target = _pressure_in_node->getDoubleValue();
54 double current = _pressure_out_node->getDoubleValue();
55 // double delta = target - current;
56 _pressure_out_node->setDoubleValue(fgGetLowPass(current, target, trat));