Implement a ton of working failures

This commit is contained in:
Joshua Davidson 2017-05-31 23:55:43 -04:00
parent 6a7b98db62
commit f349c2c77d
8 changed files with 621 additions and 163 deletions

View file

@ -508,13 +508,34 @@
<systems>
<failures n="0">
<aileron-left>0</aileron-left>
<aileron-right>0</aileron-right>
<elevator-left>0</elevator-left>
<elevator-right>0</elevator-right>
<rudder>0</rudder>
<spoiler-left>0</spoiler-left>
<spoiler-right>0</spoiler-right>
<aileron-left type="bool">0</aileron-left>
<aileron-right type="bool">0</aileron-right>
<elevator-left type="bool">0</elevator-left>
<elevator-right type="bool">0</elevator-right>
<rudder type="bool">0</rudder>
<spoiler-left type="bool">0</spoiler-left>
<spoiler-right type="bool">0</spoiler-right>
<elec-ac-ess type="bool">0</elec-ac-ess>
<elec-batt1 type="bool">0</elec-batt1>
<elec-batt2 type="bool">0</elec-batt2>
<elec-galley type="bool">0</elec-galley>
<elec-genapu type="bool">0</elec-genapu>
<elec-gen1 type="bool">0</elec-gen1>
<elec-gen2 type="bool">0</elec-gen2>
<bleed-apu type="bool">0</bleed-apu>
<bleed-ext type="bool">0</bleed-ext>
<bleed-eng1 type="bool">0</bleed-eng1>
<bleed-eng2 type="bool">0</bleed-eng2>
<pack1 type="bool">0</pack1>
<pack2 type="bool">0</pack2>
<hyd-blue type="bool">0</hyd-blue>
<hyd-green type="bool">0</hyd-green>
<hyd-yellow type="bool">0</hyd-yellow>
<ptu type="bool">0</ptu>
<pump-blue type="bool">0</pump-blue>
<pump-green type="bool">0</pump-green>
<pump-yellow-eng type="bool">0</pump-yellow-eng>
<pump-yellow-elec type="bool">0</pump-yellow-elec>
</failures>
<hydraulic n="0">
<blue-psi>0</blue-psi>

View file

@ -29,6 +29,7 @@ var init_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/init/dialog", "Aircraft/
var help_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/help/dialog", "Aircraft/A320Family/AircraftConfig/help.xml");
var fbw_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/fbw/dialog", "Aircraft/A320Family/AircraftConfig/fbw.xml");
var fail_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/fail/dialog", "Aircraft/A320Family/AircraftConfig/fail.xml");
var fail_b_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/failb/dialog", "Aircraft/A320Family/AircraftConfig/fail-b.xml");
spinning.start();
init_dlg.open();
@ -64,6 +65,42 @@ var failReset = func {
setprop("/systems/failures/rudder", 0);
setprop("/systems/failures/spoiler-left", 0);
setprop("/systems/failures/spoiler-right", 0);
setprop("/systems/failures/elec-ac-ess", 0);
setprop("/systems/failures/elec-batt1", 0);
setprop("/systems/failures/elec-batt2", 0);
setprop("/systems/failures/elec-galley", 0);
setprop("/systems/failures/elec-genapu", 0);
setprop("/systems/failures/elec-gen1", 0);
setprop("/systems/failures/elec-gen2", 0);
setprop("/systems/failures/bleed-apu", 0);
setprop("/systems/failures/bleed-ext", 0);
setprop("/systems/failures/bleed-eng1", 0);
setprop("/systems/failures/bleed-eng2", 0);
setprop("/systems/failures/pack1", 0);
setprop("/systems/failures/pack2", 0);
setprop("/systems/failures/hyd-blue", 0);
setprop("/systems/failures/hyd-green", 0);
setprop("/systems/failures/hyd-yellow", 0);
setprop("/systems/failures/ptu", 0);
setprop("/systems/failures/pump-blue", 0);
setprop("/systems/failures/pump-green", 0);
setprop("/systems/failures/pump-yellow-eng", 0);
setprop("/systems/failures/pump-yellow-elec", 0);
}
var failPage = func(page) {
if (page == 0) {
gui.popupTip("This is the first page!");
} else if (page == 1) {
fail_dlg.open();
fail_b_dlg.close();
} else if (page == 2) {
fail_dlg.close();
fail_b_dlg.open();
# fail_c_dlg.open(); # Fail C Doesn't exist yet!!! :)
} else if (page == 3) {
gui.popupTip("No Moar!");
}
}
################

158
AircraftConfig/fail-b.xml Normal file
View file

