Added magvar offset to VOR's.
This commit is contained in:
parent
519996f34d
commit
51898e3a14
4 changed files with 17 additions and 17 deletions
|
@ -303,14 +303,11 @@ int FGAutopilot::run() {
|
||||||
} else if ( heading_mode == FG_HEADING_NAV1 ) {
|
} else if ( heading_mode == FG_HEADING_NAV1 ) {
|
||||||
double tgt_radial;
|
double tgt_radial;
|
||||||
double cur_radial;
|
double cur_radial;
|
||||||
if ( current_radiostack->get_nav1_loc() ) {
|
tgt_radial = current_radiostack->get_nav1_radial()
|
||||||
tgt_radial = current_radiostack->get_nav1_radial() + 180.0;
|
+ FGBFI::getMagVar();
|
||||||
} else {
|
|
||||||
tgt_radial = current_radiostack->get_nav1_radial();
|
|
||||||
}
|
|
||||||
cur_radial = current_radiostack->get_nav1_heading();
|
cur_radial = current_radiostack->get_nav1_heading();
|
||||||
cout << "target rad = " << tgt_radial
|
cout << "target rad (true) = " << tgt_radial
|
||||||
<< " current rad = " << cur_radial
|
<< " current rad (true) = " << cur_radial
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
double diff = (tgt_radial - cur_radial);
|
double diff = (tgt_radial - cur_radial);
|
||||||
|
@ -324,7 +321,7 @@ int FGAutopilot::run() {
|
||||||
TargetHeading = cur_radial - diff;
|
TargetHeading = cur_radial - diff;
|
||||||
while ( TargetHeading < 0.0 ) { TargetHeading += 360.0; }
|
while ( TargetHeading < 0.0 ) { TargetHeading += 360.0; }
|
||||||
while ( TargetHeading > 360.0 ) { TargetHeading -= 360.0; }
|
while ( TargetHeading > 360.0 ) { TargetHeading -= 360.0; }
|
||||||
cout << "target course = " << TargetHeading << endl;
|
cout << "target course (true) = " << TargetHeading << endl;
|
||||||
} else if ( heading_mode == FG_HEADING_WAYPOINT ) {
|
} else if ( heading_mode == FG_HEADING_WAYPOINT ) {
|
||||||
// update target heading to waypoint
|
// update target heading to waypoint
|
||||||
|
|
||||||
|
|
|
@ -338,7 +338,7 @@ double FGSteam::get_HackGS_deg () {
|
||||||
double y = (FGBFI::getAltitude() - current_radiostack->get_nav1_elev())
|
double y = (FGBFI::getAltitude() - current_radiostack->get_nav1_elev())
|
||||||
* FEET_TO_METER;
|
* FEET_TO_METER;
|
||||||
double angle = atan2( y, x ) * RAD_TO_DEG;
|
double angle = atan2( y, x ) * RAD_TO_DEG;
|
||||||
return current_radiostack->get_nav1_target_gs() - angle;
|
return (current_radiostack->get_nav1_target_gs() - angle) * 5.0;
|
||||||
} else {
|
} else {
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
@ -349,8 +349,8 @@ double FGSteam::get_HackVOR1_deg () {
|
||||||
double r;
|
double r;
|
||||||
|
|
||||||
if ( current_radiostack->get_nav1_inrange() ) {
|
if ( current_radiostack->get_nav1_inrange() ) {
|
||||||
r = current_radiostack->get_nav1_heading() -
|
r = current_radiostack->get_nav1_heading() - FGBFI::getMagVar()
|
||||||
current_radiostack->get_nav1_radial();
|
- current_radiostack->get_nav1_radial();
|
||||||
// cout << "Radial = " << current_radiostack->get_nav1_radial()
|
// cout << "Radial = " << current_radiostack->get_nav1_radial()
|
||||||
// << " Bearing = " << current_radiostack->get_nav1_heading()
|
// << " Bearing = " << current_radiostack->get_nav1_heading()
|
||||||
// << endl;
|
// << endl;
|
||||||
|
@ -359,7 +359,7 @@ double FGSteam::get_HackVOR1_deg () {
|
||||||
if (r<-180.0) r+=360.0;
|
if (r<-180.0) r+=360.0;
|
||||||
if ( fabs(r) > 90.0 )
|
if ( fabs(r) > 90.0 )
|
||||||
r = ( r<0.0 ? -r-180.0 : -r+180.0 );
|
r = ( r<0.0 ? -r-180.0 : -r+180.0 );
|
||||||
if ( current_radiostack->get_nav1_loc() ) r *= -5.0;
|
if ( current_radiostack->get_nav1_loc() ) r *= 5.0;
|
||||||
} else {
|
} else {
|
||||||
r = 0.0;
|
r = 0.0;
|
||||||
}
|
}
|
||||||
|
@ -372,8 +372,8 @@ double FGSteam::get_HackVOR2_deg () {
|
||||||
double r;
|
double r;
|
||||||
|
|
||||||
if ( current_radiostack->get_nav2_inrange() ) {
|
if ( current_radiostack->get_nav2_inrange() ) {
|
||||||
r = current_radiostack->get_nav2_radial() -
|
r = current_radiostack->get_nav2_heading() - FGBFI::getMagVar()
|
||||||
current_radiostack->get_nav2_heading() + 180.0;
|
- current_radiostack->get_nav2_radial();
|
||||||
// cout << "Radial = " << current_radiostack->get_nav1_radial()
|
// cout << "Radial = " << current_radiostack->get_nav1_radial()
|
||||||
// << " Bearing = " << current_radiostack->get_nav1_heading() << endl;
|
// << " Bearing = " << current_radiostack->get_nav1_heading() << endl;
|
||||||
|
|
||||||
|
@ -403,7 +403,7 @@ double FGSteam::get_HackADF_deg () {
|
||||||
double r;
|
double r;
|
||||||
|
|
||||||
if ( current_radiostack->get_adf_inrange() ) {
|
if ( current_radiostack->get_adf_inrange() ) {
|
||||||
r = current_radiostack->get_adf_heading() - FGBFI::getHeading() + 180.0;
|
r = current_radiostack->get_adf_heading() - FGBFI::getHeading();
|
||||||
|
|
||||||
// cout << "Radial = " << current_radiostack->get_adf_heading()
|
// cout << "Radial = " << current_radiostack->get_adf_heading()
|
||||||
// << " Heading = " << FGBFI::getHeading() << endl;
|
// << " Heading = " << FGBFI::getHeading() << endl;
|
||||||
|
|
|
@ -401,6 +401,9 @@ void FGTime::update( double lon, double lat, double alt_m ) {
|
||||||
magvar = SGMagVar( lat, lon, alt_m / 1000.0, (long)jd, field );
|
magvar = SGMagVar( lat, lon, alt_m / 1000.0, (long)jd, field );
|
||||||
magdip = atan(field[5]/sqrt(field[3]*field[3]+field[4]*field[4]));
|
magdip = atan(field[5]/sqrt(field[3]*field[3]+field[4]*field[4]));
|
||||||
|
|
||||||
|
FG_LOG( FG_EVENT, FG_DEBUG,
|
||||||
|
" Current magvar = " << magvar );
|
||||||
|
|
||||||
FG_LOG( FG_EVENT, FG_DEBUG,
|
FG_LOG( FG_EVENT, FG_DEBUG,
|
||||||
" Current lon=0.00 Sidereal Time = " << gst );
|
" Current lon=0.00 Sidereal Time = " << gst );
|
||||||
FG_LOG( FG_EVENT, FG_DEBUG,
|
FG_LOG( FG_EVENT, FG_DEBUG,
|
||||||
|
|
Loading…
Reference in a new issue