diff --git a/script/tests/devices/DMAF1/.config b/script/tests/devices/DMAF1/.config index c6cdc32..e5ad97b 100644 --- a/script/tests/devices/DMAF1/.config +++ b/script/tests/devices/DMAF1/.config @@ -1,3 +1,3 @@ -name=PROF02:DMAF1 +name=DMAF1 description=Collimators tests=Collimator Tests pro diff --git a/script/tests/tests/Collimator Tests pro/Calibrate/Calibrate.py b/script/tests/tests/Collimator Tests pro/Calibrate/Calibrate.py index ecdfb5b..ac5f1fa 100644 --- a/script/tests/tests/Collimator Tests pro/Calibrate/Calibrate.py +++ b/script/tests/tests/Collimator Tests pro/Calibrate/Calibrate.py @@ -18,59 +18,66 @@ def startTest(testName, DEVICE, params): samplePeriod = 0.1 ######### WRITE YOUR CODE HERE BELOW ############# - scan = ManualScan(['time [1/'+ str(1/samplePeriod) + ' s]'], ['Motor Status (STA:1)', 'Inkr (INKR:2)', 'InkrRb (INKRRB:2)', 'Diameter (DIAM:2)', 'Com (COM:2)', - 'Logical Position (IST:2)', 'Motor Pos Raw (IST3:1)','Motor Pos (IST3:2)', 'Poti Pos From Beam (IST1:2)', 'Poti Raw (POSA:1)', 'Poti Position (IST2:1)', - 'Poti Ref1 Position (REF1:1)', 'Poti Ref2 Position (REF2:1)']) + scan = ManualScan(['time [1/'+ str(1/samplePeriod) + ' s]'], ['Motor Pos (IST3:2)', 'Poti Position (IST2:1)', + 'Motor Status (STA:1)', 'Inkr (INKR:2)', 'InkrRb (INKRRB:2)', + 'Diameter (DIAM:2)', 'Com (COM:2)', 'Logical Position (IST:2)', + 'Motor Pos Raw (IST3:1)','Poti Pos From Beam (IST1:2)', + 'Poti Raw (POSA:1)', 'Poti Ref1 Position (REF1:1)', 'Poti Ref2 Position (REF2:1)']) scan.setPlotName(plotName) scan.start() try: - idMotorStatus = Channel(DEVICE+':STA:1', type = 'd') # DSP device_status reg - idLogicalPosition = Channel(DEVICE+':IST:2', type = 'd') # Shows current position in logical units as calculated from motor step counter [1..n] - idPotiRaw = Channel(DEVICE+':POSA:1', type = 'd') # poti raw data [ADC units] - idMotorPositionRaw = Channel(DEVICE+':IST3:1', type = 'd') # shows current position in steps as as obtained from motor step counter [steps] - idInkr = Channel(DEVICE + ':INKR:2', type='d') # move relative distance (positive means towards R2) [mm] - idInkrRb = Channel(DEVICE + ':INKRRB:2', type='d') # readback of move relative distance (positive means towards R2) [mm] - idDiameter = Channel(DEVICE + ':DIAM:2', type='d') # collimator diameter [mm] - idCom = Channel(DEVICE + ':COM:2', type='d') # current position as from motor step counter [mm] - idMotorPosition = 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] + idMotorStatus = Channel(DEVICE + ':STA:1' , type = 'd') # DSP device_status reg + idLogicalPosition = Channel(DEVICE + ':IST:2' , type = 'd') # Shows current position in logical units as calculated from motor step counter [1..n] + idPotiRaw = Channel(DEVICE + ':POSA:1' , type = 'd') # poti raw data [ADC units] + idMotorPositionRaw = Channel(DEVICE + ':IST3:1' , type = 'd') # shows current position in steps as as obtained from motor step counter [steps] + idInkr = Channel(DEVICE + ':INKR:2' , type = 'd') # move relative distance (positive means towards R2) [mm] + idInkrRb = Channel(DEVICE + ':INKRRB:2' , type = 'd') # readback of move relative distance (positive means towards R2) [mm] + idDiameter = Channel(DEVICE + ':DIAM:2' , type = 'd') # collimator diameter [mm] + idCom = Channel(DEVICE + ':COM:2' , type = 'd') # current position as from motor step counter [mm] + idMotorPosition = 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] #Pre-actions: 1 = calibrate caput(DEVICE+':COM:2', 1) - sleep( samplePeriod ) # Settling time except: ret = 'Unable to create channel - ' + traceback.format_exc() success = False test.sendFeedback( ret, success) return + countDeviceInModeIdle = 0 for setpoint1 in range(0, 10000): sleep( samplePeriod ) # Settling time - MotorStatus = idMotorStatus.get() - LogicalPosition = idLogicalPosition.get() - PotiRaw = idPotiRaw.get() - MotorPositionRaw = idMotorPositionRaw.get() - Com = idCom.get() - MotorPosition = idMotorPosition.get() - PotiPosFromBeam = idPotiPosFromBeam.get() - PotiPosition = idPotiPosition.get() - PotiRef1Position = idPotiRef1Position.get() - PotiRef2Position = idPotiRef2Position.get() - Diameter = idDiameter.get() - Inkr = idInkr.get() - InkrRb = idInkrRb.get() + MotorStatus = idMotorStatus.get() + LogicalPosition = idLogicalPosition.get() + PotiRaw = idPotiRaw.get() + MotorPositionRaw = idMotorPositionRaw.get() + Com = idCom.get() + MotorPosition = idMotorPosition.get() + PotiPosFromBeam = idPotiPosFromBeam.get() + PotiPosition = idPotiPosition.get() + PotiRef1Position = idPotiRef1Position.get() + PotiRef2Position = idPotiRef2Position.get() + Diameter = idDiameter.get() + Inkr = idInkr.get() + InkrRb = idInkrRb.get() - scan.append([setpoint1], [setpoint1], - [MotorStatus, Inkr, InkrRb, Diameter, Com, LogicalPosition, MotorPositionRaw, MotorPosition, - PotiPosFromBeam, PotiRaw, PotiPosition, PotiRef1Position, PotiRef2Position]) + scan.append([setpoint2], [setpoint2], + [MotorPosition, PotiPosition, MotorStatus, Inkr, InkrRb, Diameter, Com, LogicalPosition, + MotorPositionRaw, PotiPosFromBeam, PotiRaw, PotiRef1Position, PotiRef2Position]) - if (MotorStatus & int('1',2))==0: #device finished calibration - break + if (MotorStatus & int('1',2))==0: #device finished calibration (bit#1) + #give the device some time before stating that it has really finished + countDeviceInModeIdle = countDeviceInModeIdle +1 + if countDeviceInModeIdle == 10: + break + else: + countDeviceInModeIdle = 0 #check if any error bit is raised if bool(MotorStatus & int('10000',2)): #error: abort test diff --git a/script/tests/tests/Collimator Tests pro/Drive Out/Drive Out.py b/script/tests/tests/Collimator Tests pro/Drive Out/Drive Out.py index 027dd8a..72ca25e 100644 --- a/script/tests/tests/Collimator Tests pro/Drive Out/Drive Out.py +++ b/script/tests/tests/Collimator Tests pro/Drive Out/Drive Out.py @@ -20,26 +20,28 @@ def startTest(testName, DEVICE, params): samplePeriod = 0.1 ######### WRITE YOUR CODE HERE BELOW ############# - scan = ManualScan(['time [1/'+ str(1/samplePeriod) + ' s]'], ['Motor Status (STA:1)', 'Inkr (INKR:2)', 'InkrRb (INKRRB:2)', 'Diameter (DIAM:2)', 'Com (COM:2)', - 'Logical Position (IST:2)', 'Motor Pos Raw (IST3:1)','Motor Pos (IST3:2)', 'Poti Pos From Beam (IST1:2)', 'Poti Raw (POSA:1)', 'Poti Position (IST2:1)', - 'Poti Ref1 Position (REF1:1)', 'Poti Ref2 Position (REF2:1)']) + scan = ManualScan(['time [1/'+ str(1/samplePeriod) + ' s]'], ['Motor Pos (IST3:2)', 'Poti Position (IST2:1)', + 'Motor Status (STA:1)', 'Inkr (INKR:2)', 'InkrRb (INKRRB:2)', + 'Diameter (DIAM:2)', 'Com (COM:2)', 'Logical Position (IST:2)', + 'Motor Pos Raw (IST3:1)','Poti Pos From Beam (IST1:2)', + 'Poti Raw (POSA:1)', 'Poti Ref1 Position (REF1:1)', 'Poti Ref2 Position (REF2:1)']) scan.setPlotName(plotName) scan.start() try: - idMotorStatus = Channel(DEVICE+':STA:1', type = 'd') # DSP device_status reg - idLogicalPosition = Channel(DEVICE+':IST:2', type = 'd') # Shows current position in logical units as calculated from motor step counter [1..n] - idPotiRaw = Channel(DEVICE+':POSA:1', type = 'd') # poti raw data [ADC units] - idMotorPositionRaw = Channel(DEVICE+':IST3:1', type = 'd') # shows current position in steps as as obtained from motor step counter [steps] - idInkr = Channel(DEVICE + ':INKR:2', type='d') # move relative distance (positive means towards R2) [mm] - idInkrRb = Channel(DEVICE + ':INKRRB:2', type='d') # readback of move relative distance (positive means towards R2) [mm] - idDiameter = Channel(DEVICE + ':DIAM:2', type='d') # collimator diameter [mm] - idCom = Channel(DEVICE + ':COM:2', type='d') # current position as from motor step counter [mm] - idMotorPosition = 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] + idMotorStatus = Channel(DEVICE + ':STA:1' , type = 'd') # DSP device_status reg + idLogicalPosition = Channel(DEVICE + ':IST:2' , type = 'd') # Shows current position in logical units as calculated from motor step counter [1..n] + idPotiRaw = Channel(DEVICE + ':POSA:1' , type = 'd') # poti raw data [ADC units] + idMotorPositionRaw = Channel(DEVICE + ':IST3:1' , type = 'd') # shows current position in steps as as obtained from motor step counter [steps] + idInkr = Channel(DEVICE + ':INKR:2' , type = 'd') # move relative distance (positive means towards R2) [mm] + idInkrRb = Channel(DEVICE + ':INKRRB:2' , type = 'd') # readback of move relative distance (positive means towards R2) [mm] + idDiameter = Channel(DEVICE + ':DIAM:2' , type = 'd') # collimator diameter [mm] + idCom = Channel(DEVICE + ':COM:2' , type = 'd') # current position as from motor step counter [mm] + idMotorPosition = 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] #Pre-actions: 2 = drive out caput(DEVICE+':COM:2', 2) @@ -53,26 +55,32 @@ def startTest(testName, DEVICE, params): for setpoint1 in range(0, 10000): sleep( samplePeriod ) # Settling time - MotorStatus = idMotorStatus.get() - LogicalPosition = idLogicalPosition.get() - PotiRaw = idPotiRaw.get() - MotorPositionRaw = idMotorPositionRaw.get() - Com = idCom.get() - MotorPosition = idMotorPosition.get() - PotiPosFromBeam = idPotiPosFromBeam.get() - PotiPosition = idPotiPosition.get() - PotiRef1Position = idPotiRef1Position.get() - PotiRef2Position = idPotiRef2Position.get() - Diameter = idDiameter.get() - Inkr = idInkr.get() - InkrRb = idInkrRb.get() + MotorStatus = idMotorStatus.get() + LogicalPosition = idLogicalPosition.get() + PotiRaw = idPotiRaw.get() + MotorPositionRaw = idMotorPositionRaw.get() + Com = idCom.get() + MotorPosition = idMotorPosition.get() + PotiPosFromBeam = idPotiPosFromBeam.get() + PotiPosition = idPotiPosition.get() + PotiRef1Position = idPotiRef1Position.get() + PotiRef2Position = idPotiRef2Position.get() + Diameter = idDiameter.get() + Inkr = idInkr.get() + InkrRb = idInkrRb.get() - scan.append([setpoint1], [setpoint1], - [MotorStatus, Inkr, InkrRb, Diameter, Com, LogicalPosition, MotorPositionRaw, MotorPosition, - PotiPosFromBeam, PotiRaw, PotiPosition, PotiRef1Position, PotiRef2Position]) - if (MotorStatus & int('1',2))==0: #device finished calibration - break + scan.append([setpoint2], [setpoint2], + [MotorPosition, PotiPosition, MotorStatus, Inkr, InkrRb, Diameter, Com, LogicalPosition, + MotorPositionRaw, PotiPosFromBeam, PotiRaw, PotiRef1Position, PotiRef2Position]) + + if (MotorStatus & int('1',2))==0: #device finished calibration (bit#1) + #give the device some time before stating that it has really finished + countDeviceInModeIdle = countDeviceInModeIdle +1 + if countDeviceInModeIdle == 10: + break + else: + countDeviceInModeIdle = 0 #check if any error bit is raised if bool(MotorStatus & int('10000',2)): #error: abort test diff --git a/script/tests/tests/Collimator Tests pro/Monitor Movement/Monitor Movement - Copy.py b/script/tests/tests/Collimator Tests pro/Monitor Movement/Monitor Movement - Copy.py deleted file mode 100644 index 1a8f90a..0000000 --- a/script/tests/tests/Collimator Tests pro/Monitor Movement/Monitor Movement - Copy.py +++ /dev/null @@ -1,94 +0,0 @@ - -###### DO NOT MODIFY THE CODE BELOW ###### -global print_log, sendFeedback, inspect, log, sys, inspect, os, traceback -import sys, inspect, os, traceback - -def startTest(testName, DEVICE, params): - #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 ####### - #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' - success = True -########## END OF YOUR CODE ########### - -###### DO NOT MODIFY THE CODE BELOW ###### - sendFeedback(testPath, testName, DEVICE, ret, success) - -#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 - log (now + ' ' + DEVICE + ' - ' + testName + ': ' + text ) - -#get test arguments -DEVICE = device -testName = test -params = parameters -#launch the test -startTest(testName, DEVICE, params) diff --git a/script/tests/tests/Collimator Tests pro/Monitor Movement/Monitor Movement.py b/script/tests/tests/Collimator Tests pro/Monitor Movement/Monitor Movement.py index 5d73c14..34ae97b 100644 --- a/script/tests/tests/Collimator Tests pro/Monitor Movement/Monitor Movement.py +++ b/script/tests/tests/Collimator Tests pro/Monitor Movement/Monitor Movement.py @@ -25,6 +25,7 @@ def startTest(testName, DEVICE, params): #test.log( 'parameters:' + str( params) ) #test.log( 'device: ' + DEVICE ) monitorTime = float(test.getParam("monitorTime")) + samplePeriod = 0.05 #seconds except: ret = 'Could not retrieve testing parameters - ' + traceback.format_exc() success = False @@ -32,18 +33,19 @@ def startTest(testName, DEVICE, params): return #get parameters from the calling interface - scan = ManualScan(['time'], ['idMotorStep', 'idPotiPosition', 'idPotiRef1Position','idMotorStep-idPotiPosition'] ) + scan = ManualScan(['time [1/'+ str(1/samplePeriod) + ' s]'], + ['Motor Pos (IST3:2)', 'Poti Position (IST2:1)', 'Motor Pos - Poti Pos'] ) 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] + idCom = Channel(DEVICE+':COM:2' , type = 'd') #current position as from motor step counter [mm] + idMotorPosition = 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: test.sendFeedback( 'Unable to create channel - ' + traceback.format_exc(), False) @@ -60,19 +62,19 @@ def startTest(testName, DEVICE, params): #Detector time currentTime = float(java.lang.System.currentTimeMillis()) - motorStep = idMotorStep.get() + motorPosition = idMotorPosition.get() potiPosFromBeam = idPotiPosFromBeam.get() potiPosision = idPotiPosition.get() potiRef1Position = idPotiRef1Position.get() potiRef2Position = idPotiRef2Position.get() - diff1 = motorStep-potiPosision - scan.append ([currentTime], [currentTime], [motorStep, potiPosision, potiRef1Position, diff1]) - sleep( 0.1 ) # Settling time + diff1 = motorPosition-potiPosision + scan.append ([currentTime], [currentTime], [motorPosition, potiPosision, diff1]) + sleep( samplePeriod ) # Settling time timeElapsed=timeElapsed+1 #Closing channels idCom.close() - idMotorStep.close() + idMotorPosition.close() idPotiPosFromBeam.close() idPotiPosition.close() idPotiRef1Position.close() diff --git a/script/tests/tests/Collimator Tests pro/Motor Test 1/Motor Test 1.py b/script/tests/tests/Collimator Tests pro/Motor Test 1/Motor Test 1.py index ae6653f..4675f96 100644 --- a/script/tests/tests/Collimator Tests pro/Motor Test 1/Motor Test 1.py +++ b/script/tests/tests/Collimator Tests pro/Motor Test 1/Motor Test 1.py @@ -36,27 +36,29 @@ def startTest(testName, DEVICE, params): test.sendFeedback(ret, success) return - scan = ManualScan(['idX'], ['Motor Status (STA:1)', 'Inkr (INKR:2)', 'InkrRb (INKRRB:2)', 'Diameter (DIAM:2)', 'Com (COM:2)', - 'Logical Position (IST:2)', 'Motor Pos Raw (IST3:1)','Motor Pos (IST3:2)', 'Poti Pos From Beam (IST1:2)', 'Poti Raw (POSA:1)', 'Poti Position (IST2:1)', - 'Poti Ref1 Position (REF1:1)', 'Poti Ref2 Position (REF2:1)']) + scan = ManualScan(['time [1/'+ str(1/samplePeriod) + ' s]'], ['Motor Pos (IST3:2)', 'Poti Position (IST2:1)', + 'Motor Status (STA:1)', 'Inkr (INKR:2)', 'InkrRb (INKRRB:2)', + 'Diameter (DIAM:2)', 'Com (COM:2)', 'Logical Position (IST:2)', + 'Motor Pos Raw (IST3:1)','Poti Pos From Beam (IST1:2)', + 'Poti Raw (POSA:1)', 'Poti Ref1 Position (REF1:1)', 'Poti Ref2 Position (REF2:1)']) p1 = plot(None, name = "Poti Pos From Beam - Motor Position", context = plotName + " pos difference")[0] scan.setPlotName(plotName) scan.start() # Creating channels: dimension 1 try: - idMotorStatus = Channel(DEVICE+':STA:1', type = 'd') # DSP device_status reg - idLogicalPosition = Channel(DEVICE+':IST:2', type = 'd') # Shows current position in logical units as calculated from motor step counter [1..n] - idPotiRaw = Channel(DEVICE+':POSA:1', type = 'd') # poti raw data [ADC units] - idMotorStepRaw = Channel(DEVICE+':IST3:1', type = 'd') # shows current position in steps as as obtained from motor step counter [steps] - idInkr = Channel(DEVICE + ':INKR:2', type='d') # move relative distance (positive means towards R2) [mm] - idInkrRb = Channel(DEVICE + ':INKRRB:2', type='d') # readback of move relative distance (positive means towards R2) [mm] - idDiameter = Channel(DEVICE + ':DIAM:2', type='d') # collimator diameter [mm] - idCom = Channel(DEVICE + ':COM:2', type='d') # current position as from motor step counter [mm] - idMotorPosition = 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] + idMotorStatus = Channel(DEVICE + ':STA:1' , type = 'd') # DSP device_status reg + idLogicalPosition = Channel(DEVICE + ':IST:2' , type = 'd') # Shows current position in logical units as calculated from motor step counter [1..n] + idPotiRaw = Channel(DEVICE + ':POSA:1' , type = 'd') # poti raw data [ADC units] + idMotorPositionRaw = Channel(DEVICE + ':IST3:1' , type = 'd') # shows current position in steps as as obtained from motor step counter [steps] + idInkr = Channel(DEVICE + ':INKR:2' , type = 'd') # move relative distance (positive means towards R2) [mm] + idInkrRb = Channel(DEVICE + ':INKRRB:2' , type = 'd') # readback of move relative distance (positive means towards R2) [mm] + idDiameter = Channel(DEVICE + ':DIAM:2' , type = 'd') # collimator diameter [mm] + idCom = Channel(DEVICE + ':COM:2' , type = 'd') # current position as from motor step counter [mm] + idMotorPosition = 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: ret = 'Unable to create channel - ' + traceback.format_exc() success = False @@ -79,25 +81,25 @@ def startTest(testName, DEVICE, params): sleep(samplePeriod) currentTime = float(java.lang.System.currentTimeMillis()) - MotorStatus = idMotorStatus.get() - LogicalPosition = idLogicalPosition.get() - PotiRaw = idPotiRaw.get() - MotorStepRaw = idMotorStepRaw.get() - Com = idCom.get() - MotorPosition = idMotorPosition.get() - PotiPosFromBeam = idPotiPosFromBeam.get() - PotiPosition = idPotiPosition.get() - PotiRef1Position = idPotiRef1Position.get() - PotiRef2Position = idPotiRef2Position.get() - Diameter = idDiameter.get() - Inkr = idInkr.get() - InkrRb = idInkrRb.get() + MotorStatus = idMotorStatus.get() + LogicalPosition = idLogicalPosition.get() + PotiRaw = idPotiRaw.get() + MotorPositionRaw = idMotorPositionRaw.get() + Com = idCom.get() + MotorPosition = idMotorPosition.get() + PotiPosFromBeam = idPotiPosFromBeam.get() + PotiPosition = idPotiPosition.get() + PotiRef1Position = idPotiRef1Position.get() + PotiRef2Position = idPotiRef2Position.get() + Diameter = idDiameter.get() + Inkr = idInkr.get() + InkrRb = idInkrRb.get() idDiff01 = PotiPosition - MotorPosition scan.append([setpoint2], [setpoint2], - [MotorStatus, Inkr, InkrRb, Diameter, Com, LogicalPosition, MotorStepRaw, MotorStep, - PotiPosFromBeam, PotiRaw, PotiPosition, PotiRef1Position, PotiRef2Position]) + [MotorPosition, PotiPosition, MotorStatus, Inkr, InkrRb, Diameter, Com, LogicalPosition, + MotorPositionRaw, PotiPosFromBeam, PotiRaw, PotiRef1Position, PotiRef2Position]) p1.getSeries(count).appendData(currentTime, idDiff01) diff --git a/script/tests/tests/Collimator Tests pro/Motor Test 2/Motor Test 2.py b/script/tests/tests/Collimator Tests pro/Motor Test 2/Motor Test 2.py index a2a3217..1d8ce51 100644 --- a/script/tests/tests/Collimator Tests pro/Motor Test 2/Motor Test 2.py +++ b/script/tests/tests/Collimator Tests pro/Motor Test 2/Motor Test 2.py @@ -35,11 +35,11 @@ def startTest(testName, DEVICE, params): test.sendFeedback(ret, success) return - scan = ManualScan(['idX'], ['Motor Status (STA:1)', 'Inkr (INKR:2)', 'InkrRb (INKRRB:2)', 'Diameter (DIAM:2)', - 'Com (COM:2)', - 'Logical Position (IST:2)', 'Motor Pos Raw (IST3:1)', 'Motor Pos (IST3:2)', - 'Poti Pos From Beam (IST1:2)', 'Poti Raw (POSA:1)', 'Poti Position (IST2:1)', - 'Poti Ref1 Position (REF1:1)', 'Poti Ref2 Position (REF2:1)']) + scan = ManualScan(['time [1/'+ str(1/samplePeriod) + ' s]'], ['Motor Pos (IST3:2)', 'Poti Position (IST2:1)', + 'Motor Status (STA:1)', 'Inkr (INKR:2)', 'InkrRb (INKRRB:2)', + 'Diameter (DIAM:2)', 'Com (COM:2)', 'Logical Position (IST:2)', + 'Motor Pos Raw (IST3:1)','Poti Pos From Beam (IST1:2)', + 'Poti Raw (POSA:1)', 'Poti Ref1 Position (REF1:1)', 'Poti Ref2 Position (REF2:1)']) scan.setPlotName(plotName) scan.start() # coloured plot (one colour per scan) @@ -48,19 +48,19 @@ def startTest(testName, DEVICE, params): # Creating channels: dimension 1 try: - idMotorStatus = Channel(DEVICE + ':STA:1', type='d') # DSP device_status reg - idLogicalPosition = Channel(DEVICE + ':IST:2', type='d') # Shows current position in logical units as calculated from motor step counter [1..n] - idPotiRaw = Channel(DEVICE + ':POSA:1', type='d') # poti raw data [ADC units] - idMotorPositionRaw = Channel(DEVICE + ':IST3:1', type='d') # shows current position in steps as as obtained from motor step counter [steps] - idInkr = Channel(DEVICE + ':INKR:2', type='d') # move relative distance (positive means towards R2) [mm] - idInkrRb = Channel(DEVICE + ':INKRRB:2', type='d') # readback of move relative distance (positive means towards R2) [mm] - idDiameter = Channel(DEVICE + ':DIAM:2', type='d') # collimator diameter [mm] - idCom = Channel(DEVICE + ':COM:2', type='d') # current position as from motor step counter [mm] - idMotorPosition = 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] + idMotorStatus = Channel(DEVICE + ':STA:1' , type = 'd') # DSP device_status reg + idLogicalPosition = Channel(DEVICE + ':IST:2' , type = 'd') # Shows current position in logical units as calculated from motor step counter [1..n] + idPotiRaw = Channel(DEVICE + ':POSA:1' , type = 'd') # poti raw data [ADC units] + idMotorPositionRaw = Channel(DEVICE + ':IST3:1' , type = 'd') # shows current position in steps as as obtained from motor step counter [steps] + idInkr = Channel(DEVICE + ':INKR:2' , type = 'd') # move relative distance (positive means towards R2) [mm] + idInkrRb = Channel(DEVICE + ':INKRRB:2' , type = 'd') # readback of move relative distance (positive means towards R2) [mm] + idDiameter = Channel(DEVICE + ':DIAM:2' , type = 'd') # collimator diameter [mm] + idCom = Channel(DEVICE + ':COM:2' , type = 'd') # current position as from motor step counter [mm] + idMotorPosition = 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: ret = 'Unable to create channel - ' + traceback.format_exc() success = False @@ -96,28 +96,28 @@ def startTest(testName, DEVICE, params): sleep(settlingTime) # Settling time readback2 = idInkr.get() - MotorStatus = idMotorStatus.get() - LogicalPosition = idLogicalPosition.get() - PotiRaw = idPotiRaw.get() - MotorPositionRaw = idMotorPositionRaw.get() - Com = idCom.get() - MotorPosition = idMotorPosition.get() - PotiPosFromBeam = idPotiPosFromBeam.get() - PotiPosition = idPotiPosition.get() - PotiRef1Position = idPotiRef1Position.get() - PotiRef2Position = idPotiRef2Position.get() - Diameter = idDiameter.get() - Inkr = idInkr.get() - InkrRb = idInkrRb.get() + MotorStatus = idMotorStatus.get() + LogicalPosition = idLogicalPosition.get() + PotiRaw = idPotiRaw.get() + MotorPositionRaw = idMotorPositionRaw.get() + Com = idCom.get() + MotorPosition = idMotorPosition.get() + PotiPosFromBeam = idPotiPosFromBeam.get() + PotiPosition = idPotiPosition.get() + PotiRef1Position = idPotiRef1Position.get() + PotiRef2Position = idPotiRef2Position.get() + Diameter = idDiameter.get() + Inkr = idInkr.get() + InkrRb = idInkrRb.get() idDiff01 = potiPosition - inkrRb # Manipulation idDiff02 # Variable Mappings idDiff02 = potiPosition - MotorPosition countSteps = countSteps + 1 - scan.append([countSteps], [countSteps], - [MotorStatus, Inkr, InkrRb, Diameter, Com, LogicalPosition, MotorPositionRaw, MotorPosition, - PotiPosFromBeam, PotiRaw, PotiPosition, PotiRef1Position, PotiRef2Position]) + scan.append([setpoint2], [setpoint2], + [MotorPosition, PotiPosition, MotorStatus, Inkr, InkrRb, Diameter, Com, LogicalPosition, + MotorPositionRaw, PotiPosFromBeam, PotiRaw, PotiRef1Position, PotiRef2Position]) p1.getSeries(count).appendData(setpoint2, idDiff01) p2.getSeries(count).appendData(setpoint2, idDiff02) if (direction > 0.0 and setpoint2 >= end - 1): diff --git a/script/tests/tests/Collimator Tests pro/Motor Test 2/help.html b/script/tests/tests/Collimator Tests pro/Motor Test 2/help.html new file mode 100644 index 0000000..a1c8bc0 --- /dev/null +++ b/script/tests/tests/Collimator Tests pro/Motor Test 2/help.html @@ -0,0 +1,15 @@ + +
+repeatTimes Repeat the Initialisation N timesmidPoint Position A
+spanFromMidPoint The B steps
+monitorTime This is the parameter n.1 with unit [unit]samplingDelay This is the parameter n.2 with unit [unit]