if magnets on standby disable update

This commit is contained in:
2024-02-09 11:35:20 +01:00
parent 7a9c7b02f5
commit 547ee8fc6a
2 changed files with 58 additions and 22 deletions

View File

@@ -16,8 +16,8 @@
"iocDevice" : ["AME1", "AME2", "QME10"]
},
"SH":{
"standby": [-4, 3, 3, -4, 9, 4, -5, -4,
4, 9],
"standby": [-6.8, 6.8, 6.8, -6.8, 6.8, 6.8, -6.8, -6.8,
6.8, 0],
"ref" : [-34.048, 26.68, 26.68, -34.05, 87.764, 37.424, -47.207, -38.156,
36.977, 87.642],
"pwrref" : [0.504, 0.292, 0.289, 0.498, 5.434, 0.577, 0.912, 0.608,
@@ -25,8 +25,8 @@
"iocDevice" : ["QMA7", "AMA2", "QMA12"]
},
"G2":{
"standby" : [-4.90, 4.0, -4, 5, -3, -4, 4, -4,
5, 5, -4, 11, 11, 25],
"standby" : [-6.867, 6.867, -6.867, 6.867, -6.867, -7.553, 7.553, -7.553,
7.553, 7.553, -7.553, 10.758, 10.758, 23.804],
"ref": [-41.056, 36.548, -30.490, 52.433, -27.636, -37.412, 41.966, -37.296,
51.200, 53.657, -41.966, 109.543, 109.405, 251.492],
"pwrref" : [0.699, 0.545, 0.389, 1.152, 0.323, 0.374, 0.467, 0.378,
@@ -43,8 +43,8 @@
"iocDevice" : ["QMC2", "AMC1", "QMC7"]
},
"PIF":{
"standby": [-4, 4, 4, -4, 14, 6, -6, 4,
-6, 3],
"standby": [-6.800, 6.800, 6.800, -6.800, 6.800, 6.800, -6.800, 6.800,
-6.800, 6.800],
"ref" : [-36.159, 34.434, 42.277, -43, 135, 61, -62, 37,
-55, 30],
"pwrref" : [0.16, 0.16, 0.28, 0.31, 3.7, 0.6, 0.73, 0.25,
@@ -52,7 +52,7 @@
"iocDevice" : ["QMD2", "AMD1", "QMD9"]
},
"G3":{
"standby": [-4, 7, -4],
"standby": [-6.800, 6.800, -6.800],
"ref" : [-40.388, 68.393, -34.805],
"pwrref" : [0.64, 1.8, 0.46],
"iocDevice" : ["QMD10", "QMD11", "QMD12"]

View File

@@ -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()