Startup
This commit is contained in:
@@ -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
|
||||
@@ -0,0 +1,74 @@
|
||||
#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
|
||||
|
||||
scan = ManualScan(['time'], ['SetVA', 'ActualVA', 'ActualIA'] , [0.0], [20.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, 20.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()
|
||||
Reference in New Issue
Block a user