2002-09-28 20:48:53 +00:00
|
|
|
// 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);
|
2002-10-16 22:09:26 +00:00
|
|
|
_velocity_node = fgGetNode("/velocities/airspeed-kt", true);
|
2002-09-28 20:48:53 +00:00
|
|
|
_total_pressure_node =
|
|
|
|
fgGetNode("/systems/pitot[0]/total-pressure-inhg", true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PitotSystem::bind ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PitotSystem::unbind ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2002-10-10 18:15:22 +00:00
|
|
|
#ifndef INHGTOPSF
|
|
|
|
# define INHGTOPSF (2116.217/29.9212)
|
|
|
|
#endif
|
|
|
|
|
2002-10-16 22:09:26 +00:00
|
|
|
#ifndef KTTOFPS
|
|
|
|
# define KTTOFPS 1.68781
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2002-09-28 20:48:53 +00:00
|
|
|
void
|
|
|
|
PitotSystem::update (double dt)
|
|
|
|
{
|
|
|
|
if (_serviceable_node->getBoolValue()) {
|
|
|
|
// The pitot tube sees the forward
|
|
|
|
// velocity in the body axis.
|
2002-10-10 18:15:22 +00:00
|
|
|
double p = _pressure_node->getDoubleValue(); // static
|
2002-09-28 20:48:53 +00:00
|
|
|
double r = _density_node->getDoubleValue();
|
2002-10-16 22:09:26 +00:00
|
|
|
double v = _velocity_node->getDoubleValue() * KTTOFPS;
|
2002-10-10 18:15:22 +00:00
|
|
|
double q = 0.5 * r * v * v / INHGTOPSF; // dynamic
|
2002-09-28 20:48:53 +00:00
|
|
|
_total_pressure_node->setDoubleValue(p + q);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// end of pitot.cxx
|