@ -0,0 +1,158 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- A3XX Aircraft Config Dialog -->
<PropertyList>
<name>aircraft-config-failb</name>
<layout>vbox</layout>
<group>
<layout>hbox</layout>
<text>
<halign>left</halign>
<label>System Failures (2)</label>
</text>
<button>
<halign>right</halign>
<pref-width>20</pref-width>
<pref-height>20</pref-height>
<legend>X</legend>
<key>Esc</key>
<binding>
<command>dialog-close</command>
</binding>
</button>
</group>
<hrule/>
<group>
<layout>vbox</layout>
<text>
<halign>left</halign>
<label>Failed when Checked</label>
</text>
<group>
<layout>hbox</layout>
<hrule>
<stretch type="bool">true</stretch>
</hrule>
<text>
<label>PNEU SYS Fail</label>
</text>
<hrule>
<stretch type="bool">true</stretch>
</hrule>
</group>
<checkbox>
<label>Bleed APU</label>
<halign>left</halign>
<property>/systems/failures/bleed-apu</property>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
<checkbox>
<label>Bleed EXT</label>
<halign>left</halign>
<property>/systems/failures/bleed-ext</property>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
<checkbox>
<label>Bleed ENG 1</label>
<halign>left</halign>
<property>/systems/failures/bleed-eng1</property>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
<checkbox>
<label>Bleed ENG 2</label>
<halign>left</halign>
<property>/systems/failures/bleed-eng2</property>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
<checkbox>
<label>Pack 1</label>
<halign>left</halign>
<property>/systems/failures/pack1</property>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
<checkbox>
<label>Pack 2</label>
<halign>left</halign>
<property>/systems/failures/pack2</property>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
<hrule/>
<group>
<layout>hbox</layout>
<button>
<legend>&lt;</legend>
<halign>center</halign>
<pref-width>30</pref-width>
<binding>
<command>nasal</command>
<script>
acconfig.failPage(1);
</script>
</binding>
</button>
<button>
<legend>Reset All</legend>
<halign>center</halign>
<padding>5</padding>
<binding>
<command>nasal</command>
<script>
acconfig.failReset();
</script>
</binding>
</button>
<button>
<legend>&gt;</legend>
<halign>center</halign>
<pref-width>30</pref-width>
<binding>
<command>nasal</command>
<script>
acconfig.failPage(3);
</script>
</binding>
</button>
</group>
</group>
</PropertyList>

View file

@ -12,7 +12,7 @@
<layout>hbox</layout>
<text>
<halign>left</halign>
<label>System Failures</label>
<label>System Failures (1)</label>
</text>
<button>
<halign>right</halign>
@ -43,7 +43,7 @@
<stretch type="bool">true</stretch>
</hrule>
<text>
<label>Flight Surfaces</label>
<label>FCTL SYS Fail</label>
</text>
<hrule>
<stretch type="bool">true</stretch>
@ -120,17 +120,216 @@
<live>true</live>
</checkbox>
<button>
<legend>Reset All</legend>
<halign>center</halign>
<padding>5</padding>
<group>
<layout>hbox</layout>
<hrule>
<stretch type="bool">true</stretch>
</hrule>
<text>
<label>ELEC SYS Fail</label>
</text>
<hrule>
<stretch type="bool">true</stretch>
</hrule>
</group>
<checkbox>
<label>AC ESS Bus</label>
<halign>left</halign>
<property>/systems/failures/elec-ac-ess</property>
<binding>
<command>nasal</command>
<script>
acconfig.failReset();
</script>
<command>dialog-apply</command>
</binding>
</button>
<live>true</live>
</checkbox>
<checkbox>
<label>APU GEN</label>
<halign>left</halign>
<property>/systems/failures/elec-genapu</property>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
<checkbox>
<label>BATT 1 Fail</label>
<halign>left</halign>
<property>/systems/failures/elec-batt1</property>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
<checkbox>
<label>BATT 2 Fail</label>
<halign>left</halign>
<property>/systems/failures/elec-batt2</property>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
<checkbox>
<label>ENG 1 GEN</label>
<halign>left</halign>
<property>/systems/failures/elec-gen1</property>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
<checkbox>
<label>ENG 2 GEN</label>
<halign>left</halign>
<property>/systems/failures/elec-gen2</property>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
<checkbox>
<label>Galley Bus</label>
<halign>left</halign>
<property>/systems/failures/elec-galley</property>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
<group>
<layout>hbox</layout>
<hrule>
<stretch type="bool">true</stretch>
</hrule>
<text>
<label>HYD SYS Fail</label>
</text>
<hrule>
<stretch type="bool">true</stretch>
</hrule>
</group>
<checkbox>
<label>Blue HYD Leak</label>
<halign>left</halign>
<property>/systems/failures/hyd-blue</property>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
<checkbox>
<label>Blue Elec Pump</label>
<halign>left</halign>
<property>/systems/failures/pump-blue</property>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
<checkbox>
<label>Green HYD Leak</label>
<halign>left</halign>
<property>/systems/failures/hyd-green</property>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
<checkbox>
<label>Green ENG 1 Pump</label>
<halign>left</halign>
<property>/systems/failures/pump-green</property>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
<checkbox>
<label>Yellow HYD Leak</label>
<halign>left</halign>
<property>/systems/failures/hyd-yellow</property>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
<checkbox>
<label>Yellow ENG 2 Pump</label>
<halign>left</halign>
<property>/systems/failures/pump-yellow-eng</property>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
<checkbox>
<label>Yellow ELEC Pump</label>
<halign>left</halign>
<property>/systems/failures/pump-yellow-elec</property>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
<hrule/>
<group>
<layout>hbox</layout>
<button>
<legend>&lt;</legend>
<halign>center</halign>
<pref-width>30</pref-width>
<binding>
<command>nasal</command>
<script>
acconfig.failPage(0);
</script>
</binding>
</button>
<button>
<legend>Reset All</legend>
<halign>center</halign>
<padding>5</padding>
<binding>
<command>nasal</command>
<script>
acconfig.failReset();
</script>
</binding>
</button>
<button>
<legend>&gt;</legend>
<halign>center</halign>
<pref-width>30</pref-width>
<binding>
<command>nasal</command>
<script>
acconfig.failPage(2);
</script>
</binding>
</button>
</group>
</group>

