This commit is contained in:
boccioli_m
2015-09-02 10:43:04 +02:00
parent 79e9aac763
commit 45202c5b09
748 changed files with 54734 additions and 0 deletions
@@ -0,0 +1,12 @@
name=Calibrate
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,118 @@
#Script imported from: Calibrate.xml
###### Init - DO NOT MODIFY THE CODE BELOW ######
global print_log, sendFeedback, inspect, log, 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):
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 #############
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.setPlotName(plotName)
scan.start()
try:
#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')
except:
ret = 'Unable to create channel - ' + traceback.format_exc()
success = False
sendFeedback(testPath, testName, DEVICE, 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])
#Closing channels
id000001.close()
id000003.close()
id000004.close()
id000005.close()
id000006.close()
id000007.close()
id000008.close()
id000009.close()
id000010.close()
scan.end()
ret = 'Calibration done'
status = True
################ 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,61 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration xmlns="http://www.psi.ch/~ebner/models/scan/1.0">
<data fileName="Calibrate.fda"/>
<scan>
<!-- Send Calibrate Command -->
<preAction xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ChannelAction" channel="{DEVICE}:COM:2" value="CALLIBR"/>
<dimension>
<positioner xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="PseudoPositioner" settlingTime="0.1" id="id000000">
<counts>900</counts>
</positioner>
<!-- Motor Drive Status -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:STA:1" id="id000001"/>
<!-- Logical Status -->
<!-- <detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:STA:2" id="id00001B"/> -->
<!-- Interlock Status -->
<!-- <detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IIST:2" id="id000002"/> -->
<!-- Logical Position -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST:2" id="id000003"/>
<!-- Collimator Diameter -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:DIAM:2" id="id000004"/>
<!-- Position Counter: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST1:1" id="id000005"/>
<!-- Position Counter: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST1:2" id="id000006"/>
<!-- Potentiometer: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST2:1" id="id000007"/>
<!-- Potentiometer: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST2:2" id="id000008"/>
<!-- BTVS Digitiser: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST3:1" id="id000009"/>
<!-- BTVS Digitiser: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST3:2" id="id000010"/>
</dimension>
</scan>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000001" title="Drive Status: {DEVICE}:STA:1"/>
<!-- <visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000002" title="ILK Status: {DEVICE}:IIST:2"/> -->
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000003" title="Logical Pos: {DEVICE}:IST:2"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000004" title="Diameter: {DEVICE}:DIAM:2 (mm)"/>
<!-- <visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000005" title="Cpc: {DEVICE}:IST1:1 (mm)"/> -->
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000006" title="Cpc: {DEVICE}:IST1:2 (mm)"/>
<!-- <visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000007" title="Pot: {DEVICE}:IST2:1 (mm)"/> -->
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000008" title="Pot: {DEVICE}:IST2:2 (mm)"/>
<!-- <visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000009" title="Btvs: {DEVICE}:IST3:1 (ADC raw)"/> -->
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000010" title="Btvs: {DEVICE}:IST3:2 (mm)"/>
</configuration>
@@ -0,0 +1,3 @@
name=Drive Out
description=Drives the Collimator to the Out Position
filename=Drive Out.xml
@@ -0,0 +1,82 @@
#Script imported from: Drive Out.xml
import traceback
#by default, failed
ret = 'Test failed'
status = False
try:
#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')
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()
#TODO: Set the diplay names of positioners and detectors
scan = ManualScan(['id000000'], ['id000001', 'id000003', 'id000004', 'id000005', 'id000006', 'id000007', 'id000008', 'id000009', 'id000010'] , [0.0], [3000.0], [3000])
scan.start()
#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, detector4, detector5, detector6, detector7, detector8, detector9])
#Closing channels
id000001.close()
id000003.close()
id000004.close()
id000005.close()
id000006.close()
id000007.close()
id000008.close()
id000009.close()
id000010.close()
scan.end()
#return ok
ret = 'Slides moved out'
status = True
@@ -0,0 +1,118 @@
###### Init - DO NOT MODIFY THE CODE BELOW ######
global print_log, sendFeedback, inspect, log, 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):
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 #############
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.start()
try:
#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')
except:
ret = 'Unable to create channel - ' + traceback.format_exc()
success = False
sendFeedback(testPath, testName, DEVICE, ret, success)
return
#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])
#Closing channels
id000001.close()
id000003.close()
id000004.close()
id000005.close()
id000006.close()
id000007.close()
id000008.close()
id000009.close()
id000010.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)
except:
ret = traceback.format_exc()
success = False
sendFeedback(testPath, testName, DEVICE, ret, success)
return
#launch the test
startTest(test, device, parameters)
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration xmlns="http://www.psi.ch/~ebner/models/scan/1.0">
<data fileName="Drive Out.fda"/>
<scan>
<!-- Send Drive Out Command -->
<preAction xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ChannelAction" channel="{DEVICE}:COM:2" value="FAHR_AUS"/>
<dimension>
<positioner xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="PseudoPositioner" settlingTime="0.1" id="id000000">
<counts>3000</counts>
</positioner>
<!-- Motor Drive Status -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:STA:1" id="id000001"/>
<!-- Logical Status -->
<!-- <detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:STA:2" id="id00001B"/> -->
<!-- Interlock Status -->
<!-- <detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IIST:2" id="id000002"/> -->
<!-- Logical Position -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST:2" id="id000003"/>
<!-- Collimator Diameter -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:DIAM:2" id="id000004"/>
<!-- Position Counter: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST1:1" id="id000005"/>
<!-- Position Counter: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST1:2" id="id000006"/>
<!-- Potentiometer: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST2:1" id="id000007"/>
<!-- Potentiometer: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST2:2" id="id000008"/>
<!-- BTVS Digitiser: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST3:1" id="id000009"/>
<!-- BTVS Digitiser: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST3:2" id="id000010"/>
</dimension>
</scan>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000001" title="Drive Status: {DEVICE}:STA:1"/>
<!-- <visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000002" title="ILK Status: {DEVICE}:IIST:2"/> -->
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000003" title="Logical Pos: {DEVICE}:IST:2"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000004" title="Diameter: {DEVICE}:DIAM:2 (mm)"/>
<!-- <visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000005" title="Cpc: {DEVICE}:IST1:1 (mm)"/> -->
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000006" title="Cpc: {DEVICE}:IST1:2 (mm)"/>
<!-- <visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000007" title="Pot: {DEVICE}:IST2:1 (mm)"/> -->
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000008" title="Pot: {DEVICE}:IST2:2 (mm)"/>
<!-- <visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000009" title="Btvs: {DEVICE}:IST3:1 (ADC raw)"/> -->
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000010" title="Btvs: {DEVICE}:IST3:2 (mm)"/>
</configuration>
@@ -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,96 @@
###### Init - DO NOT MODIFY THE CODE BELOW ######
global print_log, sendFeedback, inspect, log, 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):
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
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 ################
###### 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,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,7 @@
name=Motor Test 2
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:1:Repeat N times;midPoint:41.0:Middle point A;spanFromMidPoint:2.0:B steps around middle point A
@@ -0,0 +1,163 @@
#Script Motor Test 2 for production system
#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
###### Init - DO NOT MODIFY THE CODE BELOW ######
global print_log, sendFeedback, inspect, log, 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):
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"])
span = float(params["spanFromMidPoint"]["value"])
except:
ret = 'Could not retrieve testing parameters - ' + traceback.format_exc()
success = False
sendFeedback(testPath, testName, DEVICE, ret, status)
return
#scan = ManualScan(['idX', 'idInkr'], ['idMotorStatus', 'idLogicalPosition', 'idDiameter', 'idPotiPosFromBeam', 'idPotiRaw', 'idPotiProc', 'idBtvsRaw', 'idMotorStep', 'idDiff01', 'idDiff02'] , [-0.5, 0.0], [4.0, 3000.0], [3000, 20])
#scan = ManualScan(['idX'], ['idMotorStatus', 'idLogicalPosition', 'idDiameter', 'idPotiPosFromBeam', 'idPotiRaw', 'idPotiProc', 'idBtvsRaw', 'idMotorStep', 'idDiff01', 'idDiff02'] , [ 0.0], [ 3000.0], [20])
scan = ManualScan(['idX'], ['idInkr', 'idInkrRb', 'idMotorStep', 'idPotiPosFromBeam', 'idPotiPosition', 'idPotiRef1Position', 'idPotiRef2Position', 'idDiameter', 'idPotiPosition-idInkrRb', 'idPortPosition-idMotorStep'] , [ 0.0], [ 3000.0], [20])
scan.setPlotName(plotName)
scan.start()
#Creating channels: dimension 1
try:
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]
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]
idDiameter = Channel(DEVICE+':DIAM:2', type = 'd') #collimator diameter [mm]
except:
ret = 'Unable to create channel - ' + traceback.format_exc()
success = False
sendFeedback(testPath, testName, DEVICE, ret, status)
return
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) > 5 : # 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, status)
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
sleep( 5 ) # 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, status)
return
#Detector idMotorStatus
detector1 = idInkrRb.get()
#Detector idLogicalPosition
detector2 = idMotorStep.get()
#Detector idDiameter
detector3 = idPotiPosFromBeam.get()
#Detector idPotiPosFromBeam
detector4 = idPotiPosition.get()
#Detector idPotiRaw
detector5 = idPotiRef1Position.get()
#Detector idPotiProc
detector6 = idPotiRef2Position.get()
#Detector idBtvsRaw
detector7 = idDiameter.get()
#Manipulation idDiff02
#Variable Mappings
idDiff02 = detector4-detector2
#Manipulation idDiff01
#Variable Mappings
idDiff01 = detector4-detector1
countSteps = countSteps + 1
scan.append ([countSteps], [countSteps], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, idDiff02, idDiff01])
if (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 ( 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
#Closing channels
idInkr.close()
idInkrRb.close()
idMotorStep.close()
idPotiPosFromBeam.close()
idPotiPosition.close()
idPotiRef1Position.close()
idPotiRef2Position.close()
idDiameter.close()
scan.end()
ret = 'Slide moved back and forth (' + str(count) + ' runs)'
status = True
################ 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,3 @@
name=Move Ref 1
description=Moves to the Reference 1 Position
filename=Move Ref 1.xml
@@ -0,0 +1,90 @@
###### DO NOT MODIFY THE CODE BELOW ######
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
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())
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, ' Reference point reached')
########## 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
import sys, inspect, os, traceback
#get test arguments
DEVICE = device
testName = test
params = parameters
#launch the test
startTest(testName, DEVICE, params)
@@ -0,0 +1,95 @@
###### Init - DO NOT MODIFY THE CODE BELOW ######
global print_log, sendFeedback, inspect, log, 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):
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
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
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())
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, ' Reference point reached')
################ 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,61 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration xmlns="http://www.psi.ch/~ebner/models/scan/1.0">
<data fileName="Move Ref 1.fda"/>
<scan>
<!-- Send Move to Ref 1 Command -->
<preAction xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ChannelAction" channel="{DEVICE}:COM:2" value="FAHR_R1"/>
<dimension>
<positioner xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="PseudoPositioner" settlingTime="0.1" id="id000000">
<counts>3000</counts>
</positioner>
<!-- Motor Drive Status -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:STA:1" id="id000001"/>
<!-- Logical Status -->
<!-- <detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:STA:2" id="id00001B"/> -->
<!-- Interlock Status -->
<!-- <detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IIST:2" id="id000002"/> -->
<!-- Logical Position -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST:2" id="id000003"/>
<!-- Collimator Diameter -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:DIAM:2" id="id000004"/>
<!-- Position Counter: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST1:1" id="id000005"/>
<!-- Position Counter: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST1:2" id="id000006"/>
<!-- Potentiometer: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST2:1" id="id000007"/>
<!-- Potentiometer: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST2:2" id="id000008"/>
<!-- BTVS Digitiser: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST3:1" id="id000009"/>
<!-- BTVS Digitiser: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST3:2" id="id000010"/>
</dimension>
</scan>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000001" title="Drive Status: {DEVICE}:STA:1"/>
<!-- <visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000002" title="ILK Status: {DEVICE}:IIST:2"/> -->
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000003" title="Logical Pos: {DEVICE}:IST:2"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000004" title="Diameter: {DEVICE}:DIAM:2 (mm)"/>
<!-- <visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000005" title="Cpc: {DEVICE}:IST1:1 (mm)"/> -->
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000006" title="Cpc: {DEVICE}:IST1:2 (mm)"/>
<!-- <visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000007" title="Pot: {DEVICE}:IST2:1 (mm)"/> -->
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000008" title="Pot: {DEVICE}:IST2:2 (mm)"/>
<!-- <visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000009" title="Btvs: {DEVICE}:IST3:1 (ADC raw)"/> -->
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000010" title="Btvs: {DEVICE}:IST3:2 (mm)"/>
</configuration>
@@ -0,0 +1,3 @@
name=Move Ref 2
description=Moves to the Reference 2 Position
filename=Move Ref 2.xml
@@ -0,0 +1,95 @@
###### Init - DO NOT MODIFY THE CODE BELOW ######
global print_log, sendFeedback, inspect, log, 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):
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
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.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
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())
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
#Closing channels
idCom.close()
idMotorStep.close()
idPotiPosFromBeam.close()
idPotiPosition.close()
idPotiRef1Position.close()
idPotiRef2Position.close()
print_log(testName, DEVICE, ' Reference point reached')
################ 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,61 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration xmlns="http://www.psi.ch/~ebner/models/scan/1.0">
<data fileName="Move Ref 2.fda"/>
<scan>
<!-- Send Move to Ref 2 Command -->
<preAction xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ChannelAction" channel="{DEVICE}:COM:2" value="FAHR_R2"/>
<dimension>
<positioner xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="PseudoPositioner" settlingTime="0.1" id="id000000">
<counts>3000</counts>
</positioner>
<!-- Motor Drive Status -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:STA:1" id="id000001"/>
<!-- Logical Status -->
<!-- <detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:STA:2" id="id00001B"/> -->
<!-- Interlock Status -->
<!-- <detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IIST:2" id="id000002"/> -->
<!-- Logical Position -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST:2" id="id000003"/>
<!-- Collimator Diameter -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:DIAM:2" id="id000004"/>
<!-- Position Counter: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST1:1" id="id000005"/>
<!-- Position Counter: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST1:2" id="id000006"/>
<!-- Potentiometer: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST2:1" id="id000007"/>
<!-- Potentiometer: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST2:2" id="id000008"/>
<!-- BTVS Digitiser: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST3:1" id="id000009"/>
<!-- BTVS Digitiser: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST3:2" id="id000010"/>
</dimension>
</scan>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000001" title="Drive Status: {DEVICE}:STA:1"/>
<!-- <visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000002" title="ILK Status: {DEVICE}:IIST:2"/> -->
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000003" title="Logical Pos: {DEVICE}:IST:2"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000004" title="Diameter: {DEVICE}:DIAM:2 (mm)"/>
<!-- <visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000005" title="Cpc: {DEVICE}:IST1:1 (mm)"/> -->
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000006" title="Cpc: {DEVICE}:IST1:2 (mm)"/>
<!-- <visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000007" title="Pot: {DEVICE}:IST2:1 (mm)"/> -->
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000008" title="Pot: {DEVICE}:IST2:2 (mm)"/>
<!-- <visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000009" title="Btvs: {DEVICE}:IST3:1 (ADC raw)"/> -->
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000010" title="Btvs: {DEVICE}:IST3:2 (mm)"/>
</configuration>
@@ -0,0 +1,8 @@
Test 1 plotted curves
CCWsteps
CCWpoti
CWsteps
CWpoti
@@ -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,136 @@
#Script imported from: Calibrate.xml
###### DO NOT MODIFY THE CODE BELOW ######
import sys, inspect, os, traceback, time
global print_log, sendFeedback
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
#TODO: Set the diplay names of positioners and detectors
scan = ManualScan(['id000000'], ['id000001', 'id000002', 'id000003', 'id000004', 'id000005', 'id000006', 'id000007', 'id000008', 'id000009', 'id000010', 'idResult'] , [0.0], [1000.0], [1000])
scan.start()
#Creating channels: dimension 1
#PseudoPositioner id000000
#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+':MOTOR.LLS', type = 'd')
#ScalarDetector id000006
id000006 = Channel(DEVICE+':MOTOR.HLS', type = 'd')
#ScalarDetector id000007
id000007 = Channel(DEVICE+':ENCODERraw', type = 'd')
#ScalarDetector id000008
id000008 = Channel(DEVICE+':ENCODER', type = 'd')
#ScalarDetector id000009
id000009 = Channel(DEVICE+':RDY', type = 'd')
#ScalarDetector id000010
id000010 = Channel(DEVICE+':ILK', type = 'd')
#Dimension 1
#PseudoPositioner id000000
for setpoint1 in range(0, 1000):
readback1 = setpoint1
sleep( 0.05 ) # Settling time
#Detector id000001
detector1 = id000001.get()
#Detector id000002
detector2 = id000002.get()
#Detector id000003
detector3 = id000003.get()
#Detector id000004
detector4 = id000004.get()
#Detector id000005
detector5 = id000005.get()
#Detector id000006
detector6 = id000006.get()
#Detector id000007
detector7 = id000007.get()
#Detector id000008
detector8 = id000008.get()
#Detector id000009
detector9 = id000009.get()
#Detector id000010
detector10 = id000010.get()
#Manipulation idResult
#Variable Mappings
ready = detector9
interlock = detector10
count = setpoint1
if count < 800:
idResult = (0, "Note: the "+DEVICE+" calibration procedure did not complete.")
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
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
scan.append ([setpoint1], [readback1], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, detector9, detector10, idResult])
#Closing channels
id000001.close()
id000002.close()
id000003.close()
id000004.close()
id000005.close()
id000006.close()
id000007.close()
id000008.close()
id000009.close()
id000010.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
#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
#launch the test
startTest(test, device, parameters)
@@ -0,0 +1,12 @@
name=Calibrate
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,79 @@
#Script imported from: Calibrate.xml
ret = 'Calibration failed'
status = False
try:
#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')
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()
#TODO: Set the diplay names of positioners and detectors
scan = ManualScan(['id000000'], ['id000001', 'id000003', 'id000004', 'id000005', 'id000006', 'id000007', 'id000008', 'id000009', 'id000010'] , [0.0], [900.0], [900])
scan.start()
#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, detector4, detector5, detector6, detector7, detector8, detector9])
#Closing channels
id000001.close()
id000003.close()
id000004.close()
id000005.close()
id000006.close()
id000007.close()
id000008.close()
id000009.close()
id000010.close()
scan.end()
ret = 'Calibration done'
status = True
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration xmlns="http://www.psi.ch/~ebner/models/scan/1.0">
<data fileName="Calibrate.fda"/>
<scan>
<!-- Send Calibrate Command -->
<preAction xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ChannelAction" channel="{DEVICE}:COM:2" value="CALLIBR"/>
<dimension>
<positioner xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="PseudoPositioner" settlingTime="0.1" id="id000000">
<counts>900</counts>
</positioner>
<!-- Motor Drive Status -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:STA:1" id="id000001"/>
<!-- Logical Status -->
<!-- <detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:STA:2" id="id00001B"/> -->
<!-- Interlock Status -->
<!-- <detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IIST:2" id="id000002"/> -->
<!-- Logical Position -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST:2" id="id000003"/>
<!-- Collimator Diameter -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:DIAM:2" id="id000004"/>
<!-- Position Counter: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST1:1" id="id000005"/>
<!-- Position Counter: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST1:2" id="id000006"/>
<!-- Potentiometer: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST2:1" id="id000007"/>
<!-- Potentiometer: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST2:2" id="id000008"/>
<!-- BTVS Digitiser: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST3:1" id="id000009"/>
<!-- BTVS Digitiser: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST3:2" id="id000010"/>
</dimension>
</scan>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000001" title="Drive Status: {DEVICE}:STA:1"/>
<!-- <visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000002" title="ILK Status: {DEVICE}:IIST:2"/> -->
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000003" title="Logical Pos: {DEVICE}:IST:2"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000004" title="Diameter: {DEVICE}:DIAM:2 (mm)"/>
<!-- <visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000005" title="Cpc: {DEVICE}:IST1:1 (mm)"/> -->
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000006" title="Cpc: {DEVICE}:IST1:2 (mm)"/>
<!-- <visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000007" title="Pot: {DEVICE}:IST2:1 (mm)"/> -->
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000008" title="Pot: {DEVICE}:IST2:2 (mm)"/>
<!-- <visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000009" title="Btvs: {DEVICE}:IST3:1 (ADC raw)"/> -->
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000010" title="Btvs: {DEVICE}:IST3:2 (mm)"/>
</configuration>
@@ -0,0 +1,5 @@
name=Check Status
description=Monitors the status of the device
filename=Check Status.xml
help= \
This test plots the status of all relevant drive signals for a period of 15 seconds.
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration xmlns="http://www.psi.ch/~ebner/models/scan/1.0" failOnSensorError="true">
<data fileName="Check Status.fda"/>
<scan>
<dimension>
<positioner xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="PseudoPositioner" settlingTime="0.1" id="idX">
<counts>3000</counts>
</positioner>
<!-- Motor Drive Status -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:STA:1" id="idMotorStatus"/>
<!-- Logical Status -->
<!-- <detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:STA:2" id="id000002"/> -->
<!-- Interlock Status -->
<!-- <detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IIST:2" id="id000002"/> -->
<!-- Logical Position -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST:2" id="idLogicalPosition"/>
<!-- Collimator Diameter -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:DIAM:2" id="idDiameter"/>
<!-- Position Counter: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST1:2" id="idMotorPosition"/>
<!-- Potentiometer: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:POSA:1" id="idPotiRaw"/>
<!-- Potentiometer: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:POSA:2" id="idPotiProc"/>
<!-- BTVS Digitiser: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST3:1" id="idBtvsRaw"/>
<!-- BTVS Digitiser: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST3:2" id="idBtvsProc"/>
</dimension>
<manipulation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScriptManipulation" id="idDiff01">
<mapping xsi:type="IDParameterMapping" refid="idMotorPosition" variable="a"/>
<mapping xsi:type="IDParameterMapping" refid="idPotiProc" variable="b"/>
<mapping xsi:type="IDParameterMapping" refid="idX" variable="count"/>
<script>def process(a,b,count):
return a-b</script>
</manipulation>
<manipulation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScriptManipulation" id="idDiff02">
<mapping xsi:type="IDParameterMapping" refid="idMotorPosition" variable="a"/>
<mapping xsi:type="IDParameterMapping" refid="idBtvsProc" variable="b"/>
<mapping xsi:type="IDParameterMapping" refid="idX" variable="count"/>
<script>def process(a,b,count):
return a-b</script>
</manipulation>
</scan>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idMotorStatus" title="idMotorStatus"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idLogicalPosition" title="idLogicalPosition"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idDiameter" title="idDiameter"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idMotorPosition" title="idMotorPosition"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idPotiRaw" title="idPotiRaw"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idPotiProc" title="idPotiProc"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idBtvsRaw" title="idBtvsRaw"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idBtvsProc" title="idBtvsProc"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idDiff01" title="idDiff01"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idDiff02" title="idDiff02"/>
</configuration>
@@ -0,0 +1,3 @@
name=Drive Out
description=Drives the Collimator to the Out Position
filename=Drive Out.xml
@@ -0,0 +1,82 @@
#Script imported from: Drive Out.xml
import traceback
#by default, failed
ret = 'Test failed'
status = False
try:
#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')
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()
#TODO: Set the diplay names of positioners and detectors
scan = ManualScan(['id000000'], ['id000001', 'id000003', 'id000004', 'id000005', 'id000006', 'id000007', 'id000008', 'id000009', 'id000010'] , [0.0], [3000.0], [3000])
scan.start()
#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, detector4, detector5, detector6, detector7, detector8, detector9])
#Closing channels
id000001.close()
id000003.close()
id000004.close()
id000005.close()
id000006.close()
id000007.close()
id000008.close()
id000009.close()
id000010.close()
scan.end()
#return ok
ret = 'Slides moved out'
status = True
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration xmlns="http://www.psi.ch/~ebner/models/scan/1.0">
<data fileName="Drive Out.fda"/>
<scan>
<!-- Send Drive Out Command -->
<preAction xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ChannelAction" channel="{DEVICE}:COM:2" value="FAHR_AUS"/>
<dimension>
<positioner xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="PseudoPositioner" settlingTime="0.1" id="id000000">
<counts>3000</counts>
</positioner>
<!-- Motor Drive Status -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:STA:1" id="id000001"/>
<!-- Logical Status -->
<!-- <detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:STA:2" id="id00001B"/> -->
<!-- Interlock Status -->
<!-- <detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IIST:2" id="id000002"/> -->
<!-- Logical Position -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST:2" id="id000003"/>
<!-- Collimator Diameter -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:DIAM:2" id="id000004"/>
<!-- Position Counter: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST1:1" id="id000005"/>
<!-- Position Counter: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST1:2" id="id000006"/>
<!-- Potentiometer: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST2:1" id="id000007"/>
<!-- Potentiometer: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST2:2" id="id000008"/>
<!-- BTVS Digitiser: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST3:1" id="id000009"/>
<!-- BTVS Digitiser: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST3:2" id="id000010"/>
</dimension>
</scan>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000001" title="Drive Status: {DEVICE}:STA:1"/>
<!-- <visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000002" title="ILK Status: {DEVICE}:IIST:2"/> -->
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000003" title="Logical Pos: {DEVICE}:IST:2"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000004" title="Diameter: {DEVICE}:DIAM:2 (mm)"/>
<!-- <visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000005" title="Cpc: {DEVICE}:IST1:1 (mm)"/> -->
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000006" title="Cpc: {DEVICE}:IST1:2 (mm)"/>
<!-- <visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000007" title="Pot: {DEVICE}:IST2:1 (mm)"/> -->
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000008" title="Pot: {DEVICE}:IST2:2 (mm)"/>
<!-- <visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000009" title="Btvs: {DEVICE}:IST3:1 (ADC raw)"/> -->
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000010" title="Btvs: {DEVICE}:IST3:2 (mm)"/>
</configuration>
@@ -0,0 +1,7 @@
name=Go to specific position
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,8 @@
name=Initialise
description=Initialises the motor
help = \
This test sends a INIT command to the device, as many times as configured with the parameter RepeatTimes.
#optional parameters. Description is compulsory. Syntax:
#parameters=<parameter1Name>:<parameter1Value>:<Parameter 1 description>[;<parameter2Name>:<parameter2Value>:<Parameter 2 description>]
parameters=repeatTimes:2:Repeat N times;delayS:4:Delay between each initialisation [s]
@@ -0,0 +1,129 @@
###### 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')
idMotorPosition = Channel(DEVICE+':MOTOR.RBV', type = 'd')
idEncoderPosition = Channel(DEVICE+':ENCODER', 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()
#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=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]
@@ -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,192 @@
#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
###### DO NOT MODIFY THE CODE BELOW ######
import sys, inspect, os, traceback, time
global print_log, sendFeedback
#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 + ': ' + str(text)
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 ########
#DEVICE = 'PO2DV-NCS-LS'
#get parameters from the calling interface
try:
print_log(testName, DEVICE, "Running test Motor Test 1 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
#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.setPlotName(plotName)
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:
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)
#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_log(testName, DEVICE, 'Homing')
idInkr.put(-100.0, timeout=None) # TODO: Set appropriate timeout
start = startDefault #idInkr.get()+direction
setpoint2 = end
count = 0
print_log(testName, DEVICE, '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_log(testName, DEVICE, '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_log(testName, DEVICE, '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)'
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,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,7 @@
name=Motor Test 2
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:1:Repeat N times;midPoint:41.0:Middle point A;spanFromMidPoint:2.0:B steps around middle point A
@@ -0,0 +1,211 @@
#Script Motor Test 2
#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 ######
import sys, inspect, os, traceback, time
global print_log, sendFeedback
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"])
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', 'idPotiProc', 'idBtvsRaw', 'idBtvsProc', 'idDiff01', 'idDiff02'] , [ 0.0], [ 3000.0], [20])
scan = ManualScan(['idX'], ['idMotorStatus', 'idLogicalPosition', 'idDiameter', 'idMotorPosition', 'idPotiRaw', 'idPotiProc', 'idBtvsRaw', 'idBtvsProc', 'idDiff01', 'idDiff02'])
scan.setPlotName(plotName)
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:
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
sleep( 2 ) # 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()
#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
idDiff01 = a-b
countSteps = countSteps + 1
scan.append ([countSteps], [countSteps], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, idDiff02, 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()
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)'
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
#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 + ': ' + str(text)
#launch the test
#from pshellTestGeneral import testUtils
#testUtil = testUtils()
#testUtil.print_log(test, device, "CLASSE!!!")
startTest(test, device, parameters)
@@ -0,0 +1,3 @@
name=Motor Test 3 100ms
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
filename=Motor Test 3.xml
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration xmlns="http://www.psi.ch/~ebner/models/scan/1.0" failOnSensorError="true">
<data fileName="Motor Test 3.fda"/>
<scan>
<dimension>
<positioner xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="PseudoPositioner" settlingTime="0.1" id="idX">
<counts>3000</counts>
</positioner>
<positioner xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="RegionPositioner" name="{DEVICE}:INKR:2" settlingTime="5.0" id="idInkr">
<region>
<start>0.0</start>
<end>10.0</end>
<stepSize>1.0</stepSize>
</region>
<region>
<start>10.0</start>
<end>0.0</end>
<stepSize>-1.0</stepSize>
</region>
</positioner>
<!-- Motor Drive Status -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:STA:1" id="idMotorStatus"/>
<!-- Logical Position -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST:2" id="idLogicalPosition"/>
<!-- Collimator Diameter -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:DIAM:2" id="idDiameter"/>
<!-- Position Counter: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST1:2" id="idMotorPosition"/>
<!-- Potentiometer: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:POSA:1" id="idPotiRaw"/>
<!-- Potentiometer: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:POSA:2" id="idPotiProc"/>
<!-- BTVS Digitiser: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST3:1" id="idBtvsRaw"/>
<!-- BTVS Digitiser: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST3:2" id="idBtvsProc"/>
</dimension>
<manipulation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScriptManipulation" id="idDiff01">
<mapping xsi:type="IDParameterMapping" refid="idMotorPosition" variable="a"/>
<mapping xsi:type="IDParameterMapping" refid="idPotiProc" variable="b"/>
<mapping xsi:type="IDParameterMapping" refid="idX" variable="count"/>
<script>def process(a,b,count):
return a-b</script>
</manipulation>
<manipulation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScriptManipulation" id="idDiff02">
<mapping xsi:type="IDParameterMapping" refid="idMotorPosition" variable="a"/>
<mapping xsi:type="IDParameterMapping" refid="idBtvsProc" variable="b"/>
<mapping xsi:type="IDParameterMapping" refid="idX" variable="count"/>
<script>def process(a,b,count):
return a-b</script>
</manipulation>
</scan>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idMotorStatus" title="idMotorStatus"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idLogicalPosition" title="idLogicalPosition"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idDiameter" title="idDiameter"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idMotorPosition" title="idMotorPosition"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idPotiRaw" title="idPotiRaw"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idPotiProc" title="idPotiProc"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idBtvsRaw" title="idBtvsRaw"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idBtvsProc" title="idBtvsProc"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idDiff01" title="idDiff01"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idDiff02" title="idDiff02"/>
</configuration>
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration xmlns="http://www.psi.ch/~ebner/models/scan/1.0" failOnSensorError="true">
<data fileName="Motor Test 3.fda"/>
<scan>
<dimension>
<positioner xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="PseudoPositioner" settlingTime="0.1" id="idX">
<counts>3000</counts>
</positioner>
<positioner xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="RegionPositioner" name="{DEVICE}:INKR:2" settlingTime="5.0" id="idInkr">
<region>
<start>0.0</start>
<end>10.0</end>
<stepSize>1.0</stepSize>
</region>
<region>
<start>10.0</start>
<end>0.0</end>
<stepSize>-1.0</stepSize>
</region>
</positioner>
<!-- Motor Drive Status -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:STA:1" id="idMotorStatus"/>
<!-- Logical Position -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST:2" id="idLogicalPosition"/>
<!-- Collimator Diameter -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:DIAM:2" id="idDiameter"/>
<!-- Position Counter: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST1:2" id="idMotorPosition"/>
<!-- Potentiometer: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:POSA:1" id="idPotiRaw"/>
<!-- Potentiometer: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:POSA:2" id="idPotiProc"/>
<!-- BTVS Digitiser: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST3:1" id="idBtvsRaw"/>
<!-- BTVS Digitiser: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST3:2" id="idBtvsProc"/>
</dimension>
<manipulation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScriptManipulation" id="idDiff01">
<mapping xsi:type="IDParameterMapping" refid="idMotorPosition" variable="a"/>
<mapping xsi:type="IDParameterMapping" refid="idPotiProc" variable="b"/>
<mapping xsi:type="IDParameterMapping" refid="idX" variable="count"/>
<script>def process(a,b,count):
return a-b</script>
</manipulation>
<manipulation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScriptManipulation" id="idDiff02">
<mapping xsi:type="IDParameterMapping" refid="idMotorPosition" variable="a"/>
<mapping xsi:type="IDParameterMapping" refid="idBtvsProc" variable="b"/>
<mapping xsi:type="IDParameterMapping" refid="idX" variable="count"/>
<script>def process(a,b,count):
return a-b</script>
</manipulation>
</scan>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idMotorStatus" title="idMotorStatus"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idLogicalPosition" title="idLogicalPosition"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idDiameter" title="idDiameter"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idMotorPosition" title="idMotorPosition"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idPotiRaw" title="idPotiRaw"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idPotiProc" title="idPotiProc"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idBtvsRaw" title="idBtvsRaw"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idBtvsProc" title="idBtvsProc"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idDiff01" title="idDiff01"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idDiff02" title="idDiff02"/>
</configuration>
@@ -0,0 +1,3 @@
name=Motor Test 3 200ms
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
filename=Motor Test 3.xml
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration xmlns="http://www.psi.ch/~ebner/models/scan/1.0" failOnSensorError="true">
<data fileName="Motor Test 3.fda"/>
<scan>
<dimension>
<positioner xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="PseudoPositioner" settlingTime="0.1" id="idX">
<counts>3000</counts>
</positioner>
<positioner xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="RegionPositioner" name="{DEVICE}:INKR:2" settlingTime="5.0" id="idInkr">
<region>
<start>0.0</start>
<end>10.0</end>
<stepSize>1.0</stepSize>
</region>
<region>
<start>10.0</start>
<end>0.0</end>
<stepSize>-1.0</stepSize>
</region>
</positioner>
<!-- Motor Drive Status -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:STA:1" id="idMotorStatus"/>
<!-- Logical Position -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST:2" id="idLogicalPosition"/>
<!-- Collimator Diameter -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:DIAM:2" id="idDiameter"/>
<!-- Position Counter: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST1:2" id="idMotorPosition"/>
<!-- Potentiometer: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:POSA:1" id="idPotiRaw"/>
<!-- Potentiometer: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:POSA:2" id="idPotiProc"/>
<!-- BTVS Digitiser: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST3:1" id="idBtvsRaw"/>
<!-- BTVS Digitiser: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST3:2" id="idBtvsProc"/>
</dimension>
<manipulation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScriptManipulation" id="idDiff01">
<mapping xsi:type="IDParameterMapping" refid="idMotorPosition" variable="a"/>
<mapping xsi:type="IDParameterMapping" refid="idPotiProc" variable="b"/>
<mapping xsi:type="IDParameterMapping" refid="idX" variable="count"/>
<script>def process(a,b,count):
return a-b</script>
</manipulation>
<manipulation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScriptManipulation" id="idDiff02">
<mapping xsi:type="IDParameterMapping" refid="idMotorPosition" variable="a"/>
<mapping xsi:type="IDParameterMapping" refid="idBtvsProc" variable="b"/>
<mapping xsi:type="IDParameterMapping" refid="idX" variable="count"/>
<script>def process(a,b,count):
return a-b</script>
</manipulation>
</scan>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idMotorStatus" title="idMotorStatus"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idLogicalPosition" title="idLogicalPosition"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idDiameter" title="idDiameter"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idMotorPosition" title="idMotorPosition"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idPotiRaw" title="idPotiRaw"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idPotiProc" title="idPotiProc"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idBtvsRaw" title="idBtvsRaw"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idBtvsProc" title="idBtvsProc"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idDiff01" title="idDiff01"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idDiff02" title="idDiff02"/>
</configuration>
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration xmlns="http://www.psi.ch/~ebner/models/scan/1.0" failOnSensorError="true">
<data fileName="Motor Test 3.fda"/>
<scan>
<dimension>
<positioner xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="PseudoPositioner" settlingTime="0.1" id="idX">
<counts>3000</counts>
</positioner>
<positioner xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="RegionPositioner" name="{DEVICE}:INKR:2" settlingTime="5.0" id="idInkr">
<region>
<start>0.0</start>
<end>10.0</end>
<stepSize>1.0</stepSize>
</region>
<region>
<start>10.0</start>
<end>0.0</end>
<stepSize>-1.0</stepSize>
</region>
</positioner>
<!-- Motor Drive Status -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:STA:1" id="idMotorStatus"/>
<!-- Logical Position -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST:2" id="idLogicalPosition"/>
<!-- Collimator Diameter -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:DIAM:2" id="idDiameter"/>
<!-- Position Counter: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST1:2" id="idMotorPosition"/>
<!-- Potentiometer: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:POSA:1" id="idPotiRaw"/>
<!-- Potentiometer: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:POSA:2" id="idPotiProc"/>
<!-- BTVS Digitiser: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST3:1" id="idBtvsRaw"/>
<!-- BTVS Digitiser: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST3:2" id="idBtvsProc"/>
</dimension>
<manipulation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScriptManipulation" id="idDiff01">
<mapping xsi:type="IDParameterMapping" refid="idMotorPosition" variable="a"/>
<mapping xsi:type="IDParameterMapping" refid="idPotiProc" variable="b"/>
<mapping xsi:type="IDParameterMapping" refid="idX" variable="count"/>
<script>def process(a,b,count):
return a-b</script>
</manipulation>
<manipulation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScriptManipulation" id="idDiff02">
<mapping xsi:type="IDParameterMapping" refid="idMotorPosition" variable="a"/>
<mapping xsi:type="IDParameterMapping" refid="idBtvsProc" variable="b"/>
<mapping xsi:type="IDParameterMapping" refid="idX" variable="count"/>
<script>def process(a,b,count):
return a-b</script>
</manipulation>
</scan>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idMotorStatus" title="idMotorStatus"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idLogicalPosition" title="idLogicalPosition"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idDiameter" title="idDiameter"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idMotorPosition" title="idMotorPosition"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idPotiRaw" title="idPotiRaw"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idPotiProc" title="idPotiProc"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idBtvsRaw" title="idBtvsRaw"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idBtvsProc" title="idBtvsProc"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idDiff01" title="idDiff01"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idDiff02" title="idDiff02"/>
</configuration>
@@ -0,0 +1,3 @@
name=Motor Test 3 500ms
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
filename=Motor Test 3.xml
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration xmlns="http://www.psi.ch/~ebner/models/scan/1.0" failOnSensorError="true">
<data fileName="Motor Test 3.fda"/>
<scan>
<dimension>
<positioner xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="PseudoPositioner" settlingTime="0.1" id="idX">
<counts>3000</counts>
</positioner>
<positioner xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="RegionPositioner" name="{DEVICE}:INKR:2" settlingTime="5.0" id="idInkr">
<region>
<start>0.0</start>
<end>10.0</end>
<stepSize>1.0</stepSize>
</region>
<region>
<start>10.0</start>
<end>0.0</end>
<stepSize>-1.0</stepSize>
</region>
</positioner>
<!-- Motor Drive Status -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:STA:1" id="idMotorStatus"/>
<!-- Logical Position -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST:2" id="idLogicalPosition"/>
<!-- Collimator Diameter -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:DIAM:2" id="idDiameter"/>
<!-- Position Counter: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST1:2" id="idMotorPosition"/>
<!-- Potentiometer: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:POSA:1" id="idPotiRaw"/>
<!-- Potentiometer: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:POSA:2" id="idPotiProc"/>
<!-- BTVS Digitiser: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST3:1" id="idBtvsRaw"/>
<!-- BTVS Digitiser: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST3:2" id="idBtvsProc"/>
</dimension>
<manipulation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScriptManipulation" id="idDiff01">
<mapping xsi:type="IDParameterMapping" refid="idMotorPosition" variable="a"/>
<mapping xsi:type="IDParameterMapping" refid="idPotiProc" variable="b"/>
<mapping xsi:type="IDParameterMapping" refid="idX" variable="count"/>
<script>def process(a,b,count):
return a-b</script>
</manipulation>
<manipulation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScriptManipulation" id="idDiff02">
<mapping xsi:type="IDParameterMapping" refid="idMotorPosition" variable="a"/>
<mapping xsi:type="IDParameterMapping" refid="idBtvsProc" variable="b"/>
<mapping xsi:type="IDParameterMapping" refid="idX" variable="count"/>
<script>def process(a,b,count):
return a-b</script>
</manipulation>
</scan>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idMotorStatus" title="idMotorStatus"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idLogicalPosition" title="idLogicalPosition"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idDiameter" title="idDiameter"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idMotorPosition" title="idMotorPosition"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idPotiRaw" title="idPotiRaw"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idPotiProc" title="idPotiProc"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idBtvsRaw" title="idBtvsRaw"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idBtvsProc" title="idBtvsProc"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idDiff01" title="idDiff01"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idDiff02" title="idDiff02"/>
</configuration>
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration xmlns="http://www.psi.ch/~ebner/models/scan/1.0" failOnSensorError="true">
<data fileName="Motor Test 3.fda"/>
<scan>
<dimension>
<positioner xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="PseudoPositioner" settlingTime="0.1" id="idX">
<counts>3000</counts>
</positioner>
<positioner xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="RegionPositioner" name="{DEVICE}:INKR:2" settlingTime="5.0" id="idInkr">
<region>
<start>0.0</start>
<end>10.0</end>
<stepSize>1.0</stepSize>
</region>
<region>
<start>10.0</start>
<end>0.0</end>
<stepSize>-1.0</stepSize>
</region>
</positioner>
<!-- Motor Drive Status -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:STA:1" id="idMotorStatus"/>
<!-- Logical Position -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST:2" id="idLogicalPosition"/>
<!-- Collimator Diameter -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:DIAM:2" id="idDiameter"/>
<!-- Position Counter: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST1:2" id="idMotorPosition"/>
<!-- Potentiometer: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:POSA:1" id="idPotiRaw"/>
<!-- Potentiometer: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:POSA:2" id="idPotiProc"/>
<!-- BTVS Digitiser: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST3:1" id="idBtvsRaw"/>
<!-- BTVS Digitiser: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST3:2" id="idBtvsProc"/>
</dimension>
<manipulation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScriptManipulation" id="idDiff01">
<mapping xsi:type="IDParameterMapping" refid="idMotorPosition" variable="a"/>
<mapping xsi:type="IDParameterMapping" refid="idPotiProc" variable="b"/>
<mapping xsi:type="IDParameterMapping" refid="idX" variable="count"/>
<script>def process(a,b,count):
return a-b</script>
</manipulation>
<manipulation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScriptManipulation" id="idDiff02">
<mapping xsi:type="IDParameterMapping" refid="idMotorPosition" variable="a"/>
<mapping xsi:type="IDParameterMapping" refid="idBtvsProc" variable="b"/>
<mapping xsi:type="IDParameterMapping" refid="idX" variable="count"/>
<script>def process(a,b,count):
return a-b</script>
</manipulation>
</scan>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idMotorStatus" title="idMotorStatus"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idLogicalPosition" title="idLogicalPosition"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idDiameter" title="idDiameter"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idMotorPosition" title="idMotorPosition"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idPotiRaw" title="idPotiRaw"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idPotiProc" title="idPotiProc"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idBtvsRaw" title="idBtvsRaw"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idBtvsProc" title="idBtvsProc"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idDiff01" title="idDiff01"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="idX" y="idDiff02" title="idDiff02"/>
</configuration>
@@ -0,0 +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
@@ -0,0 +1,169 @@
#Script Motor Test 3
#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
import traceback
#by default, failed
ret = 'Test failed'
status = False
DEVICE = device
params = parameters
#get parameters from the calling interface
try:
print "Running test Motor Test 3 with the following parameters:"
print params
loopTimes = int(params["repeatTimes"]["value"])
direction = int(params["translation"]["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
sys.exit()
#remove limits
idLimitH.put(999999.9, timeout=None)
idLimitL.put(-999999.9, timeout=None)
if direction == 0.0 :
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 = idInkr.get()+direction
countSteps = 0
print 'Starting testing sequence'
count = 0
for setpoint1 in range(0, loopTimes*2):
count = count + 1
sleep( 2 ) # 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
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
idDiff01 = a-b
countSteps = countSteps + 1
scan.append ([countSteps], [countSteps], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, idDiff02, idDiff01])
if endH>0.0 :
#invert direction and swap start with end of translation
end = startDefault
start = readback2 - direction
direction = -1.0
print 'End H switch, changing direction to ' + str(direction)
break
if endL>0.0 :
#invert direction and swap start with end of translation
end = endDefault
start = readback2 - direction
direction = 1.0
print 'End L switch, changing direction to ' + str(direction)
break
#set limits back
idLimitH.put(145.0, timeout=None)
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,3 @@
name=Move Ref 1
description=Moves to the Reference 1 Position
filename=Move Ref 1.xml
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration xmlns="http://www.psi.ch/~ebner/models/scan/1.0">
<data fileName="Move Ref 1.fda"/>
<scan>
<!-- Send Move to Ref 1 Command -->
<preAction xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ChannelAction" channel="{DEVICE}:COM:2" value="FAHR_R1"/>
<dimension>
<positioner xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="PseudoPositioner" settlingTime="0.1" id="id000000">
<counts>3000</counts>
</positioner>
<!-- Motor Drive Status -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:STA:1" id="id000001"/>
<!-- Logical Status -->
<!-- <detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:STA:2" id="id00001B"/> -->
<!-- Interlock Status -->
<!-- <detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IIST:2" id="id000002"/> -->
<!-- Logical Position -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST:2" id="id000003"/>
<!-- Collimator Diameter -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:DIAM:2" id="id000004"/>
<!-- Position Counter: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST1:1" id="id000005"/>
<!-- Position Counter: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST1:2" id="id000006"/>
<!-- Potentiometer: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST2:1" id="id000007"/>
<!-- Potentiometer: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST2:2" id="id000008"/>
<!-- BTVS Digitiser: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST3:1" id="id000009"/>
<!-- BTVS Digitiser: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST3:2" id="id000010"/>
</dimension>
</scan>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000001" title="Drive Status: {DEVICE}:STA:1"/>
<!-- <visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000002" title="ILK Status: {DEVICE}:IIST:2"/> -->
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000003" title="Logical Pos: {DEVICE}:IST:2"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000004" title="Diameter: {DEVICE}:DIAM:2 (mm)"/>
<!-- <visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000005" title="Cpc: {DEVICE}:IST1:1 (mm)"/> -->
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000006" title="Cpc: {DEVICE}:IST1:2 (mm)"/>
<!-- <visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000007" title="Pot: {DEVICE}:IST2:1 (mm)"/> -->
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000008" title="Pot: {DEVICE}:IST2:2 (mm)"/>
<!-- <visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000009" title="Btvs: {DEVICE}:IST3:1 (ADC raw)"/> -->
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000010" title="Btvs: {DEVICE}:IST3:2 (mm)"/>
</configuration>
@@ -0,0 +1,3 @@
name=Move Ref 2
description=Moves to the Reference 2 Position
filename=Move Ref 2.xml
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration xmlns="http://www.psi.ch/~ebner/models/scan/1.0">
<data fileName="Move Ref 2.fda"/>
<scan>
<!-- Send Move to Ref 2 Command -->
<preAction xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ChannelAction" channel="{DEVICE}:COM:2" value="FAHR_R2"/>
<dimension>
<positioner xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="PseudoPositioner" settlingTime="0.1" id="id000000">
<counts>3000</counts>
</positioner>
<!-- Motor Drive Status -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:STA:1" id="id000001"/>
<!-- Logical Status -->
<!-- <detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:STA:2" id="id00001B"/> -->
<!-- Interlock Status -->
<!-- <detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IIST:2" id="id000002"/> -->
<!-- Logical Position -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST:2" id="id000003"/>
<!-- Collimator Diameter -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:DIAM:2" id="id000004"/>
<!-- Position Counter: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST1:1" id="id000005"/>
<!-- Position Counter: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST1:2" id="id000006"/>
<!-- Potentiometer: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST2:1" id="id000007"/>
<!-- Potentiometer: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST2:2" id="id000008"/>
<!-- BTVS Digitiser: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST3:1" id="id000009"/>
<!-- BTVS Digitiser: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST3:2" id="id000010"/>
</dimension>
</scan>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000001" title="Drive Status: {DEVICE}:STA:1"/>
<!-- <visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000002" title="ILK Status: {DEVICE}:IIST:2"/> -->
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000003" title="Logical Pos: {DEVICE}:IST:2"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000004" title="Diameter: {DEVICE}:DIAM:2 (mm)"/>
<!-- <visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000005" title="Cpc: {DEVICE}:IST1:1 (mm)"/> -->
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000006" title="Cpc: {DEVICE}:IST1:2 (mm)"/>
<!-- <visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000007" title="Pot: {DEVICE}:IST2:1 (mm)"/> -->
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000008" title="Pot: {DEVICE}:IST2:2 (mm)"/>
<!-- <visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000009" title="Btvs: {DEVICE}:IST3:1 (ADC raw)"/> -->
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000010" title="Btvs: {DEVICE}:IST3:2 (mm)"/>
</configuration>
@@ -0,0 +1,3 @@
name=Stop
description=Sends the STOP command
filename=Stop.xml
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration xmlns="http://www.psi.ch/~ebner/models/scan/1.0">
<data fileName="Stop.fda"/>
<scan>
<!-- Send STOP Command -->
<preAction xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ChannelAction" channel="{DEVICE}:COM:2" value="STOP"/>
<dimension>
<positioner xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="PseudoPositioner" settlingTime="0.1" id="id000000">
<counts>3000</counts>
</positioner>
<!-- Motor Drive Status -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:STA:1" id="id000001"/>
<!-- Logical Status -->
<!-- <detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:STA:2" id="id00001B"/> -->
<!-- Interlock Status -->
<!-- <detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IIST:2" id="id000002"/> -->
<!-- Logical Position -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST:2" id="id000003"/>
<!-- Collimator Diameter -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:DIAM:2" id="id000004"/>
<!-- Position Counter: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST1:1" id="id000005"/>
<!-- Position Counter: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST1:2" id="id000006"/>
<!-- Potentiometer: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST2:1" id="id000007"/>
<!-- Potentiometer: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST2:2" id="id000008"/>
<!-- BTVS Digitiser: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST3:1" id="id000009"/>
<!-- BTVS Digitiser: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST3:2" id="id000010"/>
</dimension>
</scan>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000001" title="Drive Status: {DEVICE}:STA:1"/>
<!-- <visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000002" title="ILK Status: {DEVICE}:IIST:2"/> -->
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000003" title="Logical Pos: {DEVICE}:IST:2"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000004" title="Diameter: {DEVICE}:DIAM:2 (mm)"/>
<!-- <visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000005" title="Cpc: {DEVICE}:IST1:1 (mm)"/> -->
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000006" title="Cpc: {DEVICE}:IST1:2 (mm)"/>
<!-- <visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000007" title="Pot: {DEVICE}:IST2:1 (mm)"/> -->
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000008" title="Pot: {DEVICE}:IST2:2 (mm)"/>
<!-- <visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000009" title="Btvs: {DEVICE}:IST3:1 (ADC raw)"/> -->
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000010" title="Btvs: {DEVICE}:IST3:2 (mm)"/>
</configuration>
@@ -0,0 +1,4 @@
name=Zig Zag Test
description=Moves the drive back and forth between the end-switches
filename=Zig Zag Test.xml
help = This test repetitively moves the collimator between the R1 and R2 positions.
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration xmlns="http://www.psi.ch/~ebner/models/scan/1.0">
<data fileName="Zig Zag Test.fda"/>
<scan>
<dimension>
<positioner xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="PseudoPositioner" settlingTime="0.1" id="id000000">
<counts>3000</counts>
</positioner>
<positioner xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="RegionPositioner" name="{DEVICE}:COM:2" settlingTime="20.0" id="id961899">
<region>
<start>3.0</start>
<end>4.0</end>
<stepSize>1.0</stepSize>
</region>
<region>
<start>4.0</start>
<end>4.0</end>
<stepSize>1.0</stepSize>
</region>
</positioner>
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:STA:1" id="id000001"/>
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST:2" id="id000002"/>
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:DIAM:2" id="id000003"/>
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST1:2" id="id000004"/>
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST2:2" id="id000005"/>
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="{DEVICE}:IST3:2" id="id000006"/>
</dimension>
</scan>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000001" title="Drive Status: {DEVICE}:STA:1"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000002" title="Logical Pos: {DEVICE}:IST:2"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000003" title="Diameter: {DEVICE}:DIAM:2 (mm)"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000004" title="Cpc: {DEVICE}:IST1:2 (mm)"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000005" title="Pot: {DEVICE}:IST2:2 (mm)"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000006" title="Btvs: {DEVICE}:IST3:2 (mm)"/>
</configuration>
@@ -0,0 +1,3 @@
name=motor-slide
description=Moves the device
filename=Calibrate.xml
@@ -0,0 +1,73 @@
#Script imported from: PO2DV-NCS-LS_mot.xml
import traceback
#by default, failed
ret = 'Test failed'
status = False
#Pre-actions
try:
caput('PO2DV-NCS-LS:MOTOR.TWF', '0')
sleep(0.5)
caput('PO2DV-NCS-LS:MOTOR.RDBD', '0.1')
except:
print "Unexpected error:", sys.exc_info()[0]
ret = 'Unable to create channel - ' + traceback.format_exc()
success = False
raise
sys.exit()
#TODO: Set the diplay names of positioners and detectors
scan = ManualScan(['VAL'], ['time', 'RVAL', 'Encoder', 'RBV', 'Busy'] , [40.0], [44.0], [22])
scan.start()
#Creating channels: dimension 1
#RegionPositioner VAL
VAL = Channel('PO2DV-NCS-LS:MOTOR.VAL', type = 'd')
VALReadback = Channel('PO2DV-NCS-LS:MOTOR.RBV', type = 'd')
#Timestamp time
#ScalarDetector RVAL
RVAL = Channel('PO2DV-NCS-LS:MOTOR.RVAL', type = 'd')
#ScalarDetector ENCODER
ENCODER = Channel('PO2DV-NCS-LS:ENCODER', type = 'd')
#ScalarDetector RBV
RBV = Channel('PO2DV-NCS-LS:MOTOR.RBV', type = 'd')
#ScalarDetector Busy
Busy = Channel('PO2DV-NCS-LS:MOTOR.DMOV', type = 'd')
#Dimension 1
#RegionPositioner VAL
for setpoint1 in frange(40.0, 42.0, 0.2, True) + frange(41.8, 40.0, 0.2, True):
VAL.put(setpoint1, timeout=None) # TODO: Set appropriate timeout
readback1 = VALReadback.get()
if abs(readback1 - setpoint1) > 0.1 : # TODO: Check accuracy
ret = 'Actor VAL could not be set to the value ' + str(setpoint2) + ' (current value: ' + str(readback2) + ')'
success = False
raise Exception(ret)
#Detector time
detector1 = float(java.lang.System.currentTimeMillis())
#Detector RVAL
detector2 = RVAL.get()
#Detector TWF
detector3 = ENCODER.get()
#Detector RBV
detector4 = RBV.get()
#Detector Busy
detector5 = Busy.get()
scan.append ([setpoint1], [readback1], [detector1, detector2, detector3, detector4, detector5])
#Closing channels
VAL.close()
VALReadback.close()
RVAL.close()
ENCODER.close()
RBV.close()
Busy.close()
scan.end()
#Post-actions
caput('PO2DV-NCS-LS:MOTOR.RDBD', '1')
ret = 'Test done'
status = True
@@ -0,0 +1,6 @@
name=Display Test
description=Positioning sequence
#optional parameters. Description is compulsory. Syntax:
#parameters=<parameter1Name>:<parameter1Value>:<Parameter 1 description>[;<parameter2Name>:<parameter2Value>:<Parameter 2 description>]
parameters=repeatTimes:2:Repeat N times;delayS:4:Delay between each initialisation [s]
@@ -0,0 +1,90 @@
###### DO NOT MODIFY THE CODE BELOW ######
global print_log, sendFeedback, inspect, log, 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)
#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 #######
# caput(DEVICE+':INIT.PROC', '1')
#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'], ['idPositioner'] )
scan.setPlotName(plotName)
scan.start()
try:
idInit = Channel(DEVICE+':DEMAND', type = 'l')
except:
ret = 'Unable to create channel - ' + traceback.format_exc()
success = False
sendFeedback(testPath, testName, DEVICE, ret, success)
return
for count in range(1, loopTimes+1):
print_log(testName, DEVICE, 'Positioning sequence #' + str(count) + '/' + str(loopTimes))
timeStampStart = float(java.lang.System.currentTimeMillis())
for positioner in range(1, 143):
#Detector time
idInit.put(positioner, timeout=1000) # TODO: Set appropriate timeout
timeStamp = float(java.lang.System.currentTimeMillis())
sleep( 0.01 )
detector = idInit.get()
scan.append ([timeStamp],[timeStamp], [detector])
if(count < loopTimes):
print_log(testName, DEVICE, 'Next sequence starting in ' + str(delaySeconds) + 's')
sleep( delaySeconds ) # pause between two sequences
idInit.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,32 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration xmlns="http://www.psi.ch/~ebner/models/scan/1.0" numberOfExecution="1" failOnSensorError="true">
<data fileName="Display Test.fda"/>
<scan>
<!-- Pause -->
<preAction xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ShellAction" command="/bin/sleep 2" exitValue="0"/>
<dimension>
<!-- Set up a Pseudo Positioner that samples every 50ms for 1500 samples -->
<positioner xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="PseudoPositioner" settlingTime="0.01" id="id000000">
<counts>1000</counts>
</positioner>
<positioner xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinearPositioner" name="PO2TC-NCS-{DEVICE}:DEMAND" settlingTime="0.8" id="id000001">
<start>1</start>
<end>143</end>
<stepSize>1</stepSize>
</positioner>
</dimension>
<dimension>
<!-- Set up a Pseudo Positioner that samples every 50ms for 1500 samples -->
<positioner xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="PseudoPositioner" settlingTime="0.01" id="id000002">
<counts>1</counts>
</positioner>
</dimension>
</scan>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000001" title="Demand Value"/>
</configuration>
@@ -0,0 +1,8 @@
name=Calibrate
description=Initialises the motor
help = \
This test sends a INIT command to the device, as many times as configured with the parameter RepeatTimes.
#optional parameters. Description is compulsory. Syntax:
#parameters=<parameter1Name>:<parameter1Value>:<Parameter 1 description>[;<parameter2Name>:<parameter2Value>:<Parameter 2 description>]
parameters=repeatTimes:2:Repeat N times;delayS:4:Delay between each initialisation [s]
@@ -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,136 @@
###### DO NOT MODIFY THE CODE BELOW ######
global print_log, sendFeedback, inspect, log, 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')
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, log, 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)
#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,115 @@
#########################################
###### DO NOT MODIFY THE CODE BELOW #####
#########################################
global print_log, sendFeedback, sys, inspect, os, traceback, testcommons
import sys, inspect, os, traceback, testcommons
def print_log(testName, DEVICE, text):
testcommons.print_log(testName, DEVICE, text)
def sendFeedback(testPath, testName, DEVICE, returnString, testPassed):
ret = testcommons.sendFeedback(testPath, testName, DEVICE, returnString, testPassed)
set_return(ret)
def startTest(testName, DEVICE, params):
#get the path of this script
testcommons.print_pio()
import inspect
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 #######
#########################################
print_log(testName, DEVICE, 'testpath A: ' + testPath )
print_log(testName, DEVICE, 'parameters: ' + str(params) )
print_log(testName, DEVICE, 'device: ' + DEVICE )
#scan = ManualScan(['time'], ['SetV', 'ActualV', 'ActualI'] , [0.0], [30.0], [20])
scan = ManualScan(['time'], ['SetV', 'ActualV', 'ActualI'])
scan.setPlotName(plotName)
scan.start()
try:
#Creating channels: dimension 1
#Ramp rate
SetRamp = Channel(DEVICE + ':Set-RampA', type = 'd')
#SetRamp = Channel('pw84:ai', type = 'd')
#LinearPositioner SetV
SetV = Channel(DEVICE + ':Set-VA', type = 'd')
#SetV = Channel('pw84:ai', type = 'd')
#Timestamp time
#ScalarDetector ActualV
ActualV = Channel(DEVICE + ':Actual-VA', type = 'd')
#ActualV = Channel('pw84:ai', type = 'd')
#ScalarDetector ActualI
ActualI = Channel(DEVICE + ':Actual-IA', type = 'd')
#ActualI = Channel('pw84:ai', type = 'd')
except:
import traceback
sendFeedback(testPath, testName, DEVICE, 'Unable to create channel - ' + traceback.format_exc(), False)
#raise Exception('Unable to create channel - ' + traceback.format_exc())
return
#Init
SetRamp.put(10.0, timeout=None)
#set voltage to 0
print_log(testName, DEVICE, 'Ramping down power supply A to 0V' )
SetV.put(0.0, timeout=None)
#wait up to 2 minutes for voltage to be ~0
for setpoint1 in frange(0.0, 120.0, 1.0, True):
detector2 = ActualV.get()
if detector2 <= 1.0:
break
sleep(0.5)
#Dimension 1
#LinearPositioner SetV
print_log(testName, DEVICE, 'Ramping up power supply A' )
for setpoint1 in frange(0.0, 20.0, 5.0, True):
if setpoint1 > 50.0 or setpoint1 < 0.0:
break
SetV.put(setpoint1, timeout=None) # TODO: Set appropriate timeout
readback1 = SetV.get()
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
break
#scan quickly the output during some seconds
for setpoint2 in range(0, 20):
#Detector time
detector1 = float(java.lang.System.currentTimeMillis())
#Detector ActualV
detector2 = ActualV.get()
detector3 = ActualI.get()
#scan.append ([setpoint1], [readback1], [detector1, detector2])
#append(setpoints, positions, values)
scan.append ([detector1], [detector1], [readback1, detector2, detector3])
sleep( 0.1 ) # Settling time
ret = 'Test ps A completed'
status = True
#reset output to 0V
SetV.put(0.0, timeout=None)
#Closing channels
SetV.close()
ActualV.close()
ActualI.close()
scan.end()
#########################################
############# END OF YOUR CODE ##########
#########################################
###### DO NOT MODIFY THE CODE BELOW #####
#########################################
sendFeedback(testPath, testName, DEVICE, ret, status)
#launch the test
#parameters = {}
startTest(test, device, parameters)
@@ -0,0 +1,124 @@
#########################################
###### DO NOT MODIFY THE CODE BELOW #####
#########################################
global print_log, sendFeedback, 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)
#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):
#get the path of this script
import inspect
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 #######
#########################################
print_log(testName, DEVICE, 'testpath A: ' + testPath )
print_log(testName, DEVICE, 'parameters: ' + str(params) )
print_log(testName, DEVICE, 'device: ' + DEVICE )
#scan = ManualScan(['time'], ['SetV', 'ActualV', 'ActualI'] , [0.0], [30.0], [20])
scan = ManualScan(['time'], ['SetV', 'ActualV', 'ActualI'])
scan.setPlotName(plotName)
scan.start()
try:
#Creating channels: dimension 1
#Ramp rate
SetRamp = Channel(DEVICE + ':Set-RampA', type = 'd')
#SetRamp = Channel('pw84:ai', type = 'd')
#LinearPositioner SetV
SetV = Channel(DEVICE + ':Set-VA', type = 'd')
#SetV = Channel('pw84:ai', type = 'd')
#Timestamp time
#ScalarDetector ActualV
ActualV = Channel(DEVICE + ':Actual-VA', type = 'd')
#ActualV = Channel('pw84:ai', type = 'd')
#ScalarDetector ActualI
ActualI = Channel(DEVICE + ':Actual-IA', type = 'd')
#ActualI = Channel('pw84:ai', type = 'd')
except:
import traceback
sendFeedback(testPath, testName, DEVICE, 'Unable to create channel - ' + traceback.format_exc(), False)
#raise Exception('Unable to create channel - ' + traceback.format_exc())
return
#Init
SetRamp.put(10.0, timeout=None)
#set voltage to 0
print_log(testName, DEVICE, 'Ramping down power supply A to 0V' )
SetV.put(0.0, timeout=None)
#wait up to 2 minutes for voltage to be ~0
for setpoint1 in frange(0.0, 120.0, 1.0, True):
detector2 = ActualV.get()
if detector2 <= 1.0:
break
sleep(0.5)
#Dimension 1
#LinearPositioner SetV
print_log(testName, DEVICE, 'Ramping up power supply A' )
for setpoint1 in frange(0.0, 20.0, 5.0, True):
if setpoint1 > 50.0 or setpoint1 < 0.0:
break
SetV.put(setpoint1, timeout=None) # TODO: Set appropriate timeout
readback1 = SetV.get()
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
break
#scan quickly the output during some seconds
for setpoint2 in range(0, 20):
#Detector time
detector1 = float(java.lang.System.currentTimeMillis())
#Detector ActualV
detector2 = ActualV.get()
detector3 = ActualI.get()
#scan.append ([setpoint1], [readback1], [detector1, detector2])
#append(setpoints, positions, values)
scan.append ([detector1], [detector1], [readback1, detector2, detector3])
sleep( 0.1 ) # Settling time
ret = 'Test ps A completed'
status = True
#reset output to 0V
SetV.put(0.0, timeout=None)
#Closing channels
SetV.close()
ActualV.close()
ActualI.close()
scan.end()
#########################################
############# END OF YOUR CODE ##########
#########################################
###### DO NOT MODIFY THE CODE BELOW #####
#########################################
sendFeedback(testPath, testName, DEVICE, ret, status)
#launch the test
#parameters = {}
startTest(test, device, parameters)
@@ -0,0 +1,117 @@
#########################################
###### DO NOT MODIFY THE CODE BELOW #####
#########################################
global print_log, sendFeedback, sys, inspect, os, traceback, testcommons
import sys, inspect, os, traceback, testcommons
def print_log(testName, DEVICE, text):
testcommons.print_log(testName, DEVICE, text)
def sendFeedback(testPath, testName, DEVICE, returnString, testPassed):
ret = testcommons.sendFeedback(testPath, testName, DEVICE, returnString, testPassed)
set_return(ret)
def startTest(testName, DEVICE, params):
#get the path of this script
test = testcommons.TestingTool(testName, DEVICE)
test.print_pio()
import inspect
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 #######
#########################################
print_log(testName, DEVICE, 'testpath A: ' + testPath )
print_log(testName, DEVICE, 'parameters: ' + str(params) )
print_log(testName, DEVICE, 'device: ' + DEVICE )
#scan = ManualScan(['time'], ['SetV', 'ActualV', 'ActualI'] , [0.0], [30.0], [20])
scan = ManualScan(['time'], ['SetV', 'ActualV', 'ActualI'])
scan.setPlotName(plotName)
scan.start()
try:
#Creating channels: dimension 1
#Ramp rate
SetRamp = Channel(DEVICE + ':Set-RampA', type = 'd')
#SetRamp = Channel('pw84:ai', type = 'd')
#LinearPositioner SetV
SetV = Channel(DEVICE + ':Set-VA', type = 'd')
#SetV = Channel('pw84:ai', type = 'd')
#Timestamp time
#ScalarDetector ActualV
ActualV = Channel(DEVICE + ':Actual-VA', type = 'd')
#ActualV = Channel('pw84:ai', type = 'd')
#ScalarDetector ActualI
ActualI = Channel(DEVICE + ':Actual-IA', type = 'd')
#ActualI = Channel('pw84:ai', type = 'd')
except:
import traceback
sendFeedback(testPath, testName, DEVICE, 'Unable to create channel - ' + traceback.format_exc(), False)
#raise Exception('Unable to create channel - ' + traceback.format_exc())
return
#Init
SetRamp.put(10.0, timeout=None)
#set voltage to 0
print_log(testName, DEVICE, 'Ramping down power supply A to 0V' )
SetV.put(0.0, timeout=None)
#wait up to 2 minutes for voltage to be ~0
for setpoint1 in frange(0.0, 120.0, 1.0, True):
detector2 = ActualV.get()
if detector2 <= 1.0:
break
sleep(0.5)
#Dimension 1
#LinearPositioner SetV
print_log(testName, DEVICE, 'Ramping up power supply A' )
for setpoint1 in frange(0.0, 20.0, 5.0, True):
if setpoint1 > 50.0 or setpoint1 < 0.0:
break
SetV.put(setpoint1, timeout=None) # TODO: Set appropriate timeout
readback1 = SetV.get()
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
break
#scan quickly the output during some seconds
for setpoint2 in range(0, 20):
#Detector time
detector1 = float(java.lang.System.currentTimeMillis())
#Detector ActualV
detector2 = ActualV.get()
detector3 = ActualI.get()
#scan.append ([setpoint1], [readback1], [detector1, detector2])
#append(setpoints, positions, values)
scan.append ([detector1], [detector1], [readback1, detector2, detector3])
sleep( 0.1 ) # Settling time
ret = 'Test ps A completed'
status = True
#reset output to 0V
SetV.put(0.0, timeout=None)
#Closing channels
SetV.close()
ActualV.close()
ActualI.close()
scan.end()
#########################################
############# END OF YOUR CODE ##########
#########################################
###### DO NOT MODIFY THE CODE BELOW #####
#########################################
sendFeedback(testPath, testName, DEVICE, ret, status)
#launch the test
#parameters = {}
startTest(test, device, parameters)
@@ -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,112 @@
###### Init - DO NOT MODIFY THE CODE BELOW ######
global print_log, sendFeedback, 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 + ': ' + 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):
#get the path of this script
import inspect
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 #############
print_log(testName, DEVICE, 'testpath B: ' + testPath )
print_log(testName, DEVICE, 'parameters:' + str( params) )
print_log(testName, DEVICE, 'device: ' + DEVICE )
#scan = ManualScan(['time'], ['SetVB', 'ActualVB', 'ActualIB'] , [0.0], [30.0], [20])
scan = ManualScan(['time'], ['SetVB', 'ActualVB', 'ActualIB'] )
scan.setPlotName(plotName)
scan.start()
#Creating channels: dimension 1
try:
#Ramp rate
SetRamp = Channel(DEVICE + ':Set-RampB', type = 'd')
#SetRamp = Channel('pw84:ai', type = 'd')
#LinearPositioner SetVA
SetVA = Channel(DEVICE + ':Set-VB', type = 'd')
#SetVA = Channel('pw84:ai', type = 'd')
#Timestamp time
#ScalarDetector ActualVA
ActualVA = Channel(DEVICE + ':Actual-VB', type = 'd')
#ActualVA = Channel('pw84:ai', type = 'd')
#ScalarDetector ActualIA
ActualIA = Channel(DEVICE + ':Actual-IB', type = 'd')
#ActualIA = Channel('pw84:ai', type = 'd')
except:
sendFeedback(testPath, testName, DEVICE, 'Unable to create channel - ' + traceback.format_exc(), False)
return
#Init
SetRamp.put(10.0, timeout=None)
#set voltage to 0
print_log(testName, DEVICE, 'Ramping down power supply B to 0V')
SetVA.put(0.0, timeout=None)
#wait up to 2 minutes for voltage to be ~0
for setpoint1 in frange(0.0, 120.0, 1.0, True):
detector2 = ActualVA.get()
if detector2 <= 1.0:
break
sleep(0.5)
#Dimension 1
#LinearPositioner SetVA
print_log(testName, DEVICE, 'Ramping up power supply')
for setpoint1 in frange(0.0, 20.0, 5.0, True):
if setpoint1 > 50.0 or setpoint1 < 0.0:
break
SetVA.put(setpoint1, timeout=None) # TODO: Set appropriate timeout
readback1 = SetVA.get()
if abs(readback1 - setpoint1) > 0.9 : # TODO: Check accuracy
raise Exception('SetVB could not be set to the value ' + str(setpoint1))
ret = 'SetVB could not be set to the value ' + str(setpoint1) + '(measured value: '+str(readback1)+')'
status = False
break
#scan quickly the output during some seconds
for setpoint2 in range(0, 20):
#Detector time
detector1 = float(java.lang.System.currentTimeMillis())
#Detector ActualVA
detector2 = ActualVA.get()
detector3 = ActualIA.get()
#scan.append ([setpoint1], [readback1], [detector1, detector2])
#append(setpoints, positions, values)
scan.append ([detector1], [detector1], [readback1, detector2, detector3])
sleep( 0.1 ) # Settling time
ret = 'Test ps B completed'
status = True
#reset output to 0V
SetVA.put(0.0, timeout=None)
#Closing channels
SetVA.close()
ActualVA.close()
ActualIA.close()
################ END OF YOUR CODE ################
###### Final - DO NOT MODIFY THE CODE BELOW ######
sendFeedback(testPath, testName, DEVICE, ret, status)
#launch the test
parameters = {}
startTest(test, device, parameters)
@@ -0,0 +1,8 @@
name=Calibrate
description=Initialises the motor
help = \
This test sends a INIT command to the device, as many times as configured with the parameter RepeatTimes.
#optional parameters. Description is compulsory. Syntax:
#parameters=<parameter1Name>:<parameter1Value>:<Parameter 1 description>[;<parameter2Name>:<parameter2Value>:<Parameter 2 description>]
parameters=repeatTimes:2:Repeat N times;delayS:4:Delay between each initialisation [s]
@@ -0,0 +1,143 @@
###### DO NOT MODIFY THE CODE BELOW ######
global print_log, sendFeedback, inspect, log, 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)
#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,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, log, 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)
#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,3 @@
name=Check Status
description=Checks the drive status
filename=Check Status.xml
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration xmlns="http://www.psi.ch/~ebner/models/scan/1.0">
<data fileName="Check Status.fda"/>
<scan>
<dimension>
<!-- Set up a Pseudo Positioner that samples every 50ms for 70 samples -->
<positioner xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="PseudoPositioner" settlingTime="0.1" id="id000000">
<counts>3000</counts>
</positioner>
<!-- Motor Drive Status -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="PO2TC-NCS-{DEVICE}:MOTOR.MSTA" id="id000001"/>
<!-- Position Counter: Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="PO2TC-NCS-{DEVICE}:MOTOR.RVAL" id="id000002"/>
<!-- Position Counter: Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="PO2TC-NCS-{DEVICE}:MOTOR.VAL" id="id000003"/>
<!-- Motor Home Switch -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="PO2TC-NCS-{DEVICE}:MOTOR.ATHM" id="id000004"/>
<!-- Enocder Raw -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="PO2TC-NCS-{DEVICE}:ENCODERraw" id="id000005"/>
<!-- Encoder Processed -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="PO2TC-NCS-{DEVICE}:ENCODER" id="id000006"/>
<!-- Ready -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="PO2TC-NCS-{DEVICE}:RDY" id="id000007"/>
<!-- Interlock -->
<detector xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScalarDetector" name="PO2TC-NCS-{DEVICE}:ILK" id="id000008"/>
</dimension>
<manipulation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ScriptManipulation" id="id000009">
<mapping xsi:type="IDParameterMapping" refid="id000006" variable="a"/>
<mapping xsi:type="IDParameterMapping" refid="id000003" variable="b"/>
<script>def process(a,b):
return a-b</script>
</manipulation>
</scan>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000001" title="Motor Status (MSTA)"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000002" title="Motor Step Count (RVAL)"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000003" title="Motor Position (VAL)" />
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000004" title="Motor Home Switch (ATHM)"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000005" title="Encoder Count (ENCODERraw)"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000006" title="Encoder Position (ENCODER)"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000009" title="Motor/Encoder Diff"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000007" title="Drive Ready (RDY)"/>
<visualization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinePlot" x="id000000" y="id000008" title="Drive interlock (ILK)"/>
</configuration>
@@ -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, log, 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)
#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>
@@ -0,0 +1,4 @@
#Tue Sep 01 11:44:04 CEST 2015
name=feffeefe
parameters=examplePar1\:2\:This is the parameter n.1 with unit [unit];examplePar2\:4.5\:This is the parameter n.2 with unit [unit];
description=dvfsdf
@@ -0,0 +1,119 @@
#feffeefe
#dvfsdf
###### Init - DO NOT MODIFY THE CODE BELOW ######
global print_log, sendFeedback, inspect, log, 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):
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 #############
#All the code here in this section ## ..YOUR CODE.. ## can be modified/deleted.
# INPUTS:
#If needed, the following variables are available:
#testPath string, path of this test file
#testName string, name of this test
#DEVICE string, device for which the test must run (typically it is the beginning of a process variable name)
#params dictionary, a set of key-value parameters specific to the test.
# Syntax: params["<key>"]["value"]
# Example: access the parameter called midPoint and store it in a new variable:
# middlePoint = params["midPoint"]["value"]
# OUTPUTS:
#ret string, a text summarizing the result of the test. It must be set before the end of your code.
#success bool, True = test successful. It must be set before the end of your code.
#Example (can be removed): print the list of parameters passed. If any error, stop and send feedback
print_log(testName, DEVICE, "Example - Test name: "+testName):
print_log(testName, DEVICE, "Example - Device name: "+DEVICE):
try:
print_log(testName, DEVICE, "Running test Initialise with the following parameters:")
print_log(testName, DEVICE, params )
#If present, use the parameters here below for your test script
examplePar1 = float(params["examplePar1"]["value"]) ; examplePar2 = float(params["examplePar2"]["value"]) ;
except:
ret = 'Could not retrieve testing parameters - ' + traceback.format_exc()
success = False
sendFeedback(testPath, testName, DEVICE, ret, success)
return
#example: loop to read channels for a while and plot the channels values.
#initialise plot tab with 2 plots
scan = ManualScan(['sample'], ['Motor Status (MSTA)', 'Motor Position (VAL)'] )
#set plot name(tab title)
scan.setPlotName(plotName)
#start plots. See further below how to add points to the plots
scan.start()
#IMPORTANT: if the test resulted with an error, write the following:
ret = "Example - Error, the test failed because...."
success = False
#IMPORTANT: if the test was successful, write the following:
ret = "Example - Test successful, here some detail: ..."
success = True
#set up connection to channels. "type" of data can be "d" (= double), "l" (= long)
try:
pv_motor_msta = Channel(DEVICE+':MOTOR.MSTA', type = 'd')
pv_motor_val = Channel(DEVICE+':MOTOR.VAL' , type = 'd')
except:
#prepare return information: return text
ret = 'Unable to create channel - ' + traceback.format_exc()
#prepare return information: return success
success = False
#send return information
sendFeedback(testPath, testName, DEVICE, ret, success)
return
#take 100 samples of the channels
for sample in range(0, 100):
readback1 = sample
sleep( 0.1 ) # Settling time
#get value
motor_msta = pv_motor_msta.get()
#get value
motor_val = pv_motor_val.get()
#add values to plot
scan.append ([sample], [readback1], [detmotor_msta, motor_val] )
#Closing channels
pv_motor_msta.close()
pv_motor_val.close()
#once the test is finished, no need to do anything. The code below yours will do the rest.
################ 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,15 @@
<html>
<body>
<h2>Short Description</h2>
dvfsdf
<h2>Details</h2>
Add here the detailed description of the test, with reference to the parameters (if any).
<h2>Parameters</h2>
<code>examplePar1 </code>This is the parameter n.1 with unit [unit]<br/>
<code>examplePar2 </code>This is the parameter n.2 with unit [unit]<br/>
<h2>Contact</h2>
<a href="https://intranet.psi.ch/search/#?t=phonebook&q=dfsdfd">dfsdfd</a>
</html>
</body>
+4
View File
@@ -0,0 +1,4 @@
#Tue Sep 01 11:58:14 CEST 2015
name=ef
parameters=examplePar1\:2\:This is the parameter n.1 with unit [unit];examplePar2\:4.5\:This is the parameter n.2 with unit [unit];
description=wedwee
+119
View File
@@ -0,0 +1,119 @@
#ef
#wedwee
###### Init - DO NOT MODIFY THE CODE BELOW ######
global print_log, sendFeedback, inspect, log, 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):
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 #############
#All the code here in this section ## ..YOUR CODE.. ## can be modified/deleted.
# INPUTS:
#If needed, the following variables are available:
#testPath string, path of this test file
#testName string, name of this test
#DEVICE string, device for which the test must run (typically it is the beginning of a process variable name)
#params dictionary, a set of key-value parameters specific to the test.
# Syntax: params["<key>"]["value"]
# Example: access the parameter called midPoint and store it in a new variable:
# middlePoint = params["midPoint"]["value"]
# OUTPUTS:
#ret string, a text summarizing the result of the test. It must be set before the end of your code.
#success bool, True = test successful. It must be set before the end of your code.
#Example (can be removed): print the list of parameters passed. If any error, stop and send feedback
print_log(testName, DEVICE, "Example - Test name: "+testName):
print_log(testName, DEVICE, "Example - Device name: "+DEVICE):
try:
print_log(testName, DEVICE, "Running test Initialise with the following parameters:")
print_log(testName, DEVICE, params )
#If present, use the parameters here below for your test script
examplePar1 = float(params["examplePar1"]["value"]) ; examplePar2 = float(params["examplePar2"]["value"]) ;
except:
ret = 'Could not retrieve testing parameters - ' + traceback.format_exc()
success = False
sendFeedback(testPath, testName, DEVICE, ret, success)
return
#example: loop to read channels for a while and plot the channels values.
#initialise plot tab with 2 plots
scan = ManualScan(['sample'], ['Motor Status (MSTA)', 'Motor Position (VAL)'] )
#set plot name(tab title)
scan.setPlotName(plotName)
#start plots. See further below how to add points to the plots
scan.start()
#IMPORTANT: if the test resulted with an error, write the following:
ret = "Example - Error, the test failed because...."
success = False
#IMPORTANT: if the test was successful, write the following:
ret = "Example - Test successful, here some detail: ..."
success = True
#set up connection to channels. "type" of data can be "d" (= double), "l" (= long)
try:
pv_motor_msta = Channel(DEVICE+':MOTOR.MSTA', type = 'd')
pv_motor_val = Channel(DEVICE+':MOTOR.VAL' , type = 'd')
except:
#prepare return information: return text
ret = 'Unable to create channel - ' + traceback.format_exc()
#prepare return information: return success
success = False
#send return information
sendFeedback(testPath, testName, DEVICE, ret, success)
return
#take 100 samples of the channels
for sample in range(0, 100):
readback1 = sample
sleep( 0.1 ) # Settling time
#get value
motor_msta = pv_motor_msta.get()
#get value
motor_val = pv_motor_val.get()
#add values to plot
scan.append ([sample], [readback1], [detmotor_msta, motor_val] )
#Closing channels
pv_motor_msta.close()
pv_motor_val.close()
#once the test is finished, no need to do anything. The code below yours will do the rest.
################ 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)
+15
View File
@@ -0,0 +1,15 @@
<html>
<body>
<h2>Short Description</h2>
wedwee
<h2>Details</h2>
Add here the detailed description of the test, with reference to the parameters (if any).
<h2>Parameters</h2>
<code>examplePar1 </code>This is the parameter n.1 with unit [unit]<br/>
<code>examplePar2 </code>This is the parameter n.2 with unit [unit]<br/>
<h2>Contact</h2>
<a href="https://intranet.psi.ch/search/#?t=phonebook&q=deefe">deefe</a>
</html>
</body>
+4
View File
@@ -0,0 +1,4 @@
#Wed Sep 02 09:25:34 CEST 2015
name=huihi
parameters=examplePar1\:2\:This is the parameter n.1 with unit [unit];examplePar2\:4.5\:This is the parameter n.2 with unit [unit];
description=ghjkg
+13
View File
@@ -0,0 +1,13 @@
<html>
<body>
<h2>Description</h2>
ghjkg
<h2>Parameters</h2>
<code>examplePar1 </code>This is the parameter n.1 with unit [unit]<br/>
<code>examplePar2 </code>This is the parameter n.2 with unit [unit]<br/>
<h2>Contact</h2>
<a href="https://intranet.psi.ch/search/#?t=phonebook&q=jlkljlkj">jlkljlkj</a>
</html>
</body>
+119
View File
@@ -0,0 +1,119 @@
#Test name: huihi
#ghjkg
###### Init - DO NOT MODIFY THE CODE BELOW ######
global print_log, sendFeedback, inspect, log, 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):
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 #############
#All the code here in this section ## ..YOUR CODE.. ## can be modified/deleted.
# INPUTS:
#If needed, the following variables are available:
#testPath string, path of this test file
#testName string, name of this test
#DEVICE string, device for which the test must run (typically it is the beginning of a process variable name)
#params dictionary, a set of key-value parameters specific to the test.
# Syntax: params["<key>"]["value"]
# Example: access the parameter called midPoint and store it in a new variable:
# middlePoint = params["midPoint"]["value"]
# OUTPUTS:
#ret string, a text summarizing the result of the test. It must be set before the end of your code.
#success bool, True = test successful. It must be set before the end of your code.
#Example (can be removed): print the list of parameters passed. If any error, stop and send feedback
print_log(testName, DEVICE, "Example - Test name: "+testName):
print_log(testName, DEVICE, "Example - Device name: "+DEVICE):
try:
print_log(testName, DEVICE, "Running test Initialise with the following parameters:")
print_log(testName, DEVICE, params )
#If present, use the parameters here below for your test script
examplePar1 = float(params["examplePar1"]["value"]) ; examplePar2 = float(params["examplePar2"]["value"]) ;
except:
ret = 'Could not retrieve testing parameters - ' + traceback.format_exc()
success = False
sendFeedback(testPath, testName, DEVICE, ret, success)
return
#example: loop to read channels for a while and plot the channels values.
#initialise plot tab with 2 plots
scan = ManualScan(['sample'], ['Motor Status (MSTA)', 'Motor Position (VAL)'] )
#set plot name(tab title)
scan.setPlotName(plotName)
#start plots. See further below how to add points to the plots
scan.start()
#IMPORTANT: if the test resulted with an error, write the following:
ret = "Example - Error, the test failed because...."
success = False
#IMPORTANT: if the test was successful, write the following:
ret = "Example - Test successful, here some detail: ..."
success = True
#set up connection to channels. "type" of data can be "d" (= double), "l" (= long)
try:
pv_motor_msta = Channel(DEVICE+':MOTOR.MSTA', type = 'd')
pv_motor_val = Channel(DEVICE+':MOTOR.VAL' , type = 'd')
except:
#prepare return information: return text
ret = 'Unable to create channel - ' + traceback.format_exc()
#prepare return information: return success
success = False
#send return information
sendFeedback(testPath, testName, DEVICE, ret, success)
return
#take 100 samples of the channels
for sample in range(0, 100):
readback1 = sample
sleep( 0.1 ) # Settling time
#get value
motor_msta = pv_motor_msta.get()
#get value
motor_val = pv_motor_val.get()
#add values to plot
scan.append ([sample], [readback1], [detmotor_msta, motor_val] )
#Closing channels
pv_motor_msta.close()
pv_motor_val.close()
#once the test is finished, no need to do anything. The code below yours will do the rest.
################ 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)

Some files were not shown because too many files have changed in this diff Show More