diff --git a/script/tests/devices/LS/.config b/script/tests/devices/LS/.config deleted file mode 100644 index f2b2e33..0000000 --- a/script/tests/devices/LS/.config +++ /dev/null @@ -1,3 +0,0 @@ -name=LS -description=Linear Slide in test office setup -tests=Office Linear Slide Tests diff --git a/script/tests/tests/Collimator Tests/.config b/script/tests/tests/Collimator Tests/.config new file mode 100644 index 0000000..0072d63 --- /dev/null +++ b/script/tests/tests/Collimator Tests/.config @@ -0,0 +1,2 @@ +name=Motor Test 3 +description=Motor Test 3 diff --git a/script/tests/tests/Collimator Tests/Calibrate/.config b/script/tests/tests/Collimator Tests/Calibrate/.config new file mode 100644 index 0000000..e75c90e --- /dev/null +++ b/script/tests/tests/Collimator Tests/Calibrate/.config @@ -0,0 +1,3 @@ +name=Calibrate +description=Calibrates the device +filename=Calibrate.xml diff --git a/script/tests/tests/Collimator Tests/Calibrate/Calibrate.py b/script/tests/tests/Collimator Tests/Calibrate/Calibrate.py new file mode 100644 index 0000000..1cfbe9c --- /dev/null +++ b/script/tests/tests/Collimator Tests/Calibrate/Calibrate.py @@ -0,0 +1,97 @@ +#Script imported from: Calibrate.xml + +ret = 'Test failed' +status = False + +#Pre-actions +try: + caput('PO2DV-NCS-'+DEVICE+':INIT.PROC', '1') +except: + print "Unexpected error:", sys.exc_info()[0] + ret = 'Unable to create channel' + success = False + raise + sys.exit() + +#TODO: Set the diplay names of positioners and detectors +scan = ManualScan(['id000000'], ['id000001', 'id000002', 'id000003', 'id000004', 'id000005', 'id000006', 'id000007', 'id000008', 'id000009', 'id000010', 'idResult'] , [0.0], [1000.0], [1000]) +scan.start() + +#Creating channels: dimension 1 +#PseudoPositioner id000000 +#ScalarDetector id000001 +id000001 = Channel('PO2DV-NCS-'+DEVICE+':MOTOR.MSTA', type = 'd') +#ScalarDetector id000002 +id000002 = Channel('PO2DV-NCS-'+DEVICE+':MOTOR.RVAL', type = 'd') +#ScalarDetector id000003 +id000003 = Channel('PO2DV-NCS-'+DEVICE+':MOTOR.VAL', type = 'd') +#ScalarDetector id000004 +id000004 = Channel('PO2DV-NCS-'+DEVICE+':MOTOR.ATHM', type = 'd') +#ScalarDetector id000005 +id000005 = Channel('PO2DV-NCS-'+DEVICE+':MOTOR.LLS', type = 'd') +#ScalarDetector id000006 +id000006 = Channel('PO2DV-NCS-'+DEVICE+':MOTOR.HLS', type = 'd') +#ScalarDetector id000007 +id000007 = Channel('PO2DV-NCS-'+DEVICE+':ENCODERraw', type = 'd') +#ScalarDetector id000008 +id000008 = Channel('PO2DV-NCS-'+DEVICE+':ENCODER', type = 'd') +#ScalarDetector id000009 +id000009 = Channel('PO2DV-NCS-'+DEVICE+':RDY', type = 'd') +#ScalarDetector id000010 +id000010 = Channel('PO2DV-NCS-'+DEVICE+':ILK', type = 'd') + +#Dimension 1 +#PseudoPositioner id000000 +for setpoint1 in range(0, 1000): + readback1 = setpoint1 + sleep( 0.05 ) # Settling time + #Detector id000001 + detector1 = id000001.get() + #Detector id000002 + detector2 = id000002.get() + #Detector id000003 + detector3 = id000003.get() + #Detector id000004 + detector4 = id000004.get() + #Detector id000005 + detector5 = id000005.get() + #Detector id000006 + detector6 = id000006.get() + #Detector id000007 + detector7 = id000007.get() + #Detector id000008 + detector8 = id000008.get() + #Detector id000009 + detector9 = id000009.get() + #Detector id000010 + detector10 = id000010.get() + #Manipulation idResult + #Variable Mappings + ready = detector9 + interlock = detector10 + count = setpoint1 + if count < 800: + idResult = (0, "Note: the "+DEVICE+" calibration procedure did not complete.") + if ready == 1 and interlock == 1: + #print "The "+DEVICE+" drive was successfully initialised. The RDY and ILK signals indicate the drive is ready." + ret = 'Drive successfully initialised' + status = True + else: + #print "The RS calibration procedure failed. The RDY and ILK signals indicate the drive was NOT ready at the expected time (after 40s)." + ret = 'The RDY and ILK signals indicate the drive was NOT ready at the expected time (after 40s).' + status = False + scan.append ([setpoint1], [readback1], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, detector9, detector10, idResult]) + +#Closing channels +id000001.close() +id000002.close() +id000003.close() +id000004.close() +id000005.close() +id000006.close() +id000007.close() +id000008.close() +id000009.close() +id000010.close() + +scan.end() diff --git a/script/tests/tests/Collimator Tests/Calibrate/Calibrate.xml b/script/tests/tests/Collimator Tests/Calibrate/Calibrate.xml new file mode 100644 index 0000000..eef74b6 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Calibrate/Calibrate.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + + 1000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/script/tests/tests/Collimator Tests/Calibrate/doit.sh b/script/tests/tests/Collimator Tests/Calibrate/doit.sh new file mode 100644 index 0000000..4807a72 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Calibrate/doit.sh @@ -0,0 +1,2 @@ +#!/bin/bash +sleep 5 diff --git a/script/tests/tests/Collimator Tests/Calibrate3/.config b/script/tests/tests/Collimator Tests/Calibrate3/.config new file mode 100644 index 0000000..0bc2024 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Calibrate3/.config @@ -0,0 +1,12 @@ +name=Calibrate +description=Calibrates the device +filename=Calibrate.xml +help = \ +This test sends a command to the low level firmware which controls the collimators \n\ +requesting that it calibrates itself. \n\n\ +Calibration involves moving to the R1 and R2 reference positions and measuring the \n\ +number of steps required to do so. At the end of the sequence the default collimator \n\ +will be selected. \n\n\ +During the course of the expected calibration period (45-70 seconds) the test \n\ +procedure will plot the values of all critical system variables. \n\n\ +For further information please consult Valery Ovinnikov. diff --git a/script/tests/tests/Collimator Tests/Calibrate3/Calibrate.xml b/script/tests/tests/Collimator Tests/Calibrate3/Calibrate.xml new file mode 100644 index 0000000..7e5028f --- /dev/null +++ b/script/tests/tests/Collimator Tests/Calibrate3/Calibrate.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + 900 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/script/tests/tests/Collimator Tests/Check Status/.config b/script/tests/tests/Collimator Tests/Check Status/.config new file mode 100644 index 0000000..6f07a3a --- /dev/null +++ b/script/tests/tests/Collimator Tests/Check Status/.config @@ -0,0 +1,5 @@ +name=Check Status +description=Monitors the status of the device +filename=Check Status.xml +help= \ +This test plots the status of all relevant drive signals for a period of 15 seconds. diff --git a/script/tests/tests/Collimator Tests/Check Status/Check Status.xml b/script/tests/tests/Collimator Tests/Check Status/Check Status.xml new file mode 100644 index 0000000..b9371fe --- /dev/null +++ b/script/tests/tests/Collimator Tests/Check Status/Check Status.xml @@ -0,0 +1,67 @@ + + + + + + + 3000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/script/tests/tests/Collimator Tests/Drive Out/.config b/script/tests/tests/Collimator Tests/Drive Out/.config new file mode 100644 index 0000000..3589d0d --- /dev/null +++ b/script/tests/tests/Collimator Tests/Drive Out/.config @@ -0,0 +1,3 @@ +name=Drive Out +description=Drives the Collimator to the Out Position +filename=Drive Out.xml \ No newline at end of file diff --git a/script/tests/tests/Collimator Tests/Drive Out/Drive Out.xml b/script/tests/tests/Collimator Tests/Drive Out/Drive Out.xml new file mode 100644 index 0000000..5a1c925 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Drive Out/Drive Out.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + 3000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/script/tests/tests/Collimator Tests/Motor Test 1/.config b/script/tests/tests/Collimator Tests/Motor Test 1/.config new file mode 100644 index 0000000..202e2c9 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Motor Test 1/.config @@ -0,0 +1,3 @@ +name=Motor Test 1 +description=moves to CCW switch; then for M times moves N times to CW switch then CCW switch; between each M pauses for delay; log at CCW and CW +filename=Motor Test 3.xml diff --git a/script/tests/tests/Collimator Tests/Motor Test 2/.config b/script/tests/tests/Collimator Tests/Motor Test 2/.config new file mode 100644 index 0000000..8dbafbb --- /dev/null +++ b/script/tests/tests/Collimator Tests/Motor Test 2/.config @@ -0,0 +1,3 @@ +name=Motor Test 2 +description=Go to absolute position A, then move +B steps, then -2B steps, then +2Bsteps (ie oscillate round centre position, logging after each movement); repeat N times +filename=Motor Test 3.xml diff --git a/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 100ms/.config b/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 100ms/.config new file mode 100644 index 0000000..2b64d0a --- /dev/null +++ b/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 100ms/.config @@ -0,0 +1,3 @@ +name=Motor Test 3 100ms +description=Moves from CCW to CW as a series of discrete translations (C times) logs after each translation. When end switch is encountered change direction. Repeat N times +filename=Motor Test 3.xml diff --git a/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 100ms/Motor Test 3 - with original pv.xml b/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 100ms/Motor Test 3 - with original pv.xml new file mode 100644 index 0000000..bc9aae6 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 100ms/Motor Test 3 - with original pv.xml @@ -0,0 +1,74 @@ + + + + + + + 3000 + + + + + 0.0 + 10.0 + 1.0 + + + 10.0 + 0.0 + -1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 100ms/Motor Test 3.xml b/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 100ms/Motor Test 3.xml new file mode 100644 index 0000000..bc9aae6 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 100ms/Motor Test 3.xml @@ -0,0 +1,74 @@ + + + + + + + 3000 + + + + + 0.0 + 10.0 + 1.0 + + + 10.0 + 0.0 + -1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 200ms/.config b/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 200ms/.config new file mode 100644 index 0000000..8058e03 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 200ms/.config @@ -0,0 +1,3 @@ +name=Motor Test 3 200ms +description=Moves from CCW to CW as a series of discrete translations (C times) logs after each translation. When end switch is encountered change direction. Repeat N times +filename=Motor Test 3.xml diff --git a/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 200ms/Motor Test 3 - with original pv.xml b/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 200ms/Motor Test 3 - with original pv.xml new file mode 100644 index 0000000..bc9aae6 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 200ms/Motor Test 3 - with original pv.xml @@ -0,0 +1,74 @@ + + + + + + + 3000 + + + + + 0.0 + 10.0 + 1.0 + + + 10.0 + 0.0 + -1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 200ms/Motor Test 3.xml b/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 200ms/Motor Test 3.xml new file mode 100644 index 0000000..bc9aae6 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 200ms/Motor Test 3.xml @@ -0,0 +1,74 @@ + + + + + + + 3000 + + + + + 0.0 + 10.0 + 1.0 + + + 10.0 + 0.0 + -1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 500ms/.config b/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 500ms/.config new file mode 100644 index 0000000..9733dd0 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 500ms/.config @@ -0,0 +1,3 @@ +name=Motor Test 3 500ms +description=Moves from CCW to CW as a series of discrete translations (C times) logs after each translation. When end switch is encountered change direction. Repeat N times +filename=Motor Test 3.xml diff --git a/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 500ms/Motor Test 3 - with original pv.xml b/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 500ms/Motor Test 3 - with original pv.xml new file mode 100644 index 0000000..bc9aae6 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 500ms/Motor Test 3 - with original pv.xml @@ -0,0 +1,74 @@ + + + + + + + 3000 + + + + + 0.0 + 10.0 + 1.0 + + + 10.0 + 0.0 + -1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 500ms/Motor Test 3.xml b/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 500ms/Motor Test 3.xml new file mode 100644 index 0000000..bc9aae6 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Motor Test 3 in several ms/Motor Test 3 500ms/Motor Test 3.xml @@ -0,0 +1,74 @@ + + + + + + + 3000 + + + + + 0.0 + 10.0 + 1.0 + + + 10.0 + 0.0 + -1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/script/tests/tests/Collimator Tests/Motor Test 3/.config b/script/tests/tests/Collimator Tests/Motor Test 3/.config new file mode 100644 index 0000000..d828901 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Motor Test 3/.config @@ -0,0 +1,3 @@ +name=Motor Test 3 +description=Moves from CCW to CW as a series of discrete translations (C times) logs after each translation. When end switch is encountered change direction. Repeat N times +filename=Motor Test 3.xml diff --git a/script/tests/tests/Collimator Tests/Move Ref 1/.config b/script/tests/tests/Collimator Tests/Move Ref 1/.config new file mode 100644 index 0000000..895fbd5 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Move Ref 1/.config @@ -0,0 +1,3 @@ +name=Move Ref 1 +description=Moves to the Reference 1 Position +filename=Move Ref 1.xml \ No newline at end of file diff --git a/script/tests/tests/Collimator Tests/Move Ref 1/Move Ref 1.xml b/script/tests/tests/Collimator Tests/Move Ref 1/Move Ref 1.xml new file mode 100644 index 0000000..5b81083 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Move Ref 1/Move Ref 1.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + 3000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/script/tests/tests/Collimator Tests/Move Ref 2/.config b/script/tests/tests/Collimator Tests/Move Ref 2/.config new file mode 100644 index 0000000..2b6e946 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Move Ref 2/.config @@ -0,0 +1,3 @@ +name=Move Ref 2 +description=Moves to the Reference 2 Position +filename=Move Ref 2.xml \ No newline at end of file diff --git a/script/tests/tests/Collimator Tests/Move Ref 2/Move Ref 2.xml b/script/tests/tests/Collimator Tests/Move Ref 2/Move Ref 2.xml new file mode 100644 index 0000000..2cf0a0a --- /dev/null +++ b/script/tests/tests/Collimator Tests/Move Ref 2/Move Ref 2.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + 3000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/script/tests/tests/Collimator Tests/Stop/.config b/script/tests/tests/Collimator Tests/Stop/.config new file mode 100644 index 0000000..89d5a5f --- /dev/null +++ b/script/tests/tests/Collimator Tests/Stop/.config @@ -0,0 +1,3 @@ +name=Stop +description=Sends the STOP command +filename=Stop.xml \ No newline at end of file diff --git a/script/tests/tests/Collimator Tests/Stop/Stop.xml b/script/tests/tests/Collimator Tests/Stop/Stop.xml new file mode 100644 index 0000000..27228d3 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Stop/Stop.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + 3000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/script/tests/tests/Collimator Tests/Zig Zag Test/.config b/script/tests/tests/Collimator Tests/Zig Zag Test/.config new file mode 100644 index 0000000..c522777 --- /dev/null +++ b/script/tests/tests/Collimator Tests/Zig Zag Test/.config @@ -0,0 +1,4 @@ +name=Zig Zag Test +description=Moves the drive back and forth between the end-switches +filename=Zig Zag Test.xml +help = This test repetitively moves the collimator between the R1 and R2 positions. diff --git a/script/tests/tests/Collimator Tests/Zig Zag Test/Zig Zag Test.xml b/script/tests/tests/Collimator Tests/Zig Zag Test/Zig Zag Test.xml new file mode 100644 index 0000000..970032d --- /dev/null +++ b/script/tests/tests/Collimator Tests/Zig Zag Test/Zig Zag Test.xml @@ -0,0 +1,35 @@ + + + + + + + 3000 + + + + 3.0 + 4.0 + 1.0 + + + 4.0 + 4.0 + 1.0 + + + + + + + + + + + + + + + + + diff --git a/script/tests/tests/Collimator Tests/motor-slide/.config b/script/tests/tests/Collimator Tests/motor-slide/.config new file mode 100644 index 0000000..3616e40 --- /dev/null +++ b/script/tests/tests/Collimator Tests/motor-slide/.config @@ -0,0 +1,3 @@ +name=motor-slide +description=Moves the device +filename=Calibrate.xml diff --git a/script/tests/tests/Collimator Tests/motor-slide/motor-slide.py b/script/tests/tests/Collimator Tests/motor-slide/motor-slide.py new file mode 100644 index 0000000..cd4161e --- /dev/null +++ b/script/tests/tests/Collimator Tests/motor-slide/motor-slide.py @@ -0,0 +1,73 @@ +#Script imported from: PO2DV-NCS-LS_mot.xml +import traceback + +#by default, failed +ret = 'Test failed' +status = False + +#Pre-actions +try: + caput('PO2DV-NCS-LS:MOTOR.TWF', '0') + sleep(0.5) + caput('PO2DV-NCS-LS:MOTOR.RDBD', '0.1') +except: + print "Unexpected error:", sys.exc_info()[0] + ret = 'Unable to create channel - ' + traceback.format_exc() + success = False + raise + sys.exit() + +#TODO: Set the diplay names of positioners and detectors +scan = ManualScan(['VAL'], ['time', 'RVAL', 'Encoder', 'RBV', 'Busy'] , [40.0], [44.0], [22]) +scan.start() + +#Creating channels: dimension 1 +#RegionPositioner VAL +VAL = Channel('PO2DV-NCS-LS:MOTOR.VAL', type = 'd') +VALReadback = Channel('PO2DV-NCS-LS:MOTOR.RBV', type = 'd') +#Timestamp time +#ScalarDetector RVAL +RVAL = Channel('PO2DV-NCS-LS:MOTOR.RVAL', type = 'd') +#ScalarDetector ENCODER +ENCODER = Channel('PO2DV-NCS-LS:ENCODER', type = 'd') +#ScalarDetector RBV +RBV = Channel('PO2DV-NCS-LS:MOTOR.RBV', type = 'd') +#ScalarDetector Busy +Busy = Channel('PO2DV-NCS-LS:MOTOR.DMOV', type = 'd') + +#Dimension 1 +#RegionPositioner VAL +for setpoint1 in frange(40.0, 42.0, 0.2, True) + frange(41.8, 40.0, 0.2, True): + VAL.put(setpoint1, timeout=None) # TODO: Set appropriate timeout + readback1 = VALReadback.get() + if abs(readback1 - setpoint1) > 0.1 : # TODO: Check accuracy + ret = 'Actor VAL could not be set to the value ' + str(setpoint2) + ' (current value: ' + str(readback2) + ')' + success = False + raise Exception(ret) + #Detector time + detector1 = float(java.lang.System.currentTimeMillis()) + #Detector RVAL + detector2 = RVAL.get() + #Detector TWF + detector3 = ENCODER.get() + #Detector RBV + detector4 = RBV.get() + #Detector Busy + detector5 = Busy.get() + scan.append ([setpoint1], [readback1], [detector1, detector2, detector3, detector4, detector5]) + +#Closing channels +VAL.close() +VALReadback.close() +RVAL.close() +ENCODER.close() +RBV.close() +Busy.close() + +scan.end() + +#Post-actions +caput('PO2DV-NCS-LS:MOTOR.RDBD', '1') + +ret = 'Test done' +status = True \ No newline at end of file diff --git a/script/tests/tests/Collimator Tests/power-supply/.config b/script/tests/tests/Collimator Tests/power-supply/.config new file mode 100644 index 0000000..db5d8ae --- /dev/null +++ b/script/tests/tests/Collimator Tests/power-supply/.config @@ -0,0 +1,3 @@ +name=power-supply +description=Moves HV +filename=Calibrate.xml diff --git a/script/tests/tests/Collimator Tests/power-supply/power-supply.py b/script/tests/tests/Collimator Tests/power-supply/power-supply.py new file mode 100644 index 0000000..f3fc9e3 --- /dev/null +++ b/script/tests/tests/Collimator Tests/power-supply/power-supply.py @@ -0,0 +1,75 @@ +#TODO: Set the diplay names of positioners and detectors +#ManualScan(writables, readables, start = None, end = None, steps = None, relative = False) + +#by default, failed +ret = 'Test failed' +status = False +DEVICE = 'PO2DV-NCS-VHQ1' + +scan = ManualScan(['time'], ['SetVA', 'ActualVA', 'ActualIA'] , [0.0], [10.0], [10]) +scan.start() + +#Creating channels: dimension 1 +#Ramp rate +SetRamp = Channel('PO2DV-NCS-VHQ1:Set-RampA', type = 'd') +#SetRamp = Channel('pw84:ai', type = 'd') +#LinearPositioner SetVA +SetVA = Channel('PO2DV-NCS-VHQ1:Set-VA', type = 'd') +#SetVA = Channel('pw84:ai', type = 'd') +#Timestamp time +#ScalarDetector ActualVA +ActualVA = Channel('PO2DV-NCS-VHQ1:Actual-VA', type = 'd') +#ActualVA = Channel('pw84:ai', type = 'd') +#ScalarDetector ActualIA +ActualIA = Channel('PO2DV-NCS-VHQ1:Actual-IA', type = 'd') +#ActualIA = Channel('pw84:ai', type = 'd') + +#Init +SetRamp.put(10.0, timeout=None) + +#set voltage to 0 +print 'Ramping down power supply to 0V' +SetVA.put(0.0, timeout=None) + +#wait up to 2 minutes for voltage to be ~0 +for setpoint1 in frange(0.0, 120.0, 1.0, True): + detector2 = ActualVA.get() + if detector2 <= 1.0: + break + sleep(0.5) + +#Dimension 1 +#LinearPositioner SetVA +print 'Ramping up power supply' +for setpoint1 in frange(0.0, 10.0, 10.0, True): + if setpoint1 > 50.0 or setpoint1 < 0.0: + break + SetVA.put(setpoint1, timeout=None) # TODO: Set appropriate timeout + readback1 = SetVA.get() + if abs(readback1 - setpoint1) > 0.5 : # TODO: Check accuracy + raise Exception('Actor SetVA could not be set to the value ' + str(setpoint1)) + break + #scan quickly the output during some seconds + for setpoint2 in range(0, 20): + #Detector time + detector1 = float(java.lang.System.currentTimeMillis()) + #Detector ActualVA + detector2 = ActualVA.get() + detector3 = ActualIA.get() + #scan.append ([setpoint1], [readback1], [detector1, detector2]) + #append(setpoints, positions, values) + scan.append ([detector1], [detector1], [readback1, detector2, detector3]) + sleep( 0.1 ) # Settling time + ret = 'Test completed' + status = True + +#reset output to 0V +SetVA.put(0.0, timeout=None) +#Closing channels +SetVA.close() +ActualVA.close() +ActualIA.close() + + + +scan.end()