Add a "signed" distance to the GS transmitter. When you are in the approach
hemisphere the distance is positive, if you are in the departure hemisphere the distance is negature. (Possible use for graphing approach distance vs. glide slope or cdi.)
This commit is contained in:
parent
44c16f986d
commit
29a3525869
3 changed files with 28 additions and 4 deletions
|
@ -323,12 +323,33 @@ FGNavCom::update(double dt)
|
||||||
if ( nav_has_gs ) {
|
if ( nav_has_gs ) {
|
||||||
station = Point3D( nav_gs_x, nav_gs_y, nav_gs_z );
|
station = Point3D( nav_gs_x, nav_gs_y, nav_gs_z );
|
||||||
nav_gs_dist = aircraft.distance3D( station );
|
nav_gs_dist = aircraft.distance3D( station );
|
||||||
|
// wgs84 heading to glide slope
|
||||||
|
geo_inverse_wgs_84( elev,
|
||||||
|
lat * SGD_RADIANS_TO_DEGREES,
|
||||||
|
lon * SGD_RADIANS_TO_DEGREES,
|
||||||
|
nav_gslat, nav_gslon,
|
||||||
|
&az1, &az2, &s );
|
||||||
|
double r = az1 - nav_radial;
|
||||||
|
while ( r > 180.0 ) { r -= 360.0;}
|
||||||
|
while ( r < -180.0 ) { r += 360.0;}
|
||||||
|
if ( r >= -90.0 && r <= 90.0 ) {
|
||||||
|
nav_gs_dist_signed = nav_gs_dist;
|
||||||
|
} else {
|
||||||
|
nav_gs_dist_signed = -nav_gs_dist;
|
||||||
|
}
|
||||||
|
/* cout << "Target Radial = " << nav_radial
|
||||||
|
<< " Bearing = " << az1
|
||||||
|
<< " dist (signed) = " << nav_gs_dist_signed
|
||||||
|
<< endl; */
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
nav_gs_dist = 0.0;
|
nav_gs_dist = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// wgs84 heading
|
// wgs84 heading to localizer
|
||||||
geo_inverse_wgs_84( elev, lat * SGD_RADIANS_TO_DEGREES, lon * SGD_RADIANS_TO_DEGREES,
|
geo_inverse_wgs_84( elev,
|
||||||
|
lat * SGD_RADIANS_TO_DEGREES,
|
||||||
|
lon * SGD_RADIANS_TO_DEGREES,
|
||||||
nav_loclat, nav_loclon,
|
nav_loclat, nav_loclon,
|
||||||
&az1, &az2, &s );
|
&az1, &az2, &s );
|
||||||
// cout << "az1 = " << az1 << " magvar = " << nav_magvar << endl;
|
// cout << "az1 = " << az1 << " magvar = " << nav_magvar << endl;
|
||||||
|
|
|
@ -103,6 +103,7 @@ class FGNavCom : public FGSubsystem
|
||||||
double nav_gs_y;
|
double nav_gs_y;
|
||||||
double nav_gs_z;
|
double nav_gs_z;
|
||||||
double nav_gs_dist;
|
double nav_gs_dist;
|
||||||
|
double nav_gs_dist_signed;
|
||||||
SGTimeStamp prev_time;
|
SGTimeStamp prev_time;
|
||||||
SGTimeStamp curr_time;
|
SGTimeStamp curr_time;
|
||||||
double nav_elev;
|
double nav_elev;
|
||||||
|
@ -208,6 +209,7 @@ public:
|
||||||
inline double get_nav_gslon() const { return nav_gslon; }
|
inline double get_nav_gslon() const { return nav_gslon; }
|
||||||
inline double get_nav_gslat() const { return nav_gslat; }
|
inline double get_nav_gslat() const { return nav_gslat; }
|
||||||
inline double get_nav_gs_dist() const { return nav_gs_dist; }
|
inline double get_nav_gs_dist() const { return nav_gs_dist; }
|
||||||
|
inline double get_nav_gs_dist_signed() const { return nav_gs_dist_signed; }
|
||||||
inline double get_nav_elev() const { return nav_elev; }
|
inline double get_nav_elev() const { return nav_elev; }
|
||||||
inline double get_nav_heading() const { return nav_heading; }
|
inline double get_nav_heading() const { return nav_heading; }
|
||||||
inline double get_nav_radial() const { return nav_radial; }
|
inline double get_nav_radial() const { return nav_radial; }
|
||||||
|
|
|
@ -154,8 +154,9 @@ void FGProps2NetGUI( FGNetGUI *net ) {
|
||||||
|
|
||||||
if ( current_radiostack->get_navcom1()->get_nav_loc() ) {
|
if ( current_radiostack->get_navcom1()->get_nav_loc() ) {
|
||||||
// is an ILS
|
// is an ILS
|
||||||
net->dist_nm = current_radiostack->get_navcom1()->get_nav_gs_dist()
|
net->dist_nm
|
||||||
* SG_METER_TO_NM;
|
= current_radiostack->get_navcom1()->get_nav_gs_dist_signed()
|
||||||
|
* SG_METER_TO_NM;
|
||||||
} else {
|
} else {
|
||||||
// is a VOR
|
// is a VOR
|
||||||
net->dist_nm = current_radiostack->get_navcom1()->get_nav_loc_dist()
|
net->dist_nm = current_radiostack->get_navcom1()->get_nav_loc_dist()
|
||||||
|
|
Loading…
Reference in a new issue