1
0
Fork 0

Electrical: use nodes

This commit is contained in:
legoboyvdlp R 2020-08-14 19:22:47 +01:00
parent 7398cc155c
commit 25942cb834
6 changed files with 30 additions and 46 deletions

View file

@ -43,7 +43,6 @@ LBS2KGS = 0.4535924;
# Fetch Nodes
var acconfig_weight_kgs = props.globals.getNode("/systems/acconfig/options/weight-kgs", 1);
var elapsed_sec = props.globals.getNode("/sim/time/elapsed-sec", 1);
var ac2 = props.globals.getNode("/systems/electrical/bus/ac-2", 1);
var autoconfig_running = props.globals.getNode("/systems/acconfig/autoconfig-running", 1);
var lighting_du4 = props.globals.getNode("/controls/lighting/DU/du4", 1);
var ecam_page = props.globals.getNode("/ECAM/Lower/page", 1);
@ -137,9 +136,6 @@ var tr1_volts = props.globals.getNode("/systems/electrical/relay/tr-contactor-1/
var tr2_volts = props.globals.getNode("/systems/electrical/relay/tr-contactor-2/output", 1);
var tr1_amps = props.globals.getNode("/systems/electrical/relay/tr-contactor-1/output-amp", 1);
var tr2_amps = props.globals.getNode("/systems/electrical/relay/tr-contactor-2/output-amp", 1);
var dc1 = props.globals.getNode("/systems/electrical/bus/dc-1", 1);
var dc2 = props.globals.getNode("/systems/electrical/bus/dc-2", 1);
var dc_ess = props.globals.getNode("/systems/electrical/bus/dc-ess", 1);
var switch_emer_gen = props.globals.getNode("/systems/electrical/sources/emer-gen/output-volt", 1);
var switch_gen1 = props.globals.getNode("/controls/electrical/switches/gen-1", 1);
var switch_gen2 = props.globals.getNode("/controls/electrical/switches/gen-2", 1);
@ -151,10 +147,6 @@ var ext_volts = props.globals.getNode("/systems/electrical/sources/ext/output-vo
var ext_hz = props.globals.getNode("/systems/electrical/sources/ext/output-hertz", 1);
var galleyshed = props.globals.getNode("/systems/electrical/some-electric-thingie/galley-shed", 1);
var switch_galley = props.globals.getNode("/controls/electrical/switches/galley", 1);
var dcbat = props.globals.getNode("/systems/electrical/bus/dc-bat", 1);
var ac_ess = props.globals.getNode("/systems/electrical/bus/ac-ess", 1);
var ac1 = props.globals.getNode("/systems/electrical/bus/ac-1", 1);
var ac2 = props.globals.getNode("/systems/electrical/bus/ac-2", 1);
var switch_ac_ess_feed = props.globals.getNode("/controls/electrical/switches/ac-ess-feed", 1);
var tr1_fault = props.globals.getNode("/systems/failures/electrical/tr-1", 1);
var tr2_fault = props.globals.getNode("/systems/failures/electrical/tr-2", 1);
@ -272,7 +264,7 @@ var canvas_lowerECAM_base = {
updateDu4: func() {
var elapsedtime = elapsed_sec.getValue();
if (ac2.getValue() >= 110) {
if (systems.ELEC.Bus.ac2.getValue() >= 110) {
if (du4_offtime.getValue() + 3 < elapsedtime) {
if (gear0_wow.getValue() == 1) {
if (autoconfig_running.getValue() != 1 and du4_test.getValue() != 1) {
@ -298,7 +290,7 @@ var canvas_lowerECAM_base = {
update: func() {
var elapsedtime = elapsed_sec.getValue();
if (ac2.getValue() >= 110 and lighting_du4.getValue() > 0.01) {
if (systems.ELEC.Bus.ac2.getValue() >= 110 and lighting_du4.getValue() > 0.01) {
if (du4_test_time.getValue() + du4_test_amount.getValue() >= elapsedtime) {
lowerECAM_apu.page.hide();
lowerECAM_bleed.page.hide();
@ -1739,31 +1731,31 @@ var canvas_lowerECAM_elec = {
}
# Bus indicators
if (dcbat.getValue() > 25) {
if (systems.ELEC.Bus.dcBat.getValue() > 25) {
me["ELEC-DCBAT-label"].setColor(0.0509,0.7529,0.2941);
} else {
me["ELEC-DCBAT-label"].setColor(0.7333,0.3803,0);
}
if (dc1.getValue() > 25) {
if (systems.ELEC.Bus.dc1.getValue() > 25) {
me["ELEC-DC1-label"].setColor(0.0509,0.7529,0.2941);
} else {
me["ELEC-DC1-label"].setColor(0.7333,0.3803,0);
}
if (dc2.getValue() > 25) {
if (systems.ELEC.Bus.dc2.getValue() > 25) {
me["ELEC-DC2-label"].setColor(0.0509,0.7529,0.2941);
} else {
me["ELEC-DC2-label"].setColor(0.7333,0.3803,0);
}
if (dc_ess.getValue() > 25) {
if (systems.ELEC.Bus.dcEss.getValue() > 25) {
me["ELEC-DCESS-label"].setColor(0.0509,0.7529,0.2941);
} else {
me["ELEC-DCESS-label"].setColor(0.7333,0.3803,0);
}
if (ac_ess.getValue() >= 110) {
if (systems.ELEC.Bus.acEss.getValue() >= 110) {
me["ELEC-ACESS-label"].setColor(0.0509,0.7529,0.2941);
} else {
me["ELEC-ACESS-label"].setColor(0.7333,0.3803,0);
@ -1775,13 +1767,13 @@ var canvas_lowerECAM_elec = {
me["ACESS-SHED"].show();
}
if (ac1.getValue() >= 110) {
if (systems.ELEC.Bus.ac1.getValue() >= 110) {
me["ELEC-AC1-label"].setColor(0.0509,0.7529,0.2941);
} else {
me["ELEC-AC1-label"].setColor(0.7333,0.3803,0);
}
if (ac2.getValue() >= 110) {
if (systems.ELEC.Bus.ac2.getValue() >= 110) {
me["ELEC-AC2-label"].setColor(0.0509,0.7529,0.2941);
} else {
me["ELEC-AC2-label"].setColor(0.7333,0.3803,0);
@ -1813,13 +1805,13 @@ var canvas_lowerECAM_elec = {
me["ELEC-Line-GEN2-AC2"].hide();
}
if (ac1.getValue() >= 110) {
if (systems.ELEC.Bus.ac1.getValue() >= 110) {
me["AC1-in"].show();
} else {
me["AC1-in"].hide();
}
if (ac2.getValue() >= 110) {
if (systems.ELEC.Bus.ac2.getValue() >= 110) {
me["AC2-in"].show();
} else {
me["AC2-in"].hide();
@ -1850,7 +1842,7 @@ var canvas_lowerECAM_elec = {
}
if (getprop("/systems/electrical/relay/ac-ess-feed-1/contact-pos") == 1) {
if (ac1.getValue() >= 110) {
if (systems.ELEC.Bus.ac2.getValue() >= 110) {
me["ELEC-Line-AC1-ACESS"].show();
} else {
me["ELEC-Line-AC1-ACESS"].hide();
@ -1858,7 +1850,7 @@ var canvas_lowerECAM_elec = {
me["ELEC-Line-AC2-ACESS"].hide();
} elsif (getprop("/systems/electrical/relay/ac-ess-feed-2/contact-pos") == 1) {
me["ELEC-Line-AC1-ACESS"].hide();
if (ac2.getValue() >= 110) {
if (systems.ELEC.Bus.ac2.getValue() >= 110) {
me["ELEC-Line-AC2-ACESS"].show();
} else {
me["ELEC-Line-AC2-ACESS"].hide();
@ -1869,7 +1861,7 @@ var canvas_lowerECAM_elec = {
}
if (getprop("/systems/electrical/relay/tr-contactor-1/contact-pos") == 1) {
if (ac1.getValue() < 110) {
if (systems.ELEC.Bus.ac2.getValue() < 110) {
me["ELEC-Line-AC1-TR1"].setColorFill(0.7333,0.3803,0);
} else {
me["ELEC-Line-AC1-TR1"].setColorFill(0.0509,0.7529,0.2941);
@ -1882,7 +1874,7 @@ var canvas_lowerECAM_elec = {
}
if (getprop("/systems/electrical/relay/tr-contactor-2/contact-pos") == 1) {
if (ac2.getValue() < 110) {
if (systems.ELEC.Bus.ac2.getValue() < 110) {
me["ELEC-Line-AC2-TR2"].setColorFill(0.7333,0.3803,0);
} else {
me["ELEC-Line-AC2-TR2"].setColorFill(0.0509,0.7529,0.2941);

View file

@ -74,8 +74,6 @@ var mcdu_keyboard_left = props.globals.getNode("/FMGC/keyboard-left", 0);
var mcdu_keyboard_right = props.globals.getNode("/FMGC/keyboard-right", 0);
#ACCONFIG
var ac1 = props.globals.getNode("/systems/electrical/bus/ac-1", 1);
var ac2 = props.globals.getNode("/systems/electrical/bus/ac-2", 1);
var mcdu1_lgt = props.globals.getNode("/controls/lighting/DU/mcdu1", 1);
var mcdu2_lgt = props.globals.getNode("/controls/lighting/DU/mcdu2", 1);
var acType = props.globals.getNode("/MCDUC/type", 1);

View file

@ -37,8 +37,6 @@ var wow2 = props.globals.getNode("/gear/gear[2]/wow");
var pitch = props.globals.getNode("/orientation/pitch-deg", 1);
var roll = props.globals.getNode("/orientation/roll-deg", 1);
var elapsedtime = props.globals.getNode("/sim/time/elapsed-sec", 1);
var acess = props.globals.getNode("/systems/electrical/bus/ac-ess", 1);
var ac2 = props.globals.getNode("/systems/electrical/bus/ac-2", 1);
var du1_lgt = props.globals.getNode("/controls/lighting/DU/du1", 1);
var du6_lgt = props.globals.getNode("/controls/lighting/DU/du6", 1);
var acconfig = props.globals.getNode("/systems/acconfig/autoconfig-running", 1);
@ -218,7 +216,7 @@ var canvas_PFD_base = {
},
updateDu1: func() {
var elapsedtime_act = elapsedtime.getValue();
if (acess.getValue() >= 110) {
if (systems.ELEC.Bus.acEss.getValue() >= 110) {
if (du1_offtime.getValue() + 3 < elapsedtime_act) {
if (wow0.getValue() == 1) {
if (acconfig.getValue() != 1 and du1_test.getValue() != 1) {
@ -243,7 +241,7 @@ var canvas_PFD_base = {
},
updateDu6: func() {
var elapsedtime_act = elapsedtime.getValue();
if (ac2.getValue() >= 110) {
if (systems.ELEC.Bus.ac2.getValue() >= 110) {
if (du6_offtime.getValue() + 3 < elapsedtime_act) {
if (wow0.getValue() == 1) {
if (acconfig.getValue() != 1 and du6_test.getValue() != 1) {
@ -272,7 +270,7 @@ var canvas_PFD_base = {
if (acconfig_mismatch.getValue() == "0x000") {
PFD_1_mismatch.page.hide();
PFD_2_mismatch.page.hide();
if (acess.getValue() >= 110 and du1_lgt.getValue() > 0.01) {
if (systems.ELEC.Bus.acEss.getValue() >= 110 and du1_lgt.getValue() > 0.01) {
if (du1_test_time.getValue() + du1_test_amount.getValue() >= elapsedtime_act and cpt_du_xfr.getValue() != 1) {
PFD_1_test.update();
updateL = 0;
@ -295,7 +293,7 @@ var canvas_PFD_base = {
PFD_1_test.page.hide();
PFD_1.page.hide();
}
if (ac2.getValue() >= 110 and du6_lgt.getValue() > 0.01) {
if (systems.ELEC.Bus.ac2.getValue() >= 110 and du6_lgt.getValue() > 0.01) {
if (du6_test_time.getValue() + du6_test_amount.getValue() >= elapsedtime_act and fo_du_xfr.getValue() != 1) {
PFD_2_test.update();
updateR = 0;

View file

@ -40,7 +40,6 @@ var slatLockFlash = props.globals.initNode("/instrumentation/du/slat-lock-flash"
var acconfig_weight_kgs = props.globals.getNode("/systems/acconfig/options/weight-kgs", 1);
var et = props.globals.getNode("/sim/time/elapsed-sec", 1);
var acconfig = props.globals.getNode("/systems/acconfig/autoconfig-running", 1);
var acess = props.globals.getNode("/systems/electrical/bus/ac-ess", 1);
var eng_option = props.globals.getNode("/options/eng", 1);
var du3_lgt = props.globals.getNode("/controls/lighting/DU/du3", 1);
var rev_1 = props.globals.getNode("/engines/engine[0]/reverser-pos-norm", 1);
@ -143,7 +142,7 @@ var canvas_upperECAM_base = {
updateDu3: func() {
var elapsedtime = et.getValue();
if (acess.getValue() >= 110) {
if (systems.ELEC.Bus.acEss.getValue() >= 110) {
if (du3_offtime.getValue() + 3 < elapsedtime) {
if (wow0.getValue() == 1) {
if (acconfig.getValue() != 1 and du3_test.getValue() != 1) {
@ -170,7 +169,7 @@ var canvas_upperECAM_base = {
var elapsedtime = et.getValue();
cur_eng_option = eng_option.getValue();
if (acess.getValue() >= 110 and du3_lgt.getValue() > 0.01) {
if (systems.ELEC.Bus.acEss.getValue() >= 110 and du3_lgt.getValue() > 0.01) {
if (du3_test_time.getValue() + du3_test_amount.getValue() >= elapsedtime) {
upperECAM_cfm_eis2.page.hide();
upperECAM_iae_eis2.page.hide();

View file

@ -39,7 +39,6 @@ var Gear = {
};
var Misc = {
acEss: props.globals.getNode("/systems/electrical/bus/ac-ess", 1),
elapsedSec: props.globals.getNode("/sim/time/elapsed-sec", 1),
fbwLaw: props.globals.getNode("/it-fbw/law", 1),
flapNorm: props.globals.getNode("/surface-positions/flap-pos-norm", 1),
@ -442,7 +441,7 @@ var ITAF = {
},
ap1Master: func(s) {
if (s == 1) {
if (Output.vert.getValue() != 6 and !Gear.wow1.getBoolValue() and !Gear.wow2.getBoolValue() and Misc.acEss.getValue() >= 110 and Misc.fbwLaw.getValue() == 0 and Position.gearAglFt.getValue() >= 100) {
if (Output.vert.getValue() != 6 and !Gear.wow1.getBoolValue() and !Gear.wow2.getBoolValue() and systems.ELEC.Bus.acEss.getValue() >= 110 and Misc.fbwLaw.getValue() == 0 and Position.gearAglFt.getValue() >= 100) {
me.revertBasicMode();
Output.ap1.setBoolValue(1);
Output.latTemp = Output.lat.getValue();
@ -463,7 +462,7 @@ var ITAF = {
},
ap2Master: func(s) {
if (s == 1) {
if (Output.vert.getValue() != 6 and !Gear.wow1.getBoolValue() and !Gear.wow2.getBoolValue() and Misc.acEss.getValue() >= 110 and Misc.fbwLaw.getValue() == 0 and Position.gearAglFt.getValue() >= 100) {
if (Output.vert.getValue() != 6 and !Gear.wow1.getBoolValue() and !Gear.wow2.getBoolValue() and systems.ELEC.Bus.acEss.getValue() >= 110 and Misc.fbwLaw.getValue() == 0 and Position.gearAglFt.getValue() >= 100) {
me.revertBasicMode();
Output.ap2.setBoolValue(1);
Output.latTemp = Output.lat.getValue();
@ -493,7 +492,7 @@ var ITAF = {
},
athrMaster: func(s) {
if (s == 1) {
if (Misc.acEss.getValue() >= 110) {
if (systems.ELEC.Bus.acEss.getValue() >= 110) {
Output.athr.setBoolValue(1);
Custom.ThrLock.setValue(0);
Custom.Sound.enableAthrOff = 1;

View file

@ -33,8 +33,6 @@ var eng1Agent2TimerTime = props.globals.initNode("/systems/fire/engine1/agent2-t
var eng2Agent2TimerTime = props.globals.initNode("/systems/fire/engine2/agent2-timer-time", 0, "INT");
var apuAgentTimerTime = props.globals.initNode("/systems/fire/apu/agent-timer-time", 0, "INT");
var wow = props.globals.getNode("/fdm/jsbsim/position/wow", 1);
var dcbatNode = props.globals.getNode("/systems/electrical/bus/dc-bat", 1);
var dcessNode = props.globals.getNode("/systems/electrical/bus/dc-ess", 1);
var apuMaster = props.globals.getNode("/controls/apu/master", 1);
var fire_init = func {
@ -661,7 +659,7 @@ setlistener("/controls/fire/test-btn-1", func() {
if (getprop("/systems/failures/engine-left-fire")) { return; }
if (testBtn.getValue() == 1) {
if (dcbatNode.getValue() > 25 or dcessNode.getValue() > 25) {
if (systems.ELEC.Bus.dcBat.getValue() > 25 or systems.ELEC.Bus.dcEss.getValue() > 25) {
eng1FireWarn.setBoolValue(1);
}
} else {
@ -673,7 +671,7 @@ setlistener("/controls/fire/test-btn-1", func() {
setlistener("/controls/fire/test-btn-2", func() {
if (getprop("/systems/failures/engine-right-fire")) { return; }
if (testBtn2.getValue() == 1) {
if (dcbatNode.getValue() > 25 or dcessNode.getValue() > 25) {
if (systems.ELEC.Bus.dcBat.getValue() > 25 or systems.ELEC.Bus.dcEss.getValue() > 25) {
eng2FireWarn.setBoolValue(1);
}
} else {
@ -685,7 +683,7 @@ setlistener("/controls/fire/test-btn-2", func() {
setlistener("/controls/fire/apu-test-btn", func() {
if (getprop("/systems/failures/apu-fire")) { return; }
if (apuTestBtn.getValue() == 1) {
if (dcbatNode.getValue() > 25 or dcessNode.getValue() > 25) {
if (systems.ELEC.Bus.dcBat.getValue() > 25 or systems.ELEC.Bus.dcEss.getValue() > 25) {
apuFireWarn.setBoolValue(1);
}
} else {
@ -695,7 +693,7 @@ setlistener("/controls/fire/apu-test-btn", func() {
}, 0, 0);
setlistener("/controls/fire/cargo/test", func() {
if (getprop("/systems/failures/aft-cargo-fire") or getprop("/systems/failures/fwd-cargo-fire") or dcbatNode.getValue() < 25 or dcessNode.getValue() < 25) { return; }
if (getprop("/systems/failures/aft-cargo-fire") or getprop("/systems/failures/fwd-cargo-fire") or systems.ELEC.Bus.dcBat.getValue() < 25 or systems.ELEC.Bus.dcEss.getValue() < 25) { return; }
if (cargoTestBtn.getBoolValue()) {
cargoTestTime.setValue(elapsedTime.getValue());
cargoTestChecker.start();
@ -709,7 +707,7 @@ setlistener("/controls/fire/cargo/test", func() {
}, 0, 0);
var doCargoTest = func() {
if (dcbatNode.getValue() >= 25 or dcessNode.getValue() >= 25) {
if (systems.ELEC.Bus.dcBat.getValue() > 25 or systems.ELEC.Bus.dcEss.getValue() > 25) {
aftCargoFireWarn.setBoolValue(1);
fwdCargoFireWarn.setBoolValue(1);
cargoTestTime2.setValue(elapsedTime.getValue());
@ -728,7 +726,7 @@ var doCargoTest2 = func() {
var doCargoTest3 = func() {
dischTest.setBoolValue(0);
if (dcbatNode.getValue() >= 25 or dcessNode.getValue() >= 25) {
if (systems.ELEC.Bus.dcBat.getValue() > 25 or systems.ELEC.Bus.dcEss.getValue() > 25) {
aftCargoFireWarn.setBoolValue(1);
fwdCargoFireWarn.setBoolValue(1);
cargoTestTime4.setValue(elapsedTime.getValue());