From 23a7b50e1ce6db213ac718c08aae1515616906e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kriszti=C3=A1n=20L=C3=B6ki?= <krisztian.loki@ess.eu> Date: Mon, 1 Feb 2021 09:33:59 +0100 Subject: [PATCH] Wires reflect connection status between endpoints --- .../pss1-pss/PSS1_PSS_Diagnostics.bob | 196 +++++++++++------- .../diagnostics/PLC_cabinet.bob | 1 + .../diagnostics/RIO4_cabinet.bob | 3 +- .../diagnostics/RIO5_cabinet.bob | 3 +- .../embedded_displays/diagnostics/cabinet.bob | 3 +- .../diagnostics/PLC_cabinet_diagnostics.bob | 162 +++++++-------- NON-APPROVED/pss1-pss/scripts/wire.py | 40 ++++ 7 files changed, 247 insertions(+), 161 deletions(-) create mode 100644 NON-APPROVED/pss1-pss/scripts/wire.py diff --git a/NON-APPROVED/pss1-pss/PSS1_PSS_Diagnostics.bob b/NON-APPROVED/pss1-pss/PSS1_PSS_Diagnostics.bob index a5fb389f..aac3935e 100644 --- a/NON-APPROVED/pss1-pss/PSS1_PSS_Diagnostics.bob +++ b/NON-APPROVED/pss1-pss/PSS1_PSS_Diagnostics.bob @@ -5,9 +5,10 @@ <EMBEDDED_DIAG>embedded_displays/diagnostics</EMBEDDED_DIAG> <GPLC>FEB-090:PSS-GPLC-1</GPLC> <PLC>FEB-090:PSS-PLC-1</PLC> + <PLC_SYMBOLS>$(SYMBOLS)/plc</PLC_SYMBOLS> <POPUP_DIAG>popups/diagnostics</POPUP_DIAG> <SYMBOLS>symbols</SYMBOLS> - <PLC_SYMBOLS>$(SYMBOLS)/plc</PLC_SYMBOLS> + <WIRE_PY>scripts/wire.py</WIRE_PY> </macros> <width>1500</width> <height>1006</height> @@ -65,7 +66,7 @@ <resize>2</resize> </widget> <widget type="polyline" version="2.0.0"> - <name>GCPU-CPU Wire</name> + <name>GCPU Wire</name> <x>520</x> <y>325</y> <width>220</width> @@ -86,92 +87,95 @@ </line_color> <line_style>1</line_style> <scripts> - <script file="EmbeddedPy" check_connections="false"> - <text><![CDATA[# Embedded python script -from org.csstudio.display.builder.runtime.script import PVUtil, ScriptUtil -from org.csstudio.display.builder.model.persist import WidgetColorService - -line_style = 1 # dashed - -pvSevStr = "N/A" -pvStatStr = "N/A" -pvIntStr = "null" -pvTime = "" - -try: - pvSev = PVUtil.getSeverity(pvs[0]) - pvSevStr = PVUtil.getSeverityString(pvs[0]) - pvStatStr = PVUtil.getStatus(pvs[0]) - - pvInt = PVUtil.getLong(pvs[0]) - pvIntStr = PVUtil.getString(pvs[0]) - - pvTime = PVUtil.getTimeString(pvs[0]) - - - if pvSev == 3: # INVALID - raise RuntimeError - - if pvInt == True and pvSev == 0: - line_style = 0 # solid - line_color = WidgetColorService.getColor("GREEN-BORDER") - tooltip = "Healthy connection between Gateway and Process PLC" - else: - line_color = WidgetColorService.getColor("ERROR") - tooltip = "NO connection between Gateway and Process PLC" -except: - line_color = WidgetColorService.getColor("DISCONNECTED") - tooltip = "Unknown connection status between Gateway and Process PLC" - -widget.setPropertyValue('line_color', line_color) -widget.setPropertyValue('line_style', line_style) -widget.setPropertyValue('tooltip', tooltip + """ -{} -{}, {} - {}, {}""".format(str(pvs[0]), pvIntStr, pvSevStr, pvStatStr, pvTime))]]></text> + <script file="$(WIRE_PY)" check_connections="false"> <pv_name>$(PLC):GCPU_ConnStat</pv_name> </script> </scripts> <tooltip>N/A</tooltip> </widget> <widget type="polyline" version="2.0.0"> - <name>F Wire</name> - <x>780</x> + <name>CPU Wire</name> + <x>777</x> + <y>320</y> + <width>180</width> + <height>85</height> + <points> + <point x="0.0" y="0.0"> + </point> + <point x="0.0" y="85.0"> + </point> + <point x="180.0" y="85.0"> + </point> + <point x="180.0" y="0.0"> + </point> + </points> + <line_color> + <color name="DISCONNECTED" red="105" green="77" blue="164"> + </color> + </line_color> + <line_style>1</line_style> + <scripts> + <script file="$(WIRE_PY)" check_connections="false"> + <pv_name>$(PLC):CPU_ConnStat</pv_name> + </script> + </scripts> + <tooltip>N/A</tooltip> + </widget> + <widget type="polyline" version="2.0.0"> + <name>HMI Wire</name> + <x>980</x> <y>325</y> - <width>365</width> - <height>75</height> + <width>165</width> + <height>70</height> <points> <point x="0.0" y="0.0"> </point> - <point x="0.0" y="75.0"> + <point x="0.0" y="70.0"> </point> - <point x="364.99999999999994" y="75.0"> + <point x="165.0" y="70.0"> </point> - <point x="365.0" y="0.0"> + <point x="165.0" y="0.0"> </point> </points> <line_color> - <color name="GREEN-BORDER" red="40" green="140" blue="40"> + <color name="DISCONNECTED" red="105" green="77" blue="164"> </color> </line_color> + <line_style>1</line_style> + <scripts> + <script file="$(WIRE_PY)" check_connections="false"> + <pv_name>$(PLC):HMI_ConnStat</pv_name> + </script> + </scripts> + <tooltip>N/A</tooltip> </widget> <widget type="polyline" version="2.0.0"> - <name>F Wire 2</name> - <x>1145</x> + <name>PAS HMI Wire</name> + <x>972</x> <y>325</y> - <width>240</width> - <height>75</height> + <width>410</width> + <height>80</height> <points> - <point x="0.0" y="75.0"> + <point x="0.0" y="0.0"> + </point> + <point x="0.0" y="80.0"> </point> - <point x="239.99999999999991" y="75.0"> + <point x="410.0" y="80.0"> </point> - <point x="239.99999999999997" y="0.0"> + <point x="410.0" y="0.0"> </point> </points> <line_color> - <color name="GREEN-BORDER" red="40" green="140" blue="40"> + <color name="DISCONNECTED" red="105" green="77" blue="164"> </color> </line_color> + <line_style>1</line_style> + <scripts> + <script file="$(WIRE_PY)" check_connections="false"> + <pv_name>$(PLC):PASHMI_ConnStat</pv_name> + </script> + </scripts> + <tooltip>N/A</tooltip> </widget> <widget type="group" version="2.0.0"> <name>GCPU</name> @@ -262,14 +266,14 @@ widget.setPropertyValue('tooltip', tooltip + """ </widget> <widget type="polyline" version="2.0.0"> <name>Switch Wire</name> - <x>970</x> + <x>965</x> <y>325</y> <width>1</width> <height>179</height> <points> <point x="0.0" y="0.0"> </point> - <point x="0.0" y="178.99999999999997"> + <point x="0.0" y="179.0"> </point> </points> <line_color> @@ -352,7 +356,7 @@ widget.setPropertyValue('tooltip', tooltip + """ <wrap_words>false</wrap_words> </widget> <widget type="symbol" version="2.0.0"> - <name>Disconnected</name> + <name>HMI_ConnStat</name> <pv_name>$(PLC):HMI_ConnStat</pv_name> <symbols> <symbol>$(SYMBOLS)/alarms/unconnected.svg</symbol> @@ -432,7 +436,7 @@ widget.setPropertyValue('tooltip', tooltip + """ </color> </line_color> </widget> - <widget type="polygon" version="2.0.0"> + <widget type="polyline" version="2.0.0"> <name>RIO0 Wire</name> <x>150</x> <y>506</y> @@ -445,11 +449,18 @@ widget.setPropertyValue('tooltip', tooltip + """ </point> </points> <line_color> - <color name="GREEN-BORDER" red="40" green="140" blue="40"> + <color name="DISCONNECTED" red="105" green="77" blue="164"> </color> </line_color> + <line_style>1</line_style> + <scripts> + <script file="$(WIRE_PY)" check_connections="false"> + <pv_name>FEB-010Row:CnPw-U-001:IM_ConnStat</pv_name> + </script> + </scripts> + <tooltip>N/A</tooltip> </widget> - <widget type="polygon" version="2.0.0"> + <widget type="polyline" version="2.0.0"> <name>RIO1 Wire</name> <x>410</x> <y>506</y> @@ -462,11 +473,18 @@ widget.setPropertyValue('tooltip', tooltip + """ </point> </points> <line_color> - <color name="GREEN-BORDER" red="40" green="140" blue="40"> + <color name="DISCONNECTED" red="105" green="77" blue="164"> </color> </line_color> + <line_style>1</line_style> + <scripts> + <script file="$(WIRE_PY)"> + <pv_name>FEB-010Row:CnPw-U-002:IM_ConnStat</pv_name> + </script> + </scripts> + <tooltip>N/A</tooltip> </widget> - <widget type="polygon" version="2.0.0"> + <widget type="polyline" version="2.0.0"> <name>RIO2 Wire</name> <x>651</x> <y>506</y> @@ -479,11 +497,18 @@ widget.setPropertyValue('tooltip', tooltip + """ </point> </points> <line_color> - <color name="GREEN-BORDER" red="40" green="140" blue="40"> + <color name="DISCONNECTED" red="105" green="77" blue="164"> </color> </line_color> + <line_style>1</line_style> + <scripts> + <script file="$(WIRE_PY)"> + <pv_name>FEB-010Row:CnPw-U-003:IM_ConnStat</pv_name> + </script> + </scripts> + <tooltip>N/A</tooltip> </widget> - <widget type="polygon" version="2.0.0"> + <widget type="polyline" version="2.0.0"> <name>RIO3 Wire</name> <x>891</x> <y>506</y> @@ -496,11 +521,18 @@ widget.setPropertyValue('tooltip', tooltip + """ </point> </points> <line_color> - <color name="GREEN-BORDER" red="40" green="140" blue="40"> + <color name="DISCONNECTED" red="105" green="77" blue="164"> </color> </line_color> + <line_style>1</line_style> + <scripts> + <script file="$(WIRE_PY)"> + <pv_name>FEB-010Row:CnPw-U-004:IM_ConnStat</pv_name> + </script> + </scripts> + <tooltip>N/A</tooltip> </widget> - <widget type="polygon" version="2.0.0"> + <widget type="polyline" version="2.0.0"> <name>RIO4 Wire</name> <x>1132</x> <y>506</y> @@ -513,11 +545,18 @@ widget.setPropertyValue('tooltip', tooltip + """ </point> </points> <line_color> - <color name="GREEN-BORDER" red="40" green="140" blue="40"> + <color name="DISCONNECTED" red="105" green="77" blue="164"> </color> </line_color> + <line_style>1</line_style> + <scripts> + <script file="$(WIRE_PY)"> + <pv_name>AccPSS-Z0:PSS-RIO-4:IM_ConnStat</pv_name> + </script> + </scripts> + <tooltip>N/A</tooltip> </widget> - <widget type="polygon" version="2.0.0"> + <widget type="polyline" version="2.0.0"> <name>RIO5 Wire</name> <x>1373</x> <y>506</y> @@ -530,9 +569,16 @@ widget.setPropertyValue('tooltip', tooltip + """ </point> </points> <line_color> - <color name="GREEN-BORDER" red="40" green="140" blue="40"> + <color name="DISCONNECTED" red="105" green="77" blue="164"> </color> </line_color> + <line_style>1</line_style> + <scripts> + <script file="$(WIRE_PY)"> + <pv_name>FEB-090:PSS-RIO-5:IM_ConnStat</pv_name> + </script> + </scripts> + <tooltip>N/A</tooltip> </widget> <widget type="embedded" version="2.0.0"> <name>PSS1 PSS $(CABINET) Cabinet</name> diff --git a/NON-APPROVED/pss1-pss/embedded_displays/diagnostics/PLC_cabinet.bob b/NON-APPROVED/pss1-pss/embedded_displays/diagnostics/PLC_cabinet.bob index 24c16d3c..a19382d6 100644 --- a/NON-APPROVED/pss1-pss/embedded_displays/diagnostics/PLC_cabinet.bob +++ b/NON-APPROVED/pss1-pss/embedded_displays/diagnostics/PLC_cabinet.bob @@ -54,6 +54,7 @@ <description>Open Display</description> </action> </actions> + <pv_name>$(P):Cabinet_Stat</pv_name> <text>PLC Cabinet</text> <x>10</x> <y>5</y> diff --git a/NON-APPROVED/pss1-pss/embedded_displays/diagnostics/RIO4_cabinet.bob b/NON-APPROVED/pss1-pss/embedded_displays/diagnostics/RIO4_cabinet.bob index f684daae..f3a6b922 100644 --- a/NON-APPROVED/pss1-pss/embedded_displays/diagnostics/RIO4_cabinet.bob +++ b/NON-APPROVED/pss1-pss/embedded_displays/diagnostics/RIO4_cabinet.bob @@ -58,6 +58,7 @@ <description>Open Display</description> </action> </actions> + <pv_name>$(P):Cabinet_Stat</pv_name> <text>$(CABINET) Cabinet</text> <x>10</x> <y>5</y> @@ -78,7 +79,7 @@ </color> </value> </exp> - <pv_name>$(P):Cabinet_Stat</pv_name> + <pv_name>$(pv_name)</pv_name> </rule> </rules> <tooltip>$(actions)</tooltip> diff --git a/NON-APPROVED/pss1-pss/embedded_displays/diagnostics/RIO5_cabinet.bob b/NON-APPROVED/pss1-pss/embedded_displays/diagnostics/RIO5_cabinet.bob index 4cbe9b32..1975c622 100644 --- a/NON-APPROVED/pss1-pss/embedded_displays/diagnostics/RIO5_cabinet.bob +++ b/NON-APPROVED/pss1-pss/embedded_displays/diagnostics/RIO5_cabinet.bob @@ -72,6 +72,7 @@ <description>Open Display</description> </action> </actions> + <pv_name>$(P):Cabinet_Stat</pv_name> <text>$(CABINET) Cabinet</text> <x>10</x> <y>5</y> @@ -92,7 +93,7 @@ </color> </value> </exp> - <pv_name>$(P):Cabinet_Stat</pv_name> + <pv_name>$(pv_name)</pv_name> </rule> </rules> <tooltip>$(actions)</tooltip> diff --git a/NON-APPROVED/pss1-pss/embedded_displays/diagnostics/cabinet.bob b/NON-APPROVED/pss1-pss/embedded_displays/diagnostics/cabinet.bob index f14407ab..f53eacc6 100644 --- a/NON-APPROVED/pss1-pss/embedded_displays/diagnostics/cabinet.bob +++ b/NON-APPROVED/pss1-pss/embedded_displays/diagnostics/cabinet.bob @@ -54,6 +54,7 @@ <description>Open Display</description> </action> </actions> + <pv_name>$(P):Cabinet_Stat</pv_name> <text>$(CABINET) Cabinet</text> <x>10</x> <y>5</y> @@ -74,7 +75,7 @@ </color> </value> </exp> - <pv_name>$(P):Cabinet_Stat</pv_name> + <pv_name>$(pv_name)</pv_name> </rule> </rules> <tooltip>$(actions)</tooltip> diff --git a/NON-APPROVED/pss1-pss/popups/diagnostics/PLC_cabinet_diagnostics.bob b/NON-APPROVED/pss1-pss/popups/diagnostics/PLC_cabinet_diagnostics.bob index 2e977d88..68de413e 100644 --- a/NON-APPROVED/pss1-pss/popups/diagnostics/PLC_cabinet_diagnostics.bob +++ b/NON-APPROVED/pss1-pss/popups/diagnostics/PLC_cabinet_diagnostics.bob @@ -9,6 +9,7 @@ <PLC_SYMBOLS>$(SYMBOLS)/plc</PLC_SYMBOLS> <POPUP_DIAG>popups/diagnostics</POPUP_DIAG> <SYMBOLS>../../symbols</SYMBOLS> + <WIRE_PY>../../scripts/wire.py</WIRE_PY> </macros> <width>1500</width> <height>1006</height> @@ -66,7 +67,7 @@ <resize>2</resize> </widget> <widget type="polyline" version="2.0.0"> - <name>GCPU-CPU Wire</name> + <name>GCPU Wire</name> <x>520</x> <y>325</y> <width>220</width> @@ -87,92 +88,95 @@ </line_color> <line_style>1</line_style> <scripts> - <script file="EmbeddedPy" check_connections="false"> - <text><![CDATA[# Embedded python script -from org.csstudio.display.builder.runtime.script import PVUtil, ScriptUtil -from org.csstudio.display.builder.model.persist import WidgetColorService - -line_style = 1 # dashed - -pvSevStr = "N/A" -pvStatStr = "N/A" -pvIntStr = "null" -pvTime = "" - -try: - pvSev = PVUtil.getSeverity(pvs[0]) - pvSevStr = PVUtil.getSeverityString(pvs[0]) - pvStatStr = PVUtil.getStatus(pvs[0]) - - pvInt = PVUtil.getLong(pvs[0]) - pvIntStr = PVUtil.getString(pvs[0]) - - pvTime = PVUtil.getTimeString(pvs[0]) - - - if pvSev == 3: # INVALID - raise RuntimeError - - if pvInt == True and pvSev == 0: - line_style = 0 # solid - line_color = WidgetColorService.getColor("GREEN-BORDER") - tooltip = "Healthy connection between Gateway and Process PLC" - else: - line_color = WidgetColorService.getColor("ERROR") - tooltip = "NO connection between Gateway and Process PLC" -except: - line_color = WidgetColorService.getColor("DISCONNECTED") - tooltip = "Unknown connection status between Gateway and Process PLC" - -widget.setPropertyValue('line_color', line_color) -widget.setPropertyValue('line_style', line_style) -widget.setPropertyValue('tooltip', tooltip + """ -{} -{}, {} - {}, {}""".format(str(pvs[0]), pvIntStr, pvSevStr, pvStatStr, pvTime))]]></text> + <script file="$(WIRE_PY)"> <pv_name>$(PLC):GCPU_ConnStat</pv_name> </script> </scripts> <tooltip>N/A</tooltip> </widget> <widget type="polyline" version="2.0.0"> - <name>F Wire</name> - <x>780</x> + <name>CPU Wire</name> + <x>777</x> + <y>320</y> + <width>180</width> + <height>85</height> + <points> + <point x="0.0" y="0.0"> + </point> + <point x="0.0" y="85.0"> + </point> + <point x="180.0" y="85.0"> + </point> + <point x="180.0" y="0.0"> + </point> + </points> + <line_color> + <color name="DISCONNECTED" red="105" green="77" blue="164"> + </color> + </line_color> + <line_style>1</line_style> + <scripts> + <script file="$(WIRE_PY)"> + <pv_name>$(PLC):CPU_ConnStat</pv_name> + </script> + </scripts> + <tooltip>N/A</tooltip> + </widget> + <widget type="polyline" version="2.0.0"> + <name>HMI Wire</name> + <x>980</x> <y>325</y> - <width>365</width> - <height>75</height> + <width>165</width> + <height>70</height> <points> <point x="0.0" y="0.0"> </point> - <point x="0.0" y="75.0"> + <point x="0.0" y="70.0"> </point> - <point x="364.99999999999994" y="75.0"> + <point x="164.99999999999997" y="70.0"> </point> - <point x="365.0" y="0.0"> + <point x="164.99999999999997" y="0.0"> </point> </points> <line_color> - <color name="GREEN-BORDER" red="40" green="140" blue="40"> + <color name="DISCONNECTED" red="105" green="77" blue="164"> </color> </line_color> + <line_style>1</line_style> + <scripts> + <script file="$(WIRE_PY)"> + <pv_name>$(PLC):HMI_ConnStat</pv_name> + </script> + </scripts> + <tooltip>N/A</tooltip> </widget> <widget type="polyline" version="2.0.0"> - <name>F Wire 2</name> - <x>1145</x> + <name>PAS HMI Wire</name> + <x>972</x> <y>325</y> - <width>240</width> - <height>75</height> + <width>410</width> + <height>80</height> <points> - <point x="0.0" y="75.0"> + <point x="0.0" y="0.0"> + </point> + <point x="0.0" y="80.0"> </point> - <point x="239.99999999999991" y="75.0"> + <point x="410.0" y="80.0"> </point> - <point x="239.99999999999997" y="0.0"> + <point x="410.0" y="0.0"> </point> </points> <line_color> - <color name="GREEN-BORDER" red="40" green="140" blue="40"> + <color name="DISCONNECTED" red="105" green="77" blue="164"> </color> </line_color> + <line_style>1</line_style> + <scripts> + <script file="$(WIRE_PY)"> + <pv_name>$(PLC):PASHMI_ConnStat</pv_name> + </script> + </scripts> + <tooltip>N/A</tooltip> </widget> <widget type="group" version="2.0.0"> <name>GCPU</name> @@ -261,23 +265,6 @@ widget.setPropertyValue('tooltip', tooltip + """ <transparent>true</transparent> </widget> </widget> - <widget type="polyline" version="2.0.0"> - <name>Switch Wire</name> - <x>970</x> - <y>325</y> - <width>1</width> - <height>179</height> - <points> - <point x="0.0" y="0.0"> - </point> - <point x="0.0" y="178.99999999999997"> - </point> - </points> - <line_color> - <color name="GREEN-BORDER" red="40" green="140" blue="40"> - </color> - </line_color> - </widget> <widget type="group" version="2.0.0"> <name>Switch</name> <x>890</x> @@ -419,21 +406,30 @@ widget.setPropertyValue('tooltip', tooltip + """ <widget type="polyline" version="2.0.0"> <name>RIO Wire</name> <x>340</x> - <y>506</y> - <width>632</width> - <height>75</height> + <y>325</y> + <width>625</width> + <height>254</height> <points> - <point x="0.0" y="75.0"> + <point x="0.0" y="254.0"> </point> - <point x="0.0" y="0.0"> + <point x="0.0" y="185.0"> + </point> + <point x="625.0" y="185.0"> </point> - <point x="632.0" y="0.0"> + <point x="625.0" y="0.0"> </point> </points> <line_color> - <color name="GREEN-BORDER" red="40" green="140" blue="40"> + <color name="DISCONNECTED" red="105" green="77" blue="164"> </color> </line_color> + <line_style>1</line_style> + <scripts> + <script file="$(WIRE_PY)"> + <pv_name>$(P):IM_ConnStat</pv_name> + </script> + </scripts> + <tooltip>N/A</tooltip> </widget> <widget type="embedded" version="2.0.0"> <name>PSS1 PSS $(CABINET) Cabinet</name> diff --git a/NON-APPROVED/pss1-pss/scripts/wire.py b/NON-APPROVED/pss1-pss/scripts/wire.py new file mode 100644 index 00000000..95966513 --- /dev/null +++ b/NON-APPROVED/pss1-pss/scripts/wire.py @@ -0,0 +1,40 @@ +from org.csstudio.display.builder.runtime.script import PVUtil, ScriptUtil +from org.csstudio.display.builder.model.persist import WidgetColorService + +line_style = 1 # dashed + +pvSevStr = "N/A" +pvStatStr = "N/A" +pvIntStr = "null" +pvTime = "" + +try: + pvSev = PVUtil.getSeverity(pvs[0]) + pvSevStr = PVUtil.getSeverityString(pvs[0]) + pvStatStr = PVUtil.getStatus(pvs[0]) + + pvInt = PVUtil.getLong(pvs[0]) + pvIntStr = PVUtil.getString(pvs[0]) + + pvTime = PVUtil.getTimeString(pvs[0]) + + + if pvSev == 3: # INVALID + raise RuntimeError + + if pvInt == True and pvSev == 0: + line_style = 0 # solid + line_color = WidgetColorService.getColor("GREEN-BORDER") + tooltip = "Healthy connection" + else: + line_color = WidgetColorService.getColor("ERROR") + tooltip = "NO connection" +except: + line_color = WidgetColorService.getColor("DISCONNECTED") + tooltip = "Unknown connection status" + +widget.setPropertyValue('line_color', line_color) +widget.setPropertyValue('line_style', line_style) +widget.setPropertyValue('tooltip', tooltip + """ +{} +{}, {} - {}, {}""".format(str(pvs[0]), pvIntStr, pvSevStr, pvStatStr, pvTime)) -- GitLab