From: david Date: Thu, 10 Oct 2002 18:15:22 +0000 (+0000) Subject: Patch from Alex Perry: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=e8db622ce18ef98d482af528200f26e3bdc0e070;p=flightgear.git 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. --- diff --git a/src/Instrumentation/airspeed_indicator.cxx b/src/Instrumentation/airspeed_indicator.cxx index 27f2f0f17..480d6dab3 100644 --- a/src/Instrumentation/airspeed_indicator.cxx +++ b/src/Instrumentation/airspeed_indicator.cxx @@ -54,13 +54,17 @@ AirspeedIndicator::unbind () # define FPSTOKTS 0.592484 #endif +#ifndef INHGTOPSF +# define INHGTOPSF (2116.217/29.9212) +#endif + void AirspeedIndicator::update (double dt) { if (_serviceable_node->getBoolValue()) { double pt = _total_pressure_node->getDoubleValue(); double p = _static_pressure_node->getDoubleValue(); - double q = pt - p; // dynamic pressure + double q = ( pt - p ) * INHGTOPSF; // dynamic pressure // Now, reverse the equation double v_fps = sqrt((2 * q) / SEA_LEVEL_DENSITY_SLUGFT3); diff --git a/src/Systems/pitot.cxx b/src/Systems/pitot.cxx index 0a58805b5..3cd8f9485 100644 --- a/src/Systems/pitot.cxx +++ b/src/Systems/pitot.cxx @@ -37,16 +37,20 @@ 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(); + double p = _pressure_node->getDoubleValue(); // static double r = _density_node->getDoubleValue(); double v = _velocity_node->getDoubleValue(); - double q = 0.5 * r * v * v; // dynamic pressure + double q = 0.5 * r * v * v / INHGTOPSF; // dynamic _total_pressure_node->setDoubleValue(p + q); } }