Device Level (DL)¶
Start by importing Cavro Centris Syringe Pump device level code.
>>> from syringe_pump.device import Device
>>> p1 = Device()
>>> p1.init(1,25,100,'Y',250)
>>> p1.start()
>>> p1.position
0.0
>>> p1.prime(N=2)
>>> p1.fill()
-
class
syringe_pump.device.Device[source]¶ -
-
create_low_pressure(N=1)[source]¶ performs safe compound “create_low_pressure” command which creates low pressure in syringe pump #2.
Examples
>>> device.create_low_pressure(N = 1)
-
empty()[source]¶ performs safe compound “empty” command which empties the syringe with fluid back into the reservour. The final state of the valve is ‘out’.
Examples
>>> device.empty()
-
execute_cmd(command)[source]¶ executes command from CMD(command) PV.
- Parameters
- command: string
Examples
>>> device.execute_cmd(command = 'exec:flow(position = 25,speed = 0.1)')
-
fill(volume=None)[source]¶ performs safe compound “fill” command which refills the syringe with fluid from the reservour. The final state of the valve is ‘out’.
- Parameters
- volume :: float
volume in uL to fill up to.
Examples
>>> device.fill(volume = 100.0)
-
flow(position=0, speed=0.1)[source]¶ performs safe compound “flow” command which initits flow towards posotion with the given speed. Makes sure to set the valve orientation to ‘o’ output.
Examples
>>> device.flow(position = 25, speed = 0.1)
-
get_cmd_position()[source]¶ get commanded position of the pump
- Returns
- value: float
last known commanded position
Examples
>>> device.get_cmd_position() 0.0
-
get_position()[source]¶ request position of the pump via driver
- Returns
- value: float
current pump position
Examples
>>> device.get_position() 0.0
-
get_speed()[source]¶ read speed from the pump
- Returns
- speed: float
returns pump speed
Examples
>>> device.get_speed() 25.0
-
get_valve()[source]¶ reads valve orientation from the pump
- Returns
- valve: string
valve orientation as a string” ‘i’,’o’,’b’
Examples
>>> device.get_valve() 'i'
-
init(pump_id=None, speed=None, backlash=None, orientation=None, volume=None)[source]¶ initialize the device level code
initializes the driver
sets default valve position to ‘o’
sets initial position to 0.0
sets initial speed to input speed value
- Parameters
- pump_id: integer
pump_id
- speed: float
initial speed of the syringe pump, default is 25
- backlash: float
the backlash of the syringe pump. The default value is 100
- orientation: string
the orientation of the syringe pump valve: Y or Z
- volume: float
the volume of the installed syringe
Examples
>>> device.init(pump_id = 1, speed = 25, backlash = 100,orientation = 'Y', volume = 250)
-
ioexecute(pv_name=None, value=None, **kwargs)[source]¶ executes command arrived from IO
- Parameters
- pv_name: (string)
string name of the PV
- value: (string,list,integer,float,array)
the new value to be submitted to io for processing.
Examples
>>> device.ioexecute(pv_name = '.running',value = False)
-
ioread(pv_name=None, value=None)[source]¶ put dictionary of key:value pairs to IO.
- Parameters
- pv_dict: (dictionary)
dictionary of PVs and new PV values
Examples
>>> device.ioput(pv_name = '.running',value = False)
-
iowrite(pv_name=None, value=None)[source]¶ put dictionary of key:value pairs to IO.
- Parameters
- pv_name: (string)
string name of the PV
- value: (string,list,integer,float,array)
the new value to be submitted to io for processing.
Examples
>>> device.ioput(pv_name = '.running',value = True)
-
isdonemoving()[source]¶ return flag if motion is complete. It will compare the cmd_position and actual position
- Returns
- flag: boolean
boolean if motor is moving or not
Examples
>>> device.isdonemoving() True
-
kill()[source]¶ orderly close of the serial port and shutdown of the device and deletion of the instance
Examples
>>> device.kill()
-
property
moving¶ an alias for busy
-
prime(N=5)[source]¶ performs safe compound “prime” command which empties and fills the syringe N times The final state of the valve is ‘out’. The final state of the syringe is full.
- Parameters
- N: ingteger
number of times to empty and fill. Default = 5 which is good enough.
Examples
>>> device.empty()
-
process_driver_reply(reply)[source]¶ waits for the syringe to finish the previous task. The while loop checks every dt for the status of the syringe pump.
- Parameters
- dt: float
period in seconds at which the ump status is checked.
Examples
>>> reply = {'value': '', 'error_code': '`', 'busy': False, 'error': 'No Error'} >>> device.process_driver_reply(reply)
-
set_cmd_position(value)[source]¶ set commanded position of the pump
- Parameters
- value: float
last known commanded position
Examples
>>> device.set_cmd_position(value = 25.0)
-
set_speed(value)[source]¶ sets speed of the pump. no limits on the input value
- Parameters
- speed: float
pump speed
Examples
>>> device.set_speed(25.0)
-
set_speed_on_the_fly(value)[source]¶ sets speed on the fly. speed values above 68.8 will be ignored.
- Parameters
- speed: float
pump speed
Examples
>>> device.set_speed_on_the_fly(25.0)
-
set_valve(value)[source]¶ writes valve orientation into the pump
- Parameters
- valve: string
valve orientation as a string” ‘i’,’o’,’b’
Examples
>>> device.get_valve('i')
-