dgbowl / tomato

tomato: au-tomation without the pain!
https://dgbowl.github.io/tomato
GNU General Public License v3.0
5 stars 6 forks source link

New driver interface for `tomato-1.0` #79

Closed PeterKraus closed 3 months ago

PeterKraus commented 6 months ago

Motivation

In the tomato-0.2 branch, the driver and job interfaces were basically merged into one piece of code: each job talked to each physical device separately, which was causing some race conditions (#28). With only one supported type of device, i.e. the biologic driver, this kind-of made sense at the time.

In tomato-1.0, we want to pave the road for a "device dashboard", meaning the device statuses have to be accessible from outside of the jobs. As a reminder, the relationship between jobs and devices in tomato-1.0 is shown below:

concepts_flowchart

Basically, each device (a digital twin of a physical device) is managed by a driver, and there is only one driver process running managing all devices of that type. All communication with the physical device is therefore handled by the driver, the individual physical devices (and channels within them) can be addressed when one knows the device address and channel.

Requirements

  1. We would like the new driver interface to handle a wide range of physical devices, e.g.:

    • thermocouple readers, e.g. PicoLog, which are almost completely read-only
    • volumetric flow meters, e.g. Mesa DryCal, which have a few adjustable parameters, have a start/stop function
    • mass flow controllers, e.g. Bronkhorst, which have setpoints
    • temperature controllers, e.g. Jumo, which might have ramps
    • gas chromatographs, e.g. Fusion, where a measurement might take ~ 5 minutes and might have to be scheduled
    • potentiostats, e.g. Biologic, where a single set of instructions can contain a whole cycling protocol
  2. The rest of tomato should be completely driver-agnostic, i.e. everything relevant for the measurement comes from the driver (available parameters, units, adjustable limits, etc.). This means the list of techniques and parameters, i.e. the driver specific language (DSL), has to be defined and documented in the driver docs.

  3. Some functionality, e.g. task scheduling or conditional interruption, should be probably implemented just once and made available to every driver via specific keywords. Currently I can think of the following examples:

    • if I want to measure temperature for 10 minutes every 15 seconds, but only poll for new data every 60 seconds, I need to be able to tell the driver that it's supposed to communiate with the device with a 15 second resolution, caching the data. Then, tomato calls the driver's get_data() every 60 seconds, and sends a stop signal after 10 minutes.

Implementation

Design questions

PeterKraus commented 5 months ago

Notes from our meeting on the 22th of May:

PeterKraus commented 5 months ago

ToDo for tomato-1.0:

NukP commented 5 months ago

@PeterKraus Can you elaborated on 'implement support for tomato-drycal' more? Do you mean writing a driver that handle the communication (write and read data) between tomato and the DryCal flow meter?

PeterKraus commented 5 months ago

Yup, basically incorporating your work on the DryCal into tomato. We also have one in Berlin, so testing would be fairly easy.

NukP commented 5 months ago

@PeterKraus OK, I should be able to allocate time for this (hopefully it doesn't take long). I have a look at the driver folder in the Master branch and from what I talked to Graham, do I understand it correctly that you haven't finished designing the dummy driver? If so, I would wait until this is the case.