2002-09-27 18:27:58 +00:00
|
|
|
// static.cxx - the static air system.
|
|
|
|
// Written by David Megginson, started 2002.
|
|
|
|
//
|
|
|
|
// This file is in the Public Domain and comes with no warranty.
|
|
|
|
|
|
|
|
#include "static.hxx"
|
|
|
|
#include <Main/fg_props.hxx>
|
2002-09-27 22:04:21 +00:00
|
|
|
#include <Main/util.hxx>
|
2002-09-27 18:27:58 +00:00
|
|
|
|
|
|
|
|
2004-10-16 12:37:39 +00:00
|
|
|
StaticSystem::StaticSystem ( SGPropertyNode *node )
|
|
|
|
:
|
2006-12-06 22:11:43 +00:00
|
|
|
_name(node->getStringValue("name", "static")),
|
2007-03-31 09:36:19 +00:00
|
|
|
_num(node->getIntValue("number", 0)),
|
|
|
|
_tau(node->getDoubleValue("tau", 1))
|
|
|
|
|
2002-09-27 18:27:58 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
StaticSystem::~StaticSystem ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
StaticSystem::init ()
|
|
|
|
{
|
2004-10-16 12:37:39 +00:00
|
|
|
string branch;
|
2006-12-06 22:11:43 +00:00
|
|
|
branch = "/systems/" + _name;
|
2004-10-16 12:37:39 +00:00
|
|
|
|
2006-12-06 22:11:43 +00:00
|
|
|
SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
|
2004-10-16 12:37:39 +00:00
|
|
|
_serviceable_node = node->getChild("serviceable", 0, true);
|
2002-09-27 18:27:58 +00:00
|
|
|
_pressure_in_node = fgGetNode("/environment/pressure-inhg", true);
|
2004-10-16 12:37:39 +00:00
|
|
|
_pressure_out_node = node->getChild("pressure-inhg", 0, true);
|
2002-09-27 18:27:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
StaticSystem::bind ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
StaticSystem::unbind ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
StaticSystem::update (double dt)
|
|
|
|
{
|
|
|
|
if (_serviceable_node->getBoolValue()) {
|
2007-03-31 09:36:19 +00:00
|
|
|
double trat = _tau ? dt/_tau : 100;
|
2002-09-27 18:27:58 +00:00
|
|
|
double target = _pressure_in_node->getDoubleValue();
|
|
|
|
double current = _pressure_out_node->getDoubleValue();
|
2004-04-01 15:27:53 +00:00
|
|
|
// double delta = target - current;
|
2007-03-31 09:36:19 +00:00
|
|
|
_pressure_out_node->setDoubleValue(fgGetLowPass(current, target, trat));
|
2002-09-27 18:27:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// end of static.cxx
|