commit
84820e79e3
5 changed files with 1897 additions and 9 deletions
|
@ -319,6 +319,15 @@
|
|||
</script>
|
||||
</binding>
|
||||
</item>
|
||||
<item>
|
||||
<label>Refuel Panel</label>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script><![CDATA[
|
||||
Dialogs.refuelDialog.openDialog();
|
||||
]]></script>
|
||||
</binding>
|
||||
</item>
|
||||
<item>
|
||||
<label>Pushback</label>
|
||||
<binding>
|
||||
|
@ -651,6 +660,19 @@
|
|||
<pump-right-1 type="bool">0</pump-right-1>
|
||||
<pump-right-2 type="bool">0</pump-right-2>
|
||||
</switches>
|
||||
<refuel>
|
||||
<valve-l-guard type="bool">0</valve-l-guard>
|
||||
<valve-c-guard type="bool">0</valve-c-guard>
|
||||
<valve-r-guard type="bool">0</valve-r-guard>
|
||||
<mode-guard type="bool">0</mode-guard>
|
||||
<valve-l type="double">0.5</valve-l>
|
||||
<valve-c type="double">0.5</valve-c>
|
||||
<valve-r type="double">0.5</valve-r>
|
||||
<mode type="double">0.5</mode>
|
||||
<power type="bool">0</power>
|
||||
<test type="double">0.5</test>
|
||||
<amount type="double">12.0</amount>
|
||||
</refuel>
|
||||
</fuel>
|
||||
<gear>
|
||||
<brake-parking type="bool">0</brake-parking>
|
||||
|
@ -1716,6 +1738,9 @@
|
|||
<atc>
|
||||
<file>Aircraft/A320-family/Nasal/atc.nas</file>
|
||||
</atc>
|
||||
<Dialogs>
|
||||
<file>Aircraft/A320-family/gui/dialogs/refuel.nas</file>
|
||||
</Dialogs>
|
||||
</nasal>
|
||||
|
||||
</PropertyList>
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
# Jonathan Redpath
|
||||
|
||||
var fuelSvc = {
|
||||
_needCenter: 0,
|
||||
enable: props.globals.getNode("/services/fuel-truck/enable"),
|
||||
connect: props.globals.getNode("/services/fuel-truck/connect"),
|
||||
operate: props.globals.getNode("/services/fuel-truck/operate"),
|
||||
|
@ -34,17 +35,19 @@ var fuelSvc = {
|
|||
systems.FUEL.Valves.refuelRight.setBoolValue(1);
|
||||
|
||||
if (pts.Sim.aero.getValue() == "A320-200-CFM" and me.Nodes.requestTotalLbs.getValue() > 28229.9) {
|
||||
systems.FUEL.Valves.refuelCenter.setBoolValue(1);
|
||||
me._needCenter = 1;
|
||||
} elsif ((pts.Sim.aero.getValue() == "A320-200-IAE" or pts.Sim.aero.getValue() == "A320-100-CFM") and me.Nodes.requestTotalLbs.getValue() > 27591.8) {
|
||||
systems.FUEL.Valves.refuelCenter.setBoolValue(1);
|
||||
me._needCenter = 1;
|
||||
} elsif ((pts.Sim.aero.getValue() == "A320neo-CFM" or pts.Sim.aero.getValue() == "A320neo-PW") and me.Nodes.requestTotalLbs.getValue() > 27357.8) {
|
||||
systems.FUEL.Valves.refuelCenter.setBoolValue(1);
|
||||
me._needCenter = 1;
|
||||
} else {
|
||||
me._needCenter = 0;
|
||||
}
|
||||
},
|
||||
|
||||
stop: func() {
|
||||
systems.FUEL.refuelling.setBoolValue(0);
|
||||
me.Nodes.requestLbs.setValue(0);
|
||||
# me.Nodes.requestLbs.setValue(0);
|
||||
systems.FUEL.Valves.refuelLeft.setBoolValue(0);
|
||||
systems.FUEL.Valves.refuelCenter.setBoolValue(0);
|
||||
systems.FUEL.Valves.refuelRight.setBoolValue(0);
|
||||
|
@ -69,16 +72,40 @@ setlistener("/services/fuel-truck/connect", func() {
|
|||
}, 0, 0);
|
||||
|
||||
var fuelTimer = maketimer(0.25, func() {
|
||||
if (systems.FUEL.Quantity.leftInnerPct.getValue() >= 0.999) {
|
||||
if (Dialogs.valve_l.getValue() == 0.5) {
|
||||
if (systems.FUEL.Quantity.leftInnerPct.getValue() >= 0.999) {
|
||||
systems.FUEL.Valves.refuelLeft.setBoolValue(0);
|
||||
} else {
|
||||
systems.FUEL.Valves.refuelLeft.setBoolValue(1);
|
||||
}
|
||||
} elsif (Dialogs.valve_l.getValue() == 1.0 and systems.FUEL.Quantity.leftInnerPct.getValue() < 0.999) {
|
||||
systems.FUEL.Valves.refuelLeft.setBoolValue(1);
|
||||
} else {
|
||||
systems.FUEL.Valves.refuelLeft.setBoolValue(0);
|
||||
}
|
||||
|
||||
if (systems.FUEL.Quantity.centerPct.getValue() >= 0.999) {
|
||||
systems.FUEL.Valves.refuelCenter.setBoolValue(0);
|
||||
if (Dialogs.valve_r.getValue() == 0.5) {
|
||||
if (systems.FUEL.Quantity.rightInnerPct.getValue() >= 0.999) {
|
||||
systems.FUEL.Valves.refuelRight.setBoolValue(0);
|
||||
} else {
|
||||
systems.FUEL.Valves.refuelRight.setBoolValue(1);
|
||||
}
|
||||
} elsif (Dialogs.valve_r.getValue() == 1.0 and systems.FUEL.Quantity.rightInnerPct.getValue() < 0.999) {
|
||||
systems.FUEL.Valves.refuelRight.setBoolValue(1);
|
||||
} else {
|
||||
systems.FUEL.Valves.refuelRight.setBoolValue(0);
|
||||
}
|
||||
|
||||
if (systems.FUEL.Quantity.rightInnerPct.getValue() >= 0.999) {
|
||||
systems.FUEL.Valves.refuelRight.setBoolValue(0);
|
||||
if (Dialogs.valve_c.getValue() == 0.5 and fuelSvc._needCenter == 1) {
|
||||
if (systems.FUEL.Quantity.centerPct.getValue() >= 0.999 or systems.FUEL.Quantity.leftInnerPct.getValue() < 0.999 or systems.FUEL.Quantity.rightInnerPct.getValue() < 0.999) {
|
||||
systems.FUEL.Valves.refuelCenter.setBoolValue(0);
|
||||
} else {
|
||||
systems.FUEL.Valves.refuelCenter.setBoolValue(1);
|
||||
}
|
||||
} elsif (Dialogs.valve_c.getValue() == 1.0 and systems.FUEL.Quantity.centerPct.getValue() < 0.999) {
|
||||
systems.FUEL.Valves.refuelCenter.setBoolValue(1);
|
||||
} else {
|
||||
systems.FUEL.Valves.refuelCenter.setBoolValue(0);
|
||||
}
|
||||
|
||||
if (fuelSvc.Nodes.requestTotalLbs.getValue() - pts.Consumables.Fuel.totalFuelLbs.getValue() <= 0) {
|
||||
|
|
|
@ -623,6 +623,13 @@
|
|||
|
||||
<switch name="/systems/fuel/internal/left-wing-outer-to-inner-tank">
|
||||
<default value="0"/>
|
||||
<test logic="AND" value="/systems/fuel/internal/left-outer-wing-tank-refuel">
|
||||
/systems/fuel/valves/outer-inner-transfer-valve-1 eq 1
|
||||
/accelerations/pilot-gdamped ge 0.5
|
||||
/consumables/fuel/tank[0]/level-gal_us gt /consumables/fuel/tank[0]/unusable-gal_us
|
||||
/consumables/fuel/tank[1]/level-norm lt 0.9999
|
||||
/systems/fuel/refuel/refuelling eq 1
|
||||
</test>
|
||||
<test logic="AND" value="9">
|
||||
/systems/fuel/valves/outer-inner-transfer-valve-1 eq 1
|
||||
/accelerations/pilot-gdamped ge 0.5
|
||||
|
@ -633,6 +640,13 @@
|
|||
|
||||
<switch name="/systems/fuel/internal/right-wing-outer-to-inner-tank">
|
||||
<default value="0"/>
|
||||
<test logic="AND" value="/systems/fuel/internal/right-outer-wing-tank-refuel">
|
||||
/systems/fuel/valves/outer-inner-transfer-valve-2 eq 1
|
||||
/accelerations/pilot-gdamped ge 0.5
|
||||
/consumables/fuel/tank[4]/level-gal_us gt /consumables/fuel/tank[0]/unusable-gal_us
|
||||
/consumables/fuel/tank[3]/level-norm lt 0.9999
|
||||
/systems/fuel/refuel/refuelling eq 1
|
||||
</test>
|
||||
<test logic="AND" value="9">
|
||||
/systems/fuel/valves/outer-inner-transfer-valve-2 eq 1
|
||||
/accelerations/pilot-gdamped ge 0.5
|
||||
|
|
594
gui/dialogs/refuel.nas
Normal file
594
gui/dialogs/refuel.nas
Normal file
|
@ -0,0 +1,594 @@
|
|||
# A320 Refeul panel
|
||||
# merspieler
|
||||
|
||||
# Copyright (c) 2019 merspieler
|
||||
|
||||
# Distribute under the terms of GPLv2.
|
||||
|
||||
if (pts.Sim.aero.getValue() == "A320-200-CFM") {
|
||||
max_fuel = 42.8;
|
||||
} elsif (pts.Sim.aero.getValue() == "A320-200-IAE" or pts.Sim.aero.getValue() == "A320-100-CFM") {
|
||||
max_fuel = 42.2;
|
||||
} elsif (pts.Sim.aero.getValue() == "A320neo-CFM" or pts.Sim.aero.getValue() == "A320neo-PW") {
|
||||
max_fuel = 42.0;
|
||||
}
|
||||
|
||||
# Get nodes
|
||||
var valve_l_guard = props.globals.getNode("/controls/fuel/refuel/valve-l-guard", 1);
|
||||
var valve_c_guard = props.globals.getNode("/controls/fuel/refuel/valve-c-guard", 1);
|
||||
var valve_r_guard = props.globals.getNode("/controls/fuel/refuel/valve-r-guard", 1);
|
||||
var mode_guard = props.globals.getNode("/controls/fuel/refuel/mode-guard", 1);
|
||||
var valve_l = props.globals.getNode("/controls/fuel/refuel/valve-l", 1);
|
||||
var valve_c = props.globals.getNode("/controls/fuel/refuel/valve-c", 1);
|
||||
var valve_r = props.globals.getNode("/controls/fuel/refuel/valve-r", 1);
|
||||
var power = props.globals.getNode("/controls/fuel/refuel/power", 1);
|
||||
var test = props.globals.getNode("/controls/fuel/refuel/test", 1);
|
||||
var amount = props.globals.getNode("/controls/fuel/refuel/amount", 1);
|
||||
|
||||
var refuelClass = {
|
||||
_fuelLeftAmount: nil,
|
||||
_fuelCenterAmount: nil,
|
||||
_fuelRightAmount: nil,
|
||||
_fuelTotalAmount: nil,
|
||||
_fuelPreselectAmount: nil,
|
||||
new: func() {
|
||||
var m = {parents:[refuelClass]};
|
||||
m._title = "Refuel Panel";
|
||||
m._gfd = nil;
|
||||
m._canvas = nil;
|
||||
m._timer = maketimer(0.1, m, refuelClass._timerf);
|
||||
m._timerUp = maketimer(0.1, m, refuelClass._fuelAdjustUp);
|
||||
m._timerDn = maketimer(0.1, m, refuelClass._fuelAdjustDn);
|
||||
return m;
|
||||
},
|
||||
close: func() {
|
||||
me._timer.stop();
|
||||
me._timerUp.stop();
|
||||
me._timerDn.stop();
|
||||
|
||||
me._gfd.del();
|
||||
me._gfd = nil;
|
||||
},
|
||||
openDialog: func() {
|
||||
me._gfd = canvas.Window.new([320,375], "dialog");
|
||||
me._gfd._onClose = func() {refuelDialog._onClose();}
|
||||
|
||||
me._gfd.set("title", me._title);
|
||||
me._canvas = me._gfd.createCanvas();
|
||||
me._root = me._canvas.createGroup();
|
||||
|
||||
me._svg = me._root.createChild("group");
|
||||
canvas.parsesvg(me._svg, "Aircraft/A320-family/gui/dialogs/refuel.svg");
|
||||
|
||||
amount.setValue(math.round((pts.Consumables.Fuel.totalFuelLbs.getValue() + systems.fuelSvc.Nodes.requestLbs.getValue()) / 1000, 0.1));
|
||||
|
||||
me._HI_LVL_L = me._svg.getElementById("HI-LVL-L");
|
||||
me._HI_LVL_C = me._svg.getElementById("HI-LVL-C");
|
||||
me._HI_LVL_R = me._svg.getElementById("HI-LVL-R");
|
||||
me._Valve_defuel = me._svg.getElementById("Valve-defuel");
|
||||
|
||||
me._Valve_L_guard_open = me._svg.getElementById("Valve-L-guard-open");
|
||||
me._Valve_L_guard_closed = me._svg.getElementById("Valve-L-guard-closed");
|
||||
|
||||
me._Valve_C_guard_open = me._svg.getElementById("Valve-C-guard-open");
|
||||
me._Valve_C_guard_closed = me._svg.getElementById("Valve-C-guard-closed");
|
||||
|
||||
me._Valve_R_guard_open = me._svg.getElementById("Valve-R-guard-open");
|
||||
me._Valve_R_guard_closed = me._svg.getElementById("Valve-R-guard-closed");
|
||||
|
||||
me._Mode_guard_open = me._svg.getElementById("Mode-guard-open");
|
||||
me._Mode_guard_closed = me._svg.getElementById("Mode-guard-closed");
|
||||
|
||||
me._Power_on = me._svg.getElementById("Power-on");
|
||||
me._Power_norm = me._svg.getElementById("Power-norm");
|
||||
|
||||
me._Power_on_hb = me._svg.getElementById("Power-on-hb");
|
||||
me._Power_norm_hb = me._svg.getElementById("Power-norm-hb");
|
||||
|
||||
me._Pre_inc_hb = me._svg.getElementById("Pre-inc-hb");
|
||||
me._Pre_dec_hb = me._svg.getElementById("Pre-dec-hb");
|
||||
|
||||
me._Test_hi_lvl = me._svg.getElementById("Test-hi-lvl");
|
||||
me._Test_lts = me._svg.getElementById("Test-lts");
|
||||
me._Test_off = me._svg.getElementById("Test-off");
|
||||
|
||||
me._Test_hi_lvl_hb = me._svg.getElementById("Test-hi-lvl-hb");
|
||||
me._Test_lts_hb = me._svg.getElementById("Test-lts-hb");
|
||||
|
||||
me._Valve_L_open = me._svg.getElementById("Valve-L-open");
|
||||
me._Valve_L_norm = me._svg.getElementById("Valve-L-norm");
|
||||
me._Valve_L_shut = me._svg.getElementById("Valve-L-shut");
|
||||
|
||||
me._Valve_L_open_hb = me._svg.getElementById("Valve-L-open-hb");
|
||||
me._Valve_L_norm_hb = me._svg.getElementById("Valve-L-norm-hb");
|
||||
me._Valve_L_shut_hb = me._svg.getElementById("Valve-L-shut-hb");
|
||||
|
||||
me._Valve_C_open = me._svg.getElementById("Valve-C-open");
|
||||
me._Valve_C_norm = me._svg.getElementById("Valve-C-norm");
|
||||
me._Valve_C_shut = me._svg.getElementById("Valve-C-shut");
|
||||
|
||||
me._Valve_C_open_hb = me._svg.getElementById("Valve-C-open-hb");
|
||||
me._Valve_C_norm_hb = me._svg.getElementById("Valve-C-norm-hb");
|
||||
me._Valve_C_shut_hb = me._svg.getElementById("Valve-C-shut-hb");
|
||||
|
||||
me._Valve_R_open = me._svg.getElementById("Valve-R-open");
|
||||
me._Valve_R_norm = me._svg.getElementById("Valve-R-norm");
|
||||
me._Valve_R_shut = me._svg.getElementById("Valve-R-shut");
|
||||
|
||||
me._Valve_R_open_hb = me._svg.getElementById("Valve-R-open-hb");
|
||||
me._Valve_R_norm_hb = me._svg.getElementById("Valve-R-norm-hb");
|
||||
me._Valve_R_shut_hb = me._svg.getElementById("Valve-R-shut-hb");
|
||||
|
||||
me._Mode_refuel = me._svg.getElementById("Mode-refuel");
|
||||
me._Mode_off = me._svg.getElementById("Mode-off");
|
||||
me._Mode_defuel = me._svg.getElementById("Mode-defuel");
|
||||
|
||||
me._Mode_refuel_hb = me._svg.getElementById("Mode-refuel-hb");
|
||||
me._Mode_off_hb = me._svg.getElementById("Mode-off-hb");
|
||||
me._Mode_defuel_hb = me._svg.getElementById("Mode-defuel-hb");
|
||||
|
||||
me._FQI_actual = me._svg.getElementById("FQI-actual");
|
||||
me._FQI_pre = me._svg.getElementById("FQI-pre");
|
||||
me._FQI_L = me._svg.getElementById("FQI-L");
|
||||
me._FQI_C = me._svg.getElementById("FQI-C");
|
||||
me._FQI_R = me._svg.getElementById("FQI-R");
|
||||
|
||||
me._END_ind = me._svg.getElementById("END-ind");
|
||||
|
||||
# Load current panel state
|
||||
# Guards
|
||||
if (valve_l_guard.getValue() == 1) {
|
||||
me._Valve_L_guard_open.show();
|
||||
me._Valve_L_guard_closed.hide();
|
||||
} else {
|
||||
me._Valve_L_guard_open.hide();
|
||||
me._Valve_L_guard_closed.show();
|
||||
}
|
||||
|
||||
if (valve_l_guard.getValue() == 1) {
|
||||
me._Valve_C_guard_open.show();
|
||||
me._Valve_C_guard_closed.hide();
|
||||
} else {
|
||||
me._Valve_C_guard_open.hide();
|
||||
me._Valve_C_guard_closed.show();
|
||||
}
|
||||
|
||||
if (valve_l_guard.getValue() == 1) {
|
||||
me._Valve_R_guard_open.show();
|
||||
me._Valve_R_guard_closed.hide();
|
||||
} else {
|
||||
me._Valve_R_guard_open.hide();
|
||||
me._Valve_R_guard_closed.show();
|
||||
}
|
||||
|
||||
if (systems.FUEL.refuelling.getValue() == 1) {
|
||||
me._Mode_guard_open.show();
|
||||
me._Mode_guard_closed.hide();
|
||||
} else {
|
||||
me._Mode_guard_open.hide();
|
||||
me._Mode_guard_closed.show();
|
||||
}
|
||||
|
||||
# Switches
|
||||
if (power.getValue() == 1) {
|
||||
me._Power_on.show();
|
||||
me._Power_norm.hide();
|
||||
} else {
|
||||
me._Power_on.hide();
|
||||
me._Power_norm.show();
|
||||
}
|
||||
|
||||
if (test.getValue() == 1) {
|
||||
me._Test_hi_lvl.show();
|
||||
me._Test_off.hide();
|
||||
me._Test_lts.hide();
|
||||
} else if (test.getValue() == 0.5) {
|
||||
me._Test_hi_lvl.hide();
|
||||
me._Test_off.show();
|
||||
me._Test_lts.hide();
|
||||
} else {
|
||||
me._Test_hi_lvl.hide();
|
||||
me._Test_off.hide();
|
||||
me._Test_lts.show();
|
||||
}
|
||||
|
||||
if (valve_l.getValue() == 1) {
|
||||
me._Valve_L_open.show();
|
||||
me._Valve_L_norm.hide();
|
||||
me._Valve_L_shut.hide();
|
||||
} else if (valve_l.getValue() == 0.5) {
|
||||
me._Valve_L_open.hide();
|
||||
me._Valve_L_norm.show();
|
||||
me._Valve_L_shut.hide();
|
||||
} else {
|
||||
me._Valve_L_open.hide();
|
||||
me._Valve_L_norm.hide();
|
||||
me._Valve_L_shut.show();
|
||||
}
|
||||
|
||||
if (valve_c.getValue() == 1) {
|
||||
me._Valve_C_open.show();
|
||||
me._Valve_C_norm.hide();
|
||||
me._Valve_C_shut.hide();
|
||||
} else if (valve_c.getValue() == 0.5) {
|
||||
me._Valve_C_open.hide();
|
||||
me._Valve_C_norm.show();
|
||||
me._Valve_C_shut.hide();
|
||||
} else {
|
||||
me._Valve_C_open.hide();
|
||||
me._Valve_C_norm.hide();
|
||||
me._Valve_C_shut.show();
|
||||
}
|
||||
|
||||
if (valve_r.getValue() == 1) {
|
||||
me._Valve_R_open.show();
|
||||
me._Valve_R_norm.hide();
|
||||
me._Valve_R_shut.hide();
|
||||
} else if (valve_r.getValue() == 0.5) {
|
||||
me._Valve_R_open.hide();
|
||||
me._Valve_R_norm.show();
|
||||
me._Valve_R_shut.hide();
|
||||
} else {
|
||||
me._Valve_R_open.hide();
|
||||
me._Valve_R_norm.hide();
|
||||
me._Valve_R_shut.show();
|
||||
}
|
||||
|
||||
if (systems.FUEL.refuelling.getValue()) {
|
||||
me._Mode_refuel.show();
|
||||
me._Mode_off.hide();
|
||||
me._Mode_defuel.hide();
|
||||
} else {
|
||||
me._Mode_refuel.hide();
|
||||
me._Mode_off.show();
|
||||
me._Mode_defuel.hide();
|
||||
}
|
||||
|
||||
me._Mode_defuel.hide();
|
||||
|
||||
# Listeners
|
||||
# Guards
|
||||
me._Valve_L_guard_open.addEventListener("click", func() {
|
||||
me._Valve_L_guard_open.hide();
|
||||
me._Valve_L_guard_closed.show();
|
||||
valve_l_guard.setBoolValue(0);
|
||||
me._Valve_L_open.hide();
|
||||
me._Valve_L_norm.show();
|
||||
me._Valve_L_shut.hide();
|
||||
valve_l.setValue(0.5);
|
||||
});
|
||||
|
||||
me._Valve_L_guard_closed.addEventListener("click", func() {
|
||||
me._Valve_L_guard_closed.hide();
|
||||
me._Valve_L_guard_open.show();
|
||||
valve_l_guard.setBoolValue(1);
|
||||
});
|
||||
|
||||
me._Valve_C_guard_open.addEventListener("click", func() {
|
||||
me._Valve_C_guard_open.hide();
|
||||
me._Valve_C_guard_closed.show();
|
||||
valve_c_guard.setBoolValue(0);
|
||||
me._Valve_C_open.hide();
|
||||
me._Valve_C_norm.show();
|
||||
me._Valve_C_shut.hide();
|
||||
valve_c.setValue(0.5);
|
||||
});
|
||||
|
||||
me._Valve_C_guard_closed.addEventListener("click", func() {
|
||||
me._Valve_C_guard_closed.hide();
|
||||
me._Valve_C_guard_open.show();
|
||||
valve_c_guard.setBoolValue(1);
|
||||
});
|
||||
|
||||
me._Valve_R_guard_open.addEventListener("click", func() {
|
||||
me._Valve_R_guard_open.hide();
|
||||
me._Valve_R_guard_closed.show();
|
||||
valve_r_guard.setBoolValue(0);
|
||||
me._Valve_R_open.hide();
|
||||
me._Valve_R_norm.show();
|
||||
me._Valve_R_shut.hide();
|
||||
valve_r.setValue(0.5);
|
||||
});
|
||||
|
||||
me._Valve_R_guard_closed.addEventListener("click", func() {
|
||||
me._Valve_R_guard_closed.hide();
|
||||
me._Valve_R_guard_open.show();
|
||||
valve_r_guard.setBoolValue(1);
|
||||
});
|
||||
|
||||
me._Mode_guard_open.addEventListener("click", func() {
|
||||
me._Mode_guard_open.hide();
|
||||
me._Mode_guard_closed.show();
|
||||
mode_guard.setBoolValue(0);
|
||||
me._Mode_refuel.hide();
|
||||
me._Mode_off.show();
|
||||
me._Mode_defuel.hide();
|
||||
});
|
||||
|
||||
me._Mode_guard_closed.addEventListener("click", func() {
|
||||
me._Mode_guard_closed.hide();
|
||||
me._Mode_guard_open.show();
|
||||
mode_guard.setBoolValue(1);
|
||||
});
|
||||
|
||||
# Switches
|
||||
me._Valve_L_open_hb.addEventListener("click", func() {
|
||||
if (valve_l_guard.getValue() == 1) {
|
||||
me._Valve_L_open.show();
|
||||
me._Valve_L_norm.hide();
|
||||
me._Valve_L_shut.hide();
|
||||
valve_l.setValue(1);
|
||||
}
|
||||
});
|
||||
|
||||
me._Valve_L_norm_hb.addEventListener("click", func() {
|
||||
if (valve_l_guard.getValue() == 1) {
|
||||
me._Valve_L_open.hide();
|
||||
me._Valve_L_norm.show();
|
||||
me._Valve_L_shut.hide();
|
||||
valve_l.setValue(0.5);
|
||||
}
|
||||
});
|
||||
|
||||
me._Valve_L_shut_hb.addEventListener("click", func() {
|
||||
if (valve_l_guard.getValue() == 1) {
|
||||
me._Valve_L_open.hide();
|
||||
me._Valve_L_norm.hide();
|
||||
me._Valve_L_shut.show();
|
||||
valve_l.setValue(0);
|
||||
}
|
||||
});
|
||||
|
||||
me._Valve_C_open_hb.addEventListener("click", func() {
|
||||
if (valve_c_guard.getValue() == 1) {
|
||||
me._Valve_C_open.show();
|
||||
me._Valve_C_norm.hide();
|
||||
me._Valve_C_shut.hide();
|
||||
valve_c.setValue(1);
|
||||
}
|
||||
});
|
||||
|
||||
me._Valve_C_norm_hb.addEventListener("click", func() {
|
||||
if (valve_c_guard.getValue() == 1) {
|
||||
me._Valve_C_open.hide();
|
||||
me._Valve_C_norm.show();
|
||||
me._Valve_C_shut.hide();
|
||||
valve_c.setValue(0.5);
|
||||
}
|
||||
});
|
||||
|
||||
me._Valve_C_shut_hb.addEventListener("click", func() {
|
||||
if (valve_c_guard.getValue() == 1) {
|
||||
me._Valve_C_open.hide();
|
||||
me._Valve_C_norm.hide();
|
||||
me._Valve_C_shut.show();
|
||||
valve_c.setValue(0);
|
||||
}
|
||||
});
|
||||
|
||||
me._Valve_R_open_hb.addEventListener("click", func() {
|
||||
if (valve_r_guard.getValue() == 1) {
|
||||
me._Valve_R_open.show();
|
||||
me._Valve_R_norm.hide();
|
||||
me._Valve_R_shut.hide();
|
||||
valve_r.setValue(1);
|
||||
}
|
||||
});
|
||||
|
||||
me._Valve_R_norm_hb.addEventListener("click", func() {
|
||||
if (valve_r_guard.getValue() == 1) {
|
||||
me._Valve_R_open.hide();
|
||||
me._Valve_R_norm.show();
|
||||
me._Valve_R_shut.hide();
|
||||
valve_r.setValue(0.5);
|
||||
}
|
||||
});
|
||||
|
||||
me._Valve_R_shut_hb.addEventListener("click", func() {
|
||||
if (valve_r_guard.getValue() == 1) {
|
||||
me._Valve_R_open.hide();
|
||||
me._Valve_R_norm.hide();
|
||||
me._Valve_R_shut.show();
|
||||
valve_r.setValue(0);
|
||||
}
|
||||
});
|
||||
|
||||
me._Mode_refuel_hb.addEventListener("click", func() {
|
||||
if (mode_guard.getValue() == 1) {
|
||||
me._Mode_refuel.show();
|
||||
me._Mode_off.hide();
|
||||
me._Mode_defuel.hide();
|
||||
systems.fuelSvc.refuel();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
me._Mode_off_hb.addEventListener("click", func() {
|
||||
if (mode_guard.getValue() == 1) {
|
||||
me._Mode_refuel.hide();
|
||||
me._Mode_off.show();
|
||||
me._Mode_defuel.hide();
|
||||
systems.fuelSvc.stop();
|
||||
}
|
||||
});
|
||||
|
||||
me._Mode_defuel_hb.addEventListener("click", func() {
|
||||
#if (mode_guard.getValue() == 1) {
|
||||
# me._Mode_refuel.hide();
|
||||
# me._Mode_off.hide();
|
||||
# me._Mode_defuel.show();
|
||||
# mode.setValue(0);
|
||||
#}
|
||||
});
|
||||
|
||||
me._Test_hi_lvl_hb.addEventListener("mousedown", func() {
|
||||
me._Test_hi_lvl.show();
|
||||
me._Test_off.hide();
|
||||
me._Test_lts.hide();
|
||||
test.setValue(1);
|
||||
});
|
||||
|
||||
me._Test_hi_lvl_hb.addEventListener("mouseup", func() {
|
||||
me._Test_hi_lvl.hide();
|
||||
me._Test_off.show();
|
||||
me._Test_lts.hide();
|
||||
test.setValue(0.5);
|
||||
});
|
||||
|
||||
me._Test_lts_hb.addEventListener("mousedown", func() {
|
||||
me._Test_hi_lvl.hide();
|
||||
me._Test_off.hide();
|
||||
me._Test_lts.show();
|
||||
test.setValue(0);
|
||||
});
|
||||
|
||||
me._Test_lts_hb.addEventListener("mouseup", func() {
|
||||
me._Test_hi_lvl.hide();
|
||||
me._Test_off.show();
|
||||
me._Test_lts.hide();
|
||||
test.setValue(0.5);
|
||||
});
|
||||
|
||||
me._Power_on_hb.addEventListener("click", func() {
|
||||
me._Power_on.show();
|
||||
me._Power_norm.hide();
|
||||
power.setBoolValue(1);
|
||||
});
|
||||
|
||||
me._Power_norm_hb.addEventListener("click", func() {
|
||||
me._Power_on.hide();
|
||||
me._Power_norm.show();
|
||||
power.setBoolValue(0);
|
||||
});
|
||||
|
||||
me._Pre_dec_hb.addEventListener("mousedown", func() {
|
||||
me._timerDn.start();
|
||||
});
|
||||
|
||||
me._Pre_inc_hb.addEventListener("mousedown", func() {
|
||||
me._timerUp.start();
|
||||
});
|
||||
|
||||
me._Pre_dec_hb.addEventListener("mouseup", func() {
|
||||
me._timerDn.stop();
|
||||
});
|
||||
|
||||
me._Pre_inc_hb.addEventListener("mouseup", func() {
|
||||
me._timerUp.stop();
|
||||
});
|
||||
|
||||
me._timerf();
|
||||
me._timer.start();
|
||||
},
|
||||
_timerf: func() {
|
||||
# Check power
|
||||
# TODO cut off power when turned on with BATT POWER switch:
|
||||
# The electrical supply is automatically cut off:
|
||||
# After 10 min, if no refuel operation is selected, or
|
||||
# At the end of refueling.
|
||||
if ((systems.ELEC.Bus.dcHot1.getValue() >= 25 and power.getValue() == 1) or systems.ELEC.Bus.dc2.getValue() >= 25) {
|
||||
me._FQI_actual.show();
|
||||
me._FQI_pre.show();
|
||||
me._FQI_L.show();
|
||||
me._FQI_C.show();
|
||||
me._FQI_R.show();
|
||||
|
||||
me._fuelPreselectAmount = amount.getValue();
|
||||
me._fuelLeftAmount = (systems.FUEL.Quantity.leftOuter.getValue() + systems.FUEL.Quantity.leftInner.getValue()) / 1000;
|
||||
me._fuelCenterAmount = systems.FUEL.Quantity.center.getValue() / 1000;
|
||||
me._fuelRightAmount = (systems.FUEL.Quantity.rightOuter.getValue() + systems.FUEL.Quantity.rightInner.getValue()) / 1000;
|
||||
me._fuelTotalAmount = pts.Consumables.Fuel.totalFuelLbs.getValue() / 1000;
|
||||
|
||||
if (me._fuelPreselectAmount >= 10.0) {
|
||||
me._FQI_pre.setText(sprintf("%2.1f", me._fuelPreselectAmount));
|
||||
} else {
|
||||
me._FQI_pre.setText(sprintf("%2.2f", me._fuelPreselectAmount));
|
||||
}
|
||||
|
||||
if (me._fuelLeftAmount >= 10.0) {
|
||||
me._FQI_L.setText(sprintf("%2.1f", me._fuelLeftAmount));
|
||||
} else {
|
||||
me._FQI_L.setText(sprintf("%2.2f", me._fuelLeftAmount));
|
||||
}
|
||||
|
||||
if (me._fuelCenterAmount >= 10.0) {
|
||||
me._FQI_C.setText(sprintf("%2.1f", me._fuelCenterAmount));
|
||||
} else {
|
||||
me._FQI_C.setText(sprintf("%2.2f", me._fuelCenterAmount));
|
||||
}
|
||||
|
||||
if (me._fuelRightAmount >= 10.0) {
|
||||
me._FQI_R.setText(sprintf("%2.1f", me._fuelRightAmount));
|
||||
} else {
|
||||
me._FQI_R.setText(sprintf("%2.2f", me._fuelRightAmount));
|
||||
}
|
||||
|
||||
if (me._fuelTotalAmount >= 10.0) {
|
||||
me._FQI_actual.setText(sprintf("%2.1f", pts.Consumables.Fuel.totalFuelLbs.getValue() / 1000));
|
||||
} else {
|
||||
me._FQI_actual.setText(sprintf("%2.2f", pts.Consumables.Fuel.totalFuelLbs.getValue() / 1000));
|
||||
}
|
||||
|
||||
# HI LVL indicator color: #0184f6
|
||||
|
||||
if (systems.FUEL.Quantity.leftInnerPct.getValue() >= 0.999) {
|
||||
me._HI_LVL_L.setColorFill(0.0039, 0.5176, 0.9647);
|
||||
} else {
|
||||
me._HI_LVL_L.setColorFill(0.2353, 0.2117, 0.2117);
|
||||
}
|
||||
|
||||
if (systems.FUEL.Quantity.centerPct.getValue() >= 0.999) {
|
||||
me._HI_LVL_C.setColorFill(0.0039, 0.5176, 0.9647);
|
||||
} else {
|
||||
me._HI_LVL_C.setColorFill(0.2353, 0.2117, 0.2117);
|
||||
}
|
||||
|
||||
if (systems.FUEL.Quantity.rightInnerPct.getValue() >= 0.999) {
|
||||
me._HI_LVL_R.setColorFill(0.0039, 0.5176, 0.9647);
|
||||
} else {
|
||||
me._HI_LVL_R.setColorFill(0.2353, 0.2117, 0.2117);
|
||||
}
|
||||
|
||||
# DEFUEL indicator color: #ffe23f
|
||||
} else {
|
||||
me._FQI_actual.hide();
|
||||
me._FQI_pre.hide();
|
||||
me._FQI_L.hide();
|
||||
me._FQI_C.hide();
|
||||
me._FQI_R.hide();
|
||||
me._Valve_defuel.setColor(0.2353, 0.2117, 0.2117);
|
||||
me._HI_LVL_L.setColor(0.2353, 0.2117, 0.2117);
|
||||
me._HI_LVL_C.setColor(0.2353, 0.2117, 0.2117);
|
||||
me._HI_LVL_R.setColor(0.2353, 0.2117, 0.2117);
|
||||
}
|
||||
},
|
||||
_fuelAdjustDn: func() {
|
||||
target = amount.getValue();
|
||||
if (target > 0) {
|
||||
amount.setValue(target - 0.1);
|
||||
if (target - 0.1 >= 10.0) {
|
||||
me._FQI_pre.setText(sprintf("%2.1f", target - 0.1));
|
||||
} else {
|
||||
me._FQI_pre.setText(sprintf("%2.2f", target - 0.1));
|
||||
}
|
||||
systems.fuelSvc.Nodes.requestLbs.setValue(((target - 0.1) - math.round(pts.Consumables.Fuel.totalFuelLbs.getValue() / 1000, 0.1)) * 1000);
|
||||
}
|
||||
},
|
||||
_fuelAdjustUp: func() {
|
||||
target = amount.getValue();
|
||||
if (target < max_fuel) {
|
||||
amount.setValue(target + 0.1);
|
||||
if (target + 0.1 >= 10.0) {
|
||||
me._FQI_pre.setText(sprintf("%2.1f", target + 0.1));
|
||||
} else {
|
||||
me._FQI_pre.setText(sprintf("%2.2f", target + 0.1));
|
||||
}
|
||||
systems.fuelSvc.Nodes.requestLbs.setValue(((target + 0.1) - math.round(pts.Consumables.Fuel.totalFuelLbs.getValue() / 1000, 0.1)) * 1000);
|
||||
}
|
||||
},
|
||||
_onClose: func() {
|
||||
me.close();
|
||||
},
|
||||
};
|
||||
|
||||
var refuelDialog = refuelClass.new();
|
1228
gui/dialogs/refuel.svg
Normal file
1228
gui/dialogs/refuel.svg
Normal file
File diff suppressed because it is too large
Load diff
After Width: | Height: | Size: 59 KiB |
Loading…
Add table
Reference in a new issue