From 547afb5bc34f68d4db5cb82eb1a64001e5ce8421 Mon Sep 17 00:00:00 2001 From: boccioli_m Date: Fri, 12 Jun 2015 11:33:15 +0200 Subject: [PATCH] Closedown --- plugins/TestingList.java | 2 +- script/Motor Test 3.py | 81 ++++++++++++++++++++-------------------- script/motor-slide.py | 34 ++++++++++++----- script/power-supply.py | 6 --- 4 files changed, 67 insertions(+), 56 deletions(-) diff --git a/plugins/TestingList.java b/plugins/TestingList.java index 9db281e..3bf8d47 100644 --- a/plugins/TestingList.java +++ b/plugins/TestingList.java @@ -74,7 +74,7 @@ public class TestingList extends Panel { //SwingUtils.showMessage(getComponent(), "", ret.toString() + " - " + ret.getClass().getName()); iCurrentTestPos = testingList.showResult(deviceName.toString(), fileName, ret.toString(), sStatus); //start next test - if(iCurrentTestPos>0 && testingList.isTestRunAllowed()) + if(iCurrentTestPos>=0 && testingList.isTestRunAllowed()) { testingList.executeTest(iCurrentTestPos+1); } diff --git a/script/Motor Test 3.py b/script/Motor Test 3.py index 98ade1e..eae3f99 100644 --- a/script/Motor Test 3.py +++ b/script/Motor Test 3.py @@ -1,63 +1,64 @@ #Script imported from: Motor Test 3.xml +import traceback #by default, failed ret = 'Test failed' status = False #TODO: Set the diplay names of positioners and detectors -scan = ManualScan(['idX', 'idInkr'], ['idMotorStatus', 'idLogicalPosition', 'idDiameter', 'idMotorPosition', 'idPotiRaw', 'idPotiProc', 'idBtvsRaw', 'idBtvsProc', 'idDiff01', 'idDiff02'] , [0.0, 0.0], [3000.0, 10.0], [3000, 20]) +scan = ManualScan(['idX', 'idInkr'], ['idMotorStatus', 'idLogicalPosition', 'idDiameter', 'idMotorPosition', 'idPotiRaw', 'idPotiProc', 'idBtvsRaw', 'idBtvsProc', 'idDiff01', 'idDiff02'] , [40.0, 0.0], [44.0, 10.0], [3000, 20]) scan.start() #Creating channels: dimension 1 -#try one channel to see if accessible -#PseudoPositioner idX try: #RegionPositioner idInkr - #idInkr = Channel(DEVICE+':INKR:2', type = 'd') - idInkr = Channel(DEVICE+':MOTOR.ATHM', type = 'd') + #idInkr = Channel(DEVICE+':INKR:2', type = 'd') + idInkr = Channel(DEVICE+':MOTOR.VAL', type = 'd') + #ScalarDetector idMotorStatus + #idMotorStatus = Channel(DEVICE+':STA:1', type = 'd') + idMotorStatus = Channel(DEVICE+':MOTOR.MSTA', type = 'd') + #ScalarDetector idLogicalPosition + #idLogicalPosition = Channel(DEVICE+':IST:2', type = 'd') + idLogicalPosition = Channel(DEVICE+':MOTOR.ATHM', type = 'd') + #ScalarDetector idDiameter + #idDiameter = Channel(DEVICE+':DIAM:2', type = 'd') + idDiameter = Channel(DEVICE+':ENCODERoff', type = 'd') + #ScalarDetector idMotorPosition + #idMotorPosition = Channel(DEVICE+':IST1:2', type = 'd') + idMotorPosition = Channel(DEVICE+':MOTOR.RVAL', type = 'd') + #ScalarDetector idPotiRaw + #idPotiRaw = Channel(DEVICE+':POSA:1', type = 'd') + idPotiRaw = Channel(DEVICE+':ENCODERraw', type = 'd') + #ScalarDetector idPotiProc + #idPotiProc = Channel(DEVICE+':POSA:2', type = 'd') + idPotiProc = Channel(DEVICE+':ENCODER', type = 'd') + #ScalarDetector idBtvsRaw + #idBtvsRaw = Channel(DEVICE+':IST3:1', type = 'd') + idBtvsRaw = Channel(DEVICE+':MOTOR.LLS', type = 'd') + #ScalarDetector idBtvsProc + #idBtvsProc = Channel(DEVICE+':IST3:2', type = 'd') + idBtvsProc = Channel(DEVICE+':MOTOR.HLS', type = 'd') except: - print "Unexpected error:", sys.exc_info()[0] - ret = 'Unable to create channel' - success = False - raise - sys.exit() -#ScalarDetector idMotorStatus -#idMotorStatus = Channel(DEVICE+':STA:1', type = 'd') -idMotorStatus = Channel(DEVICE+':MOTOR.MSTA', type = 'd') -#ScalarDetector idLogicalPosition -#idLogicalPosition = Channel(DEVICE+':IST:2', type = 'd') -idLogicalPosition = Channel(DEVICE+':MOTOR.STA, type = 'd') -#ScalarDetector idDiameter -#idDiameter = Channel(DEVICE+':DIAM:2', type = 'd') -idDiameter = Channel(DEVICE+':MOTOR.VAL', type = 'd') -#ScalarDetector idMotorPosition -#idMotorPosition = Channel(DEVICE+':IST1:2', type = 'd') -idMotorPosition = Channel(DEVICE+':MOTOR.RVAL', type = 'd') -#ScalarDetector idPotiRaw -#idPotiRaw = Channel(DEVICE+':POSA:1', type = 'd') -idPotiRaw = Channel(DEVICE+':ENCODERraw', type = 'd') -#ScalarDetector idPotiProc -#idPotiProc = Channel(DEVICE+':POSA:2', type = 'd') -idPotiProc = Channel(DEVICE+':ENCODER', type = 'd') -#ScalarDetector idBtvsRaw -#idBtvsRaw = Channel(DEVICE+':IST3:1', type = 'd') -idBtvsRaw = Channel(DEVICE+':MOTOR.LLS', type = 'd') -#ScalarDetector idBtvsProc -#idBtvsProc = Channel(DEVICE+':IST3:2', type = 'd') -idBtvsProc = Channel(DEVICE+':MOTOR.HLS', type = 'd') - + print "Unexpected error:", sys.exc_info()[0] + ret = 'Unable to create channel - ' + traceback.format_exc() + success = False + raise + sys.exit() + #Dimension 1 #PseudoPositioner idX -for setpoint1 in range(0, 3000): +for setpoint1 in range(0, 3): readback1 = setpoint1 sleep( 0.1 ) # Settling time #RegionPositioner idInkr - for setpoint2 in frange(0.0, 10.0, 1.0, True) + frange(11.0, 0.0, -1.0, True): + for setpoint2 in frange(40.0, 44.0, 1.0, True) + frange(11.0, 0.0, -1.0, True): idInkr.put(setpoint2, timeout=None) # TODO: Set appropriate timeout readback2 = idInkr.get() - if abs(readback2 - setpoint2) > -0.5 : # TODO: Check accuracy - raise Exception('Actor idInkr could not be set to the value ' + str(setpoint2)) - sleep( 5.0 ) # Settling time + if abs(readback2 - setpoint2) > 0.5 : # TODO: Check accuracy + ret = 'Actor idInkr could not be set to the value ' + str(setpoint2) + ' (current value: ' + str(readback2) + ')' + success = False + raise Exception(ret) + sleep( 1.0 ) # Settling time #Detector idMotorStatus detector1 = idMotorStatus.get() #Detector idLogicalPosition diff --git a/script/motor-slide.py b/script/motor-slide.py index e6f0a53..cd4161e 100644 --- a/script/motor-slide.py +++ b/script/motor-slide.py @@ -1,12 +1,24 @@ #Script imported from: PO2DV-NCS-LS_mot.xml +import traceback + +#by default, failed +ret = 'Test failed' +status = False #Pre-actions -caput('PO2DV-NCS-LS:MOTOR.TWF', '0') -sleep(0.5) -caput('PO2DV-NCS-LS:MOTOR.RDBD', '0.1') +try: + caput('PO2DV-NCS-LS:MOTOR.TWF', '0') + sleep(0.5) + caput('PO2DV-NCS-LS:MOTOR.RDBD', '0.1') +except: + print "Unexpected error:", sys.exc_info()[0] + ret = 'Unable to create channel - ' + traceback.format_exc() + success = False + raise + sys.exit() #TODO: Set the diplay names of positioners and detectors -scan = ManualScan(['VAL'], ['time', 'RVAL', 'TWF', 'RBV', 'Busy'] , [40.0], [44.0], [22]) +scan = ManualScan(['VAL'], ['time', 'RVAL', 'Encoder', 'RBV', 'Busy'] , [40.0], [44.0], [22]) scan.start() #Creating channels: dimension 1 @@ -16,8 +28,8 @@ VALReadback = Channel('PO2DV-NCS-LS:MOTOR.RBV', type = 'd') #Timestamp time #ScalarDetector RVAL RVAL = Channel('PO2DV-NCS-LS:MOTOR.RVAL', type = 'd') -#ScalarDetector TWF -TWF = Channel('PO2DV-NCS-LS:MOTOR.TWF', type = 'd') +#ScalarDetector ENCODER +ENCODER = Channel('PO2DV-NCS-LS:ENCODER', type = 'd') #ScalarDetector RBV RBV = Channel('PO2DV-NCS-LS:MOTOR.RBV', type = 'd') #ScalarDetector Busy @@ -29,13 +41,15 @@ for setpoint1 in frange(40.0, 42.0, 0.2, True) + frange(41.8, 40.0, 0.2, True): VAL.put(setpoint1, timeout=None) # TODO: Set appropriate timeout readback1 = VALReadback.get() if abs(readback1 - setpoint1) > 0.1 : # TODO: Check accuracy - raise Exception('Actor VAL could not be set to the value ' + str(setpoint1)) + ret = 'Actor VAL could not be set to the value ' + str(setpoint2) + ' (current value: ' + str(readback2) + ')' + success = False + raise Exception(ret) #Detector time detector1 = float(java.lang.System.currentTimeMillis()) #Detector RVAL detector2 = RVAL.get() #Detector TWF - detector3 = TWF.get() + detector3 = ENCODER.get() #Detector RBV detector4 = RBV.get() #Detector Busy @@ -46,7 +60,7 @@ for setpoint1 in frange(40.0, 42.0, 0.2, True) + frange(41.8, 40.0, 0.2, True): VAL.close() VALReadback.close() RVAL.close() -TWF.close() +ENCODER.close() RBV.close() Busy.close() @@ -55,3 +69,5 @@ scan.end() #Post-actions caput('PO2DV-NCS-LS:MOTOR.RDBD', '1') +ret = 'Test done' +status = True \ No newline at end of file diff --git a/script/power-supply.py b/script/power-supply.py index a75ce7a..037851e 100644 --- a/script/power-supply.py +++ b/script/power-supply.py @@ -1,12 +1,6 @@ #TODO: Set the diplay names of positioners and detectors #ManualScan(writables, readables, start = None, end = None, steps = None, relative = False) -#testname -#testName = "Calibrate" - -#device name -#deviceName = "RS" - #by default, failed ret = 'Test failed' status = False