if magnets on standby disable update
This commit is contained in:
+51
-15
@@ -208,7 +208,7 @@ class AppGui(QWidget):
|
||||
def reset_check_mini_post_sh():
|
||||
#Redo "G2" in case first two elements
|
||||
#are grayed by other beamlines
|
||||
if "ON" in (self.sectorI_dict["G2"],
|
||||
if "Offen" in (self.sectorI_dict["G2"],
|
||||
self.sectorI_dict["O2"],
|
||||
self.sectorI_dict["PIF"]):
|
||||
#self.sectorI_dict["G3"]):
|
||||
@@ -325,7 +325,33 @@ class AppGui(QWidget):
|
||||
#secsplit = pvsplit[0].split("P")
|
||||
#sec = secsplit[1]
|
||||
sec=pvsplit[0][1:]
|
||||
if pvdata.value[0] == 'ON':
|
||||
|
||||
def already_in_standby():
|
||||
devices = self.settings.data[sec]["iocDevice"]
|
||||
pv_list = []
|
||||
for magnet in devices:
|
||||
pv_list.append(magnet + ":SOL:2")
|
||||
value_list, status, status_list = self.cafe.getScalarList(
|
||||
pv_list, cacheFlag=True)
|
||||
print("valuelist", pv_list, value_list)
|
||||
if status != self.cyca.ICAFE_NORMAL:
|
||||
self.check_status_list(pv_list, status_list, _line())
|
||||
#get standby values:
|
||||
standby_value_list = []
|
||||
for magnet in devices:
|
||||
idx = self.settings.data[sec]["device"].index(magnet)
|
||||
standby_value = self.settings.data[sec]["standby"][idx]
|
||||
standby_value_list.append(standby_value)
|
||||
|
||||
in_standby = True
|
||||
for value, standby in zip(value_list, standby_value_list):
|
||||
if abs(value) < abs(standby)*0.8 or abs(value) > abs(standby)*1.2:
|
||||
in_standby = False
|
||||
break
|
||||
print("is_standby", in_standby, flush=True)
|
||||
return in_standby
|
||||
|
||||
if pvdata.value[0] == 'ON' and not already_in_standby():
|
||||
print("pv, sec-ON", pv, sec, flush=True)
|
||||
self.table_sol_dict[sec].init_value_button.setEnabled(True)
|
||||
self.table_pwr_dict[sec].init_value_button.setEnabled(True)
|
||||
@@ -334,8 +360,7 @@ class AppGui(QWidget):
|
||||
self.table_sol_dict[sec].init_value_button.setEnabled(False)
|
||||
self.table_pwr_dict[sec].init_value_button.setEnabled(False)
|
||||
|
||||
#print("sec", secsplit[1], flush=True)
|
||||
|
||||
|
||||
for state in self.sec_state_list:
|
||||
self.cafe.monitor(state, receive_sec_state)
|
||||
|
||||
@@ -502,7 +527,6 @@ class AppGui(QWidget):
|
||||
monitor_callback=cb_outtime, show_units=True)
|
||||
self.offtime_dict[pv_pwr_timeout] = qptime
|
||||
|
||||
|
||||
#Time to allow cb_outtime to fire
|
||||
time.sleep(0.2)
|
||||
|
||||
@@ -622,8 +646,9 @@ class AppGui(QWidget):
|
||||
#updates of SOL also update PWR, and vice-versa
|
||||
#Do not click if already on standby!!
|
||||
|
||||
update_enabled = is_update_enabled()
|
||||
|
||||
if is_update_enabled():
|
||||
if update_enabled:
|
||||
self.table_pwr_dict[sector].init_value_button.setEnabled(False)
|
||||
_table.init_value_button.click()
|
||||
time.sleep(0.05)
|
||||
@@ -638,14 +663,23 @@ class AppGui(QWidget):
|
||||
|
||||
if not self.input_parameters['simulation']:
|
||||
status, status_list, pv_list = _table.set_standby_values()
|
||||
|
||||
|
||||
if status != self.cyca.ICAFE_NORMAL:
|
||||
self.check_status_list(
|
||||
_pymodule, 'setScalarList', pv_list, status_list, _line())
|
||||
|
||||
pv = 'P' + target.sector + "-HUSH:STATE"
|
||||
stat = self.cafe.set(pv, 0)
|
||||
self.check_status(_pymodule, 'set', pv, stat, _line())
|
||||
|
||||
|
||||
#Seqeuncer ONLY determines when to go into STANDBY mode
|
||||
#and NOT the HLA
|
||||
##pv = 'P' + target.sector + "-HUSH:STATE"
|
||||
##stat = self.cafe.set(pv, 0)
|
||||
##self.check_status(_pymodule, 'set', pv, stat, _line())
|
||||
|
||||
#Disable because _table.set_standby_values() enables it
|
||||
if not update_enabled:
|
||||
self.table_pwr_dict[sector].init_value_button.setEnabled(False)
|
||||
_table.init_value_button.setEnabled(False)
|
||||
|
||||
|
||||
def on_sector_restore(self):
|
||||
target = self.sender()
|
||||
@@ -658,10 +692,12 @@ class AppGui(QWidget):
|
||||
if status != self.cyca.ICAFE_NORMAL:
|
||||
self.check_status_list(
|
||||
_pymodule, 'setScalarList', pv_list, status_list, _line())
|
||||
|
||||
pv = 'P' + target.sector + "-HUSH:STATE"
|
||||
stat = self.cafe.set(pv, 1)
|
||||
self.check_status(_pymodule, 'set', pv, stat, _line())
|
||||
|
||||
#Seqeuncer ONLY determines when to go into STANDBY mode
|
||||
#and NOT the HLA
|
||||
#pv = 'P' + target.sector + "-HUSH:STATE"
|
||||
#stat = self.cafe.set(pv, 1)
|
||||
#self.check_status(_pymodule, 'set', pv, stat, _line())
|
||||
|
||||
_table_pwr = self.table_pwr_dict[sector]
|
||||
row_pwr_dict = _table_pwr.get_init_values()
|
||||
|
||||
Reference in New Issue
Block a user