Weiter auf der Strecke

This commit is contained in:
jens 2022-02-01 18:22:42 +01:00
parent c2a2ec492c
commit 250fa6ee23
3 changed files with 79 additions and 41 deletions

View File

@ -1,9 +1,13 @@
from lib2to3 import refactor
from shutil import register_unpack_format
import tkinter as tk import tkinter as tk
import tkinter.ttk as ttk import tkinter.ttk as ttk
import os import os
from configparser import ConfigParser from configparser import ConfigParser
import serial.tools.list_ports import serial.tools.list_ports
from idlelib.tooltip import * from idlelib.tooltip import *
from labrobot import LabReactBlock
from labrobot import ChemLoc
import labrobot as lrb import labrobot as lrb
# serial ports # serial ports
ports = serial.tools.list_ports.comports() ports = serial.tools.list_ports.comports()
@ -25,7 +29,7 @@ orders =['Home','HomeX','HomeY']
## chemicals ## chemicals
substances = ['Water','Propanol','Aceton'] substances = ['Water','Propanol','Aceton']
clabels = ['x','y','z','volume','z/ml','reakVolume'] clabels = ['x','y','z','volume','z/ml','reakvolume']
centrys = [] centrys = []
chem_config = ConfigParser() chem_config = ConfigParser()
@ -128,6 +132,8 @@ root = tk.Tk()
akttip = tk.IntVar() akttip = tk.IntVar()
lbp = lrb.LabPipBlock lbp = lrb.LabPipBlock
pip = lrb.LabPip pip = lrb.LabPip
startVessel = tk.IntVar()
lastVessel = tk.IntVar()
##init ##init
load_chem_config() load_chem_config()
substances = chem_config.sections() substances = chem_config.sections()
@ -223,32 +229,39 @@ b17 = ttk.Button(downrightframe,text='Load All')
b17.grid(row=4,column=2,sticky='e') b17.grid(row=4,column=2,sticky='e')
b18 = ttk.Button(downrightframe,text='Clear Tip') b18 = ttk.Button(downrightframe,text='Clear Tip')
b18.grid(row=3,column=2,sticky='e') b18.grid(row=3,column=2,sticky='e')
## Info Panel
downrightframe1 =ttk.LabelFrame(rightframe,text='Info')
downrightframe1.grid(column=0,row=2,sticky='new',pady=5)
i1l = ttk.Label(downrightframe1,text='Tip Nr')
i1l.grid(row=0,column=0)
i2l =ttk.Label(downrightframe1,textvariable=akttip)
i2l.grid(row=0,column=1)
## Robot
downrightframe2 =ttk.LabelFrame(rightframe,text='Robot')
## Test Zugriff downrightframe2.grid(column=0,row=3,sticky='new',pady=5)
downrightframe2 =ttk.LabelFrame(rightframe,text='Tests') ## Chemicals
downrightframe2.grid(column=0,row=3,sticky='new',pady=5)
fra1 = ttk.LabelFrame(downrightframe2,text=' Chemicals') fra1 = ttk.LabelFrame(downrightframe2,text=' Chemicals')
fra1.grid(row=0,column=0,sticky='nw') fra1.grid(row=0,column=0,sticky='nw')
chemsub = tk.StringVar() chemsub = tk.StringVar()
chemlab = tk.StringVar() chemvol = tk.StringVar() #Volumen
chemit = tk.StringVar() reacvol = tk.StringVar() #Reaktionsvolumen
def doit(*args): ttk.Label(fra1,text='Vol[ml]').grid(row=0,column=1)
chemit.set(str(chem_config[chemsub.get()][chemlab.get()])) ttk.Label(fra1,textvariable=chemvol).grid(row=0,column=2)
chemopt = ttk.OptionMenu(fra1,chemsub,substances[0],*substances,command=doit) ttk.Label(fra1,text='Reac[ul]').grid(row=0,column=3)
chemopt.grid(row=1,column=0,sticky='e') ttk.Label(fra1,textvariable=reacvol).grid(row=0,column=4)
chemopt1 = ttk.OptionMenu(fra1,chemlab,clabels[0],*clabels,command=doit)
chemopt1.grid(row=1,column=1,sticky='e') def do_chemicals(*args):
chemerg = ttk.Label(fra1,textvariable=chemit) global chem
chemerg.grid(row=1,column=2,sticky='ne') chem = ChemLoc(chem_config[chemsub.get()]['x'],
chem_config[chemsub.get()]['y'],
chem_config[chemsub.get()]['z'],
chem_config[chemsub.get()]['volume'],
chem_config[chemsub.get()]['z/ml'],
chem_config[chemsub.get()]['reakvolume'],
)
chemvol.set(chem_config[chemsub.get()]['volume'])
reacvol.set(chem_config[chemsub.get()]['reakvolume'])
chemopt = ttk.OptionMenu(fra1,chemsub,substances[0],*substances,command=do_chemicals)
chemopt.grid(row=0,column=0,sticky='e')
do_chemicals()
## Pipettes ## Pipettes
fra2 = ttk.LabelFrame(downrightframe2,text=' Pipettes') fra2 = ttk.LabelFrame(downrightframe2,text=' Pipettes')
fra2.grid(row=1,column=0,sticky='nw') fra2.grid(row=1,column=0,sticky='nw')
@ -267,7 +280,6 @@ def do_pipettes(*args):
pipet_config[pips.get()]['tiphub'], pipet_config[pips.get()]['tiphub'],
pipet_config[pips.get()]['tipspeed'], pipet_config[pips.get()]['tipspeed'],
pipet_config[pips.get()]['tipup']) pipet_config[pips.get()]['tipup'])
print(pip)
pipopt = ttk.OptionMenu(fra2,pips,pipettes[0],*pipettes,command=do_pipettes) pipopt = ttk.OptionMenu(fra2,pips,pipettes[0],*pipettes,command=do_pipettes)
pipopt.grid(row=0,column=0,sticky='ew') pipopt.grid(row=0,column=0,sticky='ew')
@ -275,8 +287,28 @@ do_pipettes()
aktvol = tk.StringVar() aktvol = tk.StringVar()
aktvol.set('----') aktvol.set('----')
ttk.Label(fra2,textvariable=aktvol).grid(row=0,column=1,sticky='ew') ttk.Label(fra2,textvariable=aktvol).grid(row=0,column=1,sticky='ew')
ttk.Label(fra2,text='Tip Nr').grid(row=0,column=2)
ttk.Label(fra2,textvariable=akttip).grid(row=0,column=4)
## Vessels
fra3 = ttk.LabelFrame(downrightframe2,text=' Vessels') fra3 = ttk.LabelFrame(downrightframe2,text=' Vessels')
fra3.grid(row=2,column=0,sticky='nw') fra3.grid(row=2,column=0,sticky='nw')
vess = tk.StringVar()
def do_vessels(*args):
global reakt
reakt = LabReactBlock(vess_config[vess.get()]['rxoffset'],
vess_config[vess.get()]['ryoffset'],
vess_config[vess.get()]['rzlevel'],
vess_config[vess.get()]['rrows'],
vess_config[vess.get()]['rcols'],
vess_config[vess.get()]['rxspace'],
vess_config[vess.get()]['ryspace'],
)
vessopt = ttk.OptionMenu(fra3,vess,vessels[0],*vessels,command= do_vessels)
vessopt.grid(row=0,column=0)
do_vessels()
## main serial command ## main serial command
def homeAll(): def homeAll():
@ -343,7 +375,7 @@ def load():
b13.config(command=load) b13.config(command=load)
def dispense(): def dispense():
v = reaPart.get() v = reacvol.get()
if pip.dispenseVol(v): if pip.dispenseVol(v):
command.append(pip.sendE().encode('utf-8')) command.append(pip.sendE().encode('utf-8'))
else : else :
@ -369,13 +401,13 @@ def takeChem():
command.append(pip.down().encode('utf-8')) command.append(pip.down().encode('utf-8'))
load() load()
command.append(pip.up().encode('utf-8')) command.append(pip.up().encode('utf-8'))
chemVol.set(chem.vol) #chemVol.set(chem.vol)
b14.config(command=takeChem) b14.config(command=takeChem)
def nextVessel(): def nextVessel():
upTip() upTip()
command.append(pip.get_tip(react.next()).encode('utf-8')) command.append(pip.get_tip(reakt.next()).encode('utf-8'))
rakt.set(react.akt) reakt.set(reakt.akt)
downTip() downTip()
b15.config(command=nextVessel) b15.config(command=nextVessel)
@ -393,10 +425,10 @@ def loadSerie():
q = lastVessel.get() + 1 q = lastVessel.get() + 1
for i in range(p,q): for i in range(p,q):
print(i) print(i)
react.akt = i reakt.akt = i
rakt.set(react.akt) reakt.set(reakt.akt)
upTip() upTip()
command.append(pip.get_tip(react.same()).encode('utf-8')) command.append(pip.get_tip(reakt.same()).encode('utf-8'))
downTip() downTip()
dispense() dispense()
upTip() upTip()
@ -427,6 +459,12 @@ pipetframe = ttk.Frame(notebook)
notebook.add(pipetframe,text='pipettes',underline=0) notebook.add(pipetframe,text='pipettes',underline=0)
init_pipet() init_pipet()
### Init Vars
startVessel.set(1)
e2.config(textvariable=startVessel)
lastVessel.set(6)
e3.config(textvariable=lastVessel)
## looping and working ## looping and working
weiter = True weiter = True
def checkSerialPort(): def checkSerialPort():

