Wiki

Clone wiki

midas / MSetPoint

MSetPoint

MSetPoint is a system designed to control a beam line at an accelerator facility using the EPICS Channel Access interface. It is inspired by the SetPoint system from PSI, Switzerland, but implemented as a custom page within MIDAS, complemented by a general EPICS front-end program.

Prerequisites

Please install EPICS before installing MIDAS. You can find the software and installation instructions at:

https://epics.anl.gov/download/index.php

Usually it's enough to download the EPICS Base 7.x tar ball, un-tar it, run make, and then define following environment variables (usually in .zshenv, .profile, .bashrc etc depending on your shell):

  • Put the EPICS executables directory into the PATH. Usually something like /usr/local/epics-7.x.x/bin/linux-x86_64
  • Define EPICS_CA_ADDR_LIST with the name and port of the EPICS gateway. At PSI this is hipa-cagw:5062
  • Define the EPICSSYS variable to point to the installation directory, like /usr/local/epics/base-7.x.x

Especially the EPICSSYS is important for MIDAS to find the EPICS libraries to link against.

Now test if everything is working by requesting a channel like

$ caget MHC4:IST:2
(Note: this is the value of the main accelerator proton current at PSI)

If you see a no error there, the installation is good.

Installation

To install MSetPoint, follow these steps:

$ cd midas/msetpoint
msetpoint $ mkdir build
msetpoint $ cd build
msetpoint/build $ cmake ..
  • Load the msetpoint.json script. This turns MIDAS into a stand-alone MSetPoint system by changing the system menu and enables the MSetPoint custom page:
$ cd midas/msetpoint
msetpoint $ odbedit -q -c "load msetpoint.json"
  • Now you have to load a beamline configuration. This file defines which beamline elements are present and which commands they use for setting and getting values. A sample beamline form PSI is part of the distribution:
$ cd midas/msetpoint
msetpoint $ odbedit -q -c "load pie5.json"

Usage

The MSetPoint system utilizes two pages for controlling a beam line with multiple elements. The MSetPoint page allows users to adjust the demand values for all elements. In contrast, the MSPConfig (MIDAS Set-Point Configuration) page is designed for experts to configure the entirety of the beam line elements.

MSetPoint

An example of the MSetPoint page is shown here:

MSetPoint.png

To modify a value for an element, click the number in the Set value column. After making your change, press <return>. The EPICS Frontend program will then promptly send the new value to the beamline element via EPICS Channel Access. If the EPICS Frontend isn't active, you can still change the value, but there will be no effect. Ensure the program is running by checking the "Programs" page. If the EPICS Frontend isn't active, a warning will appear at the top of the page.

Beamline settings can be saved in two ways:

  • On the server where MIDAS is running. These files then go into the $MIDAS_DIR/userfiles/msetpoint subdirectory and can be loaded from there. The $MIDAS_DIR environment variable will be defined during the MIDAS installation above. The advantage of this method is that everybody connected to the same MSetPoint on browsers on various different computers will see the same set of files.

  • Via Import / Export on your local computer. This allows to store a file locally where the browser is running. The advantage is that you can open the JSON-encoded setting file with other programs and process it further.

The interface also permits direct command sending to devices, such as turning a device on and off. To execute this, select one or more devices by clicking on their names (press <Ctrl> or <Shift> to select multiple devices) and then click on "Command". A predefined set of commands will appear. By clicking on one, the command will be dispatched to the chosen device(s).

When a settings file is loaded or imported, the values appear in the File value column. However, they aren't applied to the actual element immediately. To apply them, click on the right arrow at the top of the window. A dialog box will then open, allowing you to input a scaling factor. This factor will be applied to all magnet elements, facilitating easy tuning of the beamline to various momenta. If you retain the default value of one, the values from the file will be applied directly without any change. To apply values to only certain elements, ensure you select those elements before clicking the arrow.

MSPconfig

An example of the MSPConfig page is shown here:

MSPConfig.png

The page contains one line for each beamline element. You can define various things:

  • Name is the name shown on the MSetPoint page
  • Description is an optional description shown in the Description column of MSetPoint. If no description is defined here, the element type will be shown in the Description column.
  • Group flag. If this is checked, the element starts a new group with a bold horizontal line separating the new group from the previous one on the MSetPoint page
  • Type specifies the type of the beamline element from a pre-define set of types
  • Unit is the unit shown next to the demand and measured values. For magnets this is typically A for Ampere
  • Format specifies how a value is formatted. A value of %f2 for example shows a value with two digits after the period. A complete list of formats is listed on the MIDAS custom page documentation.
  • +/- These values will be used by the + and - buttons on the MSetPoint page to increment and decrement a demand value. Some elements are usually changed by one unit, other elements maybe by 0.1 units or 10 units.
  • Warning threshold is the deviation between the demand and measured value when the measured value will turn red. Ideally, demand and measured values are equal, but many devices have some nose on the ADC side so the measured value fluctuates a bit. To avoid annoying red boxes for normal situations, this value should be set slightly higher than the normal noise on a device readback.
  • PV name is the EPICS Channel Access Process Variable name for the device.
  • Set is the EPIC Channel to set the demand value of a channel. This is concatenated with the PV name to form the channel name. In the example above the demand channel for device #1 would be QSF41:SOL:2. This naming scheme is specific to PSI and might be different at other labs.
  • Get is the EPIC Channel to read a measured value from a channel. This is concatenated with the PV name to form the channel name. In the example above the measure value channel for device #1 would be QSF41:IST:2. This naming scheme is specific to PSI and might be different at other labs.
  • Status is the EPIC Channel to read the status from a channel. This is concatenated with the PV name to form the channel name. In the example above the status channel for device #1 would be QSF41:STA:2. This naming scheme is specific to PSI and might be different at other labs.
  • Com is the EPIC Channel to send direct commands to a channel, like for turning the device on and off. This is concatenated with the PV name to form the channel name. In the example above the command channel for device #1 would be QSF41:COM:2. This naming scheme is specific to PSI and might be different at other labs.
  • History specifies the MIDAS history panel shown when one clicks on the history button (the buttons at the very right with the waveform on them on the MSetPoint page). The history panel has to be specified as <group>/<panel> pointing to the ODB at /History/Display/<group>/<panel>. Alternatively, a 1 can be specified here to show directly the history of that element (Demand and Measured values).

The top row lets you change the main title of the MIDAS installation and the EPICS gateway. The Filename is set automatically if a configuration file gets loaded. This can be done with the Load button (from the sever) and the Import button (upload from the client). Configurations can be saved with the Save and Export buttons similarly. The format of the configuration file is simply the ODB Dump of the subtree /Equipment/EPICS/Settings in JSON format, which can also be loaded with the odbedit program as odbedit -c "load xxx.json".


S. Ritt, August 2023

Updated