Often, the elevation of an ILS component is not listed in our nav database.
A good elevation is critical for proper glide slope modeling. This patch assigns the average field elevation to any ILS component that doesn't have a valid elevation. Also, for an ILS approach, use the GS transmitter elevation for glide slope calculations rather than the localizer elevation, in some cases this can make a big difference.
This commit is contained in:
parent
a01bbf5a28
commit
225298a09e
8 changed files with 34 additions and 9 deletions
|
@ -122,7 +122,6 @@ FGAirportList::FGAirportList( const string &airport_file,
|
|||
|
||||
// search for the specified id
|
||||
FGAirport FGAirportList::search( const string& id) {
|
||||
|
||||
return airports_by_id[id];
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,6 @@ SG_USING_STD(vector);
|
|||
|
||||
|
||||
struct FGAirport {
|
||||
|
||||
string id;
|
||||
double longitude;
|
||||
double latitude;
|
||||
|
|
|
@ -627,6 +627,7 @@ void FGNavCom::search()
|
|||
if ( nav_has_gs ) {
|
||||
nav_gslon = gs->get_lon();
|
||||
nav_gslat = gs->get_lat();
|
||||
nav_elev = gs->get_elev_ft();
|
||||
int tmp = (int)(gs->get_multiuse() / 1000.0);
|
||||
nav_target_gs = (double)tmp / 100.0;
|
||||
nav_gs_x = gs->get_x();
|
||||
|
@ -643,7 +644,8 @@ void FGNavCom::search()
|
|||
// << endl;
|
||||
Point3D p1 = sgGeodToCart( Point3D(tlon*SGD_DEGREES_TO_RADIANS,
|
||||
tlat*SGD_DEGREES_TO_RADIANS,
|
||||
nav_elev*SG_FEET_TO_METER) );
|
||||
nav_elev*SG_FEET_TO_METER)
|
||||
);
|
||||
// cout << nav_gs_x << "," << nav_gs_y << "," << nav_gs_z
|
||||
// << endl;
|
||||
// cout << p1 << endl;
|
||||
|
@ -651,10 +653,11 @@ void FGNavCom::search()
|
|||
p1.x()-nav_gs_x, p1.y()-nav_gs_y, p1.z()-nav_gs_z );
|
||||
// cout << gs_base_vec[0] << "," << gs_base_vec[1] << ","
|
||||
// << gs_base_vec[2] << endl;
|
||||
} else {
|
||||
nav_elev = loc->get_elev_ft();
|
||||
}
|
||||
nav_loclon = loc->get_lon();
|
||||
nav_loclat = loc->get_lat();
|
||||
nav_elev = loc->get_elev_ft();
|
||||
nav_twist = 0;
|
||||
nav_range = FG_LOC_DEFAULT_RANGE;
|
||||
nav_effective_range = nav_range;
|
||||
|
|
|
@ -105,6 +105,7 @@ class FGNavCom : public SGSubsystem
|
|||
double nav_loc_dist;
|
||||
double nav_gslon;
|
||||
double nav_gslat;
|
||||
double nav_elev; // use gs elev if available
|
||||
double nav_gs_x;
|
||||
double nav_gs_y;
|
||||
double nav_gs_z;
|
||||
|
@ -114,7 +115,6 @@ class FGNavCom : public SGSubsystem
|
|||
double nav_gs_rate_of_climb;
|
||||
SGTimeStamp prev_time;
|
||||
SGTimeStamp curr_time;
|
||||
double nav_elev;
|
||||
double nav_range;
|
||||
double nav_effective_range;
|
||||
double nav_target_gs;
|
||||
|
|
|
@ -1058,7 +1058,7 @@ fgInitNav ()
|
|||
globals->set_dmelist( dmelist );
|
||||
globals->set_mkrlist( mkrlist );
|
||||
|
||||
if ( !fgNavDBInit( navlist, loclist, gslist, dmelist, mkrlist ) ) {
|
||||
if ( !fgNavDBInit(airports, navlist, loclist, gslist, dmelist, mkrlist) ) {
|
||||
SG_LOG( SG_GENERAL, SG_ALERT,
|
||||
"Problems loading one or more navigational database" );
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <simgear/debug/logstream.hxx>
|
||||
|
||||
#include <Airports/runways.hxx>
|
||||
#include <Airports/simple.hxx>
|
||||
#include <Main/globals.hxx>
|
||||
|
||||
#include "navrecord.hxx"
|
||||
|
@ -37,7 +38,8 @@ SG_USING_STD( string );
|
|||
|
||||
|
||||
// load and initialize the navigational databases
|
||||
bool fgNavDBInit( FGNavList *navlist, FGNavList *loclist, FGNavList *gslist,
|
||||
bool fgNavDBInit( FGAirportList *airports,
|
||||
FGNavList *navlist, FGNavList *loclist, FGNavList *gslist,
|
||||
FGNavList *dmelist, FGNavList *mkrlist )
|
||||
{
|
||||
SG_LOG(SG_GENERAL, SG_INFO, "Loading Navaid Databases");
|
||||
|
@ -89,6 +91,17 @@ bool fgNavDBInit( FGNavList *navlist, FGNavList *loclist, FGNavList *gslist,
|
|||
cout << " freq = " << n.get_freq() << endl;
|
||||
cout << " range = " << n.get_range() << endl << endl; */
|
||||
|
||||
// fudge elevation to the field elevation if it's not specified
|
||||
if ( fabs(r->get_elev_ft()) < 0.01 && r->get_apt_id().length() ) {
|
||||
// cout << r->get_type() << " " << r->get_apt_id() << " zero elev"
|
||||
// << endl;
|
||||
FGAirport a = airports->search( r->get_apt_id() );
|
||||
if ( a.id == r->get_apt_id() ) {
|
||||
r->set_elev_ft( a.elevation );
|
||||
// cout << " setting to " << a.elevation << endl;
|
||||
}
|
||||
}
|
||||
|
||||
if ( r->get_type() == 2 || r->get_type() == 3 ) {
|
||||
// NDB=2, VOR=3
|
||||
navlist->add( r );
|
||||
|
|
|
@ -41,7 +41,8 @@
|
|||
|
||||
|
||||
// load and initialize the navigational databases
|
||||
bool fgNavDBInit( FGNavList *navlist, FGNavList *loclist, FGNavList *gslist,
|
||||
bool fgNavDBInit( FGAirportList *airports,
|
||||
FGNavList *navlist, FGNavList *loclist, FGNavList *gslist,
|
||||
FGNavList *dmelist, FGNavList *mkrbeacons );
|
||||
|
||||
|
||||
|
|
|
@ -61,7 +61,8 @@ class FGNavRecord {
|
|||
// (degrees) or dme bias (nm)
|
||||
|
||||
string ident; // navaid ident
|
||||
string name; // "given" name
|
||||
string name; // verbose name in nav database
|
||||
string apt_id; // corresponding airport id
|
||||
|
||||
|
||||
bool serviceable; // for failure modeling
|
||||
|
@ -78,6 +79,7 @@ public:
|
|||
inline double get_lat() const { return lat; }
|
||||
inline void set_lat( double l ) { lat = l; }
|
||||
inline double get_elev_ft() const { return elev_ft; }
|
||||
inline void set_elev_ft( double e ) { elev_ft = e; }
|
||||
inline double get_x() const { return x; }
|
||||
inline double get_y() const { return y; }
|
||||
inline double get_z() const { return z; }
|
||||
|
@ -87,6 +89,7 @@ public:
|
|||
inline void set_multiuse( double m ) { multiuse = m; }
|
||||
inline const char *get_ident() { return ident.c_str(); }
|
||||
inline string get_name() { return name; }
|
||||
inline string get_apt_id() { return apt_id; }
|
||||
inline bool get_serviceable() { return serviceable; }
|
||||
inline const char *get_trans_ident() { return trans_ident.c_str(); }
|
||||
|
||||
|
@ -105,6 +108,7 @@ FGNavRecord::FGNavRecord(void) :
|
|||
multiuse(0.0),
|
||||
ident(""),
|
||||
name(""),
|
||||
apt_id(""),
|
||||
serviceable(true),
|
||||
trans_ident("")
|
||||
{
|
||||
|
@ -135,6 +139,12 @@ operator >> ( istream& in, FGNavRecord& n )
|
|||
n.name = n.name.erase(0,1);
|
||||
}
|
||||
|
||||
if ( n.type >= 4 && n.type <= 9 ) {
|
||||
// these types are always associated with an airport id
|
||||
string::size_type pos = n.name.find(" ");
|
||||
n.apt_id = n.name.substr(0, pos);
|
||||
}
|
||||
|
||||
// assign default ranges
|
||||
if ( n.type == 2 || n.type == 3 ) {
|
||||
n.range = FG_NAV_DEFAULT_RANGE;
|
||||
|
|
Loading…
Add table
Reference in a new issue