{ "custom": { "alarm_message": null, "covert_mode": true, "disconnected": true, "display_icon": true, "plc": "System", "priority": 0, "priority_string": "No Active Alarms", "running": false, "searchId": "PLC01", "state": 0, "state_string": "Off(Inactive)" }, "params": { "angle": 0, "directionLeft": false, "forceFaultStatus": null, "forceRunningStatus": null, "tagProps": [ "System/MCM01/Conveyor/UL1_3_VFD1", "value", "value", "value", "value", "value", "value", "value", "value", "value" ] }, "propConfig": { "custom.covert_mode": { "binding": { "config": { "path": "view.custom.state" }, "transforms": [ { "expression": "case(\t{value},\r\n\t\t0, True,\r\n\t\t1, True,\r\n\t\t2, {session.custom.alarm_filter.show_running},\r\n\t\t3, {session.custom.alarm_filter.show_diagnostic} || {session.custom.alarm_filter.show_running},\r\n\t\t4, True,\r\n\t\t5, True,\r\n\t\t6, {session.custom.alarm_filter.show_diagnostic} || {session.custom.alarm_filter.show_running},\r\n\t\t7, True,\r\n\t\t8, True,\r\n\t\t9, True,\r\n\t\t13, True,\r\n\t\t14, True,\r\n\t\t61, True,\r\n 131, True,\t\r\n\t\tFalse )", "type": "expression" } ], "type": "property" }, "persistent": true }, "custom.disconnected": { "binding": { "config": { "fallbackDelay": 2.5, "mode": "indirect", "references": { "0": "{view.params.tagProps[0]}", "fc": "{session.custom.fc}" }, "tagPath": "[{fc}_SCADA_TAG_PROVIDER]{0}/STATE" }, "transforms": [ { "expression": "!isGood({value})", "type": "expression" } ], "type": "tag" }, "persistent": true }, "custom.display_icon": { "binding": { "config": { "expression": "{this.custom.covert_mode} \u003e 0" }, "type": "expr" }, "persistent": true }, "custom.plc": { "binding": { "config": { "path": "view.params.tagProps[0]" }, "transforms": [ { "expression": "split({value}, \"/\")[0]", "type": "expression" } ], "type": "property" }, "persistent": true }, "custom.priority": { "binding": { "config": { "path": "view.custom.state" }, "transforms": [ { "fallback": 0, "inputType": "scalar", "mappings": [ { "input": 0, "output": 0 }, { "input": 1, "output": 0 }, { "input": 2, "output": 0 }, { "input": 3, "output": 4 }, { "input": 4, "output": 1 }, { "input": 5, "output": 3 }, { "input": 6, "output": 4 }, { "input": 7, "output": 1 }, { "input": 8, "output": 1 }, { "input": 9, "output": 1 }, { "input": 13, "output": 1 }, { "input": 14, "output": 2 }, { "input": 61, "output": 4 } ], "outputType": "scalar", "type": "map" } ], "type": "property" }, "persistent": true }, "custom.priority_string": { "binding": { "config": { "path": "view.custom.state" }, "transforms": [ { "fallback": "Unknown", "inputType": "scalar", "mappings": [ { "input": 0, "output": "No Active Alarms" }, { "input": 1, "output": "No Active Alarms" }, { "input": 2, "output": "No Active Alarms" }, { "input": 3, "output": "Diagnostic" }, { "input": 4, "output": "High" }, { "input": 5, "output": "Low" }, { "input": 6, "output": "Diagnostic" }, { "input": 7, "output": "High" }, { "input": 8, "output": "High" }, { "input": 9, "output": "High" }, { "input": 13, "output": "High" }, { "input": 14, "output": "Medium" }, { "input": 61, "output": "Diagnostic" }, { "input": 131, "output": "Medium" } ], "outputType": "scalar", "type": "map" } ], "type": "property" }, "persistent": true }, "custom.running": { "binding": { "config": { "expression": "{view.custom.state} \u003d 1" }, "type": "expr" }, "persistent": true }, "custom.searchId": { "binding": { "config": { "path": "session.custom.searchId" }, "type": "property" }, "persistent": true }, "custom.state": { "binding": { "config": { "fallbackDelay": 2.5, "mode": "indirect", "references": { "0": "{view.params.tagProps[0]}", "fc": "{session.custom.fc}" }, "tagPath": "[{fc}_SCADA_TAG_PROVIDER]{0}/STATE" }, "transforms": [ { "expression": "coalesce({value},{view.params.forceFaultStatus},0)", "type": "expression" } ], "type": "tag" }, "persistent": true }, "custom.state_string": { "binding": { "config": { "expression": "case({view.custom.state},\r\n0, \"Off(Inactive)\",\r\n1, \"Enabled, Not Running\",\r\n2, \"Running\",\r\n3, \"Energy Management\",\r\n4, \"Jammed\",\r\n5, \"Full\",\r\n6, \"Maintenance Mode / Conveyor Stopped In Maintenance Mode\",\r\n7, \"Communication Fault\",\r\n8, \"VFD Fault\",\r\n9, \"E-Stop\",\r\n13,\"Encoder_Fault\",\r\n14,\"Stopped\",\r\n61,\"Conveyor Running In Maintenance Mode\",\r\n131, \"Disconnected\",\r\n\"Unknown\")" }, "type": "expr" }, "persistent": true }, "params.angle": { "paramDirection": "input", "persistent": true }, "params.directionLeft": { "paramDirection": "input", "persistent": true }, "params.forceFaultStatus": { "paramDirection": "input", "persistent": true }, "params.forceRunningStatus": { "paramDirection": "input", "persistent": true }, "params.tagProps": { "paramDirection": "inout", "persistent": true } }, "props": { "defaultSize": { "height": 20, "width": 29 } }, "root": { "children": [ { "meta": { "name": "RunningStatus" }, "position": { "grow": 1 }, "propConfig": { "position.display": { "binding": { "config": { "expression": "if(({view.custom.display_icon} || ({view.custom.show_running} \u0026\u0026 !{view.custom.show_error})) \u0026\u0026 !{view.params.directionLeft}, True, False)" }, "type": "expr" } }, "props.elements[0].fill.paint": { "binding": { "config": { "expression": "if(\r\n {view.custom.disconnected},\r\n \"#000000\",\r\n switch(\r\n toInt({view.custom.state}),\r\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 13, 14, 61, 131,\r\n \"#c2c2c2\", \"#c9fcc0\", \"#00ff11\", \"#00ffd0\", \"#ff8c00\",\r\n \"#0008ff\", \"#946446\", \"#ff0000\", \"#ff0000\", \"#ff0000\", \"#ff8c00\", \"#c2c2c2\", \"#B45C5C\", \"#c2c2c2\",\r\n \"#fff700\"\r\n )\r\n)\r\n" }, "type": "expr" } }, "props.style.transform": { "binding": { "config": { "fallbackDelay": 2.5, "mode": "indirect", "references": { "0": "{view.params.tagProps[0]}", "fc": "{session.custom.fc}" }, "tagPath": "[{fc}_SCADA_TAG_PROVIDER]{0}/Maintenance/Direction" }, "transforms": [ { "expression": "coalesce({value},{view.params.forceFaultStatus},\"\")", "type": "expression" }, { "fallback": "", "inputType": "scalar", "mappings": [ { "input": true, "output": "scaleX(-1)" } ], "outputType": "scalar", "type": "map" } ], "type": "tag" } } }, "props": { "elements": [ { "d": "M 0 0 L 40 0 L 40 0 L 70 30 L 40 60 L 40 60 L 0 60 L 30 30 Z", "fill": {}, "name": "path", "stroke": { "paint": "#4c4c4c", "width": "2" }, "type": "path" } ], "style": { "overflow": "hidden" }, "viewBox": "-1.5 -1.5 73 63" }, "type": "ia.shapes.svg" } ], "events": { "dom": { "onClick": { "config": { "script": "\tsystem.perspective.openDock(\u0027Docked-East-VFD\u0027,params\u003d{\u0027tagProps\u0027:self.view.params.tagProps})" }, "scope": "G", "type": "script" }, "onDoubleClick": { "config": { "script": "\ttagProps \u003d self.view.params.tagProps\n\tsystem.perspective.openPopup(\"StatusPopUP\", \"PopUp-Views/Controller-Equipment/Information\", params \u003d{\"tagProps\":tagProps})\n\t" }, "enabled": false, "scope": "G", "type": "script" }, "onMouseEnter": { "config": { "script": "\tfrom time import sleep\n\t\n\talarm \u003d []\n\tmessage \u003d None\n\t\n\tsleep(0.5)\n\t\n\tif system.tag.exists(\"System/aws_data\"):\n\t\tif self.view.params.tagProps[0] !\u003d \"\":\n\t\t\ttags_to_read \u003d system.tag.readBlocking(\"System/aws_data\")\n\t\t\tdecode_alarm_data \u003d system.util.jsonDecode(tags_to_read[0].value)\n\t\t\talarm \u003d [decode_alarm_data[i] for i in decode_alarm_data\n\t\t\t\t\tif decode_alarm_data[i][\u0027sourceId\u0027].startswith(self.view.params.tagProps[0])]\n\t\tif alarm:\n\t\t\talarm \u003d sorted(alarm, key \u003d lambda t:t[\u0027timestamp\u0027], reverse\u003dTrue)\n\t\t\tmessage \u003d max(alarm, key \u003d lambda p:p[\u0027priority\u0027]).get(\u0027message\u0027)\n\t\t\tif len(alarm) \u003e 1:\n\t\t\t\tmessage +\u003d \" (+\" + str(len(alarm)-1) + \")\"\n\tself.view.custom.alarm_message \u003d message" }, "scope": "G", "type": "script" } } }, "meta": { "name": "root", "tooltip": { "enabled": true, "location": "top-left", "style": {} } }, "propConfig": { "meta.tooltip.style.classes": { "binding": { "config": { "expression": "{view.custom.priority}" }, "transforms": [ { "fallback": "Alarms-Styles/NoAlarm", "inputType": "scalar", "mappings": [ { "input": 1, "output": "Alarms-Styles/High" }, { "input": 2, "output": "Alarms-Styles/Medium" }, { "input": 3, "output": "Alarms-Styles/Low" }, { "input": 4, "output": "Alarms-Styles/Diagnostic" } ], "outputType": "style-list", "type": "map" } ], "type": "expr" } }, "meta.tooltip.text": { "binding": { "config": { "expression": "if(\n {view.custom.disconnected} \u003d false,\n \"Source Id: \" + {view.params.tagProps[0]} + \", Priority: \" + {view.custom.priority_string} + \", State: \" + {view.custom.state_string},\n \"Device Disconnected\"\n)\n" }, "type": "expr" } }, "meta.visible": { "binding": { "config": { "path": "view.custom.display_icon" }, "type": "property" } }, "props.style.borderStyle": { "binding": { "config": { "path": "view.custom.disconnected" }, "enabled": false, "transforms": [ { "fallback": "", "inputType": "scalar", "mappings": [ { "input": true, "output": "solid" }, { "input": false, "output": "none" } ], "outputType": "scalar", "type": "map" } ], "type": "property" } } }, "props": { "justify": "center", "style": { "borderColor": "#FF0000", "borderStyle": "none", "borderWidth": "2px", "cursor": "pointer" } }, "type": "ia.container.flex" } }