A3XX: Fix FMGC Nasal error, #111

This commit is contained in:
Joshua Davidson 2017-12-20 15:25:00 -05:00
parent 7c3f34407a
commit 3fec10bca0
2 changed files with 37 additions and 37 deletions

View file

@ -555,43 +555,43 @@ var ap_various = func {
}
if (getprop("/autopilot/route-manager/route/num") > 0 and getprop("/autopilot/route-manager/active") == 1) {
gnds_mps = getprop("/velocities/groundspeed-kt") * 0.5144444444444;
wp_fly_from = getprop("/autopilot/route-manager/current-wp");
if (wp_fly_from < 0) {
wp_fly_from = 0;
}
current_course = getprop("/autopilot/route-manager/route/wp[" ~ wp_fly_from ~ "]/leg-bearing-true-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");
if ((getprop("/autopilot/route-manager/current-wp") + 1) < getprop("/autopilot/route-manager/route/num")) {
gnds_mps = getprop("/velocities/groundspeed-kt") * 0.5144444444444;
wp_fly_from = getprop("/autopilot/route-manager/current-wp");
if (wp_fly_from < 0) {
wp_fly_from = 0;
}
current_course = getprop("/autopilot/route-manager/route/wp[" ~ wp_fly_from ~ "]/leg-bearing-true-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) {
dist_coeff = 1;
}
turn_dist = math.cos(delta_angle_rad) * R * dist_coeff / 1852;
if (getprop("/gear/gear[0]/wow") == 1 and turn_dist < 1) {
turn_dist = 1;
}
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")) {
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) {
dist_coeff = 1;
}
turn_dist = math.cos(delta_angle_rad) * R * dist_coeff / 1852;
if (getprop("/gear/gear[0]/wow") == 1 and turn_dist < 1) {
turn_dist = 1;
}
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) {
setprop("/autopilot/route-manager/current-wp", getprop("/autopilot/route-manager/current-wp") + 1);
}
}

View file

@ -1 +1 @@
4100
4101