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.
7 #include <Main/fg_props.hxx>
8 #include <Main/util.hxx>
11 StaticSystem::StaticSystem ( SGPropertyNode *node )
13 _name(node->getStringValue("name", "static")),
14 _num(node->getIntValue("number", 0)),
15 _tau(node->getDoubleValue("tau", 1))
20 StaticSystem::~StaticSystem ()
28 branch = "/systems/" + _name;
30 SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
31 _serviceable_node = node->getChild("serviceable", 0, true);
32 _pressure_in_node = fgGetNode("/environment/pressure-inhg", true);
33 _pressure_out_node = node->getChild("pressure-inhg", 0, true);
42 StaticSystem::unbind ()
47 StaticSystem::update (double dt)
49 if (_serviceable_node->getBoolValue()) {
50 double trat = _tau ? dt/_tau : 100;
51 double target = _pressure_in_node->getDoubleValue();
52 double current = _pressure_out_node->getDoubleValue();
53 // double delta = target - current;
54 _pressure_out_node->setDoubleValue(fgGetLowPass(current, target, trat));