From 9ebdc9fa84c6b337aface1457dfdc19eab6dd615 Mon Sep 17 00:00:00 2001 From: Joshua Davidson Date: Fri, 24 Aug 2018 12:23:59 -0400 Subject: [PATCH] System: Fix Elec Battery logic, finish ELEC ECAM page --- Models/Instruments/IESI/IESI.nas | 4 +- Models/Instruments/Lower-ECAM/Lower-ECAM.nas | 26 +- Models/Instruments/Lower-ECAM/res/elec.svg | 1215 +++++++++--------- Models/Instruments/OHpanel/OHpanel.xml | 120 +- Nasal/ADIRS.nas | 15 +- Nasal/electrical.nas | 13 +- revision.txt | 2 +- 7 files changed, 685 insertions(+), 710 deletions(-) diff --git a/Models/Instruments/IESI/IESI.nas b/Models/Instruments/IESI/IESI.nas index 124c7f83..a426a7af 100644 --- a/Models/Instruments/IESI/IESI.nas +++ b/Models/Instruments/IESI/IESI.nas @@ -58,7 +58,7 @@ var canvas_IESI_base = { return []; }, update: func() { - if (getprop("/systems/electrical/battery1-amps") >= 120 or getprop("/systems/electrical/battery2-amps") >= 120 or getprop("/systems/electrical/bus/dc1") >= 25 or getprop("/systems/electrical/bus/dc2") >= 25) { + if (getprop("/systems/electrical/bus/dcbat") >= 25 or getprop("/systems/electrical/bus/dc1") >= 25 or getprop("/systems/electrical/bus/dc2") >= 25) { if (getprop("/systems/acconfig/autoconfig-running") != 1 and getprop("/instrumentation/iesi/iesi-init") != 1) { setprop("/instrumentation/iesi/iesi-init", 1); setprop("/instrumentation/iesi/iesi-init-time", getprop("/sim/time/elapsed-sec")); @@ -70,7 +70,7 @@ var canvas_IESI_base = { setprop("/instrumentation/iesi/iesi-init", 0); } - if (getprop("/systems/electrical/battery1-amps") >= 120 or getprop("/systems/electrical/battery2-amps") >= 120 or getprop("/systems/electrical/bus/dc1") >= 25 or getprop("/systems/electrical/bus/dc2") >= 25) { + if (getprop("/systems/electrical/bus/dcbat") >= 25 or getprop("/systems/electrical/bus/dc1") >= 25 or getprop("/systems/electrical/bus/dc2") >= 25) { IESI.page.show(); IESI.update(); } else { diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas index 039d6364..ee82da95 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM.nas @@ -138,7 +138,7 @@ var canvas_lowerECAM_base = { lowerECAM_apu.update(); } else if (page == "bleed") { lowerECAM_apu.page.hide(); - lowerECAM_bleed.page.show(); +# lowerECAM_bleed.page.show(); lowerECAM_cond.page.hide(); lowerECAM_door.page.hide(); lowerECAM_elec.page.hide(); @@ -153,7 +153,7 @@ var canvas_lowerECAM_base = { } else if (page == "cond") { lowerECAM_apu.page.hide(); lowerECAM_bleed.page.hide(); - lowerECAM_cond.page.show(); +# lowerECAM_cond.page.show(); lowerECAM_door.page.hide(); lowerECAM_elec.page.hide(); lowerECAM_eng.page.hide(); @@ -228,7 +228,7 @@ var canvas_lowerECAM_base = { lowerECAM_elec.page.hide(); lowerECAM_eng.page.hide(); lowerECAM_fctl.page.hide(); - lowerECAM_fuel.page.show(); +# lowerECAM_fuel.page.show(); lowerECAM_press.page.hide(); lowerECAM_status.page.hide(); lowerECAM_hyd.page.hide(); @@ -243,7 +243,7 @@ var canvas_lowerECAM_base = { lowerECAM_eng.page.hide(); lowerECAM_fctl.page.hide(); lowerECAM_fuel.page.hide(); - lowerECAM_press.page.show(); +# lowerECAM_press.page.show(); lowerECAM_status.page.hide(); lowerECAM_hyd.page.hide(); lowerECAM_wheel.page.hide(); @@ -273,7 +273,7 @@ var canvas_lowerECAM_base = { lowerECAM_fuel.page.hide(); lowerECAM_press.page.hide(); lowerECAM_status.page.hide(); - lowerECAM_hyd.page.show(); +# lowerECAM_hyd.page.show(); lowerECAM_wheel.page.hide(); lowerECAM_hyd.update(); } else if (page == "wheel") { @@ -894,12 +894,12 @@ 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-Box-on","EmergenVolt","EmergenHz", + "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-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-Temp","IDG1-LOPR","IDG1-DISC","IDG1-RISE-Value","IDG1-RISE-label","GalleyShed","ELEC-IDG-2-Temp","ELEC-IDG-2-label","IDG2-RISE-label","IDG2-RISE-Value","IDG2-LOPR", "IDG2-DISC","ESSTR-group","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", - "ELEC-ACESS-SHED-label","ELEC-DCBAT-label","ELEC-DCESS-label","ELEC-DC2-label","ELEC-DC1-label","ELEC-AC1-label","ELEC-AC2-label","ELEC-ACESS-label"]; + "ELEC-ACESS-SHED-label","ELEC-DCBAT-label","ELEC-DCESS-label","ELEC-DC2-label","ELEC-DC1-label","ELEC-AC1-label","ELEC-AC2-label","ELEC-ACESS-label","ELEC-Line-ESSTR-DCESS-off","ELEC-Line-Emergen-ESSTR-off"]; }, update: func() { @@ -1046,10 +1046,12 @@ var canvas_lowerECAM_elec = { # 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 (getprop("/controls/electrical/switches/emer-gen") == 0) { - me["EMERGEN-Box-on"].hide(); + me["EMERGEN-group"].hide(); + me["ELEC-Line-Emergen-ESSTR"].hide(); me["EMERGEN-Label-off"].show(); } else { - me["EMERGEN-Box-on"].show(); + me["EMERGEN-group"].show(); + me["ELEC-Line-Emergen-ESSTR"].show(); me["EMERGEN-Label-off"].hide(); } @@ -1360,7 +1362,7 @@ var canvas_lowerECAM_elec = { me["ELEC-Line-AC2-ACESS"].hide(); } - if (getprop("/systems/electrical/tr1-fault") == 0) { + if (getprop("/systems/electrical/tr1-fault") != 1) { if (getprop("/systems/electrical/bus/ac1") < 110) { me["ELEC-Line-AC1-TR1"].setColorFill(0.7333,0.3803,0); } else { @@ -1373,7 +1375,7 @@ var canvas_lowerECAM_elec = { me["ELEC-Line-TR1-DC1"].hide(); } - if (getprop("/systems/electrical/tr2-fault") == 0) { + if (getprop("/systems/electrical/tr2-fault") != 1) { if (getprop("/systems/electrical/bus/ac2") < 110) { me["ELEC-Line-AC2-TR2"].setColorFill(0.7333,0.3803,0); } else { @@ -1422,8 +1424,8 @@ var canvas_lowerECAM_elec = { me["IDG1-DISC"].hide(); me["IDG2-DISC"].hide(); me["Shed-label"].hide(); + me["ELEC-Line-ESSTR-DCESS"].hide(); me["ELEC-Line-ACESS-TRESS"].hide(); - me["ELEC-Line-Emergen-ESSTR"].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 5cf06ff2..53105392 100644 --- a/Models/Instruments/Lower-ECAM/res/elec.svg +++ b/Models/Instruments/Lower-ECAM/res/elec.svg @@ -42,14 +42,15 @@ id="namedview371" showgrid="true" inkscape:zoom="0.5" - inkscape:cx="-261.41196" - inkscape:cy="543.75283" + inkscape:cx="455.53074" + inkscape:cy="693.51145" inkscape:window-x="1592" inkscape:window-y="-8" inkscape:window-maximized="1" inkscape:current-layer="svg2" inkscape:snap-nodes="false" - inkscape:snap-global="false"> + inkscape:snap-global="false" + showguides="false"> @@ -145,6 +146,55 @@ inkscape:transform-center-y="-2.8748476" transform="matrix(0.98944731,0,0,0.81209163,63.509767,12.068865)" /> + + + + + - IDG - IDG - °C - °C - 115 - 115 - - - ESS TR - - - EMER GEN - - GALLEY SHED - - - - - - - - V - A - 28 - 150 - - - - - - - - - - - - - - - - - EMER GEN - V - HZ - 115 - 400 - - SHED - DISC - LO PR - DISC - LO PR - RISE - 15 - RISE - 15 - 1 - 2 - SHED HZ + IDG + 1 + °C + 25 + LO PR + DISC + 25 + RISE + IDG + 2 + LO PR + DISC + °C + 25 + 25 + RISE + + GALLEY SHED + ESS TR + EMER GEN + + + + + + + + 28 + 150 + V + A + + + SHED + SHED + + + + + + + + + + + + + EMER GEN + 115 + V + 400 + HZ + + + + + diff --git a/Models/Instruments/OHpanel/OHpanel.xml b/Models/Instruments/OHpanel/OHpanel.xml index 9372640b..22e185ae 100644 --- a/Models/Instruments/OHpanel/OHpanel.xml +++ b/Models/Instruments/OHpanel/OHpanel.xml @@ -75,12 +75,8 @@ - systems/electrical/battery1-amps - 120 - - - systems/electrical/battery2-amps - 120 + systems/electrical/bus/dcbat + 25 systems/electrical/bus/dc-ess @@ -1793,12 +1789,8 @@ - systems/electrical/battery1-amps - 120 - - - systems/electrical/battery2-amps - 120 + systems/electrical/bus/dcbat + 25 systems/electrical/bus/dc-ess @@ -2887,12 +2879,8 @@ - systems/electrical/battery1-amps - 120 - - - systems/electrical/battery2-amps - 120 + systems/electrical/bus/dcbat + 25 systems/electrical/bus/dc-ess @@ -2963,12 +2951,8 @@ - systems/electrical/battery1-amps - 120 - - - systems/electrical/battery2-amps - 120 + systems/electrical/bus/dcbat + 25 systems/electrical/bus/dc-ess @@ -3034,12 +3018,8 @@ - systems/electrical/battery1-amps - 120 - - - systems/electrical/battery2-amps - 120 + systems/electrical/bus/dcbat + 25 systems/electrical/bus/dc-ess @@ -3107,12 +3087,8 @@ - systems/electrical/battery1-amps - 120 - - - systems/electrical/battery2-amps - 120 + systems/electrical/bus/dcbat + 25 systems/electrical/bus/dc-ess @@ -3189,12 +3165,8 @@ - systems/electrical/battery1-amps - 120 - - - systems/electrical/battery2-amps - 120 + systems/electrical/bus/dcbat + 25 systems/electrical/bus/dc-ess @@ -3242,12 +3214,8 @@ - systems/electrical/battery1-amps - 120 - - - systems/electrical/battery2-amps - 120 + systems/electrical/bus/dcbat + 25 systems/electrical/bus/dc-ess @@ -3627,12 +3595,8 @@ - systems/electrical/battery1-amps - 120 - - - systems/electrical/battery2-amps - 120 + systems/electrical/bus/dcbat + 25 systems/electrical/bus/dc-ess @@ -3771,12 +3735,8 @@ - systems/electrical/battery1-amps - 120 - - - systems/electrical/battery2-amps - 120 + systems/electrical/bus/dcbat + 25 systems/electrical/bus/dc-ess @@ -3981,12 +3941,8 @@ - systems/electrical/battery1-amps - 120 - - - systems/electrical/battery2-amps - 120 + systems/electrical/bus/dcbat + 25 systems/electrical/bus/dc-ess @@ -4061,12 +4017,8 @@ - systems/electrical/battery1-amps - 120 - - - systems/electrical/battery2-amps - 120 + systems/electrical/bus/dcbat + 25 systems/electrical/bus/dc-ess @@ -4334,12 +4286,8 @@ - systems/electrical/battery1-amps - 120 - - - systems/electrical/battery2-amps - 120 + systems/electrical/bus/dcbat + 25 systems/electrical/bus/dc-ess @@ -5114,12 +5062,8 @@ - systems/electrical/battery1-amps - 120 - - - systems/electrical/battery2-amps - 120 + systems/electrical/bus/dcbat + 25 systems/electrical/bus/dc-ess @@ -5185,12 +5129,8 @@ - systems/electrical/battery1-amps - 120 - - - systems/electrical/battery2-amps - 120 + systems/electrical/bus/dcbat + 25 systems/electrical/bus/dc-ess diff --git a/Nasal/ADIRS.nas b/Nasal/ADIRS.nas index 3fee3305..61a6a740 100644 --- a/Nasal/ADIRS.nas +++ b/Nasal/ADIRS.nas @@ -14,8 +14,7 @@ setlistener("/sim/signals/fdm-initialized", func { var gs = getprop("/velocities/groundspeed-kt"); var ac1 = 0; var ac2 = 0; - var batt1_amps = 0; - var batt2_amps = 0; + var dcbat = 0; var pwr_src = "XX"; }); @@ -65,8 +64,7 @@ var ADIRS = { gs = getprop("/velocities/groundspeed-kt"); ac1 = getprop("/systems/electrical/bus/ac1"); ac2 = getprop("/systems/electrical/bus/ac2"); - batt1_amps = getprop("/systems/electrical/battery1-amps"); - batt2_amps = getprop("/systems/electrical/battery2-amps"); + dcbat = getprop("/systems/electrical/bus/dcbat"); if (getprop("/controls/adirs/skip") == 1) { if (getprop("/controls/adirs/align-time") != 5) { @@ -78,7 +76,7 @@ var ADIRS = { } } - if (gs > 5 or pitch > 5 or pitch < -5 or roll > 10 or roll < -10 or (ac1 < 110 and ac2 < 110 and batt1_amps < 120 and batt2_amps < 120)) { + if (gs > 5 or pitch > 5 or pitch < -5 or roll > 10 or roll < -10 or (ac1 < 110 and ac2 < 110 and dcbat < 25)) { if (getprop("/controls/adirs/ir[0]/align") == 1) { me.stopAlign(0,1); } @@ -92,7 +90,7 @@ var ADIRS = { if (ac1 >= 110 or ac2 >= 110) { pwr_src = "AC"; - } else if ((batt1_amps >= 120 or batt2_amps >= 120) and (getprop("/controls/adirs/ir[0]/knob") != 0 or getprop("/controls/adirs/ir[1]/knob") != 0 or getprop("/controls/adirs/ir[2]/knob") != 0)) { + } else if (dcbat >= 25 and (getprop("/controls/adirs/ir[0]/knob") != 0 or getprop("/controls/adirs/ir[1]/knob") != 0 or getprop("/controls/adirs/ir[2]/knob") != 0)) { pwr_src = "BATT"; } else { pwr_src = "XX"; @@ -119,10 +117,9 @@ var ADIRS = { beginAlign: func(n) { ac1 = getprop("/systems/electrical/bus/ac1"); ac2 = getprop("/systems/electrical/bus/ac2"); - batt1_amps = getprop("/systems/electrical/battery1-amps"); - batt2_amps = getprop("/systems/electrical/battery2-amps"); + dcbat = getprop("/systems/electrical/bus/dcbat"); setprop("/instrumentation/adirs/adr[" ~ n ~ "]/active", 1); - if (getprop("/controls/adirs/ir[" ~ n ~ "]/align") != 1 and getprop("/instrumentation/adirs/ir[" ~ n ~ "]/aligned") != 1 and (ac1 >= 110 or ac2 >= 110 or batt1_amps >= 120 or batt2_amps >= 120)) { + if (getprop("/controls/adirs/ir[" ~ n ~ "]/align") != 1 and getprop("/instrumentation/adirs/ir[" ~ n ~ "]/aligned") != 1 and (ac1 >= 110 or ac2 >= 110 or dcbat >= 25)) { setprop("/controls/adirs/ir[" ~ n ~ "]/time", getprop("/sim/time/elapsed-sec")); setprop("/controls/adirs/ir[" ~ n ~ "]/align", 1); setprop("/controls/adirs/ir[" ~ n ~ "]/fault", 0); diff --git a/Nasal/electrical.nas b/Nasal/electrical.nas index 78f6e11e..249abf69 100644 --- a/Nasal/electrical.nas +++ b/Nasal/electrical.nas @@ -10,6 +10,7 @@ var ac_volt_min = 110; var dc_volt_std = 28; var dc_volt_min = 25; var dc_amps_std = 150; +var batt_amps = 2; var tr_amps_std = 55; var ac_hz_std = 400; var ac1_src = "XX"; @@ -313,14 +314,16 @@ var ELEC = { replay = getprop("/sim/replay/replay-state"); wow = getprop("/gear/gear[1]/wow"); + + if (battery1_volts >= 20 and battery1_sw and !batt1_fail) { - setprop("/systems/electrical/battery1-amps", dc_amps_std); + setprop("/systems/electrical/battery1-amps", batt_amps); } else { setprop("/systems/electrical/battery1-amps", 0); } if (battery2_volts >= 20 and battery2_sw and !batt2_fail) { - setprop("/systems/electrical/battery2-amps", dc_amps_std); + setprop("/systems/electrical/battery2-amps", batt_amps); } else { setprop("/systems/electrical/battery2-amps", 0); } @@ -328,7 +331,7 @@ var ELEC = { battery1_amps = getprop("/systems/electrical/battery1-amps"); battery2_amps = getprop("/systems/electrical/battery2-amps"); - if (battery1_amps > 120 or battery2_amps > 120) { + if (battery1_amps > 0 or battery2_amps > 0) { setprop("/systems/electrical/bus/dcbat", dc_volt_std); } else { setprop("/systems/electrical/bus/dcbat", 0); @@ -623,7 +626,7 @@ var ELEC = { } } else if (battery1_percent == 100 and (dc1 > 25 or dc2 > 25) and battery1_sw and !batt1_fail) { setprop("/systems/electrical/battery1-time", getprop("/sim/time/elapsed-sec")); - } else if (battery1_amps >= 120 and battery1_sw and !batt1_fail) { + } else if (battery1_amps > 0 and battery1_sw and !batt1_fail) { if (getprop("/systems/electrical/battery1-time") + 5 < getprop("/sim/time/elapsed-sec")) { battery1_percent_calc = battery1_percent - 0.25; # Roughly 90 percent every 30 mins if (battery1_percent_calc < 0) { @@ -647,7 +650,7 @@ var ELEC = { } } else if (battery2_percent == 100 and (dc1 > 25 or dc2 > 25) and battery2_sw and !batt2_fail) { setprop("/systems/electrical/battery2-time", getprop("/sim/time/elapsed-sec")); - } else if (battery2_amps >= 120 and battery2_sw and !batt2_fail) { + } else if (battery2_amps > 0 and battery2_sw and !batt2_fail) { if (getprop("/systems/electrical/battery2-time") + 5 < getprop("/sim/time/elapsed-sec")) { battery2_percent_calc = battery2_percent - 0.25; # Roughly 90 percent every 30 mins if (battery2_percent_calc < 0) { diff --git a/revision.txt b/revision.txt index ea53445d..85691346 100644 --- a/revision.txt +++ b/revision.txt @@ -1 +1 @@ -4626 \ No newline at end of file +4630 \ No newline at end of file