Modified to use fgGetLowPass from utils.cxx.
This commit is contained in:
parent
5289055776
commit
8685e68b99
3 changed files with 9 additions and 6 deletions
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#include "altimeter.hxx"
|
#include "altimeter.hxx"
|
||||||
#include <Main/fg_props.hxx>
|
#include <Main/fg_props.hxx>
|
||||||
|
#include <Main/util.hxx>
|
||||||
|
|
||||||
|
|
||||||
// Altitude based on pressure difference from sea level.
|
// Altitude based on pressure difference from sea level.
|
||||||
|
@ -82,8 +83,11 @@ Altimeter::update (double dt)
|
||||||
if (_serviceable_node->getBoolValue()) {
|
if (_serviceable_node->getBoolValue()) {
|
||||||
double pressure = _pressure_node->getDoubleValue();
|
double pressure = _pressure_node->getDoubleValue();
|
||||||
double setting = _setting_node->getDoubleValue();
|
double setting = _setting_node->getDoubleValue();
|
||||||
_altitude_node
|
double altitude =
|
||||||
->setDoubleValue(_altitude_table->interpolate(setting-pressure));
|
fgGetLowPass(_altitude_node->getDoubleValue(),
|
||||||
|
_altitude_table->interpolate(setting - pressure),
|
||||||
|
dt * 10);
|
||||||
|
_altitude_node->setDoubleValue(altitude);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,8 +46,6 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
double _spin;
|
|
||||||
|
|
||||||
SGPropertyNode_ptr _serviceable_node;
|
SGPropertyNode_ptr _serviceable_node;
|
||||||
SGPropertyNode_ptr _setting_node;
|
SGPropertyNode_ptr _setting_node;
|
||||||
SGPropertyNode_ptr _pressure_node;
|
SGPropertyNode_ptr _pressure_node;
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include "static.hxx"
|
#include "static.hxx"
|
||||||
#include <Main/fg_props.hxx>
|
#include <Main/fg_props.hxx>
|
||||||
|
#include <Main/util.hxx>
|
||||||
|
|
||||||
|
|
||||||
StaticSystem::StaticSystem ()
|
StaticSystem::StaticSystem ()
|
||||||
|
@ -37,11 +38,11 @@ void
|
||||||
StaticSystem::update (double dt)
|
StaticSystem::update (double dt)
|
||||||
{
|
{
|
||||||
if (_serviceable_node->getBoolValue()) {
|
if (_serviceable_node->getBoolValue()) {
|
||||||
|
|
||||||
double target = _pressure_in_node->getDoubleValue();
|
double target = _pressure_in_node->getDoubleValue();
|
||||||
double current = _pressure_out_node->getDoubleValue();
|
double current = _pressure_out_node->getDoubleValue();
|
||||||
double delta = target - current;
|
double delta = target - current;
|
||||||
current += delta * dt;
|
_pressure_out_node->setDoubleValue(fgGetLowPass(current, target, dt));
|
||||||
_pressure_out_node->setDoubleValue(current);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue