]> git.mxchange.org Git - flightgear.git/commitdiff
Patch from Alex Perry:
authordavid <david>
Thu, 10 Oct 2002 18:15:22 +0000 (18:15 +0000)
committerdavid <david>
Thu, 10 Oct 2002 18:15:22 +0000 (18:15 +0000)
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.

src/Instrumentation/airspeed_indicator.cxx
src/Systems/pitot.cxx

index 27f2f0f175298e1aefd2d9b9cbc0dc6650527763..480d6dab33894c72349aa1bd9f531e248c20093e 100644 (file)
@@ -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);
index 0a58805b53ca1ecd649044add09dc33d6e9268b0..3cd8f948543ba25c810b351c233085f2e5a312e2 100644 (file)
@@ -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);
     }
 }