Beamline controls (EPICS/Bluesky)
EPICS
EPICS (Experimental Physics and Industrial Control System) is a set of Open Source software tools, libraries and applications developed collaboratively and used worldwide to create distributed soft real-time control systems for scientific instruments such as a particle accelerators, telescopes and other large scientific experiments. Light Sources in the US (e.g. APS, NSLS-II, SLAC) and around the world (e.g., Diamond Light Source (UK), BESSY (Berlin), Swiss Light Source) use EPICS for their beamline controls.
It mostly consists of servers (called Input/Output Controllers or IOCs) who perform real-world I/O and local control tasks, and publish this information to clients using the Channel Access (CA) that can be accessed through the network using Process Variables (PV.)
{image of example of IOC} --- {image of example of channel access}
Notes:
the latest version of EPICS is EPICS v7, which started when ideas from EPICS v3 and EPICS v4 merged (there is no EPICS v5 or v6)
EPICS is not straightforward to install on a Windows machine
help can be summoned at tech-talk@aps.anl.gov and in the Bluesky Mattermost space
There is no graphical user interface, but many motors can be conveniently displayed using medm (or CS-Studio Phoebus)
Here's an example on how to create a small interactive window for a generic motor with a PV name DMC02:E :
medm -x -macro “P=DMC02:, M=E” ~/bin/bl531/display-files/adl/motorx_all.adl
SynApps is a collection of software tools that help to create a control system for beamlines. It contains beamline-control and data-acquisition components for an EPICS based control system. It has a lot of IOC readily available for common motors.
EPICS works best when the motors and sensores are on a ethernet subnet, but some motors do work with USB, it may be a good idea to create a dedicate server to run the IOC next to the device: EPICS on Raspberry Pi
EPICS tutorials
Practical EPICS Training, IOC Basics (Kevin Peterson, X-ray Science Division Beamline Controls and Data Acquisition, Argonne National Laboratory, 2023)
EPICS conventions
https://www.aps.anl.gov/BCDA/EPICS-Process-Variable-Naming-Conventions
https://wiki.bnl.gov/nsls2controls/index.php/Standards-Naming_Convention_Signal_Names
EPICS emulation
EPICS Cheat sheet
download pdf
Bluesky
The Bluesky is a data collection framework in python
https://blueskyproject.io/bluesky/
pip install bluesky
Queueserver
https://blueskyproject.io/bluesky-queueserver/
Bluesky Queue Server is a set of tools that provide alternative method for executing Bluesky plans. Traditionally Bluesky was used interactively from IPython environment as demonstrated in Bluesky tutorials. A session would start by loading startup scripts that define beamline-specific devices and plans and then interactively running plans one-by-one from IPython prompt or executing a script that runs a sequence of plans. Interactive IPython workflow is currently the most common way to use Bluesky.
Alternatively, the Queue Server allows to run Bluesky in a dedicated Python process (Run Engine worker environment). The worker environment is created and managed by Run Engine (RE) Manager (see start-re-manager), which could be run as an application or a service. Bluesky plans are executed by populating and starting the plan queue maintained by RE Manager. The queue is editable and can be modified by users at any time: queue items may be added to the queue, replaced (edited), moved to different positions and removed from the queue.
Tiled
https://blueskyproject.io/tiled/
Tiled is a data access service for data-aware portals and data science tools. Tiled has a Python client and integrates naturally with Python data science libraries, but nothing about the service is Python-specific; it also works from a web browser or any Internet-connected program.
(see also databroker )
BLOP
Beamline optimization (blop) is a python package that allows to perform automated beamline alignment using the bluesky framework. It is maintaineed by Tom Morris and Max Rakitin from National Synchrotron Light Source II at Brookhaven National Laboratory.
https://nsls-ii.github.io/bloptools/
python3 -m pip install bloptools
Video tutorial
Bloptools hands-on workshop (Tom Morris, August 11, 2023)
sirepo-bluesky
sirepo-bluesky is a python package that allows you to switch between a real beamline controls and a surrogate
https://nsls-ii.github.io/sirepo-bluesky/