Closedown

This commit is contained in:
boccioli_m
2015-07-02 13:51:01 +02:00
parent e5355b7000
commit a3bc44ae37
6 changed files with 74 additions and 71 deletions

View File

@@ -14,8 +14,7 @@ def startTest(testName, DEVICE, params):
#get parameters from the calling interface
try:
print "Running test Motor Test 2 for device " + DEVICE + " with the following parameters:"
print params
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"])
@@ -85,7 +84,7 @@ def startTest(testName, DEVICE, params):
endDefault = middle + span
end = endDefault+1
#find position: it will be the middle point of the test
print 'Moving to middle point ' + str(middle)
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
@@ -96,7 +95,7 @@ def startTest(testName, DEVICE, params):
start = readback2+direction
countSteps = 0
count = 0
print 'Moving arond middle point (+-' + str(span) + ')'
print_log(testName, DEVICE, 'Moving around middle point (+-' + str(span) + ')' )
for setpoint1 in range(0, loopTimes*2):
count = count + 1
sleep( 2 ) # Settling time
@@ -147,14 +146,14 @@ def startTest(testName, DEVICE, params):
end = startDefault-1
start = setpoint2 - direction
direction = -1.0
print 'End of span (' + str(setpoint2) + '), changing direction to ' + str(direction)
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 'End of span (' + str(setpoint2) + '), changing direction to ' + str(direction)
print_log(testName, DEVICE, 'End of span (' + str(setpoint2) + '), changing direction to ' + str(direction) )
break
#set limits back
@@ -183,15 +182,20 @@ def startTest(testName, DEVICE, params):
#prepare and send feedback to calling tool
def sendFeedback(testPath, testName, DEVICE, returnString, testPassed):
print 'End of test. Result:'
print 'Test path: ' + testPath
print 'Test name: ' + testName
print 'Device: ' + DEVICE
print 'Test passed: ' + str(testPassed)
print 'Return string: ' + returnString
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

View File

@@ -33,7 +33,7 @@ def startTest(testName, DEVICE, params):
ActualI = Channel(DEVICE + ':Actual-IA', type = 'd')
#ActualI = Channel('pw84:ai', type = 'd')
except:
sendFeedback(testPath, DEVICE, 'Unable to create channel - ' + traceback.format_exc(), False)
sendFeedback(testPath, testName, DEVICE, 'Unable to create channel - ' + traceback.format_exc(), False)
#raise Exception('Unable to create channel - ' + traceback.format_exc())
return
@@ -93,11 +93,12 @@ def startTest(testName, DEVICE, params):
#prepare and send feedback to calling tool
def sendFeedback(testPath, testName, DEVICE, returnString, testPassed):
print 'Test path: ' + testPath
print 'Test name: ' + testName
print 'Device: ' + DEVICE
print 'Test passed: ' + str(testPassed)
print 'Return string: ' + returnString
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)

View File

@@ -33,7 +33,7 @@ def startTest(testName, DEVICE, params):
ActualIA = Channel(DEVICE + ':Actual-IB', type = 'd')
#ActualIA = Channel('pw84:ai', type = 'd')
except:
sendFeedback(testPath, DEVICE, 'Unable to create channel - ' + traceback.format_exc(), False)
sendFeedback(testPath, testName, DEVICE, 'Unable to create channel - ' + traceback.format_exc(), False)
#raise Exception('Unable to create channel - ' + traceback.format_exc())
return
#Init