A3XX: Move FAULT Logic to nasal in ELEC, HYD, PNEU

This commit is contained in:
Joshua Davidson 2017-07-25 00:09:58 -04:00
parent bc24b255fc
commit 8acd730efe
4 changed files with 186 additions and 157 deletions

View file

@ -1558,82 +1558,6 @@
</condition> </condition>
</animation> </animation>
<!-- Fire controls -->
<!--animation>
<name>Engine 1 fire pick</name>
<type>pick</type>
<object-name>Eng1Fire</object-name>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>property-toggle</command>
<property>controls/engines/engine[0]/fire-bottle-discharge</property>
</binding>
</action>
</animation>
<animation>
<name>Engine 1 fire emit</name>
<type>material</type>
<object-name>Eng1Fire</object-name>
<emission>
<red>0.9</red>
<green>0.7</green>
<blue>0.7</blue>
<factor-prop>controls/engines/engine[0]/fire-bottle-discharge</factor-prop>
</emission>
</animation>
<animation>
<name>APU fire pick</name>
<type>pick</type>
<object-name>APUFire</object-name>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>property-toggle</command>
<property>controls/APU/fire-switch</property>
</binding>
</action>
</animation>
<animation>
<name>APU fire emit</name>
<type>material</type>
<object-name>APUFire</object-name>
<emission>
<red>0.9</red>
<green>0.7</green>
<blue>0.7</blue>
<factor-prop>controls/APU/fire-switch</factor-prop>
</emission>
</animation>
<animation>
<name>Engine 2 fire pick</name>
<type>pick</type>
<object-name>Eng2Fire</object-name>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>property-toggle</command>
<property>controls/engines/engine[1]/fire-bottle-discharge</property>
</binding>
</action>
</animation>
<animation>
<name>Engine 2 fire emit</name>
<type>material</type>
<object-name>Eng2Fire</object-name>
<emission>
<red>0.9</red>
<green>0.7</green>
<blue>0.7</blue>
<factor-prop>controls/engines/engine[1]/fire-bottle-discharge</factor-prop>
</emission>
</animation-->
<animation> <animation>
<name>Cargo Smoke Test</name> <name>Cargo Smoke Test</name>
<type>pick</type> <type>pick</type>
@ -1690,7 +1614,7 @@
<or> <or>
<and> <and>
<equals> <equals>
<property>systems/failures/pump-green</property> <property>systems/pneumatic/eng1-pump-fault</property>
<value>1</value> <value>1</value>
</equals> </equals>
<equals> <equals>
@ -1801,7 +1725,7 @@
<or> <or>
<and> <and>
<equals> <equals>
<property>systems/failures/pump-blue</property> <property>systems/pneumatic/elec-pump-b-fault</property>
<value>1</value> <value>1</value>
</equals> </equals>
<equals> <equals>
@ -1874,7 +1798,7 @@
<or> <or>
<and> <and>
<equals> <equals>
<property>systems/failures/ptu</property> <property>systems/pneumatic/ptu-fault</property>
<value>1</value> <value>1</value>
</equals> </equals>
<equals> <equals>
@ -1947,7 +1871,7 @@
<or> <or>
<and> <and>
<equals> <equals>
<property>systems/failures/pump-yellow-eng</property> <property>systems/pneumatic/eng2-pump-fault</property>
<value>1</value> <value>1</value>
</equals> </equals>
<equals> <equals>
@ -2020,7 +1944,7 @@
<or> <or>
<and> <and>
<equals> <equals>
<property>systems/failures/pump-yellow-elec</property> <property>systems/pneumatic/elec-pump-y-fault</property>
<value>1</value> <value>1</value>
</equals> </equals>
<equals> <equals>
@ -2614,7 +2538,7 @@
<or> <or>
<and> <and>
<equals> <equals>
<property>systems/failures/elec-galley</property> <property>systems/electrical/galley-fault</property>
<value>1</value> <value>1</value>
</equals> </equals>
<equals> <equals>
@ -2675,7 +2599,7 @@
<or> <or>
<and> <and>
<equals> <equals>
<property>systems/failures/elec-batt1</property> <property>systems/electrical/batt1-fault</property>
<value>1</value> <value>1</value>
</equals> </equals>
<equals> <equals>
@ -2736,7 +2660,7 @@
<or> <or>
<and> <and>
<equals> <equals>
<property>systems/failures/elec-batt2</property> <property>systems/electrical/batt2-fault</property>
<value>1</value> <value>1</value>
</equals> </equals>
<equals> <equals>
@ -2802,10 +2726,10 @@
<object-name>IDG1Btn1F</object-name> <object-name>IDG1Btn1F</object-name>
<condition> <condition>
<or> <or>
<greater-than> <equals>
<property>systems/unused/unused-oh</property> <property>systems/electrical/idg1-fault</property>
<value>150</value> <!-- I didn't model faults yet --> <value>1</value>
</greater-than> </equals>
<equals> <equals>
<property>controls/switches/annun-test</property> <property>controls/switches/annun-test</property>
<value>1</value> <value>1</value>
@ -2862,7 +2786,7 @@
<or> <or>
<and> <and>
<equals> <equals>
<property>systems/failures/elec-gen1</property> <property>systems/electrical/gen1-fault</property>
<value>1</value> <value>1</value>
</equals> </equals>
<equals> <equals>
@ -2870,16 +2794,6 @@
<value>1</value> <value>1</value>
</equals> </equals>
</and> </and>
<and>
<equals>
<property>controls/electrical/switches/gen1</property>
<value>1</value>
</equals>
<not-equals>
<property>engines/engine[0]/state</property>
<value>3</value>
</not-equals>
</and>
<equals> <equals>
<property>controls/switches/annun-test</property> <property>controls/switches/annun-test</property>
<value>1</value> <value>1</value>
@ -2944,7 +2858,7 @@
<or> <or>
<and> <and>
<equals> <equals>
<property>systems/failures/elec-ac-ess</property> <property>systems/electrical/ac-ess-feed-fault</property>
<value>1</value> <value>1</value>
</equals> </equals>
<equals> <equals>
@ -3024,7 +2938,7 @@
<or> <or>
<and> <and>
<equals> <equals>
<property>systems/failures/elec-genapu</property> <property>systems/electrical/apugen-fault</property>
<value>1</value> <value>1</value>
</equals> </equals>
<equals> <equals>
@ -3245,7 +3159,7 @@
<or> <or>
<and> <and>
<equals> <equals>
<property>systems/failures/elec-gen2</property> <property>systems/electrical/gen2-fault</property>
<value>1</value> <value>1</value>
</equals> </equals>
<equals> <equals>
@ -3253,16 +3167,6 @@
<value>1</value> <value>1</value>
</equals> </equals>
</and> </and>
<and>
<equals>
<property>controls/electrical/switches/gen2</property>
<value>1</value>
</equals>
<not-equals>
<property>engines/engine[1]/state</property>
<value>3</value>
</not-equals>
</and>
<equals> <equals>
<property>controls/switches/annun-test</property> <property>controls/switches/annun-test</property>
<value>1</value> <value>1</value>
@ -3642,7 +3546,7 @@
<or> <or>
<and> <and>
<equals> <equals>
<property>systems/failures/pack1</property> <property>systems/pneumatic/pack1-fault</property>
<value>1</value> <value>1</value>
</equals> </equals>
<equals> <equals>
@ -3650,16 +3554,6 @@
<value>1</value> <value>1</value>
</equals> </equals>
</and> </and>
<and>
<equals>
<property>controls/pneumatic/switches/pack1</property>
<value>1</value>
</equals>
<less-than-equals>
<property>systems/pneumatic/pack1</property>
<value>5</value>
</less-than-equals>
</and>
<equals> <equals>
<property>controls/switches/annun-test</property> <property>controls/switches/annun-test</property>
<value>1</value> <value>1</value>
@ -3725,12 +3619,12 @@
<or> <or>
<and> <and>
<equals> <equals>
<property>systems/failures/bleed-eng1</property> <property>systems/pneumatic/bleed1-fault</property>
<value>1</value> <value>1</value>
</equals> </equals>
<equals> <equals>
<property>controls/pneumatic/switches/bleed1</property> <property>controls/pneumatic/switches/bleed1</property>
<value>0</value> <value>1</value>
</equals> </equals>
</and> </and>
<equals> <equals>
@ -3806,7 +3700,7 @@
<or> <or>
<and> <and>
<equals> <equals>
<property>systems/failures/bleed-apu</property> <property>systems/pneumatic/bleedapu-fault</property>
<value>1</value> <value>1</value>
</equals> </equals>
<equals> <equals>
@ -3879,7 +3773,7 @@
<or> <or>
<and> <and>
<equals> <equals>
<property>systems/failures/bleed-eng2</property> <property>systems/pneumatic/bleed2-fault</property>
<value>1</value> <value>1</value>
</equals> </equals>
<equals> <equals>
@ -3949,10 +3843,16 @@
<object-name>HotAirBtn1F</object-name> <object-name>HotAirBtn1F</object-name>
<condition> <condition>
<or> <or>
<greater-than> <and>
<property>systems/unused/unused-oh</property> <equals>
<value>150</value> <!-- I didn't model faults yet --> <property>systems/pneumatic/hotair-fault</property>
</greater-than> <value>1</value>
</equals>
<equals>
<property>controls/pneumatic/switches/hot-air</property>
<value>1</value>
</equals>
</and>
<equals> <equals>
<property>controls/switches/annun-test</property> <property>controls/switches/annun-test</property>
<value>1</value> <value>1</value>
@ -4026,7 +3926,7 @@
<or> <or>
<and> <and>
<equals> <equals>
<property>systems/failures/pack2</property> <property>systems/pneumatic/pack2-fault</property>
<value>1</value> <value>1</value>
</equals> </equals>
<equals> <equals>
@ -4034,16 +3934,6 @@
<value>1</value> <value>1</value>
</equals> </equals>
</and> </and>
<and>
<equals>
<property>controls/pneumatic/switches/pack2</property>
<value>1</value>
</equals>
<less-than-equals>
<property>systems/pneumatic/pack2</property>
<value>5</value>
</less-than-equals>
</and>
<equals> <equals>
<property>controls/switches/annun-test</property> <property>controls/switches/annun-test</property>
<value>1</value> <value>1</value>

