Electrical system: finalize

This commit is contained in:
legoboyvdlp R 2019-10-10 19:15:21 +01:00
parent d8428b0ea6
commit c0bab3a7fa
4 changed files with 141 additions and 141 deletions

View file

@ -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,23 +1669,29 @@ 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();
me["ELEC-Line-APU-EXT"].show();
me["ELEC-Line-EXT-AC2"].show();
} else {
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 (ac1_src.getValue() == "EXT" or ac2_src.getValue() == "APU" or ac1_src.getValue() == "XTIE" or ac2_src.getValue() == "XTIE") {
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 (ac2_src.getValue() == "APU" or ac2_src.getValue() == "EXT" or ac1_src.getValue() == "XTIE" or ac2_src.getValue() == "XTIE") {
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) {
me["ELEC-Line-AC1-ACESS"].hide();
@ -1696,42 +1727,56 @@ var canvas_lowerECAM_elec = {
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();
me["ELEC-Line-DC1-DCESS_DCBAT"].hide();
}
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)) {
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();
}
# TODO add connections from/to ESS TR
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();
}
# 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();

View file

@ -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"

Before

Width:  |  Height:  |  Size: 120 KiB

After

Width:  |  Height:  |  Size: 120 KiB

View file

@ -3525,16 +3525,6 @@
<property>controls/OH/protectors/emergentest</property>
<value>1</value>
</equals>
<or>
<greater-than-equals>
<property>systems/electrical/bus/dc-bat</property>
<value>25</value>
</greater-than-equals>
<greater-than-equals>
<property>systems/electrical/bus/dc-ess</property>
<value>25</value>
</greater-than-equals>
</or>
</and>
</condition>
<command>property-assign</command>
@ -3551,81 +3541,19 @@
<command>nasal</command>
<script>setprop("/sim/sounde/oh-btn", 1);</script>
</binding>
<binding>
<condition>
<and>
<equals>
<property>controls/OH/protectors/emergentest</property>
<value>1</value>
</equals>
<or>
<greater-than-equals>
<property>systems/electrical/bus/dc-bat</property>
<value>25</value>
</greater-than-equals>
<greater-than-equals>
<property>systems/electrical/bus/dc-ess</property>
<value>25</value>
</greater-than-equals>
</or>
</and>
</condition>
<command>property-assign</command>
<property>controls/OH/protectors/emergentest</property>
<value>0</value>
</binding>
<binding>
<condition>
<not>
<property>controls/OH/protectors/emergentest</property>
</not>
</condition>
<command>nasal</command>
<script>setprop("/sim/sounde/oh-cover", 1);</script>
</binding>
<mod-up>
<binding>
<condition>
<and>
<equals>
<property>controls/OH/protectors/emergentest</property>
<value>1</value>
</equals>
<or>
<greater-than-equals>
<property>systems/electrical/bus/dc-bat</property>
<value>25</value>
</greater-than-equals>
<greater-than-equals>
<property>systems/electrical/bus/dc-ess</property>
<value>25</value>
</greater-than-equals>
</or>
</and>
</condition>
<command>property-assign</command>
<property>/controls/electrical/switches/emer-gen-test</property>
<value>0</value>
</binding>
<binding>
<condition>
<and>
<equals>
<property>controls/OH/protectors/emergentest</property>
<value>1</value>
</equals>
<or>
<greater-than-equals>
<property>systems/electrical/bus/dc-bat</property>
<value>25</value>
</greater-than-equals>
<greater-than-equals>
<property>systems/electrical/bus/dc-ess</property>
<value>25</value>
</greater-than-equals>
</or>
</and>
</condition>
<command>property-assign</command>
<property>controls/OH/protectors/emergentest</property>
<value>0</value>

View file

@ -666,6 +666,7 @@
<test value="1">
/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
</test>
</switch>
@ -844,7 +845,7 @@
<fcs_function name="/systems/electrical/sources/ess-tr/output-amp"> <!-- TODO: make it depend on current draw -->
<function>
<table>
<independentVar lookup="row">/systems/electrical/sources/tr-1/output-volt</independentVar>
<independentVar lookup="row">/systems/electrical/sources/ess-tr/output-volt</independentVar>
<tableData>
0 0
27.5 200
@ -870,6 +871,13 @@
</test>
</switch>
<switch name="/systems/electrical/relay/tr-contactor-1/output-amp">
<default value="0"/>
<test value="/systems/electrical/sources/tr-1/output-amp">
/systems/electrical/relay/tr-contactor-1/contact-pos eq 1
</test>
</switch>
<switch name="/systems/electrical/relay/tr-contactor-2/contact-pos">
<default value="0"/>
<test logic="AND" value="1">
@ -886,6 +894,13 @@
</test>
</switch>
<switch name="/systems/electrical/relay/tr-contactor-2/output-amp">
<default value="0"/>
<test value="/systems/electrical/sources/tr-2/output-amp">
/systems/electrical/relay/tr-contactor-2/contact-pos eq 1
</test>
</switch>
<!-- DC Bus Tie Relays -->
<switch name="/systems/electrical/relay/dc-bus-tie-dc-1/contact-pos">
<default value="0"/>
@ -937,6 +952,13 @@
</test>
</switch>
<switch name="/systems/electrical/relay/dc-ess-feed-tr/output-amp">
<default value="0"/>
<test value="/systems/electrical/sources/ess-tr/output-amp">
/systems/electrical/relay/dc-ess-feed-tr/contact-pos eq 1
</test>
</switch>
<switch name="/systems/electrical/relay/dc-ess-feed-bat/contact-pos"> <!-- TODO: via 20PC1 80A fuse on 120VU -->
<default value="0"/>
<test logic="AND" value="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
</test>
</switch>
@ -1027,10 +1050,14 @@
</switch>
<!-- DC ESS Bus -->
<pure_gain name="/systems/electrical/bus/dc-ess">
<input>/systems/electrical/relay/dc-ess-feed-bat/output</input>
<gain>1</gain>
</pure_gain>
<fcs_function name="/systems/electrical/bus/dc-ess">
<function>
<max>
<property>/systems/electrical/relay/dc-ess-feed-bat/output</property>
<property>/systems/electrical/relay/dc-ess-feed-tr/output</property>
</max>
</function>
</fcs_function>
<pure_gain name="/systems/electrical/bus/dc-ess-shed">
<input>/systems/electrical/bus/dc-ess</input>