New battery charging logic
This commit is contained in:
parent
083e15ec57
commit
d6344cca6e
8 changed files with 345 additions and 155 deletions
|
@ -951,15 +951,11 @@
|
|||
<sources>
|
||||
<bat-1>
|
||||
<amps type="double">0</amps>
|
||||
<limiter type="bool">0</limiter>
|
||||
<percent type="double">80</percent>
|
||||
<time type="int">0</time>
|
||||
<percent-calc type="double">80</percent-calc>
|
||||
</bat-1>
|
||||
<bat-2>
|
||||
<amps type="double">0</amps>
|
||||
<limiter type="bool">0</limiter>
|
||||
<percent type="double">80</percent>
|
||||
<time type="int">0</time>
|
||||
<percent-calc type="double">80</percent-calc>
|
||||
</bat-2>
|
||||
</sources>
|
||||
</electrical>
|
||||
|
|
|
@ -131,12 +131,14 @@ var apu_hz = props.globals.getNode("/systems/electrical/sources/apu/output-hertz
|
|||
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/amp", 1);
|
||||
var bat2_amps = props.globals.getNode("/systems/electrical/sources/bat-2/amp", 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);
|
||||
|
@ -1210,7 +1212,7 @@ var canvas_lowerECAM_elec = {
|
|||
me["Bat1Ampere"].setText(sprintf("%s", math.round(bat1_amps.getValue())));
|
||||
me["Bat1Volt"].setText(sprintf("%s", math.round(bat1_volts.getValue())));
|
||||
|
||||
if (bat1_volts.getValue() >= 25 and bat1_volts.getValue() <= 31) {
|
||||
if (bat1_volts.getValue() >= 24.95 and bat1_volts.getValue() <= 31.05) {
|
||||
me["Bat1Volt"].setColor(0.0509,0.7529,0.2941);
|
||||
} else {
|
||||
me["Bat1Volt"].setColor(0.7333,0.3803,0);
|
||||
|
@ -1222,11 +1224,11 @@ var canvas_lowerECAM_elec = {
|
|||
me["Bat1Ampere"].setColor(0.0509,0.7529,0.2941);
|
||||
}
|
||||
|
||||
if (!systems.ELEC.Source.Bat1.limiter.getBoolValue()) {
|
||||
if (bat1_direction.getValue() == 0) {
|
||||
me["BAT1-discharge"].hide();
|
||||
me["BAT1-charge"].hide();
|
||||
} else {
|
||||
if (systems.ELEC.Bus.dcBat.getValue() > 25) {
|
||||
if (bat1_direction.getValue() == -1) {
|
||||
me["BAT1-charge"].show();
|
||||
me["BAT1-discharge"].hide();
|
||||
} else {
|
||||
|
@ -1254,7 +1256,7 @@ var canvas_lowerECAM_elec = {
|
|||
me["Bat2Ampere"].setText(sprintf("%s", math.round(bat2_amps.getValue())));
|
||||
me["Bat2Volt"].setText(sprintf("%s", math.round(bat2_volts.getValue())));
|
||||
|
||||
if (bat2_volts.getValue() >= 25 and bat2_volts.getValue() <= 31) {
|
||||
if (bat2_volts.getValue() >= 24.95 and bat2_volts.getValue() <= 31.05) {
|
||||
me["Bat2Volt"].setColor(0.0509,0.7529,0.2941);
|
||||
} else {
|
||||
me["Bat2Volt"].setColor(0.7333,0.3803,0);
|
||||
|
@ -1266,11 +1268,11 @@ var canvas_lowerECAM_elec = {
|
|||
me["Bat2Ampere"].setColor(0.0509,0.7529,0.2941);
|
||||
}
|
||||
|
||||
if (!systems.ELEC.Source.Bat2.limiter.getBoolValue()) {
|
||||
if (bat2_direction.getValue() == 0) {
|
||||
me["BAT2-discharge"].hide();
|
||||
me["BAT2-charge"].hide();
|
||||
} else {
|
||||
if (systems.ELEC.Bus.dcBat.getValue() > 25) {
|
||||
if (bat2_direction.getValue() == -1) {
|
||||
me["BAT2-charge"].show();
|
||||
me["BAT2-discharge"].hide();
|
||||
} else {
|
||||
|
|
|
@ -6268,7 +6268,7 @@
|
|||
<axis-alignment>xy-plane</axis-alignment>
|
||||
<type type="string">number-value</type>
|
||||
<format type="string">%2.1f</format>
|
||||
<property>systems/electrical/sources/bat-1/volt</property>
|
||||
<property>systems/electrical/bus/dc-hot-1</property>
|
||||
<font type="string">led.txf</font>
|
||||
<draw-text type="bool">true</draw-text>
|
||||
<draw-alignment type="bool">false</draw-alignment>
|
||||
|
@ -6320,7 +6320,7 @@
|
|||
<axis-alignment>xy-plane</axis-alignment>
|
||||
<type type="string">number-value</type>
|
||||
<format type="string">%2.1f</format>
|
||||
<property>systems/electrical/sources/bat-2/volt</property>
|
||||
<property>systems/electrical/bus/dc-hot-2</property>
|
||||
<font type="string">led.txf</font>
|
||||
<draw-text type="bool">true</draw-text>
|
||||
<draw-alignment type="bool">false</draw-alignment>
|
||||
|
|
|
@ -235,7 +235,8 @@ var ADIRS = {
|
|||
|
||||
# Electrical
|
||||
mainSupply: [systems.ELEC.Bus.acEss, systems.ELEC.Bus.ac2, systems.ELEC.Bus.ac1],
|
||||
backupSupply: [[systems.ELEC.Bus.dcHot2, 0], [systems.ELEC.Bus.dcHot2, 1], [systems.ELEC.Bus.dcHot1, 1]],
|
||||
backupSupply: [[systems.ELEC.Source.Bat2.volt, 0], [systems.ELEC.Source.Bat2.volt, 1], [systems.ELEC.Source.Bat1.volt, 1]],
|
||||
# ADIRS power directly from a separate bus connected to battery (no c.b. unlike main hot bus), as they are so critical
|
||||
|
||||
# PTS
|
||||
Lights: {
|
||||
|
|
|
@ -79,14 +79,16 @@ var ELEC = {
|
|||
},
|
||||
Source: {
|
||||
Bat1: {
|
||||
amps: props.globals.getNode("systems/electrical/sources/bat-1/amp"),
|
||||
limiter: props.globals.getNode("systems/electrical/sources/bat-1/limiter"),
|
||||
volt: props.globals.getNode("systems/electrical/sources/bat-1/volt"),
|
||||
amps: props.globals.getNode("systems/electrical/sources/bat-1/amps"),
|
||||
contact: props.globals.getNode("systems/electrical/sources/bat-1/contact"),
|
||||
percent: props.globals.getNode("systems/electrical/sources/bat-1/percent"),
|
||||
time: props.globals.getNode("systems/electrical/sources/bat-1/time"),
|
||||
},
|
||||
Bat2: {
|
||||
amps: props.globals.getNode("systems/electrical/sources/bat-2/amp"),
|
||||
limiter: props.globals.getNode("systems/electrical/sources/bat-2/limiter"),
|
||||
volt: props.globals.getNode("systems/electrical/sources/bat-2/volt"),
|
||||
amps: props.globals.getNode("systems/electrical/sources/bat-2/amps"),
|
||||
contact: props.globals.getNode("systems/electrical/sources/bat-2/contact"),
|
||||
percent: props.globals.getNode("systems/electrical/sources/bat-2/percent"),
|
||||
time: props.globals.getNode("systems/electrical/sources/bat-2/time"),
|
||||
},
|
||||
|
@ -159,74 +161,6 @@ var ELEC = {
|
|||
me.Fail.tr2Fault.setBoolValue(0);
|
||||
},
|
||||
loop: func() {
|
||||
battery1_sw = me.Switch.bat1.getValue();
|
||||
battery2_sw = me.Switch.bat2.getValue();
|
||||
batt1_fail = me.Fail.bat1Fault.getValue();
|
||||
batt2_fail = me.Fail.bat2Fault.getValue();
|
||||
battery1_percent = me.Source.Bat1.percent.getValue();
|
||||
battery2_percent = me.Source.Bat2.percent.getValue();
|
||||
battery1_amps = me.Source.Bat1.amps.getValue();
|
||||
battery2_amps = me.Source.Bat2.amps.getValue();
|
||||
battery1_time = me.Source.Bat1.time.getValue();
|
||||
battery2_time = me.Source.Bat2.time.getValue();
|
||||
dcbat = me.Bus.dcBat.getValue();
|
||||
|
||||
if (battery1_percent < 100 and dcbat > 25 and battery1_sw and !batt1_fail) {
|
||||
if (battery1_time + 5 < getprop("sim/time/elapsed-sec")) {
|
||||
battery1_percent_calc = battery1_percent + 0.75; # Roughly 90 percent every 10 mins
|
||||
if (battery1_percent_calc > 100) {
|
||||
battery1_percent_calc = 100;
|
||||
}
|
||||
me.Source.Bat1.limiter.setBoolValue(1);
|
||||
me.Source.Bat1.percent.setValue(battery1_percent_calc);
|
||||
me.Source.Bat1.time.setValue(getprop("sim/time/elapsed-sec"));
|
||||
}
|
||||
} else if (battery1_percent == 100 and dcbat > 25 and battery1_sw and !batt1_fail) {
|
||||
me.Source.Bat1.time.setValue(getprop("sim/time/elapsed-sec"));
|
||||
me.Source.Bat1.limiter.setBoolValue(0);
|
||||
} else if (battery1_amps > 0 and battery1_sw and !batt1_fail) {
|
||||
if (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 < 5) {
|
||||
battery1_percent_calc = 5;
|
||||
}
|
||||
me.Source.Bat1.limiter.setBoolValue(1);
|
||||
me.Source.Bat1.percent.setValue(battery1_percent_calc);
|
||||
me.Source.Bat1.time.setValue(getprop("sim/time/elapsed-sec"));
|
||||
}
|
||||
} else {
|
||||
me.Source.Bat1.time.setValue(getprop("sim/time/elapsed-sec"));
|
||||
me.Source.Bat1.limiter.setBoolValue(0);
|
||||
}
|
||||
|
||||
if (battery2_percent < 100 and dcbat > 25 and battery2_sw and !batt2_fail) {
|
||||
if (battery2_time + 5 < getprop("sim/time/elapsed-sec")) {
|
||||
battery2_percent_calc = battery2_percent + 0.75; # Roughly 90 percent every 10 mins
|
||||
if (battery2_percent_calc > 100) {
|
||||
battery2_percent_calc = 100;
|
||||
}
|
||||
me.Source.Bat2.limiter.setBoolValue(1);
|
||||
me.Source.Bat2.percent.setValue(battery2_percent_calc);
|
||||
me.Source.Bat2.time.setValue(getprop("sim/time/elapsed-sec"));
|
||||
}
|
||||
} else if (battery2_percent == 100 and dcbat > 25 and battery2_sw and !batt2_fail) {
|
||||
me.Source.Bat2.time.setValue(getprop("sim/time/elapsed-sec"));
|
||||
me.Source.Bat2.limiter.setBoolValue(0);
|
||||
} else if (battery2_amps > 0 and battery2_sw and !batt1_fail) {
|
||||
if (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 < 5) {
|
||||
battery2_percent_calc = 5;
|
||||
}
|
||||
me.Source.Bat2.limiter.setBoolValue(1);
|
||||
me.Source.Bat2.percent.setValue(battery2_percent_calc);
|
||||
me.Source.Bat2.time.setValue(getprop("sim/time/elapsed-sec"));
|
||||
}
|
||||
} else {
|
||||
me.Source.Bat2.time.setValue(getprop("sim/time/elapsed-sec"));
|
||||
me.Source.Bat2.limiter.setBoolValue(0);
|
||||
}
|
||||
|
||||
# Autopilot Disconnection routines
|
||||
if (me.Bus.dcEssShed.getValue() < 25) {
|
||||
if (getprop("it-autoflight/output/ap1") == 1 and !me._timer1On) {
|
||||
|
|
|
@ -44,7 +44,10 @@ var default = [
|
|||
"/instrumentation/efis[1]/input/lh-vor-adf",
|
||||
"/instrumentation/efis[1]/input/rh-vor-adf",
|
||||
# parking brake
|
||||
"/controls/gear/brake-parking"
|
||||
"/controls/gear/brake-parking",
|
||||
# electrics
|
||||
"/systems/electrical/sources/bat-1/percent-calc",
|
||||
"/systems/electrical/sources/bat-2/percent-calc"
|
||||
];
|
||||
|
||||
var save = func (saved_props, file) {
|
||||
|
|
|
@ -1563,12 +1563,7 @@
|
|||
<name>RelayBatt1</name>
|
||||
<mode>once</mode>
|
||||
<path>Aircraft/A320-family/Sounds/Cockpit/relay-battery.wav</path>
|
||||
<condition>
|
||||
<greater-than>
|
||||
<property>/systems/electrical/battery1-amps</property>
|
||||
<value>25</value>
|
||||
</greater-than>
|
||||
</condition>
|
||||
<property>/systems/electrical/sources/bat-1/contact</property>
|
||||
<volume>
|
||||
<factor>0.8</factor>
|
||||
</volume>
|
||||
|
@ -1578,12 +1573,7 @@
|
|||
<name>RelayBatt2</name>
|
||||
<mode>once</mode>
|
||||
<path>Aircraft/A320-family/Sounds/Cockpit/relay-battery.wav</path>
|
||||
<condition>
|
||||
<greater-than>
|
||||
<property>/systems/electrical/battery2-amps</property>
|
||||
<value>25</value>
|
||||
</greater-than>
|
||||
</condition>
|
||||
<property>/systems/electrical/sources/bat-2/contact</property>
|
||||
<volume>
|
||||
<factor>0.8</factor>
|
||||
</volume>
|
||||
|
@ -1593,18 +1583,7 @@
|
|||
<name>RelayEXT</name>
|
||||
<mode>once</mode>
|
||||
<path>Aircraft/A320-family/Sounds/Cockpit/relay-external.wav</path>
|
||||
<condition>
|
||||
<and>
|
||||
<equals>
|
||||
<property>/controls/electrical/ground-cart</property>
|
||||
<value>1</value>
|
||||
</equals>
|
||||
<equals>
|
||||
<property>/controls/electrical/switches/ext-pwr</property>
|
||||
<value>1</value>
|
||||
</equals>
|
||||
</and>
|
||||
</condition>
|
||||
<property>/systems/electrical/relay/ext-epc/contact-pos</property>
|
||||
<volume>
|
||||
<factor>0.6</factor>
|
||||
</volume>
|
||||
|
@ -1614,12 +1593,7 @@
|
|||
<name>RelayAPU</name>
|
||||
<mode>once</mode>
|
||||
<path>Aircraft/A320-family/Sounds/Cockpit/relay-apu.wav</path>
|
||||
<condition>
|
||||
<equals>
|
||||
<property>/systems/electrical/gen-apu</property>
|
||||
<value>1</value>
|
||||
</equals>
|
||||
</condition>
|
||||
<property>/systems/electrical/relay/apu-glc/contact-pos</property>
|
||||
<volume>
|
||||
<factor>0.6</factor>
|
||||
</volume>
|
||||
|
|
|
@ -11,52 +11,332 @@
|
|||
<!-- Battery 1 -->
|
||||
<fcs_function name="/systems/electrical/sources/bat-1/volt">
|
||||
<function>
|
||||
<table>
|
||||
<independentVar lookup="row">/systems/electrical/sources/bat-1/percent</independentVar>
|
||||
<independentVar lookup="column">/systems/failures/electrical/bat-1</independentVar>
|
||||
<tableData>
|
||||
0 1
|
||||
0 0.0 0.0
|
||||
10 24.0 4.0
|
||||
50 25.5 5.0
|
||||
100 31.0 7.0
|
||||
</tableData>
|
||||
</table>
|
||||
<product>
|
||||
<difference>
|
||||
<value>1</value>
|
||||
<product>
|
||||
<property>/systems/electrical/sources/bat-1/amps</property>
|
||||
<value>0.00016666</value>
|
||||
</product>
|
||||
</difference>
|
||||
<table>
|
||||
<independentVar lookup="row">/systems/electrical/sources/bat-1/percent</independentVar>
|
||||
<independentVar lookup="column">/systems/failures/electrical/bat-1</independentVar>
|
||||
<tableData>
|
||||
0 1
|
||||
0 0.0 0.0
|
||||
10 24.0 4.0
|
||||
50 25.5 5.0
|
||||
100 31.0 7.0
|
||||
</tableData>
|
||||
</table>
|
||||
</product>
|
||||
</function>
|
||||
</fcs_function>
|
||||
|
||||
<switch name="/systems/electrical/sources/bat-1/amp"> <!-- TODO: should relate to load -->
|
||||
<default value="0"/>
|
||||
<test logic="AND" value="3">
|
||||
/systems/electrical/sources/bat-1/limiter eq 1
|
||||
<switch name="/systems/electrical/sources/bat-1/contact">
|
||||
<default value="/systems/electrical/sources/bat-1/contact"/>
|
||||
<test logic="OR" value="0"> <!-- discharge protection or switch turned off -->
|
||||
/controls/electrical/switches/bat-1 eq 0
|
||||
/systems/electrical/sources/bat-1/volt lt 23
|
||||
/systems/electrical/sources/bat-1/amps ge 100
|
||||
</test>
|
||||
<test logic="AND" value="1"> <!-- apu start -->
|
||||
/controls/electrical/switches/bat-1 eq 1
|
||||
/systems/electrical/sources/bat-1/volt ge 10
|
||||
/systems/apu/start eq 1
|
||||
</test>
|
||||
<test logic="AND" value="1"> <!-- connect to dc-bat while no other power on the ground -->
|
||||
/controls/electrical/switches/bat-1 eq 1
|
||||
/systems/electrical/bus/ac-1 lt 110
|
||||
/systems/electrical/bus/ac-2 lt 110
|
||||
/gear/gear[1]/wow eq 1
|
||||
/instrumentation/airspeed-indicator/indicated-speed-kt lt 100
|
||||
</test>
|
||||
<test logic="AND" value="1"> <!-- start charging cycle -->
|
||||
/systems/electrical/sources/bat-1/charge eq 1
|
||||
</test>
|
||||
<test logic="AND" value="1"> <!-- maintain charging cycle -->
|
||||
/systems/electrical/sources/bat-1/charge eq 1
|
||||
/controls/electrical/switches/bat-1 eq 1
|
||||
/systems/electrical/sources/bat-1/contact eq 1
|
||||
/systems/electrical/bus/dc-bat gt 27.5
|
||||
/systems/electrical/sources/bat-1/percent-calc lt 99.9
|
||||
</test>
|
||||
<test logic="AND" value="0">
|
||||
/systems/electrical/sources/bat-1/charge eq 0
|
||||
</test>
|
||||
</switch>
|
||||
|
||||
<switch name="/systems/electrical/sources/bat-1/charge">
|
||||
<default value="/systems/electrical/sources/bat-1/charge"/>
|
||||
<test logic="AND" value="0"> <!-- end charging cycle -->
|
||||
/systems/electrical/sources/bat-1/charge eq 1
|
||||
<test logic="OR">
|
||||
/controls/electrical/switches/bat-1 eq 0
|
||||
/systems/electrical/bus/dc-bat lt 27.5
|
||||
/systems/electrical/sources/bat-1/percent-calc ge 99.9
|
||||
</test>
|
||||
</test>
|
||||
<test logic="AND" value="1"> <!-- start charging cycle -->
|
||||
/controls/electrical/switches/bat-1 eq 1
|
||||
/systems/electrical/sources/bat-1/contact eq 0
|
||||
/systems/electrical/sources/bat-1/volt lt 26.5
|
||||
/systems/electrical/bus/dc-bat gt 27.5
|
||||
</test>
|
||||
</switch>
|
||||
|
||||
<switch name="/systems/electrical/sources/bat-1/direction">
|
||||
<default value="0"/>
|
||||
<test value="0">
|
||||
/systems/electrical/sources/bat-1/contact eq 0
|
||||
</test>
|
||||
<test logic="AND" value="1"> <!-- drain -->
|
||||
/systems/electrical/sources/bat-1/contact eq 1
|
||||
<test logic="OR">
|
||||
<test logic="AND">
|
||||
/systems/electrical/bus/dc-bat-src ne 1
|
||||
/systems/electrical/bus/dc-bat-src ne 2
|
||||
</test>
|
||||
/systems/apu/start eq 1
|
||||
</test>
|
||||
</test>
|
||||
<test logic="AND" value="-1"> <!-- charge -->
|
||||
/systems/electrical/sources/bat-1/contact eq 1
|
||||
/systems/electrical/bus/dc-bat-src ne 3
|
||||
</test>
|
||||
</switch>
|
||||
|
||||
<fcs_function name="/systems/electrical/sources/bat-1/percent-calc">
|
||||
<function>
|
||||
<ifthen>
|
||||
<eq>
|
||||
<property>/systems/electrical/sources/bat-1/direction</property>
|
||||
<value>0</value>
|
||||
</eq>
|
||||
<property>/systems/electrical/sources/bat-1/percent-calc</property>
|
||||
<ifthen>
|
||||
<eq>
|
||||
<property>/systems/electrical/sources/bat-1/direction</property>
|
||||
<value>-1</value>
|
||||
</eq>
|
||||
<sum>
|
||||
<property>/systems/electrical/sources/bat-1/percent</property>
|
||||
<product>
|
||||
<quotient>
|
||||
<value>2.25</value>
|
||||
<sum>
|
||||
<property>/systems/electrical/sources/bat-1/percent</property>
|
||||
<value>1</value>
|
||||
</sum>
|
||||
</quotient>
|
||||
<property>simulation/channel-dt</property>
|
||||
</product>
|
||||
</sum>
|
||||
<sum>
|
||||
<property>/systems/electrical/sources/bat-1/percent</property>
|
||||
<product>
|
||||
<quotient>
|
||||
<value>-0.75</value>
|
||||
<sum>
|
||||
<property>/systems/electrical/sources/bat-1/percent</property>
|
||||
<value>1</value>
|
||||
</sum>
|
||||
</quotient>
|
||||
<property>simulation/channel-dt</property>
|
||||
</product>
|
||||
</sum>
|
||||
</ifthen>
|
||||
</ifthen>
|
||||
</function>
|
||||
<output>/systems/electrical/sources/bat-1/percent</output>
|
||||
</fcs_function>
|
||||
|
||||
<switch name="/systems/electrical/sources/bat-1/load-kw">
|
||||
<default value="0"/>
|
||||
<test logic="AND" value="0.864">
|
||||
/systems/apu/start eq 1
|
||||
/systems/electrical/sources/bat-1/contact eq 1
|
||||
</test>
|
||||
<test logic="AND" value="1.15"> <!-- 60 amp * 0.8 * 24V = 1.15kw. Guess -->
|
||||
/systems/electrical/bus/dc-bat-src ne 1
|
||||
/systems/electrical/bus/dc-bat-src ne 2
|
||||
/systems/electrical/sources/bat-1/contact eq 1
|
||||
</test>
|
||||
</switch>
|
||||
|
||||
<switch name="/systems/electrical/sources/bat-1/amps">
|
||||
<default value="0"/>
|
||||
<test logic="AND" value="40">
|
||||
/systems/electrical/sources/bat-1/load-kw ne 0
|
||||
</test>
|
||||
<test logic="AND" value="2">
|
||||
/systems/electrical/sources/bat-1/contact eq 1
|
||||
</test>
|
||||
</switch>
|
||||
|
||||
<!-- Battery 2 -->
|
||||
<fcs_function name="/systems/electrical/sources/bat-2/volt">
|
||||
<function>
|
||||
<table>
|
||||
<independentVar lookup="row">/systems/electrical/sources/bat-2/percent</independentVar>
|
||||
<independentVar lookup="column">/systems/failures/electrical/bat-2</independentVar>
|
||||
<tableData>
|
||||
0 1
|
||||
0 0.0 0.0
|
||||
10 24.0 4.0
|
||||
50 25.5 5.0
|
||||
100 31.0 7.0
|
||||
</tableData>
|
||||
</table>
|
||||
<product>
|
||||
<difference>
|
||||
<value>1</value>
|
||||
<product>
|
||||
<property>/systems/electrical/sources/bat-2/amps</property>
|
||||
<value>0.00016666</value>
|
||||
</product>
|
||||
</difference>
|
||||
<table>
|
||||
<independentVar lookup="row">/systems/electrical/sources/bat-2/percent</independentVar>
|
||||
<independentVar lookup="column">/systems/failures/electrical/bat-2</independentVar>
|
||||
<tableData>
|
||||
0 1
|
||||
0 0.0 0.0
|
||||
10 24.0 4.0
|
||||
50 25.5 5.0
|
||||
100 31.0 7.0
|
||||
</tableData>
|
||||
</table>
|
||||
</product>
|
||||
</function>
|
||||
</fcs_function>
|
||||
|
||||
<switch name="/systems/electrical/sources/bat-2/amp"> <!-- TODO: should relate to load -->
|
||||
<default value="0"/>
|
||||
<test logic="AND" value="2">
|
||||
/systems/electrical/sources/bat-2/limiter eq 1
|
||||
<switch name="/systems/electrical/sources/bat-2/contact">
|
||||
<default value="/systems/electrical/sources/bat-2/contact"/>
|
||||
<test logic="OR" value="0"> <!-- discharge protection or switch turned off -->
|
||||
/controls/electrical/switches/bat-2 eq 0
|
||||
/systems/electrical/sources/bat-2/volt lt 23
|
||||
/systems/electrical/sources/bat-2/amps ge 100
|
||||
</test>
|
||||
<test logic="AND" value="1"> <!-- apu start -->
|
||||
/controls/electrical/switches/bat-2 eq 1
|
||||
/systems/electrical/sources/bat-2/volt ge 10
|
||||
/systems/apu/start eq 1
|
||||
</test>
|
||||
<test logic="AND" value="1"> <!-- connect to dc-bat while no other power on the ground -->
|
||||
/controls/electrical/switches/bat-2 eq 1
|
||||
/systems/electrical/bus/ac-1 lt 110
|
||||
/systems/electrical/bus/ac-2 lt 110
|
||||
/gear/gear[1]/wow eq 1
|
||||
/instrumentation/airspeed-indicator/indicated-speed-kt lt 100
|
||||
</test>
|
||||
<test logic="AND" value="1"> <!-- start charging cycle -->
|
||||
/systems/electrical/sources/bat-2/charge eq 1
|
||||
</test>
|
||||
<test logic="AND" value="1"> <!-- maintain charging cycle -->
|
||||
/systems/electrical/sources/bat-2/charge eq 1
|
||||
/controls/electrical/switches/bat-2 eq 1
|
||||
/systems/electrical/sources/bat-2/contact eq 1
|
||||
/systems/electrical/bus/dc-bat gt 27.5
|
||||
/systems/electrical/sources/bat-2/percent-calc lt 99.9
|
||||
</test>
|
||||
<test logic="AND" value="0">
|
||||
/systems/electrical/sources/bat-2/charge eq 0
|
||||
</test>
|
||||
</switch>
|
||||
|
||||
<switch name="/systems/electrical/sources/bat-2/charge">
|
||||
<default value="/systems/electrical/sources/bat-2/charge"/>
|
||||
<test logic="AND" value="0"> <!-- end charging cycle -->
|
||||
/systems/electrical/sources/bat-2/charge eq 1
|
||||
<test logic="OR">
|
||||
/controls/electrical/switches/bat-2 eq 0
|
||||
/systems/electrical/bus/dc-bat lt 27.5
|
||||
/systems/electrical/sources/bat-2/percent-calc ge 99.9
|
||||
</test>
|
||||
</test>
|
||||
<test logic="AND" value="1"> <!-- start charging cycle -->
|
||||
/controls/electrical/switches/bat-2 eq 1
|
||||
/systems/electrical/sources/bat-2/contact eq 0
|
||||
/systems/electrical/sources/bat-2/volt lt 26.5
|
||||
/systems/electrical/bus/dc-bat gt 27.5
|
||||
</test>
|
||||
</switch>
|
||||
|
||||
<switch name="/systems/electrical/sources/bat-2/direction">
|
||||
<default value="0"/>
|
||||
<test value="0">
|
||||
/systems/electrical/sources/bat-2/contact eq 0
|
||||
</test>
|
||||
<test logic="AND" value="1"> <!-- drain -->
|
||||
/systems/electrical/sources/bat-2/contact eq 1
|
||||
<test logic="OR">
|
||||
<test logic="AND">
|
||||
/systems/electrical/bus/dc-bat-src ne 1
|
||||
/systems/electrical/bus/dc-bat-src ne 2
|
||||
</test>
|
||||
/systems/apu/start eq 1
|
||||
</test>
|
||||
</test>
|
||||
<test logic="AND" value="-1"> <!-- charge -->
|
||||
/systems/electrical/sources/bat-2/contact eq 1
|
||||
/systems/electrical/bus/dc-bat-src ne 3
|
||||
</test>
|
||||
</switch>
|
||||
|
||||
<fcs_function name="/systems/electrical/sources/bat-2/percent-calc">
|
||||
<function>
|
||||
<ifthen>
|
||||
<eq>
|
||||
<property>/systems/electrical/sources/bat-2/direction</property>
|
||||
<value>0</value>
|
||||
</eq>
|
||||
<property>/systems/electrical/sources/bat-2/percent-calc</property>
|
||||
<ifthen>
|
||||
<eq>
|
||||
<property>/systems/electrical/sources/bat-2/direction</property>
|
||||
<value>-1</value>
|
||||
</eq>
|
||||
<sum>
|
||||
<property>/systems/electrical/sources/bat-2/percent</property>
|
||||
<product>
|
||||
<quotient>
|
||||
<value>2.25</value>
|
||||
<sum>
|
||||
<property>/systems/electrical/sources/bat-2/percent</property>
|
||||
<value>1</value>
|
||||
</sum>
|
||||
</quotient>
|
||||
<property>simulation/channel-dt</property>
|
||||
</product>
|
||||
</sum>
|
||||
<sum>
|
||||
<property>/systems/electrical/sources/bat-2/percent</property>
|
||||
<product>
|
||||
<quotient>
|
||||
<value>-0.75</value>
|
||||
<sum>
|
||||
<property>/systems/electrical/sources/bat-2/percent</property>
|
||||
<value>1</value>
|
||||
</sum>
|
||||
</quotient>
|
||||
<property>simulation/channel-dt</property>
|
||||
</product>
|
||||
</sum>
|
||||
</ifthen>
|
||||
</ifthen>
|
||||
</function>
|
||||
<output>/systems/electrical/sources/bat-2/percent</output>
|
||||
</fcs_function>
|
||||
|
||||
<switch name="/systems/electrical/sources/bat-2/load-kw">
|
||||
<default value="0"/>
|
||||
<test logic="AND" value="0.864">
|
||||
/systems/apu/start eq 1
|
||||
/systems/electrical/sources/bat-2/contact eq 1
|
||||
</test>
|
||||
<test logic="AND" value="1.15"> <!-- 60 amp * 0.8 * 24V = 1.15kw. Guess -->
|
||||
/systems/electrical/bus/dc-bat-src ne 1
|
||||
/systems/electrical/bus/dc-bat-src ne 2
|
||||
/systems/electrical/sources/bat-2/contact eq 1
|
||||
</test>
|
||||
</switch>
|
||||
|
||||
<switch name="/systems/electrical/sources/bat-2/amps">
|
||||
<default value="0"/>
|
||||
<test logic="AND" value="40">
|
||||
/systems/electrical/sources/bat-2/load-kw ne 0
|
||||
</test>
|
||||
<test logic="AND" value="2">
|
||||
/systems/electrical/sources/bat-2/contact eq 1
|
||||
</test>
|
||||
</switch>
|
||||
|
||||
|
@ -360,7 +640,7 @@
|
|||
</fcs_function>
|
||||
|
||||
<pure_gain name="/systems/electrical/sources/si-1/output-volt">
|
||||
<input>/systems/electrical/sources/bat-1/volt</input>
|
||||
<input>/systems/electrical/sources/bat-1/volt</input> <!-- inverter feeds directly from batteries -->
|
||||
<gain>/systems/electrical/sources/si-1/inverter-gain</gain>
|
||||
</pure_gain>
|
||||
|
||||
|
@ -1293,12 +1573,12 @@
|
|||
|
||||
<!-- Hot Buses -->
|
||||
<pure_gain name="/systems/electrical/bus/dc-hot-1">
|
||||
<input>/systems/electrical/sources/bat-1/volt</input>
|
||||
<input>/systems/electrical/sources/bat-1/volt</input> <!-- todo CB 12PB1 / 5PB1 -->
|
||||
<gain>1.0</gain>
|
||||
</pure_gain>
|
||||
|
||||
<pure_gain name="/systems/electrical/bus/dc-hot-2">
|
||||
<input>/systems/electrical/sources/bat-2/volt</input>
|
||||
<input>/systems/electrical/sources/bat-2/volt</input> <!-- todo CB 12PB2 / 5PB2 -->
|
||||
<gain>1.0</gain>
|
||||
</pure_gain>
|
||||
|
||||
|
|
Loading…
Reference in a new issue