1
0
Fork 0

Add normalised glideslope deviation property to nav-radio.

This commit is contained in:
jmt 2009-09-08 16:02:59 +00:00 committed by Tim Moore
parent e2f0d1960e
commit 6fa1b3dfd0
2 changed files with 12 additions and 1 deletions

View file

@ -80,6 +80,7 @@ FGNavRadio::FGNavRadio(SGPropertyNode *node) :
loc_node(NULL),
loc_dist_node(NULL),
gs_deflection_node(NULL),
gs_deflection_norm_node(NULL),
gs_rate_of_climb_node(NULL),
gs_dist_node(NULL),
nav_id_node(NULL),
@ -188,6 +189,7 @@ FGNavRadio::init ()
loc_node = node->getChild("nav-loc", 0, true);
loc_dist_node = node->getChild("nav-distance", 0, true);
gs_deflection_node = node->getChild("gs-needle-deflection", 0, true);
gs_deflection_norm_node = node->getChild("gs-needle-deflection-norm", 0, true);
gs_rate_of_climb_node = node->getChild("gs-rate-of-climb", 0, true);
gs_dist_node = node->getChild("gs-distance", 0, true);
nav_id_node = node->getChild("nav-id", 0, true);
@ -337,6 +339,8 @@ void FGNavRadio::clearOutputs()
cdi_xtrack_hdg_err_node->setDoubleValue( 0.0 );
time_to_intercept->setDoubleValue( 0.0 );
gs_deflection_node->setDoubleValue( 0.0 );
gs_deflection_norm_node->setDoubleValue(0.0);
to_flag_node->setBoolValue( false );
from_flag_node->setBoolValue( false );
}
@ -356,6 +360,7 @@ void FGNavRadio::updateReceiver(double dt)
_cdiCrossTrackErrorM = 0.0;
_toFlag = _fromFlag = false;
_gsNeedleDeflection = 0.0;
_gsNeedleDeflectionNorm = 0.0;
inrange_node->setBoolValue(false);
return;
}
@ -508,6 +513,8 @@ void FGNavRadio::updateGlideSlope(double dt, const SGVec3d& aircraft, double sig
//SG_CLAMP_RANGE(deflectionAngle, -0.7, 0.7);
_gsNeedleDeflection = deflectionAngle * 5.0;
_gsNeedleDeflection *= signal_quality_norm;
_gsNeedleDeflectionNorm = (deflectionAngle / 0.7) * signal_quality_norm;
SG_CLAMP_RANGE(_gsNeedleDeflectionNorm, -1.0, 1.0);
//////////////////////////////////////////////////////////
// Calculate desired rate of climb for intercepting the GS
@ -634,9 +641,11 @@ void FGNavRadio::updateCDI(double dt)
if (!gs_serviceable_node->getBoolValue() ) {
_gsNeedleDeflection = 0.0;
_gsNeedleDeflectionNorm = 0.0;
}
gs_deflection_node->setDoubleValue(_gsNeedleDeflection);
gs_deflection_norm_node->setDoubleValue(_gsNeedleDeflectionNorm);
last_xtrack_error = _cdiCrossTrackErrorM;
}

View file

@ -96,6 +96,7 @@ class FGNavRadio : public SGSubsystem
SGPropertyNode_ptr loc_node;
SGPropertyNode_ptr loc_dist_node;
SGPropertyNode_ptr gs_deflection_node;
SGPropertyNode_ptr gs_deflection_norm_node;
SGPropertyNode_ptr gs_rate_of_climb_node;
SGPropertyNode_ptr gs_dist_node;
SGPropertyNode_ptr nav_id_node;
@ -145,6 +146,7 @@ class FGNavRadio : public SGSubsystem
double _cdiDeflection;
double _cdiCrossTrackErrorM;
double _gsNeedleDeflection;
double _gsNeedleDeflectionNorm;
bool updateWithPower(double aDt);