Closedown

This commit is contained in:
boccioli_m
2015-09-15 09:30:57 +02:00
parent 5ab97dbf05
commit cfce89a25e
30 changed files with 740 additions and 552 deletions

View File

@@ -22,8 +22,8 @@ def startTest(testName, DEVICE, params):
# init the testing tool class. It can be sued in the following ways:
test = TestingTool(testName, testPath, DEVICE, params)
################ END OF Init #####################
######### WRITE YOUR CODE HERE BELOW #############
################ END OF Init #####################
######### WRITE YOUR CODE HERE BELOW #############
"""
All the code in this section ###..YOUR CODE..### can be modified/deleted.
@@ -66,7 +66,7 @@ def startTest(testName, DEVICE, params):
test.log("Example - Test name: " + testName)
test.log("Example - Device name: " + DEVICE)
try:
test.log("Running test Initialise with the following parameters:")
test.log("Running test with the following parameters:")
test.log(params)
# If present, use the parameters here below for your test script. You might need to change the casting
#$testParameters
@@ -123,8 +123,8 @@ def startTest(testName, DEVICE, params):
# once the test is finished, no need to do anything. The code below yours will do the rest.
################ End of Example ##########
################ END OF YOUR CODE ################
###### Final - DO NOT MODIFY THE CODE BELOW ######
################ END OF YOUR CODE ################
###### Final - DO NOT MODIFY THE CODE BELOW ######
# just in case the feedback was forgotten
test.sendFeedback(ret, success)

View File

@@ -1,118 +1,134 @@
#Script imported from: Calibrate.xml
###### Init - DO NOT MODIFY THE CODE BELOW ######
global print_log, sendFeedback, inspect, log, sys, inspect, os, traceback
global sys, inspect, os, traceback
import sys, inspect, os, traceback
def print_log(testName, DEVICE, text):
time.ctime()
now = time.strftime('%Y.%m.%d %H:%M:%S')
print now + ' ' + DEVICE + ' - ' + testName + ': ' + str(text)
log (now + ' ' + DEVICE + ' - ' + testName + ': ' + text )
#prepare and send feedback to calling tool
def sendFeedback(testPath, testName, DEVICE, returnString, testPassed):
print_log(testName, DEVICE, 'End of test. Result:')
print_log(testName, DEVICE, 'Device: ' + DEVICE)
print_log(testName, DEVICE, 'Test name: ' + testName)
print_log(testName, DEVICE, 'Test path: ' + testPath)
print_log(testName, DEVICE, 'Test passed: ' + str(testPassed))
print_log(testName, DEVICE, 'Return string: ' + returnString)
ret = [testPath, DEVICE, returnString, testPassed]
set_return(ret)
def startTest(testName, DEVICE, params):
# by default, assume the test failed
ret = 'Test failed'
success = False
# plot name to be given to the scan. Use: scan.setPlotName(plotName)
plotName = DEVICE + ' - ' + testName
# put the whole custom code under try/catch
try:
import traceback
#get the path of this script
testPath = inspect.getfile(inspect.currentframe())
#by default, failed
ret = 'Test failed'
success = False
#plot name to be given to the scan. Use: scan.setPlotName(plotName)
plotName = DEVICE + ' - ' + testName
# get the path of this script
testPath = inspect.getfile(inspect.currentframe())
# init the testing tool class. It can be sued in the following ways:
test = TestingTool(testName, testPath, DEVICE, params)
samplePeriod = 0.1
######### WRITE YOUR CODE HERE BELOW #############
scan = ManualScan(['sample'], ['Drive Status: '+DEVICE+':STA:1', 'Logical Pos: '+DEVICE+':IST:2', 'Diameter: '+DEVICE+':DIAM:2 (mm)', 'Cpc: '+DEVICE+':IST1:2 (mm)', 'Pot: '+DEVICE+':IST2:2 (mm)', 'Btvs: '+DEVICE+':IST3:2 (mm)'] , [0.0], [900.0], [900])
scan = ManualScan(['time [1/'+ str(1/samplePeriod) + ' s]'], ['Motor Status (STA:1)', 'Inkr (INKR:2)', 'InkrRb (INKRRB:2)', 'Diameter (DIAM:2)', 'Com (COM:2)',
'Logical Position (IST:2)', 'Motor Pos Raw (IST3:1)','Motor Pos (IST3:2)', 'Poti Pos From Beam (IST1:2)', 'Poti Raw (POSA:1)', 'Poti Position (IST2:1)',
'Poti Ref1 Position (REF1:1)', 'Poti Ref2 Position (REF2:1)'])
scan.setPlotName(plotName)
scan.start()
try:
idMotorStatus = Channel(DEVICE+':STA:1', type = 'd') # DSP device_status reg
idLogicalPosition = Channel(DEVICE+':IST:2', type = 'd') # Shows current position in logical units as calculated from motor step counter [1..n]
idPotiRaw = Channel(DEVICE+':POSA:1', type = 'd') # poti raw data [ADC units]
idMotorPositionRaw = Channel(DEVICE+':IST3:1', type = 'd') # shows current position in steps as as obtained from motor step counter [steps]
idInkr = Channel(DEVICE + ':INKR:2', type='d') # move relative distance (positive means towards R2) [mm]
idInkrRb = Channel(DEVICE + ':INKRRB:2', type='d') # readback of move relative distance (positive means towards R2) [mm]
idDiameter = Channel(DEVICE + ':DIAM:2', type='d') # collimator diameter [mm]
idCom = Channel(DEVICE + ':COM:2', type='d') # current position as from motor step counter [mm]
idMotorPosition = Channel(DEVICE + ':IST3:2', type='d') # current position as from motor step counter [mm]
idPotiPosFromBeam = Channel(DEVICE + ':IST1:2', type='d') # current position from beam as from potentiometer [mm]
idPotiPosition = Channel(DEVICE + ':IST2:1', type='d') # current position as from potentiometer [mm]
idPotiRef1Position = Channel(DEVICE + ':REF1:1', type='d') # R1 position as from potentiometer [mm]
idPotiRef2Position = Channel(DEVICE + ':REF2:1', type='d') # R2 position as from potentiometer [mm]
#Pre-actions: 1 = calibrate
caput(DEVICE+':COM:2', 1)
#Creating channels: dimension 1
#PseudoPositioner id000000
#ScalarDetector id000001
id000001 = Channel(DEVICE+':STA:1', type = 'd')
#ScalarDetector id000003
id000003 = Channel(DEVICE+':IST:2', type = 'd')
#ScalarDetector id000004
id000004 = Channel(DEVICE+':DIAM:2', type = 'd')
#ScalarDetector id000005
id000005 = Channel(DEVICE+':IST1:1', type = 'd')
#ScalarDetector id000006
id000006 = Channel(DEVICE+':IST1:2', type = 'd')
#ScalarDetector id000007
id000007 = Channel(DEVICE+':IST2:1', type = 'd')
#ScalarDetector id000008
id000008 = Channel(DEVICE+':IST2:2', type = 'd')
#ScalarDetector id000009
id000009 = Channel(DEVICE+':IST3:1', type = 'd')
#ScalarDetector id000010
id000010 = Channel(DEVICE+':IST3:2', type = 'd')
sleep( samplePeriod ) # Settling time
except:
ret = 'Unable to create channel - ' + traceback.format_exc()
success = False
sendFeedback(testPath, testName, DEVICE, ret, success)
test.sendFeedback( ret, success)
return
#Dimension 1
#PseudoPositioner id000000
for setpoint1 in range(0, 900):
readback1 = setpoint1
sleep( 0.1 ) # Settling time
#Detector id000001
detector1 = id000001.get()
#Detector id000003
detector2 = id000003.get()
#Detector id000004
detector3 = id000004.get()
#Detector id000005
detector4 = id000005.get()
#Detector id000006
detector5 = id000006.get()
#Detector id000007
detector6 = id000007.get()
#Detector id000008
detector7 = id000008.get()
#Detector id000009
detector8 = id000009.get()
#Detector id000010
detector9 = id000010.get()
scan.append ([setpoint1], [readback1], [detector1, detector2, detector3, detector5, detector7, detector9])
for setpoint1 in range(0, 10000):
sleep( samplePeriod ) # Settling time
MotorStatus = idMotorStatus.get()
LogicalPosition = idLogicalPosition.get()
PotiRaw = idPotiRaw.get()
MotorPositionRaw = idMotorPositionRaw.get()
Com = idCom.get()
MotorPosition = idMotorPosition.get()
PotiPosFromBeam = idPotiPosFromBeam.get()
PotiPosition = idPotiPosition.get()
PotiRef1Position = idPotiRef1Position.get()
PotiRef2Position = idPotiRef2Position.get()
Diameter = idDiameter.get()
Inkr = idInkr.get()
InkrRb = idInkrRb.get()
scan.append([setpoint1], [setpoint1],
[MotorStatus, Inkr, InkrRb, Diameter, Com, LogicalPosition, MotorPositionRaw, MotorPosition,
PotiPosFromBeam, PotiRaw, PotiPosition, PotiRef1Position, PotiRef2Position])
if (MotorStatus & int('1',2))==0: #device finished calibration
break
#check if any error bit is raised
if bool(MotorStatus & int('10000',2)): #error: abort test
test.sendFeedback('Motor switched off (bit#4)', False)
return
if bool(MotorStatus & int('100000',2)): #error: abort test
test.sendFeedback('No motor link (bit#5)', False)
return
if bool(MotorStatus & int('1000000',2)): #error: abort test
test.sendFeedback('No poti link (bit#6)', False)
return
if bool(MotorStatus & int('10000000',2)): #error: abort test
test.sendFeedback('Calibration error (bit#7)', False)
return
if bool(MotorStatus & int('100000000',2)): #error: abort test
test.sendFeedback('Cannot get to R1 (bit#8)', False)
return
if bool(MotorStatus & int('1000000000',2)): #error: abort test
test.sendFeedback('Cannot get to R2 (bit#9)', False)
return
if bool(MotorStatus & int('10000000000',2)): #error: abort test
test.sendFeedback('Position measurement mismatch (bit#10)', False)
return
if bool(MotorStatus & int('100000000000',2)): #error: abort test
test.sendFeedback('Movement timeout (bit#11)', False)
return
#Closing channels
id000001.close()
id000003.close()
id000004.close()
id000005.close()
id000006.close()
id000007.close()
id000008.close()
id000009.close()
id000010.close()
idMotorStatus.close()
idLogicalPosition.close()
idPotiRaw.close()
idMotorPositionRaw.close()
idCom.close()
idMotorPosition.close()
idPotiPosFromBeam.close()
idPotiPosition.close()
idPotiRef1Position.close()
idPotiRef2Position.close()
idDiameter.close()
idInkr.close()
idInkrRb.close()
scan.end()
ret = 'Calibration done'
status = True
success = True
scan.end()
################ END OF YOUR CODE ################
###### Final - DO NOT MODIFY THE CODE BELOW ######
sendFeedback(testPath, testName, DEVICE, ret, success)
###### Final - DO NOT MODIFY THE CODE BELOW ######
# just in case the feedback was forgotten
test.sendFeedback(ret, success)
except:
# generic error handler
ret = traceback.format_exc()
success = False
sendFeedback(testPath, testName, DEVICE, ret, success)
return
test.sendFeedback(ret, success)
#launch the test
# launch the test
startTest(test, device, parameters)

View File

@@ -3,7 +3,7 @@ import traceback
#by default, failed
ret = 'Test failed'
status = False
success = False
try:
#Pre-actions: 2 = drive out
@@ -79,4 +79,4 @@ scan.end()
#return ok
ret = 'Slides moved out'
status = True
success = True

View File

@@ -1,118 +1,136 @@
# Drive Out
###### Init - DO NOT MODIFY THE CODE BELOW ######
global print_log, sendFeedback, inspect, log, sys, inspect, os, traceback
global sys, inspect, os, traceback
import sys, inspect, os, traceback
def print_log(testName, DEVICE, text):
time.ctime()
now = time.strftime('%Y.%m.%d %H:%M:%S')
print now + ' ' + DEVICE + ' - ' + testName + ': ' + str(text)
log (now + ' ' + DEVICE + ' - ' + testName + ': ' + text )
#prepare and send feedback to calling tool
def sendFeedback(testPath, testName, DEVICE, returnString, testPassed):
print_log(testName, DEVICE, 'End of test. Result:')
print_log(testName, DEVICE, 'Device: ' + DEVICE)
print_log(testName, DEVICE, 'Test name: ' + testName)
print_log(testName, DEVICE, 'Test path: ' + testPath)
print_log(testName, DEVICE, 'Test passed: ' + str(testPassed))
print_log(testName, DEVICE, 'Return string: ' + returnString)
ret = [testPath, DEVICE, returnString, testPassed]
set_return(ret)
def startTest(testName, DEVICE, params):
# by default, assume the test failed
ret = 'Test failed'
success = False
# plot name to be given to the scan. Use: scan.setPlotName(plotName)
plotName = DEVICE + ' - ' + testName
# put the whole custom code under try/catch
try:
import traceback
#get the path of this script
testPath = inspect.getfile(inspect.currentframe())
#by default, failed
ret = 'Test failed'
success = False
#plot name to be given to the scan. Use: scan.setPlotName(plotName)
plotName = DEVICE + ' - ' + testName
# get the path of this script
testPath = inspect.getfile(inspect.currentframe())
# init the testing tool class. It can be sued in the following ways:
test = TestingTool(testName, testPath, DEVICE, params)
samplePeriod = 0.1
######### WRITE YOUR CODE HERE BELOW #############
scan = ManualScan(['sample'], ['Drive Status: '+DEVICE+':STA:1', 'Logical Pos: '+DEVICE+':IST:2', 'Diameter: '+DEVICE+':DIAM:2 (mm)', 'Cpc: '+DEVICE+':IST1:2 (mm)', 'Pot: '+DEVICE+'::IST2:2 (mm)', 'Btvs: '+DEVICE+':IST3:2 (mm)'] )
scan.setPlotName(plotName);
scan = ManualScan(['time [1/'+ str(1/samplePeriod) + ' s]'], ['Motor Status (STA:1)', 'Inkr (INKR:2)', 'InkrRb (INKRRB:2)', 'Diameter (DIAM:2)', 'Com (COM:2)',
'Logical Position (IST:2)', 'Motor Pos Raw (IST3:1)','Motor Pos (IST3:2)', 'Poti Pos From Beam (IST1:2)', 'Poti Raw (POSA:1)', 'Poti Position (IST2:1)',
'Poti Ref1 Position (REF1:1)', 'Poti Ref2 Position (REF2:1)'])
scan.setPlotName(plotName)
scan.start()
try:
idMotorStatus = Channel(DEVICE+':STA:1', type = 'd') # DSP device_status reg
idLogicalPosition = Channel(DEVICE+':IST:2', type = 'd') # Shows current position in logical units as calculated from motor step counter [1..n]
idPotiRaw = Channel(DEVICE+':POSA:1', type = 'd') # poti raw data [ADC units]
idMotorPositionRaw = Channel(DEVICE+':IST3:1', type = 'd') # shows current position in steps as as obtained from motor step counter [steps]
idInkr = Channel(DEVICE + ':INKR:2', type='d') # move relative distance (positive means towards R2) [mm]
idInkrRb = Channel(DEVICE + ':INKRRB:2', type='d') # readback of move relative distance (positive means towards R2) [mm]
idDiameter = Channel(DEVICE + ':DIAM:2', type='d') # collimator diameter [mm]
idCom = Channel(DEVICE + ':COM:2', type='d') # current position as from motor step counter [mm]
idMotorPosition = Channel(DEVICE + ':IST3:2', type='d') # current position as from motor step counter [mm]
idPotiPosFromBeam = Channel(DEVICE + ':IST1:2', type='d') # current position from beam as from potentiometer [mm]
idPotiPosition = Channel(DEVICE + ':IST2:1', type='d') # current position as from potentiometer [mm]
idPotiRef1Position = Channel(DEVICE + ':REF1:1', type='d') # R1 position as from potentiometer [mm]
idPotiRef2Position = Channel(DEVICE + ':REF2:1', type='d') # R2 position as from potentiometer [mm]
#Pre-actions: 2 = drive out
caput(DEVICE+':COM:2', 2)
#Creating channels: dimension 1
#PseudoPositioner id000000
#ScalarDetector id000001
id000001 = Channel(DEVICE+':STA:1', type = 'd')
#ScalarDetector id000003
id000003 = Channel(DEVICE+':IST:2', type = 'd')
#ScalarDetector id000004
id000004 = Channel(DEVICE+':DIAM:2', type = 'd')
#ScalarDetector id000005
id000005 = Channel(DEVICE+':IST1:1', type = 'd')
#ScalarDetector id000006
id000006 = Channel(DEVICE+':IST1:2', type = 'd')
#ScalarDetector id000007
id000007 = Channel(DEVICE+':IST2:1', type = 'd')
#ScalarDetector id000008
id000008 = Channel(DEVICE+':IST2:2', type = 'd')
#ScalarDetector id000009
id000009 = Channel(DEVICE+':IST3:1', type = 'd')
#ScalarDetector id000010
id000010 = Channel(DEVICE+':IST3:2', type = 'd')
sleep( samplePeriod ) # Settling time
except:
ret = 'Unable to create channel - ' + traceback.format_exc()
success = False
sendFeedback(testPath, testName, DEVICE, ret, success)
test.sendFeedback( ret, success)
return
for setpoint1 in range(0, 10000):
sleep( samplePeriod ) # Settling time
#Dimension 1
#PseudoPositioner id000000
for setpoint1 in range(0, 3000):
readback1 = setpoint1
sleep( 0.1 ) # Settling time
#Detector id000001
detector1 = id000001.get()
#Detector id000003
detector2 = id000003.get()
#Detector id000004
detector3 = id000004.get()
#Detector id000005
detector4 = id000005.get()
#Detector id000006
detector5 = id000006.get()
#Detector id000007
detector6 = id000007.get()
#Detector id000008
detector7 = id000008.get()
#Detector id000009
detector8 = id000009.get()
#Detector id000010
detector9 = id000010.get()
scan.append ([setpoint1], [readback1], [detector1, detector2, detector3, detector5, detector7, detector9])
MotorStatus = idMotorStatus.get()
LogicalPosition = idLogicalPosition.get()
PotiRaw = idPotiRaw.get()
MotorPositionRaw = idMotorPositionRaw.get()
Com = idCom.get()
MotorPosition = idMotorPosition.get()
PotiPosFromBeam = idPotiPosFromBeam.get()
PotiPosition = idPotiPosition.get()
PotiRef1Position = idPotiRef1Position.get()
PotiRef2Position = idPotiRef2Position.get()
Diameter = idDiameter.get()
Inkr = idInkr.get()
InkrRb = idInkrRb.get()
scan.append([setpoint1], [setpoint1],
[MotorStatus, Inkr, InkrRb, Diameter, Com, LogicalPosition, MotorPositionRaw, MotorPosition,
PotiPosFromBeam, PotiRaw, PotiPosition, PotiRef1Position, PotiRef2Position])
if (MotorStatus & int('1',2))==0: #device finished calibration
break
#check if any error bit is raised
if bool(MotorStatus & int('10000',2)): #error: abort test
test.sendFeedback('Motor switched off (bit#4)', False)
return
if bool(MotorStatus & int('100000',2)): #error: abort test
test.sendFeedback('No motor link (bit#5)', False)
return
if bool(MotorStatus & int('1000000',2)): #error: abort test
test.sendFeedback('No poti link (bit#6)', False)
return
if bool(MotorStatus & int('10000000',2)): #error: abort test
test.sendFeedback('Calibration error (bit#7)', False)
return
if bool(MotorStatus & int('100000000',2)): #error: abort test
test.sendFeedback('Cannot get to R1 (bit#8)', False)
return
if bool(MotorStatus & int('1000000000',2)): #error: abort test
test.sendFeedback('Cannot get to R2 (bit#9)', False)
return
if bool(MotorStatus & int('10000000000',2)): #error: abort test
test.sendFeedback('Position measurement mismatch (bit#10)', False)
return
if bool(MotorStatus & int('100000000000',2)): #error: abort test
test.sendFeedback('Movement timeout (bit#11)', False)
return
#Closing channels
id000001.close()
id000003.close()
id000004.close()
id000005.close()
id000006.close()
id000007.close()
id000008.close()
id000009.close()
id000010.close()
idMotorStatus.close()
idLogicalPosition.close()
idPotiRaw.close()
idMotorPositionRaw.close()
idCom.close()
idMotorPosition.close()
idPotiPosFromBeam.close()
idPotiPosition.close()
idPotiRef1Position.close()
idPotiRef2Position.close()
idDiameter.close()
idInkr.close()
idInkrRb.close()
scan.end()
#return ok
ret = 'Slides moved out'
status = True
############# END OF YOUR CODE ###########
###### DO NOT MODIFY THE CODE BELOW ######
sendFeedback(testPath, testName, DEVICE, ret, success)
ret = 'Drive Out done'
success = True
scan.end()
################ END OF YOUR CODE ################
###### Final - DO NOT MODIFY THE CODE BELOW ######
# just in case the feedback was forgotten
test.sendFeedback(ret, success)
except:
# generic error handler
ret = traceback.format_exc()
success = False
sendFeedback(testPath, testName, DEVICE, ret, success)
return
test.sendFeedback(ret, success)
#launch the test
# launch the test
startTest(test, device, parameters)

View File

@@ -8,7 +8,7 @@ def startTest(testName, DEVICE, params):
testPath = inspect.getfile(inspect.currentframe())
#by default, failed
ret = 'Test failed'
status = False
success = False
#plot name to be given to the scan. Use: scan.setPlotName(plotName)
plotName = DEVICE + ' - ' + testName
###### WRITE YOUR CODE HERE BELOW #######
@@ -63,11 +63,11 @@ def startTest(testName, DEVICE, params):
idPotiRef2Position.close()
print_log(testName, DEVICE, 'End of Monitoring')
ret = 'End of Monitoring'
status = True
success = True
########## END OF YOUR CODE ###########
###### DO NOT MODIFY THE CODE BELOW ######
sendFeedback(testPath, testName, DEVICE, ret, status)
sendFeedback(testPath, testName, DEVICE, ret, success)
#prepare and send feedback to calling tool
def sendFeedback(testPath, testName, DEVICE, returnString, testPassed):

View File

@@ -19,8 +19,12 @@ def startTest(testName, DEVICE, params):
######### WRITE YOUR CODE HERE BELOW #############
#get parameters from the calling interface
try:
test.log( "Running test Motor Movement for device " + DEVICE + " with the following parameters:\n" + str(params))
monitorTime = int(test.getParam('monitorTime')) ; samplingDelay = float(test.getParam('samplingDelay'))
test.log( "Running test Motor Test 2 for device " + DEVICE)
#test.log( "with the following parameters:\n" + str(params))
#test.log( 'testpath: ' + testPath )
#test.log( 'parameters:' + str( params) )
#test.log( 'device: ' + DEVICE )
monitorTime = float(test.getParam("monitorTime"))
except:
ret = 'Could not retrieve testing parameters - ' + traceback.format_exc()
success = False
@@ -28,74 +32,51 @@ def startTest(testName, DEVICE, params):
return
#get parameters from the calling interface
scan = ManualScan(['1/10 s'], ['Motor Status (STA:1)', 'Inkr (INKR:2)', 'InkrRb (INKRRB:2)', 'Diameter (DIAM:2)', 'Com (COM:2)',
'Logical Position (IST:2)', 'Motor Step Raw (IST3:1)','Motor Step (IST3:2)', 'Poti Pos From Beam (IST1:2)', 'Poti Raw (POSA:1)', 'Poti Position (IST2:1)',
'Poti Ref1 Position (REF1:1)', 'Poti Ref2 Position (REF2:1)'])
scan = ManualScan(['time'], ['idMotorStep', 'idPotiPosition', 'idPotiRef1Position','idMotorStep-idPotiPosition'] )
scan.setPlotName(plotName)
scan.start()
# Creating channels: dimension 1
#Creating channels: dimension 1
try:
idMotorStatus = Channel(DEVICE+':STA:1', type = 'd') # DSP device_status reg
idLogicalPosition = Channel(DEVICE+':IST:2', type = 'd') # Shows current position in logical units as calculated from motor step counter [1..n]
idPotiRaw = Channel(DEVICE+':POSA:1', type = 'd') # poti raw data [ADC units]
idMotorStepRaw = Channel(DEVICE+':IST3:1', type = 'd') # shows current position in steps as as obtained from motor step counter [steps]
idInkr = Channel(DEVICE + ':INKR:2', type='d') # move relative distance (positive means towards R2) [mm]
idInkrRb = Channel(DEVICE + ':INKRRB:2', type='d') # readback of move relative distance (positive means towards R2) [mm]
idDiameter = Channel(DEVICE + ':DIAM:2', type='d') # collimator diameter [mm]
idCom = Channel(DEVICE + ':COM:2', type='d') # current position as from motor step counter [mm]
idMotorStep = Channel(DEVICE + ':IST3:2', type='d') # current position as from motor step counter [mm]
idPotiPosFromBeam = Channel(DEVICE + ':IST1:2', type='d') # current position from beam as from potentiometer [mm]
idPotiPosition = Channel(DEVICE + ':IST2:1', type='d') # current position as from potentiometer [mm]
idPotiRef1Position = Channel(DEVICE + ':REF1:1', type='d') # R1 position as from potentiometer [mm]
idPotiRef2Position = Channel(DEVICE + ':REF2:1', type='d') # R2 position as from potentiometer [mm]
idCom = Channel(DEVICE+':COM:2', type = 'd') #current position as from motor step counter [mm]
idMotorStep = Channel(DEVICE+':IST3:2', type = 'd') #current position as from motor step counter [mm]
idPotiPosFromBeam = Channel(DEVICE+':IST1:2', type = 'd') #current position from beam as from potentiometer [mm]
idPotiPosition = Channel(DEVICE+':IST2:1', type = 'd') #current position as from potentiometer [mm]
idPotiRef1Position = Channel(DEVICE+':REF1:1', type = 'd') #R1 position as from potentiometer [mm]
idPotiRef2Position = Channel(DEVICE+':REF2:1', type = 'd') #R2 position as from potentiometer [mm]
except:
test.sendFeedback( 'Unable to create channel - ' + traceback.format_exc(), False)
#raise Exception('Unable to create channel - ' + traceback.format_exc())
return
#monitorTime=40 #seconds
test.log( 'Monitoring movement for ' + str(monitorTime) + 's')
#scan quickly the output during some seconds
potiPosision = idPotiPosition.get()
potiRef2Position = idPotiRef2Position.get()
timeElapsed=0
monitoringTimeWindow = monitorTime*int(1.0/samplingDelay)
while timeElapsed<monitoringTimeWindow:
while timeElapsed<(monitorTime*10):
#Detector time
timestamp = float(java.lang.System.currentTimeMillis())
currentTime = float(java.lang.System.currentTimeMillis())
MotorStatus = idMotorStatus.get()
LogicalPosition = idLogicalPosition.get()
PotiRaw = idPotiRaw.get()
MotorStepRaw = idMotorStepRaw.get()
Com = idCom.get()
MotorStep = idMotorStep.get()
PotiPosFromBeam = idPotiPosFromBeam.get()
PotiPosition = idPotiPosition.get()
PotiRef1Position = idPotiRef1Position.get()
PotiRef2Position = idPotiRef2Position.get()
Diameter = idDiameter.get()
Inkr = idInkr.get()
InkrRb = idInkrRb.get()
diff1 = MotorStep-PotiPosition
scan.append([timestamp], [timestamp],
[MotorStatus, Inkr, InkrRb, Diameter, Com, LogicalPosition, MotorStepRaw, MotorStep,
PotiPosFromBeam, PotiRaw, PotiPosition, PotiRef1Position, PotiRef2Position])
sleep(samplingDelay) # Settling time
motorStep = idMotorStep.get()
potiPosFromBeam = idPotiPosFromBeam.get()
potiPosision = idPotiPosition.get()
potiRef1Position = idPotiRef1Position.get()
potiRef2Position = idPotiRef2Position.get()
diff1 = motorStep-potiPosision
scan.append ([currentTime], [currentTime], [motorStep, potiPosision, potiRef1Position, diff1])
sleep( 0.1 ) # Settling time
timeElapsed=timeElapsed+1
#Closing channels
idMotorStatus.close()
idLogicalPosition.close()
idPotiRaw.close()
idMotorStepRaw.close()
idCom.close()
idMotorStep.close()
idPotiPosFromBeam.close()
idPotiPosition.close()
idPotiRef1Position.close()
idPotiRef2Position.close()
idDiameter.close()
idInkr.close()
idInkrRb.close()
test.log( 'End of Monitoring')
ret = 'End of Monitoring'
success = True

View File

@@ -1,7 +1,7 @@
name=Motor Test 1
description=Moves to CW switch then CCW switch N times.
#optional parameters. Description is compulsory. Syntax:
#parameters=<parameter1Name>:<parameter1Value>:<Parameter 1 description>[;<parameter2Name>:<parameter2Value>:<Parameter 2 description>]
parameters=repeatTimes:1:Repeat N times;delayS:5:Pause delay [s]
name=Motor Test 1
description=Moves to CW switch then CCW switch N times.
#optional parameters. Description is compulsory. Syntax:
#parameters=<parameter1Name>:<parameter1Value>:<Parameter 1 description>[;<parameter2Name>:<parameter2Value>:<Parameter 2 description>]
parameters=repeatTimes:1:Repeat N times;delayS:5:Pause delay [s]

View File

@@ -10,7 +10,7 @@ import sys, inspect, os, traceback
def startTest(testName, DEVICE, params):
# by default, assume the test failed
ret = 'Test failed'
status = False
success = False
# plot name to be given to the scan. Use: scan.setPlotName(plotName)
plotName = DEVICE + ' - ' + testName
# put the whole custom code under try/catch
@@ -20,15 +20,16 @@ def startTest(testName, DEVICE, params):
# init the testing tool class. It can be sued in the following ways:
test = TestingTool(testName, testPath, DEVICE, params)
######### WRITE YOUR CODE HERE BELOW #############
######### WRITE YOUR CODE HERE BELOW #############
# DEVICE = 'PO2DV-NCS-LS'
# get parameters from the calling interface
try:
test.log("Running test Motor Test 1 with the following parameters:")
test.log("Running test with the following parameters:")
test.log(params)
loopTimes = int(test.getParam("repeatTimes"))
delaySeconds = int(test.getParam("delayS"))
samplePeriod = 0.05 #seconds
except:
ret = 'Could not retrieve testing parameters - ' + traceback.format_exc()
success = False
@@ -36,8 +37,9 @@ def startTest(testName, DEVICE, params):
return
scan = ManualScan(['idX'], ['Motor Status (STA:1)', 'Inkr (INKR:2)', 'InkrRb (INKRRB:2)', 'Diameter (DIAM:2)', 'Com (COM:2)',
'Logical Position (IST:2)', 'Motor Step Raw (IST3:1)','Motor Step (IST3:2)', 'Poti Pos From Beam (IST1:2)', 'Poti Raw (POSA:1)', 'Poti Position (IST2:1)',
'Logical Position (IST:2)', 'Motor Pos Raw (IST3:1)','Motor Pos (IST3:2)', 'Poti Pos From Beam (IST1:2)', 'Poti Raw (POSA:1)', 'Poti Position (IST2:1)',
'Poti Ref1 Position (REF1:1)', 'Poti Ref2 Position (REF2:1)'])
p1 = plot(None, name = "Poti Pos From Beam - Motor Position", context = plotName + " pos difference")[0]
scan.setPlotName(plotName)
scan.start()
# Creating channels: dimension 1
@@ -50,7 +52,7 @@ def startTest(testName, DEVICE, params):
idInkrRb = Channel(DEVICE + ':INKRRB:2', type='d') # readback of move relative distance (positive means towards R2) [mm]
idDiameter = Channel(DEVICE + ':DIAM:2', type='d') # collimator diameter [mm]
idCom = Channel(DEVICE + ':COM:2', type='d') # current position as from motor step counter [mm]
idMotorStep = Channel(DEVICE + ':IST3:2', type='d') # current position as from motor step counter [mm]
idMotorPosition = Channel(DEVICE + ':IST3:2', type='d') # current position as from motor step counter [mm]
idPotiPosFromBeam = Channel(DEVICE + ':IST1:2', type='d') # current position from beam as from potentiometer [mm]
idPotiPosition = Channel(DEVICE + ':IST2:1', type='d') # current position as from potentiometer [mm]
idPotiRef1Position = Channel(DEVICE + ':REF1:1', type='d') # R1 position as from potentiometer [mm]
@@ -60,65 +62,93 @@ def startTest(testName, DEVICE, params):
success = False
test.sendFeedback(ret, success)
return
# remove limits
# idLimitH.put(999999.9, timeout=None)
# idLimitL.put(-999999.9, timeout=None)
# Dimension 1
direction = 1.0;
startDefault = -100.0
endDefault = 1000.0
end = endDefault
# find position at Low end switch: it will be the starting point of the test
test.log('Homing')
idInkr.put(-100.0, timeout=None) # TODO: Set appropriate timeout
start = startDefault # idInkr.get()+direction
end = 4 #go to R2
start = 3 #go to R1
setpoint2 = end
count = 0
test.log('Starting test sequence')
for setpoint1 in range(0, loopTimes * 2):
sleep(delaySeconds) # Settling time
p1.addSeries(LinePlotSeries("Run"+str(count)))
sleep(delaySeconds) # Settling time between runs
# RegionPositioner idInkr
idInkr.put(setpoint2, timeout=None) # TODO: Set appropriate timeout
MotorStatus = idMotorStatus.get()
LogicalPosition = idLogicalPosition.get()
PotiRaw = idPotiRaw.get()
MotorStepRaw = idMotorStepRaw.get()
Com = idCom.get()
MotorStep = idMotorStep.get()
PotiPosFromBeam = idPotiPosFromBeam.get()
PotiPosition = idPotiPosition.get()
PotiRef1Position = idPotiRef1Position.get()
PotiRef2Position = idPotiRef2Position.get()
Diameter = idDiameter.get()
Inkr = idInkr.get()
InkrRb = idInkrRb.get()
count = count + 1
idDiff01 = a - b
if endH > 0.0:
# invert direction and swap start with end of translation
setpoint2 = start
test.log('End H switch, changing target to ' + str(setpoint2))
if endL > 0.0:
# invert direction and swap start with end of translation
setpoint2 = end
test.log('End L switch, changing target to ' + str(setpoint2))
scan.append([setpoint2], [setpoint2],
[MotorStatus, Inkr, InkrRb, Diameter, Com, LogicalPosition, MotorStepRaw, MotorStep,
PotiPosFromBeam, PotiRaw, PotiPosition, PotiRef1Position, PotiRef2Position])
# scan for changes
for scanTimes in range(0, 100000):
sleep(samplePeriod)
currentTime = float(java.lang.System.currentTimeMillis())
MotorStatus = idMotorStatus.get()
LogicalPosition = idLogicalPosition.get()
PotiRaw = idPotiRaw.get()
MotorStepRaw = idMotorStepRaw.get()
Com = idCom.get()
MotorPosition = idMotorPosition.get()
PotiPosFromBeam = idPotiPosFromBeam.get()
PotiPosition = idPotiPosition.get()
PotiRef1Position = idPotiRef1Position.get()
PotiRef2Position = idPotiRef2Position.get()
Diameter = idDiameter.get()
Inkr = idInkr.get()
InkrRb = idInkrRb.get()
idDiff01 = PotiPosition - MotorPosition
scan.append([setpoint2], [setpoint2],
[MotorStatus, Inkr, InkrRb, Diameter, Com, LogicalPosition, MotorStepRaw, MotorStep,
PotiPosFromBeam, PotiRaw, PotiPosition, PotiRef1Position, PotiRef2Position])
p1.getSeries(count).appendData(currentTime, idDiff01)
#extract Status bits
endH = bool(MotorStatus & 8) #Ref2 (high limit)
endL = bool(MotorStatus & 4) #Ref1 (low limit)
#check if arrived to R1 or R2
if endH:
# invert direction and swap start with end of translation
setpoint2 = start
test.log('Reached R2 switch, changing target to R1')
break
elif endL:
# invert direction and swap start with end of translation
setpoint2 = end
test.log('Reached R1 switch, changing target to R2')
break
#check if any error bit is raised
if bool(MotorStatus & int('10000',2)): #error: abort test
test.sendFeedback('Motor switched off (bit#4)', False)
return
if bool(MotorStatus & int('100000',2)): #error: abort test
test.sendFeedback('No motor link (bit#5)', False)
return
if bool(MotorStatus & int('1000000',2)): #error: abort test
test.sendFeedback('No poti link (bit#6)', False)
return
if bool(MotorStatus & int('10000000',2)): #error: abort test
test.sendFeedback('Calibration error (bit#7)', False)
return
if bool(MotorStatus & int('100000000',2)): #error: abort test
test.sendFeedback('Cannot get to R1 (bit#8)', False)
return
if bool(MotorStatus & int('1000000000',2)): #error: abort test
test.sendFeedback('Cannot get to R2 (bit#9)', False)
return
if bool(MotorStatus & int('10000000000',2)): #error: abort test
test.sendFeedback('Position measurement mismatch (bit#10)', False)
return
if bool(MotorStatus & int('100000000000',2)): #error: abort test
test.sendFeedback('Movement timeout (bit#11)', False)
return
# set limits back
# idLimitH.put(145.0, timeout=None)
# idLimitL.put(0.0, timeout=None)
# Closing channels
idMotorStatus.close()
idLogicalPosition.close()
idPotiRaw.close()
idMotorStepRaw.close()
idCom.close()
idMotorStep.close()
idMotorPosition.close()
idPotiPosFromBeam.close()
idPotiPosition.close()
idPotiRef1Position.close()
@@ -131,8 +161,8 @@ def startTest(testName, DEVICE, params):
ret = 'Slide moved back and forth (' + str(count) + ' runs)'
success = True
################ END OF YOUR CODE ################
###### Final - DO NOT MODIFY THE CODE BELOW ######
################ END OF YOUR CODE ################
###### Final - DO NOT MODIFY THE CODE BELOW ######
# just in case the feedback was forgotten
test.sendFeedback(ret, success)

View File

@@ -1,14 +1,14 @@
<html>
<body>
<h2>Short Description</h2>
Moves to CW switch then CCW switch N times.
<h2>Details</h2>
Moves to CW switch then CCW switch N times.
<h2>Parameters</h2>
<code>repeatTimes</code> Repeat the moving N times<br/>
<code>delayS</code> Pause delay between each repetition [s]
<h2>Contact</h2>
<a href="https://intranet.psi.ch/Main/MarcoBoccioli">Marco Boccioli </a>
</html>
</body>
<html>
<body>
<h2>Short Description</h2>
Moves to CW switch then CCW switch N times.
<h2>Details</h2>
Moves to CW switch then CCW switch N times.
<h2>Parameters</h2>
<code>repeatTimes</code> Repeat the moving N times<br/>
<code>delayS</code> Pause delay between each repetition [s]
<h2>Contact</h2>
<a href="https://intranet.psi.ch/Main/MarcoBoccioli">Marco Boccioli </a>
</html>
</body>

View File

@@ -9,7 +9,7 @@ import sys, inspect, os, traceback
def startTest(testName, DEVICE, params):
# by default, assume the test failed
ret = 'Test failed'
status = False
success = False
# plot name to be given to the scan. Use: scan.setPlotName(plotName)
plotName = DEVICE + ' - ' + testName
# put the whole custom code under try/catch
@@ -19,44 +19,44 @@ def startTest(testName, DEVICE, params):
# init the testing tool class. It can be sued in the following ways:
test = TestingTool(testName, testPath, DEVICE, params)
######### WRITE YOUR CODE HERE BELOW #############
######### WRITE YOUR CODE HERE BELOW #############
# get parameters from the calling interface
try:
test.log(
"Running test Motor Test 2 for device " + DEVICE + " with the following parameters:\n" + str(params))
test.log("Running test with the following parameters:")
test.log(params)
middle = float(test.getParam("midPoint"))
loopTimes = int(test.getParam("repeatTimes"))
span = float(test.getParam("spanFromMidPoint"))
settlingTime = 0.2 #seconds
except:
ret = 'Could not retrieve testing parameters - ' + traceback.format_exc()
success = False
test.sendFeedback(ret, status)
test.sendFeedback(ret, success)
return
scan = ManualScan(['idX'], ['Motor Status (STA:1)', 'Inkr (INKR:2)', 'InkrRb (INKRRB:2)', 'Diameter (DIAM:2)',
'Com (COM:2)',
'Logical Position (IST:2)', 'Motor Step Raw (IST3:1)', 'Motor Step (IST3:2)',
'Logical Position (IST:2)', 'Motor Pos Raw (IST3:1)', 'Motor Pos (IST3:2)',
'Poti Pos From Beam (IST1:2)', 'Poti Raw (POSA:1)', 'Poti Position (IST2:1)',
'Poti Ref1 Position (REF1:1)', 'Poti Ref2 Position (REF2:1)'])
scan.setPlotName(plotName)
scan.start()
# coloured plot (one colour per scan)
p1 = plot(None, name="Poti-Increment difference", context=plotName + " difference")[0]
p2 = plot(None, name="Poti-MotorStep difference", context=plotName + " difference")[0]
p2 = plot(None, name="Poti-MotorPosition difference", context=plotName + " difference")[0]
# Creating channels: dimension 1
try:
idMotorStatus = Channel(DEVICE + ':STA:1', type='d') # DSP device_status reg
idLogicalPosition = Channel(DEVICE + ':IST:2', type='d') # Shows current position in logical units as calculated from motor step counter [1..n]
idPotiRaw = Channel(DEVICE + ':POSA:1', type='d') # poti raw data [ADC units]
idMotorStepRaw = Channel(DEVICE + ':IST3:1', type='d') # shows current position in steps as as obtained from motor step counter [steps]
idMotorPositionRaw = Channel(DEVICE + ':IST3:1', type='d') # shows current position in steps as as obtained from motor step counter [steps]
idInkr = Channel(DEVICE + ':INKR:2', type='d') # move relative distance (positive means towards R2) [mm]
idInkrRb = Channel(DEVICE + ':INKRRB:2', type='d') # readback of move relative distance (positive means towards R2) [mm]
idDiameter = Channel(DEVICE + ':DIAM:2', type='d') # collimator diameter [mm]
idCom = Channel(DEVICE + ':COM:2', type='d') # current position as from motor step counter [mm]
idMotorStep = Channel(DEVICE + ':IST3:2', type='d') # current position as from motor step counter [mm]
idMotorPosition = Channel(DEVICE + ':IST3:2', type='d') # current position as from motor step counter [mm]
idPotiPosFromBeam = Channel(DEVICE + ':IST1:2', type='d') # current position from beam as from potentiometer [mm]
idPotiPosition = Channel(DEVICE + ':IST2:1', type='d') # current position as from potentiometer [mm]
idPotiRef1Position = Channel(DEVICE + ':REF1:1', type='d') # R1 position as from potentiometer [mm]
@@ -64,7 +64,7 @@ def startTest(testName, DEVICE, params):
except:
ret = 'Unable to create channel - ' + traceback.format_exc()
success = False
test.sendFeedback(ret, status)
test.sendFeedback(ret, success)
return
direction = 1.0
@@ -79,7 +79,7 @@ def startTest(testName, DEVICE, params):
ret = 'Actor idInkr could not be set to the value ' + str(middle) + ' (current value: ' + str(
readback2) + ')'
success = False
test.sendFeedback(ret, status)
test.sendFeedback(ret, success)
return
start = readback2 + direction
countSteps = 0
@@ -93,21 +93,15 @@ def startTest(testName, DEVICE, params):
for setpoint2 in frange(start, end, direction):
readback1 = setpoint1
idInkr.put(setpoint2, timeout=None) # TODO: Set appropriate timeout
sleep(0.2) # Settling time
sleep(settlingTime) # Settling time
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
test.sendFeedback(ret, status)
return
MotorStatus = idMotorStatus.get()
LogicalPosition = idLogicalPosition.get()
PotiRaw = idPotiRaw.get()
MotorStepRaw = idMotorStepRaw.get()
MotorPositionRaw = idMotorPositionRaw.get()
Com = idCom.get()
MotorStep = idMotorStep.get()
MotorPosition = idMotorPosition.get()
PotiPosFromBeam = idPotiPosFromBeam.get()
PotiPosition = idPotiPosition.get()
PotiRef1Position = idPotiRef1Position.get()
@@ -119,10 +113,10 @@ def startTest(testName, DEVICE, params):
idDiff01 = potiPosition - inkrRb
# Manipulation idDiff02
# Variable Mappings
idDiff02 = potiPosition - motorStep
idDiff02 = potiPosition - MotorPosition
countSteps = countSteps + 1
scan.append([countSteps], [countSteps],
[MotorStatus, Inkr, InkrRb, Diameter, Com, LogicalPosition, MotorStepRaw, MotorStep,
[MotorStatus, Inkr, InkrRb, Diameter, Com, LogicalPosition, MotorPositionRaw, MotorPosition,
PotiPosFromBeam, PotiRaw, PotiPosition, PotiRef1Position, PotiRef2Position])
p1.getSeries(count).appendData(setpoint2, idDiff01)
p2.getSeries(count).appendData(setpoint2, idDiff02)
@@ -142,13 +136,58 @@ def startTest(testName, DEVICE, params):
break
#extract Status bits
endH = bool(MotorStatus & 8) #Ref2 (high limit)
endL = bool(MotorStatus & 4) #Ref1 (low limit)
#check if arrived to R1 or R2; if so, invert direction
if endH:
# invert direction and swap start with end of translation
end = startDefault - 1
start = setpoint2 - direction
direction = -1.0
test.log('Reached R2 switch, changing direction to ' + str(direction))
break
elif endL:
# invert direction and swap start with end of translation
end = endDefault + 1
start = setpoint2 - direction
direction = 1.0
test.log('Reached R1 switch, changing direction to ' + str(direction))
break
#check if any error bit is raised
if bool(MotorStatus & int('10000',2)): #error: abort test
test.sendFeedback('Motor switched off (bit#4)', False)
return
if bool(MotorStatus & int('100000',2)): #error: abort test
test.sendFeedback('No motor link (bit#5)', False)
return
if bool(MotorStatus & int('1000000',2)): #error: abort test
test.sendFeedback('No poti link (bit#6)', False)
return
if bool(MotorStatus & int('10000000',2)): #error: abort test
test.sendFeedback('Calibration error (bit#7)', False)
return
if bool(MotorStatus & int('100000000',2)): #error: abort test
test.sendFeedback('Cannot get to R1 (bit#8)', False)
return
if bool(MotorStatus & int('1000000000',2)): #error: abort test
test.sendFeedback('Cannot get to R2 (bit#9)', False)
return
if bool(MotorStatus & int('10000000000',2)): #error: abort test
test.sendFeedback('Position measurement mismatch (bit#10)', False)
return
if bool(MotorStatus & int('100000000000',2)): #error: abort test
test.sendFeedback('Movement timeout (bit#11)', False)
return
# Closing channels
idMotorStatus.close()
idLogicalPosition.close()
idPotiRaw.close()
idMotorStepRaw.close()
idMotorPositionRaw.close()
idCom.close()
idMotorStep.close()
idMotorPosition.close()
idPotiPosFromBeam.close()
idPotiPosition.close()
idPotiRef1Position.close()
@@ -159,10 +198,10 @@ def startTest(testName, DEVICE, params):
scan.end()
ret = 'Slide moved back and forth (' + str(count) + ' runs)'
status = True
success = True
################ END OF YOUR CODE ################
###### Final - DO NOT MODIFY THE CODE BELOW ######
################ END OF YOUR CODE ################
###### Final - DO NOT MODIFY THE CODE BELOW ######
# just in case the feedback was forgotten
test.sendFeedback(ret, success)

View File

@@ -1,7 +1,7 @@
name=Motor Test 3
description=Moves from CCW to CW as a series of discrete translations (C times) logs after each translation. When end switch is encountered change direction. Repeat N times
#optional parameters. Description is compulsory. Syntax:
#parameters=<parameter1Name>:<parameter1Value>:<Parameter 1 description>[;<parameter2Name>:<parameter2Value>:<Parameter 2 description>]
parameters=repeatTimes:1:Repeat N times;translation:2:Translation C steps
name=Motor Test 3
description=Moves from CCW to CW as a series of discrete translations (C times) logs after each translation. When end switch is encountered change direction. Repeat N times
#optional parameters. Description is compulsory. Syntax:
#parameters=<parameter1Name>:<parameter1Value>:<Parameter 1 description>[;<parameter2Name>:<parameter2Value>:<Parameter 2 description>]
parameters=repeatTimes:1:Repeat N times;translation:2:Translation C steps

View File

@@ -25,29 +25,31 @@ def startTest(testName, DEVICE, params):
test.log(params)
loopTimes = int(test.getParam("repeatTimes"))
direction = int(test.getParam("translation"))
settlingTime = 0.2 #seconds
except:
test.log("Could not retrieve testing parameters: ", sys.exc_info()[0])
ret = 'Could not retrieve testing parameters - ' + traceback.format_exc()
success = False
test.sendFeedback(ret, status)
test.sendFeedback(ret, success)
return
scan = ManualScan(['idX'], ['Motor Status (STA:1)', 'Inkr (INKR:2)', 'InkrRb (INKRRB:2)', 'Diameter (DIAM:2)', 'Com (COM:2)',
'Logical Position (IST:2)', 'Motor Step Raw (IST3:1)','Motor Step (IST3:2)', 'Poti Pos From Beam (IST1:2)', 'Poti Raw (POSA:1)', 'Poti Position (IST2:1)',
scan = ManualScan(['time'], ['Motor Status (STA:1)', 'Inkr (INKR:2)', 'InkrRb (INKRRB:2)', 'Diameter (DIAM:2)', 'Com (COM:2)',
'Logical Position (IST:2)', 'Motor Pos Raw (IST3:1)','Motor Pos (IST3:2)', 'Poti Pos From Beam (IST1:2)', 'Poti Raw (POSA:1)', 'Poti Position (IST2:1)',
'Poti Ref1 Position (REF1:1)', 'Poti Ref2 Position (REF2:1)'])
scan.setPlotName(plotName)
scan.start()
p1 = plot(None, name = "Poti Pos From Beam - Motor Position", context = plotName + " pos difference")[0]
# Creating channels: dimension 1
try:
idMotorStatus = Channel(DEVICE+':STA:1', type = 'd') # DSP device_status reg
idLogicalPosition = Channel(DEVICE+':IST:2', type = 'd') # Shows current position in logical units as calculated from motor step counter [1..n]
idPotiRaw = Channel(DEVICE+':POSA:1', type = 'd') # poti raw data [ADC units]
idMotorStepRaw = Channel(DEVICE+':IST3:1', type = 'd') # shows current position in steps as as obtained from motor step counter [steps]
idMotorPositionRaw = Channel(DEVICE+':IST3:1', type = 'd') # shows current position in steps as as obtained from motor step counter [steps]
idInkr = Channel(DEVICE + ':INKR:2', type='d') # move relative distance (positive means towards R2) [mm]
idInkrRb = Channel(DEVICE + ':INKRRB:2', type='d') # readback of move relative distance (positive means towards R2) [mm]
idDiameter = Channel(DEVICE + ':DIAM:2', type='d') # collimator diameter [mm]
idCom = Channel(DEVICE + ':COM:2', type='d') # current position as from motor step counter [mm]
idMotorStep = Channel(DEVICE + ':IST3:2', type='d') # current position as from motor step counter [mm]
idMotorPosition = Channel(DEVICE + ':IST3:2', type='d') # current position as from motor step counter [mm]
idPotiPosFromBeam = Channel(DEVICE + ':IST1:2', type='d') # current position from beam as from potentiometer [mm]
idPotiPosition = Channel(DEVICE + ':IST2:1', type='d') # current position as from potentiometer [mm]
idPotiRef1Position = Channel(DEVICE + ':REF1:1', type='d') # R1 position as from potentiometer [mm]
@@ -77,19 +79,19 @@ def startTest(testName, DEVICE, params):
for setpoint1 in range(0, loopTimes*2):
count = count + 1
sleep( 2 ) # Settling time
#RegionPositioner idInkr
p1.addSeries(LinePlotSeries("Run"+str(count)))
#go to an end reference
for setpoint2 in frange(start, end, direction):
readback1 = setpoint1
idInkr.put(setpoint2, timeout=10) # TODO: Set appropriate timeout
sleep( 0.2 ) # Settling time
sleep(settlingTime) # Settling time
readback2 = idInkr.get()
MotorStatus = idMotorStatus.get()
LogicalPosition = idLogicalPosition.get()
PotiRaw = idPotiRaw.get()
MotorStepRaw = idMotorStepRaw.get()
MotorPositionRaw = idMotorPositionRaw.get()
Com = idCom.get()
MotorStep = idMotorStep.get()
MotorPosition = idMotorPosition.get()
PotiPosFromBeam = idPotiPosFromBeam.get()
PotiPosition = idPotiPosition.get()
PotiRef1Position = idPotiRef1Position.get()
@@ -98,46 +100,66 @@ def startTest(testName, DEVICE, params):
Inkr = idInkr.get()
InkrRb = idInkrRb.get()
#Manipulation idDiff02
#Variable Mappings
a = detector4
b = detector8
idDiff02 = a-b
#Manipulation idDiff01
#Variable Mappings
a = detector4
b = detector6
idDiff01 = a-b
idDiff01 = PotiPosition-MotorPosition
countSteps = countSteps + 1
scan.append([setpoint2], [setpoint2],
[MotorStatus, Inkr, InkrRb, Diameter, Com, LogicalPosition, MotorStepRaw, MotorStep,
[MotorStatus, Inkr, InkrRb, Diameter, Com, LogicalPosition, MotorPositionRaw, MotorPosition,
PotiPosFromBeam, PotiRaw, PotiPosition, PotiRef1Position, PotiRef2Position])
if endH>0.0 :
p1.getSeries(count).appendData(setpoint2, idDiff01)
#extract Status bits
endH = bool(MotorStatus & 8) #Ref2 (high limit)
endL = bool(MotorStatus & 4) #Ref1 (low limit)
#check if arrived to R1 or R2
if endH:
#invert direction and swap start with end of translation
end = startDefault
start = readback2 - direction
direction = -1.0
test.log('End H switch, changing direction to ' + str(direction))
test.log('Reached R2 switch, changing target to R1')
break
if endL>0.0 :
elif endL:
#invert direction and swap start with end of translation
end = endDefault
start = readback2 - direction
direction = 1.0
test.log('End L switch, changing direction to ' + str(direction))
test.log('Reached R1 switch, changing target to R2')
break
#set limits back
#idLimitH.put(145.0, timeout=None)
#idLimitL.put(0.0, timeout=None)
#check if any error bit is raised
if bool(MotorStatus & int('10000',2)): #error: abort test
test.sendFeedback('Motor switched off (bit#4)', False)
return
if bool(MotorStatus & int('100000',2)): #error: abort test
test.sendFeedback('No motor link (bit#5)', False)
return
if bool(MotorStatus & int('1000000',2)): #error: abort test
test.sendFeedback('No poti link (bit#6)', False)
return
if bool(MotorStatus & int('10000000',2)): #error: abort test
test.sendFeedback('Calibration error (bit#7)', False)
return
if bool(MotorStatus & int('100000000',2)): #error: abort test
test.sendFeedback('Cannot get to R1 (bit#8)', False)
return
if bool(MotorStatus & int('1000000000',2)): #error: abort test
test.sendFeedback('Cannot get to R2 (bit#9)', False)
return
if bool(MotorStatus & int('10000000000',2)): #error: abort test
test.sendFeedback('Position measurement mismatch (bit#10)', False)
return
if bool(MotorStatus & int('100000000000',2)): #error: abort test
test.sendFeedback('Movement timeout (bit#11)', False)
return
#Closing channels
idMotorStatus.close()
idLogicalPosition.close()
idPotiRaw.close()
idMotorStepRaw.close()
idMotorPositionRaw.close()
idCom.close()
idMotorStep.close()
idMotorPosition.close()
idPotiPosFromBeam.close()
idPotiPosition.close()
idPotiRef1Position.close()

View File

@@ -1,13 +1,13 @@
<html>
<body>
<h2>Description</h2>
Moves from CCW to CW as a series of discrete translations (C steps) logs after each translation. When end switch is encountered change direction. Repeat N times
<h2>Parameters</h2>
<code>repeatTimes </code>How many N times the test is repeated<br/>
<code>translation </code>How many C steps are done for one translation<br/>
<h2>Contact</h2>
<a href="https://intranet.psi.ch/search/#?t=phonebook&q=boccioli_m">boccioli_m</a>
</html>
</body>
<html>
<body>
<h2>Description</h2>
Moves from CCW to CW as a series of discrete translations (C steps) logs after each translation. When end switch is encountered change direction. Repeat N times
<h2>Parameters</h2>
<code>repeatTimes </code>How many N times the test is repeated<br/>
<code>translation </code>How many C steps are done for one translation<br/>
<h2>Contact</h2>
<a href="https://intranet.psi.ch/search/#?t=phonebook&q=boccioli_m">boccioli_m</a>
</html>
</body>

View File

@@ -5,7 +5,7 @@ def startTest(testName, DEVICE, params):
testPath = inspect.getfile(inspect.currentframe())
#by default, failed
ret = 'Test failed'
status = False
success = False
#plot name to be given to the scan. Use: scan.setPlotName(plotName)
plotName = DEVICE + ' - ' + testName
###### WRITE YOUR CODE HERE BELOW #######
@@ -63,7 +63,7 @@ def startTest(testName, DEVICE, params):
########## END OF YOUR CODE ###########
###### DO NOT MODIFY THE CODE BELOW ######
sendFeedback(testPath, testName, DEVICE, ret, status)
sendFeedback(testPath, testName, DEVICE, ret, success)
#prepare and send feedback to calling tool
def sendFeedback(testPath, testName, DEVICE, returnString, testPassed):

View File

@@ -1,95 +1,136 @@
# Drive to R1
###### Init - DO NOT MODIFY THE CODE BELOW ######
global print_log, sendFeedback, inspect, log, sys, inspect, os, traceback
global sys, inspect, os, traceback
import sys, inspect, os, traceback
def print_log(testName, DEVICE, text):
time.ctime()
now = time.strftime('%Y.%m.%d %H:%M:%S')
print now + ' ' + DEVICE + ' - ' + testName + ': ' + str(text)
log (now + ' ' + DEVICE + ' - ' + testName + ': ' + text )
#prepare and send feedback to calling tool
def sendFeedback(testPath, testName, DEVICE, returnString, testPassed):
print_log(testName, DEVICE, 'End of test. Result:')
print_log(testName, DEVICE, 'Device: ' + DEVICE)
print_log(testName, DEVICE, 'Test name: ' + testName)
print_log(testName, DEVICE, 'Test path: ' + testPath)
print_log(testName, DEVICE, 'Test passed: ' + str(testPassed))
print_log(testName, DEVICE, 'Return string: ' + returnString)
ret = [testPath, DEVICE, returnString, testPassed]
set_return(ret)
def startTest(testName, DEVICE, params):
# by default, assume the test failed
ret = 'Test failed'
success = False
# plot name to be given to the scan. Use: scan.setPlotName(plotName)
plotName = DEVICE + ' - ' + testName
# put the whole custom code under try/catch
try:
import traceback
#get the path of this script
testPath = inspect.getfile(inspect.currentframe())
#by default, failed
ret = 'Test failed'
success = False
#plot name to be given to the scan. Use: scan.setPlotName(plotName)
plotName = DEVICE + ' - ' + testName
# get the path of this script
testPath = inspect.getfile(inspect.currentframe())
# init the testing tool class. It can be sued in the following ways:
test = TestingTool(testName, testPath, DEVICE, params)
samplePeriod = 0.1
######### WRITE YOUR CODE HERE BELOW #############
#get parameters from the calling interface
print_log(testName, DEVICE, 'testpath: ' + testPath )
print_log(testName, DEVICE, 'parameters:' + str( params) )
print_log(testName, DEVICE, 'device: ' + DEVICE )
scan = ManualScan(['time'], ['idMotorStep', 'idPotiPosition', 'idPotiRef1Position','idMotorStep-idPotiPosition'] , [0.0], [30.0], [20])
scan = ManualScan(['time [1/'+ str(1/samplePeriod) + ' s]'], ['Motor Status (STA:1)', 'Inkr (INKR:2)', 'InkrRb (INKRRB:2)', 'Diameter (DIAM:2)', 'Com (COM:2)',
'Logical Position (IST:2)', 'Motor Pos Raw (IST3:1)','Motor Pos (IST3:2)', 'Poti Pos From Beam (IST1:2)', 'Poti Raw (POSA:1)', 'Poti Position (IST2:1)',
'Poti Ref1 Position (REF1:1)', 'Poti Ref2 Position (REF2:1)'])
scan.setPlotName(plotName)
scan.start()
#Creating channels: dimension 1
try:
idCom = Channel(DEVICE+':COM:2', type = 'd') #current position as from motor step counter [mm]
idMotorStep = Channel(DEVICE+':IST3:2', type = 'd') #current position as from motor step counter [mm]
idPotiPosFromBeam = Channel(DEVICE+':IST1:2', type = 'd') #current position from beam as from potentiometer [mm]
idPotiPosition = Channel(DEVICE+':IST2:1', type = 'd') #current position as from potentiometer [mm]
idPotiRef1Position = Channel(DEVICE+':REF1:1', type = 'd') #R1 position as from potentiometer [mm]
idPotiRef2Position = Channel(DEVICE+':REF2:1', type = 'd') #R2 position as from potentiometer [mm]
idMotorStatus = Channel(DEVICE+':STA:1', type = 'd') # DSP device_status reg
idLogicalPosition = Channel(DEVICE+':IST:2', type = 'd') # Shows current position in logical units as calculated from motor step counter [1..n]
idPotiRaw = Channel(DEVICE+':POSA:1', type = 'd') # poti raw data [ADC units]
idMotorPositionRaw = Channel(DEVICE+':IST3:1', type = 'd') # shows current position in steps as as obtained from motor step counter [steps]
idInkr = Channel(DEVICE + ':INKR:2', type='d') # move relative distance (positive means towards R2) [mm]
idInkrRb = Channel(DEVICE + ':INKRRB:2', type='d') # readback of move relative distance (positive means towards R2) [mm]
idDiameter = Channel(DEVICE + ':DIAM:2', type='d') # collimator diameter [mm]
idCom = Channel(DEVICE + ':COM:2', type='d') # current position as from motor step counter [mm]
idMotorPosition = Channel(DEVICE + ':IST3:2', type='d') # current position as from motor step counter [mm]
idPotiPosFromBeam = Channel(DEVICE + ':IST1:2', type='d') # current position from beam as from potentiometer [mm]
idPotiPosition = Channel(DEVICE + ':IST2:1', type='d') # current position as from potentiometer [mm]
idPotiRef1Position = Channel(DEVICE + ':REF1:1', type='d') # R1 position as from potentiometer [mm]
idPotiRef2Position = Channel(DEVICE + ':REF2:1', type='d') # R2 position as from potentiometer [mm]
idCom.put('3', timeout=None) # go to R1
sleep( samplePeriod ) # Settling time
except:
sendFeedback(testPath, testName, DEVICE, 'Unable to create channel - ' + traceback.format_exc(), False)
#raise Exception('Unable to create channel - ' + traceback.format_exc())
ret = 'Unable to create channel - ' + traceback.format_exc()
success = False
test.sendFeedback( ret, success)
return
idCom.put('3', timeout=None) # go to R1
print_log(testName, DEVICE, 'Moving to reference point')
#scan quickly the output during some seconds
detector4 = idPotiPosition.get()
detector6 = idPotiRef2Position.get()
timeElapsed=0
while detector4>detector6 and timeElapsed<600:
#Detector time
detector1 = float(java.lang.System.currentTimeMillis())
#scan for a while to collect data
for setpoint1 in range(0, 10000):
sleep( samplePeriod ) # Settling time
MotorStatus = idMotorStatus.get()
LogicalPosition = idLogicalPosition.get()
PotiRaw = idPotiRaw.get()
MotorPositionRaw = idMotorPositionRaw.get()
Com = idCom.get()
MotorPosition = idMotorPosition.get()
PotiPosFromBeam = idPotiPosFromBeam.get()
PotiPosition = idPotiPosition.get()
PotiRef1Position = idPotiRef1Position.get()
PotiRef2Position = idPotiRef2Position.get()
Diameter = idDiameter.get()
Inkr = idInkr.get()
InkrRb = idInkrRb.get()
scan.append([setpoint1], [setpoint1],
[MotorStatus, Inkr, InkrRb, Diameter, Com, LogicalPosition, MotorPositionRaw, MotorPosition,
PotiPosFromBeam, PotiRaw, PotiPosition, PotiRef1Position, PotiRef2Position])
if (MotorStatus & int('1',2))==0: #device finished calibration
break
#check if any error bit is raised
if bool(MotorStatus & int('10000',2)): #error: abort test
test.sendFeedback('Motor switched off (bit#4)', False)
return
if bool(MotorStatus & int('100000',2)): #error: abort test
test.sendFeedback('No motor link (bit#5)', False)
return
if bool(MotorStatus & int('1000000',2)): #error: abort test
test.sendFeedback('No poti link (bit#6)', False)
return
if bool(MotorStatus & int('10000000',2)): #error: abort test
test.sendFeedback('Calibration error (bit#7)', False)
return
if bool(MotorStatus & int('100000000',2)): #error: abort test
test.sendFeedback('Cannot get to R1 (bit#8)', False)
return
if bool(MotorStatus & int('1000000000',2)): #error: abort test
test.sendFeedback('Cannot get to R2 (bit#9)', False)
return
if bool(MotorStatus & int('10000000000',2)): #error: abort test
test.sendFeedback('Position measurement mismatch (bit#10)', False)
return
if bool(MotorStatus & int('100000000000',2)): #error: abort test
test.sendFeedback('Movement timeout (bit#11)', False)
return
detector2 = idMotorStep.get()
detector3 = idPotiPosFromBeam.get()
detector4 = idPotiPosition.get()
detector5 = idPotiRef1Position.get()
detector6 = idPotiRef2Position.get()
diff1 = detector2-detector4
scan.append ([detector1], [detector1], [detector2, detector4, detector5, diff1])
sleep( 0.1 ) # Settling time
timeElapsed=timeElapsed+1
#Closing channels
idMotorStatus.close()
idLogicalPosition.close()
idPotiRaw.close()
idMotorPositionRaw.close()
idCom.close()
idMotorStep.close()
idMotorPosition.close()
idPotiPosFromBeam.close()
idPotiPosition.close()
idPotiRef1Position.close()
idPotiRef2Position.close()
print_log(testName, DEVICE, ' Reference point reached')
idDiameter.close()
idInkr.close()
idInkrRb.close()
scan.end()
ret = 'Moved to R1'
success = True
scan.end()
################ END OF YOUR CODE ################
###### Final - DO NOT MODIFY THE CODE BELOW ######
sendFeedback(testPath, testName, DEVICE, ret, success)
###### Final - DO NOT MODIFY THE CODE BELOW ######
# just in case the feedback was forgotten
test.sendFeedback(ret, success)
except:
# generic error handler
ret = traceback.format_exc()
success = False
sendFeedback(testPath, testName, DEVICE, ret, success)
return
test.sendFeedback(ret, success)
#launch the test
# launch the test
startTest(test, device, parameters)

View File

@@ -1,95 +1,136 @@
# Drive to R2
###### Init - DO NOT MODIFY THE CODE BELOW ######
global print_log, sendFeedback, inspect, log, sys, inspect, os, traceback
global sys, inspect, os, traceback
import sys, inspect, os, traceback
def print_log(testName, DEVICE, text):
time.ctime()
now = time.strftime('%Y.%m.%d %H:%M:%S')
print now + ' ' + DEVICE + ' - ' + testName + ': ' + str(text)
log (now + ' ' + DEVICE + ' - ' + testName + ': ' + text )
#prepare and send feedback to calling tool
def sendFeedback(testPath, testName, DEVICE, returnString, testPassed):
print_log(testName, DEVICE, 'End of test. Result:')
print_log(testName, DEVICE, 'Device: ' + DEVICE)
print_log(testName, DEVICE, 'Test name: ' + testName)
print_log(testName, DEVICE, 'Test path: ' + testPath)
print_log(testName, DEVICE, 'Test passed: ' + str(testPassed))
print_log(testName, DEVICE, 'Return string: ' + returnString)
ret = [testPath, DEVICE, returnString, testPassed]
set_return(ret)
def startTest(testName, DEVICE, params):
# by default, assume the test failed
ret = 'Test failed'
success = False
# plot name to be given to the scan. Use: scan.setPlotName(plotName)
plotName = DEVICE + ' - ' + testName
# put the whole custom code under try/catch
try:
import traceback
#get the path of this script
testPath = inspect.getfile(inspect.currentframe())
#by default, failed
ret = 'Test failed'
success = False
#plot name to be given to the scan. Use: scan.setPlotName(plotName)
plotName = DEVICE + ' - ' + testName
# get the path of this script
testPath = inspect.getfile(inspect.currentframe())
# init the testing tool class. It can be sued in the following ways:
test = TestingTool(testName, testPath, DEVICE, params)
samplePeriod = 0.1
######### WRITE YOUR CODE HERE BELOW #############
#get parameters from the calling interface
print_log(testName, DEVICE, 'testpath: ' + testPath )
print_log(testName, DEVICE, 'parameters:' + str( params) )
print_log(testName, DEVICE, 'device: ' + DEVICE )
scan = ManualScan(['time'], ['idMotorStep', 'idPotiPosition', 'idPotiRef2Position','idMotorStep-idPotiPosition'] , [0.0], [30.0], [20])
scan = ManualScan(['time [1/'+ str(1/samplePeriod) + ' s]'], ['Motor Status (STA:1)', 'Inkr (INKR:2)', 'InkrRb (INKRRB:2)', 'Diameter (DIAM:2)', 'Com (COM:2)',
'Logical Position (IST:2)', 'Motor Pos Raw (IST3:1)','Motor Pos (IST3:2)', 'Poti Pos From Beam (IST1:2)', 'Poti Raw (POSA:1)', 'Poti Position (IST2:1)',
'Poti Ref1 Position (REF1:1)', 'Poti Ref2 Position (REF2:1)'])
scan.setPlotName(plotName)
scan.start()
#Creating channels: dimension 1
try:
idCom = Channel(DEVICE+':COM:2', type = 'd') #current position as from motor step counter [mm]
idMotorStep = Channel(DEVICE+':IST3:2', type = 'd') #current position as from motor step counter [mm]
idPotiPosFromBeam = Channel(DEVICE+':IST1:2', type = 'd') #current position from beam as from potentiometer [mm]
idPotiPosition = Channel(DEVICE+':IST2:1', type = 'd') #current position as from potentiometer [mm]
idPotiRef1Position = Channel(DEVICE+':REF1:1', type = 'd') #R1 position as from potentiometer [mm]
idPotiRef2Position = Channel(DEVICE+':REF2:1', type = 'd') #R2 position as from potentiometer [mm]
idMotorStatus = Channel(DEVICE+':STA:1', type = 'd') # DSP device_status reg
idLogicalPosition = Channel(DEVICE+':IST:2', type = 'd') # Shows current position in logical units as calculated from motor step counter [1..n]
idPotiRaw = Channel(DEVICE+':POSA:1', type = 'd') # poti raw data [ADC units]
idMotorPositionRaw = Channel(DEVICE+':IST3:1', type = 'd') # shows current position in steps as as obtained from motor step counter [steps]
idInkr = Channel(DEVICE + ':INKR:2', type='d') # move relative distance (positive means towards R2) [mm]
idInkrRb = Channel(DEVICE + ':INKRRB:2', type='d') # readback of move relative distance (positive means towards R2) [mm]
idDiameter = Channel(DEVICE + ':DIAM:2', type='d') # collimator diameter [mm]
idCom = Channel(DEVICE + ':COM:2', type='d') # current position as from motor step counter [mm]
idMotorPosition = Channel(DEVICE + ':IST3:2', type='d') # current position as from motor step counter [mm]
idPotiPosFromBeam = Channel(DEVICE + ':IST1:2', type='d') # current position from beam as from potentiometer [mm]
idPotiPosition = Channel(DEVICE + ':IST2:1', type='d') # current position as from potentiometer [mm]
idPotiRef1Position = Channel(DEVICE + ':REF1:1', type='d') # R1 position as from potentiometer [mm]
idPotiRef2Position = Channel(DEVICE + ':REF2:1', type='d') # R2 position as from potentiometer [mm]
idCom.put('4', timeout=None) # go to R2
sleep( samplePeriod ) # Settling time
except:
sendFeedback(testPath, testName, DEVICE, 'Unable to create channel - ' + traceback.format_exc(), False)
#raise Exception('Unable to create channel - ' + traceback.format_exc())
ret = 'Unable to create channel - ' + traceback.format_exc()
success = False
test.sendFeedback( ret, success)
return
idCom.put(4.0, timeout=None) # go to R2
print_log(testName, DEVICE, 'Moving to reference point')
#scan quickly the output during some seconds
detector4 = idPotiPosition.get()
detector5 = idPotiRef1Position.get()
timeElapsed=0
while detector4<detector6 and timeElapsed<600:
#Detector time
detector1 = float(java.lang.System.currentTimeMillis())
#scan for a while to collect data
for setpoint1 in range(0, 10000):
sleep( samplePeriod ) # Settling time
detector2 = idMotorStep.get()
detector3 = idPotiPosFromBeam.get()
detector4 = idPotiPosition.get()
detector5 = idPotiRef1Position.get()
detector6 = idPotiRef2Position.get()
diff1 = detector2-detector4
scan.append ([detector1], [detector1], [detector2, detector4, detector6, diff1])
sleep( 0.1 ) # Settling time
timeElapsed=timeElapsed+1
MotorStatus = idMotorStatus.get()
LogicalPosition = idLogicalPosition.get()
PotiRaw = idPotiRaw.get()
MotorPositionRaw = idMotorPositionRaw.get()
Com = idCom.get()
MotorPosition = idMotorPosition.get()
PotiPosFromBeam = idPotiPosFromBeam.get()
PotiPosition = idPotiPosition.get()
PotiRef1Position = idPotiRef1Position.get()
PotiRef2Position = idPotiRef2Position.get()
Diameter = idDiameter.get()
Inkr = idInkr.get()
InkrRb = idInkrRb.get()
scan.append([setpoint1], [setpoint1],
[MotorStatus, Inkr, InkrRb, Diameter, Com, LogicalPosition, MotorPositionRaw, MotorPosition,
PotiPosFromBeam, PotiRaw, PotiPosition, PotiRef1Position, PotiRef2Position])
if (MotorStatus & int('1',2))==0: #device finished calibration
break
#check if any error bit is raised
if bool(MotorStatus & int('10000',2)): #error: abort test
test.sendFeedback('Motor switched off (bit#4)', False)
return
if bool(MotorStatus & int('100000',2)): #error: abort test
test.sendFeedback('No motor link (bit#5)', False)
return
if bool(MotorStatus & int('1000000',2)): #error: abort test
test.sendFeedback('No poti link (bit#6)', False)
return
if bool(MotorStatus & int('10000000',2)): #error: abort test
test.sendFeedback('Calibration error (bit#7)', False)
return
if bool(MotorStatus & int('100000000',2)): #error: abort test
test.sendFeedback('Cannot get to R1 (bit#8)', False)
return
if bool(MotorStatus & int('1000000000',2)): #error: abort test
test.sendFeedback('Cannot get to R2 (bit#9)', False)
return
if bool(MotorStatus & int('10000000000',2)): #error: abort test
test.sendFeedback('Position measurement mismatch (bit#10)', False)
return
if bool(MotorStatus & int('100000000000',2)): #error: abort test
test.sendFeedback('Movement timeout (bit#11)', False)
return
#Closing channels
idMotorStatus.close()
idLogicalPosition.close()
idPotiRaw.close()
idMotorPositionRaw.close()
idCom.close()
idMotorStep.close()
idMotorPosition.close()
idPotiPosFromBeam.close()
idPotiPosition.close()
idPotiRef1Position.close()
idPotiRef2Position.close()
print_log(testName, DEVICE, ' Reference point reached')
idDiameter.close()
idInkr.close()
idInkrRb.close()
scan.end()
ret = 'Moved to R2'
success = True
scan.end()
################ END OF YOUR CODE ################
###### Final - DO NOT MODIFY THE CODE BELOW ######
sendFeedback(testPath, testName, DEVICE, ret, success)
###### Final - DO NOT MODIFY THE CODE BELOW ######
# just in case the feedback was forgotten
test.sendFeedback(ret, success)
except:
# generic error handler
ret = traceback.format_exc()
success = False
sendFeedback(testPath, testName, DEVICE, ret, success)
return
test.sendFeedback(ret, success)
#launch the test
# launch the test
startTest(test, device, parameters)

View File

@@ -86,11 +86,11 @@ def startTest(testName, DEVICE, params):
if ready == 1 and interlock == 1:
#print "The "+DEVICE+" drive was successfully initialised. The RDY and ILK signals indicate the drive is ready."
ret = 'Drive successfully initialised'
status = True
success = True
else:
#print "The RS calibration procedure failed. The RDY and ILK signals indicate the drive was NOT ready at the expected time (after 40s)."
ret = 'The RDY and ILK signals indicate the drive was NOT ready at the expected time (after 40s).'
status = False
success = False
scan.append ([setpoint1], [readback1], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, detector9, detector10, idResult])
#Closing channels

View File

@@ -1,7 +1,7 @@
#Script imported from: Calibrate.xml
ret = 'Calibration failed'
status = False
success = False
try:
#Pre-actions: 1 = calibrate
@@ -76,4 +76,4 @@ id000010.close()
scan.end()
ret = 'Calibration done'
status = True
success = True

View File

@@ -1,5 +1,5 @@
name=Check Status
description=Monitors the status of the device
description=Monitors the success of the device
filename=Check Status.xml
help= \
This test plots the status of all relevant drive signals for a period of 15 seconds.
This test plots the success of all relevant drive signals for a period of 15 seconds.

View File

@@ -3,7 +3,7 @@ import traceback
#by default, failed
ret = 'Test failed'
status = False
success = False
try:
#Pre-actions: 2 = drive out
@@ -79,4 +79,4 @@ scan.end()
#return ok
ret = 'Slides moved out'
status = True
success = True

View File

@@ -5,7 +5,7 @@ import traceback
#by default, failed
ret = 'Test failed'
status = False
success = False
DEVICE = device
params = parameters
#DEVICE = 'PO2DV-NCS-LS'
@@ -151,4 +151,4 @@ idBtvsRaw.close()
idBtvsProc.close()
scan.end()
ret = 'Slide moved back and forth (' + str(count) + ' runs)'
status = True
success = True

View File

@@ -5,7 +5,7 @@ import traceback
#by default, failed
ret = 'Test failed'
status = False
success = False
DEVICE = device
params = parameters
#get parameters from the calling interface
@@ -166,4 +166,4 @@ idBtvsProc.close()
scan.end()
ret = 'Slide moved back and forth (' + str(count) + ' runs)'
status = True
success = True

View File

@@ -3,7 +3,7 @@ import traceback
#by default, failed
ret = 'Test failed'
status = False
success = False
#Pre-actions
try:
@@ -70,4 +70,4 @@ scan.end()
caput('PO2DV-NCS-LS:MOTOR.RDBD', '1')
ret = 'Test done'
status = True
success = True

View File

@@ -8,7 +8,7 @@ import sys, inspect, os, traceback
def startTest(testName, DEVICE, params):
#by default, assume the test failed
ret = 'Test failed'
status = False
success = False
#plot name to be given to the scan. Use: scan.setPlotName(plotName)
plotName = DEVICE + ' - ' + testName
#put the whole custom code under try/catch

View File

@@ -18,7 +18,7 @@ def startTest(testName, DEVICE, params):
testPath = inspect.getfile(inspect.currentframe())
#by default, failed
ret = 'Test failed'
status = False
success = False
#plot name to be given to the scan. Use: scan.setPlotName(plotName)
plotName = DEVICE + ' - ' + testName
#########################################
@@ -77,7 +77,7 @@ def startTest(testName, DEVICE, params):
if abs(readback1 - setpoint1) > 0.9 : # TODO: Check accuracy
raise Exception('SetV could not be set to the value ' + str(setpoint1))
ret = 'SetV could not be set to the value ' + str(setpoint1) + '(measured value: '+str(readback1)+')'
status = False
success = False
break
#scan quickly the output during some seconds
for setpoint2 in range(0, 20):
@@ -91,7 +91,7 @@ def startTest(testName, DEVICE, params):
scan.append ([detector1], [detector1], [readback1, detector2, detector3])
sleep( 0.1 ) # Settling time
ret = 'Test ps A completed'
status = True
success = True
#reset output to 0V
SetV.put(0.0, timeout=None)
@@ -106,7 +106,7 @@ def startTest(testName, DEVICE, params):
#########################################
###### DO NOT MODIFY THE CODE BELOW #####
#########################################
sendFeedback(testPath, testName, DEVICE, ret, status)
sendFeedback(testPath, testName, DEVICE, ret, success)
#launch the test

View File

@@ -26,7 +26,7 @@ def startTest(testName, DEVICE, params):
testPath = inspect.getfile(inspect.currentframe())
#by default, failed
ret = 'Test failed'
status = False
success = False
#plot name to be given to the scan. Use: scan.setPlotName(plotName)
plotName = DEVICE + ' - ' + testName
#########################################
@@ -86,7 +86,7 @@ def startTest(testName, DEVICE, params):
if abs(readback1 - setpoint1) > 0.9 : # TODO: Check accuracy
raise Exception('SetV could not be set to the value ' + str(setpoint1))
ret = 'SetV could not be set to the value ' + str(setpoint1) + '(measured value: '+str(readback1)+')'
status = False
success = False
break
#scan quickly the output during some seconds
for setpoint2 in range(0, 20):
@@ -100,7 +100,7 @@ def startTest(testName, DEVICE, params):
scan.append ([detector1], [detector1], [readback1, detector2, detector3])
sleep( 0.1 ) # Settling time
ret = 'Test ps A completed'
status = True
success = True
#reset output to 0V
SetV.put(0.0, timeout=None)
@@ -115,7 +115,7 @@ def startTest(testName, DEVICE, params):
#########################################
###### DO NOT MODIFY THE CODE BELOW #####
#########################################
sendFeedback(testPath, testName, DEVICE, ret, status)
sendFeedback(testPath, testName, DEVICE, ret, success)
#launch the test

View File

@@ -8,7 +8,7 @@ import sys, inspect, os, traceback
def startTest(testName, DEVICE, params):
#by default, assume the test failed
ret = 'Test failed'
status = False
success = False
#plot name to be given to the scan. Use: scan.setPlotName(plotName)
plotName = DEVICE + ' - ' + testName
#put the whole custom code under try/catch

View File

@@ -1,3 +1,3 @@
name=Check Status
description=Checks the drive status
description=Checks the drive success
filename=Check Status.xml

View File

@@ -1,7 +1,7 @@
name=Monitor All
description=Monitor drive all status pv. No commands are sent
description=Monitor drive all success pv. No commands are sent
#optional parameters. Description is compulsory. Syntax:
#parameters=<parameter1Name>:<parameter1Value>:<Parameter 1 description>[;<parameter2Name>:<parameter2Value>:<Parameter 2 description>]
parameters=samplingTimeS:0.1:Sampling Time;timeWindowS:30:Duration of the monitoring time window (For how long the check status must be performed) [s]
parameters=samplingTimeS:0.1:Sampling Time;timeWindowS:30:Duration of the monitoring time window (For how long the check success must be performed) [s]

View File

@@ -8,7 +8,7 @@ import sys, inspect, os, traceback
def startTest(testName, DEVICE, params):
#by default, failed
ret = 'Test failed'
status = False
success = False
#plot name to be given to the scan. Use: scan.setPlotName(plotName)
plotName = DEVICE + ' - ' + testName
try: