From ea281051d8f1d0c97e77cc5320b8b6a0a6ba45be Mon Sep 17 00:00:00 2001 From: curt Date: Mon, 14 Dec 2009 23:54:07 +0000 Subject: [PATCH] Compute glide slope target rate of climb in fpm as well as fps. --- src/Instrumentation/navradio.cxx | 9 ++++++++- src/Instrumentation/navradio.hxx | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Instrumentation/navradio.cxx b/src/Instrumentation/navradio.cxx index a3de3a8b2..b9a5fa0fa 100644 --- a/src/Instrumentation/navradio.cxx +++ b/src/Instrumentation/navradio.cxx @@ -131,6 +131,7 @@ FGNavRadio::FGNavRadio(SGPropertyNode *node) : gs_deflection_deg_node(NULL), gs_deflection_norm_node(NULL), gs_rate_of_climb_node(NULL), + gs_rate_of_climb_fpm_node(NULL), gs_dist_node(NULL), gs_inrange_node(NULL), nav_id_node(NULL), @@ -249,6 +250,7 @@ FGNavRadio::init () gs_deflection_deg_node = node->getChild("gs-needle-deflection-deg", 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_rate_of_climb_fpm_node = node->getChild("gs-rate-of-climb-fpm", 0, true); gs_dist_node = node->getChild("gs-distance", 0, true); gs_inrange_node = node->getChild("gs-in-range", 0, true); @@ -625,17 +627,22 @@ void FGNavRadio::updateGlideSlope(double dt, const SGVec3d& aircraft, double sig double gs_diff = target_gs - angle; // convert desired vertical path angle into a climb rate double des_angle = angle - 10 * gs_diff; + /* printf("target_gs=%.1f angle=%.1f gs_diff=%.1f des_angle=%.1f\n", + target_gs, angle, gs_diff, des_angle); */ // estimate horizontal speed towards ILS in meters per minute double elapsedDistance = last_x - gsDist; last_x = gsDist; double new_vel = ( elapsedDistance / dt ); - horiz_vel = 0.75 * horiz_vel + 0.25 * new_vel; + horiz_vel = 0.99 * horiz_vel + 0.01 * new_vel; + /* printf("vel=%.1f (dist=%.1f dt=%.2f)\n", horiz_vel, elapsedDistance, dt);*/ gs_rate_of_climb_node ->setDoubleValue( -sin( des_angle * SGD_DEGREES_TO_RADIANS ) * horiz_vel * SG_METER_TO_FEET ); + gs_rate_of_climb_fpm_node + ->setDoubleValue( gs_rate_of_climb_node->getDoubleValue() * 60 ); } void FGNavRadio::updateDME(const SGVec3d& aircraft) diff --git a/src/Instrumentation/navradio.hxx b/src/Instrumentation/navradio.hxx index c3d38f86a..84e877abe 100644 --- a/src/Instrumentation/navradio.hxx +++ b/src/Instrumentation/navradio.hxx @@ -101,6 +101,7 @@ class FGNavRadio : public SGSubsystem SGPropertyNode_ptr gs_deflection_deg_node; SGPropertyNode_ptr gs_deflection_norm_node; SGPropertyNode_ptr gs_rate_of_climb_node; + SGPropertyNode_ptr gs_rate_of_climb_fpm_node; SGPropertyNode_ptr gs_dist_node; SGPropertyNode_ptr gs_inrange_node; SGPropertyNode_ptr nav_id_node;