From fd5cf5466a0393717696985d11257a1476be8da1 Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Fri, 5 Nov 2021 21:40:42 +0000 Subject: [PATCH] IESI: improve - if you have excess motion during INIT, it inits to a failure message; and then you have to reset it. --- Models/Instruments/IESI/IESI.nas | 85 +++++- Models/Instruments/IESI/res/iesi.svg | 401 ++++++++++++++++----------- Nasal/Systems/electrical.nas | 2 + 3 files changed, 314 insertions(+), 174 deletions(-) diff --git a/Models/Instruments/IESI/IESI.nas b/Models/Instruments/IESI/IESI.nas index c7231d65..a9d45404 100644 --- a/Models/Instruments/IESI/IESI.nas +++ b/Models/Instruments/IESI/IESI.nas @@ -11,6 +11,11 @@ var _showIESI = 0; var _fast = 0; var _IESITime = 0; +var pinPrograms = { + metricAltitude: 1, + showInHg: 1, +}; + var canvas_IESI = { new: func(svg, name) { var obj = {parents: [canvas_IESI] }; @@ -50,6 +55,10 @@ var canvas_IESI = { obj.AI_horizon_rot = obj["AI_horizon"].createTransform(); obj.middleAltOffset = nil; + obj._excessMotion = 0; + obj.canReset = 0; + obj.isNegativeAlt = 0; + obj.att10s.hide(); obj.update_items = [ props.UpdateManager.FromHashValue("airspeed", nil, func(val) { @@ -72,10 +81,10 @@ var canvas_IESI = { if (val.altitude < 0) { obj["negText"].show(); - obj["negText2"].show(); + obj.isNegativeAlt = 1; } else { obj["negText"].hide(); - obj["negText2"].hide(); + obj.isNegativeAlt = 0; } obj.altOffset = (val.altitude / 500) - int(val.altitude / 500); @@ -149,7 +158,7 @@ var canvas_IESI = { return obj; }, getKeys: func() { - return ["IESI","IESI_Init","ASI_scale","ASI_mach","ASI_mach_decimal","AI_center","AI_horizon","AI_bank","AI_slipskid","ALT_scale","ALT_one","ALT_two","ALT_three","ALT_four","ALT_five","ALT_digits","ALT_tens","ALT_meters","QNH_setting","QNH_std","negText","negText2","AI_bank_scale"]; + return ["IESI","IESI_Init","att90s","att10s","ATTflag","ALTwarn","SPDwarn","ASI_scale","ASI_mach","ASI_mach_decimal","AI_center","AI_index","AI_horizon","AI_sky_bank","AI_bank","AI_bank_center","AI_slipskid","ALT_scale","ALT_one","ALT_two","ALT_three","ALT_four","ALT_five","ALT_digits","ALT_tens","ALT_meters","QNH_setting","QNH_std","negText","negText2","AI_bank_scale","metricM","metricBox"]; }, update: func(notification) { if (notification.qnh_inhg != me._cachedInhg) { @@ -163,12 +172,61 @@ var canvas_IESI = { } if (_IESITime + 90 >= notification.elapsedTime) { + if (notification.groundspeed > 2) { + me._excessMotion = 1; + } + me["IESI"].hide(); me["IESI_Init"].show(); + if (_fast) { + me["att10s"].show(); + me["att90s"].hide(); + } else { + me["att10s"].hide(); + me["att90s"].show(); + } + me["ATTflag"].hide(); return; } else { - me["IESI_Init"].hide(); - me["IESI"].show(); + if (pinPrograms.metricAltitude) { + me["ALT_meters"].show(); + me["metricM"].show(); + me["metricBox"].show(); + + if (me.isNegativeAlt) { + me["negText2"].show(); + } else { + me["negText2"].hide(); + } + } else { + me["ALT_meters"].hide(); + me["metricM"].hide(); + me["metricBox"].hide(); + me["negText2"].hide(); + } + _fast = 0; + + if (!me._excessMotion) { + me["IESI_Init"].hide(); + me["IESI"].show(); + me["AI_bank"].show(); + me["AI_bank_center"].show(); + me["AI_bank_scale"].show(); + me["AI_index"].show(); + me["AI_horizon"].show(); + me["AI_sky_bank"].show(); + me["ATTflag"].hide(); + } else { + me["IESI_Init"].hide(); + me["IESI"].show(); + me["AI_bank"].hide(); + me["AI_bank_center"].hide(); + me["AI_bank_scale"].hide(); + me["AI_index"].hide(); + me["AI_horizon"].hide(); + me["AI_sky_bank"].hide(); + me["ATTflag"].show(); + } } foreach(var update_item; me.update_items) @@ -181,7 +239,11 @@ var canvas_IESI = { me["QNH_setting"].hide(); me["QNH_std"].show(); } else { - me["QNH_setting"].setText(sprintf("%4.0f", notification.qnh_hpa) ~ "/" ~ sprintf("%2.2f", notification.qnh_inhg)); + if (pinPrograms.showInHg) { + me["QNH_setting"].setText(sprintf("%4.0f", notification.qnh_hpa) ~ "/" ~ sprintf("%2.2f", notification.qnh_inhg)); + } else { + me["QNH_setting"].setText(sprintf("%4.0f", notification.qnh_hpa)); + } me["QNH_setting"].show(); me["QNH_std"].hide(); } @@ -189,13 +251,17 @@ var canvas_IESI = { _transientVar: 0, updatePower: func(notification) { # todo 20W power consumption - if (notification.attReset == 1) { - if (notification.iesiInit and _IESITime + 90 >= notification.elapsedTime) { + if (notification.attReset == 1 and me.canReset) { + if (notification.iesiInit and _IESITime + 90 >= notification.elapsedTime and !me._excessMotion) { _fast = 1; } else { _fast = 0; } + me._excessMotion = 0; iesi_init.setBoolValue(0); + me.canReset = 0; + } else if (_IESITime + 90 < notification.elapsedTime and notification.iesiInit and !me.canReset) { + me.canReset = 1; } if (notification.dcEss >= 25 or (notification.relay7XB and notification.dcHot1 >= 25)) { @@ -204,7 +270,6 @@ var canvas_IESI = { iesi_init.setBoolValue(1); if (_fast) { _IESITime = notification.elapsedTime - 80; - _fast = 0; } else { _IESITime = notification.elapsedTime; } @@ -216,7 +281,7 @@ var canvas_IESI = { if (!me._transientVar) { me._transientVar = 1; settimer(func() { - if (systems.ELEC.Bus.dcEss.getValue() >= 25 or (systems.ELEC.Bus.dcHot1.getValue() >= 25 and systems.ELEC.Relay.relay7XB.getValue())) { + if (systems.ELEC.Bus.dcEss.getValue() >= 25 or (systems.ELEC.Bus.dcHot1703.getValue() >= 25 and systems.ELEC.Relay.relay7XB.getValue())) { me._transientVar = 0; } else { _showIESI = 0; diff --git a/Models/Instruments/IESI/res/iesi.svg b/Models/Instruments/IESI/res/iesi.svg index 9b360520..fc9c3e3a 100644 --- a/Models/Instruments/IESI/res/iesi.svg +++ b/Models/Instruments/IESI/res/iesi.svg @@ -1,19 +1,19 @@ + inkscape:version="1.1 (c68e22c387, 2021-05-23)" + sodipodi:docname="iesi.svg" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:dc="http://purl.org/dc/elements/1.1/"> @@ -38,16 +38,16 @@ inkscape:pageopacity="1" inkscape:pageshadow="2" inkscape:window-width="1920" - inkscape:window-height="1017" + inkscape:window-height="986" id="namedview371" showgrid="true" - inkscape:zoom="0.45254834" - inkscape:cx="877.65465" - inkscape:cy="962.66623" - inkscape:window-x="1592" - inkscape:window-y="-8" + inkscape:zoom="0.93517029" + inkscape:cx="815.35952" + inkscape:cy="847.9739" + inkscape:window-x="-11" + inkscape:window-y="-11" inkscape:window-maximized="1" - inkscape:current-layer="IESI" + inkscape:current-layer="ATTflag" showguides="true" inkscape:snap-global="false" units="pt" @@ -55,7 +55,9 @@ fit-margin-left="0" fit-margin-right="0" fit-margin-bottom="0" - borderlayer="false"> + borderlayer="false" + inkscape:pagecheckerboard="0" + inkscape:document-units="pt"> + + + INIT 90s + + + + SPD + + + + ALT + + + + ATT + + + + width="406.27161" + id="rect12278" + style="fill:#c9d121;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.17302;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> INIT 90s + y="796.4032" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:86px;line-height:1.25;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke-width:0.75">ATT : RST - SPD - - ALT - ATT + style="opacity:1;fill:#1fa7f8;fill-opacity:1;stroke:none;stroke-width:2.58922;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:9.6;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> 10 + style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:9.6;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> + style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:9.6;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> + style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:9.6;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> + style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:9.6;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> 30 + style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:9.6;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> 40 + style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:11.7112;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> + style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:9.6;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> + style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:9.6;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> 10 + style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:9.6;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> + style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:9.6;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> + style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:9.6;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> + style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:9.6;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> 30 + style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:9.60008;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> 50 + style="fill:none;stroke:#ff0000;stroke-width:5.7;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#ff0000;stroke-width:7.42501;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#ff0000;stroke-width:6.6;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="opacity:0.46;fill:#ff00ff;fill-opacity:1;stroke:none;stroke-width:1.27697;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> .   40402020000080806060404020200000808060 + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:70px;line-height:87%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';fill:#0dc04b;fill-opacity:1;stroke-width:0.75">60 + style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:4.30556;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;fill-opacity:1;stroke:#c9d121;stroke-width:3.54375;stroke-linecap:square;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:8.10006;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> NNEG NEG + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:74px;line-height:1.25;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';fill:#ffffff;fill-opacity:1;stroke-width:0.75">NEG @@ -1836,7 +1896,7 @@ sodipodi:nodetypes="cc" /> STD + ATT 10s diff --git a/Nasal/Systems/electrical.nas b/Nasal/Systems/electrical.nas index 300cfc89..36e532d4 100644 --- a/Nasal/Systems/electrical.nas +++ b/Nasal/Systems/electrical.nas @@ -26,7 +26,9 @@ var ELEC = { dc1: props.globals.getNode("/systems/electrical/bus/dc-1"), dc2: props.globals.getNode("/systems/electrical/bus/dc-2"), dcHot1: props.globals.getNode("/systems/electrical/bus/dc-hot-1"), + dcHot1703: props.globals.getNode("/systems/electrical/bus/sub-bus/dc-hot-1-703"), dcHot2: props.globals.getNode("/systems/electrical/bus/dc-hot-2"), + dcHot2704: props.globals.getNode("/systems/electrical/bus/sub-bus/dc-hot-2-704"), }, Fail: { acEssBusFault: props.globals.getNode("/systems/failures/electrical/ac-ess-bus"),