GE Pace library
Project description
GE Pace library
This library is used to control basic features of a GE Pressure Automated Calibration Equipment (Pace) models 1000, 5000 and 6000.
It is composed of a core library, an optional simulator and an optional tango device server.
It has been tested with the Pace 5000 model, but should work with other models.
It can be used with either the ETH or the serial line connection (read below on the recommended way to setup a serial line connection)
Installation
From within your favorite python environment type:
$ pip install gepace
Library
The core of the gepace library consists of Pace object. To create a Pace object you need to pass a communication object.
The communication object can be any object that supports a simple API consisting of two methods (either the sync or async version is supported):
-
write_readline(buff: bytes) -> bytes
orasync write_readline(buff: bytes) -> bytes
-
write(buff: bytes) -> None
orasync write(buff: bytes) -> None
A library that supports this API is sockio (gepace comes pre-installed so you don't have to worry about installing it).
This library includes both async and sync versions of the TCP object. It also supports a set of features like reconnection and timeout handling.
Here is how to connect to a GE Pace controller:
import asyncio
from sockio.aio import TCP
from gepace import Pace
async def main():
tcp = TCP("192.168.1.123", 5000) # use host name or IP
pace = Pace(tcp)
idn = await pace.idn()
name = await pace.name()
print("Connected to {} ({})".format(idn, name))
# channel access:
temp_A = await pace['A'].temperature()
unit = await pace['A'].unit()
print("Channel A temperature: {}{}".format(temp_A, unit))
# loop access:
source_1 = await pace[1].source()
print("Loop 1 source: {}".format(source_1))
# activate control
await pace.control(True)
# hardware only accepts queries every 100ms. Yo can, however,
# group queries in single request:
async with pace as group:
pace.idn()
pace.control()
pace['A'].temperature()
idn, ctrl, temp_A = group.replies
asyncio.run(main())
Serial line
To access a serial line based Pace device it is strongly recommended you spawn a serial to tcp bridge using ser2net or socat
Assuming your device is connected to /dev/ttyS0
and the baudrate is set to 19200,
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,b19200,cs8,eol=10,icanon=1
It might be worth considering starting socat or ser2net as a service using supervisor or circus.
Simulator
A Pace simulator is provided.
Before using it, make sure everything is installed with:
$ pip install pace[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 2 hardware devices. The first is a minimal configuration using default values and the second defines some initial values explicitly:
# config.yml
devices:
- class: Pace
package: gepace.simulator
transports:
- type: tcp
url: :5000
To start the simulator type:
$ sinstruments-server -c ./config.yml --log-level=DEBUG
2020-05-14 16:02:35,004 INFO simulator: Bootstraping server
2020-05-14 16:02:35,004 INFO simulator: no backdoor declared
2020-05-14 16:02:35,004 INFO simulator: Creating device Pace ('Pace')
2020-05-14 16:02:35,080 INFO simulator.Pace[('', 5000)]: listening on ('', 5000) (newline='\n') (baudrate=None)
(To see the full list of options type sinstruments-server --help
)
You can access it as you would a real hardware:
$ nc localhost 5000
*IDN?
GE,Pace5000,204683,1.01A
or using the library:
$ python
>>> from sockio.sio import TCP # use synchronous socket in the CLI!
>>> from cryocon import CryoCon
>>> cryo = CryoCon(TCP('localhost', 5000))
>>> print(cryo.idn())
Cryo-con,24C,204683,1.01A
Tango server
A tango device server is also provided.
Make sure everything is installed with:
$ pip install cryocon[tango-ds]
Register a cryocon tango server in the tango database:
$ tangoctl server add -s CryoConTempController/test -d CryoConTempController test/cryocon/1
$ tangoctl device property write -d test/cryocon/1 -p address -v "tcp://192.168.123:5000"
(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:
$ CryoConTempController test
TODO
- Add
on_connection_made
callback to initialize controller with:- unit=
K
- cache IDN, fw revision, hw revision
- should we cache system:name? and input:name? in theory in could be modified directly with the hardware front panel
- unit=
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file gepace-0.2.0.tar.gz
.
File metadata
- Download URL: gepace-0.2.0.tar.gz
- Upload date:
- Size: 12.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0.post20200714 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c77c7d32f5278e91338390a7ace3e8aecc9b5639ec22699bfe5db06d7f2a12ee |
|
MD5 | 4d8117b1db07e23869b487fb8cb124e8 |
|
BLAKE2b-256 | ab6efa30999cb32934bcdf185ccb7730aebbcbc0bec4c7eac21745b4c44884cd |