View file

@ -104,6 +104,15 @@ var elec_init = func {
setprop("/systems/electrical/gen-apu", 0); setprop("/systems/electrical/gen-apu", 0);
setprop("/systems/electrical/gen-ext", 0); setprop("/systems/electrical/gen-ext", 0);
setprop("/systems/electrical/on", 0); setprop("/systems/electrical/on", 0);
setprop("/systems/electrical/galley-fault", 0);
setprop("/systems/electrical/idg1-fault", 0);
setprop("/systems/electrical/gen1-fault", 0);
setprop("/systems/electrical/apugen-fault", 0);
setprop("/systems/electrical/batt1-fault", 0);
setprop("/systems/electrical/batt2-fault", 0);
setprop("/systems/electrical/ac-ess-feed-fault", 0);
setprop("/systems/electrical/gen1-fault", 0);
setprop("/systems/electrical/idg1-fault", 0);
setprop("/controls/electrical/xtie/xtieL", 0); setprop("/controls/electrical/xtie/xtieL", 0);
setprop("/controls/electrical/xtie/xtieR", 0); setprop("/controls/electrical/xtie/xtieR", 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
@ -512,6 +521,49 @@ var master_elec = func {
setprop("/systems/electrical/outputs/transponder", dc_volt_std); setprop("/systems/electrical/outputs/transponder", dc_volt_std);
setprop("/systems/electrical/outputs/turn-coordinator", dc_volt_std); setprop("/systems/electrical/outputs/turn-coordinator", dc_volt_std);
} }
# Fault lights
if (gallery_fail and galley_sw) {
setprop("/systems/electrical/galley-fault", 1);
} else {
setprop("/systems/electrical/galley-fault", 0);
}
if (batt1_fail and battery1_sw) {
setprop("/systems/electrical/batt1-fault", 1);
} else {
setprop("/systems/electrical/batt1-fault", 0);
}
if (batt2_fail and battery2_sw) {
setprop("/systems/electrical/batt2-fault", 1);
} else {
setprop("/systems/electrical/batt2-fault", 0);
}
if ((gen1_fail and gen1_sw) or (gen1_sw and stateL != 3)) {
setprop("/systems/electrical/gen1-fault", 1);
} else {
setprop("/systems/electrical/gen1-fault", 0);
}
if (ac_ess_fail and ac_ess_feed_sw) {
setprop("/systems/electrical/ac-ess-feed-fault", 1);
} else {
setprop("/systems/electrical/ac-ess-feed-fault", 0);
}
if (genapu_fail and gen_apu_sw) {
setprop("/systems/electrical/apugen-fault", 1);
} else {
setprop("/systems/electrical/apugen-fault", 0);
}
if ((gen2_fail and gen2_sw) or (gen2_sw and stateR != 3)) {
setprop("/systems/electrical/gen2-fault", 1);
} else {
setprop("/systems/electrical/gen2-fault", 0);
}
} }
################### ###################

