System: Fix buggy, broken, and incorrect RAT logic, fixes #45

This commit is contained in:
Joshua Davidson 2018-09-28 17:00:56 -04:00
parent cf87cce3b1
commit 560c375ad3
5 changed files with 99 additions and 10 deletions

View file

@ -1054,10 +1054,12 @@ var canvas_lowerECAM_elec = {
if (getprop("/controls/electrical/switches/emer-gen") == 0) {
me["EMERGEN-group"].hide();
me["ELEC-Line-Emergen-ESSTR"].hide();
me["ELEC-Line-Emergen-ESSTR-off"].show();
me["EMERGEN-Label-off"].show();
} else {
me["EMERGEN-group"].show();
me["ELEC-Line-Emergen-ESSTR"].show();
me["ELEC-Line-Emergen-ESSTR-off"].hide();
me["EMERGEN-Label-off"].hide();
}

View file

@ -3312,7 +3312,88 @@
</or>
</condition>
</animation>
<animation>
<name>ELEC RAT MAN pick</name>
<type>pick</type>
<object-name>EmerElecManOnBtn</object-name>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<condition>
<and>
<equals>
<property>controls/OH/protectors/elecratman</property>
<value>1</value>
</equals>
<or>
<greater-than-equals>
<property>systems/electrical/bus/dcbat</property>
<value>25</value>
</greater-than-equals>
<greater-than-equals>
<property>systems/electrical/bus/dc-ess</property>
<value>25</value>
</greater-than-equals>
</or>
</and>
</condition>
<command>property-toggle</command>
<property>controls/electrical/switches/rat-man</property>
</binding>
<binding>
<condition>
<equals>
<property>controls/OH/protectors/elecratman</property>
<value>1</value>
</equals>
</condition>
<command>nasal</command>
<script>setprop("/sim/sounde/oh-btn", 1);</script>
</binding>
</action>
</animation>
<animation>
<type>pick</type>
<object-name>EmerManOnGuard</object-name>
<action>
<button>1</button>
<binding>
<command>property-assign</command>
<property>controls/OH/protectors/elecratman</property>
<value>1</value>
</binding>
<mod-up>
<binding>
<command>property-assign</command>
<property>controls/OH/protectors/elecratman</property>
<value>0</value>
</binding>
<binding>
<command>nasal</command>
<script>setprop("/sim/sounde/oh-cover", 1);</script>
</binding>
</mod-up>
</action>
</animation>
<animation>
<type>rotate</type>
<object-name>EmerManOnGuard</object-name>
<property>controls/OH/protectors/elecratman</property>
<factor>-145</factor>
<axis>
<x1-m>-0.00273</x1-m>
<y1-m>-0.20848</y1-m>
<z1-m>-0.02796</z1-m>
<x2-m>-0.00420</x2-m>
<y2-m>-0.19657</y2-m>
<z2-m>-0.02796</z2-m>
</axis>
</animation>
<!-- Pneumatic -->
<animation>
<name>AC pack flow pick</name>

View file

@ -34,6 +34,7 @@ setlistener("/sim/signals/fdm-initialized", func {
var ac_ess_feed_sw = getprop("/controls/electrical/switches/ac-ess-feed");
var battery1_sw = getprop("/controls/electrical/switches/battery1");
var battery2_sw = getprop("/controls/electrical/switches/battery2");
var manrat = getprop("/controls/electrical/switches/rat-man");
var battery1_volts = getprop("/systems/electrical/battery1-volts");
var battery2_volts = getprop("/systems/electrical/battery2-volts");
var battery1_amps = getprop("/systems/electrical/battery1-amps");
@ -62,8 +63,7 @@ setlistener("/sim/signals/fdm-initialized", func {
var galley_shed = getprop("/systems/electrical/extra/galleyshed");
var emergen = getprop("/controls/electrical/switches/emer-gen");
var ias = getprop("/instrumentation/airspeed-indicator/indicated-speed-kt");
var rat = getprop("/controls/hydraulic/rat");
var manrat = getprop("/controls/hydraulic/rat-man");
var rat = getprop("/controls/electrical/rat");
var ac_ess_fail = getprop("/systems/failures/elec-ac-ess");
var batt1_fail = getprop("/systems/failures/elec-batt1");
var batt2_fail = getprop("/systems/failures/elec-batt2");
@ -158,6 +158,7 @@ var ELEC = {
setprop("/controls/electrical/switches/ac-ess-feed", 0);
setprop("/controls/electrical/switches/battery1", 0);
setprop("/controls/electrical/switches/battery2", 0);
setprop("/controls/electrical/switches/rat-man", 0);
setprop("/systems/electrical/battery1-volts", 26.5);
setprop("/systems/electrical/battery2-volts", 26.5);
setprop("/systems/electrical/battery1-amps", 0);
@ -206,6 +207,7 @@ var ELEC = {
setprop("/systems/electrical/idg2-fault", 0);
setprop("/controls/electrical/xtie/xtieL", 0);
setprop("/controls/electrical/xtie/xtieR", 0);
setprop("/controls/electrical/rat", 0);
setprop("/systems/electrical/battery-available", 0);
setprop("/systems/electrical/dc2-available", 0);
# Below are standard FG Electrical stuff to keep things working when the plane is powered
@ -280,6 +282,7 @@ var ELEC = {
ac_ess_feed_sw = getprop("/controls/electrical/switches/ac-ess-feed");
battery1_sw = getprop("/controls/electrical/switches/battery1");
battery2_sw = getprop("/controls/electrical/switches/battery2");
manrat = getprop("/controls/electrical/switches/rat-man");
battery1_volts = getprop("/systems/electrical/battery1-volts");
battery2_volts = getprop("/systems/electrical/battery2-volts");
battery1_percent = getprop("/systems/electrical/battery1-percent");
@ -302,8 +305,7 @@ var ELEC = {
galley_shed = getprop("/systems/electrical/extra/galleyshed");
emergen = getprop("/controls/electrical/switches/emer-gen");
ias = getprop("/instrumentation/airspeed-indicator/indicated-speed-kt");
rat = getprop("/controls/hydraulic/rat");
manrat = getprop("/controls/hydraulic/rat-man");
rat = getprop("/controls/electrical/rat");
ac_ess_fail = getprop("/systems/failures/elec-ac-ess");
batt1_fail = getprop("/systems/failures/elec-batt1");
batt2_fail = getprop("/systems/failures/elec-batt2");
@ -594,13 +596,17 @@ var ELEC = {
setprop("/systems/electrical/extra/galleyshed", 0);
}
if (((ac1 == 0 and ac2 == 0 and ias >= 100) or manrat) and replay == 0) {
if (ac1 < 110 and ac2 < 110 and ias >= 100 and replay == 0) {
setprop("/controls/hydraulic/rat-deployed", 1);
setprop("/controls/hydraulic/rat", 1);
setprop("/controls/electrical/rat", 1);
setprop("/controls/electrical/switches/emer-gen", 1);
} else if (manrat) {
setprop("/controls/hydraulic/rat-deployed", 1);
setprop("/controls/electrical/rat", 1);
setprop("/controls/electrical/switches/emer-gen", 1);
}
if (ias < 100 or (ac1 == 1) or (ac2 == 1)) {
if (ias < 100 or ac1 >= 110 or ac2 >= 110) {
setprop("/controls/electrical/switches/emer-gen", 0);
}

View file

@ -125,7 +125,7 @@ var HYD = {
setprop("/systems/hydraulic/ptu-active", 0);
}
if ((rat_man_sw == 1 or getprop("/controls/electrical/switches/emer-gen") == 1) and gs > 100) {
if ((rat_man_sw == 1 or getprop("/controls/electrical/switches/emer-gen") == 1) and gs >= 100) {
setprop("/controls/hydraulic/rat", 1);
setprop("/controls/hydraulic/rat-deployed", 1);
} else if (gs < 100) {

View file

@ -1 +1 @@
4659
4660