Skip to main content

ATLAS ITK Pixels Multi-Module Cycling Box environmental monitoring/control (RS232)

Project description

Serial port handling for the ATLAS ITK pixels multi-module cycling box

PyPI version

image

Particle Physics, University of Liverpool, UK

Features

This repository provides command line tools to monitor and control equipment in the ATLAS ITK pixels multi-module cycling box test setup. It is used in the test setups for a number of other projects. Interactions with these instruments are performed via FTDI USB to RS232 adaptors.

Main commands

Command Function
dmm Reads voltage/current values from the Keithley DMM6500 6.5 digit multimeter.
iv Configurable script to measure IV/IT curves using the Keithley 2410/2614b (RS232). It can operate multiple PSUs concurrently, embed environmental data into log files, and can be easily used in shell scripts to automate tasks such as HV-cycling.
psuset Sets current/voltage parameters for power supplies (RS232: Keithley 2410/2614b, Hameg HMP4040). Works in both constant voltage and constant current modes.
ult80 Queries and/or sets parameters for the ULT80 chiller (RS232).

ZeroMQ serial port server

The following commands use the ZeroMQ serial port server to interact with instrumentation connected via FTDI USB to RS232 adaptors, rather than interacting with the devices directly as the commands above do.

Command Function
rs232_zmq_server Provides shared, parallel access to RS232 instruments. Concurrent requests to the same serial port are serialised by order of arrival since interactions with a given serial port is managed by a single thread specific to that serial port.
zpsustat Replacement for psustat. This supports requests for information on specified, individual PSU channels only. This command does not (yet) support use without arguments, as psustat does to display status of all PSUs.
zpsuset Drop-in replacement for psuset.
zult80 Drop-in replacement for ult80.

Support commands

Command Function
detect Detects equipment attached by RS232, writes a cache file containing identified equipment to ~/.cache.json. Run once after the RS232 configuration has changed.
mmcb_cache Displays the contents of the cache file (~/.cache.json) in human-readable form.
liveplot Companion to iv. Displays IV plot in real-time in a graphical window.
psustat Provides a single-shot view of the status of all power supply channels (RS232: Keithley 2410/2614b, Hameg HMP4040).

History

The files in this repository were originally part of the atlas-mmcb-avt repository, which used to handle monitoring and control of equipment attached via I2C, GPIO and serial port. To support the serial port interaction being run on a conventional Intel DAQ computer, these functions were split into two packages. All RS232 serial port interaction code is now contained in this package.

The Raspberry Pi specific aspects (I2C environmenal monitoring and Peltier device polarity switching via GPIO) remain in the atlas-mmcb-avt repository, which no longer contains any serial port capability.

Documentation

For project documentation, see the wiki, or each command's in-built help, e.g. psustat --help.

Installation

This software is publically available and may be obtained from The Python Package Index.

This repository provides also a wheel (.whl) file that is installable with pip. See the packaging directory for installation instructions.

Support

Support requests to avt@hep.ph.liv.ac.uk or via the Issue Tracker.

Installation notes

Yoctopuce sensors

In addition to the dependencies installed with pip, testing ATLAS sensors on the old probestation (for convenience) will also require the Yoctopuce Command line API. Please install the correct version for your architecture - this will provide commands such as YTemperature and YHumidity to monitor the probestation interior state from the command line.

Install the archive (e.g. Cmdlines.linux_arm.70284.zip) into ~/dev and then set the path to include ~/dev/Cmdlines/Binaries/linux/aarch64, e.g. PATH=$PATH:~/dev/Cmdlines/Binaries/linux/aarch64.

ZeroMQ serial port server

This is based on the ZeroMQ Majordomo pattern, and has a separate thread managing each serial port.

(base) [pixeldaq@atldaq1 ~]$ rs232_zmq_server -h
usage: rs232_zmq_server [-h] [-v] [-n]

ZeroMQ server (broker and workers) for the ATLAS Pixels multi-module cycling box serial port devices. This server manages
concurrent access to serial port resources for all attached clients. Commands line scripts emulated are psuset, psustat
and ult80. WARNING: ANY attached client has the authority to change ANY power supply or chiller parameter at ANY time.
Clients (PID control loops) running concurrently must ensure that they only modify their own resources, and not those of
other clients.

options:
  -h, --help     show this help message and exit
  -v, --verbose  Enable logging.
  -n, --nolock   Disable the use of the global rs232 lock. For safety this script will use the global rs232 lock by
                 default. This lock is a coarse measure that should prevent concurrent serial port access, even to
                 different ports, by this server and other command line scripts that may access serial port resources.
                 When running multiple concurrent asynchronous PID control scripts, using -n allows optimal sharing of
                 serial port resources between those scripts.

