1
0
Fork 0

Fix inconsistent NAV receiver gs-inrange behaviour.

Make sure gs-inrange and deflection outputs have same behaviour, no matter
which out-of-range condition applies (i.e. aircraft moved out of range,
frequency changed, ...).
This commit is contained in:
ThorstenB 2012-06-08 13:28:08 +02:00
parent 805c4cbba1
commit db09e11ba0

View file

@ -453,6 +453,8 @@ void FGNavRadio::updateReceiver(double dt)
heading_node->setDoubleValue(0.0); heading_node->setDoubleValue(0.0);
inrange_node->setBoolValue(false); inrange_node->setBoolValue(false);
signal_quality_norm_node->setDoubleValue(0.0); signal_quality_norm_node->setDoubleValue(0.0);
gs_dist_node->setDoubleValue( 0.0 );
gs_inrange_node->setBoolValue(false);
return; return;
} }
@ -578,7 +580,7 @@ void FGNavRadio::updateReceiver(double dt)
SG_CLAMP_RANGE(_cdiDeflection, -10.0, 10.0 ); SG_CLAMP_RANGE(_cdiDeflection, -10.0, 10.0 );
_cdiDeflection *= signal_quality_norm; _cdiDeflection *= signal_quality_norm;
// cross-track error (in metres) // cross-track error (in meters)
_cdiCrossTrackErrorM = loc_dist * sin(r * SGD_DEGREES_TO_RADIANS); _cdiCrossTrackErrorM = loc_dist * sin(r * SGD_DEGREES_TO_RADIANS);
updateGlideSlope(dt, aircraft, signal_quality_norm); updateGlideSlope(dt, aircraft, signal_quality_norm);
@ -586,22 +588,25 @@ void FGNavRadio::updateReceiver(double dt)
void FGNavRadio::updateGlideSlope(double dt, const SGVec3d& aircraft, double signal_quality_norm) void FGNavRadio::updateGlideSlope(double dt, const SGVec3d& aircraft, double signal_quality_norm)
{ {
_gsNeedleDeflection = 0.0; bool gsInRange = (_gs && inrange_node->getBoolValue());
if (!_gs || !inrange_node->getBoolValue()) { double gsDist = 0;
gs_dist_node->setDoubleValue( 0.0 );
gs_inrange_node->setBoolValue(false); if (gsInRange)
{
gsDist = dist(aircraft, _gsCart);
gsInRange = (gsDist < (_gs->get_range() * SG_NM_TO_METER));
}
gs_inrange_node->setBoolValue(gsInRange);
gs_dist_node->setDoubleValue( gsDist );
if (!gsInRange)
{
_gsNeedleDeflection = 0.0; _gsNeedleDeflection = 0.0;
_gsNeedleDeflectionNorm = 0.0; _gsNeedleDeflectionNorm = 0.0;
return; return;
} }
double gsDist = dist(aircraft, _gsCart);
gs_dist_node->setDoubleValue(gsDist);
bool gsInRange = (gsDist < (_gs->get_range() * SG_NM_TO_METER));
gs_inrange_node->setBoolValue(gsInRange);
if (!gsInRange) return;
SGVec3d pos = aircraft - _gsCart; // relative vector from gs antenna to aircraft SGVec3d pos = aircraft - _gsCart; // relative vector from gs antenna to aircraft
// The positive GS axis points along the runway in the landing direction, // The positive GS axis points along the runway in the landing direction,
// toward the far end, not toward the approach area, so we need a - sign here: // toward the far end, not toward the approach area, so we need a - sign here: