]> git.mxchange.org Git - flightgear.git/blob - src/Instrumentation/vertical_speed_indicator.cxx
Refactored some of the navlist code and removed the built in "fail to find"
[flightgear.git] / src / Instrumentation / vertical_speed_indicator.cxx
1 // vertical_speed_indicator.cxx - a regular VSI.
2 // Written by David Megginson, started 2002.
3 //
4 // This file is in the Public Domain and comes with no warranty.
5
6 #include <simgear/math/interpolater.hxx>
7
8 #include "vertical_speed_indicator.hxx"
9 #include <Main/fg_props.hxx>
10 #include <Main/util.hxx>
11
12
13 VerticalSpeedIndicator::VerticalSpeedIndicator ()
14     : _internal_pressure_inhg(29.92)
15 {
16 }
17
18 VerticalSpeedIndicator::~VerticalSpeedIndicator ()
19 {
20 }
21
22 void
23 VerticalSpeedIndicator::init ()
24 {
25     _serviceable_node =
26         fgGetNode("/instrumentation/vertical-speed-indicator/serviceable",
27                   true);
28     _pressure_node =
29         fgGetNode("/systems/static/pressure-inhg", true);
30     _speed_node =
31         fgGetNode("/instrumentation/vertical-speed-indicator/indicated-speed-fpm",
32                   true);
33 }
34
35 void
36 VerticalSpeedIndicator::bind ()
37 {
38 }
39
40 void
41 VerticalSpeedIndicator::unbind ()
42 {
43 }
44
45 void
46 VerticalSpeedIndicator::update (double dt)
47 {
48                                 // model take from steam.cxx, with change
49                                 // from 10000 to 10500 for manual factor
50     if (_serviceable_node->getBoolValue()) {
51         double pressure = _pressure_node->getDoubleValue();
52         _speed_node
53             ->setDoubleValue((_internal_pressure_inhg - pressure) * 10500);
54         _internal_pressure_inhg =
55             fgGetLowPass(_internal_pressure_inhg,
56                          _pressure_node->getDoubleValue(),
57                          dt/6.0);
58     }
59 }
60
61 // end of vertical_speed_indicator.cxx