A3XX: Fix icing, disbale g-load protection for now, causing FBW issues

This commit is contained in:
Joshua Davidson 2017-08-10 13:58:12 -04:00
parent ccea61329f
commit b99be30f21
2 changed files with 112 additions and 289 deletions

View file

@ -209,13 +209,119 @@ var icingModel = func {
setprop("/systems/icing/icingcond", 0); setprop("/systems/icing/icingcond", 0);
} }
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);
setprop("/controls/deice/wing", 0);
}
if (PSI > 10 and wingFault) {
setprop("/controls/switches/wingfault", 0);
if (wingBtn) {
setprop("/controls/deice/wing", 1);
}
}
if (PitotIcing > 0.03) {
if (!PitotFailed) {
setprop("/systems/pitot/failed", 1);
}
} else if (PitotIcing < 0.03) {
if (PitotFailed) {
setprop("/systems/pitot/failed", 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 # # Wing Anti-Ice #
################# #################
# Switching on the wing anti-ice # Switching on the wing anti-ice
setlistener("/controls/switches/wing", func { setlistener("/controls/switches/wing", func {
# On the ground wowl = getprop("/gear/gear[1]/wow");
wowr = getprop("/gear/gear[2]/wow");
wingBtn = getprop("/controls/switches/wing");
if (wowl and wowr and wingBtn) { if (wowl and wowr and wingBtn) {
setprop("/controls/switches/wingfault", 1); setprop("/controls/switches/wingfault", 1);
settimer(func() { settimer(func() {
@ -244,111 +350,6 @@ var icingModel = func {
} }
}); });
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);
setprop("/controls/deice/wing", 0);
}
if (PSI > 10 and wingFault) {
setprop("/controls/switches/wingfault", 0);
if (wingBtn) {
setprop("/controls/deice/wing", 1);
}
}
#################
# 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);
}
} else if (PitotIcing < 0.03) {
if (PitotFailed) {
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);
}
});
}
################### ###################
# Update Function # # Update Function #
################### ###################

View file

@ -671,95 +671,6 @@
<entry><ind>-1</ind><dep>-5.0</dep></entry> <entry><ind>-1</ind><dep>-5.0</dep></entry>
</table> </table>
</product> </product>
<!-- The following stuff is for load factor protection -->
<product>
<table>
<property>/orientation/pitch-deg</property>
<entry><ind>-15.00000</ind><dep>0</dep></entry>
<entry><ind>-14.99999</ind><dep>1</dep></entry>
</table>
<table>
<property>/accelerations/pilot-g</property>
<entry><ind>-0.999999</ind><dep>0</dep></entry>
<entry><ind>-1.000000</ind><dep>1</dep></entry>
</table>
<table>
<property>/controls/flight/flap-pos</property>
<entry><ind>0</ind><dep>1</dep></entry>
<entry><ind>1</ind><dep>0</dep></entry>
</table>
<table>
<property>/controls/flight/elevator-input</property>
<entry><ind>1</ind><dep>5.0</dep></entry>
<entry><ind>0</ind><dep>0.0</dep></entry>
</table>
</product>
<product>
<table>
<property>/orientation/pitch-deg</property>
<entry><ind>-15.00000</ind><dep>0</dep></entry>
<entry><ind>-14.99999</ind><dep>1</dep></entry>
</table>
<table>
<property>/accelerations/pilot-g</property>
<entry><ind>0.000001</ind><dep>0</dep></entry>
<entry><ind>0.000000</ind><dep>1</dep></entry>
</table>
<table>
<property>/controls/flight/flap-pos</property>
<entry><ind>0</ind><dep>0</dep></entry>
<entry><ind>1</ind><dep>1</dep></entry>
</table>
<table>
<property>/controls/flight/elevator-input</property>
<entry><ind>1</ind><dep>5.0</dep></entry>
<entry><ind>0</ind><dep>0.0</dep></entry>
</table>
</product>
<product>
<table>
<property>/orientation/pitch-deg</property>
<entry><ind>29.99999</ind><dep>1</dep></entry>
<entry><ind>30.00000</ind><dep>0</dep></entry>
</table>
<table>
<property>/accelerations/pilot-g</property>
<entry><ind>2.499999</ind><dep>0</dep></entry>
<entry><ind>2.500000</ind><dep>1</dep></entry>
</table>
<table>
<property>/controls/flight/flap-pos</property>
<entry><ind>0</ind><dep>1</dep></entry>
<entry><ind>1</ind><dep>0</dep></entry>
</table>
<table>
<property>/controls/flight/elevator-input</property>
<entry><ind> 0</ind><dep> 0.0</dep></entry>
<entry><ind>-1</ind><dep>-5.0</dep></entry>
</table>
</product>
<product>
<table>
<property>/orientation/pitch-deg</property>
<entry><ind>29.99999</ind><dep>1</dep></entry>
<entry><ind>30.00000</ind><dep>0</dep></entry>
</table>
<table>
<property>/accelerations/pilot-g</property>
<entry><ind>1.999999</ind><dep>0</dep></entry>
<entry><ind>2.000000</ind><dep>1</dep></entry>
</table>
<table>
<property>/controls/flight/flap-pos</property>
<entry><ind>0</ind><dep>0</dep></entry>
<entry><ind>1</ind><dep>1</dep></entry>
</table>
<table>
<property>/controls/flight/elevator-input</property>
<entry><ind> 0</ind><dep> 0.0</dep></entry>
<entry><ind>-1</ind><dep>-5.0</dep></entry>
</table>
</product>
</sum> </sum>
</expression> </expression>
</input> </input>
@ -778,95 +689,6 @@
<entry><ind> 0</ind><dep> 0.0</dep></entry> <entry><ind> 0</ind><dep> 0.0</dep></entry>
<entry><ind>-1</ind><dep> 5.0</dep></entry> <entry><ind>-1</ind><dep> 5.0</dep></entry>
</table> </table>
<!-- The following stuff is for load factor protection -->
<product>
<table>
<property>/orientation/pitch-deg</property>
<entry><ind>-15.00000</ind><dep>0</dep></entry>
<entry><ind>-14.99999</ind><dep>1</dep></entry>
</table>
<table>
<property>/accelerations/pilot-g</property>
<entry><ind>-0.999999</ind><dep>0</dep></entry>
<entry><ind>-1.000000</ind><dep>1</dep></entry>
</table>
<table>
<property>/controls/flight/flap-pos</property>
<entry><ind>0</ind><dep>1</dep></entry>
<entry><ind>1</ind><dep>0</dep></entry>
</table>
<table>
<property>/controls/flight/elevator-input</property>
<entry><ind>1</ind><dep>5.0</dep></entry>
<entry><ind>0</ind><dep>0.0</dep></entry>
</table>
</product>
<product>
<table>
<property>/orientation/pitch-deg</property>
<entry><ind>-15.00000</ind><dep>0</dep></entry>
<entry><ind>-14.99999</ind><dep>1</dep></entry>
</table>
<table>
<property>/accelerations/pilot-g</property>
<entry><ind>0.000001</ind><dep>0</dep></entry>
<entry><ind>0.000000</ind><dep>1</dep></entry>
</table>
<table>
<property>/controls/flight/flap-pos</property>
<entry><ind>0</ind><dep>0</dep></entry>
<entry><ind>1</ind><dep>1</dep></entry>
</table>
<table>
<property>/controls/flight/elevator-input</property>
<entry><ind>1</ind><dep>5.0</dep></entry>
<entry><ind>0</ind><dep>0.0</dep></entry>
</table>
</product>
<product>
<table>
<property>/orientation/pitch-deg</property>
<entry><ind>29.99999</ind><dep>1</dep></entry>
<entry><ind>30.00000</ind><dep>0</dep></entry>
</table>
<table>
<property>/accelerations/pilot-g</property>
<entry><ind>2.499999</ind><dep>0</dep></entry>
<entry><ind>2.500000</ind><dep>1</dep></entry>
</table>
<table>
<property>/controls/flight/flap-pos</property>
<entry><ind>0</ind><dep>1</dep></entry>
<entry><ind>1</ind><dep>0</dep></entry>
</table>
<table>
<property>/controls/flight/elevator-input</property>
<entry><ind> 0</ind><dep> 0.0</dep></entry>
<entry><ind>-1</ind><dep>-5.0</dep></entry>
</table>
</product>
<product>
<table>
<property>/orientation/pitch-deg</property>
<entry><ind>29.99999</ind><dep>1</dep></entry>
<entry><ind>30.00000</ind><dep>0</dep></entry>
</table>
<table>
<property>/accelerations/pilot-g</property>
<entry><ind>1.999999</ind><dep>0</dep></entry>
<entry><ind>2.000000</ind><dep>1</dep></entry>
</table>
<table>
<property>/controls/flight/flap-pos</property>
<entry><ind>0</ind><dep>0</dep></entry>
<entry><ind>1</ind><dep>1</dep></entry>
</table>
<table>
<property>/controls/flight/elevator-input</property>
<entry><ind> 0</ind><dep> 0.0</dep></entry>
<entry><ind>-1</ind><dep>-5.0</dep></entry>
</table>
</product>
</sum> </sum>
</expression> </expression>
</input> </input>