348 lines
9.7 KiB
Plaintext
348 lines
9.7 KiB
Plaintext
{
|
|
"custom": {
|
|
"alarm_message": null,
|
|
"disconnected": true,
|
|
"plc": "value",
|
|
"priority": 0,
|
|
"priority_string": "No Active Alarms",
|
|
"searchId": "PLC01",
|
|
"state": 0,
|
|
"state_string": "Disabled"
|
|
},
|
|
"params": {
|
|
"forceFaultStatus": null,
|
|
"forceRunningStatus": null,
|
|
"tagProps": [
|
|
"value",
|
|
"value",
|
|
"value",
|
|
"value",
|
|
"value",
|
|
"value",
|
|
"value",
|
|
"value",
|
|
"value",
|
|
"value"
|
|
]
|
|
},
|
|
"propConfig": {
|
|
"custom.alarm_message": {
|
|
"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}/Alarm/Pressed"
|
|
},
|
|
"transforms": [
|
|
{
|
|
"expression": "!isGood({value})",
|
|
"type": "expression"
|
|
}
|
|
],
|
|
"type": "tag"
|
|
},
|
|
"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": 1,
|
|
"output": 2
|
|
},
|
|
{
|
|
"input": 2,
|
|
"output": 2
|
|
},
|
|
{
|
|
"input": 3,
|
|
"output": 2
|
|
}
|
|
],
|
|
"outputType": "scalar",
|
|
"type": "map"
|
|
}
|
|
],
|
|
"type": "property"
|
|
},
|
|
"persistent": true
|
|
},
|
|
"custom.priority_string": {
|
|
"binding": {
|
|
"config": {
|
|
"expression": "case({view.custom.state},\r\n0, \"No Active Alarms\",\r\n1, \"Low\",\r\n2, \"No Active Alarms\",\r\n3, \"Low\",\r\n\"Unknown\")"
|
|
},
|
|
"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, \"Disabled\",\r\n1, \"Pressed\",\r\n2, \"Normal\",\r\n3, \"Pressed\",\r\n\"Unknown\")"
|
|
},
|
|
"type": "expr"
|
|
},
|
|
"persistent": true
|
|
},
|
|
"params.forceFaultStatus": {
|
|
"paramDirection": "input",
|
|
"persistent": true
|
|
},
|
|
"params.forceRunningStatus": {
|
|
"paramDirection": "input",
|
|
"persistent": true
|
|
},
|
|
"params.tagProps": {
|
|
"paramDirection": "inout",
|
|
"persistent": true
|
|
}
|
|
},
|
|
"props": {
|
|
"defaultSize": {
|
|
"height": 25,
|
|
"width": 25
|
|
}
|
|
},
|
|
"root": {
|
|
"children": [
|
|
{
|
|
"meta": {
|
|
"name": "Estop",
|
|
"tooltip": {
|
|
"style": {
|
|
"fontSize": 16
|
|
}
|
|
}
|
|
},
|
|
"position": {
|
|
"height": 1,
|
|
"width": 1
|
|
},
|
|
"propConfig": {
|
|
"props.elements[0].fill.paint": {
|
|
"binding": {
|
|
"config": {
|
|
"expression": "if(\r\n {view.custom.disconnected},\r\n \u0027#999999\u0027,\r\n if(\r\n {view.custom.state} \u003d 1 || {view.custom.state} \u003d 2 || {view.custom.state} \u003d 3,\r\n \u0027#D5D5D5\u0027,\r\n if(\r\n {view.custom.state} \u003d 0,\r\n \u0027#D5D5D5\u0027,\r\n \u0027#fff700\u0027\r\n )\r\n )\r\n)\r\n"
|
|
},
|
|
"type": "expr"
|
|
}
|
|
},
|
|
"props.elements[1].fill.paint": {
|
|
"binding": {
|
|
"config": {
|
|
"path": "view.custom.state"
|
|
},
|
|
"transforms": [
|
|
{
|
|
"fallback": "#000000",
|
|
"inputType": "scalar",
|
|
"mappings": [
|
|
{
|
|
"input": 1,
|
|
"output": "#7DFF7D"
|
|
},
|
|
{
|
|
"input": 2,
|
|
"output": "#00FF00"
|
|
},
|
|
{
|
|
"input": 3,
|
|
"output": "#7DFF7D"
|
|
},
|
|
{
|
|
"input": 0,
|
|
"output": "#00CC00"
|
|
}
|
|
],
|
|
"outputType": "color",
|
|
"type": "map"
|
|
}
|
|
],
|
|
"type": "property"
|
|
}
|
|
}
|
|
},
|
|
"props": {
|
|
"elements": [
|
|
{
|
|
"d": "M 0,0 H 20 V 20 H 0 Z",
|
|
"fill": {},
|
|
"name": "path",
|
|
"stroke": {
|
|
"paint": "#000000",
|
|
"width": 1.5
|
|
},
|
|
"type": "path"
|
|
},
|
|
{
|
|
"d": "m 17,10.5 a 7,7 0 0 1 -7,7 7,7 0 0 1 -7,-7 7,7 0 0 1 7,-7 7,7 0 0 1 7,7 z",
|
|
"fill": {},
|
|
"name": "path",
|
|
"stroke": {
|
|
"paint": "#000000",
|
|
"width": 1
|
|
},
|
|
"type": "path"
|
|
}
|
|
],
|
|
"viewBox": "0 0 20 20"
|
|
},
|
|
"type": "ia.shapes.svg"
|
|
}
|
|
],
|
|
"events": {
|
|
"dom": {
|
|
"onClick": {
|
|
"config": {
|
|
"script": "\tsystem.perspective.openDock(\u0027Docked-East-SS-BTN\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/Diagnostic"
|
|
},
|
|
{
|
|
"input": 2,
|
|
"output": "Alarms-Styles/Low"
|
|
},
|
|
{
|
|
"input": 3,
|
|
"output": "Alarms-Styles/Medium"
|
|
},
|
|
{
|
|
"input": 4,
|
|
"output": "Alarms-Styles/High"
|
|
}
|
|
],
|
|
"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": "session.custom.alarm_filter.show_buttons"
|
|
},
|
|
"type": "property"
|
|
}
|
|
}
|
|
},
|
|
"props": {
|
|
"aspectRatio": "1:1",
|
|
"mode": "percent",
|
|
"style": {
|
|
"cursor": "pointer"
|
|
}
|
|
},
|
|
"type": "ia.container.coord"
|
|
}
|
|
} |