View file

@ -73,9 +73,14 @@ var hyd_init = func {
setprop("/systems/hydraulic/brakes/mode", 0); setprop("/systems/hydraulic/brakes/mode", 0);
setprop("/systems/hydraulic/brakes/lbrake", 0); setprop("/systems/hydraulic/brakes/lbrake", 0);
setprop("/systems/hydraulic/brakes/rbrake", 0); setprop("/systems/hydraulic/brakes/rbrake", 0);
setprop("/systems/hydraulic/brakes/nose-rubber", 0); # this stops the nose from spinning when you raise the gear setprop("/systems/hydraulic/brakes/nose-rubber", 0); # This stops the nose from spinning when you raise the gear
setprop("/systems/hydraulic/brakes/counter", 0); setprop("/systems/hydraulic/brakes/counter", 0);
setprop("/systems/hydraulic/brakes/accumulator-pressure-psi-1", 0); setprop("/systems/hydraulic/brakes/accumulator-pressure-psi-1", 0);
setprop("/systems/hydraulic/eng1-pump-fault", 0);
setprop("/systems/hydraulic/eng2-pump-fault", 0);
setprop("/systems/hydraulic/elec-pump-b-fault", 0);
setprop("/systems/hydraulic/elec-pump-y-fault", 0);
setprop("/systems/hydraulic/ptu-fault", 0);
hyd_timer.start(); hyd_timer.start();
} }
@ -224,6 +229,37 @@ var master_hyd = func {
if (brake_mode == 2 and yellow_psi > 2500 and accum < 700) { if (brake_mode == 2 and yellow_psi > 2500 and accum < 700) {
setprop("/systems/hydraulic/brakes/accumulator-pressure-psi", accum + 50); setprop("/systems/hydraulic/brakes/accumulator-pressure-psi", accum + 50);
} }
# Fault lights
if (green_pump_fail and eng1_pump_sw) {
setprop("/systems/pneumatic/eng1-pump-fault", 1);
} else {
setprop("/systems/pneumatic/eng1-pump-fault", 0);
}
if (blue_pump_fail and elec_pump_blue_sw) {
setprop("/systems/pneumatic/elec-pump-b-fault", 1);
} else {
setprop("/systems/pneumatic/elec-pump-b-fault", 0);
}
if (ptu_fail and ptu_sw) {
setprop("/systems/pneumatic/ptu-fault", 1);
} else {
setprop("/systems/pneumatic/ptu-fault", 0);
}
if (yellow_pump_eng_fail and eng2_pump_sw) {
setprop("/systems/pneumatic/eng2-pump-fault", 1);
} else {
setprop("/systems/pneumatic/eng2-pump-fault", 0);
}
if (yellow_pump_elec_fail and elec_pump_yellow_sw) {
setprop("/systems/pneumatic/elec-pump-y-fault", 1);
} else {
setprop("/systems/pneumatic/elec-pump-y-fault", 0);
}
} }
####################### #######################

