From aaafb2d1b1497ac55eff5e15f7150625069a5dff Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Thu, 29 Oct 2020 00:50:20 +0000 Subject: [PATCH] WIP IAE --- Models/Instruments/Upper-ECAM/Upper-ECAM.nas | 284 +----------- .../Instruments/Upper-ECAM/Upper-ECAM.new.nas | 426 ++++++++++++++---- 2 files changed, 342 insertions(+), 368 deletions(-) diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas index d7d28b46..db2dd039 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.nas @@ -7,14 +7,7 @@ var canvas_upperECAM_iae_eis2 = { m.updateFlx(); return m; }, - getKeys: func() { - return ["EPR1-needle","EPR1-thr","EPR1-ylim","EPR1","EPR1-decpnt","EPR1-decimal","EPR1-box","EPR1-scale","EPR1-scaletick","EPR1-scalenum","EPR1-XX","EPR1-XX2","EGT1-needle","EGT1","EGT1-scale","EGT1-box","EGT1-scale2","EGT1-scaletick","EGT1-XX", - "N11-needle","N11-thr","N11-ylim","N11","N11-decpnt","N11-decimal","N11-scale","N11-scale2","N11-scaletick","N11-scalenum","N11-XX","N21","N21-decpnt","N21-decimal","N21-XX","FF1","FF1-XX","EPR2-needle","EPR2-thr","EPR2-ylim","EPR2","EPR2-decpnt", - "EPR2-decimal","EPR2-box","EPR2-scale","EPR2-scaletick","EPR2-scalenum","EPR2-XX","EPR2-XX2","EGT2-needle","EGT2","EGT2-scale","EGT2-scale2","EGT2-box","EGT2-scaletick","EGT2-XX","N12-needle","N12-thr","N12-ylim","N12","N12-decpnt","N12-decimal", - "N12-scale","N12-scale2","N12-scaletick","N12-scalenum","N12-XX","N22","N22-decpnt","N22-decimal","N22-XX","FF2","FF2-XX","FOB-LBS","FlapTxt","FlapDots","EPRLim-mode","EPRLim","EPRLim-decpnt","EPRLim-decimal","EPRLim-XX","EPRLim-XX2","REV1","REV1-box", - "REV2","REV2-box","ECAM_Left","ECAML1","ECAML2","ECAML3","ECAML4","ECAML5","ECAML6","ECAML7","ECAML8", "ECAMR1", "ECAMR2", "ECAMR3", "ECAMR4", "ECAMR5", "ECAMR6", "ECAMR7", "ECAMR8", "ECAM_Right", - "FFlow1-weight-unit", "FFlow2-weight-unit", "FOB-weight-unit","SlatAlphaLock","SlatIndicator","FlapIndicator","SlatLine","FlapLine","aFloor","FlxLimDegreesC","FlxLimTemp"]; - }, + update: func(notification) { N1_1_cur = N1_1.getValue(); N1_2_cur = N1_2.getValue(); @@ -48,281 +41,6 @@ var canvas_upperECAM_iae_eis2 = { obj["EPR2-thr"].setRotation((EPR_thr_2_act + 90) * D2R); obj["EPR2-ylim"].setRotation((EPR_lim_cur + 90) * D2R); - if (fadec.FADEC.Eng1.epr == 1) { - obj["EPR1-scale"].setColor(0.8078,0.8039,0.8078); - obj["EPR1"].show(); - obj["EPR1-decpnt"].show(); - obj["EPR1-decimal"].show(); - obj["EPR1-needle"].show(); - obj["EPR1-ylim"].show(); - obj["EPR1-scaletick"].show(); - obj["EPR1-scalenum"].show(); - obj["EPR1-box"].show(); - obj["EPR1-XX"].hide(); - obj["EPR1-XX2"].hide(); - } else { - obj["EPR1-scale"].setColor(0.7333,0.3803,0); - obj["EPR1"].hide(); - obj["EPR1-decpnt"].hide(); - obj["EPR1-decimal"].hide(); - obj["EPR1-needle"].hide(); - obj["EPR1-ylim"].hide(); - obj["EPR1-scaletick"].hide(); - obj["EPR1-scalenum"].hide(); - obj["EPR1-box"].hide(); - obj["EPR1-XX"].show(); - obj["EPR1-XX2"].show(); - } - - if (rev_1_act < 0.01 and fadec.FADEC.Eng1.epr == 1) { - obj["EPR1-thr"].show(); - } else { - obj["EPR1-thr"].hide(); - } - - if (fadec.FADEC.Eng2.epr == 1) { - obj["EPR2-scale"].setColor(0.8078,0.8039,0.8078); - obj["EPR2"].show(); - obj["EPR2-decpnt"].show(); - obj["EPR2-decimal"].show(); - obj["EPR2-needle"].show(); - obj["EPR2-ylim"].show(); - obj["EPR2-scaletick"].show(); - obj["EPR2-scalenum"].show(); - obj["EPR2-box"].show(); - obj["EPR2-XX"].hide(); - obj["EPR2-XX2"].hide(); - } else { - obj["EPR2-scale"].setColor(0.7333,0.3803,0); - obj["EPR2"].hide(); - obj["EPR2-decpnt"].hide(); - obj["EPR2-decimal"].hide(); - obj["EPR2-needle"].hide(); - obj["EPR2-ylim"].hide(); - obj["EPR2-scaletick"].hide(); - obj["EPR2-scalenum"].hide(); - obj["EPR2-box"].hide(); - obj["EPR2-XX"].show(); - obj["EPR2-XX2"].show(); - } - - if (rev_2_act < 0.01 and fadec.FADEC.Eng2.epr == 1) { - obj["EPR2-thr"].show(); - } else { - obj["EPR2-thr"].hide(); - } - - # EGT - obj["EGT1"].setText(sprintf("%s", math.round(pts.Engines.Engine.egtActual[0].getValue()))); - obj["EGT2"].setText(sprintf("%s", math.round(pts.Engines.Engine.egtActual[1].getValue()))); - - obj["EGT1-needle"].setRotation((EGT_1_cur + 90) * D2R); - obj["EGT2-needle"].setRotation((EGT_2_cur + 90) * D2R); - - if (fadec.FADEC.Eng1.egt == 1) { - obj["EGT1-scale"].setColor(0.8078,0.8039,0.8078); - obj["EGT1-scale2"].setColor(1,0,0); - obj["EGT1"].show(); - obj["EGT1-needle"].show(); - obj["EGT1-scaletick"].show(); - obj["EGT1-box"].show(); - obj["EGT1-XX"].hide(); - } else { - obj["EGT1-scale"].setColor(0.7333,0.3803,0); - obj["EGT1-scale2"].setColor(0.7333,0.3803,0); - obj["EGT1"].hide(); - obj["EGT1-needle"].hide(); - obj["EGT1-scaletick"].hide(); - obj["EGT1-box"].hide(); - obj["EGT1-XX"].show(); - } - - if (fadec.FADEC.Eng2.egt == 1) { - obj["EGT2-scale"].setColor(0.8078,0.8039,0.8078); - obj["EGT2-scale2"].setColor(1,0,0); - obj["EGT2"].show(); - obj["EGT2-needle"].show(); - obj["EGT2-scaletick"].show(); - obj["EGT2-box"].show(); - obj["EGT2-XX"].hide(); - } else { - obj["EGT2-scale"].setColor(0.7333,0.3803,0); - obj["EGT2-scale2"].setColor(0.7333,0.3803,0); - obj["EGT2"].hide(); - obj["EGT2-needle"].hide(); - obj["EGT2-scaletick"].hide(); - obj["EGT2-box"].hide(); - obj["EGT2-XX"].show(); - } - - # N1 - obj["N11"].setText(sprintf("%s", math.floor(pts.Engines.Engine.n1Actual[0].getValue() + 0.05))); - obj["N11-decimal"].setText(sprintf("%s", int(10 * math.mod(pts.Engines.Engine.n1Actual[0].getValue() + 0.05, 1)))); - - obj["N12"].setText(sprintf("%s", math.floor(pts.Engines.Engine.n1Actual[1].getValue() + 0.05))); - obj["N12-decimal"].setText(sprintf("%s", int(10 * math.mod(pts.Engines.Engine.n1Actual[1].getValue() + 0.05, 1)))); - - obj["N11-needle"].setRotation((N1_1_cur + 90) * D2R); - obj["N11-thr"].setRotation((N1_thr_1.getValue() + 90) * D2R); - obj["N11-ylim"].setRotation((N1_lim_cur + 90) * D2R); - - obj["N12-needle"].setRotation((N1_2_cur + 90) * D2R); - obj["N12-thr"].setRotation((N1_thr_2.getValue() + 90) * D2R); - obj["N12-ylim"].setRotation((N1_lim_cur + 90) * D2R); - - if (fadec.FADEC.Eng1.n1 == 1) { - obj["N11-scale"].setColor(0.8078,0.8039,0.8078); - obj["N11-scale2"].setColor(1,0,0); - obj["N11"].show(); - obj["N11-decimal"].show(); - obj["N11-decpnt"].show(); - obj["N11-needle"].show(); - obj["N11-scaletick"].show(); - obj["N11-scalenum"].show(); - obj["N11-XX"].hide(); - } else { - obj["N11-scale"].setColor(0.7333,0.3803,0); - obj["N11-scale2"].setColor(0.7333,0.3803,0); - obj["N11"].hide(); - obj["N11-decimal"].hide(); - obj["N11-decpnt"].hide(); - obj["N11-needle"].hide(); - obj["N11-scaletick"].hide(); - obj["N11-scalenum"].hide(); - obj["N11-XX"].show(); - } - - if (fadec.FADEC.Eng2.n1 == 1) { - obj["N12-scale"].setColor(0.8078,0.8039,0.8078); - obj["N12-scale2"].setColor(1,0,0); - obj["N12"].show(); - obj["N12-decimal"].show(); - obj["N12-decpnt"].show(); - obj["N12-needle"].show(); - obj["N12-scaletick"].show(); - obj["N12-scalenum"].show(); - obj["N12-XX"].hide(); - } else { - obj["N12-scale"].setColor(0.7333,0.3803,0); - obj["N12-scale2"].setColor(0.7333,0.3803,0); - obj["N12"].hide(); - obj["N12-decimal"].hide(); - obj["N12-decpnt"].hide(); - obj["N12-needle"].hide(); - obj["N12-scaletick"].hide(); - obj["N12-scalenum"].hide(); - obj["N12-XX"].show(); - } - - if (fadec.FADEC.Eng1.n1 == 1 and fadec.Fadec.n1Mode[0].getValue()) { - obj["N11-thr"].show(); - obj["N11-ylim"].hide(); # Keep it hidden, since N1 mode limit calculation is not done yet - } else { - obj["N11-thr"].hide(); - obj["N11-ylim"].hide(); - } - - if (fadec.FADEC.Eng2.n1 == 1 and fadec.Fadec.n1Mode[1].getValue()) { - obj["N12-thr"].show(); - obj["N12-ylim"].hide(); # Keep it hidden, since N1 mode limit calculation is not done yet - } else { - obj["N12-thr"].hide(); - obj["N12-ylim"].hide(); - } - - # N2 - obj["N21"].setText(sprintf("%s", math.floor(pts.Engines.Engine.n2Actual[0].getValue() + 0.05))); - obj["N21-decimal"].setText(sprintf("%s", int(10 * math.mod(pts.Engines.Engine.n2Actual[0].getValue() + 0.05, 1)))); - obj["N22"].setText(sprintf("%s", math.floor(pts.Engines.Engine.n2Actual[1].getValue() + 0.05))); - obj["N22-decimal"].setText(sprintf("%s", int(10 * math.mod(pts.Engines.Engine.n2Actual[1].getValue() + 0.05, 1)))); - - if (fadec.FADEC.Eng1.n2 == 1) { - obj["N21"].show(); - obj["N21-decimal"].show(); - obj["N21-decpnt"].show(); - obj["N21-XX"].hide(); - } else { - obj["N21"].hide(); - obj["N21-decimal"].hide(); - obj["N21-decpnt"].hide(); - obj["N21-XX"].show(); - } - - if (fadec.FADEC.Eng2.n2 == 1) { - obj["N22"].show(); - obj["N22-decimal"].show(); - obj["N22-decpnt"].show(); - obj["N22-XX"].hide(); - } else { - obj["N22"].hide(); - obj["N22-decimal"].hide(); - obj["N22-decpnt"].hide(); - obj["N22-XX"].show(); - } - - # FF - fuel1 = pts.Engines.Engine.fuelFlow[0].getValue(); - fuel2 = pts.Engines.Engine.fuelFlow[1].getValue(); - if (acconfig_weight_kgs.getValue()) { - obj["FF1"].setText(sprintf("%s", math.round(fuel1 * LBS2KGS, 10))); - obj["FF2"].setText(sprintf("%s", math.round(fuel2 * LBS2KGS, 10))); - obj["FFlow1-weight-unit"].setText("KG/H"); - obj["FFlow2-weight-unit"].setText("KG/H"); - } else { - obj["FF1"].setText(sprintf("%s", math.round(fuel1, 10))); - obj["FF2"].setText(sprintf("%s", math.round(fuel2, 10))); - obj["FFlow1-weight-unit"].setText("LBS/H"); - obj["FFlow2-weight-unit"].setText("LBS/H"); - } - - if (fadec.FADEC.Eng1.ff == 1) { - obj["FF1"].show(); - obj["FF1-XX"].hide(); - } else { - obj["FF1"].hide(); - obj["FF1-XX"].show(); - } - - if (fadec.FADEC.Eng2.ff == 1) { - obj["FF2"].show(); - obj["FF2-XX"].hide(); - } else { - obj["FF2"].hide(); - obj["FF2-XX"].show(); - } - - # EPR Limit - thrLimit = thr_limit.getValue(); - eprLimit = epr_limit.getValue(); - - obj["EPRLim-mode"].setText(sprintf("%s", thrLimit)); - obj["EPRLim"].setText(sprintf("%1.0f", math.floor(eprLimit))); - obj["EPRLim-decimal"].setText(sprintf("%03d", (eprLimit - int(eprLimit)) * 1000)); - - fadecPower1 = fadecpower_1.getValue(); - fadecPower2 = fadecpower_2.getValue(); - fadecPowerStart = fadecpowerup.getValue(); - - if (fadecPower1 or fadecPower2 or fadecPowerStart) { - obj["EPRLim-mode"].show(); - obj["EPRLim-XX"].hide(); - obj["EPRLim-XX2"].hide(); - } else { - obj["EPRLim-mode"].hide(); - obj["EPRLim-XX"].show(); - obj["EPRLim-XX2"].show(); - } - - if ((fadecPower1 or fadecPower2 or fadecPowerStart) and thrLimit != "MREV") { - obj["EPRLim"].show(); - obj["EPRLim-decpnt"].show(); - obj["EPRLim-decimal"].show(); - } else { - obj["EPRLim"].hide(); - obj["EPRLim-decpnt"].hide(); - obj["EPRLim-decimal"].hide(); - } - me.updateBase(notification); }, }; diff --git a/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas b/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas index d69f251c..7bbd3a8e 100644 --- a/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas +++ b/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas @@ -30,7 +30,7 @@ var ECAM_line7rc = props.globals.getNode("/ECAM/rightmsg/linec7", 1); var ECAM_line8rc = props.globals.getNode("/ECAM/rightmsg/linec8", 1); var canvas_upperECAM = { - new: func(svg) { + new: func(svg, name, type) { var obj = {parents: [canvas_upperECAM] }; obj.canvas = canvas.new({ "name": "upperECAM", @@ -43,13 +43,15 @@ var canvas_upperECAM = { obj.group = obj.canvas.createGroup(); obj.test = obj.canvas.createGroup(); + obj.typeString = type; + obj.font_mapper = func(family, weight) { return "LiberationFonts/LiberationSans-Regular.ttf"; }; canvas.parsesvg(obj.group, svg, {"font-mapper": obj.font_mapper} ); - - foreach(var key; obj.getKeys()) { + obj.keysHash = (type == "IAE" ? obj.getKeysIAE() : obj.getKeysCFM()); + foreach(var key; obj.keysHash) { obj[key] = obj.group.getElementById(key); var clip_el = obj.group.getElementById(key ~ "_clip"); @@ -75,12 +77,24 @@ var canvas_upperECAM = { obj.update_items = [ props.UpdateManager.FromHashValue("acconfigUnits", 1, func(val) { - if (val) { - obj["FOB-weight-unit"].setText("KG"); - obj["FFlow-weight-unit"].setText("KG/H"); + if (obj.typeString == "IAE") { + if (val) { + obj["FOB-weight-unit"].setText("KG"); + obj["FFlow1-weight-unit"].setText("KG/H"); + obj["FFlow2-weight-unit"].setText("KG/H"); + } else { + obj["FOB-weight-unit"].setText("LBS"); + obj["FFlow1-weight-unit"].setText("LBS/H"); + obj["FFlow2-weight-unit"].setText("LBS/H"); + } } else { - obj["FOB-weight-unit"].setText("LBS"); - obj["FFlow-weight-unit"].setText("LBS/H"); + if (val) { + obj["FOB-weight-unit"].setText("KG"); + obj["FFlow-weight-unit"].setText("KG/H"); + } else { + obj["FOB-weight-unit"].setText("LBS"); + obj["FFlow-weight-unit"].setText("LBS/H"); + } } obj.units = val; }), @@ -133,47 +147,9 @@ var canvas_upperECAM = { obj["FlapDots"].hide(); } }), - props.UpdateManager.FromHashValue("thrustLimit", nil, func(val) { - obj["N1Lim-mode"].setText(sprintf("%s", val)); - }), - props.UpdateManager.FromHashValue("n1Limit", 0.01, func(val) { - obj["N1Lim"].setText(sprintf("%s", math.floor(val + 0.05))); - obj["N1Lim-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1)))); - }), props.UpdateManager.FromHashValue("flexTemp", 1, func(val) { obj["FlxLimTemp"].setText(sprintf("%2.0d",val)); }), - props.UpdateManager.FromHashList(["fadecPower1", "fadecPower2", "fadecPowerStart","thrustLimit"], nil, func(val) { - if (val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) { - obj["N1Lim-mode"].show(); - obj["N1Lim-XX"].hide(); - obj["N1Lim-XX2"].hide(); - } else { - obj["N1Lim-mode"].hide(); - obj["N1Lim-XX"].show(); - obj["N1Lim-XX2"].show(); - } - - if ((val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) and val.thrustLimit != "MREV") { - obj["N1Lim"].show(); - obj["N1Lim-decpnt"].show(); - obj["N1Lim-decimal"].show(); - obj["N1Lim-percent"].show(); - } else { - obj["N1Lim"].hide(); - obj["N1Lim-decpnt"].hide(); - obj["N1Lim-decimal"].hide(); - obj["N1Lim-percent"].hide(); - } - - if ((val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) and val.thrustLimit == "FLX") { - obj["FlxLimDegreesC"].show(); - obj["FlxLimTemp"].show(); - } else { - obj["FlxLimDegreesC"].hide(); - obj["FlxLimTemp"].hide(); - } - }), props.UpdateManager.FromHashValue("slatLocked", nil, func(val) { if (val) { if (slatLockGoing == 0) { @@ -214,10 +190,18 @@ var canvas_upperECAM = { obj["N12-thr"].setRotation((val + 90) * D2R); }), props.UpdateManager.FromHashValue("reverser_1", 0.005, func(val) { - if (val < 0.01 and fadec.FADEC.Eng1.n1 == 1) { - obj["N11-thr"].show(); + if (obj.typeString == "IAE") { + if (val < 0.01 and fadec.FADEC.Eng1.epr == 1) { + obj["EPR1-thr"].show(); + } else { + obj["EPR1-thr"].hide(); + } } else { - obj["N11-thr"].hide(); + if (val < 0.01 and fadec.FADEC.Eng1.n1 == 1) { + obj["N11-thr"].show(); + } else { + obj["N11-thr"].hide(); + } } if (val >= 0.01 and fadec.FADEC.Eng1.n1 == 1) { @@ -235,10 +219,18 @@ var canvas_upperECAM = { } }), props.UpdateManager.FromHashValue("reverser_2", 0.005, func(val) { - if (val < 0.01 and fadec.FADEC.Eng2.n1 == 1) { - obj["N12-thr"].show(); + if (obj.typeString == "IAE") { + if (val < 0.01 and fadec.FADEC.Eng2.epr == 1) { + obj["EPR2-thr"].show(); + } else { + obj["EPR2-thr"].hide(); + } } else { - obj["N12-thr"].hide(); + if (val < 0.01 and fadec.FADEC.Eng2.n1 == 1) { + obj["N12-thr"].show(); + } else { + obj["N12-thr"].hide(); + } } if (val >= 0.01 and fadec.FADEC.Eng2.n1 == 1) { @@ -257,6 +249,33 @@ var canvas_upperECAM = { }), ]; + obj.update_items_fadec_powered_epr = [ + props.UpdateManager.FromHashValue("EPR_1", 0.01, func(val) { + obj["EPR1-needle"].setRotation((val + 90) * D2R); + }), + props.UpdateManager.FromHashValue("EPR_2", 0.01, func(val) { + obj["EPR2-needle"].setRotation((val + 90) * D2R); + }), + props.UpdateManager.FromHashValue("EPR_actual_1", 0.0001, func(val) { + obj["EPR1"].setText(sprintf("%s", math.floor(val + 0.05))); + obj["EPR1-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1)))); + }), + props.UpdateManager.FromHashValue("EPR_actual_2", 0.0001, func(val) { + obj["EPR1"].setText(sprintf("%s", math.floor(val + 0.05))); + obj["EPR2-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1)))); + }), + props.UpdateManager.FromHashValue("EPR_lim", 0.005, func(val) { + obj["EPR1-ylim"].setRotation((val + 90) * D2R); + obj["EPR2-ylim"].setRotation((val + 90) * D2R); + }), + props.UpdateManager.FromHashValue("EPRthr_1", 0.005, func(val) { + obj["EPR1-thr"].setRotation((val + 90) * D2R); + }), + props.UpdateManager.FromHashValue("EPRthr_2", 0.005, func(val) { + obj["EPR2-thr"].setRotation((val + 90) * D2R); + }), + ]; + obj.update_items_fadec_powered_n2 = [ props.UpdateManager.FromHashValue("N2_actual_1", 0.025, func(val) { obj["N21"].setText(sprintf("%s", math.floor(val + 0.05))); @@ -268,6 +287,104 @@ var canvas_upperECAM = { }), ]; + obj.update_items_cfm_only = [ + props.UpdateManager.FromHashValue("thrustLimit", nil, func(val) { + obj["N1Lim-mode"].setText(sprintf("%s", val)); + }), + props.UpdateManager.FromHashValue("n1Limit", 0.01, func(val) { + obj["N1Lim"].setText(sprintf("%s", math.floor(val + 0.05))); + obj["N1Lim-decimal"].setText(sprintf("%s", int(10 * math.mod(val + 0.05, 1)))); + }), + props.UpdateManager.FromHashList(["fadecPower1", "fadecPower2", "fadecPowerStart","thrustLimit"], nil, func(val) { + if (val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) { + obj["N1Lim-mode"].show(); + obj["N1Lim-XX"].hide(); + obj["N1Lim-XX2"].hide(); + } else { + obj["N1Lim-mode"].hide(); + obj["N1Lim-XX"].show(); + obj["N1Lim-XX2"].show(); + } + + if ((val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) and val.thrustLimit != "MREV") { + obj["N1Lim"].show(); + obj["N1Lim-decpnt"].show(); + obj["N1Lim-decimal"].show(); + obj["N1Lim-percent"].show(); + } else { + obj["N1Lim"].hide(); + obj["N1Lim-decpnt"].hide(); + obj["N1Lim-decimal"].hide(); + obj["N1Lim-percent"].hide(); + } + + if ((val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) and val.thrustLimit == "FLX") { + obj["FlxLimDegreesC"].show(); + obj["FlxLimTemp"].show(); + } else { + obj["FlxLimDegreesC"].hide(); + obj["FlxLimTemp"].hide(); + } + }), + ]; + + obj.update_items_iae_only = [ + props.UpdateManager.FromHashValue("thrustLimit", nil, func(val) { + obj["EPRLim-mode"].setText(sprintf("%s", val)); + }), + props.UpdateManager.FromHashValue("eprLimit", 0.01, func(val) { + obj["EPRLim"].setText(sprintf("%1.0f", math.floor(val))); + obj["EPRLim-decimal"].setText(sprintf("%03d", (val - int(val)) * 1000)); + }), + props.UpdateManager.FromHashList(["fadecPower1", "fadecPower2", "fadecPowerStart","thrustLimit"], nil, func(val) { + if (val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) { + obj["EPRLim-mode"].show(); + obj["EPRLim-XX"].hide(); + obj["EPRLim-XX2"].hide(); + } else { + obj["EPRLim-mode"].hide(); + obj["EPRLim-XX"].show(); + obj["EPRLim-XX2"].show(); + } + + if ((val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) and val.thrustLimit != "MREV") { + obj["EPRLim"].show(); + obj["EPRLim-decpnt"].show(); + obj["EPRLim-decimal"].show(); + } else { + obj["EPRLim"].hide(); + obj["EPRLim-decpnt"].hide(); + obj["EPRLim-decimal"].hide(); + } + + if ((val.fadecPower1 or val.fadecPower2 or val.fadecPowerStart) and val.thrustLimit == "FLX") { + obj["FlxLimDegreesC"].show(); + obj["FlxLimTemp"].show(); + } else { + obj["FlxLimDegreesC"].hide(); + obj["FlxLimTemp"].hide(); + } + }), + props.UpdateManager.FromHashValue("N1_mode_1", nil, func(val) { + if (fadec.FADEC.Eng1.n1 == 1 and val) { + obj["N11-thr"].show(); + obj["N11-ylim"].hide(); # Keep it hidden, since N1 mode limit calculation is not done yet + } else { + obj["N11-thr"].hide(); + obj["N11-ylim"].hide(); + } + }), + props.UpdateManager.FromHashValue("N1_mode_2", nil, func(val) { + if (fadec.FADEC.Eng2.n1 == 1 and val) { + obj["N12-thr"].show(); + obj["N12-ylim"].hide(); # Keep it hidden, since N1 mode limit calculation is not done yet + } else { + obj["N12-thr"].hide(); + obj["N12-ylim"].hide(); + } + }), + ]; + obj.update_items_fadec_powered_egt = [ props.UpdateManager.FromHashValue("egt_1", 0.5, func(val) { obj["EGT1"].setText(sprintf("%s", math.round(val))); @@ -392,17 +509,26 @@ var canvas_upperECAM = { obj._cachedN1 = [nil, nil]; obj._cachedN2 = [nil, nil]; obj._cachedEGT = [nil, nil]; + obj._cachedEPR = [nil, nil]; obj._cachedFF = [nil, nil]; return obj; }, - getKeys: func() { + getKeysCFM: func() { return ["N11-needle","N11-thr","N11-ylim","N11","N11-decpnt","N11-decimal","N11-box","N11-scale","N11-scale2","N11-scaletick","N11-scalenum","N11-XX","N11-XX2","N11-XX-box","EGT1-needle","EGT1","EGT1-scale","EGT1-box","EGT1-scale2","EGT1-scaletick", "EGT1-XX","N21","N21-decpnt","N21-decimal","N21-XX","FF1","FF1-XX","N12-needle","N12-thr","N12-ylim","N12","N12-decpnt","N12-decimal","N12-box","N12-scale","N12-scale2","N12-scaletick","N12-scalenum","N12-XX","N12-XX2","N12-XX-box","EGT2-needle","EGT2", "EGT2-scale","EGT2-box","EGT2-scale2","EGT2-scaletick","EGT2-XX","N22","N22-decpnt","N22-decimal","N22-XX","FF2","FF2-XX","FOB-LBS","FlapTxt","FlapDots","N1Lim-mode","N1Lim","N1Lim-decpnt","N1Lim-decimal","N1Lim-percent","N1Lim-XX","N1Lim-XX2","REV1", "REV1-box","REV2","REV2-box","ECAM_Left","ECAML1","ECAML2","ECAML3","ECAML4","ECAML5","ECAML6","ECAML7","ECAML8","ECAMR1", "ECAMR2", "ECAMR3", "ECAMR4", "ECAMR5", "ECAMR6", "ECAMR7", "ECAMR8", "ECAM_Right", "FOB-weight-unit","FFlow-weight-unit","SlatAlphaLock","SlatIndicator","FlapIndicator","SlatLine","FlapLine","aFloor","FlxLimDegreesC","FlxLimTemp"]; }, + getKeysIAE: func() { + return ["EPR1-needle","EPR1-thr","EPR1-ylim","EPR1","EPR1-decpnt","EPR1-decimal","EPR1-box","EPR1-scale","EPR1-scaletick","EPR1-scalenum","EPR1-XX","EPR1-XX2","EGT1-needle","EGT1","EGT1-scale","EGT1-box","EGT1-scale2","EGT1-scaletick","EGT1-XX", + "N11-needle","N11-thr","N11-ylim","N11","N11-decpnt","N11-decimal","N11-scale","N11-scale2","N11-scaletick","N11-scalenum","N11-XX","N21","N21-decpnt","N21-decimal","N21-XX","FF1","FF1-XX","EPR2-needle","EPR2-thr","EPR2-ylim","EPR2","EPR2-decpnt", + "EPR2-decimal","EPR2-box","EPR2-scale","EPR2-scaletick","EPR2-scalenum","EPR2-XX","EPR2-XX2","EGT2-needle","EGT2","EGT2-scale","EGT2-scale2","EGT2-box","EGT2-scaletick","EGT2-XX","N12-needle","N12-thr","N12-ylim","N12","N12-decpnt","N12-decimal", + "N12-scale","N12-scale2","N12-scaletick","N12-scalenum","N12-XX","N22","N22-decpnt","N22-decimal","N22-XX","FF2","FF2-XX","FOB-LBS","FlapTxt","FlapDots","EPRLim-mode","EPRLim","EPRLim-decpnt","EPRLim-decimal","EPRLim-XX","EPRLim-XX2","REV1","REV1-box", + "REV2","REV2-box","ECAM_Left","ECAML1","ECAML2","ECAML3","ECAML4","ECAML5","ECAML6","ECAML7","ECAML8", "ECAMR1", "ECAMR2", "ECAMR3", "ECAMR4", "ECAMR5", "ECAMR6", "ECAMR7", "ECAMR8", "ECAM_Right", + "FFlow1-weight-unit", "FFlow2-weight-unit", "FOB-weight-unit","SlatAlphaLock","SlatIndicator","FlapIndicator","SlatLine","FlapLine","aFloor","FlxLimDegreesC","FlxLimTemp"]; + }, getKeysTest: func() { return ["Test_white","Test_text"]; }, @@ -428,7 +554,7 @@ var canvas_upperECAM = { me[key].setColor(me.getColorString(node.getValue())); }, 0, 0); }, - update: func(notification) { + updateCommon: func(notification) { me.updatePower(); if (me.test.getVisible() == 1) { @@ -472,12 +598,6 @@ var canvas_upperECAM = { me.updateFF2(); } - if (slatLockFlash) { - me["SlatAlphaLock"].show(); - } else { - me["SlatAlphaLock"].hide(); - } - if (fadec.FADEC.Eng1.n1 or fadec.FADEC.Eng2.n1) { foreach(var update_item; me.update_items_fadec_powered_n1) { @@ -506,11 +626,51 @@ var canvas_upperECAM = { } } + if (slatLockFlash) { + me["SlatAlphaLock"].show(); + } else { + me["SlatAlphaLock"].hide(); + } + foreach (var update_item; me.ecam_update) { update_item.update(notification); } }, + updateCFM: func(notification) { + me.updateCommon(notification); + if (me.group.getVisible() == 0) { + return; + } + + foreach (var update_item; me.update_items_cfm_only) { + update_item.update(notification); + } + }, + updateIAE: func(notification) { + me.updateCommon(notification); + if (me.group.getVisible() == 0) { + return; + } + + foreach (var update_item; me.update_items_iae_only) { + update_item.update(notification); + } + + if (fadec.FADEC.Eng1.epr != me._cachedEPR[0]) { + me.updateEPR1(); + } + if (fadec.FADEC.Eng2.epr != me._cachedEPR[1]) { + me.updateEPR2(); + } + + if (fadec.FADEC.Eng1.epr or fadec.FADEC.Eng2.epr) { + foreach(var update_item; me.update_items_fadec_powered_epr) + { + update_item.update(notification); + } + } + }, updateN11: func() { me._cachedN1[0] = fadec.FADEC.Eng1.n1; @@ -521,13 +681,16 @@ var canvas_upperECAM = { me["N11-decimal"].show(); me["N11-decpnt"].show(); me["N11-needle"].show(); - me["N11-ylim"].show(); me["N11-scaletick"].show(); me["N11-scalenum"].show(); - me["N11-box"].show(); me["N11-XX"].hide(); - me["N11-XX2"].hide(); - me["N11-XX-box"].hide(); + + if (me.typeString == "CFM") { + me["N11-ylim"].show(); + me["N11-box"].show(); + me["N11-XX2"].hide(); + me["N11-XX-box"].hide(); + } } else { me["N11-scale"].setColor(0.7333,0.3803,0); me["N11-scale2"].setColor(0.7333,0.3803,0); @@ -535,13 +698,16 @@ var canvas_upperECAM = { me["N11-decimal"].hide(); me["N11-decpnt"].hide(); me["N11-needle"].hide(); - me["N11-ylim"].hide(); me["N11-scaletick"].hide(); me["N11-scalenum"].hide(); - me["N11-box"].hide(); me["N11-XX"].show(); - me["N11-XX2"].show(); - me["N11-XX-box"].show(); + + if (me.typeString == "CFM") { + me["N11-ylim"].hide(); + me["N11-box"].hide(); + me["N11-XX2"].show(); + me["N11-XX-box"].show(); + } } }, updateN12: func() { @@ -553,13 +719,16 @@ var canvas_upperECAM = { me["N12-decimal"].show(); me["N12-decpnt"].show(); me["N12-needle"].show(); - me["N12-ylim"].show(); me["N12-scaletick"].show(); me["N12-scalenum"].show(); - me["N12-box"].show(); me["N12-XX"].hide(); - me["N12-XX2"].hide(); - me["N12-XX-box"].hide(); + + if (me.typeString == "CFM") { + me["N12-ylim"].show(); + me["N12-box"].show(); + me["N12-XX2"].hide(); + me["N12-XX-box"].hide(); + } } else { me["N12-scale"].setColor(0.7333,0.3803,0); me["N12-scale2"].setColor(0.7333,0.3803,0); @@ -567,15 +736,19 @@ var canvas_upperECAM = { me["N12-decimal"].hide(); me["N12-decpnt"].hide(); me["N12-needle"].hide(); - me["N12-ylim"].hide(); me["N12-scaletick"].hide(); me["N12-scalenum"].hide(); - me["N12-box"].hide(); me["N12-XX"].show(); - me["N12-XX2"].show(); - me["N12-XX-box"].show(); + + if (me.typeString == "CFM") { + me["N12-ylim"].hide(); + me["N12-box"].hide(); + me["N12-XX2"].show(); + me["N12-XX-box"].show(); + } } }, + updateN21: func() { me._cachedN2[0] = fadec.FADEC.Eng1.n2; if (fadec.FADEC.Eng1.n2 == 1) { @@ -604,6 +777,7 @@ var canvas_upperECAM = { me["N22-XX"].show(); } }, + updateEGT1: func() { me._cachedEGT[0] = fadec.FADEC.Eng1.egt; if (fadec.FADEC.Eng1.egt == 1) { @@ -644,6 +818,63 @@ var canvas_upperECAM = { me["EGT2-XX"].show(); } }, + + updateEPR1: func() { + me._cachedEPR[0] = fadec.FADEC.Eng1.epr; + if (fadec.FADEC.Eng1.epr == 1) { + me["EPR1-scale"].setColor(0.8078,0.8039,0.8078); + me["EPR1"].show(); + me["EPR1-decpnt"].show(); + me["EPR1-decimal"].show(); + me["EPR1-needle"].show(); + me["EPR1-ylim"].show(); + me["EPR1-scaletick"].show(); + me["EPR1-scalenum"].show(); + me["EPR1-box"].show(); + me["EPR1-XX"].hide(); + me["EPR1-XX2"].hide(); + } else { + me["EPR1-scale"].setColor(0.7333,0.3803,0); + me["EPR1"].hide(); + me["EPR1-decpnt"].hide(); + me["EPR1-decimal"].hide(); + me["EPR1-needle"].hide(); + me["EPR1-ylim"].hide(); + me["EPR1-scaletick"].hide(); + me["EPR1-scalenum"].hide(); + me["EPR1-box"].hide(); + me["EPR1-XX"].show(); + me["EPR1-XX2"].show(); + } + }, + updateEPR2: func() { + me._cachedEPR[1] = fadec.FADEC.Eng2.epr; + if (fadec.FADEC.Eng2.epr == 1) { + me["EPR2-scale"].setColor(0.8078,0.8039,0.8078); + me["EPR2"].show(); + me["EPR2-decpnt"].show(); + me["EPR2-decimal"].show(); + me["EPR2-needle"].show(); + me["EPR2-ylim"].show(); + me["EPR2-scaletick"].show(); + me["EPR2-scalenum"].show(); + me["EPR2-box"].show(); + me["EPR2-XX"].hide(); + me["EPR2-XX2"].hide(); + } else { + me["EPR2-scale"].setColor(0.7333,0.3803,0); + me["EPR2"].hide(); + me["EPR2-decpnt"].hide(); + me["EPR2-decimal"].hide(); + me["EPR2-needle"].hide(); + me["EPR2-ylim"].hide(); + me["EPR2-scaletick"].hide(); + me["EPR2-scalenum"].hide(); + me["EPR2-box"].hide(); + me["EPR2-XX"].show(); + me["EPR2-XX2"].show(); + } + }, updateFF1: func() { me._cachedFF[0] = fadec.FADEC.Eng1.ff; if (fadec.FADEC.Eng1.ff == 1) { @@ -664,6 +895,7 @@ var canvas_upperECAM = { me["FF2-XX"].show(); } }, + updateTest: func() { if (du3_test_time.getValue() + 1 >= pts.Sim.Time.elapsedSec.getValue()) { me["Test_white"].show(); @@ -717,22 +949,34 @@ var UpperECAMRecipient = { new: func(_ident) { - var new_class = emesary.Recipient.new(_ident); - new_class.MainScreen = nil; - new_class.Receive = func(notification) + var EWDRecipient = emesary.Recipient.new(_ident); + EWDRecipient.MainScreen = nil; + EWDRecipient.type = eng_option.getValue() == "IAE" ? 1 : 0; + EWDRecipient.Receive = func(notification) { if (notification.NotificationType == "FrameNotification") { - if (new_class.MainScreen == nil) - new_class.MainScreen = canvas_upperECAM.new("Aircraft/A320-family/Models/Instruments/Upper-ECAM/res/cfm-eis2.svg", "A320 E/WD CFM"); - #if (!math.mod(notifications.frameNotification.FrameCount,2)){ - new_class.MainScreen.update(notification); - #} + if (EWDRecipient.MainScreen == nil) { + if (EWDRecipient.type) { + EWDRecipient.MainScreen = canvas_upperECAM.new("Aircraft/A320-family/Models/Instruments/Upper-ECAM/res/iae-eis2.svg", "A320 E/WD IAE", "IAE"); + } else { + EWDRecipient.MainScreen = canvas_upperECAM.new("Aircraft/A320-family/Models/Instruments/Upper-ECAM/res/cfm-eis2.svg", "A320 E/WD CFM", "CFM"); + } + } + + #if (!math.mod(notifications.frameNotification.FrameCount,2)){ + if (EWDRecipient.type) { + EWDRecipient.MainScreen.updateIAE(notification); + } else { + EWDRecipient.MainScreen.updateCFM(notification); + + } + #} return emesary.Transmitter.ReceiptStatus_OK; } return emesary.Transmitter.ReceiptStatus_NotProcessed; }; - return new_class; + return EWDRecipient; }, }; @@ -767,6 +1011,15 @@ input = { egt_1_needle: "/ECAM/Upper/EGT[0]", egt_2_needle: "/ECAM/Upper/EGT[1]", + # N1 parameters + EPR_1: "/ECAM/Upper/EPR[0]", + EPR_2: "/ECAM/Upper/EPR[1]", + EPR_actual_1: "/engines/engine[0]/epr-actual", + EPR_actual_2: "/engines/engine[1]/epr-actual", + EPR_lim: "/ECAM/Upper/EPRylim", + EPRthr_1: "/ECAM/Upper/EPRthr[0]", + EPRthr_2: "/ECAM/Upper/EPRthr[1]", + # fuel flow fuelflow_1: "/engines/engine[0]/fuel-flow_actual", fuelflow_2: "/engines/engine[1]/fuel-flow_actual", @@ -784,12 +1037,15 @@ input = { # fadec alphaFloor: "/systems/thrust/alpha-floor", + eprLimit: "/controls/engines/epr-limit", thrustLimit: "/controls/engines/thrust-limit", n1Limit: "/controls/engines/n1-limit", flexTemp: "/FMGC/internal/flex", fadecPower1: "/systems/fadec/powered1", fadecPower2: "/systems/fadec/powered2", fadecPowerStart: "/systems/fadec/powerup", + n1_mode_1: "/systems/fadec/n1mode1", + n1_mode_2: "/systems/fadec/n1mode2", # ecam ecamMsg1: "/ECAM/msg/line1",