Startup
This commit is contained in:
19
.gitignore
vendored
19
.gitignore
vendored
@@ -1,11 +1,10 @@
|
||||
/context
|
||||
/data
|
||||
/extensions
|
||||
/log
|
||||
/sessions
|
||||
/www
|
||||
script/cachedir
|
||||
/*
|
||||
!/script
|
||||
!/plugins
|
||||
!/devices
|
||||
!/config
|
||||
script/Lib
|
||||
script/*.class
|
||||
script/*.pyc
|
||||
plugins/*.class
|
||||
script/**/cachedir
|
||||
script/**/*.class
|
||||
script/**/*.pyc
|
||||
plugins/*.class
|
||||
@@ -1,10 +1,8 @@
|
||||
#Fri Jul 03 14:34:59 CEST 2015
|
||||
#Tue Aug 04 11:09:00 CEST 2015
|
||||
autoSaveScanData=true
|
||||
createSessionFiles=false
|
||||
dataFile={data}/{year}_{month}/{date}/{date}_{time}_{context}
|
||||
dataFileName={data}/{year}_{month}/{date}/{date}_{time}_{context}
|
||||
dataFilesCreation=true
|
||||
dataPath={data}/{year}_{month}/{date}/{date}_{time}_{context}
|
||||
dataPath={data}/{year}_{month}/{date}/{date}_{time}_{exec}
|
||||
dataProvider=text
|
||||
dataScanFlushRecords=false
|
||||
dataScanStrategy=table
|
||||
@@ -21,6 +19,8 @@ simulation=false
|
||||
tasksFile={config}/tasks.properties
|
||||
terminalEnabled=true
|
||||
terminalPort=3579
|
||||
versionTrackingEnabled=false
|
||||
userAuthenticator=
|
||||
userManagement=false
|
||||
versionTrackingEnabled=true
|
||||
versionTrackingLogin={config}/agkey
|
||||
versionTrackingRemote=ssh\://git@github.psi.ch\:7999/psd/ncs.git
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
ch.psi.jcae.ContextFactory.addressList=129.129.144.80 129.129.130.188 129.129.145.206:54321
|
||||
ch.psi.jcae.ContextFactory.addressList=129.129.144.80 129.129.130.188 172.25.60.255 172.25.60.102 129.129.145.206:54321
|
||||
ch.psi.jcae.ContextFactory.maxArrayBytes=10000000
|
||||
|
||||
ch.psi.jcae.ChannelFactory.timeout=2000
|
||||
|
||||
@@ -32,6 +32,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Vector;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.logging.FileHandler;
|
||||
import java.util.logging.SimpleFormatter;
|
||||
import javax.swing.DefaultCellEditor;
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 16 KiB |
@@ -1,97 +1,136 @@
|
||||
#Script imported from: Calibrate.xml
|
||||
|
||||
ret = 'Test failed'
|
||||
status = False
|
||||
###### 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('PO2DV-NCS-'+DEVICE+':INIT.PROC', '1')
|
||||
except:
|
||||
print "Unexpected error:", sys.exc_info()[0]
|
||||
ret = 'Unable to create channel'
|
||||
success = False
|
||||
raise
|
||||
sys.exit()
|
||||
#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()
|
||||
#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('PO2DV-NCS-'+DEVICE+':MOTOR.MSTA', type = 'd')
|
||||
#ScalarDetector id000002
|
||||
id000002 = Channel('PO2DV-NCS-'+DEVICE+':MOTOR.RVAL', type = 'd')
|
||||
#ScalarDetector id000003
|
||||
id000003 = Channel('PO2DV-NCS-'+DEVICE+':MOTOR.VAL', type = 'd')
|
||||
#ScalarDetector id000004
|
||||
id000004 = Channel('PO2DV-NCS-'+DEVICE+':MOTOR.ATHM', type = 'd')
|
||||
#ScalarDetector id000005
|
||||
id000005 = Channel('PO2DV-NCS-'+DEVICE+':MOTOR.LLS', type = 'd')
|
||||
#ScalarDetector id000006
|
||||
id000006 = Channel('PO2DV-NCS-'+DEVICE+':MOTOR.HLS', type = 'd')
|
||||
#ScalarDetector id000007
|
||||
id000007 = Channel('PO2DV-NCS-'+DEVICE+':ENCODERraw', type = 'd')
|
||||
#ScalarDetector id000008
|
||||
id000008 = Channel('PO2DV-NCS-'+DEVICE+':ENCODER', type = 'd')
|
||||
#ScalarDetector id000009
|
||||
id000009 = Channel('PO2DV-NCS-'+DEVICE+':RDY', type = 'd')
|
||||
#ScalarDetector id000010
|
||||
id000010 = Channel('PO2DV-NCS-'+DEVICE+':ILK', type = 'd')
|
||||
#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])
|
||||
#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()
|
||||
#Closing channels
|
||||
id000001.close()
|
||||
id000002.close()
|
||||
id000003.close()
|
||||
id000004.close()
|
||||
id000005.close()
|
||||
id000006.close()
|
||||
id000007.close()
|
||||
id000008.close()
|
||||
id000009.close()
|
||||
id000010.close()
|
||||
|
||||
scan.end()
|
||||
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)
|
||||
|
||||
@@ -1,154 +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
|
||||
|
||||
import traceback
|
||||
###### DO NOT MODIFY THE CODE BELOW ######
|
||||
import sys, inspect, os, traceback, time
|
||||
global print_log, sendFeedback
|
||||
|
||||
#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())
|
||||
#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
|
||||
|
||||
#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()
|
||||
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
|
||||
|
||||
#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
|
||||
####### 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
|
||||
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
|
||||
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)
|
||||
@@ -1,185 +1,192 @@
|
||||
#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
|
||||
import sys, inspect, os, traceback, time
|
||||
|
||||
|
||||
###### DO NOT MODIFY THE CODE BELOW ######
|
||||
import sys, inspect, os, traceback, time
|
||||
global print_log, sendFeedback
|
||||
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
|
||||
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
|
||||
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(['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()
|
||||
#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
|
||||
|
||||
#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, status)
|
||||
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)
|
||||
#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, 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( 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, status)
|
||||
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
|
||||
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)
|
||||
#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
|
||||
|
||||
########## END OF YOUR CODE ###########
|
||||
#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, status)
|
||||
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):
|
||||
@@ -196,11 +203,9 @@ def print_log(testName, DEVICE, text):
|
||||
time.ctime()
|
||||
now = time.strftime('%Y.%m.%d %H:%M:%S')
|
||||
print now + ' ' + DEVICE + ' - ' + testName + ': ' + text
|
||||
|
||||
|
||||
#get test arguments
|
||||
DEVICE = device
|
||||
testName = test
|
||||
params = parameters
|
||||
#launch the test
|
||||
startTest(testName, DEVICE, params)
|
||||
#from pshellTestGeneral import testUtils
|
||||
#testUtil = testUtils()
|
||||
#testUtil.print_log(test, device, "CLASSE!!!")
|
||||
startTest(test, device, parameters)
|
||||
|
||||
@@ -1,7 +1,27 @@
|
||||
|
||||
###### 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 + ': ' + 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'
|
||||
@@ -9,10 +29,11 @@ def startTest(testName, DEVICE, params):
|
||||
#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, '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'] , [0.0], [30.0], [20])
|
||||
scan = ManualScan(['time'], ['SetV', 'ActualV', 'ActualI'])
|
||||
scan.setPlotName(plotName)
|
||||
scan.start()
|
||||
|
||||
@@ -32,6 +53,7 @@ def startTest(testName, DEVICE, params):
|
||||
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
|
||||
@@ -85,32 +107,12 @@ def startTest(testName, DEVICE, params):
|
||||
ActualI.close()
|
||||
|
||||
scan.end()
|
||||
########## END OF YOUR CODE ###########
|
||||
|
||||
############# 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)
|
||||
parameters = {}
|
||||
startTest(test, device, parameters)
|
||||
|
||||
@@ -1,18 +1,39 @@
|
||||
|
||||
###### DO NOT MODIFY THE CODE BELOW ######
|
||||
###### Init - 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 + ': ' + 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 #######
|
||||
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])
|
||||
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()
|
||||
|
||||
@@ -33,7 +54,6 @@ def startTest(testName, DEVICE, params):
|
||||
#ActualIA = Channel('pw84:ai', type = 'd')
|
||||
except:
|
||||
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)
|
||||
@@ -82,31 +102,11 @@ def startTest(testName, DEVICE, params):
|
||||
SetVA.close()
|
||||
ActualVA.close()
|
||||
ActualIA.close()
|
||||
########## END OF YOUR CODE ###########
|
||||
|
||||
###### DO NOT MODIFY THE CODE BELOW ######
|
||||
################ END OF YOUR CODE ################
|
||||
###### Final - 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)
|
||||
parameters = {}
|
||||
startTest(test, device, parameters)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user