1
0
Fork 0

Merge branch 'dev' into 3D

This commit is contained in:
legoboyvdlp R 2020-09-17 19:49:16 +01:00
commit 74a88f52b3
9 changed files with 350 additions and 319 deletions

View file

@ -5,7 +5,11 @@
<PropertyList include="Aircraft/Generic/Human/Include/walker-include.xml"> <PropertyList include="Aircraft/Generic/Human/Include/walker-include.xml">
<sim> <sim>
<animation>
<fire-services type="bool">0</fire-services>
</animation>
<author>Josh Davidson/Octal450 (Flight Dynamics, Systems, Displays), Jonathan Redpath/legoboyvdlp, merspieler, Matthew Maring/mattmaring (Systems, Displays), Thorsten Herrmann/TH-555, Semir Gebran/CaptB (3D, Textures)</author> <author>Josh Davidson/Octal450 (Flight Dynamics, Systems, Displays), Jonathan Redpath/legoboyvdlp, merspieler, Matthew Maring/mattmaring (Systems, Displays), Thorsten Herrmann/TH-555, Semir Gebran/CaptB (3D, Textures)</author>
<checklists include="A32X-Checklists.xml"/> <checklists include="A32X-Checklists.xml"/>
@ -819,6 +823,7 @@
</refuel> </refuel>
</fuel> </fuel>
<gear> <gear>
<brake-fans type="bool">0</brake-fans>
<brake-parking type="bool">0</brake-parking> <brake-parking type="bool">0</brake-parking>
<tiller-cmd-norm type="double">0</tiller-cmd-norm> <tiller-cmd-norm type="double">0</tiller-cmd-norm>
<tiller-enabled type="bool">0</tiller-enabled> <tiller-enabled type="bool">0</tiller-enabled>
@ -1023,12 +1028,18 @@
<caster-angle-deg-damped type="double">0</caster-angle-deg-damped> <caster-angle-deg-damped type="double">0</caster-angle-deg-damped>
</gear> </gear>
<gear n="1"> <gear n="1">
<Lbrake-smoke type="double">0</Lbrake-smoke>
<L1brake-temp-degc type="double">15</L1brake-temp-degc>
<L2brake-temp-degc type="double">15</L2brake-temp-degc>
<tyre-smoke type="int">0</tyre-smoke> <tyre-smoke type="int">0</tyre-smoke>
<sprayspeed-ms type="double">0</sprayspeed-ms> <sprayspeed-ms type="double">0</sprayspeed-ms>
<spray-density type="double">0</spray-density> <spray-density type="double">0</spray-density>
<caster-angle-deg-damped type="double">0</caster-angle-deg-damped> <caster-angle-deg-damped type="double">0</caster-angle-deg-damped>
</gear> </gear>
<gear n="2"> <gear n="2">
<Rbrake-smoke type="double">0</Rbrake-smoke>
<R3brake-temp-degc type="double">15</R3brake-temp-degc>
<R4brake-temp-degc type="double">15</R4brake-temp-degc>
<tyre-smoke type="int">0</tyre-smoke> <tyre-smoke type="int">0</tyre-smoke>
<sprayspeed-ms type="double">0</sprayspeed-ms> <sprayspeed-ms type="double">0</sprayspeed-ms>
<spray-density type="double">0</spray-density> <spray-density type="double">0</spray-density>

View file

