]> git.mxchange.org Git - flightgear.git/commitdiff
only consider positive airspeed in longitudinal axis
authormfranz <mfranz>
Mon, 17 Jul 2006 18:14:31 +0000 (18:14 +0000)
committermfranz <mfranz>
Mon, 17 Jul 2006 18:14:31 +0000 (18:14 +0000)
src/Systems/pitot.cxx
src/Systems/pitot.hxx

index 78d1d2bd301a2b11cbe6e67349e3f260d81c9d01..136533f1b3f1371f26b998c63a29a532929f5b92 100644 (file)
@@ -3,10 +3,12 @@
 //
 // This file is in the Public Domain and comes with no warranty.
 
-#include "pitot.hxx"
+#include <simgear/constants.h>
+
 #include <Main/fg_props.hxx>
 #include <Main/util.hxx>
 
+#include "pitot.hxx"
 
 
 PitotSystem::PitotSystem ( SGPropertyNode *node )
@@ -53,6 +55,7 @@ PitotSystem::init ()
     _pressure_node = fgGetNode("/environment/pressure-inhg", true);
     _density_node = fgGetNode("/environment/density-slugft3", true);
     _velocity_node = fgGetNode("/velocities/airspeed-kt", true);
+    _slip_angle = fgGetNode("/orientation/side-slip-rad", true);
     _total_pressure_node = node->getChild("total-pressure-inhg", 0, true);
 }
 
@@ -74,10 +77,6 @@ PitotSystem::unbind ()
 # define PSFTOINHG (1/INHGTOPSF)
 #endif
 
-#ifndef KTTOFPS
-# define KTTOFPS 1.68781
-#endif
-
 
 void
 PitotSystem::update (double dt)
@@ -87,7 +86,10 @@ PitotSystem::update (double dt)
                                 // velocity in the body axis.
         double p = _pressure_node->getDoubleValue() * INHGTOPSF;
         double r = _density_node->getDoubleValue();
-        double v = _velocity_node->getDoubleValue() * KTTOFPS;
+        double v = _velocity_node->getDoubleValue() * SG_KT_TO_FPS;
+        v *= cos(_slip_angle->getDoubleValue());
+        if (v < 0.0)
+            v = 0.0;
         double q = 0.5 * r * v * v; // dynamic
         _total_pressure_node->setDoubleValue((p + q) * PSFTOINHG);
     }
index e606fe4e622cd51ff600e4f4ed0ef8929e8fce12..b0c39b31cd42cbb4e17ba5773fef5be8fc131a88 100644 (file)
@@ -59,8 +59,8 @@ private:
     SGPropertyNode_ptr _pressure_node;
     SGPropertyNode_ptr _density_node;
     SGPropertyNode_ptr _velocity_node;
+    SGPropertyNode_ptr _slip_angle;
     SGPropertyNode_ptr _total_pressure_node;
-    
 };
 
 #endif // __SYSTEMS_PITOT_HXX