Closedown

This commit is contained in:
2015-11-26 18:13:29 +01:00
parent 61fe90693a
commit 3a2747133c
+61 -96
View File
@@ -1,110 +1,75 @@
dum = CAGET('ARIDI-PCT:CURRENT',rc) ; Ring current
dum = CAGET('X06DA-FE-AB1:OPEN_EPS',ab1) ; FrontEnd absorber shutter state
dum = CAGET('X06DA-FE-PH1:OPEN_EPS',fes) ; FrontEnd shutter state
dum = CAGET('X06DA-OP-ST1:OPEN_EPS',ehs) ; ExpHutch shutter state
dum = CAGET('X06DA-OP-MO:TC1',tc1) ; theta1 thermo couple 1
dum = CAGET('X06DA-OP-MO:E-GET',energy) ; Mono energy
dum = CAGET('X06DA-ES-DET:TRZ1',dtz) ; detector Z- position
"""
"""
;print, rc, ab1, fes, ehs, tc1, energy, dtz
tc1 = caget('X06DA-OP-MO:TC1') # theta1 thermo couple 1
energy = # Mono energy
dtz = caget(X06DA-ES-DET:TRZ1') # detector Z- position
; GOTO,garbage
if current.read() < 200:
raise Exception ('Ring current too low')
IF rc LT 200 THEN BEGIN
MESSAGE,/cont,'Ring current too low - program will exit'
GOTO,garbage
ENDIF
if caget('X06DA-FE-AB1:OPEN_EPS','i') == 0:
raise Exception ('FrontEndAbsorber closed') # FrontEnd absorber shutter state
IF NOT ab1 THEN BEGIN
MESSAGE,/cont,'FrontEndAbsorber closed - program will exit'
GOTO,garbage
ENDIF
if caget('X06DA-FE-PH1:OPEN_EPS','i') == 0: # FrontEnd shutter state
raise Exception ('FrontEndShutter closed')
IF NOT fes THEN BEGIN
MESSAGE,/cont,'FrontEndShutter closed - program will exit'
GOTO,garbage
ENDIF
if caget('X06DA-OP-ST1:OPEN_EPS','i') == 0: # ExpHutch shutter state
raise Exception ('ExpHutchShutter closed ')
IF NOT ehs THEN BEGIN
MESSAGE,/cont,'ExpHutchShutter closed - program will exit'
GOTO,garbage
ENDIF
if caget('X06DA-OP-MO:E-GET'),'d') > 17.5: #Mono energy
raise Exception ('Sorry, no feedback above 17.5 keV for now')
IF energy GT 17.5 THEN BEGIN
MESSAGE,/cont,'Sorry, no feedback above 17.5 keV for now - program will exit'
GOTO,garbage
ENDIF
tc = 40 # 2015.09.20 quick fix by MT JW
cur = caget('X06DA-ES-BPM1:SUM','d')
op1 = vaget('X06DA-OP-XPM1:CHAN1', 'd')
;dum = CAGET('X06DA-ES-BPM1:SUM.LOLO',tc) ; treshold for SUM signal. NOTE: need to be set correctly, say 1e11 (TBC). now it is 0
tc = 40 ; 2015.09.20 quick fix by MT JW
dum = CAGET('X06DA-ES-BPM1:SUM',cur)
dum = CAGET('X06DA-OP-XPM1:CHAN1',op1)
if op1 < 1.0:
sete_failed = 1
raise Exception ('X06DA-OP-XPM1:CHAN1 < 10 - please check monochromator, frontend, primary slits, ring current and undulator - program exits')
IF op1 LT 1.0 THEN BEGIN
MESSAGE,/cont,'X06DA-OP-XPM1:CHAN1 < 10 - please check monochromator, frontend, primary slits, ring current and undulator - program exits'
!sete_failed = 1
GOTO,GARBAGE
ENDIF
; define max deviations
dmx = 14. ; 2 x distance mirror HR-XBPM
ymax = 2e-3 ; endwhile criterion for vertical correction
# define max deviations
dmx = 14.0 # 2 x distance mirror HR-XBPM
ymax = 2e-3 # endwhile criterion for vertical correction
IF cur LT tc THEN BEGIN ; check if beam is on CVD-XBPM
MESSAGE,/cont,'severe problem - NO BEAM ON HR-DIFFRACTOMETER XBPM - program exits'
!sete_failed = 1
GOTO,GARBAGE
ENDIF
if cur < tc: #check if beam is on CVD-XBPM
sete_failed = 1
raise Exception ('evere problem - NO BEAM ON HR-DIFFRACTOMETER XBPM')
; initial mirror TRY3 position
dum = CAGET('X06DA-OP-MI1:TRY3',y3i)
print, "initial X06DA-OP-MI1:TRY3", y3i
# initial mirror TRY3 position
y3i = try3.read()
print "initial y3i: " + str(y3i)
; how much beam is off?
dum = CAGET('X06DA-ES-BPM1:POSV',by)
print, "EBOX-POSV before rock", by
; if beam is not off, do nothing
;IF ehs AND ABS(by) LE ymax THEN BEGIN
; MESSAGE,/cont,'Beam aligned, no TRY3 mvt needed - program exits'
; GOTO,GARBAGE
;ENDIF
; can ROCK fixt it?
IF ABS(by) GT ymax THEN BEGIN
ROCK,/silent
ENDIF
; result of ROCK
WAIT,2.0
dum = CAGET('X06DA-ES-BPM1:POSV',by)
print, "EBOX-POSV after rock", by
; feedback
WHILE ABS(by) GE ymax DO BEGIN
dum = CAGET('X06DA-ES-BPM1:POSV',by)
print, "current EBOX-POSV", by
dum = CAGET('X06DA-ES-BPM1:SUM',cur)
IF cur GT tc THEN BEGIN
dum = CAGET('X06DA-OP-ST1:OPEN_EPS',ehs) ; make sure that shutter is open
IF ehs AND ABS(by) GT ymax THEN BEGIN
IF ABS(by) GT 50*ymax THEN BEGIN
GOTO,garbage
ENDIF ELSE BEGIN
; limit mirror TRY3 movement
dum = CAGET('X06DA-OP-MI1:TRY3',y3)
IF ABS(y3i-y3-1e-4*ROUND(by/1e-3)) GT 0.008 THEN BEGIN
;MV,'X06DA-OP-MI1:TRY3', y3i
MESSAGE,/cont,'Feedback trying to move mirror Y3 beyond safe limit - program exits'
GOTO,GARBAGE
ENDIF
MVR,'X06DA-OP-MI1:TRY3',-1e-4*ROUND(by/1e-3)
print, "current X06DA-OP-MI1:TRY3", y3
;MTHETA,-by/dmx*500
ENDELSE
ENDIF
WAIT,0.25
ENDIF
ENDWHILE
# how much beam is off?
by = bpm1.read()
print "EBOX-POSV before rock: " + str(by)
# if beam is not off, do nothing
if abs(by) > ymax:
rock()
;print how much TRY3 moved
dum = CAGET('X06DA-OP-MI1:TRY3',y3)
print, "TRY3 net movement", y3i-y3
# result of ROCK
time.sleep(2.0)
by = bpm1.read()
print, "EBOX-POSV after rock: " + str(by)
# feedback
while abs(by) >= ymax :
by = bpm1.read()
print "current EBOX-POSV: " + str(by)
cur = caget('X06DA-ES-BPM1:SUM','d')
if cur > tc:
ehs = caget('X06DA-OP-ST1:OPEN_EPS','i') # make sure that shutter is open
if (ehs > 0) and (abs(by) > ymax):
if abs(by) > (50*ymax):
raise Exception ('TODO')
#limit mirror TRY3 movement
y3 = try3.read()
if abs(y3i - y3 - 1e-4 * round(by/1e-3)) > 0.008:
raise Exception ('Feedback trying to move mirror Y3 beyond safe limit')
try3.motor.moveRel(-1e-4 * round(by/1e-3))
print, "current X06DA-OP-MI1:TRY3", y3
time.sleep(0.25)
print "TRY3 net movement: " + str(y3i-try3.read()) //print how much TRY3 moved