From 2385e2500866e9838e14cb3f75703eaa24989817 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sat, 24 Jul 2021 12:29:58 +0100 Subject: [PATCH] Start elec --- .../Instruments/Lower-ECAM/Lower-ECAM-APU.nas | 6 +- .../Lower-ECAM/Lower-ECAM-elec.nas | 396 +++++++++++++++++- .../Instruments/Lower-ECAM/Lower-ECAM-old.nas | 368 +--------------- Nasal/Libraries/libraries.nas | 2 + 4 files changed, 403 insertions(+), 369 deletions(-) diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-APU.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-APU.nas index 55015168..83d47a84 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-APU.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-APU.nas @@ -130,7 +130,11 @@ var canvas_lowerECAMPageApu = } }), props.UpdateManager.FromHashValue("apuHertz", 1, func(val) { - obj["APUGenHz"].setText(sprintf("%s", math.round(val))); + if (val == 0) { + obj["APUGenHz"].setText(sprintf("XX")); + } else { + obj["APUGenHz"].setText(sprintf("%s", math.round(val))); + } if (val >= 390 and val <= 410) { obj["APUGenHz"].setColor(0.0509,0.7529,0.2941); diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-elec.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-elec.nas index f42be362..dc550a7b 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-elec.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-elec.nas @@ -29,8 +29,377 @@ var canvas_lowerECAMPageElec = obj["IDG1-RISE-label"].hide(); obj["IDG1-RISE-Value"].hide(); - obj.update_items = [ + props.UpdateManager.FromHashValue("apuLoad", 0.1, func(val) { + obj["APUGenLoad"].setText(sprintf("%s", math.round(val))); + + if (val < 110) { + obj["APUGenHz"].setColor(0.0509,0.7529,0.2941); + } else { + obj["APUGenHz"].setColor(0.7333,0.3803,0); + } + }), + props.UpdateManager.FromHashValue("apuHertz", 0.5, func(val) { + if (val == 0) { + obj["APUGenHz"].setText(sprintf("XX")); + } else { + obj["APUGenHz"].setText(sprintf("%s", math.round(val))); + } + + if (val >= 390 and val <= 410) { + obj["APUGenHz"].setColor(0.0509,0.7529,0.2941); + } else { + obj["APUGenHz"].setColor(0.7333,0.3803,0); + } + }), + props.UpdateManager.FromHashValue("apuVolt", 0.1, func(val) { + obj["APUGenVolt"].setText(sprintf("%s", math.round(val))); + + if (val >= 110 and val <= 120) { + obj["APUGenVolt"].setColor(0.0509,0.7529,0.2941); + } else { + obj["APUGenVolt"].setColor(0.7333,0.3803,0); + } + }), + props.UpdateManager.FromHashList(["apuMaster","apuVolt","apuLoad","apuHertz","apuGLC"], nil, func(val) { + if (val.apuMaster == 0) { + obj["APUGentext"].setColor(0.8078,0.8039,0.8078); + } else { + if (val.apuGLC == 0) { + obj["APUGentext"].setColor(0.7333,0.3803,0); + } else if (val.apuVolt > 120 or val.apuVolt < 110 or val.apuHertz > 410 or val.apuHertz < 390 or val.apuLoad >= 100) { + obj["APUGentext"].setColor(0.7333,0.3803,0); + } else { + obj["APUGentext"].setColor(0.8078,0.8039,0.8078); + } + } + }), + props.UpdateManager.FromHashList(["apuMaster","apuGLC"], nil, func(val) { + if (val.apuMaster == 0) { + obj["APU-content"].hide(); + obj["APUGEN-off"].hide(); + obj["APU-border"].hide(); + } else { + obj["APU-border"].show(); + if (val.apuGLC == 0) { + obj["APU-content"].hide(); + obj["APUGEN-off"].show(); + } else { + obj["APU-content"].show(); + obj["APUGEN-off"].hide(); + } + } + }), + props.UpdateManager.FromHashValue("elecIDG1Disc", nil, func(val) { + if (!val) { + obj["IDG1-DISC"].show(); + obj["ELEC-IDG-1-label"].setColor(0.7333,0.3803,0); + } else { + obj["IDG1-DISC"].hide(); + obj["ELEC-IDG-1-label"].setColor(0.8078,0.8039,0.8078); + } + }), + props.UpdateManager.FromHashValue("elecIDG2Disc", nil, func(val) { + if (!val) { + obj["IDG2-DISC"].show(); + obj["ELEC-IDG-2-label"].setColor(0.7333,0.3803,0); + } else { + obj["IDG2-DISC"].hide(); + obj["ELEC-IDG-2-label"].setColor(0.8078,0.8039,0.8078); + } + }), + props.UpdateManager.FromHashValue("engine1Running", nil, func(val) { + if (val == 0) { + obj["ELEC-IDG-1-num-label"].setColor(0.7333,0.3803,0); + } else { + obj["ELEC-IDG-1-num-label"].setColor(0.8078,0.8039,0.8078); + } + }), + props.UpdateManager.FromHashValue("engine2Running", nil, func(val) { + if (val == 0) { + obj["ELEC-IDG-2-num-label"].setColor(0.7333,0.3803,0); + } else { + obj["ELEC-IDG-2-num-label"].setColor(0.8078,0.8039,0.8078); + } + }), + props.UpdateManager.FromHashValue("dc1", 0.5, func(val) { + if (val > 25) { + obj["ELEC-DC1-label"].setColor(0.0509,0.7529,0.2941); + } else { + obj["ELEC-DC1-label"].setColor(0.7333,0.3803,0); + } + }), + props.UpdateManager.FromHashValue("dc2", 0.5, func(val) { + if (val > 25) { + obj["ELEC-DC2-label"].setColor(0.0509,0.7529,0.2941); + } else { + obj["ELEC-DC2-label"].setColor(0.7333,0.3803,0); + } + }), + props.UpdateManager.FromHashValue("dcEss", 0.5, func(val) { + if (val > 25) { + obj["ELEC-DCESS-label"].setColor(0.0509,0.7529,0.2941); + } else { + obj["ELEC-DCESS-label"].setColor(0.7333,0.3803,0); + } + }), + props.UpdateManager.FromHashValue("ac1", 0.5, func(val) { + if (val >= 110) { + obj["ELEC-AC1-label"].setColor(0.0509,0.7529,0.2941); + obj["AC1-in"].show(); + } else { + obj["ELEC-AC1-label"].setColor(0.7333,0.3803,0); + obj["AC1-in"].hide(); + } + }), + props.UpdateManager.FromHashValue("ac2", 0.5, func(val) { + if (val >= 110) { + obj["ELEC-AC2-label"].setColor(0.0509,0.7529,0.2941); + obj["AC2-in"].show(); + } else { + obj["ELEC-AC2-label"].setColor(0.7333,0.3803,0); + obj["AC2-in"].hide(); + } + }), + props.UpdateManager.FromHashValue("acEss", 0.5, func(val) { + if (val >= 110) { + obj["ELEC-ACESS-label"].setColor(0.0509,0.7529,0.2941); + } else { + obj["ELEC-ACESS-label"].setColor(0.7333,0.3803,0); + } + }), + props.UpdateManager.FromHashValue("acEssShed", 0.5, func(val) { + if (val >= 110) { + obj["ACESS-SHED"].hide(); + } else { + obj["ACESS-SHED"].show(); + } + }), + props.UpdateManager.FromHashValue("ElecGalleyShed", nil, func(val) { + if (val) { + obj["GalleyShed"].show(); + } else { + obj["GalleyShed"].hide(); + } + }), + props.UpdateManager.FromHashList(["elecBat1Switch","elecBat2Switch","dcBat"], nil, func(val) { + if (val.elecBat1Switch or val.elecBat2Switch) { + obj["ELEC-DCBAT-label"].setText("DC BAT"); + if (val.dcBat > 25) { + obj["ELEC-DCBAT-label"].setColor(0.0509,0.7529,0.2941); + } else { + obj["ELEC-DCBAT-label"].setColor(0.7333,0.3803,0); + } + } else { + obj["ELEC-DCBAT-label"].setText("XX"); # BCL not powered hence no voltage info supplied from BCL + obj["ELEC-DCBAT-label"].setColor(0.7333,0.3803,0); + } + }), + props.UpdateManager.FromHashList(["elecBat1Switch","elecBat1Volt","elecBat1Amp","elecBat1Direction","elecBat1Fault"], nil, func(val) { + if (val.elecBat1Switch == 0) { + obj["BAT1-OFF"].show(); + obj["BAT1-content"].hide(); + obj["BAT1-discharge"].hide(); + obj["BAT1-charge"].hide(); + } else { + obj["BAT1-OFF"].hide(); + obj["BAT1-content"].show(); + obj["Bat1Ampere"].setText(sprintf("%s", val.elecBat1Amp)); + obj["Bat1Volt"].setText(sprintf("%s", val.elecBat1Volt)); + + if (val.elecBat1Volt >= 24.95 and val.elecBat1Volt <= 31.05) { + obj["Bat1Volt"].setColor(0.0509,0.7529,0.2941); + } else { + obj["Bat1Volt"].setColor(0.7333,0.3803,0); + } + + if (val.elecBat1Amp > 5) { + obj["Bat1Ampere"].setColor(0.7333,0.3803,0); + } else { + obj["Bat1Ampere"].setColor(0.0509,0.7529,0.2941); + } + + if (val.elecBat1Direction == 0) { + obj["BAT1-discharge"].hide(); + obj["BAT1-charge"].hide(); + } else { + if (val.elecBat1Direction == -1) { + obj["BAT1-charge"].show(); + obj["BAT1-discharge"].hide(); + } else { + obj["BAT1-discharge"].show(); + obj["BAT1-charge"].hide(); + } + } + } + + if (val.elecBat1Fault or val.elecBat1Volt < 25 or val.elecBat1Volt > 31 or val.elecBat1Amp > 5) { + obj["BAT1-label"].setColor(0.7333,0.3803,0); + } else { + obj["BAT1-label"].setColor(0.8078,0.8039,0.8078); + } + }), + props.UpdateManager.FromHashList(["elecBat2Switch","elecBat2Volt","elecBat2Amp","elecBat2Direction","elecBat2Fault"], nil, func(val) { + if (val.elecBat2Switch == 0) { + obj["BAT2-OFF"].show(); + obj["BAT2-content"].hide(); + obj["BAT2-discharge"].hide(); + obj["BAT2-charge"].hide(); + } else { + obj["BAT2-OFF"].hide(); + obj["BAT2-content"].show(); + obj["Bat2Ampere"].setText(sprintf("%s", val.elecBat2Amp)); + obj["Bat2Volt"].setText(sprintf("%s", val.elecBat2Volt)); + + if (val.elecBat2Volt >= 24.95 and val.elecBat2Volt <= 31.05) { + obj["Bat2Volt"].setColor(0.0509,0.7529,0.2941); + } else { + obj["Bat2Volt"].setColor(0.7333,0.3803,0); + } + + if (val.elecBat2Amp > 5) { + obj["Bat2Ampere"].setColor(0.7333,0.3803,0); + } else { + obj["Bat2Ampere"].setColor(0.0509,0.7529,0.2941); + } + + if (val.elecBat2Direction == 0) { + obj["BAT2-discharge"].hide(); + obj["BAT2-charge"].hide(); + } else { + if (val.elecBat2Direction == -1) { + obj["BAT2-charge"].show(); + obj["BAT2-discharge"].hide(); + } else { + obj["BAT2-discharge"].show(); + obj["BAT2-charge"].hide(); + } + } + } + + if (val.elecBat2Fault or val.elecBat2Volt < 25 or val.elecBat2Volt > 31 or val.elecBat2Amp > 5) { + obj["BAT2-label"].setColor(0.7333,0.3803,0); + } else { + obj["BAT2-label"].setColor(0.8078,0.8039,0.8078); + } + }), + props.UpdateManager.FromHashList(["elecTR1Amp","elecTR1Volt"], nil, func(val) { + obj["TR1Volt"].setText(sprintf("%s", math.round(val.elecTR1Volt))); + obj["TR1Ampere"].setText(sprintf("%s", math.round(val.elecTR1Amp))); + + if (val.elecTR1Volt < 25 or val.elecTR1Volt > 31 or val.elecTR1Amp < 5) { + obj["TR1-label"].setColor(0.7333,0.3803,0); + } else { + obj["TR1-label"].setColor(0.8078,0.8039,0.8078); + } + + if (val.elecTR1Volt < 25 or val.elecTR1Volt > 31) { + obj["TR1Volt"].setColor(0.7333,0.3803,0); + } else { + obj["TR1Volt"].setColor(0.0509,0.7529,0.2941); + } + + if (val.elecTR1Amp < 5) { + obj["TR1Ampere"].setColor(0.7333,0.3803,0); + } else { + obj["TR1Ampere"].setColor(0.0509,0.7529,0.2941); + } + }), + props.UpdateManager.FromHashList(["elecTR2Amp","elecTR2Volt"], nil, func(val) { + obj["TR2Volt"].setText(sprintf("%s", math.round(val.elecTR2Volt))); + obj["TR2Ampere"].setText(sprintf("%s", math.round(val.elecTR2Amp))); + + if (val.elecTR2Volt < 25 or val.elecTR2Volt > 31 or val.elecTR2Amp < 5) { + obj["TR2-label"].setColor(0.7333,0.3803,0); + } else { + obj["TR2-label"].setColor(0.8078,0.8039,0.8078); + } + + if (val.elecTR2Volt < 25 or val.elecTR2Volt > 31) { + obj["TR2Volt"].setColor(0.7333,0.3803,0); + } else { + obj["TR2Volt"].setColor(0.0509,0.7529,0.2941); + } + + if (val.elecTR2Amp < 5) { + obj["TR2Ampere"].setColor(0.7333,0.3803,0); + } else { + obj["TR2Ampere"].setColor(0.0509,0.7529,0.2941); + } + }), + props.UpdateManager.FromHashList(["elecExtHertz","elecExtVolt","elecGroundCart"], nil, func(val) { + if (val.elecGroundCart == 0) { + obj["EXTPWR-group"].hide(); + } else { + obj["EXTPWR-group"].show(); + obj["ExtVolt"].setText(sprintf("%s", math.round(val.elecExtVolt))); + obj["ExtHz"].setText(sprintf("%s", math.round(val.elecExtHertz))); + + if (val.elecExtHertz > 410 or val.elecExtHertz < 390 or val.elecExtVolt > 120 or val.elecExtVolt < 110) { + obj["EXTPWR-label"].setColor(0.7333,0.3803,0); + } else { + obj["EXTPWR-label"].setColor(0.0509,0.7529,0.2941); + } + + if (val.elecExtHertz > 410 or val.elecExtHertz < 390) { + obj["ExtHz"].setColor(0.7333,0.3803,0); + } else { + obj["ExtHz"].setColor(0.0509,0.7529,0.2941); + } + + if (val.elecExtVolt > 120 or val.elecExtVolt < 110) { + obj["ExtVolt"].setColor(0.7333,0.3803,0); + } else { + obj["ExtVolt"].setColor(0.0509,0.7529,0.2941); + } + } + }), + props.UpdateManager.FromHashValue("elecDCTie1", nil, func(val) { + if (val) { + obj["ELEC-Line-DC1-DCESS_DCBAT"].show(); + } else { + obj["ELEC-Line-DC1-DCESS_DCBAT"].hide(); + } + }), + props.UpdateManager.FromHashValue("elecDCTie2", nil, func(val) { + if (val) { + obj["ELEC-Line-DC2-DCESS_DCBAT"].show(); + obj["ELEC-Line-DC2-DCBAT"].show(); + } else { + obj["ELEC-Line-DC2-DCESS_DCBAT"].hide(); + obj["ELEC-Line-DC2-DCBAT"].show(); + } + }), + props.UpdateManager.FromHashList(["elecDcEssFeedBat","elecDCTie1"], nil, func(val) { + if (val.elecDcEssFeedBat or val.elecDCTie1) { + obj["ELEC-Line-DC1-DCBAT"].show(); + } else { + obj["ELEC-Line-DC1-DCBAT"].hide(); + } + }), + props.UpdateManager.FromHashValue("elecDcEssFeedBat", nil, func(val) { + if (val) { + obj["ELEC-Line-DC1-DCESS"].show(); + } else { + obj["ELEC-Line-DC1-DCESS"].hide(); + } + }), + props.UpdateManager.FromHashValue("elecDcEssFeedTr", nil, func(val) { + if (val) { + obj["ELEC-Line-ESSTR-DCESS"].show(); + } else { + obj["ELEC-Line-ESSTR-DCESS"].hide(); + } + }), + props.UpdateManager.FromHashValue("elecAcEssEmerGenFeed", nil, func(val) { + if (val) { + obj["EMERGEN-out"].show(); + obj["ELEC-Line-Emergen-ESSTR"].show(); + } else { + obj["EMERGEN-out"].hide(); + obj["ELEC-Line-Emergen-ESSTR"].hide(); + } + }), ]; obj.displayedGForce = 0; @@ -152,6 +521,31 @@ var canvas_lowerECAMPageElec = }; var input = { + elecBat1Amp: "/systems/electrical/sources/bat-1/amps", + elecBat2Amp: "/systems/electrical/sources/bat-2/amps", + elecBat1Direction: "/systems/electrical/sources/bat-1/direction", + elecBat2Direction: "/systems/electrical/sources/bat-2/direction", + elecBat1Fault: "/systems/electrical/light/bat-1-fault", + elecBat2Fault: "/systems/electrical/light/bat-2-fault", + elecBat1Volt: "/systems/electrical/sources/bat-1/volt", + elecBat2Volt: "/systems/electrical/sources/bat-2/volt", + elecBat1Switch: "/controls/electrical/switches/bat-1", + elecBat2Switch: "/controls/electrical/switches/bat-2", + elecTR1Amp: "/systems/electrical/relay/tr-contactor-1/output-amp", + elecTR2Amp: "/systems/electrical/relay/tr-contactor-2/output-amp", + elecTR1Volt: "/systems/electrical/relay/tr-contactor-1/output", + elecTR2Volt: "/systems/electrical/relay/tr-contactor-2/output", + elecIDG1Disc: "/controls/electrical/switches/idg-1-disc", + elecIDG2Disc: "/controls/electrical/switches/idg-2-disc", + elecGroundCart: "/controls/electrical/ground-cart", + elecExtHertz: "/systems/electrical/sources/ext/output-hertz", + elecExtVolt: "/systems/electrical/sources/ext/output-volt", + elecDCTie1: "/systems/electrical/relay/dc-bus-tie-dc-1/contact-pos", + elecDCTie2: "/systems/electrical/relay/dc-bus-tie-dc-2/contact-pos", + elecDcEssFeedBat: "/systems/electrical/relay/dc-ess-feed-bat/contact-pos", + elecDcEssFeedTr: "/systems/electrical/relay/dc-ess-feed-tr/contact-pos", + elecAcEssEmerGenFeed: "/systems/electrical/relay/ac-ess-feed-emer-gen/contact-pos", + ElecGalleyShed: "/systems/electrical/some-electric-thingie/galley-shed", }; foreach (var name; keys(input)) { diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-old.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-old.nas index 32c5b1c6..beb1adfb 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-old.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-old.nas @@ -117,8 +117,6 @@ var L2BrakeTempc = props.globals.getNode("/gear/gear[1]/L2brake-temp-degc", 1); var R3BrakeTempc = props.globals.getNode("/gear/gear[2]/R3brake-temp-degc", 1); var R4BrakeTempc = props.globals.getNode("/gear/gear[2]/R4brake-temp-degc", 1); -var eng1_running = props.globals.getNode("/engines/engine[0]/running", 1); -var eng2_running = props.globals.getNode("/engines/engine[1]/running", 1); var switch_cart = props.globals.getNode("/controls/electrical/ground-cart", 1); var fuel_flow1 = props.globals.getNode("/engines/engine[0]/fuel-flow_actual", 1); var fuel_flow2 = props.globals.getNode("/engines/engine[1]/fuel-flow_actual", 1); @@ -137,147 +135,6 @@ var cabinalt = props.globals.getNode("", 1); var gear0_wow = props.globals.getNode("/gear/gear[0]/wow", 1); - - # BAT1 - if (systems.ELEC.Switch.bat1.getValue() == 0) { - me["BAT1-OFF"].show(); - me["BAT1-content"].hide(); - me["BAT1-discharge"].hide(); - me["BAT1-charge"].hide(); - } else { - me["BAT1-OFF"].hide(); - me["BAT1-content"].show(); - me["Bat1Ampere"].setText(sprintf("%s", math.round(systems.ELEC.Source.Bat1.amps.getValue()))); - me["Bat1Volt"].setText(sprintf("%s", math.round(systems.ELEC.Source.Bat1.volt.getValue()))); - - 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); - } else { - me["Bat1Volt"].setColor(0.7333,0.3803,0); - } - - if (systems.ELEC.Source.Bat1.amps.getValue() > 5) { - me["Bat1Ampere"].setColor(0.7333,0.3803,0); - } else { - me["Bat1Ampere"].setColor(0.0509,0.7529,0.2941); - } - - if (systems.ELEC.Source.Bat1.direction.getValue() == 0) { - me["BAT1-discharge"].hide(); - me["BAT1-charge"].hide(); - } else { - if (systems.ELEC.Source.Bat1.direction.getValue() == -1) { - me["BAT1-charge"].show(); - me["BAT1-discharge"].hide(); - } else { - me["BAT1-discharge"].show(); - me["BAT1-charge"].hide(); - } - } - } - - 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); - } else { - me["BAT1-label"].setColor(0.8078,0.8039,0.8078); - } - - # BAT2 - if (systems.ELEC.Switch.bat2.getValue() == 0) { - me["BAT2-OFF"].show(); - me["BAT2-content"].hide(); - me["BAT2-discharge"].hide(); - me["BAT2-charge"].hide(); - } else { - me["BAT2-OFF"].hide(); - me["BAT2-content"].show(); - me["Bat2Ampere"].setText(sprintf("%s", math.round(systems.ELEC.Source.Bat2.amps.getValue()))); - me["Bat2Volt"].setText(sprintf("%s", math.round(systems.ELEC.Source.Bat2.volt.getValue()))); - - 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); - } else { - me["Bat2Volt"].setColor(0.7333,0.3803,0); - } - - if (systems.ELEC.Source.Bat2.amps.getValue() > 5) { - me["Bat2Ampere"].setColor(0.7333,0.3803,0); - } else { - me["Bat2Ampere"].setColor(0.0509,0.7529,0.2941); - } - - if (systems.ELEC.Source.Bat2.direction.getValue() == 0) { - me["BAT2-discharge"].hide(); - me["BAT2-charge"].hide(); - } else { - if (systems.ELEC.Source.Bat2.direction.getValue() == -1) { - me["BAT2-charge"].show(); - me["BAT2-discharge"].hide(); - } else { - me["BAT2-discharge"].show(); - me["BAT2-charge"].hide(); - } - } - } - - 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); - } else { - me["BAT2-label"].setColor(0.8078,0.8039,0.8078); - } - - # TR1 - # is only powered when ac1 has power - tr1_v = systems.ELEC.Source.tr1.outputVolt.getValue(); - tr1_a = systems.ELEC.Source.tr1.outputAmp.getValue(); - - me["TR1Volt"].setText(sprintf("%s", math.round(tr1_v))); - me["TR1Ampere"].setText(sprintf("%s", math.round(tr1_a))); - - if (tr1_v < 25 or tr1_v > 31 or tr1_a < 5) { - me["TR1-label"].setColor(0.7333,0.3803,0); - } else { - me["TR1-label"].setColor(0.8078,0.8039,0.8078); - } - - if (tr1_v < 25 or tr1_v > 31) { - me["TR1Volt"].setColor(0.7333,0.3803,0); - } else { - me["TR1Volt"].setColor(0.0509,0.7529,0.2941); - } - - if (tr1_a < 5) { - me["TR1Ampere"].setColor(0.7333,0.3803,0); - } else { - me["TR1Ampere"].setColor(0.0509,0.7529,0.2941); - } - - # TR2 - # is only powered when ac2 has power - tr2_v = systems.ELEC.Source.tr2.outputVolt.getValue(); - tr2_a = systems.ELEC.Source.tr2.outputAmp.getValue(); - - me["TR2Volt"].setText(sprintf("%s", math.round(tr2_v))); - me["TR2Ampere"].setText(sprintf("%s", math.round(tr2_a))); - - if (tr2_v < 25 or tr2_v > 31 or tr2_a < 5) { - me["TR2-label"].setColor(0.7333,0.3803,0); - } else { - me["TR2-label"].setColor(0.8078,0.8039,0.8078); - } - - if (tr2_v < 25 or tr2_v > 31) { - me["TR2Volt"].setColor(0.7333,0.3803,0); - } else { - me["TR2Volt"].setColor(0.0509,0.7529,0.2941); - } - - if (tr2_a < 5) { - me["TR2Ampere"].setColor(0.7333,0.3803,0); - } else { - me["TR2Ampere"].setColor(0.0509,0.7529,0.2941); - } - # ESS TR essTrvolts = systems.ELEC.Source.trEss.outputVoltRelay.getValue(); essTramps = systems.ELEC.Source.trEss.outputAmpRelay.getValue(); @@ -341,35 +198,7 @@ var gear0_wow = props.globals.getNode("/gear/gear[0]/wow", 1); } } - # IDG 1 - if (!systems.ELEC.Switch.idg1Disc.getBoolValue()) { - me["IDG1-DISC"].show(); - me["ELEC-IDG-1-label"].setColor(0.7333,0.3803,0); - } else { - me["IDG1-DISC"].hide(); - me["ELEC-IDG-1-label"].setColor(0.8078,0.8039,0.8078); - } - - if (eng1_running.getValue() == 0) { - me["ELEC-IDG-1-num-label"].setColor(0.7333,0.3803,0); - } else { - me["ELEC-IDG-1-num-label"].setColor(0.8078,0.8039,0.8078); - } - if (eng2_running.getValue() == 0) { - me["ELEC-IDG-2-num-label"].setColor(0.7333,0.3803,0); - } else { - me["ELEC-IDG-2-num-label"].setColor(0.8078,0.8039,0.8078); - } - - # IDG 2 - if (!systems.ELEC.Switch.idg2Disc.getBoolValue()) { - me["IDG2-DISC"].show(); - me["ELEC-IDG-2-label"].setColor(0.7333,0.3803,0); - } else { - me["IDG2-DISC"].hide(); - me["ELEC-IDG-2-label"].setColor(0.8078,0.8039,0.8078); - } # GEN1 if (systems.ELEC.Switch.gen1.getValue() == 0) { @@ -487,144 +316,6 @@ var gear0_wow = props.globals.getNode("/gear/gear[0]/wow", 1); } } - # APU - if (systems.APUNodes.Controls.master.getValue() == 0) { - me["APU-content"].hide(); - me["APUGEN-off"].hide(); - me["APU-border"].hide(); - me["APUGentext"].setColor(0.8078,0.8039,0.8078); - } else { - me["APU-border"].show(); - if (systems.ELEC.Source.APU.contact.getValue() == 0) { - me["APU-content"].hide(); - me["APUGEN-off"].show(); - me["APUGentext"].setColor(0.7333,0.3803,0); - } else { - me["APU-content"].show(); - me["APUGEN-off"].hide(); - # me["APUGenLoad"].setText(sprintf("%s", math.round(apu_load.getValue()))); - me["APUGenVolt"].setText(sprintf("%s", math.round(systems.ELEC.Source.APU.volts.getValue()))); - - if (systems.ELEC.Source.APU.hertz.getValue() == 0) { - me["APUGenHz"].setText(sprintf("XX")); - } else { - me["APUGenHz"].setText(sprintf("%s", math.round(systems.ELEC.Source.APU.hertz.getValue()))); - } - - 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); - } else { - me["APUGentext"].setColor(0.8078,0.8039,0.8078); - } - - if(apu_load.getValue() >= 110) { - me["APUGenLoad"].setColor(0.7333,0.3803,0); - } else { - me["APUGenLoad"].setColor(0.0509,0.7529,0.2941); - } - - if (systems.ELEC.Source.APU.volts.getValue() > 120 or systems.ELEC.Source.APU.volts.getValue() < 110) { - me["APUGenVolt"].setColor(0.7333,0.3803,0); - } else { - me["APUGenVolt"].setColor(0.0509,0.7529,0.2941); - } - - if (systems.ELEC.Source.APU.hertz.getValue() > 410 or systems.ELEC.Source.APU.hertz.getValue() < 390) { - me["APUGenHz"].setColor(0.7333,0.3803,0); - } else { - me["APUGenHz"].setColor(0.0509,0.7529,0.2941); - } - } - } - - # EXT PWR - - if (switch_cart.getValue() == 0) { - me["EXTPWR-group"].hide(); - } else { - me["EXTPWR-group"].show(); - me["ExtVolt"].setText(sprintf("%s", math.round(systems.ELEC.Source.Ext.volts.getValue()))); - me["ExtHz"].setText(sprintf("%s", math.round(systems.ELEC.Source.Ext.hertz.getValue()))); - - 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); - } else { - me["EXTPWR-label"].setColor(0.0509,0.7529,0.2941); - } - - if (systems.ELEC.Source.Ext.hertz.getValue() > 410 or systems.ELEC.Source.Ext.hertz.getValue() < 390) { - me["ExtHz"].setColor(0.7333,0.3803,0); - } else { - me["ExtHz"].setColor(0.0509,0.7529,0.2941); - } - - if (systems.ELEC.Source.Ext.volts.getValue() > 120 or systems.ELEC.Source.Ext.volts.getValue() < 110) { - me["ExtVolt"].setColor(0.7333,0.3803,0); - } else { - me["ExtVolt"].setColor(0.0509,0.7529,0.2941); - } - } - - if (systems.ELEC.SomeThing.galley.getValue()) { - me["GalleyShed"].show(); - } else { - me["GalleyShed"].hide(); - } - - # Bus indicators - if (systems.ELEC.Switch.bat1.getValue() or systems.ELEC.Switch.bat2.getValue()) { - me["ELEC-DCBAT-label"].setText("DC BAT"); - 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); - } - } else { - me["ELEC-DCBAT-label"].setText("XX"); # BCL not powered hence no voltage info supplied from BCL - me["ELEC-DCBAT-label"].setColor(0.7333,0.3803,0); - } - - 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 (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 (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 (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); - } - - if (systems.ELEC.Bus.acEssShed.getValue() >= 110) { - me["ACESS-SHED"].hide(); - } else { - me["ACESS-SHED"].show(); - } - - 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 (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); - } # Managment of the connecting lines between the components @@ -652,18 +343,6 @@ var gear0_wow = props.globals.getNode("/gear/gear[0]/wow", 1); me["ELEC-Line-GEN2-AC2"].hide(); } - if (systems.ELEC.Bus.ac1.getValue() >= 110) { - me["AC1-in"].show(); - } else { - me["AC1-in"].hide(); - } - - if (systems.ELEC.Bus.ac2.getValue() >= 110) { - me["AC2-in"].show(); - } else { - me["AC2-in"].hide(); - } - if (systems.ELEC.Relay.acTie1.getValue() and systems.ELEC.Relay.acTie2.getValue()) { me["ELEC-Line-APU-AC1"].show(); me["ELEC-Line-APU-EXT"].show(); @@ -733,53 +412,8 @@ var gear0_wow = props.globals.getNode("/gear/gear[0]/wow", 1); me["ELEC-Line-TR2-DC2"].hide(); } - if (systems.ELEC.Relay.dcTie1.getValue()) { - me["ELEC-Line-DC1-DCESS_DCBAT"].show(); - } else { - me["ELEC-Line-DC1-DCESS_DCBAT"].hide(); - } - - if (systems.ELEC.Relay.dcEssFeedBat.getValue()) { - me["ELEC-Line-DC1-DCESS"].show(); - } else { - me["ELEC-Line-DC1-DCESS"].hide(); - } - - if (systems.ELEC.Relay.dcEssFeedBat.getValue() or systems.ELEC.Relay.dcTie1.getValue()) { - me["ELEC-Line-DC1-DCBAT"].show(); - } else { - me["ELEC-Line-DC1-DCBAT"].hide(); - } - - if (systems.ELEC.Relay.dcTie2.getValue()) { - me["ELEC-Line-DC2-DCBAT"].show(); - me["ELEC-Line-DC2-DCESS_DCBAT"].show(); - } else { - me["ELEC-Line-DC2-DCBAT"].hide(); - me["ELEC-Line-DC2-DCESS_DCBAT"].hide(); - } - - if (systems.ELEC.Relay.acEssEmerGenFeed.getValue()) { - me["EMERGEN-out"].show(); - me["ELEC-Line-Emergen-ESSTR"].show(); - } else { - me["EMERGEN-out"].hide(); - me["ELEC-Line-Emergen-ESSTR"].hide(); - } - 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(); } else { me["ELEC-Line-ACESS-TRESS"].hide(); - } - - if (systems.ELEC.Relay.essTrContactor.getValue()) { - me["ELEC-Line-ESSTR-DCESS"].show(); - } else { - me["ELEC-Line-ESSTR-DCESS"].hide(); - } - - # hide not yet implemented items - me.updateBottomStatus(); - }, -}; \ No newline at end of file + } \ No newline at end of file diff --git a/Nasal/Libraries/libraries.nas b/Nasal/Libraries/libraries.nas index 33567b4a..244f97e9 100644 --- a/Nasal/Libraries/libraries.nas +++ b/Nasal/Libraries/libraries.nas @@ -397,6 +397,8 @@ var input = { "gearPosNorm": "/gear/gear[0]/position-norm", "gearPosNorm1": "/gear/gear[1]/position-norm", "gearPosNorm2": "/gear/gear[2]/position-norm", + "engine1Running": "/engines/engine[0]/running", + "engine2Running": "/engines/engine[1]/running", }; foreach (var name; keys(input)) {