From f798f315e1ad5b4d88fc54a22228dd420465b717 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Sat, 9 May 2020 11:11:31 -0400 Subject: [PATCH] Correct aoa floating point error --- Nasal/FMGC/FMGC.nas | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index b547dd22..e87d3dbd 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -333,9 +333,13 @@ var masterFMGC = maketimer(0.2, func { aoa_0 = -5; aoa = getprop("/systems/navigation/adr/output/aoa-1"); cas = getprop("/systems/navigation/adr/output/cas-1"); - - alpha_prot = cas * math.sqrt((aoa - aoa_0)/(aoa_prot - aoa_0)); - alpha_max = cas * math.sqrt((aoa - aoa_0)/(aoa_max - aoa_0)); + if (aoa > -5) { + alpha_prot = cas * math.sqrt((aoa - aoa_0)/(aoa_prot - aoa_0)); + alpha_max = cas * math.sqrt((aoa - aoa_0)/(aoa_max - aoa_0)); + } else { + alpha_prot = 0; + alpha_max = 0; + } # predicted to speeds clean_to = 2 * tow * 0.45359237 + 85;