From c0bab3a7fa1a4c5b036b07093b4fd24ebe0fb67e Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Thu, 10 Oct 2019 19:15:21 +0100 Subject: [PATCH] Electrical system: finalize --- Models/Instruments/Lower-ECAM/Lower-ECAM.nas | 165 ++++++++++++------- Models/Instruments/Lower-ECAM/res/elec.svg | 2 +- Models/Instruments/OHpanel/OHpanel.xml | 78 +-------- Systems/a320-electrical.xml | 37 ++++- 4 files changed, 141 insertions(+), 141 deletions(-) diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas index 4c68dae5..1c94a6c8 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas @@ -38,6 +38,8 @@ var tr1_v = 0; var tr1_a = 0; var tr2_v = 0; var tr2_a = 0; +var essTramps = 0; +var essTrvolts = 0; # Fetch Nodes var elapsed_sec = props.globals.getNode("/sim/time/elapsed-sec", 1); @@ -132,14 +134,16 @@ var bat1_volts = props.globals.getNode("/systems/electrical/sources/bat-1/volt", 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 tr1_volts = props.globals.getNode("/systems/electrical/sources/tr-1/output-volt", 1); -var tr2_volts = props.globals.getNode("/systems/electrical/sources/tr-2/output-volt", 1); -var tr1_amps = props.globals.getNode("/systems/electrical/sources/tr-1/output-amp", 1); -var tr2_amps = props.globals.getNode("/systems/electrical/sources/tr-2/output-amp", 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 dc1 = props.globals.getNode("/systems/electrical/bus/dc-1", 1); var dc2 = props.globals.getNode("/systems/electrical/bus/dc-2", 1); var dc_ess = props.globals.getNode("/systems/electrical/bus/dc-ess", 1); -var switch_emer_gen = props.globals.getNode("/controls/electrical/switches/emer-gen", 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); @@ -157,6 +161,8 @@ var ac2 = props.globals.getNode("/systems/electrical/bus/ac-2", 1); var switch_ac_ess_feed = props.globals.getNode("/controls/electrical/switches/ac-ess-feed", 1); var tr1_fault = props.globals.getNode("/systems/failures/electrical/tr-1", 1); var tr2_fault = props.globals.getNode("/systems/failures/electrical/tr-2", 1); +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); var eng1_running = props.globals.getNode("/engines/engine[0]/running", 1); var eng2_running = props.globals.getNode("/engines/engine[1]/running", 1); @@ -1135,7 +1141,7 @@ var canvas_lowerECAM_elec = { getKeys: func() { return ["TAT","SAT","GW","UTCh","UTCm","BAT1-label","Bat1Volt","Bat1Ampere","BAT2-label","Bat2Volt","Bat2Ampere","BAT1-charge","BAT1-discharge","BAT2-charge","BAT2-discharge","ELEC-Line-DC1-DCBAT","ELEC-Line-DC1-DCESS","ELEC-Line-DC2-DCBAT", "ELEC-Line-DC1-DCESS_DCBAT","ELEC-Line-DC2-DCESS_DCBAT","ELEC-Line-TR1-DC1","ELEC-Line-TR2-DC2","Shed-label","ELEC-Line-ESSTR-DCESS","TR1-label","TR1Volt","TR1Ampere","TR2-label","TR2Volt","TR2Ampere","EMERGEN-group","EmergenVolt","EmergenHz", - "ELEC-Line-Emergen-ESSTR","EMERGEN-Label-off","EMERGEN-out","ELEC-Line-ACESS-TRESS","ELEC-Line-AC1-TR1","ELEC-Line-AC2-TR2","ELEC-Line-AC1-ACESS","ELEC-Line-AC2-ACESS","ACESS-SHED","ACESS","AC1-in","AC2-in","ELEC-Line-GEN1-AC1","ELEC-Line-GEN2-AC2", + "ELEC-Line-Emergen-ESSTR","EMERGEN-Label-off","Emergen-Label","EMERGEN-out","ELEC-Line-ACESS-TRESS","ELEC-Line-AC1-TR1","ELEC-Line-AC2-TR2","ELEC-Line-AC1-ACESS","ELEC-Line-AC2-ACESS","ACESS-SHED","ACESS","AC1-in","AC2-in","ELEC-Line-GEN1-AC1","ELEC-Line-GEN2-AC2", "ELEC-Line-APU-AC1","ELEC-Line-APU-EXT","ELEC-Line-EXT-AC2","APU-out","EXT-out","EXTPWR-group","ExtVolt","ExtHz","APU-content","APU-border","APUGentext","APUGenLoad","APUGenVolt","APUGenHz","APUGEN-off","GEN1-label","Gen1Load","Gen1Volt","Gen1Hz", "GEN2-label","Gen2Load","GEN2-off","Gen2Volt","Gen2Hz","ELEC-IDG-1-label","ELEC-IDG-1-num-label","ELEC-IDG-1-Temp","IDG1-LOPR","IDG1-DISC","IDG1-RISE-Value","IDG1-RISE-label","GalleyShed","ELEC-IDG-2-Temp","ELEC-IDG-2-label","ELEC-IDG-2-num-label","IDG2-RISE-label","IDG2-RISE-Value","IDG2-LOPR", "IDG2-DISC","ESSTR-group","ESSTR","ESSTR-Volt","ESSTR-Ampere","BAT1-content","BAT2-content","BAT1-OFF","BAT2-OFF","GEN1-content","GEN2-content","GEN-1-num-label","GEN-2-num-label","GEN1-off","GEN2-off","GEN1-num-label","GEN2-num-label","EXTPWR-label", @@ -1284,24 +1290,26 @@ var canvas_lowerECAM_elec = { } # ESS TR + essTrvolts = essTrVolt.getValue(); + essTramps = essTrAmp.getValue(); if (systems.ELEC.Relay.essTrContactor.getValue()) { me["ESSTR-group"].show(); - me["ESSTR-Volt"].setText(sprintf("%s", math.round(systems.ELEC.Source.trEss.outputVolt.getValue()))); - me["ESSTR-Ampere"].setText(sprintf("%s", math.round(systems.ELEC.Source.trEss.outputAmp.getValue()))); + me["ESSTR-Volt"].setText(sprintf("%s", math.round(essTrvolts))); + me["ESSTR-Ampere"].setText(sprintf("%s", math.round(essTramps))); - if (systems.ELEC.Source.trEss.outputVolt.getValue() < 25 or systems.ELEC.Source.trEss.outputVolt.getValue() > 31 or systems.ELEC.Source.trEss.outputAmp.getValue() < 5) { + if (essTrvolts < 25 or essTrvolts > 31 or essTramps < 5) { me["ESSTR"].setColor(0.7333,0.3803,0); } else { me["ESSTR"].setColor(0.8078,0.8039,0.8078); } - if (systems.ELEC.Source.trEss.outputVolt.getValue() < 25 or systems.ELEC.Source.trEss.outputVolt.getValue() > 31) { + if (essTrvolts < 25 or essTrvolts > 31) { me["ESSTR-Volt"].setColor(0.7333,0.3803,0); } else { me["ESSTR-Volt"].setColor(0.0509,0.7529,0.2941); } - if (systems.ELEC.Source.trEss.outputAmp.getValue() < 5) { + if (essTramps < 5) { me["ESSTR-Ampere"].setColor(0.7333,0.3803,0); } else { me["ESSTR-Ampere"].setColor(0.0509,0.7529,0.2941); @@ -1311,8 +1319,6 @@ var canvas_lowerECAM_elec = { } # EMER GEN - # TODO add values and amber on over/under load - # TODO changes the prop to the one which indicates the use of the emergen and not of the man depoly if (switch_emer_gen.getValue() == 0) { me["EMERGEN-group"].hide(); me["ELEC-Line-Emergen-ESSTR"].hide(); @@ -1323,6 +1329,27 @@ var canvas_lowerECAM_elec = { me["ELEC-Line-Emergen-ESSTR"].show(); me["ELEC-Line-Emergen-ESSTR-off"].hide(); me["EMERGEN-Label-off"].hide(); + + me["EmergenVolt"].setText(sprintf("s", math.round(emerGenVolts.getValue()))); + me["EmergenHz"].setText(sprintf("s", math.round(emerGenHz.getValue()))); + + if (emerGenVolts.getValue() > 120 or emerGenVolts.getValue() < 110 or emerGenHz.getValue() > 410 or emerGenHz.getValue() < 390) { + me["Emergen-Label"].setColor(0.7333,0.3803,0); + } else { + me["Emergen-Label"].setColor(0.8078,0.8039,0.8078); + } + + if (emerGenVolts.getValue() > 120 or emerGenVolts.getValue() < 110) { + me["EmergenVolt"].setColor(0.7333,0.3803,0); + } else { + me["EmergenVolt"].setColor(0.0509,0.7529,0.2941); + } + + if (emerGenHz.getValue() > 410 or emerGenHz.getValue() < 390) { + me["EmergenHz"].setColor(0.7333,0.3803,0); + } else { + me["EmergenHz"].setColor(0.0509,0.7529,0.2941); + } } # IDG 1 @@ -1549,8 +1576,6 @@ var canvas_lowerECAM_elec = { } } - # TODO add IDG warnings and rise part - if (galleyshed.getValue() == 1 or (switch_galley.getValue() == 0)) { me["GalleyShed"].show(); } else { @@ -1608,25 +1633,25 @@ var canvas_lowerECAM_elec = { # Managment of the connecting lines between the components - if (ac1_src.getValue() == "APU" or ac2_src.getValue() == "APU") { + 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"))) { me["APU-out"].show(); } else { me["APU-out"].hide(); } - if (ac1_src.getValue() == "EXT" or ac2_src.getValue() == "EXT") { + 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"))) { me["EXT-out"].show(); } else { me["EXT-out"].hide(); } - if (gen1_volts.getValue() >= 110) { + if (gen1_volts.getValue() >= 110 and getprop("/systems/electrical/relay/gen-1-glc/contact-pos")) { me["ELEC-Line-GEN1-AC1"].show(); } else { me["ELEC-Line-GEN1-AC1"].hide(); } - if (gen2_volts.getValue() >= 110) { + if (gen2_volts.getValue() >= 110 and getprop("/systems/electrical/relay/gen-2-glc/contact-pos")) { me["ELEC-Line-GEN2-AC2"].show(); } else { me["ELEC-Line-GEN2-AC2"].hide(); @@ -1644,22 +1669,28 @@ var canvas_lowerECAM_elec = { me["AC2-in"].hide(); } - if (ac1_src.getValue() == "APU" or ac1_src.getValue() == "EXT" or ac1_src.getValue() == "XTIE" or ac2_src.getValue() == "XTIE") { + 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")) { me["ELEC-Line-APU-AC1"].show(); - } else { - me["ELEC-Line-APU-AC1"].hide(); - } - - if (ac1_src.getValue() == "EXT" or ac2_src.getValue() == "APU" or ac1_src.getValue() == "XTIE" or ac2_src.getValue() == "XTIE") { me["ELEC-Line-APU-EXT"].show(); - } else { - me["ELEC-Line-APU-EXT"].hide(); - } - - if (ac2_src.getValue() == "APU" or ac2_src.getValue() == "EXT" or ac1_src.getValue() == "XTIE" or ac2_src.getValue() == "XTIE") { me["ELEC-Line-EXT-AC2"].show(); } else { - me["ELEC-Line-EXT-AC2"].hide(); + if (getprop("/systems/electrical/relay/ac-bus-ac-bus-tie-1/contact-pos")) { + me["ELEC-Line-APU-AC1"].show(); + } else { + 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"))) { + me["ELEC-Line-APU-EXT"].show(); + } else { + me["ELEC-Line-APU-EXT"].hide(); + } + + if (getprop("/systems/electrical/relay/ac-bus-ac-bus-tie-2/contact-pos")) { + me["ELEC-Line-EXT-AC2"].show(); + } else { + me["ELEC-Line-EXT-AC2"].hide(); + } } if (switch_ac_ess_feed.getValue() == 1) { @@ -1695,43 +1726,57 @@ var canvas_lowerECAM_elec = { me["ELEC-Line-AC2-TR2"].hide(); me["ELEC-Line-TR2-DC2"].hide(); } - - if (ac1.getValue() < 110) { - me["ELEC-Line-DC1-DCESS"].hide(); - } else { - me["ELEC-Line-DC1-DCESS"].show(); - } - - if (dc1.getValue() < 25) { - me["ELEC-Line-DC1-DCESS_DCBAT"].hide(); - me["ELEC-Line-DC1-DCBAT"].hide(); - } else { + + if (getprop("/systems/electrical/relay/dc-bus-tie-dc-1/contact-pos")) { me["ELEC-Line-DC1-DCESS_DCBAT"].show(); - me["ELEC-Line-DC1-DCBAT"].show(); - } - - if (dc2.getValue() < 25 or dc1.getValue() >= 25 and ac1.getValue() >= 110) { - me["ELEC-Line-DC2-DCESS_DCBAT"].hide(); - me["ELEC-Line-DC2-DCBAT"].hide(); } else { - me["ELEC-Line-DC2-DCESS_DCBAT"].show(); - me["ELEC-Line-DC2-DCBAT"].show(); - } - - if (switch_emer_gen.getValue() == 1 and (ac1.getValue() < 110 and switch_ac_ess_feed.getValue() == 0 or ac2.getValue() < 110 and switch_ac_ess_feed.getValue() == 1)) { - me["EMERGEN-out"].show(); - } else { - me["EMERGEN-out"].hide(); + me["ELEC-Line-DC1-DCESS_DCBAT"].hide(); + } + + if (getprop("/systems/electrical/relay/dc-ess-feed-bat/contact-pos")) { + me["ELEC-Line-DC1-DCESS"].show(); + } else { + 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")) { + me["ELEC-Line-DC1-DCBAT"].show(); + } else { + me["ELEC-Line-DC1-DCBAT"].hide(); + } + + if (getprop("/systems/electrical/relay/dc-bus-tie-dc-2/contact-pos")) { + 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 (getprop("/systems/electrical/relay/ac-ess-feed-emer-gen/contact-pos")) { + me["EMERGEN-out"].show(); + me["ELEC-Line-Emergen-ESSTR"].show(); + } else { + me["EMERGEN-out"].hide(); + me["ELEC-Line-Emergen-ESSTR"].hide(); + } + + if (!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"))) { + me["ELEC-Line-ACESS-TRESS"].show(); + } else { + me["ELEC-Line-ACESS-TRESS"].hide(); + } + + if (getprop("/systems/electrical/relay/dc-ess-feed-tr/contact-pos")) { + me["ELEC-Line-ESSTR-DCESS"].show(); + } else { + me["ELEC-Line-ESSTR-DCESS"].hide(); } - # TODO add connections from/to ESS TR - # hide not yet implemented items me["IDG1-LOPR"].hide(); me["IDG2-LOPR"].hide(); me["Shed-label"].hide(); - me["ELEC-Line-ESSTR-DCESS"].hide(); - me["ELEC-Line-ACESS-TRESS"].hide(); me["IDG2-RISE-label"].hide(); me["IDG2-RISE-Value"].hide(); me["IDG1-RISE-label"].hide(); diff --git a/Models/Instruments/Lower-ECAM/res/elec.svg b/Models/Instruments/Lower-ECAM/res/elec.svg index 53105392..7748c51a 100644 --- a/Models/Instruments/Lower-ECAM/res/elec.svg +++ b/Models/Instruments/Lower-ECAM/res/elec.svg @@ -2272,7 +2272,7 @@ sodipodi:linespacing="0%" transform="scale(0.96119963,1.0403666)" inkscape:label="#text5149" - id="text3891" + id="Emergen-Label" y="659.37976" x="695.19788" style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:36px;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'sans-serif, Normal';text-align:start;letter-spacing:-1.60000002px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#cecdce;fill-opacity:1;stroke:none;stroke-width:4.02423px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" diff --git a/Models/Instruments/OHpanel/OHpanel.xml b/Models/Instruments/OHpanel/OHpanel.xml index 02b8f1ee..613c5cce 100644 --- a/Models/Instruments/OHpanel/OHpanel.xml +++ b/Models/Instruments/OHpanel/OHpanel.xml @@ -3525,16 +3525,6 @@ controls/OH/protectors/emergentest 1 - - - systems/electrical/bus/dc-bat - 25 - - - systems/electrical/bus/dc-ess - 25 - - property-assign @@ -3551,81 +3541,19 @@ nasal - - - + + + controls/OH/protectors/emergentest 1 - - - systems/electrical/bus/dc-bat - 25 - - - systems/electrical/bus/dc-ess - 25 - - - - - property-assign - controls/OH/protectors/emergentest - 0 - - - - - controls/OH/protectors/emergentest - - - nasal - - - - - - - - controls/OH/protectors/emergentest - 1 - - - - systems/electrical/bus/dc-bat - 25 - - - systems/electrical/bus/dc-ess - 25 - - - property-assign /controls/electrical/switches/emer-gen-test 0 - - - - controls/OH/protectors/emergentest - 1 - - - - systems/electrical/bus/dc-bat - 25 - - - systems/electrical/bus/dc-ess - 25 - - - - property-assign controls/OH/protectors/emergentest 0 diff --git a/Systems/a320-electrical.xml b/Systems/a320-electrical.xml index 85501e9a..5581a919 100644 --- a/Systems/a320-electrical.xml +++ b/Systems/a320-electrical.xml @@ -666,6 +666,7 @@ /systems/electrical/bus/ac-1 eq 0 /systems/electrical/bus/ac-2 eq 0 + /controls/electrical/switches/emer-gen-test eq 0 /systems/electrical/relay/emer-glc/output lt 110 @@ -844,7 +845,7 @@ - /systems/electrical/sources/tr-1/output-volt + /systems/electrical/sources/ess-tr/output-volt 0 0 27.5 200 @@ -870,6 +871,13 @@ + + + + /systems/electrical/relay/tr-contactor-1/contact-pos eq 1 + + + @@ -886,6 +894,13 @@ + + + + /systems/electrical/relay/tr-contactor-2/contact-pos eq 1 + + + @@ -937,6 +952,13 @@ + + + + /systems/electrical/relay/dc-ess-feed-tr/contact-pos eq 1 + + + @@ -944,6 +966,7 @@ /systems/electrical/relay/tr-contactor-1/contact-pos eq 1 /systems/electrical/relay/dc-bus-tie-dc-1/contact-pos eq 1 /systems/electrical/relay/dc-bus-tie-dc-2/contact-pos eq 0 + /controls/electrical/switches/emer-gen-test eq 0 /systems/electrical/bus/dc-1 ge 25 @@ -1027,10 +1050,14 @@ - - /systems/electrical/relay/dc-ess-feed-bat/output - 1 - + + + + /systems/electrical/relay/dc-ess-feed-bat/output + /systems/electrical/relay/dc-ess-feed-tr/output + + + /systems/electrical/bus/dc-ess