示例#1
0
def inject(direction, volume, **params):
    WaitTime = 0.0055  #wait between steps to make 1mL/min spead
    if "speed" in params:
        coeff = float(params['speed'])  #speed in mL/min
        WaitTime = WaitTime / coeff
    sul10 = 10.71 / 0.976698 / 1.038  #number of steps in 1 uL
    steps = int(float(volume) * sul10)
    print("Starting {} ({}ul, {} steps)".format(direction, volume, steps))

    gpio.setmode(gpio.BCM)
    gpio.setup(PIN_STEP, gpio.OUT)
    gpio.setup(PIN_DIR, gpio.OUT)

    if direction == 'out':
        homeinc = -1  #increment coefficient to modify home positions
        gpio.output(PIN_DIR, True)
    elif direction == 'in':
        homeinc = 1
        gpio.output(PIN_DIR, False)
    else:
        print("Attention: wrong direction")
    StepCounter = 0
    while StepCounter < steps:
        gpio.output(PIN_STEP, True)
        gpio.output(PIN_STEP, False)
        StepCounter += 1
        bufferSteps = StepCounter
        time.sleep(WaitTime)
    gpio.cleanup()

    #temp() ##measuring temperature in the end of a cycle

    lastvalue = int(config.readvalue('antibody'))
    newvalue = lastvalue + homeinc * StepCounter
    config.writevalue('antibody', str(newvalue))
示例#2
0
def home(**params):
    WaitTime = 0.0055 / 5  #wait between steps to make 5mL/min spead
    if "speed" in params:
        coeff = float(params['speed'])  #speed in mL/min
        WaitTime = WaitTime / coeff
    steps = int(config.readvalue('antibody'))

    print("Started homing antibody syringe ({} steps)".format(steps))
    config.writevalue('antibody', '0')
    gpio.setmode(gpio.BCM)
    gpio.setup(PIN_STEP, gpio.OUT)
    gpio.setup(PIN_DIR, gpio.OUT)
    gpio.output(PIN_DIR, True)  #always out syringe press
    StepCounter = 0
    if steps <= 0:
        steps *= -1  #if negative, do in
        gpio.output(PIN_DIR, False)
    else:
        gpio.output(PIN_DIR, True)
    while StepCounter < steps:
        gpio.output(PIN_STEP, True)
        gpio.output(PIN_STEP, False)
        StepCounter += 1
        bufferSteps = StepCounter
        time.sleep(WaitTime)
    gpio.cleanup()
示例#3
0
def move(direction):
	if not (direction == 'up' or direction == 'down'):
		print("ATTENTION: wrong parameter for needle movement (only 'up' and 'down' are allowed; your input: "+direction)
		input()
	WaitTime = 0.0005
	steps = 200*30 #1mm = 200 steps; 40 mm overall
	current_position = config.readvalue('needle')
	if direction == current_position:
		inp = ""
		while not (inp == "OK"):
			print ("ATTENTION: needle seems to be already in {} position (Ctrl+C to stop execution)".format (direction))
			inp = input()
	print("Needle move ({})".format(direction.capitalize()))
	gpio.setmode(gpio.BCM)
	gpio.setup(PIN_STEP, gpio.OUT) #steps
	gpio.setup(PIN_DIR, gpio.OUT) #direction
	config.writevalue('needle',direction)
	if direction == 'down':
		gpio.output(PIN_DIR, False)
	elif direction == 'up':
		gpio.output(PIN_DIR, True)

	StepCounter = 0
	while StepCounter < steps:
		gpio.output(PIN_STEP, True)
		gpio.output(PIN_STEP, False)
		StepCounter += 1
		time.sleep(WaitTime)
	gpio.cleanup()
示例#4
0
def prime (direction, volume, **params): #same as inject, but without stirring
	WaitTime = 0.0055 #wait between steps to make 1mL/min spead
	if "speed" in params:
		coeff = float(params['speed']) #speed in mL/min
		WaitTime = WaitTime/coeff
	sul10 = 182.14/1.495*0.985 #number of steps in 1 uL
	steps = int(float(volume)*sul10)
	gpio.setmode(gpio.BCM)
	gpio.setup(PIN_DIR, gpio.OUT)
	gpio.setup(PIN_STEP, gpio.OUT)

	if direction == 'out':
		gpio.output(PIN_DIR, True)
		homeinc = -1
	elif direction == 'in':
		gpio.output(PIN_DIR, False)
		homeinc = 1
	StepCounter = 0
	print("Starting reagent {} prime ({}uL, {} steps)".format(direction,int(volume),steps))
	while StepCounter < steps:
		gpio.output(PIN_STEP, True)
		gpio.output(PIN_STEP, False)
		StepCounter += 1
		time.sleep(WaitTime)
	lastvalue = int(config.readvalue('reagent')) #reading last position in steps
	newvalue = lastvalue + homeinc*StepCounter
	config.writevalue('reagent',str(newvalue))
	gpio.cleanup()
