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.

https://epics.anl.gov/

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:

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 for Dummies

EPICS Cheat sheet Wiki

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

softIOC

PCASpy

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/

Autofocus

https://github.com/AI-ML-at-APS/AI-ML_Control_System