From 6fa1b3dfd0ae513c0851d27aa95126e1d355621c Mon Sep 17 00:00:00 2001 From: jmt Date: Tue, 8 Sep 2009 16:02:59 +0000 Subject: [PATCH] Add normalised glideslope deviation property to nav-radio. --- src/Instrumentation/navradio.cxx | 11 ++++++++++- src/Instrumentation/navradio.hxx | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Instrumentation/navradio.cxx b/src/Instrumentation/navradio.cxx index d270b98f1..5f10992e2 100644 --- a/src/Instrumentation/navradio.cxx +++ b/src/Instrumentation/navradio.cxx @@ -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; } diff --git a/src/Instrumentation/navradio.hxx b/src/Instrumentation/navradio.hxx index 6b55633e2..5b64f374a 100644 --- a/src/Instrumentation/navradio.hxx +++ b/src/Instrumentation/navradio.hxx @@ -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);