diff --git a/script/fbm.py b/script/fbm.py new file mode 100644 index 0000000..69aa9fd --- /dev/null +++ b/script/fbm.py @@ -0,0 +1,110 @@ +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 + +; GOTO,garbage + +IF rc LT 200 THEN BEGIN + MESSAGE,/cont,'Ring current too low - program will exit' + GOTO,garbage +ENDIF + +IF NOT ab1 THEN BEGIN + MESSAGE,/cont,'FrontEndAbsorber closed - program will exit' + GOTO,garbage +ENDIF + +IF NOT fes THEN BEGIN + MESSAGE,/cont,'FrontEndShutter closed - program will exit' + GOTO,garbage +ENDIF + +IF NOT ehs THEN BEGIN + MESSAGE,/cont,'ExpHutchShutter closed - program will exit' + GOTO,garbage +ENDIF + +IF energy GT 17.5 THEN BEGIN + MESSAGE,/cont,'Sorry, no feedback above 17.5 keV for now - program will exit' + GOTO,garbage +ENDIF + +;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 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 + + +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 + +; initial mirror TRY3 position +dum = CAGET('X06DA-OP-MI1:TRY3',y3i) +print, "initial X06DA-OP-MI1:TRY3", 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 + +;print how much TRY3 moved +dum = CAGET('X06DA-OP-MI1:TRY3',y3) +print, "TRY3 net movement", y3i-y3