Closedown

This commit is contained in:
boccioli_m
2015-08-04 15:19:36 +02:00
parent 50a9beb10b
commit 5c1d8e7901

View File

@@ -56,7 +56,7 @@ def startTest(testName, DEVICE, params):
sendFeedback(testPath, testName, DEVICE, ret, success)
return
scan = ManualScan(['idX'], ['idMotorPosition', 'idPotiProc', 'idBtvsProc', 'idDiff01', 'idDiff02'] )
scan = ManualScan(['idX'], ['idMotorPosition', 'idEncoderPosition', 'idError'] )
scan.setPlotName(plotName)
scan.start()
#Creating channels: dimension 1
@@ -67,12 +67,10 @@ def startTest(testName, DEVICE, params):
#ScalarDetector idMotorPosition
#idMotorPosition = Channel(DEVICE+':IST1:2', type = 'd')
idMotorPosition = Channel(DEVICE+':MOTOR.RBV', type = 'd')
#ScalarDetector idPotiProc
#idPotiProc = Channel(DEVICE+':POSA:2', type = 'd')
idPotiProc = Channel(DEVICE+':ENCODER', type = 'd')
#ScalarDetector idEncoderPosition
#idEncoderPosition = Channel(DEVICE+':POSA:2', type = 'd')
idEncoderPosition = Channel(DEVICE+':ENCODER', 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')
@@ -86,53 +84,49 @@ def startTest(testName, DEVICE, params):
return
count = 0
print_log(testName, DEVICE, 'Initialisation sequence')
timeout = 60000 #timeout in ms
for count in range(0, loopTimes):
print_log(testName, DEVICE, 'Initialisation #' + str(count+1) + '/' + str(loopTimes) )
sleep( delaySeconds ) # Settling time
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<40000:
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 = idPotiProc.get()
detector8 = idBtvsProc.get()
detector6 = idEncoderPosition.get()
ready = idReady.get()
interlock = idInterlock.get()
#end switches
endH = idEndSwitchH.get()
endL = idEndSwitchL.get()
#Manipulation idDiff02
a = detector4
b = detector8
idDiff02 = a-b
#Manipulation idDiff01
a = detector4
b = detector6
idDiff01 = a-b
scan.append ([timeStamp],[timeStamp], [detector4, detector6, detector8, idDiff02, idDiff01])
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()
idPotiProc.close()
idBtvsProc.close()
idEncoderPosition.close()
scan.end()
############# END OF YOUR CODE ###########