- Notifications
You must be signed in to change notification settings - Fork3
tiagocoutinho/gepace
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This library is used to control basic features of a GE Pressure AutomatedCalibration Equipment (Pace) models 1000, 5000 and 6000.
It is composed of a core library, an optional simulator andan optionaltango device server.
It has been tested with the Pace 5000 model, but should work with other models.
From within your favorite python environment type:
$ pip install gepace
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 APIconsisting 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 issockio(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 alsosupports a set of features like reconnection and timeout handling.
Here is how to connect to a GE Pace controller:
importasynciofromsockio.aioimportTCPfromgepaceimportPaceasyncdefmain():tcp=TCP("192.168.1.123",5000)# use host name or IPpace=Pace(tcp)idn=awaitpace.idn()name=awaitpace.name()print("Connected to {} ({})".format(idn,name))# channel access:temp_A=awaitpace['A'].temperature()unit=awaitpace['A'].unit()print("Channel A temperature: {}{}".format(temp_A,unit))# loop access:source_1=awaitpace[1].source()print("Loop 1 source: {}".format(source_1))# activate controlawaitpace.control(True)# hardware only accepts queries every 100ms. Yo can, however,# group queries in single request:asyncwithpaceasgroup:pace.idn()pace.control()pace['A'].temperature()idn,ctrl,temp_A=group.repliesasyncio.run(main())
A Pace simulator is provided.
Before using it, make sure everything is installed with:
$ pip install gepace[simulator]
Thesinstruments engine is used.
To start a simulator you need to write a YAML config file where you definehow many devices you want to simulate and which properties they hold.
The following example exports 2 hardware devices. The first is a minimalconfiguration using default values and the second defines some initial valuesexplicitly:
# config.ymldevices:-class:Pacename:MyPressureDevicepackage:gepace.simulatortransports: -type:tcpurl::5000
To start the simulator type:
$ sinstruments-server -c ./config.yml --log-level=DEBUG2020-05-14 16:02:35,004 INFO simulator: Bootstraping server2020-05-14 16:02:35,004 INFO simulator: no backdoor declared2020-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 typesinstruments-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>>>fromsockio.sioimportTCP# use synchronous socket in the CLI!>>>fromgepaceimportPace>>>pace=Pace(TCP('localhost',5000))>>>print(pace.idn())GE,Pace5000,204683,1.01A
Atango device server is also provided.
Make sure everything is installed with:
$ pip install gepace[tango]
Register a gepace tango server in the tango database:
$ tangoctl server add -s GEPace/test -d Pace test/cryocon/1$ tangoctl device property write -d test/pace/1 -p address -v "tcp://192.168.123:5000"
(the above example usestangoctl. You would needto install it withpip install tangoctl
before using it. You are free to use any othertango tool likefandango or Jive)
Launch the server with:
$ GEPace test
- 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 modifieddirectly with the hardware front panel
- unit=
About
GEPace 1000/5000/6000 python library + simulator + tango device server