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>
14 VerticalSpeedIndicator::VerticalSpeedIndicator ( SGPropertyNode *node )
15 : _internal_pressure_inhg(29.92),
16 _name(node->getStringValue("name", "vertical-speed-indicator")),
17 _num(node->getIntValue("number", 0)),
18 _static_pressure(node->getStringValue("static-pressure", "/systems/static/pressure-inhg"))
22 VerticalSpeedIndicator::~VerticalSpeedIndicator ()
27 VerticalSpeedIndicator::init ()
30 branch = "/instrumentation/" + _name;
32 SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
33 _serviceable_node = node->getChild("serviceable", 0, true);
34 _pressure_node = fgGetNode(_static_pressure.c_str(), true);
35 _speed_node = node->getChild("indicated-speed-fpm", 0, true);
36 _speed_up_node = fgGetNode("/sim/speed-up", true);
38 // Initialize at ambient pressure
39 _internal_pressure_inhg = _pressure_node->getDoubleValue();
43 VerticalSpeedIndicator::update (double dt)
45 // model taken from steam.cxx, with change
46 // from 10000 to 10500 for manual factor
47 if (_serviceable_node->getBoolValue()) {
48 double pressure = _pressure_node->getDoubleValue();
49 double speed_up = _speed_up_node->getDoubleValue();
53 ->setDoubleValue((_internal_pressure_inhg - pressure) * 10500);
54 _internal_pressure_inhg =
55 fgGetLowPass(_internal_pressure_inhg,
56 _pressure_node->getDoubleValue(),
61 // end of vertical_speed_indicator.cxx