From 52a7db31ef8ac9bb167efea6a7aa765f57c92eed Mon Sep 17 00:00:00 2001 From: Claudio Scafuri <claudio.scafuri@elettra.eu> Date: Thu, 14 Sep 2023 10:35:34 +0200 Subject: [PATCH] #20400 add SPECTRO/VUV tango shutter and stopper --- FRTND_E/active_frntd_e.py | 121 +++++++++++++++++++++++++++++++++++--- 1 file changed, 113 insertions(+), 8 deletions(-) diff --git a/FRTND_E/active_frntd_e.py b/FRTND_E/active_frntd_e.py index 64e7363..43985b5 100644 --- a/FRTND_E/active_frntd_e.py +++ b/FRTND_E/active_frntd_e.py @@ -44,6 +44,7 @@ class Worker(QtCore.QThread): ) except tango.DevFailed as e: self.nanoescastopper = 0 + # tango device for nanoesca - geco device self.nanoescastopper = 0 self.nanoescastopperindex = 0 @@ -60,6 +61,27 @@ class Worker(QtCore.QThread): self.nanoescashutterindex = 0 self.nanoesca_shutter_value = -1 # 0: closed , 1:open, -1 : unknown self.nanoescashutter=self.nanoescastopper # the tango device is the same of the stopper + + # tango device for vuvphotemission - geco device + self.vuvphotoemissionstopper = 0 + self.vuvphotemissionstopperindex = 0 + self.vuvphotemission_stopper_value = -1 # 0: closed , 1:open, -1 : unknown + + self.vuvphotemissionshutter = 0 + self.vuvphotemissionshutterindex = 0 + self.vuvphotemission_shutter_value = -1 # 0: closed , 1:open, -1 : unknown + + try: + self.vuvphotoemissionstopper = tango.DeviceProxy( + "bl034-control-01.blcs.elettra.trieste.it:20000/controls/interlock/geco" + ) + self.vuvphotemissionshutter = tango.DeviceProxy( + "bl034-control-01.blcs.elettra.trieste.it:20000/controls/interlock/geco" + ) + except tango.DevFailed as e: + self.vuvphotoemissionstopper = 0 + self.vuvphotemissionshutter = 0 + def run(self): if self.mode == "update": @@ -81,11 +103,18 @@ class Worker(QtCore.QThread): except tango.DevFailed as e: self.nanoesca_stopper_value = -1 self.nanoesca_shutter_value = -1 + try: + self.vuvphotemission_stopper_value = self.vuvphotoemissionstopper.read_attribute("STPFE_S03-04.01").value + self.vuvphotemission_shutter_value = self.vuvphotemissionshutter.read_attribute("SHTFE_S03-04.01").value + except tango.DevFailed as e: + self.vuvphotemission_stopper_value = -1 + self.vuvphotemission_shutter_value = -1 + def execute(self): errtable = self.BL.closeall() - # close tango controlloed syrme stopper + # close tango controlloed syrmep stopper try: self.syrmepstopper.r_bs4_v = 0 except tango.DevFailed as e: @@ -129,6 +158,27 @@ class Worker(QtCore.QThread): self.BL, "geco/SHFE_S01-04.01", ) + + #close vuvphotoemission/spectromicro stopper + try: + self.vuvphotoemissionstopper.write_attribute("STPFE_S03-04.01",0) + except tango.DevFailed as e: + self.emit( + QtCore.SIGNAL("ExecuteError(PyQt_PyObject,PyQt_PyObject)"), + self.BL, + "geco/STPFE_S03-04.01", + ) + + #close vuvphotoemission/spectromicro shutter + try: + self.vuvphotoemissionshutter.write_attribute("SHTFE_S03-04.01",0) + except tango.DevFailed as e: + self.emit( + QtCore.SIGNAL("ExecuteError(PyQt_PyObject,PyQt_PyObject)"), + self.BL, + "geco/SHTFE_S03-04.01", + ) + if errtable is None: self.emit(QtCore.SIGNAL("ExecuteThread(PyQt_PyObject)"), self.BL) else: @@ -187,7 +237,7 @@ class active_frntd_e(Ui_frntd_e, QtCore.QObject): self.redbrush = QtGui.QBrush(QtGui.QColor("red")) self.graybrush = QtGui.QBrush(QtGui.QColor("gray")) n = self.BL.nentries - self.tableWidget.setRowCount(n + 3) + self.tableWidget.setRowCount(n + 5) row = 0 for entry in self.BL.bltable: bname = entry[2] @@ -203,7 +253,38 @@ class active_frntd_e(Ui_frntd_e, QtCore.QObject): self.tableWidget.setRowHeight(row, 22) row = row + 1 # add Tango managed entries - different - bname = "Syrmep" + bname = "3.2 Spectro / VUV" + objname = "geco/SHTFE_S03-04.01 " + stname = "UNKNOWN" + col0 = QtGui.QTableWidgetItem(bname, 0) + col1 = QtGui.QTableWidgetItem(objname, 1) + col2 = QtGui.QTableWidgetItem(stname, 2) + col2.setBackground(self.graybrush) + self.tableWidget.setItem(row, 0, col0) + self.tableWidget.setItem(row, 1, col1) + self.tableWidget.setItem(row, 2, col2) + self.tableWidget.setRowHeight(row, 22) + self.thread.vuvphotemissionshutterindex = row + self.vuvphotemissionshutterindex = row + row = row + 1 + + bname = "3.2 Spectro / VUV" + objname = "geco/STPFE_S03-04.01 " + stname = "UNKNOWN" + col0 = QtGui.QTableWidgetItem(bname, 0) + col1 = QtGui.QTableWidgetItem(objname, 1) + col2 = QtGui.QTableWidgetItem(stname, 2) + col2.setBackground(self.graybrush) + self.tableWidget.setItem(row, 0, col0) + self.tableWidget.setItem(row, 1, col1) + self.tableWidget.setItem(row, 2, col2) + self.tableWidget.setRowHeight(row, 22) + self.thread.vuvphotemissionstopperindex = row + self.vuvphotemissionstopperindex = row + row = row + 1 + + # --------------------------------------------- + bname = "6.1 Syrmep" objname = "geco/r_bs4_v" stname = "UNKNOWN" col0 = QtGui.QTableWidgetItem(bname, 0) @@ -223,7 +304,7 @@ class active_frntd_e(Ui_frntd_e, QtCore.QObject): #self.label.setAutoFillBackground(1) #self.label.setText("UNKNOWN") # ---- - bname = "NanoEsca/Nanospectr." + bname = "1.2 Nanospec. / NanoESCA" objname = "geco/STFE_S01-04.01" stname = "UNKNOWN" col0 = QtGui.QTableWidgetItem(bname, 0) @@ -236,11 +317,10 @@ class active_frntd_e(Ui_frntd_e, QtCore.QObject): self.tableWidget.setRowHeight(row, 22) self.thread.nanoescastopperindex = row self.nanoescastopperindex = row - row = row + 1 - bname = "NanoEsca/Nanospectr." + bname = "1.2 Nanospec. / NanoESCA" objname = "geco/SHFE_S01-04.01" stname = "UNKNOWN" col0 = QtGui.QTableWidgetItem(bname, 0) @@ -329,7 +409,31 @@ class active_frntd_e(Ui_frntd_e, QtCore.QObject): #--------------------------------------------- - + # check vuvphotomission stopper tango reading + idx = self.thread.vuvphotemissionstopperindex + item = self.tableWidget.item(idx, 2) + if self.thread.vuvphotemission_stopper_value == 1: + item.setBackground(self.redbrush) + item.setText("OPEN") + if self.thread.vuvphotemission_stopper_value == 0: + item.setBackground(self.greenbrush) + item.setText("CLOSED") + if self.thread.vuvphotemission_stopper_value == -1: + item.setBackground(self.graybrush) + item.setText("UNKNOWN") + #--------------------------------------------- + # check vuvphotomission shutter tango reading + idx = self.thread.vuvphotemissionshutterindex + item = self.tableWidget.item(idx, 2) + if self.thread.vuvphotemission_shutter_value == 1: + item.setBackground(self.redbrush) + item.setText("OPEN") + if self.thread.vuvphotemission_shutter_value == 0: + item.setBackground(self.greenbrush) + item.setText("CLOSED") + if self.thread.vuvphotemission_shutter_value == -1: + item.setBackground(self.graybrush) + item.setText("UNKNOWN") #--------------------------------------------- # check nanoesca shutter tango reading idx = self.thread.nanoescashutterindex @@ -347,8 +451,9 @@ class active_frntd_e(Ui_frntd_e, QtCore.QObject): #------------------------------------------------------------------- all_tango_closed = self.thread.syrmep_stopper_value == 0 and self.thread.nanoesca_stopper_value == 0 and self.thread.nanoesca_shutter_value == 0 + vuv_closed = self.thread.vuvphotemission_shutter_value == 0 and self.thread.vuvphotemission_shutter_value == 0 palette = self.label.palette() - if mybl.allclosed() == 1 and all_tango_closed : + if mybl.allclosed() == 1 and all_tango_closed and vuv_closed: palette.setBrush(QtGui.QPalette.Window, self.greenbrush) self.label.setText("ALL CLOSED") else: -- GitLab