A3XX: Add ELACs, SECs, and FACs. Improve Failures, Code cleanup

This commit is contained in:
Joshua Davidson 2017-06-10 11:57:48 -04:00
parent 8fd2fd54ac
commit abd34611ea
8 changed files with 562 additions and 534 deletions

View file

@ -515,36 +515,6 @@
</gear>
<systems>
<failures n="0">
<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>
<fuel n="0">
<only-use-ctr-tank type="bool">0</only-use-ctr-tank>
<tank n="2">

View file

@ -18,59 +18,19 @@ var spinning = maketimer(0.05, func {
}
});
setprop("/systems/acconfig/autoconfig-running", 0);
setprop("/systems/acconfig/spinning", 0);
setprop("/systems/acconfig/spin", "-");
var main_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/main/dialog", "Aircraft/A320Family/AircraftConfig/main.xml");
var welcome_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/welcome/dialog", "Aircraft/A320Family/AircraftConfig/welcome.xml");
var ps_load_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/psload/dialog", "Aircraft/A320Family/AircraftConfig/psload.xml");
var ps_loaded_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/psloaded/dialog", "Aircraft/A320Family/AircraftConfig/psloaded.xml");
var init_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/init/dialog", "Aircraft/A320Family/AircraftConfig/ac_init.xml");
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();
setlistener("/sim/signals/fdm-initialized", func {
init_dlg.close();
welcome_dlg.open();
spinning.stop();
});
var saveSettings = func {
aircraft.data.add("/options/pfd/sidestick-pos", "/controls/adirs/skip");
aircraft.data.save();
}
saveSettings();
var systemsReset = func {
systems.elec_init();
systems.ADIRSreset();
systems.pneu_init();
systems.hyd_init();
systems.press_init();
systems.fuel_init();
fmgc.FMGCinit();
mcdu1.MCDU_reset();
mcdu2.MCDU_reset();
fmgc.APinit();
setprop("/it-autoflight/input/fd1", 1);
setprop("/it-autoflight/input/fd2", 1);
libraries.ECAMinit();
libraries.variousReset();
}
var failReset = func {
setprop("/systems/failures/elac1", 0);
setprop("/systems/failures/elac2", 0);
setprop("/systems/failures/sec1", 0);
setprop("/systems/failures/sec2", 0);
setprop("/systems/failures/sec3", 0);
setprop("/systems/failures/fac1", 0);
setprop("/systems/failures/fac2", 0);
setprop("/systems/failures/aileron-left", 0);
setprop("/systems/failures/aileron-right", 0);
setprop("/systems/failures/elevator-left", 0);
setprop("/systems/failures/elevator-right", 0);
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);
@ -94,19 +54,52 @@ var failReset = func {
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!");
setprop("/systems/failures/spoiler-left", 0);
setprop("/systems/failures/spoiler-right", 0);
failReset();
setprop("/systems/acconfig/autoconfig-running", 0);
setprop("/systems/acconfig/spinning", 0);
setprop("/systems/acconfig/spin", "-");
var main_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/main/dialog", "Aircraft/A320Family/AircraftConfig/main.xml");
var welcome_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/welcome/dialog", "Aircraft/A320Family/AircraftConfig/welcome.xml");
var ps_load_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/psload/dialog", "Aircraft/A320Family/AircraftConfig/psload.xml");
var ps_loaded_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/psloaded/dialog", "Aircraft/A320Family/AircraftConfig/psloaded.xml");
var init_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/init/dialog", "Aircraft/A320Family/AircraftConfig/ac_init.xml");
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");
spinning.start();
init_dlg.open();
setlistener("/sim/signals/fdm-initialized", func {
init_dlg.close();
welcome_dlg.open();
spinning.stop();
});
var saveSettings = func {
aircraft.data.add("/options/pfd/sidestick-pos", "/controls/adirs/skip");
aircraft.data.save();
}
saveSettings();
var systemsReset = func {
fbw.fctlInit();
systems.elec_init();
systems.ADIRSreset();
systems.pneu_init();
systems.hyd_init();
systems.press_init();
systems.fuel_init();
fmgc.FMGCinit();
mcdu1.MCDU_reset();
mcdu2.MCDU_reset();
fmgc.APinit();
setprop("/it-autoflight/input/fd1", 1);
setprop("/it-autoflight/input/fd2", 1);
libraries.ECAMinit();
libraries.variousReset();
}
################

View file

@ -1,158 +0,0 @@
<?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

@ -28,14 +28,17 @@
<hrule/>
<group>
<layout>vbox</layout>
<text>
<halign>left</halign>
<label>Failed when Checked</label>
</text>
<group>
<layout>hbox</layout>
<group>
<layout>vbox</layout>
<group>
<layout>hbox</layout>
@ -101,9 +104,9 @@
</checkbox>
<checkbox>
<label>Spoiler Left</label>
<label>ELAC1</label>
<halign>left</halign>
<property>/systems/failures/spoiler-left</property>
<property>/systems/failures/elac1</property>
<binding>
<command>dialog-apply</command>
</binding>
@ -111,9 +114,59 @@
</checkbox>
<checkbox>
<label>Spoiler Right</label>
<label>ELAC2</label>
<halign>left</halign>
<property>/systems/failures/spoiler-right</property>
<property>/systems/failures/elac2</property>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
<checkbox>
<label>SEC1</label>
<halign>left</halign>
<property>/systems/failures/sec1</property>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
<checkbox>
<label>SEC2</label>
<halign>left</halign>
<property>/systems/failures/sec2</property>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
<checkbox>
<label>SEC3</label>
<halign>left</halign>
<property>/systems/failures/sec3</property>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
<checkbox>
<label>FAC2</label>
<halign>left</halign>
<property>/systems/failures/fac2</property>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
<checkbox>
<label>FAC1</label>
<halign>left</halign>
<property>/systems/failures/fac1</property>
<binding>
<command>dialog-apply</command>
</binding>
@ -204,6 +257,13 @@
<live>true</live>
</checkbox>
</group>
<vrule/>
<group>
<layout>vbox</layout>
<group>
<layout>hbox</layout>
@ -288,27 +348,87 @@
<live>true</live>
</checkbox>
<hrule/>
<group>
<layout>hbox</layout>
<button>
<legend>&lt;</legend>
<halign>center</halign>
<pref-width>30</pref-width>
<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>nasal</command>
<script>
acconfig.failPage(0);
</script>
<command>dialog-apply</command>
</binding>
</button>
<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/>
<button>
<legend>Reset All</legend>
<halign>center</halign>
<padding>5</padding>
<pref-width>120</pref-width>
<binding>
<command>nasal</command>
<script>
@ -317,18 +437,6 @@
</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

@ -1,12 +1,99 @@
# Airbus A3XX FBW/Flight Control Computer System
# Joshua Davidson (it0uchpods)
# 2 ELevator and Aileron Computers (ELAC)
# Aileron Control
# Normal Elevator / Stab Trim Control
# 3 Spoiler Elevator Computers (SEC)
# Spoiler Control
# Standby Elevator / Stab Trim Control
# 2 Flight Agumentation Computers (FAC)
# Electric Rudder Control
# 2 Flight Control Data Concentrators (FCDC)
# Aquire data from ELAC and SEC and send it to the EIS and Centralized Fault Display System
# If All ELACs Fail, Alternate Law
var fctlInit = func {
setprop("/controls/fctl/elac1", 1);
setprop("/controls/fctl/elac2", 1);
setprop("/controls/fctl/sec1", 1);
setprop("/controls/fctl/sec2", 1);
setprop("/controls/fctl/sec3", 1);
setprop("/controls/fctl/fac1", 1);
setprop("/controls/fctl/fac2", 1);
setprop("/systems/fctl/elac1", 0);
setprop("/systems/fctl/elac2", 0);
setprop("/systems/fctl/sec1", 0);
setprop("/systems/fctl/sec2", 0);
setprop("/systems/fctl/fac1", 0);
setprop("/systems/fctl/fac2", 0);
}
###################
# Update Function #
###################
var update_loop = func {
var elac1_sw = getprop("/controls/fctl/elac1");
var elac2_sw = getprop("/controls/fctl/elac2");
var sec1_sw = getprop("/controls/fctl/sec1");
var sec2_sw = getprop("/controls/fctl/sec2");
var sec3_sw = getprop("/controls/fctl/sec3");
var fac1_sw = getprop("/controls/fctl/fac1");
var fac2_sw = getprop("/controls/fctl/fac2");
var elac1_fail = getprop("/systems/failures/elac1");
var elac2_fail = getprop("/systems/failures/elac2");
var sec1_fail = getprop("/systems/failures/sec1");
var sec2_fail = getprop("/systems/failures/sec2");
var sec3_fail = getprop("/systems/failures/sec3");
var fac1_fail = getprop("/systems/failures/fac1");
var fac2_fail = getprop("/systems/failures/fac2");
if (elac1_sw and !elac1_fail) {
setprop("/systems/fctl/elac1", 1);
} else {
setprop("/systems/fctl/elac1", 0);
}
if (elac2_sw and !elac2_fail) {
setprop("/systems/fctl/elac2", 1);
} else {
setprop("/systems/fctl/elac2", 0);
}
if (sec1_sw and !sec1_fail) {
setprop("/systems/fctl/sec1", 1);
} else {
setprop("/systems/fctl/sec1", 0);
}
if (sec2_sw and !sec2_fail) {
setprop("/systems/fctl/sec2", 1);
} else {
setprop("/systems/fctl/sec2", 0);
}
if (sec3_sw and !sec3_fail) {
setprop("/systems/fctl/sec3", 1);
} else {
setprop("/systems/fctl/sec3", 0);
}
if (fac1_sw and !fac1_fail) {
setprop("/systems/fctl/fac1", 1);
} else {
setprop("/systems/fctl/fac1", 0);
}
if (fac2_sw and !fac2_fail) {
setprop("/systems/fctl/fac2", 1);
} else {
setprop("/systems/fctl/fac2", 0);
}
var ail = getprop("/controls/flight/aileron");
if (getprop("/it-fbw/law") == 0) {
@ -86,4 +173,4 @@ setlistener("/sim/signals/fdm-initialized", func {
##########
# Timers #
##########
var updatet = maketimer(0.01, update_loop);
var updatet = maketimer(0.05, update_loop);

View file

@ -157,6 +157,7 @@ var triggerDoor = func(door, doorName, doorDesc) {
#######################
setlistener("/sim/signals/fdm-initialized", func {
fbw.fctlInit();
systems.elec_init();
systems.adirs_init();
systems.pneu_init();

BIN
Resources/fctlfail.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

27
Resources/fctlfail.txt Normal file
View file

@ -0,0 +1,27 @@
PITCH ALT, ROLL DCT, YAW ALT
TRIPLE ADR FAILURE
DOUBLE HYD FAILURE
SLATS LOCKED IN CLEAN (CONF 0 or 1)
PITCH ALT (RED PROT), ROLL DCT, YAW ALT
DOUBLE ELAC FAILURE
SIDESTICK FAULT
DOUBLE ADR FAILURE
ALL SPOILERS LOST
THS JAMMED
3 SEC FAILED
ELAC 2 AND BLUE HYD FAILED
ELAC 1 AND GREEN HYD FAILED
ELAC 1 AND YELLOW HYD FAILED
ONE ELEV JAMMED
RAT OUT
PITCH ALT (RED PROT), ROLL DCT, YAW MECH
2 FAC FAILED
YAW DAMPER FAILED
Y+G HYD FAILED
PITCH DIRETCT, ROLL DIRECT, YAW ALT
RADIO ALT FAILED WHEN
LDG DOWN
or
CONF 2, with BOTH LGCIUs failed