Startup
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
name=Monitor Movement
|
||||
description=Monitor the movements during the specified time interval. No commands are sent.
|
||||
|
||||
|
||||
#optional parameters. Description is compulsory. Syntax:
|
||||
#parameters=<parameter1Name>:<parameter1Value>:<Parameter 1 description>[;<parameter2Name>:<parameter2Value>:<Parameter 2 description>]
|
||||
parameters=monitorTime:40:Monitor time interval [s]
|
||||
@@ -1,91 +0,0 @@
|
||||
|
||||
###### 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
|
||||
|
||||
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
|
||||
|
||||
import sys, inspect, os, traceback
|
||||
#get test arguments
|
||||
DEVICE = device
|
||||
testName = test
|
||||
params = parameters
|
||||
#launch the test
|
||||
startTest(testName, DEVICE, params)
|
||||
Reference in New Issue
Block a user