diff --git a/script/Motor Test 2.py b/script/Motor Test 2.py index 6d99502..d1b9e0e 100644 --- a/script/Motor Test 2.py +++ b/script/Motor Test 2.py @@ -1,10 +1,9 @@ -#Script imported from: Motor Test 2 +#Script imported from: Motor Test 3.xml import traceback #by default, failed ret = 'Test failed' status = False -#DEVICE = 'PO2DV-NCS-LS' #TODO: Set the diplay names of positioners and detectors #scan = ManualScan(['idX', 'idInkr'], ['idMotorStatus', 'idLogicalPosition', 'idDiameter', 'idMotorPosition', 'idPotiRaw', 'idPotiProc', 'idBtvsRaw', 'idBtvsProc', 'idDiff01', 'idDiff02'] , [-0.5, 0.0], [4.0, 3000.0], [3000, 20]) @@ -68,58 +67,69 @@ endDefault = 1000.0 end = endDefault #find position at Low end switch: it will be the starting point of the test idInkr.put(-100.0, timeout=None) # TODO: Set appropriate timeout -start = startDefault #idInkr.get()+direction -setpoint2 = end - +start = idInkr.get()+direction +countSteps = 0 for setpoint1 in range(0, 3): sleep( 2 ) # Settling time #RegionPositioner idInkr - idInkr.put(setpoint2, timeout=None) # TODO: Set appropriate timeout - readback2 = idInkr.get() - #if abs(readback2 - setpoint2) > 1 : # TODO: Check accuracy - # ret = 'Actor idInkr could not be set to the value ' + str(setpoint2) + ' (current value: ' + str(readback2) + ')' - # success = False - # raise Exception(ret) - #Detector idMotorStatus - detector1 = idMotorStatus.get() - #Detector idLogicalPosition - detector2 = idLogicalPosition.get() - #Detector idDiameter - detector3 = idDiameter.get() - #Detector idMotorPosition - detector4 = idMotorPosition.get() - #Detector idPotiRaw - detector5 = idPotiRaw.get() - #Detector idPotiProc - detector6 = idPotiProc.get() - #Detector idBtvsRaw - detector7 = idBtvsRaw.get() - #Detector idBtvsProc - detector8 = idBtvsProc.get() - #end switches - endH = idEndSwitchH.get() - endL = idEndSwitchL.get() - #Manipulation idDiff02 - #Variable Mappings - a = detector4 - b = detector8 - idDiff02 = a-b - #Manipulation idDiff01 - #Variable Mappings - a = detector4 - b = detector6 - count = setpoint1 - idDiff01 = a-b - if endH>0.0 : - #invert direction and swap start with end of translation - setpoint2 = start - print 'End H switch, changing target to ' + str(setpoint2) - scan.append ([setpoint2], [readback2], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, idDiff02, idDiff01]) - if endL>0.0 : - #invert direction and swap start with end of translation - setpoint2 = end - print 'End L switch, changing target to ' + str(setpoint2) - scan.append ([setpoint2], [readback2], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, idDiff02, idDiff01]) + for setpoint2 in frange(start, end, direction): + readback1 = setpoint1 + sleep( 0.1 ) # Settling time + idInkr.put(setpoint2, timeout=None) # TODO: Set appropriate timeout + readback2 = idInkr.get() + if abs(readback2 - setpoint2) > 1 : # TODO: Check accuracy + ret = 'Actor idInkr could not be set to the value ' + str(setpoint2) + ' (current value: ' + str(readback2) + ')' + success = False + raise Exception(ret) + #Detector idMotorStatus + detector1 = idMotorStatus.get() + #Detector idLogicalPosition + detector2 = idLogicalPosition.get() + #Detector idDiameter + detector3 = idDiameter.get() + #Detector idMotorPosition + detector4 = idMotorPosition.get() + #Detector idPotiRaw + detector5 = idPotiRaw.get() + #Detector idPotiProc + detector6 = idPotiProc.get() + #Detector idBtvsRaw + detector7 = idBtvsRaw.get() + #Detector idBtvsProc + detector8 = idBtvsProc.get() + #end switches + endH = idEndSwitchH.get() + endL = idEndSwitchL.get() + #Manipulation idDiff02 + #Variable Mappings + a = detector4 + b = detector8 + count = setpoint1 + idDiff02 = a-b + #Manipulation idDiff01 + #Variable Mappings + a = detector4 + b = detector6 + count = setpoint1 + idDiff01 = a-b + countSteps = countSteps + 1 + scan.append ([countSteps], [countSteps], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, idDiff02, idDiff01]) + if endH>0.0 : + #invert direction and swap start with end of translation + end = startDefault + start = readback2 - direction + direction = -1.0 + print 'End H switch, changing direction to ' + str(direction) + break + if endL>0.0 : + #invert direction and swap start with end of translation + end = endDefault + start = readback2 - direction + direction = 1.0 + print 'End L switch, changing direction to ' + str(direction) + break + + #set limits back idLimitH.put(145.0, timeout=None) diff --git a/script/Motor Test 3.py b/script/Motor Test 3.py index 504b28d..2b2d42e 100644 --- a/script/Motor Test 3.py +++ b/script/Motor Test 3.py @@ -69,7 +69,9 @@ end = endDefault idInkr.put(-100.0, timeout=None) # TODO: Set appropriate timeout start = idInkr.get()+direction countSteps = 0 -for setpoint1 in range(0, 2): +count = 0 +for setpoint1 in range(0, 3): + count = count + 1 sleep( 2 ) # Settling time #RegionPositioner idInkr for setpoint2 in frange(start, end, direction): @@ -104,13 +106,11 @@ for setpoint1 in range(0, 2): #Variable Mappings a = detector4 b = detector8 - count = setpoint1 idDiff02 = a-b #Manipulation idDiff01 #Variable Mappings a = detector4 b = detector6 - count = setpoint1 idDiff01 = a-b countSteps = countSteps + 1 scan.append ([countSteps], [countSteps], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, idDiff02, idDiff01])