Cleaned tests:
- removed old tests - replaced with tests useful for production (now same for both lab and prod environments)
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
name=Modulator Wheel Display Tests
|
||||
description=Tests on the OPTIS2 Modulator Wheel Display
|
||||
@@ -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
|
||||
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>
|
||||
Reference in New Issue
Block a user