View file

@ -981,10 +981,10 @@
<object-name>GreenEngPump1F</object-name>
<condition>
<or>
<greater-than>
<property>/systems/unused/unused-oh</property>
<value>150</value> <!-- I didn't model faults yet -->
</greater-than>
<equals>
<property>/systems/failures/pump-green</property>
<value>1</value>
</equals>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
@ -1054,10 +1054,10 @@
<object-name>BlueElecPump1F</object-name>
<condition>
<or>
<greater-than>
<property>/systems/unused/unused-oh</property>
<value>150</value> <!-- I didn't model faults yet -->
</greater-than>
<equals>
<property>/systems/failures/pump-blue</property>
<value>1</value>
</equals>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
@ -1109,10 +1109,10 @@
<object-name>PTU1F</object-name>
<condition>
<or>
<greater-than>
<property>/systems/unused/unused-oh</property>
<value>150</value> <!-- I didn't model faults yet -->
</greater-than>
<equals>
<property>/systems/failures/ptu</property>
<value>1</value>
</equals>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
@ -1164,10 +1164,10 @@
<object-name>YellowEngPump1F</object-name>
<condition>
<or>
<greater-than>
<property>/systems/unused/unused-oh</property>
<value>150</value> <!-- I didn't model faults yet -->
</greater-than>
<equals>
<property>/systems/failures/pump-yellow-eng</property>
<value>1</value>
</equals>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
@ -1219,10 +1219,10 @@
<object-name>YellowElecPump1F</object-name>
<condition>
<or>
<greater-than>
<property>/systems/unused/unused-oh</property>
<value>150</value> <!-- I didn't model faults yet -->
</greater-than>
<equals>
<property>/systems/failures/pump-yellow-elec</property>
<value>1</value>
</equals>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
@ -1274,10 +1274,10 @@
<object-name>GalleyPwrBtn1F</object-name>
<condition>
<or>
<greater-than>
<property>/systems/unused/unused-oh</property>
<value>150</value> <!-- I didn't model faults yet -->
</greater-than>
<equals>
<property>/systems/failures/elec-galley</property>
<value>1</value>
</equals>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
@ -1329,10 +1329,10 @@
<object-name>BatteryBtn11F</object-name>
<condition>
<or>
<greater-than>
<property>/systems/unused/unused-oh</property>
<value>150</value> <!-- I didn't model faults yet -->
</greater-than>
<equals>
<property>/systems/failures/elec-batt1</property>
<value>1</value>
</equals>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
@ -1384,10 +1384,10 @@
<object-name>BatteryBtn21F</object-name>
<condition>
<or>
<greater-than>
<property>/systems/unused/unused-oh</property>
<value>150</value> <!-- I didn't model faults yet -->
</greater-than>
<equals>
<property>/systems/failures/elec-batt2</property>
<value>1</value>
</equals>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
@ -1472,10 +1472,10 @@
<object-name>Gen1Btn1F</object-name>
<condition>
<or>
<greater-than>
<property>/systems/unused/unused-oh</property>
<value>150</value> <!-- I didn't model faults yet -->
</greater-than>
<equals>
<property>/systems/failures/elec-gen1</property>
<value>1</value>
</equals>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
@ -1526,10 +1526,10 @@
<object-name>ACESSFeedBtn1F</object-name>
<condition>
<or>
<greater-than>
<property>/systems/unused/unused-oh</property>
<value>150</value> <!-- I didn't model faults yet -->
</greater-than>
<equals>
<property>/systems/failures/elec-ac-ess</property>
<value>1</value>
</equals>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
@ -1580,10 +1580,10 @@
<object-name>APUGenBtn1F</object-name>
<condition>
<or>
<greater-than>
<property>/systems/unused/unused-oh</property>
<value>150</value> <!-- I didn't model faults yet -->
</greater-than>
<equals>
<property>/systems/failures/elec-genapu</property>
<value>1</value>
</equals>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
@ -1729,10 +1729,10 @@
<object-name>Gen2Btn1F</object-name>
<condition>
<or>
<greater-than>
<property>/systems/unused/unused-oh</property>
<value>150</value> <!-- I didn't model faults yet -->
</greater-than>
<equals>
<property>/systems/failures/elec-gen2</property>
<value>1</value>
</equals>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
@ -1877,10 +1877,10 @@
<object-name>ACPack1Btn1F</object-name>
<condition>
<or>
<greater-than>
<property>/systems/unused/unused-oh</property>
<value>150</value> <!-- I didn't model faults yet -->
</greater-than>
<equals>
<property>/systems/failures/pack1</property>
<value>1</value>
</equals>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
@ -1932,10 +1932,10 @@
<object-name>Eng1BleedBtn1F</object-name>
<condition>
<or>
<greater-than>
<property>/systems/unused/unused-oh</property>
<value>150</value> <!-- I didn't model faults yet -->
</greater-than>
<equals>
<property>/systems/failures/bleed-eng1</property>
<value>1</value>
</equals>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
@ -1987,10 +1987,10 @@
<object-name>APUBleedBtn1F</object-name>
<condition>
<or>
<greater-than>
<property>/systems/unused/unused-oh</property>
<value>150</value> <!-- I didn't model faults yet -->
</greater-than>
<equals>
<property>/systems/failures/bleed-apu</property>
<value>1</value>
</equals>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
@ -2042,10 +2042,10 @@
<object-name>Eng2BleedBtn1F</object-name>
<condition>
<or>
<greater-than>
<property>/systems/unused/unused-oh</property>
<value>150</value> <!-- I didn't model faults yet -->
</greater-than>
<equals>
<property>/systems/failures/bleed-eng2</property>
<value>1</value>
</equals>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>
@ -2151,10 +2151,10 @@
<object-name>ACPack2Btn1F</object-name>
<condition>
<or>
<greater-than>
<property>/systems/unused/unused-oh</property>
<value>150</value> <!-- I didn't model faults yet -->
</greater-than>
<equals>
<property>/systems/failures/pack2</property>
<value>1</value>
</equals>
<equals>
<property>/controls/switches/annun-test</property>
<value>1</value>

