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 )
17 for ( i = 0; i < node->nChildren(); ++i ) {
18 SGPropertyNode *child = node->getChild(i);
19 string cname = child->getName();
20 string cval = child->getStringValue();
21 if ( cname == "name" ) {
23 } else if ( cname == "number" ) {
24 num = child->getIntValue();
26 SG_LOG( SG_SYSTEMS, SG_WARN, "Error in systems config logic" );
27 if ( name.length() ) {
28 SG_LOG( SG_SYSTEMS, SG_WARN, "Section = " << name );
34 StaticSystem::StaticSystem ( int i )
40 StaticSystem::~StaticSystem ()
48 branch = "/systems/" + name;
50 SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
51 _serviceable_node = node->getChild("serviceable", 0, true);
52 _pressure_in_node = fgGetNode("/environment/pressure-inhg", true);
53 _pressure_out_node = node->getChild("pressure-inhg", 0, true);
62 StaticSystem::unbind ()
67 StaticSystem::update (double dt)
69 if (_serviceable_node->getBoolValue()) {
71 double target = _pressure_in_node->getDoubleValue();
72 double current = _pressure_out_node->getDoubleValue();
73 // double delta = target - current;
74 _pressure_out_node->setDoubleValue(fgGetLowPass(current, target, dt));