+ net->ground_elev = fdm_state->get_Runway_altitude_m();
+
+ // Approach
+ net->tuned_freq = nav_freq->getDoubleValue();
+ net->nav_radial = nav_target_radial->getDoubleValue();
+ net->in_range = nav_inrange->getBoolValue();
+
+ if ( nav_loc->getBoolValue() ) {
+ // is an ILS
+ net->dist_nm
+ = nav_gs_dist_signed->getDoubleValue()
+ * SG_METER_TO_NM;
+ } else {
+ // is a VOR
+ net->dist_nm = nav_loc_dist->getDoubleValue()
+ * SG_METER_TO_NM;
+ }
+
+ net->course_deviation_deg
+ = nav_reciprocal_radial->getDoubleValue()
+ - nav_target_radial->getDoubleValue();
+
+ if ( net->course_deviation_deg < -1000.0
+ || net->course_deviation_deg > 1000.0 )
+ {
+ // Sanity check ...
+ net->course_deviation_deg = 0.0;
+ }
+ while ( net->course_deviation_deg > 180.0 ) {
+ net->course_deviation_deg -= 360.0;
+ }
+ while ( net->course_deviation_deg < -180.0 ) {
+ net->course_deviation_deg += 360.0;
+ }
+ if ( fabs(net->course_deviation_deg) > 90.0 )
+ net->course_deviation_deg
+ = ( net->course_deviation_deg<0.0
+ ? -net->course_deviation_deg - 180.0
+ : -net->course_deviation_deg + 180.0 );
+
+ if ( nav_loc->getBoolValue() ) {
+ // is an ILS
+ net->gs_deviation_deg
+ = nav_gs_deflection->getDoubleValue()
+ / 5.0;
+ } else {
+ // is an ILS
+ net->gs_deviation_deg = -9999.0;
+ }