From b99be30f21150ff440994cfb2b9d8f0a73d5bcde Mon Sep 17 00:00:00 2001 From: Joshua Davidson Date: Thu, 10 Aug 2017 13:58:12 -0400 Subject: [PATCH] A3XX: Fix icing, disbale g-load protection for now, causing FBW issues --- Nasal/icing.nas | 223 +++++++++++++++++++++++---------------------- Systems/it-fbw.xml | 178 ------------------------------------ 2 files changed, 112 insertions(+), 289 deletions(-) diff --git a/Nasal/icing.nas b/Nasal/icing.nas index d3475369..7dabffd1 100644 --- a/Nasal/icing.nas +++ b/Nasal/icing.nas @@ -209,47 +209,11 @@ var icingModel = func { setprop("/systems/icing/icingcond", 0); } - ################# - # Wing Anti-Ice # - ################# - - # Switching on the wing anti-ice - setlistener("/controls/switches/wing", func { - # On the ground - if (wowl and wowr and wingBtn) { - setprop("/controls/switches/wingfault", 1); - settimer(func() { - setprop("/controls/switches/wingfault", 0); - setprop("/controls/deice/wing", 1); - }, 0.5); - settimer(func() { - setprop("/controls/deice/WingHasBeenTurnedOff", 1); - setprop("/controls/deice/wing", 0); - }, 30.5); - settimer(func() { - setprop("/controls/deice/GroundModeFinished", 1); - }, 31); - } else if (wingBtn and !wowl and !wowr) { # In the air - setprop("/controls/switches/wingfault", 1); - settimer(func() { - setprop("/controls/switches/wingfault", 0); - setprop("/controls/deice/wing", 1); - }, 0.5); - } else if (!wingBtn) { - setprop("/controls/switches/wingfault", 1); - settimer(func() { - setprop("/controls/switches/wingfault", 0); - setprop("/controls/deice/wing", 0); - }, 0.5); - } - }); - if (WingHasBeenTurnedOff and !wowl and !wowr and GroundModeFinished) { setprop("/controls/deice/wing", 1); setprop("/controls/switches/WingHasBeenTurnedOff", 0); } - # If we have low pressure we have a fault if (PSI < 10) { setprop("/controls/switches/wingfault", 1); @@ -263,62 +227,6 @@ var icingModel = func { } } - ################# - # LEng Anti-Ice # - ################# - - setlistener("/controls/switches/leng", func { - if (lengBtn and stateL == 3) { - setprop("/controls/switches/lengfault", 1); - settimer(func() { - setprop("/controls/switches/lengfault", 0); - setprop("/controls/deice/lengine", 1); - }, 0.5); - } else if (!lengBtn) { - setprop("/controls/switches/lengfault", 1); - settimer(func() { - setprop("/controls/switches/lengfault", 0); - setprop("/controls/deice/lengine", 0); - }, 0.5); - } - }); - - setlistener("/engines/engine[0]/state", func { - if (stateL != 3) { - setprop("/controls/switches/leng", 0); - } - }); - - ################# - # REng Anti-Ice # - ################# - - setlistener("/controls/switches/reng", func { - if (rengBtn and stateR == 3) { - setprop("/controls/switches/rengfault", 1); - settimer(func() { - setprop("/controls/switches/rengfault", 0); - setprop("/controls/deice/rengine", 1); - }, 0.5); - } else if (!rengBtn) { - setprop("/controls/switches/rengfault", 1); - settimer(func() { - setprop("/controls/switches/rengfault", 0); - setprop("/controls/deice/rengine", 0); - }, 0.5); - } - }); - - setlistener("/engines/engine[1]/state", func { - if (stateR != 3) { - setprop("/controls/switches/reng", 0); - } - }); - - ################## - # Probe Anti-Ice # - ################## - if (PitotIcing > 0.03) { if (!PitotFailed) { setprop("/systems/pitot/failed", 1); @@ -328,27 +236,120 @@ var icingModel = func { setprop("/systems/pitot/failed", 0); } } - - setlistener("/controls/switches/windowprobeheat", func { - windowprb = getprop("/controls/switches/windowprobeheat"); - if (windowprb == 0.5) { # if in auto - wowl = getprop("/gear/gear[1]/wow"); - wowr = getprop("/gear/gear[2]/wow"); - stateL = getprop("/engines/engine[0]/state"); - stateR = getprop("/engines/engine[1]/state"); - if (!wowl or !wowr) { - setprop("/controls/deice/windowprobeheat", 1); - } else if (stateL == 3 or stateR == 3) { - setprop("/controls/deice/windowprobeheat", 1); - } - } else if (windowprb == 1) { # if in ON - setprop("/controls/deice/windowprobeheat", 1); - } else { - setprop("/controls/deice/windowprobeheat", 0); - } - }); } +################# +# LEng Anti-Ice # +################# + +setlistener("/controls/switches/leng", func { + if (getprop("/controls/switches/leng") == 1 and getprop("/engines/engine[0]/state") == 3) { + setprop("/controls/switches/lengfault", 1); + settimer(func() { + setprop("/controls/switches/lengfault", 0); + setprop("/controls/deice/lengine", 1); + }, 0.5); + } else if (getprop("/controls/switches/leng") == 0) { + setprop("/controls/switches/lengfault", 1); + settimer(func() { + setprop("/controls/switches/lengfault", 0); + setprop("/controls/deice/lengine", 0); + }, 0.5); + } +}); + +setlistener("/engines/engine[0]/state", func { + if (getprop("/engines/engine[0]/state") != 3) { + setprop("/controls/switches/leng", 0); + } +}); + +################# +# REng Anti-Ice # +################# + +setlistener("/controls/switches/reng", func { + if (getprop("/controls/switches/reng") == 1 and getprop("/engines/engine[1]/state") == 3) { + setprop("/controls/switches/rengfault", 1); + settimer(func() { + setprop("/controls/switches/rengfault", 0); + setprop("/controls/deice/rengine", 1); + }, 0.5); + } else if (getprop("/controls/switches/reng") == 0) { + setprop("/controls/switches/rengfault", 1); + settimer(func() { + setprop("/controls/switches/rengfault", 0); + setprop("/controls/deice/rengine", 0); + }, 0.5); + } +}); + +setlistener("/engines/engine[1]/state", func { + if (getprop("/engines/engine[1]/state") != 3) { + setprop("/controls/switches/reng", 0); + } +}); + +################## +# Probe Anti-Ice # +################## + +setlistener("/controls/switches/windowprobeheat", func { + windowprb = getprop("/controls/switches/windowprobeheat"); + if (windowprb == 0.5) { # if in auto + wowl = getprop("/gear/gear[1]/wow"); + wowr = getprop("/gear/gear[2]/wow"); + stateL = getprop("/engines/engine[0]/state"); + stateR = getprop("/engines/engine[1]/state"); + if (!wowl or !wowr) { + setprop("/controls/deice/windowprobeheat", 1); + } else if (stateL == 3 or stateR == 3) { + setprop("/controls/deice/windowprobeheat", 1); + } + } else if (windowprb == 1) { # if in ON + setprop("/controls/deice/windowprobeheat", 1); + } else { + setprop("/controls/deice/windowprobeheat", 0); + } +}); + +################# +# Wing Anti-Ice # +################# + +# Switching on the wing anti-ice +setlistener("/controls/switches/wing", func { + wowl = getprop("/gear/gear[1]/wow"); + wowr = getprop("/gear/gear[2]/wow"); + wingBtn = getprop("/controls/switches/wing"); + if (wowl and wowr and wingBtn) { + setprop("/controls/switches/wingfault", 1); + settimer(func() { + setprop("/controls/switches/wingfault", 0); + setprop("/controls/deice/wing", 1); + }, 0.5); + settimer(func() { + setprop("/controls/deice/WingHasBeenTurnedOff", 1); + setprop("/controls/deice/wing", 0); + }, 30.5); + settimer(func() { + setprop("/controls/deice/GroundModeFinished", 1); + }, 31); + } else if (wingBtn and !wowl and !wowr) { # In the air + setprop("/controls/switches/wingfault", 1); + settimer(func() { + setprop("/controls/switches/wingfault", 0); + setprop("/controls/deice/wing", 1); + }, 0.5); + } else if (!wingBtn) { + setprop("/controls/switches/wingfault", 1); + settimer(func() { + setprop("/controls/switches/wingfault", 0); + setprop("/controls/deice/wing", 0); + }, 0.5); + } +}); + ################### # Update Function # ################### diff --git a/Systems/it-fbw.xml b/Systems/it-fbw.xml index bf4bbaff..50453613 100644 --- a/Systems/it-fbw.xml +++ b/Systems/it-fbw.xml @@ -671,95 +671,6 @@ -1-5.0 - - - - /orientation/pitch-deg - -15.000000 - -14.999991 -
- - /accelerations/pilot-g - -0.9999990 - -1.0000001 -
- - /controls/flight/flap-pos - 01 - 10 -
- - /controls/flight/elevator-input - 15.0 - 00.0 -
-
- - - /orientation/pitch-deg - -15.000000 - -14.999991 -
- - /accelerations/pilot-g - 0.0000010 - 0.0000001 -
- - /controls/flight/flap-pos - 00 - 11 -
- - /controls/flight/elevator-input - 15.0 - 00.0 -
-
- - - /orientation/pitch-deg - 29.999991 - 30.000000 -
- - /accelerations/pilot-g - 2.4999990 - 2.5000001 -
- - /controls/flight/flap-pos - 01 - 10 -
- - /controls/flight/elevator-input - 0 0.0 - -1-5.0 -
-
- - - /orientation/pitch-deg - 29.999991 - 30.000000 -
- - /accelerations/pilot-g - 1.9999990 - 2.0000001 -
- - /controls/flight/flap-pos - 00 - 11 -
- - /controls/flight/elevator-input - 0 0.0 - -1-5.0 -
-
@@ -778,95 +689,6 @@ 0 0.0 -1 5.0 - - - - /orientation/pitch-deg - -15.000000 - -14.999991 -
- - /accelerations/pilot-g - -0.9999990 - -1.0000001 -
- - /controls/flight/flap-pos - 01 - 10 -
- - /controls/flight/elevator-input - 15.0 - 00.0 -
-
- - - /orientation/pitch-deg - -15.000000 - -14.999991 -
- - /accelerations/pilot-g - 0.0000010 - 0.0000001 -
- - /controls/flight/flap-pos - 00 - 11 -
- - /controls/flight/elevator-input - 15.0 - 00.0 -
-
- - - /orientation/pitch-deg - 29.999991 - 30.000000 -
- - /accelerations/pilot-g - 2.4999990 - 2.5000001 -
- - /controls/flight/flap-pos - 01 - 10 -
- - /controls/flight/elevator-input - 0 0.0 - -1-5.0 -
-
- - - /orientation/pitch-deg - 29.999991 - 30.000000 -
- - /accelerations/pilot-g - 1.9999990 - 2.0000001 -
- - /controls/flight/flap-pos - 00 - 11 -
- - /controls/flight/elevator-input - 0 0.0 - -1-5.0 -
-