Skip to content
Snippets Groups Projects
Commit 7c090f6d authored by rodolakis's avatar rodolakis
Browse files

ID_switch_mode

parent 4ccf6388
No related branches found
No related tags found
No related merge requests found
......@@ -171,7 +171,12 @@ def ID_mode_set(ID_mode):
"""
writes the desired mode to the correct ID pv
"""
caput(ID_pvs()['mode_val'],ID_mode,wait=True,timeout=18000) # RCP
if ID_mode in ID_mode_list():
ID_state = ID_mode_list().index(ID_mode)
caput(ID_pvs()['mode_val'],ID_state,wait=True,timeout=18000)
sleep(1)
else:
print_warning_message('ID_mode not in '+str(ID_mode_list()))
def ID_ready(verbose=False):
......@@ -185,11 +190,11 @@ def ID_ready(verbose=False):
checkready = caget(ID_pvs()['check_ready'])
checkbusy = caget(ID_pvs()['check_busy'],as_string=True)
if (checkready!="Ready"):
print('checkready',checkready)
#print('checkready',checkready)
sleep(2)
if checkbusy=="Busy":
sleep(2)
print('checkbusy',checkbusy)
#print('checkbusy',checkbusy)
else:
if RBV > 3.7:
#thinks its done but isn't, need to reset busy
......@@ -275,11 +280,13 @@ def ID_switch_mode(ID_mode):
if ID_state_mode(ID_mode) != ID_state:
print("Turning ID off...")
ID_off(verbose=True)
sleep(10)
sleep(5)
ID_ready()
print("Switching ID mode, please wait...")
ID_mode_set(ID_mode)
ID_on(verbose=True)
sleep(5)
ID_ready()
print("ID Mode:",ID_mode)
except:
......@@ -422,7 +429,8 @@ def ID_QP_mode_set(QP_ratio=None,verbose=True):
if ratio_RBV != QP_ratio:
ID_off()
caput("ID29:QuasiRatioIn.C",QP_ratio)
sleep(1)
ID_on()
sleep(15)
......
......@@ -171,7 +171,12 @@ def ID_mode_set(ID_mode):
"""
writes the desired mode to the correct ID pv
"""
caput(ID_pvs()['mode_val'],ID_mode,wait=True,timeout=18000) # RCP
if ID_mode in ID_mode_list():
ID_state = ID_mode_list().index(ID_mode)
caput(ID_pvs()['mode_val'],ID_state,wait=True,timeout=18000)
sleep(1)
else:
print_warning_message('ID_mode not in '+str(ID_mode_list()))
def ID_ready(verbose=False):
......@@ -185,11 +190,11 @@ def ID_ready(verbose=False):
checkready = caget(ID_pvs()['check_ready'])
checkbusy = caget(ID_pvs()['check_busy'],as_string=True)
if (checkready!="Ready"):
print('checkready',checkready)
#print('checkready',checkready)
sleep(2)
if checkbusy=="Busy":
sleep(2)
print('checkbusy',checkbusy)
#print('checkbusy',checkbusy)
else:
if RBV > 3.7:
#thinks its done but isn't, need to reset busy
......@@ -271,19 +276,19 @@ def ID_switch_mode(ID_mode):
shutter_check(verbose=False)
ID_state = ID_state_get()
try:
if ID_state_mode(ID_mode) != ID_state:
print("Turning ID off...")
ID_off(verbose=True)
sleep(10)
print("Switching ID mode, please wait...")
ID_mode_set(ID_mode)
ID_on(verbose=True)
ID_ready()
print("ID Mode:",ID_mode)
except:
print_warning_message("Not a valid ID mode")
if ID_state_mode(ID_mode) != ID_state:
print("Turning ID off...")
ID_off(verbose=True)
sleep(5)
ID_ready()
print("Switching ID mode, please wait...")
ID_mode_set(ID_mode)
ID_on(verbose=True)
sleep(5)
ID_ready()
print("ID Mode:",ID_mode_get())
def ID_get(verbose=False):
"""
......@@ -422,7 +427,8 @@ def ID_QP_mode_set(QP_ratio=None,verbose=True):
if ratio_RBV != QP_ratio:
ID_off()
caput("ID29:QuasiRatioIn.C",QP_ratio)
sleep(1)
ID_on()
sleep(15)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment