1
0
Fork 0

pitot adapted to /velocities/mach being the mach norm

This commit is contained in:
janodesbois 2013-10-31 22:29:47 +01:00
parent d83bc90ca0
commit 636b6ca767
2 changed files with 8 additions and 1 deletions

View file

@ -37,6 +37,8 @@ PitotSystem::init ()
_serviceable_node = node->getChild("serviceable", 0, true); _serviceable_node = node->getChild("serviceable", 0, true);
_pressure_node = fgGetNode("/environment/pressure-inhg", true); _pressure_node = fgGetNode("/environment/pressure-inhg", true);
_mach_node = fgGetNode("/velocities/mach", true); _mach_node = fgGetNode("/velocities/mach", true);
_alpha_deg_node = fgGetNode("/orientation/alpha-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);
} }
@ -57,7 +59,10 @@ PitotSystem::update (double dt)
if (_serviceable_node->getBoolValue()) { if (_serviceable_node->getBoolValue()) {
double p = _pressure_node->getDoubleValue(); double p = _pressure_node->getDoubleValue();
double mach = _mach_node->getDoubleValue(); double mach = _mach_node->getDoubleValue();
mach = std::max( mach , 0.0 ); double alpha = _alpha_deg_node->getDoubleValue() * SGD_DEGREES_TO_RADIANS;
double beta = _beta_deg_node->getDoubleValue() * SGD_DEGREES_TO_RADIANS;
mach = mach * fabs(cos(alpha)) * cos(beta);
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 * pow(1 + 0.2 * mach*mach, 3.5 ); // true total pressure around aircraft
_total_pressure_node->setDoubleValue(p_t); _total_pressure_node->setDoubleValue(p_t);
double p_t_meas = p_t; double p_t_meas = p_t;

View file

@ -60,6 +60,8 @@ private:
SGPropertyNode_ptr _mach_node; SGPropertyNode_ptr _mach_node;
SGPropertyNode_ptr _total_pressure_node; SGPropertyNode_ptr _total_pressure_node;
SGPropertyNode_ptr _measured_total_pressure_node; SGPropertyNode_ptr _measured_total_pressure_node;
SGPropertyNode_ptr _alpha_deg_node;
SGPropertyNode_ptr _beta_deg_node;
}; };
#endif // __SYSTEMS_PITOT_HXX #endif // __SYSTEMS_PITOT_HXX