1
0
Fork 0

Compute glide slope target rate of climb in fpm as well as fps.

This commit is contained in:
curt 2009-12-14 23:54:07 +00:00 committed by Tim Moore
parent 6fcd9f967b
commit ea281051d8
2 changed files with 9 additions and 1 deletions

View file

@ -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)

View file

@ -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;