def __init__(self, doCalibration=False): # calibration will move the plunger! try: self.bus = qmixbus.Bus() self.bus.open('vinnig', '') self.bus.start() self.pump = qmixpump.Pump() self.pump.lookup_by_device_index(0) self.pump.clear_fault() self.pump.enable(True) self.pump.set_volume_unit(qmixbus.UnitPrefix.milli, qmixpump.VolumeUnit.litres) self.pump.set_flow_unit(qmixbus.UnitPrefix.milli, qmixpump.VolumeUnit.litres, qmixbus.TimeUnit.per_second) self.valve = self.pump.get_valve() if (doCalibration): self.pump.calibrate() timeout_timer = qmixbus.PollingTimer(10000) timeout_timer.wait_until(self.pump.is_calibration_finished, True) except: print('Could not init device')
def connect_to_bus_and_enable_pump( config_path: str) -> Tuple[qmixbus.Bus, qmixpump.Pump]: """ Loads a valid Qmix configuration, connects to the bus, retrieves the pump and enables it. :param config_path: Path to a valid Qmix device configuration :type config_path: str :return: A tuple containing the opened and started bus as well as the enabled pump. :rtype: tuple """ logging.debug("Opening bus") bus = qmixbus.Bus() try: bus.open(config_path, 0) except qmixbus.DeviceError as err: logging.error("could not open the bus communication: %s", err) logging.debug("Looking up pump...") if qmixpump.Pump.get_no_of_pumps() > 1: logging.info( "Found more than one pump but this SiLA server will only use the first pump. Use the SiLA_neMESYS.py script if you want to control multiple pumps via SiLA 2." ) pump = qmixpump.Pump() pump.lookup_by_device_index(0) bus.start() if pump.is_in_fault_state(): pump.clear_fault() if not pump.is_enabled(): pump.enable(True) return (bus, pump)
def __init__(self, device_config_path: str = ""): if not device_config_path: return logging.debug("Looking up devices...") self.device_config = DeviceConfiguration(device_config_path) self.bus = qmixbus.Bus() self.open_bus() # The order is important here! Many devices have I/O channels but are not # pure I/O devices (similarly, pumps might have a valve but they're not a # valve device). That's why valves have to be detected after pumps and I/O # devices have to be detected last (since then we can guarantee that there # is no possibility for an I/O channel to belong to an I/O device). self.pumps = self.get_availabe_pumps() self.axis_systems = self.get_availabe_axis_systems() self.valves = self.get_availabe_valves() self.controllers = self.get_availabe_controllers() self.io_devices = self.get_availabe_io_channels() self.balances = self.get_availabe_balances() logging.debug(f"Pumps: {repr(self.pumps)}") logging.debug(f"axis: {repr(self.axis_systems)}") logging.debug(f"valve devices: {repr(self.valves)}") logging.debug(f"controller devices: {repr(self.controllers)}") logging.debug(f"io devices: {repr(self.io_devices)}") logging.debug(f"balance devices: {repr(self.balances)}") self.state = SystemState.OPERATIONAL
def step01_capi_open(self): """ Tests opening the connection to the devices """ print("Opening bus with deviceconfig ", deviceconfig) self.bus = qmixbus.Bus() self.bus.open(deviceconfig, 0)
def step01_capi_open(self): """ Opens the internal bus and starts communication """ print("Opening bus with deviceconfig ", deviceconfig) self.bus = qmixbus.Bus() self.bus.open(deviceconfig, 0) self.bus.start()
def __init__(self, deviceconfig): # Open bus with deviceconfig # N.B. create the deviceconfig file using the QmixElements software self.bus = qmixbus.Bus() self.bus.open(deviceconfig, 0) self.vol_unit = None self.flow_unit = None self.syringe = None self.calibrated = False
def step01_capi_open(self): print("Opening bus with deviceconfig ", deviceconfig) self.bus = qmixbus.Bus() self.bus.open(deviceconfig, 0)