@ -43,6 +43,7 @@ LBS2KGS = 0.4535924;
# Fetch Nodes # Fetch Nodes
var acconfig_weight_kgs = props.globals.getNode("/systems/acconfig/options/weight-kgs", 1); 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 elapsed_sec = props.globals.getNode("/sim/time/elapsed-sec", 1);
var rate = props.globals.getNode("/systems/acconfig/options/lecam-rate", 1);
var autoconfig_running = props.globals.getNode("/systems/acconfig/autoconfig-running", 1); var autoconfig_running = props.globals.getNode("/systems/acconfig/autoconfig-running", 1);
var lighting_du4 = props.globals.getNode("/controls/lighting/DU/du4", 1); var lighting_du4 = props.globals.getNode("/controls/lighting/DU/du4", 1);
var ecam_page = props.globals.getNode("/ECAM/Lower/page", 1); var ecam_page = props.globals.getNode("/ECAM/Lower/page", 1);
@ -115,43 +116,6 @@ var cargobulk_pos = props.globals.getNode("/sim/model/door-positions/cargobulk/p
var cargofwd_pos = props.globals.getNode("/sim/model/door-positions/cargofwd/position-norm", 1); var cargofwd_pos = props.globals.getNode("/sim/model/door-positions/cargofwd/position-norm", 1);
var cargoaft_pos = props.globals.getNode("/sim/model/door-positions/cargoaft/position-norm", 1); var cargoaft_pos = props.globals.getNode("/sim/model/door-positions/cargoaft/position-norm", 1);
# Electrical nodes
var apu_volts = props.globals.getNode("/systems/electrical/sources/apu/output-volt", 1);
var apu_hz = props.globals.getNode("/systems/electrical/sources/apu/output-hertz", 1);
var gen_apu = props.globals.getNode("/systems/electrical/relay/apu-glc/contact-pos", 1);
var switch_bat1 = props.globals.getNode("/controls/electrical/switches/bat-1", 1);
var switch_bat2 = props.globals.getNode("/controls/electrical/switches/bat-2", 1);
var bat1_amps = props.globals.getNode("/systems/electrical/sources/bat-1/amps", 1);
var bat2_amps = props.globals.getNode("/systems/electrical/sources/bat-2/amps", 1);
var bat1_volts = props.globals.getNode("/systems/electrical/sources/bat-1/volt", 1);
var bat2_volts = props.globals.getNode("/systems/electrical/sources/bat-2/volt", 1);
var bat1_fault = props.globals.getNode("/systems/electrical/light/bat-1-fault", 1);
var bat2_fault = props.globals.getNode("/systems/electrical/light/bat-2-fault", 1);
var bat1_direction = props.globals.getNode("/systems/electrical/sources/bat-1/direction", 1);
var bat2_direction = props.globals.getNode("/systems/electrical/sources/bat-2/direction", 1);
var emerGenVolts = props.globals.getNode("/systems/electrical/relay/emer-glc/output", 1);
var emerGenHz = props.globals.getNode("/systems/electrical/sources/emer-gen/output-hertz", 1);
var tr1_volts = props.globals.getNode("/systems/electrical/relay/tr-contactor-1/output", 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 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);
var gen1_volts = props.globals.getNode("/systems/electrical/sources/idg-1/output-volt", 1);
var gen2_volts = props.globals.getNode("/systems/electrical/sources/idg-2/output-volt", 1);
var gen1_hz = props.globals.getNode("/systems/electrical/sources/idg-1/output-hertz", 1);
var gen2_hz = props.globals.getNode("/systems/electrical/sources/idg-2/output-hertz", 1);
var ext_volts = props.globals.getNode("/systems/electrical/sources/ext/output-volt", 1);
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 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);
var essTrVolt = props.globals.getNode("/systems/electrical/relay/dc-ess-feed-tr/output", 1);
var essTrAmp = props.globals.getNode("/systems/electrical/relay/dc-ess-feed-tr/output-amp", 1);
# Hydraulic # Hydraulic
var blue_psi = 0; var blue_psi = 0;
var green_psi = 0; var green_psi = 0;
@ -266,12 +230,12 @@ var canvas_lowerECAM_base = {
if (systems.ELEC.Bus.ac2.getValue() >= 110) { if (systems.ELEC.Bus.ac2.getValue() >= 110) {
if (du4_offtime.getValue() + 3 < elapsedtime) { if (du4_offtime.getValue() + 3 < elapsedtime) {
if (gear0_wow.getValue() == 1) { if (gear0_wow.getValue()) {
if (autoconfig_running.getValue() != 1 and du4_test.getValue() != 1) { if (autoconfig_running.getValue() != 1 and du4_test.getValue() != 1) {
du4_test.setValue(1); du4_test.setValue(1);
du4_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1)); du4_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1));
du4_test_time.setValue(elapsedtime); du4_test_time.setValue(elapsedtime);
} else if (autoconfig_running.getValue() == 1 and du4_test.getValue() != 1) { } else if (autoconfig_running.getValue() and du4_test.getValue() != 1) {
du4_test.setValue(1); du4_test.setValue(1);
du4_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1)); du4_test_amount.setValue(math.round((rand() * 5 ) + 35, 0.1));
du4_test_time.setValue(elapsedtime - 30); du4_test_time.setValue(elapsedtime - 30);
@ -556,7 +520,7 @@ var canvas_lowerECAM_base = {
me["UTCh"].setText(sprintf("%02d", hour.getValue())); me["UTCh"].setText(sprintf("%02d", hour.getValue()));
me["UTCm"].setText(sprintf("%02d", minute.getValue())); me["UTCm"].setText(sprintf("%02d", minute.getValue()));
if (acconfig_weight_kgs.getValue() == 1) { if (acconfig_weight_kgs.getValue()) {
me["GW"].setText(sprintf("%s", math.round(math.round(gw.getValue() * LBS2KGS, 100)))); me["GW"].setText(sprintf("%s", math.round(math.round(gw.getValue() * LBS2KGS, 100))));
me["GW-weight-unit"].setText("KG"); me["GW-weight-unit"].setText("KG");
} else { } else {
@ -579,7 +543,7 @@ var canvas_lowerECAM_apu = {
}, },
update: func() { update: func() {
# Avail and Flap Open # Avail and Flap Open
if (apu_flap.getValue() == 1) { if (apu_flap.getValue()) {
me["APUFlapOpen"].show(); me["APUFlapOpen"].show();
} else { } else {
me["APUFlapOpen"].hide(); me["APUFlapOpen"].hide();
@ -598,19 +562,19 @@ var canvas_lowerECAM_apu = {
} }
# APU Gen # APU Gen
if (apu_volts.getValue() >= 110) { if (systems.ELEC.Source.APU.volts.getValue() >= 110) {
me["APUGenVolt"].setColor(0.0509,0.7529,0.2941); me["APUGenVolt"].setColor(0.0509,0.7529,0.2941);
} else { } else {
me["APUGenVolt"].setColor(0.7333,0.3803,0); me["APUGenVolt"].setColor(0.7333,0.3803,0);
} }
if (apu_hz.getValue() > 380) { if (systems.ELEC.Source.APU.hertz.getValue() > 380) {
me["APUGenHz"].setColor(0.0509,0.7529,0.2941); me["APUGenHz"].setColor(0.0509,0.7529,0.2941);
} else { } else {
me["APUGenHz"].setColor(0.7333,0.3803,0); me["APUGenHz"].setColor(0.7333,0.3803,0);
} }
if (systems.APUNodes.Controls.master.getValue() == 1 or apu_rpm.getValue() >= 94.9) { if (systems.APUNodes.Controls.master.getValue() or apu_rpm.getValue() >= 94.9) {
me["APUGenbox"].show(); me["APUGenbox"].show();
me["APUGenHz"].show(); me["APUGenHz"].show();
me["APUGenVolt"].show(); me["APUGenVolt"].show();
@ -628,24 +592,24 @@ var canvas_lowerECAM_apu = {
me["text3732"].hide(); me["text3732"].hide();
} }
if ((apu_rpm.getValue() > 94.9) and (gen_apu.getValue() == 1)) { if ((apu_rpm.getValue() > 94.9) and (systems.ELEC.Source.APU.contact.getValue())) {
me["APUGenOnline"].show(); me["APUGenOnline"].show();
} else { } else {
me["APUGenOnline"].hide(); me["APUGenOnline"].hide();
} }
if ((systems.APUNodes.Controls.master.getValue() == 0) or ((systems.APUNodes.Controls.master.getValue() == 1) and (gen_apu.getValue() == 1) and (apu_rpm.getValue() > 94.9))) { if ((systems.APUNodes.Controls.master.getValue() == 0) or ((systems.APUNodes.Controls.master.getValue()) and (systems.ELEC.Source.APU.contact.getValue()) and (apu_rpm.getValue() > 94.9))) {
me["APUGentext"].setColor(0.8078,0.8039,0.8078); me["APUGentext"].setColor(0.8078,0.8039,0.8078);
} else if ((systems.APUNodes.Controls.master.getValue() == 1) and (gen_apu.getValue() == 0) and (apu_rpm.getValue() < 94.9)) { } else if ((systems.APUNodes.Controls.master.getValue()) and (systems.ELEC.Source.APU.contact.getValue() == 0) and (apu_rpm.getValue() < 94.9)) {
me["APUGentext"].setColor(0.7333,0.3803,0); me["APUGentext"].setColor(0.7333,0.3803,0);
} }
me["APUGenLoad"].setText(sprintf("%s", math.round(apu_load.getValue()))); me["APUGenLoad"].setText(sprintf("%s", math.round(apu_load.getValue())));
me["APUGenVolt"].setText(sprintf("%s", math.round(apu_volts.getValue()))); me["APUGenVolt"].setText(sprintf("%s", math.round(systems.ELEC.Source.APU.volts.getValue())));
me["APUGenHz"].setText(sprintf("%s", math.round(apu_hz.getValue()))); me["APUGenHz"].setText(sprintf("%s", math.round(systems.ELEC.Source.APU.hertz.getValue())));
# APU Bleed # APU Bleed
if (systems.ADIRS.Operating.adr[0].getValue() and (systems.APUNodes.Controls.bleed.getValue() == 1 or bleedapu.getValue() > 0)) { if (systems.ADIRS.Operating.adr[0].getValue() and (systems.APUNodes.Controls.bleed.getValue() or bleedapu.getValue() > 0)) {
me["APUBleedPSI"].setColor(0.0509,0.7529,0.2941); me["APUBleedPSI"].setColor(0.0509,0.7529,0.2941);
me["APUBleedPSI"].setText(sprintf("%s", math.round(bleedapu.getValue()))); me["APUBleedPSI"].setText(sprintf("%s", math.round(bleedapu.getValue())));
} else { } else {
@ -670,7 +634,7 @@ var canvas_lowerECAM_apu = {
# APU N and EGT # APU N and EGT
if (systems.APUNodes.Controls.master.getValue() == 1) { if (systems.APUNodes.Controls.master.getValue()) {
me["APUN"].setColor(0.0509,0.7529,0.2941); me["APUN"].setColor(0.0509,0.7529,0.2941);
me["APUN"].setText(sprintf("%s", math.round(apu_rpm.getValue() or 0))); me["APUN"].setText(sprintf("%s", math.round(apu_rpm.getValue() or 0)));
me["APUEGT"].setColor(0.0509,0.7529,0.2941); me["APUEGT"].setColor(0.0509,0.7529,0.2941);
@ -872,7 +836,7 @@ var canvas_lowerECAM_bleed = {
if (bmc1working.getValue()) { if (bmc1working.getValue()) {
var precooler_temp = precooler1_temp.getValue(); var precooler_temp = precooler1_temp.getValue();
me["BLEED-Precooler-1-Outlet-Temp"].setText(sprintf("%s", math.round(precooler_temp, 5))); me["BLEED-Precooler-1-Outlet-Temp"].setText(sprintf("%s", math.round(precooler_temp, 5)));
if (eng_valve1_cmd.getValue() == 1 and (precooler_temp < 150 or precooler1_ovht.getValue())) { if (eng_valve1_cmd.getValue() and (precooler_temp < 150 or precooler1_ovht.getValue())) {
me["BLEED-Precooler-1-Outlet-Temp"].setColor(0.7333,0.3803,0); me["BLEED-Precooler-1-Outlet-Temp"].setColor(0.7333,0.3803,0);
} else { } else {
me["BLEED-Precooler-1-Outlet-Temp"].setColor(0.0509,0.7529,0.2941); me["BLEED-Precooler-1-Outlet-Temp"].setColor(0.0509,0.7529,0.2941);
@ -886,7 +850,7 @@ var canvas_lowerECAM_bleed = {
if (bmc2working.getValue()) { if (bmc2working.getValue()) {
var precooler_temp = precooler2_temp.getValue(); var precooler_temp = precooler2_temp.getValue();
me["BLEED-Precooler-2-Outlet-Temp"].setText(sprintf("%s", math.round(precooler_temp, 5))); me["BLEED-Precooler-2-Outlet-Temp"].setText(sprintf("%s", math.round(precooler_temp, 5)));
if (eng_valve2_cmd.getValue() == 1 and (precooler_temp < 150 or precooler2_ovht.getValue())) { if (eng_valve2_cmd.getValue() and (precooler_temp < 150 or precooler2_ovht.getValue())) {
me["BLEED-Precooler-2-Outlet-Temp"].setColor(0.7333,0.3803,0); me["BLEED-Precooler-2-Outlet-Temp"].setColor(0.7333,0.3803,0);
} else { } else {
me["BLEED-Precooler-2-Outlet-Temp"].setColor(0.0509,0.7529,0.2941); me["BLEED-Precooler-2-Outlet-Temp"].setColor(0.0509,0.7529,0.2941);
@ -904,7 +868,7 @@ var canvas_lowerECAM_bleed = {
} }
# WING ANTI ICE # WING ANTI ICE
if (switch_wing_aice.getValue() == 1) { if (switch_wing_aice.getValue()) {
me["BLEED-Anti-Ice-Left"].show(); me["BLEED-Anti-Ice-Left"].show();
me["BLEED-Anti-Ice-Right"].show(); me["BLEED-Anti-Ice-Right"].show();
} else { } else {
@ -1016,7 +980,7 @@ var canvas_lowerECAM_bleed = {
me["BLEED-Ram-Air"].setColor(0.0509,0.7529,0.2941); me["BLEED-Ram-Air"].setColor(0.0509,0.7529,0.2941);
me["BLEED-Ram-Air"].setColorFill(0.0509,0.7529,0.2941); me["BLEED-Ram-Air"].setColorFill(0.0509,0.7529,0.2941);
me["BLEED-Ram-Air-connection"].hide(); me["BLEED-Ram-Air-connection"].hide();
} elsif (systems.PNEU.Valves.ramAir.getValue() == 1) { } elsif (systems.PNEU.Valves.ramAir.getValue()) {
me["BLEED-Ram-Air"].setRotation(0); me["BLEED-Ram-Air"].setRotation(0);
if (pts.Gear.wow[1].getValue()) { if (pts.Gear.wow[1].getValue()) {
me["BLEED-Ram-Air"].setColor(0.7333,0.3803,0); me["BLEED-Ram-Air"].setColor(0.7333,0.3803,0);
@ -1118,7 +1082,7 @@ var canvas_lowerECAM_crz = {
me["Oil1"].setText(sprintf("%2.1f", oil_qt1_actual.getValue())); me["Oil1"].setText(sprintf("%2.1f", oil_qt1_actual.getValue()));
me["Oil2"].setText(sprintf("%2.1f", oil_qt2_actual.getValue())); me["Oil2"].setText(sprintf("%2.1f", oil_qt2_actual.getValue()));
if (acconfig_weight_kgs.getValue() == 1) { if (acconfig_weight_kgs.getValue()) {
me["Fused-weight-unit"].setText("KG"); me["Fused-weight-unit"].setText("KG");
me["FUsed1"].setText(sprintf("%s", math.round(fuel_used_lbs1.getValue() * LBS2KGS, 10))); me["FUsed1"].setText(sprintf("%s", math.round(fuel_used_lbs1.getValue() * LBS2KGS, 10)));
me["FUsed2"].setText(sprintf("%s", math.round(fuel_used_lbs2.getValue() * LBS2KGS, 10))); me["FUsed2"].setText(sprintf("%s", math.round(fuel_used_lbs2.getValue() * LBS2KGS, 10)));
@ -1298,7 +1262,7 @@ var canvas_lowerECAM_elec = {
update: func() { update: func() {
# BAT1 # BAT1
if (switch_bat1.getValue() == 0) { if (systems.ELEC.Switch.bat1.getValue() == 0) {
me["BAT1-OFF"].show(); me["BAT1-OFF"].show();
me["BAT1-content"].hide(); me["BAT1-content"].hide();
me["BAT1-discharge"].hide(); me["BAT1-discharge"].hide();
@ -1306,26 +1270,26 @@ var canvas_lowerECAM_elec = {
} else { } else {
me["BAT1-OFF"].hide(); me["BAT1-OFF"].hide();
me["BAT1-content"].show(); me["BAT1-content"].show();
me["Bat1Ampere"].setText(sprintf("%s", math.round(bat1_amps.getValue()))); me["Bat1Ampere"].setText(sprintf("%s", math.round(systems.ELEC.Source.Bat1.amps.getValue())));
me["Bat1Volt"].setText(sprintf("%s", math.round(bat1_volts.getValue()))); me["Bat1Volt"].setText(sprintf("%s", math.round(systems.ELEC.Source.Bat1.volt.getValue())));
if (bat1_volts.getValue() >= 24.95 and bat1_volts.getValue() <= 31.05) { if (systems.ELEC.Source.Bat1.volt.getValue() >= 24.95 and systems.ELEC.Source.Bat1.volt.getValue() <= 31.05) {
me["Bat1Volt"].setColor(0.0509,0.7529,0.2941); me["Bat1Volt"].setColor(0.0509,0.7529,0.2941);
} else { } else {
me["Bat1Volt"].setColor(0.7333,0.3803,0); me["Bat1Volt"].setColor(0.7333,0.3803,0);
} }
if (bat1_amps.getValue() > 5) { if (systems.ELEC.Source.Bat1.amps.getValue() > 5) {
me["Bat1Ampere"].setColor(0.7333,0.3803,0); me["Bat1Ampere"].setColor(0.7333,0.3803,0);
} else { } else {
me["Bat1Ampere"].setColor(0.0509,0.7529,0.2941); me["Bat1Ampere"].setColor(0.0509,0.7529,0.2941);
} }
if (bat1_direction.getValue() == 0) { if (systems.ELEC.Source.Bat1.direction.getValue() == 0) {
me["BAT1-discharge"].hide(); me["BAT1-discharge"].hide();
me["BAT1-charge"].hide(); me["BAT1-charge"].hide();
} else { } else {
if (bat1_direction.getValue() == -1) { if (systems.ELEC.Source.Bat1.direction.getValue() == -1) {
me["BAT1-charge"].show(); me["BAT1-charge"].show();
me["BAT1-discharge"].hide(); me["BAT1-discharge"].hide();
} else { } else {
@ -1335,14 +1299,14 @@ var canvas_lowerECAM_elec = {
} }
} }
if (bat1_fault.getValue() == 1 or bat1_volts.getValue() < 25 or bat1_volts.getValue() > 31 or bat1_amps.getValue() > 5) { if (systems.ELEC.Light.bat1Fault.getValue() or systems.ELEC.Source.Bat1.volt.getValue() < 25 or systems.ELEC.Source.Bat1.volt.getValue() > 31 or systems.ELEC.Source.Bat1.amps.getValue() > 5) {
me["BAT1-label"].setColor(0.7333,0.3803,0); me["BAT1-label"].setColor(0.7333,0.3803,0);
} else { } else {
me["BAT1-label"].setColor(0.8078,0.8039,0.8078); me["BAT1-label"].setColor(0.8078,0.8039,0.8078);
} }
# BAT2 # BAT2
if (switch_bat2.getValue() == 0) { if (systems.ELEC.Switch.bat2.getValue() == 0) {
me["BAT2-OFF"].show(); me["BAT2-OFF"].show();
me["BAT2-content"].hide(); me["BAT2-content"].hide();
me["BAT2-discharge"].hide(); me["BAT2-discharge"].hide();
@ -1350,26 +1314,26 @@ var canvas_lowerECAM_elec = {
} else { } else {
me["BAT2-OFF"].hide(); me["BAT2-OFF"].hide();
me["BAT2-content"].show(); me["BAT2-content"].show();
me["Bat2Ampere"].setText(sprintf("%s", math.round(bat2_amps.getValue()))); me["Bat2Ampere"].setText(sprintf("%s", math.round(systems.ELEC.Source.Bat2.amps.getValue())));
me["Bat2Volt"].setText(sprintf("%s", math.round(bat2_volts.getValue()))); me["Bat2Volt"].setText(sprintf("%s", math.round(systems.ELEC.Source.Bat2.volt.getValue())));
if (bat2_volts.getValue() >= 24.95 and bat2_volts.getValue() <= 31.05) { if (systems.ELEC.Source.Bat2.volt.getValue() >= 24.95 and systems.ELEC.Source.Bat2.volt.getValue() <= 31.05) {
me["Bat2Volt"].setColor(0.0509,0.7529,0.2941); me["Bat2Volt"].setColor(0.0509,0.7529,0.2941);
} else { } else {
me["Bat2Volt"].setColor(0.7333,0.3803,0); me["Bat2Volt"].setColor(0.7333,0.3803,0);
} }
if (bat2_amps.getValue() > 5) { if (systems.ELEC.Source.Bat2.amps.getValue() > 5) {
me["Bat2Ampere"].setColor(0.7333,0.3803,0); me["Bat2Ampere"].setColor(0.7333,0.3803,0);
} else { } else {
me["Bat2Ampere"].setColor(0.0509,0.7529,0.2941); me["Bat2Ampere"].setColor(0.0509,0.7529,0.2941);
} }
if (bat2_direction.getValue() == 0) { if (systems.ELEC.Source.Bat2.direction.getValue() == 0) {
me["BAT2-discharge"].hide(); me["BAT2-discharge"].hide();
me["BAT2-charge"].hide(); me["BAT2-charge"].hide();
} else { } else {
if (bat2_direction.getValue() == -1) { if (systems.ELEC.Source.Bat2.direction.getValue() == -1) {
me["BAT2-charge"].show(); me["BAT2-charge"].show();
me["BAT2-discharge"].hide(); me["BAT2-discharge"].hide();
} else { } else {
@ -1379,7 +1343,7 @@ var canvas_lowerECAM_elec = {
} }
} }
if (bat2_fault.getValue() == 1 or bat2_volts.getValue() < 25 or bat2_volts.getValue() > 31 or bat2_amps.getValue() > 5) { if (systems.ELEC.Light.bat2Fault.getValue() or systems.ELEC.Source.Bat2.volt.getValue() < 25 or systems.ELEC.Source.Bat2.volt.getValue() > 31 or systems.ELEC.Source.Bat2.amps.getValue() > 5) {
me["BAT2-label"].setColor(0.7333,0.3803,0); me["BAT2-label"].setColor(0.7333,0.3803,0);
} else { } else {
me["BAT2-label"].setColor(0.8078,0.8039,0.8078); me["BAT2-label"].setColor(0.8078,0.8039,0.8078);
@ -1387,8 +1351,8 @@ var canvas_lowerECAM_elec = {
# TR1 # TR1
# is only powered when ac1 has power # is only powered when ac1 has power
tr1_v = tr1_volts.getValue(); tr1_v = systems.ELEC.Source.tr1.outputVolt.getValue();
tr1_a = tr1_amps.getValue(); tr1_a = systems.ELEC.Source.tr1.outputAmp.getValue();
me["TR1Volt"].setText(sprintf("%s", math.round(tr1_v))); me["TR1Volt"].setText(sprintf("%s", math.round(tr1_v)));
me["TR1Ampere"].setText(sprintf("%s", math.round(tr1_a))); me["TR1Ampere"].setText(sprintf("%s", math.round(tr1_a)));
@ -1413,8 +1377,8 @@ var canvas_lowerECAM_elec = {
# TR2 # TR2
# is only powered when ac2 has power # is only powered when ac2 has power
tr2_v = tr2_volts.getValue(); tr2_v = systems.ELEC.Source.tr2.outputVolt.getValue();
tr2_a = tr2_amps.getValue(); tr2_a = systems.ELEC.Source.tr2.outputAmp.getValue();
me["TR2Volt"].setText(sprintf("%s", math.round(tr2_v))); me["TR2Volt"].setText(sprintf("%s", math.round(tr2_v)));
me["TR2Ampere"].setText(sprintf("%s", math.round(tr2_a))); me["TR2Ampere"].setText(sprintf("%s", math.round(tr2_a)));
@ -1438,8 +1402,8 @@ var canvas_lowerECAM_elec = {
} }
# ESS TR # ESS TR
essTrvolts = essTrVolt.getValue(); essTrvolts = systems.ELEC.Source.trEss.outputVoltRelay.getValue();
essTramps = essTrAmp.getValue(); essTramps = systems.ELEC.Source.trEss.outputAmpRelay.getValue();
if (systems.ELEC.Relay.essTrContactor.getValue()) { if (systems.ELEC.Relay.essTrContactor.getValue()) {
me["ESSTR-group"].show(); me["ESSTR-group"].show();
me["ESSTR-Volt"].setText(sprintf("%s", math.round(essTrvolts))); me["ESSTR-Volt"].setText(sprintf("%s", math.round(essTrvolts)));
@ -1467,7 +1431,7 @@ var canvas_lowerECAM_elec = {
} }
# EMER GEN # EMER GEN
if (switch_emer_gen.getValue() == 0) { if (systems.ELEC.Source.EmerGen.volts.getValue() == 0) {
me["EMERGEN-group"].hide(); me["EMERGEN-group"].hide();
me["ELEC-Line-Emergen-ESSTR"].hide(); me["ELEC-Line-Emergen-ESSTR"].hide();
me["ELEC-Line-Emergen-ESSTR-off"].show(); me["ELEC-Line-Emergen-ESSTR-off"].show();
@ -1478,22 +1442,22 @@ var canvas_lowerECAM_elec = {
me["ELEC-Line-Emergen-ESSTR-off"].hide(); me["ELEC-Line-Emergen-ESSTR-off"].hide();
me["EMERGEN-Label-off"].hide(); me["EMERGEN-Label-off"].hide();
me["EmergenVolt"].setText(sprintf("%s", math.round(emerGenVolts.getValue()))); me["EmergenVolt"].setText(sprintf("%s", math.round(systems.ELEC.Source.EmerGen.voltsRelay.getValue())));
me["EmergenHz"].setText(sprintf("%s", math.round(emerGenHz.getValue()))); me["EmergenHz"].setText(sprintf("%s", math.round(systems.ELEC.Source.EmerGen.hertz.getValue())));
if (emerGenVolts.getValue() > 120 or emerGenVolts.getValue() < 110 or emerGenHz.getValue() > 410 or emerGenHz.getValue() < 390) { if (systems.ELEC.Source.EmerGen.voltsRelay.getValue() > 120 or systems.ELEC.Source.EmerGen.voltsRelay.getValue() < 110 or systems.ELEC.Source.EmerGen.hertz.getValue() > 410 or systems.ELEC.Source.EmerGen.hertz.getValue() < 390) {
me["Emergen-Label"].setColor(0.7333,0.3803,0); me["Emergen-Label"].setColor(0.7333,0.3803,0);
} else { } else {
me["Emergen-Label"].setColor(0.8078,0.8039,0.8078); me["Emergen-Label"].setColor(0.8078,0.8039,0.8078);
} }
if (emerGenVolts.getValue() > 120 or emerGenVolts.getValue() < 110) { if (systems.ELEC.Source.EmerGen.voltsRelay.getValue() > 120 or systems.ELEC.Source.EmerGen.voltsRelay.getValue() < 110) {
me["EmergenVolt"].setColor(0.7333,0.3803,0); me["EmergenVolt"].setColor(0.7333,0.3803,0);
} else { } else {
me["EmergenVolt"].setColor(0.0509,0.7529,0.2941); me["EmergenVolt"].setColor(0.0509,0.7529,0.2941);
} }
if (emerGenHz.getValue() > 410 or emerGenHz.getValue() < 390) { if (systems.ELEC.Source.EmerGen.hertz.getValue() > 410 or systems.ELEC.Source.EmerGen.hertz.getValue() < 390) {
me["EmergenHz"].setColor(0.7333,0.3803,0); me["EmergenHz"].setColor(0.7333,0.3803,0);
} else { } else {
me["EmergenHz"].setColor(0.0509,0.7529,0.2941); me["EmergenHz"].setColor(0.0509,0.7529,0.2941);
@ -1531,7 +1495,7 @@ var canvas_lowerECAM_elec = {
} }
# GEN1 # GEN1
if (switch_gen1.getValue() == 0) { if (systems.ELEC.Switch.gen1.getValue() == 0) {
me["GEN1-content"].hide(); me["GEN1-content"].hide();
me["GEN1-off"].show(); me["GEN1-off"].show();
if (systems.ELEC.Source.IDG1.gcrRelay.getValue()) { if (systems.ELEC.Source.IDG1.gcrRelay.getValue()) {
@ -1549,12 +1513,12 @@ var canvas_lowerECAM_elec = {
me["GEN1-content"].show(); me["GEN1-content"].show();
me["GEN1-off"].hide(); me["GEN1-off"].hide();
# me["Gen1Load"].setText(sprintf("%s", math.round(gen1_load.getValue()))); # me["Gen1Load"].setText(sprintf("%s", math.round(gen1_load.getValue())));
me["Gen1Volt"].setText(sprintf("%s", math.round(gen1_volts.getValue()))); me["Gen1Volt"].setText(sprintf("%s", math.round(systems.ELEC.Source.IDG1.volts.getValue())));
if (gen1_hz.getValue() == 0) { if (systems.ELEC.Source.IDG1.hertz.getValue() == 0) {
me["Gen1Hz"].setText(sprintf("XX")); me["Gen1Hz"].setText(sprintf("XX"));
} else { } else {
me["Gen1Hz"].setText(sprintf("%s", math.round(gen1_hz.getValue()))); me["Gen1Hz"].setText(sprintf("%s", math.round(systems.ELEC.Source.IDG1.hertz.getValue())));
} }
if (eng1_running.getValue() == 0) { if (eng1_running.getValue() == 0) {
@ -1563,7 +1527,7 @@ var canvas_lowerECAM_elec = {
me["GEN1-num-label"].setColor(0.8078,0.8039,0.8078); me["GEN1-num-label"].setColor(0.8078,0.8039,0.8078);
} }
if (gen1_volts.getValue() > 120 or gen1_volts.getValue() < 110 or gen1_hz.getValue() > 410 or gen1_hz.getValue() < 390 or gen1_load.getValue() >= 110) { if (systems.ELEC.Source.IDG1.volts.getValue() > 120 or systems.ELEC.Source.IDG1.volts.getValue() < 110 or systems.ELEC.Source.IDG1.hertz.getValue() > 410 or systems.ELEC.Source.IDG1.hertz.getValue() < 390 or gen1_load.getValue() >= 110) {
me["GEN1-label"].setColor(0.7333,0.3803,0); me["GEN1-label"].setColor(0.7333,0.3803,0);
} else { } else {
me["GEN1-label"].setColor(0.8078,0.8039,0.8078); me["GEN1-label"].setColor(0.8078,0.8039,0.8078);
@ -1575,13 +1539,13 @@ var canvas_lowerECAM_elec = {
me["Gen1Load"].setColor(0.0509,0.7529,0.2941); me["Gen1Load"].setColor(0.0509,0.7529,0.2941);
} }
if (gen1_volts.getValue() > 120 or gen1_volts.getValue() < 110) { if (systems.ELEC.Source.IDG1.volts.getValue() > 120 or systems.ELEC.Source.IDG1.volts.getValue() < 110) {
me["Gen1Volt"].setColor(0.7333,0.3803,0); me["Gen1Volt"].setColor(0.7333,0.3803,0);
} else { } else {
me["Gen1Volt"].setColor(0.0509,0.7529,0.2941); me["Gen1Volt"].setColor(0.0509,0.7529,0.2941);
} }
if (gen1_hz.getValue() > 410 or gen1_hz.getValue() < 390) { if (systems.ELEC.Source.IDG1.hertz.getValue() > 410 or systems.ELEC.Source.IDG1.hertz.getValue() < 390) {
me["Gen1Hz"].setColor(0.7333,0.3803,0); me["Gen1Hz"].setColor(0.7333,0.3803,0);
} else { } else {
me["Gen1Hz"].setColor(0.0509,0.7529,0.2941); me["Gen1Hz"].setColor(0.0509,0.7529,0.2941);
@ -1589,7 +1553,7 @@ var canvas_lowerECAM_elec = {
} }
# GEN2 # GEN2
if (switch_gen2.getValue() == 0) { if (systems.ELEC.Switch.gen2.getValue() == 0) {
me["GEN2-content"].hide(); me["GEN2-content"].hide();
me["GEN2-off"].show(); me["GEN2-off"].show();
if (systems.ELEC.Source.IDG2.gcrRelay.getValue()) { if (systems.ELEC.Source.IDG2.gcrRelay.getValue()) {
@ -1607,11 +1571,11 @@ var canvas_lowerECAM_elec = {
me["GEN2-content"].show(); me["GEN2-content"].show();
me["GEN2-off"].hide(); me["GEN2-off"].hide();
# me["Gen2Load"].setText(sprintf("%s", math.round(gen2_load.getValue()))); # me["Gen2Load"].setText(sprintf("%s", math.round(gen2_load.getValue())));
me["Gen2Volt"].setText(sprintf("%s", math.round(gen2_volts.getValue()))); me["Gen2Volt"].setText(sprintf("%s", math.round(systems.ELEC.Source.IDG2.volts.getValue())));
if (gen2_hz.getValue() == 0) { if (systems.ELEC.Source.IDG2.hertz.getValue() == 0) {
me["Gen2Hz"].setText(sprintf("XX")); me["Gen2Hz"].setText(sprintf("XX"));
} else { } else {
me["Gen2Hz"].setText(sprintf("%s", math.round(gen2_hz.getValue()))); me["Gen2Hz"].setText(sprintf("%s", math.round(systems.ELEC.Source.IDG2.hertz.getValue())));
} }
if (eng2_running.getValue() == 0) { if (eng2_running.getValue() == 0) {
@ -1620,7 +1584,7 @@ var canvas_lowerECAM_elec = {
me["GEN2-num-label"].setColor(0.8078,0.8039,0.8078); me["GEN2-num-label"].setColor(0.8078,0.8039,0.8078);
} }
if (gen2_volts.getValue() > 120 or gen2_volts.getValue() < 110 or gen2_hz.getValue() > 410 or gen2_hz.getValue() < 390 or gen2_load.getValue() >= 110) { if (systems.ELEC.Source.IDG2.volts.getValue() > 120 or systems.ELEC.Source.IDG2.volts.getValue() < 110 or systems.ELEC.Source.IDG2.hertz.getValue() > 410 or systems.ELEC.Source.IDG2.hertz.getValue() < 390 or gen2_load.getValue() >= 110) {
me["GEN2-label"].setColor(0.7333,0.3803,0); me["GEN2-label"].setColor(0.7333,0.3803,0);
} else { } else {
me["GEN2-label"].setColor(0.8078,0.8039,0.8078); me["GEN2-label"].setColor(0.8078,0.8039,0.8078);
@ -1633,13 +1597,13 @@ var canvas_lowerECAM_elec = {
} }
if (gen2_volts.getValue() > 120 or gen2_volts.getValue() < 110) { if (systems.ELEC.Source.IDG2.volts.getValue() > 120 or systems.ELEC.Source.IDG2.volts.getValue() < 110) {
me["Gen2Volt"].setColor(0.7333,0.3803,0); me["Gen2Volt"].setColor(0.7333,0.3803,0);
} else { } else {
me["Gen2Volt"].setColor(0.0509,0.7529,0.2941); me["Gen2Volt"].setColor(0.0509,0.7529,0.2941);
} }
if (gen2_hz.getValue() > 410 or gen2_hz.getValue() < 390) { if (systems.ELEC.Source.IDG2.hertz.getValue() > 410 or systems.ELEC.Source.IDG2.hertz.getValue() < 390) {
me["Gen2Hz"].setColor(0.7333,0.3803,0); me["Gen2Hz"].setColor(0.7333,0.3803,0);
} else { } else {
me["Gen2Hz"].setColor(0.0509,0.7529,0.2941); me["Gen2Hz"].setColor(0.0509,0.7529,0.2941);
@ -1654,7 +1618,7 @@ var canvas_lowerECAM_elec = {
me["APUGentext"].setColor(0.8078,0.8039,0.8078); me["APUGentext"].setColor(0.8078,0.8039,0.8078);
} else { } else {
me["APU-border"].show(); me["APU-border"].show();
if (gen_apu.getValue() == 0) { if (systems.ELEC.Source.APU.contact.getValue() == 0) {
me["APU-content"].hide(); me["APU-content"].hide();
me["APUGEN-off"].show(); me["APUGEN-off"].show();
me["APUGentext"].setColor(0.7333,0.3803,0); me["APUGentext"].setColor(0.7333,0.3803,0);
@ -1662,15 +1626,15 @@ var canvas_lowerECAM_elec = {
me["APU-content"].show(); me["APU-content"].show();
me["APUGEN-off"].hide(); me["APUGEN-off"].hide();
# me["APUGenLoad"].setText(sprintf("%s", math.round(apu_load.getValue()))); # me["APUGenLoad"].setText(sprintf("%s", math.round(apu_load.getValue())));
me["APUGenVolt"].setText(sprintf("%s", math.round(apu_volts.getValue()))); me["APUGenVolt"].setText(sprintf("%s", math.round(systems.ELEC.Source.APU.volts.getValue())));
if (apu_hz.getValue() == 0) { if (systems.ELEC.Source.APU.hertz.getValue() == 0) {
me["APUGenHz"].setText(sprintf("XX")); me["APUGenHz"].setText(sprintf("XX"));
} else { } else {
me["APUGenHz"].setText(sprintf("%s", math.round(apu_hz.getValue()))); me["APUGenHz"].setText(sprintf("%s", math.round(systems.ELEC.Source.APU.hertz.getValue())));
} }
if (apu_volts.getValue() > 120 or apu_volts.getValue() < 110 or apu_hz.getValue() > 410 or apu_hz.getValue() < 390 or apu_load.getValue() >= 110) { if (systems.ELEC.Source.APU.volts.getValue() > 120 or systems.ELEC.Source.APU.volts.getValue() < 110 or systems.ELEC.Source.APU.hertz.getValue() > 410 or systems.ELEC.Source.APU.hertz.getValue() < 390 or apu_load.getValue() >= 110) {
me["APUGentext"].setColor(0.7333,0.3803,0); me["APUGentext"].setColor(0.7333,0.3803,0);
} else { } else {
me["APUGentext"].setColor(0.8078,0.8039,0.8078); me["APUGentext"].setColor(0.8078,0.8039,0.8078);
@ -1682,13 +1646,13 @@ var canvas_lowerECAM_elec = {
me["APUGenLoad"].setColor(0.0509,0.7529,0.2941); me["APUGenLoad"].setColor(0.0509,0.7529,0.2941);
} }
if (apu_volts.getValue() > 120 or apu_volts.getValue() < 110) { if (systems.ELEC.Source.APU.volts.getValue() > 120 or systems.ELEC.Source.APU.volts.getValue() < 110) {
me["APUGenVolt"].setColor(0.7333,0.3803,0); me["APUGenVolt"].setColor(0.7333,0.3803,0);
} else { } else {
me["APUGenVolt"].setColor(0.0509,0.7529,0.2941); me["APUGenVolt"].setColor(0.0509,0.7529,0.2941);
} }
if (apu_hz.getValue() > 410 or apu_hz.getValue() < 390) { if (systems.ELEC.Source.APU.hertz.getValue() > 410 or systems.ELEC.Source.APU.hertz.getValue() < 390) {
me["APUGenHz"].setColor(0.7333,0.3803,0); me["APUGenHz"].setColor(0.7333,0.3803,0);
} else { } else {
me["APUGenHz"].setColor(0.0509,0.7529,0.2941); me["APUGenHz"].setColor(0.0509,0.7529,0.2941);
@ -1702,29 +1666,29 @@ var canvas_lowerECAM_elec = {
me["EXTPWR-group"].hide(); me["EXTPWR-group"].hide();
} else { } else {
me["EXTPWR-group"].show(); me["EXTPWR-group"].show();
me["ExtVolt"].setText(sprintf("%s", math.round(ext_volts.getValue()))); me["ExtVolt"].setText(sprintf("%s", math.round(systems.ELEC.Source.Ext.volts.getValue())));
me["ExtHz"].setText(sprintf("%s", math.round(ext_hz.getValue()))); me["ExtHz"].setText(sprintf("%s", math.round(systems.ELEC.Source.Ext.hertz.getValue())));
if (ext_hz.getValue() > 410 or ext_hz.getValue() < 390 or ext_volts.getValue() > 120 or ext_volts.getValue() < 110) { if (systems.ELEC.Source.Ext.hertz.getValue() > 410 or systems.ELEC.Source.Ext.hertz.getValue() < 390 or systems.ELEC.Source.Ext.volts.getValue() > 120 or systems.ELEC.Source.Ext.volts.getValue() < 110) {
me["EXTPWR-label"].setColor(0.7333,0.3803,0); me["EXTPWR-label"].setColor(0.7333,0.3803,0);
} else { } else {
me["EXTPWR-label"].setColor(0.0509,0.7529,0.2941); me["EXTPWR-label"].setColor(0.0509,0.7529,0.2941);
} }
if (ext_hz.getValue() > 410 or ext_hz.getValue() < 390) { if (systems.ELEC.Source.Ext.hertz.getValue() > 410 or systems.ELEC.Source.Ext.hertz.getValue() < 390) {
me["ExtHz"].setColor(0.7333,0.3803,0); me["ExtHz"].setColor(0.7333,0.3803,0);
} else { } else {
me["ExtHz"].setColor(0.0509,0.7529,0.2941); me["ExtHz"].setColor(0.0509,0.7529,0.2941);
} }
if (ext_volts.getValue() > 120 or ext_volts.getValue() < 110) { if (systems.ELEC.Source.Ext.volts.getValue() > 120 or systems.ELEC.Source.Ext.volts.getValue() < 110) {
me["ExtVolt"].setColor(0.7333,0.3803,0); me["ExtVolt"].setColor(0.7333,0.3803,0);
} else { } else {
me["ExtVolt"].setColor(0.0509,0.7529,0.2941); me["ExtVolt"].setColor(0.0509,0.7529,0.2941);
} }
} }
if (galleyshed.getValue()) { if (systems.ELEC.SomeThing.galley.getValue()) {
me["GalleyShed"].show(); me["GalleyShed"].show();
} else { } else {
me["GalleyShed"].hide(); me["GalleyShed"].hide();
@ -1781,25 +1745,25 @@ var canvas_lowerECAM_elec = {
# Managment of the connecting lines between the components # Managment of the connecting lines between the components
if (getprop("/systems/electrical/relay/apu-glc/contact-pos") and (getprop("/systems/electrical/relay/ac-bus-ac-bus-tie-1/contact-pos") or getprop("/systems/electrical/relay/ac-bus-ac-bus-tie-2/contact-pos"))) { if (systems.ELEC.Relay.apuGlc.getValue() and (systems.ELEC.Relay.acTie1.getValue() or systems.ELEC.Relay.acTie2.getValue())) {
me["APU-out"].show(); me["APU-out"].show();
} else { } else {
me["APU-out"].hide(); me["APU-out"].hide();
} }
if (getprop("/systems/electrical/relay/ext-epc/contact-pos") and (getprop("/systems/electrical/relay/ac-bus-ac-bus-tie-1/contact-pos") or getprop("/systems/electrical/relay/ac-bus-ac-bus-tie-2/contact-pos"))) { if (systems.ELEC.Relay.extEpc.getValue() and (systems.ELEC.Relay.acTie1.getValue() or systems.ELEC.Relay.acTie2.getValue())) {
me["EXT-out"].show(); me["EXT-out"].show();
} else { } else {
me["EXT-out"].hide(); me["EXT-out"].hide();
} }
if (gen1_volts.getValue() >= 110 and getprop("/systems/electrical/relay/gen-1-glc/contact-pos")) { if (systems.ELEC.Source.IDG1.volts.getValue() >= 110 and systems.ELEC.Relay.glc1.getValue()) {
me["ELEC-Line-GEN1-AC1"].show(); me["ELEC-Line-GEN1-AC1"].show();
} else { } else {
me["ELEC-Line-GEN1-AC1"].hide(); me["ELEC-Line-GEN1-AC1"].hide();
} }
if (gen2_volts.getValue() >= 110 and getprop("/systems/electrical/relay/gen-2-glc/contact-pos")) { if (systems.ELEC.Source.IDG2.volts.getValue() >= 110 and systems.ELEC.Relay.glc2.getValue()) {
me["ELEC-Line-GEN2-AC2"].show(); me["ELEC-Line-GEN2-AC2"].show();
} else { } else {
me["ELEC-Line-GEN2-AC2"].hide(); me["ELEC-Line-GEN2-AC2"].hide();
@ -1817,38 +1781,38 @@ var canvas_lowerECAM_elec = {
me["AC2-in"].hide(); me["AC2-in"].hide();
} }
if (getprop("/systems/electrical/relay/ac-bus-ac-bus-tie-1/contact-pos") and getprop("/systems/electrical/relay/ac-bus-ac-bus-tie-2/contact-pos")) { if (systems.ELEC.Relay.acTie1.getValue() and systems.ELEC.Relay.acTie2.getValue()) {
me["ELEC-Line-APU-AC1"].show(); me["ELEC-Line-APU-AC1"].show();
me["ELEC-Line-APU-EXT"].show(); me["ELEC-Line-APU-EXT"].show();
me["ELEC-Line-EXT-AC2"].show(); me["ELEC-Line-EXT-AC2"].show();
} else { } else {
if (getprop("/systems/electrical/relay/ac-bus-ac-bus-tie-1/contact-pos")) { if (systems.ELEC.Relay.acTie1.getValue()) {
me["ELEC-Line-APU-AC1"].show(); me["ELEC-Line-APU-AC1"].show();
} else { } else {
me["ELEC-Line-APU-AC1"].hide(); me["ELEC-Line-APU-AC1"].hide();
} }
if ((getprop("/systems/electrical/relay/ac-bus-ac-bus-tie-2/contact-pos") and getprop("/systems/electrical/relay/apu-glc/contact-pos") and !getprop("/systems/electrical/relay/gen-2-glc/contact-pos")) or (getprop("/systems/electrical/relay/ac-bus-ac-bus-tie-1/contact-pos") and getprop("/systems/electrical/relay/ext-epc/contact-pos") and !getprop("/systems/electrical/relay/gen-1-glc/contact-pos"))) { if ((systems.ELEC.Relay.acTie2.getValue() and systems.ELEC.Relay.apuGlc.getValue() and !systems.ELEC.Relay.glc2.getValue()) or (systems.ELEC.Relay.acTie1.getValue() and systems.ELEC.Relay.extEpc.getValue() and !systems.ELEC.Relay.glc1.getValue())) {
me["ELEC-Line-APU-EXT"].show(); me["ELEC-Line-APU-EXT"].show();
} else { } else {
me["ELEC-Line-APU-EXT"].hide(); me["ELEC-Line-APU-EXT"].hide();
} }
if (getprop("/systems/electrical/relay/ac-bus-ac-bus-tie-2/contact-pos")) { if (systems.ELEC.Relay.acTie2.getValue()) {
me["ELEC-Line-EXT-AC2"].show(); me["ELEC-Line-EXT-AC2"].show();
} else { } else {
me["ELEC-Line-EXT-AC2"].hide(); me["ELEC-Line-EXT-AC2"].hide();
} }
} }
if (getprop("/systems/electrical/relay/ac-ess-feed-1/contact-pos") == 1) { if (systems.ELEC.Relay.acEssFeed1.getValue()) {
if (systems.ELEC.Bus.ac1.getValue() >= 110) { if (systems.ELEC.Bus.ac1.getValue() >= 110) {
me["ELEC-Line-AC1-ACESS"].show(); me["ELEC-Line-AC1-ACESS"].show();
} else { } else {
me["ELEC-Line-AC1-ACESS"].hide(); me["ELEC-Line-AC1-ACESS"].hide();
} }
me["ELEC-Line-AC2-ACESS"].hide(); me["ELEC-Line-AC2-ACESS"].hide();
} elsif (getprop("/systems/electrical/relay/ac-ess-feed-2/contact-pos") == 1) { } elsif (systems.ELEC.Relay.acEssFeed2.getValue()) {
me["ELEC-Line-AC1-ACESS"].hide(); me["ELEC-Line-AC1-ACESS"].hide();
if (systems.ELEC.Bus.ac2.getValue() >= 110) { if (systems.ELEC.Bus.ac2.getValue() >= 110) {
me["ELEC-Line-AC2-ACESS"].show(); me["ELEC-Line-AC2-ACESS"].show();
@ -1860,7 +1824,7 @@ var canvas_lowerECAM_elec = {
me["ELEC-Line-AC2-ACESS"].hide(); me["ELEC-Line-AC2-ACESS"].hide();
} }
if (getprop("/systems/electrical/relay/tr-contactor-1/contact-pos") == 1) { if (systems.ELEC.Relay.tr1Contactor.getValue()) {
if (systems.ELEC.Bus.ac1.getValue() < 110) { if (systems.ELEC.Bus.ac1.getValue() < 110) {
me["ELEC-Line-AC1-TR1"].setColorFill(0.7333,0.3803,0); me["ELEC-Line-AC1-TR1"].setColorFill(0.7333,0.3803,0);
} else { } else {
@ -1873,7 +1837,7 @@ var canvas_lowerECAM_elec = {
me["ELEC-Line-TR1-DC1"].hide(); me["ELEC-Line-TR1-DC1"].hide();
} }
if (getprop("/systems/electrical/relay/tr-contactor-2/contact-pos") == 1) { if (systems.ELEC.Relay.tr2Contactor.getValue()) {
if (systems.ELEC.Bus.ac2.getValue() < 110) { if (systems.ELEC.Bus.ac2.getValue() < 110) {
me["ELEC-Line-AC2-TR2"].setColorFill(0.7333,0.3803,0); me["ELEC-Line-AC2-TR2"].setColorFill(0.7333,0.3803,0);
} else { } else {
@ -1886,25 +1850,25 @@ var canvas_lowerECAM_elec = {
me["ELEC-Line-TR2-DC2"].hide(); me["ELEC-Line-TR2-DC2"].hide();
} }
if (getprop("/systems/electrical/relay/dc-bus-tie-dc-1/contact-pos")) { if (systems.ELEC.Relay.dcTie1.getValue()) {
me["ELEC-Line-DC1-DCESS_DCBAT"].show(); me["ELEC-Line-DC1-DCESS_DCBAT"].show();
} else { } else {
me["ELEC-Line-DC1-DCESS_DCBAT"].hide(); me["ELEC-Line-DC1-DCESS_DCBAT"].hide();
} }
if (getprop("/systems/electrical/relay/dc-ess-feed-bat/contact-pos")) { if (systems.ELEC.Relay.dcEssFeedBat.getValue()) {
me["ELEC-Line-DC1-DCESS"].show(); me["ELEC-Line-DC1-DCESS"].show();
} else { } else {
me["ELEC-Line-DC1-DCESS"].hide(); me["ELEC-Line-DC1-DCESS"].hide();
} }
if (getprop("/systems/electrical/relay/dc-ess-feed-bat/contact-pos") or getprop("/systems/electrical/relay/dc-bus-tie-dc-1/contact-pos")) { if (systems.ELEC.Relay.dcEssFeedBat.getValue() or systems.ELEC.Relay.dcTie1.getValue()) {
me["ELEC-Line-DC1-DCBAT"].show(); me["ELEC-Line-DC1-DCBAT"].show();
} else { } else {
me["ELEC-Line-DC1-DCBAT"].hide(); me["ELEC-Line-DC1-DCBAT"].hide();
} }
if (getprop("/systems/electrical/relay/dc-bus-tie-dc-2/contact-pos")) { if (systems.ELEC.Relay.dcTie2.getValue()) {
me["ELEC-Line-DC2-DCBAT"].show(); me["ELEC-Line-DC2-DCBAT"].show();
me["ELEC-Line-DC2-DCESS_DCBAT"].show(); me["ELEC-Line-DC2-DCESS_DCBAT"].show();
} else { } else {
@ -1912,7 +1876,7 @@ var canvas_lowerECAM_elec = {
me["ELEC-Line-DC2-DCESS_DCBAT"].hide(); me["ELEC-Line-DC2-DCESS_DCBAT"].hide();
} }
if (getprop("/systems/electrical/relay/ac-ess-feed-emer-gen/contact-pos")) { if (systems.ELEC.Relay.acEssEmerGenFeed.getValue()) {
me["EMERGEN-out"].show(); me["EMERGEN-out"].show();
me["ELEC-Line-Emergen-ESSTR"].show(); me["ELEC-Line-Emergen-ESSTR"].show();
} else { } else {
@ -1920,13 +1884,13 @@ var canvas_lowerECAM_elec = {
me["ELEC-Line-Emergen-ESSTR"].hide(); me["ELEC-Line-Emergen-ESSTR"].hide();
} }
if (systems.ELEC.Bus.acEss.getValue() >= 110 and !getprop("/systems/electrical/relay/ac-ess-feed-emer-gen/contact-pos") and (!getprop("/systems/electrical/relay/tr-contactor-1/contact-pos") or !getprop("/systems/electrical/relay/tr-contactor-2/contact-pos"))) { if (systems.ELEC.Bus.acEss.getValue() >= 110 and !systems.ELEC.Relay.acEssEmerGenFeed.getValue() and (!systems.ELEC.Relay.tr1Contactor.getValue() or !systems.ELEC.Relay.tr2Contactor.getValue())) {
me["ELEC-Line-ACESS-TRESS"].show(); me["ELEC-Line-ACESS-TRESS"].show();
} else { } else {
me["ELEC-Line-ACESS-TRESS"].hide(); me["ELEC-Line-ACESS-TRESS"].hide();
} }
if (getprop("/systems/electrical/relay/dc-ess-feed-tr/contact-pos")) { if (systems.ELEC.Relay.essTrContactor.getValue()) {
me["ELEC-Line-ESSTR-DCESS"].show(); me["ELEC-Line-ESSTR-DCESS"].show();
} else { } else {
me["ELEC-Line-ESSTR-DCESS"].hide(); me["ELEC-Line-ESSTR-DCESS"].hide();
@ -1989,7 +1953,7 @@ var canvas_lowerECAM_eng = {
me["OilPSI2-needle"].setRotation((oil_psi2.getValue() + 90) * D2R); me["OilPSI2-needle"].setRotation((oil_psi2.getValue() + 90) * D2R);
# Fuel Used # Fuel Used
if (acconfig_weight_kgs.getValue() == 1) { if (acconfig_weight_kgs.getValue()) {
me["FUEL-used-1"].setText(sprintf("%s", math.round(fuel_used_lbs1.getValue() * LBS2KGS, 10))); me["FUEL-used-1"].setText(sprintf("%s", math.round(fuel_used_lbs1.getValue() * LBS2KGS, 10)));
me["FUEL-used-2"].setText(sprintf("%s", math.round(fuel_used_lbs2.getValue() * LBS2KGS, 10))); me["FUEL-used-2"].setText(sprintf("%s", math.round(fuel_used_lbs2.getValue() * LBS2KGS, 10)));
me["Fused-weight-unit"].setText("KG"); me["Fused-weight-unit"].setText("KG");
@ -2303,7 +2267,7 @@ var canvas_lowerECAM_fctl = {
if (elac1.getValue()) { if (elac1.getValue()) {
me["elac1"].setColor(0.0509,0.7529,0.2941); me["elac1"].setColor(0.0509,0.7529,0.2941);
me["path4249"].setColor(0.0509,0.7529,0.2941); me["path4249"].setColor(0.0509,0.7529,0.2941);
} else if ((elac1.getValue() == 0) or (elac1_fail.getValue() == 1)) { } else if ((elac1.getValue() == 0) or (elac1_fail.getValue())) {
me["elac1"].setColor(0.7333,0.3803,0); me["elac1"].setColor(0.7333,0.3803,0);
me["path4249"].setColor(0.7333,0.3803,0); me["path4249"].setColor(0.7333,0.3803,0);
} }
@ -2311,7 +2275,7 @@ var canvas_lowerECAM_fctl = {
if (elac2.getValue()) { if (elac2.getValue()) {
me["elac2"].setColor(0.0509,0.7529,0.2941); me["elac2"].setColor(0.0509,0.7529,0.2941);
me["path4249-3"].setColor(0.0509,0.7529,0.2941); me["path4249-3"].setColor(0.0509,0.7529,0.2941);
} else if ((elac2.getValue() == 0) or (elac2_fail.getValue() == 1)) { } else if ((elac2.getValue() == 0) or (elac2_fail.getValue())) {
me["elac2"].setColor(0.7333,0.3803,0); me["elac2"].setColor(0.7333,0.3803,0);
me["path4249-3"].setColor(0.7333,0.3803,0); me["path4249-3"].setColor(0.7333,0.3803,0);
} }
@ -2319,7 +2283,7 @@ var canvas_lowerECAM_fctl = {
if (sec1.getValue()) { if (sec1.getValue()) {
me["sec1"].setColor(0.0509,0.7529,0.2941); me["sec1"].setColor(0.0509,0.7529,0.2941);
me["path4249-3-6-7"].setColor(0.0509,0.7529,0.2941); me["path4249-3-6-7"].setColor(0.0509,0.7529,0.2941);
} else if ((sec1.getValue() == 0) or (sec1_fail.getValue() == 1)) { } else if ((sec1.getValue() == 0) or (sec1_fail.getValue())) {
me["sec1"].setColor(0.7333,0.3803,0); me["sec1"].setColor(0.7333,0.3803,0);
me["path4249-3-6-7"].setColor(0.7333,0.3803,0); me["path4249-3-6-7"].setColor(0.7333,0.3803,0);
} }
@ -2327,7 +2291,7 @@ var canvas_lowerECAM_fctl = {
if (sec2.getValue()) { if (sec2.getValue()) {
me["sec2"].setColor(0.0509,0.7529,0.2941); me["sec2"].setColor(0.0509,0.7529,0.2941);
me["path4249-3-6-7-5"].setColor(0.0509,0.7529,0.2941); me["path4249-3-6-7-5"].setColor(0.0509,0.7529,0.2941);
} else if ((sec2.getValue() == 0) or (sec2_fail.getValue() == 1)) { } else if ((sec2.getValue() == 0) or (sec2_fail.getValue())) {
me["sec2"].setColor(0.7333,0.3803,0); me["sec2"].setColor(0.7333,0.3803,0);
me["path4249-3-6-7-5"].setColor(0.7333,0.3803,0); me["path4249-3-6-7-5"].setColor(0.7333,0.3803,0);
} }
@ -2335,7 +2299,7 @@ var canvas_lowerECAM_fctl = {
if (sec3.getValue()) { if (sec3.getValue()) {
me["sec3"].setColor(0.0509,0.7529,0.2941); me["sec3"].setColor(0.0509,0.7529,0.2941);
me["path4249-3-6"].setColor(0.0509,0.7529,0.2941); me["path4249-3-6"].setColor(0.0509,0.7529,0.2941);
} else if ((sec3.getValue() == 0) or (sec3_fail.getValue() == 1)) { } else if ((sec3.getValue() == 0) or (sec3_fail.getValue())) {
me["sec3"].setColor(0.7333,0.3803,0); me["sec3"].setColor(0.7333,0.3803,0);
me["path4249-3-6"].setColor(0.7333,0.3803,0); me["path4249-3-6"].setColor(0.7333,0.3803,0);
} }
@ -2407,7 +2371,6 @@ var canvas_lowerECAM_fuel = {
update: func() { update: func() {
_weight_kgs = acconfig_weight_kgs.getValue(); _weight_kgs = acconfig_weight_kgs.getValue();
# if (getprop("/engines/engine[0]/n1-actual") < getprop("/controls/engines/idle-limit")) {
if (eng1_n1.getValue() <= 18.8) { if (eng1_n1.getValue() <= 18.8) {
me["ENG1idFFlow"].setColor(0.7333,0.3803,0); me["ENG1idFFlow"].setColor(0.7333,0.3803,0);
me["FUEL-ENG-1-label"].setColor(0.7333,0.3803,0); me["FUEL-ENG-1-label"].setColor(0.7333,0.3803,0);
@ -2416,7 +2379,6 @@ var canvas_lowerECAM_fuel = {
me["FUEL-ENG-1-label"].setColor(0.8078,0.8039,0.8078); me["FUEL-ENG-1-label"].setColor(0.8078,0.8039,0.8078);
} }
# if (getprop("/engines/engine[1]/n1-actual") < getprop("/controls/engines/idle-limit")) {
if (eng2_n1.getValue() <= 18.5) { if (eng2_n1.getValue() <= 18.5) {
me["ENG2idFFlow"].setColor(0.7333,0.3803,0); me["ENG2idFFlow"].setColor(0.7333,0.3803,0);
me["FUEL-ENG-2-label"].setColor(0.7333,0.3803,0); me["FUEL-ENG-2-label"].setColor(0.7333,0.3803,0);
@ -2455,7 +2417,7 @@ var canvas_lowerECAM_fuel = {
# TODO use the valve prop and add amber if difference between eng master and valve # TODO use the valve prop and add amber if difference between eng master and valve
# TODO add transition state # TODO add transition state
if (systems.FUEL.Valves.lpValve1.getValue() == 1) { if (systems.FUEL.Valves.lpValve1.getValue()) {
me["FUEL-ENG-Master-1"].setRotation(0); me["FUEL-ENG-Master-1"].setRotation(0);
me["FUEL-ENG-Master-1"].setColor(0.0509,0.7529,0.2941); me["FUEL-ENG-Master-1"].setColor(0.0509,0.7529,0.2941);
me["FUEL-ENG-Master-1"].setColorFill(0.0509,0.7529,0.2941); me["FUEL-ENG-Master-1"].setColorFill(0.0509,0.7529,0.2941);
@ -2469,7 +2431,7 @@ var canvas_lowerECAM_fuel = {
# TODO use the valve prop and add amber if difference between eng master and valve # TODO use the valve prop and add amber if difference between eng master and valve
# TODO add transition state # TODO add transition state
if (systems.FUEL.Valves.lpValve2.getValue() == 1) { if (systems.FUEL.Valves.lpValve2.getValue()) {
me["FUEL-ENG-Master-2"].setRotation(0); me["FUEL-ENG-Master-2"].setRotation(0);
me["FUEL-ENG-Master-2"].setColor(0.0509,0.7529,0.2941); me["FUEL-ENG-Master-2"].setColor(0.0509,0.7529,0.2941);
me["FUEL-ENG-Master-2"].setColorFill(0.0509,0.7529,0.2941); me["FUEL-ENG-Master-2"].setColorFill(0.0509,0.7529,0.2941);
@ -2609,7 +2571,7 @@ var canvas_lowerECAM_fuel = {
if (systems.FUEL.Valves.transfer1.getValue() == 0) { if (systems.FUEL.Valves.transfer1.getValue() == 0) {
me["FUEL-Left-Transfer"].hide(); me["FUEL-Left-Transfer"].hide();
} else { } else {
if (systems.FUEL.Valves.transfer1.getValue() == 1) { if (systems.FUEL.Valves.transfer1.getValue()) {
me["FUEL-Left-Transfer"].setColor(0.0509,0.7529,0.2941); me["FUEL-Left-Transfer"].setColor(0.0509,0.7529,0.2941);
} else { } else {
me["FUEL-Left-Transfer"].setColor(0.7333,0.3803,0); me["FUEL-Left-Transfer"].setColor(0.7333,0.3803,0);
@ -2620,7 +2582,7 @@ var canvas_lowerECAM_fuel = {
if (systems.FUEL.Valves.transfer2.getValue() == 0) { if (systems.FUEL.Valves.transfer2.getValue() == 0) {
me["FUEL-Right-Transfer"].hide(); me["FUEL-Right-Transfer"].hide();
} else { } else {
if (systems.FUEL.Valves.transfer2.getValue() == 1) { if (systems.FUEL.Valves.transfer2.getValue()) {
me["FUEL-Right-Transfer"].setColor(0.0509,0.7529,0.2941); me["FUEL-Right-Transfer"].setColor(0.0509,0.7529,0.2941);
} else { } else {
me["FUEL-Right-Transfer"].setColor(0.7333,0.3803,0); me["FUEL-Right-Transfer"].setColor(0.7333,0.3803,0);
@ -2635,13 +2597,13 @@ var canvas_lowerECAM_fuel = {
} }
# APU # APU
if (systems.FUEL.Valves.apu.getValue() == 1 and systems.APUNodes.Controls.master.getValue() and !systems.APUNodes.Controls.fire.getValue()) { if (systems.FUEL.Valves.apu.getValue() and systems.APUNodes.Controls.master.getValue() and !systems.APUNodes.Controls.fire.getValue()) {
me["FUEL-APU-label"].setColor(0.8078, 0.8039, 0.8078); me["FUEL-APU-label"].setColor(0.8078, 0.8039, 0.8078);
me["FUEL-APU-line"].setColor(0.0509,0.7529,0.2941); me["FUEL-APU-line"].setColor(0.0509,0.7529,0.2941);
me["FUEL-APU-arrow"].setColor(0.0509,0.7529,0.2941); me["FUEL-APU-arrow"].setColor(0.0509,0.7529,0.2941);
me["FUEL-APU-line"].show(); me["FUEL-APU-line"].show();
me["FUEL-APU-arrow"].show(); me["FUEL-APU-arrow"].show();
} elsif (systems.FUEL.Valves.apu.getValue() == 1 and (!systems.APUNodes.Controls.master.getValue() or systems.APUNodes.Controls.fire.getValue())) { } elsif (systems.FUEL.Valves.apu.getValue() and (!systems.APUNodes.Controls.master.getValue() or systems.APUNodes.Controls.fire.getValue())) {
me["FUEL-APU-label"].setColor(0.7333,0.3803,0); me["FUEL-APU-label"].setColor(0.7333,0.3803,0);
me["FUEL-APU-line"].setColor(0.7333,0.3803,0); me["FUEL-APU-line"].setColor(0.7333,0.3803,0);
me["FUEL-APU-arrow"].setColor(0.7333,0.3803,0); me["FUEL-APU-arrow"].setColor(0.7333,0.3803,0);
@ -2887,37 +2849,37 @@ var canvas_lowerECAM_hyd = {
} }
} }
if (y_resv_lo_air_press.getValue() == 1) { if (y_resv_lo_air_press.getValue()) {
me["LO-AIR-PRESS-Yellow"].show(); me["LO-AIR-PRESS-Yellow"].show();
} else { } else {
me["LO-AIR-PRESS-Yellow"].hide(); me["LO-AIR-PRESS-Yellow"].hide();
} }
if (b_resv_lo_air_press.getValue() == 1) { if (b_resv_lo_air_press.getValue()) {
me["LO-AIR-PRESS-Blue"].show(); me["LO-AIR-PRESS-Blue"].show();
} else { } else {
me["LO-AIR-PRESS-Blue"].hide(); me["LO-AIR-PRESS-Blue"].hide();
} }
if (g_resv_lo_air_press.getValue() == 1) { if (g_resv_lo_air_press.getValue()) {
me["LO-AIR-PRESS-Green"].show(); me["LO-AIR-PRESS-Green"].show();
} else { } else {
me["LO-AIR-PRESS-Green"].hide(); me["LO-AIR-PRESS-Green"].hide();
} }
if (elec_pump_y_ovht.getValue() == 1) { if (elec_pump_y_ovht.getValue()) {
me["ELEC-OVHT-Yellow"].show(); me["ELEC-OVHT-Yellow"].show();
} else { } else {
me["ELEC-OVHT-Yellow"].hide(); me["ELEC-OVHT-Yellow"].hide();
} }
if (elec_pump_b_ovht.getValue() == 1) { if (elec_pump_b_ovht.getValue()) {
me["ELEC-OVHT-Blue"].show(); me["ELEC-OVHT-Blue"].show();
} else { } else {
me["ELEC-OVHT-Blue"].hide(); me["ELEC-OVHT-Blue"].hide();
} }
if (systems.HYD.Rat.position.getValue() == 1) { if (systems.HYD.Rat.position.getValue()) {
me["RAT-stowed"].hide(); me["RAT-stowed"].hide();
me["RAT-not-stowed"].show(); me["RAT-not-stowed"].show();
} else { } else {
@ -2925,19 +2887,19 @@ var canvas_lowerECAM_hyd = {
me["RAT-not-stowed"].hide(); me["RAT-not-stowed"].hide();
} }
if (y_resv_ovht.getValue() == 1) { if (y_resv_ovht.getValue()) {
me["OVHT-Yellow"].show(); me["OVHT-Yellow"].show();
} else { } else {
me["OVHT-Yellow"].hide(); me["OVHT-Yellow"].hide();
} }
if (b_resv_ovht.getValue() == 1) { if (b_resv_ovht.getValue()) {
me["OVHT-Green"].show(); me["OVHT-Green"].show();
} else { } else {
me["OVHT-Green"].hide(); me["OVHT-Green"].hide();
} }
if (g_resv_ovht.getValue() == 1) { if (g_resv_ovht.getValue()) {
me["OVHT-Blue"].show(); me["OVHT-Blue"].show();
} else { } else {
me["OVHT-Blue"].hide(); me["OVHT-Blue"].hide();
@ -3593,13 +3555,13 @@ setlistener("sim/signals/fdm-initialized", func {
lowerECAM_test = canvas_lowerECAM_test.new(group_test, "Aircraft/A320-family/Models/Instruments/Common/res/du-test.svg"); lowerECAM_test = canvas_lowerECAM_test.new(group_test, "Aircraft/A320-family/Models/Instruments/Common/res/du-test.svg");
lowerECAM_update.start(); lowerECAM_update.start();
if (getprop("/systems/acconfig/options/lecam-rate") > 1) { if (rate.getValue() > 1) {
l_rateApply(); l_rateApply();
} }
}); });
var l_rateApply = func { var l_rateApply = func {
lowerECAM_update.restart(0.05 * getprop("/systems/acconfig/options/lecam-rate")); lowerECAM_update.restart(0.05 * rate.getValue());
} }
var lowerECAM_update = maketimer(0.05, func { var lowerECAM_update = maketimer(0.05, func {

View file

@ -236,14 +236,21 @@ var status = {
var ECAM_controller = { var ECAM_controller = {
_recallCounter: 0, _recallCounter: 0,
_noneActive: 0, _noneActive: 0,
counter: 0,
init: func() { init: func() {
ECAMloopTimer.start(); ECAMloopTimer.start();
me.counter = 0;
me.reset(); me.reset();
}, },
loop: func() { loop: func() {
if ((systems.ELEC.Bus.acEss.getValue() >= 110 or systems.ELEC.Bus.ac2.getValue() >= 110) and !pts.Acconfig.running.getBoolValue()) { if ((systems.ELEC.Bus.acEss.getValue() >= 110 or systems.ELEC.Bus.ac2.getValue() >= 110) and !pts.Acconfig.running.getBoolValue()) {
# update FWC phases # update FWC phases
phaseLoop(); if (me.counter == 0) {
phaseLoop();
me.counter = 1;
return;
}
me.counter = 0;
# check active messages # check active messages
messages_priority_3(); messages_priority_3();

View file

@ -197,15 +197,15 @@ var light_manager = {
var sh = math.sin(heading); var sh = math.sin(heading);
var ch = math.cos(heading); var ch = math.cos(heading);
if ((ll1 == 1 and getprop("systems/electrical/bus/ac-1") != 0) and (ll2 == 1 and getprop("systems/electrical/bus/ac-2") !=0)) { if ((ll1 == 1 and systems.ELEC.Bus.ac1.getValue() != 0) and (ll2 == 1 and systems.ELEC.Bus.ac2.getValue() != 0)) {
me.light1_ypos = 0.0; me.light1_ypos = 0.0;
me.light1_setSize(16); me.light1_setSize(16);
me.light1_on(); me.light1_on();
} else if (ll1 == 1 and getprop("systems/electrical/bus/ac-1") != 0) { } else if (ll1 == 1 and systems.ELEC.Bus.ac1.getValue() != 0) {
me.light1_ypos = 3.0; me.light1_ypos = 3.0;
me.light1_setSize(12); me.light1_setSize(12);
me.light1_on(); me.light1_on();
} else if (ll2 == 1 and getprop("systems/electrical/bus/ac-2") !=0) { } else if (ll2 == 1 and systems.ELEC.Bus.ac2.getValue() != 0) {
me.light1_ypos = -3.0; me.light1_ypos = -3.0;
me.light1_setSize(12); me.light1_setSize(12);
me.light1_on(); me.light1_on();

View file

@ -206,6 +206,7 @@ var systemsInit = func {
systems.ADIRS.init(); systems.ADIRS.init();
systems.eng_init(); systems.eng_init();
systems.APUController.init(); systems.APUController.init();
systems.BrakeSys.reset();
systems.Autobrake.init(); systems.Autobrake.init();
systems.fire_init(); systems.fire_init();
fmgc.flightPlanController.reset(); fmgc.flightPlanController.reset();
@ -254,6 +255,7 @@ var systemsLoop = maketimer(0.1, func {
systems.HYD.loop(); systems.HYD.loop();
systems.ADIRS.loop(); systems.ADIRS.loop();
systems.APUController.loop(); systems.APUController.loop();
systems.BrakeSys.update();
ecam.ECAM.loop(); ecam.ECAM.loop();
fadec.FADEC.loop(); fadec.FADEC.loop();
rmp.rmpUpdate(); rmp.rmpUpdate();

View file

@ -45,6 +45,7 @@ var Controls = {
brake: [props.globals.getNode("/controls/gear/brake-left"),props.globals.getNode("/controls/gear/brake-right")], brake: [props.globals.getNode("/controls/gear/brake-left"),props.globals.getNode("/controls/gear/brake-right")],
gearDown: props.globals.getNode("/controls/gear/gear-down"), gearDown: props.globals.getNode("/controls/gear/gear-down"),
parkingBrake: props.globals.getNode("/controls/gear/brake-parking"), parkingBrake: props.globals.getNode("/controls/gear/brake-parking"),
chocks: props.globals.getNode("/services/chocks/enable"),
}, },
}; };
@ -57,17 +58,20 @@ var Engines = {
eprActual: [props.globals.getNode("/engines/engine[0]/epr-actual"), props.globals.getNode("/engines/engine[1]/epr-actual")], eprActual: [props.globals.getNode("/engines/engine[0]/epr-actual"), props.globals.getNode("/engines/engine[1]/epr-actual")],
n1Actual: [props.globals.getNode("/engines/engine[0]/n1-actual"), props.globals.getNode("/engines/engine[1]/n1-actual")], n1Actual: [props.globals.getNode("/engines/engine[0]/n1-actual"), props.globals.getNode("/engines/engine[1]/n1-actual")],
n2Actual: [props.globals.getNode("/engines/engine[0]/n2-actual"), props.globals.getNode("/engines/engine[1]/n2-actual")], n2Actual: [props.globals.getNode("/engines/engine[0]/n2-actual"), props.globals.getNode("/engines/engine[1]/n2-actual")],
thrust: [props.globals.getNode("/engines/engine[0]/thrust-lb"), props.globals.getNode("/engines/engine[1]/thrust-lb")],
state: [props.globals.getNode("/engines/engine[0]/state"), props.globals.getNode("/engines/engine[1]/state")], state: [props.globals.getNode("/engines/engine[0]/state"), props.globals.getNode("/engines/engine[1]/state")],
}, },
}; };
var Environment = { var Environment = {
magVar: props.globals.getNode("/environment/magnetic-variation-deg"), magVar: props.globals.getNode("/environment/magnetic-variation-deg"),
tempDegC: props.globals.getNode("/environment/temperature-degc"),
}; };
var Fdm = { var Fdm = {
JSBsim: { JSBsim: {
Fcs: { Fcs: {
brake: [props.globals.getNode("/fdm/jsbsim/fcs/left-brake-cmd-norm"),props.globals.getNode("/fdm/jsbsim/fcs/right-brake-cmd-norm")],
flapDeg: props.globals.getNode("/fdm/jsbsim/fcs/flap-pos-deg"), flapDeg: props.globals.getNode("/fdm/jsbsim/fcs/flap-pos-deg"),
slatDeg: props.globals.getNode("/fdm/jsbsim/fcs/slat-pos-deg"), slatDeg: props.globals.getNode("/fdm/jsbsim/fcs/slat-pos-deg"),
}, },
@ -75,10 +79,14 @@ var Fdm = {
aileron: props.globals.getNode("/fdm/jsbsim/fbw/aileron-sidestick"), aileron: props.globals.getNode("/fdm/jsbsim/fbw/aileron-sidestick"),
elevator: props.globals.getNode("/fdm/jsbsim/fbw/elevator-sidestick"), elevator: props.globals.getNode("/fdm/jsbsim/fbw/elevator-sidestick"),
}, },
Inertia: {
weightLbs: props.globals.getNode("/fdm/jsbsim/inertia/weight-lbs"),
},
Position: { Position: {
wow: props.globals.getNode("/fdm/jsbsim/position/wow"), wow: props.globals.getNode("/fdm/jsbsim/position/wow"),
}, },
Propulsion: { Propulsion: {
tatC: props.globals.getNode("/fdm/jsbsim/propulsion/tat-c"),
Engine: { Engine: {
fuelUsed: [props.globals.getNode("/fdm/jsbsim/propulsion/engine[0]/fuel-used-lbs"), props.globals.getNode("/fdm/jsbsim/propulsion/engine[1]/fuel-used-lbs")], fuelUsed: [props.globals.getNode("/fdm/jsbsim/propulsion/engine[0]/fuel-used-lbs"), props.globals.getNode("/fdm/jsbsim/propulsion/engine[1]/fuel-used-lbs")],
reverserAngle: [props.globals.getNode("/fdm/jsbsim/propulsion/engine[0]/reverser-angle-rad"), props.globals.getNode("/fdm/jsbsim/propulsion/engine[1]/reverser-angle-rad")], reverserAngle: [props.globals.getNode("/fdm/jsbsim/propulsion/engine[0]/reverser-angle-rad"), props.globals.getNode("/fdm/jsbsim/propulsion/engine[1]/reverser-angle-rad")],
@ -163,6 +171,7 @@ var Sim = {
online: props.globals.getNode("/sim/multiplay/online"), online: props.globals.getNode("/sim/multiplay/online"),
}, },
pause: props.globals.getNode("/sim/freeze/master"), pause: props.globals.getNode("/sim/freeze/master"),
replayState: props.globals.getNode("/sim/freeze/replay-state"),
Replay: { Replay: {
replayActive: props.globals.getNode("/sim/replay/replay-state"), replayActive: props.globals.getNode("/sim/replay/replay-state"),
}, },
@ -179,7 +188,9 @@ var Systems = {
}; };
var Velocities = { var Velocities = {
airspeed: props.globals.getNode("/velocities/airspeed-kt"),
groundspeed: props.globals.getNode("/velocities/groundspeed-kt"), groundspeed: props.globals.getNode("/velocities/groundspeed-kt"),
mach: props.globals.getNode("/velocities/mach"),
}; };
setprop("/systems/acconfig/property-tree-setup-loaded", 1); setprop("/systems/acconfig/property-tree-setup-loaded", 1);

View file

@ -33,8 +33,20 @@
# #
# Added brakes temp calculations and adapted for A320-family # Added brakes temp calculations and adapted for A320-family
# 2020, Andrea Vezzali # 2020, Andrea Vezzali
# # Updated Nasal to project standards
# 2020, Jonathan Redpath
########################################################################## ##########################################################################
var LThermalEnergy = 0;
var RThermalEnergy = 0;
var dt = 0;
var LBrakeLevel = 0;
var RBrakeLevel = 0;
var tatdegc = 0;
var L_thrust = 0;
var R_thrust = 0;
var airspeed = 0;
var BrakeSystem = var BrakeSystem =
{ {
new : func() new : func()
@ -56,9 +68,17 @@ var BrakeSystem =
m.LSmokeToggle = 0; m.LSmokeToggle = 0;
m.RSmokeActive = 0; m.RSmokeActive = 0;
m.RSmokeToggle = 0; m.RSmokeToggle = 0;
# m.LnCoolFactor = math.ln(1-m.CoolingFactor); m.thermalEnergy = [0.0, 0.0];
m.brakeFans = props.globals.getNode("/controls/gear/brake-fans");
m.reset(); m.fireServices = props.globals.getNode("/sim/animation/fire-services");
m.gearSmoke = [props.globals.getNode("/gear/gear[1]/Lbrake-smoke"), props.globals.getNode("/gear/gear[2]/Rbrake-smoke")];
m.lBrakeTemp = [props.globals.getNode("/gear/gear[1]/L1brake-temp-degc"),props.globals.getNode("/gear/gear[1]/L2brake-temp-degc")];
m.rBrakeTemp = [props.globals.getNode("/gear/gear[2]/R3brake-temp-degc"),props.globals.getNode("/gear/gear[2]/R4brake-temp-degc")];
m.L1error = 0;
m.L2error = 0;
m.R3error = 0;
m.R4error = 0;
m.counter = 0;
return m; return m;
}, },
@ -66,73 +86,68 @@ var BrakeSystem =
reset : func() reset : func()
{ {
# Initial thermal energy # Initial thermal energy
setprop("gear/gear[1]/Lbrake-thermal-energy",0.0); me.thermalEnergy[0] = 0.0;
setprop("gear/gear[2]/Rbrake-thermal-energy",0.0); me.thermalEnergy[1] = 0.0;
setprop("/controls/gear/brake-fans",0); me.brakeFans.setValue(0);
setprop("gear/gear[1]/Lbrake-smoke",0); me.gearSmoke[0].setValue(0);
setprop("gear/gear[2]/Rbrake-smoke",0); me.gearSmoke[1].setValue(0);
setprop("gear/gear[1]/L-Thrust",0); me.fireServices.setValue(0);
setprop("gear/gear[2]/R-Thrust",0);
#Introducing a random error on temp sensors (max 5°C) #Introducing a random error on temp sensors (max 5°C)
setprop("gear/gear[1]/L1error-temp-degc", math.round(rand()*(5))); me.L1error = math.round(rand()*(5));
setprop("gear/gear[1]/L2error-temp-degc", math.round(rand()*(5))); me.L2error = math.round(rand()*(5));
setprop("gear/gear[2]/R3error-temp-degc", math.round(rand()*(5))); me.R3error = math.round(rand()*(5));
setprop("gear/gear[2]/R4error-temp-degc", math.round(rand()*(5))); me.R4error = math.round(rand()*(5));
#var atemp = getprop("environment/temperature-degc") or 0; var tatdegc = pts.Fdm.JSBsim.Propulsion.tatC.getValue() or 0;
#var vmach = getprop("velocities/mach") or 0;
var tatdegc = getprop("/systems/navigation/probes/tat-1/compute-tat") or 0;
var atemp = getprop("environment/temperature-degc") or 0;
var vmach = getprop("velocities/mach") or 0;
var tatdegc = getprop("/systems/navigation/probes/tat-1/compute-tat");
setprop("gear/gear[1]/L1brake-temp-degc",tatdegc+getprop("gear/gear[1]/L1error-temp-degc")); me.lBrakeTemp[0].setValue(tatdegc+me.L1error);
setprop("gear/gear[1]/L2brake-temp-degc",tatdegc+getprop("gear/gear[1]/L2error-temp-degc")); me.lBrakeTemp[1].setValue(tatdegc+me.L2error);
setprop("gear/gear[2]/R3brake-temp-degc",tatdegc+getprop("gear/gear[2]/R3error-temp-degc")); me.rBrakeTemp[0].setValue(tatdegc+me.R3error);
setprop("gear/gear[2]/R4brake-temp-degc",tatdegc+getprop("gear/gear[2]/R4error-temp-degc")); me.rBrakeTemp[1].setValue(tatdegc+me.R4error);
setprop("/sim/animation/fire-services",0);
me.LastSimTime = 0.0; me.LastSimTime = 0.0;
}, },
# update brake energy # update brake energy
update : func() update : func()
{ {
var CurrentTime = getprop("/sim/time/elapsed-sec"); if (me.counter == 0) {
var dt = CurrentTime - me.LastSimTime; me.counter = 1;
var LThermalEnergy = getprop("gear/gear[1]/Lbrake-thermal-energy"); } else {
var RThermalEnergy = getprop("gear/gear[2]/Rbrake-thermal-energy"); me.counter = 0;
var LBrakeLevel = getprop("fdm/jsbsim/fcs/left-brake-cmd-norm"); return;
var RBrakeLevel = getprop("fdm/jsbsim/fcs/right-brake-cmd-norm"); }
#var atemp = getprop("environment/temperature-degc") or 0;
#var vmach = getprop("velocities/mach") or 0; LThermalEnergy = me.thermalEnergy[0];
#var tatdegc = atemp * (1 + (0.2 * math.pow(vmach, 2))); RThermalEnergy = me.thermalEnergy[1];
var tatdegc = getprop("/systems/navigation/probes/tat-1/compute-tat") or 0; me.CurrentTime = pts.Sim.Time.elapsedSec.getValue();
var L_thrust_lb = getprop("engines/engine[0]/thrust_lb"); dt = me.CurrentTime - me.LastSimTime;
var R_thrust_lb = getprop("engines/engine[1]/thrust_lb"); LBrakeLevel = pts.Fdm.JSBsim.Fcs.brake[0].getValue();
RBrakeLevel = pts.Fdm.JSBsim.Fcs.brake[1].getValue();
tatdegc = pts.Fdm.JSBsim.Propulsion.tatC.getValue() or 0;
if (getprop("/sim/freeze/replay-state")==0 and dt<1.0) { if (pts.Sim.replayState.getValue() == 0 and dt < 1.0) {
var OnGround = getprop("gear/gear[1]/wow");
#cooling effect: adjust cooling factor by a value proportional to the environment temp (m.CoolingFactor + environment temp-degc * 0.00001) #cooling effect: adjust cooling factor by a value proportional to the environment temp (m.CoolingFactor + environment temp-degc * 0.00001)
var LCoolingRatio = me.CoolingFactor+(tatdegc*0.000001); var LCoolingRatio = me.CoolingFactor+(tatdegc*0.000001);
var RCoolingRatio = me.CoolingFactor+(tatdegc*0.000001); var RCoolingRatio = me.CoolingFactor+(tatdegc*0.000001);
if (getprop("/controls/gear/brake-fans")) { if (me.brakeFans.getValue()) {
#increase CoolingRatio if Brake Fans are active #increase CoolingRatio if Brake Fans are active
LCoolingRatio = LCoolingRatio * 3; LCoolingRatio = LCoolingRatio * 3;
RCoolingRatio = RCoolingRatio * 3; RCoolingRatio = RCoolingRatio * 3;
}; };
if (getprop("gear/gear[1]/position-norm")) { airspeed = pts.Velocities.airspeed.getValue();
if (pts.Gear.position[1].getValue()) {
#increase CoolingRatio if gear down according to airspeed #increase CoolingRatio if gear down according to airspeed
LCoolingRatio = LCoolingRatio * getprop("velocities/airspeed-kt"); LCoolingRatio = LCoolingRatio * airspeed;
} else { } else {
#Reduced CoolingRatio if gear up #Reduced CoolingRatio if gear up
LCoolingRatio = LCoolingRatio * 0.1; LCoolingRatio = LCoolingRatio * 0.1;
}; };
if (getprop("gear/gear[2]/position-norm")) { if (pts.Gear.position[2].getValue()) {
#increase CoolingRatio if gear down according to airspeed #increase CoolingRatio if gear down according to airspeed
RCoolingRatio = RCoolingRatio * getprop("velocities/airspeed-kt"); RCoolingRatio = RCoolingRatio * airspeed;
} else { } else {
#Reduced CoolingRatio if gear up #Reduced CoolingRatio if gear up
RCoolingRatio = RCoolingRatio * 0.1; RCoolingRatio = RCoolingRatio * 0.1;
@ -149,34 +164,22 @@ var BrakeSystem =
var LnCoolFactor = math.ln(1-LCoolingRatio); var LnCoolFactor = math.ln(1-LCoolingRatio);
var RnCoolFactor = math.ln(1-RCoolingRatio); var RnCoolFactor = math.ln(1-RCoolingRatio);
L_thrust_lb = math.abs(getprop("engines/engine[0]/thrust_lb")); # disabled thrust effect
if (L_thrust_lb < 1) {
L_thrust_lb = 1
};
#Disabling thrust computation on Brakes temperature
#L_Thrust = math.pow((math.log10(L_thrust_lb)),10)*0.0000000002;
L_Thrust = 0; L_Thrust = 0;
R_thrust_lb = math.abs(getprop("engines/engine[1]/thrust_lb"));
if (R_thrust_lb < 1) {
R_thrust_lb = 1
};
#Disabling thrust computation on Brakes temperature
#R_Thrust = math.pow((math.log10(R_thrust_lb)),10)*0.0000000002;
R_Thrust = 0; R_Thrust = 0;
if (OnGround) { if (pts.Gear.wow[1].getValue()) {
var V1 = getprop("velocities/groundspeed-kt"); var V1 = pts.Velocities.groundspeed.getValue();
var Mass = getprop("fdm/jsbsim/inertia/weight-lbs")*(me.ScalingDivisor); var Mass = pts.Fdm.JSBsim.Inertia.weightLbs.getValue() * me.ScalingDivisor;
# absorb some kinetic energy: # absorb some kinetic energy:
# dE= 1/2 * m * V1^2 - 1/2 * m * V2^2) # dE= 1/2 * m * V1^2 - 1/2 * m * V2^2)
var V2_L = V1 - me.BrakeDecel * dt * LBrakeLevel; var V2_L = V1 - me.BrakeDecel * dt * LBrakeLevel;
var V2_R = V1 - me.BrakeDecel * dt * RBrakeLevel; var V2_R = V1 - me.BrakeDecel * dt * RBrakeLevel;
LThermalEnergy += (Mass * getprop("gear/gear[1]/compression-norm") * (math.pow(V1, 2) - math.pow(V2_L, 2)) / 2); LThermalEnergy += (Mass * pts.Gear.compression[1].getValue() * (math.pow(V1, 2) - math.pow(V2_L, 2)) / 2);
if (getprop("/services/chocks/enable")) { if (pts.Controls.Gear.chocks.getValue()) {
if (!getprop("/controls/gear/brake-parking")) { if (!pts.Controls.Gear.parkingBrake.getValue()) {
# cooling effect: reduce thermal energy by (LnCoolFactor) * dt # cooling effect: reduce thermal energy by (LnCoolFactor) * dt
LThermalEnergy = LThermalEnergy * math.exp(LnCoolFactor * dt); LThermalEnergy = LThermalEnergy * math.exp(LnCoolFactor * dt);
} else { } else {
@ -185,7 +188,7 @@ var BrakeSystem =
LThermalEnergy = (LThermalEnergy * math.exp(LnCoolFactor * dt)) + (L_Thrust * dt); LThermalEnergy = (LThermalEnergy * math.exp(LnCoolFactor * dt)) + (L_Thrust * dt);
}; };
} else { } else {
if (!getprop("/controls/gear/brake-parking")) { if (!pts.Controls.Gear.parkingBrake.getValue()) {
if (LBrakeLevel>0) { if (LBrakeLevel>0) {
if (V2_L>0) { if (V2_L>0) {
#LThermalEnergy += (Mass * (math.pow(V1, 2) - math.pow(V2_L, 2)) / 2) + L_thrust; #LThermalEnergy += (Mass * (math.pow(V1, 2) - math.pow(V2_L, 2)) / 2) + L_thrust;
@ -207,9 +210,9 @@ var BrakeSystem =
}; };
}; };
RThermalEnergy += (Mass * getprop("gear/gear[2]/compression-norm") * (math.pow(V1, 2) - math.pow(V2_R, 2)) / 2); RThermalEnergy += (Mass * pts.Gear.compression[2].getValue() * (math.pow(V1, 2) - math.pow(V2_R, 2)) / 2);
if (getprop("/services/chocks/enable")) { if (pts.Controls.Gear.chocks.getValue()) {
if (!getprop("/controls/gear/brake-parking")) { if (!pts.Controls.Gear.parkingBrake.getValue()) {
# cooling effect: reduce thermal energy by (RnCoolFactor) * dt # cooling effect: reduce thermal energy by (RnCoolFactor) * dt
RThermalEnergy = RThermalEnergy * math.exp(RnCoolFactor * dt); RThermalEnergy = RThermalEnergy * math.exp(RnCoolFactor * dt);
} else { } else {
@ -218,7 +221,7 @@ var BrakeSystem =
RThermalEnergy = (RThermalEnergy * math.exp(RnCoolFactor * dt)) + (R_Thrust * dt); RThermalEnergy = (RThermalEnergy * math.exp(RnCoolFactor * dt)) + (R_Thrust * dt);
}; };
} else { } else {
if (!getprop("/controls/gear/brake-parking")) { if (!pts.Controls.Gear.parkingBrake.getValue()) {
if (RBrakeLevel>0) { if (RBrakeLevel>0) {
if (V2_R>0) { if (V2_R>0) {
#RThermalEnergy += (Mass * (math.pow(V1, 2) - math.pow(V2_R, 2)) / 2) + R_thrust; #RThermalEnergy += (Mass * (math.pow(V1, 2) - math.pow(V2_R, 2)) / 2) + R_thrust;
@ -256,67 +259,62 @@ var BrakeSystem =
RThermalEnergy = 3 RThermalEnergy = 3
}; };
setprop("gear/gear[1]/L-Thrust",L_Thrust); me.thermalEnergy[0] = LThermalEnergy;
setprop("gear/gear[2]/R-Thrust",R_Thrust); me.thermalEnergy[1] = RThermalEnergy;
setprop("gear/gear[1]/Lbrake-thermal-energy",LThermalEnergy);
setprop("gear/gear[2]/Rbrake-thermal-energy",RThermalEnergy);
#Calculating Brakes temperature #Calculating Brakes temperature
setprop("gear/gear[1]/L1brake-temp-degc",tatdegc+getprop("gear/gear[1]/L1error-temp-degc")+(LThermalEnergy * (300-tatdegc-getprop("gear/gear[1]/L1error-temp-degc")))); me.lBrakeTemp[0].setValue(tatdegc+me.L1error+(LThermalEnergy * (300-tatdegc-me.L1error)));
setprop("gear/gear[1]/L2brake-temp-degc",tatdegc+getprop("gear/gear[1]/L2error-temp-degc")+(LThermalEnergy * (300-tatdegc-getprop("gear/gear[1]/L2error-temp-degc")))); me.lBrakeTemp[1].setValue(tatdegc+me.L2error+(LThermalEnergy * (300-tatdegc-me.L2error)));
setprop("gear/gear[2]/R3brake-temp-degc",tatdegc+getprop("gear/gear[2]/R3error-temp-degc")+(RThermalEnergy * (300-tatdegc-getprop("gear/gear[2]/R3error-temp-degc")))); me.rBrakeTemp[0].setValue(tatdegc+me.R3error+(RThermalEnergy * (300-tatdegc-me.R3error)));
setprop("gear/gear[2]/R4brake-temp-degc",tatdegc+getprop("gear/gear[2]/R4error-temp-degc")+(RThermalEnergy * (300-tatdegc-getprop("gear/gear[2]/R4error-temp-degc")))); me.rBrakeTemp[1].setValue(tatdegc+me.R4error+(RThermalEnergy * (300-tatdegc-me.R4error)));
if ((LThermalEnergy>1)and(!me.LSmokeActive)) { if (LThermalEnergy>1 and !me.LSmokeActive) {
# start smoke processing # start smoke processing
me.LSmokeActive = 1; me.LSmokeActive = 1;
settimer(func { BrakeSys.Lsmoke(); },0); settimer(func { BrakeSys.Lsmoke(); },0);
}; };
if ((RThermalEnergy>1)and(!me.RSmokeActive)) { if (RThermalEnergy>1 and !me.RSmokeActive) {
# start smoke processing # start smoke processing
me.RSmokeActive = 1; me.RSmokeActive = 1;
settimer(func { BrakeSys.Rsmoke(); },0); settimer(func { BrakeSys.Rsmoke(); },0);
}; };
}; };
me.LastSimTime = CurrentTime; me.LastSimTime = me.CurrentTime;
# 5 updates per second are good enough
settimer(func { BrakeSys.update(); },0.2);
}, },
# smoke processing # smoke processing
Lsmoke : func() Lsmoke : func()
{ {
if ((me.LSmokeActive)and(getprop("gear/gear[1]/Lbrake-thermal-energy")>1)) { if (me.LSmokeActive and me.thermalEnergy[0] > 1) {
# make density of smoke effect depend on energy level # make density of smoke effect depend on energy level
var LSmokeDelay=0; var LSmokeDelay = 0;
var LThermalEnergy = getprop("gear/gear[1]/Lbrake-thermal-energy"); var LThermalEnergy = me.thermalEnergy[0];
if (LThermalEnergy < 1.5) { if (LThermalEnergy < 1.5) {
LSmokeDelay=(1.5-LThermalEnergy); LSmokeDelay = (1.5 - LThermalEnergy);
}; };
# No smoke when gear retracted # No smoke when gear retracted
var LSmokeValue = (getprop("gear/gear[1]/position-norm")>0.5); var LSmokeValue = (pts.Gear.position[1].getValue() > 0.5);
# toggle smoke to interpolate different densities # toggle smoke to interpolate different densities
if (LSmokeDelay>0.05) { if (LSmokeDelay > 0.05) {
me.LSmokeToggle = !me.LSmokeToggle; me.LSmokeToggle = !me.LSmokeToggle;
if (!me.LSmokeToggle) if (!me.LSmokeToggle)
LSmokeValue = 0; LSmokeValue = 0;
else else
LSmokeDelay = 0; LSmokeDelay = 0;
}; };
setprop("gear/gear[1]/Lbrake-smoke",LSmokeValue); me.gearSmoke[0].setValue(LSmokeValue);
settimer(func { BrakeSys.Lsmoke(); },LSmokeDelay); settimer(func { BrakeSys.Lsmoke(); },LSmokeDelay);
} else { } else {
# stop smoke processing # stop smoke processing
setprop("gear/gear[1]/Lbrake-smoke",0); me.gearSmoke[0].setValue(0);
setprop("/sim/animation/fire-services",0);
me.LSmokeActive = 0; me.LSmokeActive = 0;
}; };
if (getprop("gear/gear[1]/Lbrake-thermal-energy") > 1.5) { if (me.thermalEnergy[0] > 1.5) {
setprop("/sim/animation/fire-services",1); me.fireServices.setValue(1);
} else { } else {
setprop("/sim/animation/fire-services",0); me.fireServices.setValue(0);
}; };
}, },
@ -324,35 +322,35 @@ var BrakeSystem =
# smoke processing # smoke processing
Rsmoke : func() Rsmoke : func()
{ {
if ((me.RSmokeActive)and(getprop("gear/gear[2]/Rbrake-thermal-energy")>1)) { if (me.RSmokeActive and me.thermalEnergy[1] > 1) {
# make density of smoke effect depend on energy level # make density of smoke effect depend on energy level
var RSmokeDelay=0; var RSmokeDelay = 0;
var RThermalEnergy = getprop("gear/gear[2]/Rbrake-thermal-energy"); var RThermalEnergy = me.thermalEnergy[1];
if (RThermalEnergy < 1.5) { if (RThermalEnergy < 1.5) {
RSmokeDelay=(1.5-RThermalEnergy); RSmokeDelay = (1.5 - RThermalEnergy);
}; };
# No smoke when gear retracted # No smoke when gear retracted
var RSmokeValue = (getprop("gear/gear[2]/position-norm")>0.5); var RSmokeValue = (pts.Gear.position[2].getValue() > 0.5);
# toggle smoke to interpolate different densities # toggle smoke to interpolate different densities
if (RSmokeDelay>0.05) { if (RSmokeDelay > 0.05) {
me.RSmokeToggle = !me.RSmokeToggle; me.RSmokeToggle = !me.RSmokeToggle;
if (!me.RSmokeToggle) if (!me.RSmokeToggle)
RSmokeValue = 0; RSmokeValue = 0;
else else
RSmokeDelay = 0; RSmokeDelay = 0;
}; };
setprop("gear/gear[2]/Rbrake-smoke",RSmokeValue); me.gearSmoke[1].setValue(RSmokeValue);
settimer(func { BrakeSys.Rsmoke(); },RSmokeDelay); settimer(func { BrakeSys.Rsmoke(); },RSmokeDelay);
} else { } else {
# stop smoke processing # stop smoke processing
setprop("gear/gear[2]/Rbrake-smoke",0); me.gearSmoke[1].setValue(0);
me.RSmokeActive = 0; me.RSmokeActive = 0;
}; };
if (getprop("gear/gear[2]/Rbrake-thermal-energy") > 1.5) { if (me.thermalEnergy[1] > 1.5) {
setprop("/sim/animation/fire-services",1); me.fireServices.setValue(1);
} else { } else {
setprop("/sim/animation/fire-services",0); me.fireServices.setValue(0);
}; };
}, },
}; };
@ -437,13 +435,6 @@ controls.applyBrakes = func(v, which = 0) {
} }
} }
} }
setlistener("/sim/signals/fdm-initialized",
# executed on _every_ FDM reset (but not installing new listeners)
func(idle) { BrakeSys.reset(); },
0,0);
settimer(func() { BrakeSys.update(); }, 5);
# Autobrake loop # Autobrake loop
var absChk = maketimer(0.2, func { var absChk = maketimer(0.2, func {

View file

@ -17,38 +17,38 @@ var ELEC = {
_timer2On: 0, _timer2On: 0,
EmerElec: props.globals.getNode("/systems/electrical/some-electric-thingie/emer-elec-config"), EmerElec: props.globals.getNode("/systems/electrical/some-electric-thingie/emer-elec-config"),
Bus: { Bus: {
acEss: props.globals.getNode("systems/electrical/bus/ac-ess"), acEss: props.globals.getNode("/systems/electrical/bus/ac-ess"),
acEssShed: props.globals.getNode("systems/electrical/bus/ac-ess-shed"), acEssShed: props.globals.getNode("/systems/electrical/bus/ac-ess-shed"),
ac1: props.globals.getNode("systems/electrical/bus/ac-1"), ac1: props.globals.getNode("/systems/electrical/bus/ac-1"),
ac2: props.globals.getNode("systems/electrical/bus/ac-2"), ac2: props.globals.getNode("/systems/electrical/bus/ac-2"),
dcBat: props.globals.getNode("systems/electrical/bus/dc-bat"), dcBat: props.globals.getNode("/systems/electrical/bus/dc-bat"),
dcEss: props.globals.getNode("systems/electrical/bus/dc-ess"), dcEss: props.globals.getNode("/systems/electrical/bus/dc-ess"),
dcEssShed: props.globals.getNode("systems/electrical/bus/dc-ess-shed"), dcEssShed: props.globals.getNode("/systems/electrical/bus/dc-ess-shed"),
dc1: props.globals.getNode("systems/electrical/bus/dc-1"), dc1: props.globals.getNode("/systems/electrical/bus/dc-1"),
dc2: props.globals.getNode("systems/electrical/bus/dc-2"), dc2: props.globals.getNode("/systems/electrical/bus/dc-2"),
dcHot1: props.globals.getNode("systems/electrical/bus/dc-hot-1"), dcHot1: props.globals.getNode("/systems/electrical/bus/dc-hot-1"),
dcHot2: props.globals.getNode("systems/electrical/bus/dc-hot-2"), dcHot2: props.globals.getNode("/systems/electrical/bus/dc-hot-2"),
}, },
Fail: { Fail: {
acEssBusFault: props.globals.getNode("systems/failures/electrical/ac-ess-bus"), acEssBusFault: props.globals.getNode("/systems/failures/electrical/ac-ess-bus"),
ac1BusFault: props.globals.getNode("systems/failures/electrical/ac-1-bus"), ac1BusFault: props.globals.getNode("/systems/failures/electrical/ac-1-bus"),
ac2BusFault: props.globals.getNode("systems/failures/electrical/ac-2-bus"), ac2BusFault: props.globals.getNode("/systems/failures/electrical/ac-2-bus"),
bat1Fault: props.globals.getNode("systems/failures/electrical/bat-1"), bat1Fault: props.globals.getNode("/systems/failures/electrical/bat-1"),
bat2Fault: props.globals.getNode("systems/failures/electrical/bat-2"), bat2Fault: props.globals.getNode("/systems/failures/electrical/bat-2"),
dcBatBusFault: props.globals.getNode("systems/failures/electrical/dc-bat-bus"), dcBatBusFault: props.globals.getNode("/systems/failures/electrical/dc-bat-bus"),
dcEssBusFault: props.globals.getNode("systems/failures/electrical/dc-ess-bus"), dcEssBusFault: props.globals.getNode("/systems/failures/electrical/dc-ess-bus"),
dc1BusFault: props.globals.getNode("systems/failures/electrical/dc-1-bus"), dc1BusFault: props.globals.getNode("/systems/failures/electrical/dc-1-bus"),
dc2BusFault: props.globals.getNode("systems/failures/electrical/dc-2-bus"), dc2BusFault: props.globals.getNode("/systems/failures/electrical/dc-2-bus"),
emerGenFault: props.globals.getNode("systems/failures/electrical/emer-gen"), emerGenFault: props.globals.getNode("/systems/failures/electrical/emer-gen"),
essTrFault: props.globals.getNode("systems/failures/electrical/ess-tr"), essTrFault: props.globals.getNode("/systems/failures/electrical/ess-tr"),
gen1Fault: props.globals.getNode("systems/failures/electrical/gen-1"), gen1Fault: props.globals.getNode("/systems/failures/electrical/gen-1"),
gen2Fault: props.globals.getNode("systems/failures/electrical/gen-2"), gen2Fault: props.globals.getNode("/systems/failures/electrical/gen-2"),
genApuFault: props.globals.getNode("systems/failures/electrical/apu"), genApuFault: props.globals.getNode("/systems/failures/electrical/apu"),
idg1Fault: props.globals.getNode("systems/failures/electrical/idg-1"), # oil leak or low press idg1Fault: props.globals.getNode("/systems/failures/electrical/idg-1"), # oil leak or low press
idg2Fault: props.globals.getNode("systems/failures/electrical/idg-2"), idg2Fault: props.globals.getNode("/systems/failures/electrical/idg-2"),
statInvFault: props.globals.getNode("systems/failures/electrical/stat-inv"), statInvFault: props.globals.getNode("/systems/failures/electrical/stat-inv"),
tr1Fault: props.globals.getNode("systems/failures/electrical/tr-1"), tr1Fault: props.globals.getNode("/systems/failures/electrical/tr-1"),
tr2Fault: props.globals.getNode("systems/failures/electrical/tr-2"), tr2Fault: props.globals.getNode("/systems/failures/electrical/tr-2"),
}, },
Generic: { Generic: {
adf: props.globals.initNode("/systems/electrical/outputs/adf", 0, "DOUBLE"), adf: props.globals.initNode("/systems/electrical/outputs/adf", 0, "DOUBLE"),
@ -69,39 +69,86 @@ var ELEC = {
turnCoordinator: props.globals.initNode("/systems/electrical/outputs/turn-coordinator", 0, "DOUBLE"), turnCoordinator: props.globals.initNode("/systems/electrical/outputs/turn-coordinator", 0, "DOUBLE"),
}, },
Light: { Light: {
bat1Fault: props.globals.getNode("/systems/electrical/light/bat-1-fault"),
bat2Fault: props.globals.getNode("/systems/electrical/light/bat-2-fault"),
}, },
Misc: { Misc: {
}, },
Relay: { Relay: {
essTrContactor: props.globals.getNode("systems/electrical/relay/dc-ess-feed-tr/contact-pos"), acEssFeed1: props.globals.getNode("/systems/electrical/relay/ac-ess-feed-1/contact-pos"),
acEssFeed2: props.globals.getNode("/systems/electrical/relay/ac-ess-feed-2/contact-pos"),
acEssEmerGenFeed: props.globals.getNode("/systems/electrical/relay/ac-ess-feed-emer-gen/contact-pos"),
acTie1: props.globals.getNode("/systems/electrical/relay/ac-bus-ac-bus-tie-1/contact-pos"),
acTie2: props.globals.getNode("/systems/electrical/relay/ac-bus-ac-bus-tie-2/contact-pos"),
apuGlc: props.globals.getNode("/systems/electrical/relay/apu-glc/contact-pos"),
dcEssFeedBat: props.globals.getNode("/systems/electrical/relay/dc-ess-feed-bat/contact-pos"),
essTrContactor: props.globals.getNode("/systems/electrical/relay/dc-ess-feed-tr/contact-pos"),
extEpc: props.globals.getNode("/systems/electrical/relay/ext-epc/contact-pos"),
dcTie1: props.globals.getNode("/systems/electrical/relay/dc-bus-tie-dc-1/contact-pos"),
dcTie2: props.globals.getNode("/systems/electrical/relay/dc-bus-tie-dc-2/contact-pos"),
glc1: props.globals.getNode("/systems/electrical/relay/gen-1-glc/contact-pos"),
glc2: props.globals.getNode("/systems/electrical/relay/gen-2-glc/contact-pos"),
tr1Contactor: props.globals.getNode("/systems/electrical/relay/tr-contactor-1/contact-pos"),
tr2Contactor: props.globals.getNode("/systems/electrical/relay/tr-contactor-2/contact-pos"),
}, },
SomeThing: { SomeThing: {
emerGenSignal: props.globals.getNode("systems/electrical/some-electric-thingie/emer-gen-operate"), emerGenSignal: props.globals.getNode("/systems/electrical/some-electric-thingie/emer-gen-operate"),
galley: props.globals.getNode("/systems/electrical/some-electric-thingie/galley-shed"),
}, },
Source: { Source: {
APU: {
volts: props.globals.getNode("/systems/electrical/sources/apu/output-volt"),
hertz: props.globals.getNode("/systems/electrical/sources/apu/output-hertz"),
contact: props.globals.getNode("/systems/electrical/relay/apu-glc/contact-pos"),
},
Bat1: { Bat1: {
volt: props.globals.getNode("systems/electrical/sources/bat-1/volt"), volt: props.globals.getNode("/systems/electrical/sources/bat-1/volt"),
amps: props.globals.getNode("systems/electrical/sources/bat-1/amps"), amps: props.globals.getNode("/systems/electrical/sources/bat-1/amps"),
contact: props.globals.getNode("systems/electrical/sources/bat-1/contact"), contact: props.globals.getNode("/systems/electrical/sources/bat-1/contact"),
percent: props.globals.getNode("systems/electrical/sources/bat-1/percent"), percent: props.globals.getNode("/systems/electrical/sources/bat-1/percent"),
time: props.globals.getNode("systems/electrical/sources/bat-1/time"), direction: props.globals.getNode("/systems/electrical/sources/bat-1/direction"),
time: props.globals.getNode("/systems/electrical/sources/bat-1/time"),
}, },
Bat2: { Bat2: {
volt: props.globals.getNode("systems/electrical/sources/bat-2/volt"), volt: props.globals.getNode("/systems/electrical/sources/bat-2/volt"),
amps: props.globals.getNode("systems/electrical/sources/bat-2/amps"), amps: props.globals.getNode("/systems/electrical/sources/bat-2/amps"),
contact: props.globals.getNode("systems/electrical/sources/bat-2/contact"), contact: props.globals.getNode("/systems/electrical/sources/bat-2/contact"),
percent: props.globals.getNode("systems/electrical/sources/bat-2/percent"), percent: props.globals.getNode("/systems/electrical/sources/bat-2/percent"),
time: props.globals.getNode("systems/electrical/sources/bat-2/time"), direction: props.globals.getNode("/systems/electrical/sources/bat-2/direction"),
time: props.globals.getNode("/systems/electrical/sources/bat-2/time"),
},
EmerGen: {
volts: props.globals.getNode("/systems/electrical/sources/emer-gen/output-volt"),
hertz: props.globals.getNode("/systems/electrical/sources/emer-gen/output-hertz"),
},
Ext: {
volts: props.globals.getNode("/systems/electrical/sources/ext/output-volt"),
voltsRelay: props.globals.getNode("/systems/electrical/relay/emer-glc/output"),
hertz: props.globals.getNode("/systems/electrical/sources/ext/output-hertz"),
},
tr1: {
outputVolt: props.globals.getNode("/systems/electrical/relay/tr-contactor-1/output"),
outputAmp: props.globals.getNode("/systems/electrical/relay/tr-contactor-1/output-amp"),
},
tr2: {
outputVolt: props.globals.getNode("/systems/electrical/relay/tr-contactor-2/output"),
outputAmp: props.globals.getNode("/systems/electrical/relay/tr-contactor-2/output-amp"),
}, },
trEss: { trEss: {
outputVolt: props.globals.getNode("systems/electrical/sources/tr-ess/output-volt"), outputVolt: props.globals.getNode("/systems/electrical/sources/tr-ess/output-volt"),
outputAmp: props.globals.getNode("systems/electrical/sources/tr-ess/output-amp"), outputAmp: props.globals.getNode("/systems/electrical/sources/tr-ess/output-amp"),
outputVoltRelay: props.globals.getNode("/systems/electrical/relay/dc-ess-feed-tr/output"),
outputAmpRelay: props.globals.getNode("/systems/electrical/relay/dc-ess-feed-tr/output-amp"),
}, },
IDG1: { IDG1: {
gcrRelay: props.globals.getNode("systems/electrical/sources/idg-1/gcr-relay"), gcrRelay: props.globals.getNode("/systems/electrical/sources/idg-1/gcr-relay"),
hertz: props.globals.getNode("/systems/electrical/sources/idg-1/output-hertz"),
volts: props.globals.getNode("/systems/electrical/sources/idg-1/output-volt"),
}, },
IDG2: { IDG2: {
gcrRelay: props.globals.getNode("systems/electrical/sources/idg-1/gcr-relay"), gcrRelay: props.globals.getNode("/systems/electrical/sources/idg-2/gcr-relay"),
hertz: props.globals.getNode("/systems/electrical/sources/idg-2/output-hertz"),
volts: props.globals.getNode("/systems/electrical/sources/idg-2/output-volt"),
}, },
}, },
Switch: { Switch: {

Binary file not shown.