1
0
Fork 0

Bugfix + improve

This commit is contained in:
legoboyvdlp R 2019-11-08 18:22:29 +00:00
parent 6d1ddcbd4b
commit ff70da0438
6 changed files with 77 additions and 32 deletions

View file

@ -937,6 +937,8 @@
<refuel>
<refuelling type="bool">0</refuelling>
</refuel>
<fuel-used-1 type="double">0</fuel-used-1>
<fuel-used-2 type="double">0</fuel-used-2>
</fuel>
<hydraulic n="0">
<blue-psi>0</blue-psi>

View file

@ -111,11 +111,8 @@ var switch_pack1 = props.globals.getNode("/controls/pneumatic/switches/pack1", 1
var switch_pack2 = props.globals.getNode("/controls/pneumatic/switches/pack2", 1);
var oil_qt1_actual = props.globals.getNode("/engines/engine[0]/oil-qt-actual", 1);
var oil_qt2_actual = props.globals.getNode("/engines/engine[1]/oil-qt-actual", 1);
var fuel_used_lbs1 = props.globals.getNode("/fdm/jsbsim/propulsion/engine[0]/fuel-used-lbs", 1);
var fuel_used_lbs2 = props.globals.getNode("/fdm/jsbsim/propulsion/engine[1]/fuel-used-lbs", 1);
var fuel_left_quantity = props.globals.getNode("/consumables/fuel/tank[0]/level-lbs", 1);
var fuel_center_quantity = props.globals.getNode("/consumables/fuel/tank[1]/level-lbs", 1);
var fuel_right_quantity = props.globals.getNode("/consumables/fuel/tank[2]/level-lbs", 1);
var fuel_used_lbs1 = props.globals.getNode("/systems/fuel/fuel-used-1", 1);
var fuel_used_lbs2 = props.globals.getNode("/systems/fuel/fuel-used-2", 1);
var doorL1_pos = props.globals.getNode("sim/model/door-positions/doorl1/position-norm", 1);
var doorR1_pos = props.globals.getNode("sim/model/door-positions/doorr1/position-norm", 1);
var doorL4_pos = props.globals.getNode("sim/model/door-positions/doorl4/position-norm", 1);
@ -2241,17 +2238,21 @@ var canvas_lowerECAM_fuel = {
update: func() {
# if (getprop("engines/engine[0]/n1-actual") < getprop("/controls/engines/idle-limit")) {
if (eng1_n1.getValue() <= 18.9) {
if (eng1_n1.getValue() <= 18.8) {
me["ENG1idFFlow"].setColor(0.7333,0.3803,0);
me["FUEL-ENG-1-label"].setColor(0.7333,0.3803,0);
} else {
me["ENG1idFFlow"].setColor(0.8078,0.8039,0.8078);
me["FUEL-ENG-1-label"].setColor(0.8078,0.8039,0.8078);
}
# if (getprop("engines/engine[1]/n1-actual") < getprop("/controls/engines/idle-limit")) {
if (eng2_n1.getValue() <= 18.9) {
if (eng2_n1.getValue() <= 18.5) {
me["ENG2idFFlow"].setColor(0.7333,0.3803,0);
me["FUEL-ENG-2-label"].setColor(0.7333,0.3803,0);
} else {
me["ENG2idFFlow"].setColor(0.8078,0.8039,0.8078);
me["FUEL-ENG-2-label"].setColor(0.8078,0.8039,0.8078);
}
# TODO add FOB half-boxed amber if some fuel is blocked
@ -2267,27 +2268,29 @@ var canvas_lowerECAM_fuel = {
# TODO use the valve prop and add amber if difference between eng master and valve
# TODO add transition state
# TODO fix amber/green at the same time when closed
if (systems.FUEL.Valves.lpValve1.getValue() == 1) {
me["FUEL-ENG-Master-1"].setRotation(0);
me["FUEL-ENG-Master-1"].setColor(0.0509,0.7529,0.2941);
me["FUEL-ENG-Master-1"].setColorFill(0.0509,0.7529,0.2941);
me["FUEL-ENG-1-pipe"].setColor(0.0509,0.7529,0.2941);
} else {
me["FUEL-ENG-Master-1"].setRotation(90 * D2R);
me["FUEL-ENG-Master-1"].setColor(0.7333,0.3803,0);
me["FUEL-ENG-Master-1"].setColorFill(0.7333,0.3803,0);
me["FUEL-ENG-1-pipe"].setColor(0.7333,0.3803,0);
}
# TODO use the valve prop and add amber if difference between eng master and valve
# TODO add transition state
# TODO fix amber/green at the same time when closed
if (systems.FUEL.Valves.lpValve2.getValue() == 1) {
me["FUEL-ENG-Master-2"].setRotation(0);
me["FUEL-ENG-Master-2"].setColor(0.0509,0.7529,0.2941);
me["FUEL-ENG-Master-2"].setColorFill(0.0509,0.7529,0.2941);
me["FUEL-ENG-2-pipe"].setColor(0.0509,0.7529,0.2941);
} else {
me["FUEL-ENG-Master-2"].setRotation(90 * D2R);
me["FUEL-ENG-Master-2"].setColor(0.7333,0.3803,0);
me["FUEL-ENG-Master-2"].setColorFill(0.7333,0.3803,0);
me["FUEL-ENG-2-pipe"].setColor(0.7333,0.3803,0);
}
@ -2304,75 +2307,81 @@ var canvas_lowerECAM_fuel = {
}
# TODO add LO indication
# TODO fix amber/green at the same time when closed
if (systems.FUEL.Switches.pumpLeft1.getValue() == 1) {
me["FUEL-Pump-Left-1-Open"].show();
me["FUEL-Pump-Left-1-Closed"].hide();
me["FUEL-Pump-Left-1"].setColor(0.0509,0.7529,0.2941);
me["FUEL-Pump-Left-1"].setColorFill(0.0509,0.7529,0.2941);
} else {
me["FUEL-Pump-Left-1-Open"].hide();
me["FUEL-Pump-Left-1-Closed"].show();
me["FUEL-Pump-Left-1"].setColor(0.7333,0.3803,0);
me["FUEL-Pump-Left-1"].setColorFill(0.7333,0.3803,0);
}
# TODO add LO indication
# TODO fix amber/green at the same time when closed
if (systems.FUEL.Switches.pumpLeft2.getValue() == 1) {
me["FUEL-Pump-Left-2-Open"].show();
me["FUEL-Pump-Left-2-Closed"].hide();
me["FUEL-Pump-Left-2"].setColor(0.0509,0.7529,0.2941);
me["FUEL-Pump-Left-2"].setColorFill(0.0509,0.7529,0.2941);
} else {
me["FUEL-Pump-Left-2-Open"].hide();
me["FUEL-Pump-Left-2-Closed"].show();
me["FUEL-Pump-Left-2"].setColor(0.7333,0.3803,0);
me["FUEL-Pump-Left-2"].setColorFill(0.7333,0.3803,0);
}
# TODO fix amber/green at the same time when closed
# TODO add functionality to match FCOM 1.28.20 "Amber: Transfer valve is open, whereas commanded closed in automatic or manual mode"
if (systems.FUEL.Switches.pumpCenter1.getValue() == 1) {
me["FUEL-Pump-Center-1-Open"].show();
me["FUEL-Pump-Center-1-Closed"].hide();
me["FUEL-Pump-Center-1"].setColor(0.0509,0.7529,0.2941);
me["FUEL-Pump-Center-1"].setColorFill(0.0509,0.7529,0.2941);
} else {
me["FUEL-Pump-Center-1-Open"].hide();
me["FUEL-Pump-Center-1-Closed"].show();
me["FUEL-Pump-Center-1"].setColor(0.7333,0.3803,0);
me["FUEL-Pump-Center-1"].setColorFill(0.7333,0.3803,0);
}
# TODO add LO indication
# TODO fix amber/green at the same time when closed
if (systems.FUEL.Switches.pumpCenter2.getValue() == 1) {
me["FUEL-Pump-Center-2-Open"].show();
me["FUEL-Pump-Center-2-Closed"].hide();
me["FUEL-Pump-Center-2"].setColor(0.0509,0.7529,0.2941);
me["FUEL-Pump-Center-2"].setColorFill(0.0509,0.7529,0.2941);
} else {
me["FUEL-Pump-Center-2-Open"].hide();
me["FUEL-Pump-Center-2-Closed"].show();
me["FUEL-Pump-Center-2"].setColor(0.7333,0.3803,0);
me["FUEL-Pump-Center-2"].setColorFill(0.7333,0.3803,0);
}
# TODO add LO indication
# TODO fix amber/green at the same time when closed
if (systems.FUEL.Switches.pumpRight1.getValue() == 1) {
me["FUEL-Pump-Right-1-Open"].show();
me["FUEL-Pump-Right-1-Closed"].hide();
me["FUEL-Pump-Right-1"].setColor(0.0509,0.7529,0.2941);
me["FUEL-Pump-Right-1"].setColorFill(0.0509,0.7529,0.2941);
} else {
me["FUEL-Pump-Right-1-Open"].hide();
me["FUEL-Pump-Right-1-Closed"].show();
me["FUEL-Pump-Right-1"].setColor(0.7333,0.3803,0);
me["FUEL-Pump-Right-1"].setColorFill(0.7333,0.3803,0);
}
# TODO add LO indication
# TODO fix amber/green at the same time when closed
if (systems.FUEL.Switches.pumpRight2.getValue() == 1) {
me["FUEL-Pump-Right-2-Open"].show();
me["FUEL-Pump-Right-2-Closed"].hide();
me["FUEL-Pump-Right-2"].setColor(0.0509,0.7529,0.2941);
me["FUEL-Pump-Right-2"].setColorFill(0.0509,0.7529,0.2941);
} else {
me["FUEL-Pump-Right-2-Open"].hide();
me["FUEL-Pump-Right-2-Closed"].show();
me["FUEL-Pump-Right-2"].setColor(0.7333,0.3803,0);
me["FUEL-Pump-Right-2"].setColorFill(0.7333,0.3803,0);
}
# Fuel Used
@ -2394,27 +2403,38 @@ var canvas_lowerECAM_fuel = {
me["FUEL-Right-Inner-quantity"].setText(sprintf("%s", math.round(systems.FUEL.Quantity.rightInner.getValue(), 10)));
me["FUEL-Right-Outer-quantity"].setText(sprintf("%s", math.round(systems.FUEL.Quantity.rightOuter.getValue(), 10)));
if (!systems.FUEL.Valves.transfer1.getValue()) {
if (systems.FUEL.Valves.transfer1.getValue() == 0) {
me["FUEL-Left-Transfer"].hide();
} else {
me["FUEL-Left-Transfer"].setColor(0.7333,0.3803,0);
if (systems.FUEL.Valves.transfer1.getValue() == 1) {
me["FUEL-Left-Transfer"].setColor(0.0509,0.7529,0.2941);
} else {
me["FUEL-Left-Transfer"].setColor(0.7333,0.3803,0);
}
me["FUEL-Left-Transfer"].show();
}
if (!systems.FUEL.Valves.transfer2.getValue()) {
if (systems.FUEL.Valves.transfer2.getValue() == 0) {
me["FUEL-Right-Transfer"].hide();
} else {
me["FUEL-Right-Transfer"].setColor(0.7333,0.3803,0);
if (systems.FUEL.Valves.transfer2.getValue() == 1) {
me["FUEL-Right-Transfer"].setColor(0.0509,0.7529,0.2941);
} else {
me["FUEL-Right-Transfer"].setColor(0.7333,0.3803,0);
}
me["FUEL-Right-Transfer"].show();
}
if (!systems.FUEL.Switches.pumpCenter1.getValue() and !systems.FUEL.Switches.pumpCenter2.getValue()) {
me["FUEL-Center-blocked"].show();
} else {
me["FUEL-Center-blocked"].hide();
}
# Hide not yet implemented features
# TODO add them
me["FUEL-Left-blocked"].hide();
me["FUEL-Right-blocked"].hide();
me["FUEL-Center-blocked"].hide();
me["FUEL-Left-Outer-Inacc"].hide();
me["FUEL-Left-Inner-Inacc"].hide();
me["FUEL-Right-Outer-Inacc"].hide();

View file

@ -12,7 +12,7 @@
viewBox="0 0 1024 1024"
version="1.1"
id="svg2"
inkscape:version="0.92.2 (5c3e80d, 2017-08-06)"
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"
sodipodi:docname="fuel.svg">
<metadata
id="metadata375">
@ -49,9 +49,9 @@
inkscape:window-height="705"
id="namedview371"
showgrid="false"
inkscape:zoom="2.0852713"
inkscape:cx="56"
inkscape:cy="255"
inkscape:zoom="0.68"
inkscape:cx="817.73616"
inkscape:cy="1022.6281"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
@ -413,8 +413,9 @@
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#cecdce;fill-opacity:1;stroke:none;stroke-width:1.12171543"
x="768.26727"
y="57.18037"
id="text5073-0"
transform="scale(0.95537765,1.0467065)"><tspan
id="FUEL-ENG-2-label"
transform="scale(0.95537765,1.0467065)"
inkscape:label="#text5073-0"><tspan
sodipodi:role="line"
id="tspan5093"
x="768.26727"

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 69 KiB

View file

@ -4,6 +4,8 @@
# Copyright (c) 2019 Joshua Davidson (Octal450)
var FUEL = {
offset1: 0,
offset2: 0,
timeEngStart: 0,
cmdCtrOn: props.globals.getNode("/systems/fuel/ctr-pump-cmd-on-eng-start"),
@ -32,6 +34,8 @@ var FUEL = {
center: props.globals.getNode("/consumables/fuel/tank[2]/level-lbs"),
rightInner: props.globals.getNode("/consumables/fuel/tank[3]/level-lbs"),
rightOuter: props.globals.getNode("/consumables/fuel/tank[4]/level-lbs"),
usedLeft: props.globals.getNode("/systems/fuel/fuel-used-1"),
usedRight: props.globals.getNode("/systems/fuel/fuel-used-2"),
},
resetFail: func() {
@ -40,8 +44,13 @@ var FUEL = {
},
loop: func() {
systems.FUEL.Quantity.usedLeft.setValue(pts.JSBSim.Propulsion.Engine1.fuelUsed.getValue() + me.offset1);
systems.FUEL.Quantity.usedRight.setValue(pts.JSBSim.Propulsion.Engine2.fuelUsed.getValue() + me.offset2);
},
setOffset: func() {
me.offset1 = me.offset1 -(pts.JSBSim.Propulsion.Engine1.fuelUsed.getValue());
me.offset2 = me.offset2 -(pts.JSBSim.Propulsion.Engine2.fuelUsed.getValue());
}
};
setlistener("/engines/engine[0]/state", func() {

View file

@ -49,6 +49,17 @@ var Instrumentation = {
},
};
var JSBSim = {
Propulsion: {
Engine1: {
fuelUsed: props.globals.getNode("/fdm/jsbsim/propulsion/engine[0]/fuel-used-lbs"),
},
Engine2: {
fuelUsed: props.globals.getNode("/fdm/jsbsim/propulsion/engine[1]/fuel-used-lbs"),
},
},
};
var Options = {
eng: props.globals.getNode("/options/eng"),
};

View file

@ -171,8 +171,9 @@
/systems/fuel/valves/outer-inner-transfer-valve-1-cmd eq 1
/systems/fuel/refuel/refuelling eq 0
</test>
<test value="1">
<test logic="OR" value="1">
/systems/fuel/quantity/left-wing-inner-low eq 1
/systems/fuel/quantity/right-wing-inner-low eq 1
</test>
</switch>
@ -194,7 +195,8 @@
/systems/fuel/valves/outer-inner-transfer-valve-2-cmd eq 1
/systems/fuel/refuel/refuelling eq 0
</test>
<test value="1">
<test logic="OR" value="1">
/systems/fuel/quantity/left-wing-inner-low eq 1
/systems/fuel/quantity/right-wing-inner-low eq 1
</test>
</switch>
@ -527,8 +529,8 @@
</summer>
<summer name="/systems/fuel/internal/center-flow-rate">
<input>-/systems/fuel/internal/center-tank-left</input>
<input>-/systems/fuel/internal/center-tank-right</input>
<input>-/systems/fuel/internal/center-tank-eng-1</input>
<input>-/systems/fuel/internal/center-tank-eng-2</input>
<output>propulsion/tank[2]/external-flow-rate-pps</output>
</summer>