1
0
Fork 0

Merge branch 'master' into ADIRS

This commit is contained in:
legoboyvdlp R 2019-11-21 16:34:28 +00:00
commit f64bbea9f2
63 changed files with 2691 additions and 822 deletions

View file

@ -197,7 +197,7 @@
<nasal>
<specific>
<file>Aircraft/A320-family/Nasal/a320livery-cfm-100.nas</file>
<file>Aircraft/A320-family/Nasal/Sim/a320livery-cfm-100.nas</file>
</specific>
</nasal>

View file

@ -197,7 +197,7 @@
<nasal>
<specific>
<file>Aircraft/A320-family/Nasal/a320livery-cfm.nas</file>
<file>Aircraft/A320-family/Nasal/Sim/a320livery-cfm.nas</file>
</specific>
</nasal>

View file

@ -197,7 +197,7 @@
<nasal>
<specific>
<file>Aircraft/A320-family/Nasal/a320livery-iae.nas</file>
<file>Aircraft/A320-family/Nasal/Sim/a320livery-iae.nas</file>
</specific>
</nasal>

View file

@ -139,6 +139,9 @@
<autopilot n="12">
<path>Aircraft/A320-family/Systems/a320-lights-proprules.xml</path>
</autopilot>
<autopilot n="13">
<path>Aircraft/A320-family/Systems/ecam-proprules.xml</path>
</autopilot>
<path>Aircraft/A320-family/Systems/pitot-static.xml</path>
</systems>
@ -320,6 +323,15 @@
</script>
</binding>
</item>
<item>
<label>Refuel Panel</label>
<binding>
<command>nasal</command>
<script><![CDATA[
Dialogs.refuelDialog.openDialog();
]]></script>
</binding>
</item>
<item>
<label>Pushback</label>
<binding>
@ -652,6 +664,19 @@
<pump-right-1 type="bool">0</pump-right-1>
<pump-right-2 type="bool">0</pump-right-2>
</switches>
<refuel>
<valve-l-guard type="bool">0</valve-l-guard>
<valve-c-guard type="bool">0</valve-c-guard>
<valve-r-guard type="bool">0</valve-r-guard>
<mode-guard type="bool">0</mode-guard>
<valve-l type="double">0.5</valve-l>
<valve-c type="double">0.5</valve-c>
<valve-r type="double">0.5</valve-r>
<mode type="double">0.5</mode>
<power type="bool">0</power>
<test type="double">0.5</test>
<amount type="double">12.0</amount>
</refuel>
</fuel>
<gear>
<brake-parking type="bool">0</brake-parking>
@ -1733,48 +1758,48 @@
<nasal>
<pts>
<file>Aircraft/A320-family/Nasal/property-tree-setup.nas</file>
<file>Aircraft/A320-family/Nasal/Sim/property-tree-setup.nas</file>
</pts>
<libraries>
<file>Aircraft/A320-family/Nasal/libraries.nas</file>
<file>Aircraft/A320-family/Nasal/buttons.nas</file>
<file>Aircraft/A320-family/Nasal/efis.nas</file>
<file>Aircraft/A320-family/Nasal/ECAM.nas</file>
<file>Aircraft/A320-family/Nasal/shake.nas</file>
<file>Aircraft/A320-family/Nasal/light-manager.nas</file>
<file>Aircraft/A320-family/Nasal/zoom-views.nas</file>
<file>Aircraft/A320-family/Nasal/ECAM/ECAM-main.nas</file>
<file>Aircraft/A320-family/Nasal/Effects/light-manager.nas</file>
<file>Aircraft/A320-family/Nasal/Sim/libraries.nas</file>
<file>Aircraft/A320-family/Nasal/Sim/buttons.nas</file>
<file>Aircraft/A320-family/Nasal/Sim/shake.nas</file>
<file>Aircraft/A320-family/Nasal/Sim/zoom-views.nas</file>
<file>Aircraft/A320-family/Nasal/Systems/efis.nas</file>
</libraries>
<acconfig>
<file>Aircraft/A320-family/AircraftConfig/acconfig.nas</file>
</acconfig>
<systems>
<file>Aircraft/A320-family/Nasal/electrical.nas</file>
<file>Aircraft/A320-family/Nasal/pneumatics.nas</file>
<file>Aircraft/A320-family/Nasal/hydraulics.nas</file>
<file>Aircraft/A320-family/Nasal/fuel.nas</file>
<file>Aircraft/A320-family/Nasal/engines-common.nas</file>
<file>Aircraft/A320-family/Nasal/ADIRS.nas</file>
<file>Aircraft/A320-family/Nasal/ADIRS/ADR.nas</file>
<file>Aircraft/A320-family/Nasal/ADIRS/SwitchingPanel.nas</file>
<file>Aircraft/A320-family/Nasal/fire.nas</file>
<file>Aircraft/A320-family/Nasal/brakes.nas</file>
<file>Aircraft/A320-family/Nasal/ground_services.nas</file>
<file>Aircraft/A320-family/Nasal/payload.nas</file>
<file>Aircraft/A320-family/Nasal/effects.nas</file>
<file>Aircraft/A320-family/Nasal/Effects/effects.nas</file>
<file>Aircraft/A320-family/Nasal/Systems/electrical.nas</file>
<file>Aircraft/A320-family/Nasal/Systems/pneumatics.nas</file>
<file>Aircraft/A320-family/Nasal/Systems/hydraulics.nas</file>
<file>Aircraft/A320-family/Nasal/Systems/fuel.nas</file>
<file>Aircraft/A320-family/Nasal/Systems/FADEC/engines-common.nas</file>
<file>Aircraft/A320-family/Nasal/Systems/ADIRS/ADIRS.nas</file>
<file>Aircraft/A320-family/Nasal/Systems/ADIRS/ADR.nas</file>
<file>Aircraft/A320-family/Nasal/Systems/ADIRS/SwitchingPanel.nas</file>
<file>Aircraft/A320-family/Nasal/Systems/fire.nas</file>
<file>Aircraft/A320-family/Nasal/Systems/brakes.nas</file>
<file>Aircraft/A320-family/Nasal/Systems/ground_services.nas</file>
<file>Aircraft/A320-family/Nasal/Systems/payload.nas</file>
</systems>
<fadec>
<file>Aircraft/A320-family/Nasal/fadec-common.nas</file>
<file>Aircraft/A320-family/Nasal/Systems/FADEC/fadec-common.nas</file>
</fadec>
<fbw>
<file>Aircraft/A320-family/Nasal/it-fbw.nas</file>
<file>Aircraft/A320-family/Nasal/FBW/it-fbw.nas</file>
</fbw>
<fcu>
<file>Aircraft/A320-family/Nasal/FMGC/FCU.nas</file>
</fcu>
<fmgc>
<file>Aircraft/A320-family/Nasal/FMGC.nas</file>
<file>Aircraft/A320-family/Nasal/FMGC-b.nas</file>
<file>Aircraft/A320-family/Nasal/FMGC-c.nas</file>
<file>Aircraft/A320-family/Nasal/FMGC/FMGC.nas</file>
<file>Aircraft/A320-family/Nasal/FMGC/FMGC-b.nas</file>
<file>Aircraft/A320-family/Nasal/FMGC/FMGC-c.nas</file>
</fmgc>
<mcdu>
<file>Aircraft/A320-family/Nasal/MCDU/MCDU.nas</file>
@ -1811,32 +1836,35 @@
<file>Aircraft/A320-family/Nasal/ECAM/ECAM-phases.nas</file>
</ecam>
<icing>
<file>Aircraft/A320-family/Nasal/icing.nas</file>
<file>Aircraft/A320-family/Nasal/Systems/icing.nas</file>
</icing>
<autopush>
<file>Aircraft/A320-family/Nasal/autopush.nas</file>
<file>Aircraft/A320-family/Nasal/Autopush/autopush.nas</file>
</autopush>
<autopush_driver>
<file>Aircraft/A320-family/Nasal/autopush_driver.nas</file>
<file>Aircraft/A320-family/Nasal/Autopush/autopush_driver.nas</file>
</autopush_driver>
<dynarr>
<file>Aircraft/A320-family/Nasal/dynarr.nas</file>
<file>Aircraft/A320-family/Nasal/Autopush/dynarr.nas</file>
</dynarr>
<autopush_route>
<file>Aircraft/A320-family/Nasal/autopush_route.nas</file>
<file>Aircraft/A320-family/Nasal/Autopush/autopush_route.nas</file>
</autopush_route>
<rmp>
<file>Aircraft/A320-family/Nasal/rmp.nas</file>
<file>Aircraft/A320-family/Nasal/Panels/rmp.nas</file>
</rmp>
<acp>
<file>Aircraft/A320-family/Nasal/acp.nas</file>
<file>Aircraft/A320-family/Nasal/Panels/acp.nas</file>
</acp>
<atc>
<file>Aircraft/A320-family/Nasal/atc.nas</file>
<file>Aircraft/A320-family/Nasal/Panels/atc.nas</file>
</atc>
<dmc>
<file>Aircraft/A320-family/Nasal/DMC.nas</file>
<file>Aircraft/A320-family/Nasal/Systems/DMC.nas</file>
</dmc>
<Dialogs>
<file>Aircraft/A320-family/gui/dialogs/refuel.nas</file>
</Dialogs>
</nasal>
</PropertyList>

View file

@ -197,7 +197,7 @@
<nasal>
<specific>
<file>Aircraft/A320-family/Nasal/a320livery-neocfm.nas</file>
<file>Aircraft/A320-family/Nasal/Sim/a320livery-neocfm.nas</file>
</specific>
</nasal>

View file

@ -197,7 +197,7 @@
<nasal>
<specific>
<file>Aircraft/A320-family/Nasal/a320livery-neopw.nas</file>
<file>Aircraft/A320-family/Nasal/Sim/a320livery-neopw.nas</file>
</specific>
</nasal>

View file

