Files
ncs/script/Marco/power-supply.py
2015-05-20 16:18:14 +02:00

57 lines
1.6 KiB
Python

#Script imported from: PO2DV-NCS-HW_ps.xml
#Pre-actions
caput('PO2DV-NCS-VHQ1:Set-RampA', '20')
sleep(0.5)
#TODO: Set the diplay names of positioners and detectors
scan = ManualScan(['SetVA'], ['time', 'ActualVA'] , [0.0], [50.0], [50])
scan.start()
#Creating channels: dimension 1
#LinearPositioner SetVA
SetVA = Channel('PO2DV-NCS-VHQ1:Set-VA', type = 'd')
#Timestamp time
#ScalarDetector ActualVA
ActualVA = Channel('PO2DV-NCS-VHQ1:Actual-VA', type = 'd')
#set voltage to 0
caput('PO2DV-NCS-VHQ1:Set-VA', '0')
#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
for setpoint1 in frange(0.0, 50.0, 4.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))
for setpoint2 in frange(0.0, 40.0, 1.0, True):
#Detector time
detector1 = float(java.lang.System.currentTimeMillis())
#Detector ActualVA
detector2 = ActualVA.get()
#scan.append ([setpoint1], [readback1], [detector1, detector2])
scan.append ([detector1], [detector1], [readback1, detector2])
sleep( 0.1 ) # Settling time
if detector2 >= setpoint1:
break
#Closing channels
SetVA.close()
ActualVA.close()
scan.end()
#Post-actions
caput('PO2DV-NCS-VHQ1:Set-VA', '0')
#sleep(4.0)