Hook up FACS to elec
This commit is contained in:
parent
58b7778412
commit
2d954d5b5b
3 changed files with 82 additions and 27 deletions
|
@ -71,6 +71,7 @@
|
||||||
<object-name>RamAirBtn2O</object-name>
|
<object-name>RamAirBtn2O</object-name>
|
||||||
<object-name>SEC1Btn1F</object-name>
|
<object-name>SEC1Btn1F</object-name>
|
||||||
<object-name>SEC1Btn2O</object-name>
|
<object-name>SEC1Btn2O</object-name>
|
||||||
|
<object-name>VentBlowBtn1F</object-name>
|
||||||
<condition>
|
<condition>
|
||||||
<or>
|
<or>
|
||||||
<greater-than-equals>
|
<greater-than-equals>
|
||||||
|
@ -167,8 +168,6 @@
|
||||||
<object-name>SEC2Btn2O</object-name>
|
<object-name>SEC2Btn2O</object-name>
|
||||||
<object-name>SEC3Btn1F</object-name>
|
<object-name>SEC3Btn1F</object-name>
|
||||||
<object-name>SEC3Btn2O</object-name>
|
<object-name>SEC3Btn2O</object-name>
|
||||||
<object-name>VentBlowBtn1F</object-name>
|
|
||||||
<object-name>VentBlowBtn2O</object-name>
|
|
||||||
<object-name>VentExtractBtn1F</object-name>
|
<object-name>VentExtractBtn1F</object-name>
|
||||||
<object-name>VentExtractBtn2O</object-name>
|
<object-name>VentExtractBtn2O</object-name>
|
||||||
<object-name>WingAntiIceBtn1F</object-name>
|
<object-name>WingAntiIceBtn1F</object-name>
|
||||||
|
@ -210,7 +209,6 @@
|
||||||
<object-name>Gen1LineBtn1S</object-name>
|
<object-name>Gen1LineBtn1S</object-name>
|
||||||
<object-name>Gen1LineBtn2O</object-name>
|
<object-name>Gen1LineBtn2O</object-name>
|
||||||
<object-name>RcdrGndCtlBtn2O</object-name>
|
<object-name>RcdrGndCtlBtn2O</object-name>
|
||||||
<object-name>VentBlowBtn1F</object-name>
|
|
||||||
<object-name>VentBlowBtn2O</object-name>
|
<object-name>VentBlowBtn2O</object-name>
|
||||||
<object-name>VentExtractBtn1F</object-name>
|
<object-name>VentExtractBtn1F</object-name>
|
||||||
<object-name>VentExtractBtn2O</object-name>
|
<object-name>VentExtractBtn2O</object-name>
|
||||||
|
@ -238,6 +236,24 @@
|
||||||
</diffuse>
|
</diffuse>
|
||||||
</animation>
|
</animation>
|
||||||
|
|
||||||
|
<!-- Ventilation -->
|
||||||
|
<animation>
|
||||||
|
<type>select</type>
|
||||||
|
<object-name>VentBlowBtn1F</object-name>
|
||||||
|
<condition>
|
||||||
|
<or>
|
||||||
|
<equals>
|
||||||
|
<property>/controls/ventilation/blowFail</property>
|
||||||
|
<value>1</value>
|
||||||
|
</equals>
|
||||||
|
<equals>
|
||||||
|
<property>controls/switches/annun-test</property>
|
||||||
|
<value>1</value>
|
||||||
|
</equals>
|
||||||
|
</or>
|
||||||
|
</condition>
|
||||||
|
</animation>
|
||||||
|
|
||||||
<!-- Cargo Smoke -->
|
<!-- Cargo Smoke -->
|
||||||
<animation>
|
<animation>
|
||||||
<type>select</type>
|
<type>select</type>
|
||||||
|
@ -1132,7 +1148,7 @@
|
||||||
<or>
|
<or>
|
||||||
<and>
|
<and>
|
||||||
<equals>
|
<equals>
|
||||||
<property>systems/failures/fac1</property>
|
<property>systems/failures/fac1-fault</property>
|
||||||
<value>1</value>
|
<value>1</value>
|
||||||
</equals>
|
</equals>
|
||||||
<equals>
|
<equals>
|
||||||
|
@ -1400,7 +1416,7 @@
|
||||||
<or>
|
<or>
|
||||||
<and>
|
<and>
|
||||||
<equals>
|
<equals>
|
||||||
<property>systems/failures/fac2</property>
|
<property>systems/failures/fac2-fault</property>
|
||||||
<value>1</value>
|
<value>1</value>
|
||||||
</equals>
|
</equals>
|
||||||
<equals>
|
<equals>
|
||||||
|
@ -2720,7 +2736,7 @@
|
||||||
</binding>
|
</binding>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script>systems.batflash();</script>
|
<script>systems.fctlpoweruptest();</script>
|
||||||
</binding>
|
</binding>
|
||||||
</action>
|
</action>
|
||||||
</animation>
|
</animation>
|
||||||
|
@ -2785,7 +2801,7 @@
|
||||||
</binding>
|
</binding>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script>systems.batflash();</script>
|
<script>systems.fctlpoweruptest();</script>
|
||||||
</binding>
|
</binding>
|
||||||
</action>
|
</action>
|
||||||
</animation>
|
</animation>
|
||||||
|
|
|
@ -43,6 +43,7 @@ setlistener("/sim/signals/fdm-initialized", func {
|
||||||
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");
|
||||||
var ac_ess = getprop("/systems/electrical/bus/ac-ess");
|
var ac_ess = getprop("/systems/electrical/bus/ac-ess");
|
||||||
|
var dc_ess_shed = getprop("/systems/electrical/bus/dc-ess-shed");
|
||||||
var ac_ess_shed = getprop("/systems/electrical/bus/ac-ess-shed");
|
var ac_ess_shed = getprop("/systems/electrical/bus/ac-ess-shed");
|
||||||
var dc1 = getprop("/systems/electrical/bus/dc1");
|
var dc1 = getprop("/systems/electrical/bus/dc1");
|
||||||
var dc2 = getprop("/systems/electrical/bus/dc2");
|
var dc2 = getprop("/systems/electrical/bus/dc2");
|
||||||
|
@ -163,6 +164,7 @@ var ELEC = {
|
||||||
setprop("/systems/electrical/bus/gen1-hz", 0);
|
setprop("/systems/electrical/bus/gen1-hz", 0);
|
||||||
setprop("/systems/electrical/bus/gen2-hz", 0);
|
setprop("/systems/electrical/bus/gen2-hz", 0);
|
||||||
setprop("/systems/electrical/bus/ac-ess", 0);
|
setprop("/systems/electrical/bus/ac-ess", 0);
|
||||||
|
setprop("/systems/electrical/bus/dc-ess-shed", 0);
|
||||||
setprop("/systems/electrical/bus/ac-ess-shed", 0);
|
setprop("/systems/electrical/bus/ac-ess-shed", 0);
|
||||||
setprop("/systems/electrical/extra/ext-volts", 0);
|
setprop("/systems/electrical/extra/ext-volts", 0);
|
||||||
setprop("/systems/electrical/extra/apu-volts", 0);
|
setprop("/systems/electrical/extra/apu-volts", 0);
|
||||||
|
@ -269,6 +271,7 @@ var ELEC = {
|
||||||
ac1 = getprop("/systems/electrical/bus/ac1");
|
ac1 = getprop("/systems/electrical/bus/ac1");
|
||||||
ac2 = getprop("/systems/electrical/bus/ac2");
|
ac2 = getprop("/systems/electrical/bus/ac2");
|
||||||
ac_ess = getprop("/systems/electrical/bus/ac-ess");
|
ac_ess = getprop("/systems/electrical/bus/ac-ess");
|
||||||
|
dc_ess_shed = getprop("/systems/electrical/bus/dc-ess-shed");
|
||||||
ac_ess_shed = getprop("/systems/electrical/bus/ac-ess-shed");
|
ac_ess_shed = getprop("/systems/electrical/bus/ac-ess-shed");
|
||||||
dc1 = getprop("/systems/electrical/bus/dc1");
|
dc1 = getprop("/systems/electrical/bus/dc1");
|
||||||
dc2 = getprop("/systems/electrical/bus/dc2");
|
dc2 = getprop("/systems/electrical/bus/dc2");
|
||||||
|
@ -531,6 +534,12 @@ var ELEC = {
|
||||||
setprop("/controls/electrical/switches/emer-gen", 0);
|
setprop("/controls/electrical/switches/emer-gen", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (emergen == 0 and ac1 == 0 and ac2 == 0) { # as far as I know dc ess is only shed when batteries only
|
||||||
|
setprop("/systems/electrical/bus/dc-ess-shed", 0);
|
||||||
|
} else {
|
||||||
|
setprop("/systems/electrical/bus/dc-ess-shed", ac_volt_std);
|
||||||
|
}
|
||||||
|
|
||||||
dc1 = getprop("/systems/electrical/bus/dc1");
|
dc1 = getprop("/systems/electrical/bus/dc1");
|
||||||
dc2 = getprop("/systems/electrical/bus/dc2");
|
dc2 = getprop("/systems/electrical/bus/dc2");
|
||||||
|
|
||||||
|
@ -688,6 +697,14 @@ var ELEC = {
|
||||||
setprop("/systems/electrical/gen2-fault", 0);
|
setprop("/systems/electrical/gen2-fault", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# these two are here because they are on whenever the battery switch is on with no ac source connected (youtube)
|
||||||
|
|
||||||
|
if ((battery1_sw or battery2_sw) and dc1 < 25 and ac1 < 110) {
|
||||||
|
setprop("/controls/ventilation/blowFail", 1);
|
||||||
|
} else {
|
||||||
|
setprop("/controls/ventilation/blowFail", 0);
|
||||||
|
}
|
||||||
|
|
||||||
foreach(var screena; screens) {
|
foreach(var screena; screens) {
|
||||||
power_consumption = screena.power_consumption();
|
power_consumption = screena.power_consumption();
|
||||||
if (getprop(screena.elec_prop) != 0) {
|
if (getprop(screena.elec_prop) != 0) {
|
||||||
|
@ -725,19 +742,17 @@ var decharge2 = maketimer(69, func {
|
||||||
setprop("/systems/electrical/battery2-volts", bat2_volts - 0.1);
|
setprop("/systems/electrical/battery2-volts", bat2_volts - 0.1);
|
||||||
});
|
});
|
||||||
|
|
||||||
var batflash = func {
|
var fctlpoweruptest = func {
|
||||||
if (getprop("/systems/electrical/battery-available") == 0) {
|
if (getprop("/systems/electrical/battery-available") == 0) {
|
||||||
setprop("/systems/failures/elac1", 1);
|
setprop("/systems/failures/elac1", 1);
|
||||||
setprop("/systems/failures/sec1", 1);
|
setprop("/systems/failures/sec1", 1);
|
||||||
setprop("/systems/failures/fac1", 1);
|
|
||||||
setprop("/systems/electrical/battery-available", 1);
|
setprop("/systems/electrical/battery-available", 1);
|
||||||
settimer(func(){
|
settimer(func(){
|
||||||
setprop("/systems/failures/elac1", 0);
|
setprop("/systems/failures/elac1", 0);
|
||||||
},1.5);
|
},8);
|
||||||
settimer(func(){
|
settimer(func(){
|
||||||
setprop("/systems/failures/sec1", 0);
|
setprop("/systems/failures/sec1", 0);
|
||||||
setprop("/systems/failures/fac1", 0);
|
},8.5);
|
||||||
},2);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,20 +39,28 @@ var fctlInit = func {
|
||||||
var update_loop = func {
|
var update_loop = func {
|
||||||
var elac1_sw = getprop("/controls/fctl/elac1");
|
var elac1_sw = getprop("/controls/fctl/elac1");
|
||||||
var elac2_sw = getprop("/controls/fctl/elac2");
|
var elac2_sw = getprop("/controls/fctl/elac2");
|
||||||
var sec1_sw = getprop("/controls/fctl/sec1");
|
var sec1_sw = getprop("/controls/fctl/sec1");
|
||||||
var sec2_sw = getprop("/controls/fctl/sec2");
|
var sec2_sw = getprop("/controls/fctl/sec2");
|
||||||
var sec3_sw = getprop("/controls/fctl/sec3");
|
var sec3_sw = getprop("/controls/fctl/sec3");
|
||||||
var fac1_sw = getprop("/controls/fctl/fac1");
|
var fac1_sw = getprop("/controls/fctl/fac1");
|
||||||
var fac2_sw = getprop("/controls/fctl/fac2");
|
var fac2_sw = getprop("/controls/fctl/fac2");
|
||||||
|
|
||||||
var elac1_fail = getprop("/systems/failures/elac1");
|
var elac1_fail = getprop("/systems/failures/elac1");
|
||||||
var elac2_fail = getprop("/systems/failures/elac2");
|
var elac2_fail = getprop("/systems/failures/elac2");
|
||||||
var sec1_fail = getprop("/systems/failures/sec1");
|
var sec1_fail = getprop("/systems/failures/sec1");
|
||||||
var sec2_fail = getprop("/systems/failures/sec2");
|
var sec2_fail = getprop("/systems/failures/sec2");
|
||||||
var sec3_fail = getprop("/systems/failures/sec3");
|
var sec3_fail = getprop("/systems/failures/sec3");
|
||||||
var fac1_fail = getprop("/systems/failures/fac1");
|
var fac1_fail = getprop("/systems/failures/fac1");
|
||||||
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_shed = getprop("/systems/electrical/bus/dc-ess-shed");
|
||||||
|
var ac1 = getprop("/systems/electrical/bus/ac1");
|
||||||
|
var ac2 = getprop("/systems/electrical/bus/ac2");
|
||||||
|
var dc1 = getprop("/systems/electrical/bus/dc1");
|
||||||
|
var dc2 = getprop("/systems/electrical/bus/dc2");
|
||||||
|
var battery1_sw = getprop("/controls/electrical/switches/battery1");
|
||||||
|
var battery2_sw = getprop("/controls/electrical/switches/battery2");
|
||||||
|
|
||||||
if (elac1_sw and !elac1_fail and ac_ess >= 110) {
|
if (elac1_sw and !elac1_fail and ac_ess >= 110) {
|
||||||
setprop("/systems/fctl/elac1", 1);
|
setprop("/systems/fctl/elac1", 1);
|
||||||
|
@ -104,20 +112,36 @@ var update_loop = func {
|
||||||
setprop("/systems/failures/spoiler-r2", 1);
|
setprop("/systems/failures/spoiler-r2", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fac1_sw and !fac1_fail and ac_ess >= 110) {
|
if (fac1_sw and !fac1_fail and (ac_ess >= 110 or dc_ess_shed >= 25)) {
|
||||||
setprop("/systems/fctl/fac1", 1);
|
setprop("/systems/fctl/fac1", 1);
|
||||||
setprop("/systems/failures/rudder", 0);
|
setprop("/systems/failures/rudder", 0);
|
||||||
|
setprop("/systems/failures/fac1-fault", 0);
|
||||||
|
} else if (fac1_sw and (battery1_sw or battery2_sw) and (fac1_fail or ac_ess < 110 or dc_ess_shed < 25)) {
|
||||||
|
setprop("/systems/failures/fac1-fault", 1);
|
||||||
|
setprop("/systems/fctl/fac1", 0);
|
||||||
|
if (!fac2_sw or fac2_fail) {
|
||||||
|
setprop("/systems/failures/rudder", 1);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
setprop("/systems/failures/fac1-fault", 0);
|
||||||
setprop("/systems/fctl/fac1", 0);
|
setprop("/systems/fctl/fac1", 0);
|
||||||
if (!fac2_sw or fac2_fail) {
|
if (!fac2_sw or fac2_fail) {
|
||||||
setprop("/systems/failures/rudder", 1);
|
setprop("/systems/failures/rudder", 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fac2_sw and !fac2_fail and ac_ess >= 110) {
|
if (fac2_sw and !fac2_fail and (ac2 >= 110 or dc2 >= 25)) {
|
||||||
setprop("/systems/fctl/fac2", 1);
|
setprop("/systems/fctl/fac2", 1);
|
||||||
|
setprop("/systems/failures/fac2-fault", 0);
|
||||||
|
} else if (fac2_sw and (fac2_fail or ac2 < 110 or dc2 < 25)) {
|
||||||
|
setprop("/systems/failures/fac2-fault", 1);
|
||||||
|
setprop("/systems/fctl/fac2", 0);
|
||||||
|
if (!fac1_sw or fac1_fail) {
|
||||||
|
setprop("/systems/failures/rudder", 1);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
setprop("/systems/fctl/fac2", 0);
|
setprop("/systems/fctl/fac2", 0);
|
||||||
|
setprop("/systems/failures/fac2-fault", 0);
|
||||||
if (!fac1_sw or fac1_fail) {
|
if (!fac1_sw or fac1_fail) {
|
||||||
setprop("/systems/failures/rudder", 1);
|
setprop("/systems/failures/rudder", 1);
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue