1
0
Fork 0

pitot system stalls at high angles, using /system/pitot[x]/stall-deg

This commit is contained in:
Eric van den Berg 2013-11-01 17:44:42 +01:00 committed by janodesbois
parent b045dcf0f1
commit 49131b5a7a
2 changed files with 23 additions and 10 deletions

View file

@ -1,7 +1,7 @@
// pitot.cxx - the pitot air system. // pitot.cxx - the pitot air system.
// Written by David Megginson, started 2002. // Written by David Megginson, started 2002.
// //
// Last modified by Eric van den Berg, 24 Nov 2012 // Last modified by Eric van den Berg, 01 Nov 2013
// This file is in the Public Domain and comes with no warranty. // This file is in the Public Domain and comes with no warranty.
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
@ -19,7 +19,9 @@
PitotSystem::PitotSystem ( SGPropertyNode *node ) PitotSystem::PitotSystem ( SGPropertyNode *node )
: :
_name(node->getStringValue("name", "pitot")), _name(node->getStringValue("name", "pitot")),
_num(node->getIntValue("number", 0)) _num(node->getIntValue("number", 0)),
_stall_factor(cos(node->getDoubleValue("stall-deg", 60.0) * SGD_DEGREES_TO_RADIANS ))
// this is the projection factor for the stall angle.
{ {
} }
@ -41,6 +43,9 @@ PitotSystem::init ()
_beta_deg_node = fgGetNode("/orientation/side-slip-deg", true); _beta_deg_node = fgGetNode("/orientation/side-slip-deg", true);
_total_pressure_node = node->getChild("total-pressure-inhg", 0, true); _total_pressure_node = node->getChild("total-pressure-inhg", 0, true);
_measured_total_pressure_node = node->getChild("measured-total-pressure-inhg", 0, true); _measured_total_pressure_node = node->getChild("measured-total-pressure-inhg", 0, true);
if ( _stall_factor < 0 ) { // |stall angle| > 90°
_stall_factor = cos(60 * SGD_DEGREES_TO_RADIANS);
}
} }
void void
@ -61,14 +66,21 @@ PitotSystem::update (double dt)
double mach = _mach_node->getDoubleValue(); double mach = _mach_node->getDoubleValue();
double alpha = _alpha_deg_node->getDoubleValue() * SGD_DEGREES_TO_RADIANS; double alpha = _alpha_deg_node->getDoubleValue() * SGD_DEGREES_TO_RADIANS;
double beta = _beta_deg_node->getDoubleValue() * SGD_DEGREES_TO_RADIANS; double beta = _beta_deg_node->getDoubleValue() * SGD_DEGREES_TO_RADIANS;
mach = mach * fabs(cos(alpha)) * cos(beta); double x_proj_factor = cos(alpha) * fabs(cos(beta)); // the factor to project the total speed vector on the longitudinal body axis
mach = std::max( mach , 0.0 ); // we want a mach=0 if the airflow comes from behind
double p_t = p * pow(1 + 0.2 * mach*mach, 3.5 ); // true total pressure around aircraft double p_t = p; // pitot tube stalled: total pressure = static pressure
_total_pressure_node->setDoubleValue(p_t); double p_t_meas = p;
double p_t_meas = p_t;
if ( x_proj_factor > _stall_factor ) { // NOTE: alpha: -180 - 180, beta: -90 - 90, pitot probe is stalled at more than 60 deg
p_t = p * pow(1 + 0.2 * mach*mach*x_proj_factor*x_proj_factor, 3.5 ); // total pressure in the pitot tube if not stalled
p_t_meas = p_t;
if (mach > 1) { if (mach > 1) {
p_t_meas = p * pow( 1.2 * mach*mach, 3.5 ) * pow( 2.8/2.4*mach*mach - 0.4 / 2.4 , -2.5 ); // measured total pressure by pitot tube (Rayleigh formula, at Mach>1, normal shockwave in front of pitot tube) p_t_meas = p * pow( 1.2 * mach*mach, 3.5 ) * pow( 2.8/2.4*mach*mach - 0.4 / 2.4 , -2.5 ); // measured total pressure by pitot tube (Rayleigh formula, at Mach>1, normal shockwave in front of pitot tube)
} }
}
_total_pressure_node->setDoubleValue(p_t);
_measured_total_pressure_node->setDoubleValue(p_t_meas); _measured_total_pressure_node->setDoubleValue(p_t_meas);
} }
} }

View file

@ -1,7 +1,7 @@
// pitot.hxx - the pitot air system. // pitot.hxx - the pitot air system.
// Written by David Megginson, started 2002. // Written by David Megginson, started 2002.
// //
// Last modified by Eric van den Berg, 24 Nov 2012 // Last modified by Eric van den Berg, 01 Nov 2013
// This file is in the Public Domain and comes with no warranty. // This file is in the Public Domain and comes with no warranty.
@ -55,6 +55,7 @@ private:
std::string _name; std::string _name;
int _num; int _num;
double _stall_factor;
SGPropertyNode_ptr _serviceable_node; SGPropertyNode_ptr _serviceable_node;
SGPropertyNode_ptr _pressure_node; SGPropertyNode_ptr _pressure_node;
SGPropertyNode_ptr _mach_node; SGPropertyNode_ptr _mach_node;