View file

@ -133,14 +133,20 @@ var master_elec = func {
var gs = getprop("/velocities/groundspeed-kt");
var rat = getprop("/controls/hydraulic/rat");
var manrat = getprop("/controls/hydraulic/rat-man");
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");
var gallery_fail = getprop("/systems/failures/elec-galley");
var genapu_fail = getprop("/systems/failures/elec-genapu");
var gen1_fail = getprop("/systems/failures/elec-gen1");
var gen2_fail = getprop("/systems/failures/elec-gen2");
# Left cross tie yes?
if (extpwr_on and gen_ext_sw) {
setprop("/controls/electrical/xtie/xtieR", 1);
} else if (rpmapu >= 94.9 and gen_apu_sw) {
} else if (rpmapu >= 94.9 and gen_apu_sw and !genapu_fail) {
setprop("/controls/electrical/xtie/xtieR", 1);
} else if (stateL == 3 and gen1_sw) {
} else if (stateL == 3 and gen1_sw and !gen1_fail) {
setprop("/controls/electrical/xtie/xtieR", 1);
} else {
setprop("/controls/electrical/xtie/xtieR", 0);
@ -149,45 +155,81 @@ var master_elec = func {
# Right cross tie yes?
if (extpwr_on and gen_ext_sw) {
setprop("/controls/electrical/xtie/xtieL", 1);
} else if (rpmapu >= 94.9 and gen_apu_sw) {
} else if (rpmapu >= 94.9 and gen_apu_sw and !genapu_fail) {
setprop("/controls/electrical/xtie/xtieL", 1);
} else if (stateR == 3 and gen2_sw) {
} else if (stateR == 3 and gen2_sw and !gen2_fail) {
setprop("/controls/electrical/xtie/xtieL", 1);
} else {
setprop("/controls/electrical/xtie/xtieL", 0);
}
# Left AC/DC bus yes?
# Left DC bus yes?
if (extpwr_on and gen_ext_sw) {
setprop("/systems/electrical/bus/ac1", ac_volt_std);
setprop("/systems/electrical/bus/ac-ess", ac_volt_std);
setprop("/systems/electrical/extra/ext-volts", ac_volt_std);
setprop("/systems/electrical/extra/ext-hz", ac_volt_std);
setprop("/systems/electrical/bus/dc1", dc_volt_std);
setprop("/systems/electrical/bus/dc-ess", dc_volt_std);
setprop("/systems/electrical/bus/dc1-amps", dc_amps_std);
} else if (gen_apu) {
setprop("/systems/electrical/bus/ac1", ac_volt_std);
setprop("/systems/electrical/bus/ac-ess", ac_volt_std);
setprop("/systems/electrical/extra/apu-volts", ac_volt_std);
setprop("/systems/electrical/extra/apu-hz", ac_volt_std);
} else if (gen_apu and !genapu_fail) {
setprop("/systems/electrical/bus/dc1", dc_volt_std);
setprop("/systems/electrical/bus/dc-ess", dc_volt_std);
setprop("/systems/electrical/bus/dc1-amps", dc_amps_std);
} else if (stateL == 3 and gen1_sw) {
setprop("/systems/electrical/bus/ac1", ac_volt_std);
setprop("/systems/electrical/bus/ac-ess", ac_volt_std);
setprop("/systems/electrical/extra/gen1-volts", ac_volt_std);
setprop("/systems/electrical/bus/gen1-hz", ac_hz_std);
} else if (stateL == 3 and gen1_sw and !gen1_fail) {
setprop("/systems/electrical/bus/dc1", dc_volt_std);
setprop("/systems/electrical/bus/dc-ess", dc_volt_std);
setprop("/systems/electrical/bus/dc1-amps", dc_amps_std);
} else if (apu_ext_crosstie_sw == 1 and xtieL) {
setprop("/systems/electrical/bus/ac1", ac_volt_std);
setprop("/systems/electrical/bus/ac-ess", ac_volt_std);
setprop("/systems/electrical/bus/dc1", dc_volt_std);
setprop("/systems/electrical/bus/dc-ess", dc_volt_std);
setprop("/systems/electrical/bus/dc1-amps", dc_amps_std);
} else {
setprop("/systems/electrical/bus/dc1", 0);
setprop("/systems/electrical/bus/dc1-amps", 0);
if (getprop("/systems/electrical/bus/dc2") == 0) {
setprop("/systems/electrical/bus/dc-ess", 0);
}
}
# Right DC bus yes?
if (extpwr_on and gen_ext_sw) {
setprop("/systems/electrical/bus/dc2", dc_volt_std);
setprop("/systems/electrical/bus/dc-ess", dc_volt_std);
setprop("/systems/electrical/bus/dc2-amps", dc_amps_std);
} else if (gen_apu and !genapu_fail) {
setprop("/systems/electrical/bus/dc2", dc_volt_std);
setprop("/systems/electrical/bus/dc-ess", dc_volt_std);
setprop("/systems/electrical/bus/dc2-amps", dc_amps_std);
} else if (stateR == 3 and gen2_sw and !gen2_fail) {
setprop("/systems/electrical/bus/dc2", dc_volt_std);
setprop("/systems/electrical/bus/dc-ess", dc_volt_std);
setprop("/systems/electrical/bus/dc2-amps", dc_amps_std);
} else if (apu_ext_crosstie_sw == 1 and xtieR) {
setprop("/systems/electrical/bus/dc2", dc_volt_std);
setprop("/systems/electrical/bus/dc-ess", dc_volt_std);
setprop("/systems/electrical/bus/dc2-amps", dc_amps_std);
} else {
setprop("/systems/electrical/bus/dc2", 0);
setprop("/systems/electrical/bus/dc2-amps", 0);
if (getprop("/systems/electrical/bus/dc1") == 0) {
setprop("/systems/electrical/bus/dc-ess", 0);
}
}
# Left AC bus yes?
if (extpwr_on and gen_ext_sw) {
setprop("/systems/electrical/bus/ac1", ac_volt_std);
setprop("/systems/electrical/extra/ext-volts", ac_volt_std);
setprop("/systems/electrical/extra/ext-hz", ac_volt_std);
} else if (gen_apu and !genapu_fail) {
setprop("/systems/electrical/bus/ac1", ac_volt_std);
setprop("/systems/electrical/extra/apu-volts", ac_volt_std);
setprop("/systems/electrical/extra/apu-hz", ac_volt_std);
} else if (stateL == 3 and gen1_sw and !gen1_fail) {
setprop("/systems/electrical/bus/ac1", ac_volt_std);
setprop("/systems/electrical/extra/gen1-volts", ac_volt_std);
setprop("/systems/electrical/bus/gen1-hz", ac_hz_std);
} else if (apu_ext_crosstie_sw == 1 and xtieL) {
setprop("/systems/electrical/bus/ac1", ac_volt_std);
setprop("/systems/electrical/extra/gen1-volts", ac_volt_std);
setprop("/systems/electrical/bus/gen1-hz", ac_hz_std);
} else {
setprop("/systems/electrical/bus/ac1", 0);
setprop("/systems/electrical/extra/ext-volts", 0);
@ -196,47 +238,25 @@ var master_elec = func {
setprop("/systems/electrical/extra/apu-hz", 0);
setprop("/systems/electrical/extra/gen1-volts", 0);
setprop("/systems/electrical/bus/gen1-hz", 0);
if (getprop("/systems/electrical/bus/ac2") == 0) {
setprop("/systems/electrical/bus/ac-ess", 0);
}
setprop("/systems/electrical/bus/dc1", 0);
setprop("/systems/electrical/bus/dc1-amps", 0);
if (getprop("/systems/electrical/bus/dc2") == 0) {
setprop("/systems/electrical/bus/dc-ess", 0);
}
}
# Right AC/DC bus yes?
# Right AC bus yes?
if (extpwr_on and gen_ext_sw) {
setprop("/systems/electrical/bus/ac2", ac_volt_std);
setprop("/systems/electrical/bus/ac-ess", ac_volt_std);
setprop("/systems/electrical/extra/ext-volts", ac_volt_std);
setprop("/systems/electrical/extra/ext-hz", ac_hz_std);
setprop("/systems/electrical/bus/dc2", dc_volt_std);
setprop("/systems/electrical/bus/dc-ess", dc_volt_std);
setprop("/systems/electrical/bus/dc2-amps", dc_amps_std);
} else if (gen_apu) {
} else if (gen_apu and !genapu_fail) {
setprop("/systems/electrical/bus/ac2", ac_volt_std);
setprop("/systems/electrical/bus/ac-ess", ac_volt_std);
setprop("/systems/electrical/extra/apu-volts", ac_volt_std);
setprop("/systems/electrical/extra/apu-hz", ac_hz_std);
setprop("/systems/electrical/bus/dc2", dc_volt_std);
setprop("/systems/electrical/bus/dc-ess", dc_volt_std);
setprop("/systems/electrical/bus/dc2-amps", dc_amps_std);
} else if (stateR == 3 and gen2_sw) {
} else if (stateR == 3 and gen2_sw and !gen2_fail) {
setprop("/systems/electrical/bus/ac2", ac_volt_std);
setprop("/systems/electrical/bus/ac-ess", ac_volt_std);
setprop("/systems/electrical/extra/gen2-volts", ac_volt_std);
setprop("/systems/electrical/bus/gen2-hz", ac_hz_std);
setprop("/systems/electrical/bus/dc2", dc_volt_std);
setprop("/systems/electrical/bus/dc-ess", dc_volt_std);
setprop("/systems/electrical/bus/dc2-amps", dc_amps_std);
} else if (apu_ext_crosstie_sw == 1 and xtieR) {
setprop("/systems/electrical/bus/ac2", ac_volt_std);
setprop("/systems/electrical/bus/ac-ess", ac_volt_std);
setprop("/systems/electrical/bus/dc2", dc_volt_std);
setprop("/systems/electrical/bus/dc-ess", dc_volt_std);
setprop("/systems/electrical/bus/dc2-amps", dc_amps_std);
setprop("/systems/electrical/extra/gen2-volts", ac_volt_std);
setprop("/systems/electrical/bus/gen2-hz", ac_hz_std);
} else {
setprop("/systems/electrical/bus/ac2", 0);
setprop("/systems/electrical/extra/ext-volts", 0);
@ -245,17 +265,20 @@ var master_elec = func {
setprop("/systems/electrical/extra/apu-hz", 0);
setprop("/systems/electrical/extra/gen2-volts", 0);
setprop("/systems/electrical/bus/gen2-hz", 0);
if (getprop("/systems/electrical/bus/ac1") == 0) {
setprop("/systems/electrical/bus/ac-ess", 0);
}
setprop("/systems/electrical/bus/dc2", 0);
setprop("/systems/electrical/bus/dc2-amps", 0);
if (getprop("/systems/electrical/bus/dc1") == 0) {
setprop("/systems/electrical/bus/dc-ess", 0);
}
}
if (ac_ess >= 100) {
var ac1 = getprop("/systems/electrical/bus/ac1");
var ac2 = getprop("/systems/electrical/bus/ac2");
if (!ac_ess_fail and (ac1 >= 110 or ac2 >= 110)) {
setprop("/systems/electrical/bus/ac-ess", ac_volt_std);
} else {
setprop("/systems/electrical/bus/ac-ess", 0);
}
var ac_ess = getprop("/systems/electrical/bus/ac-ess");
if (ac_ess >= 110 and !gallery_fail) {
if (galley_sw == 1 and !galley_shed) {
setprop("/systems/electrical/bus/galley", ac_volt_std);
} else if (galley_sw or galley_shed) {
@ -300,13 +323,13 @@ var master_elec = func {
# Battery Amps
if (battery1_sw) {
if (battery1_sw and !batt1_fail) {
setprop("/systems/electrical/battery1-amps", dc_amps_std);
} else {
setprop("/systems/electrical/battery1-amps", 0);
}
if (battery2_sw) {
if (battery2_sw and !batt2_fail) {
setprop("/systems/electrical/battery2-amps", dc_amps_std);
} else {
setprop("/systems/electrical/battery2-amps", 0);
@ -321,31 +344,37 @@ var master_elec = func {
if (battery1_volts > 27.9 or (dcbat == 0)) {
setprop("/systems/electrical/extra/battery/bat1-contact", 0);
charge1.stop();
} else if (batt1_fail) {
setprop("/systems/electrical/extra/battery/bat1-contact", 0);
charge1.stop();
}
if (battery2_volts > 27.9 or (dcbat == 0)) {
setprop("/systems/electrical/extra/battery/bat2-contact", 0);
charge2.stop();
} else if (batt2_fail) {
setprop("/systems/electrical/extra/battery/bat2-contact", 0);
charge2.stop();
}
if ((dcbat > 0) and battery1_sw) {
if ((dcbat > 0) and battery1_sw and !batt1_fail) {
setprop("/systems/electrical/extra/battery/bat1-contact", 1);
decharge1.stop();
charge1.start();
}
if ((dcbat > 0) and battery2_sw) {
if ((dcbat > 0) and battery2_sw and !batt2_fail) {
setprop("/systems/electrical/extra/battery/bat2-contact", 1);
decharge1.stop();
charge2.start();
}
if (!bat1_con and (dcbat == 0) and battery1_sw) {
if (!bat1_con and (dcbat == 0) and battery1_sw and !batt1_fail) {
decharge1.start();
}
if (!bat2_con and (dcbat == 0) and battery2_sw) {
if (!bat2_con and (dcbat == 0) and battery2_sw and !batt2_fail) {
decharge2.start();
}

View file

@ -43,6 +43,14 @@ var master_hyd = func {
var rat = getprop("/controls/hydraulic/rat");
var ratout = getprop("/controls/hydraulic/rat-deployed");
var gs = getprop("/velocities/groundspeed-kt");
var blue_leak = getprop("/systems/failures/hyd-blue");
var green_leak = getprop("/systems/failures/hyd-green");
var yellow_leak = getprop("/systems/failures/hyd-yellow");
var blue_pump_fail = getprop("/systems/failures/pump-blue");
var green_pump_fail = getprop("/systems/failures/pump-green");
var yellow_pump_eng_fail = getprop("/systems/failures/pump-yellow-eng");
var yellow_pump_elec_fail = getprop("/systems/failures/pump-yellow-elec");
var ptu_fail = getprop("/systems/failures/ptu");
if (psi_diff > 500 or psi_diff < -500 and ptu_sw) {
setprop("/systems/hydraulic/ptu-active", 1);
@ -59,13 +67,13 @@ var master_hyd = func {
var ptu_active = getprop("/systems/hydraulic/ptu-active");
if (elec_pump_blue_sw and dc_ess >= 25 and (stateL == 3 or stateR == 3)) {
if ((elec_pump_blue_sw and dc_ess >= 25 and !blue_pump_fail) and (stateL == 3 or stateR == 3) and !blue_leak) {
if (blue_psi < 2900) {
setprop("/systems/hydraulic/blue-psi", blue_psi + 100);
} else {
setprop("/systems/hydraulic/blue-psi", 3000);
}
} else if (gs >= 100 and rat) {
} else if (gs >= 100 and rat and !blue_leak) {
if (blue_psi < 2400) {
setprop("/systems/hydraulic/blue-psi", blue_psi + 100);
} else {
@ -79,13 +87,13 @@ var master_hyd = func {
}
}
if (eng1_pump_sw and stateL == 3) {
if ((eng1_pump_sw and stateL == 3 and !green_pump_fail) and !green_leak) {
if (green_psi < 2900) {
setprop("/systems/hydraulic/green-psi", green_psi + 100);
} else {
setprop("/systems/hydraulic/green-psi", 3000);
}
} else if (ptu_active and stateL != 3) {
} else if ((ptu_active and stateL != 3 and !ptu_fail) and !green_leak) {
if (green_psi < 2900) {
setprop("/systems/hydraulic/green-psi", green_psi + 100);
} else {
@ -99,19 +107,19 @@ var master_hyd = func {
}
}
if (eng2_pump_sw and stateR == 3) {
if ((eng2_pump_sw and stateR == 3 and !yellow_pump_eng_fail) and !yellow_leak) {
if (yellow_psi < 2900) {
setprop("/systems/hydraulic/yellow-psi", yellow_psi + 100);
} else {
setprop("/systems/hydraulic/yellow-psi", 3000);
}
} else if (elec_pump_yellow_sw and dc_ess >= 25) {
} else if ((elec_pump_yellow_sw and dc_ess >= 25 and !yellow_pump_elec_fail) and !yellow_leak) {
if (yellow_psi < 2900) {
setprop("/systems/hydraulic/yellow-psi", yellow_psi + 100);
} else {
setprop("/systems/hydraulic/yellow-psi", 3000);
}
} else if (ptu_active and stateR != 3) {
} else if ((ptu_active and stateR != 3 and !ptu_fail) and !yellow_leak) {
if (yellow_psi < 2900) {
setprop("/systems/hydraulic/yellow-psi", yellow_psi + 100);
} else {

View file

@ -52,21 +52,27 @@ var master_pneu = func {
var rpmapu = getprop("/systems/apu/rpm");
var stateL = getprop("/engines/engine[0]/state");
var stateR = getprop("/engines/engine[1]/state");
var bleedapu_fail = getprop("/systems/failures/bleed-apu");
var bleedext_fail = getprop("/systems/failures/bleed-ext");
var bleedeng1_fail = getprop("/systems/failures/bleed-eng1");
var bleedeng2_fail = getprop("/systems/failures/bleed-eng2");
var pack1_fail = getprop("/systems/failures/pack1");
var pack2_fail = getprop("/systems/failures/pack2");
# Air Sources/PSI
if (rpmapu >= 94.9 and bleedapu_sw) {
if (rpmapu >= 94.9 and bleedapu_sw and !bleedapu_fail) {
setprop("/systems/pneumatic/bleedapu", 34);
} else {
setprop("/systems/pneumatic/bleedapu", 0);
}
if (stateL == 3 and bleed1_sw) {
if (stateL == 3 and bleed1_sw and !bleedeng1_fail) {
setprop("/systems/pneumatic/bleed1", 31);
} else {
setprop("/systems/pneumatic/bleed1", 0);
}
if (stateR == 3 and bleed2_sw) {
if (stateR == 3 and bleed2_sw and !bleedeng2_fail) {
setprop("/systems/pneumatic/bleed2", 32);
} else {
setprop("/systems/pneumatic/bleed2", 0);
@ -83,13 +89,13 @@ var master_pneu = func {
setprop("/systems/pneumatic/start-psi", 0);
}
if (pack1_sw == 1 and (bleed1 >= 20 or bleedapu >= 20 or ground >= 20) and eng1_starter == 0 and eng2_starter == 0) {
if (pack1_sw == 1 and (bleed1 >= 20 or bleedapu >= 20 or ground >= 20) and eng1_starter == 0 and eng2_starter == 0 and !pack1_fail) {
setprop("/systems/pneumatic/pack1", pack_flo_sw);
} else {
setprop("/systems/pneumatic/pack1", 0);
}
if (pack2_sw == 1 and (bleed2 >= 20 or bleedapu >= 20 or ground >= 20) and eng1_starter == 0 and eng2_starter == 0) {
if (pack2_sw == 1 and (bleed2 >= 20 or bleedapu >= 20 or ground >= 20) and eng1_starter == 0 and eng2_starter == 0 and !pack2_fail) {
setprop("/systems/pneumatic/pack2", pack_flo_sw);
} else {
setprop("/systems/pneumatic/pack2", 0);
@ -116,7 +122,7 @@ var master_pneu = func {
setprop("/systems/pneumatic/total-psi", total_psi_calc);
}
if (groundair_supp) {
if (groundair_supp) {
setprop("/systems/pneumatic/groundair", 39);
} else {
setprop("/systems/pneumatic/groundair", 0);