View file

@ -97,6 +97,12 @@ var pneu_init = func {
setprop("/systems/pneumatic/startpsir", 0); setprop("/systems/pneumatic/startpsir", 0);
setprop("/systems/pneumatic/eng1-starter", 0); setprop("/systems/pneumatic/eng1-starter", 0);
setprop("/systems/pneumatic/eng2-starter", 0); setprop("/systems/pneumatic/eng2-starter", 0);
setprop("/systems/pneumatic/bleed1-fault", 0);
setprop("/systems/pneumatic/bleed2-fault", 0);
setprop("/systems/pneumatic/bleedapu-fault", 0);
setprop("/systems/pneumatic/hotair-fault", 0);
setprop("/systems/pneumatic/pack1-fault", 0);
setprop("/systems/pneumatic/pack2-fault", 0);
setprop("/FMGC/internal/dep-arpt", ""); setprop("/FMGC/internal/dep-arpt", "");
altitude = getprop("/instrumentation/altimeter/indicated-altitude-ft"); altitude = getprop("/instrumentation/altimeter/indicated-altitude-ft");
setprop("/systems/pressurization/mode", "GN"); setprop("/systems/pressurization/mode", "GN");
@ -247,20 +253,6 @@ var master_pneu = func {
setprop("/controls/deice/rengine", 1); setprop("/controls/deice/rengine", 1);
} }
var flashfault1 = func {
setprop("/controls/deice/eng1-fault", 1);
settimer(func {
setprop("/controls/deice/eng1-fault", 0);
}, 0.5);
}
var flashfault2 = func {
setprop("/controls/deice/eng2-fault", 1);
settimer(func {
setprop("/controls/deice/eng2-fault", 0);
}, 0.5);
}
total_psi = getprop("/systems/pneumatic/total-psi"); total_psi = getprop("/systems/pneumatic/total-psi");
phase = getprop("/FMGC/status/phase"); phase = getprop("/FMGC/status/phase");
@ -322,8 +314,53 @@ var master_pneu = func {
setprop("/systems/ventilation/avionics/fan", 0); setprop("/systems/ventilation/avionics/fan", 0);
setprop("/systems/ventilation/lavatory/extractfan", 0); setprop("/systems/ventilation/lavatory/extractfan", 0);
} }
# Fault lights
if (bleedeng1_fail and bleed1_sw) {
setprop("/systems/pneumatic/bleed1-fault", 1);
} else {
setprop("/systems/pneumatic/bleed1-fault", 0);
}
if (bleedeng2_fail and bleed2_sw) {
setprop("/systems/pneumatic/bleed2-fault", 1);
} else {
setprop("/systems/pneumatic/bleed2-fault", 0);
}
if (bleedapu_fail and bleedapu_sw) {
setprop("/systems/pneumatic/bleedapu-fault", 1);
} else {
setprop("/systems/pneumatic/bleedapu-fault", 0);
}
if ((pack1_fail and pack1_sw) or (pack1_sw and pack1 <= 5)) {
setprop("/systems/pneumatic/pack1-fault", 1);
} else {
setprop("/systems/pneumatic/pack1-fault", 0);
}
if ((pack2_fail and pack2_sw) or (pack2_sw and pack2 <= 5)) {
setprop("/systems/pneumatic/pack2-fault", 1);
} else {
setprop("/systems/pneumatic/pack2-fault", 0);
}
} }
setlistener("/controls/pneumatic/switches/pack1", func {
pack1_sw = getprop("/controls/pneumatic/switches/pack1");
if (pack1_sw) {
setprop("/systems/pneumatic/pack1-fault", 1);
}
});
setlistener("/controls/pneumatic/switches/pack2", func {
pack2_sw = getprop("/controls/pneumatic/switches/pack2");
if (pack2_sw) {
setprop("/systems/pneumatic/pack2-fault", 1);
}
});
setlistener("/controls/deice/eng1-on", func { setlistener("/controls/deice/eng1-on", func {
eng1on = getprop("/controls/deice/eng1-on"); eng1on = getprop("/controls/deice/eng1-on");
if (eng1on) { if (eng1on) {
@ -338,6 +375,20 @@ setlistener("/controls/deice/eng2-on", func {
} }
}); });
var flashfault1 = func {
setprop("/controls/deice/eng1-fault", 1);
settimer(func {
setprop("/controls/deice/eng1-fault", 0);
}, 0.5);
}
var flashfault2 = func {
setprop("/controls/deice/eng2-fault", 1);
settimer(func {
setprop("/controls/deice/eng2-fault", 0);
}, 0.5);
}
################### ###################
# Update Function # # Update Function #
################### ###################