View File

@ -1,7 +1,7 @@
[Water] [Water]
x = 50 x = 50
y = 10 y = 10
z = z = 10
volume = 100 volume = 100
z/ml = 0.1 z/ml = 0.1
reakvolume = 100 reakvolume = 100
@ -9,24 +9,24 @@ reakvolume = 100
[Propanol] [Propanol]
x = 100 x = 100
y = 10 y = 10
z = z = 10
volume = volume = 100
z/ml = 1 z/ml = 1
reakvolume = 500 reakvolume = 500
[Aceton] [Aceton]
x = 150 x = 150
y = 20 y = 20
z = z = 10
volume = volume = 100
z/ml = 1 z/ml = 1
reakvolume = 500 reakvolume = 500
[Mausi] [Mausi]
x = 200 x = 200
y = 30 y = 30
z = z = 10
volume = volume = 100
z/ml = 1 z/ml = 1
reakvolume = 1000 reakvolume = 1000
@ -34,7 +34,7 @@ reakvolume = 1000
x = 200 x = 200
y = 40 y = 40
z = 12 z = 12
volume = volume = 100
z/ml = 1 z/ml = 1
reakvolume = 1000 reakvolume = 1000

View File

@ -164,13 +164,13 @@ class ChemLoc():
vol of chemical vol of chemical
change of surface per ml """ change of surface per ml """
def __init__(self,xloc,yloc,zloc,vol,deltaz,tauch,chemvol): def __init__(self,xloc,yloc,zloc,vol,deltaz,chemvol):
self.xloc = xloc self.xloc = xloc
self.yloc = yloc self.yloc = yloc
self.zloc = zloc self.zloc = zloc
self.vol = vol self.vol = vol
self.deltaz = deltaz self.deltaz = deltaz
self.tauch = tauch #self.tauch = tauch
self.chemvol = chemvol self.chemvol = chemvol
def getXY(self): def getXY(self):