diff --git a/A320-main.xml b/A320-main.xml index 114488c6..10df1aaf 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -10,7 +10,7 @@ - it0uchpods Design Group: Joshua Davidson (it0uchpods), Jonathan Redpath (legoboyvdlp), Thorsten Herrmann (TH-555), Charlie Schwehm (Wecsje) + it0uchpods Design Group: Joshua Davidson (it0uchpods), Jonathan Redpath (legoboyvdlp), Thorsten Herrmann (TH-555) Pre V1.0 diff --git a/AircraftConfig/about.xml b/AircraftConfig/about.xml index 0c9c45b1..6b8d249c 100644 --- a/AircraftConfig/about.xml +++ b/AircraftConfig/about.xml @@ -43,7 +43,7 @@ left - + diff --git a/Nasal/FMGC-b.nas b/Nasal/FMGC-b.nas index c0520f30..22e9c84d 100644 --- a/Nasal/FMGC-b.nas +++ b/Nasal/FMGC-b.nas @@ -26,6 +26,19 @@ setlistener("/sim/signals/fdm-initialized", func { var FPangle = 0; var gear1 = getprop("/gear/gear[1]/wow"); var gear2 = getprop("/gear/gear[2]/wow"); + var gnds_mps = 0; + var current_course = 0; + var wp_fly_to = 0; + var next_course = 0; + var max_bank_limit = 0; + var delta_angle = 0; + var max_bank = 0; + var radius = 0; + var time = 0; + var delta_angle_rad = 0; + var R = 0; + var dist_coeff = 0; + var turn_dist = 0; }); var APinit = func { @@ -525,6 +538,10 @@ var trkfpa_on = func { } } +setlistener("/autopilot/route-manager/current-wp", func { + setprop("/autopilot/internal/wp-change-time", getprop("/sim/time/elapsed-sec")); +}); + var ap_various = func { trueSpeedKts = getprop("/instrumentation/airspeed-indicator/true-speed-kt"); if (trueSpeedKts > 420) { @@ -536,7 +553,35 @@ var ap_various = func { } if (getprop("/autopilot/route-manager/route/num") > 0 and getprop("/autopilot/route-manager/active") == 1) { - if (getprop("/autopilot/route-manager/wp/dist") <= getprop("/it-autoflight/internal/lnav-advance-nm")) { + gnds_mps = getprop("/velocities/groundspeed-kt") * 0.5144444444444; + current_course = getprop("/instrumentation/gps/wp/leg-true-course-deg"); + wp_fly_to = getprop("/autopilot/route-manager/current-wp") + 1; + if (wp_fly_to < 0) { + wp_fly_to = 0; + } + next_course = getprop("/autopilot/route-manager/route/wp["~wp_fly_to~"]/leg-bearing-true-deg"); + max_bank_limit = getprop("/it-autoflight/internal/bank-limit"); + + delta_angle = math.abs(geo.normdeg180(current_course - next_course)); + max_bank = delta_angle * 1.5; + if (max_bank > max_bank_limit) { + max_bank = max_bank_limit; + } + radius = (gnds_mps * gnds_mps) / (9.81 * math.tan(max_bank/57.2957795131)); + time = 0.64 * gnds_mps * delta_angle * 0.7 / (360 * math.tan(max_bank/57.2957795131)); + delta_angle_rad = (180 - delta_angle) / 114.5915590262; + R = radius/math.sin(delta_angle_rad); + dist_coeff = delta_angle * -0.011111 + 2; + if (dist_coeff < 1) { + ist_coeff = 1; + } + turn_dist = math.cos(delta_angle_rad) * R * dist_coeff / 1852; + setprop("/it-autoflight/internal/lnav-advance-nm", turn_dist); + if (getprop("/sim/time/elapsed-sec")-getprop("/autopilot/internal/wp-change-time") > 60) { + setprop("/autopilot/internal/wp-change-check-period", time); + } + + if (getprop("/autopilot/route-manager/wp/dist") <= turn_dist) { if ((getprop("/autopilot/route-manager/current-wp") + 1) < getprop("/autopilot/route-manager/route/num")) { setprop("/autopilot/route-manager/current-wp", getprop("/autopilot/route-manager/current-wp") + 1); } diff --git a/Systems/fmgc-drivers.xml b/Systems/fmgc-drivers.xml index 1a45c258..c65b8ec9 100644 --- a/Systems/fmgc-drivers.xml +++ b/Systems/fmgc-drivers.xml @@ -438,36 +438,6 @@ /instrumentation/pfd/track-deg - - LNAV ADVANCE - gain - 1.0 - - - - - /velocities/groundspeed-kt - 1201.0 - 4001.2 -
- - - - /autopilot/route-manager/wp[1]/true-bearing-deg - /autopilot/route-manager/wp[0]/true-bearing-deg - - - 300.0 - 701.0 -
-
-
- - /it-autoflight/internal/lnav-advance-nm - 1.0 - 5.0 -
- HEADING ERROR DEG false diff --git a/Systems/libraries.xml b/Systems/libraries.xml index 199a7977..1cbb5aed 100644 --- a/Systems/libraries.xml +++ b/Systems/libraries.xml @@ -11,7 +11,7 @@ Groundspeed Meters Per Second gain - 0.51444444444 + 0.5144444444444 /velocities/groundspeed-kt /velocities/groundspeed-mps 0 @@ -574,7 +574,7 @@ - velocities/uBody-fps + /velocities/uBody-fps 0.592484 @@ -589,11 +589,11 @@ 0.05 - fdm/jsbsim/inertia/weight-lbs + /fdm/jsbsim/inertia/weight-lbs 0.45359237 - fdm/jsbsim/inertia/weight-kg + /fdm/jsbsim/inertia/weight-kg