Giter Site home page Giter Site logo

julabo's Introduction

Julabo library

Julabo CF31

This library is used to control basic features of Julabo equipment. It is composed of a core library, an optional simulator and an optional tango device server.

It has been tested with CF31, HL-4, MS-1000f and FC models, but should work with other models too.

It can be used with either with a direct serial line (read below on the recommended way to setup a serial line connection) or remotely through TCP socket (either raw socket or rfc2217). In the latter case the master device to which the Julabo serial line is connected must provide a raw socket or rfc2217 interface.

Installation

From within your favorite python environment type:

$ pip install julabo

Library

The core of the julabo library consists of JulaboCF, JulaboHL, JulaboMS and JulaboFC objects. To create a Julabo object you need to pass a communication object. Here is how to connect to a julabo CF31 through a raw tcp socket:

from julabo import JulaboCF, connection_for_url


async def main():
    conn = connection_for_url("tcp://controls.lab.org:17890")
    dev = JulaboCF(conn)
    await conn.open()

    ident = await dev.identification()
    status = await dev.status()
    print(f"{ident} status is: {status}")

    # read temperature:
    temp = await dev.bath_temperature()
    print(f"Bath temperature: {temp} degC")

    # start the device
    started = await dev.is_started()
    if not started:
       await cryo.start()

    # define a new set point
    await dev.set_point_1(34.56)

asyncio.run(main())

Serial line

To access a serial line based Julabo device it is strongly recommended you spawn a serial to tcp bridge using ser2net, ser2sock or socat

Assuming your device is connected to /dev/ttyS0 and the baudrate is set to 9600, here is how you could use socat to expose your device on the machine port 5000:

socat -v TCP-LISTEN:5000,reuseaddr,fork file:/dev/ttyS0,rawer,b9600,cs8,eol=10,icanon=1

It might be worth considering starting socat, ser2net or ser2sock as a service using supervisor or circus.

Simulator

A Julabo simulator is provided.

Before using it, make sure everything is installed with:

$ pip install julabo[simulator]

The sinstruments engine is used.

To start a simulator you need to write a YAML config file where you define how many devices you want to simulate and which properties they hold.

The following example exports 1 hardware device with a minimal configuration using default values:

# config.yml

devices:
- class: JulaboCF
  package: julabo.simulator
  transports:
  - type: serial
    url: /tmp/julabo-cf31
    baudrate: 9600

To start the simulator type:

$ sinstruments-server -c ./config.yml --log-level=DEBUG
2020-09-01 21:04:43,172 INFO  simulator: Bootstraping server
2020-09-01 21:04:43,173 INFO  simulator: no backdoor declared
2020-09-01 21:04:43,173 INFO  simulator: Creating device JulaboCF ('JulaboCF')
2020-09-01 21:04:43,186 INFO  simulator: Created symbolic link "/tmp/julabo-cf31" to simulator pseudo terminal '/dev/pts/4'
2020-09-01 21:04:43,186 INFO  simulator.JulaboCF[/tmp/julabo-cf31]: listening on /tmp/julabo-cf31 (baud=9600)

(To see the full list of options type sinstruments-server --help)

You can access it as you would a real hardware. Here is an example using python serial library on the same machine as the simulator:

$ python
>>> from julabo import JulaboCF, connection_for_url
>>> conn = connection_for_url("serial:///tmp/julabo-cf31", concurrency="syncio")
>>> dev = JulaboCF(conn)
>>> conn.open()
>>> print(dev.identification())
JULABO CRYOCOMPACT CF31 VERSION 5.0

Tango server

A tango device server is also provided.

Make sure everything is installed with:

$ pip install julabo[tango]

Register a julabo tango server in the tango database:

$ tangoctl server add -s Julabo/test -d JulaboCF test/julabo/1
$ tangoctl device property write -d test/julabo/1 -p url -v "tcp://controls.lab.org:17890"

(the above example uses tangoctl. You would need to install it with pip install tangoctl before using it. You are free to use any other tango tool like fandango or Jive)

Launch the server with:

$ Julabo test

TODO

  • Add on_connection_made callback to initialize controller with:
    • support for async local serial line connection
    • cache identification()

julabo's People

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

julabo's Issues

Other Julabo Chillers

Would this work for Julabo MA, MC, EH, or HE chillers? if not could it be adapted to that purpose?

Request for contribution

Hello,

do you have a contribution policy on your mind. If not, I would like to suggest allowing one of two contribution policies for github.

Looking forward to our cooperation!
Mišo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.