2002-09-27 22:03:48 +00:00
|
|
|
// vertical_speed_indicator.cxx - a regular VSI.
|
|
|
|
// Written by David Megginson, started 2002.
|
|
|
|
//
|
|
|
|
// This file is in the Public Domain and comes with no warranty.
|
|
|
|
|
|
|
|
#include <simgear/math/interpolater.hxx>
|
|
|
|
|
|
|
|
#include "vertical_speed_indicator.hxx"
|
|
|
|
#include <Main/fg_props.hxx>
|
|
|
|
#include <Main/util.hxx>
|
|
|
|
|
|
|
|
|
|
|
|
VerticalSpeedIndicator::VerticalSpeedIndicator ()
|
|
|
|
: _internal_pressure_inhg(29.92)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
VerticalSpeedIndicator::~VerticalSpeedIndicator ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
VerticalSpeedIndicator::init ()
|
|
|
|
{
|
|
|
|
_serviceable_node =
|
|
|
|
fgGetNode("/instrumentation/vertical-speed-indicator/serviceable",
|
|
|
|
true);
|
|
|
|
_pressure_node =
|
|
|
|
fgGetNode("/systems/static/pressure-inhg", true);
|
|
|
|
_speed_node =
|
|
|
|
fgGetNode("/instrumentation/vertical-speed-indicator/indicated-speed-fpm",
|
|
|
|
true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
VerticalSpeedIndicator::update (double dt)
|
|
|
|
{
|
2003-01-29 15:30:29 +00:00
|
|
|
// model taken from steam.cxx, with change
|
2002-09-27 22:03:48 +00:00
|
|
|
// from 10000 to 10500 for manual factor
|
|
|
|
if (_serviceable_node->getBoolValue()) {
|
|
|
|
double pressure = _pressure_node->getDoubleValue();
|
|
|
|
_speed_node
|
|
|
|
->setDoubleValue((_internal_pressure_inhg - pressure) * 10500);
|
|
|
|
_internal_pressure_inhg =
|
|
|
|
fgGetLowPass(_internal_pressure_inhg,
|
|
|
|
_pressure_node->getDoubleValue(),
|
|
|
|
dt/6.0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// end of vertical_speed_indicator.cxx
|