1 // vertical_speed_indicator.cxx - a regular VSI.
2 // Written by David Megginson, started 2002.
4 // This file is in the Public Domain and comes with no warranty.
6 #include <simgear/math/interpolater.hxx>
8 #include "vertical_speed_indicator.hxx"
9 #include <Main/fg_props.hxx>
10 #include <Main/util.hxx>
13 VerticalSpeedIndicator::VerticalSpeedIndicator ( SGPropertyNode *node )
14 : _internal_pressure_inhg(29.92),
15 _name(node->getStringValue("name", "vertical-speed-indicator")),
16 _num(node->getIntValue("number", 0)),
17 _static_pressure(node->getStringValue("static-pressure", "/systems/static/pressure-inhg"))
21 VerticalSpeedIndicator::~VerticalSpeedIndicator ()
26 VerticalSpeedIndicator::init ()
29 branch = "/instrumentation/" + _name;
31 SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
32 _serviceable_node = node->getChild("serviceable", 0, true);
33 _pressure_node = fgGetNode(_static_pressure.c_str(), true);
34 _speed_node = node->getChild("indicated-speed-fpm", 0, true);
36 // Initialize at ambient pressure
37 _internal_pressure_inhg = _pressure_node->getDoubleValue();
41 VerticalSpeedIndicator::update (double dt)
43 // model taken from steam.cxx, with change
44 // from 10000 to 10500 for manual factor
45 if (_serviceable_node->getBoolValue()) {
46 double pressure = _pressure_node->getDoubleValue();
48 ->setDoubleValue((_internal_pressure_inhg - pressure) * 10500);
49 _internal_pressure_inhg =
50 fgGetLowPass(_internal_pressure_inhg,
51 _pressure_node->getDoubleValue(),
56 // end of vertical_speed_indicator.cxx