Hook up ELACS
This commit is contained in:
parent
2d954d5b5b
commit
ddce64bce8
3 changed files with 62 additions and 26 deletions
|
@ -1014,11 +1014,7 @@
|
||||||
<or>
|
<or>
|
||||||
<and>
|
<and>
|
||||||
<equals>
|
<equals>
|
||||||
<property>systems/failures/elac1</property>
|
<property>/systems/failures/elac1-fault</property>
|
||||||
<value>1</value>
|
|
||||||
</equals>
|
|
||||||
<equals>
|
|
||||||
<property>controls/fctl/elac1</property>
|
|
||||||
<value>1</value>
|
<value>1</value>
|
||||||
</equals>
|
</equals>
|
||||||
</and>
|
</and>
|
||||||
|
@ -1215,7 +1211,7 @@
|
||||||
<or>
|
<or>
|
||||||
<and>
|
<and>
|
||||||
<equals>
|
<equals>
|
||||||
<property>systems/failures/elac2</property>
|
<property>systems/failures/elac2-fault</property>
|
||||||
<value>1</value>
|
<value>1</value>
|
||||||
</equals>
|
</equals>
|
||||||
<equals>
|
<equals>
|
||||||
|
|
|
@ -131,10 +131,44 @@ var light = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var fctlpoweruptest = func {
|
||||||
|
if (getprop("/systems/electrical/battery-available") == 0 and (getprop("/controls/electrical/switches/battery1") == 1 or getprop("/controls/electrical/switches/battery2") == 1)) {
|
||||||
|
setprop("/systems/failures/elac1-fault", 1);
|
||||||
|
setprop("/systems/failures/sec1", 1);
|
||||||
|
setprop("/systems/electrical/battery-available", 1);
|
||||||
|
setprop("/systems/electrical/elac1-test", 1);
|
||||||
|
settimer(func(){
|
||||||
|
setprop("/systems/failures/elac1-fault", 0);
|
||||||
|
setprop("/systems/electrical/elac1-test", 0);
|
||||||
|
},8);
|
||||||
|
settimer(func(){
|
||||||
|
setprop("/systems/failures/sec1", 0);
|
||||||
|
},8.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
gen1_sw = getprop("/controls/electrical/switches/gen1");
|
||||||
|
gen2_sw = getprop("/controls/electrical/switches/gen2");
|
||||||
|
gen_apu_sw = getprop("/controls/electrical/switches/gen-apu");
|
||||||
|
gen_ext_sw = getprop("/controls/electrical/switches/gen-ext");
|
||||||
|
|
||||||
|
if (getprop("/systems/electrical/dc2-available") == 0 and getprop("/systems/electrical/bus/dc2") > 25) {
|
||||||
|
setprop("/systems/failures/elac2-fault", 1);
|
||||||
|
setprop("/systems/electrical/dc2-available", 1);
|
||||||
|
setprop("/systems/electrical/elac2-test", 1);
|
||||||
|
settimer(func(){
|
||||||
|
setprop("/systems/failures/elac2-fault", 0);
|
||||||
|
setprop("/systems/electrical/elac2-test", 0);
|
||||||
|
},8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Main Elec System
|
# Main Elec System
|
||||||
|
|
||||||
var ELEC = {
|
var ELEC = {
|
||||||
init: func() {
|
init: func() {
|
||||||
|
setprop("/systems/electrical/elac-test", 0);
|
||||||
setprop("/controls/switches/annun-test", 0);
|
setprop("/controls/switches/annun-test", 0);
|
||||||
setprop("/systems/electrical/nav-lights-power", 0);
|
setprop("/systems/electrical/nav-lights-power", 0);
|
||||||
setprop("/controls/electrical/switches/galley", 1);
|
setprop("/controls/electrical/switches/galley", 1);
|
||||||
|
@ -190,6 +224,7 @@ var ELEC = {
|
||||||
setprop("/controls/electrical/xtie/xtieL", 0);
|
setprop("/controls/electrical/xtie/xtieL", 0);
|
||||||
setprop("/controls/electrical/xtie/xtieR", 0);
|
setprop("/controls/electrical/xtie/xtieR", 0);
|
||||||
setprop("/systems/electrical/battery-available", 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
|
# Below are standard FG Electrical stuff to keep things working when the plane is powered
|
||||||
setprop("/systems/electrical/outputs/adf", 0);
|
setprop("/systems/electrical/outputs/adf", 0);
|
||||||
setprop("/systems/electrical/outputs/audio-panel", 0);
|
setprop("/systems/electrical/outputs/audio-panel", 0);
|
||||||
|
@ -304,10 +339,17 @@ var ELEC = {
|
||||||
setprop("/systems/electrical/battery-available", 0);
|
setprop("/systems/electrical/battery-available", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dc2 >= 25) {
|
||||||
|
fctlpoweruptest();
|
||||||
|
} else {
|
||||||
|
setprop("/systems/electrical/dc2-available", 0);
|
||||||
|
}
|
||||||
|
|
||||||
dcbat = getprop("/systems/electrical/bus/dcbat");
|
dcbat = getprop("/systems/electrical/bus/dcbat");
|
||||||
|
|
||||||
if (extpwr_on and gen_ext_sw) {
|
if (extpwr_on and gen_ext_sw) {
|
||||||
setprop("/systems/electrical/gen-ext", 1);
|
setprop("/systems/electrical/gen-ext", 1);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
setprop("/systems/electrical/gen-ext", 0);
|
setprop("/systems/electrical/gen-ext", 0);
|
||||||
}
|
}
|
||||||
|
@ -741,18 +783,3 @@ var decharge2 = maketimer(69, func {
|
||||||
bat2_volts = getprop("/systems/electrical/battery2-volts");
|
bat2_volts = getprop("/systems/electrical/battery2-volts");
|
||||||
setprop("/systems/electrical/battery2-volts", bat2_volts - 0.1);
|
setprop("/systems/electrical/battery2-volts", bat2_volts - 0.1);
|
||||||
});
|
});
|
||||||
|
|
||||||
var fctlpoweruptest = func {
|
|
||||||
if (getprop("/systems/electrical/battery-available") == 0) {
|
|
||||||
setprop("/systems/failures/elac1", 1);
|
|
||||||
setprop("/systems/failures/sec1", 1);
|
|
||||||
setprop("/systems/electrical/battery-available", 1);
|
|
||||||
settimer(func(){
|
|
||||||
setprop("/systems/failures/elac1", 0);
|
|
||||||
},8);
|
|
||||||
settimer(func(){
|
|
||||||
setprop("/systems/failures/sec1", 0);
|
|
||||||
},8.5);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,7 @@ var update_loop = func {
|
||||||
var fac2_fail = getprop("/systems/failures/fac2");
|
var fac2_fail = getprop("/systems/failures/fac2");
|
||||||
|
|
||||||
var ac_ess = getprop("/systems/electrical/bus/ac-ess");
|
var ac_ess = getprop("/systems/electrical/bus/ac-ess");
|
||||||
|
var dc_ess = getprop("/systems/electrical/bus/dc-ess");
|
||||||
var dc_ess_shed = getprop("/systems/electrical/bus/dc-ess-shed");
|
var dc_ess_shed = getprop("/systems/electrical/bus/dc-ess-shed");
|
||||||
var ac1 = getprop("/systems/electrical/bus/ac1");
|
var ac1 = getprop("/systems/electrical/bus/ac1");
|
||||||
var ac2 = getprop("/systems/electrical/bus/ac2");
|
var ac2 = getprop("/systems/electrical/bus/ac2");
|
||||||
|
@ -61,17 +62,29 @@ var update_loop = func {
|
||||||
var dc2 = getprop("/systems/electrical/bus/dc2");
|
var dc2 = getprop("/systems/electrical/bus/dc2");
|
||||||
var battery1_sw = getprop("/controls/electrical/switches/battery1");
|
var battery1_sw = getprop("/controls/electrical/switches/battery1");
|
||||||
var battery2_sw = getprop("/controls/electrical/switches/battery2");
|
var battery2_sw = getprop("/controls/electrical/switches/battery2");
|
||||||
|
var elac1_test = getprop("/systems/electrical/elac1-test");
|
||||||
|
var elac2_test = getprop("/systems/electrical/elac2-test");
|
||||||
|
|
||||||
if (elac1_sw and !elac1_fail and ac_ess >= 110) {
|
if (elac1_sw and !elac1_fail and (dc_ess >= 25 or battery1_sw) and !elac1_test) {
|
||||||
setprop("/systems/fctl/elac1", 1);
|
setprop("/systems/fctl/elac1", 1);
|
||||||
} else {
|
setprop("/systems/failures/elac1-fault", 0);
|
||||||
|
} else if (elac1_sw and (elac1_fail or (dc_ess < 25 and !battery1_sw)) and !elac1_test) {
|
||||||
|
setprop("/systems/failures/elac1-fault", 1);
|
||||||
setprop("/systems/fctl/elac1", 0);
|
setprop("/systems/fctl/elac1", 0);
|
||||||
|
} else if (!elac1_test) {
|
||||||
|
setprop("/systems/failures/elac1-fault", 0);
|
||||||
|
setprop("/systems/fctl/elac1", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (elac2_sw and !elac2_fail and ac_ess >= 110) {
|
if (elac2_sw and !elac2_fail and (dc2 >= 25 or battery2_sw) and !elac2_test) {
|
||||||
setprop("/systems/fctl/elac2", 1);
|
setprop("/systems/fctl/elac2", 1);
|
||||||
} else {
|
setprop("/systems/failures/elac2-fault", 0);
|
||||||
|
} else if (elac2_sw and (elac2_fail or (dc2 < 25 and !battery2_sw)) and !elac2_test) {
|
||||||
|
setprop("/systems/failures/elac2-fault", 1);
|
||||||
setprop("/systems/fctl/elac2", 0);
|
setprop("/systems/fctl/elac2", 0);
|
||||||
|
} else if (!elac2_test) {
|
||||||
|
setprop("/systems/failures/elac2-fault", 0);
|
||||||
|
setprop("/systems/fctl/elac2", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sec1_sw and !sec1_fail and ac_ess >= 110) {
|
if (sec1_sw and !sec1_fail and ac_ess >= 110) {
|
||||||
|
|
Reference in a new issue