示例#5
0
def home(**params):
	WaitTime = 0.00324/5 #wait between steps to make 5mL/min speed
	if "speed" in params:
		coeff = float(params['speed']) #speed in mL/min
		WaitTime = WaitTime/coeff
	steps = int(config.readvalue('reagent'))
	print("Started homing reagent syringe ({} steps)".format(steps))
	config.writevalue('reagent','0')
	gpio.setmode(gpio.BCM)
	gpio.setup(PIN_DIR, gpio.OUT)
	gpio.setup(PIN_STEP, gpio.OUT)
	if steps >= 0:
		gpio.output(PIN_DIR, True) ##in direction
	else:
		steps = steps * (-1)
		gpio.output(PIN_DIR, False) ##out direction
	StepCounter = 0
	while StepCounter < steps:
		gpio.output(PIN_STEP, True)
		gpio.output(PIN_STEP, False)
		StepCounter += 1
		bufferSteps = StepCounter
		time.sleep(WaitTime)
#	print("Ended homing reagent syringe")
	gpio.cleanup()
示例#6
0
文件: rvol.py 项目: k0n1ev/darx
def main(win):
    global dir
    global speed
    WaitTime = 0.0055 / speed  #wait between steps to make 1mL/min spead
    sul10 = 10.71 / 0.976698 / 1.038  #number of steps in 1 uL
    maxsteps = 12000 * sul10  ##max volume of 15 mL
    gpio.setmode(gpio.BCM)
    gpio.setup(PIN_DIR, gpio.OUT)
    gpio.setup(PIN_STEP, gpio.OUT)
    if dir == "in" or dir == "IN":
        gpio.output(PIN_DIR, False)
        homeinc = 1  #for config (direction of steps)
    elif dir == "out" or dir == "OUT":
        gpio.output(PIN_DIR, True)
        homeinc = -1
    else:
        print(
            "Wrong direction provided (should be IN or OUT). Starting IN direction."
        )
        dir = "IN"
        gpio.output(PIN_DIR, False)
        homeinc = 1
    win.nodelay(True)
    key = ""
    win.clear()
    outmessage = "Measuring reactor volume (press C to measure or E to stop). Direction: {}.\n".format(
        dir)
    win.addstr(outmessage)
    StepCounter = 0
    while StepCounter < maxsteps:
        try:
            key = win.getkey()
            win.clear()
            win.addstr(outmessage)
            if key == "c" or key == "C":
                win.clear()
                outmessage += "[{}] Current volume: {}uL\n".format(
                    datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
                    str(int(StepCounter / sul10)))
                win.addstr(outmessage)
            if key == "e" or key == "E":
                outmessage += "[{}] Final volume: {}uL".format(
                    datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
                    str(int(StepCounter / sul10)))
                break
        except Exception as e:
            pass
        gpio.output(PIN_STEP, True)
        gpio.output(PIN_STEP, False)
        StepCounter += 1
        time.sleep(WaitTime)
    gpio.cleanup()
    lastvalue = int(
        config.readvalue('antibody'))  #reading last position in steps
    newvalue = lastvalue + homeinc * StepCounter
    config.writevalue('antibody', str(newvalue))
    return outmessage
示例#7
0
def inject (direction, volume, **params):
	WaitTime = 0.00324 #wait between steps to make 100uL/min speed
	if "speed" in params:
		coeff = float(params['speed']) #speed in 0.1mL/min
		WaitTime = WaitTime/coeff
	sul10 = 182.14/1.495*0.985 #number of steps in 1 uL
	steps = int(float(volume)*sul10)

	print("Mixing started")
	print("Starting reagent {} injection ({}uL, {} steps)".format(direction,round(volume,1),steps))

	gpio.setmode(gpio.BCM)
	gpio.setup(PIN_DIR, gpio.OUT)
	gpio.setup(PIN_STEP, gpio.OUT)

	##routine of mixing + stopping all other motors
	gpio.setup(14,gpio.OUT)
	gpio.output(14, False)
	gpio.setup(16,gpio.OUT)
	gpio.output(16, False)
	#strating agitation
	gpio.setup(PIN_MIX, gpio.OUT)

	if direction == 'out':
		gpio.output(PIN_DIR, True)
		homeinc = -1
	elif direction == 'in':
		homeinc = 1
		gpio.output(PIN_DIR, False)
	StepCounter = 0
	while StepCounter < steps:
		gpio.output(PIN_STEP, True)
		gpio.output(PIN_STEP, False)
		StepCounter += 1
		time.sleep(WaitTime)
	lastvalue = int(config.readvalue('reagent')) #reading last position in steps
	newvalue = lastvalue + homeinc*StepCounter
	config.writevalue('reagent',str(newvalue))

	time.sleep(post_inj_mix)
	print("Mixing ended")
	gpio.cleanup()