@ -134,9 +134,9 @@ setlistener("/systems/acconfig/new-revision", func {
});
var mismatch_chk = func {
if (num(string.replace(getprop("/sim/version/flightgear"),".","")) < 201910) {
if (num(string.replace(getprop("/sim/version/flightgear"),".","")) < 201912) {
setprop("/systems/acconfig/mismatch-code", "0x121");
setprop("/systems/acconfig/mismatch-reason", "FGFS version is too old! Please update FlightGear to at least 2019.1.0.");
setprop("/systems/acconfig/mismatch-reason", "FGFS version is too old! Please update FlightGear to at least 2019.1.2.");
if (getprop("/systems/acconfig/out-of-date") != 1) {
error_mismatch.open();
}
@ -342,12 +342,12 @@ var beforestart = func {
}
var beforestart_b = func {
# Continue with engine start prep.
setprop("/controls/fuel/tank0pump1", 1);
setprop("/controls/fuel/tank0pump2", 1);
setprop("/controls/fuel/tank1pump1", 1);
setprop("/controls/fuel/tank1pump2", 1);
setprop("/controls/fuel/tank2pump1", 1);
setprop("/controls/fuel/tank2pump2", 1);
systems.FUEL.Switches.pumpLeft1.setValue(1);
systems.FUEL.Switches.pumpLeft2.setValue(1);
systems.FUEL.Switches.pumpCenter1.setValue(1);
systems.FUEL.Switches.pumpCenter2.setValue(1);
systems.FUEL.Switches.pumpRight1.setValue(1);
systems.FUEL.Switches.pumpRight2.setValue(1);
setprop("/controls/electrical/switches/apu", 1);
setprop("/controls/electrical/switches/galley", 1);
setprop("/controls/electrical/switches/gen-1", 1);
@ -424,12 +424,12 @@ var taxi = func {
}
var taxi_b = func {
# Continue with engine start prep, and start engines.
setprop("/controls/fuel/tank0pump1", 1);
setprop("/controls/fuel/tank0pump2", 1);
setprop("/controls/fuel/tank1pump1", 1);
setprop("/controls/fuel/tank1pump2", 1);
setprop("/controls/fuel/tank2pump1", 1);
setprop("/controls/fuel/tank2pump2", 1);
systems.FUEL.Switches.pumpLeft1.setValue(1);
systems.FUEL.Switches.pumpLeft2.setValue(1);
systems.FUEL.Switches.pumpCenter1.setValue(1);
systems.FUEL.Switches.pumpCenter2.setValue(1);
systems.FUEL.Switches.pumpRight1.setValue(1);
systems.FUEL.Switches.pumpRight2.setValue(1);
setprop("/controls/electrical/switches/apu", 1);
setprop("/controls/electrical/switches/galley", 1);
setprop("/controls/electrical/switches/gen-1", 1);

View file

@ -6,6 +6,15 @@
<PropertyList>
<nasal>
<close>
<![CDATA[
systems.FUEL.Nodes.requestLbs.setValue(0);
]]>
</close>
</nasal>
<name>fuel-dlg</name>
<layout>vbox</layout>
@ -132,11 +141,22 @@
<binding>
<command>nasal</command>
<script>
if ((getprop("/services/fuel-truck/enable") == 1) and (getprop("/services/fuel-truck/connect") == 1)) {
systems.fuelSvc.refuel();
screen.log.write("Refueling process started.", 0, 0.584, 1);
} else
screen.log.write("Please Enable and Connect the Fuel Truck First!", 1, 0, 0);
<![CDATA[
if (systems.fuelSvc.Nodes.requestLbs.getValue() > 0) {
if ((getprop("/services/fuel-truck/enable") == 1) and getprop("/services/fuel-truck/connect") == 1) {
if (systems.fuelSvc.Nodes.requestTotalLbs.getValue() - pts.Consumables.Fuel.totalFuelLbs.getValue() > 0) {
systems.fuelSvc.refuel();
screen.log.write("Refueling process started.", 0, 0.584, 1);
} else {
screen.log.write("Refuelling complete.", 0, 0.584, 1);
}
} else {
screen.log.write("Please Enable and Connect the Fuel Truck First!", 1, 0, 0);
}
} else {
screen.log.write("Refuelling quantity incorrect.", 0, 0.584, 1);
}
]]>
</script>
</binding>
</button>

View file

@ -1209,7 +1209,7 @@
</greater-than-equals>
</condition>
<command>nasal</command>
<script>libraries.LowerECAM.button("sts");</script>
<script>libraries.ECAMControlPanel.sysPageBtn("sts");</script>
</binding>
</action>
</animation>
@ -1228,7 +1228,7 @@
</greater-than-equals>
</condition>
<command>nasal</command>
<script>libraries.LowerECAM.button("apu");</script>
<script>libraries.ECAMControlPanel.sysPageBtn("apu");</script>
</binding>
</action>
</animation>
@ -1247,7 +1247,7 @@
</greater-than-equals>
</condition>
<command>nasal</command>
<script>libraries.LowerECAM.button("bleed");</script>
<script>libraries.ECAMControlPanel.sysPageBtn("bleed");</script>
</binding>
</action>
</animation>
@ -1266,7 +1266,7 @@
</greater-than-equals>
</condition>
<command>nasal</command>
<script>libraries.LowerECAM.button("press");</script>
<script>libraries.ECAMControlPanel.sysPageBtn("press");</script>
</binding>
</action>
</animation>
@ -1285,7 +1285,7 @@
</greater-than-equals>
</condition>
<command>nasal</command>
<script>libraries.LowerECAM.button("elec");</script>
<script>libraries.ECAMControlPanel.sysPageBtn("elec");</script>
</binding>
</action>
</animation>
@ -1304,7 +1304,7 @@
</greater-than-equals>
</condition>
<command>nasal</command>
<script>libraries.LowerECAM.button("hyd");</script>
<script>libraries.ECAMControlPanel.sysPageBtn("hyd");</script>
</binding>
</action>
</animation>
@ -1323,7 +1323,7 @@
</greater-than-equals>
</condition>
<command>nasal</command>
<script>libraries.LowerECAM.button("fuel");</script>
<script>libraries.ECAMControlPanel.sysPageBtn("fuel");</script>
</binding>
</action>
</animation>
@ -1342,7 +1342,7 @@
</greater-than-equals>
</condition>
<command>nasal</command>
<script>libraries.LowerECAM.button("eng");</script>
<script>libraries.ECAMControlPanel.sysPageBtn("eng");</script>
</binding>
</action>
</animation>
@ -1361,7 +1361,7 @@
</greater-than-equals>
</condition>
<command>nasal</command>
<script>libraries.LowerECAM.button("cond");</script>
<script>libraries.ECAMControlPanel.sysPageBtn("cond");</script>
</binding>
</action>
</animation>
@ -1380,7 +1380,7 @@
</greater-than-equals>
</condition>
<command>nasal</command>
<script>libraries.LowerECAM.button("door");</script>
<script>libraries.ECAMControlPanel.sysPageBtn("door");</script>
</binding>
</action>
</animation>
@ -1399,7 +1399,7 @@
</greater-than-equals>
</condition>
<command>nasal</command>
<script>libraries.LowerECAM.button("wheel");</script>
<script>libraries.ECAMControlPanel.sysPageBtn("wheel");</script>
</binding>
</action>
</animation>
@ -1418,7 +1418,7 @@
</greater-than-equals>
</condition>
<command>nasal</command>
<script>libraries.LowerECAM.button("fctl");</script>
<script>libraries.ECAMControlPanel.sysPageBtn("fctl");</script>
</binding>
</action>
</animation>
@ -1655,6 +1655,23 @@
</or>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>ecam_sts_led</object-name>
<condition>
<or>
<equals>
<property>ECAM/Lower/light/sts</property>
<value>1</value>
</equals>
<equals>
<property>controls/switches/annun-test</property>
<value>1</value>
</equals>
</or>
</condition>
</animation>
<animation>
<type>pick</type>
@ -1671,7 +1688,7 @@
</condition>
<command>nasal</command>
<script>
ecam.ECAM_controller.recall();
libraries.ECAMControlPanel.rclBtn();
ecam.FWC.Btn.recall.setValue(1);
</script>
</binding>
@ -1702,7 +1719,7 @@
</condition>
<command>nasal</command>
<script>
libraries.LowerECAM.button("clr");
libraries.ECAMControlPanel.clrBtn();
ecam.FWC.Btn.clr.setValue(1);
</script>
</binding>

View file

@ -1,497 +0,0 @@
# A3XX ECAM
# Joshua Davidson (Octal450)
# Copyright (c) 2019 Joshua Davidson (Octal450)
var stateL = 0;
var stateR = 0;
var thrustL = 0;
var thrustR = 0;
var elec = 0;
var speed = 0;
var wow = 0;
var altitude = 0;
var phase = 1;
var toPowerSet = 0;
var eng = "XX";
var eprlim = 0;
var n1lim = 0;
var mode = "XX";
var modeI = "XX";
var man_sel = 0;
var fault_sel = 0;
var fault_page = "";
var warnPhase = 1;
var page = "door";
var aileron = 0;
var elevator = 0;
var elapsedSec = 0;
var fctlCounting = 0;
var fctlTime = 0;
var showAPUPage = 0;
var APUMaster = 0;
var APURPM = 0;
var APUTime = 0;
var APUCounting = 0;
var engModeSel = 0;
var showENGPage = 0;
var ENGTime = 0;
var ENGCounting = 0;
var flapLever = 0;
var CRZTime = 0;
var CRZCondition = 0;
var CRZCounting = 0;
var agl = 0;
var ap_active = 0;
var athr_active = 0;
setprop("/ECAM/left-msg", "NONE");
setprop("/position/gear-agl-ft", 0);
# w = White, b = Blue, g = Green, a = Amber, r = Red
var ECAM = {
init: func() {
setprop("/ECAM/engine-start-time", 0);
setprop("/ECAM/engine-start-time-switch", 0);
setprop("/systems/gear/landing-gear-warning-light", 0);
setprop("/ECAM/Lower/page", "door");
setprop("/ECAM/Lower/man-select", 0);
setprop("/ECAM/Lower/fault-select", 0);
setprop("/ECAM/Lower/fault-page", "");
setprop("/ECAM/Lower/apu-timer", 0);
setprop("/ECAM/Lower/eng-timer", 0);
setprop("/ECAM/Lower/fctl-timer", 0);
setprop("/ECAM/Lower/light/apu", 0);
setprop("/ECAM/Lower/light/bleed", 0);
setprop("/ECAM/Lower/light/cond", 0);
setprop("/ECAM/Lower/light/door", 0);
setprop("/ECAM/Lower/light/elec", 0);
setprop("/ECAM/Lower/light/eng", 0);
setprop("/ECAM/Lower/light/fctl", 0);
setprop("/ECAM/Lower/light/fuel", 0);
setprop("/ECAM/Lower/light/hyd", 0);
setprop("/ECAM/Lower/light/press", 0);
setprop("/ECAM/Lower/light/sts", 0);
setprop("/ECAM/Lower/light/wheel", 0);
setprop("/ECAM/Lower/light/clr", 0);
setprop("/ECAM/warning-phase", 1);
setprop("/ECAM/warning-phase-10-time", 0);
setprop("/ECAM/ap-off-time", 0);
setprop("/ECAM/athr-off-time", 0);
setprop("/it-autoflight/output/ap-warning", 0);
setprop("/it-autoflight/output/athr-warning", 0);
var ap_off_time = getprop("/ECAM/ap-off-time");
var athr_off_time = getprop("/ECAM/athr-off-time");
LowerECAM.reset();
},
MSGclr: func() {
setprop("/ECAM/ecam-checklist-active", 0);
setprop("/ECAM/left-msg", "NONE");
setprop("/ECAM/msg/line1", "");
setprop("/ECAM/msg/line2", "");
setprop("/ECAM/msg/line3", "");
setprop("/ECAM/msg/line4", "");
setprop("/ECAM/msg/line5", "");
setprop("/ECAM/msg/line6", "");
setprop("/ECAM/msg/line7", "");
setprop("/ECAM/msg/line8", "");
setprop("/ECAM/msg/linec1", "w");
setprop("/ECAM/msg/linec2", "w");
setprop("/ECAM/msg/linec3", "w");
setprop("/ECAM/msg/linec4", "w");
setprop("/ECAM/msg/linec5", "w");
setprop("/ECAM/msg/linec6", "w");
setprop("/ECAM/msg/linec7", "w");
setprop("/ECAM/msg/linec8", "w");
setprop("/ECAM/rightmsg/line1", "");
setprop("/ECAM/rightmsg/line2", "");
setprop("/ECAM/rightmsg/line3", "");
setprop("/ECAM/rightmsg/line4", "");
setprop("/ECAM/rightmsg/line5", "");
setprop("/ECAM/rightmsg/line6", "");
setprop("/ECAM/rightmsg/line7", "");
setprop("/ECAM/rightmsg/line8", "");
setprop("/ECAM/rightmsg/linec1", "w");
setprop("/ECAM/rightmsg/linec2", "w");
setprop("/ECAM/rightmsg/linec3", "w");
setprop("/ECAM/rightmsg/linec4", "w");
setprop("/ECAM/rightmsg/linec5", "w");
setprop("/ECAM/rightmsg/linec6", "w");
setprop("/ECAM/rightmsg/linec7", "w");
setprop("/ECAM/rightmsg/linec8", "w");
},
loop: func() {
stateL = getprop("/engines/engine[0]/state");
stateR = getprop("/engines/engine[1]/state");
thrustL = getprop("/systems/thrust/state1");
thrustR = getprop("/systems/thrust/state2");
elec = getprop("/systems/electrical/on");
speed = getprop("/instrumentation/airspeed-indicator/indicated-speed-kt");
wow = getprop("/gear/gear[0]/wow");
eng = getprop("/options/eng");
if (stateL != 3 or stateR != 3) {
if (getprop("/ECAM/engine-start-time-switch") != 0) {
setprop("/ECAM/engine-start-time-switch", 0);
setprop("/ECAM/engine-start-time", 0);
}
} else if (stateL == 3 and stateR == 3 and wow == 1) {
if (getprop("/ECAM/engine-start-time-switch") != 1) {
setprop("/ECAM/engine-start-time", getprop("/sim/time/elapsed-sec"));
setprop("/ECAM/engine-start-time-switch", 1);
}
} else if (wow == 1) {
if (getprop("/ECAM/engine-start-time-switch") != 0) {
setprop("/ECAM/engine-start-time-switch", 0);
}
}
if (getprop("/ECAM/show-left-msg") == 1) {
setprop("/ECAM/left-msg", "MSG");
} else {
setprop("/ECAM/left-msg", "NONE");
}
if (getprop("/ECAM/show-right-msg") == 1) {
setprop("/ECAM/right-msg", "MSG");
} else {
setprop("/ECAM/right-msg", "NONE");
}
# AP / ATHR warnings
if (ap_active == 1 and getprop("/it-autoflight/output/ap-warning") == 0) {
ap_active = 0;
} elsif (ap_active == 1 and getprop("/it-autoflight/output/ap-warning") == 1 and getprop("/sim/time/elapsed-sec") > (getprop("/ECAM/ap-off-time") + 9)) {
ap_active = 0;
setprop("/it-autoflight/output/ap-warning", 0);
} elsif (ap_active == 0 and getprop("/it-autoflight/output/ap-warning") != 0) {
ap_active = 1;
}
if (ap_active == 1 and getprop("/it-autoflight/output/ap-warning") == 1 and getprop("/sim/time/elapsed-sec") > (getprop("/ECAM/ap-off-time") + 3) and getprop("/ECAM/warnings/master-warning-light") == 1) {
setprop("/ECAM/warnings/master-warning-light", 0);
}
if (getprop("/it-autoflight/output/ap-warning") == 2 and (getprop("/it-autoflight/output/ap1") == 1 or getprop("/it-autoflight/output/ap2") == 1)) {
setprop("/it-autoflight/output/ap-warning", 0);
}
if (athr_active == 1 and getprop("/it-autoflight/output/athr-warning") == 0) {
athr_active = 0;
} elsif (athr_active == 1 and getprop("/it-autoflight/output/athr-warning") == 1 and getprop("/sim/time/elapsed-sec") > (getprop("/ECAM/athr-off-time") + 9)) {
athr_active = 0;
setprop("/it-autoflight/output/athr-warning", 0);
} elsif (athr_active == 0 and getprop("/it-autoflight/output/athr-warning") != 0) {
athr_active = 1;
}
if (athr_active == 1 and getprop("/it-autoflight/output/athr-warning") == 1 and getprop("/sim/time/elapsed-sec") > (getprop("/ECAM/athr-off-time") + 3) and getprop("/ECAM/warnings/master-caution-light") == 1) {
setprop("/ECAM/warnings/master-caution-light", 0);
}
if (getprop("/it-autoflight/output/athr-warning") == 2 and getprop("/it-autoflight/output/athr") == 1) {
setprop("/it-autoflight/output/athr-warning", 0);
}
LowerECAM.loop();
},
};
ECAM.MSGclr();
# Lower ECAM Pages
var LowerECAM = {
button: func(b) {
man_sel = getprop("/ECAM/Lower/man-select");
if (b == "clr" and getprop("/it-autoflight/output/athr-warning") == 2) {
setprop("/it-autoflight/output/athr-warning", 0);
setprop("/ECAM/Lower/light/clr", 0);
setprop("/ECAM/warnings/master-caution-light", 0);
return;
}
if (b == "clr" and getprop("/it-autoflight/output/ap-warning") == 2) {
setprop("/it-autoflight/output/ap-warning", 0);
setprop("/ECAM/Lower/light/clr", 0);
setprop("/ECAM/warnings/master-warning-light", 0);
return;
}
if (b == "clr") {
ecam.ECAM_controller.clear();
return;
}
if (getprop("/ECAM/Lower/fault-select") == 0) {
if (b != "clr") {
if (!man_sel) {
setprop("/ECAM/Lower/man-select", 1);
setprop("/ECAM/Lower/page", b);
setprop("/ECAM/Lower/light/" ~ b, 1);
} else {
if (b == getprop("/ECAM/Lower/page")) {
setprop("/ECAM/Lower/man-select", 0);
LowerECAM.loop();
setprop("/ECAM/Lower/light/" ~ b, 0);
} else {
setprop("/ECAM/Lower/light/" ~ getprop("/ECAM/Lower/page"), 0);
setprop("/ECAM/Lower/page", b);
setprop("/ECAM/Lower/light/" ~ b, 1);
}
}
} elsif (getprop("/ECAM/Lower/light/clr") == 1) {
setprop("/ECAM/Lower/light/clr", 0);
}
} else {
if (b == "clr") {
setprop("/ECAM/Lower/light/clr", 0);
setprop("/ECAM/Lower/fault-select", 0);
setprop("/ECAM/Lower/fault-page", "");
LowerECAM.loop();
} elsif (!man_sel) {
setprop("/ECAM/Lower/man-select", 1);
setprop("/ECAM/Lower/page", b);
setprop("/ECAM/Lower/light/" ~ b, 1);
} else {
if (b == getprop("/ECAM/Lower/page")) {
setprop("/ECAM/Lower/man-select", 0);
setprop("/ECAM/Lower/light/" ~ b, 0);
setprop("/ECAM/Lower/fault-select", 1);
setprop("/ECAM/Lower/page", getprop("/ECAM/Lower/fault-page"));
} else {
setprop("/ECAM/Lower/light/" ~ getprop("/ECAM/Lower/page"), 0);
setprop("/ECAM/Lower/page", b);
setprop("/ECAM/Lower/light/" ~ b, 1);
}
}
}
},
loop: func() {
man_sel = getprop("/ECAM/Lower/man-select");
fault_sel = getprop("/ECAM/Lower/fault-select");
fault_page = getprop("/ECAM/Lower/fault-page");
page = getprop("/ECAM/Lower/page");
if (!man_sel) {
if (!fault_sel) {
warnPhase = getprop("/ECAM/warning-phase");
aileron = getprop("/fdm/jsbsim/fbw/aileron-sidestick");
elevator = getprop("/fdm/jsbsim/fbw/elevator-sidestick");
APUMaster = getprop("/controls/APU/master");
APURPM = getprop("/systems/apu/rpm");
stateL = getprop("/engines/engine[0]/state");
stateR = getprop("/engines/engine[1]/state");
engModeSel = getprop("/controls/engines/engine-start-switch");
elapsedSec = getprop("/sim/time/elapsed-sec");
if (warnPhase == 2) {
if (abs(aileron) > 0.3 or abs(elevator) > 0.3) {
fctlTime = elapsedSec;
fctlCounting = 1;
} else if (fctlCounting) {
if (fctlTime + 20 < elapsedSec) {
fctlCounting = 0;
}
}
} else {
fctlCounting = 0;
}
if (APURPM > 95) {
if (APUTime + 10 < elapsedSec) {
APUCounting = 0;
}
} else {
if (APUMaster) {
APUTime = elapsedSec;
APUCounting = 1;
} else {
APUCounting = 0;
}
}
if ((APURPM <= 95 or APUCounting) and APUMaster) {
showAPUPage = 1;
} else {
showAPUPage = 0;
}
if (stateL == 3 or stateR == 3) {
if (ENGCounting and ENGTime + 10 < elapsedSec) {
ENGCounting = 0;
}
}
if (((stateL > 0 and stateL != 3) or (stateR > 0 and stateR != 3)) and engModeSel == 2) {
ENGTime = elapsedSec;
ENGCounting = 1;
} else if ((stateL == 0 and stateR == 0) or engModeSel == 1) {
ENGCounting = 0;
}
if (ENGCounting or engModeSel == 0) {
showENGPage = 1;
} else {
showENGPage = 0;
}
if (warnPhase == 1 or warnPhase == 10) {
if (showENGPage) {
if (page != "eng") {
setprop("/ECAM/Lower/page", "eng");
}
} else if (showAPUPage) {
if (page != "apu") {
setprop("/ECAM/Lower/page", "apu");
}
} else if (page != "door") {
setprop("/ECAM/Lower/page", "door");
}
} else if (warnPhase == 2) {
if (showENGPage) {
if (page != "eng") {
setprop("/ECAM/Lower/page", "eng");
}
} else if (showAPUPage) {
if (page != "apu") {
setprop("/ECAM/Lower/page", "apu");
}
} else if (fctlCounting == 1) {
if (page != "fctl") {
setprop("/ECAM/Lower/page", "fctl");
}
} else if (page != "wheel") {
setprop("/ECAM/Lower/page", "wheel");
}
} else if (warnPhase >= 3 and warnPhase <= 5) {
if (page != "eng") {
setprop("/ECAM/Lower/page", "eng");
}
} else if (warnPhase >= 7 and warnPhase <= 9) {
if (showENGPage) {
if (page != "eng") {
setprop("/ECAM/Lower/page", "eng");
}
} else if (showAPUPage) {
if (page != "apu") {
setprop("/ECAM/Lower/page", "apu");
}
} else if (page != "wheel") {
setprop("/ECAM/Lower/page", "wheel");
}
} else if (warnPhase == 6) {
flapLever = getprop("/controls/flight/flap-lever");
gearLever = getprop("/controls/gear/gear-down");
agl = pts.Position.gearAglFt.getValue();
if (CRZCounting and (toPowerSet or flapLever > 0) and !CRZCondition) {
if (CRZTime + 60 < elapsedSec) {
CRZCondition = 1;
CRZCounting = 0;
} else {
CRZCondition = 0;
}
}
if (!CRZCounting and (toPowerSet or flapLever > 0) and !CRZCondition) {
CRZTime = elapsedSec;
CRZCondition = 0;
CRZCounting = 1;
}
if (CRZCondition or (flapLever == 0 and !toPowerSet)) {
if (gearLever and agl <= 16000) {
if (page != "wheel") {
setprop("/ECAM/Lower/page", "wheel");
}
} else if (page != "crz") {
setprop("/ECAM/Lower/page", "crz");
}
} else {
if (showENGPage) {
if (page != "eng") {
setprop("/ECAM/Lower/page", "eng");
}
} else if (showAPUPage) {
if (page != "apu") {
setprop("/ECAM/Lower/page", "apu");
}
} else if (page != "eng") {
setprop("/ECAM/Lower/page", "eng");
}
}
}
} else {
setprop("/ECAM/Lower/light/apu", 0);
setprop("/ECAM/Lower/light/bleed", 0);
setprop("/ECAM/Lower/light/cond", 0);
setprop("/ECAM/Lower/light/door", 0);
setprop("/ECAM/Lower/light/elec", 0);
setprop("/ECAM/Lower/light/eng", 0);
setprop("/ECAM/Lower/light/fctl", 0);
setprop("/ECAM/Lower/light/fuel", 0);
setprop("/ECAM/Lower/light/hyd", 0);
setprop("/ECAM/Lower/light/press", 0);
setprop("/ECAM/Lower/light/sts", 0);
setprop("/ECAM/Lower/light/wheel", 0);
}
}
},
reset: func() {
setprop("/ECAM/Lower/page", "door");
setprop("/ECAM/Lower/man-select", 0);
setprop("/ECAM/Lower/fault-select", 0);
setprop("/ECAM/Lower/light/apu", 0);
setprop("/ECAM/Lower/light/bleed", 0);
setprop("/ECAM/Lower/light/cond", 0);
setprop("/ECAM/Lower/light/door", 0);
setprop("/ECAM/Lower/light/elec", 0);
setprop("/ECAM/Lower/light/eng", 0);
setprop("/ECAM/Lower/light/fctl", 0);
setprop("/ECAM/Lower/light/fuel", 0);
setprop("/ECAM/Lower/light/hyd", 0);
setprop("/ECAM/Lower/light/press", 0);
setprop("/ECAM/Lower/light/sts", 0);
setprop("/ECAM/Lower/light/wheel", 0);
},
failCall: func(page) {
setprop("/ECAM/Lower/man-select", 0);
setprop("/ECAM/Lower/fault-select", 1);
setprop("/ECAM/Lower/fault-page", page);
setprop("/ECAM/Lower/page", page);
setprop("/ECAM/Lower/light/clr", 1);
},
clrLight: func() {
setprop("/ECAM/Lower/light/clr", 1);
}
};
# Autoflight Warnings
var doAthrWarn = func(type) {
if (type == "none") {
return;
} elsif (type == "soft") {
setprop("/ECAM/athr-off-time", getprop("/sim/time/elapsed-sec"));
setprop("/it-autoflight/output/athr-warning", 1);
} else {
libraries.LowerECAM.clrLight();
setprop("/it-autoflight/output/athr-warning", 2);
}
setprop("/ECAM/warnings/master-caution-light", 1);
}
var doApWarn = func(type) {
if (type == "none") {
return;
} elsif (type == "soft") {
setprop("/ECAM/ap-off-time", getprop("/sim/time/elapsed-sec"));
setprop("/it-autoflight/output/ap-warning", 1);
setprop("/ECAM/warnings/master-warning-light", 1);
} else {
setprop("/it-autoflight/output/ap-warning", 2);
# master warning handled by warning system in this case
libraries.LowerECAM.clrLight();
}
}

View file

@ -1,9 +1,6 @@
# A3XX Electronic Centralised Aircraft Monitoring System
# Copyright (c) 2019 Jonathan Redpath (legoboyvdlp)
var leftmsgEnable = props.globals.initNode("/ECAM/show-left-msg", 1, "BOOL");
var rightmsgEnable = props.globals.initNode("/ECAM/show-right-msg", 1, "BOOL");
var lines = [props.globals.getNode("/ECAM/msg/line1", 1), props.globals.getNode("/ECAM/msg/line2", 1), props.globals.getNode("/ECAM/msg/line3", 1), props.globals.getNode("/ECAM/msg/line4", 1), props.globals.getNode("/ECAM/msg/line5", 1), props.globals.getNode("/ECAM/msg/line6", 1), props.globals.getNode("/ECAM/msg/line7", 1), props.globals.getNode("/ECAM/msg/line8", 1)];
var linesCol = [props.globals.getNode("/ECAM/msg/linec1", 1), props.globals.getNode("/ECAM/msg/linec2", 1), props.globals.getNode("/ECAM/msg/linec3", 1), props.globals.getNode("/ECAM/msg/linec4", 1), props.globals.getNode("/ECAM/msg/linec5", 1), props.globals.getNode("/ECAM/msg/linec6", 1), props.globals.getNode("/ECAM/msg/linec7", 1), props.globals.getNode("/ECAM/msg/linec8", 1)];
var rightLines = [props.globals.getNode("/ECAM/rightmsg/line1", 1), props.globals.getNode("/ECAM/rightmsg/line2", 1), props.globals.getNode("/ECAM/rightmsg/line3", 1), props.globals.getNode("/ECAM/rightmsg/line4", 1), props.globals.getNode("/ECAM/rightmsg/line5", 1), props.globals.getNode("/ECAM/rightmsg/line6", 1), props.globals.getNode("/ECAM/rightmsg/line7", 1), props.globals.getNode("/ECAM/rightmsg/line8", 1)];
@ -100,7 +97,7 @@ var warning = {
},
callPage: func() {
if (me.sdPage == "nil" or me.hasCalled == 1) { return; }
#libraries.LowerECAM.failCall(me.sdPage);
libraries.SystemDisplay.failCall(me.sdPage);
me.hasCalled = 1;
}
};
@ -297,6 +294,7 @@ var ECAM_controller = {
w.clearFlag = 1;
hasCleared = 1;
statusFlag = 1;
libraries.ECAMControlPanel.lightOff("clr");
}
}
} else {
@ -305,13 +303,14 @@ var ECAM_controller = {
w.clearFlag = 1;
hasCleared = 1;
statusFlag = 1;
libraries.ECAMControlPanel.lightOff("clr");
break;
}
}
}
if (statusFlag == 1) {
libraries.LowerECAM.failCall("sts");
libraries.SystemDisplay.manCall("sts");
statusFlag = 0;
}
},

