Difference between revisions of "SBS EPICS"

From Hall A Wiki
Jump to: navigation, search
(Add GEMGasApp)
(Move page to SBS wiki)
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
__TOC__
+
This page has moved to the [https://sbs.jlab.org/wiki/index.php/SBS_EPICS SBS Wiki].
 
+
The High voltage for PMTs and GEMs for SBS experiments use at least 4
+
different types of power supplies.  These include:
+
 
+
* 5 Lecroy mainframes
+
* A Caen 1527 mainframe
+
* A Wiener Mpod mainframe for (UVA) GEM detectors
+
* CAEN VME V6521 cards for (INFN) GEM detectors
+
* CAEN 4527 mainframe(s) (possible use for GeN-RP)
+
 
+
Each of these systems has a vendor or lab developed graphical or web
+
interface.  In order to simplify operations, EPICS controls have been
+
implemented for all these systems.
+
 
+
== User control of high voltage ==
+
 
+
EPICS Graphical interfaces will implemented for all the HV under EPICS
+
control.  These interfaces will include the ability to backup and
+
restore HV settings.
+
 
+
The various types of high voltage mainframes have vendor or user
+
supplied control interfaces that don't use EPICS.  These interfaces
+
will continue to work.
+
 
+
== HV Alarms ==
+
For each HV channel, a voltage difference (VDiff) EPICS signal is provided.  Alarm limits are places on
+
these signals so that shift workers will be notified via the alarm handler if a channel trips off or
+
if the actual voltage provided by the channel differs from the set voltage.  By default, a minor alarm is raised if the monitored voltage is more than 25 volts above or below the set voltage, and a major alarm is raised
+
if the voltage is more than 50 volts away from the set voltage.  These limits may be changed for individual channels
+
using the alarm handler.
+
 
+
==EPICS Software==
+
 
+
The master copy of the EPICS HV controls for SBS are in the directory
+
<code>~aslow/EPICS</code> on adaqsc.  The <code>EPICS</code> directory contains the following
+
directories:
+
 
+
; base-3.15.8 : The base EPICS distribution from https://epics.anl.gov/
+
; clas12-epics-third-party-libs : Contains CAEN libraries that are needed for the communicating with SY1527 HV crates
+
; sbs-epics : Contains the source code for EPICS support to provide IOCs (Input Output Controllers) for all the models of HV crates in use. Also contains configuration files to define EPICS signals for all the HV channels in use.
+
 
+
The base-3.15.8 and sbs-epics directories are also installed on the
+
Raspberry Pi for each Lecroy Mainframe and on sbsvme27 for controlling
+
CAEN VME HV cards.
+
 
+
<code>sbs-epics/apps</code> contains these source code/configuration directories:
+
 
+
; Alias4527 : Mirrors 4527 crate signals to provide "fake" readback signals. (See [[#CAEN 4527|CAEN 4527]] section below)
+
; caenHvApp : Code and configuration for CAEN SY1527 mainframes.  (Used by BigBite hodoscope)
+
; caenV65XXApp : Code and configuration for CAEN VME HV cards.  (Used by GEM detectors
+
; iocBoot : Scripts to start the IOCs for each of the HV systems
+
; lecroyApp : Code and configuration for RPi enabled Lecroy Mainframtes
+
; procServ:2.6-0App : A wrapper for running the EPICS IOCs
+
; snmpApp : Code and configuration for communicating with SNMP systems. Used for Wiener HV.
+
; syX527App : Library routines needed by caenHvApp
+
; GEMGasApp : Soft Channel records for BB Gas system
+
 
+
This code is compiled by running make from sbs-epics/apps.  The
+
Makefiles in some of the above source code directories are setup to
+
compile only under certain conditions:
+
 
+
caenHvApp and syX527App will only be compiled if the
+
<code>clas12-epics-third-party-libs</code> directory exists.
+
 
+
snmpApp will only be compiled if snmp support is installed on the
+
operating system.  (By checking if
+
<code>/usr/include/net-snmp/net-snmp-config.h</code> exists.)
+
 
+
caenV65XXApp is only compiled if '''LINUXVME_INC''' is defined.
+
 
+
===Crate Numbering===
+
 
+
Every high voltage mainframe must be assigned a unique crate/mainframe
+
number.  For the Lecroy crates, this crate number is automaticallly
+
assigned from the Raspberry Pi hostname.  If the hostname is of the
+
form rpiNN, then NN is the crate number.  Other HV system types are
+
assigned a crate number manually.  The following mainframes are in use
+
for the SBS eperiments:
+
 
+
    0 CAEN1527  BigBite Hodoscope
+
    8 Lecroy   HRS Left
+
    17 Lecroy   BigBite
+
    18 Lecroy   BigBite
+
    20 Lecroy   Hcal
+
    21 Lecroy   Hcal
+
    91 MPOD   UVA GEM HV
+
    92 CAEN V6521 INFN GEM HV
+
    93  CAEN4527  GeN-RP
+
 
+
===EPICS PV Naming Convention===
+
 
+
The EPICS Process Variables (PVs) for individual HV channels are
+
chosen to have a consistent form, independent of hardware.  The form is
+
chosen to match the built in EPICS on CAEN4527 mainframes.  The use of
+
consistent PV naming convention allows for GUIs that are independent
+
of hardware.
+
 
+
EPICS PVs for HV have the form
+
 
+
"%s%d:%.2d:%.3d:%s", prefix, crate, slot, channel, property
+
 
+
where prefix is a string unique to Hall A ("HAHV"), crate is a
+
mainframe number (from 0 to 99), slot is a card # within a mainframe
+
(0-99), channel is the channel number within a card (0-999) and
+
property is the attribute to be written or read.  For example, the monitored voltage (VMon property)
+
for crate 7, slot 5, channel 3 will have the PV "HAHV7:05:003:VMon".
+
 
+
Properties common to all hardware types are:
+
 
+
    V0Set  (w) Voltage setting for a channel
+
    V0Setr (r) Readback of voltage setting
+
    VMon  (r) Monitored/measured voltage
+
    I0Set  (w) Setting for Current at which to trip channel
+
    I0Setr (r) Readback of trip current setting
+
    IMon  (r) Measured current
+
    Pw    (w) (0/1) Turn off or on the channel
+
    Pwr    (r) Readback of on/off status
+
    RUp    (w) Ramp rate in V/s when turning on channel
+
    Rupr  (r) Readback of ramp up rate
+
    RDWn  (w) Ramp down rate in V/s when turning off channel
+
    RDWnr  (r) Readback of ramp up rate
+
    VDiff  (r) Difference between set and monitor voltage.  Used for alarms.
+
 
+
These property names are chosen to be consistent with the property
+
names of the CAEN4527 built in EPICS.
+
 
+
==Building GUI screens==
+
 
+
If detector HV is changed due to bad channels or other reasons, control
+
screens will need to be rebuilt.  The software to generate GUI screens is being developed and will be documented here when it is ready.
+
 
+
==ProcServ and ProcServMgr==
+
On systems where the EPICS IOCS (servers) run, a cron task is
+
configured to periodically run ProcServMgr.  ProcServMgr looks at the
+
file <code>sbs-epics/apps/iocBoot/procServMgr.conf</code> to determine which IOC
+
tasks need to run on that system and starts any IOCs that are not
+
running.  The IOC tasks are run by ProcServ which allows experts to
+
login to the IOC with the command <code>telnet PORT</code> where the
+
PORT number is defined in <code>ProcServMgr.conf</code>.
+
 
+
==Hardware specific notes==
+
 
+
===Lecroy===
+
 
+
Hall A has a large number of Lecroy Mainframes.  These were controlled
+
either by ARCnet or RS232.  Several years ago, the PC boards in each
+
of these mainframes was replaced with Raspberry Pi boards that
+
communcate with the mainframe via a custom serial board developed by
+
Javier Gomez and Jack Segal.  Two processes run on each board.  A process
+
that communicates with the HV cards (written by J. Gomez) and a
+
process (shim) (written by Brad Sawatzky) that mimics the original
+
ARCnet/RS232 command set, except that it uses TCP/IP.  This is further
+
described in [[HV HowTo for Experts]].
+
 
+
In 2000, Chris Slominski developed an EPICS driver for the Lecroy
+
mainframes that communicated with ARCnet.  This driver has been
+
adapted to use the TCP/IP interface that the modified Lecroy
+
mainframes now provide.
+
 
+
A single linux IOC can be configured to support multiple mainframes or
+
an IOC can be run on each rPI board.  For the SBS HV, the later method
+
is used.  Each mainframe is configured to create create EPICS signals
+
for the installed HV cards.
+
 
+
To install EPICS on a Lecroy Mainframe, use the following steps.
+
 
+
# Setup a rpi with a hostname of rpiN, where N is not an<!--
+
--> existing HV crate number (See "Crate Numbering" section).<!--
+
--> (Unless it is replacing an existing crate.)
+
# Insure that the rPI board in the mainframe has the<!--
+
--> software prerequisites to compile C programs (gcc,<!--
+
--> ncurses, readline) and the perl modules needed by the<!--
+
--> shim (IO-Multiplex, Net-Server, IO-Tty, Expect).  If<!--
+
--> the JAVA GUI already works with this mainframe,<!--
+
--> then these prerequisites are installed.  If they<!--
+
--> are not, ask the Spectrometer Support Group to<!--
+
--> prepare an RPI with these prerequisites.
+
# Obtain the files scripts.tar.gz, lecroy_servers.tar.gz<!--
+
--> and epics.tar.gz and place them in the home<!--
+
--> directory of the pi account on the rPI.  These<!--
+
--> can be found in the directory <code>~/EPICS/RPI</code> of the<!--
+
--> <code>aslow@adaqsc</code> account.
+
# Untar all three files into the pi account home directory.
+
# Type <code>crontab -r</code> and <code>~/scripts/kill_hv_all</code> to kill<!--
+
--> and disable old versions of the Lecroy software.
+
# Type <code>crontab ~/scripts/cron.tab</code>
+
# Wait 5 minutes and check that an "i2lchv" process<!--
+
--> and a "LecroyHV_shim" procees is running.
+
# Check that the EPICS server is running with<!--
+
--> <code>telnet localhoset 20000</code>.  You should see the<!--
+
--> <code>epics></code> prompt.  Typing <code>dbl</code> should show a long<!--
+
--> list of EPICS signal names starting with "HAHV91".
+
 
+
====Lecroy Cron job====
+
 
+
The cronjob that is setup with <code>crontab ~/scripts/cron.tab</code> run the
+
script <code>start_hv_cron_new</code> every four minutes.  This script checks
+
that each of the servers, i2lchv, the shim and the epics server is
+
running.  It will start any server that is not running.
+
 
+
If the EPICS server is not running, <code>start_hv_cron_new</code> will first run
+
<code>~/scripts/configure_epics.py</code>.  This python script does several
+
things.
+
 
+
# Determines the mainframe/crate number from the hostname rpiN.
+
# Reads the file <code>/home/pi/scripts/LecroySlotList.txt</code> to find which # slots are occupied and what type of module is in each slot.  Currenly, only 1461N, 1461P and 1471N cards are supported.
+
# Using the slot information, define epics signals for every HV # channel in the crate by writing the file <code>LecroyHV.substitutions</code> to <code>/home/pi/epics/sbs-epics/apps/db/</code>. 
+
 
+
===CAEN 1527===
+
 
+
The CAEN1527 is used for the BigBite hodoscope.  It is instrumented
+
with four 48 channel A1932 cards.  These cards differ from most other
+
HV cards.  There is a single primary power supply and 48 secondary
+
channels which supply the PMTs.  The voltage on the primary supply can
+
be set to an arbitrary value.  The secondary channels can only be set
+
to the primary voltage or less.  Not all attributes are availabe on
+
both primary and secondary channels.  When an attribute doesn't exist,
+
the GUI will show -1.0.
+
 
+
===Wiener MPOD===
+
 
+
UVA GEM modules.  Wiener MPOD systems are controlled by SNMP (Simple
+
Network Management Protocol).  The standard EPICS
+
[https://groups.nscl.msu.edu/controls/files/devSnmp.html SNMP EPICS
+
driver] is used.
+
 
+
The IOC for the Wiener MPOD system runs on adaqsc.  It is started by
+
[[#ProcServ|ProcServMgr]].
+
 
+
===CAEN VME V6521 cards===
+
 
+
CAEN VME V6521 cards are used for the INFN GEM detectors.  These cards
+
do not use a custom HV mainframe, just a regular VME crate.  This
+
EPICS driver for these cards runs on the Linux Single board computer
+
(sbsvme27) in the VME crate with the cards.  The driver software for
+
these cards is in <code>sbs-epics/apps/caenV65XXApp</code> and the startup script for the IOC
+
is <code>sbs-epics/apps/iocBoot/iocv65xx/st.cmd</code>.  Slot number used in the EPICS PVs is
+
not the physical slot but rather the logical slot, where slot 0 is the
+
first card defined, slot 1 is the second card defined etc.  The cards
+
are defined with the command
+
 
+
  V65XXInit(Ncards, baseaddr, incaddr)
+
 
+
in <code>st.cmd</code>.  For exmple, <code>V65XXInit(3, 0xa00000,
+
0x100000)</code> will define "slots" 0-2 with VME addresses
+
<code>0xa00000, 0xb00000, and 0xc00000</code>.
+
 
+
===CAEN 4527===
+
The CAEN 4527 is a relatively modern high voltage system.  It may be used for some SBS experiments
+
such as GeN-RP.
+
 
+
The CAEN 4527 has built in EPICS.  The EPICS server can be enabled in the mainframe's web interface.
+
The EPICS PV name prefix (e.g. "HAHV") and mainframe number are also set in this interface.
+
 
+
The CAEN 4527 EPICS interface does not supply separate signal names for setting and readback of setting.
+
For example, the PV HAHV93:00:000:V0Set is used both to set the voltage and to readback the voltage
+
setting.  In order provide compatibility with the other EPICS drivers, the Alias4527 app is run.  This
+
app mirrors each of writable signal names to provide a "fake" readback signal.  The Alias4527 also provides a VDiff
+
signal for each channel for alarms.
+
 
+
These mirror signals are configured in the file
+
<code>sbs-epics/apps/Alias4725App/SY4527_crate93.substitutions</code>.  (Assuming that the 4527 mainframe number is 93.)
+

Latest revision as of 10:33, 7 December 2021

This page has moved to the SBS Wiki.