A3XX: Further fuel system bugfixes

This commit is contained in:
Joshua Davidson 2017-09-22 23:53:01 -04:00
parent 081cb48df7
commit f3c8395b35
3 changed files with 38 additions and 66 deletions

View file

@ -687,16 +687,13 @@
<fuel n="0"> <fuel n="0">
<only-use-ctr-tank type="bool">0</only-use-ctr-tank> <only-use-ctr-tank type="bool">0</only-use-ctr-tank>
<tank n="0"> <tank n="0">
<feed0 type="bool">0</feed0> <feed type="bool">0</feed>
<feed1 type="bool">0</feed1>
</tank> </tank>
<tank n="1"> <tank n="1">
<feed0 type="bool">0</feed0> <feed type="bool">0</feed>
<feed1 type="bool">0</feed1>
</tank> </tank>
<tank n="2"> <tank n="2">
<feed0 type="bool">0</feed0> <feed type="bool">0</feed>
<feed1 type="bool">0</feed1>
</tank> </tank>
<x-feed type="bool">0</x-feed> <x-feed type="bool">0</x-feed>
</fuel> </fuel>

View file

@ -26,12 +26,9 @@ setlistener("/sim/signals/fdm-initialized", func {
var gload = getprop("/accelerations/pilot-gdamped"); var gload = getprop("/accelerations/pilot-gdamped");
var gravityfeedL_output = getprop("/systems/fuel/gravityfeedL-output"); var gravityfeedL_output = getprop("/systems/fuel/gravityfeedL-output");
var gravityfeedR_output = getprop("/systems/fuel/gravityfeedR-output"); var gravityfeedR_output = getprop("/systems/fuel/gravityfeedR-output");
var tank0feed0 = getprop("/systems/fuel/tank[0]/feed0"); var tank0 = getprop("/systems/fuel/tank[0]/feed");
var tank0feed1 = getprop("/systems/fuel/tank[0]/feed1"); var tank1 = getprop("/systems/fuel/tank[1]/feed");
var tank1feed0 = getprop("/systems/fuel/tank[1]/feed0"); var tank2 = getprop("/systems/fuel/tank[2]/feed");
var tank1feed1 = getprop("/systems/fuel/tank[1]/feed1");
var tank2feed0 = getprop("/systems/fuel/tank[2]/feed0");
var tank2feed1 = getprop("/systems/fuel/tank[2]/feed1");
var gravityfeedL = getprop("/systems/fuel/gravityfeedL"); var gravityfeedL = getprop("/systems/fuel/gravityfeedL");
var gravityfeedR = getprop("/systems/fuel/gravityfeedR"); var gravityfeedR = getprop("/systems/fuel/gravityfeedR");
var tank0pump1_fail = getprop("/systems/failures/tank0pump1"); var tank0pump1_fail = getprop("/systems/failures/tank0pump1");
@ -56,12 +53,9 @@ var fuel_init = func {
setprop("/controls/fuel/tank2pump2", 0); setprop("/controls/fuel/tank2pump2", 0);
setprop("/controls/fuel/mode", 1); setprop("/controls/fuel/mode", 1);
setprop("/systems/fuel/x-feed", 0); setprop("/systems/fuel/x-feed", 0);
setprop("/systems/fuel/tank[0]/feed0", 0); setprop("/systems/fuel/tank[0]/feed", 0);
setprop("/systems/fuel/tank[0]/feed1", 0); setprop("/systems/fuel/tank[1]/feed", 0);
setprop("/systems/fuel/tank[1]/feed0", 0); setprop("/systems/fuel/tank[2]/feed", 0);
setprop("/systems/fuel/tank[1]/feed1", 0);
setprop("/systems/fuel/tank[2]/feed0", 0);
setprop("/systems/fuel/tank[2]/feed1", 0);
setprop("/systems/fuel/only-use-ctr-tank", 0); setprop("/systems/fuel/only-use-ctr-tank", 0);
setprop("/systems/fuel/tank0pump1-fault", 0); setprop("/systems/fuel/tank0pump1-fault", 0);
setprop("/systems/fuel/tank0pump2-fault", 0); setprop("/systems/fuel/tank0pump2-fault", 0);
@ -114,47 +108,31 @@ var master_fuel = func {
gravityfeedR_output = getprop("/systems/fuel/gravityfeedR-output"); gravityfeedR_output = getprop("/systems/fuel/gravityfeedR-output");
if ((ac1 >= 110 or ac2 >= 110) and tank0pump1_sw and !tank0pump1_fail) { if ((ac1 >= 110 or ac2 >= 110) and tank0pump1_sw and !tank0pump1_fail) {
setprop("/systems/fuel/tank[0]/feed0", 1); setprop("/systems/fuel/tank[0]/feed", 1);
} else if ((ac1 >= 110 or ac2 >= 110) and tank0pump2_sw and !tank0pump2_fail) {
setprop("/systems/fuel/tank[0]/feed", 1);
} else if (gravityfeedL_output) { } else if (gravityfeedL_output) {
setprop("/systems/fuel/tank[0]/feed0", 1); setprop("/systems/fuel/tank[0]/feed", 1);
} else { } else {
setprop("/systems/fuel/tank[0]/feed0", 0); setprop("/systems/fuel/tank[0]/feed", 0);
}
if ((ac1 >= 110 or ac2 >= 110) and tank0pump2_sw and !tank0pump2_fail) {
setprop("/systems/fuel/tank[0]/feed1", 1);
} else if (gravityfeedL_output) {
setprop("/systems/fuel/tank[0]/feed1", 1);
} else {
setprop("/systems/fuel/tank[0]/feed1", 0);
} }
if ((ac1 >= 110 or ac2 >= 110) and tank1pump1_sw and !tank1pump1_fail) { if ((ac1 >= 110 or ac2 >= 110) and tank1pump1_sw and !tank1pump1_fail) {
setprop("/systems/fuel/tank[1]/feed0", 1); setprop("/systems/fuel/tank[1]/feed", 1);
} else if ((ac1 >= 110 or ac2 >= 110) and tank1pump2_sw and !tank1pump2_fail) {
setprop("/systems/fuel/tank[1]/feed", 1);
} else { } else {
setprop("/systems/fuel/tank[1]/feed0", 0); setprop("/systems/fuel/tank[1]/feed", 0);
}
if ((ac1 >= 110 or ac2 >= 110) and tank1pump2_sw and !tank1pump2_fail) {
setprop("/systems/fuel/tank[1]/feed1", 1);
} else {
setprop("/systems/fuel/tank[1]/feed1", 0);
} }
if ((ac1 >= 110 or ac2 >= 110) and tank2pump1_sw and !tank2pump1_fail) { if ((ac1 >= 110 or ac2 >= 110) and tank2pump1_sw and !tank2pump1_fail) {
setprop("/systems/fuel/tank[2]/feed0", 1); setprop("/systems/fuel/tank[2]/feed", 1);
} else if ((ac1 >= 110 or ac2 >= 110) and tank2pump2_sw and !tank2pump2_fail) {
setprop("/systems/fuel/tank[2]/feed", 1);
} else if (gravityfeedR_output) { } else if (gravityfeedR_output) {
setprop("/systems/fuel/tank[2]/feed0", 1); setprop("/systems/fuel/tank[2]/feed", 1);
} else { } else {
setprop("/systems/fuel/tank[2]/feed0", 0); setprop("/systems/fuel/tank[2]/feed", 0);
}
if ((ac1 >= 110 or ac2 >= 110) and tank2pump2_sw and !tank2pump2_fail) {
setprop("/systems/fuel/tank[2]/feed1", 1);
} else if (gravityfeedR_output) {
setprop("/systems/fuel/tank[2]/feed1", 1);
} else {
setprop("/systems/fuel/tank[2]/feed1", 0);
} }
if ((ac1 >= 110 or ac2 >= 110) and xfeed_sw) { if ((ac1 >= 110 or ac2 >= 110) and xfeed_sw) {
@ -163,12 +141,9 @@ var master_fuel = func {
setprop("/systems/fuel/x-feed", 0); setprop("/systems/fuel/x-feed", 0);
} }
tank0feed0 = getprop("/systems/fuel/tank[0]/feed0"); tank0 = getprop("/systems/fuel/tank[0]/feed");
tank0feed1 = getprop("/systems/fuel/tank[0]/feed1"); tank1 = getprop("/systems/fuel/tank[1]/feed");
tank1feed0 = getprop("/systems/fuel/tank[1]/feed0"); tank2 = getprop("/systems/fuel/tank[2]/feed");
tank1feed1 = getprop("/systems/fuel/tank[1]/feed1");
tank2feed0 = getprop("/systems/fuel/tank[2]/feed0");
tank2feed1 = getprop("/systems/fuel/tank[2]/feed1");
if (((ac1 >= 110 or ac2 >= 110) and tank0pump1_sw and tank0pump1_sw)) { if (((ac1 >= 110 or ac2 >= 110) and tank0pump1_sw and tank0pump1_sw)) {
setprop("/systems/fuel/gravityfeedL", 0); setprop("/systems/fuel/gravityfeedL", 0);

View file

@ -16,18 +16,18 @@
<default value="0"/> <default value="0"/>
<test logic="AND" value="0.9"> <test logic="AND" value="0.9">
/systems/fuel/only-use-ctr-tank == 0 /systems/fuel/only-use-ctr-tank == 0
/systems/fuel/tank[0]/feed0 == 1 /systems/fuel/tank[0]/feed == 1
propulsion/tank[0]/contents-lbs GT 0 propulsion/tank[0]/contents-lbs GT 0
/consumables/fuel/tank[3]/level-lbs LT 0.9 propulsion/tank[3]/contents-lbs LT 0.9
</test> </test>
</switch> </switch>
<switch name="fuel/from-tank1-to-tank3"> <switch name="fuel/from-tank1-to-tank3">
<default value="0"/> <default value="0"/>
<test logic="AND" value="0.9"> <test logic="AND" value="0.9">
/systems/fuel/tank[1]/feed0 == 1 /systems/fuel/tank[1]/feed == 1
propulsion/tank[1]/contents-lbs GT 0 propulsion/tank[1]/contents-lbs GT 0
/consumables/fuel/tank[3]/level-lbs LT 0.9 propulsion/tank[3]/contents-lbs LT 0.9
</test> </test>
</switch> </switch>
@ -36,9 +36,9 @@
<test logic="AND" value="0.9"> <test logic="AND" value="0.9">
/systems/fuel/x-feed == 1 /systems/fuel/x-feed == 1
/systems/fuel/only-use-ctr-tank == 0 /systems/fuel/only-use-ctr-tank == 0
/systems/fuel/tank[2]/feed0 == 1 /systems/fuel/tank[2]/feed == 1
propulsion/tank[2]/contents-lbs GT 0 propulsion/tank[2]/contents-lbs GT 0
/consumables/fuel/tank[3]/level-lbs LT 0.9 propulsion/tank[3]/contents-lbs LT 0.9
</test> </test>
</switch> </switch>
</channel> </channel>
@ -48,18 +48,18 @@
<default value="0"/> <default value="0"/>
<test logic="AND" value="0.9"> <test logic="AND" value="0.9">
/systems/fuel/only-use-ctr-tank == 0 /systems/fuel/only-use-ctr-tank == 0
/systems/fuel/tank[2]/feed0 == 1 /systems/fuel/tank[2]/feed == 1
propulsion/tank[2]/contents-lbs GT 0 propulsion/tank[2]/contents-lbs GT 0
/consumables/fuel/tank[4]/level-lbs LT 0.9 propulsion/tank[4]/contents-lbs LT 0.9
</test> </test>
</switch> </switch>
<switch name="fuel/from-tank1-to-tank4"> <switch name="fuel/from-tank1-to-tank4">
<default value="0"/> <default value="0"/>
<test logic="AND" value="0.9"> <test logic="AND" value="0.9">
/systems/fuel/tank[1]/feed0 == 1 /systems/fuel/tank[1]/feed == 1
propulsion/tank[1]/contents-lbs GT 0 propulsion/tank[1]/contents-lbs GT 0
/consumables/fuel/tank[4]/level-lbs LT 0.9 propulsion/tank[4]/contents-lbs LT 0.9
</test> </test>
</switch> </switch>
@ -68,9 +68,9 @@
<test logic="AND" value="0.9"> <test logic="AND" value="0.9">
/systems/fuel/x-feed == 1 /systems/fuel/x-feed == 1
/systems/fuel/only-use-ctr-tank == 0 /systems/fuel/only-use-ctr-tank == 0
/systems/fuel/tank[0]/feed0 == 1 /systems/fuel/tank[0]/feed == 1
propulsion/tank[0]/contents-lbs GT 0 propulsion/tank[0]/contents-lbs GT 0
/consumables/fuel/tank[4]/level-lbs LT 0.9 propulsion/tank[4]/contents-lbs LT 0.9
</test> </test>
</switch> </switch>
</channel> </channel>