1
0
Fork 0
flightgear/src/Systems/pitot.cxx
david e8db622ce1 Patch from Alex Perry:
Ok, I found the problem.  You're computing the dynamic pressure in
"psf" and adding it to the static pressure in "inHg" to form the
total pressure.  The attached patch is the simple fix to the source.

With that fix, failing the pitot while in cruise at 3k' will cause
the airspeed to indicate beyond redline during climb ... well before 4k'.
Thus, a pitot problem can be detected on any IFR altitude change.

Similarly, failing the static (with working pitot) while cruising 4k'
causes the airspeed to indicate beyond redline during a descent
well before reaching 3k' (during which, of course, the ALT looks fine).
Thus, a static failure can be detected before the aircraft breaks out
of the pilot tolerance range and is blatantly conspicuous soon after.
2002-10-10 18:15:22 +00:00

58 lines
1.3 KiB
C++

// pitot.cxx - the pitot air system.
// Written by David Megginson, started 2002.
//
// This file is in the Public Domain and comes with no warranty.
#include "pitot.hxx"
#include <Main/fg_props.hxx>
#include <Main/util.hxx>
PitotSystem::PitotSystem ()
{
}
PitotSystem::~PitotSystem ()
{
}
void
PitotSystem::init ()
{
_serviceable_node = fgGetNode("/systems/pitot[0]/serviceable", true);
_pressure_node = fgGetNode("/environment/pressure-inhg", true);
_density_node = fgGetNode("/environment/density-slugft3", true);
_velocity_node = fgGetNode("/velocities/uBody-fps", true);
_total_pressure_node =
fgGetNode("/systems/pitot[0]/total-pressure-inhg", true);
}
void
PitotSystem::bind ()
{
}
void
PitotSystem::unbind ()
{
}
#ifndef INHGTOPSF
# define INHGTOPSF (2116.217/29.9212)
#endif
void
PitotSystem::update (double dt)
{
if (_serviceable_node->getBoolValue()) {
// The pitot tube sees the forward
// velocity in the body axis.
double p = _pressure_node->getDoubleValue(); // static
double r = _density_node->getDoubleValue();
double v = _velocity_node->getDoubleValue();
double q = 0.5 * r * v * v / INHGTOPSF; // dynamic
_total_pressure_node->setDoubleValue(p + q);
}
}
// end of pitot.cxx