1
0
Fork 0

Simplify the pitot system and ASI -- the indicated airspeed should be

more reasonable now.
This commit is contained in:
david 2003-03-12 20:28:54 +00:00
parent 034f224de7
commit 4d146352d7
3 changed files with 15 additions and 11 deletions

View file

@ -34,15 +34,12 @@ AirspeedIndicator::init ()
fgGetNode("/systems/pitot/total-pressure-inhg", true); fgGetNode("/systems/pitot/total-pressure-inhg", true);
_static_pressure_node = _static_pressure_node =
fgGetNode("/systems/static/pressure-inhg", true); fgGetNode("/systems/static/pressure-inhg", true);
_density_node = fgGetNode("/environment/density-slugft3", true);
_speed_node = _speed_node =
fgGetNode("/instrumentation/airspeed-indicator/indicated-speed-kt", fgGetNode("/instrumentation/airspeed-indicator/indicated-speed-kt",
true); true);
} }
#ifndef SEA_LEVEL_DENSITY_SLUGFG3
# define SEA_LEVEL_DENSITY_SLUGFT3 0.002378
#endif
#ifndef FPSTOKTS #ifndef FPSTOKTS
# define FPSTOKTS 0.592484 # define FPSTOKTS 0.592484
#endif #endif
@ -55,14 +52,15 @@ void
AirspeedIndicator::update (double dt) AirspeedIndicator::update (double dt)
{ {
if (_serviceable_node->getBoolValue()) { if (_serviceable_node->getBoolValue()) {
double pt = _total_pressure_node->getDoubleValue(); double pt = _total_pressure_node->getDoubleValue() * INHGTOPSF;
double p = _static_pressure_node->getDoubleValue(); double p = _static_pressure_node->getDoubleValue() * INHGTOPSF;
double q = ( pt - p ) * INHGTOPSF; // dynamic pressure double r = _density_node->getDoubleValue();
double q = ( pt - p ); // dynamic pressure
// Now, reverse the equation (normalize dynamic pressure to // Now, reverse the equation (normalize dynamic pressure to
// avoid "nan" results from sqrt) // avoid "nan" results from sqrt)
if ( q < 0 ) { q = 0.0; } if ( q < 0 ) { q = 0.0; }
double v_fps = sqrt((2 * q) / SEA_LEVEL_DENSITY_SLUGFT3); double v_fps = sqrt((2 * q) / r);
// Publish the indicated airspeed // Publish the indicated airspeed
double last_speed_kt = _speed_node->getDoubleValue(); double last_speed_kt = _speed_node->getDoubleValue();

View file

@ -23,6 +23,7 @@
* /instrumentation/airspeed-indicator/serviceable * /instrumentation/airspeed-indicator/serviceable
* /systems/pitot[0]/total-pressure-inhg * /systems/pitot[0]/total-pressure-inhg
* /systems/static[0]/pressure-inhg * /systems/static[0]/pressure-inhg
* /environment/density-slugft3
* *
* Output properties: * Output properties:
* *
@ -44,6 +45,7 @@ private:
SGPropertyNode_ptr _serviceable_node; SGPropertyNode_ptr _serviceable_node;
SGPropertyNode_ptr _total_pressure_node; SGPropertyNode_ptr _total_pressure_node;
SGPropertyNode_ptr _static_pressure_node; SGPropertyNode_ptr _static_pressure_node;
SGPropertyNode_ptr _density_node;
SGPropertyNode_ptr _speed_node; SGPropertyNode_ptr _speed_node;
}; };

View file

@ -41,6 +41,10 @@ PitotSystem::unbind ()
# define INHGTOPSF (2116.217/29.9212) # define INHGTOPSF (2116.217/29.9212)
#endif #endif
#ifndef PSFTOINHG
# define PSFTOINHG (1/INHGTOPSF)
#endif
#ifndef KTTOFPS #ifndef KTTOFPS
# define KTTOFPS 1.68781 # define KTTOFPS 1.68781
#endif #endif
@ -52,11 +56,11 @@ PitotSystem::update (double dt)
if (_serviceable_node->getBoolValue()) { if (_serviceable_node->getBoolValue()) {
// The pitot tube sees the forward // The pitot tube sees the forward
// velocity in the body axis. // velocity in the body axis.
double p = _pressure_node->getDoubleValue(); // static double p = _pressure_node->getDoubleValue() * INHGTOPSF;
double r = _density_node->getDoubleValue(); double r = _density_node->getDoubleValue();
double v = _velocity_node->getDoubleValue() * KTTOFPS; double v = _velocity_node->getDoubleValue() * KTTOFPS;
double q = 0.5 * r * v * v / INHGTOPSF; // dynamic double q = 0.5 * r * v * v; // dynamic
_total_pressure_node->setDoubleValue(p + q); _total_pressure_node->setDoubleValue((p + q) * PSFTOINHG);
} }
} }