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.
14 #include <Main/fg_props.hxx>
15 #include <Main/util.hxx>
18 StaticSystem::StaticSystem ( SGPropertyNode *node )
20 _name(node->getStringValue("name", "static")),
21 _num(node->getIntValue("number", 0)),
22 _tau(node->getDoubleValue("tau", 1))
27 StaticSystem::~StaticSystem ()
34 std::string branch = "/systems/" + _name;
36 SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
37 _serviceable_node = node->getChild("serviceable", 0, true);
38 _pressure_in_node = fgGetNode("/environment/pressure-inhg", true);
39 _pressure_out_node = node->getChild("pressure-inhg", 0, true);
48 StaticSystem::unbind ()
53 StaticSystem::update (double dt)
55 if (_serviceable_node->getBoolValue()) {
56 double trat = _tau ? dt/_tau : 100;
57 double target = _pressure_in_node->getDoubleValue();
58 double current = _pressure_out_node->getDoubleValue();
59 // double delta = target - current;
60 _pressure_out_node->setDoubleValue(fgGetLowPass(current, target, trat));