This commit is contained in:
@@ -14,8 +14,8 @@ class LEEM2000(TcpDevice):
|
||||
self.debug = False
|
||||
self.retries = 1
|
||||
self.timeout = 1000
|
||||
self.move_timeout = 300000 #5min
|
||||
self.homing_timeout = 300000 #5min
|
||||
self.move_timeout = 600000 #5min
|
||||
self.homing_timeout = 600000 #5min
|
||||
|
||||
def doInitialize(self):
|
||||
super(LEEM2000, self).doInitialize()
|
||||
@@ -143,6 +143,13 @@ class LEEM2000(TcpDevice):
|
||||
ret.initialize()
|
||||
return ret
|
||||
|
||||
def get_slit_motor(self, motor_id, encoder_index, name=None):
|
||||
if name is None:
|
||||
name=str(motor_id)
|
||||
ret = LEEM2000SlitMotor(name, motor_id, encoder_index, self)
|
||||
ret.initialize()
|
||||
return ret
|
||||
|
||||
def get_tilt(self, motor_id_pos, motor_id_neg, name=None):
|
||||
if name is None:
|
||||
name=str(motor_id_pos) + "_" + str(motor_id_neg)
|
||||
@@ -150,6 +157,12 @@ class LEEM2000(TcpDevice):
|
||||
ret.initialize()
|
||||
return ret
|
||||
|
||||
def get_motor(self, motor_id, name=None):
|
||||
if name is None:
|
||||
name=str(motor_id)
|
||||
ret = LEEM2000Motor(name, motor_id, self)
|
||||
ret.initialize()
|
||||
return ret
|
||||
|
||||
def get_manip_readback(self, timeout = None, retries = None):
|
||||
ret = microscope.send_receive("gmv", timeout, retries)
|
||||
@@ -265,6 +278,45 @@ class LEEM2000ManipMotor(PositionerBase):
|
||||
pos_mm= self.microscope.get_manip_readback()[self.encoder_index]
|
||||
return pos_mm*1000.0
|
||||
|
||||
class LEEM2000SlitMotor(PositionerBase):
|
||||
def __init__(self, name, motor_id, encoder_index, microscope):
|
||||
PositionerBase.__init__(self, name, PositionerConfig())
|
||||
self.motor_id = motor_id
|
||||
self.encoder_index = encoder_index
|
||||
self.microscope = microscope
|
||||
self.pos = None
|
||||
|
||||
def doRead(self):
|
||||
if self.pos is None:
|
||||
self.pos = float(self.doReadReadback())
|
||||
return self.pos
|
||||
|
||||
def doWrite(self, val):
|
||||
self.microscope.move_motor(self.motor_id, val)
|
||||
self.pos = None
|
||||
|
||||
def doReadReadback(self):
|
||||
pos_step = self.microscope.get_value(str(self.encoder_index))
|
||||
#pos_mm= self.microscope.get_manip_readback()[self.encoder_index]
|
||||
return pos_step*0.700
|
||||
|
||||
class LEEM2000Motor(PositionerBase):
|
||||
def __init__(self,name, motor_id, microscope):
|
||||
PositionerBase.__init__(self,name, PositionerConfig())
|
||||
self.motor_id = motor_id
|
||||
self.microscope = microscope
|
||||
self.pos = None
|
||||
|
||||
def doRead(self):
|
||||
#self.microscope.get_value(str(self.motor_id))
|
||||
return self.pos
|
||||
|
||||
def doWrite(self, val):
|
||||
self.microscope.move_motor(self.motor_id, val)
|
||||
self.pos = val
|
||||
|
||||
|
||||
|
||||
class LEEM2000Tilt(RegisterBase):
|
||||
def __init__(self,name, motor_id_pos, motor_id_neg, microscope):
|
||||
RegisterBase.__init__(self,name)
|
||||
@@ -300,7 +352,13 @@ add_device (microscope.get_child("FIL","fil"), True)
|
||||
add_device (microscope.get_child("STV","start_voltage"), True)
|
||||
add_device (microscope.get_child("OBJDX","obj_align_x"), True)
|
||||
add_device (microscope.get_child("OBJDY","obj_align_y"), True)
|
||||
add_device (microscope.get_child("HMOTSLIT","slitttt"), True)
|
||||
add_device (microscope.get_child("HMOTSLIT","slit_motion_pos"), True)
|
||||
#add_device (microscope.get_child("76","slit_motion_pos"), True)
|
||||
#add_device (microscope.get_child("HMOTCAX","ca_motion_pos"), True)
|
||||
#add_device (microscope.get_child("HMOTCAY","ca_correction_pos"), True)
|
||||
add_device (microscope.get_motor(1, "ca_correction"), True)
|
||||
add_device (microscope.get_motor(2, "ca_motion"), True)
|
||||
add_device (microscope.get_slit_motor(7, 76, "slit_motion"), True)
|
||||
|
||||
microscope.setPolling(5000)
|
||||
|
||||
@@ -317,7 +375,7 @@ class TiltMotor(RegisterBase):
|
||||
return self.position
|
||||
|
||||
def doWrite(self, pos):
|
||||
if abs(pos)>8000:
|
||||
if abs(pos)>10000:
|
||||
raise Exception("Exceeded device range")
|
||||
offset = pos -self.position
|
||||
self.tilt_motor.write(offset)
|
||||
@@ -355,6 +413,7 @@ azimuth_rot.precision=1
|
||||
azimuth_rot.polling=5000
|
||||
bv.polling=1000
|
||||
fil.polling=1000
|
||||
slit_motion.polling=1000
|
||||
|
||||
#Create a listener to the sensor, verifying the readback values.
|
||||
class ListenerAzimuth (DeviceListener):
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
from collections import OrderedDict
|
||||
|
||||
PREFIX_MICROSCOPE = "Microscope "
|
||||
|
||||
diag_channels_names = { \
|
||||
#"photon energy": "X11MA-PGM:rbkenergy", \
|
||||
#"grating number": "X11MA-PGM:grating", \
|
||||
@@ -46,11 +48,11 @@ diag_channels_names = { \
|
||||
"PEEM leakage current": "X11MA-ES1-PEEM:IMON", \
|
||||
"Pressure in PEEM": "X11MA-ES1-MAIN:PRESSURE", \
|
||||
"Pressure in Column": "X11MA-ES1-COLU:PRESSURE", \
|
||||
"SW Pt100 sample temperature": "X11MA-PC-SW:Pt100-K", \
|
||||
"SW Pt100 resistance": "X11MA-PC-SW:Pt100-R", \
|
||||
"SW E-field value voltage": "X11MA-PC-SW:E-Field-V", \
|
||||
"SW E-field value current": "X11MA-PC-SW:E-Field-I", \
|
||||
"SW Resistence value resistence": "X11MA-PC-SW:Resistance", \
|
||||
#"SW Pt100 sample temperature": "X11MA-PC-SW:Pt100-K", \
|
||||
#"SW Pt100 resistance": "X11MA-PC-SW:Pt100-R", \
|
||||
#"SW E-field value voltage": "X11MA-PC-SW:E-Field-V", \
|
||||
#"SW E-field value current": "X11MA-PC-SW:E-Field-I", \
|
||||
#"SW Resistence value resistence": "X11MA-PC-SW:Resistance", \
|
||||
"Cooling He flow meas": "X11MA-PC-BRONKHORST:PEEM-GET-MEASURE", \
|
||||
"Cooling He flow set": "X11MA-PC-BRONKHORST:PEEM-SET-SETPOINT", \
|
||||
"Cooling Needle Valve": "X11MA-ES1-AO4:V", \
|
||||
@@ -103,7 +105,7 @@ diag_devices = {
|
||||
"PEEM high voltage": microscope.high_voltage, \
|
||||
"Tilt vertical": tilt_vertical, \
|
||||
"Tilt horizontal": tilt_horizontal, \
|
||||
"ai1 current": ai1, \
|
||||
# "ai1 current": ai1, \
|
||||
}
|
||||
|
||||
|
||||
@@ -148,15 +150,15 @@ def get_diags():
|
||||
|
||||
if microscope.initialized and microscope.client.isConnected():
|
||||
for k,v in get_microscope_diags().items():
|
||||
ret["Microscope " + k] = str(v)
|
||||
ret[PREFIX_MICROSCOPE + k] = str(v)
|
||||
try:
|
||||
ret["Microscope Manip. X"] = str(manip_x.readback.read())
|
||||
ret[PREFIX_MICROSCOPE + "Manip. X"] = str(manip_x.readback.read())
|
||||
except:
|
||||
ret["Microscope Manip. X"] = "Error: " + str(sys.exc_info()[1])
|
||||
ret[PREFIX_MICROSCOPE + "Manip. X"] = "Error: " + str(sys.exc_info()[1])
|
||||
try:
|
||||
ret["Microscope Manip. Y"] = str(manip_y.readback.read())
|
||||
ret[PREFIX_MICROSCOPE + "Manip. Y"] = str(manip_y.readback.read())
|
||||
except:
|
||||
ret["Microscope Manip. Y"] = "Error: " + str(sys.exc_info()[1])
|
||||
ret[PREFIX_MICROSCOPE + "Manip. Y"] = "Error: " + str(sys.exc_info()[1])
|
||||
|
||||
return OrderedDict(sorted(ret.items(), key=lambda i: i[0].lower()))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user