1 // pitot.cxx - the pitot air system.
2 // Written by David Megginson, started 2002.
4 // This file is in the Public Domain and comes with no warranty.
7 #include <Main/fg_props.hxx>
8 #include <Main/util.hxx>
11 PitotSystem::PitotSystem ()
15 PitotSystem::~PitotSystem ()
22 _serviceable_node = fgGetNode("/systems/pitot[0]/serviceable", true);
23 _pressure_node = fgGetNode("/environment/pressure-inhg", true);
24 _density_node = fgGetNode("/environment/density-slugft3", true);
25 _velocity_node = fgGetNode("/velocities/airspeed-kt", true);
26 _total_pressure_node =
27 fgGetNode("/systems/pitot[0]/total-pressure-inhg", true);
36 PitotSystem::unbind ()
41 # define INHGTOPSF (2116.217/29.9212)
45 # define KTTOFPS 1.68781
50 PitotSystem::update (double dt)
52 if (_serviceable_node->getBoolValue()) {
53 // The pitot tube sees the forward
54 // velocity in the body axis.
55 double p = _pressure_node->getDoubleValue(); // static
56 double r = _density_node->getDoubleValue();
57 double v = _velocity_node->getDoubleValue() * KTTOFPS;
58 double q = 0.5 * r * v * v / INHGTOPSF; // dynamic
59 _total_pressure_node->setDoubleValue(p + q);