This commit is contained in:
boccioli_m
2015-08-28 17:35:28 +02:00
parent beb7ded936
commit 104d203536
527 changed files with 44889 additions and 719 deletions
@@ -0,0 +1,4 @@
#Thu Aug 27 16:00:36 CEST 2015
name=Monitor Movement
description=Monitor the movements during the specified time interval. No commands are sent.
parameters=monitorTime\:40\:Monitor time interval [s];
@@ -0,0 +1,94 @@
###### DO NOT MODIFY THE CODE BELOW ######
global print_log, sendFeedback, inspect, log, sys, inspect, os, traceback
import sys, inspect, os, traceback
def startTest(testName, DEVICE, params):
#get the path of this script
testPath = inspect.getfile(inspect.currentframe())
#by default, failed
ret = 'Test failed'
status = False
#plot name to be given to the scan. Use: scan.setPlotName(plotName)
plotName = DEVICE + ' - ' + testName
###### 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.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]
except:
sendFeedback(testPath, testName, DEVICE, 'Unable to create channel - ' + traceback.format_exc(), False)
#raise Exception('Unable to create channel - ' + traceback.format_exc())
return
monitorTime=40 #seconds
print_log(testName, DEVICE, 'Monitoring movement for ' + str(monitorTime) + 's')
#scan quickly the output during some seconds
detector4 = idPotiPosition.get()
detector6 = idPotiRef2Position.get()
timeElapsed=0
while timeElapsed<(monitorTime*10):
#Detector time
detector1 = float(java.lang.System.currentTimeMillis())
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
idCom.close()
idMotorStep.close()
idPotiPosFromBeam.close()
idPotiPosition.close()
idPotiRef1Position.close()
idPotiRef2Position.close()
print_log(testName, DEVICE, 'End of Monitoring')
ret = 'End of Monitoring'
status = True
########## END OF YOUR CODE ###########
###### DO NOT MODIFY THE CODE BELOW ######
sendFeedback(testPath, testName, DEVICE, ret, status)
#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, 'Test path: ' + testPath)
print_log(testName, DEVICE, 'Test name: ' + testName )
print_log(testName, DEVICE, 'Device: ' + DEVICE)
print_log(testName, DEVICE, 'Test passed: ' + str(testPassed))
print_log(testName, DEVICE, 'Return string: ' + returnString)
ret = [testPath, DEVICE, returnString, testPassed]
set_return(ret)
def print_log(testName, DEVICE, text):
time.ctime()
now = time.strftime('%Y.%m.%d %H:%M:%S')
print now + ' ' + DEVICE + ' - ' + testName + ': ' + text
log (now + ' ' + DEVICE + ' - ' + testName + ': ' + text )
#get test arguments
DEVICE = device
testName = test
params = parameters
#launch the test
startTest(testName, DEVICE, params)
@@ -0,0 +1,13 @@
<html>
<body>
<h2>Short Description</h2>
Monitor movements.
<h2>Details</h2>
Monitor the movements during the specified time interval. No commands are sent.
<h2>Parameters</h2>
<code>monitorTime</code> Monitoring time interval [s]
<h2>Contact</h2>
<a href="https://intranet.psi.ch/Main/MarcoBoccioli">Marco Boccioli </a>
</html>
</body>
@@ -0,0 +1,12 @@
name=Calibrate test vme
description=Calibrates the device
filename=Calibrate.xml
help = \
This test sends a command to the low level firmware which controls the collimators \n\
requesting that it calibrates itself. \n\n\
<b>Calibration</b> involves moving to the R1 and R2 reference positions and measuring the \n\
number of steps required to do so. At the end of the sequence the default collimator \n\
will be selected. \n\n\
During the course of the expected calibration period (45-70 seconds) the test \n\
procedure will plot the values of all critical system variables. \n\n\
For further information please consult Valery Ovinnikov.<br/>\
@@ -0,0 +1,154 @@
#Script Motor Test 1
#Moves to CCW switch; then for M times moves N times to CW switch then CCW switch; between each M pauses for delay; log at CCW and CW
import traceback
#by default, failed
ret = 'Test failed'
status = False
DEVICE = device
params = parameters
#DEVICE = 'PO2DV-NCS-LS'
#get parameters from the calling interface
try:
print "Running test Motor Test 1 with the following parameters:"
print params
loopTimes = int(params["repeatTimes"]["value"])
delaySeconds = int(params["delayS"]["value"])
except:
print "Could not retrieve testing parameters: ", sys.exc_info()[0]
ret = 'Could not retrieve testing parameters - ' + traceback.format_exc()
success = False
raise Exception('Could not retrieve testing parameters - ' + traceback.format_exc())
#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])
scan = ManualScan(['idX'], ['idMotorStatus', 'idLogicalPosition', 'idDiameter', 'idMotorPosition', 'idPotiRaw', 'idPotiProc', 'idBtvsRaw', 'idBtvsProc', 'idDiff01', 'idDiff02'] , [ 0.0], [ 3000.0], [20])
scan.start()
#Creating channels: dimension 1
try:
#RegionPositioner idInkr
#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.RVAL', 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.RBV', 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')
#ScalarDetector idEndSwitchL
#idBtvsRaw = Channel(DEVICE+':IST3:1', type = 'd')
idEndSwitchL = Channel(DEVICE+':MOTOR.LLS', type = 'd')
#ScalarDetector idEndSwitchH
#idBtvsProc = Channel(DEVICE+':IST3:2', type = 'd')
idEndSwitchH = Channel(DEVICE+':MOTOR.HLS', type = 'd')
#high position limit
idLimitH = Channel(DEVICE+':MOTOR.HLM', type = 'd')
#low position limit
idLimitL = Channel(DEVICE+':MOTOR.LLM', type = 'd')
except:
print "Unexpected error:", sys.exc_info()[0]
ret = 'Unable to create channel - ' + traceback.format_exc()
success = False
raise Exception('Unable to create channel - ' + traceback.format_exc())
sys.exit()
#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
print 'Homing'
idInkr.put(-100.0, timeout=None) # TODO: Set appropriate timeout
start = startDefault #idInkr.get()+direction
setpoint2 = end
count = 0
print 'Starting test sequence'
for setpoint1 in range(0, loopTimes*2):
sleep( delaySeconds ) # 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 = count + 1
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])
#set limits back
idLimitH.put(145.0, timeout=None)
idLimitL.put(0.0, timeout=None)
#Closing channels
idInkr.close()
idMotorStatus.close()
idLogicalPosition.close()
idDiameter.close()
idMotorPosition.close()
idPotiRaw.close()
idPotiProc.close()
idBtvsRaw.close()
idBtvsProc.close()
scan.end()
ret = 'Slide moved back and forth (' + str(count) + ' runs)'
status = True
@@ -0,0 +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>
@@ -0,0 +1,125 @@
###### DO NOT MODIFY THE CODE BELOW ######
global print_log, sendFeedback, inspect, pshellTestGeneral, testPath, testName, DEVICE
import sys, inspect, os, traceback, time, pshellTestGeneral
#prepare and send feedback to calling tool
def sendFeedback(returnString, testPassed):
ret = pshellTestGeneral.buildFeedback(testPath, testName, DEVICE, returnString, testPassed)
set_return(ret)
def startTest(testName, DEVICE, params):
global testPath, testName, DEVICE
try:
import traceback, pshellTestGeneral
#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
###### WRITE YOUR CODE HERE BELOW #######
#Pre-actions
# try:
# caput(DEVICE+':INIT.PROC', '1')
# except:
# ret = 'Unable to create channel - ' + traceback.format_exc()
# success = False
# pshellTestGeneral.sendFeedback(testPath, testName, DEVICE, ret, success)
# return
#get parameters from the calling interface
try:
pshellTestGeneral.print_log(testName, DEVICE, "Running test Initialise with the following parameters:")
pshellTestGeneral.print_log(testName, DEVICE, params )
loopTimes = int(params["repeatTimes"]["value"])
delaySeconds = int(params["delayS"]["value"])
except:
ret = 'Could not retrieve testing parameters - ' + traceback.format_exc()
success = False
sendFeedback(ret, success)
return
scan = ManualScan(['idX'], ['Motor Position (RBV)', 'Encoder Position (ENCODER)', 'Diff Motor - Encoder'] )
scan.setPlotName(plotName)
scan.start()
#Creating channels: dimension 1
try:
idInit = Channel(DEVICE+':INIT.PROC', type = 'l')
idReady = Channel(DEVICE+':RDY', type = 'l')
idInterlock = Channel(DEVICE+':ILK', type = 'l')
idMotorPosition = Channel(DEVICE+':MOTOR.RBV', type = 'd')
idEncoderPosition = Channel(DEVICE+':ENCODER', type = 'd')
#idBtvsRaw = Channel(DEVICE+':IST3:1', type = 'd')
idEndSwitchL = Channel(DEVICE+':MOTOR.LLS', type = 'd')
#idBtvsProc = Channel(DEVICE+':IST3:2', type = 'd')
idEndSwitchH = Channel(DEVICE+':MOTOR.HLS', type = 'd')
except:
ret = 'Unable to create channel - ' + traceback.format_exc()
success = False
sendFeedback(ret, success)
return
count = 0
timeout = 90000 #timeout in ms
for count in range(1, loopTimes+1):
pshellTestGeneral.print_log(testName, DEVICE, 'Initialisation #' + str(count) + '/' + str(loopTimes))
idInit.put(1, timeout=None) # TODO: Set appropriate timeout
timeStampStart = float(java.lang.System.currentTimeMillis())
sleep(0.1)
ready = 0
interlock = idInterlock.get()
timeElapsed = 0 #in ms
while (ready == 0) and timeElapsed<timeout:
#Detector time
timeStamp = float(java.lang.System.currentTimeMillis())
timeElapsed = timeStamp - timeStampStart
ready = idReady.get()
sleep( 0.1 )
detector4 = idMotorPosition.get()
detector6 = idEncoderPosition.get()
ready = idReady.get()
interlock = idInterlock.get()
#end switches
endH = idEndSwitchH.get()
endL = idEndSwitchL.get()
#Manipulation idDiff01
a = detector4
b = detector6
idError = a-b
scan.append ([timeStamp],[timeStamp], [detector4, detector6, idError])
if ready == 1 and interlock == 1:
pshellTestGeneral.print_log(testName, DEVICE, 'Initialisation #' + str(count) + '/' + str(loopTimes) + ' successful')
ret = 'Drive initialised ' + str(count) + ' times'
success = True
else:
ret = 'The RDY and ILK signals indicate the drive was NOT ready at the expected time (after ' + str(timeout/1000) + 's).'
success = False
break
if(count < loopTimes):
pshellTestGeneral.print_log(testName, DEVICE, 'Next initialisation starting in ' + str(delaySeconds) + 's')
sleep( delaySeconds ) # pause between two init
idInit.close()
idReady.close()
idMotorPosition.close()
idEncoderPosition.close()
scan.end()
############# END OF YOUR CODE ###########
###### DO NOT MODIFY THE CODE BELOW ######
sendFeedback(ret, success)
except:
ret = traceback.format_exc()
success = False
sendFeedback(ret, success)
return
#launch the test
startTest(test, device, parameters)
@@ -0,0 +1,140 @@
import pshellTestGeneral
pshellTestGeneral.print_log('a','s','g')
###### DO NOT MODIFY THE CODE BELOW ######
global print_log, sendFeedback, inspect
import sys, inspect, os, traceback
def print_log(testName, DEVICE, text):
time.ctime()
now = time.strftime('%Y.%m.%d %H:%M:%S')
textToLog = now + ' ' + DEVICE + ' - ' + testName + ': ' + str(text)
print textToLog
log ( textToLog )
#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):
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
###### WRITE YOUR CODE HERE BELOW #######
#Pre-actions
# try:
# caput(DEVICE+':INIT.PROC', '1')
# except:
# ret = 'Unable to create channel - ' + traceback.format_exc()
# success = False
# sendFeedback(testPath, testName, DEVICE, ret, success)
# return
#get parameters from the calling interface
try:
print_log(testName, DEVICE, "Running test Initialise with the following parameters:")
print_log(testName, DEVICE, params )
loopTimes = int(params["repeatTimes"]["value"])
delaySeconds = int(params["delayS"]["value"])
except:
ret = 'Could not retrieve testing parameters - ' + traceback.format_exc()
success = False
sendFeedback(testPath, testName, DEVICE, ret, success)
return
scan = ManualScan(['idX'], ['Motor Position (RBV)', 'Encoder Position (ENCODER)', 'Diff Motor - Encoder'] )
scan.setPlotName(plotName)
scan.start()
#Creating channels: dimension 1
try:
idInit = Channel(DEVICE+':INIT.PROC', type = 'l')
idReady = Channel(DEVICE+':RDY', type = 'l')
idInterlock = Channel(DEVICE+':ILK', type = 'l')
idMotorPosition = Channel(DEVICE+':MOTOR.RBV', type = 'd')
idEncoderPosition = Channel(DEVICE+':ENCODER', type = 'd')
#idBtvsRaw = Channel(DEVICE+':IST3:1', type = 'd')
idEndSwitchL = Channel(DEVICE+':MOTOR.LLS', type = 'd')
#idBtvsProc = Channel(DEVICE+':IST3:2', type = 'd')
idEndSwitchH = Channel(DEVICE+':MOTOR.HLS', type = 'd')
except:
ret = 'Unable to create channel - ' + traceback.format_exc()
success = False
sendFeedback(testPath, testName, DEVICE, ret, success)
return
count = 0
timeout = 90000 #timeout in ms
for count in range(1, loopTimes+1):
print_log(testName, DEVICE, 'Initialisation #' + str(count) + '/' + str(loopTimes))
idInit.put(1, timeout=None) # TODO: Set appropriate timeout
timeStampStart = float(java.lang.System.currentTimeMillis())
sleep(0.1)
ready = 0
interlock = idInterlock.get()
timeElapsed = 0 #in ms
while (ready == 0) and timeElapsed<timeout:
#Detector time
timeStamp = float(java.lang.System.currentTimeMillis())
timeElapsed = timeStamp - timeStampStart
ready = idReady.get()
sleep( 0.1 )
detector4 = idMotorPosition.get()
detector6 = idEncoderPosition.get()
ready = idReady.get()
interlock = idInterlock.get()
#end switches
endH = idEndSwitchH.get()
endL = idEndSwitchL.get()
#Manipulation idDiff01
a = detector4
b = detector6
idError = a-b
scan.append ([timeStamp],[timeStamp], [detector4, detector6, idError])
if ready == 1 and interlock == 1:
print_log(testName, DEVICE, 'Initialisation #' + str(count) + '/' + str(loopTimes) + ' successful')
ret = 'Drive initialised ' + str(count) + ' times'
success = True
else:
ret = 'The RDY and ILK signals indicate the drive was NOT ready at the expected time (after ' + str(timeout/1000) + 's).'
success = False
break
if(count < loopTimes):
print_log(testName, DEVICE, 'Next initialisation starting in ' + str(delaySeconds) + 's')
sleep( delaySeconds ) # pause between two init
idInit.close()
idReady.close()
idMotorPosition.close()
idEncoderPosition.close()
scan.end()
############# END OF YOUR CODE ###########
###### DO NOT MODIFY THE CODE BELOW ######
sendFeedback(testPath, testName, DEVICE, ret, success)
except:
ret = traceback.format_exc()
success = False
sendFeedback(testPath, testName, DEVICE, ret, success)
return
#launch the test
startTest(test, device, parameters)
@@ -0,0 +1,14 @@
<html>
<body>
<h2>Short Description</h2>
Initialise N times.
<h2>Details</h2>
This test sends a INIT command to the device, as many times as configured with the parameter repeatTimes.
<h2>Parameters</h2>
<code>repeatTimes</code> Repeat the Initialisation N times<br/>
<code>delayS</code> Pause delay between each Initialisation [s]
<h2>Contact</h2>
<a href="https://intranet.psi.ch/Main/MarcoBoccioli">Marco Boccioli </a>
</html>
</body>
@@ -0,0 +1,7 @@
name=Check Linearity
description=Go to absolute position A, then move +B steps, then -2B steps, then +2Bsteps (ie oscillate round centre position, logging after each movement); repeat N times
#optional parameters. Description is compulsory. Syntax:
#parameters=<parameter1Name>:<parameter1Value>:<Parameter 1 description>[;<parameter2Name>:<parameter2Value>:<Parameter 2 description>]
parameters=repeatTimes:2:Repeat N times;midPoint:41.0:Middle point A;spanFromMidPoint:3.0:B steps around middle point A;delayS:0:Delay between each oscillation [s]
@@ -0,0 +1,162 @@
#Go to absolute position A, then move +B steps, then -2B steps, then +2Bsteps (ie oscillate round centre position, logging after each movement); repeat N times
###### DO NOT MODIFY THE CODE BELOW ######
global print_log, sendFeedback, inspect
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)
#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):
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
###### WRITE YOUR CODE HERE BELOW #######
#get parameters from the calling interface
try:
print_log(testName, DEVICE, "Running test Motor Test 2 for device " + DEVICE + " with the following parameters:\n" + str(params))
middle = float(params["midPoint"]["value"])
loopTimes = int(params["repeatTimes"]["value"])
delayS = int(params["delayS"]["value"])
if(delayS<1): delayS=1
span = float(params["spanFromMidPoint"]["value"])
except:
ret = 'Could not retrieve testing parameters - ' + traceback.format_exc()
success = False
sendFeedback(testPath, testName, DEVICE, ret, success)
return
#scan = ManualScan(['idX'], ['idMotorStatus', 'idLogicalPosition', 'idDiameter', 'idMotorPosition', 'idPotiRaw', 'idEncoderPosition', 'idBtvsRaw', 'idBtvsProc', 'idDiff01', 'idDiff02'] , [ 0.0], [ 3000.0], [20])
scan = ManualScan(['idX'], ['idMotorStatus', 'idMotorPosition', 'idEncoderPosition', 'idError'])
scan.setPlotName(plotName)
scan.start()
#Creating channels: dimension 1
try:
idInkr = Channel(DEVICE+':MOTOR.VAL', type = 'd')
idMotorStatus = Channel(DEVICE+':MOTOR.MSTA', type = 'd')
idMotorPosition = Channel(DEVICE+':MOTOR.RBV', type = 'd')
idEncoderPosition = Channel(DEVICE+':ENCODER', type = 'd')
idEndSwitchL = Channel(DEVICE+':MOTOR.LLS', type = 'd')
idEndSwitchH = Channel(DEVICE+':MOTOR.HLS', type = 'd')
idLimitH = Channel(DEVICE+':MOTOR.HLM', type = 'd')
idLimitL = Channel(DEVICE+':MOTOR.LLM', type = 'd')
except:
ret = 'Unable to create channel - ' + traceback.format_exc()
success = False
sendFeedback(testPath, testName, DEVICE, ret, success)
return
#remove limits
idLimitH.put(999999.9, timeout=None)
idLimitL.put(-999999.9, timeout=None)
direction = 1.0
startDefault = middle - span
endDefault = middle + span
end = endDefault+1
#find position: it will be the middle point of the test
print_log(testName, DEVICE, 'Moving to middle point ' + str(middle) )
idInkr.put(middle, timeout=None) # TODO: Set appropriate timeout
readback2 = idInkr.get()
if abs(readback2 - middle) > 1 : # TODO: Check accuracy
ret = 'Actor idInkr could not be set to the value ' + str(middle) + ' (current value: ' + str(readback2) + ')'
success = False
sendFeedback(testPath, testName, DEVICE, ret, success)
return
start = readback2+direction
countSteps = 0
count = 0
print_log(testName, DEVICE, 'Moving around middle point (+-' + str(span) + ')' )
for setpoint1 in range(0, loopTimes*2):
count = count + 1
print_log(testName, DEVICE, 'Pausing ' + str(delayS) + 's' )
sleep( delayS ) # Settling time
#RegionPositioner idInkr
for setpoint2 in frange(start, end, direction):
readback1 = setpoint1
idInkr.put(setpoint2, timeout=None) # TODO: Set appropriate timeout
sleep( 0.2 ) # 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
sendFeedback(testPath, testName, DEVICE, ret, success)
return
#Detector idMotorStatus
detector1 = idMotorStatus.get()
detector4 = idMotorPosition.get()
detector6 = idEncoderPosition.get()
endH = idEndSwitchH.get()
endL = idEndSwitchL.get()
#Manipulation idDiff01
#Variable Mappings
a = detector4
b = detector6
idDiff01 = a-b
countSteps = countSteps + 1
scan.append ([countSteps], [countSteps], [detector1, detector4, detector6, idDiff01])
if endH>0.0 or (direction > 0.0 and setpoint2 >= end -1):
#invert direction and swap start with end of translation
end = startDefault-1
start = setpoint2 - direction
direction = -1.0
print_log(testName, DEVICE, 'End of span (' + str(setpoint2) + '), changing direction to ' + str(direction) )
break
if endL>0.0 or ( direction < 0.0 and setpoint2 <= end +1):
#invert direction and swap start with end of translation
end = endDefault+1
start = setpoint2 - direction
direction = 1.0
print_log(testName, DEVICE, 'End of span (' + str(setpoint2) + '), changing direction to ' + str(direction) )
break
#set limits back
idLimitH.put(145.0, timeout=None)
idLimitL.put(0.0, timeout=None)
#Closing channels
idInkr.close()
idMotorStatus.close()
idMotorPosition.close()
idEncoderPosition.close()
idLimitH.close()
idLimitL.close()
scan.end()
ret = 'Slide moved back and forth (' + str(count) + ' runs)'
success = True
############# END OF YOUR CODE ###########
###### DO NOT MODIFY THE CODE BELOW ######
sendFeedback(testPath, testName, DEVICE, ret, success)
except:
ret = traceback.format_exc()
success = False
sendFeedback(testPath, testName, DEVICE, ret, success)
return
#launch the test
startTest(test, device, parameters)
@@ -0,0 +1,16 @@
<html>
<body>
<h2>Short Description</h2>
Oscillate around a specific position
<h2>Details</h2>
Go to absolute position A, then move +B steps, then -2B steps, then +2Bsteps (ie oscillate round centre position, logging after each movement); repeat N times
<h2>Parameters</h2>
<code>midPoint</code> Middle point A around which it will oscillate<br/>
<code>spanFromMidPoint</code> B stepst to oscillate around A<br/>
<code>repeatTimes</code> Repeat the moving N times<br/>
<code>delayS</code> Pause delay (>0s) between each oscillation [s]
<h2>Contact</h2>
<a href="https://intranet.psi.ch/Main/MarcoBoccioli">Marco Boccioli </a>
</html>
</body>
@@ -0,0 +1,12 @@
name=power-supply-A
description=power-supply A
help = \
This test sends a command to the low level firmware which controls the collimators \n\
requesting that it calibrates itself. \n\n\
<b>Calibration</b> involves moving to the R1 and R2 reference positions and measuring the \n\
number of steps required to do so. At the end of the sequence the default collimator \n\
will be selected. \n\n\
During the course of the expected calibration period (45-70 seconds) the test \n\
procedure will plot the values of all critical system variables. \n\n\
For further information please consult Valery Ovinnikov.<br/>\
@@ -0,0 +1,12 @@
name=power-supply-B
description=power-supply B
help = \
This test sends a command to the low level firmware which controls the collimators \n\
requesting that it calibrates itself. \n\n\
<b>Calibration</b> involves moving to the R1 and R2 reference positions and measuring the \n\
number of steps required to do so. At the end of the sequence the default collimator \n\
will be selected. \n\n\
During the course of the expected calibration period (45-70 seconds) the test \n\
procedure will plot the values of all critical system variables. \n\n\
For further information please consult Valery Ovinnikov.<br/>\
@@ -0,0 +1,143 @@
###### DO NOT MODIFY THE CODE BELOW ######
global print_log, sendFeedback, inspect
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)
#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):
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
###### WRITE YOUR CODE HERE BELOW #######
#Pre-actions
# try:
# caput(DEVICE+':INIT.PROC', '1')
# except:
# ret = 'Unable to create channel - ' + traceback.format_exc()
# success = False
# sendFeedback(testPath, testName, DEVICE, ret, success)
# return
#get parameters from the calling interface
try:
print_log(testName, DEVICE, "Running test Initialise with the following parameters:")
print_log(testName, DEVICE, params )
loopTimes = int(params["repeatTimes"]["value"])
delaySeconds = int(params["delayS"]["value"])
except:
ret = 'Could not retrieve testing parameters - ' + traceback.format_exc()
success = False
sendFeedback(testPath, testName, DEVICE, ret, success)
return
scan = ManualScan(['idX'], ['idMotorPosition', 'idEncoderPosition', 'idError'] )
scan.setPlotName(plotName)
scan.start()
#Creating channels: dimension 1
try:
idInit = Channel(DEVICE+':INIT.PROC', type = 'l')
idReady = Channel(DEVICE+':RDY', type = 'l')
idInterlock = Channel(DEVICE+':ILK', type = 'l')
#ScalarDetector idMotorPosition
#idMotorPosition = Channel(DEVICE+':IST1:2', type = 'd')
idMotorPosition = Channel(DEVICE+':MOTOR.RBV', type = 'd')
#ScalarDetector idEncoderPosition
#idEncoderPosition = Channel(DEVICE+':POSA:2', type = 'd')
idEncoderPosition = Channel(DEVICE+':ENCODER', type = 'd')
#ScalarDetector idBtvsProc
#ScalarDetector idEndSwitchL
#idBtvsRaw = Channel(DEVICE+':IST3:1', type = 'd')
idEndSwitchL = Channel(DEVICE+':MOTOR.LLS', type = 'd')
#ScalarDetector idEndSwitchH
#idBtvsProc = Channel(DEVICE+':IST3:2', type = 'd')
idEndSwitchH = Channel(DEVICE+':MOTOR.HLS', type = 'd')
except:
ret = 'Unable to create channel - ' + traceback.format_exc()
success = False
sendFeedback(testPath, testName, DEVICE, ret, success)
return
count = 0
timeout = 5000 #timeout in ms
for count in range(1, loopTimes+1):
print_log(testName, DEVICE, 'Initialisation #' + str(count) + '/' + str(loopTimes))
idInit.put(1, timeout=None) # TODO: Set appropriate timeout
timeStampStart = float(java.lang.System.currentTimeMillis())
sleep(0.1)
ready = 0
interlock = idInterlock.get()
timeElapsed = 0 #in ms
while (ready == 0) and timeElapsed<timeout:
#Detector time
timeStamp = float(java.lang.System.currentTimeMillis())
timeElapsed = timeStamp - timeStampStart
ready = idReady.get()
sleep( 0.1 )
detector4 = idMotorPosition.get()
detector6 = idEncoderPosition.get()
ready = idReady.get()
interlock = idInterlock.get()
#end switches
endH = idEndSwitchH.get()
endL = idEndSwitchL.get()
#Manipulation idDiff01
a = detector4
b = detector6
idError = a-b
scan.append ([timeStamp],[timeStamp], [detector4, detector6, idError])
if ready == 1 and interlock == 1:
print_log(testName, DEVICE, 'Initialisation #' + str(count) + '/' + str(loopTimes) + ' successful')
ret = 'Drive initialised ' + str(count) + ' times'
success = True
else:
ret = 'The RDY and ILK signals indicate the drive was NOT ready at the expected time (after ' + str(timeout/1000) + 's).'
success = False
break
if(count < loopTimes):
print_log(testName, DEVICE, 'Next initialisation starting in ' + str(delaySeconds) + 's')
sleep( delaySeconds ) # pause between two init
idInit.close()
idReady.close()
idMotorPosition.close()
idEncoderPosition.close()
scan.end()
################ END OF YOUR CODE ################
###### Final - DO NOT MODIFY THE CODE BELOW ######
sendFeedback(testPath, testName, DEVICE, ret, success)
except:
ret = traceback.format_exc()
success = False
sendFeedback(testPath, testName, DEVICE, ret, success)
return
#launch the test
startTest(test, device, parameters)
@@ -0,0 +1,14 @@
<html>
<body>
<h2>Short Description</h2>
Initialise N times.
<h2>Details</h2>
This test sends a INIT command to the device, as many times as configured with the parameter repeatTimes.
<h2>Parameters</h2>
<code>repeatTimes</code> Repeat the Initialisation N times<br/>
<code>delayS</code> Pause delay between each Initialisation [s]
<h2>Contact</h2>
<a href="https://intranet.psi.ch/Main/MarcoBoccioli">Marco Boccioli </a>
</html>
</body>
@@ -0,0 +1,162 @@
#Go to absolute position A, then move +B steps, then -2B steps, then +2Bsteps (ie oscillate round centre position, logging after each movement); repeat N times
###### DO NOT MODIFY THE CODE BELOW ######
global print_log, sendFeedback, inspect
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)
#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):
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
###### WRITE YOUR CODE HERE BELOW #######
#get parameters from the calling interface
try:
print_log(testName, DEVICE, "Running test Motor Test 2 for device " + DEVICE + " with the following parameters:\n" + str(params))
middle = float(params["midPoint"]["value"])
loopTimes = int(params["repeatTimes"]["value"])
delayS = int(params["delayS"]["value"])
if(delayS<1): delayS=1
span = float(params["spanFromMidPoint"]["value"])
except:
ret = 'Could not retrieve testing parameters - ' + traceback.format_exc()
success = False
sendFeedback(testPath, testName, DEVICE, ret, success)
return
#scan = ManualScan(['idX'], ['idMotorStatus', 'idLogicalPosition', 'idDiameter', 'idMotorPosition', 'idPotiRaw', 'idEncoderPosition', 'idBtvsRaw', 'idBtvsProc', 'idDiff01', 'idDiff02'] , [ 0.0], [ 3000.0], [20])
scan = ManualScan(['idX'], ['idMotorStatus', 'idMotorPosition', 'idEncoderPosition', 'idError'])
scan.setPlotName(plotName)
scan.start()
#Creating channels: dimension 1
try:
idInkr = Channel(DEVICE+':MOTOR.VAL', type = 'd')
idMotorStatus = Channel(DEVICE+':MOTOR.MSTA', type = 'd')
idMotorPosition = Channel(DEVICE+':MOTOR.RBV', type = 'd')
idEncoderPosition = Channel(DEVICE+':ENCODER', type = 'd')
idEndSwitchL = Channel(DEVICE+':MOTOR.LLS', type = 'd')
idEndSwitchH = Channel(DEVICE+':MOTOR.HLS', type = 'd')
idLimitH = Channel(DEVICE+':MOTOR.HLM', type = 'd')
idLimitL = Channel(DEVICE+':MOTOR.LLM', type = 'd')
except:
ret = 'Unable to create channel - ' + traceback.format_exc()
success = False
sendFeedback(testPath, testName, DEVICE, ret, success)
return
#remove limits
idLimitH.put(999999.9, timeout=None)
idLimitL.put(-999999.9, timeout=None)
direction = 1.0
startDefault = middle - span
endDefault = middle + span
end = endDefault+1
#find position: it will be the middle point of the test
print_log(testName, DEVICE, 'Moving to middle point ' + str(middle) )
idInkr.put(middle, timeout=None) # TODO: Set appropriate timeout
readback2 = idInkr.get()
if abs(readback2 - middle) > 1 : # TODO: Check accuracy
ret = 'Actor idInkr could not be set to the value ' + str(middle) + ' (current value: ' + str(readback2) + ')'
success = False
sendFeedback(testPath, testName, DEVICE, ret, success)
return
start = readback2+direction
countSteps = 0
count = 0
print_log(testName, DEVICE, 'Moving around middle point (+-' + str(span) + ')' )
for setpoint1 in range(0, loopTimes*2):
count = count + 1
print_log(testName, DEVICE, 'Pausing ' + str(delayS) + 's' )
sleep( delayS ) # Settling time
#RegionPositioner idInkr
for setpoint2 in frange(start, end, direction):
readback1 = setpoint1
idInkr.put(setpoint2, timeout=None) # TODO: Set appropriate timeout
sleep( 0.2 ) # 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
sendFeedback(testPath, testName, DEVICE, ret, success)
return
#Detector idMotorStatus
detector1 = idMotorStatus.get()
detector4 = idMotorPosition.get()
detector6 = idEncoderPosition.get()
endH = idEndSwitchH.get()
endL = idEndSwitchL.get()
#Manipulation idDiff01
#Variable Mappings
a = detector4
b = detector6
idDiff01 = a-b
countSteps = countSteps + 1
scan.append ([countSteps], [countSteps], [detector1, detector4, detector6, idDiff01])
if endH>0.0 or (direction > 0.0 and setpoint2 >= end -1):
#invert direction and swap start with end of translation
end = startDefault-1
start = setpoint2 - direction
direction = -1.0
print_log(testName, DEVICE, 'End of span (' + str(setpoint2) + '), changing direction to ' + str(direction) )
break
if endL>0.0 or ( direction < 0.0 and setpoint2 <= end +1):
#invert direction and swap start with end of translation
end = endDefault+1
start = setpoint2 - direction
direction = 1.0
print_log(testName, DEVICE, 'End of span (' + str(setpoint2) + '), changing direction to ' + str(direction) )
break
#set limits back
idLimitH.put(145.0, timeout=None)
idLimitL.put(0.0, timeout=None)
#Closing channels
idInkr.close()
idMotorStatus.close()
idMotorPosition.close()
idEncoderPosition.close()
idLimitH.close()
idLimitL.close()
scan.end()
ret = 'Slide moved back and forth (' + str(count) + ' runs)'
success = True
############# END OF YOUR CODE ###########
###### DO NOT MODIFY THE CODE BELOW ######
sendFeedback(testPath, testName, DEVICE, ret, success)
except:
ret = traceback.format_exc()
success = False
sendFeedback(testPath, testName, DEVICE, ret, success)
return
#launch the test
startTest(test, device, parameters)
@@ -0,0 +1,16 @@
<html>
<body>
<h2>Short Description</h2>
Oscillate around a specific position
<h2>Details</h2>
Go to absolute position A, then move +B steps, then -2B steps, then +2Bsteps (ie oscillate round centre position, logging after each movement); repeat N times
<h2>Parameters</h2>
<code>midPoint</code> Middle point A around which it will oscillate<br/>
<code>spanFromMidPoint</code> B stepst to oscillate around A<br/>
<code>repeatTimes</code> Repeat the moving N times<br/>
<code>delayS</code> Pause delay (>0s) between each oscillation [s]
<h2>Contact</h2>
<a href="https://intranet.psi.ch/Main/MarcoBoccioli">Marco Boccioli </a>
</html>
</body>
@@ -0,0 +1,7 @@
name=Monitor All
description=Monitor drive all status 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]
@@ -0,0 +1,196 @@
###### DO NOT MODIFY THE CODE BELOW ######
global print_log, sendFeedback, inspect
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)
#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):
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
###### WRITE YOUR CODE HERE BELOW #######
#get parameters from the calling interface
try:
print_log(testName, DEVICE, "Running test Initialise with the following parameters:")
print_log(testName, DEVICE, params )
samplingTimeWindow = int(params["timeWindowS"]["value"])
samplingTime = float(params["samplingTimeS"]["value"])
if samplingTime<0.001:
samplingTime=0.001
except:
ret = 'Could not retrieve testing parameters - ' + traceback.format_exc()
success = False
sendFeedback(testPath, testName, DEVICE, ret, success)
return
scan = ManualScan(['id000000'], ['Motor Status (MSTA)', 'Motor Step Count (RVAL)', 'Motor Position (VAL)', 'Motor Home Switch (ATHM)', 'Encoder Count (ENCODERraw)', 'Encoder Position (ENCODER)', 'Motor/Encoder Diff', 'Drive Ready (RDY)', 'Drive interlock (ILK)', 'CAD_VALA', 'MOTOR_ATHM', 'MOTOR_LLS', 'MOTOR_HLS', 'MOTOR_DMOV', 'CAD_ODIR', 'MOTOR_HOMF', 'MOTOR_RLV', 'MOTOR_STOP', 'MOTOR_SET', 'MOTOR_OFF', 'MOTOR_VAL', 'MOTOR_DVAL', 'MOTOR_DLLM', 'MOTOR_DHLM', 'CAD_VALB', 'CAR_IVAL', 'CAR_IERR', 'SIR_VAL', 'ENCODERraw', 'ENCODERscale', 'ENCODER_oEN', 'ENCODER_HFF', 'FIRST_INIT'] )
scan.setPlotName(plotName)
scan.start()
#Creating channels: dimension 1
try:
#ScalarDetector id000001
id000001 = Channel(DEVICE+':MOTOR.MSTA', type = 'd')
#ScalarDetector id000002
id000002 = Channel(DEVICE+':MOTOR.RVAL', type = 'd')
#ScalarDetector id000003
id000003 = Channel(DEVICE+':MOTOR.VAL', type = 'd')
#ScalarDetector id000004
id000004 = Channel(DEVICE+':MOTOR.ATHM', type = 'd')
#ScalarDetector id000005
id000005 = Channel(DEVICE+':ENCODERraw', type = 'd')
#ScalarDetector id000006
id000006 = Channel(DEVICE+':ENCODER', type = 'd')
#ScalarDetector id000007
id000007 = Channel(DEVICE+':RDY', type = 'd')
#ScalarDetector id000008
id000008 = Channel(DEVICE+':ILK', type = 'd')
pV_CAD_VALA = Channel(DEVICE+':CAD.VALA', type = 'i');
pV_MOTOR_ATHM = Channel(DEVICE+':MOTOR.ATHM', type = 'i');
pV_MOTOR_LLS = Channel(DEVICE+':MOTOR.LLS', type = 'i');
pV_MOTOR_HLS = Channel(DEVICE+':MOTOR.HLS', type = 'i');
pV_MOTOR_DMOV = Channel(DEVICE+':MOTOR.DMOV', type = 'i');
pV_CAD_ODIR = Channel(DEVICE+':CAD.ODIR', type = 'i');
pV_MOTOR_HOMF = Channel(DEVICE+':MOTOR.HOMF', type = 'i');
pV_MOTOR_RLV = Channel(DEVICE+':MOTOR.RLV', type = 'l');
pV_MOTOR_STOP = Channel(DEVICE+':MOTOR.STOP', type = 'i');
pV_MOTOR_SET = Channel(DEVICE+':MOTOR.SET', type = 'i');
pV_MOTOR_OFF = Channel(DEVICE+':MOTOR.OFF', type = 'i');
pV_MOTOR_VAL = Channel(DEVICE+':MOTOR.VAL', type = 'l');
pV_MOTOR_DVAL = Channel(DEVICE+':MOTOR.DVAL', type = 'l');
pV_MOTOR_DLLM = Channel(DEVICE+':MOTOR.DLLM', type = 'd');
pV_MOTOR_DHLM = Channel(DEVICE+':MOTOR.DHLM', type = 'd');
pV_CAD_VALB = Channel(DEVICE+':CAD.VALB', type = 'l');
pV_CAR_IVAL = Channel(DEVICE+':CAR.IVAL', type = 'i');
pV_CAR_IERR = Channel(DEVICE+':CAR.IERR', type = 'i');
pV_SIR_VAL = Channel(DEVICE+':SIR.VAL', type = 'i');
pV_ENCODERraw = Channel(DEVICE+':ENCODERraw', type = 'l');
pV_ENCODERscale = Channel(DEVICE+':ENCODERscale', type = 'l');
pV_ENCODER_oEN = Channel(DEVICE+':ENCODER_oEN', type = 'i');
pV_ENCODER_HFF = Channel(DEVICE+':ENCODER_HFF', type = 'i');
pV_FIRST_INIT = Channel(DEVICE+':FIRST_INIT', type = 'i');
except:
ret = 'Unable to create channel - ' + traceback.format_exc()
success = False
sendFeedback(testPath, testName, DEVICE, ret, success)
return
#Dimension 1
#PseudoPositioner id000000
samplingRange = int(float(samplingTimeWindow) / samplingTime)
print_log(testName, DEVICE, 'Start monitoring during ' + samplingTimeWindow + 's')
for setpoint1 in range(0, samplingRange):
readback1 = setpoint1
sleep( samplingTime ) # Settling time
detector1 = id000001.get()
detector2 = id000002.get()
detector3 = id000003.get()
detector4 = id000004.get()
detector5 = id000005.get()
detector6 = id000006.get()
detector7 = id000007.get()
detector8 = id000008.get()
CAD_VALA = pV_CAD_VALA.get()
MOTOR_ATHM = pV_MOTOR_ATHM.get()
MOTOR_LLS = pV_MOTOR_LLS.get()
MOTOR_HLS = pV_MOTOR_HLS.get()
MOTOR_DMOV = pV_MOTOR_DMOV.get()
CAD_ODIR = pV_CAD_ODIR.get()
MOTOR_HOMF = pV_MOTOR_HOMF.get()
MOTOR_RLV = pV_MOTOR_RLV.get()
MOTOR_STOP = pV_MOTOR_STOP.get()
MOTOR_SET = pV_MOTOR_SET.get()
MOTOR_OFF = pV_MOTOR_OFF.get()
MOTOR_VAL = pV_MOTOR_VAL.get()
MOTOR_DVAL = pV_MOTOR_DVAL.get()
MOTOR_DLLM = pV_MOTOR_DLLM.get()
MOTOR_DHLM = pV_MOTOR_DHLM.get()
CAD_VALB = pV_CAD_VALB.get()
CAR_IVAL = pV_CAR_IVAL.get()
CAR_IERR = pV_CAR_IERR.get()
SIR_VAL = pV_SIR_VAL.get()
ENCODERraw = pV_ENCODERraw.get()
ENCODERscale = pV_ENCODERscale.get()
ENCODER_oEN = pV_ENCODER_oEN.get()
ENCODER_HFF = pV_ENCODER_HFF.get()
FIRST_INIT = pV_FIRST_INIT.get()
#Variable Mappings
a = detector6
b = detector3
id000009 = a-b
scan.append ([setpoint1], [readback1], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, id000009, CAD_VALA, MOTOR_ATHM, MOTOR_LLS, MOTOR_HLS, MOTOR_DMOV, CAD_ODIR, MOTOR_HOMF, MOTOR_RLV, MOTOR_STOP, MOTOR_SET, MOTOR_OFF, MOTOR_VAL, MOTOR_DVAL, MOTOR_DLLM, MOTOR_DHLM, CAD_VALB, CAR_IVAL, CAR_IERR, SIR_VAL, ENCODERraw, ENCODERscale, ENCODER_oEN, ENCODER_HFF, FIRST_INIT] )
#Closing channels
id000001.close()
id000002.close()
id000003.close()
id000004.close()
id000005.close()
id000006.close()
id000007.close()
id000008.close()
pV_CAD_VALA.close()
pV_MOTOR_ATHM.close()
pV_MOTOR_LLS.close()
pV_MOTOR_HLS.close()
pV_MOTOR_DMOV.close()
pV_CAD_ODIR.close()
pV_MOTOR_HOMF.close()
pV_MOTOR_RLV.close()
pV_MOTOR_STOP.close()
pV_MOTOR_SET.close()
pV_MOTOR_OFF.close()
pV_MOTOR_VAL.close()
pV_MOTOR_DVAL.close()
pV_MOTOR_DLLM.close()
pV_MOTOR_DHLM.close()
pV_CAD_VALB.close()
pV_CAR_IVAL.close()
pV_CAR_IERR.close()
pV_SIR_VAL.close()
pV_ENCODERraw.close()
pV_ENCODERscale.close()
pV_ENCODER_oEN.close()
pV_ENCODER_HFF.close()
pV_FIRST_INIT.close()
scan.end()
success = True
ret = 'Monitoring completed'
print_log(testName, DEVICE, ret)
############# END OF YOUR CODE ###########
###### DO NOT MODIFY THE CODE BELOW ######
sendFeedback(testPath, testName, DEVICE, ret, success)
except:
ret = traceback.format_exc()
success = False
sendFeedback(testPath, testName, DEVICE, ret, success)
return
#launch the test
startTest(test, device, parameters)
@@ -0,0 +1,14 @@
<html>
<body>
<h2>Short Description</h2>
Monitor all process variables.
<h2>Details</h2>
Monitor all parameters during a fixed amount of time. No commands are sent.
<h2>Parameters</h2>
<code>timeWindowS </code> Duration of the monitoring time window [s] <br/>
<code>samplingTimeS </code> Time resolution (time elapsed between two samples are taken) [s]
<h2>Contact</h2>
<a href="https://intranet.psi.ch/Main/MarcoBoccioli">Marco Boccioli </a>
</html>
</body>