diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-eng.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-eng.nas index 76de7471..c00d7e5e 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-eng.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-eng.nas @@ -1,6 +1,11 @@ # A3XX Lower ECAM Canvas # Copyright (c) 2021 Josh Davidson (Octal450) and Jonathan Redpath +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 QT2LTR = 0.946353; + var canvas_lowerECAMPageEng = { new: func(svg,name) { @@ -21,8 +26,108 @@ var canvas_lowerECAMPageEng = obj.units = acconfig_weight_kgs.getValue(); # init + obj["FUEL-clog-1"].hide(); + obj["FUEL-clog-2"].hide(); + obj["OIL-clog-1"].hide(); + obj["OIL-clog-2"].hide(); + + obj.quantity = [nil, nil]; obj.update_items = [ + props.UpdateManager.FromHashValue("engOilQt1", 0.005, func(val) { + if (obj.units) { + obj.quantity[0] = sprintf("%2.1f",(0.1 * math.round(val * QT2LTR * 10,5))); + obj["OilQT1"].setText(sprintf("%s", left(obj.quantity[0], (size(obj.quantity[0]) == 4 ? 2 : 1)))); + obj["OilQT1-decimal"].setText(sprintf("%s", right(obj.quantity[0],1))); + obj["OilQT1-needle"].setRotation(((val * QT2LTR) + 90) * D2R); + } else { + obj.quantity[0] = sprintf("%2.1f",(0.1 * math.round(val * 10,5))); + obj["OilQT1"].setText(sprintf("%s", left(obj.quantity[0], (size(obj.quantity[0]) == 4 ? 2 : 1)))); + obj["OilQT1-decimal"].setText(sprintf("%s", right(obj.quantity[0],1))); + obj["OilQT1-needle"].setRotation((val + 90) * D2R); + } + }), + props.UpdateManager.FromHashValue("engOilQt2", 0.005, func(val) { + if (obj.units) { + obj.quantity[1] = sprintf("%2.1f",(0.1 * math.round(val * QT2LTR * 10,5))); + obj["OilQT2"].setText(sprintf("%s", left(obj.quantity[1], (size(obj.quantity[1]) == 4 ? 2 : 1)))); + obj["OilQT2-decimal"].setText(sprintf("%s", right(obj.quantity[1],1))); + obj["OilQT2-needle"].setRotation(((val * QT2LTR) + 90) * D2R); + } else { + obj.quantity[1] = sprintf("%2.1f",(0.1 * math.round(val * 10,5))); + obj["OilQT2"].setText(sprintf("%s", left(obj.quantity[1], (size(obj.quantity[1]) == 4 ? 2 : 1)))); + obj["OilQT2-decimal"].setText(sprintf("%s", right(obj.quantity[1],1))); + obj["OilQT2-needle"].setRotation((val + 90) * D2R); + } + }), + props.UpdateManager.FromHashValue("engOilPsi1", 0.25, func(val) { + if (val >= 13) { + obj["OilPSI1"].setColor(0.0509,0.7529,0.2941); + obj["OilPSI1-needle"].setColor(0.0509,0.7529,0.2941); + } else { + obj["OilPSI1"].setColor(1,0,0); + obj["OilPSI1-needle"].setColor(1,0,0); + } + + obj["OilPSI1"].setText(sprintf("%s", math.round(val))); + obj["OilPSI1-needle"].setRotation((val + 90) * D2R); + }), + props.UpdateManager.FromHashValue("engOilPsi2", 0.25, func(val) { + if (val >= 13) { + obj["OilPSI2"].setColor(0.0509,0.7529,0.2941); + obj["OilPSI2-needle"].setColor(0.0509,0.7529,0.2941); + } else { + obj["OilPSI2"].setColor(1,0,0); + obj["OilPSI2-needle"].setColor(1,0,0); + } + + obj["OilPSI2"].setText(sprintf("%s", math.round(val))); + obj["OilPSI2-needle"].setRotation((val + 90) * D2R); + }), + props.UpdateManager.FromHashValue("acconfigUnits", nil, func(val) { + if (val) { + obj["Fused-weight-unit"].setText("KG"); + obj["Fused-oil-unit"].setText("LTR"); + # immediately update parameters + obj.quantity[0] = sprintf("%2.1f",(0.1 * math.round(pts.Engines.Engine.oilQt[0].getValue() * QT2LTR * 10,5))); + obj["OilQT1"].setText(sprintf("%s", left(obj.quantity[0], (size(obj.quantity[0]) == 4 ? 2 : 1)))); + obj["OilQT1-decimal"].setText(sprintf("%s", right(obj.quantity[0],1))); + obj["OilQT1-needle"].setRotation(((pts.Engines.Engine.oilQt[0].getValue() * QT2LTR) + 90) * D2R); + obj.quantity[1] = sprintf("%2.1f",(0.1 * math.round(pts.Engines.Engine.oilQt[1].getValue() * QT2LTR * 10,5))); + obj["OilQT2"].setText(sprintf("%s", left(obj.quantity[1], (size(obj.quantity[1]) == 4 ? 2 : 1)))); + obj["OilQT2-decimal"].setText(sprintf("%s", right(obj.quantity[1],1))); + obj["OilQT2-needle"].setRotation(((pts.Engines.Engine.oilQt[1].getValue() * QT2LTR) + 90) * D2R); + obj["FUEL-used-1"].setText(sprintf("%s", math.round(fuel_used_lbs1.getValue() * LBS2KGS, 10))); + obj["FUEL-used-2"].setText(sprintf("%s", math.round(fuel_used_lbs2.getValue() * LBS2KGS, 10))); + } else { + obj["Fused-weight-unit"].setText("LBS"); + obj["Fused-oil-unit"].setText("QT"); + obj.quantity[0] = sprintf("%2.1f",(0.1 * math.round(pts.Engines.Engine.oilQt[0].getValue() * 10,5))); + obj["OilQT1"].setText(sprintf("%s", left(obj.quantity[0], (size(obj.quantity[0]) == 4 ? 2 : 1)))); + obj["OilQT1-decimal"].setText(sprintf("%s", right(obj.quantity[0],1))); + obj["OilQT1-needle"].setRotation((pts.Engines.Engine.oilQt[0].getValue() + 90) * D2R); + obj.quantity[1] = sprintf("%2.1f",(0.1 * math.round(pts.Engines.Engine.oilQt[1].getValue() * 10,5))); + obj["OilQT2"].setText(sprintf("%s", left(obj.quantity[1], (size(obj.quantity[1]) == 4 ? 2 : 1)))); + obj["OilQT2-decimal"].setText(sprintf("%s", right(obj.quantity[1],1))); + obj["OilQT2-needle"].setRotation((pts.Engines.Engine.oilQt[1].getValue() + 90) * D2R); + obj["FUEL-used-1"].setText(sprintf("%s", math.round(fuel_used_lbs1.getValue(), 10))); + obj["FUEL-used-2"].setText(sprintf("%s", math.round(fuel_used_lbs2.getValue(), 10))); + } + }), + props.UpdateManager.FromHashValue("engFuelUsed1", 1, func(val) { + if (obj.units) { + obj["FUEL-used-1"].setText(sprintf("%s", math.round(val * LBS2KGS, 10))); + } else { + obj["FUEL-used-1"].setText(sprintf("%s", math.round(val, 10))); + } + }), + props.UpdateManager.FromHashValue("engFuelUsed2", 1, func(val) { + if (obj.units) { + obj["FUEL-used-2"].setText(sprintf("%s", math.round(val * LBS2KGS, 10))); + } else { + obj["FUEL-used-2"].setText(sprintf("%s", math.round(val, 10))); + } + }), ]; obj.displayedGForce = 0; @@ -62,10 +167,10 @@ var canvas_lowerECAMPageEng = return ["TAT","SAT","GW","UTCh","UTCm","GLoad","GW-weight-unit"]; }, getKeys: func() { - return["Bulk","BulkLine","BulkLbl","Exit1L","Exit1R","Cabin1Left","Cabin1LeftLbl","Cabin1LeftLine","Cabin1LeftSlide","Cabin1Right","Cabin1RightLbl","Cabin1RightLine","Cabin1RightSlide","Cabin2Left","Cabin2LeftLbl", - "Cabin2LeftLine","Cabin2LeftSlide","Cabin2Right","Cabin2RightLbl","Cabin2RightLine","Cabin2RightSlide","Cabin3Left","Cabin3LeftLbl","Cabin3LeftLine","Cabin3LeftSlide","Cabin3Right","Cabin3RightLbl","Cabin3RightLine","Cabin3RightSlide","AvionicsLine1", - "AvionicsLbl1","AvionicsLine2","AvionicsLbl2","Cargo1Line","Cargo1Lbl","Cargo1Door","Cargo2Line","Cargo2Lbl","Cargo2Door","ExitLSlide","ExitLLine","ExitLLbl","ExitRSlide","ExitRLine","ExitRLbl","Cabin4Left","Cabin4LeftLbl","Cabin4LeftLine", - "Cabin4LeftSlide","Cabin4Right","Cabin4RightLbl","Cabin4RightLine","Cabin4RightSlide","DOOROXY-REGUL-LO-PR"];}, + return["OilQT1-needle","OilQT2-needle","OilQT1","OilQT2","OilQT1-decimal","OilQT2-decimal","OilPSI1-needle","OilPSI2-needle","OilPSI1","OilPSI2", + "FUEL-used-1","FUEL-used-2", "Fused-weight-unit","Fused-oil-unit","FUEL-clog-1","FUEL-clog-2","OIL-clog-1","OIL-clog-2","OilTemp1","OilTemp2", + "VIB-N1-1","VIB-N1-2","VIB-N2-1","VIB-N2-2"]; + }, updateBottom: func(notification) { foreach(var update_item_bottom; me.updateItemsBottom) { @@ -140,6 +245,12 @@ var canvas_lowerECAMPageEng = }; var input = { + engFuelUsed1: "/systems/fuel/fuel-used-1", + engFuelUsed2: "/systems/fuel/fuel-used-2", + engOilQt1: "/engines/engine[0]/oil-qt-actual", + engOilQt2: "/engines/engine[1]/oil-qt-actual", + engOilPsi1: "/engines/engine[0]/oil-psi-actual", + engOilPsi2: "/engines/engine[1]/oil-psi-actual", }; foreach (var name; keys(input)) { diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-old.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-old.nas index b181dfbf..7abf7bd7 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-old.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-old.nas @@ -46,9 +46,6 @@ var hp_valve_state = 0; var xbleedcmdstate = 0; var ramAirState = 0; -# Conversion factor pounds to kilogram -LBS2KGS = 0.4535924; - # Fetch Nodes var acconfig_weight_kgs = props.globals.getNode("/systems/acconfig/options/weight-kgs", 1); var rate = props.globals.getNode("/systems/acconfig/options/lecam-rate", 1); @@ -105,10 +102,9 @@ var gs_kt = props.globals.getNode("/velocities/groundspeed-kt", 1); var switch_wing_aice = props.globals.getNode("/controls/ice-protection/wing", 1); var pack1_bypass = props.globals.getNode("/systems/pneumatics/pack-1-bypass", 1); var pack2_bypass = props.globals.getNode("/systems/pneumatics/pack-2-bypass", 1); -var oil_qt1_actual = props.globals.getNode("/engines/engine[0]/oil-qt-actual", 1); +var oil_qt1_actual = props.globals.getNode("", 1); var oil_qt2_actual = props.globals.getNode("/engines/engine[1]/oil-qt-actual", 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 fuel_used_lbs1 = props.globals.getNode("", 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); @@ -1657,50 +1653,18 @@ var canvas_lowerECAM_eng = { return m; }, getKeys: func() { - return ["TAT","SAT","GW","UTCh","UTCm","GLoad","GW-weight-unit","OilQT1-needle","OilQT2-needle","OilQT1","OilQT2","OilQT1-decimal","OilQT2-decimal","OilPSI1-needle","OilPSI2-needle","OilPSI1","OilPSI2","FUEL-used-1","FUEL-used-2", "Fused-weight-unit"]; + return ["TAT","SAT","GW","UTCh","UTCm","GLoad","GW-weight-unit",]; }, update: func() { # Oil Quantity - me["OilQT1"].setText(sprintf("%s", int(oil_qt1_actual.getValue()))); - me["OilQT2"].setText(sprintf("%s", int(oil_qt2_actual.getValue()))); - me["OilQT1-decimal"].setText(sprintf("%s", int(10*math.mod(oil_qt1_actual.getValue(),1)))); - me["OilQT2-decimal"].setText(sprintf("%s", int(10*math.mod(oil_qt2_actual.getValue(),1)))); - - me["OilQT1-needle"].setRotation((oil_qt1.getValue() + 90) * D2R); - me["OilQT2-needle"].setRotation((oil_qt2.getValue() + 90) * D2R); + # Oil Pressure - if (pts.Engines.Engine.oilPsi[0].getValue() >= 20) { - me["OilPSI1"].setColor(0.0509,0.7529,0.2941); - me["OilPSI1-needle"].setColor(0.0509,0.7529,0.2941); - } else { - me["OilPSI1"].setColor(1,0,0); - me["OilPSI1-needle"].setColor(1,0,0); - } - - if (pts.Engines.Engine.oilPsi[1].getValue() >= 20) { - me["OilPSI2"].setColor(0.0509,0.7529,0.2941); - me["OilPSI2-needle"].setColor(0.0509,0.7529,0.2941); - } else { - me["OilPSI2"].setColor(1,0,0); - me["OilPSI2-needle"].setColor(1,0,0); - } - - me["OilPSI1"].setText(sprintf("%s", math.round(pts.Engines.Engine.oilPsi[0].getValue()))); - me["OilPSI2"].setText(sprintf("%s", math.round(pts.Engines.Engine.oilPsi[1].getValue()))); - - me["OilPSI1-needle"].setRotation((oil_psi1.getValue() + 90) * D2R); - me["OilPSI2-needle"].setRotation((oil_psi2.getValue() + 90) * D2R); + # Fuel Used if (acconfig_weight_kgs.getValue()) { - me["FUEL-used-1"].setText(sprintf("%s", math.round(fuel_used_lbs1.getValue() * LBS2KGS, 10))); - me["FUEL-used-2"].setText(sprintf("%s", math.round(fuel_used_lbs2.getValue() * LBS2KGS, 10))); - me["Fused-weight-unit"].setText("KG"); } else { - me["FUEL-used-1"].setText(sprintf("%s", math.round(fuel_used_lbs1.getValue(), 10))); - me["FUEL-used-2"].setText(sprintf("%s", math.round(fuel_used_lbs2.getValue(), 10))); - me["Fused-weight-unit"].setText("LBS"); } me.updateBottomStatus(); diff --git a/Models/Instruments/Lower-ECAM/res/eng.svg b/Models/Instruments/Lower-ECAM/res/eng.svg index 212bd01f..4056f45c 100644 --- a/Models/Instruments/Lower-ECAM/res/eng.svg +++ b/Models/Instruments/Lower-ECAM/res/eng.svg @@ -12,8 +12,8 @@ viewBox="0 0 1024 1024" version="1.1" id="svg2" - inkscape:version="0.91 r13725" - sodipodi:docname="eng-eis2.svg"> + inkscape:version="0.92.4 (5da689c313, 2019-01-14)" + sodipodi:docname="eng.svg"> @@ -37,14 +37,14 @@ guidetolerance="10" inkscape:pageopacity="1" inkscape:pageshadow="2" - inkscape:window-width="1920" - inkscape:window-height="1030" + inkscape:window-width="1366" + inkscape:window-height="705" id="namedview371" showgrid="true" - inkscape:zoom="0.5" - inkscape:cx="988.67552" - inkscape:cy="398.82462" - inkscape:window-x="1592" + inkscape:zoom="1" + inkscape:cx="593.89152" + inkscape:cy="650.40507" + inkscape:window-x="-8" inkscape:window-y="-8" inkscape:window-maximized="1" inkscape:current-layer="svg2"> @@ -81,8 +81,7 @@ style="font-style:normal;font-weight:normal;line-height:0%;font-family:'Liberation Sans';letter-spacing:0px;word-spacing:0px;fill:#179ab7;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" x="500.75214" y="977.31793" - id="text6232" - sodipodi:linespacing="0%">120000 °C G.LOAD 0.6 + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:32px;line-height:1.25;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:center;text-anchor:middle;fill:#bb6100;fill-opacity:1">G.LOAD 0.6   0000 + x="264.69104" + y="181.87344" + style="font-size:30.0000782px;line-height:1.25;fill:#0dc04b;fill-opacity:1;stroke-width:0.75000191">0000 0000 + CLOG + CLOG + CLOG + CLOG + 22 + 0.6 + 0.1 + 0.6 + 0.1 + 22 diff --git a/Nasal/Libraries/property-tree-setup.nas b/Nasal/Libraries/property-tree-setup.nas index a4d5c988..7280d194 100644 --- a/Nasal/Libraries/property-tree-setup.nas +++ b/Nasal/Libraries/property-tree-setup.nas @@ -87,6 +87,7 @@ var Engines = { n1Actual: [props.globals.getNode("/engines/engine[0]/n1-actual"), props.globals.getNode("/engines/engine[1]/n1-actual")], n2Actual: [props.globals.getNode("/engines/engine[0]/n2-actual"), props.globals.getNode("/engines/engine[1]/n2-actual")], oilPsi: [props.globals.getNode("/engines/engine[0]/oil-psi-actual"), props.globals.getNode("/engines/engine[1]/oil-psi-actual")], + oilQt: [props.globals.getNode("/engines/engine[0]/oil-qt-actual"), props.globals.getNode("/engines/engine[1]/oil-qt-actual")], thrust: [props.globals.getNode("/engines/engine[0]/thrust-lb"), props.globals.getNode("/engines/engine[1]/thrust-lb")], reverser: [props.globals.getNode("/engines/engine[0]/reverser-pos-norm"), props.globals.getNode("/engines/engine[1]/reverser-pos-norm")], state: [props.globals.getNode("/engines/engine[0]/state"), props.globals.getNode("/engines/engine[1]/state")],