View file

@ -6,7 +6,6 @@
var dualFailNode = props.globals.initNode("/ECAM/dual-failure-enabled", 0, "BOOL");
var phaseNode = props.globals.getNode("/ECAM/warning-phase", 1);
var leftMsgNode = props.globals.getNode("/ECAM/left-msg", 1);
var apWarn = props.globals.getNode("/it-autoflight/output/ap-warning", 1);
var athrWarn = props.globals.getNode("/it-autoflight/output/athr-warning", 1);
var emerGen = props.globals.getNode("/controls/electrical/switches/emer-gen", 1);

417
Nasal/ECAM/ECAM-main.nas Normal file
View file

@ -0,0 +1,417 @@
# A3XX ECAM
# Joshua Davidson (Octal450) and Jonathan Redpath (legoboyvdlp)
# Copyright (c) 2019 Joshua Davidson (Octal450) and Jonathan Redpath (legoboyvdlp)
var ap_active = 0;
var athr_active = 0;
var phase = 0;
var aileron = 0;
var elevator = 0;
var stateL = 0;
var stateR = 0;
var engModeSel = 0;
var APUMaster = 0;
var APURPM = 0;
var elapsedSec = 0;
var gearDown = 0;
var agl = 0;
var apOffTime = 0;
var athrOffTime = 0;
var apWarnNode = 0;
var athrWarnNode = 0;
var leftMsg = 0;
var rightMsg = 0;
var engStrtTimeSw = 0;
var engStrtTime = 0;
var page = 0;
var apuLight = 0;
var bleedLight = 0;
var condLight = 0;
var doorLight = 0;
var elecLight = 0;
var engLight = 0;
var fctlLight = 0;
var fuelLight = 0;
var hydLight = 0;
var pressLight = 0;
var stsLight = 0;
var wheelLight = 0;
var clrLight = 0;
var ECAM = {
_cachePage: "",
init: func() {
setprop("/systems/gear/landing-gear-warning-light", 0);
page = props.globals.initNode("/ECAM/Lower/page", "door", "STRING");
apuLight = props.globals.initNode("/ECAM/Lower/light/apu", 0, "BOOL");
bleedLight = props.globals.initNode("/ECAM/Lower/light/bleed", 0, "BOOL");
condLight = props.globals.initNode("/ECAM/Lower/light/cond", 0, "BOOL");
doorLight = props.globals.initNode("/ECAM/Lower/light/door", 0, "BOOL");
elecLight = props.globals.initNode("/ECAM/Lower/light/elec", 0, "BOOL");
engLight = props.globals.initNode("/ECAM/Lower/light/eng", 0, "BOOL");
fctlLight = props.globals.initNode("/ECAM/Lower/light/fctl", 0, "BOOL");
fuelLight = props.globals.initNode("/ECAM/Lower/light/fuel", 0, "BOOL");
hydLight = props.globals.initNode("/ECAM/Lower/light/hyd", 0, "BOOL");
pressLight = props.globals.initNode("/ECAM/Lower/light/press", 0, "BOOL");
stsLight = props.globals.initNode("/ECAM/Lower/light/sts", 0, "BOOL");
wheelLight = props.globals.initNode("/ECAM/Lower/light/wheel", 0, "BOOL");
clrLight = props.globals.initNode("/ECAM/Lower/light/clr", 0, "BOOL");
phase = props.globals.initNode("/ECAM/warning-phase", 0, "INT");
apOffTime = props.globals.initNode("/ECAM/ap-off-time", 0, "INT");
athrOffTime = props.globals.initNode("/ECAM/athr-off-time", 0, "INT");
leftMsg = props.globals.initNode("/ECAM/left-msg", "MSG", "STRING");
rightMsg = props.globals.initNode("/ECAM/right-msg", "MSG", "STRING");
engStrtTimeSw = props.globals.initNode("/ECAM/engine-start-time-switch", 0, "BOOL");
engStrtTime = props.globals.initNode("/ECAM/engine-start-time", 0.0, "DOUBLE");
apWarnNode = props.globals.initNode("/it-autoflight/output/ap-warning", 0, "INT");
athrWarnNode = props.globals.initNode("/it-autoflight/output/athr-warning", 0, "INT");
me.reset();
},
reset: func() {
setprop("/ECAM/msg/line1", "");
setprop("/ECAM/msg/line2", "");
setprop("/ECAM/msg/line3", "");
setprop("/ECAM/msg/line4", "");
setprop("/ECAM/msg/line5", "");
setprop("/ECAM/msg/line6", "");
setprop("/ECAM/msg/line7", "");
setprop("/ECAM/msg/line8", "");
setprop("/ECAM/msg/linec1", "w");
setprop("/ECAM/msg/linec2", "w");
setprop("/ECAM/msg/linec3", "w");
setprop("/ECAM/msg/linec4", "w");
setprop("/ECAM/msg/linec5", "w");
setprop("/ECAM/msg/linec6", "w");
setprop("/ECAM/msg/linec7", "w");
setprop("/ECAM/msg/linec8", "w");
setprop("/ECAM/rightmsg/line1", "");
setprop("/ECAM/rightmsg/line2", "");
setprop("/ECAM/rightmsg/line3", "");
setprop("/ECAM/rightmsg/line4", "");
setprop("/ECAM/rightmsg/line5", "");
setprop("/ECAM/rightmsg/line6", "");
setprop("/ECAM/rightmsg/line7", "");
setprop("/ECAM/rightmsg/line8", "");
setprop("/ECAM/rightmsg/linec1", "w");
setprop("/ECAM/rightmsg/linec2", "w");
setprop("/ECAM/rightmsg/linec3", "w");
setprop("/ECAM/rightmsg/linec4", "w");
setprop("/ECAM/rightmsg/linec5", "w");
setprop("/ECAM/rightmsg/linec6", "w");
setprop("/ECAM/rightmsg/linec7", "w");
setprop("/ECAM/rightmsg/linec8", "w");
page.setValue("door");
apuLight.setValue(0);
bleedLight.setValue(0);
condLight.setValue(0);
doorLight.setValue(0);
elecLight.setValue(0);
engLight.setValue(0);
fctlLight.setValue(0);
fuelLight.setValue(0);
hydLight.setValue(0);
pressLight.setValue(0);
stsLight.setValue(0);
wheelLight.setValue(0);
clrLight.setValue(0);
},
loop: func() {
stateL = pts.Engines.Engine1.state.getValue();
stateR = pts.Engines.Engine2.state.getValue();
wow = pts.Gear.wow[0].getValue();
elapsedTime = pts.Sim.Time.elapsedSec.getValue();
if (stateL != 3 or stateR != 3) {
if (engStrtTimeSw.getBoolValue()) {
engStrtTimeSw.setBoolValue(0);
engStrtTime.setValue(0);
}
} else if (stateL == 3 and stateR == 3 and wow == 1) {
if (!engStrtTimeSw.getBoolValue()) {
engStrtTime.setValue(elapsedTime);
engStrtTimeSw.setBoolValue(1);
}
} else if (wow == 1) {
if (engStrtTimeSw.getBoolValue()) {
engStrtTimeSw.setBoolValue(0);
}
}
# AP / ATHR warnings
if (ap_active == 1 and apWarnNode.getValue() == 0) {
ap_active = 0;
} elsif (ap_active == 1 and apWarnNode.getValue() == 1 and elapsedTime > (apOffTime.getValue() + 9)) {
ap_active = 0;
apWarnNode.setValue(0);
} elsif (ap_active == 0 and apWarnNode.getValue() != 0) {
ap_active = 1;
}
if (ap_active == 1 and apWarnNode.getValue() == 1 and elapsedTime > (apOffTime.getValue() + 3) and ecam.lights[0].getBoolValue()) {
ecam.lights[0].setBoolValue(0);
}
if (apWarnNode.getValue() == 2 and (fmgc.Output.ap1.getValue() == 1 or fmgc.Output.ap2.getValue() == 1)) {
apWarnNode.setValue(0);
}
if (athr_active == 1 and athrWarnNode.getValue() == 0) {
athr_active = 0;
} elsif (athr_active == 1 and athrWarnNode.getValue() == 1 and elapsedTime > (athrOffTime.getValue() + 9)) {
athr_active = 0;
athrWarnNode.setValue(0);
} elsif (athr_active == 0 and athrWarnNode.getValue() != 0) {
athr_active = 1;
}
if (athr_active == 1 and athrWarnNode.getValue() == 1 and elapsedTime > (athrOffTime.getValue() + 3) and ecam.lights[1].getBoolValue()) {
ecam.lights[1].setValue(0);
}
if (athrWarnNode.getValue() == 2 and fmgc.Output.athr.getValue() == 1) {
athrWarnNode.setValue(0);
}
SystemDisplay.update();
if (me._cachePage != SystemDisplay.page) {
me._cachePage = SystemDisplay.page;
page.setValue(SystemDisplay.page);
}
},
clrLight: func() {
clrLight.setValue(1);
}
};
var SystemDisplay = {
page: "",
manShownPage: 0,
failShownPage: 0,
APU10sec: 9,
eng10sec: 9,
fctl20sc: 9,
_apuTime: 0,
_engTime: 0,
_fctlTime: 0,
failCall: func(page) {
if (me.manShownPage) {
me.manShownPage = 0;
ECAMControlPanel.lightOff(me.page);
}
ECAMControlPanel.lightOn(page);
me.page = page;
me.failShownPage = 1;
},
manCall: func(page) {
ECAMControlPanel.lightOff(me.page);
ECAMControlPanel.lightOn(page);
me.page = page;
me.manShownPage = 1;
},
autoCall: func(page) {
if (me.manShownPage or me.failShownPage) { return; }
if (me.page != page) {
me.page = page;
}
},
update: func() {
phase = pts.ECAM.fwcWarningPhase.getValue();
APUMaster = pts.APU.masterSw.getValue();
APURPM = pts.APU.rpm.getValue();
engModeSel = pts.Controls.Engines.startSw.getValue();
elapsedSec = pts.Sim.Time.elapsedSec.getValue();
if (APUMaster == 1 and me.APU10sec != 1) {
me.autoCall("apu");
me.fctl20sec = 9;
if (me.APU10sec == 9 and APURPM >= 95.0) {
me.APU10sec = 0;
me._apuTime = elapsedSec;
}
if (me.APU10sec != 9 and elapsedSec > me._apuTime + 10) {
me.APU10sec = 1;
}
} elsif (engModeSel == 0 or engModeSel == 2 or (engModeSel == 1 and me.eng10sec == 0)) {
me.autoCall("eng");
me.fctl20sec = 9;
if (me.eng10sec == 9 and engModeSel == 1) {
me.eng10sec = 0;
me._engTime = elapsedSec;
}
if (me.eng10sec != 9 and elapsedSec > me._engTime + 10) {
me.eng10sec = 1;
}
} else {
# Reset variables
me.APU10sec = 9;
me.eng10sec = 9;
# Phase logic
if (phase == 1) {
me.autoCall("door");
me.fctl20sec = 9;
} elsif (phase == 2) {
aileron = pts.JSBSim.FBW.aileron.getValue();
elevator = pts.JSBSim.FBW.elevator.getValue();
if (abs(aileron) >= 0.15 or abs(elevator) >= 0.15 and me.fctl20sec == 9) {
me.autoCall("fctl");
if (me.fctl20sec == 9) {
me.fctl20sec = 0;
me._fctlTime = elapsedSec;
}
if (me.fctl20sec != 9 and elapsedSec > me._fctlTime + 20) {
me.fctl20sec = 1;
}
} elsif (me.fctl20sec == 0) {
if (me.fctl20sec != 9 and elapsedSec > me._fctlTime + 20) {
me.fctl20sec = 1;
}
} else {
me.autoCall("wheel");
me.fctl20sec = 9;
}
} elsif (phase >= 3 and phase <= 5) {
me.autoCall("eng");
me.fctl20sec = 9;
} elsif (phase == 6) {
gearLever = pts.Controls.Gear.gearDown.getValue();
agl = pts.Position.gearAglFt.getValue();
if (gearLever and agl <= 16000) {
me.autoCall("wheel");
} else {
me.autoCall("crz");
}
me.fctl20sec = 9;
} elsif (phase >= 7 and phase <= 9) {
me.autoCall("wheel");
me.fctl20sec = 9;
} elsif (phase == 10) {
me.autoCall("door");
me.fctl20sec = 9;
}
}
},
};
var ECAMControlPanel = {
sysPageBtn: func(page) {
if (SystemDisplay.page != page) {
SystemDisplay.manCall(page);
} else {
me.lightOff(SystemDisplay.page);
SystemDisplay.manShownPage = 0;
}
},
rclBtn: func() {
ecam.ECAM_controller.recall();
},
clrBtn: func() {
me.lightOff("clr");
if (athrWarnNode.getValue == 2) {
athrWarnNode.setValue(0);
return;
}
if (apWarnNode.getValue() == 2) {
apWarnNode.setValue(0);
return;
}
if (SystemDisplay.manShownPage) {
me.lightOff(SystemDisplay.page);
SystemDisplay.manShownPage = 0;
return;
}
if (SystemDisplay.failShownPage) {
me.lightOff(SystemDisplay.page);
SystemDisplay.failShownPage = 0;
return;
}
ecam.ECAM_controller.clear();
},
stsBtn: func() {
SystemDisplay.manCall("sts");
},
allBtn: func() {
# todo
},
toConfigBtn: func() {
# todo
},
emerCancBtn: func() {
# todo
},
lightOff: func(page) {
if (page == "clr") { clrLight.setBoolValue(0); }
elsif (page == "apu") { apuLight.setBoolValue(0); }
elsif (page == "bleed") { bleedLight.setBoolValue(0); }
elsif (page == "cond") { condLight.setBoolValue(0); }
elsif (page == "door") { doorLight.setBoolValue(0); }
elsif (page == "elec") { elecLight.setBoolValue(0); }
elsif (page == "eng") { engLight.setBoolValue(0); }
elsif (page == "fctl") { fctlLight.setBoolValue(0); }
elsif (page == "fuel") { fuelLight.setBoolValue(0); }
elsif (page == "hyd") { hydLight.setBoolValue(0); }
elsif (page == "press") { pressLight.setBoolValue(0); }
elsif (page == "sts") { stsLight.setBoolValue(0); }
elsif (page == "wheel") { wheelLight.setBoolValue(0); }
},
lightOn: func(page) {
if (page == "clr") { clrLight.setBoolValue(1); }
elsif (page == "apu") { apuLight.setBoolValue(1); }
elsif (page == "bleed") { bleedLight.setBoolValue(1); }
elsif (page == "cond") { condLight.setBoolValue(1); }
elsif (page == "door") { doorLight.setBoolValue(1); }
elsif (page == "elec") { elecLight.setBoolValue(1); }
elsif (page == "eng") { engLight.setBoolValue(1); }
elsif (page == "fctl") { fctlLight.setBoolValue(1); }
elsif (page == "fuel") { fuelLight.setBoolValue(1); }
elsif (page == "hyd") { hydLight.setBoolValue(1); }
elsif (page == "press") { pressLight.setBoolValue(1); }
elsif (page == "sts") { stsLight.setBoolValue(1); }
elsif (page == "wheel") { wheelLight.setBoolValue(1); }
},
};
# Autoflight Warnings
var doAthrWarn = func(type) {
if (type == "none") {
return;
} elsif (type == "soft") {
athrOffTime.setValue(pts.Sim.Time.elapsedSec.getValue());
athrWarnNode.setValue(1);
} else {
ECAMControlPanel.lightOn("clr");
athrWarnNode.setValue(2);
}
ecam.lights[1].setBoolValue(1);
}
var doApWarn = func(type) {
if (type == "none") {
return;
} elsif (type == "soft") {
apOffTime.setValue(pts.Sim.Time.elapsedSec.getValue());
apWarnNode.setValue(1);
ecam.lights[0].setBoolValue(1);
} else {
apWarnNode.setValue(2);
# master warning handled by warning system in this case
}
}