If you want the best performance from PID scripts, start the server with -n. If you need to use command line utilities (psuset, psustat, etc.) in parallel with PID scripts, then omit the -n.

Start

(base) [pixeldaq@atldaq1 ~]$ nohup rs232_zmq_server </dev/null >/dev/null 2>&1 &
(base) [pixeldaq@atldaq1 ~]$ disown

Stop

(base) [pixeldaq@atldaq1 ~]$ ps -ef | grep rs232_zmq_server
pixeldaq 18079 17527  0 12:00 pts/16   00:00:12 /usr/local/bin/python3 /home/pixeldaq/.local/bin/rs232_zmq_server
pixeldaq 26239 17527  0 12:51 pts/16   00:00:00 grep --color=auto rs232_zmq_server
(base) [pixeldaq@atldaq1 ~]$ kill 18079

Test

(base) [pixeldaq@atldaq1 ~]$ pip show mmcb-rs232-avt
WARNING: Ignoring invalid distribution ~ip (/home/pixeldaq/miniconda3/lib/python3.13/site-packages)
Name: mmcb-rs232-avt
Version: 1.1.28
Summary: ATLAS ITK Pixels Multi-Module Cycling Box environmental monitoring/control (RS232)
Home-page: https://gitlab.ph.liv.ac.uk/avt/atlas-itk-pmmcb-rs232
Author: Alan Taylor
Author-email: avt@hep.ph.liv.ac.uk
License:
Location: /home/pixeldaq/miniconda3/lib/python3.13/site-packages
Requires: matplotlib, numpy, pandas, pyserial, tables, yoctopuce, zmq
Required-by:

(base) [pixeldaq@atldaq1 ~]$ python
Python 3.13.2 | packaged by Anaconda, Inc. | (main, Feb  6 2025, 18:56:02) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from mmcbrs232 import mdclientlib
>>> mdclientlib.__version__
'1.1.28'
>>> mdc = mdclientlib.Rs232()
>>> mdc.
mdc.channels           mdc.get_pt_i(          mdc.get_ult80_temps()  mdc.psu_set(           mdc.psus
mdc.client             mdc.get_pt_v(          mdc.ports              mdc.psu_unset(         mdc.settings
>>> mdc.get_ult80_temps()
(23.0, 23.0)
>>> mdc.get_pt_v(103877, 2)
0.3

Latency for common operations

(base) [pixeldaq@atldaq1 ~]$ ipython
Python 3.13.2 | packaged by Anaconda, Inc. | (main, Feb  6 2025, 18:56:02) [GCC 11.2.0]
Type 'copyright', 'credits' or 'license' for more information
IPython 9.6.0 -- An enhanced Interactive Python. Type '?' for help.
Tip: You can use LaTeX or Unicode completion, `\alpha<tab>` will insert the α symbol.

In [1]: from mmcbrs232 import mdclientlib

In [2]: mdc = mdclientlib.Rs232()

In [3]: %timeit mdc.get_ult80_temps()
63.9 ms ± 26.4 μs per loop (mean ± std. dev. of 7 runs, 10 loops each)

In [4]: %timeit mdc.get_pt_v(103877, 2)
204 ms ± 8.58 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

In [5]: %timeit mdc.psu_set(103877, 2, 0.3, 4.95)
1.12 s ± 4.58 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

In [6]: %timeit mdc.psu_unset(103877, 2, 0.3, 4.95)
1.12 s ± 7.78 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

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

mmcb_rs232_avt-1.2.1.tar.gz (109.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mmcb_rs232_avt-1.2.1-py3-none-any.whl (122.7 kB view details)

Uploaded Python 3

File details

Details for the file mmcb_rs232_avt-1.2.1.tar.gz.

File metadata

  • Download URL: mmcb_rs232_avt-1.2.1.tar.gz
  • Upload date:
  • Size: 109.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for mmcb_rs232_avt-1.2.1.tar.gz
Algorithm Hash digest
SHA256 1c3c6524e269b8bc4fe84a2bf92a62f0c29a635b60b612c55e6c7d1e31901c46
MD5 536e88c90e1e34e53b603588cea7c47b
BLAKE2b-256 007e864d1fa57b1bdb87d1a83b22460de7fa6bdc173f31b41d849461428f199e

See more details on using hashes here.

File details

Details for the file mmcb_rs232_avt-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: mmcb_rs232_avt-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 122.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for mmcb_rs232_avt-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 28feba56f2a77418a527b21d3bae0b030fa5885e917432e26316e97203d9b7c9
MD5 518a4588ae5a049d0cc584a20dc6aa19
BLAKE2b-256 8d114016b78749aa19cf21f07e7d2e33256895ac7155f76305e9dfb8b0b0946b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page