View file

@ -405,9 +405,4 @@ var light_manager = {
setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-b[4]", 0.0);
me.light5_is_on = 0;
},
};
light_manager.init();
};

View file

@ -195,6 +195,7 @@ var triggerDoor = func(door, doorName, doorDesc) {
var systemsInit = func {
fbw.fctlInit();
light_manager.init();
systems.ELEC.init();
systems.PNEU.init();
systems.HYD.init();

View file

@ -5,6 +5,11 @@
# Anything that says Temp is set by another file to avoid multiple getValue calls
# Usage Example: pts.Class.SubClass.node.getValue()
var APU = {
masterSw: props.globals.getNode("/controls/APU/master"),
rpm: props.globals.getNode("/systems/apu/rpm"),
};
var Consumables = {
Fuel: {
totalFuelLbs: props.globals.getNode("/consumables/fuel/total-fuel-lbs"),
@ -13,6 +18,7 @@ var Consumables = {
var Controls = {
Engines: {
startSw: props.globals.getNode("/controls/engines/engine-start-switch"),
Engine1: {
cutoffSw: props.globals.getNode("/controls/engines/engine[0]/cutoff-switch"),
firePb: props.globals.getNode("/controls/engines/engine[0]/fire-btn"),
@ -24,6 +30,9 @@ var Controls = {
throttle: props.globals.getNode("/controls/engines/engine[1]/throttle"),
},
},
Gear: {
gearDown: props.globals.getNode("/controls/gear/gear-down"),
},
};
var ECAM = {
@ -47,6 +56,7 @@ var Engines = {
var Gear = {
compression: [props.globals.getNode("/gear/gear[0]/compression-norm"),props.globals.getNode("/gear/gear[1]/compression-norm"),props.globals.getNode("/gear/gear[2]/compression-norm")],
wow: [props.globals.getNode("/gear/gear[0]/wow"),props.globals.getNode("/gear/gear[1]/wow"),props.globals.getNode("/gear/gear[2]/wow")],
};
var Instrumentation = {
@ -68,6 +78,10 @@ var JSBSIM = {
};
var JSBSim = {
FBW: {
aileron: props.globals.getNode("/fdm/jsbsim/fbw/aileron-sidestick"),
elevator: props.globals.getNode("/fdm/jsbsim/fbw/elevator-sidestick"),
},
Propulsion: {
Engine1: {
fuelUsed: props.globals.getNode("/fdm/jsbsim/propulsion/engine[0]/fuel-used-lbs"),

View file

@ -2,6 +2,7 @@
# Jonathan Redpath
var fuelSvc = {
_needCenter: 0,
enable: props.globals.getNode("/services/fuel-truck/enable"),
connect: props.globals.getNode("/services/fuel-truck/connect"),
operate: props.globals.getNode("/services/fuel-truck/operate"),
@ -34,16 +35,19 @@ var fuelSvc = {
systems.FUEL.Valves.refuelRight.setBoolValue(1);
if (pts.Sim.aero.getValue() == "A320-200-CFM" and me.Nodes.requestTotalLbs.getValue() > 28229.9) {
systems.FUEL.Valves.refuelCenter.setBoolValue(1);
me._needCenter = 1;
} elsif ((pts.Sim.aero.getValue() == "A320-200-IAE" or pts.Sim.aero.getValue() == "A320-100-CFM") and me.Nodes.requestTotalLbs.getValue() > 27591.8) {
systems.FUEL.Valves.refuelCenter.setBoolValue(1);
me._needCenter = 1;
} elsif ((pts.Sim.aero.getValue() == "A320neo-CFM" or pts.Sim.aero.getValue() == "A320neo-PW") and me.Nodes.requestTotalLbs.getValue() > 27357.8) {
systems.FUEL.Valves.refuelCenter.setBoolValue(1);
me._needCenter = 1;
} else {
me._needCenter = 0;
}
},
stop: func() {
systems.FUEL.refuelling.setBoolValue(0);
# me.Nodes.requestLbs.setValue(0);
systems.FUEL.Valves.refuelLeft.setBoolValue(0);
systems.FUEL.Valves.refuelCenter.setBoolValue(0);
systems.FUEL.Valves.refuelRight.setBoolValue(0);
@ -68,19 +72,44 @@ setlistener("/services/fuel-truck/connect", func() {
}, 0, 0);
var fuelTimer = maketimer(0.25, func() {
if (systems.FUEL.Quantity.leftInnerPct.getValue() >= 0.999) {
if (Dialogs.valve_l.getValue() == 0.5) {
if (systems.FUEL.Quantity.leftInnerPct.getValue() >= 0.999) {
systems.FUEL.Valves.refuelLeft.setBoolValue(0);
} else {
systems.FUEL.Valves.refuelLeft.setBoolValue(1);
}
} elsif (Dialogs.valve_l.getValue() == 1.0 and systems.FUEL.Quantity.leftInnerPct.getValue() < 0.999) {
systems.FUEL.Valves.refuelLeft.setBoolValue(1);
} else {
systems.FUEL.Valves.refuelLeft.setBoolValue(0);
}
if (systems.FUEL.Quantity.centerPct.getValue() >= 0.999) {
systems.FUEL.Valves.refuelCenter.setBoolValue(0);
}
if (systems.FUEL.Quantity.rightInnerPct.getValue() >= 0.999) {
if (Dialogs.valve_r.getValue() == 0.5) {
if (systems.FUEL.Quantity.rightInnerPct.getValue() >= 0.999) {
systems.FUEL.Valves.refuelRight.setBoolValue(0);
} else {
systems.FUEL.Valves.refuelRight.setBoolValue(1);
}
} elsif (Dialogs.valve_r.getValue() == 1.0 and systems.FUEL.Quantity.rightInnerPct.getValue() < 0.999) {
systems.FUEL.Valves.refuelRight.setBoolValue(1);
} else {
systems.FUEL.Valves.refuelRight.setBoolValue(0);
}
if (abs(pts.Consumables.Fuel.totalFuelLbs.getValue() - fuelSvc.Nodes.requestTotalLbs.getValue()) < 5) {
if (Dialogs.valve_c.getValue() == 0.5 and fuelSvc._needCenter == 1) {
if (systems.FUEL.Quantity.centerPct.getValue() >= 0.999 or systems.FUEL.Quantity.leftInnerPct.getValue() < 0.999 or systems.FUEL.Quantity.rightInnerPct.getValue() < 0.999) {
systems.FUEL.Valves.refuelCenter.setBoolValue(0);
} else {
systems.FUEL.Valves.refuelCenter.setBoolValue(1);
}
} elsif (Dialogs.valve_c.getValue() == 1.0 and systems.FUEL.Quantity.centerPct.getValue() < 0.999) {
systems.FUEL.Valves.refuelCenter.setBoolValue(1);
} else {
systems.FUEL.Valves.refuelCenter.setBoolValue(0);
}
if (fuelSvc.Nodes.requestTotalLbs.getValue() - pts.Consumables.Fuel.totalFuelLbs.getValue() <= 0) {
screen.log.write("Refuelling complete.", 0, 0.584, 1);
fuelSvc.stop();
fuelTimer.stop();
}

View file

@ -194,6 +194,7 @@
/systems/fuel/refuel/refuelling eq 0
</test>
<test logic="AND" value="1">
/systems/fuel/valves/outer-inner-transfer-valve-1-power ne 0
<test logic="OR">
/systems/fuel/quantity/left-wing-inner-low eq 1
/systems/fuel/quantity/right-wing-inner-low eq 1
@ -204,8 +205,9 @@
<switch name="/systems/fuel/valves/outer-inner-transfer-valve-1-power">
<default value="0"/>
<test value="0.333">
<test logic="OR" value="0.333">
/systems/electrical/bus/dc-ess-shed ge 25
/systems/electrical/bus/dc-2 ge 25
</test>
</switch>
@ -221,6 +223,7 @@
/systems/fuel/refuel/refuelling eq 0
</test>
<test logic="AND" value="1">
/systems/fuel/valves/outer-inner-transfer-valve-2-power ne 0
<test logic="OR">
/systems/fuel/quantity/left-wing-inner-low eq 1
/systems/fuel/quantity/right-wing-inner-low eq 1
@ -231,8 +234,9 @@
<switch name="/systems/fuel/valves/outer-inner-transfer-valve-2-power">
<default value="0"/>
<test value="0.333">
<test logic="OR" value="0.333">
/systems/electrical/bus/dc-ess-shed ge 25
/systems/electrical/bus/dc-2 ge 25
</test>
</switch>
@ -619,21 +623,35 @@
<switch name="/systems/fuel/internal/left-wing-outer-to-inner-tank">
<default value="0"/>
<test logic="AND" value="/systems/fuel/internal/left-outer-wing-tank-refuel">
/systems/fuel/valves/outer-inner-transfer-valve-1 eq 1
/accelerations/pilot-gdamped ge 0.5
/consumables/fuel/tank[0]/level-gal_us gt /consumables/fuel/tank[0]/unusable-gal_us
/consumables/fuel/tank[1]/level-norm lt 0.9999
/systems/fuel/refuel/refuelling eq 1
</test>
<test logic="AND" value="9">
/systems/fuel/valves/outer-inner-transfer-valve-1 eq 1
/accelerations/pilot-gdamped ge 0.5
/consumables/fuel/tank[0]/level-gal_us gt /consumables/fuel/tank[0]/unusable-gal_us
/consumables/fuel/tank[1]/level-norm lt 0.999
/consumables/fuel/tank[1]/level-norm lt 0.9999
</test>
</switch>
<switch name="/systems/fuel/internal/right-wing-outer-to-inner-tank">
<default value="0"/>
<test logic="AND" value="/systems/fuel/internal/right-outer-wing-tank-refuel">
/systems/fuel/valves/outer-inner-transfer-valve-2 eq 1
/accelerations/pilot-gdamped ge 0.5
/consumables/fuel/tank[4]/level-gal_us gt /consumables/fuel/tank[0]/unusable-gal_us
/consumables/fuel/tank[3]/level-norm lt 0.9999
/systems/fuel/refuel/refuelling eq 1
</test>
<test logic="AND" value="9">
/systems/fuel/valves/outer-inner-transfer-valve-2 eq 1
/accelerations/pilot-gdamped ge 0.5
/consumables/fuel/tank[4]/level-gal_us gt /consumables/fuel/tank[4]/unusable-gal_us
/consumables/fuel/tank[3]/level-norm lt 0.999
/consumables/fuel/tank[3]/level-norm lt 0.9999
</test>
</switch>

232
Systems/ecam-proprules.xml Normal file
View file

@ -0,0 +1,232 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (c) 2019 Joshua Davidson (Octal450) -->
<PropertyList>
<flipflop>
<type>RS</type>
<S>
<property>/systems/electrical/some-electric-thingie/emer-elec-config-generator-1-bustie</property>
</S>
<R>
<not>
<property>/systems/electrical/some-electric-thingie/emer-elec-config</property>
</not>
</R>
<output>/systems/electrical/some-electric-thingie/generator-1-reset-bustie</output>
</flipflop>
<flipflop>
<type>RS</type>
<S>
<property>/systems/electrical/some-electric-thingie/emer-elec-config-generator-2-bustie</property>
</S>
<R>
<not>
<property>/systems/electrical/some-electric-thingie/emer-elec-config</property>
</not>
</R>
<output>/systems/electrical/some-electric-thingie/generator-2-reset-bustie</output>
</flipflop>
<flipflop>
<type>RS</type>
<S>
<property>/systems/electrical/some-electric-thingie/emer-elec-config-generator-1</property>
</S>
<R>
<not>
<property>/systems/electrical/some-electric-thingie/emer-elec-config</property>
</not>
</R>
<output>/systems/electrical/some-electric-thingie/generator-1-reset</output>
</flipflop>
<flipflop>
<type>RS</type>
<S>
<property>/systems/electrical/some-electric-thingie/emer-elec-config-generator-2</property>
</S>
<R>
<not>
<property>/systems/electrical/some-electric-thingie/emer-elec-config</property>
</not>
</R>
<output>/systems/electrical/some-electric-thingie/generator-2-reset</output>
</flipflop>
<flipflop>
<type>RS</type>
<S>
<property>/ECAM/to-config-set</property>
</S>
<R>
<property>/ECAM/to-config-reset</property>
</R>
<output>/ECAM/to-config-flipflop</output>
</flipflop>
<flipflop>
<type>RS</type>
<S>
<property>/ECAM/to-memo-set</property>
</S>
<R>
<property>/ECAM/to-memo-reset</property>
</R>
<output>/ECAM/to-memo-flipflop</output>
</flipflop>
<flipflop>
<type>SR</type>
<S>
<property>/ECAM/ldg-memo-set</property>
</S>
<R>
<property>/ECAM/ldg-memo-reset</property>
</R>
<output>/ECAM/ldg-memo-flipflop</output>
</flipflop>
<flipflop>
<type>RS</type>
<S>
<property>/ECAM/ldg-memo-2200-set</property>
</S>
<R>
<property>/ECAM/ldg-memo-2200-reset</property>
</R>
<output>/ECAM/ldg-memo-2200-flipflop</output>
</flipflop>
<flipflop>
<type>SR</type>
<S>
<property>/ECAM/phases/flipflop/gear-set</property>
</S>
<R>
<property>/ECAM/phases/flipflop/gear-reset</property>
</R>
<output>/ECAM/phases/flipflop/gear-output</output>
</flipflop>
<flipflop>
<type>SR</type>
<S>
<property>/ECAM/phases/flipflop/phase-2-set</property>
</S>
<R>
<property>/ECAM/phases/flipflop/phase-2-reset</property>
</R>
<output>/ECAM/phases/flipflop/phase-2-output</output>
</flipflop>
<flipflop>
<type>RS</type>
<S>
<property>/ECAM/phases/flipflop/phase-10-set</property>
</S>
<R>
<property>/ECAM/phases/flipflop/phase-10-reset</property>
</R>
<output>/ECAM/phases/flipflop/phase-10-output</output>
</flipflop>
<flipflop>
<type>RS</type>
<S>
<property>/ECAM/flipflop/recall-set</property>
</S>
<R>
<property>/ECAM/flipflop/recall-reset</property>
</R>
<output>/ECAM/flipflop/recall-output</output>
</flipflop>
<flipflop>
<type>monostable</type>
<time>
<value>2.0</value>
</time>
<S>
<not>
<property>/ECAM/phases/speed-gt-80</property>
</not>
</S>
<output>/ECAM/phases/monostable-80kt</output>
</flipflop>
<flipflop>
<type>monostable</type>
<time>
<value>300.0</value>
</time>
<S>
<property>/ECAM/phases/monostable/phase-1-300</property>
</S>
<output>/ECAM/phases/monostable/phase-1-output</output>
</flipflop>
<flipflop>
<type>monostable</type>
<time>
<value>120.0</value>
</time>
<S>
<property>/ECAM/phases/monostable/phase-5</property>
</S>
<output>/ECAM/phases/monostable/phase-5-output</output>
</flipflop>
<flipflop>
<type>monostable</type>
<time>
<value>180.0</value>
</time>
<S>
<property>/ECAM/phases/monostable/phase-7</property>
</S>
<output>/ECAM/phases/monostable/phase-7-output</output>
</flipflop>
<flipflop>
<type>monostable</type>
<time>
<value>5.0</value>
</time>
<S>
<property>/ECAM/buttons/recall-status-normal</property>
</S>
<R>
<property>/ECAM/buttons/clear-btn</property>
</R>
<output>/ECAM/buttons/recall-status-normal-output</output>
</flipflop>
<!-- falling edge detector - take inverse of following -->
<flipflop>
<type>monostable</type>
<inverted type="bool">true</inverted>
<time>
<value>3.0</value>
</time>
<S>
<property>/ECAM/phases/monostable/phase-9</property>
</S>
<output>/ECAM/phases/monostable/phase-9-output</output>
</flipflop>
<flipflop>
<type>monostable</type>
<inverted type="bool">true</inverted>
<time>
<value>1.0</value>
</time>
<S>
<property>/ECAM/phases/to-power-set</property>
</S>
<output>/ECAM/phases/monostable/to-power-set-output</output>
</flipflop>
</PropertyList>

View file

@ -399,230 +399,5 @@
<input>0</input>
<output>/ECAM/Upper/N1ylim</output>
</filter>
<flipflop>
<type>RS</type>
<S>
<property>/systems/electrical/some-electric-thingie/emer-elec-config-generator-1-bustie</property>
</S>
<R>
<not>
<property>/systems/electrical/some-electric-thingie/emer-elec-config</property>
</not>
</R>
<output>/systems/electrical/some-electric-thingie/generator-1-reset-bustie</output>
</flipflop>
<flipflop>
<type>RS</type>
<S>
<property>/systems/electrical/some-electric-thingie/emer-elec-config-generator-2-bustie</property>
</S>
<R>
<not>
<property>/systems/electrical/some-electric-thingie/emer-elec-config</property>
</not>
</R>
<output>/systems/electrical/some-electric-thingie/generator-2-reset-bustie</output>
</flipflop>
<flipflop>
<type>RS</type>
<S>
<property>/systems/electrical/some-electric-thingie/emer-elec-config-generator-1</property>
</S>
<R>
<not>
<property>/systems/electrical/some-electric-thingie/emer-elec-config</property>
</not>
</R>
<output>/systems/electrical/some-electric-thingie/generator-1-reset</output>
</flipflop>
<flipflop>
<type>RS</type>
<S>
<property>/systems/electrical/some-electric-thingie/emer-elec-config-generator-2</property>
</S>
<R>
<not>
<property>/systems/electrical/some-electric-thingie/emer-elec-config</property>
</not>
</R>
<output>/systems/electrical/some-electric-thingie/generator-2-reset</output>
</flipflop>
<flipflop>
<type>RS</type>
<S>
<property>/ECAM/to-config-set</property>
</S>
<R>
<property>/ECAM/to-config-reset</property>
</R>
<output>/ECAM/to-config-flipflop</output>
</flipflop>
<flipflop>
<type>RS</type>
<S>
<property>/ECAM/to-memo-set</property>
</S>
<R>
<property>/ECAM/to-memo-reset</property>
</R>
<output>/ECAM/to-memo-flipflop</output>
</flipflop>
<flipflop>
<type>SR</type>
<S>
<property>/ECAM/ldg-memo-set</property>
</S>
<R>
<property>/ECAM/ldg-memo-reset</property>
</R>
<output>/ECAM/ldg-memo-flipflop</output>
</flipflop>
<flipflop>
<type>RS</type>
<S>
<property>/ECAM/ldg-memo-2200-set</property>
</S>
<R>
<property>/ECAM/ldg-memo-2200-reset</property>
</R>
<output>/ECAM/ldg-memo-2200-flipflop</output>
</flipflop>
<flipflop>
<type>SR</type>
<S>
<property>/ECAM/phases/flipflop/gear-set</property>
</S>
<R>
<property>/ECAM/phases/flipflop/gear-reset</property>
</R>
<output>/ECAM/phases/flipflop/gear-output</output>
</flipflop>
<flipflop>
<type>SR</type>
<S>
<property>/ECAM/phases/flipflop/phase-2-set</property>
</S>
<R>
<property>/ECAM/phases/flipflop/phase-2-reset</property>
</R>
<output>/ECAM/phases/flipflop/phase-2-output</output>
</flipflop>
<flipflop>
<type>RS</type>
<S>
<property>/ECAM/phases/flipflop/phase-10-set</property>
</S>
<R>
<property>/ECAM/phases/flipflop/phase-10-reset</property>
</R>
<output>/ECAM/phases/flipflop/phase-10-output</output>
</flipflop>
<flipflop>
<type>RS</type>
<S>
<property>/ECAM/flipflop/recall-set</property>
</S>
<R>
<property>/ECAM/flipflop/recall-reset</property>
</R>
<output>/ECAM/flipflop/recall-output</output>
</flipflop>
<flipflop>
<type>monostable</type>
<time>
<value>2.0</value>
</time>
<S>
<not>
<property>/ECAM/phases/speed-gt-80</property>
</not>
</S>
<output>/ECAM/phases/monostable-80kt</output>
</flipflop>
<flipflop>
<type>monostable</type>
<time>
<value>300.0</value>
</time>
<S>
<property>/ECAM/phases/monostable/phase-1-300</property>
</S>
<output>/ECAM/phases/monostable/phase-1-output</output>
</flipflop>
<flipflop>
<type>monostable</type>
<time>
<value>120.0</value>
</time>
<S>
<property>/ECAM/phases/monostable/phase-5</property>
</S>
<output>/ECAM/phases/monostable/phase-5-output</output>
</flipflop>
<flipflop>
<type>monostable</type>
<time>
<value>180.0</value>
</time>
<S>
<property>/ECAM/phases/monostable/phase-7</property>
</S>
<output>/ECAM/phases/monostable/phase-7-output</output>
</flipflop>
<flipflop>
<type>monostable</type>
<time>
<value>5.0</value>
</time>
<S>
<property>/ECAM/buttons/recall-status-normal</property>
</S>
<R>
<property>/ECAM/buttons/clear-btn</property>
</R>
<output>/ECAM/buttons/recall-status-normal-output</output>
</flipflop>
<!-- falling edge detector - take inverse of following -->
<flipflop>
<type>monostable</type>
<inverted type="bool">true</inverted>
<time>
<value>3.0</value>
</time>
<S>
<property>/ECAM/phases/monostable/phase-9</property>
</S>
<output>/ECAM/phases/monostable/phase-9-output</output>
</flipflop>
<flipflop>
<type>monostable</type>
<inverted type="bool">true</inverted>
<time>
<value>1.0</value>
</time>
<S>
<property>/ECAM/phases/to-power-set</property>
</S>
<output>/ECAM/phases/monostable/to-power-set-output</output>
</flipflop>
</PropertyList>

594
gui/dialogs/refuel.nas Normal file
View file

@ -0,0 +1,594 @@
# A320 Refeul panel
# merspieler
# Copyright (c) 2019 merspieler
# Distribute under the terms of GPLv2.
if (pts.Sim.aero.getValue() == "A320-200-CFM") {
max_fuel = 42.8;
} elsif (pts.Sim.aero.getValue() == "A320-200-IAE" or pts.Sim.aero.getValue() == "A320-100-CFM") {
max_fuel = 42.2;
} elsif (pts.Sim.aero.getValue() == "A320neo-CFM" or pts.Sim.aero.getValue() == "A320neo-PW") {
max_fuel = 42.0;
}
# Get nodes
var valve_l_guard = props.globals.getNode("/controls/fuel/refuel/valve-l-guard", 1);
var valve_c_guard = props.globals.getNode("/controls/fuel/refuel/valve-c-guard", 1);
var valve_r_guard = props.globals.getNode("/controls/fuel/refuel/valve-r-guard", 1);
var mode_guard = props.globals.getNode("/controls/fuel/refuel/mode-guard", 1);
var valve_l = props.globals.getNode("/controls/fuel/refuel/valve-l", 1);
var valve_c = props.globals.getNode("/controls/fuel/refuel/valve-c", 1);
var valve_r = props.globals.getNode("/controls/fuel/refuel/valve-r", 1);
var power = props.globals.getNode("/controls/fuel/refuel/power", 1);
var test = props.globals.getNode("/controls/fuel/refuel/test", 1);
var amount = props.globals.getNode("/controls/fuel/refuel/amount", 1);
var refuelClass = {
_fuelLeftAmount: nil,
_fuelCenterAmount: nil,
_fuelRightAmount: nil,
_fuelTotalAmount: nil,
_fuelPreselectAmount: nil,
new: func() {
var m = {parents:[refuelClass]};
m._title = "Refuel Panel";
m._gfd = nil;
m._canvas = nil;
m._timer = maketimer(0.1, m, refuelClass._timerf);
m._timerUp = maketimer(0.1, m, refuelClass._fuelAdjustUp);
m._timerDn = maketimer(0.1, m, refuelClass._fuelAdjustDn);
return m;
},
close: func() {
me._timer.stop();
me._timerUp.stop();
me._timerDn.stop();
me._gfd.del();
me._gfd = nil;
},
openDialog: func() {
me._gfd = canvas.Window.new([320,375], "dialog");
me._gfd._onClose = func() {refuelDialog._onClose();}
me._gfd.set("title", me._title);
me._canvas = me._gfd.createCanvas();
me._root = me._canvas.createGroup();
me._svg = me._root.createChild("group");
canvas.parsesvg(me._svg, "Aircraft/A320-family/gui/dialogs/refuel.svg");
amount.setValue(math.round((pts.Consumables.Fuel.totalFuelLbs.getValue() + systems.fuelSvc.Nodes.requestLbs.getValue()) / 1000, 0.1));
me._HI_LVL_L = me._svg.getElementById("HI-LVL-L");
me._HI_LVL_C = me._svg.getElementById("HI-LVL-C");
me._HI_LVL_R = me._svg.getElementById("HI-LVL-R");
me._Valve_defuel = me._svg.getElementById("Valve-defuel");
me._Valve_L_guard_open = me._svg.getElementById("Valve-L-guard-open");
me._Valve_L_guard_closed = me._svg.getElementById("Valve-L-guard-closed");
me._Valve_C_guard_open = me._svg.getElementById("Valve-C-guard-open");
me._Valve_C_guard_closed = me._svg.getElementById("Valve-C-guard-closed");
me._Valve_R_guard_open = me._svg.getElementById("Valve-R-guard-open");
me._Valve_R_guard_closed = me._svg.getElementById("Valve-R-guard-closed");
me._Mode_guard_open = me._svg.getElementById("Mode-guard-open");
me._Mode_guard_closed = me._svg.getElementById("Mode-guard-closed");
me._Power_on = me._svg.getElementById("Power-on");
me._Power_norm = me._svg.getElementById("Power-norm");
me._Power_on_hb = me._svg.getElementById("Power-on-hb");
me._Power_norm_hb = me._svg.getElementById("Power-norm-hb");
me._Pre_inc_hb = me._svg.getElementById("Pre-inc-hb");
me._Pre_dec_hb = me._svg.getElementById("Pre-dec-hb");
me._Test_hi_lvl = me._svg.getElementById("Test-hi-lvl");
me._Test_lts = me._svg.getElementById("Test-lts");
me._Test_off = me._svg.getElementById("Test-off");
me._Test_hi_lvl_hb = me._svg.getElementById("Test-hi-lvl-hb");
me._Test_lts_hb = me._svg.getElementById("Test-lts-hb");
me._Valve_L_open = me._svg.getElementById("Valve-L-open");
me._Valve_L_norm = me._svg.getElementById("Valve-L-norm");
me._Valve_L_shut = me._svg.getElementById("Valve-L-shut");
me._Valve_L_open_hb = me._svg.getElementById("Valve-L-open-hb");
me._Valve_L_norm_hb = me._svg.getElementById("Valve-L-norm-hb");
me._Valve_L_shut_hb = me._svg.getElementById("Valve-L-shut-hb");
me._Valve_C_open = me._svg.getElementById("Valve-C-open");
me._Valve_C_norm = me._svg.getElementById("Valve-C-norm");
me._Valve_C_shut = me._svg.getElementById("Valve-C-shut");
me._Valve_C_open_hb = me._svg.getElementById("Valve-C-open-hb");
me._Valve_C_norm_hb = me._svg.getElementById("Valve-C-norm-hb");
me._Valve_C_shut_hb = me._svg.getElementById("Valve-C-shut-hb");
me._Valve_R_open = me._svg.getElementById("Valve-R-open");
me._Valve_R_norm = me._svg.getElementById("Valve-R-norm");
me._Valve_R_shut = me._svg.getElementById("Valve-R-shut");
me._Valve_R_open_hb = me._svg.getElementById("Valve-R-open-hb");
me._Valve_R_norm_hb = me._svg.getElementById("Valve-R-norm-hb");
me._Valve_R_shut_hb = me._svg.getElementById("Valve-R-shut-hb");
me._Mode_refuel = me._svg.getElementById("Mode-refuel");
me._Mode_off = me._svg.getElementById("Mode-off");
me._Mode_defuel = me._svg.getElementById("Mode-defuel");
me._Mode_refuel_hb = me._svg.getElementById("Mode-refuel-hb");
me._Mode_off_hb = me._svg.getElementById("Mode-off-hb");
me._Mode_defuel_hb = me._svg.getElementById("Mode-defuel-hb");
me._FQI_actual = me._svg.getElementById("FQI-actual");
me._FQI_pre = me._svg.getElementById("FQI-pre");
me._FQI_L = me._svg.getElementById("FQI-L");
me._FQI_C = me._svg.getElementById("FQI-C");
me._FQI_R = me._svg.getElementById("FQI-R");
me._END_ind = me._svg.getElementById("END-ind");
# Load current panel state
# Guards
if (valve_l_guard.getValue() == 1) {
me._Valve_L_guard_open.show();
me._Valve_L_guard_closed.hide();
} else {
me._Valve_L_guard_open.hide();
me._Valve_L_guard_closed.show();
}
if (valve_l_guard.getValue() == 1) {
me._Valve_C_guard_open.show();
me._Valve_C_guard_closed.hide();
} else {
me._Valve_C_guard_open.hide();
me._Valve_C_guard_closed.show();
}
if (valve_l_guard.getValue() == 1) {
me._Valve_R_guard_open.show();
me._Valve_R_guard_closed.hide();
} else {
me._Valve_R_guard_open.hide();
me._Valve_R_guard_closed.show();
}
if (systems.FUEL.refuelling.getValue() == 1) {
me._Mode_guard_open.show();
me._Mode_guard_closed.hide();
} else {
me._Mode_guard_open.hide();
me._Mode_guard_closed.show();
}
# Switches
if (power.getValue() == 1) {
me._Power_on.show();
me._Power_norm.hide();
} else {
me._Power_on.hide();
me._Power_norm.show();
}
if (test.getValue() == 1) {
me._Test_hi_lvl.show();
me._Test_off.hide();
me._Test_lts.hide();
} else if (test.getValue() == 0.5) {
me._Test_hi_lvl.hide();
me._Test_off.show();
me._Test_lts.hide();
} else {
me._Test_hi_lvl.hide();
me._Test_off.hide();
me._Test_lts.show();
}
if (valve_l.getValue() == 1) {
me._Valve_L_open.show();
me._Valve_L_norm.hide();
me._Valve_L_shut.hide();
} else if (valve_l.getValue() == 0.5) {
me._Valve_L_open.hide();
me._Valve_L_norm.show();
me._Valve_L_shut.hide();
} else {
me._Valve_L_open.hide();
me._Valve_L_norm.hide();
me._Valve_L_shut.show();
}
if (valve_c.getValue() == 1) {
me._Valve_C_open.show();
me._Valve_C_norm.hide();
me._Valve_C_shut.hide();
} else if (valve_c.getValue() == 0.5) {
me._Valve_C_open.hide();
me._Valve_C_norm.show();
me._Valve_C_shut.hide();
} else {
me._Valve_C_open.hide();
me._Valve_C_norm.hide();
me._Valve_C_shut.show();
}
if (valve_r.getValue() == 1) {
me._Valve_R_open.show();
me._Valve_R_norm.hide();
me._Valve_R_shut.hide();
} else if (valve_r.getValue() == 0.5) {
me._Valve_R_open.hide();
me._Valve_R_norm.show();
me._Valve_R_shut.hide();
} else {
me._Valve_R_open.hide();
me._Valve_R_norm.hide();
me._Valve_R_shut.show();
}
if (systems.FUEL.refuelling.getValue()) {
me._Mode_refuel.show();
me._Mode_off.hide();
me._Mode_defuel.hide();
} else {
me._Mode_refuel.hide();
me._Mode_off.show();
me._Mode_defuel.hide();
}
me._Mode_defuel.hide();
# Listeners
# Guards
me._Valve_L_guard_open.addEventListener("click", func() {
me._Valve_L_guard_open.hide();
me._Valve_L_guard_closed.show();
valve_l_guard.setBoolValue(0);
me._Valve_L_open.hide();
me._Valve_L_norm.show();
me._Valve_L_shut.hide();
valve_l.setValue(0.5);
});
me._Valve_L_guard_closed.addEventListener("click", func() {
me._Valve_L_guard_closed.hide();
me._Valve_L_guard_open.show();
valve_l_guard.setBoolValue(1);
});
me._Valve_C_guard_open.addEventListener("click", func() {
me._Valve_C_guard_open.hide();
me._Valve_C_guard_closed.show();
valve_c_guard.setBoolValue(0);
me._Valve_C_open.hide();
me._Valve_C_norm.show();
me._Valve_C_shut.hide();
valve_c.setValue(0.5);
});
me._Valve_C_guard_closed.addEventListener("click", func() {
me._Valve_C_guard_closed.hide();
me._Valve_C_guard_open.show();
valve_c_guard.setBoolValue(1);
});
me._Valve_R_guard_open.addEventListener("click", func() {
me._Valve_R_guard_open.hide();
me._Valve_R_guard_closed.show();
valve_r_guard.setBoolValue(0);
me._Valve_R_open.hide();
me._Valve_R_norm.show();
me._Valve_R_shut.hide();
valve_r.setValue(0.5);
});
me._Valve_R_guard_closed.addEventListener("click", func() {
me._Valve_R_guard_closed.hide();
me._Valve_R_guard_open.show();
valve_r_guard.setBoolValue(1);
});
me._Mode_guard_open.addEventListener("click", func() {
me._Mode_guard_open.hide();
me._Mode_guard_closed.show();
mode_guard.setBoolValue(0);
me._Mode_refuel.hide();
me._Mode_off.show();
me._Mode_defuel.hide();
});
me._Mode_guard_closed.addEventListener("click", func() {
me._Mode_guard_closed.hide();
me._Mode_guard_open.show();
mode_guard.setBoolValue(1);
});
# Switches
me._Valve_L_open_hb.addEventListener("click", func() {
if (valve_l_guard.getValue() == 1) {
me._Valve_L_open.show();
me._Valve_L_norm.hide();
me._Valve_L_shut.hide();
valve_l.setValue(1);
}
});
me._Valve_L_norm_hb.addEventListener("click", func() {
if (valve_l_guard.getValue() == 1) {
me._Valve_L_open.hide();
me._Valve_L_norm.show();
me._Valve_L_shut.hide();
valve_l.setValue(0.5);
}
});
me._Valve_L_shut_hb.addEventListener("click", func() {
if (valve_l_guard.getValue() == 1) {
me._Valve_L_open.hide();
me._Valve_L_norm.hide();
me._Valve_L_shut.show();
valve_l.setValue(0);
}
});
me._Valve_C_open_hb.addEventListener("click", func() {
if (valve_c_guard.getValue() == 1) {
me._Valve_C_open.show();
me._Valve_C_norm.hide();
me._Valve_C_shut.hide();
valve_c.setValue(1);
}
});
me._Valve_C_norm_hb.addEventListener("click", func() {
if (valve_c_guard.getValue() == 1) {
me._Valve_C_open.hide();
me._Valve_C_norm.show();
me._Valve_C_shut.hide();
valve_c.setValue(0.5);
}
});
me._Valve_C_shut_hb.addEventListener("click", func() {
if (valve_c_guard.getValue() == 1) {
me._Valve_C_open.hide();
me._Valve_C_norm.hide();
me._Valve_C_shut.show();
valve_c.setValue(0);
}
});
me._Valve_R_open_hb.addEventListener("click", func() {
if (valve_r_guard.getValue() == 1) {
me._Valve_R_open.show();
me._Valve_R_norm.hide();
me._Valve_R_shut.hide();
valve_r.setValue(1);
}
});
me._Valve_R_norm_hb.addEventListener("click", func() {
if (valve_r_guard.getValue() == 1) {
me._Valve_R_open.hide();
me._Valve_R_norm.show();
me._Valve_R_shut.hide();
valve_r.setValue(0.5);
}
});
me._Valve_R_shut_hb.addEventListener("click", func() {
if (valve_r_guard.getValue() == 1) {
me._Valve_R_open.hide();
me._Valve_R_norm.hide();
me._Valve_R_shut.show();
valve_r.setValue(0);
}
});
me._Mode_refuel_hb.addEventListener("click", func() {
if (mode_guard.getValue() == 1) {
me._Mode_refuel.show();
me._Mode_off.hide();
me._Mode_defuel.hide();
systems.fuelSvc.refuel();
}
});
me._Mode_off_hb.addEventListener("click", func() {
if (mode_guard.getValue() == 1) {
me._Mode_refuel.hide();
me._Mode_off.show();
me._Mode_defuel.hide();
systems.fuelSvc.stop();
}
});
me._Mode_defuel_hb.addEventListener("click", func() {
#if (mode_guard.getValue() == 1) {
# me._Mode_refuel.hide();
# me._Mode_off.hide();
# me._Mode_defuel.show();
# mode.setValue(0);
#}
});
me._Test_hi_lvl_hb.addEventListener("mousedown", func() {
me._Test_hi_lvl.show();
me._Test_off.hide();
me._Test_lts.hide();
test.setValue(1);
});
me._Test_hi_lvl_hb.addEventListener("mouseup", func() {
me._Test_hi_lvl.hide();
me._Test_off.show();
me._Test_lts.hide();
test.setValue(0.5);
});
me._Test_lts_hb.addEventListener("mousedown", func() {
me._Test_hi_lvl.hide();
me._Test_off.hide();
me._Test_lts.show();
test.setValue(0);
});
me._Test_lts_hb.addEventListener("mouseup", func() {
me._Test_hi_lvl.hide();
me._Test_off.show();
me._Test_lts.hide();
test.setValue(0.5);
});
me._Power_on_hb.addEventListener("click", func() {
me._Power_on.show();
me._Power_norm.hide();
power.setBoolValue(1);
});
me._Power_norm_hb.addEventListener("click", func() {
me._Power_on.hide();
me._Power_norm.show();
power.setBoolValue(0);
});
me._Pre_dec_hb.addEventListener("mousedown", func() {
me._timerDn.start();
});
me._Pre_inc_hb.addEventListener("mousedown", func() {
me._timerUp.start();
});
me._Pre_dec_hb.addEventListener("mouseup", func() {
me._timerDn.stop();
});
me._Pre_inc_hb.addEventListener("mouseup", func() {
me._timerUp.stop();
});
me._timerf();
me._timer.start();
},
_timerf: func() {
# Check power
# TODO cut off power when turned on with BATT POWER switch:
# The electrical supply is automatically cut off:
# After 10 min, if no refuel operation is selected, or
# At the end of refueling.
if ((systems.ELEC.Bus.dcHot1.getValue() >= 25 and power.getValue() == 1) or systems.ELEC.Bus.dc2.getValue() >= 25) {
me._FQI_actual.show();
me._FQI_pre.show();
me._FQI_L.show();
me._FQI_C.show();
me._FQI_R.show();
me._fuelPreselectAmount = amount.getValue();
me._fuelLeftAmount = (systems.FUEL.Quantity.leftOuter.getValue() + systems.FUEL.Quantity.leftInner.getValue()) / 1000;
me._fuelCenterAmount = systems.FUEL.Quantity.center.getValue() / 1000;
me._fuelRightAmount = (systems.FUEL.Quantity.rightOuter.getValue() + systems.FUEL.Quantity.rightInner.getValue()) / 1000;
me._fuelTotalAmount = pts.Consumables.Fuel.totalFuelLbs.getValue() / 1000;
if (me._fuelPreselectAmount >= 10.0) {
me._FQI_pre.setText(sprintf("%2.1f", me._fuelPreselectAmount));
} else {
me._FQI_pre.setText(sprintf("%2.2f", me._fuelPreselectAmount));
}
if (me._fuelLeftAmount >= 10.0) {
me._FQI_L.setText(sprintf("%2.1f", me._fuelLeftAmount));
} else {
me._FQI_L.setText(sprintf("%2.2f", me._fuelLeftAmount));
}
if (me._fuelCenterAmount >= 10.0) {
me._FQI_C.setText(sprintf("%2.1f", me._fuelCenterAmount));
} else {
me._FQI_C.setText(sprintf("%2.2f", me._fuelCenterAmount));
}
if (me._fuelRightAmount >= 10.0) {
me._FQI_R.setText(sprintf("%2.1f", me._fuelRightAmount));
} else {
me._FQI_R.setText(sprintf("%2.2f", me._fuelRightAmount));
}
if (me._fuelTotalAmount >= 10.0) {
me._FQI_actual.setText(sprintf("%2.1f", pts.Consumables.Fuel.totalFuelLbs.getValue() / 1000));
} else {
me._FQI_actual.setText(sprintf("%2.2f", pts.Consumables.Fuel.totalFuelLbs.getValue() / 1000));
}
# HI LVL indicator color: #0184f6
if (systems.FUEL.Quantity.leftInnerPct.getValue() >= 0.999) {
me._HI_LVL_L.setColorFill(0.0039, 0.5176, 0.9647);
} else {
me._HI_LVL_L.setColorFill(0.2353, 0.2117, 0.2117);
}
if (systems.FUEL.Quantity.centerPct.getValue() >= 0.999) {
me._HI_LVL_C.setColorFill(0.0039, 0.5176, 0.9647);
} else {
me._HI_LVL_C.setColorFill(0.2353, 0.2117, 0.2117);
}
if (systems.FUEL.Quantity.rightInnerPct.getValue() >= 0.999) {
me._HI_LVL_R.setColorFill(0.0039, 0.5176, 0.9647);
} else {
me._HI_LVL_R.setColorFill(0.2353, 0.2117, 0.2117);
}
# DEFUEL indicator color: #ffe23f
} else {
me._FQI_actual.hide();
me._FQI_pre.hide();
me._FQI_L.hide();
me._FQI_C.hide();
me._FQI_R.hide();
me._Valve_defuel.setColor(0.2353, 0.2117, 0.2117);
me._HI_LVL_L.setColor(0.2353, 0.2117, 0.2117);
me._HI_LVL_C.setColor(0.2353, 0.2117, 0.2117);
me._HI_LVL_R.setColor(0.2353, 0.2117, 0.2117);
}
},
_fuelAdjustDn: func() {
target = amount.getValue();
if (target > 0) {
amount.setValue(target - 0.1);
if (target - 0.1 >= 10.0) {
me._FQI_pre.setText(sprintf("%2.1f", target - 0.1));
} else {
me._FQI_pre.setText(sprintf("%2.2f", target - 0.1));
}
systems.fuelSvc.Nodes.requestLbs.setValue(((target - 0.1) - math.round(pts.Consumables.Fuel.totalFuelLbs.getValue() / 1000, 0.1)) * 1000);
}
},
_fuelAdjustUp: func() {
target = amount.getValue();
if (target < max_fuel) {
amount.setValue(target + 0.1);
if (target + 0.1 >= 10.0) {
me._FQI_pre.setText(sprintf("%2.1f", target + 0.1));
} else {
me._FQI_pre.setText(sprintf("%2.2f", target + 0.1));
}
systems.fuelSvc.Nodes.requestLbs.setValue(((target + 0.1) - math.round(pts.Consumables.Fuel.totalFuelLbs.getValue() / 1000, 0.1)) * 1000);
}
},
_onClose: func() {
me.close();
},
};
var refuelDialog = refuelClass.new();

1228
gui/dialogs/refuel.svg Normal file

File diff suppressed because it is too large Load diff

After

Width:  |  Height:  |  Size: 59 KiB

View file

@ -1 +1 @@
10
13